A method, apparatus, and computer program product for determining, in a
computer environment, the equivalence, if any, of two algebraic
expressions. The expressions are recast into a form of one or more token
pairs arranged sequentially in a string, such that each token pair
includes an operator followed by an operand. The strings are reduced in
accordance with a set of predetermined simplifying rules. The reduced
strings are compared by matching, to detect equivalence of the two
algebraic expressions. The source code is compiled into object code,
wherein the source code includes the two algebraic expressions, and
wherein the compiling includes the recasting, the reducing, and the
comparing. The method, apparal us, and computer program product may be
used in compiler optimisation of source code and like computing tasks.