Khrapchenko's Formula-Size Bound in Lean 4
We formalise Khrapchenko's method for lower bounds on De Morgan formula size in Lean 4 with Mathlib and derive the classical corollary that every De Morgan formula computing parity on n variables has at least n² leaves. A formula is built from constants, literals, binary conjunction and binary disjunction, and its size is its number of leaves. The main theorem states that, for a formula F and all sets A of inputs on which F is false and B of inputs on which F is true, the square of the number of pairs in A × B at Hamming distance one is at most the number of leaves of F times |A| times |B|. The proof is by induction on the formula with a hypothesis that quantifies over all such sets, and it avoids square roots through a two-term inequality on natural numbers. The Lean file contains no sorry, and its four headline theorems depend only on propext, Classical.choice and Quot.sound. As a separate sanity check that is not part of the Lean proof, we enumerate the exact minimum formula size of every Boolean function on one to four variables in the same formula model, with a Rust program that is not verified in Lean. The inequality, tested with the full zero and one sets of each function, holds for all 65,536 functions on four variables. The exact minimum sizes of parity on one to four variables are 1, 4, 10 and 16, so the bound n² is attained at n = 1, 2 and 4 and is exceeded by one at n = 3. Scope. This is a lower bound for formulas, not for circuits with shared gates, and it does not resolve the P versus NP problem. We searched the proof-assistant libraries and archives available to us and found no earlier formalisation; we make no priority claim. The statement follows the formulation of Laplante, Lee and Szegedy (arXiv:quant-ph/0501057, Theorem 27); we did not consult Khrapchenko's original publication. Contents. The paper (PDF) with six figures, and a bundle (zip with SHA-256) containing the Lean 4 source, the axiom audit, replay.sh, the figures and their TikZ sources, the Rust enumeration program with the data it produces, the paper template and generator, the replay logs and SHA256SUMS. How to verify. With a Lake project that pins the Lean toolchain and Mathlib revision recorded in versions.txt, run MATHLIB_PROJECT=/path/to/project ./replay.sh; it prints the axioms of the four headline theorems. Run experiments/reproduce.sh to regenerate the enumeration data (expected last line DATA REPRODUCED) and paper/make_paper.sh to regenerate the paper tables. Environment. Lean v4.33.1 and Mathlib commit 0df444a3. Licence. CC BY-NC 4.0, copyright SmartLedger Solutions, produced by Origin Neural AI. Commercial use requires written permission from [email protected]. No patent licence is granted. See smartledger.solutions.
Authors
- Shawn Ryan
- Gregory Ward
- Bryan W. Daugherty
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24543149
- Citations
- 1
- Primary Topic
- Complexity and Algorithms in Graphs
- Type
- preprint