Theory CIMP_unbounded_buffer
theory CIMP_unbounded_buffer
imports
"../CIMP"
"HOL-Library.Prefix_Order"
begin
abbreviation (input)
Receive :: "'location ⇒ 'channel ⇒ ('val ⇒ 'state ⇒ 'state)
⇒ (unit, 'location, 'channel × 'val, 'state) com" ("⦃_⦄/ _▹_" [0,0,81] 81)
where
"⦃l⦄ ch▹f ≡ ⦃l⦄ Response (λq s. if fst q = ch then {(f (snd q) s, ())} else {})"
abbreviation (input)
Send :: "'location ⇒ 'channel ⇒ ('state ⇒ 'val) × ('state ⇒ 'state)
⇒ (unit, 'location, 'channel × 'val, 'state) com" ("⦃_⦄/ _◃_" [0,0,81] 81)
where
"⦃l⦄ ch◃f ≡ ⦃l⦄ Request (λs. (ch, fst f s)) (λans s. {snd f s})"
section‹Example: an unbounded buffer \label{sec:unbounded_buffer}›
text‹
This is more literally Kai Engelhardt's example from his notes titled
\emph{Proving an Asynchronous Message Passing Program Correct}, 2011.
›
datatype ex_chname = ξ12 | ξ23
type_synonym ex_val = nat
type_synonym ex_ls = "ex_val list"
type_synonym ex_ch = "ex_chname × ex_val"