# F04Riemann — Lean 4 Formalization of F04

Machine-checked Lean 4.35.0 formalization of **F04**: *When Separated Pieces Stay Positive Together: Controlling interactions in a mathematical test related to the Riemann hypothesis* (Paul Cooper, author-review package `F04-author-review-2026-11-21-r1.zip`).

- **Toolchain**: `leanprover/lean4:v4.35.0` (`-DautoImplicit=false`)
- **Size**: 13,946 lines across 15 modules + root (`F04Riemann.lean`)
- **Verification**: `reports/VERIFICATION.json` — **PASS** (`522` audited declarations, `0` `sorry`, `0` custom axioms, transitive axioms strictly within `{propext, Classical.choice, Quot.sound}`)

## Audit of Existing Lean Proof Library (`LinkedTower`)

Before authoring new modules, the existing published proof library (`LinkedTower`, 55 modules / 763 audited theorems) and reference Lean files in `/Users/paulcooper/Documents/Codex 2/` were audited:

- **Mathematical reuse**: None of the 55 `LinkedTower` modules formalize 1D harmonic analysis, the Weil explicit-formula quadratic/sesquilinear form, von Mangoldt prime-power sums, comparison matrices, or $C_c^\infty$ exponential-moment codimension. Every `LinkedTower` theorem concerns quaternionic Hopf fibrations, linked connections, Tower/$S^{13}$, $\mathrm{Sp}(2)$ transfers, and $S^2$ area–holonomy (matching `evidence/source-documents/riemann-reconstruction-2026-10-14.md`, which records that F04 is an independent scalar logarithmic-line construction).
- **Infrastructure reuse**: This project directly reuses the pinned Lean 4.35.0 toolchain, prebuilt Mathlib4 (`rev 56a005855ea17e0b0958f73ec801ae140b0a1679`), `-DautoImplicit=false` compilation discipline, and transitive `#print axioms` audit methodology from `linked-tower-lean-2026-11-13`. Nothing inside `/Users/paulcooper/Documents/Codex 2/` was modified.

## F04 Paper-to-Lean Map

