Elm Exactly

TheoremtranslateAll_error

StandardElmMech/Stat/CopyLoop.lean:98, `translateAll` · term proof

Statement

theorem translateAll_error {tr : Assignment → Except SpecError (Spec (List D.Def))} :
    ∀ {l : List Assignment} {e}, translateAll tr l = .error e → ∃ a ∈ l, tr a = .error e
  | [], e, h => by simp [translateAll] at h
  | a :: as, e, h => by
    simp only [translateAll, bind, Except.bind] at h
    cases ha : tr a with
    | error e' => rw [ha] at h; cases h; exact ⟨a, List.mem_cons_self, ha⟩
    | ok s =>
      rw [ha] at h
      simp only at h
      cases hr : translateAll tr as with
      | error e' =>
        rw [hr] at h; cases h
        obtain ⟨b, hb, hb'⟩

Proof

translateAll_error hr
        exact ⟨b, List.mem_cons_of_mem _ hb, hb'⟩
      | ok rest => rw [hr] at h; cases h

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.