Hashing Modulo Alpha-equivalence
Maziarz Krzysztof, Ellis Tom, Lawrence Alan, Fitzgibbon Andrew, Jones Simon Peyton. Arxiv 2021
[Paper]
ARXIV
In many applications one wants to identify identical subtrees of a program
syntax tree. This identification should ideally be robust to alpha-renaming of
the program, but no existing technique has been shown to achieve this with good
efficiency (better than in expression size). We present a
new, asymptotically efficient way to hash modulo alpha-equivalence. A key
insight of our method is to use a weak (commutative) hash combiner at exactly
one point in the construction, which admits an algorithm with time complexity. We prove that the use of the commutative combiner
nevertheless yields a strong hash with low collision probability. Numerical
benchmarks attest to the asymptotic behaviour of the method.
Similar Work