Fixpoint MapDomRestrByApp1 (pf : ad -> ad) (l : list ad)
(m : Map A) {struct m} : Map B -> list ad :=
match m with
| M0 => fun _ : Map B => l
| M1 a y =>
fun m' : Map B =>
match MapGet B m' a with
| None => pf a :: l
| _ => l
end
| M2 m1 m2 =>
fun m' : Map B =>
match m' with
| M0 => map_app_list1 pf l m
| M1 a' y' => map_app_list1 pf l (MapRemove A m a')
| M2 m'1 m'2 =>
MapDomRestrByApp1 (fun a0 : ad => pf (Ndouble_plus_one a0))
(MapDomRestrByApp1 (fun a0 : ad => pf (Ndouble a0)) l m1 m'1)
m2 m'2
end
end.

(* Specifications: *)
Lemma MapDomRestrByApp1_lemma_1 :
forall (m : Map A) (m' : Map B) (l : list ad) (pf : ad -> ad) (a : ad),
In a l -> In a (MapDomRestrByApp1 pf l m m').
Lemma MapDomRestrByApp1_lemma_2 :
forall (m : Map A) (m' : Map B) (l : list ad) (pf : ad -> ad) (a : ad),
in_dom _ a m = true ->
in_dom _ a m' = false -> In (pf a) (MapDomRestrByApp1 pf l m m').
Lemma MapDomRestrByApp1_lemma_3 :
forall (m : Map A) (m' : Map B) (l : list ad) (pf fp : ad -> ad),
(forall a : ad, fp (pf a) = a) ->
forall a : ad,
In a (MapDomRestrByApp1 pf l m m') ->
In a l \/
in_dom _ (fp a) m = true /\ in_dom _ (fp a) m' = false /\ pf (fp a) = a.
Lemma MapDomRestrByApp1_lemma_4 :
forall (m : Map A) (m' : Map B) (l : list ad) (pf fp : ad -> ad),
(forall a : ad, fp (pf a) = a) ->
(forall a : ad,
in_dom _ a m = true -> in_dom _ a m' = false -> ~ In (pf a) l) ->
no_dup_list _ l -> no_dup_list _ (MapDomRestrByApp1 pf l m m').