Today ainotis Join

My notis

ResearchPublished ExplainedAll news from that day

How Lean checks an AI-written proof, and where that stops

Lean's manual describes a kernel check, an axiom listing and two stronger tools, and says a passing check is meaningful if the theorem statement matches its intended meaning.

Share

Check our sources · 16 facts from 7 sources
Illustration: A bench-top inspection gate with a tray feeding in and a tray collecting out; its green checkpoint housing stands for the small kernel that checks every step of a proof.Illustration made with AI for ai notis
source · Illustration made with AI for ai notis; not a picture of what happened

Key points

  1. Lean's manual describes its trusted kernel as a small implementation of a type checker, and says newly elaborated inductive types and definitions must be checked by it.
  2. #print axioms lists what a declaration uses; sorryAx in the list means the theorem or a dependency uses sorry or is incomplete. Lean has four standard axioms.
  3. The manual separates whether a theorem has a valid proof from what its statement means, and calls the basic check meaningful if the statement matches its intended meaning.

What happened

Lean is an open-source system that works both as a programming language and as a proof assistant. You use it to write precise, verifiable code and formal proofs.

Lean's manual describes its trusted kernel as a small, robust implementation of a type checker for the core type theory. New inductive types or definitions must be checked by the kernel to guard against potential bugs in elaboration.

The idea behind the check is called propositions as types. A statement is a type, and a proof of it is simply an object of that type. In interactive proving, every step has to be justified by appealing to prior definitions and theorems, all the way down to basic axioms and rules.

Lean's manual says proof terms are sufficient evidence of the truth of a theorem and are amenable to independent verification.

The check has limits, and the manual lists them. A proof can contain the sorry placeholder, which Lean says can prove anything and is not intended to occur in finished proofs. Running the command #print axioms on a theorem shows which axioms it depends on. A result that lists sorryAx is incomplete.

Lean counts four standard axioms: propext, Classical.choice and Quot.sound, which the manual calls important parts of how mathematics is done in Lean, and sorryAx, which is not intended to occur in finished proofs.

The manual also separates two questions: whether a theorem has a valid proof, and what the theorem statement means. It says that if there are doubts the theorem means what it appears to mean, its statement and all referenced definitions must be investigated carefully.

For higher stakes it describes the lean4checker tool, which replays the stored declarations through the kernel, and a tool called Comparator, which builds the proof in a sandbox and checks that the proved statements match those in a trusted challenge file.

The manual says the check is meaningful if one believes the theorem statement matches its intended meaning and trusts the authors of the imported libraries to be honest.

What it means for you

Our view

A passing Lean check answers whether a proof is valid, and leaves open whether the theorem proved is the one you wanted. The manual says to investigate the statement and the definitions it refers to when there is doubt, in particular custom notation and type classes.

For higher stakes it describes lean4checker, which replays stored declarations through the kernel, and Comparator, which checks the proved statements against a trusted challenge file.

When someone presents an AI-written result as verified in Lean, ask for the #print axioms output and read the theorem statement against the claim being made before you rely on it.

It adds no new facts.

Share this story

Your reaction

We count reactions per story and day, never who reacted. The counts help us choose what goes in the monthly issue. If you are signed in, your own page shows yours too.

Check our sources

Every sentence above is checked against these 7 sources.

1 Lean: programming language and proof assistantLean FRO / Lean project · 1 fact Open the source archived copy
  1. The Lean home page describes Lean as an open-source programming language and proof assistant that enables correct, maintainable and formally verified code, and says Lean lets you write precise, verifiable code and formal proofs.

    Toned down to what the source says cite
2 Lean reference: Elaboration and CompilationLean FRO / Lean project · 2 facts Open the source archived copy
  1. Lean's reference manual says: 'Lean's trusted kernel is a small, robust implementation of a type checker for the core type theory.'

    Lean's trusted kernel is a small, robust implementation of a type checker for the core type theory.
    cite
  2. The manual says newly elaborated inductive types and definitions 'must be checked by the kernel to guard against potential bugs in elaboration'.

    Before new inductive types or definitions are added to the environment by the command or term elaborators, they must be checked by the kernel to guard against potential bugs in elaboration.
    cite
3 Theorem Proving in Lean 4: Propositions and ProofsLean FRO / Lean project · 2 facts Open the source archived copy
  1. Theorem Proving in Lean 4 describes propositions-as-types as an instance of the Curry-Howard isomorphism and says 'A proof of p is then simply an object t : p of the right type.'

    ...is an instance of the Curry-Howard isomorphism , sometimes known as the propositions-as-types paradigm. ... A proof of p is then simply an object t : p of the right type.
    cite
  2. Theorem Proving in Lean 4 says: 'The sorry identifier magically produces a proof of anything, or provides an object of any data type at all.'

    The sorry identifier magically produces a proof of anything, or provides an object of any data type at all. Of course, it is unsound as a proof method
    cite
