HackerPapers

arXiv:1807.04085cs.LO

Everybody's Got To Be Somewhere

Conor McBride

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

Abstract

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.

arXiv comments
In Proceedings MSFP 2018, arXiv:1807.03732
Journal reference
EPTCS 275, 2018, pp. 53-69
DOI
doi:10.4204/EPTCS.275.6
Subjects
cs.LOLogic in Computer Science cs.PLProgramming Languages

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Oct 2020 to Oct 2020.

Comments linking this paper, per year.

Discussed in comments1 thread

  1. Fun with Combinators 1 comment
    • There are tricky aspects, and I've tripped up a few times over the years. Most annoying is trying to make a 'step' function from lambda terms to lambda terms; we either need to produce a separate closure type instead, or encode those closures to lambda terms (which may defeat…

      chriswarboView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.