math / data /lean /ComparatorChallenges /TotientCompanionZero.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
3.54 kB
import Mathlib
namespace OAI
/-! The no-seed alternative of the weighted totient companion theorem. -/
noncomputable section
open scoped BigOperators Topology
open Filter
namespace TotientAsymptotic
def IsTotient (v : β„•) : Prop := βˆƒ n : β„•, 0 < n ∧ n.totient = v
def ell (v : β„•) : β„• := by
classical
exact if h : IsTotient v then Nat.find h else 0
def a (j : β„•) : ℝ := (j + 1 : ℝ) * Real.log (j + 1) - j * Real.log j - 1
def RenewalRootSet : Set ℝ :=
{z | 0 < z ∧ z < 1 ∧ (βˆ‘' j : β„•, a (j+1) * z^(j+1)) = 1}
def rho : ℝ := sInf RenewalRootSet
def lam : ℝ := Real.log (1 / rho)
def gamma : ℝ := (βˆ‘' j : β„•, (j+1 : ℝ) * a (j+1) * rho^(j+1))⁻¹
def P (H : β„•) : β„• := ⌊Real.log (Real.log (H : ℝ))βŒ‹β‚Š
def alpha (s : ℝ) : ℝ := lam * Real.exp (lam * s)
def largestPrimeFactor (n : β„•) : β„• := max 1 (n.primeFactors.sup id)
structure TailDatum (H : β„•) where
Q : Fin H β†’ β„•
cofactor : β„•
def tailPrime {H : β„•} (Ξ· : TailDatum H) (h : β„•) : β„• :=
if hH : h < H then η.Q ⟨h, hH⟩ else 1
def tailLog {H : β„•} (Ξ· : TailDatum H) (h : β„•) : ℝ :=
Real.log (Real.log (tailPrime Ξ· h : ℝ))
def IsWitness (H : β„•) (s : ℝ) (Ξ· : TailDatum H) : Prop :=
(βˆ€ h : Fin H, h.val < P H β†’ Ξ·.Q h = 1) ∧
0 < η.cofactor ∧
(βˆ€ h ∈ Finset.Ico (P H) H, (tailPrime Ξ· h).Prime ∧
(9 / 10 : ℝ) * alpha s * h * (rho^h)⁻¹ ≀ tailLog Ξ· h ∧
tailLog Ξ· h ≀ (11 / 10 : ℝ) * alpha s * h * (rho^h)⁻¹ ∧
(βˆ‘ l ∈ Finset.Ico (P H) h, a (h-l) * tailLog Ξ· l) ≀
(1 + (1 / 10000 : ℝ) * Real.exp (-(h : ℝ) / 40)) * tailLog Ξ· h) ∧
largestPrimeFactor Ξ·.cofactor ≀ tailPrime Ξ· (P H) ∧
Real.log (Ξ·.cofactor : ℝ) ≀
Real.exp (2 * alpha s * (P H : ℝ) * (rho^(P H))⁻¹)
def w {H : β„•} (Ξ· : TailDatum H) : β„• :=
η.cofactor * ∏ h ∈ Finset.Ico (P H) H, tailPrime η h
def witnesses (H : β„•) (s : ℝ) (d : β„•) : Set (TailDatum H) :=
{η | IsWitness H s η ∧ (w η).totient = d}
def D {H : β„•} (h : β„•) (Ξ· : TailDatum H) : ℝ :=
βˆ‘ l ∈ Finset.Ico (P H) H, a (h-l) * tailLog Ξ· l
def maxD {H : β„•} (h : β„•) (T : Finset (TailDatum H)) : ℝ := by
classical
exact if ht : T.Nonempty then T.sup' ht (D h) else 0
def AH (H : β„•) (f : ℝ β†’ ℝ) (s : ℝ) : ℝ := by
classical
exact rho^(H*(H-1)/2) * (gamma / alpha s)^H *
βˆ‘αΆ  d : β„•,
if IsTotient d then
f ((ell d : ℝ) / d) / d *
βˆ‘αΆ  T : Finset (TailDatum H),
if T.Nonempty ∧ (↑T : Set (TailDatum H)) βŠ† witnesses H s d then
(-1 : ℝ)^(T.card-1) *
Real.exp (-(gamma / alpha s) *
βˆ‘' n : β„•, rho^(H+n) * maxD (H+n) T)
else 0
else 0
def A (f : ℝ β†’ ℝ) (s : ℝ) : ℝ := limUnder atTop (fun H : β„• => AH H f s)
def N (k : β„•) (x : ℝ) : ℝ := by
classical
exact (((Finset.Icc 1 ⌊xβŒ‹β‚Š).filter fun v =>
IsTotient v ∧ (k : ℝ) * x < ell v ∧ (ell v : ℝ) ≀ (k+1 : ℝ) * x).card : ℝ)
def fk (k : β„•) (r : ℝ) : ℝ := min 1 ((k+1 : ℝ) / r) - min 1 ((k : ℝ) / r)
/-- Without a totient value whose least preimage exceeds its prescribed multiple,
both the weighted count and its limiting coefficient vanish. -/
theorem companion_zero_case (k : β„•) (_hk : 0 < k)
(hno : Β¬ βˆƒ d : β„•, IsTotient d ∧ k*d < ell d) :
(βˆ€ x : ℝ, 0 < x β†’ N k x = 0) ∧
(βˆ€ s ∈ Set.Ico (0 : ℝ) 1, A (fk k) s = 0) := by
sorry
end TotientAsymptotic
end
end OAI