Clean up lattices a bit.

This commit introduces generic semilattices (and bounded semilattices).
It also adds some useful conversions to/from the various lattice types,
as well as conversions to PartialOrder instances.

It also moves some operations from Bool onto Heyting (where they are
just as valid) and provides a method to get a commutative ring from
a heyting algebra.