4 Theorem Proving in Lean 4: IntroductionLean FRO / Lean project · 1 fact Open the source archived copy
  1. Theorem Proving in Lean 4 says that in interactive proving, every step of a calculation has to be justified by appealing to prior definitions and theorems, all the way down to basic axioms and rules.

    cite
5 Lean reference: The Type SystemLean FRO / Lean project · 1 fact Open the source archived copy
  1. Lean's reference manual says proof terms are sufficient evidence of the truth of a theorem and are amenable to independent verification.

    cite
6 Lean reference: AxiomsLean FRO / Lean project · 3 facts Open the source archived copy
  1. The Axioms page says sorryAx is used in the implementation of the sorry tactic and term, and that uses of this axiom are not intended to occur in finished proofs, as it can be used to prove anything.

    The axiom sorryAx is used as part of the implementation of the sorry tactic and sorry term. Uses of this axiom are not intended to occur in finished proofs, as it can be used to prove anything
    cite
  2. The Axioms page says the command #print axioms prints the axioms used by a declaration, directly or indirectly.

    #print axioms ... Prints the axioms used by a declaration, directly or indirectly.
    cite
  3. The Axioms page says Lean has four standard axioms: Classical.choice, propext and Quot.sound, which it calls important parts of how mathematics is done in Lean and says are known to be consistent, and sorryAx, which implements sorry and is not intended to occur in finished proofs.

    Toned down to what the source says
    There are four standard axioms in Lean. The first three axioms are important parts of how mathematics is done in Lean: Classical.choice ... propext ... Quot.sound ... The axiom sorryAx is used as part of the implementation of the sorry tactic ... Lean itself provides three such axioms that are known to be consistent.
    cite
7 Lean reference: Validating a Lean ProofLean FRO / Lean project · 6 facts Open the source archived copy
  1. The Validating a Lean Proof page says that if sorryAx is reported by #print axioms, the theorem or a dependency uses sorry or is incomplete.

    If sorryAx is reported, then this theorem or one of its dependencies uses sorry or is otherwise incomplete.
    cite
  2. The Validating a Lean Proof page separates the question of whether a theorem has a valid proof from the question of what the theorem statement means, and counts un-reviewed AI-generated proofs and programs as malicious in its sense: code that goes out of its way to trick or mislead the user, exploit bugs or compromise the system.

    Toned down to what the source says
    we use malicious to describe code that goes out of its way to trick or mislead the user, exploit bugs or compromise the system. This includes un-reviewed AI-generated proofs and programs. Furthermore it is important to distinguish the question does the theorem have a valid proof from what does the theorem statement mean.
    cite
  3. The Validating a Lean Proof page says that if there are doubts that the theorem means what it appears to mean, its statement and all referenced definitions must be investigated carefully, in particular with regard to custom notation and type classes.

    Toned down to what the source says
    If there are doubts that the theorem means what it appears to mean, its statement and all referenced definitions must be investigated carefully, in particular with regard to custom notation and type classes.
    cite
  4. The Validating a Lean Proof page says lean4checker reads the declarations and proofs as stored by lean in the .olean files and replays them through the kernel.

    The lean4checker tool reads the declarations and proofs as they are stored by lean during building (the .olean files ), and replays them through the kernel. It trusts that the .olean files are structurally correct.
    cite
  5. The Validating a Lean Proof page says Comparator, meant for high-risk cases such as proof marketplaces, high-reward proof competitions and unaligned AI, builds the proof in a sandbox, exports the proof term, and outside the sandbox replays the proofs and checks that the proved theorem statements match those in a trusted challenge file.

    Toned down to what the source says
    This should only be necessary for high risk scenarios (proof marketplaces, high-reward proof competitions, unaligned AI). ... Comparator will build the proof in a sandboxed environment, to protect against malicious code in the build step. The proof term is exported to a serialized format. Outside the sandbox ... it validates the exported format, replays the proofs using both Lean's kernel and/or an external checker and also ensures that the proved theorem statements match those in the trusted challenge file.
    cite
  6. The Validating a Lean Proof page says the basic check is meaningful if one believes the formal theorem statement corresponds to its intended informal meaning and trusts the authors of the imported libraries to be honest.

    Toned down to what the source says
    This check is meaningful if one believes the formal theorem statement corresponds to its intended informal meanings and trusts the authors of the imported libraries to be honest
    cite

Topics

The morning email

On the mornings we publish: the three top stories and up to four short ones. Free.

We email you a link to confirm. An issue may include one sponsor, always labelled Sponsored · Advertisement. Our emails count opens and clicks, not who made them. Unsubscribe in one click. What we keep