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