Fixpoint map_fill (A : Set) (m : Map A) {struct m} :
bool -> Map bool :=
fun b : bool =>
match m with
| M0 => M0 bool
| M1 a _ => M1 bool a b
| M2 m0 m1 => M2 bool (map_fill A m0 b) (map_fill A m1 b)
end.
Definition map_mini (A : Set) (m : Map A) : Map bool := map_fill A m false.
Definition map_maxi (A : Set) (m : Map A) : Map bool := map_fill A m true.

(* Specifications: *)
Lemma map_mini_appartient :
forall (A : Set) (x : Map A), ensemble_base A x (map_mini A x).
Lemma map_maxi_appartient :
forall (A : Set) (x : Map A), ensemble_base A x (map_maxi A x).
Lemma map_mini_mini :
forall (A : Set) (x : Map A),
mini bool lem (ensemble_base A x) (map_mini A x).
Lemma map_maxi_maxi :
forall (A : Set) (x : Map A),
maxi bool lem (ensemble_base A x) (map_maxi A x).
Lemma map_mini_mapget_false :
forall (A : Set) (x : Map A) (a : ad) (b : bool),
MapGet bool (map_mini A x) a = Some b -> b = false.
Lemma map_mini_mapget_true :
forall (A : Set) (x : Map A) (a : ad),
MapGet bool (map_mini A x) a = Some true -> False.
Lemma mlattice :
forall (A : Set) (x : Map A),
mLattice bool lem (ensemble_base A x) (map_mini A x) (map_maxi A x).