Elm Exactly

TheoremdefaultM_bwd

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

A row of the default matrix covers hr: its row of P covers h :: hr, whatever h.

Statement

theorem defaultM_bwd (h : Inh) (hr : List Inh) : ∀ (P : List (List PatN)),
    (∃ r' ∈ defaultM P, RowCovers r' hr) → ∃ r ∈ P, RowCovers r (h :: hr)
  | [], ⟨_, hm, _⟩ => by simp [defaultM] at hm
  | r :: P, ⟨r', hm, hc⟩ => by
    have ih0 : ∀ {r1 : List PatN}, r' ∈ defaultM P → ∃ r0 ∈ r1 :: P, RowCovers r0 (h :: hr)

Proof

fun h' =>
      let ⟨r0, h0, h1⟩ := defaultM_bwd h hr P ⟨r', h', hc⟩
      ⟨r0, List.mem_cons_of_mem _ h0, h1⟩
    match r, hm with
    | .wild :: rest, hm =>
      simp only [defaultM, List.mem_cons] at hm
      rcases hm with rfl | hm
      · exact ⟨_, List.mem_cons_self, trivial, hc⟩
      · exact ih0 hm
    | .den _ :: _, hm => exact ih0 (by simpa [defaultM] using hm)
    | .con _ _ :: _, hm => exact ih0 (by simpa [defaultM] using hm)
    | [], hm => exact ih0 (by simpa [defaultM] using hm)

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

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.