De Bruijn notation: Difference between revisions
m Citation maintenance. You can use this bot yourself! Please report any bugs. |
removed note about Polish notation per talk |
||
Line 45: | Line 45: | ||
Several properties of λ-terms that are difficult to state and prove using the traditional notation are easily expressed in the de Bruijn notation. For example, in a [[type theory|type-theoretic]] setting, one can easily compute the canonical class of types for a term in a typing context, and restate the [[type checking]] problem to one of verifying that the checked type is a member of this class.<ref name="kamareddine nederpelt 96">{{cite journal|author=Kamareddine, Fairouz|coauthors=Nederpelt, Rob|title=A useful λ-notation|journal=[[Theoretical Computer Science]]|volume=155|year=1996|pages=85–109|issn=0304-3975|doi=10.1016/0304-3975(95)00101-8}}</ref> De Bruijn notation has also been shown to be useful in calculi for [[explicit substitution]] in [[pure type theory]].<ref name="leuw 95">{{citation|last=de Leuw|first=B.-J.|title=Generalisations in the λ-calculus and its type theory|year=1995|place=Masters Thesis, [[University of Glasgow]]}}.</ref> |
Several properties of λ-terms that are difficult to state and prove using the traditional notation are easily expressed in the de Bruijn notation. For example, in a [[type theory|type-theoretic]] setting, one can easily compute the canonical class of types for a term in a typing context, and restate the [[type checking]] problem to one of verifying that the checked type is a member of this class.<ref name="kamareddine nederpelt 96">{{cite journal|author=Kamareddine, Fairouz|coauthors=Nederpelt, Rob|title=A useful λ-notation|journal=[[Theoretical Computer Science]]|volume=155|year=1996|pages=85–109|issn=0304-3975|doi=10.1016/0304-3975(95)00101-8}}</ref> De Bruijn notation has also been shown to be useful in calculi for [[explicit substitution]] in [[pure type theory]].<ref name="leuw 95">{{citation|last=de Leuw|first=B.-J.|title=Generalisations in the λ-calculus and its type theory|year=1995|place=Masters Thesis, [[University of Glasgow]]}}.</ref> |
||
== See also == |
|||
* [[Polish notation]], which the de Bruijn notation greatly resembles. |
|||
== References == |
== References == |
Revision as of 09:38, 10 June 2008
In mathematical logic, the de Bruijn notation is a syntax for terms in the λ calculus invented by the Dutch mathematician Nicolaas Govert de Bruijn (IPA: [dɪˈbʁœyn]).[1] It can be seen as a reversal of the usual syntax for the λ calculus where the argument in an application is placed next to its corresponding binder in the function instead of after the latter's body.
Formal definition
Terms () in the de Bruijn notation are either variables (), or have one of two wagon prefixes. The abstractor wagon, written , corresponds to the usual λ-binder of the λ calculus, and the applicator wagon, written , corresponds to the argument in an application in the λ calculus.
Terms in the traditional syntax can be converted to the de Bruijn notation by defining an inductive function for which:
All operations on λ-terms commute with respect to the translation. For example, the usual β-reduction,
in the de Bruijn notation is, predictably,
- .
A feature of this notation is that abstractor and applicator wagons of β-redexes are paired like parentheses. For example, consider the stages in the β-reduction of the term , where the redexes are underlined:[2]
Thus, if one views the applicator as an open paren ('(
') and the abstractor as a close paren (')
'), then the pattern in the above term is '(()())
'. De Bruijn called an applicator and its corresponding abstractor in this interpretation partners, and wagons without partners bachelors. A sequence of wagons, which he called a segment, is well balanced if all its wagons are partnered.
Advantages of the de Bruijn notation
In a well balanced segment, the partnered wagons may be moved around arbitrarily and, as long as parity is not destroyed, the meaning of the term stays the same. For example, in the above example, the applicator can be brought to its abstractor , or the abstractor to the applicator. In fact, all commutatives and permutative conversions on lambda terms may be described simply in terms of parity-preserving reorderings of partnered wagons. One thus obtains a generalised conversion primitive for λ-terms in the de Bruijn notation.
Several properties of λ-terms that are difficult to state and prove using the traditional notation are easily expressed in the de Bruijn notation. For example, in a type-theoretic setting, one can easily compute the canonical class of types for a term in a typing context, and restate the type checking problem to one of verifying that the checked type is a member of this class.[3] De Bruijn notation has also been shown to be useful in calculi for explicit substitution in pure type theory.[4]
References
- ^ De Bruijn, Nicolaas Govert (1980). "A survey of the project AUTOMATH". In Hindley J. R. and Seldin J. P. (ed.). To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism. Academic Press. pp. 29–61. ISBN 0-123-49050-2. OCLC 6305265.
- ^ Kamareddine, Fairouz (2001). "Reviewing the classical and the de Bruijn notation for λ-calculus and pure type systems". Logic and Computation. 11 (3): 363–394. doi:10.1093/logcom/11.3.363. ISSN 0955-792X.
{{cite journal}}
: Check date values in:|year=
(help)CS1 maint: year (link) The example is from page 384. - ^ Kamareddine, Fairouz (1996). "A useful λ-notation". Theoretical Computer Science. 155: 85–109. doi:10.1016/0304-3975(95)00101-8. ISSN 0304-3975.
{{cite journal}}
: Unknown parameter|coauthors=
ignored (|author=
suggested) (help) - ^ de Leuw, B.-J. (1995), Generalisations in the λ-calculus and its type theory, Masters Thesis, University of Glasgow
{{citation}}
: CS1 maint: location missing publisher (link).