TheoremstepTaskL_sound
Every step of the evaluator is a logged reduction.
Statement
theorem stepTaskL_sound {o : Oracle} {n fr : Nat} {tk : Val} {k : Nat} {a : Option Action} {tk' : Val}
(h : (stepTaskL o n fr tk k).out = .value (a, tk')) : TaskRedL tk a tk' (stepTaskL o n fr tk k).logProof
by
induction tk, k using stepTaskL.induct generalizing a tk' with
| case1 f v k =>
simp only [stepTaskL] at h ⊢
obtain ⟨t, ht, he⟩ := mapOut_value h
simp only [Prod.mk.injEq] at he; obtain ⟨rfl, rfl⟩ := he
exact .r_e_task_andthen_succeed_l _ _ _ _ (appVal_sound_out ht)
| case2 f v k =>
simp only [stepTaskL, Outcome.value.injEq, Prod.mk.injEq] at h ⊢; obtain ⟨rfl, rfl⟩ := h
exact .r_e_task_andthen_fail_l _ _
| case3 f v k =>
simp only [stepTaskL] at h ⊢
obtain ⟨t, ht, he⟩ := mapOut_value h
simp only [Prod.mk.injEq] at he; obtain ⟨rfl, rfl⟩ := he
exact .r_e_task_onerror_fail_l _ _ _ _ (appVal_sound_out ht)
| case4 f v k =>
simp only [stepTaskL, Outcome.value.injEq, Prod.mk.injEq] at h ⊢; obtain ⟨rfl, rfl⟩ := h
exact .r_e_task_onerror_succeed_l _ _
| case5 f t k h1 h2 ih =>
rw [stepTaskL] at h ⊢
· obtain ⟨⟨a0, t0⟩, ht, he⟩ := mapOut_value h
simp only [Prod.mk.injEq] at he; obtain ⟨rfl, rfl⟩ := he
exact .r_e_task_andthen_inner_l _ _ _ _ _ (ih ht)
all_goals assumption
| case6 f t k h1 h2 ih =>
rw [stepTaskL] at h ⊢
· obtain ⟨⟨a0, t0⟩, ht, he⟩ := mapOut_value h
simp only [Prod.mk.injEq] at he; obtain ⟨rfl, rfl⟩ := he
exact .r_e_task_onerror_inner_l _ _ _ _ _ (ih ht)
all_goals assumption
| case7 v k =>
simp only [stepTaskL, Outcome.value.injEq, Prod.mk.injEq] at h ⊢; obtain ⟨rfl, rfl⟩ := h
exact .r_e_task_prim_l _ _ _ (.sleep v)
| case8 t k =>
simp only [stepTaskL, Outcome.value.injEq, Prod.mk.injEq] at h ⊢; obtain ⟨rfl, rfl⟩ := h
exact .r_e_task_prim_l _ _ _ (.spawn t fr)
| case9 p k =>
simp only [stepTaskL, Outcome.value.injEq, Prod.mk.injEq] at h ⊢; obtain ⟨rfl, rfl⟩ := h
exact .r_e_task_prim_l _ _ _ (.kill p)
| case10 t k _ _ _ _ _ _ _ _ _ =>
rw [stepTaskL] at h
· cases h
all_goals assumptionProved with tactics, which Lean expands into a proof term that its kernel checks.
Rules of the book it uses
Theorems it uses
Used by
In StandardElmMech/Eff/Task.lean: Task reduction (TaskRed, 7 rules, r_e_task_*) and its logged twin, focus and plug, the property of task reduction (taskRed_iff, taskRed_outcome, taskRed_kind, taskRed_silent_same, taskRed_none), and the executable step stepTaskL, sound, complete and unique.
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.