This function takes a list of invariants, finds the equality
Comparison invariants (x==y, y==z), and deletes and replaces them
with Equality invariants (x==y==z). The first variable in an
Equality invariant is always the canonical variable of the group.
The Equality invariants are inserted into the beginning. Equality
invariants are useful when it comes to displaying invariants.