## I am not a number: I am a free variable (2004)

Venue: | In Haskell workshop |

Citations: | 3 - 0 self |

### BibTeX

@INPROCEEDINGS{Mcbride04iam,

author = {Conor Mcbride and James Mckinna},

title = {I am not a number: I am a free variable},

booktitle = {In Haskell workshop},

year = {2004}

}

### OpenURL

### Abstract

In this paper, we show 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 [dB72] for bound variables. By doing so, we retain the advantages of both representations: naming supports easy, arithmetic-free manipulation of terms; de Bruijn indices eliminate the need for α-conversion. Further, we have ensure that not only the user but also the implementation need never deal with de Bruijn indices, except within key basic operations. Moreover, we give a representation for names which readily supports a power structure naturally reflecting the structure of the implementation. Name choice is safe and straightforward. Our technology combines easily with an approach to syntax manipulation inspired by Huet’s ‘zippers’[Hue97]. Without the technology in this paper, we could not have implemented Epigram [McB04]. Our example—constructing inductive elimination operators for datatype families—is but one of many where it proves invaluable. Prologue In conversation, we like to have names for the people we’re talking about. If we had to say things like ‘the person three to the left of me ’ rather than ‘Fred’, things would get complicated whenever anyone went to the lavatory. You don’t need to have formalized the strengthening property for Pure Type Systems [MP99] to appreciate this basic phenomenon of social interaction. It is in the company of strangers that more primitive pointing-based modes of reference acquire a useful rôle as a way of indicating unambiguously an individual with no socially agreed name. Even so, once a stranger enters the context of the conversation, he or she typically acquires a name. What this name is and who chooses it depends on the power relationships between those involved, as we learned in the playground at school. Moreover, if we are having a conversation about hypothetical individuals—say, Alice, Bob and Unscrupulous Charlie—we have a tendency to name them locally to the discussion. We do not worry about whether Unscrupulous Charlie might actually turn out to be called Shameless David whenever he turns up. That is, we exploit naming locally to assist the construction of explanations which apply to individuals regardless of what they are called. 1 1

### Citations

179 | Lambda lifting: transforming programs to recursive equations
- Johnsson
- 1985
(Show Context)
Citation Context ...g → (Binding, Expr → Expr) generalize bindings (me :∈ expr) = (me :∈ bindings → expr, substitute (me −$$ bindings) me) Indeed, working in a λ-calculus, these tools make it easy to implement λ-lifting =-=[Joh85]-=-, and also the ‘raising’ step in Miller’s unification algorithm, working under a mixed prefix of existential and universal quantifiers [Mil92]. 6 Example—inductive elimination operators for datatype f... |

153 |
The view from the left
- McBride, McKinna
(Show Context)
Citation Context ...laration of an inductive datatype (by declaring the types of its constructors), how might one construct its induction principle? We encounter such issues all the time in the implementation of Epigram =-=[MM04]-=-. But as we develop new technology to support programming and reasoning in advanced type systems, but we must handle them effectively with today’s technology. We work in Haskell and so do our students... |

124 | Unification under a mixed prefix
- Miller
- 1992
(Show Context)
Citation Context ...calculus, these tools make it easy to implement λ-lifting [Joh85], and also the ‘raising’ step in Miller’s unification algorithm, working under a mixed prefix of existential and universal quantifiers =-=[Mil92]-=-. 6 Example—inductive elimination operators for datatype families We shall now use our tools to develop our example—constructing induction principles. To make things a little more challenging, and a l... |

108 |
Computation and Reasoning, A Type Theory for Computer Science
- Luo
- 1994
(Show Context)
Citation Context ...claration of the family takes the form of a binding for the type constructor and a context of data constructors which have already been checked for validity, say, according to the schema given by Luo =-=[Luo94]-=-—checking as we go just requires a little extra work and a shift to an appropriate monad. Luo’s schema is a sound (but by no means complete) set of syntactic conditions on family declarations which gu... |

107 |
An algorithm for testing conversion in type theory
- Coquand
- 1991
(Show Context)
Citation Context ...ntactically is also far from new. Gentzen [Gen69], Kleene [Kle52] and Prawitz [Pra65] certainly exploit it. The second author learned it from Randy Pollack who learned it in turn from Thierry Coquand =-=[Coq91]-=-; the first author learned it from the second. The idea of using free names and bound indices is not new either—it is a common representation in interactive proof systems. Here ‘free’ means ‘bound glo... |

92 | The zipper
- Huet
- 1997
(Show Context)
Citation Context ...e naturally reflecting the structure of the implementation. Name choice is safe and straightforward. Our technology combines easily with an approach to syntax manipulation inspired by Huet’s ‘zippers’=-=[Hue97]-=-. Without the technology in this paper, we could not have implemented Epigram [McB04]. Our example—constructing inductive elimination operators for datatype families—is but one of many where it proves... |

