Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Localized prime weights and Selberg majorants

Definition
GreenTaoPort_Wikipedia_GreenTao_Primes_WTrick

by kmehltretter82 · Nov 14, 2026 · Mathlib c5ea003 (Lean v4.30.0)

arithmetic-progressionsgreen-tao-port-8822number-theory

Let N>0N>0N>0 be a cyclic modulus, and represent n∈Z/NZn\in\mathbb Z/N\mathbb Zn∈Z/NZ by its standard natural value ttt. The localization interval is

IN=[⌊N/64⌋,⌊N/4⌋]∩N.I_N=[\lfloor N/64\rfloor,\lfloor N/4\rfloor]\cap\mathbb N.IN​=[⌊N/64⌋,⌊N/4⌋]∩N.

For a real scale α\alphaα and natural affine parameters W,bW,bW,b, the prime weight is zero unless t∈INt\in I_Nt∈IN​ and Wt+bWt+bWt+b is prime. In that case it equals

α φ(W)Wlog⁡(Wt+b).\alpha\,\frac{\varphi(W)}{W}\log(Wt+b).αWφ(W)​log(Wt+b).

The companion majorant uses a smoothing function χ\chiχ, normalizer cχc_\chicχ​, and sieve level RRR: inside INI_NIN​ it is the normalized Selberg square evaluated at Wt+bWt+bWt+b, and outside INI_NIN​ it is one. The positive-period and positive-normalizer hypotheses needed for later estimates are not built into these total definitions.

Definition code
import Definitions.Def_GreenTaoPort_Wikipedia_GreenTao_Primes_ReducedResidues
import Definitions.Def_GreenTaoPort_Wikipedia_GreenTao_Sieve_TruncatedDivisorSum
import Mathlib.Data.ZMod.Basic
import Lean
import Mathlib.Analysis.SpecialFunctions.Log.Basic
import Mathlib.Combinatorics.Pigeonhole
import Mathlib.Data.Nat.Totient
import Mathlib.NumberTheory.ArithmeticFunction.Moebius
import Mathlib.NumberTheory.Divisors
import Mathlib.NumberTheory.Primorial
import Mathlib.Tactic

set_option autoImplicit true
set_option relaxedAutoImplicit false
set_option maxSynthPendingDepth 3


/-!
# W-tricked prime weight and Selberg majorant

This file defines the two functions compared in the final transference
argument.  Both are localized to a short interval of standard
representatives.  Outside that interval the prime weight is zero and the
majorant is one; inside it, the majorant is the normalized Selberg square at
`W * n + b`.
-/

namespace Wikipedia.SzemeredisTheorem

/-- The fixed short interval used to prevent wraparound when a cyclic
progression is lifted back to the natural numbers. -/
def greenTaoInterval (N : ℕ) : Finset ℕ :=
  Finset.Icc (N / 64) (N / 4)





/-- The affine natural number represented by a W-tricked residue. -/
def wTrickedValue {N : ℕ} [NeZero N]
    (W b : ℕ) (n : ZMod N) : ℕ :=
  W * n.val + b

/-- Localized, logarithmically weighted indicator of W-tricked primes. -/
noncomputable def wTrickedPrimeWeight {N : ℕ} [NeZero N]
    (α : ℝ) (W b : ℕ) (n : ZMod N) : ℝ :=
  if n.val ∈ greenTaoInterval N ∧ Nat.Prime (wTrickedValue W b n) then
    α * ((W.totient : ℝ) / W) * Real.log (wTrickedValue W b n)
  else
    0

/-- Localized Selberg majorant. -/
noncomputable def wTrickedMajorant {N : ℕ} [NeZero N]
    (χ : ℝ → ℝ) (cχ : ℝ) (R W b : ℕ) (n : ZMod N) : ℝ :=
  if n.val ∈ greenTaoInterval N then
    normalizedSelbergMajorant χ cχ R W (wTrickedValue W b n)
  else
    1















end Wikipedia.SzemeredisTheorem


/- Materialize compiler-generated declarations promised by this bundle. -/
run_meta do
  for requiredName in #[
    `Wikipedia.SzemeredisTheorem.greenTaoInterval.eq_1,
    `Wikipedia.SzemeredisTheorem.wTrickedMajorant.eq_1,
    `Wikipedia.SzemeredisTheorem.wTrickedPrimeWeight.eq_1,
    `Wikipedia.SzemeredisTheorem.wTrickedValue.congr_simp
  ] do
    let actualName ← Lean.realizeGlobalConstNoOverloadCore requiredName
    unless actualName == requiredName do
      throwError "Generated companion resolved to an unexpected name"
Source
https://github.com/plby/lean-proofs/blob/8822f7ddef30fadbd92e1c6ab4ed897af356af5e/src/latest/Wikipedia/GreenTao/Primes/WTrick.lean#L17-L59

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