Section IntervalLattice.
Variable (disp : unit) (T : latticeType disp).
Implicit Types (x y z : T) (b bl br : itv_bound T) (i : interval T).
Definition bound_meet bl br : itv_bound T :=
match bl, br with
| -oo, _ | _, -oo => -oo
| +oo, b | b, +oo => b
| BSide xb x, BSide yb y =>
BSide (((x <= y) && xb) || ((y <= x) && yb)) (x `&` y)
end.
Definition bound_join bl br : itv_bound T :=
match bl, br with
| -oo, b | b, -oo => b
| +oo, _ | _, +oo => +oo
| BSide xb x, BSide yb y =>
BSide ((~~ (x <= y) || yb) && (~~ (y <= x) || xb)) (x `|` y)
end.

Lemma bound_meetC : commutative bound_meet.