Elm Exactly

TheoremprocTask_sound

StandardElmMech/Prog/Sched.lean:448, Soundness · tactic proof

Statement

theorem procTask_sound {c : Ctx} {st : SchedState} {n : Nat} {tk : Val} {s' : Time} {o : Option Val}
    {t : Taken} {st' : SchedState} (hp : st.K.procs.get n = some (.live ⟨tk, s', o⟩))
    (h : procTask c st n tk s' o = .trans t st') : TransOK c st t st'

Proof

by
  rcases hK : st.K with ⟨s, v, M, P, sb, Q, H⟩
  rw [hK] at hp; simp only at hp
  unfold procTask at h
  simp only [hK] at h
  split at h
  · rename_i tk' l k' hs
    simp only [ChoiceOut.trans.injEq] at h; obtain ⟨rfl, rfl⟩ := h
    refine ⟨?_, .silent _ _, rfl, rfl⟩
    show StepL c.PE c.r st.K _ _ _; rw [hK]
    exact .r_p_proc_step_l s v M P sb Q H n tk s' o none tk' l hp (stepTaskL_sound_eq hs) (by simp)
  · rename_i v' t'' tk' l k' hs
    split at h
    · rename_i hr
      simp only [ChoiceOut.trans.injEq] at h; obtain ⟨rfl, rfl⟩ := h
      refine ⟨?_, .act _ _ _, rfl, rfl⟩
      show StepL c.PE c.r st.K _ _ _; rw [hK]
      exact .r_p_proc_sleep_l s v M P sb Q H n tk s' o tk' v' t'' l hp (stepTaskL_sound_eq hs)
        (sleepReadyB_sound hr)
    · cases h
  · rename_i t0 n' tk' l k' hs
    split at h
    · rename_i hn
      simp only [ChoiceOut.trans.injEq] at h; obtain ⟨rfl, rfl⟩ := h
      refine ⟨?_, .act _ _ _, rfl, rfl⟩
      show StepL c.PE c.r st.K _ _ _; rw [hK]
      exact .r_p_proc_spawn_l s v M P sb Q H n tk s' o tk' t0 n' l hp (stepTaskL_sound_eq hs) hn
    · cases h
  · rename_i n' t'' tk' l k' hs
    simp only [ChoiceOut.trans.injEq] at h; obtain ⟨rfl, rfl⟩ := h
    refine ⟨?_, .act _ _ _, rfl, rfl⟩
    show StepL c.PE c.r st.K _ _ _; rw [hK]
    exact .r_p_proc_kill_l s v M P sb Q H n tk s' o tk' n' t'' l hp (stepTaskL_sound_eq hs)
  · cases h

Proved 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/Prog/Sched.lean: The default scheduler (run): one choice per iteration, overridable per test, each transition proved by doChoice_sound; run_sound: every run is an execution.

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.