Hashing modulo alpha-equivalence

  title={Hashing modulo alpha-equivalence},
  author={Krzysztof Maziarz and Tom Ellis and Alan Christopher Lawrence and Andrew William Fitzgibbon and Simon L. Peyton Jones},
  journal={Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation},
  • Krzysztof MaziarzTom Ellis S. Jones
  • Published 6 May 2021
  • Computer Science, Mathematics
  • Proceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation
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 O(n2) 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… 

Figures and Tables from this paper

Sketch-Guided Equality Saturation: Scaling Equality Saturation to Complex Optimizations in Languages with Bindings

This paper demonstrates how to drastically improve the efficiency of equality saturation for a functional language based on the typed lambda calculus and introduces sketch-guided equality saturation, a semi-automatic technique that allows programmers to provide sketches guiding rewriting when performing complex optimizations.



Type-safe modular hash-consing

This paper introduces anocaml library that encapsulates hash-consed terms in an abstract datatype, thus safely ensuring maximal sharing and is parameterized by an equality that allows the user to identify terms according to an arbitrary equivalence relation.

Functional pearl: i am not a number--i am a free variable

This paper shows how to manipulate syntax with binding using a mixed representation of names for free variables (with respect to the task in hand) and de Bruijn indices and gives a hierarchical representation for names which naturally reflects the structure of the operations the authors implement.

Everybody's Got To Be Somewhere

This paper introduces a nameless 'co-de-Bruijn' representation which makes the opposite canonical choice, delaying discarding minimally, as near as possible to the root.

cHash: Detection of Redundant Compilations via AST Hashing

Software projects that use a compiled language are built hundreds of thousands of times during their lifespan. Hence, the compiler is invoked over and over again on an incrementally changing source

The Wizard of TILT: Efficient?, Convenient, and Abstract Type Representations

This paper recounts the experience in attempting to implement a more e cient type representation strategy into the substantial existing code base, and concludes that the abstraction and optimizations are successful, but in the end the overhead is overwhelmed by the overhead necessary to implement them.

Implementing typed intermediate languages

This paper describes the experience with implementing the FLINT typed intermediate language in the SML/NJ production compiler and observes that a type-preserving compiler will not scale to handle large types unless all of its type- Preserving stages preserve the asymptotic time and space usage in representing and manipulating types.

Clone detection using rolling hashing, suffix trees and dagification: A case study

It is found that the subsequent dag analysis to discover Type-3 clones performs well on NAV source code, both in terms of computational complexity and precision, which suggests that efficient dagification and independently configurable dag interpretation may be valuable ingredients for modular clone detection.

A Lambda Term Representation Inspired by Linear Ordered Logic

A new nameless representation of lambda terms inspired by ordered logic is introduced and an experimental evaluation of its performance in a proof checker for the Edinburgh Logical Framework is presented.

The Locally Nameless Representation

This paper provides an introduction to the locally nameless approach to the representation of syntax with variable binding, focusing in particular on the use of this technique in formal proofs.