The lambda calculus

The lambda calculus provides a very concise, yet powerful formalism to reason about computational abstraction. The introduction given here has been taken from  [Barend], which is a standard reference on this subject.
  
  
slide: The lambda calculus -- terms

Syntactically, lambda terms are built from a very simple syntax, figuring variables, the abstractor   
   (that is used to bind variables in an expression), and punctuation symbols. Abstractors may be used to abstract a lambda term   
   into a function λx.M with parameter x. The expression x must be read as denoting the function with body M and formal parameter M. The variable x is called the bound variable, since it is bound by the abstractor %l. In addition to function abstraction, we also have (function) application, which is written as the juxtaposition of two lambda terms. See slide lambda-terms. Behaviorally, lambda terms have a number of properties, as expressed in the laws given in slide lambda-laws.
  
  • ( λx.M) N = M [ x : = N ]

  • M = N ⇒ MZ = NZ and ZM = ZN

  • M = N ⇒ λx.M = λx.N


slide: The lambda calculus -- laws

The most important rule is the beta conversion rule, which describes in a manner of speaking how parameter passing is handled. In other words function call, that is the application   
  • ( λx.M) N = M [ x : = N ]

  • M = N ⇒ MZ = NZ and ZM = ZN

  • M = N ⇒ λx.M = λx.N

, results in the function body M in which N is substituted for x. Two other laws are the so-called extensionality axioms, which express how equality of lambda terms is propagated into application and function abstraction. These laws impose constraints upon the models characterizing the meaning of lambda terms.
  
  • ( λx.M) N = M [ x : = N ]

  • M = N ⇒ MZ = NZ and ZM = ZN

  • M = N ⇒ λx.M = λx.N


slide: The lambda calculus -- substitution

Substitution is defined by induction on the structure of lambda terms. A variable y is replaced by N (for a substitution [x:=N]) if y is x and remains y otherwise. A substitution [x:=N] performed on an abstraction %l y.M results in substituting N for x in M if x is not y. If x is identical to y, then y must first be replaced by a fresh variable (not occurring in M). A substitution performed on an application simply results in applying the substitution to both components of the application. See slide lambda-substitution. Some examples of beta conversion are given in slide lambda-examples. In the examples, for simplicity we employ ordinary arithmetical values and operators. This does not perturb the underlying %l-theory, since both values and operations may be expressed as proper %l-terms.
  
  • ( λx.M) N = M [ x : = N ]

  • M = N ⇒ MZ = NZ and ZM = ZN

  • M = N ⇒ λx.M = λx.N


slide: Beta conversion -- examples

Note that the result of a substitution may still contain free variables (as in the third example) that may be bound in the surrounding environment (as in the fourth example). Lambda calculus may be used to state properties of functions (and other programming constructs) in a general way.
  
  • ( λx.M) N = M [ x : = N ]

  • M = N ⇒ MZ = NZ and ZM = ZN

  • M = N ⇒ λx.M = λx.N


slide: The lambda calculus -- properties

Consider, for example, the statement that the identity function works for each lambda term as expected. The quantification with respect to M indicates that in each possible model for the lambda calculus (that respects the extensionality axioms given above) the identity $(%l x.x)M = M
holds. See slide lambda-properties. As another example, consider the statement that each function F has a fixed point, that is a value X for which FX = X. The proof given above, however, does not give us any information concerning the actual contents of the fixed point, but merely proves its existence. In the following (see section self-reference) we will write \Y(F) for the fixed point of a function F. In  [Barend], an extensive account is given of how to construct mathematical models for the lambda calculus. A semantics of our type calculus may be given in terms of such models; however we will not pursue this any further here.