Theoremref
Statement
theorem ref : ∀ (a : ATopDec) (C : Ctx), Inv B f A C → refTop A a.erase = true → checkTopDec C a = none
| .value VE vb, C, hI, hr => by
simp only [ATopDec.erase, refTop] at hr
simp only [checkTopDec]
split
· rename_i hc
simp only [Bool.and_eq_true] at hc
haveProof
vb_not_refuted hcol hAU (C' := C.plusVE VE) (fun lc => lookSim_plusVE VE (hI.look lc)) hI.U vb hc.1.1
rw [hr] at this; cases this
· rfl
| .types TE VE db tbs, C, hI, hr => by
cases h : checkTopDec C (.types TE VE db tbs) with
| none => rfl
| some r =>
obtain ⟨E, PE⟩ := r
simp only [ATopDec.erase, refTop, Bool.and_eq_true, Bool.or_eq_true, Bool.not_eq_true'] at hr
have hH : aliasesRefuted A tbs = true ∨ aliasesAllOK A tbs = true := by
rcases hr.2 with h' | h'
· exact .inl h'
· exact .inr h'.1
have ht := types_top hcol hAU rfl hI hr.1 hH h
rcases hr.2 with h' | h'
· rw [ht.1] at h'; cases h'
· rw [ht.2.2] at h'; cases h'.2
| .port x ty U, C, hI, hr => by
simp only [ATopDec.erase, refTop] at hr
cases h : elabPort C x ty U with
| none => simp [checkTopDec, h]
| some r => rw [port_not_fails hcol hAU hI h] at hr; cases hr
| .seq a1 a2, C, hI, hr => by
simp only [ATopDec.erase, refTop, Bool.or_eq_true, Bool.and_eq_true] at hr
simp only [checkTopDec]
rcases hr with h1 | ⟨hp, h2⟩
· rw [ref a1 C hI h1]
· cases hc1 : checkTopDec C a1 with
| none => rfl
| some r1 =>
obtain ⟨E1, PE1⟩ := r1
simp only
rw [ref a2 (C.oplusE E1) (pres hcol hAU a1 C E1 PE1 hI hp hc1) h2]Proved by a term, which Lean's kernel checks directly.
Theorems it uses
Used by
In StandardElmMech/Stat/RefuseTypes.lean: Refusals by type expressions (aliases, constructor arguments, annotations, ports) and by the type of main (typesFailB, mainFailB), for every choice of generated names and variable sorts.
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.