TheoremprogCheck_infer
Statement
theorem progCheck_infer : ∀ (ms : List BModule) (B : SBasis), progCheckFrom B ms = true →
∃ as, inferProgramFrom B ms = .ok as ∧ (AProgram.bases B as).isSome
| [], _, h => by simp [progCheckFrom] at h
| [m], B, h => by
simp only [progCheckFrom] at h
split at h
· rename_i a ha
split at h
· rename_i B' E hr
refine ⟨[a], ?_, ?_⟩
· simp [inferProgramFrom, ha, hr, bind, Except.bind, pure, Except.pure]
· simp [AProgram.bases, hr]
· cases h
· cases h
| m :: m2 :: ms, B, h => by
simp only [progCheckFrom] at h
split at h
· rename_i a ha
split at h
· rename_i B' E hr
simp only [Bool.and_eq_true] at h
obtain ⟨as, has, hb⟩Proof
progCheck_infer (m2 :: ms) (B.plus B') h.2
refine ⟨a :: as, ?_, ?_⟩
· rw [inferProgramFrom_cons ha hr, has]; rfl
· obtain ⟨Bs, hBs⟩ := Option.isSome_iff_exists.mp hb
simp [AProgram.bases, hr, hBs]
· cases h
· cases hProved by a term, which Lean's kernel checks directly.
Theorems it uses
Used by
In StandardElmMech/Stat/Legal.lean: The master theorems: a program whose inferred derivation checks, meets the further restrictions and gives main a Chapter 9 type is legal, under D11 (legal_of_infer1, legal_of_infer).
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.