| F04 Section / Claim | Lean Module | Key Declarations |
|---|---|---|
| §2 Weight $w(t)$, residual $w_0(t)$, $B(L)$, $m(L) \ge \log(4/L) - A$, Euler–Mascheroni $\gamma_E$, Connes–Consani normalization | `F04Riemann/AnalyticFoundations.lean` | `eulerGamma`, `weilConstA`, `weilWeight`, `residualWeight`, `B_func`, `m_func`, `weilWeight_split`, `residualWeight_antiOn`, `integral_Ioi_weilWeight`, `m_func_ge_log_four_div_sub_A`, `connes_consani_normalization` |
| §2 von Mangoldt $\Lambda(n)$, arithmetic weight $\Lambda(n)/\sqrt{n}$, prime-power sets $P(d,D)$ and $P_D$ | `F04Riemann/Arithmetic.lean` | `vonMangoldt`, `vonMangoldt_prime_pow`, `arithWeight`, `primePowerRange`, `P_bound`, `P_D_bound`, `P_bound_le_P_D_bound` |
| §2 Test space $C_c^\infty(\mathbb{R},\mathbb{C})$, multiplicative $L^2$ isometry, $L^1 \le \sqrt{L}\,L^2$, balance eq. (1), $T\psi = \psi'' - \tfrac14\psi$, correlations, $O(t^2)$ convergence | `F04Riemann/TestFunctions.lean` | `TestFn`, `SupportedIn`, `normSq_toMultCoord`, `l1Norm_le_sqrt_mul_l2Norm`, `IsBalanced`, `diffOp`, `isBalanced_diffOp`, `corr`, `autoCorr`, `norm_corr_le`, `norm_symm_corr_diff_le`, `integrableOn_weil_integrand`, `normSq_sum_disjoint` |
| §2 Weil quadratic form $Q(\varphi)$ eq. (2) & Hermitian sesquilinear form $B(a,b)$ eq. (3), finite arithmetic sums | `F04Riemann/WeilForm.lean` | `Q_form`, `B_form`, `arithTermB_finite_support`, `B_form_hermitian`, `B_form_diag`, `Q_form_sum_expansion` |
| §3 Lemma 1 — Single-interval lower bound eq. (4) (incl. $L = \log 2$, no balance needed) | `F04Riemann/WindowBounds.lean` | `lemma1_single_interval_lower_bound` |
| §4 Exact off-diagonal interaction eq. (6), Fubini exponential-moment cancellation eq. (9), Lemma 2 eqs. (7)–(8) | `F04Riemann/WindowBounds.lean` | `exact_interwindow_interaction`, `fubini_exp_corr_eq_moments`, `R_bound`, `E_bound`, `lemma2_interwindow_bound` |
| §5 Comparison matrix $M$, row-dominance criterion eq. (12), Theorem 1 eqs. (10)–(11) | `F04Riemann/ComparisonAndPositivity.lean` | `compMatrix`, `compMatrix_isSymm`, `quadForm_compMatrix`, `rowMargin`, `row_dominance_implies_matrix_lower_bound`, `theorem1_comparison`, `theorem1_uniform_positivity` |
| §6 Fixed-center regime, explicit width bound eq. (13), Theorem 2 | `F04Riemann/ComparisonAndPositivity.lean` | `C_delta`, `explicitWidthBound`, `theorem2_fixed_centers_explicit`, `theorem2_fixed_centers` |
| §7 Smooth bump construction, dual moment nondegeneracy, exact codimension $2r - 2$, infinite-dimensionality, cutoff identity eq. (14) | `F04Riemann/CodimensionAndCutoff.lean` | `bumpTestFn`, `dual_moment_nondegeneracy`, `localMomentMap_surjective`, `local_balance_codimension`, `local_balanced_infinite_dimensional`, `disjoint_sum_unique`, `mulCutoff`, `cutoff_product_rule`, `cutoff_reconstruction_sum` |
| §1 Toy counterexample ($x^2 + y^2 - 3xy$), §6 prime-power window illustration ($L = 1/20$), & certified three-window positivity at $L = 1/100$ (`PROOF-REVIEW.md`) | `F04Riemann/WorkedExamples.lean` | `section1_counterexample`, `m_func_one_hundredth_gt`, `arithmetic_illustration_L_one_twentieth`, `certified_three_window_L_one_hundredth` |
| Finite-chain single-interval lower bound $m_N(L)$ (`riemann-reconstruction-2026-10-14` / `support-analysis.md`), discrete sine-chain inequality, fiber decomposition, and enhanced comparison matrix | `F04Riemann/FiniteChainBounds.lean` | `discrete_finite_chain_bound`, `re_autoCorr_le_cos_mul_normSq`, `chainTerm`, `chainContrib`, `m_chain`, `m_chain_mono`, `lemma1_finite_chain_lower_bound`, `compMatrixChain`, `theorem1_chain_comparison`, `theorem1_chain_uniform_positivity` |
| Symmetric $LDL^\top$ / Schur-complement positivity, kernel-checked $m_{64}(1/20) > 1.175$, 3-window ($L = 1/20, \varepsilon = 1/4$) & 7-window / 21-edge ($L = 1/20, \varepsilon = 1/100$) certificates (`riemann-reconstruction-2026-10-14`) | `F04Riemann/SchurLDLAndSevenWindows.lean` | `quadForm_eq_ldl_sum`, `quadForm_ge_of_ldl`, `quadForm_gt_of_unit_lower_ldl`, `quadForm_mono_entrywise_nonneg`, `m_chain_64_one_twentieth_gt`, `certified_three_window_L_one_twentieth`, `certified_seven_window_L_one_twentieth`, `seven_window_row0_prime_sum_gt` |
| 3D Gaussian zero-form, reflection symmetry, unconditional multiplicity-weighted critical-strip tail shield $B(T)$, kernel-checked $B(100) \le 1.48 \times 10^{-159}$, & $3 \times 3$ Sylvester interval-perturbation positivity (`riemann-2026-10-14`) | `F04Riemann/GaussianZeroForm.lean` | `gaussianTransform`, `gaussianTransform_reflect`, `gaussianTransform_criticalLine`, `reflectedPair_symm`, `reflectedPair_add_reflect_real`, `norm_reflectedPair_le_tailEnvelope`, `tailEnvelope_le_exp_mul`, `nlog_le_exp_mul`, `tail_shells_tsum_le_tailBoundB`, `tailBoundB_100_le`, `sylvester_3x3_hermitian_pos_def`, `certified_gaussian_3x3_positive_definite`, `certified_gaussian_3x3_from_finite_and_tail` |
| Exact rational polygon winding, zero-free convex rectangular cages (`RectBox`), Arb/FLINT box-enclosure winding invariance, IVT critical-line completeness, kernel-verified 29 rational zero intervals ($T = 100$), & wired end-to-end 3D Gaussian bridge (`riemann-2026-10-14`) | `F04Riemann/CauchyWindingCages.lean` | `edgeCrossing`, `polyWinding`, `rayAngle_sub_add_crossing_eq_arg_div`, `RectBox.homotopy_zeroFree`, `lift_diff_eq_arg_div_of_rectBox`, `arg_div_four_point_of_rectBox`, `winding_eq_polyWinding_of_box_cover`, `winding_eq_polyWinding_of_convex_cover`, `exists_strictMono_zeros_of_sign_changes`, `finite_critical_line_completeness`, `zero29_lower_pos`, `zero29_lower_lt_upper`, `zero29_upper_lt_100`, `zero29_strictly_separated`, `zero29_width_lt`, `certified_29_zeros_up_to_100`, `certified_3D_gaussian_from_29_zeros_and_tail` |
| §8 Gap 1 — Closing codimension $2r - 2$ local-balance gap on separated windows via Cauchy–Schwarz moment bounds $F_{\mathrm{unbal}}$, unbalanced Lemma 2, unbalanced comparison matrices, fixed-center global-balance Theorem 2, & kernel-checked unbalanced 3-window certificates | `F04Riemann/GlobalBalanceWindows.lean` | `norm_momentNeg_le`, `norm_momentPos_le`, `F_unbal`, `exact_interwindow_interaction_split`, `lemma2_interwindow_bound_unbalanced`, `compMatrixUnbal`, `compMatrixChainUnbal`, `theorem1_unbalanced_uniform_positivity`, `theorem1_chain_unbalanced_uniform_positivity`, `theorem2_fixed_centers_global_balance`, `theorem2_globally_balanced_subspace`, `certified_three_window_L_one_hundredth_unbalanced`, `certified_three_window_L_one_twentieth_unbalanced`, `exists_globally_balanced_not_locally_balanced_positive` |
| §8 Gap 2 — Exact overlapping smooth-cutoff decomposition, $L^2$ overlap defect, singular $t \to 0^+$ obstruction, uniform-in-$N$ small-gap breakdown ($d \to 0^+$), & sharp $L > \log 2$ single-window prime-entry / diagonal-sign failure | `F04Riemann/OverlappingCutoffBoundary.lean` | `Q_form_cutoff_reconstruction`, `normSq_cutoff_overlap_defect`, `B_form_overlapping_singular_obstruction`, `explicit_overlapping_cutoff_defect`, `tendsto_R_bound_atZero`, `chainContrib_le_of_pos`, `compMatrixChain_fails_small_gap_uniform`, `compMatrix_fails_small_gap`, `prime_enters_diagonal_above_log_two`, `single_window_diagonal_fails_large_L`, `m_func_neg_of_large_L`, `m_chain_log_two_neg` |
| §8 Gap 3 (Option A) — Classical bidirectional Weil equivalence ($\mathrm{RH} \iff Q \ge 0$) on multiplicity-weighted critical-strip zero spectra via Mellin transform & two-shift phase-rotated Gaussian wave packets (explicit formula as hypothesis, zero custom axioms) | `F04Riemann/WeilEquivalence.lean` | `mellinTransform`, `mellinTransform_isBalanced_iff`, `weilSpectralTerm`, `ZeroSpectrum`, `ZeroSpectrum.of_HSW`, `RH_holds`, `spectral_form_nonneg_of_RH`, `weil_positivity_of_RH_TestFn`, `weil_positivity_of_RH_balanced`, `shiftedGaussianTransform`, `shiftedGaussianTransform_zero_one`, `summable_shiftedGaussian_norm`, `summable_shiftedGaussian_re`, `exists_negative_shiftedGaussian_of_not_RH`, `RH_of_shiftedGaussian_nonneg`, `weil_equivalence_gaussian_spectrum`, `weil_equivalence_with_explicit_formula` |

