(*** Begin Module Signature Definitions and lemmas ***)
(* Here we show that canonical share trees form a boolean algrbra.  These proofs mainly involve showing that the results above commute in the proper ways with mkCanon. *)
Module BA <: BOOLEAN_ALGEBRA.
Definition t := canonTree.
Definition Ord (x y:canonTree) := shareTreeOrd (proj1_sig x) (proj1_sig y).
Definition lub (x y:canonTree) : canonTree :=
exist (fun t => canonicalTree t)
(mkCanon (union_tree (proj1_sig x) (proj1_sig y)))
(mkCanon_correct _).
Definition glb (x y:canonTree) : canonTree :=
exist (fun t => canonicalTree t)
(mkCanon (intersect_tree (proj1_sig x) (proj1_sig y)))
(mkCanon_correct _).
Definition top : canonTree := exist (fun t => canonicalTree t) (Leaf true) I.
Definition bot : canonTree := exist (fun t => canonicalTree t) (Leaf false) I.
Definition comp (x:canonTree) : canonTree :=
exist (fun t => canonicalTree t) (comp_tree (proj1_sig x))
(comp_canonical _ (proj2_sig x)).

Lemma glb_greatest : forall x y z,
Ord z x -> Ord z y -> Ord z (glb x y).