Read Lean’s reply

The four replies you will see most, word for word, and what to do about each.

Rewritten12 minBeginnerreading repliesunknown namesa failed rflunsolved goals
0/11 completed in this course

Every Check gets a reply from Lean. Most of learning Lean is reading that reply calmly, so here are the four you will see most often, exactly as Lean prints them.

1. Accepted. The Goal tab says No goals left. There is nothing more to do.

2. A name Lean does not know. Usually a typo. In a proof, Lean says unknown tactic:

Lean rejects this
example : 2 + 3 = 5 := by
  rlf
Lean replies with an error
unknown tactic

Elsewhere it names the word it could not find: Unknown identifier dobule. The editor often catches typos before you spend a check and suggests the closest word it knows.

3. The claim is false. rfl shows the two sides it computed. If they differ, the claim is wrong, not the tactic:

Lean rejects this
example : 2 + 3 = 6 := by
  rfl
Lean replies with an error
Tactic `rfl` failed: The left-hand side
  2 + 3
is not definitionally equal to the right-hand side
  6

4. Unsolved goals. Every step worked, but the proof is not finished. Lean prints what is still left to prove after the symbol ⊢. You will meet this one constantly from the next course on, and it is good news: it tells you the next thing to do.

One rule for all of them: read the first error, fix only that, and check again. A single mistake often causes a second error further down, and that one disappears with the first.

Worked example

-- Fix 1: the tactic is spelled rfl.
example : 2 + 3 = 5 := by
  rfl

-- Fix 2: the claim said 6, but two plus three is five.
example : 2 + 3 = 5 := by
  rfl
Step through the proof1 / 4

At the start of the proof on line 2. Everything above ⊢ may be used; the line below it is what must be proved.

⊢2 + 3 = 5

Both fixes were small: correct one spelling, or correct one number in the claim. The reply told you which.

Takeaway

Read Lean’s first reply before changing anything. An unknown name is a spelling problem, a failed rfl shows the two sides it compared, and unsolved goals show what is left.

Exercise 1 of 3

This proof has a typo. Read the reply under the editor and fix the spelling.

Suggested steps
  1. Correct the spelling of the tactic

These marks only recognize text. Another correct proof may use different steps; Lean checks whether it works.

Exercise.lean
1theorem exercise : 6 * 7 = 42 := by
given
Loading editor…

Where you start. Everything above ⊢ may be assumed; the line below it is what you must prove.

⊢6 * 7 = 42
Fix the problem below the editor to checkLn 1, Col 1Lean 4
Draft saved in this browser
Stuck?
Recall and apply

Knowledge check

Answer without looking back, then check your reasoning.

0of 3
correct
Question 1 of 3Lean replies unknown tactic. What is the most likely cause?
Question 2 of 3rfl fails and shows 3 + 4 on the left and 8 on the right. What do you change?
Question 3 of 3Your code produces two errors. Which do you fix first?