Elm Exactly

Theoremsc_atExp

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

Statement

theorem sc_atExp : (a : AAtExp) → (C : Ctx) → (Γ : Shape) → Abs C Γ → checkAtExp C a = true →
    scAtExp Γ a.erase = true
  | .scon _ _, _, _, _, _ => rfl
  | .var lv inst τ, C, Γ, hA, h => by
    simp only [checkAtExp] at h
    simp only [AAtExp.erase, scAtExp]
    exact isSome_of_lookup hA h
  | .con lc inst τ, C, Γ, hA, h => by
    simp only [checkAtExp] at h
    simp only [AAtExp.erase, scAtExp]
    exact isSome_of_lookup hA h
  | .op _ _ _, _, _, _, _ => rfl
  | .unit, _, _, _, _ => rfl
  | .tuple e1 e2 e3, C, Γ, hA, h => by
    simp only [checkAtExp, Bool.and_eq_true] at h
    simp only [AAtExp.erase, scAtExp, Bool.and_eq_true]
    exact ⟨⟨sc_exp e1 C Γ hA h.1.1, sc_exp e2 C Γ hA h.1.2⟩, sc_expOpt e3 C Γ hA h.2⟩
  | .nil _, _, _, _, _ => rfl
  | .record row, C, Γ, hA, h => by
    simp only [checkAtExp] at h
    simp only [AAtExp.erase, scAtExp]
    exact sc_expRowOpt row C Γ hA h
  | .update x inst τ row, C, Γ, hA, h => by
    simp only [checkAtExp, Bool.and_eq_true] at h
    obtain ⟨⟨⟨h1, _⟩, h3⟩, _⟩

Proof

h
    simp only [AAtExp.erase, scAtExp, Bool.and_eq_true]
    exact ⟨isSome_of_lookup hA h1, sc_expRow row C Γ hA h3⟩
  | .letE d e, C, Γ, hA, h => by
    simp only [checkAtExp, Bool.and_eq_true] at h
    simp only [AAtExp.erase, scAtExp, Bool.and_eq_true]
    exact ⟨sc_dec d C Γ hA h.1, sc_exp e _ _ (abs_plusVE hA (keys_dec h.1)) h.2⟩
  | .paren e, C, Γ, hA, h => by
    simp only [checkAtExp] at h
    simp only [AAtExp.erase, scAtExp]
    exact sc_exp e C Γ hA h

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

Theorems it uses

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.