Deductive lambda calculus
   HOME

TheInfoList



OR:

Deductive lambda calculus considers what happens when lambda terms are regarded as mathematical expressions. One interpretation of the untyped lambda calculus is as a programming language where evaluation proceeds by performing reductions on an expression until it is in normal form. In this interpretation, if the expression never reduces to normal form then the program never terminates, and the value is undefined. Considered as a mathematical
deductive system A formal system is an abstract structure used for inferring theorems from axioms according to a set of rules. These rules, which are used for carrying out the inference of theorems from axioms, are the logical calculus of the formal system. A for ...
, each reduction would not alter the value of the expression. The expression would equal the reduction of the expression.


History

Alonzo Church Alonzo Church (June 14, 1903 – August 11, 1995) was an American mathematician, computer scientist, logician, philosopher, professor and editor who made major contributions to mathematical logic and the foundations of theoretical computer scien ...
invented the lambda calculus in the 1930s, originally to provide a new and simpler basis for mathematics. However soon after inventing it major logic problems were identified with the definition of the lambda abstraction: The
Kleene–Rosser paradox In mathematics, the Kleene–Rosser paradox is a paradox that shows that certain systems of formal logic are inconsistent, in particular the version of Haskell Curry's combinatory logic introduced in 1930, and Alonzo Church's original lambda ca ...
is an implementation of
Richard's paradox In logic, Richard's paradox is a semantical antinomy of set theory and natural language first described by the French mathematician Jules Richard in 1905. The paradox is ordinarily used to motivate the importance of distinguishing carefully betwee ...
in the lambda calculus.
Haskell Curry Haskell Brooks Curry (; September 12, 1900 – September 1, 1982) was an American mathematician and logician. Curry is best known for his work in combinatory logic. While the initial concept of combinatory logic was based on a single paper by ...
found that the key step in this paradox could be used to implement the simpler
Curry's paradox Curry's paradox is a paradox in which an arbitrary claim ''F'' is proved from the mere existence of a sentence ''C'' that says of itself "If ''C'', then ''F''", requiring only a few apparently innocuous logical deduction rules. Since ''F'' is arbi ...
. The existence of these paradoxes meant that the lambda calculus could not be both consistent and complete as a
deductive system A formal system is an abstract structure used for inferring theorems from axioms according to a set of rules. These rules, which are used for carrying out the inference of theorems from axioms, are the logical calculus of the formal system. A for ...
.
Haskell Curry Haskell Brooks Curry (; September 12, 1900 – September 1, 1982) was an American mathematician and logician. Curry is best known for his work in combinatory logic. While the initial concept of combinatory logic was based on a single paper by ...
studied of illative (deductive) combinatory logic in 1941. Combinatory logic is closely related to lambda calculus, and the same paradoxes exist in each. Later the lambda calculus was resurrected as a definition of a programming language.


Introduction

Lambda calculus is the model and inspiration for the development of
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
languages. These languages implement the lambda abstraction, and use it in conjunction with application of functions, and types. The use of lambda abstractions, which are then embedded into other mathematical systems, and used as a deductive system, leads to a number of problems, such as
Curry's paradox Curry's paradox is a paradox in which an arbitrary claim ''F'' is proved from the mere existence of a sentence ''C'' that says of itself "If ''C'', then ''F''", requiring only a few apparently innocuous logical deduction rules. Since ''F'' is arbi ...
. The problems are related to the definition of the lambda abstraction and the definition and use of functions as the basic type in lambda calculus. This article describes these problems and how they arise. This is not a criticism of pure lambda calculus, and lambda calculus as a pure system is not the primary topic here. The problems arise with the interaction of lambda calculus with other mathematical systems. Being aware of the problems allows them to be avoided in some cases.


Terminology

For this discussion, the lambda abstraction is added as an extra operator in mathematics. The usual domains, such as Boolean and
real Real may refer to: Currencies * Brazilian real (R$) * Central American Republic real * Mexican real * Portuguese real * Spanish real * Spanish colonial real Music Albums * ''Real'' (L'Arc-en-Ciel album) (2000) * ''Real'' (Bright album) (2010) ...
will be available. Mathematical equality will be applied to these domains. The purpose is to see what problems arise from this definition. Function application will be represented using the lambda calculus syntax. So multiplication will be represented by a dot. Also, for some examples, the let expression will be used. The following table summarizes;


Interpretation of lambda calculus as mathematics

In the
mathematical Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
interpretation, lambda terms represent values. Eta and beta reductions are deductive steps that do not alter the values of expressions. : \operatorname = X : \operatorname = X


Eta reduction as mathematics

An eta-reduct is defined by, :x \not \in \operatorname(f) \to \operatorname lambda x.(f\ x)= f In the mathematical interpretation, : \operatorname = X Taking f to be a variable then, : \lambda x.(f\ x) = f or by letting f\ x = y : f\ x = y \iff f = \lambda x.y This definition defines \lambda x.y to be the solution for ''f'' in the equation, : f\ x = y


Beta reduction as mathematics

A beta reduct is, : \operatorname \lambda x.b)\ z= b :=z and as, : \operatorname = X then, : (\lambda x.b)\ z = b :=z This rule is implied by the instantiation of quantified variables. If, : \forall x: f\ x = y then f\ z is the expression y with the quantified variable x instantiated as z. : f\ z = y :=z so, : (\lambda x.y)\ z = y :=z As beta reduction is implied from eta reduction, there is no contradiction between the two definitions.


