Elm Exactly

TheoremcheckExpS_sound

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

Statement

theorem checkExpS_sound (C : Ctx) : (a : AExp) → checkExpS C a = true → ElExp C a.erase a.ty
  | .atexp a, h => by
    simp only [checkExpS] at h
    simp only [AExp.erase, AExp.ty]
    exact .r_s_exp_atexp (checkAtExp_sound C a h)
  | .app e a, h => by
    simp only [checkExpS, Bool.and_eq_true] at h
    obtain ⟨⟨h1, h2⟩, h3⟩

Proof

h
    have he := checkExpS_sound C e h1
    obtain ⟨τ, hτ⟩ := fn_of_match h3
    rw [hτ] at he
    simp only [AExp.erase, AExp.ty, hτ, Ty.cod]
    exact .r_s_exp_app he (checkAtExp_sound C a h2)
  | .lam p e, h => by
    simp only [checkExpS, Bool.and_eq_true] at h
    simp only [AExp.erase, AExp.ty]
    exact .r_s_exp_lambda (checkAtPat_sound C p h.1) (checkExpS_sound _ e h.2)
  | .caseE e m, h => by
    simp only [checkExpS, Bool.and_eq_true] at h
    obtain ⟨⟨h1, h2⟩, h3⟩ := h
    have hm := checkMatch_sound C m h2
    obtain ⟨τ', hτ⟩ := fn_of_match h3
    rw [hτ] at hm
    simp only [AExp.erase, AExp.ty, hτ, Ty.cod]
    exact .r_s_exp_case (checkExpS_sound C e h1) hm

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.