Elm Exactly

TheoremexhDec_sound

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

res:core-exhaustiveness, decided.

Statement

theorem exhDec_sound {tbl : ConTable} {τ : Ty} {ps : List PatN} (ht : ∀ p ∈ ps, PTyped tbl τ p)
    (h : exhDec tbl τ ps = true) : ExhProp tbl τ ps

Proof

by
  unfold exhDec at h
  simp only [beq_iff_eq] at h
  have hspec := useful_spec tbl .exh _ [τ] (ps.map ([·])) [.wild] false h ⟨trivial, trivial⟩ (by
    intro r hr
    obtain ⟨p, hp, rfl⟩ := List.mem_map.mp hr
    exact ⟨ht p hp, trivial⟩)
  intro hh hinh
  apply Classical.byContradiction
  intro hno
  have : Useful tbl .exh [τ] (ps.map ([·])) [.wild] := by
    refine ⟨[hh], ⟨hinh, trivial⟩, ⟨trivial, trivial⟩, ?_⟩
    intro r hr hc
    obtain ⟨p, hp, rfl⟩ := List.mem_map.mp hr
    exact hno ⟨p, hp, hc.1⟩
  cases hspec.mpr this

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.