(*s Adding a lis of adresses connected to [root] with weight $0$ *)
Fixpoint CG_add_root (root : ad) (cg : CGraph1) (l : list ad) {struct l} :
CGraph1 :=
match l with
| nil => cg
| x :: l' => CG_add_root root (CG_add cg root x Dz) l'
end.

(* Specifications: *)
Lemma CG_add_root_out_of_range :
forall (l : list ad) (cg : CGraph1) (root : ad),
(forall (x0 : ad) (d0 : D) (l : list ad),
CG_path cg x0 d0 (x0 :: l) -> Dle Dz d0 = true) ->
MapSubset _ _ (Elems l) (MapDom _ cg) ->
ad_in_list root l = false ->
in_dom _ root (cg_range cg) = false ->
forall (x0 : ad) (d0 : D) (l0 : list ad),
CG_path (CG_add_root root cg l) x0 d0 (x0 :: l0) -> Dle Dz d0 = true.
Lemma CG_add_rooted_1 :
forall (cg : CGraph1) (root a : ad) (d : D),
CG_edge cg root a = None -> CG_edge (CG_add cg root a d) root a = Some d.
Lemma CG_add_root_rooted_1 :
forall (l : list ad) (cg : CGraph1) (root a : ad),
ad_list_stutters l = false ->
ad_in_list a l = false ->
forall d : D,
CG_edge cg root a = Some d ->
CG_edge (CG_add_root root cg l) root a = Some d.
Lemma CG_add_root_rooted_2 :
forall (l : list ad) (cg : CGraph1) (root : ad),
ad_list_stutters l = false ->
(forall a0 : ad, ad_in_list a0 l = true -> CG_edge cg root a0 = None) ->
forall a : ad,
ad_in_list a l = true -> CG_edge (CG_add_root root cg l) root a = Some Dz.
Lemma CG_add_root_rooted_3 :
forall (cg : CGraph1) (root : ad),
in_dom _ root cg = false ->
forall a : ad,
in_dom _ a cg = true ->
CG_edge (CG_add_root root cg (ad_list_of_dom _ cg)) root a = Some Dz.
Lemma CG_add_root_rooted_4 :
forall (l : list ad) (cg : CGraph1) (root a : ad),
in_dom _ a (CG_add_root root cg l) = true ->
{a = root} + {in_dom _ a cg = true}.
Lemma CG_edge_dist_some_1 :
forall (n : nat) (cg : CGraph1) (x y : ad) (d : D) (prefix : list ad),
CG_edge cg x y = Some d ->
ad_in_list y prefix = false ->
{d' : D |
Ddle (ad_simple_path_dist_1 cg x y prefix (S n)) (Some d') = true}.
Lemma CG_edge_dist_some :
forall (cg : CGraph1) (x y : ad) (d : D),
CG_edge cg x y = Some d ->
{d' : D | ad_simple_path_dist cg x y = Some d'}.
Lemma CG_add_root_rooted :
forall (cg : CGraph1) (root : ad),
(forall (x : ad) (d : D) (l : list ad),
CG_path cg x d (x :: l) -> Dle Dz d = true) ->
in_dom _ root cg = false ->
forall a : ad,
in_dom _ a (CG_add_root root cg (ad_list_of_dom _ cg)) = true ->
CG_leq (CG_add_root root cg (ad_list_of_dom _ cg)) root a = true.
Lemma CG_add_sat :
forall (cg : CGraph1) (root a : ad) (d : D) (rho : ad -> D),
CGsat (cg2 cg root a d) rho -> CGsat cg rho.
Lemma CG_add_root_sat :
forall (l : list ad) (cg : CGraph1) (root : ad) (rho : ad -> D),
CGsat (CG_add_root root cg l) rho -> CGsat cg rho.
Lemma CG_add_root_consistent :
forall (l : list ad) (cg : CGraph1) (root : ad),
CGconsistent (CG_add_root root cg l) -> CGconsistent cg.
Lemma CG_circuit_complete_1 :
forall cg : CGraph1,
(forall (x : ad) (d : D) (l : list ad),
CG_path cg x d (x :: l) -> Dle Dz d = true) ->
forall root : ad,
root = ad_alloc_opt unit (FSetUnion (MapDom _ cg) (MapDom _ (cg_range cg))) ->
forall cg' : CGraph1,
cg' = CG_add_root root cg (ad_list_of_dom _ cg) -> CGconsistent cg.