Fixpoint MapCanonicalize (m:Map A) : Map A :=
    match m with
    | M2 m0 m1 => makeM2 A (MapCanonicalize m0) (MapCanonicalize m1)
    | _ => m
    end.

(* Specifications: *)
Lemma mapcanon_exists_1 : forall m:Map A, eqmap A m (MapCanonicalize m).
Lemma mapcanon_exists_2 : forall m:Map A, mapcanon (MapCanonicalize m).
Lemma mapcanon_exists : forall m:Map A, {m' : Map A | eqmap A m m' /\ mapcanon m'}.
Lemma MapRemove_canon : forall m:Map A, mapcanon m -> forall a:ad, mapcanon (MapRemove A m a).
Lemma MapMerge_canon : forall m m':Map A, mapcanon m -> mapcanon m' -> mapcanon (MapMerge A m m').
Lemma MapDelta_canon : forall m m':Map A, mapcanon m -> mapcanon m' -> mapcanon (MapDelta A m m').
Lemma MapDomRestrTo_canon : forall m:Map A, mapcanon m -> forall m':Map B, mapcanon (MapDomRestrTo A B m m').
Lemma MapDomRestrBy_canon : forall m:Map A, mapcanon m -> forall m':Map B, mapcanon (MapDomRestrBy A B m m').
Lemma Map_of_alist_canon : forall l:alist A, mapcanon (Map_of_alist A l).
Lemma MapSubset_c_1 : forall (m:Map A) (m':Map B), mapcanon m -> MapSubset A B m m' -> MapDomRestrBy A B m m' = M0 A.
Lemma MapSubset_c_2 : forall (m:Map A) (m':Map B), MapDomRestrBy A B m m' = M0 A -> MapSubset A B m m'.
Lemma MapDom_canon : forall m:Map A, mapcanon A m -> mapcanon unit (MapDom A m).
Lemma MapFold_canon_1 : forall m0:Map B, mapcanon B m0 -> forall op:Map B -> Map B -> Map B, (forall m1:Map B, mapcanon B m1 -> forall m2:Map B, mapcanon B m2 -> mapcanon B (op m1 m2)) -> forall f:ad -> A -> Map B, (forall (a:ad) (y:A), mapcanon B (f a y)) -> forall (m:Map A) (pf:ad -> ad), mapcanon B (MapFold1 A (Map B) m0 op f pf m).
Lemma MapFold_canon : forall m0:Map B, mapcanon B m0 -> forall op:Map B -> Map B -> Map B, (forall m1:Map B, mapcanon B m1 -> forall m2:Map B, mapcanon B m2 -> mapcanon B (op m1 m2)) -> forall f:ad -> A -> Map B, (forall (a:ad) (y:A), mapcanon B (f a y)) -> forall m:Map A, mapcanon B (MapFold A (Map B) m0 op f m).
Lemma MapCollect_canon : forall f:ad -> A -> Map B, (forall (a:ad) (y:A), mapcanon B (f a y)) -> forall m:Map A, mapcanon B (MapCollect A B f m).