Module 5: Reading Real Lean·Lesson 16 of 16·6 min read

Lean Proved It. Did It Prove What the Paper Says?

The problem: a green check mark is not the whole story

A research paper makes a claim in its abstract. A Lean file says the claim is proved. Lean checked every step, so the claim must be true. Right?

Not quite. Lean checks that the proof proves the theorem statement that is written in the file. It does not check that this statement says the same thing as the abstract. That second check is a human job, and after the last lesson you can do it.

This lesson walks through one real case from November 2026: OpenAI's manuscript "The matrix multiplication exponent is nine fourths" and the Lean statement published next to it.

What the paper claims

The manuscript, dated 24 November 2026, says that over every field, the exponent of square matrix multiplication is exactly 9/4. In plain words: as matrices get bigger, the number of arithmetic steps needed to multiply two n by n matrices grows like n to the power 2.25, and no method can do better.

The paper is careful about its model. It uses formal arithmetic circuits whose gates can add, subtract, multiply, or divide by a nonzero rational function. Each output must equal the right entry of the product as an identity of rational functions, and the paper says this convention also applies over finite fields.

The repository README then says something narrower about the Lean side: the Lean development proves the square exponent 9/4 for division-free circuits computing formal polynomial identities over every field.

So we already have a gap to look for. Let us find it in the code.

Step 1: read the theorem line

Here is the statement, copied from the file ExactExponent.lean in the openai/math repository. It needs Mathlib and the whole OpenAI development, so it was not compiled for this lesson.

lean
theorem square_exponent (F : Type*) [Field F] : formalOmega F 1 1 1 = (9 : ℝ) / 4

Read it the way lesson 15 taught you. The binder (F : Type*) with the instance [Field F] means: for any type F that is a field. The conclusion is an equation between real numbers. So far this matches "over every field" and "exactly 9/4".

But formalOmega is a name. The theorem means nothing until you read what that name is defined as.

Step 2: follow every definition

OpenAI publishes a short statement file used by its comparator check, ComparatorChallenges/MatrixExponent.lean. It contains the definitions and the theorem with its proof replaced by sorry, as a frozen copy of what must be proved. That file is the best place to read the meaning, because it is short.

The exponent is defined as an infimum:

lean
def formalOmega (F : Type*) [Field F] (w12 w23 w31 : ℝ) : ℝ :=
  sInf {τ : ℝ | FormalAdmissibleExponent F w12 w23 w31 τ}

An exponent τ is admissible when, for every ε greater than 0, there is a constant C so that every size N has a correct program whose cost is at most C times N to the power τ plus ε. That is the standard textbook idea of the exponent, written out.

Then comes the part that matters most. A program is a list of gates, and this is the full list of gate types:

lean
inductive Gate (F Input Register : Type*) where
  | constant : F → Gate F Input Register
  | input : Input → Gate F Input Register
  | add : Register → Register → Gate F Input Register
  | sub : Register → Register → Gate F Input Register
  | mul : Register → Register → Gate F Input Register

There is no division gate. That is the "division-free" in the README, visible in five lines. Constants and inputs cost 0, and each add, sub and mul costs 1.

Correctness is also spelled out. A program is correct when the polynomial computed in each output register equals the sum over j of X(i, j) times X(j, k), as a formal polynomial. Formal means two polynomials must be equal as expressions, not just give the same values. Over a finite field that difference is real, which is why the paper bothers to say it.

Animation: From the paper's claim down to the Gate type: there is no division gate, so the result covers division-free programs.

Step 3: compare, line by line

Now put the paper and the code side by side.

  • Which fields: the paper says every field, and the Lean statement says every F with a Field instance. They match.
  • Which number: 9/4 in both. They match.
  • Which programs: the paper allows division by nonzero rational functions, and the Lean model has no division gate. The Lean statement is narrower.
  • What counts as correct: formal identities in both, rational functions in the paper and polynomials in Lean, which follows from having no division.

