Elm Exactly

TheoremstepC_inv

StandardElmMech/Src/GroupingProof.lean:94, The classes partition `range n` · tactic proof

Statement

theorem stepC_inv {acc : List (List Nat)} {a : Nat} (ha : a < n) (h : Inv n r acc) :
    Inv n r (stepC n r acc a) ∧ (∀ x c, c ∈ acc → x ∈ c → ∃ c' ∈ stepC n r acc a, x ∈ c') ∧
      (∃ c ∈ stepC n r acc a, a ∈ c) ∧ (stepC n r acc a).length ≤ acc.length + 1

Proof

by
  unfold stepC
  split
  · rename_i hin
    obtain ⟨c, hc, ha'⟩ := List.any_eq_true.mp hin
    exact ⟨h, fun x c hc hx => ⟨c, hc, hx⟩, ⟨c, hc, List.contains_iff_mem.mp ha'⟩, by omega⟩
  · rename_i hnin
    have hnot : ∀ c ∈ acc, a ∉ c := by
      intro c hc hac
      exact hnin (List.any_eq_true.mpr ⟨c, hc, List.contains_iff_mem.mpr hac⟩)
    refine ⟨⟨?_, ?_⟩, fun x c hc hx => ⟨c, List.mem_append_left _ hc, hx⟩,
      ⟨_, List.mem_append_right _ (List.mem_singleton_self _), self_mem_cls ha⟩, by simp⟩
    · intro c hc
      rcases List.mem_append.mp hc with hc | hc
      · exact h.1 c hc
      · rw [List.mem_singleton.mp hc]; exact ⟨a, ha, rfl⟩
    · apply List.pairwise_append.mpr
      refine ⟨h.2, List.pairwise_singleton _ _, ?_⟩
      intro c hc d hd x hxc hxd
      rw [List.mem_singleton.mp hd] at hxd
      obtain ⟨a', ha', rfl⟩ := h.1 c hc
      have h1 := (mem_cls ha').mp hxc
      have h2 := (mem_cls ha).mp hxd
      have : a ∈ cls n r a' := (mem_cls ha').mpr ⟨ha, mr_trans h1.2 (mr_symm h2.2)⟩
      exact hnot _ hc this

Proved with tactics, which Lean expands into a proof term that its kernel checks.

Theorems it uses

Used by

In StandardElmMech/Src/GroupingProof.lean: components_valid: the canonical grouping is one the book allows (ValidNumbering).

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.