Elm Exactly

TheoremcopyLoop_fuel

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

With fuel 2^k + 1 the loop does not run out of fuel unless a translation fails.

Statement

theorem copyLoop_fuel {gid k : Nat} {tr : Assignment → Except SpecError (Spec (List D.Def))}
    {init : List Assignment} (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) :
    copyLoop gid tr (2 ^ k + 1) init [] [] ≠ .error .copyFuel ∨ ∃ a e, tr a = .error e

Proof

(copyLoop_lengths htr (2 ^ k + 1) init [] [] hk (by simp) List.nodup_nil).1 (by simp)

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

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.