86 |
How to replace failure by a list of successes
- Wadler
- 1985
(Show Context)
Citation Context ...constructions for non-recursive and recursive arguments (3 and 4, above) by making Stack an instance of the MonadPlus class in exactly the same ‘list of successes’ style as we have for ordinary lists =-=[Wad85]-=-. The non-recursive constructor arguments give rise to an empty Prefix (= Stack Binding) of inductive hypothesis bindings. indhyp :: Binding → Prefix indhyp (arg :∈ argtype) = do guard (argfam==family... |

77 | Monadic presentations of lambda terms using generalized inductive types - Altenkirch, Reus - 1999 |

76 | Inductive sets and families in Martin-Löfs Type Theory and their set-theoretic semantics: An inversion principle for Martin-Löfs type theory
- Dybjer
- 1991
(Show Context)
Citation Context ...on principles. To make things a little more challenging, and a little closer to home, let us consider the more general problem of constructing the inductive elimination operator for a datatype family =-=[Dyb91]-=-. Datatype families are collections of sets defined not parametrically as in HindleyMilner languages, but by mutual induction, indexed over other data. They are the cornerstone of our dependently type... |

68 | R.: De Bruijn notation as a nested datatype - Bird, Paterson - 1999 |

66 |
1969] The Collected Papers of Gerhard Gentzen
- Gentzen
(Show Context)
Citation Context ...l is arbitrary was observed in the context of natural language by Saussure [dS83]. In formal languages, the idea of distinguishing free and bound variables syntactically is also far from new. Gentzen =-=[Gen69]-=-, Kleene [Kle52] and Prawitz [Pra65] certainly exploit it. The second author learned it from Randy Pollack who learned it in turn from Thierry Coquand [Coq91]; the first author learned it from the sec... |

52 | R.: Some lambda calculus and type theory formalized
- McKinna, Pollack
- 1999
(Show Context)
Citation Context ...rson three to the left of me’ rather than ‘Fred’, things would get complicated whenever anyone went to the lavatory. You don’t need to have formalized the strengthening property for Pure Type Systems =-=[MP99]-=- to appreciate this basic phenomenon of social interaction. It is in the company of strangers that more primitive pointing-based modes of reference acquire a useful rôle as a way of indicating unambig... |

43 | Pure type systems formalized - McKinna, Pollack - 1993 |

37 | Elimination with a motive
- McBride
- 2000
(Show Context)
Citation Context ...c �a) where the � H are the inductive hypotheses, specified as follows. 3. Non-recursive constructor arguments a : A do not mention F in A and contribute no inductive hypothesis. 1 We prefer ‘motive’ =-=[McB02]-=- to ‘induction predicate’, because a motive need not be a predicate (i.e., a constructor of propositions) nor need an elimination operator be inductive. 11s4. Recursive constructor arguments have form... |

32 |
de Saussure, Course in General Linguistics
- Ferdinand
- 1983
(Show Context)
Citation Context ...tablished linguistic signs, connecting a signal with its signification, and local signs, where the particular choice of signal is arbitrary was observed in the context of natural language by Saussure =-=[dS83]-=-. In formal languages, the idea of distinguishing free and bound variables syntactically is also far from new. Gentzen [Gen69], Kleene [Kle52] and Prawitz [Pra65] certainly exploit it. The second auth... |

15 |
Introduction to Metamathematics. VanNostrand,Princeton,NewJersey
- Kleene
- 1950
(Show Context)
Citation Context ...as observed in the context of natural language by Saussure [dS83]. In formal languages, the idea of distinguishing free and bound variables syntactically is also far from new. Gentzen [Gen69], Kleene =-=[Kle52]-=- and Prawitz [Pra65] certainly exploit it. The second author learned it from Randy Pollack who learned it in turn from Thierry Coquand [Coq91]; the first author learned it from the second. The idea of... |

8 | Inverting inductively defined relations in LEGO
- McBride
- 1998
(Show Context)
Citation Context ...d with respect to the raw definition of Expr, moving into scopes without binding variables, requires a nightmare of arithmetic. The first author did most of the implementation for his Master’s project=-=[McB98]-=- this way, before the second author caught him at it and set him on a wiser path. The zipper construction provides a general-purpose presentation of navigation within expressions—that’s a strength whe... |

6 |
de Bruijn. Lambda Calculus notation with nameless dummies: a tool for automatic formula manipulation
- Nicolas
- 1972
(Show Context)
Citation Context ...na June 8, 2004 Abstract In this paper, we show 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 =-=[dB72]-=- for bound variables. By doing so, we retain the advantages of both representations: naming supports easy, arithmetic-free manipulation of terms; de Bruijn indices eliminate the need for α-conversion.... |

4 |
Natural Deduction—A proof theoretical study. Almquist and Wiksell
- Prawitz
- 1965
(Show Context)
Citation Context ...ontext of natural language by Saussure [dS83]. In formal languages, the idea of distinguishing free and bound variables syntactically is also far from new. Gentzen [Gen69], Kleene [Kle52] and Prawitz =-=[Pra65]-=- certainly exploit it. The second author learned it from Randy Pollack who learned it in turn from Thierry Coquand [Coq91]; the first author learned it from the second. The idea of using free names an... |