Elm Exactly

TheoremcheckValBind_sound

StandardElmMech/Stat/CheckSound.lean:268, Expressions · term proof

Statement

theorem checkValBind_sound (C : Ctx) : (vb : AValBind) → checkValBind C vb = true → ElValBind C vb.erase vb.ve
  | .var x ann τ e rest, h => by
    simp only [checkValBind, Bool.and_eq_true, decide_eq_true_eq] at h
    obtain ⟨⟨⟨h1, h2⟩, h3⟩, h4⟩

Proof

h
    have he := checkExpS_sound _ e h2
    rw [h3] at he
    have hr := checkValBindOpt_sound C rest h4
    have hv := ElValBind.r_s_valbind_var (x := x) (checkAnn_sound C ann τ h1) he hr
    simp only [Option.isSome_map] at hv
    simp only [AValBind.erase, AValBind.ve]
    cases rest <;> exact hv
  | .pat p e, h => by
    simp only [checkValBind, Bool.and_eq_true, decide_eq_true_eq] at h
    obtain ⟨⟨h1, h2⟩, h3⟩ := h
    have he := checkExpS_sound C e h2
    rw [h3] at he
    simp only [AValBind.erase]
    exact .r_s_valbind_pat (checkAtPat_sound C p h1) he

Proved by a term, which Lean's kernel checks directly.

Rules of the book it uses

Theorems it uses

Used by

In StandardElmMech/Stat/CheckSound.lean: The checker is sound: a phrase that checks has a derivation by the rules of Chapters 4 and 5 (checkExp_sound, checkModule_sound).

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.