Definition f_OK (A B : Set) (f : ad -> A -> Map B) :=
forall (a a1 a2 : ad) (y1 y2 : A),
in_dom _ a (f a1 y1) = true -> in_dom _ a (f a2 y2) = true -> a1 = a2.
Definition no_dup_alist (A : Set) (l : alist A) :=
forall (a : ad) (y1 y2 : A), In (a, y1) l -> In (a, y2) l -> y1 = y2.

(* Specifications: *)
Lemma no_dup_alist_of_Map :
forall (A : Set) (m : Map A), no_dup_alist _ (alist_of_Map _ m).
Lemma my_fold_right_lemma :
forall (A B : Set) (f : ad -> A -> Map B) (l : alist A),
f_OK _ _ f ->
no_dup_alist _ l ->
forall (a : ad) (y : B),
MapGet _
(fold_right
(fun (r : ad * A) (m0 : Map B) =>
let (a0, y0) := r in MapMerge B (f a0 y0) m0)
(M0 B) l) a = Some y <->
(exists a1 : ad,
(exists y1 : A, In (a1, y1) l /\ MapGet _ (f a1 y1) a = Some y)).