A proof assistant has one job that matters more than any other: when it says a proof is correct, it must be right. How can a program be trusted to judge mathematics? Lean’s answer is surprising. It has no separate notion of “proof” at all. It has programs and types, the same machinery a typed programming language uses to stop you adding a string to a number. A theorem’s statement is a type. A proof of the theorem is a program of that type. Checking the proof means checking that the program has the type it claims, and that check is a mechanical procedure, simple enough to be done by a small, carefully audited piece of code.

This lecture explains that idea, called propositions as types or the Curry–Howard correspondence. By the end you should be able to read a Lean statement as a type, write short proofs directly as programs, explain why type checking is proof checking, and name three places where the correspondence stops. Every Lean snippet below was compiled against plain Lean, with no libraries, so you can paste it into an empty file.

Notebook and cheatsheet

Types and terms

In Lean every expression is a term, and every term has a type. 3 is a term of type Nat. fun (n : Nat) => n + 1 is a term of type Nat → Nat, a function from natural numbers to natural numbers. The command #check asks Lean for a term’s type, and #eval runs a term. The comments show what Lean prints:

#check 3                           -- 3 : Nat
#check fun (n : Nat) => n + 1      -- fun n ↦ n + 1 : Nat → Nat
#check Nat → Nat                   -- Nat → Nat : Type
#eval (fun (n : Nat) => n + 1) 41  -- 42

The third line matters: types are terms too, so they have types. Nat → Nat has type Type, the type of ordinary data types. The colon is the central notion of the whole system, so it gets a name.

Definition 1.1 (Typing judgment).

A context is a list of variables with their types, . The typing judgment says: if the variables in have the stated types, then the term has type . The typing rules of the language say which judgments can be derived.

When you write fun (n : Nat) => n + 1, Lean checks the body n + 1 in a context containing n : Nat. Inside a proof, the context is the list of hypotheses you may use. In the editor, Lean’s infoview panel lists them above the turnstile ⊢, the same symbol as in the typing judgment (Definition 1.1), with the goal after it.

Now the step that makes Lean a theorem prover. There is a special type called Prop, and its terms are propositions, statements that may be true or false:

#check 2 + 2 = 4      -- 2 + 2 = 4 : Prop
#check Prop           -- Prop : Type
#check Type           -- Type : Type 1
 
theorem two_add_two : 2 + 2 = 4 := rfl
#check two_add_two    -- two_add_two : 2 + 2 = 4

2 + 2 = 4 is a term of type Prop. But it is also a type in its own right, and theorem declares a name, two_add_two, for a term of that type. The term is rfl (for “reflexivity”), whose type is a = a for any a. Lean accepts rfl as a term of type 2 + 2 = 4 because both sides compute to the same numeral. That is a complete proof, and it is the whole idea in miniature: the statement is a type, the proof is a term, and checking the proof is a type check. The last line shows that, as far as Lean is concerned, two_add_two is a constant whose type is the statement it proves.

(Type : Type 1 is not a typo. Lean has a ladder of universes Type 0, Type 1, …, each the type of the one below, because Type : Type would make the logic inconsistent. Lecture 2 covers universes.)

Propositions are types

Definition 1.2 (Propositions and proofs).

A proposition is a term with . A proof of is a term with . A proposition is provable exactly when the type has at least one term, that is, when is inhabited.

The definition of propositions and proofs (Definition 1.2) is a choice, not a discovery. The discovery is that the logical connectives line up with type constructors that programmers already use, so that the rules of logic and the rules of typed programming are the same rules. Haskell Curry noticed the pattern for implication (in 1934, and with Robert Feys in 1958); William Howard extended it to the other connectives in a manuscript written in 1969 and published in 1980. Philip Wadler’s essay in the Readings tells the history.

Theorem 1.1 (Curry–Howard correspondence).

