This is a part of the following series:
"Exploring Simplified Lambda Calculus Notations".
Part I: "Summary" (HTML).
Part II: "Revelation: Lambda Calculus Reduced To Four Primitive Operations" (HTML).2023-07-21
[N.G. de Bruijn 1972] introduced a way to eliminate names from the syntax of lambda calculus, making it much simpler and “easy to handle in metalingual discussion” and “easy for the computer and for the computer programmer”.
[J. Tromp 2023] incorporated and expanded upon this idea in his Binary Lambda Calculus (BLC) syntax, which also eliminates the notion of significant parentheses and spaces.
BLC makes for a very good binary canonical representation of lambda calculus terms.
In this article I define text-based equivalents which retain the desirable properties of BLC.
Going futher, I propose ways to also remove repetition from the syntax.
I also show how various syntax modifications and variants can be mixed-and-matched and combined to reintroduce human-readability while retaining the ease of processing.
I introduce a loose labeling scheme for lambda calculus syntax variants, with LCλ2τ0α2 denoting the most terse text-based variant of the syntax.
Compare a few well-known combinators:
combinator | conventional | de Bruijn | LCλ2τ0α2 |
---|---|---|---|
I | λx.x | λ 0 | λτ0 |
K | λx.λy.x | λ λ 1 | λ2τ1 |
U | λx.x x | λ 0 0 | λατ0τ0 |
W | λx.λy.x y y | λ λ 1 0 0 | λ2α2τ1τ0τ0 |
S | λx.λy.λz.x z (y z) | λ λ λ 2 0 (1 0) | λ3α2τ2τ0ατ1τ0 |
Ω | (λx.x x) (λx.x x) | (λ 0 0) (λ 0 0) | αλατ0τ0λατ0τ0 |
To get the LCλ2τ0α2 syntax:
Eliminate significant parentheses from de Bruijn syntax by changing application to use the prefix-operator α (alpha) instead of juxtaposition.
Eliminate significant spaces by transforming each de Bruijn index n into τn. E.g.
The resulting syntax is effectively Polish notation for lambda calculus, so there are no hidden precedence and associativity rules.
The LCλ2τ0α2 label signifies that the syntax:
For an example of how this syntax can be combined with the conventional one, the Y combinator, i.e.:
can be rendered as:
naming the f variable () and then using rather than to refer to it. Also, redundant parens and formatting are added for clarity.
The described syntaxes may be useful:
BTW here is how to encode UWU:
UWU
de Bruijn, Nicolaas Govert (1972). “Lambda Calculus Notation with Nameless Dummies: A Tool for Automatic Formula Manipulation, with Application to the Church-Rosser Theorem” (PDF). Indagationes Mathematicae. 34: 381–392. ISSN 0019-3577. Archived (PDF) from the original on 2011-05-20.
Tromp, John (2023). “Functional Bits: Lambda Calculus based Algorithmic Information Theory” (PDF).