-
- Share
- Explore
- Block Explorer (BSV)
- Blockchair
- WhatsOnChain
- ViaWallet
- BCHSVExplorer
# Tim Syntax
## A Compact Lambda Calculus Notation Using De Bruijn Indices
**Author:** Timothy Swan
**Original development:** Circa March 1, 2021
**Subject:** Lambda calculus, formal notation, functional programming, mathematical logic
---
## Abstract
This document introduces **Tim Syntax**, a notation for expressing lambda calculus using square brackets for function application, numerical indices for bound variables, and two alternative representations of lambda abstraction.
The notation has two forms:
- **Version 1:** Parentheses `()` represent abstraction.
- **Version 2:** A prefix period `.` represents abstraction.
Both versions use the same underlying representation of lambda terms. They differ only in how abstractions are written.
The notation was developed by Timothy Swan, with a C++ implementation containing lambda calculus expressions dating to circa March 1, 2021.
## 1. Introduction
Lambda calculus is a mathematical system for expressing computation through function abstraction and application.
Traditional lambda calculus commonly uses named variables, as in:
`λx.λy.x`
Tim Syntax instead uses numerical indices, following the general approach of de Bruijn notation. This identifies variables by their position relative to their enclosing abstractions rather than by names.
The notation also uses square brackets to represent application and provides two alternative ways to express abstraction.
The design aims to make lambda expressions compact, structurally explicit, and suitable for direct parsing by software.
## 2. Fundamental notation
Both versions share the following conventions.
### 2.1 Bound variables
Positive integers represent bound variables.
The indices are one-based:
| Index | Meaning |
|---|---|
| `1` | Nearest enclosing abstraction |
| `2` | Second-nearest enclosing abstraction |
| `3` | Third-nearest enclosing abstraction |
| `n` | The nth enclosing abstraction |
For example, the conventional expression:
`λx.λy.x`
is represented by `2` inside the two abstractions, because `x` is bound by the outer abstraction.
The complete expression in Tim Syntax is:
Version 1: `((2))`
Version 2: `..2`
### 2.2 Function application
Square brackets represent application.
The general form is:
`[M]N`
This represents the application of function `M` to argument `N`.
Nested brackets allow applications to be grouped explicitly.
For example:
`[[3]2]1`
represents:
`((3 2) 1)`
The brackets make the structure of an application visible without requiring conventional infix or fully parenthesized notation.
## 3. Version 1: Parenthesized abstraction
The first version represents each lambda abstraction by enclosing its body in a pair of parentheses.
Each additional pair of parentheses introduces another abstraction.
Examples:
| Tim Syntax | Conventional notation |
|---|---|
| `(1)` | `λ.1` |
| `((1))` | `λ.λ.1` |
| `(([2]1))` | `λ.λ.(2 1)` |
| `(([2][2]1))` | `λ.λ.(2 (2 1))` |
| `((([2][[3]2]1)))` | `λ.λ.λ.(2 (3 2 1))` |
The number of enclosing pairs of parentheses determines the number of nested abstractions.
## 4. Version 2: Period abstraction
The second version uses a period (`.`) as a prefix abstraction operator.
Each period introduces one abstraction, with the following expression serving as its body.
Examples:
| Tim Syntax | Conventional notation |
|---|---|
| `.1` | `λ.1` |
| `..1` | `λ.λ.1` |
| `..[2]1` | `λ.λ.(2 1)` |
| `..[2][2]1` | `λ.λ.(2 (2 1))` |
| `...[2][[3]2]1` | `λ.λ.λ.(2 (3 2 1))` |
Version 2 provides a more compact alternative to the parenthesized abstraction notation.
It is not necessarily intended to replace Version 1. Both forms describe the same underlying lambda expressions.
## 5. Examples of lambda calculus constructions
The original March 2021 implementation included expressions representing several familiar lambda calculus constructions.
Examples include:
| Construction | Version 1 |
|---|---|
| Church zero | `((1))` |
| Church one | `(([2]1))` |
| Church two | `(([2][2]1))` |
| Successor | `((([2][[3]2]1)))` |
| Church true | `((2))` |
| Church false | `((1))` |
The implementation also contained expressions for:
- Addition
- Predecessor
- Boolean conditionals
- Pairs, including first and second projections
- The Y combinator
- Zero testing
- Fibonacci functions
- Ackermann functions
These examples demonstrate that the notation can represent more than isolated lambda abstractions. It can express recursive constructions, arithmetic encodings, and other familiar functional structures.
## 6. Extended computational examples
The following examples illustrate the use of Tim Syntax in larger expressions.
### 6.1 Addition: 5 + 5
The following expression represents an addition of two Church numerals, each representing five:
```text
[[(((([[4]2][[3]2]1))))](([2][2][2][2][2]1))](([2][2][2][2][2]1))
```
The intended result is Church numeral ten, representing:
`5 + 5 = 10`
### 6.2 Fibonacci: Fibonacci of 2
The following expression represents a larger recursive computation involving the Fibonacci construction:
```text
[[([([2][1]1)]([2][1]1))](([[[([[1](((1)))]((2)))]1](([2]1))][[(((([[4]2][[3]2]1))))][2][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))]1][2][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))]1))](([2][2]1))
```
The expected reduction is:
```text
(([2][2][2]1))
```
This is Church numeral three, corresponding to:
`Fibonacci(2) = 3`
These examples illustrate the intended use of Tim Syntax for expressing arithmetic and recursive lambda calculus computations in a compact textual form.
## 7. Development history
Tim Syntax was developed by Timothy Swan circa March 1, 2021.
A C++ implementation from that period used a `parse()` function to construct lambda expressions from strings. Its examples included Church numerals, arithmetic operations, Boolean expressions, recursive combinators, and other lambda calculus constructions.
The parenthesized notation appears in the March 2021 implementation. The period-based notation was developed as an alternative surface representation.
The two versions preserve the same basic conventions for application and numerical variable indices.
The original source code provides historical evidence of the notation's use in a working software project.
## 8. Relationship to de Bruijn notation
Tim Syntax uses numerical indices to identify bound variables, rather than relying on variable names.
This is related to de Bruijn notation, in which bound variables are represented by their distance from the corresponding binding abstraction.
The distinguishing feature of Tim Syntax is its combination of numerical indices with its particular square-bracket application notation and alternative abstraction delimiters.
It is a notation for representing lambda terms, not a replacement for the mathematical rules of lambda calculus. The usual concepts of beta reduction, substitution, abstraction, and application remain applicable.
## 9. Conclusion
Tim Syntax provides two compact surface representations of lambda calculus.
Its shared conventions are:
1. Numerical indices identify bound variables.
2. Square brackets express function application.
3. Parentheses express abstraction in Version 1.
4. Prefix periods express abstraction in Version 2.
The notation was developed by Timothy Swan circa March 1, 2021, and is documented here together with examples from a C++ implementation and larger computational expressions.
The intention of this publication is to establish a public technical description of the notation and make it available for examination, implementation, discussion, and further development.
---
**Author:** Timothy Swan
**Document title:** Tim Syntax: A Compact Lambda Calculus Notation Using De Bruijn Indices
**Historical source:** C++ lambda calculus implementation, circa March 1, 2021.
**Publication note:** This document describes a proposed notation. Its historical priority and originality are claims that may be investigated through comparison with earlier mathematical and programming-language literature.
## Acknowledgments
ChatGPT (OpenAI) assisted Timothy Swan in preparing this document, including organizing the technical description, formatting examples, and editing the written presentation of the notation.
The notation itself, its original development, and the underlying March 2021 implementation are attributed to Timothy Swan. The author is responsible for the technical content, historical claims, and final published version.
## A Compact Lambda Calculus Notation Using De Bruijn Indices
**Author:** Timothy Swan
**Original development:** Circa March 1, 2021
**Subject:** Lambda calculus, formal notation, functional programming, mathematical logic
---
## Abstract
This document introduces **Tim Syntax**, a notation for expressing lambda calculus using square brackets for function application, numerical indices for bound variables, and two alternative representations of lambda abstraction.
The notation has two forms:
- **Version 1:** Parentheses `()` represent abstraction.
- **Version 2:** A prefix period `.` represents abstraction.
Both versions use the same underlying representation of lambda terms. They differ only in how abstractions are written.
The notation was developed by Timothy Swan, with a C++ implementation containing lambda calculus expressions dating to circa March 1, 2021.
## 1. Introduction
Lambda calculus is a mathematical system for expressing computation through function abstraction and application.
Traditional lambda calculus commonly uses named variables, as in:
`λx.λy.x`
Tim Syntax instead uses numerical indices, following the general approach of de Bruijn notation. This identifies variables by their position relative to their enclosing abstractions rather than by names.
The notation also uses square brackets to represent application and provides two alternative ways to express abstraction.
The design aims to make lambda expressions compact, structurally explicit, and suitable for direct parsing by software.
## 2. Fundamental notation
Both versions share the following conventions.
### 2.1 Bound variables
Positive integers represent bound variables.
The indices are one-based:
| Index | Meaning |
|---|---|
| `1` | Nearest enclosing abstraction |
| `2` | Second-nearest enclosing abstraction |
| `3` | Third-nearest enclosing abstraction |
| `n` | The nth enclosing abstraction |
For example, the conventional expression:
`λx.λy.x`
is represented by `2` inside the two abstractions, because `x` is bound by the outer abstraction.
The complete expression in Tim Syntax is:
Version 1: `((2))`
Version 2: `..2`
### 2.2 Function application
Square brackets represent application.
The general form is:
`[M]N`
This represents the application of function `M` to argument `N`.
Nested brackets allow applications to be grouped explicitly.
For example:
`[[3]2]1`
represents:
`((3 2) 1)`
The brackets make the structure of an application visible without requiring conventional infix or fully parenthesized notation.
## 3. Version 1: Parenthesized abstraction
The first version represents each lambda abstraction by enclosing its body in a pair of parentheses.
Each additional pair of parentheses introduces another abstraction.
Examples:
| Tim Syntax | Conventional notation |
|---|---|
| `(1)` | `λ.1` |
| `((1))` | `λ.λ.1` |
| `(([2]1))` | `λ.λ.(2 1)` |
| `(([2][2]1))` | `λ.λ.(2 (2 1))` |
| `((([2][[3]2]1)))` | `λ.λ.λ.(2 (3 2 1))` |
The number of enclosing pairs of parentheses determines the number of nested abstractions.
## 4. Version 2: Period abstraction
The second version uses a period (`.`) as a prefix abstraction operator.
Each period introduces one abstraction, with the following expression serving as its body.
Examples:
| Tim Syntax | Conventional notation |
|---|---|
| `.1` | `λ.1` |
| `..1` | `λ.λ.1` |
| `..[2]1` | `λ.λ.(2 1)` |
| `..[2][2]1` | `λ.λ.(2 (2 1))` |
| `...[2][[3]2]1` | `λ.λ.λ.(2 (3 2 1))` |
Version 2 provides a more compact alternative to the parenthesized abstraction notation.
It is not necessarily intended to replace Version 1. Both forms describe the same underlying lambda expressions.
## 5. Examples of lambda calculus constructions
The original March 2021 implementation included expressions representing several familiar lambda calculus constructions.
Examples include:
| Construction | Version 1 |
|---|---|
| Church zero | `((1))` |
| Church one | `(([2]1))` |
| Church two | `(([2][2]1))` |
| Successor | `((([2][[3]2]1)))` |
| Church true | `((2))` |
| Church false | `((1))` |
The implementation also contained expressions for:
- Addition
- Predecessor
- Boolean conditionals
- Pairs, including first and second projections
- The Y combinator
- Zero testing
- Fibonacci functions
- Ackermann functions
These examples demonstrate that the notation can represent more than isolated lambda abstractions. It can express recursive constructions, arithmetic encodings, and other familiar functional structures.
## 6. Extended computational examples
The following examples illustrate the use of Tim Syntax in larger expressions.
### 6.1 Addition: 5 + 5
The following expression represents an addition of two Church numerals, each representing five:
```text
[[(((([[4]2][[3]2]1))))](([2][2][2][2][2]1))](([2][2][2][2][2]1))
```
The intended result is Church numeral ten, representing:
`5 + 5 = 10`
### 6.2 Fibonacci: Fibonacci of 2
The following expression represents a larger recursive computation involving the Fibonacci construction:
```text
[[([([2][1]1)]([2][1]1))](([[[([[1](((1)))]((2)))]1](([2]1))][[(((([[4]2][[3]2]1))))][2][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))]1][2][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))][([([1]((2)))][[1]([[((([[1]3]2)))][([1]((1)))]1][((([2][[3]2]1)))][([1]((1)))]1)][[((([[1]3]2)))]((1))]((1)))]1))](([2][2]1))
```
The expected reduction is:
```text
(([2][2][2]1))
```
This is Church numeral three, corresponding to:
`Fibonacci(2) = 3`
These examples illustrate the intended use of Tim Syntax for expressing arithmetic and recursive lambda calculus computations in a compact textual form.
## 7. Development history
Tim Syntax was developed by Timothy Swan circa March 1, 2021.
A C++ implementation from that period used a `parse()` function to construct lambda expressions from strings. Its examples included Church numerals, arithmetic operations, Boolean expressions, recursive combinators, and other lambda calculus constructions.
The parenthesized notation appears in the March 2021 implementation. The period-based notation was developed as an alternative surface representation.
The two versions preserve the same basic conventions for application and numerical variable indices.
The original source code provides historical evidence of the notation's use in a working software project.
## 8. Relationship to de Bruijn notation
Tim Syntax uses numerical indices to identify bound variables, rather than relying on variable names.
This is related to de Bruijn notation, in which bound variables are represented by their distance from the corresponding binding abstraction.
The distinguishing feature of Tim Syntax is its combination of numerical indices with its particular square-bracket application notation and alternative abstraction delimiters.
It is a notation for representing lambda terms, not a replacement for the mathematical rules of lambda calculus. The usual concepts of beta reduction, substitution, abstraction, and application remain applicable.
## 9. Conclusion
Tim Syntax provides two compact surface representations of lambda calculus.
Its shared conventions are:
1. Numerical indices identify bound variables.
2. Square brackets express function application.
3. Parentheses express abstraction in Version 1.
4. Prefix periods express abstraction in Version 2.
The notation was developed by Timothy Swan circa March 1, 2021, and is documented here together with examples from a C++ implementation and larger computational expressions.
The intention of this publication is to establish a public technical description of the notation and make it available for examination, implementation, discussion, and further development.
---
**Author:** Timothy Swan
**Document title:** Tim Syntax: A Compact Lambda Calculus Notation Using De Bruijn Indices
**Historical source:** C++ lambda calculus implementation, circa March 1, 2021.
**Publication note:** This document describes a proposed notation. Its historical priority and originality are claims that may be investigated through comparison with earlier mathematical and programming-language literature.
## Acknowledgments
ChatGPT (OpenAI) assisted Timothy Swan in preparing this document, including organizing the technical description, formatting examples, and editing the written presentation of the notation.
The notation itself, its original development, and the underlying March 2021 implementation are attributed to Timothy Swan. The author is responsible for the technical content, historical claims, and final published version.
