Elm Exactly

Theoremlength_flatMap_two

StandardElmMech/Stat/CopyLoop.lean:19, Assignments · term proof

Statement

theorem length_flatMap_two {α β : Type} (f g : α → β) :
    ∀ l : List α, (l.flatMap fun a => [f a, g a]).length = 2 * l.length
  | [] => rfl
  | a :: l => by
    simp only [List.flatMap_cons, List.length_append, List.length_cons, List.length_nil,
      length_flatMap_two f g l]
    omega

Proof

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

Used by

In StandardElmMech/Stat/CopyLoop.lean: The copy loop terminates within 2^k + 1 rounds, makes the least set of copies closed under requests, at most 2^k (copyLoop_fuel, copyLoop_least, copies_le_pow).

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.