(*s [(CG_add x y d)] adds the edge (x,y) of weight d to G, 
   in case an edge already exists, only the minimal one is kept
*)

Definition CG_add (x y : ad) (d : D) :=
  match MapGet _ cg x with
  | None => MapPut _ cg x (M1 _ y d)
  | Some edges =>
      match MapGet _ edges y with
      | None => MapPut _ cg x (MapPut _ edges y d)
      | Some d0 => MapPut _ cg x (MapPut _ edges y (Dmin d d0))
      end
  end.Definition cg2 := CG_add cg1 x y d.

Lemma CG_add_5_1 : forall n : nat, (forall (x0 : ad) (d0 : D) (l : list ad), CG_path cg1 x0 d0 (x0 :: l) -> Dle Dz d0 = true) -> Ddle (Some (Dneg d)) (ad_simple_path_dist cg1 y x) = true -> forall (x0 : ad) (d0 : D) (l : list ad), CG_path cg2 x0 d0 (x0 :: l) -> length l <= n -> Dle Dz d0 = true.