Elm Exactly

TheoremelabItem_sound

StandardElmMech/Stat/Deterministic.lean:188, Exposing lists and imports · tactic proof

Statement

theorem elabItem_sound (mI : ModId × IEnv) (it : BItem) (NN : List SmLongId × List SmLongId)
    (h : elabItem mI it = some NN) : ElItem mI it NN

Proof

by
  obtain ⟨mid, I⟩ := mI
  cases it with
  | var x =>
    by_cases hx : x ∈ I.VE.keys
    · simp only [elabItem, hx, if_true, Option.some.injEq] at h; subst h; exact .r_sm_item_var hx
    · simp [elabItem, hx] at h
  | op o =>
    by_cases ho : o ∈ smops mid
    · simp only [elabItem, ho, if_true, Option.some.injEq] at h; subst h; exact .r_sm_item_op ho
    · simp [elabItem, ho] at h
  | ty c =>
    simp only [elabItem] at h
    split at h
    · rename_i θ VE hf; cases h; exact .r_sm_item_type hf
    · cases h
  | tyAll c =>
    simp only [elabItem] at h
    split at h
    · rename_i θ VE hf
      split at h
      · rename_i hany
        cases h
        refine .r_sm_item_opentype hf ?_
        obtain ⟨k, _, hk⟩ := List.any_eq_true.mp hany
        cases hv : VE.find? k with
        | none => rw [hv] at hk; cases hk
        | some b =>
          rw [hv] at hk
          obtain ⟨σ, st⟩ := b
          simp only [Option.any_some, beq_iff_eq] at hk
          subst hk
          exact ⟨k, σ, hv⟩
      · cases h
    · cases h

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

Rules of the book it uses

In StandardElmMech/Stat/Deterministic.lean: The deterministic parts as functions, each sound for its relation: type expressions, imports and exposing, type declarations given their names (checkTypes), ports.

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.