Reading library Reading the Lean PCP proof

Auto select follows the paper as you scroll. Hover over a marked phrase to preview its Lean and see how the two compare. Click a phrase to keep it selected in Manual.

Reading the Lean PCP proof

A guide for readers new to Lean: the formal statement of the PCP theorem, the definitions it rests on, and three results from the low-degree testing part of the proof. It accompanies the PCP guide, which has the proof map and the list of differences from the paper.

The formalization follows A Simple Algebraic Proof of the PCP Theorem by Amireddy, Behera, Srinivasan, Sudan and Willumsgaard (arXiv:2608.17429, to appear in SOSA 2027). Theorem numbers are those of the paper (see Paper version). Code is quoted verbatim from the development, with doc comments left out; each block names its source file.

Contents

  1. What you have to read
  2. Reading a Lean statement
  3. The definitions
  4. The PCP theorem
  5. Checks on the definitions
  6. The explicit constants
  7. Low-degree testing statements
  8. Reading a proof
  9. Finding your way around
  10. Learning more Lean

1. What you have to read

Lean checks every proof mechanically, down to the axioms. To know what has been proved, you only need to read statements: the final theorem and the definitions it mentions. You never need to read a proof to trust it.

Concretely, a reader has to check three things:

  1. The definitions of NP, of a verifier, and of polynomial time (Section 3) say what they should.
  2. The final theorem PCP.np_subset_pcp (Section 4) says NP ⊆ PCP(O(log n), O(1)).
  3. No extra axioms were used. Running #print axioms PCP.np_subset_pcp lists nothing beyond propext, Classical.choice and Quot.sound, the standard axioms of classical mathematics in Lean. The audit script scripts/pcp/axiom-audit.sh checks this for every declaration and rejects sorry (an unproved step).

Everything else, about 26,000 declarations, is checked by Lean and can be read for understanding rather than for trust.

2. Reading a Lean statement

A theorem has the shape theorem name (h₁ : A) (h₂ : B) : C := proof. Everything in parentheses before the last colon is a hypothesis, each with a name (h₁, h₂) used later in the proof. What follows the last colon is the conclusion. So the line reads “if A and B, then C”. The table covers the notation used in this guide.

Lean Meaning
{F : Type*} [Field F] [Fintype F] Let F be a finite field. Arguments in braces and brackets are filled in by Lean automatically; brackets state structure on a type (field, finite, …).
[DecidableEq F] Equality in F can be tested by an algorithm. No mathematical content; it lets Lean count disagreements.
ℕ, ℚ Natural numbers (including 0) and rationals. Probabilities and distances are exact rationals.
(c + 2 : ℚ) The number c + 2, read as a rational.
Fin n The set {0, 1, …, n − 1}.
σ → F, Fin m → F The spaces Fσ and Fm: a point is a function from coordinates to F.
F × F, z.1, z.2 Pairs, and the two coordinates of z = (z₁, z₂).
fun z => e The function z ↦ e.
f x, (R y).eval x f(x), and Ry(x). Application is written by juxtaposition.
A → B, ∀ x, P x, ∃ y, Q y A implies B; for all x; there exists y. Also ∧, ∨, ¬, ↔ as usual.
x : List Bool, x.length A bit string x ∈ {0,1}*, and its length |x|.
Polynomial F, p.natDegree, p.eval t F[X], deg p (with deg 0 = 0), and p(t).
MvPolynomial σ F Polynomials in variables Xi, i ∈ σ.
P.totalDegree, P.degreeOf j Total degree, and degree in the variable Xj.
MvPolynomial.eval x P P(x).
![a, b] The vector (a, b).
Fintype.card F |F|.
IsPrimitiveRoot ζ (Fintype.card F - 1) ζ generates the multiplicative group F×.
Nat.clog 2 n ⌈log₂ n⌉.
{p : Polynomial F // p.natDegree ≤ c} The set of polynomials of degree at most c; .val is the polynomial itself.
V.queries, V.accProb x π Dot notation: the field queries of V, or a function applied with V as its first argument.
Nonempty T There is an object of type T (for example, a Turing machine with some property).
relativeDistance f g Prx[f(x) ≠ g(x)], the normalized Hamming distance (defined in this project).