Inconsistency with the Principle of Bivalence

Let z be a Boolean; then we can form an equation with no solutions, : z = \neg z To solve this equation by recursion, we introduce a new function defined by, : f\ n = \neg (n\ n) where is an auxiliary variable to hold the recursion value. (We take it that \neg still returns a Boolean even if it is given a non-Boolean argument.) By an eta-reduction, we obtain, : f = \lambda x.\neg (x\ x) And then, : \begin f\ f &= (\lambda x.\neg (x\ x)) (\lambda x.\neg (x\ x)) \\ &= \neg ((\lambda x.\neg (x\ x)) (\lambda x.\neg (x\ x))) \\ &= \neg (f\ f) \end Then is neither true nor false, and as is a Boolean value (on any , returns the Boolean \neg (x\ x)) then we see that is neither true nor false; it also demonstrates that negation makes less sense when applied to non-logical values.


Intensional versus extensional equality

Another difficulty for the interpretation of lambda calculus as a deductive system is the representation of values as lambda terms, which represent functions. The untyped lambda calculus is implemented by performing reductions on a lambda term, until the term is in normal form. The intensional interpretation of equality is that the reduction of a lambda term to normal form is the value of the lambda term. This interpretation considers the identity of a lambda expression to be its structure. Two lambda terms are equal if they are alpha convertible. The
extensional In any of several fields of study that treat the use of signs — for example, in linguistics Linguistics is the science, scientific study of human language. It is called a scientific study because it entails a comprehensive, systematic, obj ...
definition of function equality is that two functions are equal if they perform the same mapping; : f = g \iff (\forall x f\ x = g\ x) One way to describe this is that extensional equality describes equality of functions, where as intensional equality describes equality of function implementations. The extensional definition of equality is not equivalent to the intensional definition. This can be seen in the example below. This inequivalence is created by considering lambda terms as values. In
typed lambda calculus A typed lambda calculus is a typed formalism that uses the lambda-symbol (\lambda) to denote anonymous function abstraction. In this context, types are usually objects of a syntactic nature that are assigned to lambda terms; the exact nature of a ...
this problem is circumvented, because built-in types may be added to carry values that are in a
canonical form In mathematics and computer science, a canonical, normal, or standard form of a mathematical object is a standard way of presenting that object as a mathematical expression. Often, it is one which provides the simplest representation of an ...
and have both extensional and intensional equality.


Example

In arithmetic, the
distributive law In mathematics, the distributive property of binary operations generalizes the distributive law, which asserts that the equality x \cdot (y + z) = x \cdot y + x \cdot z is always true in elementary algebra. For example, in elementary arithmetic, ...
implies that 2 * (r + s) = 2*r + 2*s. Using the Church encoding of numerals the left and right hand sides may be represented as lambda terms. So the distributive law says that the two functions, :\lambda r.\lambda s.2 * (r + s) = \lambda r.\lambda s.2*r + 2*s are equal, as functions on Church numerals. (Here we encounter a technical weakness of the untyped lambda calculus: there is no way to restrict the domain of a function to the Church numerals. In the following argument we will ignore this difficulty, by pretending that "all" lambda expressions are Church numerals.) The distributive law should apply if the Church numerals provided a satisfactory implementation of numbers. :\begin \lambda r.\lambda s.\operatorname\ 2\ (\operatorname\ r\ s) &= \lambda r.\lambda s.\operatorname\ (\operatorname\ 2\ r)\ (\operatorname\ 2\ s) \\ &= \\ \lambda r.\lambda s.\lambda f.\lambda x.r\ f\ (s\ f\ (r\ f\ (s\ f\ x))) &= \lambda r.\lambda s.\lambda f.\lambda x.r\ f\ (r\ f\ (s\ f\ (s\ f\ x))) \end The two terms beta reduce to similar expressions. Still they are not alpha convertible, or even eta convertible (the latter follows because both terms are already in eta-long form). So according to the intensional definition of equality, the expressions are not equal. But if the two functions are applied to the same Church numerals they produce the same result, by the distributive law; thus they are extensionally equal. This is a significant problem, as it means that the intensional value of a lambda-term may change under extensionally valid transformations. A solution to this problem is to introduce an omega-rule, * If, for all lambda-expressions we have f\ t \ \underset=\ g\ t, then f \ \underset=\ g. In our situation, "all lambda-expressions" means "all Church numerals", so this is an omega-rule in the standard sense as well. Note that the omega-rule implies the eta-rule, since f\ t \ \underset=\ (\lambda x.f\ x)\ t by a beta-reduction on the right side.


