Elm Exactly

TheoremadmComp_iff

StandardElmMech/Stat/Subst.lean:110, Admissible types (fig:static-core-admissible) · tactic proof

Statement

theorem admComp_iff (τ : Ty) : admComp τ = true ↔ Adm .comp τ

Proof

by
  constructor
  · intro h
    match τ, h with
    | .var a, h => exact .comp_var a h
    | .con [] t, h =>
      simp only [admComp, Bool.or_eq_true, beq_iff_eq] at h
      rcases h with ((h | h) | h) | h <;> subst h
      · exact .comp_int
      · exact .comp_float
      · exact .comp_char
      · exact .comp_string
    | .con [τ1] t, h =>
      simp only [admComp, Bool.and_eq_true, beq_iff_eq] at h
      obtain ⟨rfl, h1⟩ := h
      exact .comp_list _ ((admComp_iff τ1).mp h1)
    | .con [τ1, τ2] t, h =>
      simp only [admComp, Bool.and_eq_true, beq_iff_eq] at h
      obtain ⟨⟨rfl, h1⟩, h2⟩ := h
      exact .comp_tuple2 _ _ ((admComp_iff τ1).mp h1) ((admComp_iff τ2).mp h2)
    | .con [τ1, τ2, τ3] t, h =>
      simp only [admComp, Bool.and_eq_true, beq_iff_eq] at h
      obtain ⟨⟨⟨rfl, h1⟩, h2⟩, h3⟩ := h
      exact .comp_tuple3 _ _ _ ((admComp_iff τ1).mp h1) ((admComp_iff τ2).mp h2) ((admComp_iff τ3).mp h3)
    | .record _ _, h => simp [admComp] at h
    | .fn _ _, h => simp [admComp] at h
    | .con (_ :: _ :: _ :: _ :: _) _, h => simp [admComp] at h
  · intro h
    cases h with
    | comp_int => rfl
    | comp_float => rfl
    | comp_char => rfl
    | comp_string => rfl
    | comp_var a h => exact h
    | comp_list τ h => simp only [admComp, listTy, beq_self_eq_true, Bool.true_and]; exact (admComp_iff τ).mpr h
    | comp_tuple2 τ1 τ2 h1 h2 =>
      simp only [admComp, beq_self_eq_true, Bool.true_and, Bool.and_eq_true]
      exact ⟨(admComp_iff τ1).mpr h1, (admComp_iff τ2).mpr h2⟩
    | comp_tuple3 τ1 τ2 τ3 h1 h2 h3 =>
      simp only [admComp, beq_self_eq_true, Bool.true_and, Bool.and_eq_true]
      exact ⟨⟨(admComp_iff τ1).mpr h1, (admComp_iff τ2).mpr h2⟩, (admComp_iff τ3).mpr h3⟩

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

Used by

In StandardElmMech/Stat/Subst.lean: Substitutions, the classes and their meets, admissible types (Adm, adm_iff, adm_mono).

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.