Ready when you are

Two ways to try Lean.

The lessons are ready in this browser. Choose where you want to experiment with the code.

What you will see

Wherever you run Lean, the screen has two halves: your code, and a panel that shows the goal.

A Lean editor windowOn the left, the code pane holds the proof that 2 + 2 = 4, with the cursor on the first line. On the right, the goal panel, called the infoview, shows the goal at the cursor: 2 + 2 = 4 after the turnstile. Below the code, a wavy red underline marks where an error would appear.Example.lean12example : 2 + 2 = 4 := byrfl-- a mistake is underlined:INFOVIEW (goal panel)⊢ 2 + 2 = 4Updates as you movethe cursor.1234

Swipe sideways to see the whole window.

  1. The code pane. Type your claim and tactics here.
  2. The cursor. Click on a line to ask “what is the goal here?”
  3. The infoview. Shows the goal at the cursor, after ⊢. This is the same goal state the lessons show in “Step by step”.
  4. Errors. A wavy red line marks a problem. Hover over it or read the infoview for the message.
The online editor and VS Code both use this layout. The goal shown here is the real one Lean records for line 1 of Step 6.

The quickest first step

In your browser.

Use any lesson’s Try it live button. It opens the official Lean editor with that example already loaded.

  1. Open a lesson.
  2. Choose Try it live.
  3. Wait for the Lean server to connect, then change one line.
  4. Read the goal or output before changing more.
Open the Lean editor ↗

The editor is an external service. It runs Lean on its own server and needs an internet connection. If it cannot connect, you can keep reading here and copy the code for later.

For bigger adventures

On your computer.

The official setup uses VS Code and the Lean 4 extension. Follow the current official instructions for your operating system.

  1. Install VS Code.
  2. Install the official Lean 4 extension.
  3. Follow its setup guide.
  4. Open the course’s lean folder to use its pinned toolchain and Mathlib revision.
Follow the official guide ↗

The course examples are checked with Lean 4.36.0. Local installation details can change, so the official guide stays the source for those steps.