ArticleslgStudy

computer science

System F

System F is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand System F rather than just read about it. In short: System F (also polymorphic lambda calculus or second-order lambda calculus) is a typed lambda calculus that introduces, to simply typed lambda calculus, a mechanism of universal quantification over types. System F formalizes parametric polymorphism in programming languages, thus forming a theoretical basis for languages such as Haskell and ML.

Key takeaways

  • System F belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect System F to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of System F from memory before moving on to harder problems.

Reference excerpt

System F (also polymorphic lambda calculus or second-order lambda calculus) is a typed lambda calculus that introduces, to simply typed lambda calculus, a mechanism of universal quantification over types. System F formalizes parametric polymorphism in programming languages, thus forming a theoretical basis for languages such as Haskell and ML. It was discovered independently by logician Jean-Yves Girard (1972) and computer scientist John C. Reynolds. Whereas simply typed lambda calculus has variables ranging over terms, and binders for them, System F additionally 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 statement

⊢ Λ α . λ x α . x : ∀ α . α → α {\displaystyle \vdash \Lambda \alpha .\lambda x^{\alpha }.x:\forall \alpha .\alpha \to \alpha }

where α {\displaystyle \alpha } is a type variable. The upper-case Λ {\displaystyle \Lambda } is traditionally used to denote type-level functions, as opposed to the lower-case λ {\displaystyle \lambda } which is used for value-level functions. (The superscripted α {\displaystyle \alpha } means that the bound variable x is of type α {\displaystyle \alpha } ; the expression after the colon is the type of the lambda expression preceding it.) As a term rewriting system, System F is strongly normalizing. However, type inference in System F (without explicit type annotations) is undecidable. Under the Curry–Howard isomorphism, System F corresponds to second-order propositional intuitionistic logic. System F can be seen as part of the lambda cube, together with even more expressive typed lambda calculi, including those with dependent types. According to Girard, the "F" in System F was picked by chance.

Typing rules The typing rules of System F are those of simply typed lambda calculus with the addition of the following:

where σ , τ {\displaystyle \sigma ,\tau } are types, α {\displaystyle \alpha } is a type variable, and α type {\displaystyle \alpha ~{\text{type}}} in the context indicates that α {\displaystyle \alpha } is bound. The first rule is that of application, and the second is that of abstraction.

Logic and predicates The B o o l e a n {\displaystyle {\mathsf {Boolean}}} type is defined as:

∀ α . α → α → α {\displaystyle \forall \alpha .\alpha \to \alpha \to \alpha } , where α {\displaystyle \alpha } is a type variable. This means: B o o l e a n {\displaystyle {\mathsf {Boolean}}} is the type of all functions which take as input a type α and two expressions of type α, and produce as output an expression of type α (note that we consider → {\displaystyle \to } to be right-associative.) The following two definitions for the Boolean values T {\displaystyle \mathbf {T} } and F {\displaystyle \mathbf {F} } are used, extending the definition of Church Booleans:

T = Λ α . λ x α λ y α . x {\displaystyle \mathbf {T} =\Lambda \alpha {.}\lambda x^{\alpha }\lambda y^{\alpha }{.}x}

F = Λ α . λ x α λ y α . y {\displaystyle \mathbf {F} =\Lambda \alpha {.}\lambda x^{\alpha }\lambda y^{\alpha }{.}y}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with System F

Start with the simplest possible case. Write down what System F claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to System F before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about System F ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of System F

In research
System F appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses System F in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
System F is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1971 in computing, 1974 in computing, Lambda calculus, so understanding it makes those chapters shorter.
In everyday life
Look for System F outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study System F in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what System F means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain System F out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is System F in simple terms?

System F (also polymorphic lambda calculus or second-order lambda calculus) is a typed lambda calculus that introduces, to simply typed lambda calculus, a mechanism of universal quantification over types. System F formalizes parametric polymorphism in programming languages, thus forming a theoretic…

Why does System F matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study System F?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on System F.

Tags

  • 1971 in computing
  • 1974 in computing
  • Lambda calculus
  • Logic
  • Polymorphism (computer science)
  • Type theory

Keep exploring