Definition server_send_step (ss : server_state) (to : nid) (tag : nat) (msg : seq nat)
: server_state :=
if to \in clients
then if tag == update_response_tag
then if msg is [:: e; v; b]
then let: r := Update (to, e, v)
in if current_epoch ss <= e
then ServerState e v (seq.rem r (outstanding ss))
else ServerState (current_epoch ss) (current_value ss) (seq.rem r (outstanding ss))
else ss
else if tag == read_response_tag
then if msg is e :: _
then let: r := Read (to, e)
in ServerState (current_epoch ss) (current_value ss) (seq.rem r (outstanding ss))
else ss
else ss
else ss.
Definition server_recv_step (ss : server_state) (from : nid)
(mtag : nat) (mbody : seq nat) : server_state :=
if mtag == update_tag
then
if mbody is [:: e; v]
then ServerState (current_epoch ss) (current_value ss) (cons (Update (from, e, v)) (outstanding ss))
else ss
else (* mtag == read_tag *)
if mbody is [:: e]
then ServerState (current_epoch ss) (current_value ss) (cons (Read (from, e)) (outstanding ss))
else ss.
Section GetterLemmas.

Lemma getLocal_server_st_tp d (C : ResourceCoh d) s:
find st (getLocal server d) = Some s ->
dyn_tp s = server_state.