Published online by Cambridge University Press: 01 June 2007
We give the first linear time (randomised) algorithm for the first order isomorphism problem, that is, the isomorphism of non-recursive types involving product- and function-type constructors, under the axioms of commutativity and associativity of products, currying and distributivity of functions over products. This problem can also be thought of as the problem of formal equality-testing of multi-variate expressions involving only multiplications and exponentiation. Previous work gave a deterministic O(n log2n) time and O(n) space algorithm for the problem (n being the input size). Our specific contribution includes two randomised algorithms for the problem:
(i) an O(n) time Monte Carlo algorithm (that is, with a small probability it may decide erroneously that the two types are isomorphic), and
(ii) an O(n log n) expected time and O(n) space Las Vegas algorithm (that is, with a small probability it may execute long).