Skip to content
LeanLearn
Level 2~20 minLean 4

Meet Lean: evaluate, check, define

Lean is both a programming language and a proof checker. Run your first Lean commands and see that every expression has a type.

You will be able to
  • Use #eval to compute and #check to ask for a type.
  • Define a simple function with def.
  • Recognise that statements like 2 + 2 = 4 have type Prop, and that Lean can check a proof of one.

Recommended first: What is a statement?. You can start anyway. Nothing is locked.

EncounterActivity 1 of 10

Encounter

Lean is a computer language with two jobs:

  1. It is a programming language: you can write functions and run them.
  2. It is a proof assistant: you can state mathematical claims and write proofs, and Lean checks every step. If Lean accepts a proof, a small, carefully designed program at its heart, the kernel, has confirmed it.

You do not need to install anything: the boxes below send your code to a real Lean 4 installation and show you exactly what it answers.

A program is a list of instructions. Here, each line starting with # is a command that asks Lean a question:

  • #eval e means "compute e and show me the result".
  • #check e means "what type does e have?"