Elm Exactly

Theoremcopies_le_pow

StandardElmMech/Stat/CopyLoop.lean:337, Fuel and the number of copies · tactic proof

At most 2^k copies (the book's finiteness remark), and distinct.

Statement

theorem copies_le_pow {gid k : Nat} {tr : Assignment → Except SpecError (Spec (List D.Def))}
    {fuel : Nat} {init : List Assignment} {made : List (Assignment × List D.Def)} {out : List Req}
    (h : copyLoop gid tr fuel init [] [] = .ok (made, out)) (hk : ∀ a ∈ init, a.length = k)
    (htr : ∀ a s, a.length = k → tr a = .ok s → ∀ r ∈ s.reqs, r.1 = gid → r.2.length = k) :
    (made.map (·.1)).Nodup ∧ made.length ≤ 2 ^ k

Proof

by
  obtain ⟨hl, hn⟩ := (copyLoop_lengths htr fuel init [] [] hk (by simp) List.nodup_nil).2 made out h
  refine ⟨hn, ?_⟩
  have := length_le_pow hn hl
  simpa using this

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

Theorems it uses

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.