Section CalculatorApp.
Definition l1 := 1.
Definition l2 := 2.
Definition f args :=
match args with
| x::y::_ => Some (x + y)
| _ => None
end.
Definition prec (args : input) :=
if args is x::y::_ then true else false.
(* This server node *)
Definition sv : nid := 1.
Definition cl : nid := 2.
(* Delegate server *)
Definition sd := 3.
Notation loc i k := (getLocal sv (getStatelet i k)).
Notation loc1 i := (loc i l1).
Notation loc2 i := (loc i l2).
(****************************************************)
(***********        Initial state     ***************)
(****************************************************)
Definition init_loc := st :-> ([::] : reqs).
Definition init_dstate1 := sv \\-> init_loc \+ cl \\-> init_loc.
Definition init_dstate2 := sv \\-> init_loc \+ sd \\-> init_loc.
Notation init_dstatelet1 := (DStatelet init_dstate1 Unit).
Notation init_dstatelet2 := (DStatelet init_dstate2 Unit).
Definition init_state : state :=
l1 \\-> init_dstatelet1 \+ l2 \\-> init_dstatelet2.

Lemma coh2' : calcoh prec cs2 cls2 init_dstatelet2 /\
CalcInv l2 f prec cs2 cls2 init_dstatelet2.