Elm Exactly

TheoremspecializeDen_bwd

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

Statement

theorem specializeDen_bwd (d : Den) (hr : List Inh) : ∀ (P : List (List PatN)),
    (∃ r' ∈ specializeDen d P, RowCovers r' hr) → ∃ r ∈ P, RowCovers r (Inh.leaf (.den d) :: hr)
  | [], ⟨_, hm, _⟩ => by simp [specializeDen] at hm
  | r :: P, ⟨r', hm, hc⟩ => by
    have ih0 : ∀ {r1 : List PatN}, r' ∈ specializeDen d P → ∃ r0 ∈ r1 :: P, RowCovers r0 (Inh.leaf (.den d) :: hr)

Proof

fun h' =>
      let ⟨r0, h0, h1⟩ := specializeDen_bwd d hr P ⟨r', h', hc⟩
      ⟨r0, List.mem_cons_of_mem _ h0, h1⟩
    match r, hm with
    | .wild :: rest, hm =>
      simp only [specializeDen, List.mem_cons] at hm
      rcases hm with rfl | hm
      · exact ⟨_, List.mem_cons_self, trivial, hc⟩
      · exact ih0 hm
    | .den d' :: rest, hm =>
      simp only [specializeDen] at hm
      split at hm
      · rename_i hd
        subst hd
        rcases List.mem_cons.mp hm with rfl | hm
        · exact ⟨_, List.mem_cons_self, (covers_leaf_den _ _).mpr rfl, hc⟩
        · exact ih0 hm
      · exact ih0 hm
    | .con _ _ :: _, hm => exact ih0 (by simpa [specializeDen] using hm)
    | [], hm => exact ih0 (by 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.