Theoremspec_of_useful
Statement
theorem spec_of_useful {tbl : ConTable} {mode : Mode} {τ : Ty} {τr : List Ty} {P : List (List PatN)}
{qs : List PatN} (hlit : litKind τ = none) (hne : ctorsAt tbl τ ≠ [])
(hP : ∀ r ∈ P, PTypedList tbl (τ :: τr) r) :
Useful tbl mode (τ :: τr) P (.wild :: qs) →
∃ c ∈ ctorsAt tbl τ, Useful tbl mode (c.2 ++ τr) (specializeCon c.1 c.2.length P)
(List.replicate c.2.length .wild ++ qs)Proof
by
rintro ⟨hs, hw, hc, hn⟩
match hs, hw, hc with
| h :: hr, ⟨hh, hwr⟩, ⟨_, hcr⟩ =>
obtain ⟨nd, hnd, hcl, _⟩ := hh.root
match nd, hcl with
| .den _, hcl => simp [Clause, hlit] at hcl
| .other, hcl => simp [Clause, hlit] at hcl
| .wild, hcl => exact absurd hcl.2 hne
| .con k n, hcl =>
obtain ⟨_, as, has, hl⟩ := hcl
subst hl
refine ⟨(k, as), argTys_ctorsAt has, ?_⟩
exact useful_spec_of hP has hh hnd hwr hn _ (by
have := RowCovers.wilds (h.children as.length); rwa [children_length] at this) hcrProved 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.