Simply typed lambda calculus ( simple typed lambda calculus , lambda calculus with simple types , system ) Is a system of typed lambda calculus in which a special "arrow" type is assigned to lambda abstractions. This system was proposed by Alonzo Church in 1940 [1] . For a close to lambda calculus formalism of combinatorial logic, a similar system was considered by Haskell Curry in 1934 [2] .
Content
Formal Description
Type and term syntax
In the basic version of the system types are constructed from a set of variables using a single binary infix constructor . By tradition, Greek letters are used for type variables, and the operator consider right associative, that is is short for . Letters from the second half of the Greek alphabet ( , , etc.) are often used to denote arbitrary types, not just type variables.
There are two versions of a simply typed system. If the terms used are the same terms as in the typeless lambda calculus , then the system is called implicitly typed or typed according to Curry . If the variables in lambda abstraction are annotated with types, then the system is called explicitly typed or typed according to Church . As an example, we give an identical function in the Curry style: , and in Church style: .
Reduction Rules
The reduction rules do not differ from the rules for the typeless lambda calculus . reduction is determined by substitution
- .
reduction is defined as
- .
For reduction required that the variable was not free in terma .
Typing contexts and typing assertions
A context is a set of statements about typing variables separated by commas, for example,
Contexts are usually denoted in capital Greek letters: . In a context, you can add a “fresh” variable for this context: if - a valid context that does not contain a variable then - also a valid context.
The general form of a typing statement is as follows:
It reads as follows: in context term has type .
Typing Rules (Church)
In a simply typed lambda calculus, types are assigned to terms according to the rules below.
Axiom. If the variable assigned in context type then in this context has type . In the form of an output rule:
Introduction rule . If in some context extended by the statement that has type term has type , then in the mentioned context (without ), lambda abstraction has type . In the form of an output rule:
Delete rule . If in some context the term has type , and the term has type then application has type . In the form of an output rule:
The first rule allows you to assign a type to free variables, setting them in context. The second rule allows you to typify a lambda abstraction with an arrow type, removing the variable associated with this abstraction from the context. The third rule allows you to typify the application (application), provided that the left applicant has a suitable arrow type.
Examples of typing assertions in Church style:
- (axiom)
- (introduction )
- (removal )
- (introduction )
Properties
- Just a typed system has the property of typical security: with -reductions, the type of lambda term remains unchanged, while typing itself does not interfere with the advancement of calculations.
- In 1967, William Tate proved [3] that -reduction for a simply typed system has the property of strong normalization: any admissible term in a finite number reductions is reduced to a single normal form. Consequently -equivalence of terms is solvable in this system.
- The Curry-Howard isomorphism simply associates a typed lambda calculus with the so-called “minimal logic” (a fragment of the intuitionistic propositional logic of statements that includes only implication ): the populated types are exactly tautologies of this logic, and the terms correspond to evidence written in the form of a natural conclusion.
Notes
- ↑ A. Church. A Formulation of the Simple Theory of Types // J. Symbolic Logic. - 1940. - S. 56-68 .
- ↑ HB Curry. Functionality in Combinatory Logic // Proc Natl Acad Sci USA. - 1934. - S. 584-590 .
- ↑ WW Tait. Intensional Interpretations of Functionals of Finite Type I // J. Symbolic Logic. - 1967 .-- T. 32 (2) .
Literature
- Pierce, Benjamin C. Types and Programming Languages. - MIT Press , 2002. - ISBN 0-262-16209-1 .
- Translation into Russian: Pierce B. Types in programming languages. - Dobrosvet , 2012 .-- 680 p. - ISBN 978-5-7913-0082-9 .
- Barendregt, Henk. Lambda Calculi with Types // Handbook of Logic in Computer Science. - Oxford University Press, 1992 .-- T. II . - S. 117-309 .