Everybody's Got To Be Somewhere

07/11/2018
by   Conor McBride, et al.
0

The key to any nameless representation of syntax is how it indicates the variables we choose to use and thus, implicitly, those we discard. Standard de Bruijn representations delay discarding maximally till the leaves of terms where one is chosen from the variables in scope at the expense of the rest. Consequently, introducing new but unused variables requires term traversal. 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. It is literate Agda: dependent types make it a practical joy to express and be driven by strong intrinsic invariants which ensure that scope is aggressively whittled down to just the support of each subterm, in which every remaining variable occurs somewhere. The construction is generic, delivering a universe of syntaxes with higher-order metavariables, for which the appropriate notion of substitution is hereditary. The implementation of simultaneous substitution exploits tight scope control to avoid busywork and shift terms without traversal. Surprisingly, it is also intrinsically terminating, by structural recursion alone.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
02/02/2023

A Framework for Higher-Order Effects Handlers

Algebraic effects handlers are a modular approach for modeling side-...
research
01/29/2020

A Type and Scope Safe Universe of Syntaxes with Binding: Their Semantics and Proofs

Almost every programming language's syntax includes a notion of binder a...
research
07/05/2018

Abstract Representation of Binders in OCaml using the Bindlib Library

The Bindlib library for OCaml provides a set of tools for the manipulati...
research
05/05/2021

Refinements of Futures Past: Higher-Order Specification with Implicit Refinement Types (Extended Version)

Refinement types decorate types with assertions that enable automatic ve...
research
09/20/2018

Permutation Invariant Gaussian Matrix Models

Permutation invariant Gaussian matrix models were recently developed for...
research
03/26/2020

Data-Driven Inference of Representation Invariants

A representation invariant is a property that holds of all values of abs...

Please sign up or login with your details

Forgot password? Click here to reset