x == y
Returns true or false, depending on whether the objects x and y are (mathematically) equal. The objects x and y are typically numbers, elements of rings, matrices, modules, ideals, chain complexes, and so on.
A test for mathematical equality will typically involve doing a computation to see whether two representations of the same mathematical object are being compared. For example, an ideal in a ring is represented by giving its generators, and checking whether two sets of generators produce the same ideal involves a computation with GrÃ¶bner bases. The ideals must be defined in the same ring.


Often mathematical objects can be tested to see if they are 0 or 1.



Two matrices are equal if their entries are equal, the source and target are the same (including degrees), and the degree of the matrices are the same. In this example, m and n have different source free modules.




If you only want to know if they have the same entries, test the difference against zero.

Two modules are equal if they are isomorphic as subquotients of the same ambient free module.


If either side of the equality is an RRi, the equality is an equality of sets.



It may happen that for certain types of objects, there is no method installed (yet) for testing mathematical equality, in which case an error message will be printed. A good alternative may be to test for strict equality with the operator ===.
Since various sorts of mathematical objects are implemented as types, i.e., as instances of Type, there is no generic method for checking equality of types, so that new mathematical comparison code can be provided in the future without breaking code that works.
This operator may be used as a binary operator in an expression like x==y. The user may install binary methods for handling such expressions with code such as
X == Y := (x,y) > ...
where X is the class of x and Y is the class of y.