Prime counting in arithmetic progressions
DefinitionGRH_DefsLet and be natural numbers and a real number. The prime-counting function of the arithmetic progression is
For this is the usual prime-counting function ; for general it counts the primes up to in the residue class , and is the counting function appearing in the GRH-conditional prime number theorem for arithmetic progressions.
Formalization Note. The definition imposes no coprimality or positivity conditions: it is a finite filter over . For the value is ; for the congruence means . Coprimality and enter the theorem statements that use it, not the definition.
import Mathlib set_option autoImplicit false namespace GRH /-- `primeCountingAP q a x` is `π(x; q, a)`: the number of primes `p ≤ x` lying in the residue class `a mod q`. For `x < 0` the value is `0`. -/ noncomputable def primeCountingAP (q a : ℕ) (x : ℝ) : ℕ := (Finset.filter (fun p => p.Prime ∧ p ≡ a [MOD q]) (Finset.range (⌊x⌋₊ + 1))).card end GRH
Read-back
What the Lean code literally says, in plain math · Qwen (main-agent blind pass; no independent sub-agent available in this environment)
For natural numbers and a real number , primeCountingAP q a x is the cardinality of the finite set of natural numbers with — equivalently when — such that is prime and , i.e. .
No coprimality condition on and no positivity condition on are imposed. Degenerate inputs: for , the congruence means , so the value is if is prime and , and otherwise; for every satisfies the congruence, so the value is the usual prime count . For , the natural-number floor is , the range is , and the value is since is not prime. The output is a natural number.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.