Section My_Map.
Variable A B : Set.
Fixpoint Mapn (n : nat) : Set :=
match n with
| O => A
| S m => Map (Mapn m)
end.
(* Left to define MapGetn, MapPutn, MapPutn_semantics ... *)
Definition MapGet2 (m : Map (Map A)) (a b : ad) :=
match MapGet _ m a with
| None => None
| Some m' => MapGet _ m' b
end.
Definition MapGet3 (m : Map (Map (Map A))) (a b c : ad) :=
match MapGet _ m a with
| None => None
| Some m' => MapGet2 m' b c
end.
Definition MapPut2 (m : Map (Map A)) (a b : ad) (c : A) :=
match MapGet _ m a with
| Some m' => MapPut _ m a (MapPut _ m' b c)
| None => MapPut _ m a (M1 _ b c)
end.
Definition MapPut3 (m : Map (Map (Map A))) (a b c : ad)
(d : A) :=
match MapGet _ m a with
| Some m' => MapPut _ m a (MapPut2 m' b c d)
| None => MapPut _ m a (M1 _ b (M1 _ c d))
end.

(* Specifications: *)
Lemma MapPut2_semantics :
forall (m : Map (Map A)) (a b a1 b1 : ad) (c : A),
MapGet2 (MapPut2 m a b c) a1 b1 =
(if Neqb a a1 && Neqb b b1 then Some c else MapGet2 m a1 b1).
Lemma MapPut3_semantics :
forall (m : Map (Map (Map A))) (a b c a1 b1 c1 : ad) (d : A),
MapGet3 (MapPut3 m a b c d) a1 b1 c1 =
(if Neqb a a1 && (Neqb b b1 && Neqb c c1)
then Some d
else MapGet3 m a1 b1 c1).
Lemma makeM2_MapDom_lemma :
forall (A : Set) (m1 m2 : Map A),
makeM2 unit (MapDom A m1) (MapDom A m2) = MapDom A (makeM2 A m1 m2).