← Adversarial Mathematics: From First Principles

Statement Identity

A kernel can establish that p is a proof of P. It cannot, by doing so, establish that P is the proposition anyone meant. Five ways two statements can be 'the same', which of them the laboratory checks, which it deliberately does not, and why a proof must answer the question that was asked.

A proof assistant’s kernel establishes one kind of fact:

$$\Gamma \vdash p : P$$

in the context Γ, the term p is a proof of the proposition P. That is all. It is a great deal, because the check is small, mechanical and trustworthy. But it is a fact about P, and P is whatever the file says it is. Whether P is the proposition the author, the paper or the problem meant is not part of the judgement.

Chapter 5 — The Wrong Theorem (Part I, Chapter 4) showed what happens when that gap is left to software that goes by names: a proof of True was credited to “for every natural number n, 0 + n = n”. This chapter is about how the laboratory closes the gap, and how far it can close it.

The proof must answer the question we asked, not merely a question that the kernel can prove.

Names are not identities

A declaration’s name is a label in a file. Two facts make it useless as an identifier for a claim.

First, a name can be kept while the statement changes. The substituted case in Chapter 5 — The Wrong Theorem (Part I, Chapter 4) is called P04.zero_add_left and states True. Nothing in the language prevents that, and nothing should: names are for people.

Second, the change can be gradual and well-meant. Someone fixes a proof that will not go through by adding a hypothesis, n ≤ 10 →, and keeps the name. The file compiles, the theorem is true, the name is unchanged, and the claim it now supports is much weaker. That is the weakened case, and it is the more dangerous of the two, because nobody intended anything.

So the laboratory never asks “is there an accepted declaration with this name?”. It asks “is this accepted declaration a proof of this statement?”, where the statement comes from the contract (Chapter 20).

Five ways two statements can be “the same”

Take a requested statement S and the statement T that a proof file actually proves. There are at least five things “S and T are the same” could mean, each weaker than the one before.

  1. Textually equal. The same characters, perhaps after collapsing whitespace.
  2. Structurally equal after normalization. The same expression once the proof assistant has parsed and elaborated both, with irrelevant details (such as the names of bound variables) erased.
  3. Definitionally equal. The kernel can see they are the same proposition by unfolding definitions and renaming variables, without any proof. In Lean, 0 + n and Nat.add 0 n are definitionally equal: one is notation for the other.
  4. Logically equivalent. Each can be proved from the other. Classically, ¬ ∀ n, n = 0 and ∃ n, n ≠ 0 are equivalent, but seeing it needs a proof that uses the law of the excluded middle.
  5. Meant the same. Both express the claim a person had in mind.

Only the fifth is what we actually want, and no machine can check it. The laboratory checks the third, records the second, tests the first, and deliberately does not attempt the fourth.

What the kernel binding checks

For each proposition, the runner appends to a copy of the proof file a definition of the contract’s statement and a binding:

def Spec : Prop := <statement from the contract>
theorem Bind : Spec := @Namespace.declaration

The kernel accepts Bind exactly when the declaration’s type is definitionally equal to Spec: level 3. Here is what that does in practice. The file below gives two genuine theorems, A : ∀ n : Nat, 0 + n = n and B : ¬ ∀ n : Nat, n = 0, and five candidate bindings. Run with Lean 4.35.0:

Requested statement Bound to Relation Kernel
∀ m : Nat, 0 + m = m A bound variable renamed accepted
∀ n : Nat, Nat.add 0 n = n A same proposition, other notation accepted
∃ n : Nat, n ≠ 0 B logically equivalent, not definitionally refused
∀ n : Nat, n ≤ 10 → 0 + n = n A narrower claim refused
∀ n : Nat, n + 0 = n A a different true statement refused

Read the rows in order.

  • Renaming a bound variable changes nothing. ∀ m, 0 + m = m and ∀ n, 0 + n = n are the same proposition. The revised case in Chapter 5 relies on this, and is rightly accepted.
  • Notation is unfolded. The kernel sees through + to the function it stands for.
  • Logical equivalence is not enough. The third row is refused even though the two statements are classically equivalent. That is not a defect. The binding does not search for proofs of equivalence. If it did, its answer would depend on how hard it searched, and a “no” would mean only “not found”. Refusing is the safe failure: a person can add the equivalence as an extra, separately proved proposition if it matters.
  • A narrower claim is a different claim. A implies the weakened statement, and a one-line proof would derive it. But the question was not “does something follow from A?”. The question was “is A a proof of the requested statement?”, and it is not. Narrowing a universal statement to a finite range is exactly the change that must not pass silently.
  • A different truth is a different claim. n + 0 = n is true, and true by definition in Lean. It is not the requested statement, so it is refused.

The runner also prints the axioms of each declaration and of its binding, and refuses anything outside the contract’s allowed list (judge in src/math_engine/proofs/runner.py). A binding that holds by way of sorry would surface there.

What a fingerprint records

The runner also exports the type of every accepted declaration from the kernel and hashes it: a type fingerprint, level 2. In Lean the type is serialized structurally, with bound-variable names and metadata erased, so renaming does not change the fingerprint. Constants, universe levels, implicit and explicit binders, literals and the order of binders do. In Rocq the type is taken as the kernel prints it with all notation expanded; Rocq prints bound-variable names, so there a renaming does change the fingerprint (src/math_engine/formal_identity.py states this policy at the top).

