Elm Exactly

Theoremsc_pat

StandardElmMech/Stat/RefuseScope.lean:600, The bare checker is sound · term proof

Statement

theorem sc_pat (C : Ctx) (Γ : Shape) (hA : Abs C Γ) : (p : APat) → checkPat C p = true →
    scPat Γ p.erase = true
  | .atpat a, h => by
    simp only [checkPat] at h
    simp only [APat.erase, scPat]
    exact sc_atPat C Γ hA 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
      simp only [APat.erase, scPat, Bool.and_eq_true]
      refine ⟨conOK_of hA hl (fun n hn => ?_), sc_atPatList C Γ hA args h2⟩
      have := genAt_arity h1.1 h1.2 hn
      rw [length_tyList] at this
      rw [length_eraseList, this]
    · cases h1
  | .cons p1 p2, h => by
    simp only [checkPat, Bool.and_eq_true] at h
    simp only [APat.erase, scPat, Bool.and_eq_true]
    exact ⟨sc_pat C Γ hA p1 h.1.1, sc_pat C Γ hA p2 h.1.2⟩
  | .as p _, h => by
    simp only [checkPat] at h
    simp only [APat.erase, scPat]
    exact sc_pat C Γ hA p h

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

Theorems it uses

Used by

In StandardElmMech/Stat/RefuseScope.lean: Refusals by scope, constructor arity and imports, for one module and for a module after a helper (scopeFailB).

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.