Elm Exactly

TheoremspecializeDen_fwd

StandardElmMech/Stat/PatternsProof.lean:453, Specialisation and the default matrix · term proof

Statement

theorem specializeDen_fwd (d : Den) (hr : List Inh) : ∀ (P : List (List PatN)),
    (∃ r ∈ P, RowCovers r (Inh.leaf (.den d) :: hr)) → ∃ r' ∈ specializeDen d P, RowCovers r' hr
  | [], ⟨_, hm, _⟩ => by cases hm
  | r :: P, ⟨r0, hm, hc⟩ => by
    rcases List.mem_cons.mp hm with rfl | hm
    · match r0, hc with
      | .wild :: rest, hc => exact ⟨rest, by simp [specializeDen], hc.2⟩
      | .den d' :: rest, hc =>
        have e

Proof

(covers_leaf_den d' _).mp hc.1
        simp only [INode.den.injEq] at e
        subst e
        exact ⟨rest, by simp [specializeDen], hc.2⟩
      | .con k args :: rest, hc => exact absurd hc.1 (not_covers_leaf_con k args _ (by intro n h; cases h))
      | [], hc => simp [RowCovers] at hc
    · obtain ⟨r', hm', hc'⟩ := specializeDen_fwd d hr P ⟨r0, hm, hc⟩
      refine ⟨r', ?_, hc'⟩
      match r with
      | .wild :: _ => simp only [specializeDen]; exact List.mem_cons_of_mem _ hm'
      | .den d' :: _ =>
        simp only [specializeDen]
        split
        · exact List.mem_cons_of_mem _ hm'
        · exact hm'
      | .con _ _ :: _ => simpa [specializeDen] using hm'
      | [] => simpa [specializeDen] using hm'

Proved by a term, which Lean's kernel checks directly.

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.