Definition opt_lub (x y: L.t) : option L.t :=
let z := L.lub x y in
if L.beq z L.top then None else Some z.
Definition lub (x y: t) : t :=
match x, y with
| Bot, _ => y
| _, Bot => x
| Top_except m, Top_except n =>
Top_except
(LM.combine
(fun a b =>
match a, b with
| Some u, Some v => opt_lub u v
| _, _ => None
end)
m n)
end.

(* Specifications: *)
Lemma gcombine_top:
forall f t1 t2 p,
f None None = None ->
L.eq (get p (Top_except (LM.combine f t1 t2)))
(match f t1!p t2!p with Some x => x | None => L.top end).
Lemma ge_lub_left:
forall x y, ge (lub x y) x.
Lemma ge_lub_right:
forall x y, ge (lub x y) y.
Lemma gcombine_top:
forall f t1 t2 p,
f None None = None ->
L.eq (get p (Top_except (LM.combine f t1 t2)))
(match f t1!p t2!p with Some x => x | None => L.top end).
Lemma ge_lub_left:
forall x y, ge (lub x y) x.
Lemma ge_lub_right:
forall x y, ge (lub x y) y.