Elm Exactly

TheoremrecvL_complete

StandardElmMech/Eff/Messages.lean:141 · tactic proof

Every logged reception is found by the evaluator, with some choices and fuel.

Statement

theorem recvL_complete {c : Val} {x : Input} {v : Val} {l : Log} (d : RecvL c x v l) :
    CompleteFor (fun o m k => recvL o m c x k) v l

Proof

by
  induction d with
  | r_e_msg_task_l tk v => exact ⟨[], 0, fun o k m _ _ => by simp [recvL]⟩
  | r_e_msg_port_l p τ f j v' v'' l hd ha =>
    obtain ⟨L, n, c⟩ := AppValL.complete ha
    exact ⟨L, n, fun o k m hm hag => by simp [recvL, (dec_iff τ j v').mp hd, c o k m hm hag]⟩
  | r_e_msg_map_l f c x v' v'' l1 l2 hr ha ih =>
    obtain ⟨L1, n1, c1⟩ := ih
    obtain ⟨L2, n2, c2⟩ := AppValL.complete ha
    refine ⟨L1 ++ L2, max n1 n2, fun o k m hm hag => ?_⟩
    obtain ⟨hag1, hag2⟩ := agrees_append hag
    have e1 := c1 o k m (by omega) hag1
    simp only at e1
    have e2 := c2 o (k + L1.length) m (by omega) hag2
    simp only [recvL, e1, e2, List.length_append, Nat.add_assoc]

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/Messages.lean: Messages (Recv, 3 rules, r_e_msg_*) and its logged twin, and the executable recvL, 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.