AI and mathematics
Proof assistants like Lean check every step of a proof by machine. AI can help find proofs, spot patterns and suggest conjectures, and the checker keeps it honest.
In 60 seconds
AI and mathematics
Proof assistants like Lean check every step of a proof by machine. AI can help find proofs, spot patterns and suggest conjectures, and the checker keeps it honest.
Proofs, conjectures and checking
n × n + n + 41. For n = 0, 1, 2 and many more, it gives a prime number. It is tempting to guess "always prime". But at n = 40 it gives 1681, which is 41 × 41. One counter-example breaks the pattern. The lab lets you see this yourself.What a proof assistant is
-- Lean checks that 2 + 2 really equals 4.
example : 2 + 2 = 4 := rfl
-- For every natural number n, n + 0 = n.
theorem add_zero_example (n : Nat) : n + 0 = n := rflHow AI helps mathematicians
| Task | What AI does | What keeps it honest |
|---|---|---|
| Finding proofs | A language model suggests the next proof step or a whole proof in Lean. | Lean checks it. Wrong steps are rejected. |
| Searching the library | AI helps find a lemma in a big library that fits the current step. | The step must still check. |
| Spotting patterns | Machine learning looks at lots of mathematical data and finds links a person might miss. | Mathematicians must then prove the pattern. |
| Explaining and writing | AI explains a proof in simpler words or drafts a write-up. | A human must read it critically. Explanations can contain errors. |
The key idea: generate, then verify
- 1
Propose
A model suggests a proof, a step or a conjecture. It may be wrong. - 2
Check
Lean checks a formal proof. Tests or counter-example searches check a conjecture. - 3
Keep or reject
Only checked proofs are kept. Failed attempts give feedback for the next try. - 4
Understand
Mathematicians read and explain the result, so people learn why it is true.
- Copying a chatbot's proof into homework without checking
- Trusting a pattern because it held for 100 cases
- Accepting a proof of a statement you did not read carefully
- Asking AI for hints, then writing and checking the proof yourself
- Searching for counter-examples, then trying to prove it
- Checking that the formal statement says what you mean
Watch and read more
Lab
A small Python search that tests a tempting conjecture, and a written reflection on examples versus proof.
The problem
You will test two conjectures by searching for counter-examples.
- Run the starter code. It tests "n × n + n + 41 is always prime" for n from 0 to 50. At which n does it first fail?
- Change the code to test a second conjecture: "the sum of the first n odd numbers is n × n". Check n from 1 to 1000. Does it ever fail?
- For the second conjecture, try to explain in your own words (or with a picture of squares) why it is always true. This is the start of a proof.
- Write three sentences on the difference between "checked for 1000 cases" and "proved".
Practice lab
Edit the code and run it. Python runs in your browser — nothing is sent to our server.
No output. Add print(...) to see values.
You are done when
Hard questions
Try to answer before you reveal. If you can answer these, you understood the lesson.
Q1If a computer checks a conjecture for a billion cases with no counter-example, is that a proof?Reveal
No. The statement is about infinitely many numbers, and a billion is still a finite number of cases. Some famous conjectures held for enormous ranges before a counter-example was found. Large checks are good evidence and can guide mathematicians, but a proof must cover every case by logic.
Q2An AI writes a Lean proof that is accepted, but the mathematicians do not understand why it works. Is that a problem?Reveal
The result is still correct: Lean has checked it. But mathematics is also about understanding. A proof no one understands teaches less and is harder to build on. Mathematicians may then study the proof to extract the key idea, or look for a clearer one. Correctness and understanding are both valued.
Questions people ask
Can a chatbot's written proof be trusted?
Not by itself. A chatbot can write a proof that sounds convincing but has a gap or a wrong step. Check it carefully yourself, or use a proof assistant. A formal proof checked by Lean is much more trustworthy than prose.
Is Lean hard to learn?
It takes practice, like any precise language. There are free beginner tutorials and interactive games linked from lean-lang.org and the Lean community. School algebra is enough to start with the simplest ones.
Will AI replace mathematicians?
AI is becoming a strong helper for finding and checking proofs. But choosing important questions, building new ideas and explaining why things are true are deeply human parts of mathematics. Many mathematicians see AI as a new kind of collaborator and tool.
What if the statement given to Lean is wrong?
Then Lean may check a correct proof of the wrong statement. This is a real risk. People must read the formal statement carefully and make sure it matches what they meant. The checker verifies the proof, not your intention.
Lesson test
5 questions. Get 3 right (60%) to pass and complete this lesson.