Theoremvb_mainBad
Statement
theorem vb_mainBad {C' : Ctx} (hL : ∀ lc, LookSim f C' A lc) (hU : C'.U = []) :
∀ avb : AValBind, checkValBind C' avb = true → vbMainBad A avb.erase = true →
∃ sch, FMap.find? avb.ve "main" = some (sch, .v) ∧ badHeadB sch.body = true
| .var x ann τ e rest, h, hm => by
simp only [checkValBind, Bool.and_eq_true, decide_eq_true_eq] at h
obtain ⟨⟨⟨hann, hexp⟩, hty⟩, hrest⟩Proof
h
simp only [AValBind.erase, vbMainBad_var, Bool.or_eq_true, Bool.and_eq_true, beq_iff_eq, bne_iff_ne,
ne_eq] at hm
rw [ve_var]
rcases hm with ⟨⟨rfl, hnm⟩, hb⟩ | ⟨_, hr⟩
· have hrn : ((rest.map AValBind.ve).getD [] |>.find? "main") = none := by
cases rest with
| none => rfl
| some r =>
simp only [AValBind.eraseOpt, Option.map_some, Option.getD_some] at hnm ⊢
exact vb_noMain r hnm
rw [hrn]
simp only [FMap.find?, ite_true, Option.none_or]
refine ⟨_, rfl, ?_⟩
cases ann with
| none =>
simp only [Option.isSome_none, Bool.false_eq_true, ite_false, mono]
simp only [Option.map_none, Option.getD_none] at hb
rw [← hty]
exact forcedBad_sound _ e hexp hb
| some p =>
obtain ⟨ty, U'⟩ := p
simp only [Option.isSome_some, ite_true, annScheme, annU]
apply badHead_canon
simp only [checkAnn, Bool.and_eq_true, decide_eq_true_eq] at hann
obtain ⟨⟨hnew, hel⟩, _⟩ := hann
obtain ⟨U'', hU'', hs⟩ := ann_sim hcol hAU hL hU hnew hel
simp only [Option.map_some, Option.getD_some, annHeadBad, List.all_eq_true] at hb
have := hb U'' hU''
rw [hs] at this
exact badHead_map (hcol.fixed _ (by simp [fixedNames])) (hcol.fixed _ (by simp [fixedNames])) τ this
· cases rest with
| none => simp [AValBind.eraseOpt] at hr
| some r =>
simp only [AValBind.eraseOpt, Option.map_some, Option.getD_some] at hr
replace hrest : checkValBind C' r = true := hrest
obtain ⟨sch, hs, hb⟩ := vb_mainBad hL hU r hrest hr
refine ⟨sch, ?_, hb⟩
simp [hs]
| .pat _ _, _, hm => by simp [AValBind.erase, vbMainBad] at hmProved 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.