Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Aether Catalog definitions — MachineLearning_PrimeGaps_Optimization

Definition
MachineLearning_PrimeGaps_Optimization

by raver1975 · Sep 12, 2026 · Mathlib c5ea003 (Lean v4.30.0)

aether-catalogmachinelearning

Definition bundle for the Aether Catalog module MachineLearning.PrimeGaps.Optimization, transplanted by skeleton subtraction; supplies the types and constants the catalog's theorems import.

Definition code
-- Def bundle generated from MachineLearning/PrimeGaps/Optimization.lean by skeleton subtraction
import Mathlib
/-
# Finite-Dimensional Optimization Core of the Maynard Sieve

This file formalizes the exact extremal inequality S₂(w) ≤ k · S₁(w) where
S₁(w) = ∑ wᵢ² and S₂(w) = (∑ wᵢ)², and characterizes equality as holding
iff all weights are equal. This is the finite-dimensional positivity backbone
of the Maynard–Tao bounded gaps argument.

## Main results

* `sum_sq_le_card_mul_sq_sum` — The Cauchy–Schwarz inequality S₂ ≤ k·S₁
* `rayleigh_quotient_bound` — S₂/S₁ ≤ k with division
* `rayleigh_quotient_eq_iff_constant` — Equality iff all weights are equal
* `positiveWeightProfile_exists_iff` — The threshold existence theorem:
    ∃ w with S₂/S₁ > τ ⟺ τ < k
-/


open Finset BigOperators

/-- Sum of squares of weights. -/
def S1 {k : ℕ} (w : Fin k → ℝ) : ℝ := ∑ i, (w i) ^ 2

/-- Square of sum of weights. -/
def S2 {k : ℕ} (w : Fin k → ℝ) : ℝ := (∑ i, w i) ^ 2

/-
**Cauchy–Schwarz in finite dimension.** The square of the sum is at most
`k` times the sum of squares. This is the sharp finite-dimensional inequality
underlying Maynard-type weight optimization.
-/

/-
The Rayleigh quotient S₂/S₁ is bounded by k.
-/

/-
**Equality characterization.** S₂ = k·S₁ if and only if all weights are equal.
-/

/-- A weight profile beats threshold τ if S₂/S₁ > τ. -/
def PositiveWeightProfile {k : ℕ} (τ : ℝ) (w : Fin k → ℝ) : Prop :=
  S2 w / S1 w > τ

/-
**Threshold existence theorem.** There exists a weight vector with
S₂/S₁ > τ if and only if τ < k. This is the exact finite-dimensional
optimization threshold for the Maynard sieve.
-/

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me