Elm Exactly

TheoremcanonNode_clause

StandardElmMech/Stat/PatternsProof.lean:219, A97: every type has an inhabitant · tactic proof

Statement

theorem canonNode_clause (tbl : ConTable) (mode : Mode) (τ : Ty) :
    Clause tbl mode τ (canonNode tbl τ).1 ∧ (canonNode tbl τ).1.arity = (canonNode tbl τ).2.length ∧
    ∀ k as, (canonNode tbl τ).1 = .con k as.length → argTys tbl τ k = some as → (canonNode tbl τ).2 = as

Proof

by
  unfold canonNode
  cases hl : litKind τ with
  | some kd =>
    rcases litKind_spec hl with rfl | rfl | rfl
    · refine ⟨⟨by simp [hl, Den.kind], by decide⟩, rfl, by intro k as h; cases h⟩
    · refine ⟨⟨by simp [hl, Den.kind], rfl⟩, rfl, by intro k as h; cases h⟩
    · refine ⟨⟨by simp [hl, Den.kind], rfl⟩, rfl, by intro k as h; cases h⟩
  | none =>
    simp only
    cases hc : ctorsAt tbl τ with
    | nil => exact ⟨⟨by simp [hl], hc⟩, rfl, by intro k as h; cases h⟩
    | cons c rest =>
      obtain ⟨k, as⟩ := c
      have has := ctorsAt_argTys (hc ▸ List.mem_cons_self : (k, as) ∈ ctorsAt tbl τ)
      refine ⟨⟨by simp [hl], as, has, rfl⟩, rfl, ?_⟩
      intro k' as' he has'
      simp only [INode.con.injEq] at he
      obtain ⟨rfl, _⟩ := he
      rw [has] at has'
      exact Option.some.inj has'

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

Theorems it uses

Used by

In StandardElmMech/Stat/PatternsProof.lean: The pattern decider is correct: every type is inhabited (inhabited), useful_spec, exhDec_sound, irrDec_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.