← Adversarial Mathematics: From First Principles

Failure Controls

Every run deliberately makes mistakes and checks that they are caught: a wrong factor, a doubled volume, a substituted statement, a missing boundary on a map. What each kind of mistake exposes, why a control must fail for the right reason, how a careless control can reassure falsely, and why catching these mistakes is evidence about the checker, not a proof that it is sound.

A check that cannot fail proves nothing. If Lean accepted every file, Lean accepting Fermat’s file would mean nothing. So every run in this book also makes mistakes on purpose, and checks that each one is caught. These are the failure controls. They are experiments on the checker, run alongside the experiment on the mathematics, every time.

An experiment: break Euler’s factorization

Fermat’s proof file contains the line

theorem euler_factorization : (2 : ℕ) ^ (2 ^ 5) + 1 = 641 * 6700417 := by decide

The control lean-wrong-cofactor copies the file, changes 6700417 to 6700419, and compiles the copy. In the approved run, Lean answered:

FermatEuler.lean:33:74: error: Tactic `decide` proved that the proposition
  2 ^ 2 ^ 5 + 1 = 641 * 6700419
is false

The kernel did not merely fail to find a proof. It evaluated both sides and found them different. The error is on line 33, the line that was changed, and that matters (see below). Fermat’s contract has nine controls like this: a wrong divisor (643), a wrong cofactor, and a wrong index (n = 4, whose number 65537 is prime), each in both Lean and Rocq; a binding to a wrong statement in each system; and the computation asked to confirm 643 as a divisor. All nine were refused in every recorded run.

Three kinds of failure

The eight investigations use controls of three different kinds, and each exposes something different.

Kind Example What it exposes
Mathematical mutation Gabriel’s volume changed from π to 2π the proof checker rejects a false statement
Statement substitution the wrong theorem’s claim replaced, or bound to True the identity gate rejects a statement that is not the claim
Source mutation the boundary B3–Gout removed from Kempe’s map the conclusion depends on one reading of the source

Mathematical mutation. In Gabriel’s v2 run, the control lean-wrong-volume changes

∫ x in Ioi (1 : ℝ), Real.pi * x⁻¹ ^ 2 = Real.pi

to = 2 * Real.pi. Lean stopped at that theorem with “unsolved goals”, and the goal it was left with was False: having computed the integral, it was asked to show that π equals 2π. A control of this kind shows that the proof is doing work. If the proof went through with the wrong value, it would not be connected to the value at all.

Statement substitution. Here the mathematics is not changed. What changes is the claim the evidence is attached to. Three controls of this kind run in the book.

  • Fermat’s and Gabriel’s binding controls ask the kernel to attach a correct declaration to a nearby wrong statement (+ 3 instead of + 1; a different volume). Both were refused.
  • The wrong-theorem demonstration runs four cases through two gates. The substituted case (a proof of True) and the weakened case (only n ≤ 10) were verified by the historical name-only gate and refused by the statement gate, each with the reason “Lean refused to accept the declaration as a proof of the pinned statement”.
  • The wrong theorem’s own control hands the demonstration a claim file in which 0 + n = n has become n + 0 = n. The demonstration refused to run: “claim.json does not match its pinned sha256”.

These test the part of the laboratory that Chapter 22 described, the part that decides what a kernel’s success means.

Source mutation. Kempe’s investigation has no proof kernel. Its evidence is a computation on a transcription of Heawood’s map, and its control changes the transcription: it removes the one shared boundary, B3–Gout, that was hardest to read on the scan. Eleven facts are computed on each version. Ten come out the same. One changes: regions 2 and 4 are no longer joined by a blue-green chain. That single change flips the verdict from kempe_step_fails_as_heawood_says to not_as_heawood_says.

This control does not test a checker. It tests the claim’s dependence on its source. It shows that the result is only as good as one reading of one line in an 1890 figure. The correspondence at issue is the fidelity of the transcription to that figure.

When the challenge text is the corrupted source

A 2026 human audit of AI-generated mathematics (arXiv:2608.14673) supplies the mirror image. An earlier edition raised a probability-polarity objection to a quantum parallel repetition argument; the later edition withdrew it. Text extraction from the typeset paper had dropped an overbar — the mark distinguishing a failure probability from a success probability — and the critic had reasoned from the corrupted text. Comparison with the rendered source retired the objection.

The lesson belongs in this chapter because the control that catches it is the same kind: the evidence used to challenge a claim must itself be challenged. A critic reading corrupted text is Kempe’s dropped boundary in reverse — the verdict flips when the source is re-read. The standing rule is therefore two-sided. A withdrawn criticism is historical evidence, not a current defect; and a withdrawal is not a validation of the proof. This book preserves retired objections as history because its own evidence policy is append-only (Chapter 25) — that is our policy, not necessarily the external audit’s, though in this case the v3 audit does retain the withdrawal across its versions, with primary materials deposited under DOI 10.5281/zenodo.22218229. The full version history is reconstructed in the research dossier (docs/research/MATH-OAI10-quantum-audit.md); the mechanism is demonstrated on a synthetic fixture in src/math_engine/proofs/source_fidelity_demo.py, labelled as synthetic, never as the original formula.

