(* Compute the answer function explicitly *)
Next Obligation.
move=>i1/=[L1]_; apply: step; apply: (gh_ex (g:=[::])).
apply: call_rule=>//[[from args]] i2/=[L2]H1 H2 C2.
case: (prec_valid _ H2)=>ans F.
move: (erefl (f args))=>e.
have X: (match f args as anonymous' return (anonymous' = f args -> nat) with
| Some v => fun _ : Some v = f args => v
| None => fun _ : None = f args => 0
end e) = ans by move: e; rewrite F.
rewrite X=>{X}; apply: step; apply: (gh_ex (g:=[:: (from, sv, args)])).
apply: call_rule=>//; first by move=>_; split=>//; rewrite inE eqxx.
move=>x i3/=; rewrite eqxx=> L3 C3.
apply: ret_rule=>i4 R3 _; split=>//.
by rewrite (rely_loc' _ R3); case: L3.
Qed.
Definition one_shot_server :=
server_loop _ _ _ _ _ _ _ _ _ state0_wf one_shot_body.
End OneShotServer.
End OneShotServer.
(***** Batching (per iteration) server *****)
Module BatchingServer.
Section BatchingServer.
Variable l : Label.
Variable f : input -> option nat.
Variable prec : input -> bool.
Hypothesis prec_valid :
forall i, prec i -> exists v, f i = Some v.
Variables (cs cls : seq nid).
Notation nodes := (cs ++ cls).
Hypothesis Huniq : uniq nodes.
Notation cal := (CalculatorProtocol f prec cs cls l).
Notation sts := (snd_trans cal).
Notation rts := (rcv_trans cal).
Notation W := (mkWorld cal).
(* A server node *)
Variable sv : nid.
Hypothesis  Hs : sv \in cs.
Notation loc i := (getLocal sv (getStatelet i l)).
(* Server-specific infrastructure *)
Notation Sstate := unit.
Definition state_wf := fun _ : unit => True.
Definition state0 := tt.

(* Specifications: *)
Lemma state0_wf : state_wf state0. Proof. done. Qed.
Variable bsize : nat.