Natural-deduction derivations in intuitionistic propositional logic correspond one-to-one to terms of the simply typed λ-calculus with pairs and tagged unions: a derivation of from hypotheses is a term with . Simplifying a proof (removing a detour) corresponds to running the program (β-reduction).

Lean’s type theory is much richer than the simply typed λ-calculus (it has dependent types, below), but the dictionary of the Curry–Howard correspondence (Theorem 1.1) carries over connective by connective:

logictypea proof isusing a proof
function typefun hp => …apply it: hpq hp
pair (And)⟨hp, hq⟩project: h.1, h.2
tagged union (Or)Or.inl hp or Or.inr hqsplit cases: match
P → Falsefun hp => …apply it to a proof of P
dependent functionfun x => …apply it to a value
dependent pair (Exists)⟨w, hw⟩unpack: match

Implication first. A proof of is a function that turns any proof of into a proof of . Using it is function application, and that is modus ponens:

theorem modus_ponens (p q : Prop) (hp : p) (hpq : p → q) : q :=
  hpq hp
 
theorem const_intro (p q : Prop) : p → q → p :=
  fun hp => fun _hq => hp

Read the first statement as a typing problem: in the context p q : Prop, hp : p, hpq : p → q, produce a term of type q. The hypotheses are just variables, and hpq hp is the only sensible program. The second proof takes two arguments and returns the first. The underscore in _hq tells Lean the argument is unused on purpose. (Programmers know this function as const; in logic it is the axiom K of Hilbert-style proof systems.)

Conjunction is a pair. Lean’s And is a structure with one constructor, And.intro, and two projections. Asking for their types (the @ makes the implicit arguments visible) gives back exactly the introduction and elimination rules of logic:

theorem swap_and (p q : Prop) (h : p ∧ q) : q ∧ p :=
  ⟨h.2, h.1⟩
 
#check @And.intro  -- @And.intro : ∀ {a b : Prop}, a → b → a ∧ b
#check @And.left   -- @And.left : ∀ {a b : Prop}, a ∧ b → a

The angle brackets ⟨h.2, h.1⟩ build a pair, and h.1 and h.2 are short for h.left and h.right. Disjunction is a tagged union: a proof of is either Or.inl hp or Or.inr hq, and you use one by handling both tags. In a programming language this is pattern matching; in logic it is proof by cases:

example (p q r : Prop) (hpr : p → r) (hqr : q → r) : p ∨ q → r :=
  fun h =>
    match h with
    | Or.inl hp => hpr hp
    | Or.inr hq => hqr hq
 
theorem not_both (p : Prop) : ¬(p ∧ ¬p) :=
  fun h => h.2 h.1

The second proof uses the negation row. False is a proposition with no proofs at all, and ¬P is defined to mean P → False. So h.2 : ¬p is a function from proofs of p to proofs of False, and applying it to h.1 : p produces the False we need.

Quantifiers are where Lean goes beyond the simply typed λ-calculus. In ∀ n : Nat, n = n, the type of the result depends on the input: for the input 5 it is 5 = 5. Lean’s functions can do this; they are dependent functions. A proof of a ∀ statement is a function that takes any n and returns a proof about that n. Ordinary implication p → q is the special case where the output type does not mention the input:

#check ∀ n : Nat, n = n                -- ∀ (n : Nat), n = n : Prop
#check fun (n : Nat) => (rfl : n = n)  -- fun n ↦ rfl : ∀ (n : Nat), n = n
#check fun (p : Prop) (h : p) => h     -- fun p h ↦ h : ∀ (p : Prop), p → p
 
example : ∃ n : Nat, n * n = 49 := ⟨7, rfl⟩

The third line deserves a pause: the identity function, given a proposition p and a proof of it, is a proof that every proposition implies itself. An existential proof is a pair of a witness and evidence: ⟨7, rfl⟩ packs 7 with a proof that 7 * 7 = 49, which holds by computation.