A fingerprint is useful for one thing: noticing that a statement has changed form between two runs. It is printed in every notebook’s identity record, so two runs can be compared declaration by declaration. In the MATH-INV-02F procedure that repaired the incident of Chapter 5 — The Wrong Theorem (Part I, Chapter 4), fingerprints were frozen in a registry and compared on every run. A declaration that still bound to its statement but had a new fingerprint was classified as syntactic_drift and refused until a person re-approved it.

It is important to say what a fingerprint does not establish.

  • Not meaning. Equal fingerprints mean equal normalized syntax in one system on one toolchain. They say nothing about whether the statement is the intended one.
  • Not equivalence. Different fingerprints do not mean different propositions. A theorem stated with Nat.add 0 n would have a different fingerprint from one stated with 0 + n, and it is the same proposition, as the second row of the table shows.
  • Not correspondence across systems. A Lean fingerprint and a Rocq fingerprint can never be equal, by construction. Whether a Lean statement and a Rocq statement say the same thing is the correspondence of Chapter 15, argued through bridges and approved by a person.

In the book’s own runner, fingerprints are recorded for comparison and audit; acceptance rests on the kernel binding and the axiom check.

Text equality, as a test

Level 1 appears once, as a test rather than a gate. For each kernel-checked investigation, the test suite extracts each declaration’s statement from the proof file and compares it, whitespace collapsed, with the statement in the contract (test_lean_statements_in_contract_are_the_statements_in_the_file and its Rocq twin, and the corresponding tests for Abel, Simpson and Gabriel). That catches a proof file and a contract drifting apart in their wording, even when the kernel would still accept the binding. It is a check on the manuscript’s consistency, not on the mathematics.

Pinned separately, so they cannot change together

There is one more way to defeat a binding: change the proof and the contract together. If someone weakens a theorem and also weakens the contract’s statement to match, the binding will hold.

The laboratory cannot forbid that, and should not: contracts sometimes need correcting. It makes it visible instead.

  • The contract’s sha256 is recorded in every run, so the change shows in every later record.
  • Any approval is pinned to the old hash and lapses. The status falls from …_approved to …_pending until a person reads the new statement and approves it again (Chapter 24).
  • --verify on any earlier run reports that the contract has changed since the run.
  • In the wrong-theorem demonstration, the claim lives in its own file whose hash is written into the demonstration’s code. A coordinated edit of the claim and the case files stops the demonstration before it runs.

So a coordinated change is possible, but it cannot be quiet. It leaves a new contract hash, a lapsed approval and a record of both.

That guarantee has a boundary, and it should be stated plainly. It holds only while the earlier records are themselves protected: the approval file, the committed runs and the history that shows which contract hash was approved. A hash says that two copies are the same; it cannot say which copy is the original. Someone able to rewrite the contract, the proof, the approval record and the history together could replace all of them consistently. What prevents that is not hashing but custody: the repository’s history, copies held by others, and, eventually, independent reproduction (Chapter 25).

What statement identity cannot do

Everything in this chapter works between two formal objects: a statement in a contract and a declaration in a file. Levels 1 to 3 are about those. None of it reaches level 5. If the contract’s statement is itself the wrong formalization of the claim, every check in this chapter will pass, faithfully, on the wrong statement. That is why the correspondence between claim and contract is a separate judgement, made by a person and recorded as one. Part II, Chapter 15 showed how much room there is for that judgement to go wrong: total division, truncated subtraction, and integrals that quietly return 0.

Try it yourself

  1. Write the five-binding file from this chapter, using your own two theorems, and run it with any Lean 4. Add a sixth binding that you expect to be accepted and that changes the statement’s notation in another way.
  2. Give an example of two Lean statements that are logically equivalent without any classical reasoning, but not definitionally equal. Does the binding accept one for the other?
  3. In Fermat’s approved run, the identity record lists a fingerprint for each declaration. If fermat_claim_false were restated with a bound variable called k instead of n, which fingerprints would change, the Lean one, the Rocq one, or both? Would the bindings still be accepted?
  4. Suppose a colleague weakens Gabriel’s area theorem and edits the contract to match. List everything in the laboratory’s records that would show it.
  5. Why is refusing a logically equivalent statement the right default for a gate, but the wrong default for a mathematician?

Worked answers: Chapter 35 — Appendix A: Solutions to the Exercises (Part IV, Appendix A)#chapter-3-statement-identity.

Evidence record

Identity policy src/math_engine/formal_identity.py (module docstring; fingerprint, lean_identity_footer, lean_declaration_export, rocq_binding_file)
Acceptance rule judge in src/math_engine/proofs/runner.py
Text-level tests tests/test_proofs_fermat.py (contract-vs-source tests for N1, N2, P07, P08)
Gate demonstration p04-wrong-theorem/, reader run 20261113T232811Z-24153376
Registry and drift MATH-INV-02F records, experiments/investigations/math-inv-02/
Five-binding experiment Lean 4.35.0 core; illustrative, not a recorded investigation

Further Reading

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

  1. N. G. de Bruijn. “Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem.” Indagationes Mathematicae 75(5) (1972), 381–392. DOI. Why read it: Introduces de Bruijn indices, the canonical way to make bound-variable renaming irrelevant to the identity of a formula.
  2. Arthur Charguéraud. “The Locally Nameless Representation.” Journal of Automated Reasoning 49(3) (2011), 363–408. DOI. Why read it: Explains a modern representation that treats alpha-equivalence correctly, relevant to the chapter’s distinction between textual, structural and definitional identity.

Next in Part III: Chapter 23, the deliberate mistakes every run must catch.