Elm Exactly

TheoremstepTaskL_complete

StandardElmMech/Eff/Task.lean:403, The executable step · tactic proof

Every logged reduction is found by the evaluator, with some choices, fuel and fresh identifier (the one the reduction spawns, if it spawns).

Statement

theorem stepTaskL_complete {tk : Val} {a : Option Action} {tk' : Val} {l : Log}
    (d : TaskRedL tk a tk' l) : ∃ fr, CompleteFor (fun o m k => stepTaskL o m fr tk k) (a, tk') l

Proof

by
  induction d with
  | r_e_task_andthen_succeed_l f v t l h =>
    obtain ⟨L, n, c⟩ := AppValL.complete h
    exact ⟨0, L, n, fun o k m hm ha => by simp [stepTaskL, c o k m hm ha, Res.mapOut]⟩
  | r_e_task_andthen_fail_l f v => exact ⟨0, [], 0, fun o k m _ _ => by simp [stepTaskL]⟩
  | r_e_task_onerror_fail_l f v t l h =>
    obtain ⟨L, n, c⟩ := AppValL.complete h
    exact ⟨0, L, n, fun o k m hm ha => by simp [stepTaskL, c o k m hm ha, Res.mapOut]⟩
  | r_e_task_onerror_succeed_l f v => exact ⟨0, [], 0, fun o k m _ _ => by simp [stepTaskL]⟩
  | r_e_task_andthen_inner_l f t t' a l d ih =>
    obtain ⟨fr, L, n, c⟩ := ih
    refine ⟨fr, L, n, fun o k m hm ha => ?_⟩
    have c' := c o k m hm ha
    simp only at c' ⊢
    rw [stepTaskL_andThen_inner d.not_outcome, c']
    rfl
  | r_e_task_onerror_inner_l f t t' a l d ih =>
    obtain ⟨fr, L, n, c⟩ := ih
    refine ⟨fr, L, n, fun o k m hm ha => ?_⟩
    have c' := c o k m hm ha
    simp only at c' ⊢
    rw [stepTaskL_onError_inner d.not_outcome, c']
    rfl
  | r_e_task_prim_l π vs t h =>
    cases h with
    | sleep v => exact ⟨0, [], 0, fun o k m _ _ => by simp [stepTaskL]⟩
    | spawn t n => exact ⟨n, [], 0, fun o k m _ _ => by simp [stepTaskL]⟩
    | kill p => exact ⟨0, [], 0, fun o k m _ _ => by simp [stepTaskL]⟩

Proved with tactics, which Lean expands into a proof term that its kernel checks.

Rules of the book it uses

Theorems it uses

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.