Elm Exactly

TheoremisInh_mkCon

StandardElmMech/Stat/PatternsProof.lean:118, Inhabitants: construction and decomposition · tactic proof

Statement

theorem isInh_mkCon {tbl : ConTable} {mode : Mode} {τ : Ty} {k : String} {as : List Ty} {cs : List Inh}
    (hlit : (litKind τ).isNone = true) (has : argTys tbl τ k = some as) (hlen : cs.length = as.length)
    (hch : ∀ i (hi : i < as.length), IsInh tbl mode as[i] (cs[i]'(by omega))) :
    IsInh tbl mode τ (Inh.mkCon k cs)

Proof

by
  intro n
  cases n with
  | zero => trivial
  | succ n =>
    refine ⟨.con k cs.length, rfl, ⟨hlit, as, has, hlen.symm⟩, ?_, ?_⟩
    · intro i p hi
      simp only [INode.arity] at hi
      simp only [Inh.mkCon]
      rw [List.getElem?_eq_none_iff.mpr hi]; rfl
    · intro k' as' he has' i hi
      simp only [INode.con.injEq] at he
      obtain ⟨rfl, hl⟩ := he
      rw [has] at has'
      cases has'
      rw [mkCon_sub k cs i (by omega)]
      exact hch i hi n

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.