## Scope Boundary

- **F04, Support Reconstruction, & Gap 1 Closure (`WindowBounds`, `ComparisonAndPositivity`, `FiniteChainBounds`, `SchurLDLAndSevenWindows`, `GlobalBalanceWindows`)**: Proved **unconditionally inside Lean's kernel** (zero external oracles). Establishes Weil positivity with explicit uniform lower bounds on finite linear combinations of separated windows — both locally balanced (including $m_{64}(1/20) > 1.175$, 3-window $\varepsilon = 1/4$, and 7-window / 21-edge $\varepsilon = 1/100$ Schur-complement $LDL^\top$ certificates) **and globally balanced without local balance** (`GlobalBalanceWindows`, closing all $2r - 2$ cross-window directions on narrow separated windows, including unbalanced 3-window certificates at $L = 1/100$ with $\varepsilon = 1$ and $L = 1/20, N = 64$ with $\varepsilon = 1/6$ plus an explicit non-locally-balanced positive witness).
- **§8 Sharp Method Boundary (`CodimensionAndCutoff`, `OverlappingCutoffBoundary`)**: Proved **unconditionally inside Lean's kernel**. Establishes the exact overlapping smooth-cutoff decomposition and $L^2$ overlap defect, the non-integrable $t \to 0^+$ singular obstruction on overlapping pieces, the uniform-in-$N$ breakdown of `compMatrixChain N` as window gap $d \to 0^+$ (since `chainContrib N L ≤ exp(L/2) π²/9`), and the sharp single-window width threshold at $L = \log 2$ (prime $p = 2$ enters with negative contribution above $\log 2$, and `m_chain N (log 2) < 0` for every $N$).
- **Finite-Region Zeros & 3D Gaussian Zero-Form (`GaussianZeroForm`, `CauchyWindingCages`)**: The analytic multiplicity-weighted tail-decay theorems, the numerical bound $B(100) \le 1.48 \times 10^{-159}$ (assuming neither RH nor simplicity on omitted zeros), the $3 \times 3$ Sylvester interval-perturbation positivity proof, the exact rational ray-crossing / Arb box-enclosure homotopy winding theorem (`winding_eq_polyWinding_of_box_cover`), the IVT exhaustion / simplicity completeness theorem, the strict ordering and $< 10^{-28}$ widths of all 29 exact 192-bit rational zero intervals in $(0, 100)$ (matching `certification-zeros-100.json` bit-for-bit across all 58 endpoints), and the end-to-end 29-zero + weighted-tail bridge (`certified_3D_gaussian_from_29_zeros_and_tail`) are all proved **inside Lean's kernel** with zero custom axioms. Raw 192-bit FLINT/Arb pointwise evaluations of $\zeta(s)$ and $\Xi(t)$ (the sign changes of $\Xi$ at the 29 endpoints, the total contour count $57 + 1 = 58$, the Hasanalizade–Shen–Wong weighted shell count bound, and the finite 58-zero sum enclosure) enter as explicit theorem hypotheses rather than axioms.
- **Classical Weil Equivalence (`WeilEquivalence`)**: Proved **unconditionally inside Lean's kernel** for arbitrary multiplicity-weighted critical-strip zero spectra (`ZeroSpectrum`, assuming neither RH nor simplicity of zeros). Direction 1 (`RH ⟹ Q ≥ 0`) applies to both `TestFn` (`C_c^\infty`) and arbitrary transform functions; Direction 2 (`Q ≥ 0 ⟹ RH`) and the full bidirectional equivalence (`weil_equivalence_gaussian_spectrum`, `weil_equivalence_with_explicit_formula`) hold on the globally balanced Schwartz-class shifted Gaussian wave-packet family (`shiftedGaussianTransform`, order-2 entire transforms vanishing at `s = 0, 1`), taking Weil's explicit-formula identity as an explicit theorem hypothesis rather than an axiom.
- **Open RH**: In accordance with §8 of F04 and `CERTIFICATION.md`, none of these results prove unrestricted Weil positivity on arbitrary overlapping/wide globally balanced functions (`OverlappingCutoffBoundary` explicitly formalizes why the separated-window comparison method cannot reach unrestricted global positivity), nor do they prove the Riemann Hypothesis at unbounded height.

## Reproducing Verification

```sh
# 1. Recompile all modules directly through Lean 4.35.0 (-DautoImplicit=false)
sh scripts/check.sh \
  F04Riemann.AnalyticFoundations \
  F04Riemann.Arithmetic \
  F04Riemann.TestFunctions \
  F04Riemann.WeilForm \
  F04Riemann.WindowBounds \
  F04Riemann.ComparisonAndPositivity \
  F04Riemann.CodimensionAndCutoff \
  F04Riemann.WorkedExamples \
  F04Riemann.FiniteChainBounds \
  F04Riemann.SchurLDLAndSevenWindows \
  F04Riemann.GaussianZeroForm \
  F04Riemann.CauchyWindingCages \
  F04Riemann.GlobalBalanceWindows \
  F04Riemann.OverlappingCutoffBoundary \
  F04Riemann.WeilEquivalence \
  F04Riemann

# 2. Run the transitive #print axioms & forbidden-token audit
python3 scripts/audit_axioms.py
```

The machine-readable audit receipt is written to `reports/VERIFICATION.json`.
