Elm Exactly

TheoremirrDec_sound

StandardElmMech/Stat/PatternsProof.lean:1009, The deciders · tactic proof

res:core-irredundancy, decided.

Statement

theorem irrDec_sound {tbl : ConTable} {τ : Ty} {ps : List PatN} (ht : ∀ p ∈ ps, PTyped tbl τ p)
    (h : irrDec tbl τ ps = true) : IrrProp tbl τ ps

Proof

by
  intro j hj
  unfold irrDec at h
  have hjr := List.all_eq_true.mp h j (List.mem_range.mpr hj)
  simp only [beq_iff_eq] at hjr
  have hget : ps.getD j .wild = ps[j] := by simp [List.getD_eq_getElem?_getD, hj]
  rw [hget] at hjr
  have hspec := useful_spec tbl .irr _ [τ] ((ps.take j).map ([·])) [ps[j]] true hjr
    ⟨ht _ (List.getElem_mem hj), trivial⟩ (by
      intro r hr
      obtain ⟨p, hp, rfl⟩ := List.mem_map.mp hr
      exact ⟨ht p (List.mem_of_mem_take hp), trivial⟩)
  obtain ⟨hs, hw, hc, hn⟩ := hspec.mp rfl
  match hs, hw, hc with
  | [hh], ⟨hinh, _⟩, ⟨hcj, _⟩ =>
    refine ⟨hh, hinh, hcj, fun i hi hci => ?_⟩
    apply hn [ps[i]] _ ⟨hci, trivial⟩
    apply List.mem_map.mpr
    refine ⟨ps[i], ?_, rfl⟩
    rw [List.mem_iff_getElem]
    exact ⟨i, by simp; omega, by simp⟩

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.