Hashing Modulo Alpha-Equivalence

Krzysztof Maziarz, Tom Ellis, Alan Lawrence, Andrew Fitzgibbon, Simon Peyton Jones
5/6/2021
cs.PLcs.DS

Official code: microsoft/hash-modulo-alpha (18 stars, Haskell, MIT, last commit 2021-09-07).

Abstract

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 $\mathcal{O}(n^2)$ in expression size).

Show full abstract

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 $\mathcal{O}(n (\log n)^2)$ 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.

View on arXivView PDF

Code Implementations(1)

MIT

Quickly hashing all subexpressions of a program modulo alpha-renaming

188Haskell, PythonNov 13, 20205 years agoMIT

Similar Papers

Cite this paper

@article{maziarz2021hashing,
  title  = {Hashing Modulo Alpha-Equivalence},
  author = {Krzysztof Maziarz and Tom Ellis and Alan Lawrence and Andrew Fitzgibbon and Simon Peyton Jones},
  year   = {2021},
  eprint = {2105.02856},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2105.02856}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2105.02856.svg)](https://codeofpaper.com/paper/2105.02856)

Discussion