Elm Exactly

TheoremcheckModule_sound

StandardElmMech/Stat/CheckSound.lean:416, Modules · tactic proof

D10: a certificate that checks is a derivation of r:sm-module.

Statement

theorem checkModule_sound (B : SBasis) (a : AModule) (B' : SBasis) (E : Env)
    (h : a.result B = some (B', E)) : ElModule B a.erase B' E

Proof

by
  unfold AModule.result importCtx at h
  cases hπ : elabImports B π0 (defaultImports ++ a.imports) with
  | none => rw [hπ] at h; cases h
  | some π =>
    rw [hπ] at h
    simp only [Option.map_some] at h
    unfold AModule.resultIn at h
    split at h
    · cases h
    · rename_i E' PE hd
      split at h
      · cases h
      · rename_i I hI
        split at h
        · cases h
        · rename_i hn
          simp only [Option.some.injEq, Prod.mk.injEq] at h
          obtain ⟨rfl, rfl⟩ := h
          exact .r_sm_module (elabImports_sound B _ π0 π hπ) (checkTopDecOpt_sound _ a.body E' PE hd)
            (.r_sm_header hI) hn

Proved with tactics, which Lean expands into a proof term that its kernel checks.

Rules of the book it uses

Theorems it uses

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.