(*s [(ad_simple_path_dist_1 x y l n)] computes the minimum weight of a path from [x] to [y] of maximal length [n] which does not contain vertexes from [l] *)
Fixpoint ad_simple_path_dist_1 (x y : ad) (l : list ad)
(n : nat) {struct n} : option D :=
if Neqb x y
then Some Dz
else
match n with
| O => None
| S n' =>
match MapGet _ cg x with
| None => None
| Some edges =>
let l' := x :: l in (* builds reverse path *)
all_min
(fun (z : ad) (d : D) =>
if ad_in_list z l'
then None
else Ddplus (ad_simple_path_dist_1 z y l' n') d) edges
end
end.

(* Specifications: *)
Lemma ad_simple_path_dist_1_correct_1 :
forall (n : nat) (x y : ad) (l : list ad) (d : D),
length l <= n ->
CG_path y d (x :: l) ->
forall prefix : list ad,
ad_list_stutters (rev prefix ++ x :: l) = false ->
Ddle (ad_simple_path_dist_1 x y prefix n) (Some d) = true.
Lemma ad_simple_path_dist_1_correct_2 :
forall (n : nat) (x y : ad) (l : list ad) (d : D),
length l <= n ->
CG_path y d (x :: l) ->
ad_list_stutters (x :: l) = false ->
Ddle (ad_simple_path_dist_1 x y nil n) (Some d) = true.