(*s [(CG_standard_rho root d0 others x)] computes [d0-d] when [root] and [x] are connected by a path of minimal length [d] and [(others x)] when there are not connected *)
Definition CG_standard_rho (root : ad) (d0 : D) (others : ad -> D)
(x : ad) :=
match ad_simple_path_dist root x with
| Some d => Dplus d0 (Dneg d)
| None => others x (* dummy *)
end.

(* Specifications: *)
Lemma CG_standard_rho_root :
forall (root : ad) (d0 : D) (others : ad -> D),
CG_standard_rho root d0 others root = d0.
(*s If there is a root such that all the nodes ae connected to this root, then [CG_standard_rho] gives a correct valuation *)
Lemma CG_rooted_sat_1 :
forall (root : ad) (d0 : D) (others : ad -> D),
(forall x : ad, in_dom _ x cg = true -> CG_leq root x = true) ->
CGsat (CG_standard_rho root d0 others).
Lemma CG_rooted_sat :
forall (root : ad) (d0 : D),
(forall x : ad, in_dom _ x cg = true -> CG_leq root x = true) ->
{rho : ad -> D | CGsat rho /\ rho root = d0}.
(*s The [CG_standard_rho] valuation is the minimal one *)
Lemma CG_standard_rho_minimal :
forall (root : ad) (d0 : D) (others rho : ad -> D),
CGsat rho ->
Dle d0 (rho root) = true ->
forall x : ad,
CG_leq root x = true ->
Dle (CG_standard_rho root d0 others x) (rho x) = true.
Lemma CG_sat_add_1 :
forall (x y : ad) (d : D) (rho : ad -> D),
CGsat rho ->
Dle (rho x) (Dplus (rho y) d) = true ->
Ddle (Some (Dneg d)) (ad_simple_path_dist y x) = true.