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, theisomorphism of non-recursive types involving product- and function-typeconstructors, under the axioms of commutativity and associativity of products,currying and distributivity of functions over products. This problem can also bethought of as the problem of formal equality-testing of multi-variateexpressions involving only multiplications and exponentiation. Previous workgave a deterministic O(n log2n) time and O(n) space algorithm for the problem (n being the input size). Our specific contributionincludes two randomised algorithms for the problem:
(i) an O(n) time Monte Carloalgorithm (that is, with a small probability it may decideerroneously that the two types are isomorphic), and
(ii) an O(n log n) expectedtime and O(n) space LasVegas algorithm (that is, with a small probability itmay execute long).