LearnViz CompSci
Home / Learn / Theory & Discrete Math / Lambda Calculus

Advanced Topic 45 of 51 Theory & Discrete Math

Lambda Calculus

Minimal formal system of function abstraction and application.

How it works

Lambda calculus is a minimal formal system for computation built from only three kinds of expressions: variables, abstraction, written lambda x dot body, which defines a function, and application, which calls a function on an argument. Computation proceeds by beta reduction, substituting the argument for the bound variable. Despite its simplicity, it is Turing-complete: numbers, booleans, pairs and recursion can be encoded, for example Church numerals and the Y combinator. Typed variants add static guarantees.

Step-by-step walkthrough

  1. The only things are variables, function definitions and applications.
  2. A function is written lambda x dot x plus 1.
  3. Applying it to 3 substitutes x with 3.
  4. Beta reduction gives 3 plus 1.
  5. This tiny system is Turing complete and underlies functional languages.

Where it is used

It is the foundation of functional programming languages such as Lisp, Haskell and ML, and of type theory and proof assistants. Lambda expressions in mainstream languages come from it.

Common pitfall

Variable capture during substitution causes errors, so alpha-renaming of bound variables is needed. Reduction strategies such as normal order and applicative order differ in termination: some terms have no normal form. Untyped lambda calculus allows nonterminating terms, while simply typed versions guarantee termination but lose power. Practice by reducing small expressions by hand.

Where it fits in the course

Lambda Calculus is topic 45 of 51 in Theory & Discrete Math, rated Advanced. It follows Parameterized Complexity. The next topic is Information Theory.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Theory & Discrete Math quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Lambda Calculus?
Minimal formal system of function abstraction and application. It belongs to Theory & Discrete Math and is an advanced-level topic.
Where do people use Lambda Calculus?
It is the foundation of functional programming languages such as Lisp, Haskell and ML, and of type theory and proof assistants.
What is the most common mistake with Lambda Calculus?
Variable capture during substitution causes errors, so alpha-renaming of bound variables is needed.
What should I learn before this topic?
Start with Parameterized Complexity, the topic just before it in Theory & Discrete Math.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Theory & Discrete Math quiz.
Is Lambda Calculus hard to learn?
It is an Advanced topic. Expect to read the explanation more than once and to connect it with earlier topics. Working through a small example by hand helps most.
How long does it take to learn Lambda Calculus?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Lambda Calculus?
Parameterized Complexity, Information Theory, Approximation and Inapproximability are closely connected. The full list is in the related topics section of this page.
What should I study after Lambda Calculus?
Continue with Information Theory, the next topic in Theory & Discrete Math.

Related topics