Everybody's Got To Be Somewhere
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 res...
Main Author: | |
---|---|
Format: | Article |
Language: | English |
Published: |
Open Publishing Association
2018-07-01
|
Series: | Electronic Proceedings in Theoretical Computer Science |
Online Access: | http://arxiv.org/pdf/1807.04085v1 |
id |
doaj-8a1fcca61bc047f3824f201d4c6ef53e |
---|---|
record_format |
Article |
spelling |
doaj-8a1fcca61bc047f3824f201d4c6ef53e2020-11-25T02:11:02ZengOpen Publishing AssociationElectronic Proceedings in Theoretical Computer Science2075-21802018-07-01275Proc. MSFP 2018536910.4204/EPTCS.275.6:1Everybody's Got To Be SomewhereConor McBride0 University of Strathclyde 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.http://arxiv.org/pdf/1807.04085v1 |
collection |
DOAJ |
language |
English |
format |
Article |
sources |
DOAJ |
author |
Conor McBride |
spellingShingle |
Conor McBride Everybody's Got To Be Somewhere Electronic Proceedings in Theoretical Computer Science |
author_facet |
Conor McBride |
author_sort |
Conor McBride |
title |
Everybody's Got To Be Somewhere |
title_short |
Everybody's Got To Be Somewhere |
title_full |
Everybody's Got To Be Somewhere |
title_fullStr |
Everybody's Got To Be Somewhere |
title_full_unstemmed |
Everybody's Got To Be Somewhere |
title_sort |
everybody's got to be somewhere |
publisher |
Open Publishing Association |
series |
Electronic Proceedings in Theoretical Computer Science |
issn |
2075-2180 |
publishDate |
2018-07-01 |
description |
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. |
url |
http://arxiv.org/pdf/1807.04085v1 |
work_keys_str_mv |
AT conormcbride everybodysgottobesomewhere |
_version_ |
1724916771306078208 |