TheoremtranslateAll_ok
Statement
theorem translateAll_ok {tr : Assignment → Except SpecError (Spec (List D.Def))} :
∀ {l : List Assignment} {rs}, translateAll tr l = .ok rs →
rs.map (·.1) = l ∧ ∀ p ∈ rs, tr p.1 = .ok p.2
| [], rs, h => by simp only [translateAll, Except.ok.injEq] at h; subst h; simp
| a :: as, rs, h => by
simp only [translateAll, bind, Except.bind] at h
cases ha : tr a with
| error e => rw [ha] at h; cases h
| ok s =>
rw [ha] at h
simp only at h
cases hr : translateAll tr as with
| error e => rw [hr] at h; cases h
| ok rest =>
rw [hr] at h
simp only [pure, Except.pure, Except.ok.injEq] at h
subst h
obtain ⟨h1, h2⟩Proof
translateAll_ok hr
refine ⟨by simp [h1], ?_⟩
intro p hp
rcases List.mem_cons.mp hp with rfl | hp
· exact ha
· exact h2 p hpProved 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.