Elm Exactly

Theoremadm_iff

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

Statement

theorem adm_iff (k : Cls) (τ : Ty) : adm k τ = true ↔ Adm k τ

Proof

by
  cases k with
  | any => exact ⟨fun _ => .any τ, fun _ => rfl⟩
  | comp => exact admComp_iff τ
  | num =>
    constructor
    · intro h
      match τ, h with
      | .var a, h => exact .num_var a (by simpa [adm] using h)
      | .record _ _, h => simp [adm, tIntTy, tFloatTy] at h
      | .fn _ _, h => simp [adm, tIntTy, tFloatTy] at h
      | .con as t, h =>
        simp only [adm, Bool.or_eq_true, beq_iff_eq] at h
        rcases h with h | h <;> rw [h]
        · exact .num_int
        · exact .num_float
    · intro h
      cases h with
      | num_int => rfl
      | num_float => rfl
      | num_var a h => simp [adm, h]
  | app =>
    constructor
    · intro h
      match τ, h with
      | .var a, h => exact .app_var a h
      | .con [] t, h => simp only [adm, beq_iff_eq] at h; subst h; exact .app_string
      | .con [τ1] t, h => simp only [adm, beq_iff_eq] at h; subst h; exact .app_list τ1
      | .record _ _, h => simp [adm] at h
      | .fn _ _, h => simp [adm] at h
      | .con (_ :: _ :: _) _, h => simp [adm] at h
    · intro h
      cases h with
      | app_string => rfl
      | app_list τ => rfl
      | app_var a h => exact h
  | capp =>
    constructor
    · intro h
      match τ, h with
      | .var a, h => exact .capp_var a (by simpa [adm] using h)
      | .con [] t, h => simp only [adm, beq_iff_eq] at h; subst h; exact .capp_string
      | .con [τ1] t, h =>
        simp only [adm, Bool.and_eq_true, beq_iff_eq] at h
        obtain ⟨rfl, h1⟩ := h
        exact .capp_list τ1 ((admComp_iff τ1).mp h1)
      | .record _ _, h => simp [adm] at h
      | .fn _ _, h => simp [adm] at h
      | .con (_ :: _ :: _) _, h => simp [adm] at h
    · intro h
      cases h with
      | capp_string => rfl
      | capp_list τ h =>
        simp only [adm, listTy, beq_self_eq_true, Bool.true_and]; exact (admComp_iff τ).mpr h
      | capp_var a h => simp [adm, h]

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

Theorems it uses

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.