test HeterogeneousLattice

Move some more utility methods into `TestUtils` and use them in the new
tests for `HeterogeneousLattice`.

Fix some possible testing problems by storing `Instance`s in a
`Subcontext` using a `Set`, which reflects the fact that order doesn't
matter. Also update the `hashCode` method of `Supracontext`, which
previously gave different values for different set traversal orders,
which could potentially break tests. The new way better reflects the
fact that order does not matter.