Section CombineGreeters.
Variables (l1 l2 : Label) (nodes : seq nid) (this : nid).
Variable (lab_disj : l2 != l1).
Definition gp1 := GreeterProtocol nodes l1.
Definition gp2 := GreeterProtocol nodes l2.
Definition V := (W l1 nodes) \+ (W l2 nodes).
Notation loc i k := (getLocal this (getStatelet i k)).
Notation msgs i k := (dsoup (getStatelet i k)).
Hypothesis T : this \in nodes.
Definition greet_prog1 := greet2 l1 T.
Definition greet_prog2 := greet2 l2 T.
Definition greeter_spec3 n1 n2 to :=
DHT [this, V]
(fun i =>
[/\ loc i l1 = counter :-> n1,
loc i l2 = counter :-> n2 &
to \in nodes],
fun r m =>
[/\ loc m l1 = counter :-> n1.+2,
loc m l2 = counter :-> n2.+2 &
r = n1 + n2 + 2]).
Next Obligation. exact Unit. Defined.
Next Obligation.
rewrite -(unitR V)/V.
have V: valid (W l1 nodes \+ W l2 nodes \+ Unit) by rewrite unitR validV.
apply: (injectR V); do?[apply: hook_complete_unit | apply: hooks_consistent_unit].
by move=>??????; rewrite dom0.
Defined.

Lemma hcomp l : hook_complete (W l nodes).