TheoremrecvL_unique
When the evaluator reads no choice, its message and log are the only ones.
Statement
theorem recvL_unique {o : Oracle} {n : Nat} {c : Val} {x : Input} {k : Nat} {v : Val} {l : Log}
(h : recvL o n c x k = ⟨.value v, l, k⟩) : ∀ v' l', RecvL c x v' l' → v' = v ∧ l' = lProof
by
intro v' l' d
induction d generalizing v l k with
| r_e_msg_task_l tk v0 => simp [recvL] at h; exact ⟨h.1, h.2.symm⟩
| r_e_msg_port_l p τ f j w w' l0 hd ha =>
simp only [recvL, ite_true, (dec_iff τ j w).mp hd] at h
exact appVal_unique_l h _ _ ha
| r_e_msg_map_l f c0 x0 w w' l1 l2 hr ha ih =>
simp only [recvL] at h
rcases hr' : recvL o n c0 x0 k with ⟨out, la, ka⟩
rw [hr'] at h
cases out with
| value u =>
simp only at h
rcases ha' : appVal o n f u ka with ⟨out2, lb, kb⟩
rw [ha'] at h
cases out2 <;> simp at h
obtain ⟨rfl, rfl, hk⟩ := h
have h1 := recvL_next (o := o) (n := n) c0 (x := x0) (k := k); rw [hr'] at h1; simp only at h1
have h2 := appVal_next ha'; simp only at h2
have hka : ka = k := by omega
subst hka
have hkb : kb = ka := by omega
subst hkb
obtain ⟨rfl, rfl⟩ := ih hr'
obtain ⟨rfl, rfl⟩ := appVal_unique_l ha' _ _ ha
exact ⟨rfl, rfl⟩
| stuck => simp at h
| outOfFuel => simp at hProved 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/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.