Elm Exactly

TheoremcheckPat_sound

StandardElmMech/Stat/CheckSound.lean:83, Patterns · term proof

Statement

theorem checkPat_sound (C : Ctx) : (p : APat) → checkPat C p = true → ElPat C p.erase p.ve p.ty
  | .atpat a, h => by
    simp only [checkPat] at h
    simp only [APat.erase, APat.ve, APat.ty]
    exact .r_s_pat_atpat (checkAtPat_sound C a h)
  | .con lc inst args τ, h => by
    simp only [checkPat, Bool.and_eq_true] at h
    obtain ⟨h1, h2⟩

Proof

h
    split at h1
    · rename_i σ hl
      simp only [Bool.and_eq_true] at h1
      obtain ⟨τs', t, rfl⟩ := isConTy_spec h1.2
      simp only [APat.erase, APat.ve, APat.ty]
      exact .r_s_pat_con hl (gen_of_genAt h1.1) (checkAtPatList_sound C args h2)
    · cases h1
  | .cons p1 p2, h => by
    simp only [checkPat, Bool.and_eq_true, decide_eq_true_eq] at h
    obtain ⟨⟨h1, h2⟩, h3⟩ := h
    have e2 := checkPat_sound C p2 h2
    rw [h3] at e2
    simp only [APat.erase, APat.ve, APat.ty]
    exact .r_s_pat_cons (checkPat_sound C p1 h1) e2
  | .as p x, h => by
    simp only [checkPat] at h
    simp only [APat.erase, APat.ve, APat.ty]
    exact .r_s_pat_as (checkPat_sound C p h)

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.