Failing for the right reason

A control passes only if the mistake is caught where it was made. Otherwise a file broken for some unrelated reason would look like a successful control.

  • A mutation passes only if the kernel’s first error is at the changed line or a few lines after it. In Fermat’s run every error fell on the changed line or the next. By default the window is three lines.
  • A binding control passes only if the original file compiled, the declaration exists, and the binding alone was refused. If the file did not compile, the control reports “source did not compile” and fails.
  • A computation control passes only if the program exits with the expected code and prints the expected words, such as “does not divide” or “claim fails”.
  • A mutation whose search text does not occur exactly once in the file stops the run with an error, so a mutation can never silently change nothing.
  • A missing tool (“tool unavailable”) is always a failure, never a pass.

The locality window is an engineering safeguard, not a mathematical fact. Lean reports an error where a proof stops working, which is not always where the statement was changed. In Gabriel’s lean-area-bound-too-large control, the change is to the statement on line 100, but the proof only fails at line 112, where it rewrites with a lemma that no longer fits. That contract widens the window to 15 lines for that control and says so. A wider window is a weaker test of locality, and choosing it is a judgement, recorded in the contract where a reader can see it.

A control that reassures falsely

Here is how a control can go wrong without anyone noticing. Suppose Kempe’s control had been written to expect only a non-zero exit code, and its module name had been mistyped (kempe_comptue). Python cannot find the module, prints an error and exits with code 1. Running that control through the runner’s own computation check:

defective control (expects exit 1 only):         passed   exit 1
same control, also expecting the verdict text:   failed   exit 1, missing "not_as_heawood_says"

The first control “passed” because the command crashed. It tested nothing, and said that it had. The second is the same mistake caught, because it insists on the words that only a real run of the computation would print. Every computation control in the book’s contracts names such words.

The general lesson is that a control must be specific about how the check fails, not only that it fails. A crash, a missing file, a wrong path and a timeout all fail too.

Detecting is not proving

The controls show that the checker catches these particular mistakes, in these particular places, on this toolchain. They do not show that it catches every mistake. Controls are tests, and tests can only exhibit failures. They cannot prove there are none. In the language of Chapter 10 — Every, Some, None (Part II, Chapter 1), “the checker rejects every wrong proof” is a universal claim, and nine witnesses do not establish it.

What does give confidence in the kernel is something else: its small size, its long use, the second independent kernel (Chapter 16 — What a Proof Rests On (Part II, Chapter 7)), and the axiom report. The controls play a different role. They guard against the commonest way a laboratory fails: not a bug in the kernel, but a pipeline that would have reported success whatever happened. A run whose controls all fail as designed has shown that, on this occasion, it could have said no.

Try it yourself

  1. In a copy of the repository, change Fermat’s control lean-wrong-index so that it replaces (h 5) with (h 5), a change that changes nothing. What does the control report, and what status does the run end with?
  2. Gabriel’s lean-area-bound-too-large control has a window of 15 lines. If it had the default of 3, what would the control report, and what status would the run end with? Is that outcome a better or a worse test?
  3. Kempe’s control removes B3–Gout. Write a second control that adds a boundary that is not on Heawood’s map, choosing it so that the verdict should not change. What does the result tell you, and what does it not?
  4. Why does a binding control require the original file to compile before a refusal counts?
  5. The wrong-theorem tampered-claim control expects exit code 2 and the words “does not match its pinned sha256”. Describe a defect in the demonstration that this control would catch, and one it would not.

Worked answers: Chapter 35 — Appendix A: Solutions to the Exercises (Part IV, Appendix A)#chapter-4-failure-controls.

Evidence record

Control implementations mutation_control, binding_control, computation, ERROR_WINDOW in src/math_engine/proofs/runner.py
Fermat controls n1-fermat/investigation.json; approved run kernel-runs/2026-11-13-approved/runs/<control>/
Gabriel controls and windows p08-gabriel/investigation.json (error_window 10 and 15); v2 run runner-runs/2026-11-13-v2-pinned/
Substitution P04 reader run runner-runs/2026-11-13-pinned/ (runs/demo/record.json, runs/tampered-claim/)
Source mutation Kempe reader run runner-runs/2026-11-13-pinned/ (runs/compute/, runs/drop-B3-Gout/)
Defective-control experiment run with the runner’s computation; illustrative, not a recorded investigation

Further Reading

For deeper study; not sources for the chapter’s claims.

  1. R. A. DeMillo, R. J. Lipton, F. G. Sayward. “Hints on Test Data Selection: Help for the Practicing Programmer.” Computer 11(4) (1978), 34–41. DOI. Why read it: The founding paper on mutation testing, the direct ancestor of deliberately breaking a proof and checking that the failure is caught where it was made.
  2. Yue Jia, Mark Harman. “An Analysis and Survey of the Development of Mutation Testing.” IEEE Transactions on Software Engineering 37(5) (2011), 649–678. DOI. Why read it: A comprehensive survey of mutation testing, including what mutation adequacy can and cannot show, which is the chapter’s central caution.

Next in Part III: Chapter 24, statuses and approvals.