I've noticed that equal_bases($M1,$M2) does not work when the first matrix $M1 has the null space of zero dimension. For example,
polytope > $a = new Matrix([[1,0],[0,1]]);
polytope > print equal_bases($a,$a);
polymake: ERROR: operator*(GenericMatrix,GenericMatrix) - dimension mismatch at /usr/local/share/polymake/apps/common/rules/algebraic_types line 466.
The line #466 of "algebraic_types" says:
return $M1->rows==$M2->rows && is_zero(null_space($M1) * transpose($M2));
If the null space of $M1 is {0}, the command null_space($M1) returns nothing.
So it seems that an additional code is required, which checks whether both of the two matrices have the same null space {0}.