(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the GNU General Public License as published by  *)
(*  the Free Software Foundation, either version 2 of the License, or  *)
(*  (at your option) any later version.  This file is also distributed *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Constructions of semi-lattices. *)
(* To avoid useless definitions of inductors in extracted code. *)
Local Unset Elimination Schemes.
Local Unset Case Analysis Schemes.
(** * Signatures of semi-lattices *)
(** A semi-lattice is a type [t] equipped with an equivalence relation [eq], a boolean equivalence test [beq], a partial order [ge], a smallest element [bot], and an upper bound operation [lub]. Note that we do not demand that [lub] computes the least upper bound. *)
Module Type SEMILATTICE.
Parameter t: Type.
Parameter eq: t -> t -> Prop.

(* Specifications: *)
Axiom eq_refl: forall x, eq x x.
Axiom eq_sym: forall x y, eq x y -> eq y x.
Axiom eq_trans: forall x y z, eq x y -> eq y z -> eq x z.
Parameter beq: t -> t -> bool.
Axiom beq_correct: forall x y, beq x y = true -> eq x y.
Parameter ge: t -> t -> Prop.
Axiom ge_refl: forall x y, eq x y -> ge x y.
Axiom ge_trans: forall x y z, ge x y -> ge y z -> ge x z.
Parameter bot: t.
Axiom ge_bot: forall x, ge x bot.
Parameter lub: t -> t -> t.
Axiom ge_lub_left: forall x y, ge (lub x y) x.
Axiom ge_lub_right: forall x y, ge (lub x y) y.
End SEMILATTICE.
Axiom eq_refl: forall x, eq x x.
Axiom eq_sym: forall x y, eq x y -> eq y x.
Axiom eq_trans: forall x y z, eq x y -> eq y z -> eq x z.
Parameter beq: t -> t -> bool.
Axiom beq_correct: forall x y, beq x y = true -> eq x y.
Parameter ge: t -> t -> Prop.
Axiom ge_refl: forall x y, eq x y -> ge x y.
Axiom ge_trans: forall x y z, ge x y -> ge y z -> ge x z.
Parameter bot: t.
Axiom ge_bot: forall x, ge x bot.
Parameter lub: t -> t -> t.
Axiom ge_lub_left: forall x y, ge (lub x y) x.
Axiom ge_lub_right: forall x y, ge (lub x y) y.
End SEMILATTICE.