lattice: add Pattern.eq for semantic equality

Currently it's the same as structural equality. Hopefully this will be
preserved.