Set theoretic domain

Lambda abstractions are functions of functions. A natural step is to define a domain for the lambda abstraction as a set of all functions. The set of all functions from a domain ''D'' to a range ''R'' is given by ''K'' in, : f \in K \iff (\forall x : x \in D \implies f\ x \in R) Then the (imaginary) definition of the set of all functions of functions is given by ''F'' in, : f \in F \iff (\forall x : x \in F \implies f\ x \in F) This definition cannot be formulated in an axiomatic set theory; and this naive equation, even if it could be written in a set theory, has no solutions. Now lambda calculus is defined by beta reductions and eta reductions. Interpreting reduction as defining equality gives an implicit domain for the lambda calculus. The rules are, * Every lambda abstraction has one value. * The beta reduction of a lambda term has the same value. * The eta reduction of a lambda term has the same value. * Alpha convertible lambda terms are equal. * f the omega-rule is present"omega-equivalent" lambda terms are equal. * If two lambda terms can not be shown to be equal by the above rules, they are not equal. If two lambda terms may be reduced to normal form then the
Church–Rosser theorem In lambda calculus, the Church–Rosser theorem states that, when applying reduction rules to terms, the ordering in which the reductions are chosen does not make a difference to the eventual result. More precisely, if there are two distinct red ...
may be used to show that they are equal if their normal forms are alpha convertible. If one or both of the terms are not normalizing then the undecidability of equivalence shows that in general there is no algorithm to determine if two lambda terms are equal. In general this makes it impossible to know what the distinct elements of the lambda calculus domain are.


Example: No solutions → one solution

For example the equation x = \neg x may be coded with
Church encoding In mathematics, Church encoding is a means of representing data and operators in the lambda calculus. The Church numerals are a representation of the natural numbers using lambda notation. The method is named for Alonzo Church, who first encoded da ...
and using Curry's Y combinator as, :\operatorname_1 = \lambda p.\lambda a.\lambda b.p\ b\ a :(\lambda f.(\lambda x.f\ (x\ x))\ (\lambda x.f\ (x\ x))) (\lambda p.\lambda a.\lambda b.p\ b\ a) And the recursion is, :(\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))\ (\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x)) :(\lambda p.\lambda a.\lambda b.p\ b\ a)\ ((\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))\ (\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))) :\lambda a.\lambda b.((\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))\ (\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x)))\ b\ a : ... :\lambda a.\lambda b.(\lambda a.\lambda b.((\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))\ (\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x)))\ b\ a)\ b\ a : ... (beta and then eta reduction) :(\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x))\ (\lambda x.(\lambda p.\lambda a.\lambda b.p\ b\ a)\ (x\ x)) Which is the first line and will recurse indefinitely. The expression never reduces to normal form. However every lambda term in the reduction represents the same value. This value is distinct from the encodings for ''true'' or ''false''. It is not part of the Boolean domain but it exists in the lambda calculus domain.


Example: Multiple solutions → one solution

Using
division Division or divider may refer to: Mathematics *Division (mathematics), the inverse of multiplication *Division algorithm, a method for computing the result of mathematical division Military *Division (military), a formation typically consisting ...
and signed numbers, the ''Y'' combinator may be used to define an expression representing a whole number square root. The Church encoding may also be extended further to
rational Rationality is the quality of being guided by or based on reasons. In this regard, a person acts rationally if they have a good reason for what they do or a belief is rational if it is based on strong evidence. This quality can apply to an abi ...
and
real Real may refer to: Currencies * Brazilian real (R$) * Central American Republic real * Mexican real * Portuguese real * Spanish real * Spanish colonial real Music Albums * ''Real'' (L'Arc-en-Ciel album) (2000) * ''Real'' (Bright album) (2010) ...
numbers, so that a real square root may be defined. The Church-Turing thesis implies that any computable operator (and its operands) can be represented in lambda calculus. Using such an encoding, : x^2 = n \Rightarrow x = \frac \Rightarrow f\ x = \frac \land Y\ f = x Using the implementation of divide then, : Y (\operatorname n) represents two values in the domain of the signed numbers, if ''n'' is not equal to zero. However it is a lambda expression so has only one value in the lambda calculus domain. Beta reduction of this lambda term never reaches normal form. However it represents a value, so a single value in the lambda calculus domain represents two values in the signed number domain.


See also

* Lambda calculus * Let expression *
Church encoding In mathematics, Church encoding is a means of representing data and operators in the lambda calculus. The Church numerals are a representation of the natural numbers using lambda notation. The method is named for Alonzo Church, who first encoded da ...


References

{{reflist, group=note Lambda calculus