Added to Favorites

Nearby Words

System F, also known as the polymorphic lambda calculus or the second-order lambda calculus, is a typed 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 languages.## Logic and predicates

The Boolean type is defined as:
$forallalpha.alpha\; to\; alpha\; to\; alpha$, where α is a type variable.
This produces the following two definitions for the boolean values `TRUE` and `FALSE`:`ISZERO` which returns `TRUE` if and only if its argument is the Church numeral `0`:
## System F Structures

## Use in programming languages

## System $F\_omega$

## References

## External links

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

- $vdash\; Lambdaalpha.\; lambda\; x^alpha.x:\; forallalpha.alpha\; to\; alpha$

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.

- TRUE := $Lambda\; alpha.lambda\; x^alpha\; lambda\; y^alpha.x$

- FALSE := $Lambda\; alpha.lambda\; x^alpha\; lambda\; y^alpha.y$

Then, with these two λ-terms, we can define some logic operators:

- AND := $lambda\; x^\{Boolean\}\; lambda\; y^\{Boolean\}.((x\; (Boolean))\; y)\; FALSE$

- OR := $lambda\; x^\{Boolean\}\; lambda\; y^\{Boolean\}.((x\; (Boolean))\; TRUE)\; y$

- NOT := $lambda\; x^\{Boolean\}.\; ((x\; (Boolean))\; FALSE)\; TRUE$

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 := $Lambda\; alpha.lambda\; x^\{Boolean\}lambda\; y^\{alpha\}lambda\; z^\{alpha\}.((x\; (alpha))\; y)\; z$

`ISZERO := λ n. n (λ x. FALSE) TRUE`

System F allows recursive constructions to be embedded in a natural manner, related to that in Martin-Löf's type theory. Abstract structures (S) are created using constructors. These are functions typed as:

- $K\_1rightarrow\; K\_2rightarrowdotsrightarrow\; S$.

Recursivity is manifested when $S$ itself appears within one of the types $K\_i$. If you have $m$ of these constructors, you can define the type of $S$ as:

- $forall\; alpha.(K\_1^1[alpha/S]rightarrowdotsrightarrow\; alpha)dotsrightarrow(K\_1^m[alpha/S]rightarrowdotsrightarrow\; alpha)rightarrow\; alpha$

For instance, the natural numbers can be defined as an inductive datatype $N$ with constructors

- $mathit\{zero\}\; :\; mathrm\{N\}$

- $mathit\{succ\}\; :\; mathrm\{N\}\; to\; mathrm\{N\}$

`0 :=`$Lambda\; alpha\; .\; lambda\; x^alpha\; .\; lambda\; f^\{alphatoalpha\}\; .\; x$

`1 :=`$Lambda\; alpha\; .\; lambda\; x^alpha\; .\; lambda\; f^\{alphatoalpha\}\; .\; f\; x$

`2 :=`$Lambda\; alpha\; .\; lambda\; x^alpha\; .\; lambda\; f^\{alphatoalpha\}\; .\; f\; (f\; x)$

`3 :=`$Lambda\; alpha\; .\; lambda\; x^alpha\; .\; lambda\; f^\{alphatoalpha\}\; .\; f\; (f\; (f\; x))$

If we reverse the order of the curried arguments (i.e., $forall\; alpha.\; (alpha\; to\; alpha)\; to\; alpha\; to\; alpha$), then the Church numeral for $n$ is a function that takes a function `f` as argument and returns the $n^textrm\{th\}$ 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.

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.

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 98 and ML. Over time, as the restrictions of HM-style type systems have become apparent, languages have steadily moved to more expressive logics for their type systems. As of 2008, the Haskell compiler, GHC, goes beyond HM, and now uses System F extended with non-syntactic type equality, for example.

System $F\_1$ is the simply-typed lambda calculus; it includes no mappings from types to types. The System F described in this article is technically System $F\_2$; that is, the system wherein all mappings from types to types take arguments which are strictly first-order (not functions themselves).

In general, there is a family of systems defined inductively by the kinds permitted in each system:

- $F\_1$ does not permit any kinds (only types)
- $F\_n$ permits kinds:
- $star$ (the kind of types) and
- $JRightarrow\; K$ where $Jin\; F\_\{n-1\}$ and $Kin\; F\_n$ (the kind of functions from types to types, where the argument type is of a lower order)

In the limit, we can define system $F\_omega$ to be

- $F\_omega\; =\; underset\{1\; leq\; i\}\{bigcup\}\; F\_i$

That is, $F\_omega$ is the system which allows functions from types to types where the argument (and result) may be of any order.

Note that although $F\_omega$ places no restrictions on the order of the arguments in these mappings, it does restrict the universe of the arguments for these mappings -- they must be types rather than values. System $F\_omega$ does not permit mappings from values to types (Dependent types), though it does permit mappings from values to values ($lambda$ abstraction), mappings from types to values ($Lambda$ abstraction, sometimes written $forall$) and mappings from types to types ($lambda$ abstraction at the level of types)

- Girard, Lafont and Taylor, Proofs and Types Cambridge University Press, 1989, ISBN 0 521 37181 3.
- J. B. Wells. "Typability and type checking in the second-order lambda-calculus are equivalent and undecidable." In Proceedings of the 9th Annual IEEE Symposium on Logic in Computer Science (LICS), pages 176-185, 1994.

- Summary of System F by Franck Binard.

Wikipedia, the free encyclopedia © 2001-2006 Wikipedia contributors (Disclaimer)

This article is licensed under the GNU Free Documentation License.

Last updated on Saturday September 06, 2008 at 23:39:55 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

This article is licensed under the GNU Free Documentation License.

Last updated on Saturday September 06, 2008 at 23:39:55 PDT (GMT -0700)

View this article at Wikipedia.org - Edit this article at Wikipedia.org - Donate to the Wikimedia Foundation

Copyright © 2015 Dictionary.com, LLC. All rights reserved.