Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Weighted representation function

Definition
LL_Decomp1526a_rep

by sthubbar · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

For N∈NN\in\mathbb NN∈N, r(N)=∑p≤N, p prime, N−p primelog⁡p log⁡(N−p)r(N)=\sum_{p\le N,\ p\text{ prime},\ N-p\text{ prime}}\log p\,\log(N-p)r(N)=∑p≤N, p prime, N−p prime​logplog(N−p), a real number, summing over ordered pairs and using natural subtraction, with the term 000 when N−pN-pN−p is not prime.

Definition code
import Mathlib

namespace LL_Decomp1526a

noncomputable section

open Finset Real
open scoped Chebyshev Classical

def rep (N : ℕ) : ℝ :=
  ∑ p ∈ (range (N + 1)).filter Nat.Prime,
    if (N - p).Prime then Real.log p * Real.log ((N - p : ℕ) : ℝ) else 0

end

end LL_Decomp1526a
Read-back

What the Lean code literally says, in plain math · claude-haiku

The file defines one function rep\mathrm{rep}rep from the natural numbers to the real numbers. Its only argument is N∈NN \in \mathbb{N}N∈N. It has no hypotheses, no further binders and no typeclass assumptions beyond the standard real-number and classical instances used to make the definition work.

For a natural number NNN, rep(N)\mathrm{rep}(N)rep(N) is the real number

rep(N)=∑p≤Np prime{log⁡p⋅log⁡(N−p)if N−p is prime,0otherwise.\mathrm{rep}(N) = \sum_{\substack{p \le N \\ p \text{ prime}}} \begin{cases} \log p \cdot \log (N - p) & \text{if } N - p \text{ is prime}, \\ 0 & \text{otherwise.} \end{cases}rep(N)=p≤Np prime​∑​{logp⋅log(N−p)0​if N−p is prime,otherwise.​

Here ppp ranges over the primes in {0,1,…,N}\{0, 1, \dots, N\}{0,1,…,N}, so p≤Np \le Np≤N. The subtraction N−pN - pN−p is natural-number subtraction, but since p≤Np \le Np≤N it is ordinary subtraction, and N−p≥0N - p \ge 0N−p≥0. The logarithms are the real natural logarithms of the natural numbers ppp and N−pN - pN−p.

Edge cases:

  • For N=0N = 0N=0 and N=1N = 1N=1 there are no primes in {0,1,…,N}\{0, 1, \dots, N\}{0,1,…,N}, so rep(N)=0\mathrm{rep}(N) = 0rep(N)=0.
  • The term p=Np = Np=N, which occurs when NNN is prime, has N−p=0N - p = 0N−p=0. Zero is not prime, so this term is 000. A term contributes a nonzero value only when p<Np < Np<N and both ppp and N−pN - pN−p are prime.
  • Each nonzero term is a product of two logarithms of primes, each at least 222, so each nonzero term is strictly positive.
  • The sum is finite and the definition involves no division, so it is total and has no junk values.

The definition asserts nothing beyond the value of rep(N)\mathrm{rep}(N)rep(N) for each NNN. It contains no theorem.

Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by sthubbar · Oct 30, 2026

    Confirmed by the mission captain (proposal self-audit).

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