So the honest one line summary is: Lean checks that 9/4 is the exact exponent for division-free programs over every field. The stronger claim with division gates rests on the paper's prose proof, which has not been peer reviewed. The README says this plainly, and now you can see it for yourself in the code.

A toy model you can run

You do not need Mathlib to feel how a gate model works. This small file defines division-free gates, a cost, and checks one entry of a 2 by 2 product. It compiles with plain Lean 4.

lean
inductive Gate where
  | input : Nat → Gate
  | const : Int → Gate
  | add : Gate → Gate → Gate
  | sub : Gate → Gate → Gate
  | mul : Gate → Gate → Gate

def Gate.eval (env : Nat → Int) : Gate → Int
  | .input i => env i
  | .const c => c
  | .add a b => a.eval env + b.eval env
  | .sub a b => a.eval env - b.eval env
  | .mul a b => a.eval env * b.eval env

def Gate.cost : Gate → Nat
  | .input _ => 0
  | .const _ => 0
  | .add a b => a.cost + b.cost + 1
  | .sub a b => a.cost + b.cost + 1
  | .mul a b => a.cost + b.cost + 1

def entry : Gate := .add (.mul (.input 0) (.input 1)) (.mul (.input 2) (.input 3))

#eval entry.cost                                  -- 3
#eval entry.eval (fun i => [2, 3, 4, 5].getD i 0) -- 26

theorem entry_correct (env : Nat → Int) :
    entry.eval env = env 0 * env 1 + env 2 * env 3 := rfl

Notice what you could not write with this Gate type: a division. Any theorem about "all programs" built from it is automatically a theorem about division-free programs only. That is exactly the shape of the real case.

Two more things worth checking

Junk values. In Mathlib, the infimum of a set of reals with no lower bound is defined to be 0, and the infimum of an empty set is also 0. That is a convention, not a theorem about matrices. A definition built on sInf can therefore hide a surprise. Here the theorem pins the value to 9/4, so the convention does not bite, but it is always worth asking.

Axioms. The comparator file uses sorry on purpose, as a placeholder for the statement. In the real development the proof comes from other lemmas. If you build the project yourself, #print axioms square_exponent tells you whether any sorry slipped into the chain. We did not build the full OpenAI project for this lesson, so we have not run that check ourselves.

The checklist to keep

  1. Read the theorem line: binders, instances, conclusion.
  2. Open every definition the statement uses, all the way down to the basic types.
  3. Write the paper's claim and the Lean statement side by side and mark each difference.
  4. Look for junk value conventions such as sInf and division by zero.
  5. Run #print axioms when you can.

Try this

Open live.lean-lang.org, paste the toy model, and add a div constructor to Gate. Try to finish Gate.eval for it on Int, then #eval (7 : Int) / 0. What does Lean return, and why would that matter for a theorem about programs with division?

Sources

Try it yourselfHard

Check that a definition means what its name says

Someone wrote `isEven` and a theorem saying 4 is even. Both check. But the definition is wrong. Prove `isEven_wrong` to show it calls 3 even, then fix `isEven2` and prove both facts about it.

def isEven (n : Nat) : Bool := n % 2 == n % 2

theorem four_even : isEven 4 = true := by
  decide

theorem isEven_wrong : isEven 3 = true := by
  sorry

def isEven2 (n : Nat) : Bool := sorry

theorem four_even2 : isEven2 4 = true := by
  sorry

theorem three_not_even2 : isEven2 3 = false := by
  sorry
Open in the Lean web editor

The official Lean editor runs in your browser and checks the file on Lean's server. Replace every sorry until no errors or warnings are left, then mark it solved.

The worked solution unlocks after your first attempt.

Saved in this browser. Pass the quiz while signed in to count it for the certificate.

Check what you learned

Answer all 3 questions. You need at least 2 right to pass.

1. What does Lean actually guarantee when a proof checks?

2. In the Lean model behind the 9/4 statement, which gate type is missing compared with the paper's circuits?

3. Why should you open the definition of formalOmega instead of trusting the theorem line?

You've reached the end of the course.

Test yourself on everything you read.

Take the final exam →