Definition server_send_step (ss : server_state) (to : nid) : server_state :=
if to \in clients
then if outstanding ss is _ :: out'
then ServerState out' (S (current_epoch ss)) (Some to)
else ss
else ss.
Definition client_send_step (cs : client_state) : client_state :=
NotHeld. (* ! *)
Definition server_recv_step (ss : server_state) (from : nid)
(mtag : nat) (mbody : seq nat) : server_state :=
if mtag == acquire_tag
then
ServerState (rcons (outstanding ss) from) (current_epoch ss) (current_holder ss)
else (* mtag == release_tag *)
ServerState (outstanding ss) (current_epoch ss) None.
Definition client_recv_step (cs : client_state) (from : nid)
(mtag : nat) (mbody : seq nat) : client_state :=
if mbody is [:: e]
then Held e
else NotHeld.
Section GetterLemmas.

(* Specifications: *)
Lemma getLocal_coh n d (C : LockCoh d):
n \in nodes ->
valid (getLocal n d) /\
if n == server
then exists (ss : server_state),
getLocal n d = st :-> ss
else (n \in clients) /\
exists (cs : client_state),
getLocal n d = st :-> cs.
Lemma getLocal_server_st_tp d (C : LockCoh d) s:
find st (getLocal server d) = Some s ->
dyn_tp s = server_state.
Lemma getLocal_client_st_tp n d (C : LockCoh d) (H : n \in clients) s:
find st (getLocal n d) = Some s ->
dyn_tp s = client_state.