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.

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).