Elm Exactly

TheoremportB_sound

StandardElmMech/Stat/CheckSound.lean:301, Modules · term proof

Statement

theorem portB_sound : (τ : Ty) → portB τ = true → Port τ
  | .con [] t, h => by
    simp only [portB, Bool.or_eq_true, beq_iff_eq] at h
    rcases h with (((((h | h) | h) | h) | h) | h) | h <;> subst h
    · exact .int
    · exact .float
    · exact .bool
    · exact .string
    · exact .bytes
    · exact .unit
    · exact .value
  | .con [τ] t, h => by
    simp only [portB, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq] at h
    obtain ⟨(h | h) | h, h2⟩

Proof

h <;> subst h
    · exact .list (portB_sound τ h2)
    · exact .maybe (portB_sound τ h2)
    · exact .array (portB_sound τ h2)
  | .con [τ1, τ2] t, h => by
    simp only [portB, Bool.and_eq_true, beq_iff_eq] at h
    obtain ⟨⟨rfl, h1⟩, h2⟩ := h
    exact .tuple2 (portB_sound τ1 h1) (portB_sound τ2 h2)
  | .con [τ1, τ2, τ3] t, h => by
    simp only [portB, Bool.and_eq_true, beq_iff_eq] at h
    obtain ⟨⟨⟨rfl, h1⟩, h2⟩, h3⟩ := h
    exact .tuple3 (portB_sound τ1 h1) (portB_sound τ2 h2) (portB_sound τ3 h3)
  | .record ρ none, h => by
    simp only [portB] at h
    exact .record (portRowB_sound ρ h)
  | .con (_ :: _ :: _ :: _ :: _) _, h => by simp [portB] at h
  | .record _ (some _), h => by simp [portB] at h
  | .var _, h => by simp [portB] at h
  | .fn _ _, h => by simp [portB] at h

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

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.