Inside the Lean 4 Axiom Sanctuary (Part I): From the Parallelogram Law to Finite Record Pinching
“Build an academic theory of a universal machine for proposition proofs: define, state, prove.”
In conventional mathematical physics monographs, a “proof” relies on an unwritten pact between author and reader: a phrase such as “it is easy to see”, an implicit assumption that an index set is nonempty, or a quiet slide from coordinate-line invariance to a single global phase can hide subtle gaps. From Chapter 1 onward, this book has operated under a stricter contract captured by our opening epigraph — define, state, prove: every formal theorem, lemma, proposition, and corollary carrying the green LEAN ✓ badge is anchored to a declaration in the-omega-institute/trureturing@dev (pinned at commit a93ac745c3afb58d6ec61d9a0a8ba002948f43b7) that has been type-checked by the Lean 4 kernel and frozen without a single sorry.
From the parallelogram law to finite-record pinching. The chapter at a glance. Panel I: the ink arrows and span a parallelogram, and the squares of its two cyan diagonals and add up to the squares of its four sides (Theorem Kernel.16). Panel II: four coordinates form a chain; each cyan arc is a test vector that is non-zero on two neighbouring coordinates, and, for a unitary preserving the coordinate rays and all these test rays, the violet phase arrows in all four diagonal entries point the same way, (Proposition Kernel.19). Panel III: pinching strips the magenta off-diagonal blocks from the block matrix and keeps the cyan diagonal ones; pinching again leaves the matrix in place (Corollary Kernel.20).
In this chapter and Inside the Lean 4 Axiom Sanctuary (Part II): From Rank-One Born Reduction to Unread Fixed Points and , we open the actual .lean source files of trureturing@dev and audit the formal proof scripts line by line (a sample audit: the two chapters read 8 representative proofs line by line and list 76 declarations in their two audit tables — sampling the foundational spine of Parts I–VI, far fewer than all frozen declarations cited across the book):
- In this chapter (Part I of our kernel audit), we dissect four foundational proofs underlying Parts I through III: the real inner-product parallelogram norm law, the three-part Born probability skeleton on positive trace-one matrices, unitary global phase rigidity under support-connected ray tests, and idempotence of finite complete orthogonal record pinching;
- We trace the exact Mathlib lemmas and tactic chains (
parallelogram_law_with_norm,mul_mul_conjTranspose_same,Relation.ReflTransGeninduction,Finset.sum_eq_single) used in the kernel proofs, and conclude with a comprehensive audit table of frozen declarations across Parts I–III.
Define, State, Prove: Inside the Lean 4 Kernel Audit
In the trureturing verification pipeline, every green theorem in this book passes three machine-enforced stages:
- Define: Every mathematical object — such as a real inner-product space
InnerProductSpace ℝ E, a square complex matrixMatrix n n ℂ, the positive-semidefinite predicateMatrix.PosSemidef, or a projective record measurementIsRecordMeasurement P— is defined unambiguously in dependent type theory; - State: The theorem header specifies all typeclass instances and explicit hypotheses; the source module produces a module-level SHA-256
statement_id, recorded inGolden/Frozen/state/<module>.lean.json, which may be shared by several declarations in that module; - Prove: The proof term is checked by the Lean 4 kernel with zero
sorryplaceholders and only standard foundational axioms (propext,Classical.choice,Quot.sound, verified in source files via#print axioms).
We begin by auditing two cornerstone declarations from Part I: the parallelogram norm identity and the finite-dimensional Born probability skeleton (Panel I of the chapter overview figure).
Let be a normed additive commutative group equipped with a real inner product ([NormedAddCommGroup E] [InnerProductSpace ℝ E]). For any two vectors ,
In D5/S3/QuantumContext/ParallelogramNormLaw.lean:22, the frozen declaration is proved by a single exact term application:
theorem inner_product_norm_parallelogram_law {E : Type*} [NormedAddCommGroup E]
[InnerProductSpace ℝ E] (x y : E) :
‖x + y‖ ^ 2 + ‖x - y‖ ^ 2 = 2 * (‖x‖ ^ 2 + ‖y‖ ^ 2) := by
exact parallelogram_law_with_norm ℝ x y
In the pinned Mathlib’s Mathlib.Analysis.InnerProductSpace.Basic, parallelogram_law_with_norm rewrites squares as products with sq and calls parallelogram_law_with_norm_mul; the latter rewrites norm products as real parts of self-inner products and applies the inner-product identity parallelogram_law. For a manual derivation, one can instead expand and via norm_add_sq_real and norm_sub_sq_real into and cancel the opposite inner-product cross terms . Line 26 of the source file runs #print axioms inner_product_norm_parallelogram_law to confirm that no unverified axioms enter. The full proof is checked by the Lean kernel.
Why must parallelogram_law_with_norm and norm_add_sq_real square 1D vectors into a 2D quadratic form before orthogonal cross terms disappear? Here lies the geometric synthesis formulated in the author’s design notes:
Author’s original words: “Pythagoras — all things are number — the Pythagorean theorem.”
From non-additive 1D lengths to grade-0 area scalars and canceling grade-2 bivector orientations: In a positive-definite Euclidean inner-product space, let two orthogonal vectors have scalar norms . When both vectors are non-zero, their 1D lengths cannot add linearly () because they point along perpendicular axes; if one vector is zero, that strict inequality degenerates to equality. In positive-definite Euclidean Clifford geometric algebra, squaring the resultant yields
Here , , and are grade-0 scalars carrying squared-length (area) measure, whereas and are grade-2 oriented-area bivectors. Since and the oppositely oriented bivectors anticommute (), the grade-2 oriented areas cancel identically (), leaving the grade-0 Pythagorean identity ! In the author’s reading, this is the exact geometric meaning behind the vanishing cross term in norm_add_sq_real and the cancellation between and in Theorem Kernel.16 (Mathlib’s proofs have no wedge product; only the grade-0 inner-product cross term does any work). The classical number-theoretic consequences and conceptual progression triggered when this quadratic identity is evaluated on the unit integer lattice are recorded in the following literature note:
Literature result, not formalized in this book. The 2-adic valuation parity proof of the irrationality of , the canonical Pell continued-fraction best rational approximants, and the transcendence of and the cosine fixed point below (see also Remark Kernel.22, Chapter 24 Remark 24.12, and Chapter 23 §23.1 Remark 23.6) belong to the classical number-theory literature together with this book’s conceptual synthesis (MODEL), and are not part of the frozen theorems audited line by line in this chapter. The unit remainder of the Pell convergents, however, is no longer only a literature result: writing and (the companion Pell and Pell numbers of Definition 23.1 in Chapter 23 §23.1), the identities and below follow by a manual derivation from the Lean-verified Theorem 23.3, and Theorem 23.4 adds the best-approximation lower bound; what remains literature is the identification of these fractions with the continued-fraction convergents of and the general theory of best approximation.
Setting on the unit integer lattice forces , so . For any positive integers (), a putative rational solution () shatters against 2-adic valuation parity: is always even, whereas is always odd (). While arbitrary rational sequences (such as decimal truncations ) can converge to , the canonical best continued-fraction approximants are the Pell convergents defined by (),
which satisfy the alternating unit-gap Pell equation:
For every , an indestructible unit arithmetic crack separates from . In this book’s conceptual and philosophical synthesis (MODEL), that unit crack propels the classical Chinese concept of number (shù / shǔ) from the discrete counting verb operator (shǔ, ) to the continuous geometric noun coordinate (shù), tracing a four-stage conceptual progression (note that this is a conceptual hierarchy rather than a chain of field inclusions ; the algebraic golden ratio satisfying belongs to Stage 2, whereas Stage 4’s denotes the transcendental self-referential cosine fixed point ):
Next we inspect born_probability_skeleton in D5/S3/Quantum/FiniteDimensional.lean:78. For any finite index type n ([Fintype n]) and matrices , the trace pairing is defined as
When is positive semidefinite (hRho : rho.PosSemidef) and has unit trace (hTrace : Matrix.trace rho = 1), the following frozen lemma establishes normalization on the identity, additivity over matrix addition, and nonnegativity on self-adjoint idempotent projections (in the complex partial order 0 ≤ z from ComplexOrder, meaning and ).
Let be a finite index type with decidable equality ([Fintype n] [DecidableEq n]), and let satisfy hRho : rho.PosSemidef and hTrace : Matrix.trace rho = 1. Then all three properties hold:
-
Identity normalization: ;
-
Additivity: For all ,
-
Nonnegativity on self-adjoint idempotent projections: For every , if and , then
In D5/S3/Quantum/FiniteDimensional.lean:78:
-
Conjunct 1 is discharged by
simpa [bornProbability] using hTracesince ; -
Conjunct 2 is discharged for arbitrary by
simp [bornProbability, Matrix.mul_add], using distributivity and trace linearity; -
Conjunct 3 uses a sandwich-compression trick to avoid spectral decomposition of the non-Hermitian product : given
hSelfAdjoint : star P = P(rewritten ashConjTranspose : Pᴴ = P) andhIdempotent : P * P = P, the proof applieshRho.mul_mul_conjTranspose_same Pto certify that the sandwiched matrix is positive semidefinite (hCompressed : (P * rho * Pᴴ).PosSemidef). A four-stepcalcblock usingMatrix.trace_mul_cycleandMatrix.trace_mul_commthen equates their traces:Rewriting
bornProbabilityvia← hTraceCompressedand applyingexact hCompressed.trace_nonnegcompletes the proof.
The full proof is checked by the Lean kernel.
The Born skeleton is proved along three branches, and only the third takes a detour. Dashed ovals are hypotheses; boxes are the steps the proof names, each with the lemma that does it. Branches ① and ② take one step each; branch ③ first turns into the sandwich , then uses and with the cyclic trace to bring its trace back to , and finally takes a nonnegative trace. All three meet in the green Lemma Kernel.18.
Support-Chain Ray Phase Rigidity and Finite Record Pinching Idempotence
We now audit two structural theorems from Part I that showcase graph induction and block-diagonal projection algebra in Lean 4 (Panels II and III of the chapter overview figure).
In D5/S3/Quantum/Foundation/RayPhaseRigidity.lean:97, a matrix preserves the ray of a vector when
If preserves every coordinate basis ray , then must be diagonal. If also preserves every test ray, then to force all diagonal entries to equal a single common phase , no single full-support test vector is required; instead, RaySupportConnected tests requires only that every pair of indices is connected by the reflexive-transitive closure Relation.ReflTransGen of pairwise support overlaps .
Let be a finite index type with decidable equality ([Fintype ι] [DecidableEq ι]), let belong to the unitary group (hA : A ∈ Matrix.unitaryGroup ι ℂ), and let be a set of test vectors. Suppose:
- Coordinate ray invariance (
hcoord): For every , ; - Test ray invariance (
htests): For every , ; - Connected test supports (
hconnect): .
Then there exists a complex scalar such that
In D5/S3/Quantum/Foundation/RayPhaseRigidity.lean:97, the proof proceeds in two stages:
- Private lemma
coordinate_shape_of_connected_ray_tests:- First,
hoffproves for all : unpackinghcoord jgives for some , whose -th component () reduces to . - Second,
hstepproves that whenever some satisfies and , we have : unpackinghtests x hxgives , and because is diagonal (Finset.sum_eq_single kwithhoff), each component obeys . Canceling viamul_right_cancel₀gives . - Third,
hchaininducts overRelation.ReflTransGen(| refl => rfland| @tail j k _ hjk ih => exact ih.trans (hstep j k hjk)), establishing for all .
- First,
- Main theorem and empty-type guard: Splitting on
isEmpty_or_nonempty ι:- If is empty (
inl hempty), satisfiesnorm_oneandSubsingleton.elim _ _. - If is nonempty (
inr hnonempty), settingbase := Classical.choice hnonemptyand yieldshscalar : A = c • 1. Substitutinghscalarinto (Matrix.mem_unitaryGroup_iff'.mp hA) at entry(base, base)gives , and taking norms withnlinarith [norm_nonneg c]proves .
- If is empty (
The full proof is checked by the Lean kernel.
Phase rigidity: first force diagonal, then pass one phase along the support chain. The large dashed frame holds the three steps of the private lemma coordinate_shape_of_connected_ray_tests, each fed by one dashed hypothesis on the left; below the frame the proof splits on whether is empty, and the non-empty branch uses “ unitary” to get . Both branches meet in the green Proposition Kernel.19.
Our fourth audited declaration in this chapter is finite_record_pinching_idempotent in D5/S3/Observer/Conditioning/FiniteRecordPinchingIdempotence.lean:30, which proves functional idempotence of the unread Lüders pinching map
for any finite complete orthogonal projection family IsRecordMeasurement P.
Let be a finite index type with decidable equality ([Fintype n] [DecidableEq n]), let be a finite outcome type ([Fintype kappa]), and let satisfy hP : IsRecordMeasurement P. Then
In FiniteRecordPinchingIdempotence.lean:30, funext rho reduces functional equality to the pointwise theorem unreadState_idempotent hP rho in D5/S3/Observer/Conditioning.lean:98. There, the helper lemma left_project_unread first computes
by collapsing the sum over to the single index via Finset.sum_eq_single k and pairwise orthogonality hP.orthogonal k l, then applying hP.idempotent k. Multiplying on the right by inside the outer sum and applying hP.idempotent k a second time yields . The full proof is checked by the Lean kernel.
The idempotence of pinching is proved in one straight chain. The dashed hypotheses, orthogonality and idempotence, first let the left projection absorb the whole sum, ; multiplying by on the right absorbs once more and gives pointwise idempotence; function extensionality then carries it to every , ending in the green Corollary Kernel.20. In the figure, stands for .
Line-by-Line Source Anatomy: From Mathlib Lemmas to Graph Induction and Block Elimination
Across the four proofs above, four recurring Lean 4 proof engineering patterns stand out:
- Finite-index extensionality (
ext i j; fin_cases i <;> fin_cases j): Concrete low-dimensional matrix identities are reduced to scalar ring equations over or and closed deterministically bysimpandring; - Positive-semidefinite cone preservation under conjugate compression (
hRho.mul_mul_conjTranspose_same P): Rather than diagonalizing , the proof rewrites using self-adjointness, idempotence, and trace cyclicity so thatPosSemidef.trace_nonnegapplies directly; - Single-index sum collapse (
Finset.sum_eq_single k): Orthogonality relations ( or for ) prune finite sums down to the diagonal term ; - Reflexive-transitive closure induction (
Relation.ReflTransGen): Local two-coordinate overlap steps (hstep) are lifted to global constancy across arbitrary connected support graphs by two-line structural induction (reflandtail).
Comprehensive Audit Table of Frozen Declarations Across Parts I–III
The table below audits representative frozen declarations cited across Parts I through III at commit a93ac745c3afb58d6ec61d9a0a8ba002948f43b7. As required by our verification contract, prose labels such as “parallelogram law”, “probability skeleton”, or “pinching idempotence” are descriptive titles only and carry no formal claim beyond the exact Lean signature.
Let us trace a concrete hypothesis-mutation check on Proposition Kernel.19.
Consider in Proposition Kernel.19:
- Connected test support: Take with , so and . For any preserving the coordinate rays and and the test ray ,
hoffforces , andhstep 0 1cancels from viamul_right_cancel₀to lock , yielding (). - Disconnected test support (counterexample blocked by
hconnect): If we drophconnect : RaySupportConnected testsand take , no vector in is simultaneously nonzero at both and . Then the unitary phase gate satisfies bothhcoordandhtests, yet is not a scalar multiple of ! In the Lean proof, the induction callhchain (hconnect i j)is the exact line that blocks disconnected phase sectors.
Cut the support graph and the two phases go their own ways. In both panels the two circles are the two coordinates of , and the violet arrow in each circle is the phase of the diagonal entry or . On the left the only test vector is , and a cyan arc joins the two cells; the unitary preserves both coordinate rays and this test ray, so both arrows point the same way: (Proposition Kernel.19). On the right the test vectors and each cover one cell only, and the dashed arc between the cells is struck out; keeps both coordinate rays, yet its two arrows are apart, so it is not . The right panel is a counterexample once the connectivity hypothesis is dropped, not a conclusion of the theorem.
Literature result, not formalized in this book. Two foundational principles govern the formal verification architecture audited in this chapter:
- The Calculus of Inductive Constructions and the de Bruijn criterion (L. de Moura & S. Ullrich, The Lean 4 Theorem Prover and Programming Language, CADE-28, LNAI 12699, 625–635, 2021, DOI 10.1007/978-3-030-79876-5_37; M. Carneiro, The Type Theory of Lean, MS thesis, Carnegie Mellon University, 2019): Lean 4 satisfies the de Bruijn criterion: elaborate tactics (
simp,ring,linarith,nlinarith) construct explicit proof terms that are independently verified by a small, trusted type-checking kernel. - Formal deduction versus physical modeling assumptions: The Lean 4 kernel certifies that each conclusion follows with mathematical certainty from its stated definitions and hypotheses; whether a physical laboratory apparatus satisfies the idealizations of a given hypothesis belongs to empirical physics and prose commentary rather than the formal theorem itself.
- Classical number-theoretic results versus the book’s philosophical synthesis:
- Classical theorems: The Pythagorean theorem and incommensurability of appear in Euclid, Elements, Book I Prop. 47 & Book X; the 2-adic parity contradiction for () and the best continued-fraction Pell convergents are treated in G. H. Hardy & E. M. Wright, An Introduction to the Theory of Numbers, 6th ed., Oxford University Press, 2008, Ch. 4 & Ch. 10; transcendence of and of the cosine fixed point () follows from the Lindemann–Weierstrass theorem (F. Lindemann, Math. Ann. 20, 213–225, 1882; see also T. Y. Chow, Amer. Math. Monthly 106(5), 440–448, 1999).
- Conceptual synthesis: The reading of the classical Chinese term for number (shù / shǔ) from the counting verb operator (
shǔ) to the continuous geometric noun coordinate (shù) and the four-stage conceptual progression represent the author’s philosophical synthesis around Theorem Kernel.16 rather than a chain of field inclusions or part of the four frozen Lean declarations of this chapter.
Having audited the formal spine of Parts I–III, let us now enter Inside the Lean 4 Axiom Sanctuary (Part II): From Rank-One Born Reduction to Unread Fixed Points and to audit the rank-one Born reduction, the three-part Born pairing bridge, Lüders conditional state validity, and the fixed-point equivalence that closes the book’s self-referential loop .