Fixpoint MapPut_behind (m:Map) : ad -> A -> Map :=
    match m with
    | M0 => M1
    | M1 a y =>
        fun (a':ad) (y':A) =>
          match Nxor a a' with
          | N0 => m
          | Npos p => MapPut1 a y a' y' p
          end
    | M2 m1 m2 =>
        fun (a:ad) (y:A) =>
          match a with
          | N0 => M2 (MapPut_behind m1 N0 y) m2
          | Npos xH => M2 m1 (MapPut_behind m2 N0 y)
          | Npos (xO p) => M2 (MapPut_behind m1 (Npos p) y) m2
          | Npos (xI p) => M2 m1 (MapPut_behind m2 (Npos p) y)
          end
    end.

(* Specifications: *)
Lemma MapPut_behind_semantics_3_1 : forall (m m':Map) (a:ad) (y:A), MapPut_behind (M2 m m') a y = (if Nbit0 a then M2 m (MapPut_behind m' (Ndiv2 a) y) else M2 (MapPut_behind m (Ndiv2 a) y) m').
Lemma MapPut_behind_as_before_1 : forall a a' a0:ad, Neqb a' a0 = false -> forall y y':A, MapGet (MapPut (M1 a y) a' y') a0 = MapGet (MapPut_behind (M1 a y) a' y') a0.
Lemma MapPut_behind_as_before : forall (m:Map) (a:ad) (y:A) (a0:ad), Neqb a a0 = false -> MapGet (MapPut m a y) a0 = MapGet (MapPut_behind m a y) a0.
Lemma MapPut_behind_new : forall (m:Map) (a:ad) (y:A), MapGet (MapPut_behind m a y) a = match MapGet m a with | Some y' => Some y' | _ => Some y end.
Lemma MapPut_behind_semantics : forall (m:Map) (a:ad) (y:A), eqm (MapGet (MapPut_behind m a y)) (fun a':ad => match MapGet m a' with | Some y' => Some y' | _ => if Neqb a a' then Some y else None end).