(*s [(ad_simple_path_dist x y)] computes the minimum path from x to y *)
Definition ad_simple_path_dist (x y : ad) :=
ad_simple_path_dist_1 x y nil (MapCard _ cg).

(* Specifications: *)
Lemma ad_simple_path_dist_correct_1 :
forall (x y : ad) (l : list ad) (d : D),
CG_path y d (x :: l) ->
ad_list_stutters (x :: l) = false ->
Ddle (ad_simple_path_dist x y) (Some d) = true.
Lemma ad_simple_path_dist_correct :
forall (x y : ad) (l : list ad) (d : D),
CG_path y d (x :: l) -> Ddle (ad_simple_path_dist x y) (Some d) = true.
Lemma ad_simple_path_dist_1_complete_1 :
forall (n : nat) (x y : ad) (prefix : list ad) (d' : D),
CG_path x d' (rev (x :: prefix)) ->
ad_list_stutters (x :: prefix) = false ->
forall d0 : D,
ad_simple_path_dist_1 x y prefix n = Some d0 ->
{l : list ad &
and_sp (CG_path y (Dplus d0 d') (rev (x :: prefix) ++ l))
(ad_list_stutters (rev (x :: prefix) ++ l) = false /\ length l <= n)}.
Lemma ad_simple_path_dist_1_complete :
forall (n : nat) (x y : ad) (d : D),
ad_simple_path_dist_1 x y nil n = Some d ->
{l : list ad &
and_sp (CG_path y d (x :: l)) (ad_list_stutters (x :: l) = false)}.
Lemma ad_simple_path_dist_complete :
forall (x y : ad) (d : D),
ad_simple_path_dist x y = Some d ->
{l : list ad &
and_sp (CG_path y d (x :: l)) (ad_list_stutters (x :: l) = false)}.
Lemma ad_simple_path_dist_complete_2 :
forall (x y : ad) (d : D),
ad_simple_path_dist x y = Some d -> {l : list ad &  CG_path y d (x :: l)}.
Lemma ad_simple_path_dist_complete_3 :
forall (x y : ad) (dd : option D),
(forall (l : list ad) (d : D),
CG_path y d (x :: l) -> Ddle dd (Some d) = true) ->
Ddle dd (ad_simple_path_dist x y) = true.
Lemma ad_simple_path_dist_d_1 :
forall x : ad, ad_simple_path_dist x x = Some Dz.
Lemma ad_simple_path_dist_d_2 :
forall (x y z : ad) (d d' : D),
ad_simple_path_dist x y = Some d ->
ad_simple_path_dist y z = Some d' ->
Ddle (ad_simple_path_dist x z) (Some (Dplus d' d)) = true.
Lemma ad_simple_path_dist_d_3 :
forall (x y z : ad) (d d' : D),
Ddle (ad_simple_path_dist x y) (Some d) = true ->
Ddle (ad_simple_path_dist y z) (Some d') = true ->
Ddle (ad_simple_path_dist x z) (Some (Dplus d' d)) = true.