Elm Exactly

Theoremflatten_nodup

StandardElmMech/Src/GroupingProof.lean:306, The canonical grouping is valid · term proof

Statement

theorem flatten_nodup : ∀ (L : List (List Nat)), (∀ l ∈ L, l.Nodup) → L.Pairwise Disj → L.flatten.Nodup
  | [], _, _ => List.nodup_nil
  | c :: L, h1, h2 => by
    simp only [List.flatten_cons]
    rw [List.pairwise_cons] at h2
    apply List.nodup_append.mpr
    refine ⟨h1 c List.mem_cons_self, flatten_nodup L (fun l hl => h1 l (List.mem_cons_of_mem _ hl)) h2.2, ?_⟩
    intro a ha b hb hab
    subst hab
    obtain ⟨d, hd, had⟩

Proof

List.mem_flatten.mp hb
    exact h2.1 d hd a ha had

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

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.