In mathematical logic, the de Bruijn index is a notation invented by the Dutch mathematician Nicolaas Govert de Bruijn (pronounced [dɪˈbʁœyn]) for representing terms in the λ calculus. Mathematical logic is a subfield of Logic and Mathematics with close connections to Computer science and Philosophical logic. The Netherlands ( Dutch:, ˈnedərlɑnt is the European part of the Kingdom of the Netherlands, which consists of the Netherlands the Netherlands A mathematician is a person whose primary area of study and research is the field of Mathematics. Nicolaas Govert de Bruijn (born 9 July, 1918) is a Dutch Mathematician, affiliated as Professor emeritus In Mathematical logic and Computer science, lambda calculus, also written as λ-calculus, is a Formal system designed to investigate function [1] Terms written using these indexes are invariant with respect to α conversion, so the check for α-equivalence is the same as that for syntactic equality. In Mathematical logic and Computer science, lambda calculus, also written as λ-calculus, is a Formal system designed to investigate function Each de Bruijn index is a natural number that represents an occurrence of a variable in a λ-term, and denotes the number of binders that are in scope between that occurrence and its corresponding binder. In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an A variable (ˈvɛərɪəbl is an Attribute of a physical or an abstract System which may change its Value while it is under Observation. In Computer programming, scope is an enclosing context where values and expressions are associated The following are some examples:

De Bruijn indexes are commonly used in higher-order reasoning systems such as automated theorem provers and logic programming systems. In Mathematics, higher-order logic is distinguished from First-order logic in a number of ways Automated theorem proving ( ATP) or automated deduction, currently the most well-developed subfield of Automated reasoning (AR is the Logic programming is in its broadest sense the use of mathematical logic for computer programming [2]
Contents |
Formally, λ-terms (M, N, …) written using de Bruijn indexes have the following syntax (parentheses allowed freely):
where n — natural numbers greater than 0 — are the variables. In Mathematical logic and Computer science, lambda calculus, also written as λ-calculus, is a Formal system designed to investigate function In Mathematics, a natural number (also called counting number) can mean either an element of the set (the positive Integers or an A variable n is bound if it is in the scope of at least n binders (λ); otherwise it is free. In Mathematics, and in other disciplines involving Formal languages including Mathematical logic and Computer science, a free variable is a In Mathematics, and in other disciplines involving Formal languages including Mathematical logic and Computer science, a free variable is a The binding site for a variable n is the nth binder it is in the scope of, starting from the innermost binder. In Computer programming, scope is an enclosing context where values and expressions are associated
The most primitive operation on λ-terms is substitution: replacing free variables in a term with other terms. In the β-reduction (λ M) N, for example, we must:
To illustrate, consider the application
which might correspond to the following term written in the usual notation
After step 1, we obtain the term λ 4 □ (λ 1 □), where the variables that are substituted for are replaced with boxes. Step 2 lowers the free variables, giving λ 3 □ (λ 1 □). Finally, in step 3 we replace the boxes with the argument; the first box is under one binder, so we replace it with λ 6 1 (which is λ 5 1 with the free variables increased by 1); the second is under two binders, so we replace it with λ 7 1. The final result is λ 3 (λ 6 1) (λ 1 (λ 7 1)).
Formally, a substitution is an unbounded list of term replacements for the free variables, written M1. M2…, where Mi is the replacement for the ith free variable. The increasing operation in step 3 is sometimes called shift and written ↑k where k is a natural number indicating the amount to increase the variables; For example, ↑0 is the identity substitution, leaving a term unchanged.
The application of a substitution s to a term M is written M[s]. The composition of two substitutions s1 and s2 is written s1 s2 and defined by
The rules for application are as follows:
The steps outlined for the β-reduction above are thus more concisely expressed as:
When using the standard "named" representation of λ-terms, where variables are treated as labels or strings, one has to explicitly handle α-conversion when defining any operation on the terms. The standard Variable Convention[3] of Barendregt is one such approach where α-conversion is applied as needed to ensure that:
In practice this is cumbersome, inefficient, and often error-prone. It has therefore led to the search for different representations of such terms. On the other hand, the named representation of λ-terms is more pervasive and can be more immediately understandable by others because the variables can be given descriptive names. Thus, even if a system uses de Bruijn indexes internally, it will present a user interface with names.
De Bruijn indexes are not the only representation of λ-terms that obviates the problem of α-conversion. Among named representations, the nominal logic of Pitts is one approach, where the representation of a λ-term is treated as an equivalence class of all terms rewritable to it using variable permutations. In Mathematics, Computer science and Logic, rewriting covers a wide range of potentially non-deterministic methods of replacing subterms of a [4] This approach is taken by the Nominal Datatype Package of Isabelle/HOL. The Isabelle theorem prover is an interactive theorem proving framework a successor of the HOL theorem prover. [5]
Another common alternative is an appeal to higher-order representations where the λ-binder is treated as a true function. In Computer science, higher-order abstract syntax (abbreviated HOAS) is a technique for the representation of Abstract syntax trees for languages with variable In such representations, the issues of α-equivalence, substitution, etc. are identified with the same operations in a meta-logic. Metalogic is the study of the Metatheory of Logic. While logic is the study of the manner in which logical systems can be used to decide the correctness