Elm Exactly

Theorema81_any_later

StandardElmMech/Prog/Rulings.lean:249, A81: sleep · tactic proof

A81: no upper bound: whenever the sleep is due by some later time, it can happen then.

Statement

theorem a81_any_later (PE : PortEnv) (r : List (String × Val)) {K : Config} {n : Nat} {tk tk' t : Val}
    {s' : Time} {o : Option Val} {x : Float} {q : Rat}
    (hp : K.procs.get n = some (.live ⟨tk, s', o⟩))
    (hr : TaskRed tk (some ⟨.sleep, [.sv (.float x)], t⟩) tk') (hq : floatToRat? x = some q)
    (d : Rat) (hd : 0 < d) (hge : s' + (if q < 0 then 0 else q) ≤ K.time + d) :
    ∃ K1 K2, Step PE r K (some (.wait d)) K1 ∧ Step PE r K1 (some (.act ⟨.sleep, [.sv (.float x)], t⟩)) K2

Proof

by
  obtain ⟨s, m, M, P, sb, Q, H⟩ := K
  refine ⟨_, _, .r_p_wait s m M P sb Q H d hd, .r_p_proc_sleep _ _ _ _ _ _ _ n tk s' o tk' _ t hp hr ?_⟩
  intro x' q' he hq'
  simp only [Val.sv.injEq, SVal.float.injEq] at he
  subst he
  rw [hq] at hq'; cases hq'
  exact hge

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

Rules of the book it uses

About ruling A81 of the book, where the implementations disagreed or were silent and the definition decides.

In StandardElmMech/Prog/Rulings.lean: The rulings A62, A72, A77, A79, A80 and A81 as theorems, and a66_batch_order_open: a program whose batch is delivered in either order.

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.