Everybody's got to be somewhere

Research output: Contribution to journalConference Contributionpeer-review

9 Citations (Scopus)
82 Downloads (Pure)


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.
Original languageEnglish
Pages (from-to)53-69
Number of pages17
JournalElectronic Proceedings in Theoretical Computer Science
Publication statusPublished - 10 Jul 2018
EventMathematically Structured Functional Programming - Blavatnik School of Government, Oxford, United Kingdom
Duration: 8 Jul 20188 Jul 2018
Conference number: 7


  • variables
  • syntaxes
  • nameless representation
  • structural recursion


Dive into the research topics of 'Everybody's got to be somewhere'. Together they form a unique fingerprint.

Cite this