TheoremendToEnd_ok
What a successful run of the pipeline gives: the derivation the inference returned, the results of its modules, and the reduced program.
Statement
theorem endToEnd_ok {B : SBasis} {s : SProgram} {r : Mod.Reduced} (h : endToEnd B s = .ok r) :
∃ a rs, inferProgram B (bareOf s) = .ok a ∧ progResults B a = some rs ∧
a.map AModule.erase = (bareOf s).modules ∧ checksAll rs = true ∧ reduceWith B a rs = .ok rProof
by
unfold endToEnd at h
dsimp only at h
cases hi : inferProgram B (bareOf s) with
| error e => simp only [hi, Except.mapError, bind, Except.bind] at h; cases h
| ok a =>
simp only [hi, Except.mapError, bind, Except.bind] at h
cases hr : progResults B a with
| none => rw [hr] at h; cases h
| some rs =>
rw [hr] at h
simp only at h
by_cases hc : (a.map AModule.erase == (bareOf s).modules && checksAll rs) = true
· simp only [hc, ↓reduceIte] at h
simp only [Bool.and_eq_true, beq_iff_eq] at hc
refine ⟨a, rs, rfl, hr, hc.1, hc.2, ?_⟩
cases hw : reduceWith B a rs with
| error e => rw [hw] at h; cases h
| ok r' => rw [hw] at h; cases h; rfl
· simp only [hc] at h; cases hProved with tactics, which Lean expands into a proof term that its kernel checks.
Used by
In StandardElmMech/Stat/Pipeline.lean: SpecOf, DynOf (in Lib.Btest for a view, Mod.Btest [] for a worker: dynBasis), ProgramSem (r:p-program), D11For; copy names, payload types and main (copyName_inj, toPTy_isSome_iff, mainKind_worker_iff, mainKind_view_iff); the pipeline theorems (specOf_of_endToEnd, programSem_of_legal).
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.