End LPMap.
(** * Semi-lattice over a set. *)
(** Given a set [S: FSetInterface.S], the following functor implements a semi-lattice over these sets, ordered by inclusion. *)
Module LFSet (S: FSetInterface.WS) <: SEMILATTICE.
Definition t := S.t.
Definition eq (x y: t) := S.Equal x y.
Definition eq_refl: forall x, eq x x := S.eq_refl.
Definition eq_sym: forall x y, eq x y -> eq y x := S.eq_sym.
Definition eq_trans: forall x y z, eq x y -> eq y z -> eq x z := S.eq_trans.
Definition beq: t -> t -> bool := S.equal.
Definition beq_correct: forall x y, beq x y = true -> eq x y := S.equal_2.
Definition ge (x y: t) := S.Subset y x.

(* Specifications: *)
Lemma ge_refl: forall x y, eq x y -> ge x y.
Lemma ge_trans: forall x y z, ge x y -> ge y z -> ge x z.
Definition  bot: t := S.empty.
Lemma ge_bot: forall x, ge x bot.
Definition lub: t -> t -> t := S.union.
Lemma ge_lub_left: forall x y, ge (lub x y) x.
Lemma ge_lub_right: forall x y, ge (lub x y) y.
End LFSet.
Lemma ge_refl: forall x y, eq x y -> ge x y.
Lemma ge_trans: forall x y z, ge x y -> ge y z -> ge x z.
Definition  bot: t := S.empty.
Lemma ge_bot: forall x, ge x bot.
Definition lub: t -> t -> t := S.union.
Lemma ge_lub_left: forall x y, ge (lub x y) x.
Lemma ge_lub_right: forall x y, ge (lub x y) y.
End LFSet.