Information AboutSystem F |
| CATEGORIES ABOUT SYSTEM F | |
| lambda calculus | |
| type theory | |
|
''System F'' is a typed Lambda Calculus . It is also known as the '''''second-order''''' or '''''polymorphic lambda calculus'''''. It was discovered independently by the Logician Jean-Yves Girard and the Computer Scientist John C. Reynolds . System F formalizes the notion of parametric Polymorphism in Programming Language s. Just as the Lambda Calculus has variables ranging over functions, and binders for them, the second-order lambda calculus has variables ranging over ''types'', and binders for them. As an example, the fact that the identity function can have any type of the form A→ A would be formalized in System F as the judgement : where α is a Type Variable . Under the Curry-Howard Isomorphism , System F corresponds to a Second-order Logic . System F, together with even more expressive lambda calculi, can be seen as part of the Lambda Cube . LOGIC AND PREDICATES The ''Boolean'' type is defined as: , where α is a Type Variable . This produces the following two definitions for the boolean values TRUE and FALSE: : TRUE := : FALSE := Then, with these two λ-terms, we can define some logic operators: : AND := : OR := : NOT := There really is no need for a ''IFTHENELSE'' function as one can just use raw Boolean typed terms as decision functions. However, if one is requested: : IFTHENELSE := will do. A ''predicate'' is a function which returns a boolean value. The most fundamental predicate is ISZERO which returns TRUE if and only if its argument is the Church numeral 0: : ISZERO := λ ''n''. ''n'' (λ ''x''. FALSE) TRUE SYSTEM F STRUCTURES System F allows recursive constructions to be embedded in a natural manner, related to that in Martin-Löf's Type Theory . Suppose you want to create an abstract structure (call it S). The first thing you'll need are constructors. These will be functions whose type will be :. Recursivity is manifested when itself appears within one of the types . If you have of these constructors, you can define the type of as: : For instance, the natural numbers can be defined as an inductive datatype with constructors : : The System F type corresponding to this structure is . The terms of this type comprise a typed version of the Church Numeral s, the first few of which are: : 0 := : 1 := : 2 := : 3 := If we reverse the order of the curried arguments (''i.e.,'' ), then the Church numeral for is a function that takes a function ''f'' as argument and returns the power of ''f''. That is to say, a Church numeral is a Higher-order Function -- it takes a single-argument function ''f'', and returns another single-argument function. USE IN PROGRAMMING LANGUAGES The version of System F used in this article is as an explicitly-typed, or Church-style, calculus. The typing information contained in λ-terms makes Type-checking straightforward. Joe Wells (1994) settled an "embarrassing open problem" by proving that type checking is Undecidable for a Curry-style variant of System F, that is, one that lacks explicit typing annotations. [http://www.church-project.org/reports/Wells:APAL-1999-v98-no-note.html Wells' result implies that Type Inference for System F is impossible. A restriction of System F known as " Hindley-Milner ", or simply "HM", does have an easy type inference algorithm and is used for many Strongly Typed Functional Programming Languages such as Haskell and ML . REFERENCES
EXTERNAL LINKS
|
|
|