The dictionary also explains Lean’s error messages. A wrong proof is a program of the wrong type:

example (p q : Prop) (h : p ∨ q) : p := h

Lean rejects it with Type mismatch: h has type p ∨ q but is expected to have type p. Knowing does not let you conclude , and the type checker says so in its own vocabulary.

Why type checking is proof checking

The dictionary would be a curiosity if it were only an analogy. It matters because the typing rules of Lean’s language are inference rules of a logic. Here are the two rules for functions, written the way logicians write rules, with premises above the line and the conclusion below:

Erase the terms, keep only the types, and you get natural deduction. Rule says “if assuming you can derive , then ”, and rule is modus ponens. Keep the terms and each rule also records how its conclusion was reached, so a term is a whole derivation written on one line. The figure below shows this for swap_and: the same three steps, drawn as a natural-deduction tree and as the tree of the proof term.

natural deduction (logic) proof term (Lean) p ∧ q p ∧ q ∧E₂ ∧E₁ q p ∧I q ∧ p hypothesis projection pairing h : p ∧ q h : p ∧ q h.2 : q h.1 : p ⟨h.2, h.1⟩ : q ∧ p

Each row of the figure is one step, and the two columns are the same step in two notations: a hypothesis is a variable, the elimination rules for are the projections .1 and .2, and the introduction rule is the pair constructor. With that in hand, here are the two problems a proof assistant faces.

The two problems of Definition 1.3 differ enormously in difficulty. Proof search contains all of mathematics: already for first-order logic, no algorithm can decide whether an arbitrary statement has a proof (Church and Turing, 1936). Type checking is easy by comparison, because the typing rules are syntax-directed. The outermost shape of (a fun, an application, a pair) tells the checker which rule to use, and the premises of that rule are checks on the smaller pieces of . One walk over the term is enough.

The only real work is comparing types. In two_add_two, the term is rfl at 2 + 2, whose type is 2 + 2 = 2 + 2, and the checker must confirm that this is the same type as 2 + 2 = 4. It does so by computing 2 + 2 to 4. Types that agree after computation are called definitionally equal. Lecture 2 says exactly which computations count.

This asymmetry is the design of every modern proof assistant. People, tactics, decision procedures and AI models do the hard part, the search, and they are allowed to be clever, large and buggy. What they produce is a term, and a small program called the kernel checks it again from scratch.

Remark 1.1 (The de Bruijn criterion).

A proof assistant meets the de Bruijn criterion if every proof it accepts is reduced to a proof object that a small, independent checker verifies. You then trust the checker, not the tools that found the proof. Lean meets it: its kernel checks every declaration that Lean adds in the normal way, leanchecker replays a whole build to confirm none skipped the kernel, and separate re-implementations of the kernel can re-check a whole library. The name honours N. G. de Bruijn, whose Automath project, begun in 1967, first checked mathematics this way.

The de Bruijn criterion (Remark 1.1) moves trust; it does not remove it. Three caveats keep the claim honest. The kernel is trusted, so a kernel bug could accept a false theorem, which is why the kernel is kept small and why independent checkers exist (Lecture 2). Definitional equality in Lean is undecidable in theory, as Carneiro’s thesis shows, so the kernel’s comparison is sound but incomplete: it never accepts an ill-typed term, and on real proofs it terminates. And every check is relative to the axioms, which come up below.

A tactic proof is still a term

Most Lean proofs you will read are not written as terms. They are tactic proofs: a sequence of commands after by, each transforming the current goal. Tactics might look like a second kind of proof. They are not. A tactic is a program that writes part of a term, and when the tactic block finishes, the kernel checks the finished term like any other.

theorem swap_and' (p q : Prop) (h : p ∧ q) : q ∧ p := by
  constructor
  · exact h.2
  · exact h.1
 
#print swap_and'

constructor means “build this ∧ with And.intro”, which leaves two goals, q and p. Each exact closes one, and the · bullets keep the two goals apart. #print shows the term that was built:

theorem swap_and' : ∀ (p q : Prop), p ∧ q → q ∧ p :=
fun p q h ↦ ⟨h.right, h.left⟩

It is the term of swap_and, with h.right and h.left spelled out. The hypotheses before the colon became fun p q h ↦ at the front: a theorem with arguments is a function of them. Lecture 3 builds up the tactic vocabulary, and the cheatsheet card intro, exact, apply traces how each tactic fills a hole in the term.

Where the correspondence stops

The dictionary is exact for the constructive core of logic. Three things sit outside it.

Prop is not an ordinary type. Lean treats any two proofs of the same proposition as equal (proof irrelevance). A proof is evidence that something holds, not data to compute with, so you cannot take the witness out of a proof of ∃ and use it as data in a program; the cheatsheet card on the dictionary shows the error you get. This is deliberate. It lets the compiler erase proofs, and it stops axioms without computational content (below) from leaking into programs.

Classical logic is added by axioms. No row of the table proves for an arbitrary ; no term built from these rules does. That is the constructive (or intuitionistic) part of logic. Lean adds classical reasoning with axioms, and #print axioms lists exactly the axioms a theorem depends on:

theorem em_example (p : Prop) : p ∨ ¬p := Classical.em p
 
#print axioms em_example
#print axioms modus_ponens

The first command reports 'em_example' depends on axioms: [propext, Classical.choice, Quot.sound]. The second reports 'modus_ponens' does not depend on any axioms. These three are Lean’s standard axioms, and Mathlib uses them freely. In an audit, look for anything else: sorryAx, which marks an unfinished proof, or a project’s own axiom declarations.

The kernel checks the statement you wrote. Type checking guarantees . It says nothing about whether means what you intended. Here is a true theorem:

example : (2 : Nat) - 5 + 5 = 5 := rfl

It holds because subtraction on Nat stops at zero, so 2 - 5 = 0. Over the integers the left side would be 2. Lean is not wrong here; the statement is simply not the one a reader expects. Mistranslated statements are the main way formal proofs go wrong in practice, and the kernel cannot see them. A paper of 2026-10-06 by Bastounis, Circelli and Hansen (arXiv 2610.08144) argues, as its title puts it, that “Lean verification of AI autoformalisation does not guarantee correct natural language proofs”, with a Navier–Stokes formalization as its case study (DISPUTED; Lecture 13 sets out both sides). Lecture 5 turns checking a statement into a routine.

Try this

  • In Notebook 1, draw the term trees of swap_and and swap_and' and confirm they have the same shape.
  • Prove (p → q) → (q → r) → p → r as a term (a fun of three arguments), then with tactics, and #print both.
  • Prove ¬(p ∨ q) → ¬p ∧ ¬q as a term. Hint: unfold ¬ to → False and build a pair of functions.
  • Find a statement about Nat that Lean proves by rfl but that is false over the integers. Subtraction is a good place to start: evaluate (2 : Nat) - 5 and (2 : Int) - 5. (Division by zero does not work here: both (5 : Nat) / 0 and (5 : Int) / 0 are 0.)

Readings

  • Avigad, de Moura, Kong and Ullrich, Theorem Proving in Lean 4, ch. 2, Dependent Type Theory and ch. 3, Propositions and Proofs. The Lean treatment of this lecture, with many more exercises.
  • Philip Wadler, Propositions as Types, Communications of the ACM 58(12), 2015. The history and the idea, for a general reader.
  • The Hitchhiker’s Guide to Logical Verification (2023 edition). A course text that covers the same ground from the logician’s side.
  • Mario Carneiro, The Type Theory of Lean, MSc thesis, Carnegie Mellon University, 2019. The exact rules, and the proof that Lean’s definitional equality is undecidable.
  • William A. Howard, “The formulae-as-types notion of construction”, in To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, Academic Press, 1980.