Add lean source and binary files (part 104)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeContinuousMinorArc.lean +89 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeCubicStability.lean +110 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeEulerProduct.lean +93 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeEulerTail.lean +176 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourier.lean +203 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourierBundle.lean +4 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourierReduction.lean +53 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeIntegralCount.lean +52 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalDensity.lean +319 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalFactor.lean +105 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalFourier.lean +43 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalSeries.lean +72 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldt.lean +249 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtAsymptotics.lean +82 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtBridge.lean +31 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtIntegral.lean +66 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtPowerError.lean +89 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMinorArc.lean +188 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMinorEnergy.lean +102 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimePartialSummation.lean +108 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeSingularSeries.lean +126 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeSingularTail.lean +174 -0
- lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeWeighted.lean +62 -0
- lean/OAI/NumberTheory/EgyptianFractions/TruncatedDivisors.lean +128 -0
- lean/OAI/NumberTheory/EgyptianFractions/TypeIIBlockScalar.lean +43 -0
- lean/OAI/NumberTheory/EgyptianFractions/UniformDivisorMoment.lean +91 -0
- lean/OAI/NumberTheory/EgyptianFractions/UniformSecondMoment.lean +90 -0
- lean/OAI/NumberTheory/EgyptianFractions/UpperSlope.lean +94 -0
- lean/OAI/NumberTheory/EgyptianFractions/VanDerCorput.lean +239 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanBilinear.lean +305 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanCutoff.lean +192 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanDecomposition.lean +105 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadic.lean +152 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicDecomposition.lean +96 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicEstimate.lean +96 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicUniform.lean +127 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanEstimate.lean +140 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanHyperbola.lean +144 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanHyperbolicNearRational.lean +55 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanIdentity.lean +180 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanNearRational.lean +269 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanOptimized.lean +86 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanRealTypeIHyperbolic.lean +112 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanTypeI.lean +160 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanTypeINormalized.lean +102 -0
- lean/OAI/NumberTheory/EgyptianFractions/VaughanWeighted.lean +108 -0
- lean/OAI/NumberTheory/EgyptianFractions/WeightedBinomial.lean +55 -0
- lean/OAI/NumberTheory/GaussianMoat/AccurateScales.lean +336 -0
- lean/OAI/NumberTheory/GaussianMoat/BackwardCoverage.lean +388 -0
- lean/OAI/NumberTheory/GaussianMoat/BatchCertificate.lean +271 -0
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeContinuousMinorArc.lean
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeContinuousEnergy
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMinorArc
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
open MeasureTheory
|
| 8 |
+
|
| 9 |
+
namespace Problem337.ThreePrimeContinuousMinorArc
|
| 10 |
+
|
| 11 |
+
/-- The actual prime logarithmic exponential sum, with positive phase. -/
|
| 12 |
+
def primeExponentialSum (u : ℕ) (x : ℝ) : ℂ :=
|
| 13 |
+
ThreePrimeContinuousEnergy.natPolynomial (Nat.primesLE u)
|
| 14 |
+
(fun p => (Real.log (p : ℝ) : ℂ)) x
|
| 15 |
+
|
| 16 |
+
lemma primeExponentialSum_eq (u : ℕ) (x : ℝ) :
|
| 17 |
+
primeExponentialSum u x =
|
| 18 |
+
∑ p ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 19 |
+
(Real.log (p : ℝ) : ℂ) *
|
| 20 |
+
Complex.exp (2 * Real.pi * Complex.I * (p : ℂ) * (x : ℂ)) := by
|
| 21 |
+
rw [primeExponentialSum, ThreePrimeContinuousEnergy.natPolynomial,
|
| 22 |
+
Nat.primesLE_eq_filter_Icc_one]
|
| 23 |
+
|
| 24 |
+
/-- Every real frequency gives a unit-modulus phase. -/
|
| 25 |
+
lemma phase_norm (t x : ℝ) :
|
| 26 |
+
‖Complex.exp (2 * Real.pi * Complex.I * (t : ℂ) * (x : ℂ))‖ = 1 := by
|
| 27 |
+
rw [Complex.norm_exp]
|
| 28 |
+
simp [Complex.mul_re, Complex.mul_im]
|
| 29 |
+
|
| 30 |
+
/-- The unconditional amplitude estimate needed in major-arc error budgets. -/
|
| 31 |
+
theorem primeExponentialSum_norm_le (u : ℕ) (x : ℝ) :
|
| 32 |
+
‖primeExponentialSum u x‖ ≤ Real.log 4 * (u : ℝ) := by
|
| 33 |
+
apply ThreePrimeMinorArc.prime_sum_norm_le
|
| 34 |
+
intro p hp
|
| 35 |
+
exact (phase_norm p x).le
|
| 36 |
+
|
| 37 |
+
/-- Exact energy of the prime exponential sum on one unit interval. -/
|
| 38 |
+
theorem primeExponentialSum_parseval (u : ℕ) :
|
| 39 |
+
(∫ x : ℝ in 0..1, ‖primeExponentialSum u x‖ ^ 2) =
|
| 40 |
+
∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2 := by
|
| 41 |
+
simpa only [primeExponentialSum, Complex.norm_real, Real.norm_eq_abs, sq_abs] using
|
| 42 |
+
ThreePrimeContinuousEnergy.nat_polynomial_parseval_interval
|
| 43 |
+
(Nat.primesLE u) (fun p => (Real.log (p : ℝ) : ℂ))
|
| 44 |
+
|
| 45 |
+
/-- Continuous prime minor arcs with an arbitrary norm-bounded twist.
|
| 46 |
+
The prime supremum estimate remains an explicit analytic hypothesis. -/
|
| 47 |
+
theorem prime_minor_cubic_bound (u : ℕ) (hu : 2 ≤ u)
|
| 48 |
+
(phase : ℝ → ℂ) (minor : Set ℝ) (hmeas : MeasurableSet minor)
|
| 49 |
+
(hsubset : minor ⊆ Set.Icc 0 1) (ε : ℝ) (hε : 0 ≤ ε)
|
| 50 |
+
(hminor : ∀ x ∈ minor, ‖primeExponentialSum u x‖ ≤
|
| 51 |
+
ε * (u : ℝ) / Real.log (u : ℝ))
|
| 52 |
+
(hphase : ∀ x ∈ minor, ‖phase x‖ ≤ 1) :
|
| 53 |
+
‖∫ x in minor, primeExponentialSum u x ^ 3 * phase x‖ ≤
|
| 54 |
+
ε * Real.log 4 * (u : ℝ) ^ 2 := by
|
| 55 |
+
have hu1 : 1 < (u : ℝ) := by exact_mod_cast (show 1 < u by omega)
|
| 56 |
+
have hlog : 0 < Real.log (u : ℝ) := Real.log_pos hu1
|
| 57 |
+
have hB : 0 ≤ ε * (u : ℝ) / Real.log (u : ℝ) := by positivity
|
| 58 |
+
have h := ThreePrimeContinuousEnergy.nat_polynomial_interval_minor_cubic_bound
|
| 59 |
+
(Nat.primesLE u) (fun p => (Real.log (p : ℝ) : ℂ)) phase minor hmeas hsubset
|
| 60 |
+
(ε * (u : ℝ) / Real.log (u : ℝ)) hB hminor hphase
|
| 61 |
+
change ‖∫ x in minor, primeExponentialSum u x ^ 3 * phase x‖ ≤ _ at h
|
| 62 |
+
simp only [Complex.norm_real, Real.norm_eq_abs, sq_abs] at h
|
| 63 |
+
apply h.trans
|
| 64 |
+
calc
|
| 65 |
+
ε * (u : ℝ) / Real.log (u : ℝ) *
|
| 66 |
+
(∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2) ≤
|
| 67 |
+
ε * (u : ℝ) / Real.log (u : ℝ) *
|
| 68 |
+
(Real.log 4 * (u : ℝ) * Real.log (u : ℝ)) :=
|
| 69 |
+
mul_le_mul_of_nonneg_left (ThreePrimeMinorArc.prime_log_squares_le u (by omega)) hB
|
| 70 |
+
_ = ε * Real.log 4 * (u : ℝ) ^ 2 := by field_simp
|
| 71 |
+
|
| 72 |
+
/-- Conventional negative extraction frequency for the cubic prime count. -/
|
| 73 |
+
theorem prime_minor_extraction_bound (u : ℕ) (hu : 2 ≤ u)
|
| 74 |
+
(minor : Set ℝ) (hmeas : MeasurableSet minor)
|
| 75 |
+
(hsubset : minor ⊆ Set.Icc 0 1) (ε : ℝ) (hε : 0 ≤ ε)
|
| 76 |
+
(hminor : ∀ x ∈ minor, ‖primeExponentialSum u x‖ ≤
|
| 77 |
+
ε * (u : ℝ) / Real.log (u : ℝ)) :
|
| 78 |
+
‖∫ x in minor, primeExponentialSum u x ^ 3 *
|
| 79 |
+
Complex.exp (2 * Real.pi * Complex.I * (-(u : ℂ)) * (x : ℂ))‖ ≤
|
| 80 |
+
ε * Real.log 4 * (u : ℝ) ^ 2 := by
|
| 81 |
+
apply prime_minor_cubic_bound u hu _ minor hmeas hsubset ε hε hminor
|
| 82 |
+
intro x hx
|
| 83 |
+
simpa only [Complex.ofReal_neg, Complex.ofReal_natCast] using (phase_norm (-(u : ℝ)) x).le
|
| 84 |
+
|
| 85 |
+
end Problem337.ThreePrimeContinuousMinorArc
|
| 86 |
+
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeCubicStability.lean
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open MeasureTheory
|
| 6 |
+
open scoped ENNReal
|
| 7 |
+
|
| 8 |
+
namespace Problem337.ThreePrimeCubicStability
|
| 9 |
+
|
| 10 |
+
/-- Exact polynomial factorization gives a norm estimate without choosing
|
| 11 |
+
common upper bounds for the two arguments. -/
|
| 12 |
+
theorem norm_cube_sub_cube_le (z w : ℂ) :
|
| 13 |
+
‖z ^ 3 - w ^ 3‖ ≤ ‖z - w‖ * (‖z‖ ^ 2 + ‖z‖ * ‖w‖ + ‖w‖ ^ 2) := by
|
| 14 |
+
have hfactor : z ^ 3 - w ^ 3 = (z - w) * (z ^ 2 + z * w + w ^ 2) := by ring
|
| 15 |
+
rw [hfactor, norm_mul]
|
| 16 |
+
apply mul_le_mul_of_nonneg_left _ (norm_nonneg _)
|
| 17 |
+
calc
|
| 18 |
+
‖z ^ 2 + z * w + w ^ 2‖ ≤ ‖z ^ 2 + z * w‖ + ‖w ^ 2‖ := norm_add_le _ _
|
| 19 |
+
_ ≤ (‖z ^ 2‖ + ‖z * w‖) + ‖w ^ 2‖ :=
|
| 20 |
+
add_le_add (norm_add_le _ _) le_rfl
|
| 21 |
+
_ = _ := by simp only [norm_pow, norm_mul]
|
| 22 |
+
|
| 23 |
+
/-- Asymmetric uniform error estimate for two cubic expressions. -/
|
| 24 |
+
theorem norm_cube_sub_cube_le_of_bounds (z w : ℂ) {E M N : ℝ}
|
| 25 |
+
(hE : 0 ≤ E) (hM : 0 ≤ M) (_hN : 0 ≤ N)
|
| 26 |
+
(hdiff : ‖z - w‖ ≤ E) (hz : ‖z‖ ≤ M) (hw : ‖w‖ ≤ N) :
|
| 27 |
+
‖z ^ 3 - w ^ 3‖ ≤ E * (M ^ 2 + M * N + N ^ 2) := by
|
| 28 |
+
apply (norm_cube_sub_cube_le z w).trans
|
| 29 |
+
apply mul_le_mul hdiff _ (by positivity) hE
|
| 30 |
+
exact add_le_add
|
| 31 |
+
(add_le_add (pow_le_pow_left₀ (norm_nonneg _) hz 2)
|
| 32 |
+
(mul_le_mul hz hw (norm_nonneg _) hM))
|
| 33 |
+
(pow_le_pow_left₀ (norm_nonneg _) hw 2)
|
| 34 |
+
|
| 35 |
+
/-- Cubic approximation error integrated over an arbitrary finite-measure set.
|
| 36 |
+
No measurability or integrability is silently assumed: the Bochner norm bound
|
| 37 |
+
is valid also when the displayed integral is defined by zero. -/
|
| 38 |
+
theorem norm_cubic_error_integral_le {α : Type*} [MeasurableSpace α]
|
| 39 |
+
{μ : Measure α} {s : Set α} (hs : μ s < ∞)
|
| 40 |
+
(F G ψ : α → ℂ) {E M N : ℝ}
|
| 41 |
+
(hE : 0 ≤ E) (hM : 0 ≤ M) (hN : 0 ≤ N)
|
| 42 |
+
(hdiff : ∀ x ∈ s, ‖F x - G x‖ ≤ E)
|
| 43 |
+
(hF : ∀ x ∈ s, ‖F x‖ ≤ M) (hG : ∀ x ∈ s, ‖G x‖ ≤ N)
|
| 44 |
+
(hψ : ∀ x ∈ s, ‖ψ x‖ ≤ 1) :
|
| 45 |
+
‖∫ x in s, (F x ^ 3 - G x ^ 3) * ψ x ∂μ‖ ≤
|
| 46 |
+
E * (M ^ 2 + M * N + N ^ 2) * (μ s).toReal := by
|
| 47 |
+
apply norm_setIntegral_le_of_norm_le_const hs
|
| 48 |
+
intro x hx
|
| 49 |
+
rw [norm_mul]
|
| 50 |
+
calc
|
| 51 |
+
‖F x ^ 3 - G x ^ 3‖ * ‖ψ x‖ ≤
|
| 52 |
+
(E * (M ^ 2 + M * N + N ^ 2)) * 1 :=
|
| 53 |
+
mul_le_mul (norm_cube_sub_cube_le_of_bounds (F x) (G x) hE hM hN
|
| 54 |
+
(hdiff x hx) (hF x hx) (hG x hx)) (hψ x hx) (norm_nonneg _) (by positivity)
|
| 55 |
+
_ = _ := mul_one _
|
| 56 |
+
|
| 57 |
+
/-- A common amplitude bound gives the standard `3 E M²` cubic error. -/
|
| 58 |
+
theorem norm_cubic_error_integral_le_common {α : Type*} [MeasurableSpace α]
|
| 59 |
+
{μ : Measure α} {s : Set α} (hs : μ s < ∞)
|
| 60 |
+
(F G ψ : α → ℂ) {E M : ℝ} (hE : 0 ≤ E) (hM : 0 ≤ M)
|
| 61 |
+
(hdiff : ∀ x ∈ s, ‖F x - G x‖ ≤ E)
|
| 62 |
+
(hF : ∀ x ∈ s, ‖F x‖ ≤ M) (hG : ∀ x ∈ s, ‖G x‖ ≤ M)
|
| 63 |
+
(hψ : ∀ x ∈ s, ‖ψ x‖ ≤ 1) :
|
| 64 |
+
‖∫ x in s, (F x ^ 3 - G x ^ 3) * ψ x ∂μ‖ ≤
|
| 65 |
+
3 * E * M ^ 2 * (μ s).toReal := by
|
| 66 |
+
convert norm_cubic_error_integral_le hs F G ψ hE hM hM hdiff hF hG hψ using 1
|
| 67 |
+
ring
|
| 68 |
+
|
| 69 |
+
/-- When the two cubic integrands are integrable, the error estimate controls
|
| 70 |
+
the difference of their integrals, as required by major-arc approximation. -/
|
| 71 |
+
theorem norm_cubic_integral_sub_le {α : Type*} [MeasurableSpace α]
|
| 72 |
+
{μ : Measure α} {s : Set α} (hs : μ s < ∞)
|
| 73 |
+
(F G ψ : α → ℂ) {E M : ℝ} (hE : 0 ≤ E) (hM : 0 ≤ M)
|
| 74 |
+
(hFi : IntegrableOn (fun x => F x ^ 3 * ψ x) s μ)
|
| 75 |
+
(hGi : IntegrableOn (fun x => G x ^ 3 * ψ x) s μ)
|
| 76 |
+
(hdiff : ∀ x ∈ s, ‖F x - G x‖ ≤ E)
|
| 77 |
+
(hF : ∀ x ∈ s, ‖F x‖ ≤ M) (hG : ∀ x ∈ s, ‖G x‖ ≤ M)
|
| 78 |
+
(hψ : ∀ x ∈ s, ‖ψ x‖ ≤ 1) :
|
| 79 |
+
‖(∫ x in s, F x ^ 3 * ψ x ∂μ) - (∫ x in s, G x ^ 3 * ψ x ∂μ)‖ ≤
|
| 80 |
+
3 * E * M ^ 2 * (μ s).toReal := by
|
| 81 |
+
rw [← integral_sub hFi hGi]
|
| 82 |
+
simpa only [sub_mul] using
|
| 83 |
+
norm_cubic_error_integral_le_common hs F G ψ hE hM hdiff hF hG hψ
|
| 84 |
+
|
| 85 |
+
/-- Oriented-interval version of cubic stability, independent of endpoint order. -/
|
| 86 |
+
theorem norm_cubic_interval_error_le (F G ψ : ℝ → ℂ) (a b : ℝ)
|
| 87 |
+
{E M : ℝ} (hE : 0 ≤ E) (hM : 0 ≤ M)
|
| 88 |
+
(hdiff : ∀ x ∈ Set.uIoc a b, ‖F x - G x‖ ≤ E)
|
| 89 |
+
(hF : ∀ x ∈ Set.uIoc a b, ‖F x‖ ≤ M)
|
| 90 |
+
(hG : ∀ x ∈ Set.uIoc a b, ‖G x‖ ≤ M)
|
| 91 |
+
(hψ : ∀ x ∈ Set.uIoc a b, ‖ψ x‖ ≤ 1) :
|
| 92 |
+
‖∫ x in a..b, (F x ^ 3 - G x ^ 3) * ψ x‖ ≤
|
| 93 |
+
3 * E * M ^ 2 * |b - a| := by
|
| 94 |
+
apply intervalIntegral.norm_integral_le_of_norm_le_const
|
| 95 |
+
intro x hx
|
| 96 |
+
have hbound : ‖F x ^ 3 - G x ^ 3‖ ≤ 3 * E * M ^ 2 := by
|
| 97 |
+
convert norm_cube_sub_cube_le_of_bounds (F x) (G x) hE hM hM
|
| 98 |
+
(hdiff x hx) (hF x hx) (hG x hx) using 1
|
| 99 |
+
ring
|
| 100 |
+
rw [norm_mul]
|
| 101 |
+
calc
|
| 102 |
+
_ ≤ (3 * E * M ^ 2) * 1 :=
|
| 103 |
+
mul_le_mul hbound (hψ x hx) (norm_nonneg _) (by positivity)
|
| 104 |
+
_ = _ := mul_one _
|
| 105 |
+
|
| 106 |
+
end Problem337.ThreePrimeCubicStability
|
| 107 |
+
|
| 108 |
+
end
|
| 109 |
+
|
| 110 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeEulerProduct.lean
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeSingularSeries
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
/-- The standard ternary local Euler factor, extended by one at nonprimes. -/
|
| 10 |
+
def ternaryEulerFactor (u p : ℕ) : ℝ :=
|
| 11 |
+
if p.Prime then
|
| 12 |
+
if p ∣ u then 1 - 1 / ((p : ℝ) - 1) ^ 2
|
| 13 |
+
else 1 + 1 / ((p : ℝ) - 1) ^ 3
|
| 14 |
+
else 1
|
| 15 |
+
|
| 16 |
+
lemma ternaryEulerFactor_add_three (u n : ℕ) :
|
| 17 |
+
ternaryEulerFactor u (n + 3) = 1 + threePrimeOddPerturbation u n := by
|
| 18 |
+
have heq : ((n + 3 : ℕ) : ℝ) - 1 = (n : ℝ) + 2 := by push_cast; ring
|
| 19 |
+
unfold ternaryEulerFactor threePrimeOddPerturbation
|
| 20 |
+
rw [heq]
|
| 21 |
+
split_ifs <;> ring
|
| 22 |
+
|
| 23 |
+
lemma ternaryEulerFactor_two (u : ℕ) :
|
| 24 |
+
ternaryEulerFactor u 2 = if Odd u then 2 else 0 := by
|
| 25 |
+
unfold ternaryEulerFactor
|
| 26 |
+
norm_num only [Nat.prime_two, ite_true, Nat.cast_ofNat]
|
| 27 |
+
by_cases h : 2 ∣ u
|
| 28 |
+
· have hn : ¬ Odd u := fun ho =>
|
| 29 |
+
(Nat.not_even_iff_odd.mpr ho) (even_iff_two_dvd.mpr h)
|
| 30 |
+
norm_num [h, hn]
|
| 31 |
+
· have ho : Odd u := Nat.not_even_iff_odd.mp
|
| 32 |
+
(fun he => h (even_iff_two_dvd.mp he))
|
| 33 |
+
norm_num [h, ho]
|
| 34 |
+
|
| 35 |
+
lemma ternaryEulerFactor_prefix (u : ℕ) :
|
| 36 |
+
(∏ p ∈ Finset.range 3, ternaryEulerFactor u p) = if Odd u then 2 else 0 := by
|
| 37 |
+
simp only [Finset.prod_range_succ, Finset.prod_range_zero, one_mul]
|
| 38 |
+
have h0 : ternaryEulerFactor u 0 = 1 := by simp [ternaryEulerFactor, Nat.not_prime_zero]
|
| 39 |
+
have h1 : ternaryEulerFactor u 1 = 1 := by simp [ternaryEulerFactor]
|
| 40 |
+
rw [h0, h1, one_mul, one_mul, ternaryEulerFactor_two]
|
| 41 |
+
|
| 42 |
+
lemma ternaryEulerFactor_tail_multipliable (u : ℕ) :
|
| 43 |
+
Multipliable (fun n : ℕ => ternaryEulerFactor u (n + 3)) := by
|
| 44 |
+
exact (threePrimeOddFactors_multipliable u).congr
|
| 45 |
+
(fun n => (ternaryEulerFactor_add_three u n).symm)
|
| 46 |
+
|
| 47 |
+
lemma ternaryEulerFactor_multipliable (u : ℕ) :
|
| 48 |
+
Multipliable (ternaryEulerFactor u) :=
|
| 49 |
+
(ternaryEulerFactor_tail_multipliable u).comp_nat_add
|
| 50 |
+
|
| 51 |
+
/-- The shifted odd-prime definition is exactly the conventional Euler
|
| 52 |
+
product, including the vanishing local factor at two for even inputs. -/
|
| 53 |
+
theorem threePrimeSingularSeries_eq_euler_tprod (u : ℕ) :
|
| 54 |
+
threePrimeSingularSeries u = ∏' p : ℕ, ternaryEulerFactor u p := by
|
| 55 |
+
calc
|
| 56 |
+
threePrimeSingularSeries u = (if Odd u then 2 else 0) *
|
| 57 |
+
∏' n : ℕ, ternaryEulerFactor u (n + 3) := by
|
| 58 |
+
unfold threePrimeSingularSeries
|
| 59 |
+
congr 1
|
| 60 |
+
exact tprod_congr (fun n => (ternaryEulerFactor_add_three u n).symm)
|
| 61 |
+
_ = (∏ p ∈ Finset.range 3, ternaryEulerFactor u p) *
|
| 62 |
+
∏' n : ℕ, ternaryEulerFactor u (n + 3) := by rw [ternaryEulerFactor_prefix]
|
| 63 |
+
_ = ∏' p : ℕ, ternaryEulerFactor u p :=
|
| 64 |
+
(ternaryEulerFactor_tail_multipliable u).prod_mul_tprod_nat_mul'
|
| 65 |
+
|
| 66 |
+
/-- Removing the factors equal to one at nonprimes recovers the usual
|
| 67 |
+
prime-indexed singular series. This identity is valid for all natural inputs. -/
|
| 68 |
+
theorem threePrimeSingularSeries_eq_prime_tprod (u : ℕ) :
|
| 69 |
+
threePrimeSingularSeries u = ∏' p : {p : ℕ // p.Prime},
|
| 70 |
+
(if p.val ∣ u then 1 - 1 / ((p.val : ℝ) - 1) ^ 2
|
| 71 |
+
else 1 + 1 / ((p.val : ℝ) - 1) ^ 3) := by
|
| 72 |
+
have hs : Function.mulSupport (ternaryEulerFactor u) ⊆ {p : ℕ | p.Prime} := by
|
| 73 |
+
intro p hp
|
| 74 |
+
by_contra hn
|
| 75 |
+
change ¬ p.Prime at hn
|
| 76 |
+
exact hp (by simp [ternaryEulerFactor, hn])
|
| 77 |
+
rw [threePrimeSingularSeries_eq_euler_tprod,
|
| 78 |
+
← tprod_subtype_eq_of_mulSupport_subset hs]
|
| 79 |
+
apply tprod_congr
|
| 80 |
+
intro p
|
| 81 |
+
have hp : Nat.Prime (p : ℕ) := p.property
|
| 82 |
+
simp only [ternaryEulerFactor, hp, ite_true]
|
| 83 |
+
|
| 84 |
+
lemma threePrimeSingularSeries_eq_zero_of_even {u : ℕ} (hu : Even u) :
|
| 85 |
+
threePrimeSingularSeries u = 0 := by
|
| 86 |
+
have hn : ¬ Odd u := fun ho => Nat.not_even_iff_odd.mpr ho hu
|
| 87 |
+
simp [threePrimeSingularSeries, hn]
|
| 88 |
+
|
| 89 |
+
end Problem337
|
| 90 |
+
|
| 91 |
+
end
|
| 92 |
+
|
| 93 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeEulerTail.lean
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
|
| 7 |
+
namespace Problem337.ThreePrimeEulerTail
|
| 8 |
+
|
| 9 |
+
/-- A reciprocal-square tail is bounded by a telescoping reciprocal tail.
|
| 10 |
+
The statement is for arbitrary finite sets, hence also for sets of primes. -/
|
| 11 |
+
theorem reciprocal_square_tail (P : Finset ℕ) (N : ℕ) (hN : 2 ≤ N)
|
| 12 |
+
(hP : ∀ p ∈ P, N < p) :
|
| 13 |
+
(∑ p ∈ P, 1 / ((p : ℝ) - 1) ^ 2) ≤ 1 / ((N : ℝ) - 1) := by
|
| 14 |
+
classical
|
| 15 |
+
by_cases hempty : P = ∅
|
| 16 |
+
· subst P
|
| 17 |
+
simp only [Finset.sum_empty]
|
| 18 |
+
apply one_div_nonneg.mpr
|
| 19 |
+
have : (2 : ℝ) ≤ N := by exact_mod_cast hN
|
| 20 |
+
linarith
|
| 21 |
+
have hne : P.Nonempty := Finset.nonempty_iff_ne_empty.mpr hempty
|
| 22 |
+
let M := P.max' hne
|
| 23 |
+
have hNM : N < M := hP M (Finset.max'_mem P hne)
|
| 24 |
+
have hsub : P ⊆ Finset.Ico (N + 1) (M + 1) := by
|
| 25 |
+
intro p hp
|
| 26 |
+
exact Finset.mem_Ico.mpr ⟨by have := hP p hp; omega,
|
| 27 |
+
by have := Finset.le_max' P p hp; omega⟩
|
| 28 |
+
have hpoint (p : ℕ) (hp : p ∈ Finset.Ico (N + 1) (M + 1)) :
|
| 29 |
+
1 / ((p : ℝ) - 1) ^ 2 ≤
|
| 30 |
+
1 / ((p : ℝ) - 2) - 1 / (((p + 1 : ℕ) : ℝ) - 2) := by
|
| 31 |
+
have hp3 : 3 ≤ p := by have := (Finset.mem_Ico.mp hp).1; omega
|
| 32 |
+
have hpR : (3 : ℝ) ≤ p := by exact_mod_cast hp3
|
| 33 |
+
have hp1 : 0 < (p : ℝ) - 1 := by linarith
|
| 34 |
+
have hp2 : 0 < (p : ℝ) - 2 := by linarith
|
| 35 |
+
push_cast
|
| 36 |
+
have heq : (p : ℝ) + 1 - 2 = (p : ℝ) - 1 := by ring
|
| 37 |
+
rw [heq]
|
| 38 |
+
field_simp
|
| 39 |
+
nlinarith
|
| 40 |
+
calc
|
| 41 |
+
_ ≤ ∑ p ∈ Finset.Ico (N + 1) (M + 1), 1 / ((p : ℝ) - 1) ^ 2 :=
|
| 42 |
+
Finset.sum_le_sum_of_subset_of_nonneg hsub (by intros; positivity)
|
| 43 |
+
_ ≤ ∑ p ∈ Finset.Ico (N + 1) (M + 1),
|
| 44 |
+
(1 / ((p : ℝ) - 2) - 1 / (((p + 1 : ℕ) : ℝ) - 2)) :=
|
| 45 |
+
Finset.sum_le_sum hpoint
|
| 46 |
+
_ = 1 / (((N + 1 : ℕ) : ℝ) - 2) -
|
| 47 |
+
1 / (((M + 1 : ℕ) : ℝ) - 2) := by
|
| 48 |
+
have htel := Finset.sum_Ico_sub (fun p : ℕ => -(1 / ((p : ℝ) - 2)))
|
| 49 |
+
(show N + 1 ≤ M + 1 by omega)
|
| 50 |
+
simpa only [neg_sub_neg] using htel
|
| 51 |
+
_ ≤ 1 / ((N : ℝ) - 1) := by
|
| 52 |
+
have hM : (2 : ℝ) ≤ M := by exact_mod_cast (show 2 ≤ M by omega)
|
| 53 |
+
have hpos : 0 ≤ 1 / (((M + 1 : ℕ) : ℝ) - 2) := by
|
| 54 |
+
apply one_div_nonneg.mpr
|
| 55 |
+
push_cast
|
| 56 |
+
linarith
|
| 57 |
+
push_cast at *
|
| 58 |
+
have heq : (N : ℝ) + 1 - 2 = (N : ℝ) - 1 := by ring
|
| 59 |
+
rw [heq]
|
| 60 |
+
linarith
|
| 61 |
+
|
| 62 |
+
/-- Uniform finite Euler-tail error from the standard local-factor defect bound. -/
|
| 63 |
+
theorem product_tail_abs_sub_one (f : ℕ → ℝ) (P : Finset ℕ)
|
| 64 |
+
(N : ℕ) (hN : 2 ≤ N) (hP : ∀ p ∈ P, N < p)
|
| 65 |
+
(hf : ∀ p ∈ P, |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2) :
|
| 66 |
+
|(∏ p ∈ P, f p) - 1| ≤ 2 / ((N : ℝ) - 1) := by
|
| 67 |
+
have hsum : (∑ p ∈ P, |f p - 1|) ≤ 1 / ((N : ℝ) - 1) :=
|
| 68 |
+
(Finset.sum_le_sum hf).trans (reciprocal_square_tail P N hN hP)
|
| 69 |
+
have hNreal : (2 : ℝ) ≤ N := by exact_mod_cast hN
|
| 70 |
+
have hden : 0 < (N : ℝ) - 1 := by linarith
|
| 71 |
+
have hsmall : |1 / ((N : ℝ) - 1)| ≤ 1 := by
|
| 72 |
+
rw [abs_of_nonneg (by positivity)]
|
| 73 |
+
exact (div_le_one hden).mpr (by linarith)
|
| 74 |
+
have hprod := P.norm_prod_one_add_sub_one_le (fun p => f p - 1)
|
| 75 |
+
simp only [add_sub_cancel, Real.norm_eq_abs] at hprod
|
| 76 |
+
calc
|
| 77 |
+
_ ≤ Real.exp (∑ p ∈ P, |f p - 1|) - 1 := hprod
|
| 78 |
+
_ ≤ Real.exp (1 / ((N : ℝ) - 1)) - 1 := sub_le_sub_right (Real.exp_le_exp.mpr hsum) 1
|
| 79 |
+
_ ≤ |Real.exp (1 / ((N : ℝ) - 1)) - 1| := le_abs_self _
|
| 80 |
+
_ ≤ 2 * |1 / ((N : ℝ) - 1)| := Real.abs_exp_sub_one_le hsmall
|
| 81 |
+
_ = 2 / ((N : ℝ) - 1) := by rw [abs_of_nonneg (by positivity)]; ring
|
| 82 |
+
|
| 83 |
+
/-- The local-factor defect majorant gives absolute summability without imposing
|
| 84 |
+
any condition on the finitely many initial factors. -/
|
| 85 |
+
theorem summable_abs_sub_one (f : ℕ → ℝ)
|
| 86 |
+
(hf : ∀ p : ℕ, 3 ≤ p → |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2) :
|
| 87 |
+
Summable (fun p => |f p - 1|) := by
|
| 88 |
+
have hseries : Summable (fun n : ℕ => 1 / (n : ℝ) ^ 2) :=
|
| 89 |
+
Real.summable_one_div_nat_pow.mpr (by norm_num)
|
| 90 |
+
have hshift := (summable_nat_add_iff 2).mpr hseries
|
| 91 |
+
apply (summable_nat_add_iff 3).mp
|
| 92 |
+
apply hshift.of_nonneg_of_le (fun n => abs_nonneg _)
|
| 93 |
+
intro n
|
| 94 |
+
have h := hf (n + 3) (by omega)
|
| 95 |
+
convert h using 1
|
| 96 |
+
push_cast
|
| 97 |
+
ring
|
| 98 |
+
|
| 99 |
+
/-- Absolute summability of the local defects defines a genuine Euler product. -/
|
| 100 |
+
theorem multipliable (f : ℕ → ℝ)
|
| 101 |
+
(hf : ∀ p : ℕ, 3 ≤ p → |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2) :
|
| 102 |
+
Multipliable f := by
|
| 103 |
+
have hsum : Summable (fun p => f p - 1) := by
|
| 104 |
+
apply Summable.of_norm
|
| 105 |
+
simpa only [Real.norm_eq_abs] using summable_abs_sub_one f hf
|
| 106 |
+
simpa only [add_sub_cancel] using Real.multipliable_one_add_of_summable hsum
|
| 107 |
+
|
| 108 |
+
/-- A partial Euler product approximates its infinite product with an explicit
|
| 109 |
+
relative error. Only the universal local defect estimate is needed. -/
|
| 110 |
+
theorem tprod_sub_partial_abs_le (f : ℕ → ℝ)
|
| 111 |
+
(hf : ∀ p : ℕ, 3 ≤ p → |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2)
|
| 112 |
+
(N : ℕ) (hN : 2 ≤ N) :
|
| 113 |
+
|(∏' p, f p) - ∏ p ∈ Finset.range (N + 1), f p| ≤
|
| 114 |
+
|∏ p ∈ Finset.range (N + 1), f p| * (2 / ((N : ℝ) - 1)) := by
|
| 115 |
+
apply le_of_tendsto (((multipliable f hf).hasProd.tendsto_prod_nat.sub_const
|
| 116 |
+
(∏ p ∈ Finset.range (N + 1), f p)).abs)
|
| 117 |
+
filter_upwards [Filter.eventually_ge_atTop (N + 1)] with M hNM
|
| 118 |
+
rw [← Finset.prod_range_mul_prod_Ico f hNM]
|
| 119 |
+
have heq : (∏ p ∈ Finset.range (N + 1), f p) *
|
| 120 |
+
(∏ p ∈ Finset.Ico (N + 1) M, f p) -
|
| 121 |
+
(∏ p ∈ Finset.range (N + 1), f p) =
|
| 122 |
+
(∏ p ∈ Finset.range (N + 1), f p) *
|
| 123 |
+
((∏ p ∈ Finset.Ico (N + 1) M, f p) - 1) := by ring
|
| 124 |
+
rw [heq, abs_mul]
|
| 125 |
+
apply mul_le_mul_of_nonneg_left _ (abs_nonneg _)
|
| 126 |
+
apply product_tail_abs_sub_one f _ N hN
|
| 127 |
+
· intro p hp
|
| 128 |
+
have := (Finset.mem_Ico.mp hp).1
|
| 129 |
+
omega
|
| 130 |
+
· intro p hp
|
| 131 |
+
apply hf
|
| 132 |
+
have := (Finset.mem_Ico.mp hp).1
|
| 133 |
+
omega
|
| 134 |
+
|
| 135 |
+
/-- All partial products are bounded by three times their first three factors.
|
| 136 |
+
This estimate is uniform in any external parameter of the local factors. -/
|
| 137 |
+
theorem partial_abs_le (f : ℕ → ℝ)
|
| 138 |
+
(hf : ∀ p : ℕ, 3 ≤ p → |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2)
|
| 139 |
+
(N : ℕ) (hN : 2 ≤ N) :
|
| 140 |
+
|∏ p ∈ Finset.range (N + 1), f p| ≤
|
| 141 |
+
3 * |∏ p ∈ Finset.range 3, f p| := by
|
| 142 |
+
rw [← Finset.prod_range_mul_prod_Ico f (show 3 ≤ N + 1 by omega), abs_mul]
|
| 143 |
+
have htail := product_tail_abs_sub_one f (Finset.Ico 3 (N + 1)) 2 (by omega)
|
| 144 |
+
(by intro p hp; have := (Finset.mem_Ico.mp hp).1; omega)
|
| 145 |
+
(by intro p hp; exact hf p (Finset.mem_Ico.mp hp).1)
|
| 146 |
+
norm_num only [Nat.cast_ofNat, sub_self, one_div, Nat.cast_one, sub_zero] at htail
|
| 147 |
+
have hbound : |∏ p ∈ Finset.Ico 3 (N + 1), f p| ≤ 3 := by
|
| 148 |
+
calc
|
| 149 |
+
_ = |((∏ p ∈ Finset.Ico 3 (N + 1), f p) - 1) + 1| := by ring_nf
|
| 150 |
+
_ ≤ |(∏ p ∈ Finset.Ico 3 (N + 1), f p) - 1| + |(1 : ℝ)| := abs_add_le _ _
|
| 151 |
+
_ ≤ 3 := by norm_num at htail ⊢; linarith
|
| 152 |
+
nlinarith [abs_nonneg (∏ p ∈ Finset.range 3, f p)]
|
| 153 |
+
|
| 154 |
+
/-- Uniform O(1/N) truncation error, stated with a bound for the only three
|
| 155 |
+
uncontrolled initial local factors. -/
|
| 156 |
+
theorem tprod_sub_partial_abs_le_uniform (f : ℕ → ℝ)
|
| 157 |
+
(hf : ∀ p : ℕ, 3 ≤ p → |f p - 1| ≤ 1 / ((p : ℝ) - 1) ^ 2)
|
| 158 |
+
(B : ℝ) (hB : |∏ p ∈ Finset.range 3, f p| ≤ B)
|
| 159 |
+
(N : ℕ) (hN : 2 ≤ N) :
|
| 160 |
+
|(∏' p, f p) - ∏ p ∈ Finset.range (N + 1), f p| ≤
|
| 161 |
+
6 * B / ((N : ℝ) - 1) := by
|
| 162 |
+
have hNR : (2 : ℝ) ≤ N := by exact_mod_cast hN
|
| 163 |
+
have hden : 0 < (N : ℝ) - 1 := by linarith
|
| 164 |
+
calc
|
| 165 |
+
_ ≤ |∏ p ∈ Finset.range (N + 1), f p| * (2 / ((N : ℝ) - 1)) :=
|
| 166 |
+
tprod_sub_partial_abs_le f hf N hN
|
| 167 |
+
_ ≤ (3 * B) * (2 / ((N : ℝ) - 1)) := by
|
| 168 |
+
apply mul_le_mul_of_nonneg_right _ (by positivity)
|
| 169 |
+
exact (partial_abs_le f hf N hN).trans (mul_le_mul_of_nonneg_left hB (by norm_num))
|
| 170 |
+
_ = 6 * B / ((N : ℝ) - 1) := by ring
|
| 171 |
+
|
| 172 |
+
end Problem337.ThreePrimeEulerTail
|
| 173 |
+
|
| 174 |
+
end
|
| 175 |
+
|
| 176 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourier.lean
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.RationalSupplyReduction
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
|
| 7 |
+
namespace Problem337.ThreePrimeFourier
|
| 8 |
+
|
| 9 |
+
/-- Exact Fourier extraction of a weighted ordered triple in a finite cyclic
|
| 10 |
+
group. No primality or analytic estimate is needed. -/
|
| 11 |
+
theorem weighted_triple_character_identity {q : ℕ} [NeZero q]
|
| 12 |
+
{α : Type*} (s : Finset α) (f : α → ZMod q) (w : α → ℂ)
|
| 13 |
+
(u : ZMod q) :
|
| 14 |
+
(∑ r : ZMod q, (∑ a ∈ s, w a * ZMod.stdAddChar (f a * r)) ^ 3 *
|
| 15 |
+
ZMod.stdAddChar (-u * r)) =
|
| 16 |
+
(q : ℂ) * ∑ a ∈ s, ∑ b ∈ s, ∑ c ∈ s,
|
| 17 |
+
if f a + f b + f c = u then w a * w b * w c else 0 := by
|
| 18 |
+
classical
|
| 19 |
+
have hexpand (r : ZMod q) :
|
| 20 |
+
(∑ a ∈ s, w a * ZMod.stdAddChar (f a * r)) ^ 3 *
|
| 21 |
+
ZMod.stdAddChar (-u * r) =
|
| 22 |
+
∑ a ∈ s, ∑ b ∈ s, ∑ c ∈ s,
|
| 23 |
+
(w a * w b * w c) * ZMod.stdAddChar ((f a + f b + f c - u) * r) := by
|
| 24 |
+
calc
|
| 25 |
+
_ = ((∑ a ∈ s, w a * ZMod.stdAddChar (f a * r)) *
|
| 26 |
+
(∑ b ∈ s, w b * ZMod.stdAddChar (f b * r)) *
|
| 27 |
+
(∑ c ∈ s, w c * ZMod.stdAddChar (f c * r))) *
|
| 28 |
+
ZMod.stdAddChar (-u * r) := by ring
|
| 29 |
+
_ = _ := by
|
| 30 |
+
simp only [Finset.sum_mul, Finset.mul_sum]
|
| 31 |
+
apply Finset.sum_congr rfl
|
| 32 |
+
intro a ha
|
| 33 |
+
apply Finset.sum_congr rfl
|
| 34 |
+
intro b hb
|
| 35 |
+
apply Finset.sum_congr rfl
|
| 36 |
+
intro c hc
|
| 37 |
+
rw [sub_mul, add_mul, add_mul, sub_eq_add_neg,
|
| 38 |
+
AddChar.map_add_eq_mul, AddChar.map_add_eq_mul, AddChar.map_add_eq_mul]
|
| 39 |
+
rw [neg_mul]
|
| 40 |
+
ring
|
| 41 |
+
simp_rw [hexpand]
|
| 42 |
+
rw [Finset.sum_comm]
|
| 43 |
+
calc
|
| 44 |
+
_ = ∑ a ∈ s, ∑ b ∈ s, ∑ c ∈ s,
|
| 45 |
+
∑ r : ZMod q,
|
| 46 |
+
(w a * w b * w c) * ZMod.stdAddChar ((f a + f b + f c - u) * r) := by
|
| 47 |
+
apply Finset.sum_congr rfl
|
| 48 |
+
intro a ha
|
| 49 |
+
rw [Finset.sum_comm]
|
| 50 |
+
apply Finset.sum_congr rfl
|
| 51 |
+
intro b hb
|
| 52 |
+
rw [Finset.sum_comm]
|
| 53 |
+
_ = _ := by
|
| 54 |
+
simp_rw [← Finset.mul_sum, FiveProducts.character_sum, sub_eq_zero]
|
| 55 |
+
simp only [Finset.mul_sum]
|
| 56 |
+
apply Finset.sum_congr rfl
|
| 57 |
+
intro a ha
|
| 58 |
+
apply Finset.sum_congr rfl
|
| 59 |
+
intro b hb
|
| 60 |
+
apply Finset.sum_congr rfl
|
| 61 |
+
intro c hc
|
| 62 |
+
split_ifs <;> ring
|
| 63 |
+
|
| 64 |
+
/-- Choosing the cyclic modulus above every possible sum removes all modular
|
| 65 |
+
aliasing. The resulting identity counts ordinary natural-number sums exactly. -/
|
| 66 |
+
theorem weighted_natural_triple_character_identity {q : ℕ} [NeZero q]
|
| 67 |
+
(s : Finset ℕ) (w : ℕ → ℂ) (u : ℕ)
|
| 68 |
+
(hs : ∀ a ∈ s, a ≤ u) (hq : 3 * u < q) :
|
| 69 |
+
(∑ r : ZMod q, (∑ a ∈ s, w a * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 70 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)) =
|
| 71 |
+
(q : ℂ) * ∑ a ∈ s, ∑ b ∈ s, ∑ c ∈ s,
|
| 72 |
+
if a + b + c = u then w a * w b * w c else 0 := by
|
| 73 |
+
classical
|
| 74 |
+
rw [weighted_triple_character_identity]
|
| 75 |
+
congr 1
|
| 76 |
+
apply Finset.sum_congr rfl
|
| 77 |
+
intro a ha
|
| 78 |
+
apply Finset.sum_congr rfl
|
| 79 |
+
intro b hb
|
| 80 |
+
apply Finset.sum_congr rfl
|
| 81 |
+
intro c hc
|
| 82 |
+
have habc : a + b + c < q := by
|
| 83 |
+
have := hs a ha
|
| 84 |
+
have := hs b hb
|
| 85 |
+
have := hs c hc
|
| 86 |
+
omega
|
| 87 |
+
have hu : u < q := by omega
|
| 88 |
+
have heq : (a : ZMod q) + (b : ZMod q) + (c : ZMod q) = (u : ZMod q) ↔
|
| 89 |
+
a + b + c = u := by
|
| 90 |
+
rw [← Nat.cast_add, ← Nat.cast_add, ZMod.natCast_eq_natCast_iff',
|
| 91 |
+
Nat.mod_eq_of_lt habc, Nat.mod_eq_of_lt hu]
|
| 92 |
+
simp only [heq]
|
| 93 |
+
|
| 94 |
+
/-- Normalized inverse Fourier extraction for weighted ordinary triples. -/
|
| 95 |
+
theorem weighted_natural_triple_fourier {q : ℕ} [NeZero q]
|
| 96 |
+
(s : Finset ℕ) (w : ℕ → ℂ) (u : ℕ)
|
| 97 |
+
(hs : ∀ a ∈ s, a ≤ u) (hq : 3 * u < q) :
|
| 98 |
+
(∑ a ∈ s, ∑ b ∈ s, ∑ c ∈ s,
|
| 99 |
+
if a + b + c = u then w a * w b * w c else 0) =
|
| 100 |
+
(∑ r : ZMod q, (∑ a ∈ s, w a * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 101 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)) / (q : ℂ) := by
|
| 102 |
+
apply (eq_div_iff (NeZero.ne (q : ℂ))).2
|
| 103 |
+
simpa only [mul_comm] using
|
| 104 |
+
(weighted_natural_triple_character_identity s w u hs hq).symm
|
| 105 |
+
|
| 106 |
+
/-- The existing ordered-prime-triple finset is exactly the filtered cube
|
| 107 |
+
of the primes at most `u`. This identity also applies to arbitrary weights. -/
|
| 108 |
+
theorem supply_prime_triple_sum_eq_nested (u : ℕ) (w : ℕ → ℂ) :
|
| 109 |
+
(∑ t ∈ supplyPrimeTriples u, w t.1 * w t.2.1 * w t.2.2) =
|
| 110 |
+
∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 111 |
+
∑ b ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 112 |
+
∑ c ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 113 |
+
if a + b + c = u then w a * w b * w c else 0 := by
|
| 114 |
+
classical
|
| 115 |
+
let s := (Finset.Icc 1 u).filter Nat.Prime
|
| 116 |
+
have hset : ((s ×ˢ (s ×ˢ s)).filter
|
| 117 |
+
(fun t : ℕ × ℕ × ℕ => t.1 + t.2.1 + t.2.2 = u)) =
|
| 118 |
+
supplyPrimeTriples u := by
|
| 119 |
+
ext t
|
| 120 |
+
simp only [s, supplyPrimeTriples, Finset.mem_filter, Finset.mem_product]
|
| 121 |
+
tauto
|
| 122 |
+
rw [← hset]
|
| 123 |
+
simp only [Finset.sum_filter, Finset.sum_product, s]
|
| 124 |
+
|
| 125 |
+
/-- Exact extraction of the log-weighted prime count that occurs in the
|
| 126 |
+
three-prime lower bound. The modulus condition excludes all circular sums. -/
|
| 127 |
+
theorem supply_prime_weighted_fourier {q : ℕ} [NeZero q]
|
| 128 |
+
(u : ℕ) (hq : 3 * u < q) :
|
| 129 |
+
(∑ t ∈ supplyPrimeTriples u,
|
| 130 |
+
(Real.log (t.1 : ℝ) : ℂ) * (Real.log (t.2.1 : ℝ) : ℂ) *
|
| 131 |
+
(Real.log (t.2.2 : ℝ) : ℂ)) =
|
| 132 |
+
(∑ r : ZMod q,
|
| 133 |
+
(∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 134 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 135 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)) / (q : ℂ) := by
|
| 136 |
+
rw [supply_prime_triple_sum_eq_nested u (fun a => (Real.log (a : ℝ) : ℂ))]
|
| 137 |
+
apply weighted_natural_triple_fourier _ _ _ _ hq
|
| 138 |
+
intro a ha
|
| 139 |
+
exact (Finset.mem_Icc.mp (Finset.mem_filter.mp ha).1).2
|
| 140 |
+
|
| 141 |
+
/-- Real-part version of the exact extraction formula. -/
|
| 142 |
+
theorem supply_prime_weighted_fourier_re {q : ℕ} [NeZero q]
|
| 143 |
+
(u : ℕ) (hq : 3 * u < q) :
|
| 144 |
+
(∑ t ∈ supplyPrimeTriples u,
|
| 145 |
+
Real.log (t.1 : ℝ) * Real.log (t.2.1 : ℝ) * Real.log (t.2.2 : ℝ)) =
|
| 146 |
+
(∑ r : ZMod q,
|
| 147 |
+
(∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 148 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 149 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)).re / (q : ℝ) := by
|
| 150 |
+
have h := congrArg Complex.re (supply_prime_weighted_fourier u hq)
|
| 151 |
+
simpa only [Complex.re_sum, ← Complex.ofReal_mul, Complex.ofReal_re,
|
| 152 |
+
← Complex.ofReal_natCast, Complex.div_ofReal_re] using h
|
| 153 |
+
|
| 154 |
+
/-- Splitting frequencies into an arbitrary major set and its complement
|
| 155 |
+
gives the standard lower bound by the major real part minus the minor norm. -/
|
| 156 |
+
theorem major_minor_real_lower_bound {α : Type*} [Fintype α] [DecidableEq α]
|
| 157 |
+
(s : Finset α) (F : α → ℂ) (Q : ℝ) (hQ : 0 < Q) :
|
| 158 |
+
((∑ r ∈ s, F r).re - ‖∑ r ∈ sᶜ, F r‖) / Q ≤
|
| 159 |
+
(∑ r, F r).re / Q := by
|
| 160 |
+
classical
|
| 161 |
+
apply div_le_div_of_nonneg_right _ hQ.le
|
| 162 |
+
rw [← Finset.sum_add_sum_compl s F, Complex.add_re]
|
| 163 |
+
have h := Complex.re_le_norm (-(∑ r ∈ sᶜ, F r))
|
| 164 |
+
simp only [Complex.neg_re, norm_neg] at h
|
| 165 |
+
linarith
|
| 166 |
+
|
| 167 |
+
/-- A lower major-frequency bound and an upper minor-frequency norm bound
|
| 168 |
+
imply a lower bound for the actual log-weighted ordered-prime-triple count.
|
| 169 |
+
The genuinely analytic estimates remain explicit hypotheses. -/
|
| 170 |
+
theorem supply_prime_weighted_lower_of_major_minor {q : ℕ} [NeZero q]
|
| 171 |
+
(u : ℕ) (hq : 3 * u < q) (major : Finset (ZMod q))
|
| 172 |
+
(A E : ℝ)
|
| 173 |
+
(hmajor : A * (q : ℝ) ≤
|
| 174 |
+
(∑ r ∈ major,
|
| 175 |
+
(∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 176 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 177 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)).re)
|
| 178 |
+
(hminor : ‖∑ r ∈ majorᶜ,
|
| 179 |
+
(∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 180 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 181 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)‖ ≤ E * (q : ℝ)) :
|
| 182 |
+
A - E ≤ ∑ t ∈ supplyPrimeTriples u,
|
| 183 |
+
Real.log (t.1 : ℝ) * Real.log (t.2.1 : ℝ) * Real.log (t.2.2 : ℝ) := by
|
| 184 |
+
classical
|
| 185 |
+
have hqpos : (0 : ℝ) < q := by exact_mod_cast (Nat.pos_of_ne_zero (NeZero.ne q))
|
| 186 |
+
rw [supply_prime_weighted_fourier_re u hq]
|
| 187 |
+
let F : ZMod q → ℂ := fun r =>
|
| 188 |
+
(∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 189 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod q) * r)) ^ 3 *
|
| 190 |
+
ZMod.stdAddChar (-(u : ZMod q) * r)
|
| 191 |
+
change A - E ≤ (∑ r, F r).re / (q : ℝ)
|
| 192 |
+
have hsplit := major_minor_real_lower_bound major F (q : ℝ) hqpos
|
| 193 |
+
refine le_trans ?_ hsplit
|
| 194 |
+
apply (le_div_iff₀ hqpos).2
|
| 195 |
+
change A * (q : ℝ) ≤ (∑ r ∈ major, F r).re at hmajor
|
| 196 |
+
change ‖∑ r ∈ majorᶜ, F r‖ ≤ E * (q : ℝ) at hminor
|
| 197 |
+
nlinarith
|
| 198 |
+
|
| 199 |
+
end Problem337.ThreePrimeFourier
|
| 200 |
+
|
| 201 |
+
end
|
| 202 |
+
|
| 203 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourierBundle.lean
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeFourierReduction
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeContinuousMinorArc
|
| 3 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeIntegralCount
|
| 4 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMangoldtIntegral
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeFourierReduction.lean
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeFourier
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeWeighted
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
open Filter
|
| 8 |
+
|
| 9 |
+
namespace Problem337.ThreePrimeFourier
|
| 10 |
+
|
| 11 |
+
/-- The ordinary positive-sign prime exponential sum, at the zero-padded
|
| 12 |
+
cyclic modulus `3*u+1`. -/
|
| 13 |
+
def primeFourierSum (u : ℕ) (r : ZMod (3 * u + 1)) : ℂ :=
|
| 14 |
+
∑ a ∈ (Finset.Icc 1 u).filter Nat.Prime,
|
| 15 |
+
(Real.log (a : ℝ) : ℂ) * ZMod.stdAddChar ((a : ZMod (3 * u + 1)) * r)
|
| 16 |
+
|
| 17 |
+
/-- The cubic integrand extracting the ordered prime triples of sum `u`. -/
|
| 18 |
+
def primeFourierIntegrand (u : ℕ) (r : ZMod (3 * u + 1)) : ℂ :=
|
| 19 |
+
primeFourierSum u r ^ 3 * ZMod.stdAddChar (-(u : ZMod (3 * u + 1)) * r)
|
| 20 |
+
|
| 21 |
+
/-- The canonical weighted count is exactly the real inverse Fourier sum. -/
|
| 22 |
+
theorem weightedSupplyPrimeTriples_eq_fourier (u : ℕ) :
|
| 23 |
+
weightedSupplyPrimeTriples u =
|
| 24 |
+
(∑ r, primeFourierIntegrand u r).re / (3 * u + 1 : ℕ) := by
|
| 25 |
+
exact supply_prime_weighted_fourier_re u (by omega)
|
| 26 |
+
|
| 27 |
+
/-- The remaining quantitative three-prime assertion follows from explicit
|
| 28 |
+
major-frequency main terms and minor-frequency errors for the actual prime
|
| 29 |
+
exponential sums. This theorem does not assert either analytic estimate. -/
|
| 30 |
+
theorem quantitativeThreePrimeLowerBound_of_major_minor
|
| 31 |
+
(major : (u : ℕ) → Finset (ZMod (3 * u + 1)))
|
| 32 |
+
(c : ℝ) (hc : 0 < c)
|
| 33 |
+
(hmajor : ∀ᶠ u : ℕ in atTop, Odd u →
|
| 34 |
+
(2 * c * (u : ℝ) ^ 2) * (3 * u + 1 : ℕ) ≤
|
| 35 |
+
(∑ r ∈ major u, primeFourierIntegrand u r).re)
|
| 36 |
+
(hminor : ∀ᶠ u : ℕ in atTop, Odd u →
|
| 37 |
+
‖∑ r ∈ (major u)ᶜ, primeFourierIntegrand u r‖ ≤
|
| 38 |
+
(c * (u : ℝ) ^ 2) * (3 * u + 1 : ℕ)) :
|
| 39 |
+
QuantitativeThreePrimeLowerBound := by
|
| 40 |
+
apply quantitativeThreePrimeLowerBound_of_weighted
|
| 41 |
+
refine ⟨c, hc, ?_⟩
|
| 42 |
+
filter_upwards [hmajor, hminor] with u hma hmi
|
| 43 |
+
intro hu
|
| 44 |
+
have h := supply_prime_weighted_lower_of_major_minor u (by omega : 3 * u < 3 * u + 1)
|
| 45 |
+
(major u) (2 * c * (u : ℝ) ^ 2) (c * (u : ℝ) ^ 2) (hma hu) (hmi hu)
|
| 46 |
+
change 2 * c * (u : ℝ) ^ 2 - c * (u : ℝ) ^ 2 ≤ weightedSupplyPrimeTriples u at h
|
| 47 |
+
nlinarith
|
| 48 |
+
|
| 49 |
+
end Problem337.ThreePrimeFourier
|
| 50 |
+
|
| 51 |
+
end
|
| 52 |
+
|
| 53 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeIntegralCount.lean
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeContinuousFourier
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.RationalSupplyReduction
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337.ThreePrimeContinuousFourier
|
| 9 |
+
|
| 10 |
+
/-- Positive prime frequencies up to the integer under representation. -/
|
| 11 |
+
def primeFrequencies (u : ℕ) : Finset ℕ := (Finset.Icc 1 u).filter Nat.Prime
|
| 12 |
+
|
| 13 |
+
/-- The unweighted positive-sign prime exponential sum. -/
|
| 14 |
+
def primePhaseSum (u : ℕ) (x : ℝ) : ℂ :=
|
| 15 |
+
∑ p ∈ primeFrequencies u, phase (p : ℤ) x
|
| 16 |
+
|
| 17 |
+
lemma prime_triples_eq_filter (u : ℕ) :
|
| 18 |
+
supplyPrimeTriples u =
|
| 19 |
+
((primeFrequencies u) ×ˢ ((primeFrequencies u) ×ˢ (primeFrequencies u))).filter
|
| 20 |
+
(fun t => t.1 + t.2.1 + t.2.2 = u) := by
|
| 21 |
+
ext t
|
| 22 |
+
simp only [supplyPrimeTriples, primeFrequencies, Finset.mem_filter, Finset.mem_product]
|
| 23 |
+
tauto
|
| 24 |
+
|
| 25 |
+
/-- The exact prime-triple count is a continuous cubic Fourier coefficient.
|
| 26 |
+
This does not estimate the integral or assert a prime-distribution result. -/
|
| 27 |
+
theorem prime_triple_integral (u : ℕ) :
|
| 28 |
+
(∫ x in (0 : ℝ)..1, primePhaseSum u x ^ 3 * phase (-(u : ℤ)) x) =
|
| 29 |
+
((supplyPrimeTriples u).card : ℂ) := by
|
| 30 |
+
classical
|
| 31 |
+
have h := weighted_triple_finset_integral (primeFrequencies u)
|
| 32 |
+
(fun p : ℕ => (p : ℤ)) (fun _ => (1 : ℂ)) (u : ℤ)
|
| 33 |
+
simp only [one_mul, mul_one] at h
|
| 34 |
+
change (∫ x in (0 : ℝ)..1,
|
| 35 |
+
(∑ p ∈ primeFrequencies u, phase (p : ℤ) x) ^ 3 * phase (-(u : ℤ)) x) = _
|
| 36 |
+
rw [h, prime_triples_eq_filter]
|
| 37 |
+
simp only [Finset.card_eq_sum_ones, Nat.cast_sum, Finset.sum_filter,
|
| 38 |
+
Finset.sum_product]
|
| 39 |
+
apply Finset.sum_congr rfl
|
| 40 |
+
intro a ha
|
| 41 |
+
apply Finset.sum_congr rfl
|
| 42 |
+
intro b hb
|
| 43 |
+
apply Finset.sum_congr rfl
|
| 44 |
+
intro c hc
|
| 45 |
+
have heq : ((a : ℤ) + (b : ℤ) + (c : ℤ) = (u : ℤ)) ↔ a + b + c = u := by omega
|
| 46 |
+
simp [heq]
|
| 47 |
+
|
| 48 |
+
end Problem337.ThreePrimeContinuousFourier
|
| 49 |
+
|
| 50 |
+
end
|
| 51 |
+
|
| 52 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalDensity.lean
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337
|
| 9 |
+
|
| 10 |
+
/-- Nonzero residue classes modulo `p`. For prime `p`, these are exactly
|
| 11 |
+
its unit classes. -/
|
| 12 |
+
def threePrimeNonzeroResidues (p : ℕ) [NeZero p] : Finset (ZMod p) :=
|
| 13 |
+
Finset.univ.erase 0
|
| 14 |
+
|
| 15 |
+
/-- Two-coordinate parametrization of nonzero residue triples with sum `u`:
|
| 16 |
+
the third coordinate is `u - x - y`. -/
|
| 17 |
+
def threePrimeLocalPairs (p : ℕ) [NeZero p] (u : ZMod p) :
|
| 18 |
+
Finset (ZMod p × ZMod p) :=
|
| 19 |
+
(threePrimeNonzeroResidues p ×ˢ threePrimeNonzeroResidues p).filter
|
| 20 |
+
(fun t => t.1 + t.2 ≠ u)
|
| 21 |
+
|
| 22 |
+
lemma mem_threePrimeLocalPairs {p : ℕ} [NeZero p]
|
| 23 |
+
(u x y : ZMod p) :
|
| 24 |
+
(x, y) ∈ threePrimeLocalPairs p u ↔
|
| 25 |
+
x ≠ 0 ∧ y ≠ 0 ∧ u - x - y ≠ 0 := by
|
| 26 |
+
simp only [threePrimeLocalPairs, threePrimeNonzeroResidues,
|
| 27 |
+
Finset.mem_filter, Finset.mem_product, Finset.mem_erase,
|
| 28 |
+
Finset.mem_univ, and_true]
|
| 29 |
+
constructor
|
| 30 |
+
· rintro ⟨⟨hx, hy⟩, hsum⟩
|
| 31 |
+
refine ⟨hx, hy, ?_⟩
|
| 32 |
+
intro hz
|
| 33 |
+
apply hsum
|
| 34 |
+
linear_combination -hz
|
| 35 |
+
· rintro ⟨hx, hy, hz⟩
|
| 36 |
+
refine ⟨⟨hx, hy⟩, ?_⟩
|
| 37 |
+
intro hsum
|
| 38 |
+
apply hz
|
| 39 |
+
linear_combination -hsum
|
| 40 |
+
|
| 41 |
+
lemma threePrimeLocalBadPairs_eq_image {p : ℕ} [NeZero p] (u : ZMod p) :
|
| 42 |
+
(threePrimeNonzeroResidues p ×ˢ threePrimeNonzeroResidues p).filter
|
| 43 |
+
(fun t => t.1 + t.2 = u) =
|
| 44 |
+
((threePrimeNonzeroResidues p).erase u).image (fun x => (x, u - x)) := by
|
| 45 |
+
classical
|
| 46 |
+
ext t
|
| 47 |
+
rcases t with ⟨x, y⟩
|
| 48 |
+
simp only [threePrimeNonzeroResidues, Finset.mem_filter, Finset.mem_product,
|
| 49 |
+
Finset.mem_erase, Finset.mem_univ, and_true, Finset.mem_image, Prod.mk.injEq]
|
| 50 |
+
constructor
|
| 51 |
+
· rintro ⟨⟨hx, hy⟩, hsum⟩
|
| 52 |
+
refine ⟨x, ⟨?_, hx⟩, rfl, ?_⟩
|
| 53 |
+
· intro hxu
|
| 54 |
+
apply hy
|
| 55 |
+
linear_combination hsum - hxu
|
| 56 |
+
· linear_combination -hsum
|
| 57 |
+
· rintro ⟨a, ⟨hau, ha⟩, hax, hay⟩
|
| 58 |
+
subst a
|
| 59 |
+
refine ⟨⟨ha, ?_⟩, ?_⟩
|
| 60 |
+
· intro hy
|
| 61 |
+
apply hau
|
| 62 |
+
linear_combination -hay - hy
|
| 63 |
+
· linear_combination -hay
|
| 64 |
+
|
| 65 |
+
lemma threePrimeNonzeroResidues_card (p : ℕ) [NeZero p] :
|
| 66 |
+
(threePrimeNonzeroResidues p).card = p - 1 := by
|
| 67 |
+
simp [threePrimeNonzeroResidues]
|
| 68 |
+
|
| 69 |
+
/-- Removing the forbidden third-coordinate-zero pairs leaves this exact
|
| 70 |
+
cardinality balance. This identity uses only the additive residue group. -/
|
| 71 |
+
theorem threePrimeLocalPairs_card_balance (p : ℕ) [NeZero p] (u : ZMod p) :
|
| 72 |
+
(threePrimeLocalPairs p u).card +
|
| 73 |
+
((threePrimeNonzeroResidues p).erase u).card = (p - 1) ^ 2 := by
|
| 74 |
+
classical
|
| 75 |
+
have hcard := Finset.card_filter_add_card_filter_not
|
| 76 |
+
(s := threePrimeNonzeroResidues p ×ˢ threePrimeNonzeroResidues p)
|
| 77 |
+
(p := fun t : ZMod p × ZMod p => t.1 + t.2 = u)
|
| 78 |
+
rw [threePrimeLocalBadPairs_eq_image] at hcard
|
| 79 |
+
have hinj : Function.Injective (fun x : ZMod p => (x, u - x)) := by
|
| 80 |
+
intro x y hxy
|
| 81 |
+
exact congrArg Prod.fst hxy
|
| 82 |
+
rw [Finset.card_image_of_injective _ hinj] at hcard
|
| 83 |
+
simpa [threePrimeLocalPairs, Finset.card_product,
|
| 84 |
+
threePrimeNonzeroResidues_card, pow_two, add_comm] using hcard
|
| 85 |
+
|
| 86 |
+
/-- Exact count of the local nonzero solutions to a three-term sum. -/
|
| 87 |
+
theorem threePrimeLocalPairs_card (p : ℕ) [NeZero p] (hp : 2 ≤ p)
|
| 88 |
+
(u : ZMod p) :
|
| 89 |
+
(threePrimeLocalPairs p u).card =
|
| 90 |
+
if u = 0 then (p - 1) * (p - 2) else (p - 1) * (p - 2) + 1 := by
|
| 91 |
+
classical
|
| 92 |
+
have hbalance := threePrimeLocalPairs_card_balance p u
|
| 93 |
+
have hdiff : p - 1 = (p - 2) + 1 := by omega
|
| 94 |
+
by_cases hu : u = 0
|
| 95 |
+
· subst u
|
| 96 |
+
simp [threePrimeNonzeroResidues] at hbalance
|
| 97 |
+
simp only [ite_true, eq_self]
|
| 98 |
+
rw [hdiff] at hbalance ⊢
|
| 99 |
+
nlinarith
|
| 100 |
+
· have hmem : u ∈ threePrimeNonzeroResidues p := by
|
| 101 |
+
simp [threePrimeNonzeroResidues, hu]
|
| 102 |
+
rw [Finset.card_erase_of_mem hmem, threePrimeNonzeroResidues_card] at hbalance
|
| 103 |
+
simp only [ite_eq_right hu]
|
| 104 |
+
rw [hdiff] at hbalance ⊢
|
| 105 |
+
simp only [Nat.add_sub_cancel] at hbalance
|
| 106 |
+
nlinarith
|
| 107 |
+
|
| 108 |
+
/-- Polynomial form of the local solution count. -/
|
| 109 |
+
theorem threePrimeLocalPairs_card_real (p : ℕ) [NeZero p] (hp : 2 ≤ p)
|
| 110 |
+
(u : ZMod p) :
|
| 111 |
+
((threePrimeLocalPairs p u).card : ℝ) =
|
| 112 |
+
(p : ℝ) ^ 2 - 3 * p + 3 - if u = 0 then 1 else 0 := by
|
| 113 |
+
rw [threePrimeLocalPairs_card p hp u]
|
| 114 |
+
split_ifs <;> push_cast [Nat.cast_sub (show 1 ≤ p by omega), Nat.cast_sub hp] <;> ring
|
| 115 |
+
|
| 116 |
+
/-- The local density relative to the heuristic density of three unit classes.
|
| 117 |
+
The prime hypothesis is used when identifying this with a singular-series
|
| 118 |
+
factor; the finite expression is defined for every nonzero modulus. -/
|
| 119 |
+
def threePrimeLocalFactor (p : ℕ) [NeZero p] (u : ZMod p) : ℝ :=
|
| 120 |
+
(p : ℝ) * (threePrimeLocalPairs p u).card / ((p : ℝ) - 1) ^ 3
|
| 121 |
+
|
| 122 |
+
/-- The exact local factor of the ternary prime singular series. -/
|
| 123 |
+
theorem threePrimeLocalFactor_eq (p : ℕ) [NeZero p] (hp : 2 ≤ p)
|
| 124 |
+
(u : ZMod p) :
|
| 125 |
+
threePrimeLocalFactor p u =
|
| 126 |
+
if u = 0 then 1 - 1 / ((p : ℝ) - 1) ^ 2
|
| 127 |
+
else 1 + 1 / ((p : ℝ) - 1) ^ 3 := by
|
| 128 |
+
have hpR : (2 : ℝ) ≤ p := by exact_mod_cast hp
|
| 129 |
+
have hden : (p : ℝ) - 1 ≠ 0 := by linarith
|
| 130 |
+
rw [threePrimeLocalFactor, threePrimeLocalPairs_card_real p hp u]
|
| 131 |
+
split_ifs <;> field_simp <;> ring
|
| 132 |
+
|
| 133 |
+
/-- The natural-number formulation distinguishes primes dividing the target. -/
|
| 134 |
+
theorem threePrimeLocalFactor_natCast (p u : ℕ) [NeZero p] (hp : 2 ≤ p) :
|
| 135 |
+
threePrimeLocalFactor p (u : ZMod p) =
|
| 136 |
+
if p ∣ u then 1 - 1 / ((p : ℝ) - 1) ^ 2
|
| 137 |
+
else 1 + 1 / ((p : ℝ) - 1) ^ 3 := by
|
| 138 |
+
rw [threePrimeLocalFactor_eq p hp]
|
| 139 |
+
simp only [ZMod.natCast_eq_zero_iff]
|
| 140 |
+
|
| 141 |
+
/-- An odd target has the positive factor two at the prime two. -/
|
| 142 |
+
theorem threePrimeLocalFactor_two (u : ℕ) (hu : Odd u) :
|
| 143 |
+
threePrimeLocalFactor 2 (u : ZMod 2) = 2 := by
|
| 144 |
+
rw [threePrimeLocalFactor_natCast 2 u (by omega)]
|
| 145 |
+
have hnot : ¬2 ∣ u := by
|
| 146 |
+
rw [← ZMod.natCast_eq_zero_iff]
|
| 147 |
+
exact ZMod.natCast_ne_zero_iff_odd.mpr hu
|
| 148 |
+
norm_num [hnot]
|
| 149 |
+
|
| 150 |
+
/-- The literal ordered triples underlying the local density. -/
|
| 151 |
+
def threePrimeLocalTriples (p : ℕ) [NeZero p] (u : ZMod p) :
|
| 152 |
+
Finset (ZMod p × ZMod p × ZMod p) :=
|
| 153 |
+
Finset.univ.filter (fun t =>
|
| 154 |
+
t.1 ≠ 0 ∧ t.2.1 ≠ 0 ∧ t.2.2 ≠ 0 ∧ t.1 + t.2.1 + t.2.2 = u)
|
| 155 |
+
|
| 156 |
+
/-- The third residue is uniquely determined by the first two. -/
|
| 157 |
+
theorem threePrimeLocalTriples_eq_image (p : ℕ) [NeZero p] (u : ZMod p) :
|
| 158 |
+
threePrimeLocalTriples p u =
|
| 159 |
+
(threePrimeLocalPairs p u).image (fun t => (t.1, t.2, u - t.1 - t.2)) := by
|
| 160 |
+
classical
|
| 161 |
+
ext t
|
| 162 |
+
rcases t with ⟨x, y, z⟩
|
| 163 |
+
constructor
|
| 164 |
+
· intro ht
|
| 165 |
+
obtain ⟨hx, hy, hz, hsum⟩ := (Finset.mem_filter.mp ht).2
|
| 166 |
+
have hthird : u - x - y = z := by linear_combination -hsum
|
| 167 |
+
refine Finset.mem_image.mpr ⟨(x, y), ?_, ?_⟩
|
| 168 |
+
· exact (mem_threePrimeLocalPairs u x y).mpr ⟨hx, hy, by simpa [hthird] using hz⟩
|
| 169 |
+
· simp [hthird]
|
| 170 |
+
· intro ht
|
| 171 |
+
obtain ⟨⟨a, b⟩, hab, h⟩ := Finset.mem_image.mp ht
|
| 172 |
+
obtain ⟨hx, hy, hz⟩ := (mem_threePrimeLocalPairs u a b).mp hab
|
| 173 |
+
rw [← h]
|
| 174 |
+
apply Finset.mem_filter.mpr
|
| 175 |
+
refine ⟨Finset.mem_univ _, hx, hy, hz, ?_⟩
|
| 176 |
+
ring
|
| 177 |
+
|
| 178 |
+
/-- The two-coordinate parametrization does not change the local count. -/
|
| 179 |
+
theorem threePrimeLocalTriples_card (p : ℕ) [NeZero p] (u : ZMod p) :
|
| 180 |
+
(threePrimeLocalTriples p u).card = (threePrimeLocalPairs p u).card := by
|
| 181 |
+
rw [threePrimeLocalTriples_eq_image]
|
| 182 |
+
apply Finset.card_image_of_injective
|
| 183 |
+
intro a b h
|
| 184 |
+
apply Prod.ext
|
| 185 |
+
· exact congrArg (fun t : ZMod p × ZMod p × ZMod p => t.1) h
|
| 186 |
+
· exact congrArg (fun t : ZMod p × ZMod p × ZMod p => t.2.1) h
|
| 187 |
+
|
| 188 |
+
/-- For a prime modulus, the nonzero residue condition is exactly the unit
|
| 189 |
+
condition used in the prime singular series. -/
|
| 190 |
+
theorem mem_threePrimeLocalTriples_iff_units (p : ℕ) [Fact p.Prime]
|
| 191 |
+
(u : ZMod p) (t : ZMod p × ZMod p × ZMod p) :
|
| 192 |
+
t ∈ threePrimeLocalTriples p u ↔
|
| 193 |
+
IsUnit t.1 ∧ IsUnit t.2.1 ∧ IsUnit t.2.2 ∧ t.1 + t.2.1 + t.2.2 = u := by
|
| 194 |
+
simp [threePrimeLocalTriples, isUnit_iff_ne_zero]
|
| 195 |
+
|
| 196 |
+
/-- There is no local obstruction at a modulus of at least three when only
|
| 197 |
+
nonzero residue classes are required. -/
|
| 198 |
+
theorem threePrimeLocalPairs_card_pos (p : ℕ) [NeZero p] (hp : 3 ≤ p)
|
| 199 |
+
(u : ZMod p) : 0 < (threePrimeLocalPairs p u).card := by
|
| 200 |
+
rw [threePrimeLocalPairs_card p (by omega) u]
|
| 201 |
+
have hp1 : 0 < p - 1 := by omega
|
| 202 |
+
have hp2 : 0 < p - 2 := by omega
|
| 203 |
+
split_ifs <;> positivity
|
| 204 |
+
|
| 205 |
+
/-- In particular every odd-prime local density is strictly positive. -/
|
| 206 |
+
theorem threePrimeLocalFactor_pos_of_three_le (p : ℕ) [NeZero p]
|
| 207 |
+
(hp : 3 ≤ p) (u : ZMod p) : 0 < threePrimeLocalFactor p u := by
|
| 208 |
+
have hpR : (3 : ℝ) ≤ p := by exact_mod_cast hp
|
| 209 |
+
have hcard : (0 : ℝ) < (threePrimeLocalPairs p u).card := by
|
| 210 |
+
exact_mod_cast threePrimeLocalPairs_card_pos p hp u
|
| 211 |
+
dsimp [threePrimeLocalFactor]
|
| 212 |
+
exact div_pos (mul_pos (by linarith) hcard) (pow_pos (by linarith) _)
|
| 213 |
+
|
| 214 |
+
/-- The only nonzero-residue ternary-sum obstruction is zero modulo two. -/
|
| 215 |
+
theorem threePrimeLocalTriples_nonempty_iff (p : ℕ) [NeZero p]
|
| 216 |
+
(hp : 2 ≤ p) (u : ZMod p) :
|
| 217 |
+
(threePrimeLocalTriples p u).Nonempty ↔ p ≠ 2 ∨ u ≠ 0 := by
|
| 218 |
+
rw [← Finset.card_pos, threePrimeLocalTriples_card]
|
| 219 |
+
by_cases hp2 : p = 2
|
| 220 |
+
· subst p
|
| 221 |
+
rw [threePrimeLocalPairs_card 2 (by omega)]
|
| 222 |
+
by_cases hu : u = 0 <;> simp [hu]
|
| 223 |
+
· have hpos := threePrimeLocalPairs_card_pos p (by omega) u
|
| 224 |
+
simp [hp2, hpos]
|
| 225 |
+
|
| 226 |
+
/-- Every prime local factor is positive for odd natural targets. -/
|
| 227 |
+
theorem threePrimeLocalFactor_pos (p u : ℕ) [Fact p.Prime] (hu : Odd u) :
|
| 228 |
+
0 < threePrimeLocalFactor p (u : ZMod p) := by
|
| 229 |
+
have hp := (Fact.out : p.Prime).two_le
|
| 230 |
+
by_cases hp2 : p = 2
|
| 231 |
+
· subst p
|
| 232 |
+
rw [threePrimeLocalFactor_two u hu]
|
| 233 |
+
norm_num
|
| 234 |
+
· exact threePrimeLocalFactor_pos_of_three_le p (by omega) _
|
| 235 |
+
|
| 236 |
+
/-- Oddness is exactly the local-solubility condition for a sum of three unit
|
| 237 |
+
residue classes at every prime. This is only a local statement, not a theorem
|
| 238 |
+
that those residue classes lift simultaneously to three prime integers. -/
|
| 239 |
+
theorem threePrimeLocalSolubility_iff_odd (u : ℕ) :
|
| 240 |
+
(∀ p : ℕ, p.Prime → ∃ x y z : ZMod p,
|
| 241 |
+
IsUnit x ∧ IsUnit y ∧ IsUnit z ∧ x + y + z = (u : ZMod p)) ↔ Odd u := by
|
| 242 |
+
constructor
|
| 243 |
+
· intro h
|
| 244 |
+
obtain ⟨x, y, z, hx, hy, hz, hsum⟩ := h 2 Nat.prime_two
|
| 245 |
+
have hmem : (x, y, z) ∈ threePrimeLocalTriples 2 (u : ZMod 2) :=
|
| 246 |
+
(mem_threePrimeLocalTriples_iff_units 2 _ _).mpr ⟨hx, hy, hz, hsum⟩
|
| 247 |
+
have hnonzero := (threePrimeLocalTriples_nonempty_iff 2 (by omega) _).mp ⟨_, hmem⟩
|
| 248 |
+
exact ZMod.natCast_ne_zero_iff_odd.mp (hnonzero.resolve_left (by simp))
|
| 249 |
+
· intro hu p hp
|
| 250 |
+
let : Fact p.Prime := ⟨hp⟩
|
| 251 |
+
have hlocal : p ≠ 2 ∨ (u : ZMod p) ≠ 0 := by
|
| 252 |
+
by_cases hp2 : p = 2
|
| 253 |
+
· right
|
| 254 |
+
subst p
|
| 255 |
+
exact ZMod.natCast_ne_zero_iff_odd.mpr hu
|
| 256 |
+
· exact Or.inl hp2
|
| 257 |
+
obtain ⟨t, ht⟩ := (threePrimeLocalTriples_nonempty_iff p hp.two_le _).mpr hlocal
|
| 258 |
+
exact ⟨t.1, t.2.1, t.2.2, (mem_threePrimeLocalTriples_iff_units p _ _).mp ht⟩
|
| 259 |
+
|
| 260 |
+
private lemma sum_zmod_zero_other (p : ℕ) [NeZero p] (hp : 1 ≤ p)
|
| 261 |
+
(a b : ℝ) :
|
| 262 |
+
(∑ u : ZMod p, if u = 0 then a else b) = ((p : ℝ) - 1) * b + a := by
|
| 263 |
+
classical
|
| 264 |
+
rw [← Finset.sum_erase_add (s := (Finset.univ : Finset (ZMod p)))
|
| 265 |
+
(fun u => if u = 0 then a else b) (Finset.mem_univ 0)]
|
| 266 |
+
have heq : (∑ u ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 267 |
+
if u = 0 then a else b) =
|
| 268 |
+
∑ _u ∈ (Finset.univ : Finset (ZMod p)).erase 0, b := by
|
| 269 |
+
apply Finset.sum_congr rfl
|
| 270 |
+
intro u hu
|
| 271 |
+
exact ite_eq_right (Finset.mem_erase.mp hu).1
|
| 272 |
+
rw [heq]
|
| 273 |
+
simp [Nat.cast_sub hp]
|
| 274 |
+
|
| 275 |
+
/-- The normalized local solution density has exact average one. -/
|
| 276 |
+
theorem sum_threePrimeLocalFactor (p : ℕ) [NeZero p] (hp : 2 ≤ p) :
|
| 277 |
+
(∑ u : ZMod p, threePrimeLocalFactor p u) = (p : ℝ) := by
|
| 278 |
+
simp_rw [threePrimeLocalFactor_eq p hp]
|
| 279 |
+
rw [sum_zmod_zero_other p (by omega)]
|
| 280 |
+
have hpR : (2 : ℝ) ≤ p := by exact_mod_cast hp
|
| 281 |
+
have hden : (p : ℝ) - 1 ≠ 0 := by linarith
|
| 282 |
+
field_simp
|
| 283 |
+
ring
|
| 284 |
+
|
| 285 |
+
/-- Exact local variance of the ternary density: after dividing by the number
|
| 286 |
+
of residues, it is `(p - 1)⁻⁵`. -/
|
| 287 |
+
theorem sum_threePrimeLocalFactor_centered_sq (p : ℕ) [NeZero p] (hp : 2 ≤ p) :
|
| 288 |
+
(∑ u : ZMod p, (threePrimeLocalFactor p u - 1) ^ 2) =
|
| 289 |
+
(p : ℝ) / ((p : ℝ) - 1) ^ 5 := by
|
| 290 |
+
have hpR : (2 : ℝ) ≤ p := by exact_mod_cast hp
|
| 291 |
+
have hden : (p : ℝ) - 1 ≠ 0 := by linarith
|
| 292 |
+
have heq (u : ZMod p) : (threePrimeLocalFactor p u - 1) ^ 2 =
|
| 293 |
+
if u = 0 then 1 / ((p : ℝ) - 1) ^ 4 else 1 / ((p : ℝ) - 1) ^ 6 := by
|
| 294 |
+
rw [threePrimeLocalFactor_eq p hp]
|
| 295 |
+
split_ifs <;> field_simp <;> ring
|
| 296 |
+
simp_rw [heq]
|
| 297 |
+
rw [sum_zmod_zero_other p (by omega)]
|
| 298 |
+
field_simp
|
| 299 |
+
ring
|
| 300 |
+
|
| 301 |
+
/-- The exact uncentered second moment, useful with the independent CRT
|
| 302 |
+
multiplicativity of local densities. -/
|
| 303 |
+
theorem sum_threePrimeLocalFactor_sq (p : ℕ) [NeZero p] (hp : 2 ≤ p) :
|
| 304 |
+
(∑ u : ZMod p, (threePrimeLocalFactor p u) ^ 2) =
|
| 305 |
+
(p : ℝ) * (1 + 1 / ((p : ℝ) - 1) ^ 5) := by
|
| 306 |
+
have heq (u : ZMod p) : (threePrimeLocalFactor p u) ^ 2 =
|
| 307 |
+
(threePrimeLocalFactor p u - 1) ^ 2 + 2 * threePrimeLocalFactor p u - 1 := by
|
| 308 |
+
ring
|
| 309 |
+
simp_rw [heq]
|
| 310 |
+
rw [Finset.sum_sub_distrib, Finset.sum_add_distrib, ← Finset.mul_sum,
|
| 311 |
+
sum_threePrimeLocalFactor p hp, sum_threePrimeLocalFactor_centered_sq p hp]
|
| 312 |
+
simp only [Finset.sum_const, Finset.card_univ, ZMod.card, nsmul_eq_mul, mul_one]
|
| 313 |
+
ring
|
| 314 |
+
|
| 315 |
+
end Problem337
|
| 316 |
+
|
| 317 |
+
end
|
| 318 |
+
|
| 319 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalFactor.lean
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.FiveProducts
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337.ThreePrimeLocalFactor
|
| 9 |
+
|
| 10 |
+
/-- Orthogonality with the zero residue removed. -/
|
| 11 |
+
theorem nonzero_character_sum {p : ℕ} [NeZero p] (t : ZMod p) :
|
| 12 |
+
(∑ a ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 13 |
+
ZMod.stdAddChar (t * a)) =
|
| 14 |
+
if t = 0 then (p : ℂ) - 1 else -1 := by
|
| 15 |
+
classical
|
| 16 |
+
have hsum := FiveProducts.character_sum t
|
| 17 |
+
have hsplit := Finset.sum_erase_add
|
| 18 |
+
(s := (Finset.univ : Finset (ZMod p)))
|
| 19 |
+
(fun a => ZMod.stdAddChar (t * a)) (Finset.mem_univ 0)
|
| 20 |
+
simp only [mul_zero, AddChar.map_zero_eq_one] at hsplit
|
| 21 |
+
rw [hsum] at hsplit
|
| 22 |
+
split_ifs at hsplit ⊢ <;> linear_combination hsplit
|
| 23 |
+
|
| 24 |
+
/-- The prime-modulus Ramanujan sum, indexed by nonzero residues. -/
|
| 25 |
+
def primeRamanujanSum (p : ℕ) [NeZero p] (u : ℕ) : ℂ :=
|
| 26 |
+
∑ a ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 27 |
+
ZMod.stdAddChar (-(u : ZMod p) * a)
|
| 28 |
+
|
| 29 |
+
/-- Removing the zero frequency from character orthogonality gives the
|
| 30 |
+
prime Ramanujan sum. In fact this formula needs only a nonzero modulus. -/
|
| 31 |
+
theorem primeRamanujanSum_eq (p : ℕ) [NeZero p] (u : ℕ) :
|
| 32 |
+
primeRamanujanSum p u = if p ∣ u then (p : ℂ) - 1 else -1 := by
|
| 33 |
+
simpa only [primeRamanujanSum, neg_eq_zero, ZMod.natCast_eq_zero_iff] using
|
| 34 |
+
nonzero_character_sum (-(u : ZMod p))
|
| 35 |
+
|
| 36 |
+
/-- The normalized cubic prime-frequency contribution to the ternary
|
| 37 |
+
singular series. -/
|
| 38 |
+
def localFactor (p u : ℕ) [NeZero p] : ℂ :=
|
| 39 |
+
1 - primeRamanujanSum p u / ((p : ℂ) - 1) ^ 3
|
| 40 |
+
|
| 41 |
+
/-- The two familiar local factors follow exactly from finite character
|
| 42 |
+
orthogonality; this is not an asymptotic prime-counting assertion. -/
|
| 43 |
+
theorem localFactor_eq (p u : ℕ) (hp : p.Prime) :
|
| 44 |
+
letI : NeZero p := ⟨hp.ne_zero⟩
|
| 45 |
+
localFactor p u =
|
| 46 |
+
if p ∣ u then 1 - 1 / ((p : ℂ) - 1) ^ 2
|
| 47 |
+
else 1 + 1 / ((p : ℂ) - 1) ^ 3 := by
|
| 48 |
+
let : NeZero p := ⟨hp.ne_zero⟩
|
| 49 |
+
have hp1 : (p : ℂ) - 1 ≠ 0 := by
|
| 50 |
+
exact sub_ne_zero.mpr (by exact_mod_cast hp.ne_one)
|
| 51 |
+
rw [localFactor, primeRamanujanSum_eq]
|
| 52 |
+
split_ifs
|
| 53 |
+
· field_simp
|
| 54 |
+
· ring
|
| 55 |
+
|
| 56 |
+
/-- The normalized cubic exponential-sum contribution of the nonzero
|
| 57 |
+
frequencies at a prime modulus. -/
|
| 58 |
+
def cubicPrimeCoefficient (p u : ℕ) [NeZero p] : ℂ :=
|
| 59 |
+
∑ a ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 60 |
+
((∑ b ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 61 |
+
ZMod.stdAddChar (a * b)) / ((p : ℂ) - 1)) ^ 3 *
|
| 62 |
+
ZMod.stdAddChar (-(u : ZMod p) * a)
|
| 63 |
+
|
| 64 |
+
/-- The cubic coefficient is exactly the signed, normalized Ramanujan sum.
|
| 65 |
+
Thus the local Euler factor is the zero-frequency contribution plus the
|
| 66 |
+
actual nonzero-frequency cubic sum. -/
|
| 67 |
+
theorem cubicPrimeCoefficient_eq (p u : ℕ) [NeZero p] :
|
| 68 |
+
cubicPrimeCoefficient p u =
|
| 69 |
+
-primeRamanujanSum p u / ((p : ℂ) - 1) ^ 3 := by
|
| 70 |
+
classical
|
| 71 |
+
unfold cubicPrimeCoefficient
|
| 72 |
+
calc
|
| 73 |
+
_ = ∑ a ∈ (Finset.univ : Finset (ZMod p)).erase 0,
|
| 74 |
+
(-1 / ((p : ℂ) - 1) ^ 3) *
|
| 75 |
+
ZMod.stdAddChar (-(u : ZMod p) * a) := by
|
| 76 |
+
apply Finset.sum_congr rfl
|
| 77 |
+
intro a ha
|
| 78 |
+
rw [nonzero_character_sum, ite_eq_right (Finset.mem_erase.mp ha).1, div_pow]
|
| 79 |
+
norm_num
|
| 80 |
+
_ = (-1 / ((p : ℂ) - 1) ^ 3) * primeRamanujanSum p u := by
|
| 81 |
+
rw [← Finset.mul_sum]
|
| 82 |
+
rfl
|
| 83 |
+
_ = _ := by ring
|
| 84 |
+
|
| 85 |
+
theorem one_add_cubicPrimeCoefficient (p u : ℕ) [NeZero p] :
|
| 86 |
+
1 + cubicPrimeCoefficient p u = localFactor p u := by
|
| 87 |
+
rw [cubicPrimeCoefficient_eq, localFactor]
|
| 88 |
+
ring
|
| 89 |
+
|
| 90 |
+
/-- A real-valued statement of the local factor for direct use with real
|
| 91 |
+
Euler products. -/
|
| 92 |
+
theorem one_add_cubicPrimeCoefficient_eq_real (p u : ℕ) (hp : p.Prime) :
|
| 93 |
+
letI : NeZero p := ⟨hp.ne_zero⟩
|
| 94 |
+
1 + cubicPrimeCoefficient p u =
|
| 95 |
+
((if p ∣ u then 1 - 1 / ((p : ℝ) - 1) ^ 2
|
| 96 |
+
else 1 + 1 / ((p : ℝ) - 1) ^ 3 : ℝ) : ℂ) := by
|
| 97 |
+
let : NeZero p := ⟨hp.ne_zero⟩
|
| 98 |
+
rw [one_add_cubicPrimeCoefficient, localFactor_eq p u hp]
|
| 99 |
+
split_ifs <;> push_cast <;> rfl
|
| 100 |
+
|
| 101 |
+
end Problem337.ThreePrimeLocalFactor
|
| 102 |
+
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalFourier.lean
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeLocalDensity
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeLocalFactor
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
/-- The normalized actual local solution count agrees with the zero frequency
|
| 10 |
+
plus the normalized cubic nonzero-frequency sum. -/
|
| 11 |
+
theorem threePrimeLocalFactor_eq_cubic (p u : ℕ) [Fact p.Prime] :
|
| 12 |
+
(threePrimeLocalFactor p (u : ZMod p) : ℂ) =
|
| 13 |
+
1 + ThreePrimeLocalFactor.cubicPrimeCoefficient p u := by
|
| 14 |
+
have hp := (Fact.out : p.Prime)
|
| 15 |
+
rw [threePrimeLocalFactor_natCast p u hp.two_le]
|
| 16 |
+
exact (ThreePrimeLocalFactor.one_add_cubicPrimeCoefficient_eq_real p u hp).symm
|
| 17 |
+
|
| 18 |
+
/-- An unnormalized finite Fourier identity for literal local unit triples.
|
| 19 |
+
All normalizing constants are checked against the combinatorial count. -/
|
| 20 |
+
theorem threePrimeLocalTriples_card_fourier (p u : ℕ) [Fact p.Prime] :
|
| 21 |
+
(p : ℂ) * (threePrimeLocalTriples p (u : ZMod p)).card =
|
| 22 |
+
((p : ℂ) - 1) ^ 3 *
|
| 23 |
+
(1 + ThreePrimeLocalFactor.cubicPrimeCoefficient p u) := by
|
| 24 |
+
have hp := (Fact.out : p.Prime)
|
| 25 |
+
have hp1 : (p : ℂ) - 1 ≠ 0 := by
|
| 26 |
+
exact sub_ne_zero.mpr (by exact_mod_cast hp.ne_one)
|
| 27 |
+
rw [threePrimeLocalTriples_card, ← threePrimeLocalFactor_eq_cubic]
|
| 28 |
+
unfold threePrimeLocalFactor
|
| 29 |
+
push_cast
|
| 30 |
+
field_simp
|
| 31 |
+
|
| 32 |
+
/-- The cubic prime-frequency contribution is real, as follows from its
|
| 33 |
+
independently counted local-density interpretation. -/
|
| 34 |
+
theorem threePrimeCubicCoefficient_im (p u : ℕ) [Fact p.Prime] :
|
| 35 |
+
(ThreePrimeLocalFactor.cubicPrimeCoefficient p u).im = 0 := by
|
| 36 |
+
have h := congrArg Complex.im (threePrimeLocalFactor_eq_cubic p u)
|
| 37 |
+
simpa using h.symm
|
| 38 |
+
|
| 39 |
+
end Problem337
|
| 40 |
+
|
| 41 |
+
end
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeLocalSeries.lean
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeLocalDensity
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeSingularSeries
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem337
|
| 10 |
+
|
| 11 |
+
/-- The normalized actual local unit-triple count at prime moduli, with one at
|
| 12 |
+
nonprime indices. The inactive branch makes this a total natural-indexed
|
| 13 |
+
function without imposing a finiteness instance on `ZMod 0`. -/
|
| 14 |
+
def threePrimeArithmeticFactor (p u : ℕ) : ℝ :=
|
| 15 |
+
if hp : p.Prime then
|
| 16 |
+
@threePrimeLocalFactor p ⟨hp.ne_zero⟩ (u : ZMod p)
|
| 17 |
+
else 1
|
| 18 |
+
|
| 19 |
+
lemma threePrimeArithmeticFactor_of_prime (p u : ℕ) (hp : p.Prime) :
|
| 20 |
+
threePrimeArithmeticFactor p u =
|
| 21 |
+
if p ∣ u then 1 - 1 / ((p : ℝ) - 1) ^ 2
|
| 22 |
+
else 1 + 1 / ((p : ℝ) - 1) ^ 3 := by
|
| 23 |
+
let : NeZero p := ⟨hp.ne_zero⟩
|
| 24 |
+
simpa only [threePrimeArithmeticFactor, dite_eq_left hp] using
|
| 25 |
+
threePrimeLocalFactor_natCast p u hp.two_le
|
| 26 |
+
|
| 27 |
+
lemma threePrimeArithmeticFactor_of_not_prime (p u : ℕ) (hp : ¬p.Prime) :
|
| 28 |
+
threePrimeArithmeticFactor p u = 1 := by
|
| 29 |
+
simp only [threePrimeArithmeticFactor, dite_eq_right hp]
|
| 30 |
+
|
| 31 |
+
/-- The analytically indexed odd-prime Euler factor is the normalized actual
|
| 32 |
+
count of its local unit solutions. -/
|
| 33 |
+
theorem threePrimeOddFactor_eq_arithmeticFactor (u n : ℕ) :
|
| 34 |
+
1 + threePrimeOddPerturbation u n = threePrimeArithmeticFactor (n + 3) u := by
|
| 35 |
+
by_cases hp : (n + 3).Prime
|
| 36 |
+
· rw [threePrimeArithmeticFactor_of_prime _ _ hp]
|
| 37 |
+
have hn : ((n + 3 : ℕ) : ℝ) - 1 = (n : ℝ) + 2 := by push_cast; ring
|
| 38 |
+
rw [hn]
|
| 39 |
+
simp only [threePrimeOddPerturbation, ite_eq_left hp]
|
| 40 |
+
split_ifs <;> ring
|
| 41 |
+
· simp [threePrimeOddPerturbation, hp,
|
| 42 |
+
threePrimeArithmeticFactor_of_not_prime _ _ hp]
|
| 43 |
+
|
| 44 |
+
/-- The local unit-triple factor at two records precisely the parity obstruction. -/
|
| 45 |
+
theorem threePrimeArithmeticFactor_two (u : ℕ) :
|
| 46 |
+
threePrimeArithmeticFactor 2 u = if Odd u then 2 else 0 := by
|
| 47 |
+
rw [threePrimeArithmeticFactor_of_prime 2 u Nat.prime_two]
|
| 48 |
+
have hdvd : 2 ∣ u ↔ ¬Odd u := by
|
| 49 |
+
rw [← ZMod.natCast_eq_zero_iff]
|
| 50 |
+
exact not_iff_not.mp (by simp only [not_not, ZMod.natCast_ne_zero_iff_odd])
|
| 51 |
+
by_cases hu : Odd u <;> norm_num [hdvd, hu]
|
| 52 |
+
|
| 53 |
+
/-- Exact interpretation of the singular series as the product of normalized
|
| 54 |
+
finite local unit-triple solution counts. -/
|
| 55 |
+
theorem threePrimeSingularSeries_eq_localProduct (u : ℕ) :
|
| 56 |
+
threePrimeSingularSeries u = threePrimeArithmeticFactor 2 u *
|
| 57 |
+
∏' n : ℕ, threePrimeArithmeticFactor (n + 3) u := by
|
| 58 |
+
rw [threePrimeSingularSeries, threePrimeArithmeticFactor_two]
|
| 59 |
+
simp_rw [threePrimeOddFactor_eq_arithmeticFactor]
|
| 60 |
+
|
| 61 |
+
/-- The actual local-factor product converges, rather than merely being a
|
| 62 |
+
formal Euler-product notation. -/
|
| 63 |
+
theorem threePrimeArithmeticFactors_multipliable (u : ℕ) :
|
| 64 |
+
Multipliable (fun n : ℕ => threePrimeArithmeticFactor (n + 3) u) := by
|
| 65 |
+
simpa only [threePrimeOddFactor_eq_arithmeticFactor] using
|
| 66 |
+
threePrimeOddFactors_multipliable u
|
| 67 |
+
|
| 68 |
+
end Problem337
|
| 69 |
+
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldt.lean
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.RationalSupplyReduction
|
| 2 |
+
import Mathlib.NumberTheory.Chebyshev
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
open Filter Asymptotics
|
| 8 |
+
|
| 9 |
+
namespace Problem337
|
| 10 |
+
|
| 11 |
+
/-- All positive ordered triples of fixed sum, without primality restrictions. -/
|
| 12 |
+
def supplyIntegerTriples (u : ℕ) : Finset (ℕ × ℕ × ℕ) :=
|
| 13 |
+
((Finset.Icc 1 u) ×ˢ ((Finset.Icc 1 u) ×ˢ (Finset.Icc 1 u))).filter
|
| 14 |
+
(fun t => t.1 + t.2.1 + t.2.2 = u)
|
| 15 |
+
|
| 16 |
+
/-- Logarithmic weight supported only on primes, unlike the von Mangoldt weight. -/
|
| 17 |
+
def primeLogWeight (n : ℕ) : ℝ := if n.Prime then Real.log n else 0
|
| 18 |
+
|
| 19 |
+
/-- The weighted ternary convolution used in the analytic three-prime theorem. -/
|
| 20 |
+
def mangoldtTripleSum (u : ℕ) : ℝ :=
|
| 21 |
+
∑ t ∈ supplyIntegerTriples u,
|
| 22 |
+
ArithmeticFunction.vonMangoldt t.1 * ArithmeticFunction.vonMangoldt t.2.1 *
|
| 23 |
+
ArithmeticFunction.vonMangoldt t.2.2
|
| 24 |
+
|
| 25 |
+
/-- The corresponding weighted sum over genuine prime triples. -/
|
| 26 |
+
def primeTripleLogSum (u : ℕ) : ℝ :=
|
| 27 |
+
∑ t ∈ supplyPrimeTriples u,
|
| 28 |
+
Real.log (t.1 : ℝ) * Real.log (t.2.1 : ℝ) * Real.log (t.2.2 : ℝ)
|
| 29 |
+
|
| 30 |
+
lemma primeLogWeight_nonneg (n : ℕ) : 0 ≤ primeLogWeight n := by
|
| 31 |
+
unfold primeLogWeight
|
| 32 |
+
split_ifs with hn
|
| 33 |
+
· exact Real.log_nonneg (by exact_mod_cast hn.one_le)
|
| 34 |
+
· exact le_rfl
|
| 35 |
+
|
| 36 |
+
lemma primeLogWeight_le_vonMangoldt (n : ℕ) :
|
| 37 |
+
primeLogWeight n ≤ ArithmeticFunction.vonMangoldt n := by
|
| 38 |
+
unfold primeLogWeight
|
| 39 |
+
split_ifs with hn
|
| 40 |
+
· exact (ArithmeticFunction.vonMangoldt_apply_prime hn).ge
|
| 41 |
+
· exact ArithmeticFunction.vonMangoldt_nonneg
|
| 42 |
+
|
| 43 |
+
lemma primeTripleLogSum_eq (u : ℕ) :
|
| 44 |
+
primeTripleLogSum u = ∑ t ∈ supplyIntegerTriples u,
|
| 45 |
+
primeLogWeight t.1 * primeLogWeight t.2.1 * primeLogWeight t.2.2 := by
|
| 46 |
+
classical
|
| 47 |
+
have hset : supplyPrimeTriples u = (supplyIntegerTriples u).filter
|
| 48 |
+
(fun t => t.1.Prime ∧ t.2.1.Prime ∧ t.2.2.Prime) := by
|
| 49 |
+
ext t
|
| 50 |
+
simp only [supplyPrimeTriples, supplyIntegerTriples, Finset.mem_filter]
|
| 51 |
+
tauto
|
| 52 |
+
unfold primeTripleLogSum
|
| 53 |
+
rw [hset, Finset.sum_filter]
|
| 54 |
+
apply Finset.sum_congr rfl
|
| 55 |
+
intro t ht
|
| 56 |
+
by_cases h1 : t.1.Prime <;> by_cases h2 : t.2.1.Prime <;>
|
| 57 |
+
by_cases h3 : t.2.2.Prime <;> simp [primeLogWeight, h1, h2, h3]
|
| 58 |
+
|
| 59 |
+
/-- A weighted version of the fixed-coordinate counting bound. -/
|
| 60 |
+
lemma fixed_sum_coordinate_sum_le
|
| 61 |
+
{α : Type*} [DecidableEq α] (T : Finset α) (U : Finset ℕ)
|
| 62 |
+
(x y z : α → ℕ) (u : ℕ) (f : ℕ → ℝ)
|
| 63 |
+
(hf : ∀ n ∈ U, 0 ≤ f n)
|
| 64 |
+
(hsum : ∀ t ∈ T, x t + y t + z t = u)
|
| 65 |
+
(hU : ∀ t ∈ T, x t ∈ U ∧ y t ∈ U)
|
| 66 |
+
(hinj : Function.Injective (fun t => (x t, y t, z t))) :
|
| 67 |
+
(∑ t ∈ T, f (x t)) ≤ (U.card : ℝ) * ∑ n ∈ U, f n := by
|
| 68 |
+
classical
|
| 69 |
+
have hi : Set.InjOn (fun t => (x t, y t)) (T : Set α) := by
|
| 70 |
+
intro a ha b hb hab
|
| 71 |
+
have hxy := Prod.mk.inj hab
|
| 72 |
+
have hz : z a = z b := by
|
| 73 |
+
have := hsum a ha
|
| 74 |
+
have := hsum b hb
|
| 75 |
+
omega
|
| 76 |
+
exact hinj (Prod.ext hxy.1 (Prod.ext hxy.2 hz))
|
| 77 |
+
have hsub : T.image (fun t => (x t, y t)) ⊆ U ×ˢ U := by
|
| 78 |
+
intro q hq
|
| 79 |
+
obtain ⟨t, ht, rfl⟩ := Finset.mem_image.mp hq
|
| 80 |
+
exact Finset.mem_product.mpr (hU t ht)
|
| 81 |
+
calc
|
| 82 |
+
(∑ t ∈ T, f (x t)) = ∑ q ∈ T.image (fun t => (x t, y t)), f q.1 := by
|
| 83 |
+
rw [Finset.sum_image]
|
| 84 |
+
exact hi
|
| 85 |
+
_ ≤ ∑ q ∈ U ×ˢ U, f q.1 := by
|
| 86 |
+
apply Finset.sum_le_sum_of_subset_of_nonneg hsub
|
| 87 |
+
intro q hq _
|
| 88 |
+
exact hf q.1 (Finset.mem_product.mp hq).1
|
| 89 |
+
_ = (U.card : ℝ) * ∑ n ∈ U, f n := by
|
| 90 |
+
rw [Finset.sum_product]
|
| 91 |
+
simp only [Finset.sum_const, nsmul_eq_mul]
|
| 92 |
+
rw [← Finset.mul_sum]
|
| 93 |
+
|
| 94 |
+
/-- Prime powers of exponent at least two carry exactly the difference of the
|
| 95 |
+
Chebyshev functions. -/
|
| 96 |
+
lemma sum_primePowerLogWeight (u : ℕ) :
|
| 97 |
+
(∑ n ∈ Finset.Icc 1 u,
|
| 98 |
+
(ArithmeticFunction.vonMangoldt n - primeLogWeight n)) =
|
| 99 |
+
Chebyshev.psi u - Chebyshev.theta u := by
|
| 100 |
+
rw [Finset.sum_sub_distrib]
|
| 101 |
+
congr 1
|
| 102 |
+
· simp only [Chebyshev.psi, Nat.floor_natCast]
|
| 103 |
+
congr 1
|
| 104 |
+
· simp only [Chebyshev.theta, Nat.floor_natCast, Finset.sum_filter,
|
| 105 |
+
primeLogWeight]
|
| 106 |
+
congr 1
|
| 107 |
+
|
| 108 |
+
private lemma triple_product_difference_le
|
| 109 |
+
(a b c p q r L : ℝ)
|
| 110 |
+
(hp : 0 ≤ p) (hq : 0 ≤ q) (hr : 0 ≤ r)
|
| 111 |
+
(hpa : p ≤ a) (hqb : q ≤ b) (hrc : r ≤ c)
|
| 112 |
+
(ha : a ≤ L) (hb : b ≤ L) (hc : c ≤ L) :
|
| 113 |
+
a * b * c ≤ p * q * r + L ^ 2 * ((a - p) + (b - q) + (c - r)) := by
|
| 114 |
+
have hL : 0 ≤ L := hp.trans (hpa.trans ha)
|
| 115 |
+
have ha0 := hp.trans hpa
|
| 116 |
+
have hb0 := hq.trans hqb
|
| 117 |
+
have hc0 := hr.trans hrc
|
| 118 |
+
have hpL := hpa.trans ha
|
| 119 |
+
have hqL := hqb.trans hb
|
| 120 |
+
have h1 : (a - p) * b * c ≤ (a - p) * L * L := by gcongr
|
| 121 |
+
have h2 : p * (b - q) * c ≤ L * (b - q) * L := by gcongr
|
| 122 |
+
have h3 : p * q * (c - r) ≤ L * L * (c - r) := by gcongr
|
| 123 |
+
nlinarith
|
| 124 |
+
|
| 125 |
+
lemma mangoldtTripleSum_le_primeTripleLogSum (u : ℕ) :
|
| 126 |
+
mangoldtTripleSum u ≤ primeTripleLogSum u +
|
| 127 |
+
3 * (u : ℝ) * Real.log (u : ℝ) ^ 2 *
|
| 128 |
+
(Chebyshev.psi u - Chebyshev.theta u) := by
|
| 129 |
+
classical
|
| 130 |
+
let U := Finset.Icc 1 u
|
| 131 |
+
let T := supplyIntegerTriples u
|
| 132 |
+
let d : ℕ → ℝ := fun n => ArithmeticFunction.vonMangoldt n - primeLogWeight n
|
| 133 |
+
have hd (n : ℕ) : 0 ≤ d n := sub_nonneg.mpr (primeLogWeight_le_vonMangoldt n)
|
| 134 |
+
have hT (t : ℕ × ℕ × ℕ) (ht : t ∈ T) :
|
| 135 |
+
t.1 ∈ U ∧ t.2.1 ∈ U ∧ t.2.2 ∈ U := by
|
| 136 |
+
obtain ⟨ht, _⟩ := Finset.mem_filter.mp ht
|
| 137 |
+
exact (Finset.mem_product.mp ht).imp_right Finset.mem_product.mp
|
| 138 |
+
have hsum (t : ℕ × ℕ × ℕ) (ht : t ∈ T) :
|
| 139 |
+
t.1 + t.2.1 + t.2.2 = u := (Finset.mem_filter.mp ht).2
|
| 140 |
+
have hweight (n : ℕ) (hn : n ∈ U) :
|
| 141 |
+
ArithmeticFunction.vonMangoldt n ≤ Real.log (u : ℝ) := by
|
| 142 |
+
apply ArithmeticFunction.vonMangoldt_le_log.trans
|
| 143 |
+
apply Real.log_le_log
|
| 144 |
+
· exact_mod_cast (Finset.mem_Icc.mp hn).1
|
| 145 |
+
· exact_mod_cast (Finset.mem_Icc.mp hn).2
|
| 146 |
+
have h1 := fixed_sum_coordinate_sum_le T U (fun t => t.1)
|
| 147 |
+
(fun t => t.2.1) (fun t => t.2.2) u d (fun n _ => hd n)
|
| 148 |
+
hsum (fun t ht => ⟨(hT t ht).1, (hT t ht).2.1⟩)
|
| 149 |
+
(by intro a b h; exact h)
|
| 150 |
+
have h2 := fixed_sum_coordinate_sum_le T U (fun t => t.2.1)
|
| 151 |
+
(fun t => t.1) (fun t => t.2.2) u d (fun n _ => hd n)
|
| 152 |
+
(by intro t ht; have := hsum t ht; omega)
|
| 153 |
+
(fun t ht => ⟨(hT t ht).2.1, (hT t ht).1⟩)
|
| 154 |
+
(by
|
| 155 |
+
intro a b h
|
| 156 |
+
have hc := Prod.mk.inj h
|
| 157 |
+
have hh := Prod.mk.inj hc.2
|
| 158 |
+
exact Prod.ext hh.1 (Prod.ext hc.1 hh.2))
|
| 159 |
+
have h3 := fixed_sum_coordinate_sum_le T U (fun t => t.2.2)
|
| 160 |
+
(fun t => t.1) (fun t => t.2.1) u d (fun n _ => hd n)
|
| 161 |
+
(by intro t ht; have := hsum t ht; omega)
|
| 162 |
+
(fun t ht => ⟨(hT t ht).2.2, (hT t ht).1⟩)
|
| 163 |
+
(by
|
| 164 |
+
intro a b h
|
| 165 |
+
have hc := Prod.mk.inj h
|
| 166 |
+
have hh := Prod.mk.inj hc.2
|
| 167 |
+
exact Prod.ext hh.1 (Prod.ext hh.2 hc.1))
|
| 168 |
+
have hUcard : U.card = u := by simp [U, Nat.card_Icc]
|
| 169 |
+
have hdSum : (∑ n ∈ U, d n) = Chebyshev.psi u - Chebyshev.theta u :=
|
| 170 |
+
sum_primePowerLogWeight u
|
| 171 |
+
rw [hUcard, hdSum] at h1 h2 h3
|
| 172 |
+
have hlocal : mangoldtTripleSum u ≤ primeTripleLogSum u +
|
| 173 |
+
Real.log (u : ℝ) ^ 2 *
|
| 174 |
+
((∑ t ∈ T, d t.1) + (∑ t ∈ T, d t.2.1) + (∑ t ∈ T, d t.2.2)) := by
|
| 175 |
+
calc
|
| 176 |
+
mangoldtTripleSum u ≤ ∑ t ∈ T,
|
| 177 |
+
(primeLogWeight t.1 * primeLogWeight t.2.1 * primeLogWeight t.2.2 +
|
| 178 |
+
Real.log (u : ℝ) ^ 2 * (d t.1 + d t.2.1 + d t.2.2)) := by
|
| 179 |
+
apply Finset.sum_le_sum
|
| 180 |
+
intro t ht
|
| 181 |
+
have htU := hT t ht
|
| 182 |
+
exact triple_product_difference_le
|
| 183 |
+
(ArithmeticFunction.vonMangoldt t.1) (ArithmeticFunction.vonMangoldt t.2.1)
|
| 184 |
+
(ArithmeticFunction.vonMangoldt t.2.2) (primeLogWeight t.1)
|
| 185 |
+
(primeLogWeight t.2.1) (primeLogWeight t.2.2) (Real.log u)
|
| 186 |
+
(primeLogWeight_nonneg _) (primeLogWeight_nonneg _) (primeLogWeight_nonneg _)
|
| 187 |
+
(primeLogWeight_le_vonMangoldt _) (primeLogWeight_le_vonMangoldt _)
|
| 188 |
+
(primeLogWeight_le_vonMangoldt _) (hweight _ htU.1)
|
| 189 |
+
(hweight _ htU.2.1) (hweight _ htU.2.2)
|
| 190 |
+
_ = _ := by
|
| 191 |
+
rw [Finset.sum_add_distrib, ← Finset.mul_sum]
|
| 192 |
+
simp only [Finset.sum_add_distrib, primeTripleLogSum_eq, T]
|
| 193 |
+
have htotal := add_le_add (add_le_add h1 h2) h3
|
| 194 |
+
have hm := mul_le_mul_of_nonneg_left htotal (sq_nonneg (Real.log (u : ℝ)))
|
| 195 |
+
nlinarith
|
| 196 |
+
|
| 197 |
+
/-- The contribution from genuine higher prime powers is lower order than the
|
| 198 |
+
quadratic main term. This uses Mathlib's elementary `ψ - θ = O(sqrt x)` bound. -/
|
| 199 |
+
theorem mangoldt_triple_error_isLittleO :
|
| 200 |
+
(fun x : ℝ => 3 * x * Real.log x ^ 2 *
|
| 201 |
+
(Chebyshev.psi x - Chebyshev.theta x)) =o[atTop] (fun x : ℝ => x ^ 2) := by
|
| 202 |
+
have hlog : (fun x : ℝ => Real.log x ^ 2) =o[atTop]
|
| 203 |
+
(fun x : ℝ => x ^ (1 / 2 : ℝ)) := by
|
| 204 |
+
simpa only [Real.rpow_two] using
|
| 205 |
+
isLittleO_log_rpow_rpow_atTop (2 : ℝ) (by norm_num : (0 : ℝ) < 1 / 2)
|
| 206 |
+
have hsmall := hlog.mul_isBigO Chebyshev.isBigO_psi_sub_theta_sqrt
|
| 207 |
+
have hscaled := hsmall.mul_isBigO (isBigO_refl (fun x : ℝ => x) atTop)
|
| 208 |
+
have hquadratic :
|
| 209 |
+
(fun x : ℝ => x * Real.log x ^ 2 * (Chebyshev.psi x - Chebyshev.theta x))
|
| 210 |
+
=o[atTop] (fun x : ℝ => x ^ 2) := by
|
| 211 |
+
apply hscaled.congr'
|
| 212 |
+
· exact Eventually.of_forall (fun x => by simp only [Pi.sub_apply]; ring)
|
| 213 |
+
· filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx
|
| 214 |
+
rw [Real.sqrt_eq_rpow, ← Real.rpow_add hx]
|
| 215 |
+
norm_num
|
| 216 |
+
ring
|
| 217 |
+
simpa only [mul_assoc] using hquadratic.const_mul_left 3
|
| 218 |
+
|
| 219 |
+
/-- Explicit error absorption along the natural-number parameter. -/
|
| 220 |
+
theorem eventually_mangoldt_triple_error_lt (ε : ℝ) (hε : 0 < ε) :
|
| 221 |
+
∀ᶠ u : ℕ in atTop,
|
| 222 |
+
3 * (u : ℝ) * Real.log (u : ℝ) ^ 2 *
|
| 223 |
+
(Chebyshev.psi u - Chebyshev.theta u) < ε * (u : ℝ) ^ 2 := by
|
| 224 |
+
have hsmall := mangoldt_triple_error_isLittleO.bound (show 0 < ε / 2 by positivity)
|
| 225 |
+
have hn := (tendsto_natCast_atTop_atTop (R := ℝ)).eventually hsmall
|
| 226 |
+
filter_upwards [hn, eventually_ge_atTop (1 : ℕ)] with u hu hu1
|
| 227 |
+
rw [Real.norm_of_nonneg (sq_nonneg (u : ℝ))] at hu
|
| 228 |
+
have hu0 : (0 : ℝ) < u := by exact_mod_cast hu1
|
| 229 |
+
exact (le_trans (le_abs_self _) hu).trans_lt (by nlinarith [sq_pos_of_pos hu0])
|
| 230 |
+
|
| 231 |
+
/-- An analytic quadratic lower bound for the von Mangoldt convolution implies
|
| 232 |
+
one for the prime-only weighted sum. No analytic lower bound is asserted here. -/
|
| 233 |
+
theorem weighted_prime_lower_bound_of_mangoldt
|
| 234 |
+
(c : ℝ) (hc : 0 < c)
|
| 235 |
+
(hmain : ∀ᶠ u : ℕ in atTop, Odd u → c * (u : ℝ) ^ 2 ≤ mangoldtTripleSum u) :
|
| 236 |
+
∀ᶠ u : ℕ in atTop, Odd u →
|
| 237 |
+
(c / 2) * (u : ℝ) ^ 2 ≤ primeTripleLogSum u := by
|
| 238 |
+
filter_upwards [hmain, eventually_mangoldt_triple_error_lt (c / 2) (by positivity)]
|
| 239 |
+
with u hu herr
|
| 240 |
+
intro hodd
|
| 241 |
+
have hupper := mangoldtTripleSum_le_primeTripleLogSum u
|
| 242 |
+
have hlower := hu hodd
|
| 243 |
+
linarith
|
| 244 |
+
|
| 245 |
+
end Problem337
|
| 246 |
+
|
| 247 |
+
end
|
| 248 |
+
|
| 249 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtAsymptotics.lean
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMangoldt
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
open Filter Asymptotics
|
| 7 |
+
|
| 8 |
+
namespace Problem337
|
| 9 |
+
|
| 10 |
+
/-- Removing higher prime powers can only reduce a nonnegative convolution. -/
|
| 11 |
+
lemma primeTripleLogSum_le_mangoldtTripleSum (u : ℕ) :
|
| 12 |
+
primeTripleLogSum u ≤ mangoldtTripleSum u := by
|
| 13 |
+
rw [primeTripleLogSum_eq]
|
| 14 |
+
unfold mangoldtTripleSum
|
| 15 |
+
apply Finset.sum_le_sum
|
| 16 |
+
intro t ht
|
| 17 |
+
exact mul_le_mul
|
| 18 |
+
(mul_le_mul (primeLogWeight_le_vonMangoldt t.1)
|
| 19 |
+
(primeLogWeight_le_vonMangoldt t.2.1)
|
| 20 |
+
(primeLogWeight_nonneg t.2.1) ArithmeticFunction.vonMangoldt_nonneg)
|
| 21 |
+
(primeLogWeight_le_vonMangoldt t.2.2) (primeLogWeight_nonneg t.2.2)
|
| 22 |
+
(mul_nonneg ArithmeticFunction.vonMangoldt_nonneg ArithmeticFunction.vonMangoldt_nonneg)
|
| 23 |
+
|
| 24 |
+
/-- Two-sided control of the actual convolution error, without an analytic hypothesis. -/
|
| 25 |
+
theorem abs_mangoldtTripleSum_sub_primeTripleLogSum_le (u : ℕ) :
|
| 26 |
+
|mangoldtTripleSum u - primeTripleLogSum u| ≤
|
| 27 |
+
3 * (u : ℝ) * Real.log (u : ℝ) ^ 2 *
|
| 28 |
+
(Chebyshev.psi u - Chebyshev.theta u) := by
|
| 29 |
+
rw [abs_of_nonneg (sub_nonneg.mpr (primeTripleLogSum_le_mangoldtTripleSum u))]
|
| 30 |
+
linarith [mangoldtTripleSum_le_primeTripleLogSum u]
|
| 31 |
+
|
| 32 |
+
/-- Higher prime powers do not affect the normalized quadratic main term. -/
|
| 33 |
+
theorem mangoldtTripleSum_sub_primeTripleLogSum_isLittleO :
|
| 34 |
+
(fun u : ℕ => mangoldtTripleSum u - primeTripleLogSum u) =o[atTop]
|
| 35 |
+
(fun u : ℕ => (u : ℝ) ^ 2) := by
|
| 36 |
+
have hbound := mangoldt_triple_error_isLittleO.comp_tendsto
|
| 37 |
+
(tendsto_natCast_atTop_atTop (R := ℝ))
|
| 38 |
+
apply IsLittleO.of_bound
|
| 39 |
+
intro c hc
|
| 40 |
+
filter_upwards [hbound.bound hc] with u hu
|
| 41 |
+
simp only [Function.comp_apply, Real.norm_eq_abs] at hu ⊢
|
| 42 |
+
exact (abs_mangoldtTripleSum_sub_primeTripleLogSum_le u).trans
|
| 43 |
+
((le_abs_self _).trans hu)
|
| 44 |
+
|
| 45 |
+
/-- The normalized difference converges to zero along all natural integers. -/
|
| 46 |
+
theorem tendsto_mangoldtTripleSum_sub_primeTripleLogSum_div_sq :
|
| 47 |
+
Tendsto (fun u : ℕ =>
|
| 48 |
+
(mangoldtTripleSum u - primeTripleLogSum u) / (u : ℝ) ^ 2)
|
| 49 |
+
atTop (nhds 0) :=
|
| 50 |
+
mangoldtTripleSum_sub_primeTripleLogSum_isLittleO.tendsto_div_nhds_zero
|
| 51 |
+
|
| 52 |
+
/-- Any quadratic asymptotic, including a varying singular-series coefficient,
|
| 53 |
+
is equivalent for the Mangoldt and prime-only convolutions. This is only an
|
| 54 |
+
error-transfer theorem: neither asymptotic formula is asserted. -/
|
| 55 |
+
theorem mangoldt_prime_quadratic_asymptotic_iff_filter
|
| 56 |
+
(l : Filter ℕ) (hl : l ≤ atTop) (σ : ℕ → ℝ) :
|
| 57 |
+
((fun u : ℕ => mangoldtTripleSum u - σ u * (u : ℝ) ^ 2) =o[l]
|
| 58 |
+
(fun u : ℕ => (u : ℝ) ^ 2)) ↔
|
| 59 |
+
((fun u : ℕ => primeTripleLogSum u - σ u * (u : ℝ) ^ 2) =o[l]
|
| 60 |
+
(fun u : ℕ => (u : ℝ) ^ 2)) := by
|
| 61 |
+
constructor
|
| 62 |
+
· intro h
|
| 63 |
+
exact (h.sub (mangoldtTripleSum_sub_primeTripleLogSum_isLittleO.mono hl)).congr_left
|
| 64 |
+
(fun u => by ring)
|
| 65 |
+
· intro h
|
| 66 |
+
exact (h.add (mangoldtTripleSum_sub_primeTripleLogSum_isLittleO.mono hl)).congr_left
|
| 67 |
+
(fun u => by ring)
|
| 68 |
+
|
| 69 |
+
/-- The same transfer without restricting the parameter (the filter version also
|
| 70 |
+
applies directly to the odd integers). -/
|
| 71 |
+
theorem mangoldt_prime_quadratic_asymptotic_iff (σ : ℕ → ℝ) :
|
| 72 |
+
((fun u : ℕ => mangoldtTripleSum u - σ u * (u : ℝ) ^ 2) =o[atTop]
|
| 73 |
+
(fun u : ℕ => (u : ℝ) ^ 2)) ↔
|
| 74 |
+
((fun u : ℕ => primeTripleLogSum u - σ u * (u : ℝ) ^ 2) =o[atTop]
|
| 75 |
+
(fun u : ℕ => (u : ℝ) ^ 2)) :=
|
| 76 |
+
mangoldt_prime_quadratic_asymptotic_iff_filter atTop le_rfl σ
|
| 77 |
+
|
| 78 |
+
end Problem337
|
| 79 |
+
|
| 80 |
+
end
|
| 81 |
+
|
| 82 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtBridge.lean
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMangoldt
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeWeighted
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open Filter
|
| 7 |
+
|
| 8 |
+
namespace Problem337
|
| 9 |
+
|
| 10 |
+
/-- The independently defined prime-weighted counts are identical. -/
|
| 11 |
+
lemma primeTripleLogSum_eq_weightedSupplyPrimeTriples (u : ℕ) :
|
| 12 |
+
primeTripleLogSum u = weightedSupplyPrimeTriples u := rfl
|
| 13 |
+
|
| 14 |
+
/-- The standard quadratic lower bound for the von Mangoldt convolution is
|
| 15 |
+
sufficient for the exact arithmetic hypothesis used in the Egyptian-fraction
|
| 16 |
+
construction. The genuinely analytic lower bound remains an explicit premise. -/
|
| 17 |
+
theorem quantitativeThreePrimeLowerBound_of_mangoldt
|
| 18 |
+
(hmain : ∃ c : ℝ, 0 < c ∧ ∀ᶠ u : ℕ in atTop, Odd u →
|
| 19 |
+
c * (u : ℝ) ^ 2 ≤ mangoldtTripleSum u) :
|
| 20 |
+
QuantitativeThreePrimeLowerBound := by
|
| 21 |
+
obtain ⟨c, hc, hmain⟩ := hmain
|
| 22 |
+
apply quantitativeThreePrimeLowerBound_of_weighted
|
| 23 |
+
refine ⟨c / 2, by positivity, ?_⟩
|
| 24 |
+
simpa only [primeTripleLogSum_eq_weightedSupplyPrimeTriples] using
|
| 25 |
+
weighted_prime_lower_bound_of_mangoldt c hc hmain
|
| 26 |
+
|
| 27 |
+
end Problem337
|
| 28 |
+
|
| 29 |
+
end
|
| 30 |
+
|
| 31 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtIntegral.lean
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeContinuousFourier
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMangoldt
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337.ThreePrimeContinuousFourier
|
| 9 |
+
|
| 10 |
+
/-- The actual positive-frequency Mangoldt polynomial on the unit circle. -/
|
| 11 |
+
def mangoldtPhaseSum (u : ℕ) (x : ℝ) : ℂ :=
|
| 12 |
+
∑ n ∈ Finset.Icc 1 u, (ArithmeticFunction.vonMangoldt n : ℂ) * phase (n : ℤ) x
|
| 13 |
+
|
| 14 |
+
lemma mangoldtPhaseSum_exp (u : ℕ) (x : ℝ) :
|
| 15 |
+
mangoldtPhaseSum u x = ∑ n ∈ Finset.Icc 1 u,
|
| 16 |
+
(ArithmeticFunction.vonMangoldt n : ℂ) *
|
| 17 |
+
Complex.exp (2 * Real.pi * Complex.I * (n : ℂ) * x) := by
|
| 18 |
+
simp only [mangoldtPhaseSum, phase_exp, Int.cast_natCast]
|
| 19 |
+
|
| 20 |
+
lemma mangoldtPhaseSum_continuous (u : ℕ) : Continuous (mangoldtPhaseSum u) := by
|
| 21 |
+
unfold mangoldtPhaseSum
|
| 22 |
+
exact continuous_finsetSum _ (fun n hn => continuous_const.mul (phase_continuous _))
|
| 23 |
+
|
| 24 |
+
/-- Exact continuous cubic extraction for the canonical positive-integer
|
| 25 |
+
Mangoldt convolution. In particular no prime-distribution estimate is used. -/
|
| 26 |
+
theorem mangoldt_triple_integral (u : ℕ) :
|
| 27 |
+
(∫ x in (0 : ℝ)..1, mangoldtPhaseSum u x ^ 3 * phase (-(u : ℤ)) x) =
|
| 28 |
+
(mangoldtTripleSum u : ℂ) := by
|
| 29 |
+
classical
|
| 30 |
+
have h := weighted_triple_finset_integral (Finset.Icc 1 u)
|
| 31 |
+
(fun n : ℕ => (n : ℤ)) (fun n => (ArithmeticFunction.vonMangoldt n : ℂ)) (u : ℤ)
|
| 32 |
+
change (∫ x in (0 : ℝ)..1,
|
| 33 |
+
(∑ n ∈ Finset.Icc 1 u, (ArithmeticFunction.vonMangoldt n : ℂ) *
|
| 34 |
+
phase (n : ℤ) x) ^ 3 * phase (-(u : ℤ)) x) = _
|
| 35 |
+
rw [h]
|
| 36 |
+
unfold mangoldtTripleSum supplyIntegerTriples
|
| 37 |
+
simp only [Finset.sum_filter, Finset.sum_product, Complex.ofReal_sum]
|
| 38 |
+
apply Finset.sum_congr rfl
|
| 39 |
+
intro a ha
|
| 40 |
+
apply Finset.sum_congr rfl
|
| 41 |
+
intro b hb
|
| 42 |
+
apply Finset.sum_congr rfl
|
| 43 |
+
intro c hc
|
| 44 |
+
have heq : ((a : ℤ) + (b : ℤ) + (c : ℤ) = (u : ℤ)) ↔ a + b + c = u := by omega
|
| 45 |
+
by_cases hsum : a + b + c = u <;> simp [heq, hsum]
|
| 46 |
+
|
| 47 |
+
/-- The integral is a genuine integrable complex expression, not an appeal to
|
| 48 |
+
the default value of the Bochner integral on a nonintegrable function. -/
|
| 49 |
+
theorem mangoldt_cubic_intervalIntegrable (u : ℕ) (a b : ℝ) :
|
| 50 |
+
IntervalIntegrable
|
| 51 |
+
(fun x => mangoldtPhaseSum u x ^ 3 * phase (-(u : ℤ)) x) MeasureTheory.volume a b := by
|
| 52 |
+
exact ((mangoldtPhaseSum_continuous u).pow 3 |>.mul
|
| 53 |
+
(phase_continuous _)).intervalIntegrable _ _
|
| 54 |
+
|
| 55 |
+
/-- Taking real parts recovers exactly the real arithmetic convolution. -/
|
| 56 |
+
theorem re_mangoldt_triple_integral (u : ℕ) :
|
| 57 |
+
(∫ x in (0 : ℝ)..1, mangoldtPhaseSum u x ^ 3 * phase (-(u : ℤ)) x).re =
|
| 58 |
+
mangoldtTripleSum u := by
|
| 59 |
+
rw [mangoldt_triple_integral]
|
| 60 |
+
rfl
|
| 61 |
+
|
| 62 |
+
end Problem337.ThreePrimeContinuousFourier
|
| 63 |
+
|
| 64 |
+
end
|
| 65 |
+
|
| 66 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMangoldtPowerError.lean
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMangoldtAsymptotics
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open Filter Asymptotics
|
| 6 |
+
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
/-- The elementary prime-power error is smaller than every power above `3/2`. -/
|
| 10 |
+
theorem mangoldt_triple_error_isLittleO_rpow
|
| 11 |
+
(α : ℝ) (hα : 3 / 2 < α) :
|
| 12 |
+
(fun x : ℝ => 3 * x * Real.log x ^ 2 *
|
| 13 |
+
(Chebyshev.psi x - Chebyshev.theta x)) =o[atTop]
|
| 14 |
+
(fun x : ℝ => x ^ α) := by
|
| 15 |
+
have hlog : (fun x : ℝ => Real.log x ^ 2) =o[atTop]
|
| 16 |
+
(fun x : ℝ => x ^ (α - 3 / 2)) := by
|
| 17 |
+
simpa only [Real.rpow_two] using
|
| 18 |
+
isLittleO_log_rpow_rpow_atTop (2 : ℝ) (by linarith : 0 < α - 3 / 2)
|
| 19 |
+
have hsmall := hlog.mul_isBigO Chebyshev.isBigO_psi_sub_theta_sqrt
|
| 20 |
+
have hscaled := hsmall.mul_isBigO (isBigO_refl (fun x : ℝ => x) atTop)
|
| 21 |
+
have hfinal :
|
| 22 |
+
(fun x : ℝ => x * Real.log x ^ 2 * (Chebyshev.psi x - Chebyshev.theta x))
|
| 23 |
+
=o[atTop] (fun x : ℝ => x ^ α) := by
|
| 24 |
+
apply hscaled.congr'
|
| 25 |
+
· exact Eventually.of_forall (fun x => by simp only [Pi.sub_apply]; ring)
|
| 26 |
+
· filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx
|
| 27 |
+
rw [Real.sqrt_eq_rpow]
|
| 28 |
+
calc
|
| 29 |
+
x ^ (α - 3 / 2) * x ^ (1 / 2 : ℝ) * x =
|
| 30 |
+
x ^ (α - 3 / 2) * x ^ (1 / 2 : ℝ) * x ^ (1 : ℝ) := by
|
| 31 |
+
rw [Real.rpow_one]
|
| 32 |
+
_ = x ^ α := by
|
| 33 |
+
rw [← Real.rpow_add hx, ← Real.rpow_add hx]
|
| 34 |
+
congr 1
|
| 35 |
+
ring
|
| 36 |
+
simpa only [mul_assoc] using hfinal.const_mul_left 3
|
| 37 |
+
|
| 38 |
+
/-- Actual Mangoldt and prime-only convolutions differ by `o(u^α)` for `α>3/2`. -/
|
| 39 |
+
theorem mangoldtTripleSum_sub_primeTripleLogSum_isLittleO_rpow
|
| 40 |
+
(α : ℝ) (hα : 3 / 2 < α) :
|
| 41 |
+
(fun u : ℕ => mangoldtTripleSum u - primeTripleLogSum u) =o[atTop]
|
| 42 |
+
(fun u : ℕ => (u : ℝ) ^ α) := by
|
| 43 |
+
have hbound := (mangoldt_triple_error_isLittleO_rpow α hα).comp_tendsto
|
| 44 |
+
(tendsto_natCast_atTop_atTop (R := ℝ))
|
| 45 |
+
apply IsLittleO.of_bound
|
| 46 |
+
intro c hc
|
| 47 |
+
filter_upwards [hbound.bound hc] with u hu
|
| 48 |
+
simp only [Function.comp_apply, Real.norm_eq_abs] at hu ⊢
|
| 49 |
+
exact (abs_mangoldtTripleSum_sub_primeTripleLogSum_le u).trans
|
| 50 |
+
((le_abs_self _).trans hu)
|
| 51 |
+
|
| 52 |
+
/-- A positive power lower bound for the Mangoldt convolution survives removing
|
| 53 |
+
higher prime powers at any exponent above `3/2`. The lower bound itself remains
|
| 54 |
+
an explicit analytic premise. -/
|
| 55 |
+
theorem weighted_prime_power_lower_bound_of_mangoldt
|
| 56 |
+
(α : ℝ) (hα : 3 / 2 < α) (c : ℝ) (hc : 0 < c)
|
| 57 |
+
(hmain : ∀ᶠ u : ℕ in atTop, Odd u → c * (u : ℝ) ^ α ≤ mangoldtTripleSum u) :
|
| 58 |
+
∀ᶠ u : ℕ in atTop, Odd u →
|
| 59 |
+
(c / 2) * (u : ℝ) ^ α ≤ primeTripleLogSum u := by
|
| 60 |
+
have herr := (mangoldtTripleSum_sub_primeTripleLogSum_isLittleO_rpow α hα).bound
|
| 61 |
+
(show 0 < c / 2 by positivity)
|
| 62 |
+
filter_upwards [hmain, herr] with u hu herr
|
| 63 |
+
intro hodd
|
| 64 |
+
rw [Real.norm_of_nonneg (Real.rpow_nonneg (Nat.cast_nonneg u) α),
|
| 65 |
+
Real.norm_eq_abs] at herr
|
| 66 |
+
have habs := le_abs_self (mangoldtTripleSum u - primeTripleLogSum u)
|
| 67 |
+
have hlower := hu hodd
|
| 68 |
+
linarith
|
| 69 |
+
|
| 70 |
+
/-- Transfer of an arbitrary power-scale asymptotic to genuine prime triples,
|
| 71 |
+
including along the odd integers or any other subfilter tending to infinity. -/
|
| 72 |
+
theorem mangoldt_prime_rpow_asymptotic_iff_filter
|
| 73 |
+
(α : ℝ) (hα : 3 / 2 < α) (l : Filter ℕ) (hl : l ≤ atTop) (σ : ℕ → ℝ) :
|
| 74 |
+
((fun u : ℕ => mangoldtTripleSum u - σ u * (u : ℝ) ^ α) =o[l]
|
| 75 |
+
(fun u : ℕ => (u : ℝ) ^ α)) ↔
|
| 76 |
+
((fun u : ℕ => primeTripleLogSum u - σ u * (u : ℝ) ^ α) =o[l]
|
| 77 |
+
(fun u : ℕ => (u : ℝ) ^ α)) := by
|
| 78 |
+
have herr := (mangoldtTripleSum_sub_primeTripleLogSum_isLittleO_rpow α hα).mono hl
|
| 79 |
+
constructor
|
| 80 |
+
· intro h
|
| 81 |
+
exact (h.sub herr).congr_left (fun u => by ring)
|
| 82 |
+
· intro h
|
| 83 |
+
exact (h.add herr).congr_left (fun u => by ring)
|
| 84 |
+
|
| 85 |
+
end Problem337
|
| 86 |
+
|
| 87 |
+
end
|
| 88 |
+
|
| 89 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMinorArc.lean
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.BilinearFourier
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeMinorEnergy
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337.ThreePrimeMinorArc
|
| 9 |
+
|
| 10 |
+
/-- The prime logarithmic polynomial has global size at most Chebyshev's
|
| 11 |
+
theta function, for arbitrary phases of norm at most one. -/
|
| 12 |
+
theorem prime_sum_norm_le_theta (u : ℕ) (phase : ℕ → ℂ)
|
| 13 |
+
(hphase : ∀ p ∈ Nat.primesLE u, ‖phase p‖ ≤ 1) :
|
| 14 |
+
‖∑ p ∈ Nat.primesLE u, (Real.log (p : ℝ) : ℂ) * phase p‖ ≤
|
| 15 |
+
Chebyshev.theta (u : ℝ) := by
|
| 16 |
+
rw [Chebyshev.theta_eq_sum_primesLE_log]
|
| 17 |
+
apply (norm_sum_le _ _).trans
|
| 18 |
+
apply Finset.sum_le_sum
|
| 19 |
+
intro p hp
|
| 20 |
+
have hlog : 0 ≤ Real.log (p : ℝ) :=
|
| 21 |
+
Real.log_nonneg (by exact_mod_cast (Nat.mem_primesLE.mp hp).2.one_le)
|
| 22 |
+
rw [norm_mul, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg hlog]
|
| 23 |
+
simpa using mul_le_mul_of_nonneg_left (hphase p hp) hlog
|
| 24 |
+
|
| 25 |
+
/-- An unconditional linear global amplitude bound, with an explicit constant. -/
|
| 26 |
+
theorem prime_sum_norm_le (u : ℕ) (phase : ℕ → ℂ)
|
| 27 |
+
(hphase : ∀ p ∈ Nat.primesLE u, ‖phase p‖ ≤ 1) :
|
| 28 |
+
‖∑ p ∈ Nat.primesLE u, (Real.log (p : ℝ) : ℂ) * phase p‖ ≤
|
| 29 |
+
Real.log 4 * (u : ℝ) :=
|
| 30 |
+
(prime_sum_norm_le_theta u phase hphase).trans
|
| 31 |
+
(Chebyshev.theta_le_log4_mul_x (Nat.cast_nonneg u))
|
| 32 |
+
|
| 33 |
+
/-- The cubic contribution of any set of frequencies is controlled by a
|
| 34 |
+
uniform bound on that set and the full Fourier energy. The twist may be any
|
| 35 |
+
function of norm at most one. This is the elementary minor-arc reduction,
|
| 36 |
+
not an assertion of a prime exponential-sum estimate. -/
|
| 37 |
+
theorem cubic_contribution_le_energy {q : ℕ} [NeZero q]
|
| 38 |
+
(w : ZMod q → ℂ) (minor : Finset (ZMod q))
|
| 39 |
+
(twist : ZMod q → ℂ) (A : ℝ) (hA : 0 ≤ A)
|
| 40 |
+
(hbound : ∀ r ∈ minor, ‖residueFourier w r‖ ≤ A)
|
| 41 |
+
(htwist : ∀ r ∈ minor, ‖twist r‖ ≤ 1) :
|
| 42 |
+
‖(∑ r ∈ minor, residueFourier w r ^ 3 * twist r) / (q : ℂ)‖ ≤
|
| 43 |
+
A * ∑ n : ZMod q, ‖w n‖ ^ 2 := by
|
| 44 |
+
have htransform (r : ZMod q) :
|
| 45 |
+
residueFourier w r = ZMod.dft (fun n => w (-n)) r := by
|
| 46 |
+
rw [ZMod.dft_comp_neg]
|
| 47 |
+
simp only [residueFourier, ZMod.dft_apply, smul_eq_mul, mul_neg, neg_neg]
|
| 48 |
+
apply Finset.sum_congr rfl
|
| 49 |
+
intro n hn
|
| 50 |
+
rw [mul_comm n r, mul_comm]
|
| 51 |
+
have h := ThreePrimeMinorEnergy.minor_cubic_bound
|
| 52 |
+
(fun n => w (-n)) twist minor A hA (by
|
| 53 |
+
intro r hr
|
| 54 |
+
rw [← htransform]
|
| 55 |
+
exact hbound r hr) htwist
|
| 56 |
+
simp_rw [← htransform] at h
|
| 57 |
+
have henergy : (∑ n : ZMod q, ‖w (-n)‖ ^ 2) =
|
| 58 |
+
∑ n : ZMod q, ‖w n‖ ^ 2 :=
|
| 59 |
+
Equiv.sum_comp (Equiv.neg _) (fun n => ‖w n‖ ^ 2)
|
| 60 |
+
rw [henergy] at h
|
| 61 |
+
simpa only [div_eq_mul_inv, mul_comm] using h
|
| 62 |
+
|
| 63 |
+
/-- The usual additive-character twist for the coefficient at `u`. -/
|
| 64 |
+
theorem cubic_character_contribution_le_energy {q : ℕ} [NeZero q]
|
| 65 |
+
(w : ZMod q → ℂ) (minor : Finset (ZMod q)) (u : ZMod q)
|
| 66 |
+
(A : ℝ) (hA : 0 ≤ A)
|
| 67 |
+
(hbound : ∀ r ∈ minor, ‖residueFourier w r‖ ≤ A) :
|
| 68 |
+
‖(∑ r ∈ minor, residueFourier w r ^ 3 * ZMod.stdAddChar (-(r * u))) /
|
| 69 |
+
(q : ℂ)‖ ≤ A * ∑ n : ZMod q, ‖w n‖ ^ 2 := by
|
| 70 |
+
apply cubic_contribution_le_energy w minor _ A hA hbound
|
| 71 |
+
intro r hr
|
| 72 |
+
simp [ZMod.stdAddChar_apply]
|
| 73 |
+
|
| 74 |
+
/-- Prime logarithmic weights, zero padded in a cyclic group. -/
|
| 75 |
+
def primeLogWeight {q : ℕ} [NeZero q] (u : ℕ) (n : ZMod q) : ℂ :=
|
| 76 |
+
if n.val ∈ Nat.primesLE u then (Real.log (n.val : ℝ) : ℂ) else 0
|
| 77 |
+
|
| 78 |
+
/-- Zero padding preserves the exact prime-weight energy when `u < q`. -/
|
| 79 |
+
theorem primeLogWeight_energy {q : ℕ} [NeZero q] (u : ℕ) (huq : u < q) :
|
| 80 |
+
(∑ n : ZMod q, ‖primeLogWeight u n‖ ^ 2) =
|
| 81 |
+
∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2 := by
|
| 82 |
+
classical
|
| 83 |
+
calc
|
| 84 |
+
(∑ n : ZMod q, ‖primeLogWeight u n‖ ^ 2) =
|
| 85 |
+
∑ n ∈ Finset.univ.filter (fun n : ZMod q => n.val ∈ Nat.primesLE u),
|
| 86 |
+
Real.log (n.val : ℝ) ^ 2 := by
|
| 87 |
+
simp [primeLogWeight, Finset.sum_filter, apply_ite, Complex.norm_real,
|
| 88 |
+
Real.norm_eq_abs, sq_abs]
|
| 89 |
+
_ = ∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2 := by
|
| 90 |
+
apply Finset.sum_bij (fun n _ => n.val)
|
| 91 |
+
· intro n hn
|
| 92 |
+
exact (Finset.mem_filter.mp hn).2
|
| 93 |
+
· intro n hn n' hn' heq
|
| 94 |
+
exact ZMod.val_injective q heq
|
| 95 |
+
· intro p hp
|
| 96 |
+
have hpq : p < q := (Nat.mem_primesLE.mp hp).1.trans_lt huq
|
| 97 |
+
refine ⟨(p : ZMod q), ?_, ZMod.val_natCast_of_lt hpq⟩
|
| 98 |
+
simp [ZMod.val_natCast_of_lt hpq, hp]
|
| 99 |
+
· intro n hn
|
| 100 |
+
rfl
|
| 101 |
+
|
| 102 |
+
/-- The zero-padded transform is exactly the usual prime exponential sum. -/
|
| 103 |
+
theorem residueFourier_primeLogWeight {q : ℕ} [NeZero q]
|
| 104 |
+
(u : ℕ) (huq : u < q) (r : ZMod q) :
|
| 105 |
+
residueFourier (primeLogWeight u) r =
|
| 106 |
+
∑ p ∈ Nat.primesLE u,
|
| 107 |
+
(Real.log (p : ℝ) : ℂ) * ZMod.stdAddChar (r * (p : ZMod q)) := by
|
| 108 |
+
classical
|
| 109 |
+
calc
|
| 110 |
+
residueFourier (primeLogWeight u) r =
|
| 111 |
+
∑ n ∈ Finset.univ.filter (fun n : ZMod q => n.val ∈ Nat.primesLE u),
|
| 112 |
+
(Real.log (n.val : ℝ) : ℂ) * ZMod.stdAddChar (r * n) := by
|
| 113 |
+
simp [residueFourier, primeLogWeight, Finset.sum_filter, ite_mul]
|
| 114 |
+
_ = ∑ p ∈ Nat.primesLE u,
|
| 115 |
+
(Real.log (p : ℝ) : ℂ) * ZMod.stdAddChar (r * (p : ZMod q)) := by
|
| 116 |
+
apply Finset.sum_bij (fun n _ => n.val)
|
| 117 |
+
· intro n hn
|
| 118 |
+
exact (Finset.mem_filter.mp hn).2
|
| 119 |
+
· intro n hn n' hn' heq
|
| 120 |
+
exact ZMod.val_injective q heq
|
| 121 |
+
· intro p hp
|
| 122 |
+
have hpq : p < q := (Nat.mem_primesLE.mp hp).1.trans_lt huq
|
| 123 |
+
refine ⟨(p : ZMod q), ?_, ZMod.val_natCast_of_lt hpq⟩
|
| 124 |
+
simp [ZMod.val_natCast_of_lt hpq, hp]
|
| 125 |
+
· intro n hn
|
| 126 |
+
simp only [ZMod.natCast_zmod_val]
|
| 127 |
+
|
| 128 |
+
/-- A Chebyshev energy bound saves one logarithm compared with the trivial
|
| 129 |
+
bound obtained by counting all integers up to `u`. -/
|
| 130 |
+
theorem prime_log_squares_le (u : ℕ) (hu : 1 ≤ u) :
|
| 131 |
+
(∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2) ≤
|
| 132 |
+
Real.log 4 * (u : ℝ) * Real.log (u : ℝ) := by
|
| 133 |
+
have hlogu : 0 ≤ Real.log (u : ℝ) := Real.log_nonneg (by exact_mod_cast hu)
|
| 134 |
+
calc
|
| 135 |
+
(∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2) ≤
|
| 136 |
+
∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) * Real.log (u : ℝ) := by
|
| 137 |
+
apply Finset.sum_le_sum
|
| 138 |
+
intro p hp
|
| 139 |
+
obtain ⟨hpu, hprime⟩ := Nat.mem_primesLE.mp hp
|
| 140 |
+
have hp0 : (0 : ℝ) < p := by exact_mod_cast hprime.pos
|
| 141 |
+
have hplog : 0 ≤ Real.log (p : ℝ) :=
|
| 142 |
+
Real.log_nonneg (by exact_mod_cast hprime.one_le)
|
| 143 |
+
have hlog : Real.log (p : ℝ) ≤ Real.log (u : ℝ) :=
|
| 144 |
+
Real.log_le_log hp0 (by exact_mod_cast hpu)
|
| 145 |
+
simpa [pow_two] using mul_le_mul_of_nonneg_left hlog hplog
|
| 146 |
+
_ = Chebyshev.theta (u : ℝ) * Real.log (u : ℝ) := by
|
| 147 |
+
rw [Chebyshev.theta_eq_sum_primesLE_log, Finset.sum_mul]
|
| 148 |
+
_ ≤ Real.log 4 * (u : ℝ) * Real.log (u : ℝ) :=
|
| 149 |
+
mul_le_mul_of_nonneg_right (Chebyshev.theta_le_log4_mul_x (Nat.cast_nonneg u)) hlogu
|
| 150 |
+
|
| 151 |
+
/-- A minor-frequency supremum bound for the actual prime sum yields a
|
| 152 |
+
quadratic error with the Chebyshev constant made explicit. -/
|
| 153 |
+
theorem prime_cubic_contribution_le {q : ℕ} [NeZero q]
|
| 154 |
+
(u : ℕ) (hu : 2 ≤ u) (huq : u < q) (minor : Finset (ZMod q))
|
| 155 |
+
(ε : ℝ) (hε : 0 ≤ ε)
|
| 156 |
+
(hbound : ∀ r ∈ minor,
|
| 157 |
+
‖∑ p ∈ Nat.primesLE u,
|
| 158 |
+
(Real.log (p : ℝ) : ℂ) * ZMod.stdAddChar (r * (p : ZMod q))‖ ≤
|
| 159 |
+
ε * (u : ℝ) / Real.log (u : ℝ)) :
|
| 160 |
+
‖(∑ r ∈ minor, (∑ p ∈ Nat.primesLE u,
|
| 161 |
+
(Real.log (p : ℝ) : ℂ) * ZMod.stdAddChar (r * (p : ZMod q))) ^ 3 *
|
| 162 |
+
ZMod.stdAddChar (-(r * (u : ZMod q)))) / (q : ℂ)‖ ≤
|
| 163 |
+
ε * Real.log 4 * (u : ℝ) ^ 2 := by
|
| 164 |
+
have hu1 : 1 < (u : ℝ) := by exact_mod_cast (show 1 < u by omega)
|
| 165 |
+
have hlog : 0 < Real.log (u : ℝ) := Real.log_pos hu1
|
| 166 |
+
have hA : 0 ≤ ε * (u : ℝ) / Real.log (u : ℝ) := by positivity
|
| 167 |
+
have h := cubic_character_contribution_le_energy (primeLogWeight u) minor
|
| 168 |
+
(u : ZMod q) (ε * (u : ℝ) / Real.log (u : ℝ)) hA (by
|
| 169 |
+
intro r hr
|
| 170 |
+
rw [residueFourier_primeLogWeight u huq]
|
| 171 |
+
exact hbound r hr)
|
| 172 |
+
simp_rw [residueFourier_primeLogWeight u huq] at h
|
| 173 |
+
rw [primeLogWeight_energy u huq] at h
|
| 174 |
+
apply h.trans
|
| 175 |
+
calc
|
| 176 |
+
ε * (u : ℝ) / Real.log (u : ℝ) *
|
| 177 |
+
(∑ p ∈ Nat.primesLE u, Real.log (p : ℝ) ^ 2) ≤
|
| 178 |
+
ε * (u : ℝ) / Real.log (u : ℝ) *
|
| 179 |
+
(Real.log 4 * (u : ℝ) * Real.log (u : ℝ)) :=
|
| 180 |
+
mul_le_mul_of_nonneg_left (prime_log_squares_le u (by omega)) hA
|
| 181 |
+
_ = ε * Real.log 4 * (u : ℝ) ^ 2 := by
|
| 182 |
+
field_simp
|
| 183 |
+
|
| 184 |
+
end Problem337.ThreePrimeMinorArc
|
| 185 |
+
|
| 186 |
+
end
|
| 187 |
+
|
| 188 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeMinorEnergy.lean
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators ComplexConjugate
|
| 6 |
+
|
| 7 |
+
namespace Problem337.ThreePrimeMinorEnergy
|
| 8 |
+
|
| 9 |
+
variable {q : ℕ} [NeZero q]
|
| 10 |
+
|
| 11 |
+
/-- Transposition for the unnormalized discrete Fourier transform. -/
|
| 12 |
+
theorem sum_dft_mul (f g : ZMod q → ℂ) :
|
| 13 |
+
(∑ k, ZMod.dft f k * g k) = ∑ x, f x * ZMod.dft g x := by
|
| 14 |
+
simp only [ZMod.dft_apply, smul_eq_mul, Finset.sum_mul, Finset.mul_sum]
|
| 15 |
+
rw [Finset.sum_comm]
|
| 16 |
+
apply Finset.sum_congr rfl
|
| 17 |
+
intro x hx
|
| 18 |
+
apply Finset.sum_congr rfl
|
| 19 |
+
intro k hk
|
| 20 |
+
rw [mul_comm k x]
|
| 21 |
+
ring
|
| 22 |
+
|
| 23 |
+
/-- Complex conjugation reverses the Fourier frequency. -/
|
| 24 |
+
theorem dft_conj (f : ZMod q → ℂ) (k : ZMod q) :
|
| 25 |
+
ZMod.dft (fun x => conj (f x)) k = conj (ZMod.dft f (-k)) := by
|
| 26 |
+
simp only [ZMod.dft_apply, smul_eq_mul, map_sum, map_mul,
|
| 27 |
+
← AddChar.map_neg_eq_conj]
|
| 28 |
+
apply Finset.sum_congr rfl
|
| 29 |
+
intro x hx
|
| 30 |
+
congr 2
|
| 31 |
+
ring
|
| 32 |
+
|
| 33 |
+
/-- Exact Parseval identity, retaining the factor `q` for counting measure. -/
|
| 34 |
+
theorem dft_parseval (f : ZMod q → ℂ) :
|
| 35 |
+
(∑ k, ‖ZMod.dft f k‖ ^ 2) = (q : ℝ) * ∑ x, ‖f x‖ ^ 2 := by
|
| 36 |
+
have h := sum_dft_mul f (fun k => conj (ZMod.dft f k))
|
| 37 |
+
have hconj (x : ZMod q) :
|
| 38 |
+
ZMod.dft (fun k => conj (ZMod.dft f k)) x = (q : ℂ) * conj (f x) := by
|
| 39 |
+
rw [dft_conj]
|
| 40 |
+
simp only [ZMod.dft_dft, neg_neg, smul_eq_mul, map_mul, map_natCast]
|
| 41 |
+
simp only [hconj] at h
|
| 42 |
+
have h' : (∑ k, (‖ZMod.dft f k‖ ^ 2 : ℂ)) =
|
| 43 |
+
(q : ℂ) * ∑ x, (‖f x‖ ^ 2 : ℂ) := by
|
| 44 |
+
calc
|
| 45 |
+
(∑ k, (‖ZMod.dft f k‖ ^ 2 : ℂ)) =
|
| 46 |
+
∑ k, ZMod.dft f k * conj (ZMod.dft f k) := by
|
| 47 |
+
apply Finset.sum_congr rfl
|
| 48 |
+
intro k hk
|
| 49 |
+
rw [Complex.mul_conj, Complex.normSq_eq_norm_sq, Complex.ofReal_pow]
|
| 50 |
+
_ = ∑ x, f x * ((q : ℂ) * conj (f x)) := h
|
| 51 |
+
_ = (q : ℂ) * ∑ x, (‖f x‖ ^ 2 : ℂ) := by
|
| 52 |
+
rw [Finset.mul_sum]
|
| 53 |
+
apply Finset.sum_congr rfl
|
| 54 |
+
intro x hx
|
| 55 |
+
rw [← mul_assoc, mul_comm (f x) (q : ℂ), mul_assoc,
|
| 56 |
+
Complex.mul_conj, Complex.normSq_eq_norm_sq, Complex.ofReal_pow]
|
| 57 |
+
exact_mod_cast h'
|
| 58 |
+
|
| 59 |
+
/-- The cubic contribution of any frequency set is controlled by its
|
| 60 |
+
supremum Fourier bound and the exact input energy. The phase may be any
|
| 61 |
+
function of modulus at most one, so either Fourier sign convention is allowed. -/
|
| 62 |
+
theorem minor_cubic_bound (f phase : ZMod q → ℂ) (minor : Finset (ZMod q))
|
| 63 |
+
(B : ℝ) (hB : 0 ≤ B)
|
| 64 |
+
(hminor : ∀ k ∈ minor, ‖ZMod.dft f k‖ ≤ B)
|
| 65 |
+
(hphase : ∀ k ∈ minor, ‖phase k‖ ≤ 1) :
|
| 66 |
+
‖(q : ℂ)⁻¹ * ∑ k ∈ minor, ZMod.dft f k ^ 3 * phase k‖ ≤
|
| 67 |
+
B * ∑ x, ‖f x‖ ^ 2 := by
|
| 68 |
+
have hq : (0 : ℝ) < q := by exact_mod_cast Nat.pos_of_ne_zero (NeZero.ne q)
|
| 69 |
+
have hsum : ‖∑ k ∈ minor, ZMod.dft f k ^ 3 * phase k‖ ≤
|
| 70 |
+
B * ((q : ℝ) * ∑ x, ‖f x‖ ^ 2) := by
|
| 71 |
+
calc
|
| 72 |
+
‖∑ k ∈ minor, ZMod.dft f k ^ 3 * phase k‖ ≤
|
| 73 |
+
∑ k ∈ minor, ‖ZMod.dft f k ^ 3 * phase k‖ := norm_sum_le _ _
|
| 74 |
+
_ ≤ ∑ k ∈ minor, B * ‖ZMod.dft f k‖ ^ 2 := by
|
| 75 |
+
apply Finset.sum_le_sum
|
| 76 |
+
intro k hk
|
| 77 |
+
rw [norm_mul, norm_pow]
|
| 78 |
+
calc
|
| 79 |
+
‖ZMod.dft f k‖ ^ 3 * ‖phase k‖ ≤ ‖ZMod.dft f k‖ ^ 3 := by
|
| 80 |
+
simpa using mul_le_mul_of_nonneg_left (hphase k hk) (by positivity :
|
| 81 |
+
0 ≤ ‖ZMod.dft f k‖ ^ 3)
|
| 82 |
+
_ ≤ B * ‖ZMod.dft f k‖ ^ 2 := by
|
| 83 |
+
nlinarith [mul_le_mul_of_nonneg_right (hminor k hk)
|
| 84 |
+
(sq_nonneg ‖ZMod.dft f k‖)]
|
| 85 |
+
_ = B * ∑ k ∈ minor, ‖ZMod.dft f k‖ ^ 2 := (Finset.mul_sum ..).symm
|
| 86 |
+
_ ≤ B * ∑ k, ‖ZMod.dft f k‖ ^ 2 := by
|
| 87 |
+
apply mul_le_mul_of_nonneg_left _ hB
|
| 88 |
+
exact Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ _)
|
| 89 |
+
(by intros; positivity)
|
| 90 |
+
_ = B * ((q : ℝ) * ∑ x, ‖f x‖ ^ 2) := by rw [dft_parseval]
|
| 91 |
+
rw [norm_mul, norm_inv, Complex.norm_natCast]
|
| 92 |
+
calc
|
| 93 |
+
(q : ℝ)⁻¹ * ‖∑ k ∈ minor, ZMod.dft f k ^ 3 * phase k‖ ≤
|
| 94 |
+
(q : ℝ)⁻¹ * (B * ((q : ℝ) * ∑ x, ‖f x‖ ^ 2)) :=
|
| 95 |
+
mul_le_mul_of_nonneg_left hsum (inv_nonneg.mpr hq.le)
|
| 96 |
+
_ = B * ∑ x, ‖f x‖ ^ 2 := by field_simp
|
| 97 |
+
|
| 98 |
+
end Problem337.ThreePrimeMinorEnergy
|
| 99 |
+
|
| 100 |
+
end
|
| 101 |
+
|
| 102 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimePartialSummation.lean
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.FirstDerivativeSum
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
|
| 7 |
+
namespace Problem337.ThreePrimeAnalysis
|
| 8 |
+
|
| 9 |
+
/-- Finite Abel summation controlled by initial partial sums and total variation. -/
|
| 10 |
+
theorem weighted_sum_norm_le_partial_sum_bound
|
| 11 |
+
(a b : ℕ → ℂ) (n : ℕ) (B : ℝ)
|
| 12 |
+
(hprefix : ∀ k ≤ n + 1, ‖∑ j ∈ Finset.range k, a j‖ ≤ B) :
|
| 13 |
+
‖∑ j ∈ Finset.range (n + 1), b j * a j‖ ≤
|
| 14 |
+
B * (‖b n‖ + ∑ j ∈ Finset.range n, ‖b (j + 1) - b j‖) := by
|
| 15 |
+
let A : ℕ → ℂ := fun k => ∑ j ∈ Finset.range k, a j
|
| 16 |
+
have hdiff (j : ℕ) : A (j + 1) - A j = a j := by
|
| 17 |
+
simp [A, Finset.sum_range_succ]
|
| 18 |
+
have hid := Problem337.weighted_difference_sum A b n
|
| 19 |
+
simp only [hdiff, A, Finset.range_zero, Finset.sum_empty, mul_zero, sub_zero] at hid
|
| 20 |
+
rw [hid]
|
| 21 |
+
calc
|
| 22 |
+
_ ≤ ‖b n * ∑ j ∈ Finset.range (n + 1), a j‖ +
|
| 23 |
+
‖∑ j ∈ Finset.range n, (b (j + 1) - b j) *
|
| 24 |
+
∑ i ∈ Finset.range (j + 1), a i‖ := norm_sub_le _ _
|
| 25 |
+
_ ≤ ‖b n‖ * B + ∑ j ∈ Finset.range n, ‖b (j + 1) - b j‖ * B := by
|
| 26 |
+
apply add_le_add
|
| 27 |
+
· rw [norm_mul]
|
| 28 |
+
exact mul_le_mul_of_nonneg_left (hprefix (n + 1) le_rfl) (norm_nonneg _)
|
| 29 |
+
· apply (norm_sum_le _ _).trans
|
| 30 |
+
apply Finset.sum_le_sum
|
| 31 |
+
intro j hj
|
| 32 |
+
rw [norm_mul]
|
| 33 |
+
exact mul_le_mul_of_nonneg_left (hprefix (j + 1) (by
|
| 34 |
+
have := Finset.mem_range.mp hj
|
| 35 |
+
omega)) (norm_nonneg _)
|
| 36 |
+
_ = _ := by rw [← Finset.sum_mul]; ring
|
| 37 |
+
|
| 38 |
+
/-- The unit exponential is one-Lipschitz in its real angle. -/
|
| 39 |
+
theorem norm_exp_I_mul_sub_le (x y : ℝ) :
|
| 40 |
+
‖Complex.exp (Complex.I * (x : ℂ)) - Complex.exp (Complex.I * (y : ℂ))‖ ≤
|
| 41 |
+
|x - y| := by
|
| 42 |
+
have hid : Complex.exp (Complex.I * (x : ℂ)) - Complex.exp (Complex.I * (y : ℂ)) =
|
| 43 |
+
Complex.exp (Complex.I * (y : ℂ)) *
|
| 44 |
+
(Complex.exp (Complex.I * ((x - y : ℝ) : ℂ)) - 1) := by
|
| 45 |
+
rw [mul_sub, mul_one, ← Complex.exp_add]
|
| 46 |
+
congr 2
|
| 47 |
+
push_cast
|
| 48 |
+
ring
|
| 49 |
+
rw [hid, norm_mul, Complex.norm_exp_I_mul_ofReal, one_mul]
|
| 50 |
+
simpa only [Real.norm_eq_abs] using
|
| 51 |
+
(Real.norm_exp_I_mul_ofReal_sub_one_le (x := x - y))
|
| 52 |
+
|
| 53 |
+
/-- Linear-phase Abel transfer, uniform in the initial angle and frequency. -/
|
| 54 |
+
theorem linear_phase_sum_norm_le
|
| 55 |
+
(a : ℕ → ℂ) (N : ℕ) (B α t : ℝ) (hB : 0 ≤ B)
|
| 56 |
+
(hprefix : ∀ k ≤ N, ‖∑ j ∈ Finset.range k, a j‖ ≤ B) :
|
| 57 |
+
‖∑ j ∈ Finset.range N,
|
| 58 |
+
Complex.exp (Complex.I * ((α + t * j : ℝ) : ℂ)) * a j‖ ≤
|
| 59 |
+
B * (1 + |t| * N) := by
|
| 60 |
+
cases N with
|
| 61 |
+
| zero => simpa using hB
|
| 62 |
+
| succ n =>
|
| 63 |
+
have h := weighted_sum_norm_le_partial_sum_bound a
|
| 64 |
+
(fun j => Complex.exp (Complex.I * ((α + t * j : ℝ) : ℂ))) n B hprefix
|
| 65 |
+
have hvariation :
|
| 66 |
+
(∑ j ∈ Finset.range n,
|
| 67 |
+
‖Complex.exp (Complex.I * ((α + t * (j + 1 : ℕ) : ℝ) : ℂ)) -
|
| 68 |
+
Complex.exp (Complex.I * ((α + t * j : ℝ) : ℂ))‖) ≤ (n : ℝ) * |t| := by
|
| 69 |
+
calc
|
| 70 |
+
_ ≤ ∑ _j ∈ Finset.range n, |t| := by
|
| 71 |
+
apply Finset.sum_le_sum
|
| 72 |
+
intro j hj
|
| 73 |
+
have heq : α + t * (j + 1 : ℕ) - (α + t * j) = t := by
|
| 74 |
+
push_cast
|
| 75 |
+
ring
|
| 76 |
+
simpa only [heq] using norm_exp_I_mul_sub_le
|
| 77 |
+
(α + t * (j + 1 : ℕ)) (α + t * j)
|
| 78 |
+
_ = _ := by simp
|
| 79 |
+
rw [Complex.norm_exp_I_mul_ofReal] at h
|
| 80 |
+
apply h.trans
|
| 81 |
+
apply mul_le_mul_of_nonneg_left _ hB
|
| 82 |
+
have ht := abs_nonneg t
|
| 83 |
+
push_cast at hvariation ⊢
|
| 84 |
+
nlinarith
|
| 85 |
+
|
| 86 |
+
/-- The major-arc partial-summation error estimate, in turns rather than radians.
|
| 87 |
+
It is conditional only on the stated finite prefix discrepancy. -/
|
| 88 |
+
theorem twisted_sum_sub_norm_le
|
| 89 |
+
(a b : ℕ → ℂ) (N : ℕ) (B β : ℝ) (hB : 0 ≤ B)
|
| 90 |
+
(hprefix : ∀ k ≤ N,
|
| 91 |
+
‖(∑ j ∈ Finset.range k, a j) - ∑ j ∈ Finset.range k, b j‖ ≤ B) :
|
| 92 |
+
‖(∑ j ∈ Finset.range N,
|
| 93 |
+
Complex.exp (Complex.I * ((2 * Real.pi * β * j : ℝ) : ℂ)) * a j) -
|
| 94 |
+
∑ j ∈ Finset.range N,
|
| 95 |
+
Complex.exp (Complex.I * ((2 * Real.pi * β * j : ℝ) : ℂ)) * b j‖ ≤
|
| 96 |
+
B * (1 + 2 * Real.pi * |β| * N) := by
|
| 97 |
+
have h := linear_phase_sum_norm_le (fun j => a j - b j) N B 0
|
| 98 |
+
(2 * Real.pi * β) hB (by
|
| 99 |
+
intro k hk
|
| 100 |
+
simpa only [Finset.sum_sub_distrib] using hprefix k hk)
|
| 101 |
+
simpa only [zero_add, mul_sub, Finset.sum_sub_distrib, abs_mul,
|
| 102 |
+
abs_of_pos Real.pi_pos, abs_of_pos (show (0 : ℝ) < 2 by norm_num)] using h
|
| 103 |
+
|
| 104 |
+
end Problem337.ThreePrimeAnalysis
|
| 105 |
+
|
| 106 |
+
end
|
| 107 |
+
|
| 108 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeSingularSeries.lean
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.RationalSupplyReduction
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
open Filter
|
| 7 |
+
|
| 8 |
+
namespace Problem337
|
| 9 |
+
|
| 10 |
+
/-- The odd-prime local perturbation in the ternary Goldbach singular series.
|
| 11 |
+
Index `n` corresponds to the integer `n + 3`; nonprimes contribute zero. -/
|
| 12 |
+
def threePrimeOddPerturbation (u n : ℕ) : ℝ :=
|
| 13 |
+
if (n + 3).Prime then
|
| 14 |
+
if n + 3 ∣ u then -(1 / ((n : ℝ) + 2) ^ 2)
|
| 15 |
+
else 1 / ((n : ℝ) + 2) ^ 3
|
| 16 |
+
else 0
|
| 17 |
+
|
| 18 |
+
/-- The local factor at two, with all the odd-prime factors following it. -/
|
| 19 |
+
def threePrimeSingularSeries (u : ℕ) : ℝ :=
|
| 20 |
+
(if Odd u then 2 else 0) *
|
| 21 |
+
∏' n : ℕ, (1 + threePrimeOddPerturbation u n)
|
| 22 |
+
|
| 23 |
+
lemma threePrimeOddPerturbation_norm_le (u n : ℕ) :
|
| 24 |
+
‖threePrimeOddPerturbation u n‖ ≤ 1 / ((n : ℝ) + 2) ^ 2 := by
|
| 25 |
+
have hx : 1 ≤ (n : ℝ) + 2 := by have := Nat.cast_nonneg (α := ℝ) n; linarith
|
| 26 |
+
have hx0 : 0 < (n : ℝ) + 2 := by positivity
|
| 27 |
+
unfold threePrimeOddPerturbation
|
| 28 |
+
split_ifs
|
| 29 |
+
· simp [Real.norm_eq_abs]
|
| 30 |
+
· rw [Real.norm_eq_abs, abs_of_nonneg (by positivity)]
|
| 31 |
+
apply div_le_div_of_nonneg_left zero_le_one (by positivity)
|
| 32 |
+
nlinarith [sq_nonneg ((n : ℝ) + 2)]
|
| 33 |
+
· simp only [norm_zero]
|
| 34 |
+
positivity
|
| 35 |
+
|
| 36 |
+
lemma threePrimeOddPerturbation_summable (u : ℕ) :
|
| 37 |
+
Summable (threePrimeOddPerturbation u) := by
|
| 38 |
+
have hs : Summable (fun n : ℕ => 1 / ((n : ℝ) + 2) ^ 2) := by
|
| 39 |
+
simpa only [Nat.cast_add, Nat.cast_ofNat] using
|
| 40 |
+
(summable_nat_add_iff 2).mpr (Real.summable_one_div_nat_pow.mpr (by norm_num : 1 < 2))
|
| 41 |
+
exact hs.of_norm_bounded (threePrimeOddPerturbation_norm_le u)
|
| 42 |
+
|
| 43 |
+
lemma threePrimeOddFactors_multipliable (u : ℕ) :
|
| 44 |
+
Multipliable (fun n : ℕ => 1 + threePrimeOddPerturbation u n) :=
|
| 45 |
+
Real.multipliable_one_add_of_summable (threePrimeOddPerturbation_summable u)
|
| 46 |
+
|
| 47 |
+
/-- The telescoping product over all integers is a lower bound for the product
|
| 48 |
+
of the negative local factors over any subset of odd primes. -/
|
| 49 |
+
lemma prod_one_sub_reciprocal_square (N : ℕ) :
|
| 50 |
+
(∏ n ∈ Finset.range N, (1 - 1 / ((n : ℝ) + 2) ^ 2)) =
|
| 51 |
+
((N : ℝ) + 2) / (2 * ((N : ℝ) + 1)) := by
|
| 52 |
+
induction N with
|
| 53 |
+
| zero => norm_num
|
| 54 |
+
| succ N ih =>
|
| 55 |
+
rw [Finset.prod_range_succ, ih]
|
| 56 |
+
push_cast
|
| 57 |
+
have h1 : (N : ℝ) + 1 ≠ 0 := by positivity
|
| 58 |
+
have h2 : (N : ℝ) + 2 ≠ 0 := by positivity
|
| 59 |
+
field_simp
|
| 60 |
+
ring
|
| 61 |
+
|
| 62 |
+
lemma one_sub_reciprocal_square_nonneg (n : ℕ) :
|
| 63 |
+
0 ≤ 1 - 1 / ((n : ℝ) + 2) ^ 2 := by
|
| 64 |
+
have hsq : 1 ≤ ((n : ℝ) + 2) ^ 2 := by nlinarith [Nat.cast_nonneg (α := ℝ) n]
|
| 65 |
+
have hdiv : 1 / ((n : ℝ) + 2) ^ 2 ≤ 1 :=
|
| 66 |
+
(div_le_one (by positivity)).2 hsq
|
| 67 |
+
linarith
|
| 68 |
+
|
| 69 |
+
lemma threePrimeOddFactor_lower (u n : ℕ) :
|
| 70 |
+
1 - 1 / ((n : ℝ) + 2) ^ 2 ≤ 1 + threePrimeOddPerturbation u n := by
|
| 71 |
+
unfold threePrimeOddPerturbation
|
| 72 |
+
split_ifs <;> have h2 : 0 ≤ 1 / ((n : ℝ) + 2) ^ 2 := by positivity
|
| 73 |
+
all_goals have h3 : 0 ≤ 1 / ((n : ℝ) + 2) ^ 3 := by positivity
|
| 74 |
+
all_goals linarith
|
| 75 |
+
|
| 76 |
+
lemma threePrimeOddFactors_prod_lower (u N : ℕ) :
|
| 77 |
+
(1 / 2 : ℝ) ≤ ∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n) := by
|
| 78 |
+
calc
|
| 79 |
+
(1 / 2 : ℝ) ≤ ((N : ℝ) + 2) / (2 * ((N : ℝ) + 1)) := by
|
| 80 |
+
apply (le_div_iff₀ (by positivity)).2
|
| 81 |
+
linarith
|
| 82 |
+
_ = ∏ n ∈ Finset.range N, (1 - 1 / ((n : ℝ) + 2) ^ 2) :=
|
| 83 |
+
(prod_one_sub_reciprocal_square N).symm
|
| 84 |
+
_ ≤ _ := Finset.prod_le_prod₀
|
| 85 |
+
(fun n _ => one_sub_reciprocal_square_nonneg n)
|
| 86 |
+
(fun n _ => threePrimeOddFactor_lower u n)
|
| 87 |
+
|
| 88 |
+
lemma threePrimeOddFactors_tprod_lower (u : ℕ) :
|
| 89 |
+
(1 / 2 : ℝ) ≤ ∏' n : ℕ, (1 + threePrimeOddPerturbation u n) := by
|
| 90 |
+
exact ge_of_tendsto' (threePrimeOddFactors_multipliable u).hasProd.tendsto_prod_nat
|
| 91 |
+
(threePrimeOddFactors_prod_lower u)
|
| 92 |
+
|
| 93 |
+
/-- Uniform positivity does not require a prime number theorem: the all-integer
|
| 94 |
+
comparison product gives the explicit lower bound one for every odd input. -/
|
| 95 |
+
theorem threePrimeSingularSeries_one_le {u : ℕ} (hu : Odd u) :
|
| 96 |
+
1 ≤ threePrimeSingularSeries u := by
|
| 97 |
+
rw [threePrimeSingularSeries, ite_eq_left hu]
|
| 98 |
+
have h := threePrimeOddFactors_tprod_lower u
|
| 99 |
+
linarith
|
| 100 |
+
|
| 101 |
+
/-- A uniform asymptotic error estimate for ordered prime triples suffices for
|
| 102 |
+
the precise quantitative number-theoretic interface used by the supply proof.
|
| 103 |
+
The asymptotic estimate remains a hypothesis; no Vinogradov theorem is asserted. -/
|
| 104 |
+
theorem quantitativeThreePrimeLowerBound_of_singular_error
|
| 105 |
+
(A : ℝ) (hA : 0 < A)
|
| 106 |
+
(herror : ∀ ε : ℝ, 0 < ε → ∀ᶠ u : ℕ in atTop, Odd u →
|
| 107 |
+
|((supplyPrimeTriples u).card : ℝ) - A * threePrimeSingularSeries u *
|
| 108 |
+
((u : ℝ) ^ 2 / Real.log (u : ℝ) ^ 3)| ≤
|
| 109 |
+
ε * ((u : ℝ) ^ 2 / Real.log (u : ℝ) ^ 3)) :
|
| 110 |
+
QuantitativeThreePrimeLowerBound := by
|
| 111 |
+
refine ⟨A / 2, by positivity, ?_⟩
|
| 112 |
+
filter_upwards [herror (A / 2) (by positivity), eventually_ge_atTop 2] with u hu hu2
|
| 113 |
+
intro hodd
|
| 114 |
+
have hs := threePrimeSingularSeries_one_le hodd
|
| 115 |
+
have huR : 1 < (u : ℝ) := by exact_mod_cast (show 1 < u by omega)
|
| 116 |
+
have hscale : 0 ≤ (u : ℝ) ^ 2 / Real.log (u : ℝ) ^ 3 := by
|
| 117 |
+
exact div_nonneg (sq_nonneg _) (pow_nonneg (Real.log_pos huR).le _)
|
| 118 |
+
have hmain := mul_le_mul_of_nonneg_right hs (mul_nonneg hA.le hscale)
|
| 119 |
+
have hlow := (abs_le.mp (hu hodd)).1
|
| 120 |
+
nlinarith
|
| 121 |
+
|
| 122 |
+
end Problem337
|
| 123 |
+
|
| 124 |
+
end
|
| 125 |
+
|
| 126 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeSingularTail.lean
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeEulerTail
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimeSingularSeries
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
open Filter
|
| 8 |
+
|
| 9 |
+
namespace Problem337
|
| 10 |
+
|
| 11 |
+
private lemma shifted_reciprocal_square_tail (P : Finset ℕ) (N : ℕ)
|
| 12 |
+
(hP : ∀ n ∈ P, N ≤ n) :
|
| 13 |
+
(∑ n ∈ P, 1 / ((n : ℝ) + 2) ^ 2) ≤ 1 / ((N : ℝ) + 1) := by
|
| 14 |
+
have htail := ThreePrimeEulerTail.reciprocal_square_tail
|
| 15 |
+
(P.image (fun n => n + 3)) (N + 2) (by omega) (by
|
| 16 |
+
intro p hp
|
| 17 |
+
obtain ⟨n, hn, rfl⟩ := Finset.mem_image.mp hp
|
| 18 |
+
have := hP n hn
|
| 19 |
+
omega)
|
| 20 |
+
rw [Finset.sum_image (by intro a ha b hb hab; dsimp at hab; omega)] at htail
|
| 21 |
+
convert htail using 1
|
| 22 |
+
· apply Finset.sum_congr rfl
|
| 23 |
+
intro n hn
|
| 24 |
+
push_cast
|
| 25 |
+
ring
|
| 26 |
+
· push_cast
|
| 27 |
+
ring
|
| 28 |
+
|
| 29 |
+
/-- Every finite tail of the canonical ternary singular series has relative
|
| 30 |
+
error at most `2 / (N + 1)`, uniformly in the integer being represented. -/
|
| 31 |
+
theorem threePrimeOddFactors_tail_abs_sub_one (u N : ℕ) (P : Finset ℕ)
|
| 32 |
+
(hP : ∀ n ∈ P, N ≤ n) :
|
| 33 |
+
|(∏ n ∈ P, (1 + threePrimeOddPerturbation u n)) - 1| ≤
|
| 34 |
+
2 / ((N : ℝ) + 1) := by
|
| 35 |
+
have hsum : (∑ n ∈ P, ‖threePrimeOddPerturbation u n‖) ≤
|
| 36 |
+
1 / ((N : ℝ) + 1) :=
|
| 37 |
+
(Finset.sum_le_sum (fun n _ => threePrimeOddPerturbation_norm_le u n)).trans
|
| 38 |
+
(shifted_reciprocal_square_tail P N hP)
|
| 39 |
+
have hsmall : |1 / ((N : ℝ) + 1)| ≤ 1 := by
|
| 40 |
+
rw [abs_of_nonneg (by positivity)]
|
| 41 |
+
exact (div_le_one (by positivity)).mpr (by linarith [Nat.cast_nonneg (α := ℝ) N])
|
| 42 |
+
have hprod := P.norm_prod_one_add_sub_one_le (threePrimeOddPerturbation u)
|
| 43 |
+
rw [Real.norm_eq_abs] at hprod
|
| 44 |
+
calc
|
| 45 |
+
_ ≤ Real.exp (∑ n ∈ P, ‖threePrimeOddPerturbation u n‖) - 1 := hprod
|
| 46 |
+
_ ≤ Real.exp (1 / ((N : ℝ) + 1)) - 1 :=
|
| 47 |
+
sub_le_sub_right (Real.exp_le_exp.mpr hsum) 1
|
| 48 |
+
_ ≤ |Real.exp (1 / ((N : ℝ) + 1)) - 1| := le_abs_self _
|
| 49 |
+
_ ≤ 2 * |1 / ((N : ℝ) + 1)| := Real.abs_exp_sub_one_le hsmall
|
| 50 |
+
_ = 2 / ((N : ℝ) + 1) := by rw [abs_of_nonneg (by positivity)]; ring
|
| 51 |
+
|
| 52 |
+
/-- Uniform boundedness of the finite odd-prime factors. -/
|
| 53 |
+
theorem threePrimeOddFactors_partial_abs_le (u N : ℕ) :
|
| 54 |
+
|∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)| ≤ 3 := by
|
| 55 |
+
have htail := threePrimeOddFactors_tail_abs_sub_one u 0 (Finset.range N)
|
| 56 |
+
(by intros; omega)
|
| 57 |
+
norm_num only [Nat.cast_zero, zero_add, div_one] at htail
|
| 58 |
+
calc
|
| 59 |
+
_ = |((∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)) - 1) + 1| := by ring_nf
|
| 60 |
+
_ ≤ |(∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)) - 1| + |(1 : ℝ)| :=
|
| 61 |
+
abs_add_le _ _
|
| 62 |
+
_ ≤ 3 := by norm_num at htail ⊢; linarith
|
| 63 |
+
|
| 64 |
+
/-- The canonical infinite odd-prime product is uniformly approximated by its
|
| 65 |
+
first `N` factors at the explicit rate `6 / (N + 1)`. -/
|
| 66 |
+
theorem threePrimeOddFactors_tprod_sub_partial (u N : ℕ) :
|
| 67 |
+
|(∏' n : ℕ, (1 + threePrimeOddPerturbation u n)) -
|
| 68 |
+
∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)| ≤
|
| 69 |
+
6 / ((N : ℝ) + 1) := by
|
| 70 |
+
apply le_of_tendsto (((threePrimeOddFactors_multipliable u).hasProd.tendsto_prod_nat.sub_const
|
| 71 |
+
(∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n))).abs)
|
| 72 |
+
filter_upwards [eventually_ge_atTop N] with M hNM
|
| 73 |
+
rw [← Finset.prod_range_mul_prod_Ico (fun n => 1 + threePrimeOddPerturbation u n) hNM]
|
| 74 |
+
have heq : (∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)) *
|
| 75 |
+
(∏ n ∈ Finset.Ico N M, (1 + threePrimeOddPerturbation u n)) -
|
| 76 |
+
(∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)) =
|
| 77 |
+
(∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)) *
|
| 78 |
+
((∏ n ∈ Finset.Ico N M, (1 + threePrimeOddPerturbation u n)) - 1) := by ring
|
| 79 |
+
rw [heq, abs_mul]
|
| 80 |
+
calc
|
| 81 |
+
_ ≤ 3 * (2 / ((N : ℝ) + 1)) := by
|
| 82 |
+
apply mul_le_mul (threePrimeOddFactors_partial_abs_le u N)
|
| 83 |
+
(threePrimeOddFactors_tail_abs_sub_one u N (Finset.Ico N M)
|
| 84 |
+
(by intro n hn; exact (Finset.mem_Ico.mp hn).1)) (abs_nonneg _) (by norm_num)
|
| 85 |
+
_ = 6 / ((N : ℝ) + 1) := by ring
|
| 86 |
+
|
| 87 |
+
/-- The finite canonical singular product, including the factor at two. -/
|
| 88 |
+
def threePrimeSingularPartial (u N : ℕ) : ℝ :=
|
| 89 |
+
(if Odd u then 2 else 0) *
|
| 90 |
+
∏ n ∈ Finset.range N, (1 + threePrimeOddPerturbation u n)
|
| 91 |
+
|
| 92 |
+
/-- Uniform quantitative truncation of the actual defined singular series. -/
|
| 93 |
+
theorem threePrimeSingularSeries_sub_partial (u N : ℕ) :
|
| 94 |
+
|threePrimeSingularSeries u - threePrimeSingularPartial u N| ≤
|
| 95 |
+
12 / ((N : ℝ) + 1) := by
|
| 96 |
+
unfold threePrimeSingularSeries threePrimeSingularPartial
|
| 97 |
+
rw [← mul_sub, abs_mul]
|
| 98 |
+
have hfactor : |(if Odd u then 2 else 0 : ℝ)| ≤ 2 := by split_ifs <;> norm_num
|
| 99 |
+
calc
|
| 100 |
+
_ ≤ 2 * (6 / ((N : ℝ) + 1)) :=
|
| 101 |
+
mul_le_mul hfactor (threePrimeOddFactors_tprod_sub_partial u N) (abs_nonneg _) (by norm_num)
|
| 102 |
+
_ = 12 / ((N : ℝ) + 1) := by ring
|
| 103 |
+
|
| 104 |
+
/-- Uniform convergence in the represented integer: the onset is independent
|
| 105 |
+
of `u`, including even inputs where the singular series vanishes. -/
|
| 106 |
+
theorem threePrimeSingularPartial_tendstoUniformly :
|
| 107 |
+
TendstoUniformly (fun N u => threePrimeSingularPartial u N)
|
| 108 |
+
threePrimeSingularSeries atTop := by
|
| 109 |
+
apply Metric.tendstoUniformly_iff.mpr
|
| 110 |
+
intro ε hε
|
| 111 |
+
obtain ⟨N₀, hN₀⟩ := exists_nat_gt (12 / ε)
|
| 112 |
+
filter_upwards [eventually_ge_atTop N₀] with N hN
|
| 113 |
+
intro u
|
| 114 |
+
rw [Real.dist_eq]
|
| 115 |
+
apply (threePrimeSingularSeries_sub_partial u N).trans_lt
|
| 116 |
+
apply (div_lt_iff₀ (by positivity : (0 : ℝ) < N + 1)).mpr
|
| 117 |
+
have hNreal : (N₀ : ℝ) ≤ N := by exact_mod_cast hN
|
| 118 |
+
have hbound := (div_lt_iff₀ hε).mp hN₀
|
| 119 |
+
nlinarith
|
| 120 |
+
|
| 121 |
+
/-- A simultaneous absolute bound for all singular series, useful when
|
| 122 |
+
converting an additive asymptotic error into a relative error. -/
|
| 123 |
+
theorem threePrimeSingularSeries_abs_le_six (u : ℕ) :
|
| 124 |
+
|threePrimeSingularSeries u| ≤ 6 := by
|
| 125 |
+
have hodd : |∏' n : ℕ, (1 + threePrimeOddPerturbation u n)| ≤ 3 :=
|
| 126 |
+
le_of_tendsto' (threePrimeOddFactors_multipliable u).hasProd.tendsto_prod_nat.abs
|
| 127 |
+
(threePrimeOddFactors_partial_abs_le u)
|
| 128 |
+
unfold threePrimeSingularSeries
|
| 129 |
+
rw [abs_mul]
|
| 130 |
+
have hfactor : |(if Odd u then 2 else 0 : ℝ)| ≤ 2 := by split_ifs <;> norm_num
|
| 131 |
+
nlinarith [abs_nonneg (∏' n : ℕ, (1 + threePrimeOddPerturbation u n))]
|
| 132 |
+
|
| 133 |
+
/-- A cutoff tending to infinity may depend on the represented integer or on
|
| 134 |
+
any other parameter; uniform truncation still makes the error tend to zero. -/
|
| 135 |
+
theorem threePrimeSingularPartial_sub_tendsto_zero {α : Type*} {l : Filter α}
|
| 136 |
+
(u Q : α → ℕ) (hQ : Tendsto Q l atTop) :
|
| 137 |
+
Tendsto (fun x => threePrimeSingularSeries (u x) -
|
| 138 |
+
threePrimeSingularPartial (u x) (Q x)) l (nhds 0) := by
|
| 139 |
+
apply squeeze_zero_norm (fun x => by
|
| 140 |
+
simpa only [Real.norm_eq_abs] using threePrimeSingularSeries_sub_partial (u x) (Q x))
|
| 141 |
+
apply tendsto_const_nhds.div_atTop
|
| 142 |
+
apply tendsto_atTop_mono (fun x => ?_) (tendsto_natCast_atTop_atTop.comp hQ)
|
| 143 |
+
exact le_add_of_nonneg_right zero_le_one
|
| 144 |
+
|
| 145 |
+
/-- Truncating the singular series changes any weighted main term by little-o
|
| 146 |
+
of that same weight. No positivity or nonvanishing of the weight is needed. -/
|
| 147 |
+
theorem threePrimeSingularPartial_weighted_isLittleO {α : Type*} {l : Filter α}
|
| 148 |
+
(u Q : α → ℕ) (hQ : Tendsto Q l atTop) (w : α → ℝ) :
|
| 149 |
+
(fun x => (threePrimeSingularSeries (u x) -
|
| 150 |
+
threePrimeSingularPartial (u x) (Q x)) * w x) =o[l] w := by
|
| 151 |
+
have hsmall : (fun x => threePrimeSingularSeries (u x) -
|
| 152 |
+
threePrimeSingularPartial (u x) (Q x)) =o[l] (fun _ => (1 : ℝ)) :=
|
| 153 |
+
(Asymptotics.isLittleO_one_iff ℝ).mpr (threePrimeSingularPartial_sub_tendsto_zero u Q hQ)
|
| 154 |
+
simpa only [one_mul] using hsmall.mul_isBigO (Asymptotics.isBigO_refl w l)
|
| 155 |
+
|
| 156 |
+
/-- An asymptotic formula with a growing finite singular product is equivalent
|
| 157 |
+
to the formula with the canonical infinite series. This supplies the uniform
|
| 158 |
+
Euler-tail transfer in a major-arc computation without asserting that formula. -/
|
| 159 |
+
theorem threePrimeSingularPartial_asymptotic_iff {α : Type*} {l : Filter α}
|
| 160 |
+
(u Q : α → ℕ) (hQ : Tendsto Q l atTop) (a w : α → ℝ) :
|
| 161 |
+
((fun x => a x - threePrimeSingularSeries (u x) * w x) =o[l] w) ↔
|
| 162 |
+
((fun x => a x - threePrimeSingularPartial (u x) (Q x) * w x) =o[l] w) := by
|
| 163 |
+
have htail := threePrimeSingularPartial_weighted_isLittleO u Q hQ w
|
| 164 |
+
constructor
|
| 165 |
+
· intro h
|
| 166 |
+
exact (h.add htail).congr_left (fun x => by ring)
|
| 167 |
+
· intro h
|
| 168 |
+
exact (h.sub htail).congr_left (fun x => by ring)
|
| 169 |
+
|
| 170 |
+
end Problem337
|
| 171 |
+
|
| 172 |
+
end
|
| 173 |
+
|
| 174 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/ThreePrimeWeighted.lean
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.RationalSupplyReduction
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
open Filter
|
| 7 |
+
|
| 8 |
+
namespace Problem337
|
| 9 |
+
|
| 10 |
+
/-- The logarithmically weighted ordered prime triple count, with exactly the
|
| 11 |
+
same triples as the rational-divisor supply reduction. -/
|
| 12 |
+
def weightedSupplyPrimeTriples (u : ℕ) : ℝ :=
|
| 13 |
+
∑ t ∈ supplyPrimeTriples u,
|
| 14 |
+
Real.log (t.1 : ℝ) * Real.log (t.2.1 : ℝ) * Real.log (t.2.2 : ℝ)
|
| 15 |
+
|
| 16 |
+
lemma weightedSupplyPrimeTriples_le (u : ℕ) :
|
| 17 |
+
weightedSupplyPrimeTriples u ≤
|
| 18 |
+
(supplyPrimeTriples u).card * Real.log (u : ℝ) ^ 3 := by
|
| 19 |
+
unfold weightedSupplyPrimeTriples
|
| 20 |
+
calc
|
| 21 |
+
_ ≤ ∑ _t ∈ supplyPrimeTriples u, Real.log (u : ℝ) ^ 3 := by
|
| 22 |
+
apply Finset.sum_le_sum
|
| 23 |
+
intro t ht
|
| 24 |
+
obtain ⟨htmem, htprime⟩ := Finset.mem_filter.mp ht
|
| 25 |
+
obtain ⟨hp, hq, hr⟩ := Finset.mem_product.mp htmem |>.imp_right Finset.mem_product.mp
|
| 26 |
+
have hlog (p : ℕ) (hp : p ∈ Finset.Icc 1 u) :
|
| 27 |
+
0 ≤ Real.log (p : ℝ) ∧ Real.log (p : ℝ) ≤ Real.log (u : ℝ) := by
|
| 28 |
+
obtain ⟨hp1, hpu⟩ := Finset.mem_Icc.mp hp
|
| 29 |
+
have hp1r : (1 : ℝ) ≤ p := by exact_mod_cast hp1
|
| 30 |
+
exact ⟨Real.log_nonneg hp1r,
|
| 31 |
+
Real.log_le_log (lt_of_lt_of_le zero_lt_one hp1r) (by exact_mod_cast hpu)⟩
|
| 32 |
+
obtain ⟨hp0, hpu⟩ := hlog t.1 hp
|
| 33 |
+
obtain ⟨hq0, hqu⟩ := hlog t.2.1 hq
|
| 34 |
+
obtain ⟨hr0, hru⟩ := hlog t.2.2 hr
|
| 35 |
+
have hu0 : 0 ≤ Real.log (u : ℝ) := hp0.trans hpu
|
| 36 |
+
calc
|
| 37 |
+
_ ≤ (Real.log (u : ℝ) * Real.log (u : ℝ)) * Real.log (u : ℝ) :=
|
| 38 |
+
mul_le_mul (mul_le_mul hpu hqu hq0 hu0) hru hr0 (by positivity)
|
| 39 |
+
_ = _ := by ring
|
| 40 |
+
_ = _ := by simp
|
| 41 |
+
|
| 42 |
+
/-- Positive quadratic logarithmically weighted count is enough for the
|
| 43 |
+
precise unweighted lower-bound interface already used by the solution. -/
|
| 44 |
+
theorem quantitativeThreePrimeLowerBound_of_weighted
|
| 45 |
+
(hweighted : ∃ c : ℝ, 0 < c ∧ ∀ᶠ u : ℕ in atTop, Odd u →
|
| 46 |
+
c * (u : ℝ) ^ 2 ≤ weightedSupplyPrimeTriples u) :
|
| 47 |
+
QuantitativeThreePrimeLowerBound := by
|
| 48 |
+
obtain ⟨c, hc, hw⟩ := hweighted
|
| 49 |
+
refine ⟨c, hc, ?_⟩
|
| 50 |
+
filter_upwards [hw, eventually_ge_atTop 2] with u hu hu2
|
| 51 |
+
intro hodd
|
| 52 |
+
have hur : (1 : ℝ) < u := by exact_mod_cast (show 1 < u by omega)
|
| 53 |
+
have hlog : 0 < Real.log (u : ℝ) ^ 3 := pow_pos (Real.log_pos hur) 3
|
| 54 |
+
have h := (hu hodd).trans (weightedSupplyPrimeTriples_le u)
|
| 55 |
+
rw [← mul_div_assoc]
|
| 56 |
+
exact (div_le_iff₀ hlog).2 h
|
| 57 |
+
|
| 58 |
+
end Problem337
|
| 59 |
+
|
| 60 |
+
end
|
| 61 |
+
|
| 62 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/TruncatedDivisors.lean
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
namespace Problem337.DivisorMoment
|
| 5 |
+
|
| 6 |
+
/-- Positive divisors truncated at an integral threshold. -/
|
| 7 |
+
def truncatedDivisors (X n : ℕ) : Finset ℕ :=
|
| 8 |
+
n.divisors.filter (fun a => a ≤ X)
|
| 9 |
+
|
| 10 |
+
@[simp] theorem mem_truncatedDivisors {X n a : ℕ} :
|
| 11 |
+
a ∈ truncatedDivisors X n ↔ a ∣ n ∧ n ≠ 0 ∧ a ≤ X := by
|
| 12 |
+
simp [truncatedDivisors, and_assoc]
|
| 13 |
+
|
| 14 |
+
/-- The second component of the gcd splitting is a divisor of the quotient.
|
| 15 |
+
No coprimality of the chosen factor and the quotient is needed. -/
|
| 16 |
+
theorem div_gcd_dvd_quotient {a d n : ℕ} (ha : a ∣ n) (hd : d ∣ n) :
|
| 17 |
+
a / Nat.gcd a d ∣ n / d := by
|
| 18 |
+
apply (Nat.dvd_div_iff_mul_dvd hd).2
|
| 19 |
+
have hlcm : Nat.lcm a d = d * (a / Nat.gcd a d) := by
|
| 20 |
+
rw [Nat.lcm_eq_mul_div, Nat.mul_comm a d,
|
| 21 |
+
Nat.mul_div_assoc d (Nat.gcd_dvd_left a d)]
|
| 22 |
+
rw [← hlcm]
|
| 23 |
+
exact Nat.lcm_dvd ha hd
|
| 24 |
+
|
| 25 |
+
/-- Divisor splitting is injective, because its components multiply to the input. -/
|
| 26 |
+
theorem gcd_split_injective (d : ℕ) :
|
| 27 |
+
Function.Injective (fun a : ℕ => (Nat.gcd a d, a / Nat.gcd a d)) := by
|
| 28 |
+
intro a b hab
|
| 29 |
+
have h := congrArg (fun z : ℕ × ℕ => z.2 * z.1) hab
|
| 30 |
+
simpa only [Nat.div_mul_cancel (Nat.gcd_dvd_left a d),
|
| 31 |
+
Nat.div_mul_cancel (Nat.gcd_dvd_left b d)] using h
|
| 32 |
+
|
| 33 |
+
/-- Truncated divisors of a product inject into a full divisor set and one
|
| 34 |
+
truncated divisor set. This is the prefix inequality in the divisor moment argument. -/
|
| 35 |
+
theorem truncated_card_le_mul {X n d : ℕ} (hn : 0 < n) (hd : d ∣ n) :
|
| 36 |
+
(truncatedDivisors X n).card ≤
|
| 37 |
+
d.divisors.card * (truncatedDivisors X (n / d)).card := by
|
| 38 |
+
have hdpos : 0 < d := Nat.pos_of_dvd_of_pos hd hn
|
| 39 |
+
have hquotpos : 0 < n / d := Nat.div_pos (Nat.le_of_dvd hn hd) hdpos
|
| 40 |
+
rw [← Finset.card_product]
|
| 41 |
+
apply Finset.card_le_card_of_injOn (fun a : ℕ => (Nat.gcd a d, a / Nat.gcd a d))
|
| 42 |
+
· intro a ha
|
| 43 |
+
obtain ⟨han, _, haX⟩ := mem_truncatedDivisors.mp ha
|
| 44 |
+
apply Finset.mem_product.mpr
|
| 45 |
+
constructor
|
| 46 |
+
· exact Nat.mem_divisors.mpr ⟨Nat.gcd_dvd_right a d, hdpos.ne'⟩
|
| 47 |
+
· exact mem_truncatedDivisors.mpr
|
| 48 |
+
⟨div_gcd_dvd_quotient han hd, hquotpos.ne',
|
| 49 |
+
(Nat.div_le_self a (Nat.gcd a d)).trans haX⟩
|
| 50 |
+
· exact (gcd_split_injective d).injOn
|
| 51 |
+
|
| 52 |
+
/-- Multiples of a positive integer in a translated interval satisfy the
|
| 53 |
+
uniform counting estimate needed for short-interval divisor moments. -/
|
| 54 |
+
theorem interval_multiples_card_le (N Y d : ℕ) (hd : 0 < d) :
|
| 55 |
+
((Finset.Ioc N (N + Y)).filter (fun a => d ∣ a)).card ≤ Y / d + 1 := by
|
| 56 |
+
have hcard : ((Finset.Ioc N (N + Y)).filter (fun a => d ∣ a)).card ≤
|
| 57 |
+
(Finset.Ioc (N / d) ((N + Y) / d)).card := by
|
| 58 |
+
apply Finset.card_le_card_of_injOn (fun a : ℕ => a / d)
|
| 59 |
+
· intro a ha
|
| 60 |
+
obtain ⟨haI, had⟩ := Finset.mem_filter.mp ha
|
| 61 |
+
obtain ⟨hNa, haNY⟩ := Finset.mem_Ioc.mp haI
|
| 62 |
+
apply Finset.mem_Ioc.mpr
|
| 63 |
+
constructor
|
| 64 |
+
· apply (Nat.div_lt_iff_lt_mul hd).mpr
|
| 65 |
+
simpa only [Nat.div_mul_cancel had] using hNa
|
| 66 |
+
· exact Nat.div_le_div_right haNY
|
| 67 |
+
· intro a ha b hb hab
|
| 68 |
+
have had := (Finset.mem_filter.mp ha).2
|
| 69 |
+
have hbd := (Finset.mem_filter.mp hb).2
|
| 70 |
+
have h := congrArg (fun q => q * d) hab
|
| 71 |
+
simpa only [Nat.div_mul_cancel had, Nat.div_mul_cancel hbd] using h
|
| 72 |
+
rw [Nat.card_Ioc, Nat.add_div hd] at hcard
|
| 73 |
+
split_ifs at hcard
|
| 74 |
+
· simpa only [Nat.add_assoc, Nat.add_sub_cancel_left] using hcard
|
| 75 |
+
· have h : ((Finset.Ioc N (N + Y)).filter (fun a => d ∣ a)).card ≤ Y / d := by
|
| 76 |
+
simpa only [Nat.add_zero, Nat.add_sub_cancel_left] using hcard
|
| 77 |
+
exact h.trans (Nat.le_succ _)
|
| 78 |
+
|
| 79 |
+
theorem interval_multiples_card_le_real (N Y d : ℕ) (hd : 0 < d) :
|
| 80 |
+
(((Finset.Ioc N (N + Y)).filter (fun a => d ∣ a)).card : ℝ) ≤
|
| 81 |
+
(Y : ℝ) / d + 1 := by
|
| 82 |
+
calc
|
| 83 |
+
_ ≤ ((Y / d + 1 : ℕ) : ℝ) := by
|
| 84 |
+
exact_mod_cast interval_multiples_card_le N Y d hd
|
| 85 |
+
_ = ((Y / d : ℕ) : ℝ) + 1 := by norm_cast
|
| 86 |
+
_ ≤ (Y : ℝ) / d + 1 := by
|
| 87 |
+
have hcast : ((Y / d : ℕ) : ℝ) ≤ (Y : ℝ) / d := Nat.cast_div_le
|
| 88 |
+
linarith
|
| 89 |
+
|
| 90 |
+
theorem interval_multiples_card_le_twice (N Y d : ℕ) (hd : 0 < d)
|
| 91 |
+
(hdY : d ≤ Y) :
|
| 92 |
+
(((Finset.Ioc N (N + Y)).filter (fun a => d ∣ a)).card : ℝ) ≤
|
| 93 |
+
2 * (Y : ℝ) / d := by
|
| 94 |
+
have hdR : (0 : ℝ) < d := by exact_mod_cast hd
|
| 95 |
+
have hratio : (1 : ℝ) ≤ (Y : ℝ) / d := by
|
| 96 |
+
apply (le_div_iff₀ hdR).mpr
|
| 97 |
+
simpa only [one_mul] using (show (d : ℝ) ≤ Y by exact_mod_cast hdY)
|
| 98 |
+
calc
|
| 99 |
+
_ ≤ (Y : ℝ) / d + 1 := interval_multiples_card_le_real N Y d hd
|
| 100 |
+
_ ≤ 2 * ((Y : ℝ) / d) := by linarith
|
| 101 |
+
_ = 2 * (Y : ℝ) / d := by ring
|
| 102 |
+
|
| 103 |
+
/-- Real lengths are implemented by their natural floor, without changing the
|
| 104 |
+
uniform interval bound. -/
|
| 105 |
+
theorem interval_multiples_real_cutoff (N d : ℕ) (Y : ℝ) (hY : 0 ≤ Y)
|
| 106 |
+
(hd : 0 < d) :
|
| 107 |
+
(((Finset.Ioc N (N + ⌊Y⌋₊)).filter (fun a => d ∣ a)).card : ℝ) ≤
|
| 108 |
+
Y / d + 1 := by
|
| 109 |
+
calc
|
| 110 |
+
_ ≤ (⌊Y⌋₊ : ℝ) / d + 1 := interval_multiples_card_le_real N ⌊Y⌋₊ d hd
|
| 111 |
+
_ ≤ Y / d + 1 := by
|
| 112 |
+
gcongr
|
| 113 |
+
exact Nat.floor_le hY
|
| 114 |
+
|
| 115 |
+
theorem interval_multiples_real_cutoff_twice (N d : ℕ) (Y : ℝ) (hY : 0 ≤ Y)
|
| 116 |
+
(hd : 0 < d) (hdY : (d : ℝ) ≤ Y) :
|
| 117 |
+
(((Finset.Ioc N (N + ⌊Y⌋₊)).filter (fun a => d ∣ a)).card : ℝ) ≤
|
| 118 |
+
2 * Y / d := by
|
| 119 |
+
calc
|
| 120 |
+
_ ≤ 2 * (⌊Y⌋₊ : ℝ) / d :=
|
| 121 |
+
interval_multiples_card_le_twice N ⌊Y⌋₊ d hd (Nat.le_floor hdY)
|
| 122 |
+
_ ≤ 2 * Y / d := by
|
| 123 |
+
gcongr
|
| 124 |
+
exact Nat.floor_le hY
|
| 125 |
+
|
| 126 |
+
end Problem337.DivisorMoment
|
| 127 |
+
|
| 128 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/TypeIIBlockScalar.lean
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
namespace Problem337.TypeIIBlockScalar
|
| 5 |
+
|
| 6 |
+
/-- The scalar aggregation for one dyadic Vaughan Type-II block. All analytic
|
| 7 |
+
information is explicit in the three elementary size bounds. -/
|
| 8 |
+
theorem block_bound (X M T Q U V H : ℝ)
|
| 9 |
+
(hX : 0 ≤ X) (hM : 0 ≤ M) (hT : 0 ≤ T)
|
| 10 |
+
(hQ : 0 < Q) (hU : 0 < U) (hV : 0 < V) (hH : 1 ≤ H)
|
| 11 |
+
(hMT : M * T ≤ X) (hTU : T ≤ 2 * X / U) (hMV : M ≤ X / V) :
|
| 12 |
+
(2 * M * H ^ 3) * ((2 * T / Q + 1) * (2 * M + 4 * Q * H)) *
|
| 13 |
+
(T * H ^ 2) ≤
|
| 14 |
+
32 * X * H ^ 6 * (X / Q + X / U + X / V + Q) := by
|
| 15 |
+
have hH0 : 0 ≤ H := by linarith
|
| 16 |
+
have hXQ : 0 ≤ X / Q := div_nonneg hX hQ.le
|
| 17 |
+
have hXU : 0 ≤ X / U := div_nonneg hX hU.le
|
| 18 |
+
have hXV : 0 ≤ X / V := div_nonneg hX hV.le
|
| 19 |
+
have hMTQ : M * T / Q ≤ X / Q := div_le_div_of_nonneg_right hMT hQ.le
|
| 20 |
+
have hTH : T * H ≤ (2 * X / U) * H := mul_le_mul_of_nonneg_right hTU hH0
|
| 21 |
+
have hQH : X / Q ≤ H * (X / Q) := by nlinarith [mul_le_mul_of_nonneg_right hH hXQ]
|
| 22 |
+
have hVH : X / V ≤ H * (X / V) := by nlinarith [mul_le_mul_of_nonneg_right hH hXV]
|
| 23 |
+
have hinner : (2 * T / Q + 1) * (2 * M + 4 * Q * H) ≤
|
| 24 |
+
16 * H * (X / Q + X / U + X / V + Q) := by
|
| 25 |
+
have heq : (2 * T / Q + 1) * (2 * M + 4 * Q * H) =
|
| 26 |
+
4 * (M * T / Q) + 8 * T * H + 2 * M + 4 * Q * H := by
|
| 27 |
+
field_simp
|
| 28 |
+
ring
|
| 29 |
+
rw [heq]
|
| 30 |
+
have hTH' : T * H ≤ 2 * (X / U) * H := by convert hTH using 1; ring
|
| 31 |
+
nlinarith [mul_nonneg hH0 hXQ, mul_nonneg hH0 hXV, mul_nonneg hH0 hQ.le]
|
| 32 |
+
have hfactor : 2 * (M * T) * H ^ 5 ≤ 2 * X * H ^ 5 :=
|
| 33 |
+
mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left hMT (by norm_num)) (by positivity)
|
| 34 |
+
have hinner0 : 0 ≤ (2 * T / Q + 1) * (2 * M + 4 * Q * H) := by positivity
|
| 35 |
+
calc
|
| 36 |
+
_ = (2 * (M * T) * H ^ 5) * ((2 * T / Q + 1) * (2 * M + 4 * Q * H)) := by ring
|
| 37 |
+
_ ≤ (2 * X * H ^ 5) * (16 * H * (X / Q + X / U + X / V + Q)) :=
|
| 38 |
+
mul_le_mul hfactor hinner hinner0 (by positivity)
|
| 39 |
+
_ = _ := by ring
|
| 40 |
+
|
| 41 |
+
end Problem337.TypeIIBlockScalar
|
| 42 |
+
|
| 43 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/UniformDivisorMoment.lean
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.SmallPrimeMoment
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.IntermediateBandBudget
|
| 3 |
+
import OAI.NumberTheory.EgyptianFractions.LargeClassUniform
|
| 4 |
+
import OAI.NumberTheory.EgyptianFractions.DivisorClassAssembly
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
noncomputable section
|
| 8 |
+
|
| 9 |
+
open Filter
|
| 10 |
+
open scoped BigOperators
|
| 11 |
+
|
| 12 |
+
namespace Problem337.DivisorMoment
|
| 13 |
+
|
| 14 |
+
attribute [local instance] Classical.propDecidable
|
| 15 |
+
|
| 16 |
+
/-- The complete uniform shifted divisor moment, with the upper cutoff
|
| 17 |
+
parameterized exponentially. All three prime-factor classes are estimated
|
| 18 |
+
unconditionally; the threshold depends only on the fixed `D` and `r`. -/
|
| 19 |
+
theorem eventually_uniform_divisor_moment_exp (D r : ℝ)
|
| 20 |
+
(hD : 1 ≤ D) (hr : 0 ≤ r) :
|
| 21 |
+
∀ᶠ S : ℝ in atTop, ∀ v Y : ℝ, ∀ N : ℕ,
|
| 22 |
+
S / (2 * Real.log S) ≤ v → v ≤ D * S →
|
| 23 |
+
Real.exp (v / 2) ≤ Y → Y ≤ Real.exp v →
|
| 24 |
+
(N : ℝ) ≤ Real.exp (D * S) →
|
| 25 |
+
(∑ h ∈ Finset.Icc 1 ⌊Y⌋₊,
|
| 26 |
+
(truncatedDivisorCount (Real.exp v) (N + h) : ℝ) ^ r) ≤
|
| 27 |
+
Y * Real.exp (S ^ (1 / 4 : ℝ)) := by
|
| 28 |
+
obtain ⟨C, hC, hlarge⟩ := eventually_large_class_moment_bound_exp D r hD hr
|
| 29 |
+
filter_upwards [hlarge, small_class_truncated_moment_bound D r hD hr,
|
| 30 |
+
eventually_intermediate_band_budget D r hD hr,
|
| 31 |
+
DivisorClasses.eventually_class_budget_assembly D r C hD hr hC.le]
|
| 32 |
+
with S hlarge hsmall hband hassemble
|
| 33 |
+
intro v Y N hvlo hvhi hYlo hYhi hN
|
| 34 |
+
have hYpos : 0 < Y := (Real.exp_pos (v / 2)).trans_le hYlo
|
| 35 |
+
have hsqrt : Real.sqrt (Real.exp v) = Real.exp (v / 2) := by
|
| 36 |
+
rw [Real.sqrt_eq_rpow, ← Real.exp_mul]
|
| 37 |
+
congr 1
|
| 38 |
+
ring
|
| 39 |
+
apply hassemble v Y hvlo hvhi hYlo hYhi (Finset.Icc 1 ⌊Y⌋₊)
|
| 40 |
+
(fun h => N + h) (fun h => (truncatedDivisorCount (Real.exp v) (N + h) : ℝ) ^ r)
|
| 41 |
+
· intro h hh
|
| 42 |
+
positivity
|
| 43 |
+
· exact hlarge v Y N hvlo hvhi hYlo hYhi hN
|
| 44 |
+
· simpa only [Real.log_exp] using hsmall (Real.exp v) Y N
|
| 45 |
+
(by simpa only [Real.log_exp] using hvlo)
|
| 46 |
+
(by simpa only [Real.log_exp] using hvhi)
|
| 47 |
+
(by simpa only [hsqrt] using hYlo) hYhi hN
|
| 48 |
+
· intro j
|
| 49 |
+
by_cases hj : 4 * Real.log S * 2 ^ j ≤ v ^ (15 / 16 : ℝ)
|
| 50 |
+
· exact hband v Y N j hvlo hvhi hYlo hYhi hN hj
|
| 51 |
+
· have hempty : (Finset.Icc 1 ⌊Y⌋₊).filter
|
| 52 |
+
(fun h => DivisorClasses.BandClass (N + h) S v Y j) = ∅ := by
|
| 53 |
+
apply Finset.filter_eq_empty_iff.mpr
|
| 54 |
+
intro h hh hb
|
| 55 |
+
exact hj (DivisorClasses.band_scale_lt hb).le
|
| 56 |
+
simp only [hempty, Finset.sum_empty]
|
| 57 |
+
positivity
|
| 58 |
+
|
| 59 |
+
/-- Uniform divisor moments with real cutoffs. The statement also covers a real
|
| 60 |
+
interval length through its floor. -/
|
| 61 |
+
theorem eventually_uniform_divisor_moment (D r : ℝ)
|
| 62 |
+
(hD : 1 ≤ D) (hr : 0 ≤ r) :
|
| 63 |
+
∀ᶠ S : ℝ in atTop, ∀ X Y : ℝ, ∀ N : ℕ,
|
| 64 |
+
S / (2 * Real.log S) ≤ Real.log X → Real.log X ≤ D * S →
|
| 65 |
+
Real.sqrt X ≤ Y → Y ≤ X → (N : ℝ) ≤ Real.exp (D * S) →
|
| 66 |
+
(∑ h ∈ Finset.Icc 1 ⌊Y⌋₊,
|
| 67 |
+
(truncatedDivisorCount X (N + h) : ℝ) ^ r) ≤
|
| 68 |
+
Y * Real.exp (S ^ (1 / 4 : ℝ)) := by
|
| 69 |
+
filter_upwards [eventually_uniform_divisor_moment_exp D r hD hr,
|
| 70 |
+
eventually_ge_atTop (2 : ℝ)] with S hmoment hS
|
| 71 |
+
intro X Y N hvlo hvhi hYlo hYhi hN
|
| 72 |
+
have hSpos : 0 < S := by linarith
|
| 73 |
+
have hlogS : 0 < Real.log S := Real.log_pos (by linarith)
|
| 74 |
+
have hlogX : 0 < Real.log X :=
|
| 75 |
+
(by positivity : 0 < S / (2 * Real.log S)).trans_le hvlo
|
| 76 |
+
have hXnonneg : 0 ≤ X := (Real.sqrt_nonneg X).trans (hYlo.trans hYhi)
|
| 77 |
+
have hX : 1 < X := (Real.log_pos_iff hXnonneg).mp hlogX
|
| 78 |
+
have hXpos : 0 < X := by linarith
|
| 79 |
+
have hsqrt : Real.exp (Real.log X / 2) = Real.sqrt X := by
|
| 80 |
+
rw [Real.sqrt_eq_rpow, Real.rpow_def_of_pos hXpos]
|
| 81 |
+
congr 1
|
| 82 |
+
ring
|
| 83 |
+
simpa only [Real.exp_log hXpos] using hmoment (Real.log X) Y N hvlo hvhi
|
| 84 |
+
(by simpa only [hsqrt] using hYlo)
|
| 85 |
+
(by simpa only [Real.exp_log hXpos] using hYhi) hN
|
| 86 |
+
|
| 87 |
+
end Problem337.DivisorMoment
|
| 88 |
+
|
| 89 |
+
end
|
| 90 |
+
|
| 91 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/UniformSecondMoment.lean
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.SecondMomentAssembly
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.FiniteExposureAverage
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
theorem norm_expect_sq_eq_expect_pairs {I : Type*} [Fintype I] (z : I → ℂ) :
|
| 10 |
+
‖𝔼 i, z i‖ ^ 2 = 𝔼 ij : I × I, (z ij.1 * star (z ij.2)).re := by
|
| 11 |
+
simp only [Fintype.expect_eq_sum_div_card, norm_div, norm_natCast]
|
| 12 |
+
rw [div_pow, norm_sum_sq_eq_sum_pair]
|
| 13 |
+
simp only [Fintype.card_prod, Nat.cast_mul, pow_two]
|
| 14 |
+
|
| 15 |
+
theorem uniform_second_moment_identity {Ω I : Type*} [Fintype Ω] [Fintype I]
|
| 16 |
+
(z : Ω → I → ℂ) :
|
| 17 |
+
(𝔼 ω, ‖𝔼 i, z ω i‖ ^ 2) =
|
| 18 |
+
𝔼 ij : I × I, (𝔼 ω, z ω ij.1 * star (z ω ij.2)).re := by
|
| 19 |
+
simp_rw [norm_expect_sq_eq_expect_pairs]
|
| 20 |
+
rw [Finset.expect_comm]
|
| 21 |
+
congr 1
|
| 22 |
+
funext ij
|
| 23 |
+
exact (map_expect (Complex.reCLM.toLinearMap.restrictScalars ℚ≥0) (fun ω => z ω ij.1 * star (z ω ij.2)) Finset.univ).symm
|
| 24 |
+
|
| 25 |
+
/-- Uniform finite-average version of the Hamming second-moment reduction. -/
|
| 26 |
+
theorem uniform_boolean_second_moment_bound {Ω : Type*} [Fintype Ω] [Nonempty Ω]
|
| 27 |
+
(m : ℕ) (z : Ω → (Fin m → Bool) → ℂ)
|
| 28 |
+
(hz : ∀ ω i, ‖z ω i‖ ≤ 1) (δ : ℝ) (hδ : 0 ≤ δ)
|
| 29 |
+
(hgood : ∀ i j, (m : ℝ) / 4 ≤ (hammingDist i j : ℝ) →
|
| 30 |
+
‖𝔼 ω, z ω i * star (z ω j)‖ ≤ δ) :
|
| 31 |
+
(𝔼 ω, ‖𝔼 i, z ω i‖ ^ 2) ≤ Real.exp (-(m : ℝ) / 16) + δ := by
|
| 32 |
+
classical
|
| 33 |
+
let E := Finset.univ.filter (fun ij : (Fin m → Bool) × (Fin m → Bool) =>
|
| 34 |
+
(hammingDist ij.1 ij.2 : ℝ) < (m : ℝ) / 4)
|
| 35 |
+
have hall (i j : Fin m → Bool) : ‖𝔼 ω, z ω i * star (z ω j)‖ ≤ 1 := by
|
| 36 |
+
calc
|
| 37 |
+
_ ≤ 𝔼 ω, ‖z ω i * star (z ω j)‖ := RCLike.norm_expect_le (K := ℂ)
|
| 38 |
+
_ ≤ 𝔼 _ω : Ω, (1 : ℝ) := by
|
| 39 |
+
apply Finset.expect_le_expect
|
| 40 |
+
intro ω hω
|
| 41 |
+
rw [norm_mul, norm_star]
|
| 42 |
+
nlinarith [hz ω i, hz ω j, norm_nonneg (z ω i), norm_nonneg (z ω j)]
|
| 43 |
+
_ = 1 := Fintype.expect_const 1
|
| 44 |
+
have hexc : (E.card : ℝ) ≤ (4 : ℝ) ^ m * Real.exp (-(m : ℝ) / 16) :=
|
| 45 |
+
hamming_exception_count m
|
| 46 |
+
have hcard : (Fintype.card ((Fin m → Bool) × (Fin m → Bool)) : ℝ) = (4 : ℝ) ^ m := by
|
| 47 |
+
simp only [Fintype.card_prod, Fintype.card_fun, Fintype.card_bool,
|
| 48 |
+
Fintype.card_fin, Nat.cast_mul, Nat.cast_pow, Nat.cast_ofNat]
|
| 49 |
+
rw [← mul_pow]
|
| 50 |
+
norm_num
|
| 51 |
+
rw [uniform_second_moment_identity]
|
| 52 |
+
calc
|
| 53 |
+
(𝔼 ij : (Fin m → Bool) × (Fin m → Bool),
|
| 54 |
+
(𝔼 ω, z ω ij.1 * star (z ω ij.2)).re) ≤
|
| 55 |
+
𝔼 ij : (Fin m → Bool) × (Fin m → Bool),
|
| 56 |
+
((if ij ∈ E then 1 else 0) + δ : ℝ) := by
|
| 57 |
+
apply Finset.expect_le_expect
|
| 58 |
+
intro ij hij
|
| 59 |
+
by_cases hb : ij ∈ E
|
| 60 |
+
· simp only [ite_eq_left hb]
|
| 61 |
+
exact (Complex.re_le_norm _).trans ((hall _ _).trans (by linarith))
|
| 62 |
+
· simp only [ite_eq_right hb, zero_add]
|
| 63 |
+
apply (Complex.re_le_norm _).trans (hgood _ _ ?_)
|
| 64 |
+
simpa only [E, Finset.mem_filter, Finset.mem_univ, true_and, not_lt] using hb
|
| 65 |
+
_ = (E.card : ℝ) / (4 : ℝ) ^ m + δ := by
|
| 66 |
+
rw [Finset.expect_add_distrib, expect_finset_indicator, Fintype.expect_const, hcard]
|
| 67 |
+
_ ≤ Real.exp (-(m : ℝ) / 16) + δ := by
|
| 68 |
+
have hdiv : (E.card : ℝ) / (4 : ℝ) ^ m ≤ Real.exp (-(m : ℝ) / 16) :=
|
| 69 |
+
(div_le_iff₀ (by positivity)).2 (by simpa only [mul_comm] using hexc)
|
| 70 |
+
linarith
|
| 71 |
+
|
| 72 |
+
/-- Uniform-mean final random estimate, directly matching the second moment
|
| 73 |
+
of the sampled Boolean-product exponential average. -/
|
| 74 |
+
theorem uniform_boolean_random_second_moment_bound {Ω : Type*}
|
| 75 |
+
[Fintype Ω] [Nonempty Ω] (m : ℕ) (V : ℝ)
|
| 76 |
+
(z : Ω → (Fin m → Bool) → ℂ) (hz : ∀ ω i, ‖z ω i‖ ≤ 1)
|
| 77 |
+
(hlarge : 50 ≤ min (m : ℝ) V)
|
| 78 |
+
(hgood : ∀ i j, (m : ℝ) / 4 ≤ (hammingDist i j : ℝ) →
|
| 79 |
+
‖𝔼 ω, z ω i * star (z ω j)‖ ≤ Real.exp (-V / 20) + Real.exp (-V / 5)) :
|
| 80 |
+
(𝔼 ω, ‖𝔼 i, z ω i‖ ^ 2) ≤ Real.exp (-min (m : ℝ) V / 100) := by
|
| 81 |
+
have h := uniform_boolean_second_moment_bound m z hz
|
| 82 |
+
(Real.exp (-V / 20) + Real.exp (-V / 5)) (by positivity) hgood
|
| 83 |
+
exact h.trans (by simpa only [add_assoc] using
|
| 84 |
+
random_second_moment_absorption (m : ℝ) V hlarge)
|
| 85 |
+
|
| 86 |
+
end Problem337
|
| 87 |
+
|
| 88 |
+
end
|
| 89 |
+
|
| 90 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/UpperSlope.lean
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
open Filter
|
| 5 |
+
open scoped Topology
|
| 6 |
+
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
/-- A double logarithm estimate for the elementary denominator bound. -/
|
| 10 |
+
theorem loglog_le_of_power_bound {k : ℕ} {x : ℝ} (hk : 2 ≤ k)
|
| 11 |
+
(hx : 2 ≤ x) (hbound : x ≤ 1 + (k : ℝ) ^ (2 ^ (k - 1))) :
|
| 12 |
+
Real.log (Real.log x) ≤ (k : ℝ) * Real.log 2 + Real.log (Real.log k) := by
|
| 13 |
+
have hkR : 2 ≤ (k : ℝ) := by exact_mod_cast hk
|
| 14 |
+
have hkpos : 0 < (k : ℝ) := by linarith
|
| 15 |
+
have hkone : 1 ≤ (k : ℝ) := by linarith
|
| 16 |
+
have hlogk : 0 < Real.log (k : ℝ) := Real.log_pos (by linarith)
|
| 17 |
+
have hp : 1 ≤ (2 : ℕ) ^ (k - 1) := Nat.one_le_pow _ _ (by decide)
|
| 18 |
+
have hpow : 2 ≤ (k : ℝ) ^ (2 ^ (k - 1)) := by
|
| 19 |
+
calc
|
| 20 |
+
2 ≤ (k : ℝ) := hkR
|
| 21 |
+
_ = (k : ℝ) ^ 1 := by simp
|
| 22 |
+
_ ≤ (k : ℝ) ^ (2 ^ (k - 1)) := pow_le_pow_right₀ hkone hp
|
| 23 |
+
have hexp : (2 : ℕ) ^ (k - 1) * 2 = 2 ^ k := by
|
| 24 |
+
rw [← pow_succ, Nat.sub_add_cancel (by omega : 1 ≤ k)]
|
| 25 |
+
have hbound' : x ≤ (k : ℝ) ^ (2 ^ k) := by
|
| 26 |
+
calc
|
| 27 |
+
x ≤ 1 + (k : ℝ) ^ (2 ^ (k - 1)) := hbound
|
| 28 |
+
_ ≤ ((k : ℝ) ^ (2 ^ (k - 1))) ^ 2 := by nlinarith
|
| 29 |
+
_ = (k : ℝ) ^ (2 ^ k) := by rw [← pow_mul, hexp]
|
| 30 |
+
have hlog : Real.log x ≤ (2 : ℝ) ^ k * Real.log (k : ℝ) := by
|
| 31 |
+
simpa only [Real.log_pow, Nat.cast_pow, Nat.cast_ofNat] using
|
| 32 |
+
Real.log_le_log (by linarith : 0 < x) hbound'
|
| 33 |
+
have hlogx : 0 < Real.log x := Real.log_pos (by linarith)
|
| 34 |
+
calc
|
| 35 |
+
Real.log (Real.log x) ≤ Real.log ((2 : ℝ) ^ k * Real.log (k : ℝ)) :=
|
| 36 |
+
Real.log_le_log hlogx hlog
|
| 37 |
+
_ = (k : ℝ) * Real.log 2 + Real.log (Real.log k) := by
|
| 38 |
+
rw [Real.log_mul (by positivity) (ne_of_gt hlogk), Real.log_pow]
|
| 39 |
+
|
| 40 |
+
/-- The logarithmic error in the denominator upper bound is negligible. -/
|
| 41 |
+
theorem tendsto_log_nat_div_nat :
|
| 42 |
+
Tendsto (fun k : ℕ => Real.log (k : ℝ) / (k : ℝ)) atTop (𝓝 0) := by
|
| 43 |
+
have h := Real.tendsto_pow_log_div_mul_add_atTop 1 0 1 one_ne_zero
|
| 44 |
+
simpa [Function.comp_def] using h.comp tendsto_natCast_atTop_atTop
|
| 45 |
+
|
| 46 |
+
/-- The elementary power upper bound forces the sharp upper logarithmic slope. -/
|
| 47 |
+
theorem power_bound_slope_limits (u : ℕ → ℝ)
|
| 48 |
+
(hu : ∀ᶠ k in atTop, 2 ≤ u k ∧
|
| 49 |
+
u k ≤ 1 + (k : ℝ) ^ (2 ^ (k - 1))) :
|
| 50 |
+
0 ≤ liminf (fun k => Real.log (Real.log (u k)) / (k : ℝ)) atTop ∧
|
| 51 |
+
liminf (fun k => Real.log (Real.log (u k)) / (k : ℝ)) atTop ≤
|
| 52 |
+
limsup (fun k => Real.log (Real.log (u k)) / (k : ℝ)) atTop ∧
|
| 53 |
+
limsup (fun k => Real.log (Real.log (u k)) / (k : ℝ)) atTop ≤ Real.log 2 := by
|
| 54 |
+
let f : ℕ → ℝ := fun k => Real.log (Real.log (u k)) / (k : ℝ)
|
| 55 |
+
have hupp : f ≤ᶠ[atTop] (fun k : ℕ => Real.log 2 + Real.log (k : ℝ) / (k : ℝ)) := by
|
| 56 |
+
filter_upwards [hu, eventually_ge_atTop 2] with k hk hk2
|
| 57 |
+
have hkR : 2 ≤ (k : ℝ) := by exact_mod_cast hk2
|
| 58 |
+
have hkpos : 0 < (k : ℝ) := by linarith
|
| 59 |
+
have hlog : Real.log (Real.log (k : ℝ)) ≤ Real.log (k : ℝ) := by
|
| 60 |
+
apply Real.log_le_log (Real.log_pos (by linarith))
|
| 61 |
+
linarith [Real.log_le_sub_one_of_pos hkpos]
|
| 62 |
+
have hmain := loglog_le_of_power_bound hk2 hk.1 hk.2
|
| 63 |
+
calc
|
| 64 |
+
f k ≤ ((k : ℝ) * Real.log 2 + Real.log (k : ℝ)) / (k : ℝ) := by
|
| 65 |
+
apply div_le_div_of_nonneg_right _ hkpos.le
|
| 66 |
+
exact hmain.trans (add_le_add (le_refl _) hlog)
|
| 67 |
+
_ = Real.log 2 + Real.log (k : ℝ) / (k : ℝ) := by
|
| 68 |
+
field_simp
|
| 69 |
+
have hlo : (fun k : ℕ => Real.log (Real.log 2) / (k : ℝ)) ≤ᶠ[atTop] f := by
|
| 70 |
+
filter_upwards [hu, eventually_ge_atTop 2] with k hk hk2
|
| 71 |
+
apply div_le_div_of_nonneg_right _ (Nat.cast_nonneg k)
|
| 72 |
+
exact Real.log_le_log (Real.log_pos (by norm_num))
|
| 73 |
+
(Real.log_le_log (by norm_num) hk.1)
|
| 74 |
+
have htU : Tendsto (fun k : ℕ => Real.log 2 + Real.log (k : ℝ) / (k : ℝ))
|
| 75 |
+
atTop (𝓝 (Real.log 2)) := by
|
| 76 |
+
simpa using tendsto_const_nhds.add tendsto_log_nat_div_nat
|
| 77 |
+
have htL : Tendsto (fun k : ℕ => Real.log (Real.log 2) / (k : ℝ))
|
| 78 |
+
atTop (𝓝 0) := tendsto_const_nhds.div_atTop tendsto_natCast_atTop_atTop
|
| 79 |
+
have hfbU : atTop.IsBoundedUnder (· ≤ ·) f := htU.isBoundedUnder_le.mono_le hupp
|
| 80 |
+
have hfbL : atTop.IsBoundedUnder (· ≥ ·) f := htL.isBoundedUnder_ge.mono_ge hlo
|
| 81 |
+
change 0 ≤ liminf f atTop ∧ liminf f atTop ≤ limsup f atTop ∧
|
| 82 |
+
limsup f atTop ≤ Real.log 2
|
| 83 |
+
refine ⟨?_, liminf_le_limsup hfbU hfbL, ?_⟩
|
| 84 |
+
· calc
|
| 85 |
+
0 = liminf (fun k : ℕ => Real.log (Real.log 2) / (k : ℝ)) atTop := htL.liminf_eq.symm
|
| 86 |
+
_ ≤ liminf f atTop := liminf_le_liminf hlo htL.isBoundedUnder_ge hfbU.isCobounded_flip
|
| 87 |
+
· calc
|
| 88 |
+
limsup f atTop ≤ limsup (fun k : ℕ => Real.log 2 + Real.log (k : ℝ) / (k : ℝ)) atTop :=
|
| 89 |
+
limsup_le_limsup hupp hfbL.isCobounded_flip htU.isBoundedUnder_le
|
| 90 |
+
_ = Real.log 2 := htU.limsup_eq
|
| 91 |
+
|
| 92 |
+
end Problem337
|
| 93 |
+
|
| 94 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VanDerCorput.lean
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.FourierSecondMoment
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
open scoped BigOperators
|
| 5 |
+
open ComplexConjugate
|
| 6 |
+
|
| 7 |
+
namespace Problem337
|
| 8 |
+
|
| 9 |
+
/-- Cauchy--Schwarz for the norm of a finite complex sum. -/
|
| 10 |
+
theorem norm_sum_sq_le_card_mul_sum_norm_sq {α : Type*}
|
| 11 |
+
(U : Finset α) (f : α → ℂ) :
|
| 12 |
+
‖∑ u ∈ U, f u‖ ^ 2 ≤ (U.card : ℝ) * ∑ u ∈ U, ‖f u‖ ^ 2 := by
|
| 13 |
+
have hn := norm_sum_le U f
|
| 14 |
+
have hs := Finset.sum_mul_sq_le_sq_mul_sq U (fun _ => (1 : ℝ)) (fun u => ‖f u‖)
|
| 15 |
+
simp only [one_mul, one_pow, Finset.sum_const, nsmul_eq_mul, mul_one] at hs
|
| 16 |
+
exact (pow_le_pow_left₀ (norm_nonneg _) hn 2).trans hs
|
| 17 |
+
|
| 18 |
+
/-- Averaging equal column sums and bounding their pairwise correlations.
|
| 19 |
+
This is the finite algebraic core of van der Corput differencing. -/
|
| 20 |
+
theorem averaged_columns_correlation_bound {α β : Type*}
|
| 21 |
+
(U : Finset α) (T : Finset β) (z : α → β → ℂ)
|
| 22 |
+
(S : ℂ) (D E : ℝ)
|
| 23 |
+
(hcol : ∀ t ∈ T, ∑ u ∈ U, z u t = S)
|
| 24 |
+
(hdiag : ∀ t ∈ T, ∑ u ∈ U, ‖z u t‖ ^ 2 ≤ D)
|
| 25 |
+
(hcorr : ∀ t ∈ T, ∀ s ∈ T, t ≠ s →
|
| 26 |
+
‖∑ u ∈ U, z u t * conj (z u s)‖ ≤ E) :
|
| 27 |
+
(T.card : ℝ) ^ 2 * ‖S‖ ^ 2 ≤
|
| 28 |
+
(U.card : ℝ) * ((T.card : ℝ) * D +
|
| 29 |
+
(T.card : ℝ) * (T.card - 1 : ℝ) * E) := by
|
| 30 |
+
classical
|
| 31 |
+
have havg : (∑ u ∈ U, ∑ t ∈ T, z u t) = (T.card : ℂ) * S := by
|
| 32 |
+
rw [Finset.sum_comm]
|
| 33 |
+
simp_rw [Finset.sum_congr rfl hcol]
|
| 34 |
+
simp
|
| 35 |
+
have hcs := norm_sum_sq_le_card_mul_sum_norm_sq U (fun u => ∑ t ∈ T, z u t)
|
| 36 |
+
rw [havg, norm_mul, Complex.norm_natCast, mul_pow] at hcs
|
| 37 |
+
apply hcs.trans
|
| 38 |
+
apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)
|
| 39 |
+
rw [finite_complex_second_moment_identity]
|
| 40 |
+
have hentry (t : β) (ht : t ∈ T) (s : β) (hs : s ∈ T) :
|
| 41 |
+
(∑ u ∈ U, z u t * conj (z u s)).re ≤
|
| 42 |
+
E + if t = s then D - E else 0 := by
|
| 43 |
+
by_cases heq : t = s
|
| 44 |
+
· subst s
|
| 45 |
+
simp only [re_finset_sum, Complex.mul_conj, Complex.ofReal_re,
|
| 46 |
+
Complex.normSq_eq_norm_sq, ite_true, add_sub_cancel]
|
| 47 |
+
exact hdiag t ht
|
| 48 |
+
· simpa [heq] using (Complex.re_le_norm _).trans (hcorr t ht s hs heq)
|
| 49 |
+
calc
|
| 50 |
+
(∑ t ∈ T, ∑ s ∈ T, (∑ u ∈ U, z u t * conj (z u s)).re) ≤
|
| 51 |
+
∑ t ∈ T, ∑ s ∈ T, (E + if t = s then D - E else 0) := by
|
| 52 |
+
exact Finset.sum_le_sum (fun t ht => Finset.sum_le_sum (fun s hs => hentry t ht s hs))
|
| 53 |
+
_ = (T.card : ℝ) * D + (T.card : ℝ) * (T.card - 1 : ℝ) * E := by
|
| 54 |
+
have hrow (t : β) (ht : t ∈ T) :
|
| 55 |
+
(∑ s ∈ T, (E + if t = s then D - E else 0)) =
|
| 56 |
+
(T.card : ℝ) * E + D - E := by
|
| 57 |
+
simp [Finset.sum_add_distrib, ht]
|
| 58 |
+
ring
|
| 59 |
+
simp_rw [Finset.sum_congr rfl hrow]
|
| 60 |
+
simp only [Finset.sum_const, nsmul_eq_mul]
|
| 61 |
+
ring
|
| 62 |
+
|
| 63 |
+
/-- Translation does not change a finite sum once the summation interval
|
| 64 |
+
contains all translated points in its support. -/
|
| 65 |
+
theorem sum_shift_supported {M : Type*} [AddCommMonoid M]
|
| 66 |
+
(a : ℤ → M) (N H : ℕ) (t : ℤ) (ht0 : 0 ≤ t) (htH : t ≤ H)
|
| 67 |
+
(hsupport : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → a n = 0) :
|
| 68 |
+
(∑ n ∈ Finset.Icc (1 - (H : ℤ)) N, a (n + t)) =
|
| 69 |
+
∑ n ∈ Finset.Icc (1 : ℤ) N, a n := by
|
| 70 |
+
classical
|
| 71 |
+
apply Finset.sum_bij_ne_zero (fun n _ _ => n + t)
|
| 72 |
+
· intro n hn hne
|
| 73 |
+
by_contra hout
|
| 74 |
+
exact hne (hsupport (n + t) hout)
|
| 75 |
+
· intro n hn hn0 m hm hm0 heq
|
| 76 |
+
omega
|
| 77 |
+
· intro n hn hn0
|
| 78 |
+
refine ⟨n - t, ?_, ?_, by omega⟩
|
| 79 |
+
· simp only [Finset.mem_Icc] at hn ⊢
|
| 80 |
+
omega
|
| 81 |
+
· simpa using hn0
|
| 82 |
+
· intros
|
| 83 |
+
rfl
|
| 84 |
+
|
| 85 |
+
/-- A concrete finite-support shift bound, before using `H ≤ N` to simplify
|
| 86 |
+
the two endpoint losses. Correlation assumptions are symmetric in the shift. -/
|
| 87 |
+
theorem van_der_corput_interval_exact
|
| 88 |
+
(a : ℤ → ℂ) (N H : ℕ) (hH : 1 ≤ H) (E : ℝ) (hE : 0 ≤ E)
|
| 89 |
+
(hsupport : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → a n = 0)
|
| 90 |
+
(hnorm : ∀ n : ℤ, ‖a n‖ ≤ 1)
|
| 91 |
+
(hcorr : ∀ h : ℤ, -(H : ℤ) < h → h < H → h ≠ 0 →
|
| 92 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + h) * conj (a n)‖ ≤ E) :
|
| 93 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a n‖ ^ 2 ≤
|
| 94 |
+
((N : ℝ) + H) * ((N : ℝ) / H + E) := by
|
| 95 |
+
classical
|
| 96 |
+
let U := Finset.Icc (1 - (H : ℤ)) (N : ℤ)
|
| 97 |
+
let T := Finset.range H
|
| 98 |
+
let z : ℤ → ℕ → ℂ := fun n t => a (n + t)
|
| 99 |
+
have hcardU : (U.card : ℝ) = (N : ℝ) + H := by
|
| 100 |
+
dsimp [U]
|
| 101 |
+
rw [Int.card_Icc]
|
| 102 |
+
have heq : (N : ℤ) + 1 - (1 - (H : ℤ)) = ((N + H : ℕ) : ℤ) := by omega
|
| 103 |
+
rw [heq]
|
| 104 |
+
norm_cast
|
| 105 |
+
have hcol (t : ℕ) (ht : t ∈ T) :
|
| 106 |
+
(∑ n ∈ U, z n t) = ∑ n ∈ Finset.Icc (1 : ℤ) N, a n := by
|
| 107 |
+
exact sum_shift_supported a N H t (by omega) (by have := Finset.mem_range.mp ht; omega) hsupport
|
| 108 |
+
have hdiag (t : ℕ) (ht : t ∈ T) : (∑ n ∈ U, ‖z n t‖ ^ 2) ≤ (N : ℝ) := by
|
| 109 |
+
have hs : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → ‖a n‖ ^ 2 = 0 := by
|
| 110 |
+
intro n hn
|
| 111 |
+
simp [hsupport n hn]
|
| 112 |
+
have heq := sum_shift_supported (fun n => ‖a n‖ ^ 2) N H t
|
| 113 |
+
(by omega) (by have := Finset.mem_range.mp ht; omega) hs
|
| 114 |
+
change (∑ n ∈ U, ‖a (n + t)‖ ^ 2) ≤ (N : ℝ)
|
| 115 |
+
rw [heq]
|
| 116 |
+
calc
|
| 117 |
+
(∑ n ∈ Finset.Icc (1 : ℤ) N, ‖a n‖ ^ 2) ≤
|
| 118 |
+
∑ _n ∈ Finset.Icc (1 : ℤ) N, (1 : ℝ) := by
|
| 119 |
+
exact Finset.sum_le_sum (fun n _ => by have := hnorm n; have := norm_nonneg (a n); nlinarith)
|
| 120 |
+
_ = (N : ℝ) := by simp [Int.card_Icc]
|
| 121 |
+
have hcorr' (t : ℕ) (ht : t ∈ T) (s : ℕ) (hs : s ∈ T) (hne : t ≠ s) :
|
| 122 |
+
‖∑ n ∈ U, z n t * conj (z n s)‖ ≤ E := by
|
| 123 |
+
let b : ℤ → ℂ := fun n => a (n + ((t : ℤ) - s)) * conj (a n)
|
| 124 |
+
have hb : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → b n = 0 := by
|
| 125 |
+
intro n hn
|
| 126 |
+
simp [b, hsupport n hn]
|
| 127 |
+
have heq := sum_shift_supported b N H s (by omega)
|
| 128 |
+
(by have := Finset.mem_range.mp hs; omega) hb
|
| 129 |
+
have hz : (∑ n ∈ U, z n t * conj (z n s)) = ∑ n ∈ U, b (n + s) := by
|
| 130 |
+
apply Finset.sum_congr rfl
|
| 131 |
+
intro n hn
|
| 132 |
+
simp [z, b]
|
| 133 |
+
rw [hz, heq]
|
| 134 |
+
apply hcorr
|
| 135 |
+
· have := Finset.mem_range.mp ht
|
| 136 |
+
have := Finset.mem_range.mp hs
|
| 137 |
+
omega
|
| 138 |
+
· have := Finset.mem_range.mp ht
|
| 139 |
+
have := Finset.mem_range.mp hs
|
| 140 |
+
omega
|
| 141 |
+
· omega
|
| 142 |
+
have hraw := averaged_columns_correlation_bound U T z
|
| 143 |
+
(∑ n ∈ Finset.Icc (1 : ℤ) N, a n) N E hcol hdiag hcorr'
|
| 144 |
+
have hHR : (0 : ℝ) < H := by exact_mod_cast (show 0 < H by omega)
|
| 145 |
+
simp only [T, Finset.card_range, hcardU] at hraw
|
| 146 |
+
apply (mul_le_mul_iff_left₀ (sq_pos_of_pos hHR)).mp
|
| 147 |
+
have hweak : (H : ℝ)^2 * ‖∑ n ∈ Finset.Icc (1 : ℤ) N, a n‖^2 ≤
|
| 148 |
+
((N : ℝ) + H) * ((H : ℝ) * N + (H : ℝ)^2 * E) := by
|
| 149 |
+
apply hraw.trans
|
| 150 |
+
apply mul_le_mul_of_nonneg_left _ (by positivity)
|
| 151 |
+
nlinarith
|
| 152 |
+
have heq : (((N : ℝ) + H) * ((N : ℝ) / H + E)) * (H : ℝ)^2 =
|
| 153 |
+
((N : ℝ) + H) * ((H : ℝ) * N + (H : ℝ)^2 * E) := by
|
| 154 |
+
field_simp
|
| 155 |
+
rw [heq]
|
| 156 |
+
simpa [mul_comm] using hweak
|
| 157 |
+
|
| 158 |
+
/-- Opposite shifts give conjugate autocorrelations, with zero extension
|
| 159 |
+
supplying the endpoint cancellation. -/
|
| 160 |
+
theorem interval_correlation_neg (a : ℤ → ℂ) (N : ℕ) (h : ℤ)
|
| 161 |
+
(hsupport : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → a n = 0) :
|
| 162 |
+
(∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + -h) * conj (a n)) =
|
| 163 |
+
conj (∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + h) * conj (a n)) := by
|
| 164 |
+
classical
|
| 165 |
+
rw [map_sum]
|
| 166 |
+
apply Finset.sum_bij_ne_zero (fun n _ _ => n - h)
|
| 167 |
+
· intro n hn hn0
|
| 168 |
+
by_contra hout
|
| 169 |
+
have hz := hsupport (n - h) hout
|
| 170 |
+
simp [sub_eq_add_neg] at hz
|
| 171 |
+
simp [hz] at hn0
|
| 172 |
+
· intro n hn hn0 m hm hm0 heq
|
| 173 |
+
omega
|
| 174 |
+
· intro n hn hn0
|
| 175 |
+
have hmem : n + h ∈ Finset.Icc (1 : ℤ) N := by
|
| 176 |
+
by_contra hout
|
| 177 |
+
have hz := hsupport (n + h) hout
|
| 178 |
+
simp [hz] at hn0
|
| 179 |
+
refine ⟨n + h, hmem, ?_, by omega⟩
|
| 180 |
+
simpa [map_mul, mul_comm] using hn0
|
| 181 |
+
· intro n hn hn0
|
| 182 |
+
simp [map_mul, sub_eq_add_neg, mul_comm]
|
| 183 |
+
|
| 184 |
+
/-- The elementary van der Corput inequality for an interval-supported
|
| 185 |
+
sequence, in the positive-shift form required for iterated differencing. -/
|
| 186 |
+
theorem van_der_corput_interval
|
| 187 |
+
(a : ℤ → ℂ) (N H : ℕ) (hH : 1 ≤ H) (hHN : H ≤ N)
|
| 188 |
+
(E : ℝ) (hE : 0 ≤ E)
|
| 189 |
+
(hsupport : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → a n = 0)
|
| 190 |
+
(hnorm : ∀ n : ℤ, ‖a n‖ ≤ 1)
|
| 191 |
+
(hcorr : ∀ h : ℤ, 0 < h → h < H →
|
| 192 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + h) * conj (a n)‖ ≤ E) :
|
| 193 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a n‖ ^ 2 ≤
|
| 194 |
+
2 * (N : ℝ)^2 / H + 2 * (N : ℝ) * E := by
|
| 195 |
+
have hsym : ∀ h : ℤ, -(H : ℤ) < h → h < H → h ≠ 0 →
|
| 196 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + h) * conj (a n)‖ ≤ E := by
|
| 197 |
+
intro h hl hu hn
|
| 198 |
+
by_cases hp : 0 < h
|
| 199 |
+
· exact hcorr h hp hu
|
| 200 |
+
· have hneg : 0 < -h := by omega
|
| 201 |
+
have hnegb : -h < (H : ℤ) := by omega
|
| 202 |
+
have heq := interval_correlation_neg a N (-h) hsupport
|
| 203 |
+
simp only [neg_neg] at heq
|
| 204 |
+
rw [heq, Complex.norm_conj]
|
| 205 |
+
exact hcorr (-h) hneg hnegb
|
| 206 |
+
have hraw := van_der_corput_interval_exact a N H hH E hE hsupport hnorm hsym
|
| 207 |
+
have hHR : (0 : ℝ) < H := by exact_mod_cast (show 0 < H by omega)
|
| 208 |
+
have hHNR : (H : ℝ) ≤ N := by exact_mod_cast hHN
|
| 209 |
+
calc
|
| 210 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a n‖ ^ 2 ≤
|
| 211 |
+
((N : ℝ) + H) * ((N : ℝ) / H + E) := hraw
|
| 212 |
+
_ ≤ (2 * (N : ℝ)) * ((N : ℝ) / H + E) := by
|
| 213 |
+
apply mul_le_mul_of_nonneg_right (by linarith)
|
| 214 |
+
positivity
|
| 215 |
+
_ = 2 * (N : ℝ)^2 / H + 2 * (N : ℝ) * E := by ring
|
| 216 |
+
|
| 217 |
+
/-- Normalized van der Corput differencing, with an explicit absolute constant. -/
|
| 218 |
+
theorem van_der_corput_interval_normalized
|
| 219 |
+
(a : ℤ → ℂ) (N H : ℕ) (hH : 1 ≤ H) (hHN : H ≤ N)
|
| 220 |
+
(E : ℝ) (hE : 0 ≤ E)
|
| 221 |
+
(hsupport : ∀ n : ℤ, n ∉ Finset.Icc (1 : ℤ) N → a n = 0)
|
| 222 |
+
(hnorm : ∀ n : ℤ, ‖a n‖ ≤ 1)
|
| 223 |
+
(hcorr : ∀ h : ℤ, 0 < h → h < H →
|
| 224 |
+
‖∑ n ∈ Finset.Icc (1 : ℤ) N, a (n + h) * conj (a n)‖ ≤ E) :
|
| 225 |
+
‖��� n ∈ Finset.Icc (1 : ℤ) N, a n‖ ^ 2 / (N : ℝ)^2 ≤
|
| 226 |
+
2 / (H : ℝ) + 2 * E / N := by
|
| 227 |
+
have hNR : (0 : ℝ) < N := by exact_mod_cast (show 0 < N by omega)
|
| 228 |
+
have hHR : (0 : ℝ) < H := by exact_mod_cast (show 0 < H by omega)
|
| 229 |
+
apply (div_le_iff₀ (sq_pos_of_pos hNR)).mpr
|
| 230 |
+
have hraw := van_der_corput_interval a N H hH hHN E hE hsupport hnorm hcorr
|
| 231 |
+
have heq : (2 / (H : ℝ) + 2 * E / N) * (N : ℝ)^2 =
|
| 232 |
+
2 * (N : ℝ)^2 / H + 2 * (N : ℝ) * E := by
|
| 233 |
+
field_simp
|
| 234 |
+
rw [heq]
|
| 235 |
+
exact hraw
|
| 236 |
+
|
| 237 |
+
end Problem337
|
| 238 |
+
|
| 239 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanBilinear.lean
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
|
| 7 |
+
namespace Problem337.VaughanBilinear
|
| 8 |
+
|
| 9 |
+
/-- The exact correlation expansion of a weighted finite bilinear energy.
|
| 10 |
+
No distinctness or unit-modulus assumption on the phase is needed. -/
|
| 11 |
+
theorem energy_identity {α β : Type*} (s : Finset α) (t : Finset β)
|
| 12 |
+
(b : β → ℂ) (z : α → β → ℂ) :
|
| 13 |
+
((∑ m ∈ s, ‖∑ n ∈ t, b n * z m n‖ ^ 2 : ℝ) : ℂ) =
|
| 14 |
+
∑ n ∈ t, ∑ k ∈ t, b n * (starRingEnd ℂ) (b k) *
|
| 15 |
+
∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k) := by
|
| 16 |
+
classical
|
| 17 |
+
have hpoint (m : α) :
|
| 18 |
+
(‖∑ n ∈ t, b n * z m n‖ ^ 2 : ℂ) =
|
| 19 |
+
∑ n ∈ t, ∑ k ∈ t,
|
| 20 |
+
b n * (starRingEnd ℂ) (b k) *
|
| 21 |
+
(z m n * (starRingEnd ℂ) (z m k)) := by
|
| 22 |
+
rw [← Complex.mul_conj']
|
| 23 |
+
simp only [map_sum, map_mul, Finset.sum_mul, Finset.mul_sum]
|
| 24 |
+
rw [Finset.sum_comm]
|
| 25 |
+
apply Finset.sum_congr rfl
|
| 26 |
+
intro n hn
|
| 27 |
+
apply Finset.sum_congr rfl
|
| 28 |
+
intro k hk
|
| 29 |
+
ring
|
| 30 |
+
push_cast
|
| 31 |
+
simp_rw [hpoint]
|
| 32 |
+
rw [Finset.sum_comm]
|
| 33 |
+
apply Finset.sum_congr rfl
|
| 34 |
+
intro n hn
|
| 35 |
+
rw [Finset.sum_comm]
|
| 36 |
+
apply Finset.sum_congr rfl
|
| 37 |
+
intro k hk
|
| 38 |
+
rw [Finset.mul_sum]
|
| 39 |
+
|
| 40 |
+
/-- Bounding a bilinear energy by absolute correlations retains the
|
| 41 |
+
arithmetic cancellation in the first variable. -/
|
| 42 |
+
theorem energy_le_correlations {α β : Type*} (s : Finset α) (t : Finset β)
|
| 43 |
+
(b : β → ℂ) (z : α → β → ℂ) :
|
| 44 |
+
(∑ m ∈ s, ‖∑ n ∈ t, b n * z m n‖ ^ 2) ≤
|
| 45 |
+
∑ n ∈ t, ∑ k ∈ t, ‖b n‖ * ‖b k‖ *
|
| 46 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ := by
|
| 47 |
+
have h := congrArg Complex.re (energy_identity s t b z)
|
| 48 |
+
simp only [Complex.ofReal_re, Complex.re_sum] at h
|
| 49 |
+
rw [h]
|
| 50 |
+
apply Finset.sum_le_sum
|
| 51 |
+
intro n hn
|
| 52 |
+
apply Finset.sum_le_sum
|
| 53 |
+
intro k hk
|
| 54 |
+
calc
|
| 55 |
+
_ ≤ ‖b n * (starRingEnd ℂ) (b k) *
|
| 56 |
+
∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ := Complex.re_le_norm _
|
| 57 |
+
_ = _ := by simp only [norm_mul, Complex.norm_conj]
|
| 58 |
+
|
| 59 |
+
/-- Finite Type-II Cauchy--Schwarz, with the full correlation sum explicit.
|
| 60 |
+
This is an unconditional algebraic bound, not a minor-arc hypothesis. -/
|
| 61 |
+
theorem norm_bilinear_sq_le {α β : Type*} (s : Finset α) (t : Finset β)
|
| 62 |
+
(a : α → ℂ) (b : β → ℂ) (z : α → β → ℂ) :
|
| 63 |
+
‖∑ m ∈ s, a m * ∑ n ∈ t, b n * z m n‖ ^ 2 ≤
|
| 64 |
+
(∑ m ∈ s, ‖a m‖ ^ 2) *
|
| 65 |
+
(∑ n ∈ t, ∑ k ∈ t, ‖b n‖ * ‖b k‖ *
|
| 66 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) := by
|
| 67 |
+
calc
|
| 68 |
+
_ ≤ (∑ m ∈ s, ‖a m‖ * ‖∑ n ∈ t, b n * z m n‖) ^ 2 := by
|
| 69 |
+
apply pow_le_pow_left₀ (norm_nonneg _)
|
| 70 |
+
simpa only [norm_mul] using
|
| 71 |
+
norm_sum_le s (fun m => a m * ∑ n ∈ t, b n * z m n)
|
| 72 |
+
_ ≤ (∑ m ∈ s, ‖a m‖ ^ 2) *
|
| 73 |
+
∑ m ∈ s, ‖∑ n ∈ t, b n * z m n‖ ^ 2 :=
|
| 74 |
+
Finset.sum_mul_sq_le_sq_mul_sq s _ _
|
| 75 |
+
_ ≤ _ := mul_le_mul_of_nonneg_left (energy_le_correlations s t b z)
|
| 76 |
+
(Finset.sum_nonneg fun _ _ => sq_nonneg _)
|
| 77 |
+
|
| 78 |
+
/-- For unit phases the diagonal correlation is exactly the number of rows. -/
|
| 79 |
+
theorem diagonal_correlation {α β : Type*} (s : Finset α)
|
| 80 |
+
(z : α → β → ℂ) (n : β) (hz : ∀ m ∈ s, ‖z m n‖ = 1) :
|
| 81 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m n)‖ = (s.card : ℝ) := by
|
| 82 |
+
have h : (∑ m ∈ s, z m n * (starRingEnd ℂ) (z m n)) = (s.card : ℂ) := by
|
| 83 |
+
calc
|
| 84 |
+
_ = ∑ m ∈ s, (1 : ℂ) := by
|
| 85 |
+
apply Finset.sum_congr rfl
|
| 86 |
+
intro m hm
|
| 87 |
+
rw [Complex.mul_conj', hz m hm]
|
| 88 |
+
norm_num
|
| 89 |
+
_ = _ := by simp
|
| 90 |
+
rw [h, Complex.norm_natCast]
|
| 91 |
+
|
| 92 |
+
/-- Exact diagonal/off-diagonal separation; erased indices do not count a
|
| 93 |
+
diagonal pair twice, including when either indexing set is empty. -/
|
| 94 |
+
theorem correlation_sum_split {α β : Type*} [DecidableEq β]
|
| 95 |
+
(s : Finset α) (t : Finset β) (z : α → β → ℂ)
|
| 96 |
+
(hz : ∀ m ∈ s, ∀ n ∈ t, ‖z m n‖ = 1) :
|
| 97 |
+
(∑ n ∈ t, ∑ k ∈ t, ‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) =
|
| 98 |
+
(s.card : ℝ) * t.card +
|
| 99 |
+
∑ n ∈ t, ∑ k ∈ t.erase n,
|
| 100 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ := by
|
| 101 |
+
have hpoint (n : β) (hn : n ∈ t) :
|
| 102 |
+
(∑ k ∈ t, ‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) =
|
| 103 |
+
(s.card : ℝ) + ∑ k ∈ t.erase n,
|
| 104 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ := by
|
| 105 |
+
rw [← Finset.sum_erase_add (s := t)
|
| 106 |
+
(fun k => ‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) hn,
|
| 107 |
+
diagonal_correlation s z n (fun m hm => hz m hm n hn)]
|
| 108 |
+
ring
|
| 109 |
+
calc
|
| 110 |
+
_ = ∑ n ∈ t, ((s.card : ℝ) + ∑ k ∈ t.erase n,
|
| 111 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) :=
|
| 112 |
+
Finset.sum_congr rfl hpoint
|
| 113 |
+
_ = _ := by rw [Finset.sum_add_distrib]; simp [mul_comm]
|
| 114 |
+
|
| 115 |
+
/-- Bounded coefficient version of Type-II Cauchy--Schwarz. The diagonal
|
| 116 |
+
is evaluated exactly; only genuine off-diagonal correlations remain. -/
|
| 117 |
+
theorem norm_bilinear_sq_le_offDiagonal {α β : Type*} [DecidableEq β]
|
| 118 |
+
(s : Finset α) (t : Finset β) (a : α → ℂ) (b : β → ℂ)
|
| 119 |
+
(z : α → β → ℂ) (B : ℝ) (hB : 0 ≤ B)
|
| 120 |
+
(hb : ∀ n ∈ t, ‖b n‖ ≤ B)
|
| 121 |
+
(hz : ∀ m ∈ s, ∀ n ∈ t, ‖z m n‖ = 1) :
|
| 122 |
+
‖∑ m ∈ s, a m * ∑ n ∈ t, b n * z m n‖ ^ 2 ≤
|
| 123 |
+
(∑ m ∈ s, ‖a m‖ ^ 2) * B ^ 2 *
|
| 124 |
+
((s.card : ℝ) * t.card + ∑ n ∈ t, ∑ k ∈ t.erase n,
|
| 125 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) := by
|
| 126 |
+
have hbound :
|
| 127 |
+
(∑ n ∈ t, ∑ k ∈ t, ‖b n‖ * ‖b k‖ *
|
| 128 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) ≤
|
| 129 |
+
B ^ 2 * ∑ n ∈ t, ∑ k ∈ t,
|
| 130 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ := by
|
| 131 |
+
simp only [Finset.mul_sum]
|
| 132 |
+
apply Finset.sum_le_sum
|
| 133 |
+
intro n hn
|
| 134 |
+
apply Finset.sum_le_sum
|
| 135 |
+
intro k hk
|
| 136 |
+
apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
|
| 137 |
+
simpa only [pow_two] using mul_le_mul (hb n hn) (hb k hk) (norm_nonneg _) hB
|
| 138 |
+
calc
|
| 139 |
+
_ ≤ _ := norm_bilinear_sq_le s t a b z
|
| 140 |
+
_ ≤ (∑ m ∈ s, ‖a m‖ ^ 2) *
|
| 141 |
+
(B ^ 2 * ∑ n ∈ t, ∑ k ∈ t,
|
| 142 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) :=
|
| 143 |
+
mul_le_mul_of_nonneg_left hbound (Finset.sum_nonneg fun _ _ => sq_nonneg _)
|
| 144 |
+
_ = _ := by rw [correlation_sum_split s t z hz]; ring
|
| 145 |
+
|
| 146 |
+
/-- The standard real additive phase, with the `2π` convention. -/
|
| 147 |
+
def phase (x : ℝ) : ℂ := Real.fourierChar x
|
| 148 |
+
|
| 149 |
+
@[simp] theorem norm_phase (x : ℝ) : ‖phase x‖ = 1 := Circle.norm_coe _
|
| 150 |
+
|
| 151 |
+
theorem phase_mul_conj (x y : ℝ) :
|
| 152 |
+
phase x * (starRingEnd ℂ) (phase y) = phase (x - y) := by
|
| 153 |
+
unfold phase
|
| 154 |
+
rw [Circle.starRingEnd_addChar, ← Circle.coe_mul, ← AddChar.map_add_eq_mul]
|
| 155 |
+
congr 2
|
| 156 |
+
|
| 157 |
+
theorem phase_nat_mul (x : ℝ) (n : ℕ) : phase (x * n) = phase x ^ n := by
|
| 158 |
+
unfold phase
|
| 159 |
+
rw [mul_comm, ← nsmul_eq_mul, AddChar.map_nsmul_eq_pow, Circle.coe_pow]
|
| 160 |
+
|
| 161 |
+
/-- An exact geometric cancellation bound in a form valid even at resonance. -/
|
| 162 |
+
theorem phase_sum_mul_bound (x : ℝ) (M : ℕ) :
|
| 163 |
+
‖∑ m ∈ Finset.range M, phase (x * m)‖ * ‖1 - phase x‖ ≤ 2 := by
|
| 164 |
+
simp_rw [phase_nat_mul]
|
| 165 |
+
rw [← norm_mul, geom_sum_mul_neg]
|
| 166 |
+
calc
|
| 167 |
+
‖1 - phase x ^ M‖ ≤ ‖(1 : ℂ)‖ + ‖phase x ^ M‖ := norm_sub_le _ _
|
| 168 |
+
_ = 2 := by simp; norm_num
|
| 169 |
+
|
| 170 |
+
/-- The usual geometric sum bound away from resonance. -/
|
| 171 |
+
theorem phase_sum_le_min (x : ℝ) (M : ℕ) (hx : phase x ≠ 1) :
|
| 172 |
+
‖∑ m ∈ Finset.range M, phase (x * m)‖ ≤
|
| 173 |
+
min (M : ℝ) (2 / ‖1 - phase x‖) := by
|
| 174 |
+
apply le_min
|
| 175 |
+
· calc
|
| 176 |
+
_ ≤ ∑ m ∈ Finset.range M, ‖phase (x * m)‖ := norm_sum_le _ _
|
| 177 |
+
_ = M := by simp
|
| 178 |
+
· have hpos : 0 < ‖1 - phase x‖ := norm_pos_iff.mpr (sub_ne_zero.mpr hx.symm)
|
| 179 |
+
exact (le_div_iff₀ hpos).mpr (phase_sum_mul_bound x M)
|
| 180 |
+
|
| 181 |
+
/-- A total geometric majorant. Resonant frequencies use the trivial bound;
|
| 182 |
+
the definition never interprets division by zero as cancellation. -/
|
| 183 |
+
def geometricBound (M : ℕ) (x : ℝ) : ℝ :=
|
| 184 |
+
if phase x = 1 then M else min (M : ℝ) (2 / ‖1 - phase x‖)
|
| 185 |
+
|
| 186 |
+
theorem phase_sum_le_geometricBound (x : ℝ) (M : ℕ) :
|
| 187 |
+
‖∑ m ∈ Finset.range M, phase (x * m)‖ ≤ geometricBound M x := by
|
| 188 |
+
unfold geometricBound
|
| 189 |
+
split_ifs with hx
|
| 190 |
+
· simp_rw [phase_nat_mul, hx]
|
| 191 |
+
simp
|
| 192 |
+
· exact phase_sum_le_min x M hx
|
| 193 |
+
|
| 194 |
+
/-- The finite Type-II estimate specialized to a real bilinear phase. All
|
| 195 |
+
remaining terms are explicit one-dimensional geometric sums, bounded without
|
| 196 |
+
any Diophantine approximation assumption. -/
|
| 197 |
+
theorem real_phase_bilinear_sq_le (M : ℕ) (t : Finset ℕ)
|
| 198 |
+
(a b : ℕ → ℂ) (θ B : ℝ) (hB : 0 ≤ B)
|
| 199 |
+
(hb : ∀ n ∈ t, ‖b n‖ ≤ B) :
|
| 200 |
+
‖∑ m ∈ Finset.range M, a m * ∑ n ∈ t, b n * phase (θ * m * n)‖ ^ 2 ≤
|
| 201 |
+
(∑ m ∈ Finset.range M, ‖a m‖ ^ 2) * B ^ 2 *
|
| 202 |
+
((M : ℝ) * t.card + ∑ n ∈ t, ∑ k ∈ t.erase n,
|
| 203 |
+
geometricBound M (θ * ((n : ℝ) - k))) := by
|
| 204 |
+
have hbase := norm_bilinear_sq_le_offDiagonal (Finset.range M) t a b
|
| 205 |
+
(fun m n => phase (θ * m * n)) B hB hb
|
| 206 |
+
(fun m hm n hn => norm_phase _)
|
| 207 |
+
simp only [Finset.card_range] at hbase
|
| 208 |
+
refine hbase.trans ?_
|
| 209 |
+
apply mul_le_mul_of_nonneg_left _
|
| 210 |
+
(mul_nonneg (Finset.sum_nonneg fun _ _ => sq_nonneg _) (sq_nonneg B))
|
| 211 |
+
apply add_le_add_right
|
| 212 |
+
apply Finset.sum_le_sum
|
| 213 |
+
intro n hn
|
| 214 |
+
apply Finset.sum_le_sum
|
| 215 |
+
intro k hk
|
| 216 |
+
have hcorr : (∑ m ∈ Finset.range M,
|
| 217 |
+
phase (θ * m * n) * (starRingEnd ℂ) (phase (θ * m * k))) =
|
| 218 |
+
∑ m ∈ Finset.range M, phase ((θ * ((n : ℝ) - k)) * m) := by
|
| 219 |
+
apply Finset.sum_congr rfl
|
| 220 |
+
intro m hm
|
| 221 |
+
rw [phase_mul_conj]
|
| 222 |
+
congr 1
|
| 223 |
+
ring
|
| 224 |
+
rw [hcorr]
|
| 225 |
+
exact phase_sum_le_geometricBound _ M
|
| 226 |
+
|
| 227 |
+
/-- A finite real Schur bound, proved by symmetrizing `2xy ≤ x²+y²`.
|
| 228 |
+
The coefficients need not be nonnegative. -/
|
| 229 |
+
theorem symmetric_weighted_sum_le {β : Type*} (t : Finset β)
|
| 230 |
+
(f : β → ℝ) (K : β → β → ℝ)
|
| 231 |
+
(hK : ∀ n ∈ t, ∀ k ∈ t, 0 ≤ K n k)
|
| 232 |
+
(hsym : ∀ n ∈ t, ∀ k ∈ t, K n k = K k n) :
|
| 233 |
+
(∑ n ∈ t, ∑ k ∈ t, f n * f k * K n k) ≤
|
| 234 |
+
∑ n ∈ t, f n ^ 2 * ∑ k ∈ t, K n k := by
|
| 235 |
+
have hfirst : (∑ n ∈ t, ∑ k ∈ t, f n ^ 2 * K n k) =
|
| 236 |
+
∑ n ∈ t, f n ^ 2 * ∑ k ∈ t, K n k := by
|
| 237 |
+
simp only [Finset.mul_sum]
|
| 238 |
+
have hsecond : (∑ n ∈ t, ∑ k ∈ t, f k ^ 2 * K n k) =
|
| 239 |
+
∑ n ∈ t, f n ^ 2 * ∑ k ∈ t, K n k := by
|
| 240 |
+
rw [Finset.sum_comm]
|
| 241 |
+
simp only [Finset.mul_sum]
|
| 242 |
+
apply Finset.sum_congr rfl
|
| 243 |
+
intro n hn
|
| 244 |
+
apply Finset.sum_congr rfl
|
| 245 |
+
intro k hk
|
| 246 |
+
rw [hsym k hk n hn]
|
| 247 |
+
calc
|
| 248 |
+
_ ≤ ∑ n ∈ t, ∑ k ∈ t,
|
| 249 |
+
(f n ^ 2 * K n k + f k ^ 2 * K n k) / 2 := by
|
| 250 |
+
apply Finset.sum_le_sum
|
| 251 |
+
intro n hn
|
| 252 |
+
apply Finset.sum_le_sum
|
| 253 |
+
intro k hk
|
| 254 |
+
nlinarith [mul_nonneg (sq_nonneg (f n - f k)) (hK n hn k hk)]
|
| 255 |
+
_ = ((∑ n ∈ t, ∑ k ∈ t, f n ^ 2 * K n k) +
|
| 256 |
+
(∑ n ∈ t, ∑ k ∈ t, f k ^ 2 * K n k)) / 2 := by
|
| 257 |
+
simp only [add_div, Finset.sum_div, Finset.sum_add_distrib]
|
| 258 |
+
_ = _ := by rw [hfirst, hsecond]; ring
|
| 259 |
+
|
| 260 |
+
/-- Reversing a correlation conjugates it, hence preserves its norm. -/
|
| 261 |
+
theorem correlation_norm_symm {α β : Type*} (s : Finset α)
|
| 262 |
+
(z : α → β → ℂ) (n k : β) :
|
| 263 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖ =
|
| 264 |
+
‖∑ m ∈ s, z m k * (starRingEnd ℂ) (z m n)‖ := by
|
| 265 |
+
have hc : (∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)) =
|
| 266 |
+
(starRingEnd ℂ) (∑ m ∈ s, z m k * (starRingEnd ℂ) (z m n)) := by
|
| 267 |
+
simp only [map_sum, map_mul, starRingEnd_self_apply]
|
| 268 |
+
apply Finset.sum_congr rfl
|
| 269 |
+
intro m hm
|
| 270 |
+
ring
|
| 271 |
+
rw [hc, Complex.norm_conj]
|
| 272 |
+
|
| 273 |
+
/-- Type-II energy bound using an absolute correlation row bound. Unlike the
|
| 274 |
+
bounded-coefficient version, this retains both coefficient squared sums and
|
| 275 |
+
therefore applies directly to divisor-coefficient second-moment estimates. -/
|
| 276 |
+
theorem norm_bilinear_sq_le_energy {α β : Type*} (s : Finset α) (t : Finset β)
|
| 277 |
+
(a : α → ℂ) (b : β → ℂ) (z : α → β → ℂ) (C : ℝ)
|
| 278 |
+
(hrow : ∀ n ∈ t,
|
| 279 |
+
(∑ k ∈ t, ‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) ≤ C) :
|
| 280 |
+
‖∑ m ∈ s, a m * ∑ n ∈ t, b n * z m n‖ ^ 2 ≤
|
| 281 |
+
(∑ m ∈ s, ‖a m‖ ^ 2) * C * (∑ n ∈ t, ‖b n‖ ^ 2) := by
|
| 282 |
+
have hweight := symmetric_weighted_sum_le t (fun n => ‖b n‖)
|
| 283 |
+
(fun n k => ‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖)
|
| 284 |
+
(fun _ _ _ _ => norm_nonneg _)
|
| 285 |
+
(fun n _ k _ => correlation_norm_symm s z n k)
|
| 286 |
+
have hbound :
|
| 287 |
+
(∑ n ∈ t, ∑ k ∈ t, ‖b n‖ * ‖b k‖ *
|
| 288 |
+
‖∑ m ∈ s, z m n * (starRingEnd ℂ) (z m k)‖) ≤
|
| 289 |
+
C * ∑ n ∈ t, ‖b n‖ ^ 2 := by
|
| 290 |
+
refine hweight.trans ?_
|
| 291 |
+
rw [Finset.mul_sum]
|
| 292 |
+
apply Finset.sum_le_sum
|
| 293 |
+
intro n hn
|
| 294 |
+
simpa only [mul_comm] using mul_le_mul_of_nonneg_left (hrow n hn) (sq_nonneg ‖b n‖)
|
| 295 |
+
calc
|
| 296 |
+
_ ≤ _ := norm_bilinear_sq_le s t a b z
|
| 297 |
+
_ ≤ (∑ m ∈ s, ‖a m‖ ^ 2) * (C * ∑ n ∈ t, ‖b n‖ ^ 2) :=
|
| 298 |
+
mul_le_mul_of_nonneg_left hbound (Finset.sum_nonneg fun _ _ => sq_nonneg _)
|
| 299 |
+
_ = _ := by ring
|
| 300 |
+
|
| 301 |
+
end Problem337.VaughanBilinear
|
| 302 |
+
|
| 303 |
+
end
|
| 304 |
+
|
| 305 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanCutoff.lean
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open Filter
|
| 6 |
+
|
| 7 |
+
namespace Problem337.Vaughan
|
| 8 |
+
|
| 9 |
+
/-- The conventional balanced natural cutoff for Vaughan's identity. -/
|
| 10 |
+
def optimizedCutoff (X : ℝ) : ℕ := ⌊X ^ (2 / 5 : ℝ)⌋₊
|
| 11 |
+
|
| 12 |
+
theorem optimizedCutoff_le (X : ℝ) (hX : 0 ≤ X) :
|
| 13 |
+
(optimizedCutoff X : ℝ) ≤ X ^ (2 / 5 : ℝ) :=
|
| 14 |
+
Nat.floor_le (Real.rpow_nonneg hX _)
|
| 15 |
+
|
| 16 |
+
theorem optimizedCutoff_lower (X : ℝ) (hX : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 17 |
+
X ^ (2 / 5 : ℝ) / 2 ≤ (optimizedCutoff X : ℝ) := by
|
| 18 |
+
have hfloor := Nat.lt_floor_add_one (X ^ (2 / 5 : ℝ))
|
| 19 |
+
unfold optimizedCutoff
|
| 20 |
+
linarith
|
| 21 |
+
|
| 22 |
+
theorem optimizedCutoff_pos (X : ℝ) (hX : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 23 |
+
0 < optimizedCutoff X := by
|
| 24 |
+
have h : 2 ≤ optimizedCutoff X := Nat.le_floor hX
|
| 25 |
+
omega
|
| 26 |
+
|
| 27 |
+
theorem optimizedCutoff_sq_le (X : ℝ) (hX : 0 ≤ X) :
|
| 28 |
+
(optimizedCutoff X : ℝ) ^ 2 ≤ X ^ (4 / 5 : ℝ) := by
|
| 29 |
+
have hpow : (X ^ (2 / 5 : ℝ)) ^ 2 = X ^ (4 / 5 : ℝ) := by
|
| 30 |
+
have h := Real.rpow_mul hX (2 / 5 : ℝ) (2 : ℝ)
|
| 31 |
+
norm_num at h
|
| 32 |
+
exact h.symm
|
| 33 |
+
rw [← hpow]
|
| 34 |
+
exact pow_le_pow_left₀ (Nat.cast_nonneg _) (optimizedCutoff_le X hX) 2
|
| 35 |
+
|
| 36 |
+
theorem optimizedCutoff_le_four_fifths (X : ℝ) (hX : 1 ≤ X) :
|
| 37 |
+
(optimizedCutoff X : ℝ) ≤ X ^ (4 / 5 : ℝ) :=
|
| 38 |
+
(optimizedCutoff_le X (by linarith)).trans
|
| 39 |
+
(Real.rpow_le_rpow_of_exponent_le hX (by norm_num))
|
| 40 |
+
|
| 41 |
+
/-- The reciprocal square-root loss from a long-variable cutoff has precisely
|
| 42 |
+
the required four-fifths power, with a harmless explicit constant. -/
|
| 43 |
+
theorem div_sqrt_optimizedCutoff_le (X : ℝ) (hX : 0 < X)
|
| 44 |
+
(hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 45 |
+
X / Real.sqrt (optimizedCutoff X : ℝ) ≤ 2 * X ^ (4 / 5 : ℝ) := by
|
| 46 |
+
have hsq : (X ^ (1 / 5 : ℝ)) ^ 2 = X ^ (2 / 5 : ℝ) := by
|
| 47 |
+
have h := Real.rpow_mul hX.le (1 / 5 : ℝ) (2 : ℝ)
|
| 48 |
+
norm_num at h
|
| 49 |
+
exact h.symm
|
| 50 |
+
have hcut := optimizedCutoff_lower X hpow
|
| 51 |
+
have hs : X ^ (1 / 5 : ℝ) / 2 ≤ Real.sqrt (optimizedCutoff X : ℝ) := by
|
| 52 |
+
apply (Real.le_sqrt (by positivity) (Nat.cast_nonneg _)).mpr
|
| 53 |
+
nlinarith [sq_nonneg (X ^ (1 / 5 : ℝ))]
|
| 54 |
+
have hpos : 0 < Real.sqrt (optimizedCutoff X : ℝ) :=
|
| 55 |
+
Real.sqrt_pos.mpr (by exact_mod_cast optimizedCutoff_pos X hpow)
|
| 56 |
+
apply (div_le_iff₀ hpos).mpr
|
| 57 |
+
have hprod : X ^ (4 / 5 : ℝ) * X ^ (1 / 5 : ℝ) = X := by
|
| 58 |
+
rw [← Real.rpow_add hX]
|
| 59 |
+
norm_num
|
| 60 |
+
calc
|
| 61 |
+
X = X ^ (4 / 5 : ℝ) * X ^ (1 / 5 : ℝ) := hprod.symm
|
| 62 |
+
_ = (2 * X ^ (4 / 5 : ℝ)) * (X ^ (1 / 5 : ℝ) / 2) := by ring
|
| 63 |
+
_ ≤ _ := mul_le_mul_of_nonneg_left hs (by positivity)
|
| 64 |
+
|
| 65 |
+
/-- A concrete scalar optimization of the cutoff-dependent error terms. -/
|
| 66 |
+
theorem optimizedCutoff_error_le (X : ℝ) (hX : 1 ≤ X)
|
| 67 |
+
(hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 68 |
+
(optimizedCutoff X : ℝ) + (optimizedCutoff X : ℝ) ^ 2 +
|
| 69 |
+
X / Real.sqrt (optimizedCutoff X : ℝ) ≤ 4 * X ^ (4 / 5 : ℝ) := by
|
| 70 |
+
have h1 := optimizedCutoff_le_four_fifths X hX
|
| 71 |
+
have h2 := optimizedCutoff_sq_le X (by linarith)
|
| 72 |
+
have h3 := div_sqrt_optimizedCutoff_le X (by linarith) hpow
|
| 73 |
+
linarith
|
| 74 |
+
|
| 75 |
+
/-- The short initial segment is also absorbed by the four-fifths budget. -/
|
| 76 |
+
theorem optimizedCutoff_log_le (X : ℝ) (hX : 1 ≤ X)
|
| 77 |
+
(hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 78 |
+
(optimizedCutoff X : ℝ) * Real.log (optimizedCutoff X : ℝ) ≤
|
| 79 |
+
X ^ (4 / 5 : ℝ) * Real.log X := by
|
| 80 |
+
have hUX : (optimizedCutoff X : ℝ) ≤ X := by
|
| 81 |
+
calc
|
| 82 |
+
_ ≤ X ^ (2 / 5 : ℝ) := optimizedCutoff_le X (by linarith)
|
| 83 |
+
_ ≤ X ^ (1 : ℝ) := Real.rpow_le_rpow_of_exponent_le hX (by norm_num)
|
| 84 |
+
_ = X := Real.rpow_one X
|
| 85 |
+
have hlog : Real.log (optimizedCutoff X : ℝ) ≤ Real.log X :=
|
| 86 |
+
Real.log_le_log (by exact_mod_cast optimizedCutoff_pos X hpow) hUX
|
| 87 |
+
have hlogX : 0 ≤ Real.log X := Real.log_nonneg hX
|
| 88 |
+
exact (mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg _)).trans
|
| 89 |
+
(mul_le_mul_of_nonneg_right (optimizedCutoff_le_four_fifths X hX) hlogX)
|
| 90 |
+
|
| 91 |
+
/-- Scalar normalization to the usual three-term Vaughan envelope. The
|
| 92 |
+
Diophantine denominator only needs the ordinary range `1 ≤ q ≤ X`. -/
|
| 93 |
+
theorem optimizedCutoff_standard_envelope (X q : ℝ) (hX : 1 ≤ X)
|
| 94 |
+
(hq : 1 ≤ q) (hqX : q ≤ X) (hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 95 |
+
X / q + ((optimizedCutoff X : ℝ) + (optimizedCutoff X : ℝ) ^ 2 +
|
| 96 |
+
X / Real.sqrt (optimizedCutoff X : ℝ)) + q ≤
|
| 97 |
+
4 * (X / Real.sqrt q + X ^ (4 / 5 : ℝ) + Real.sqrt (X * q)) := by
|
| 98 |
+
have hX0 : 0 ≤ X := by linarith
|
| 99 |
+
have hq0 : 0 ≤ q := by linarith
|
| 100 |
+
have hsqpos : 0 < Real.sqrt q := Real.sqrt_pos.mpr (by linarith)
|
| 101 |
+
have hsqq : Real.sqrt q ≤ q := Real.sqrt_le_self_iff.mpr (Or.inr hq)
|
| 102 |
+
have hdiv : X / q ≤ X / Real.sqrt q :=
|
| 103 |
+
div_le_div_of_nonneg_left hX0 hsqpos hsqq
|
| 104 |
+
have hqsqrt : q ≤ Real.sqrt (X * q) := by
|
| 105 |
+
apply (Real.le_sqrt hq0 (mul_nonneg hX0 hq0)).mpr
|
| 106 |
+
nlinarith [mul_le_mul_of_nonneg_right hqX hq0]
|
| 107 |
+
have herr := optimizedCutoff_error_le X hX hpow
|
| 108 |
+
have hnonneg : 0 ≤ X / Real.sqrt q := div_nonneg hX0 hsqpos.le
|
| 109 |
+
nlinarith [Real.sqrt_nonneg (X * q)]
|
| 110 |
+
|
| 111 |
+
/-- Optimization of the square-root expression arising from a Type II block.
|
| 112 |
+
Both long-variable cutoffs are the same balanced natural cutoff. -/
|
| 113 |
+
theorem sqrt_optimizedCutoff_envelope_le (X q : ℝ) (hX : 1 ≤ X)
|
| 114 |
+
(hq : 0 < q) (hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 115 |
+
Real.sqrt (X * (X / q + X / (optimizedCutoff X : ℝ) +
|
| 116 |
+
X / (optimizedCutoff X : ℝ) + q)) ≤
|
| 117 |
+
3 * (X / Real.sqrt q + X ^ (4 / 5 : ℝ) + Real.sqrt (X * q)) := by
|
| 118 |
+
have hX0 : 0 ≤ X := by linarith
|
| 119 |
+
have hU0 : 0 < (optimizedCutoff X : ℝ) := by
|
| 120 |
+
exact_mod_cast optimizedCutoff_pos X hpow
|
| 121 |
+
have hA : 0 ≤ X / Real.sqrt q := by positivity
|
| 122 |
+
have hB : 0 ≤ X ^ (4 / 5 : ℝ) := by positivity
|
| 123 |
+
have hC : 0 ≤ Real.sqrt (X * q) := Real.sqrt_nonneg _
|
| 124 |
+
have hqeq : X * (X / q) = (X / Real.sqrt q) ^ 2 := by
|
| 125 |
+
rw [div_pow, Real.sq_sqrt hq.le]
|
| 126 |
+
ring
|
| 127 |
+
have hUeq : X * (X / (optimizedCutoff X : ℝ)) =
|
| 128 |
+
(X / Real.sqrt (optimizedCutoff X : ℝ)) ^ 2 := by
|
| 129 |
+
rw [div_pow, Real.sq_sqrt hU0.le]
|
| 130 |
+
ring
|
| 131 |
+
have hUbound := pow_le_pow_left₀ (show 0 ≤ X / Real.sqrt (optimizedCutoff X : ℝ) by
|
| 132 |
+
positivity) (div_sqrt_optimizedCutoff_le X (by linarith) hpow) 2
|
| 133 |
+
have hCeq := Real.sq_sqrt (mul_nonneg hX0 hq.le)
|
| 134 |
+
apply (Real.sqrt_le_left (by positivity)).mpr
|
| 135 |
+
rw [mul_add, mul_add, mul_add, hqeq, hUeq]
|
| 136 |
+
nlinarith [mul_nonneg hA hB, mul_nonneg hA hC, mul_nonneg hB hC,
|
| 137 |
+
sq_nonneg (X / Real.sqrt q), sq_nonneg (X ^ (4 / 5 : ℝ)),
|
| 138 |
+
sq_nonneg (Real.sqrt (X * q))]
|
| 139 |
+
|
| 140 |
+
/-- The precise squared Type II block budget transfers to the standard
|
| 141 |
+
Vaughan envelope after choosing both cutoffs as `optimizedCutoff X`. -/
|
| 142 |
+
theorem optimizedCutoff_squared_budget (X q C R : ℝ) (hX : 1 ≤ X)
|
| 143 |
+
(hq : 0 < q) (hC : 0 ≤ C) (hpow : 2 ≤ X ^ (2 / 5 : ℝ))
|
| 144 |
+
(hbound : R ^ 2 ≤ C * X * (1 + Real.log (2 * X)) ^ 6 *
|
| 145 |
+
(X / q + X / (optimizedCutoff X : ℝ) + X / (optimizedCutoff X : ℝ) + q)) :
|
| 146 |
+
R ≤ 3 * Real.sqrt C * (1 + Real.log (2 * X)) ^ 3 *
|
| 147 |
+
(X / Real.sqrt q + X ^ (4 / 5 : ℝ) + Real.sqrt (X * q)) := by
|
| 148 |
+
let L : ℝ := 1 + Real.log (2 * X)
|
| 149 |
+
let E : ℝ := X / Real.sqrt q + X ^ (4 / 5 : ℝ) + Real.sqrt (X * q)
|
| 150 |
+
have hX0 : 0 ≤ X := by linarith
|
| 151 |
+
have hL : 0 ≤ L := by
|
| 152 |
+
have := Real.log_nonneg (show (1 : ℝ) ≤ 2 * X by linarith)
|
| 153 |
+
dsimp [L]
|
| 154 |
+
linarith
|
| 155 |
+
have hE : 0 ≤ E := by dsimp [E]; positivity
|
| 156 |
+
have hD : X * (X / q + X / (optimizedCutoff X : ℝ) +
|
| 157 |
+
X / (optimizedCutoff X : ℝ) + q) ≤ (3 * E) ^ 2 :=
|
| 158 |
+
(Real.sqrt_le_left (by positivity)).mp (sqrt_optimizedCutoff_envelope_le X q hX hq hpow)
|
| 159 |
+
change R ≤ 3 * Real.sqrt C * L ^ 3 * E
|
| 160 |
+
apply le_of_sq_le_sq _ (by positivity)
|
| 161 |
+
calc
|
| 162 |
+
R ^ 2 ≤ C * X * L ^ 6 *
|
| 163 |
+
(X / q + X / (optimizedCutoff X : ℝ) + X / (optimizedCutoff X : ℝ) + q) := hbound
|
| 164 |
+
_ = (C * L ^ 6) * (X *
|
| 165 |
+
(X / q + X / (optimizedCutoff X : ℝ) + X / (optimizedCutoff X : ℝ) + q)) := by ring
|
| 166 |
+
_ ≤ (C * L ^ 6) * (3 * E) ^ 2 := mul_le_mul_of_nonneg_left hD (by positivity)
|
| 167 |
+
_ = (3 * Real.sqrt C * L ^ 3 * E) ^ 2 := by
|
| 168 |
+
have hs := Real.sq_sqrt hC
|
| 169 |
+
calc
|
| 170 |
+
_ = (3 * E) ^ 2 * L ^ 6 * (Real.sqrt C) ^ 2 := by rw [hs]; ring
|
| 171 |
+
_ = _ := by ring
|
| 172 |
+
|
| 173 |
+
/-- All cutoff inequalities hold simultaneously beyond one real threshold. -/
|
| 174 |
+
theorem eventually_optimizedCutoff_bounds :
|
| 175 |
+
∀ᶠ X : ℝ in atTop,
|
| 176 |
+
0 < optimizedCutoff X ∧
|
| 177 |
+
X ^ (2 / 5 : ℝ) / 2 ≤ (optimizedCutoff X : ℝ) ∧
|
| 178 |
+
(optimizedCutoff X : ℝ) ≤ X ^ (2 / 5 : ℝ) ∧
|
| 179 |
+
(optimizedCutoff X : ℝ) ^ 2 ≤ X ^ (4 / 5 : ℝ) ∧
|
| 180 |
+
X / Real.sqrt (optimizedCutoff X : ℝ) ≤ 2 * X ^ (4 / 5 : ℝ) := by
|
| 181 |
+
have hlarge := (tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 2 / 5)).eventually
|
| 182 |
+
(eventually_ge_atTop (2 : ℝ))
|
| 183 |
+
filter_upwards [hlarge, eventually_ge_atTop (1 : ℝ)] with X hpow hX
|
| 184 |
+
exact ⟨optimizedCutoff_pos X hpow, optimizedCutoff_lower X hpow,
|
| 185 |
+
optimizedCutoff_le X (by linarith), optimizedCutoff_sq_le X (by linarith),
|
| 186 |
+
div_sqrt_optimizedCutoff_le X (by linarith) hpow⟩
|
| 187 |
+
|
| 188 |
+
end Problem337.Vaughan
|
| 189 |
+
|
| 190 |
+
end
|
| 191 |
+
|
| 192 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanDecomposition.lean
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanTypeI
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 6 |
+
|
| 7 |
+
namespace Problem337.Vaughan
|
| 8 |
+
|
| 9 |
+
/-- Taking a short part restricts a finite weighted sum to the smaller interval. -/
|
| 10 |
+
theorem weightedSum_shortPart (N V : ℕ) (w : ℕ → ℂ) (f : ArithmeticFunction ℝ) :
|
| 11 |
+
weightedSum (Finset.Ioc 0 N) w (shortPart V f) =
|
| 12 |
+
weightedSum (Finset.Ioc 0 (min V N)) w f := by
|
| 13 |
+
unfold weightedSum
|
| 14 |
+
calc
|
| 15 |
+
_ = ∑ n ∈ Finset.Ioc 0 (min V N), (shortPart V f n : ℂ) * w n := by
|
| 16 |
+
symm
|
| 17 |
+
apply Finset.sum_subset
|
| 18 |
+
· intro n hn
|
| 19 |
+
obtain ⟨hn0, hnVN⟩ := Finset.mem_Ioc.mp hn
|
| 20 |
+
exact Finset.mem_Ioc.mpr ⟨hn0, (le_min_iff.mp hnVN).2⟩
|
| 21 |
+
· intro n hn hnot
|
| 22 |
+
have hV : ¬ n ≤ V := by
|
| 23 |
+
simp only [Finset.mem_Ioc] at hn hnot
|
| 24 |
+
omega
|
| 25 |
+
simp [hV]
|
| 26 |
+
_ = _ := by
|
| 27 |
+
apply Finset.sum_congr rfl
|
| 28 |
+
intro n hn
|
| 29 |
+
simp [(le_min_iff.mp (Finset.mem_Ioc.mp hn).2).1]
|
| 30 |
+
|
| 31 |
+
/-- The initial von Mangoldt segment has the elementary `V log V` bound. -/
|
| 32 |
+
theorem norm_short_vonMangoldt_sum_le (N V : ℕ) (w : ℕ → ℂ)
|
| 33 |
+
(hw : ∀ n ∈ Finset.Ioc 0 N, ‖w n‖ ≤ 1) :
|
| 34 |
+
‖weightedSum (Finset.Ioc 0 N) w (shortPart V Λ)‖ ≤
|
| 35 |
+
(V : ℝ) * Real.log V := by
|
| 36 |
+
rw [weightedSum_shortPart]
|
| 37 |
+
unfold weightedSum
|
| 38 |
+
calc
|
| 39 |
+
_ ≤ ∑ n ∈ Finset.Ioc 0 (min V N), ‖(Λ n : ℂ) * w n‖ := norm_sum_le _ _
|
| 40 |
+
_ ≤ ∑ _n ∈ Finset.Ioc 0 (min V N), Real.log V := by
|
| 41 |
+
apply Finset.sum_le_sum
|
| 42 |
+
intro n hn
|
| 43 |
+
obtain ⟨hn0, hnVN⟩ := Finset.mem_Ioc.mp hn
|
| 44 |
+
obtain ⟨hnV, hnN⟩ := le_min_iff.mp hnVN
|
| 45 |
+
rw [norm_mul, Complex.norm_real, Real.norm_eq_abs,
|
| 46 |
+
abs_of_nonneg ArithmeticFunction.vonMangoldt_nonneg]
|
| 47 |
+
calc
|
| 48 |
+
Λ n * ‖w n‖ ≤ Λ n * 1 := mul_le_mul_of_nonneg_left
|
| 49 |
+
(hw n (Finset.mem_Ioc.mpr ⟨hn0, hnN⟩)) ArithmeticFunction.vonMangoldt_nonneg
|
| 50 |
+
_ ≤ Real.log n := by simpa using (ArithmeticFunction.vonMangoldt_le_log (n := n))
|
| 51 |
+
_ ≤ Real.log V := Real.log_le_log (by exact_mod_cast hn0) (by exact_mod_cast hnV)
|
| 52 |
+
_ = (min V N : ℕ) * Real.log V := by simp
|
| 53 |
+
_ ≤ (V : ℝ) * Real.log V := mul_le_mul_of_nonneg_right
|
| 54 |
+
(by exact_mod_cast min_le_left V N) (Real.log_natCast_nonneg V)
|
| 55 |
+
|
| 56 |
+
/-- The actual Type II term is a hyperbola with both short factors removed. -/
|
| 57 |
+
theorem typeII_eq_hyperbola (N U V : ℕ) (w : ℕ → ℂ) :
|
| 58 |
+
weightedSum (Finset.Ioc 0 N) w (typeIICoefficient U * longPart V Λ) =
|
| 59 |
+
∑ d ∈ (hyperbola N).filter (fun d => U < d.1 ∧ V < d.2),
|
| 60 |
+
(typeIICoefficient U d.1 : ℂ) * (Λ d.2 : ℂ) * w (d.1 * d.2) := by
|
| 61 |
+
unfold weightedSum
|
| 62 |
+
rw [← positive_interval N, sum_real_convolution_hyperbola, Finset.sum_filter]
|
| 63 |
+
apply Finset.sum_congr rfl
|
| 64 |
+
intro d hd
|
| 65 |
+
by_cases hU : U < d.1
|
| 66 |
+
· by_cases hV : V < d.2 <;> simp [hU, hV]
|
| 67 |
+
· simp [hU, typeIICoefficient_eq_zero U d.1 (not_lt.mp hU)]
|
| 68 |
+
|
| 69 |
+
/-- A fully finite Vaughan estimate. Only the displayed elementary inner-sum
|
| 70 |
+
envelopes are hypotheses; the remaining Type II sum is retained explicitly. -/
|
| 71 |
+
theorem norm_vonMangoldt_sum_le (N U V : ℕ) (w : ℕ → ℂ) (B₁ B₂ : ℕ → ℝ)
|
| 72 |
+
(hw : ∀ n ∈ Finset.Ioc 0 N, ‖w n‖ ≤ 1)
|
| 73 |
+
(hfirst : ∀ a ∈ Finset.Ioc 0 (min U N), ∀ k ≤ N / a,
|
| 74 |
+
‖∑ b ∈ Finset.Ioc 0 k, w (a * b)‖ ≤ B₁ a)
|
| 75 |
+
(hsecond : ∀ a ∈ Finset.Ioc 0 (min (U * V) N),
|
| 76 |
+
‖∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤ B₂ a) :
|
| 77 |
+
‖weightedSum (Finset.Ioc 0 N) w Λ‖ ≤
|
| 78 |
+
(V : ℝ) * Real.log V +
|
| 79 |
+
2 * Real.log N * (∑ a ∈ Finset.Ioc 0 (min U N), B₁ a) +
|
| 80 |
+
Real.log N * (∑ a ∈ Finset.Ioc 0 (min (U * V) N), B₂ a) +
|
| 81 |
+
‖∑ d ∈ (hyperbola N).filter (fun d => U < d.1 ∧ V < d.2),
|
| 82 |
+
(typeIICoefficient U d.1 : ℂ) * (Λ d.2 : ℂ) * w (d.1 * d.2)‖ := by
|
| 83 |
+
have h0 := norm_short_vonMangoldt_sum_le N V w hw
|
| 84 |
+
have h1 := first_typeI_bound w N U B₁ hfirst
|
| 85 |
+
have h2 := second_typeI_bound w N U V B₂ hsecond
|
| 86 |
+
rw [weighted_identity (Finset.Ioc 0 N) w U V]
|
| 87 |
+
calc
|
| 88 |
+
_ ≤ (‖weightedSum (Finset.Ioc 0 N) w (shortPart V Λ)‖ +
|
| 89 |
+
‖weightedSum (Finset.Ioc 0 N) w
|
| 90 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖) +
|
| 91 |
+
‖weightedSum (Finset.Ioc 0 N) w (typeICoefficient U V * ζ)‖ +
|
| 92 |
+
‖weightedSum (Finset.Ioc 0 N) w (typeIICoefficient U * longPart V Λ)‖ := by
|
| 93 |
+
apply (norm_add_le _ _).trans
|
| 94 |
+
apply add_le_add _ le_rfl
|
| 95 |
+
apply (norm_sub_le _ _).trans
|
| 96 |
+
exact add_le_add (norm_add_le _ _) le_rfl
|
| 97 |
+
_ ≤ _ := by
|
| 98 |
+
rw [typeII_eq_hyperbola]
|
| 99 |
+
exact add_le_add (add_le_add (add_le_add h0 h1) h2) le_rfl
|
| 100 |
+
|
| 101 |
+
end Problem337.Vaughan
|
| 102 |
+
|
| 103 |
+
end
|
| 104 |
+
|
| 105 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadic.lean
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
/-!
|
| 5 |
+
# Exact dyadic decomposition of a truncated hyperbola
|
| 6 |
+
|
| 7 |
+
The long--long convolution is partitioned into genuine dyadic row intervals.
|
| 8 |
+
Each column interval is shortened to `N / 2^j`, retaining the exact `mn ≤ N`
|
| 9 |
+
cutoff. This is a finite reindexing, with no analytic cancellation hypothesis.
|
| 10 |
+
-/
|
| 11 |
+
|
| 12 |
+
noncomputable section
|
| 13 |
+
open scoped BigOperators
|
| 14 |
+
open Finset
|
| 15 |
+
|
| 16 |
+
namespace Problem337.VaughanDyadic
|
| 17 |
+
|
| 18 |
+
/-- Rows above the lower cutoff, inside one half-open power-of-two interval. -/
|
| 19 |
+
def shell (U N j : ℕ) : Finset ℕ :=
|
| 20 |
+
(Ioc U N).filter fun m => 2 ^ j ≤ m ∧ m < 2 ^ (j + 1)
|
| 21 |
+
|
| 22 |
+
lemma mem_shell {U N j m : ℕ} :
|
| 23 |
+
m ∈ shell U N j ↔ U < m ∧ m ≤ N ∧ 2 ^ j ≤ m ∧ m < 2 ^ (j + 1) := by
|
| 24 |
+
simp only [shell, mem_filter, mem_Ioc]
|
| 25 |
+
tauto
|
| 26 |
+
|
| 27 |
+
lemma shell_eq_log_fiber (U N j : ℕ) :
|
| 28 |
+
shell U N j = (Ioc U N).filter (fun m => Nat.log 2 m = j) := by
|
| 29 |
+
ext m
|
| 30 |
+
simp only [shell, mem_filter]
|
| 31 |
+
apply and_congr_right
|
| 32 |
+
intro hm
|
| 33 |
+
exact (Nat.log_eq_iff (Or.inr ⟨by decide, (lt_of_le_of_lt (Nat.zero_le U)
|
| 34 |
+
(mem_Ioc.mp hm).1).ne'⟩)).symm
|
| 35 |
+
|
| 36 |
+
/-- The shell is a single consecutive interval, so its phase correlations remain geometric. -/
|
| 37 |
+
lemma shell_eq_Icc (U N j : ℕ) :
|
| 38 |
+
shell U N j = Icc (max (U + 1) (2 ^ j)) (min N (2 ^ (j + 1) - 1)) := by
|
| 39 |
+
ext m
|
| 40 |
+
rw [mem_shell]
|
| 41 |
+
simp only [mem_Icc, max_le_iff, le_min_iff]
|
| 42 |
+
have hp : 0 < 2 ^ (j + 1) := by positivity
|
| 43 |
+
omega
|
| 44 |
+
|
| 45 |
+
/-- Exact partition, valid also when the original interval is empty. -/
|
| 46 |
+
theorem sum_eq_sum_shells {E : Type*} [AddCommMonoid E]
|
| 47 |
+
(U N : ℕ) (f : ℕ → E) :
|
| 48 |
+
(∑ m ∈ Ioc U N, f m) =
|
| 49 |
+
∑ j ∈ range (Nat.log 2 N + 1), ∑ m ∈ shell U N j, f m := by
|
| 50 |
+
simp_rw [shell_eq_log_fiber]
|
| 51 |
+
apply (sum_fiberwise_of_maps_to ?_ f).symm
|
| 52 |
+
intro m hm
|
| 53 |
+
exact mem_range.mpr (Nat.lt_succ_of_le (Nat.log_mono_right (mem_Ioc.mp hm).2))
|
| 54 |
+
|
| 55 |
+
lemma inner_sum_eq_common_cutoff {E : Type*} [AddCommMonoid E]
|
| 56 |
+
(N U V j m : ℕ) (hm : m ∈ shell U N j) (f : ℕ → E) :
|
| 57 |
+
(∑ n ∈ Ioc V (N / m), f n) =
|
| 58 |
+
∑ n ∈ Ioc V (N / 2 ^ j), if m * n ≤ N then f n else 0 := by
|
| 59 |
+
have hmem := mem_shell.mp hm
|
| 60 |
+
have hm0 : 0 < m := lt_of_le_of_lt (Nat.zero_le U) hmem.1
|
| 61 |
+
have hpow : 0 < 2 ^ j := by positivity
|
| 62 |
+
have hdiv : N / m ≤ N / 2 ^ j := Nat.div_le_div_left hmem.2.2.1 hpow
|
| 63 |
+
have hsets : Ioc V (N / m) =
|
| 64 |
+
(Ioc V (N / 2 ^ j)).filter (fun n => m * n ≤ N) := by
|
| 65 |
+
ext n
|
| 66 |
+
simp only [mem_Ioc, mem_filter]
|
| 67 |
+
constructor
|
| 68 |
+
· rintro ⟨hV, hn⟩
|
| 69 |
+
exact ⟨⟨hV, hn.trans hdiv⟩,
|
| 70 |
+
by simpa [Nat.mul_comm] using (Nat.le_div_iff_mul_le hm0).mp hn⟩
|
| 71 |
+
· rintro ⟨⟨hV, _⟩, hn⟩
|
| 72 |
+
exact ⟨hV, (Nat.le_div_iff_mul_le hm0).mpr (by simpa [Nat.mul_comm] using hn)⟩
|
| 73 |
+
rw [hsets, sum_filter]
|
| 74 |
+
|
| 75 |
+
/-- The actual dyadic block, not a rectangular surrogate without the cutoff. -/
|
| 76 |
+
def block {E : Type*} [AddCommMonoid E] (N U V j : ℕ) (F : ℕ → ℕ → E) : E :=
|
| 77 |
+
∑ m ∈ shell U N j, ∑ n ∈ Ioc V (N / 2 ^ j),
|
| 78 |
+
if m * n ≤ N then F m n else 0
|
| 79 |
+
|
| 80 |
+
/-- Exact long--long hyperbola decomposition into common-column dyadic blocks. -/
|
| 81 |
+
theorem sum_hyperbola_eq_sum_blocks {E : Type*} [AddCommMonoid E]
|
| 82 |
+
(N U V : ℕ) (F : ℕ → ℕ → E) :
|
| 83 |
+
(∑ m ∈ Ioc U N, ∑ n ∈ Ioc V (N / m), F m n) =
|
| 84 |
+
∑ j ∈ range (Nat.log 2 N + 1), block N U V j F := by
|
| 85 |
+
rw [sum_eq_sum_shells]
|
| 86 |
+
apply sum_congr rfl
|
| 87 |
+
intro j hj
|
| 88 |
+
unfold block
|
| 89 |
+
apply sum_congr rfl
|
| 90 |
+
intro m hm
|
| 91 |
+
exact inner_sum_eq_common_cutoff N U V j m hm (F m)
|
| 92 |
+
|
| 93 |
+
/-- Product-finset form of the same exact decomposition. -/
|
| 94 |
+
theorem sum_filtered_product_eq_sum_blocks {E : Type*} [AddCommMonoid E]
|
| 95 |
+
(N U V : ℕ) (F : ℕ → ℕ → E) :
|
| 96 |
+
(∑ d ∈ (Ioc U N ×ˢ Ioc V N).filter (fun d => d.1 * d.2 ≤ N), F d.1 d.2) =
|
| 97 |
+
∑ j ∈ range (Nat.log 2 N + 1), block N U V j F := by
|
| 98 |
+
rw [← sum_hyperbola_eq_sum_blocks, sum_filter, sum_product]
|
| 99 |
+
apply sum_congr rfl
|
| 100 |
+
intro m hm
|
| 101 |
+
have hm0 : 0 < m := lt_of_le_of_lt (Nat.zero_le U) (mem_Ioc.mp hm).1
|
| 102 |
+
rw [← sum_filter]
|
| 103 |
+
have he : (Ioc V N).filter (fun n => m * n ≤ N) = Ioc V (N / m) := by
|
| 104 |
+
ext n
|
| 105 |
+
simp only [mem_filter, mem_Ioc]
|
| 106 |
+
constructor
|
| 107 |
+
· rintro ⟨⟨hV, _⟩, hmn⟩
|
| 108 |
+
exact ⟨hV, (Nat.le_div_iff_mul_le hm0).mpr (by simpa [Nat.mul_comm] using hmn)⟩
|
| 109 |
+
· rintro ⟨hV, hn⟩
|
| 110 |
+
exact ⟨⟨hV, hn.trans (Nat.div_le_self N m)⟩,
|
| 111 |
+
by simpa [Nat.mul_comm] using (Nat.le_div_iff_mul_le hm0).mp hn⟩
|
| 112 |
+
rw [he]
|
| 113 |
+
|
| 114 |
+
/-- Triangle inequality with the actual dyadic block norms. -/
|
| 115 |
+
theorem norm_hyperbola_le_sum_block_norms {E : Type*} [SeminormedAddCommGroup E]
|
| 116 |
+
(N U V : ℕ) (F : ℕ → ℕ → E) :
|
| 117 |
+
‖∑ m ∈ Ioc U N, ∑ n ∈ Ioc V (N / m), F m n‖ ≤
|
| 118 |
+
∑ j ∈ range (Nat.log 2 N + 1), ‖block N U V j F‖ := by
|
| 119 |
+
rw [sum_hyperbola_eq_sum_blocks]
|
| 120 |
+
exact norm_sum_le _ _
|
| 121 |
+
|
| 122 |
+
/-- Any genuine uniform block estimate pays only the number of dyadic blocks. -/
|
| 123 |
+
theorem norm_hyperbola_le_block_count {E : Type*} [SeminormedAddCommGroup E]
|
| 124 |
+
(N U V : ℕ) (F : ℕ → ℕ → E) (B : ℝ)
|
| 125 |
+
(hB : ∀ j < Nat.log 2 N + 1, ‖block N U V j F‖ ≤ B) :
|
| 126 |
+
‖∑ m ∈ Ioc U N, ∑ n ∈ Ioc V (N / m), F m n‖ ≤
|
| 127 |
+
(Nat.log 2 N + 1 : ℕ) * B := by
|
| 128 |
+
calc
|
| 129 |
+
_ ≤ ∑ j ∈ range (Nat.log 2 N + 1), ‖block N U V j F‖ :=
|
| 130 |
+
norm_hyperbola_le_sum_block_norms N U V F
|
| 131 |
+
_ ≤ ∑ j ∈ range (Nat.log 2 N + 1), B :=
|
| 132 |
+
sum_le_sum fun j hj => hB j (mem_range.mp hj)
|
| 133 |
+
_ = _ := by simp
|
| 134 |
+
|
| 135 |
+
/-- Real-log normalization of the finite dyadic block count. -/
|
| 136 |
+
theorem norm_hyperbola_le_log_budget {E : Type*} [SeminormedAddCommGroup E]
|
| 137 |
+
(N U V : ℕ) (F : ℕ → ℕ → E) (B : ℝ) (hB0 : 0 ≤ B)
|
| 138 |
+
(hB : ∀ j < Nat.log 2 N + 1, ‖block N U V j F‖ ≤ B) :
|
| 139 |
+
‖∑ m ∈ Ioc U N, ∑ n ∈ Ioc V (N / m), F m n‖ ≤
|
| 140 |
+
(1 + Real.log N / Real.log 2) * B := by
|
| 141 |
+
refine (norm_hyperbola_le_block_count N U V F B hB).trans ?_
|
| 142 |
+
apply mul_le_mul_of_nonneg_right _ hB0
|
| 143 |
+
have h := Real.natLog_le_logb N 2
|
| 144 |
+
simp only [Real.logb, Nat.cast_ofNat] at h
|
| 145 |
+
push_cast
|
| 146 |
+
linarith
|
| 147 |
+
|
| 148 |
+
end Problem337.VaughanDyadic
|
| 149 |
+
|
| 150 |
+
end
|
| 151 |
+
|
| 152 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicDecomposition.lean
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanDyadic
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanDecomposition
|
| 3 |
+
import OAI.NumberTheory.EgyptianFractions.DivisorSquareMean
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 8 |
+
open Finset
|
| 9 |
+
|
| 10 |
+
namespace Problem337.Vaughan
|
| 11 |
+
|
| 12 |
+
lemma long_hyperbola_eq_filtered_product (N U V : ℕ) :
|
| 13 |
+
(hyperbola N).filter (fun d => U < d.1 ∧ V < d.2) =
|
| 14 |
+
(Ioc U N ×ˢ Ioc V N).filter (fun d => d.1 * d.2 ≤ N) := by
|
| 15 |
+
ext d
|
| 16 |
+
rcases d with ⟨a, b⟩
|
| 17 |
+
simp only [mem_filter, mem_hyperbola, mem_product, mem_Ioc]
|
| 18 |
+
constructor
|
| 19 |
+
· rintro ⟨⟨ha, hb, hp⟩, hU, hV⟩
|
| 20 |
+
exact ⟨⟨⟨hU, (Nat.le_mul_of_pos_right a hb).trans hp⟩,
|
| 21 |
+
⟨hV, (Nat.le_mul_of_pos_left b ha).trans hp⟩⟩, hp⟩
|
| 22 |
+
· rintro ⟨⟨⟨hU, ha⟩, ⟨hV, hb⟩⟩, hp⟩
|
| 23 |
+
exact ⟨⟨by omega, by omega, hp⟩, hU, hV⟩
|
| 24 |
+
|
| 25 |
+
/-- The dyadic block with the actual arithmetic coefficients in Vaughan's identity. -/
|
| 26 |
+
def typeIIBlock (N U V j : ℕ) (w : ℕ → ℂ) : ℂ :=
|
| 27 |
+
VaughanDyadic.block N U V j
|
| 28 |
+
(fun m n => (typeIICoefficient U m : ℂ) * (Λ n : ℂ) * w (m * n))
|
| 29 |
+
|
| 30 |
+
/-- No arithmetic coefficient or hyperbolic cutoff is lost in dyadic decomposition. -/
|
| 31 |
+
theorem typeII_eq_sum_dyadic_blocks (N U V : ℕ) (w : ℕ → ℂ) :
|
| 32 |
+
weightedSum (Ioc 0 N) w (typeIICoefficient U * longPart V Λ) =
|
| 33 |
+
∑ j ∈ range (Nat.log 2 N + 1), typeIIBlock N U V j w := by
|
| 34 |
+
rw [typeII_eq_hyperbola, long_hyperbola_eq_filtered_product]
|
| 35 |
+
exact VaughanDyadic.sum_filtered_product_eq_sum_blocks (E := ℂ) N U V
|
| 36 |
+
(fun m n => (typeIICoefficient U m : ℂ) * (Λ n : ℂ) * w (m * n))
|
| 37 |
+
|
| 38 |
+
theorem norm_typeII_le_sum_dyadic_blocks (N U V : ℕ) (w : ℕ → ℂ) :
|
| 39 |
+
‖weightedSum (Ioc 0 N) w (typeIICoefficient U * longPart V Λ)‖ ≤
|
| 40 |
+
∑ j ∈ range (Nat.log 2 N + 1), ‖typeIIBlock N U V j w‖ := by
|
| 41 |
+
rw [typeII_eq_sum_dyadic_blocks]
|
| 42 |
+
exact norm_sum_le _ _
|
| 43 |
+
|
| 44 |
+
/-- A genuine uniform block bound has only a logarithmic decomposition cost. -/
|
| 45 |
+
theorem norm_typeII_le_dyadic_log_budget (N U V : ℕ) (w : ℕ → ℂ)
|
| 46 |
+
(B : ℝ) (hB0 : 0 ≤ B)
|
| 47 |
+
(hB : ∀ j < Nat.log 2 N + 1, ‖typeIIBlock N U V j w‖ ≤ B) :
|
| 48 |
+
‖weightedSum (Ioc 0 N) w (typeIICoefficient U * longPart V Λ)‖ ≤
|
| 49 |
+
(1 + Real.log N / Real.log 2) * B := by
|
| 50 |
+
let F : ℕ → ℕ → ℂ :=
|
| 51 |
+
fun m n => (typeIICoefficient U m : ℂ) * (Λ n : ℂ) * w (m * n)
|
| 52 |
+
have he : weightedSum (Ioc 0 N) w (typeIICoefficient U * longPart V Λ) =
|
| 53 |
+
∑ m ∈ Ioc U N, ∑ n ∈ Ioc V (N / m), F m n := by
|
| 54 |
+
rw [typeII_eq_sum_dyadic_blocks, VaughanDyadic.sum_hyperbola_eq_sum_blocks]
|
| 55 |
+
rfl
|
| 56 |
+
rw [he]
|
| 57 |
+
exact VaughanDyadic.norm_hyperbola_le_log_budget N U V F B hB0 hB
|
| 58 |
+
|
| 59 |
+
/-- The complete finite Vaughan envelope, with its Type II term split into
|
| 60 |
+
actual dyadic blocks ready for interval correlation estimates. -/
|
| 61 |
+
theorem norm_vonMangoldt_sum_le_dyadic (N U V : ℕ) (w : ℕ → ℂ) (B₁ B₂ : ℕ → ℝ)
|
| 62 |
+
(hw : ∀ n ∈ Ioc 0 N, ‖w n‖ ≤ 1)
|
| 63 |
+
(hfirst : ∀ a ∈ Ioc 0 (min U N), ∀ k ≤ N / a,
|
| 64 |
+
‖∑ b ∈ Ioc 0 k, w (a * b)‖ ≤ B₁ a)
|
| 65 |
+
(hsecond : ∀ a ∈ Ioc 0 (min (U * V) N),
|
| 66 |
+
‖∑ b ∈ Ioc 0 (N / a), w (a * b)‖ ≤ B₂ a) :
|
| 67 |
+
‖weightedSum (Ioc 0 N) w Λ‖ ≤
|
| 68 |
+
(V : ℝ) * Real.log V +
|
| 69 |
+
2 * Real.log N * (∑ a ∈ Ioc 0 (min U N), B₁ a) +
|
| 70 |
+
Real.log N * (∑ a ∈ Ioc 0 (min (U * V) N), B₂ a) +
|
| 71 |
+
∑ j ∈ range (Nat.log 2 N + 1), ‖typeIIBlock N U V j w‖ := by
|
| 72 |
+
have h := norm_vonMangoldt_sum_le N U V w B₁ B₂ hw hfirst hsecond
|
| 73 |
+
rw [← typeII_eq_hyperbola] at h
|
| 74 |
+
exact h.trans (add_le_add le_rfl (norm_typeII_le_sum_dyadic_blocks N U V w))
|
| 75 |
+
|
| 76 |
+
/-- Sharp unconditional row energy for the actual Type II coefficient in a dyadic shell. -/
|
| 77 |
+
theorem typeII_shell_energy_le (N U j : ℕ) :
|
| 78 |
+
(∑ m ∈ VaughanDyadic.shell U N j, ‖(typeIICoefficient U m : ℂ)‖ ^ 2) ≤
|
| 79 |
+
(2 ^ (j + 1) : ℕ) * (1 + Real.log (2 ^ (j + 1) : ℕ)) ^ 3 := by
|
| 80 |
+
have hT : VaughanDyadic.shell U N j ⊆ Ioc 0 (2 ^ (j + 1)) := by
|
| 81 |
+
intro m hm
|
| 82 |
+
have h := VaughanDyadic.mem_shell.mp hm
|
| 83 |
+
exact mem_Ioc.mpr ⟨lt_of_le_of_lt (Nat.zero_le U) h.1, h.2.2.2.le⟩
|
| 84 |
+
have h := DivisorSquareMean.sum_norm_sq_le_log_of_subset
|
| 85 |
+
(fun m => (typeIICoefficient U m : ℂ)) (VaughanDyadic.shell U N j)
|
| 86 |
+
(2 ^ (j + 1)) 1 hT (by
|
| 87 |
+
intro m hm
|
| 88 |
+
simpa only [Complex.norm_real, Real.norm_eq_abs, one_mul] using
|
| 89 |
+
abs_typeIICoefficient_le_divisors_card U m)
|
| 90 |
+
simpa only [one_pow, one_mul] using h
|
| 91 |
+
|
| 92 |
+
end Problem337.Vaughan
|
| 93 |
+
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicEstimate.lean
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanDyadicDecomposition
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanHyperbolicNearRational
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators ArithmeticFunction
|
| 7 |
+
open Finset
|
| 8 |
+
|
| 9 |
+
namespace Problem337.Vaughan
|
| 10 |
+
|
| 11 |
+
lemma typeIIBlock_eq_bilinear (θ : ℝ) (N U V j : ℕ) :
|
| 12 |
+
typeIIBlock N U V j (fun k => VaughanBilinear.phase (θ * k)) =
|
| 13 |
+
∑ m ∈ Icc (max (U + 1) (2 ^ j)) (min N (2 ^ (j + 1) - 1)),
|
| 14 |
+
(typeIICoefficient U m : ℂ) *
|
| 15 |
+
∑ n ∈ Ioc V (N / 2 ^ j), (Λ n : ℂ) *
|
| 16 |
+
HyperbolaCorrelation.column θ N n m := by
|
| 17 |
+
unfold typeIIBlock VaughanDyadic.block
|
| 18 |
+
rw [VaughanDyadic.shell_eq_Icc]
|
| 19 |
+
apply sum_congr rfl
|
| 20 |
+
intro m hm
|
| 21 |
+
rw [mul_sum]
|
| 22 |
+
apply sum_congr rfl
|
| 23 |
+
intro n hn
|
| 24 |
+
unfold HyperbolaCorrelation.column
|
| 25 |
+
by_cases h : m * n ≤ N
|
| 26 |
+
· simp only [ite_eq_left h, HyperbolaCorrelation.phase_eq_vaughan]
|
| 27 |
+
rw [mul_assoc]
|
| 28 |
+
congr 2
|
| 29 |
+
congr 1
|
| 30 |
+
push_cast
|
| 31 |
+
ring
|
| 32 |
+
· simp [h]
|
| 33 |
+
|
| 34 |
+
lemma dyadic_row_length_le (N U j : ℕ) :
|
| 35 |
+
min N (2 ^ (j + 1) - 1) + 1 - max (U + 1) (2 ^ j) ≤ 2 ^ j := by
|
| 36 |
+
have htop : min N (2 ^ (j + 1) - 1) ≤ 2 ^ (j + 1) - 1 := min_le_right _ _
|
| 37 |
+
have hlow : 2 ^ j ≤ max (U + 1) (2 ^ j) := le_max_right _ _
|
| 38 |
+
have hp : 0 < 2 ^ j := by positivity
|
| 39 |
+
rw [pow_succ] at htop
|
| 40 |
+
omega
|
| 41 |
+
|
| 42 |
+
/-- The elementary bounded-weight column energy, used only as a normalization
|
| 43 |
+
inside the actual Type II block estimate. -/
|
| 44 |
+
lemma mangoldt_column_energy_le (V T : ℕ) :
|
| 45 |
+
(∑ n ∈ Ioc V T, ‖(Λ n : ℂ)‖ ^ 2) ≤ (T : ℝ) * (Real.log T) ^ 2 := by
|
| 46 |
+
calc
|
| 47 |
+
_ ≤ ∑ n ∈ Ioc V T, (Real.log T) ^ 2 := by
|
| 48 |
+
apply sum_le_sum
|
| 49 |
+
intro n hn
|
| 50 |
+
have h := mem_Ioc.mp hn
|
| 51 |
+
have hn0 : 0 < n := lt_of_le_of_lt (Nat.zero_le V) h.1
|
| 52 |
+
apply pow_le_pow_left₀ (norm_nonneg _)
|
| 53 |
+
rw [Complex.norm_real, Real.norm_eq_abs,
|
| 54 |
+
abs_of_nonneg ArithmeticFunction.vonMangoldt_nonneg]
|
| 55 |
+
exact ArithmeticFunction.vonMangoldt_le_log.trans
|
| 56 |
+
(Real.log_le_log (by exact_mod_cast hn0) (by exact_mod_cast h.2))
|
| 57 |
+
_ = ((T - V : ℕ) : ℝ) * (Real.log T) ^ 2 := by simp
|
| 58 |
+
_ ≤ _ := mul_le_mul_of_nonneg_right (by exact_mod_cast Nat.sub_le T V) (sq_nonneg _)
|
| 59 |
+
|
| 60 |
+
/-- A genuine rational-approximation estimate for one actual Vaughan block.
|
| 61 |
+
All coefficient energies and correlations have been evaluated explicitly. -/
|
| 62 |
+
theorem typeIIBlock_sq_le_raw
|
| 63 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 64 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 65 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 66 |
+
(N U V j : ℕ) :
|
| 67 |
+
‖typeIIBlock N U V j (fun k => VaughanBilinear.phase (θ * k))‖ ^ 2 ≤
|
| 68 |
+
((2 ^ (j + 1) : ℕ) * (1 + Real.log (2 ^ (j + 1) : ℕ)) ^ 3) *
|
| 69 |
+
((2 * ((N / 2 ^ j : ℕ) : ℝ) / q + 1) *
|
| 70 |
+
(2 * ((2 ^ j : ℕ) : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ))))) *
|
| 71 |
+
(((N / 2 ^ j : ℕ) : ℝ) * (Real.log (N / 2 ^ j : ℕ)) ^ 2) := by
|
| 72 |
+
have hlog : 0 ≤ 1 + Real.log (2 * (q : ℝ)) := by
|
| 73 |
+
have hq1 : (1 : ℝ) ≤ q := by exact_mod_cast hq
|
| 74 |
+
have h := Real.log_nonneg (show (1 : ℝ) ≤ 2 * q by linarith)
|
| 75 |
+
linarith
|
| 76 |
+
have h := VaughanBilinear.near_rational_hyperbolic_bilinear_sq_le θ a q hq hcop happrox
|
| 77 |
+
N (max (U + 1) (2 ^ j)) (min N (2 ^ (j + 1) - 1)) (V + 1) (N / 2 ^ j)
|
| 78 |
+
(Ioc V (N / 2 ^ j)) (by
|
| 79 |
+
intro n hn
|
| 80 |
+
have hn' := mem_Ioc.mp hn
|
| 81 |
+
exact mem_Ico.mpr ⟨by omega, by omega⟩)
|
| 82 |
+
(fun n hn => lt_of_le_of_lt (Nat.zero_le V) (mem_Ioc.mp hn).1)
|
| 83 |
+
(fun m => (typeIICoefficient U m : ℂ)) (fun n => (Λ n : ℂ))
|
| 84 |
+
rw [← typeIIBlock_eq_bilinear, ← VaughanDyadic.shell_eq_Icc] at h
|
| 85 |
+
refine h.trans ?_
|
| 86 |
+
have hA := typeII_shell_energy_le N U j
|
| 87 |
+
have hB := mangoldt_column_energy_le V (N / 2 ^ j)
|
| 88 |
+
have hlength : ((min N (2 ^ (j + 1) - 1) + 1 - max (U + 1) (2 ^ j) : ℕ) : ℝ) ≤
|
| 89 |
+
((2 ^ j : ℕ) : ℝ) := by exact_mod_cast dyadic_row_length_le N U j
|
| 90 |
+
gcongr
|
| 91 |
+
|
| 92 |
+
end Problem337.Vaughan
|
| 93 |
+
|
| 94 |
+
end
|
| 95 |
+
|
| 96 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanDyadicUniform.lean
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanDyadicEstimate
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.TypeIIBlockScalar
|
| 3 |
+
import OAI.NumberTheory.EgyptianFractions.HyperbolaDyadicBridge
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators ArithmeticFunction
|
| 8 |
+
open Finset
|
| 9 |
+
|
| 10 |
+
namespace Problem337.Vaughan
|
| 11 |
+
|
| 12 |
+
def typeIILogScale (N : ℕ) : ℝ := 1 + Real.log (2 * (N : ℝ))
|
| 13 |
+
|
| 14 |
+
lemma one_le_typeIILogScale (N : ℕ) : 1 ≤ typeIILogScale N := by
|
| 15 |
+
have h := Real.log_natCast_nonneg (2 * N)
|
| 16 |
+
simp only [Nat.cast_mul, Nat.cast_ofNat] at h
|
| 17 |
+
unfold typeIILogScale
|
| 18 |
+
linarith
|
| 19 |
+
|
| 20 |
+
lemma log_nat_le_typeIILogScale (N T : ℕ) (hT : T ≤ N) :
|
| 21 |
+
Real.log T ≤ typeIILogScale N := by
|
| 22 |
+
by_cases h0 : T = 0
|
| 23 |
+
· simp only [h0, Nat.cast_zero, Real.log_zero]
|
| 24 |
+
exact zero_le_one.trans (one_le_typeIILogScale N)
|
| 25 |
+
have ht : (0 : ℝ) < T := by exact_mod_cast Nat.pos_of_ne_zero h0
|
| 26 |
+
have htn : (T : ℝ) ≤ 2 * (N : ℝ) := by
|
| 27 |
+
have h := (Nat.cast_le (α := ℝ)).mpr hT
|
| 28 |
+
nlinarith [Nat.cast_nonneg N (α := ℝ)]
|
| 29 |
+
have hlog := Real.log_le_log ht htn
|
| 30 |
+
unfold typeIILogScale
|
| 31 |
+
linarith
|
| 32 |
+
|
| 33 |
+
/-- Uniform logarithmic normalization of the coefficient block estimate. -/
|
| 34 |
+
theorem typeIIBlock_sq_le_normalized
|
| 35 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 36 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 37 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 38 |
+
(N U V j : ℕ) (hqN : q ≤ N) (hM : 2 ^ j ≤ N) :
|
| 39 |
+
‖typeIIBlock N U V j (fun k => VaughanBilinear.phase (θ * k))‖ ^ 2 ≤
|
| 40 |
+
(2 * ((2 ^ j : ℕ) : ℝ) * (typeIILogScale N) ^ 3) *
|
| 41 |
+
((2 * ((N / 2 ^ j : ℕ) : ℝ) / q + 1) *
|
| 42 |
+
(2 * ((2 ^ j : ℕ) : ℝ) + 4 * (q : ℝ) * typeIILogScale N)) *
|
| 43 |
+
(((N / 2 ^ j : ℕ) : ℝ) * (typeIILogScale N) ^ 2) := by
|
| 44 |
+
have hH0 : 0 ≤ typeIILogScale N := zero_le_one.trans (one_le_typeIILogScale N)
|
| 45 |
+
have hqR : (0 : ℝ) < q := by exact_mod_cast hq
|
| 46 |
+
have hMR : (0 : ℝ) < ((2 ^ j : ℕ) : ℝ) := by positivity
|
| 47 |
+
have hqlog : 1 + Real.log (2 * (q : ℝ)) ≤ typeIILogScale N := by
|
| 48 |
+
unfold typeIILogScale
|
| 49 |
+
apply add_le_add le_rfl
|
| 50 |
+
exact Real.log_le_log (by positivity) (by exact_mod_cast Nat.mul_le_mul_left 2 hqN)
|
| 51 |
+
have hMlog : 1 + Real.log (2 ^ (j + 1) : ℕ) ≤ typeIILogScale N := by
|
| 52 |
+
unfold typeIILogScale
|
| 53 |
+
apply add_le_add le_rfl
|
| 54 |
+
apply Real.log_le_log (by positivity)
|
| 55 |
+
rw [pow_succ, Nat.cast_mul, Nat.cast_ofNat]
|
| 56 |
+
have hMRN : ((2 ^ j : ℕ) : ℝ) ≤ N := by exact_mod_cast hM
|
| 57 |
+
nlinarith
|
| 58 |
+
have hTlog := log_nat_le_typeIILogScale N (N / 2 ^ j) (Nat.div_le_self _ _)
|
| 59 |
+
have hraw := typeIIBlock_sq_le_raw θ a q hq hcop happrox N U V j
|
| 60 |
+
refine hraw.trans ?_
|
| 61 |
+
have hqlog0 : 0 ≤ 1 + Real.log (2 * (q : ℝ)) := by
|
| 62 |
+
have h := Real.log_natCast_nonneg (2 * q)
|
| 63 |
+
simp only [Nat.cast_mul, Nat.cast_ofNat] at h
|
| 64 |
+
linarith
|
| 65 |
+
have hMlog0 : 0 ≤ 1 + Real.log (2 ^ (j + 1) : ℕ) := by
|
| 66 |
+
linarith [Real.log_natCast_nonneg (2 ^ (j + 1))]
|
| 67 |
+
have hTlog0 := Real.log_natCast_nonneg (N / 2 ^ j)
|
| 68 |
+
have he : ((2 ^ (j + 1) : ℕ) : ℝ) = 2 * ((2 ^ j : ℕ) : ℝ) := by
|
| 69 |
+
rw [pow_succ, Nat.cast_mul, Nat.cast_ofNat]
|
| 70 |
+
ring
|
| 71 |
+
rw [he] at hMlog hMlog0 ⊢
|
| 72 |
+
gcongr
|
| 73 |
+
|
| 74 |
+
/-- Uniform actual Type II block bound, with no cancellation or energy premise. -/
|
| 75 |
+
theorem typeIIBlock_sq_le_uniform
|
| 76 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 77 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 78 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 79 |
+
(N U V j : ℕ) (hqN : q ≤ N) (hU : 0 < U) (hV : 0 < V) :
|
| 80 |
+
‖typeIIBlock N U V j (fun k => VaughanBilinear.phase (θ * k))‖ ^ 2 ≤
|
| 81 |
+
32 * (N : ℝ) * (typeIILogScale N) ^ 6 *
|
| 82 |
+
((N : ℝ) / q + (N : ℝ) / U + (N : ℝ) / V + q) := by
|
| 83 |
+
have hH : 0 ≤ typeIILogScale N := zero_le_one.trans (one_le_typeIILogScale N)
|
| 84 |
+
by_cases hb : typeIIBlock N U V j (fun k => VaughanBilinear.phase (θ * k)) = 0
|
| 85 |
+
· rw [hb, norm_zero, zero_pow (by decide : 2 ≠ 0)]
|
| 86 |
+
positivity
|
| 87 |
+
have hs : (VaughanDyadic.shell U N j).Nonempty := by
|
| 88 |
+
by_contra he
|
| 89 |
+
have he' : VaughanDyadic.shell U N j = ∅ := not_nonempty_iff_eq_empty.mp he
|
| 90 |
+
apply hb
|
| 91 |
+
simp [typeIIBlock, VaughanDyadic.block, he']
|
| 92 |
+
obtain ⟨m, hm⟩ := hs
|
| 93 |
+
have hm' := VaughanDyadic.mem_shell.mp hm
|
| 94 |
+
have hM : 2 ^ j ≤ N := hm'.2.2.1.trans hm'.2.1
|
| 95 |
+
have hbase := VaughanDyadic.base_le_div_of_block_ne_zero N U V j
|
| 96 |
+
(fun m n => (typeIICoefficient U m : ℂ) * (Λ n : ℂ) *
|
| 97 |
+
VaughanBilinear.phase (θ * (m * n : ℕ))) hb
|
| 98 |
+
have hMT : (((2 ^ j : ℕ) : ℝ) * ((N / 2 ^ j : ℕ) : ℝ)) ≤ N := by
|
| 99 |
+
exact_mod_cast Nat.mul_div_le N (2 ^ j)
|
| 100 |
+
have hU2M : (U : ℝ) ≤ 2 * ((2 ^ j : ℕ) : ℝ) := by
|
| 101 |
+
have hnat : U ≤ 2 * 2 ^ j := by
|
| 102 |
+
have hu := hm'.1
|
| 103 |
+
have hmhi := hm'.2.2.2
|
| 104 |
+
rw [pow_succ] at hmhi
|
| 105 |
+
omega
|
| 106 |
+
exact_mod_cast hnat
|
| 107 |
+
have hTU : ((N / 2 ^ j : ℕ) : ℝ) ≤ 2 * (N : ℝ) / U := by
|
| 108 |
+
apply (le_div_iff₀ (by exact_mod_cast hU : (0 : ℝ) < U)).mpr
|
| 109 |
+
nlinarith [mul_le_mul_of_nonneg_left hU2M
|
| 110 |
+
(Nat.cast_nonneg (N / 2 ^ j) : (0 : ℝ) ≤ (N / 2 ^ j : ℕ))]
|
| 111 |
+
have hMV : ((2 ^ j : ℕ) : ℝ) ≤ (N : ℝ) / V := by
|
| 112 |
+
apply (le_div_iff₀ (by exact_mod_cast hV : (0 : ℝ) < V)).mpr
|
| 113 |
+
have hn : 2 ^ j * V ≤ N :=
|
| 114 |
+
(Nat.mul_le_mul_left (2 ^ j) (Nat.le_succ V)).trans
|
| 115 |
+
((Nat.le_div_iff_mul_le (Nat.succ_pos V)).mp hbase)
|
| 116 |
+
exact_mod_cast hn
|
| 117 |
+
exact (typeIIBlock_sq_le_normalized θ a q hq hcop happrox N U V j hqN hM).trans
|
| 118 |
+
(TypeIIBlockScalar.block_bound N (2 ^ j : ℕ) (N / 2 ^ j : ℕ) q U V (typeIILogScale N)
|
| 119 |
+
(Nat.cast_nonneg N) (by positivity) (Nat.cast_nonneg _)
|
| 120 |
+
(by exact_mod_cast hq) (by exact_mod_cast hU) (by exact_mod_cast hV)
|
| 121 |
+
(one_le_typeIILogScale N) hMT hTU hMV)
|
| 122 |
+
|
| 123 |
+
end Problem337.Vaughan
|
| 124 |
+
|
| 125 |
+
end
|
| 126 |
+
|
| 127 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanEstimate.lean
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanOptimized
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanTypeINormalized
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 7 |
+
|
| 8 |
+
namespace Problem337.Vaughan
|
| 9 |
+
|
| 10 |
+
lemma realPhase_eq_bilinear_phase (x : ℝ) :
|
| 11 |
+
RealPhase.phase x = VaughanBilinear.phase x :=
|
| 12 |
+
(VaughanBilinear.phase_eq_geometric_phase x).symm
|
| 13 |
+
|
| 14 |
+
lemma optimized_typeI_scales (X q : ℝ) (hX : 1 ≤ X) (hq : 1 ≤ q)
|
| 15 |
+
(hqX : q ≤ X) (hpow : 2 ≤ X ^ (2 / 5 : ℝ)) :
|
| 16 |
+
X / q + (optimizedCutoff X : ℝ) + q ≤ 4 * approximationEnvelope X q ∧
|
| 17 |
+
X / q + (optimizedCutoff X : ℝ) ^ 2 + q ≤ 4 * approximationEnvelope X q := by
|
| 18 |
+
have hs := optimizedCutoff_standard_envelope X q hX hq hqX hpow
|
| 19 |
+
have hdiv : 0 ≤ X / Real.sqrt (optimizedCutoff X : ℝ) := by positivity
|
| 20 |
+
change _ ≤ 4 * approximationEnvelope X q at hs
|
| 21 |
+
constructor <;> nlinarith [Nat.cast_nonneg (optimizedCutoff X) (α := ℝ),
|
| 22 |
+
sq_nonneg (optimizedCutoff X : ℝ)]
|
| 23 |
+
|
| 24 |
+
/-- An explicit classical Vaughan estimate for the actual von Mangoldt
|
| 25 |
+
exponential sum. The only analytic input is a reduced rational approximation;
|
| 26 |
+
all Type I and Type II cancellation estimates have been proved above. -/
|
| 27 |
+
theorem vonMangoldt_sum_bound
|
| 28 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 29 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 30 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 31 |
+
(N : ℕ) (hqN : q ≤ N)
|
| 32 |
+
(hpow : 2 ≤ (N : ℝ) ^ (2 / 5 : ℝ)) :
|
| 33 |
+
‖weightedSum (Finset.Ioc 0 N) (fun k => VaughanBilinear.phase (θ * k)) Λ‖ ≤
|
| 34 |
+
200 * (typeIILogScale N) ^ 4 * approximationEnvelope N q := by
|
| 35 |
+
let U := optimizedCutoff (N : ℝ)
|
| 36 |
+
let w : ℕ → ℂ := fun k => VaughanBilinear.phase (θ * k)
|
| 37 |
+
let H := typeIILogScale N
|
| 38 |
+
let E := approximationEnvelope (N : ℝ) q
|
| 39 |
+
have hN : 1 ≤ N := hq.trans_le hqN
|
| 40 |
+
have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN
|
| 41 |
+
have hqr : (1 : ℝ) ≤ q := by exact_mod_cast hq
|
| 42 |
+
have hqNr : (q : ℝ) ≤ N := by exact_mod_cast hqN
|
| 43 |
+
have hH : 1 ≤ H := one_le_typeIILogScale N
|
| 44 |
+
have hH0 : 0 ≤ H := zero_le_one.trans hH
|
| 45 |
+
have hE : 0 ≤ E := approximationEnvelope_nonneg N q (Nat.cast_nonneg N)
|
| 46 |
+
have hH14 : H ≤ H ^ 4 := by
|
| 47 |
+
simpa using (pow_le_pow_right₀ hH (show 1 ≤ 4 by omega))
|
| 48 |
+
have hH24 : H ^ 2 ≤ H ^ 4 := pow_le_pow_right₀ hH (by omega)
|
| 49 |
+
have hcost := optimized_typeI_scales N q hNr hqr hqNr hpow
|
| 50 |
+
have hfirst := VaughanHyperbolic.first_typeI_normalized_bound θ a q hq hcop happrox
|
| 51 |
+
N U hN hqN
|
| 52 |
+
have hsecond := VaughanHyperbolic.second_typeI_normalized_bound θ a q hq hcop happrox
|
| 53 |
+
N U U hN hqN
|
| 54 |
+
simp only [realPhase_eq_bilinear_phase] at hfirst hsecond
|
| 55 |
+
have h1 : ‖weightedSum (Finset.Ioc 0 N) w
|
| 56 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖ ≤ 64 * H ^ 4 * E := by
|
| 57 |
+
calc
|
| 58 |
+
_ ≤ 16 * H ^ 2 * ((N : ℝ) / q + U + q) := hfirst
|
| 59 |
+
_ ≤ 16 * H ^ 2 * (4 * E) := mul_le_mul_of_nonneg_left hcost.1 (by positivity)
|
| 60 |
+
_ ≤ 64 * H ^ 4 * E := by nlinarith [mul_le_mul_of_nonneg_right hH24 hE]
|
| 61 |
+
have h2 : ‖weightedSum (Finset.Ioc 0 N) w (typeICoefficient U U * ζ)‖ ≤
|
| 62 |
+
32 * H ^ 4 * E := by
|
| 63 |
+
calc
|
| 64 |
+
_ ≤ 8 * H ^ 2 * ((N : ℝ) / q + (U : ℝ) ^ 2 + q) := by
|
| 65 |
+
simpa only [H, typeIILogScale, w, pow_two] using hsecond
|
| 66 |
+
_ ≤ 8 * H ^ 2 * (4 * E) := mul_le_mul_of_nonneg_left hcost.2 (by positivity)
|
| 67 |
+
_ ≤ 32 * H ^ 4 * E := by nlinarith [mul_le_mul_of_nonneg_right hH24 hE]
|
| 68 |
+
have h0 : ‖weightedSum (Finset.Ioc 0 N) w (shortPart U Λ)‖ ≤ H ^ 4 * E := by
|
| 69 |
+
have hlog : Real.log N ≤ H ^ 4 := (log_nat_le_typeIILogScale N N le_rfl).trans hH14
|
| 70 |
+
have hpower : (N : ℝ) ^ (4 / 5 : ℝ) ≤ E := by
|
| 71 |
+
dsimp [E, approximationEnvelope]
|
| 72 |
+
have hd : 0 ≤ (N : ℝ) / Real.sqrt q := by positivity
|
| 73 |
+
linarith [Real.sqrt_nonneg ((N : ℝ) * q)]
|
| 74 |
+
calc
|
| 75 |
+
_ ≤ (U : ℝ) * Real.log U := norm_short_vonMangoldt_sum_le N U w (by
|
| 76 |
+
intro n hn
|
| 77 |
+
simp [w])
|
| 78 |
+
_ ≤ (N : ℝ) ^ (4 / 5 : ℝ) * Real.log N := optimizedCutoff_log_le N hNr hpow
|
| 79 |
+
_ ≤ E * H ^ 4 := mul_le_mul hpower hlog (Real.log_natCast_nonneg N) hE
|
| 80 |
+
_ = _ := by ring
|
| 81 |
+
have hII : ‖weightedSum (Finset.Ioc 0 N) w (typeIICoefficient U * longPart U Λ)‖ ≤
|
| 82 |
+
54 * H ^ 4 * E := optimized_typeII_bound θ a q hq hcop happrox N hqN hpow
|
| 83 |
+
change ‖weightedSum (Finset.Ioc 0 N) w Λ‖ ≤ 200 * H ^ 4 * E
|
| 84 |
+
rw [weighted_identity (Finset.Ioc 0 N) w U U]
|
| 85 |
+
calc
|
| 86 |
+
_ ≤ (‖weightedSum (Finset.Ioc 0 N) w (shortPart U Λ)‖ +
|
| 87 |
+
‖weightedSum (Finset.Ioc 0 N) w
|
| 88 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖) +
|
| 89 |
+
‖weightedSum (Finset.Ioc 0 N) w (typeICoefficient U U * ζ)‖ +
|
| 90 |
+
‖weightedSum (Finset.Ioc 0 N) w (typeIICoefficient U * longPart U Λ)‖ := by
|
| 91 |
+
apply (norm_add_le _ _).trans
|
| 92 |
+
apply add_le_add _ le_rfl
|
| 93 |
+
apply (norm_sub_le _ _).trans
|
| 94 |
+
exact add_le_add (norm_add_le _ _) le_rfl
|
| 95 |
+
_ ≤ _ := by nlinarith [mul_nonneg (pow_nonneg hH0 4) hE]
|
| 96 |
+
|
| 97 |
+
/-- The ordinary logarithmic form of the classical Vaughan estimate. -/
|
| 98 |
+
theorem vonMangoldt_sum_log_bound
|
| 99 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 100 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 101 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 102 |
+
(N : ℕ) (hqN : q ≤ N)
|
| 103 |
+
(hpow : 2 ≤ (N : ℝ) ^ (2 / 5 : ℝ)) (hlog : 1 ≤ Real.log N) :
|
| 104 |
+
‖weightedSum (Finset.Ioc 0 N) (fun k => VaughanBilinear.phase (θ * k)) Λ‖ ≤
|
| 105 |
+
16200 * (Real.log N) ^ 4 * approximationEnvelope N q := by
|
| 106 |
+
have hNr : (0 : ℝ) < N := by exact_mod_cast hq.trans_le hqN
|
| 107 |
+
have hH : typeIILogScale N ≤ 3 * Real.log N := by
|
| 108 |
+
unfold typeIILogScale
|
| 109 |
+
rw [Real.log_mul (by norm_num) hNr.ne']
|
| 110 |
+
linarith [Real.log_two_lt_d9]
|
| 111 |
+
have hH0 : 0 ≤ typeIILogScale N := zero_le_one.trans (one_le_typeIILogScale N)
|
| 112 |
+
have hE := approximationEnvelope_nonneg N q (Nat.cast_nonneg N)
|
| 113 |
+
refine (vonMangoldt_sum_bound θ a q hq hcop happrox N hqN hpow).trans ?_
|
| 114 |
+
calc
|
| 115 |
+
_ ≤ 200 * (3 * Real.log N) ^ 4 * approximationEnvelope N q := by gcongr
|
| 116 |
+
_ = _ := by ring
|
| 117 |
+
|
| 118 |
+
open Filter in
|
| 119 |
+
/-- The estimate holds uniformly in every reduced approximation once the
|
| 120 |
+
summation length is large, with an absolute explicit constant. -/
|
| 121 |
+
theorem eventually_vonMangoldt_sum_log_bound :
|
| 122 |
+
∀ᶠ N : ℕ in atTop, ∀ (θ : ℝ) (a : ℤ) (q : ℕ), 0 < q →
|
| 123 |
+
IsCoprime a (q : ℤ) → |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2 → q ≤ N →
|
| 124 |
+
‖weightedSum (Finset.Ioc 0 N) (fun k => VaughanBilinear.phase (θ * k)) Λ‖ ≤
|
| 125 |
+
16200 * (Real.log N) ^ 4 * approximationEnvelope N q := by
|
| 126 |
+
have hlog : ∀ᶠ N : ℕ in atTop, 1 ≤ Real.log (N : ℝ) :=
|
| 127 |
+
(Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop).eventually
|
| 128 |
+
(eventually_ge_atTop (1 : ℝ))
|
| 129 |
+
have hpow : ∀ᶠ N : ℕ in atTop, 2 ≤ (N : ℝ) ^ (2 / 5 : ℝ) :=
|
| 130 |
+
((tendsto_rpow_atTop (by norm_num : (0 : ℝ) < 2 / 5)).comp
|
| 131 |
+
tendsto_natCast_atTop_atTop).eventually (eventually_ge_atTop (2 : ℝ))
|
| 132 |
+
filter_upwards [hlog, hpow] with N hlog hpow
|
| 133 |
+
intro θ a q hq hcop happrox hqN
|
| 134 |
+
exact vonMangoldt_sum_log_bound θ a q hq hcop happrox N hqN hpow hlog
|
| 135 |
+
|
| 136 |
+
end Problem337.Vaughan
|
| 137 |
+
|
| 138 |
+
end
|
| 139 |
+
|
| 140 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanHyperbola.lean
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.NumberTheory.ArithmeticFunction.VonMangoldt
|
| 2 |
+
import Mathlib.Basic.Complex.Basic
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
/-!
|
| 6 |
+
# Finite hyperbola reindexing for Vaughan sums
|
| 7 |
+
|
| 8 |
+
An exact finite change of variables from `n = a*b` to pairs of positive
|
| 9 |
+
integers below a hyperbola. The arbitrary weight version is suitable for
|
| 10 |
+
both rational additive characters and real-frequency exponential sums.
|
| 11 |
+
-/
|
| 12 |
+
|
| 13 |
+
noncomputable section
|
| 14 |
+
open scoped BigOperators
|
| 15 |
+
|
| 16 |
+
namespace Problem337.Vaughan
|
| 17 |
+
|
| 18 |
+
/-- Positive lattice points below the multiplicative hyperbola `a*b ≤ N`. -/
|
| 19 |
+
def hyperbola (N : ℕ) : Finset (ℕ × ℕ) :=
|
| 20 |
+
((Finset.Icc 1 N).product (Finset.Icc 1 N)).filter (fun ab => ab.1 * ab.2 ≤ N)
|
| 21 |
+
|
| 22 |
+
@[simp] lemma mem_hyperbola {N a b : ℕ} :
|
| 23 |
+
(a, b) ∈ hyperbola N ↔ 1 ≤ a ∧ 1 ≤ b ∧ a * b ≤ N := by
|
| 24 |
+
change ((a, b) ∈ ((Finset.Icc 1 N).product (Finset.Icc 1 N)).filter
|
| 25 |
+
(fun ab => ab.1 * ab.2 ≤ N)) ↔ _
|
| 26 |
+
rw [Finset.mem_filter]
|
| 27 |
+
have hm : (a, b) ∈ (Finset.Icc 1 N).product (Finset.Icc 1 N) ↔
|
| 28 |
+
a ∈ Finset.Icc 1 N ∧ b ∈ Finset.Icc 1 N := Finset.mem_product
|
| 29 |
+
rw [hm]
|
| 30 |
+
simp only [Finset.mem_Icc]
|
| 31 |
+
constructor
|
| 32 |
+
· rintro ⟨⟨⟨ha, _⟩, ⟨hb, _⟩⟩, hp⟩
|
| 33 |
+
exact ⟨ha, hb, hp⟩
|
| 34 |
+
· rintro ⟨ha, hb, hp⟩
|
| 35 |
+
have haN : a ≤ N := (Nat.le_mul_of_pos_right a (by omega : 0 < b)).trans hp
|
| 36 |
+
have hbN : b ≤ N := (Nat.le_mul_of_pos_left b (by omega : 0 < a)).trans hp
|
| 37 |
+
exact ⟨⟨⟨ha, haN⟩, ⟨hb, hbN⟩⟩, hp⟩
|
| 38 |
+
|
| 39 |
+
/-- The divisor-antidiagonal fibers partition the positive hyperbola exactly.
|
| 40 |
+
The summand may also depend on the product index `n`. -/
|
| 41 |
+
theorem sum_divisor_fibers {A : Type*} [AddCommMonoid A]
|
| 42 |
+
(N : ℕ) (F : ℕ → ℕ → ℕ → A) :
|
| 43 |
+
(∑ n ∈ Finset.Icc 1 N, ∑ ab ∈ n.divisorsAntidiagonal, F n ab.1 ab.2) =
|
| 44 |
+
∑ ab ∈ hyperbola N, F (ab.1 * ab.2) ab.1 ab.2 := by
|
| 45 |
+
rw [Finset.sum_sigma']
|
| 46 |
+
apply Finset.sum_nbij'
|
| 47 |
+
(fun x : Sigma (fun _n : ℕ => ℕ × ℕ) => x.2)
|
| 48 |
+
(fun ab : ℕ × ℕ => (⟨ab.1 * ab.2, ab⟩ : Sigma (fun _n : ℕ => ℕ × ℕ)))
|
| 49 |
+
· rintro ⟨n, a, b⟩ hx
|
| 50 |
+
obtain ⟨hn, hab⟩ := Finset.mem_sigma.mp hx
|
| 51 |
+
obtain ⟨hn1, hnN⟩ := Finset.mem_Icc.mp hn
|
| 52 |
+
obtain ⟨hprod, hn0⟩ := Nat.mem_divisorsAntidiagonal.mp hab
|
| 53 |
+
apply mem_hyperbola.mpr
|
| 54 |
+
change a * b = n at hprod
|
| 55 |
+
change n ≠ 0 at hn0
|
| 56 |
+
have hab0 : a * b ≠ 0 := by rw [hprod]; exact hn0
|
| 57 |
+
exact ⟨Nat.pos_of_ne_zero (left_ne_zero_of_mul hab0),
|
| 58 |
+
Nat.pos_of_ne_zero (right_ne_zero_of_mul hab0), by rw [hprod]; exact hnN⟩
|
| 59 |
+
· rintro ⟨a, b⟩ hab
|
| 60 |
+
obtain ⟨ha, hb, hp⟩ := mem_hyperbola.mp hab
|
| 61 |
+
apply Finset.mem_sigma.mpr
|
| 62 |
+
constructor
|
| 63 |
+
· exact Finset.mem_Icc.mpr ⟨Nat.mul_pos ha hb, hp⟩
|
| 64 |
+
· exact Nat.mem_divisorsAntidiagonal.mpr ⟨rfl, Nat.ne_of_gt (Nat.mul_pos ha hb)⟩
|
| 65 |
+
· rintro ⟨n, a, b⟩ hx
|
| 66 |
+
have hprod := (Nat.mem_divisorsAntidiagonal.mp (Finset.mem_sigma.mp hx).2).1
|
| 67 |
+
change (⟨a * b, (a, b)⟩ : Sigma (fun _n : ℕ => ℕ × ℕ)) = ⟨n, (a, b)⟩
|
| 68 |
+
rw [hprod]
|
| 69 |
+
· intro ab hab
|
| 70 |
+
rfl
|
| 71 |
+
· rintro ⟨n, a, b⟩ hx
|
| 72 |
+
have hprod := (Nat.mem_divisorsAntidiagonal.mp (Finset.mem_sigma.mp hx).2).1
|
| 73 |
+
change F n a b = F (a * b) a b
|
| 74 |
+
rw [hprod]
|
| 75 |
+
|
| 76 |
+
/-- The hyperbola sum as ordinary nested integer intervals. The inner endpoint
|
| 77 |
+
is the natural-number quotient `N / a`; the outer interval excludes zero. -/
|
| 78 |
+
theorem sum_hyperbola_eq_nested {A : Type*} [AddCommMonoid A]
|
| 79 |
+
(N : ℕ) (F : ℕ → ℕ → A) :
|
| 80 |
+
(∑ ab ∈ hyperbola N, F ab.1 ab.2) =
|
| 81 |
+
∑ a ∈ Finset.Icc 1 N, ∑ b ∈ Finset.Icc 1 (N / a), F a b := by
|
| 82 |
+
rw [Finset.sum_sigma']
|
| 83 |
+
apply Finset.sum_nbij'
|
| 84 |
+
(fun ab : ℕ × ℕ => (⟨ab.1, ab.2⟩ : Sigma (fun _a : ℕ => ℕ)))
|
| 85 |
+
(fun x : Sigma (fun _a : ℕ => ℕ) => (x.1, x.2))
|
| 86 |
+
· rintro ⟨a, b⟩ hab
|
| 87 |
+
obtain ⟨ha, hb, hp⟩ := mem_hyperbola.mp hab
|
| 88 |
+
apply Finset.mem_sigma.mpr
|
| 89 |
+
constructor
|
| 90 |
+
· exact Finset.mem_Icc.mpr ⟨ha,
|
| 91 |
+
(Nat.le_mul_of_pos_right a (by omega : 0 < b)).trans hp⟩
|
| 92 |
+
· apply Finset.mem_Icc.mpr
|
| 93 |
+
exact ⟨hb, (Nat.le_div_iff_mul_le (by omega : 0 < a)).mpr (by simpa [mul_comm] using hp)⟩
|
| 94 |
+
· rintro ⟨a, b⟩ hx
|
| 95 |
+
obtain ⟨ha, hb⟩ := Finset.mem_sigma.mp hx
|
| 96 |
+
obtain ⟨ha1, haN⟩ := Finset.mem_Icc.mp ha
|
| 97 |
+
obtain ⟨hb1, hbN⟩ := Finset.mem_Icc.mp hb
|
| 98 |
+
change 1 ≤ a at ha1
|
| 99 |
+
change 1 ≤ b at hb1
|
| 100 |
+
change b ≤ N / a at hbN
|
| 101 |
+
apply mem_hyperbola.mpr
|
| 102 |
+
refine ⟨ha1, hb1, ?_⟩
|
| 103 |
+
have hp := (Nat.le_div_iff_mul_le (by omega : 0 < a)).mp hbN
|
| 104 |
+
simpa [mul_comm] using hp
|
| 105 |
+
· intro ab hab
|
| 106 |
+
rfl
|
| 107 |
+
· intro x hx
|
| 108 |
+
rfl
|
| 109 |
+
· intro ab hab
|
| 110 |
+
rfl
|
| 111 |
+
|
| 112 |
+
/-- Exact finite convolution reindexing with an arbitrary multiplicative
|
| 113 |
+
weight. No convergence or support hypotheses on the weight are needed. -/
|
| 114 |
+
theorem sum_convolution_hyperbola {R : Type*} [Semiring R]
|
| 115 |
+
(N : ℕ) (f g : ArithmeticFunction R) (w : ℕ → R) :
|
| 116 |
+
(∑ n ∈ Finset.Icc 1 N, (f * g) n * w n) =
|
| 117 |
+
∑ ab ∈ hyperbola N, (f ab.1 * g ab.2) * w (ab.1 * ab.2) := by
|
| 118 |
+
simp_rw [ArithmeticFunction.mul_apply, Finset.sum_mul]
|
| 119 |
+
exact sum_divisor_fibers N (fun n a b => (f a * g b) * w n)
|
| 120 |
+
|
| 121 |
+
/-- Real arithmetic coefficients with complex weights, the combination used
|
| 122 |
+
for the von-Mangoldt exponential sum. -/
|
| 123 |
+
theorem sum_real_convolution_hyperbola
|
| 124 |
+
(N : ℕ) (f g : ArithmeticFunction ℝ) (w : ℕ → ℂ) :
|
| 125 |
+
(∑ n ∈ Finset.Icc 1 N, ((f * g) n : ℂ) * w n) =
|
| 126 |
+
∑ ab ∈ hyperbola N, ((f ab.1 * g ab.2 : ℝ) : ℂ) * w (ab.1 * ab.2) := by
|
| 127 |
+
simp_rw [ArithmeticFunction.mul_apply, Complex.ofReal_sum, Finset.sum_mul]
|
| 128 |
+
exact sum_divisor_fibers N (fun n a b => ((f a * g b : ℝ) : ℂ) * w n)
|
| 129 |
+
|
| 130 |
+
/-- The traditional nested-interval form of the finite convolution identity. -/
|
| 131 |
+
theorem sum_real_convolution_eq_nested
|
| 132 |
+
(N : ℕ) (f g : ArithmeticFunction ℝ) (w : ℕ → ℂ) :
|
| 133 |
+
(∑ n ∈ Finset.Icc 1 N, ((f * g) n : ℂ) * w n) =
|
| 134 |
+
∑ a ∈ Finset.Icc 1 N, ∑ b ∈ Finset.Icc 1 (N / a),
|
| 135 |
+
((f a * g b : ℝ) : ℂ) * w (a * b) := by
|
| 136 |
+
rw [sum_real_convolution_hyperbola]
|
| 137 |
+
exact sum_hyperbola_eq_nested (A := ℂ) N
|
| 138 |
+
(fun a b => ((f a * g b : ℝ) : ℂ) * w (a * b))
|
| 139 |
+
|
| 140 |
+
end Problem337.Vaughan
|
| 141 |
+
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanHyperbolicNearRational.lean
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.HyperbolaTypeII
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanNearRational
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators
|
| 7 |
+
|
| 8 |
+
namespace Problem337.VaughanBilinear
|
| 9 |
+
|
| 10 |
+
/-- A full Type-II estimate for the actual hyperbolic region `m*n ≤ X`.
|
| 11 |
+
The rational approximation is the only analytic input: support intersection,
|
| 12 |
+
geometric cancellation, harmonic spacing, and coefficient-energy estimates
|
| 13 |
+
are all supplied by checked lemmas. Empty row and column intervals are allowed. -/
|
| 14 |
+
theorem near_rational_hyperbolic_bilinear_sq_le
|
| 15 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 16 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 17 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 18 |
+
(X L U V N : ℕ) (t : Finset ℕ)
|
| 19 |
+
(ht : t ⊆ Finset.Ico V (V + N)) (hpos : ∀ n ∈ t, 0 < n)
|
| 20 |
+
(c b : ℕ → ℂ) :
|
| 21 |
+
‖∑ m ∈ Finset.Icc L U, c m * ∑ n ∈ t,
|
| 22 |
+
b n * HyperbolaCorrelation.column θ X n m‖ ^ 2 ≤
|
| 23 |
+
(∑ m ∈ Finset.Icc L U, ‖c m‖ ^ 2) *
|
| 24 |
+
((2 * (N : ℝ) / q + 1) *
|
| 25 |
+
(2 * ((U + 1 - L : ℕ) : ℝ) +
|
| 26 |
+
4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ))))) *
|
| 27 |
+
(∑ n ∈ t, ‖b n‖ ^ 2) := by
|
| 28 |
+
apply norm_bilinear_sq_le_energy
|
| 29 |
+
intro n hn
|
| 30 |
+
calc
|
| 31 |
+
_ ≤ ∑ k ∈ t, geometricBound (U + 1 - L) (θ * ((n : ℝ) - k)) := by
|
| 32 |
+
apply Finset.sum_le_sum
|
| 33 |
+
intro k hk
|
| 34 |
+
exact HyperbolaCorrelation.column_correlation_le θ X L U n k
|
| 35 |
+
((hpos n hn).trans_le (le_max_left _ _))
|
| 36 |
+
_ ≤ _ := by
|
| 37 |
+
simpa only [Int.cast_sub, Int.cast_natCast] using
|
| 38 |
+
(sum_geometricBound_difference_le θ a q hq hcop happrox
|
| 39 |
+
(U + 1 - L) t (fun k : ℕ => (k : ℤ)) (V : ℤ) N
|
| 40 |
+
(by
|
| 41 |
+
intro k hk
|
| 42 |
+
obtain ⟨hl, hu⟩ := Finset.mem_Ico.mp (ht hk)
|
| 43 |
+
apply Finset.mem_Ico.mpr
|
| 44 |
+
constructor <;> exact_mod_cast (by assumption))
|
| 45 |
+
(by
|
| 46 |
+
intro i hi j hj hij
|
| 47 |
+
dsimp at hij
|
| 48 |
+
exact_mod_cast hij)
|
| 49 |
+
(n : ℤ))
|
| 50 |
+
|
| 51 |
+
end Problem337.VaughanBilinear
|
| 52 |
+
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanIdentity.lean
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.NumberTheory.ArithmeticFunction.VonMangoldt
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
/-!
|
| 5 |
+
# Vaughan's identity with finite cutoffs
|
| 6 |
+
|
| 7 |
+
This file supplies an unconditional algebraic input to the analytic three-prime
|
| 8 |
+
route. Multiplication of arithmetic functions below is Dirichlet convolution.
|
| 9 |
+
No estimate for exponential sums over primes is assumed or asserted here.
|
| 10 |
+
-/
|
| 11 |
+
|
| 12 |
+
noncomputable section
|
| 13 |
+
|
| 14 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius
|
| 15 |
+
ArithmeticFunction.zeta
|
| 16 |
+
|
| 17 |
+
namespace Problem337.Vaughan
|
| 18 |
+
|
| 19 |
+
/-- The part of an arithmetic function supported on integers at most `U`. -/
|
| 20 |
+
def shortPart {R : Type*} [Zero R] (U : ℕ) (f : ArithmeticFunction R) :
|
| 21 |
+
ArithmeticFunction R :=
|
| 22 |
+
⟨fun n => if n ≤ U then f n else 0, by simp⟩
|
| 23 |
+
|
| 24 |
+
/-- The complementary part, supported on integers strictly above `U`. -/
|
| 25 |
+
def longPart {R : Type*} [Zero R] (U : ℕ) (f : ArithmeticFunction R) :
|
| 26 |
+
ArithmeticFunction R :=
|
| 27 |
+
⟨fun n => if U < n then f n else 0, by simp⟩
|
| 28 |
+
|
| 29 |
+
@[simp] lemma shortPart_apply {R : Type*} [Zero R]
|
| 30 |
+
(U : ℕ) (f : ArithmeticFunction R) (n : ℕ) :
|
| 31 |
+
shortPart U f n = if n ≤ U then f n else 0 := rfl
|
| 32 |
+
|
| 33 |
+
@[simp] lemma longPart_apply {R : Type*} [Zero R]
|
| 34 |
+
(U : ℕ) (f : ArithmeticFunction R) (n : ℕ) :
|
| 35 |
+
longPart U f n = if U < n then f n else 0 := rfl
|
| 36 |
+
|
| 37 |
+
lemma shortPart_add_longPart {R : Type*} [AddMonoid R]
|
| 38 |
+
(U : ℕ) (f : ArithmeticFunction R) : shortPart U f + longPart U f = f := by
|
| 39 |
+
ext n
|
| 40 |
+
by_cases hn : n ≤ U <;> simp [hn, Nat.not_lt.mpr, Nat.lt_of_not_ge]
|
| 41 |
+
|
| 42 |
+
lemma longPart_eq_sub_shortPart {R : Type*} [AddCommGroup R]
|
| 43 |
+
(U : ℕ) (f : ArithmeticFunction R) : longPart U f = f - shortPart U f := by
|
| 44 |
+
have h := shortPart_add_longPart U f
|
| 45 |
+
exact eq_sub_iff_add_eq.mpr (by simpa only [add_comm] using h)
|
| 46 |
+
|
| 47 |
+
/-- Vaughan's four-term identity, valid also at zero and for zero cutoffs.
|
| 48 |
+
The first convolution is Type I; the second has a coefficient supported on
|
| 49 |
+
`[1,U*V]`; the last is the long-long Type II convolution. -/
|
| 50 |
+
theorem vonMangoldt_identity (U V : ℕ) :
|
| 51 |
+
ArithmeticFunction.vonMangoldt =
|
| 52 |
+
shortPart V ArithmeticFunction.vonMangoldt +
|
| 53 |
+
shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log -
|
| 54 |
+
(shortPart U (μ : ArithmeticFunction ℝ) *
|
| 55 |
+
shortPart V ArithmeticFunction.vonMangoldt) * (ζ : ArithmeticFunction ℝ) +
|
| 56 |
+
(longPart U (μ : ArithmeticFunction ℝ) * (ζ : ArithmeticFunction ℝ)) *
|
| 57 |
+
longPart V ArithmeticFunction.vonMangoldt := by
|
| 58 |
+
rw [longPart_eq_sub_shortPart, longPart_eq_sub_shortPart]
|
| 59 |
+
have hμ : (μ : ArithmeticFunction ℝ) * (ζ : ArithmeticFunction ℝ) = 1 :=
|
| 60 |
+
ArithmeticFunction.coe_moebius_mul_coe_zeta
|
| 61 |
+
have hΛ : (ζ : ArithmeticFunction ℝ) * ArithmeticFunction.vonMangoldt =
|
| 62 |
+
ArithmeticFunction.log := ArithmeticFunction.zeta_mul_vonMangoldt
|
| 63 |
+
calc
|
| 64 |
+
ArithmeticFunction.vonMangoldt =
|
| 65 |
+
((μ : ArithmeticFunction ℝ) * (ζ : ArithmeticFunction ℝ)) *
|
| 66 |
+
ArithmeticFunction.vonMangoldt := by rw [hμ, one_mul]
|
| 67 |
+
_ = _ := by
|
| 68 |
+
rw [← hΛ]
|
| 69 |
+
have hshort : ((μ : ArithmeticFunction ℝ) * (ζ : ArithmeticFunction ℝ)) *
|
| 70 |
+
shortPart V ArithmeticFunction.vonMangoldt =
|
| 71 |
+
shortPart V ArithmeticFunction.vonMangoldt := by rw [hμ, one_mul]
|
| 72 |
+
linear_combination hshort
|
| 73 |
+
|
| 74 |
+
/-- A convolution of two short parts has the expected product support. -/
|
| 75 |
+
lemma shortPart_mul_eq_zero_of_lt {R : Type*} [Semiring R]
|
| 76 |
+
(U V n : ℕ) (f g : ArithmeticFunction R) (hn : U * V < n) :
|
| 77 |
+
(shortPart U f * shortPart V g) n = 0 := by
|
| 78 |
+
rw [ArithmeticFunction.mul_apply]
|
| 79 |
+
apply Finset.sum_eq_zero
|
| 80 |
+
intro ab hab
|
| 81 |
+
have habn := (Nat.mem_divisorsAntidiagonal.mp hab).1
|
| 82 |
+
by_cases ha : ab.1 ≤ U
|
| 83 |
+
· have hb : ¬ ab.2 ≤ V := by
|
| 84 |
+
intro hb
|
| 85 |
+
have hm := Nat.mul_le_mul ha hb
|
| 86 |
+
rw [habn] at hm
|
| 87 |
+
omega
|
| 88 |
+
simp [ha, hb]
|
| 89 |
+
· simp [ha]
|
| 90 |
+
|
| 91 |
+
/-- Convolving a long part cannot create a smaller positive index. -/
|
| 92 |
+
lemma longPart_mul_eq_zero_of_le {R : Type*} [Semiring R]
|
| 93 |
+
(U n : ℕ) (f g : ArithmeticFunction R) (hn : n ≤ U) :
|
| 94 |
+
(longPart U f * g) n = 0 := by
|
| 95 |
+
rw [ArithmeticFunction.mul_apply]
|
| 96 |
+
apply Finset.sum_eq_zero
|
| 97 |
+
intro ab hab
|
| 98 |
+
obtain ⟨hprod, hn0⟩ := Nat.mem_divisorsAntidiagonal.mp hab
|
| 99 |
+
have ha : ab.1 ≤ n := Nat.le_of_dvd (Nat.pos_of_ne_zero hn0) ⟨ab.2, hprod.symm⟩
|
| 100 |
+
have hnot : ¬ U < ab.1 := by omega
|
| 101 |
+
simp [hnot]
|
| 102 |
+
|
| 103 |
+
lemma abs_shortPart_le (U : ℕ) (f : ArithmeticFunction ℝ) (n : ℕ) :
|
| 104 |
+
|shortPart U f n| ≤ |f n| := by
|
| 105 |
+
by_cases hn : n ≤ U <;> simp [hn, abs_nonneg]
|
| 106 |
+
|
| 107 |
+
lemma abs_longPart_le (U : ℕ) (f : ArithmeticFunction ℝ) (n : ℕ) :
|
| 108 |
+
|longPart U f n| ≤ |f n| := by
|
| 109 |
+
by_cases hn : U < n <;> simp [hn, abs_nonneg]
|
| 110 |
+
|
| 111 |
+
lemma abs_real_moebius_le_one (n : ℕ) :
|
| 112 |
+
|(μ : ArithmeticFunction ℝ) n| ≤ 1 := by
|
| 113 |
+
change |((ArithmeticFunction.moebius n : ℤ) : ℝ)| ≤ 1
|
| 114 |
+
exact_mod_cast (ArithmeticFunction.abs_moebius_le_one (n := n))
|
| 115 |
+
|
| 116 |
+
/-- The short convolution coefficient appearing in Type I sums. -/
|
| 117 |
+
def typeICoefficient (U V : ℕ) : ArithmeticFunction ℝ :=
|
| 118 |
+
shortPart U (μ : ArithmeticFunction ℝ) * shortPart V ArithmeticFunction.vonMangoldt
|
| 119 |
+
|
| 120 |
+
/-- The coefficient appearing in the long-long Type II sum. -/
|
| 121 |
+
def typeIICoefficient (U : ℕ) : ArithmeticFunction ℝ :=
|
| 122 |
+
longPart U (μ : ArithmeticFunction ℝ) * (ζ : ArithmeticFunction ℝ)
|
| 123 |
+
|
| 124 |
+
lemma typeICoefficient_eq_zero (U V n : ℕ) (hn : U * V < n) :
|
| 125 |
+
typeICoefficient U V n = 0 := shortPart_mul_eq_zero_of_lt U V n _ _ hn
|
| 126 |
+
|
| 127 |
+
lemma typeIICoefficient_eq_zero (U n : ℕ) (hn : n ≤ U) :
|
| 128 |
+
typeIICoefficient U n = 0 := longPart_mul_eq_zero_of_le U n _ _ hn
|
| 129 |
+
|
| 130 |
+
/-- The Type I coefficient costs only a logarithm, not a divisor function. -/
|
| 131 |
+
lemma abs_typeICoefficient_le_log (U V n : ℕ) :
|
| 132 |
+
|typeICoefficient U V n| ≤ Real.log n := by
|
| 133 |
+
unfold typeICoefficient
|
| 134 |
+
rw [ArithmeticFunction.mul_apply]
|
| 135 |
+
calc
|
| 136 |
+
_ ≤ ∑ ab ∈ n.divisorsAntidiagonal,
|
| 137 |
+
|shortPart U (μ : ArithmeticFunction ℝ) ab.1 *
|
| 138 |
+
shortPart V ArithmeticFunction.vonMangoldt ab.2| :=
|
| 139 |
+
Finset.abs_sum_le_sum_abs _ _
|
| 140 |
+
_ ≤ ∑ ab ∈ n.divisorsAntidiagonal, ArithmeticFunction.vonMangoldt ab.2 := by
|
| 141 |
+
apply Finset.sum_le_sum
|
| 142 |
+
intro ab hab
|
| 143 |
+
rw [abs_mul]
|
| 144 |
+
have hμ := (abs_shortPart_le U (μ : ArithmeticFunction ℝ) ab.1).trans
|
| 145 |
+
(abs_real_moebius_le_one ab.1)
|
| 146 |
+
have hΛ := abs_shortPart_le V ArithmeticFunction.vonMangoldt ab.2
|
| 147 |
+
rw [abs_of_nonneg ArithmeticFunction.vonMangoldt_nonneg] at hΛ
|
| 148 |
+
calc
|
| 149 |
+
_ ≤ 1 * ArithmeticFunction.vonMangoldt ab.2 :=
|
| 150 |
+
mul_le_mul hμ hΛ (abs_nonneg _) zero_le_one
|
| 151 |
+
_ = _ := one_mul _
|
| 152 |
+
_ = Real.log n := by
|
| 153 |
+
rw [Nat.sum_divisorsAntidiagonal' (fun _ b => ArithmeticFunction.vonMangoldt b)]
|
| 154 |
+
exact ArithmeticFunction.vonMangoldt_sum
|
| 155 |
+
|
| 156 |
+
lemma typeIICoefficient_apply (U n : ℕ) :
|
| 157 |
+
typeIICoefficient U n =
|
| 158 |
+
∑ d ∈ n.divisors.filter (U < ·), (μ : ArithmeticFunction ℝ) d := by
|
| 159 |
+
rw [typeIICoefficient, ArithmeticFunction.coe_mul_zeta_apply]
|
| 160 |
+
simp only [longPart_apply, Finset.sum_filter]
|
| 161 |
+
|
| 162 |
+
/-- A uniform elementary coefficient bound for the Type II sum. -/
|
| 163 |
+
lemma abs_typeIICoefficient_le_divisors_card (U n : ℕ) :
|
| 164 |
+
|typeIICoefficient U n| ≤ (n.divisors.card : ℝ) := by
|
| 165 |
+
rw [typeIICoefficient, ArithmeticFunction.coe_mul_zeta_apply]
|
| 166 |
+
calc
|
| 167 |
+
_ ≤ ∑ d ∈ n.divisors, |longPart U (μ : ArithmeticFunction ℝ) d| :=
|
| 168 |
+
Finset.abs_sum_le_sum_abs _ _
|
| 169 |
+
_ ≤ ∑ _d ∈ n.divisors, (1 : ℝ) := by
|
| 170 |
+
apply Finset.sum_le_sum
|
| 171 |
+
intro d hd
|
| 172 |
+
exact (abs_longPart_le U (μ : ArithmeticFunction ℝ) d).trans
|
| 173 |
+
(abs_real_moebius_le_one d)
|
| 174 |
+
_ = _ := by simp
|
| 175 |
+
|
| 176 |
+
end Problem337.Vaughan
|
| 177 |
+
|
| 178 |
+
end
|
| 179 |
+
|
| 180 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanNearRational.lean
ADDED
|
@@ -0,0 +1,269 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanBilinear
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.GeometricCharacterBound
|
| 3 |
+
import OAI.NumberTheory.EgyptianFractions.RationalPhaseSpacing
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators
|
| 8 |
+
|
| 9 |
+
namespace Problem337.VaughanBilinear
|
| 10 |
+
|
| 11 |
+
theorem phase_int (n : ℤ) : phase n = 1 := by
|
| 12 |
+
rw [phase, Real.fourierChar_apply]
|
| 13 |
+
have he : (↑(2 * Real.pi * (n : ℝ)) : ℂ) * Complex.I =
|
| 14 |
+
(n : ℂ) * (2 * (Real.pi : ℂ) * Complex.I) := by
|
| 15 |
+
push_cast
|
| 16 |
+
ring
|
| 17 |
+
rw [he, Complex.exp_int_mul_two_pi_mul_I]
|
| 18 |
+
|
| 19 |
+
theorem phase_fract (x : ℝ) : phase (Int.fract x) = phase x := by
|
| 20 |
+
rw [Int.fract, ← phase_mul_conj, phase_int]
|
| 21 |
+
simp
|
| 22 |
+
|
| 23 |
+
theorem phase_eq_geometric_phase (x : ℝ) :
|
| 24 |
+
phase x = Complex.exp (Complex.I * (2 * Real.pi * x : ℝ)) := by
|
| 25 |
+
rw [phase, Real.fourierChar_apply]
|
| 26 |
+
congr 1
|
| 27 |
+
ring
|
| 28 |
+
|
| 29 |
+
/-- The usual truncated reciprocal-distance majorant for a real geometric
|
| 30 |
+
sum. Integer phases use the length cap, never a spurious zero reciprocal. -/
|
| 31 |
+
theorem phase_sum_le_truncatedInv (x : ℝ) (M : ℕ) :
|
| 32 |
+
‖∑ m ∈ Finset.range M, phase (x * m)‖ ≤
|
| 33 |
+
RationalPhaseSpacing.truncatedInv M (RationalPhaseSpacing.intDistance x) := by
|
| 34 |
+
have hcap : ‖∑ m ∈ Finset.range M, phase (x * m)‖ ≤ (M : ℝ) := by
|
| 35 |
+
calc
|
| 36 |
+
_ ≤ ∑ m ∈ Finset.range M, ‖phase (x * m)‖ := norm_sum_le _ _
|
| 37 |
+
_ = _ := by simp
|
| 38 |
+
by_cases hx : RationalPhaseSpacing.intDistance x = 0
|
| 39 |
+
· simpa only [RationalPhaseSpacing.truncatedInv, ite_eq_left hx] using hcap
|
| 40 |
+
have hpos : 0 < RationalPhaseSpacing.intDistance x :=
|
| 41 |
+
lt_of_le_of_ne (RationalPhaseSpacing.intDistance_nonneg x) (Ne.symm hx)
|
| 42 |
+
rw [RationalPhaseSpacing.truncatedInv, ite_eq_right hx]
|
| 43 |
+
refine le_min hcap ?_
|
| 44 |
+
have hlow : RationalPhaseSpacing.intDistance x ≤ Int.fract x := min_le_left _ _
|
| 45 |
+
have hhigh : Int.fract x ≤ 1 - RationalPhaseSpacing.intDistance x := by
|
| 46 |
+
have h := min_le_right (Int.fract x) (1 - Int.fract x)
|
| 47 |
+
change RationalPhaseSpacing.intDistance x ≤ 1 - Int.fract x at h
|
| 48 |
+
linarith
|
| 49 |
+
have hgeom := norm_geometric_phase_sum_le_middle hpos hlow hhigh M
|
| 50 |
+
have heq : (∑ m ∈ Finset.range M, phase (x * m)) =
|
| 51 |
+
∑ m ∈ Finset.range M,
|
| 52 |
+
Complex.exp (Complex.I * (2 * Real.pi * Int.fract x : ℝ)) ^ m := by
|
| 53 |
+
apply Finset.sum_congr rfl
|
| 54 |
+
intro m hm
|
| 55 |
+
rw [phase_nat_mul, ← phase_fract x, phase_eq_geometric_phase]
|
| 56 |
+
rw [heq]
|
| 57 |
+
exact hgeom.trans (one_div_le_one_div_of_le hpos (by linarith))
|
| 58 |
+
|
| 59 |
+
/-- Rational approximation provides an actual Type-II correlation row bound
|
| 60 |
+
on every short block of integer columns, uniformly in the chosen row. -/
|
| 61 |
+
theorem near_rational_correlation_row_le
|
| 62 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 63 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 64 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 65 |
+
(M : ℕ) (t : Finset ℤ)
|
| 66 |
+
(hspan : ∀ n ∈ t, ∀ k ∈ t, 2 * |n - k| ≤ (q : ℤ)) (n : ℤ) :
|
| 67 |
+
(∑ k ∈ t, ‖∑ m ∈ Finset.range M,
|
| 68 |
+
phase (θ * m * n) * (starRingEnd ℂ) (phase (θ * m * k))‖) ≤
|
| 69 |
+
2 * (M : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ))) := by
|
| 70 |
+
classical
|
| 71 |
+
let A := t.image (fun k => n - k)
|
| 72 |
+
have hA : ∀ j ∈ A, ∀ l ∈ A, 2 * |j - l| ≤ (q : ℤ) := by
|
| 73 |
+
intro j hj l hl
|
| 74 |
+
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hj
|
| 75 |
+
obtain ⟨i, hi, rfl⟩ := Finset.mem_image.mp hl
|
| 76 |
+
have heq : (n - k) - (n - i) = i - k := by omega
|
| 77 |
+
rw [heq]
|
| 78 |
+
exact hspan i hi k hk
|
| 79 |
+
have hsum := RationalPhaseSpacing.sum_truncatedInv_intDistance_le
|
| 80 |
+
θ a q hq hcop happrox A hA (M : ℝ) (Nat.cast_nonneg M)
|
| 81 |
+
have hcorr (k : ℤ) : (∑ m ∈ Finset.range M,
|
| 82 |
+
phase (θ * m * n) * (starRingEnd ℂ) (phase (θ * m * k))) =
|
| 83 |
+
∑ m ∈ Finset.range M, phase ((θ * ((n - k : ℤ) : ℝ)) * m) := by
|
| 84 |
+
apply Finset.sum_congr rfl
|
| 85 |
+
intro m hm
|
| 86 |
+
rw [phase_mul_conj]
|
| 87 |
+
congr 1
|
| 88 |
+
push_cast
|
| 89 |
+
ring
|
| 90 |
+
calc
|
| 91 |
+
_ ≤ ∑ k ∈ t, RationalPhaseSpacing.truncatedInv M
|
| 92 |
+
(RationalPhaseSpacing.intDistance (θ * ((n - k : ℤ) : ℝ))) := by
|
| 93 |
+
apply Finset.sum_le_sum
|
| 94 |
+
intro k hk
|
| 95 |
+
rw [hcorr]
|
| 96 |
+
exact phase_sum_le_truncatedInv _ M
|
| 97 |
+
_ = ∑ j ∈ A, RationalPhaseSpacing.truncatedInv M
|
| 98 |
+
(RationalPhaseSpacing.intDistance (θ * j)) := by
|
| 99 |
+
rw [Finset.sum_image]
|
| 100 |
+
intro k hk i hi heq
|
| 101 |
+
dsimp at heq
|
| 102 |
+
omega
|
| 103 |
+
_ ≤ _ := hsum
|
| 104 |
+
|
| 105 |
+
/-- A proved near-rational Type-II estimate with both coefficient energies.
|
| 106 |
+
The only number-theoretic hypothesis is the stated reduced approximation;
|
| 107 |
+
all correlation/spacing/cancellation estimates are discharged. -/
|
| 108 |
+
theorem near_rational_bilinear_sq_le
|
| 109 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 110 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 111 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 112 |
+
(M : ℕ) (t : Finset ℤ)
|
| 113 |
+
(hspan : ∀ n ∈ t, ∀ k ∈ t, 2 * |n - k| ≤ (q : ℤ))
|
| 114 |
+
(c : ℕ → ℂ) (b : ℤ → ℂ) :
|
| 115 |
+
‖∑ m ∈ Finset.range M, c m * ∑ n ∈ t, b n * phase (θ * m * n)‖ ^ 2 ≤
|
| 116 |
+
(∑ m ∈ Finset.range M, ‖c m‖ ^ 2) *
|
| 117 |
+
(2 * (M : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ)))) *
|
| 118 |
+
(∑ n ∈ t, ‖b n‖ ^ 2) := by
|
| 119 |
+
apply norm_bilinear_sq_le_energy
|
| 120 |
+
intro n hn
|
| 121 |
+
exact near_rational_correlation_row_le θ a q hq hcop happrox M t hspan n
|
| 122 |
+
|
| 123 |
+
/-- Actual near-rational row cancellation on an arbitrary integer interval,
|
| 124 |
+
also valid for any subset of that interval. -/
|
| 125 |
+
theorem near_rational_interval_correlation_row_le
|
| 126 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 127 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 128 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 129 |
+
(M : ℕ) (t : Finset ℤ) (L : ℤ) (N : ℕ)
|
| 130 |
+
(ht : t ⊆ Finset.Ico L (L + N)) (n : ℤ) :
|
| 131 |
+
(∑ k ∈ t, ‖∑ m ∈ Finset.range M,
|
| 132 |
+
phase (θ * m * n) * (starRingEnd ℂ) (phase (θ * m * k))‖) ≤
|
| 133 |
+
(2 * (N : ℝ) / q + 1) *
|
| 134 |
+
(2 * (M : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ)))) := by
|
| 135 |
+
classical
|
| 136 |
+
let A := t.image (fun k => n - k)
|
| 137 |
+
let L' : ℤ := n - L - N + 1
|
| 138 |
+
have hA : A ⊆ Finset.Ico L' (L' + N) := by
|
| 139 |
+
intro j hj
|
| 140 |
+
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hj
|
| 141 |
+
have hk' := Finset.mem_Ico.mp (ht hk)
|
| 142 |
+
apply Finset.mem_Ico.mpr
|
| 143 |
+
dsimp [L']
|
| 144 |
+
omega
|
| 145 |
+
calc
|
| 146 |
+
_ ≤ ∑ k ∈ t, RationalPhaseSpacing.truncatedInv M
|
| 147 |
+
(RationalPhaseSpacing.intDistance (θ * ((n - k : ℤ) : ℝ))) := by
|
| 148 |
+
apply Finset.sum_le_sum
|
| 149 |
+
intro k hk
|
| 150 |
+
have heq : (∑ m ∈ Finset.range M,
|
| 151 |
+
phase (θ * m * n) * (starRingEnd ℂ) (phase (θ * m * k))) =
|
| 152 |
+
∑ m ∈ Finset.range M, phase ((θ * ((n - k : ℤ) : ℝ)) * m) := by
|
| 153 |
+
apply Finset.sum_congr rfl
|
| 154 |
+
intro m hm
|
| 155 |
+
rw [phase_mul_conj]
|
| 156 |
+
congr 1
|
| 157 |
+
push_cast
|
| 158 |
+
ring
|
| 159 |
+
rw [heq]
|
| 160 |
+
exact phase_sum_le_truncatedInv _ M
|
| 161 |
+
_ = ∑ j ∈ A, RationalPhaseSpacing.truncatedInv M
|
| 162 |
+
(RationalPhaseSpacing.intDistance (θ * j)) := by
|
| 163 |
+
rw [Finset.sum_image]
|
| 164 |
+
intro k hk i hi heq
|
| 165 |
+
dsimp at heq
|
| 166 |
+
omega
|
| 167 |
+
_ ≤ ∑ j ∈ Finset.Ico L' (L' + N), RationalPhaseSpacing.truncatedInv M
|
| 168 |
+
(RationalPhaseSpacing.intDistance (θ * j)) :=
|
| 169 |
+
Finset.sum_le_sum_of_subset_of_nonneg hA (fun _ _ _ =>
|
| 170 |
+
RationalPhaseSpacing.truncatedInv_nonneg (Nat.cast_nonneg M)
|
| 171 |
+
(RationalPhaseSpacing.intDistance_nonneg _))
|
| 172 |
+
_ ≤ _ := RationalPhaseSpacing.sum_truncatedInv_intDistance_interval_le
|
| 173 |
+
θ a q hq hcop happrox L' N M (Nat.cast_nonneg M)
|
| 174 |
+
|
| 175 |
+
/-- Full rectangular Type-II estimate from a reduced rational approximation.
|
| 176 |
+
No spacing, correlation, or equidistribution estimate remains as a premise. -/
|
| 177 |
+
theorem near_rational_interval_bilinear_sq_le
|
| 178 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 179 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 180 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 181 |
+
(M : ℕ) (t : Finset ℤ) (L : ℤ) (N : ℕ)
|
| 182 |
+
(ht : t ⊆ Finset.Ico L (L + N)) (c : ℕ → ℂ) (b : ℤ → ℂ) :
|
| 183 |
+
‖∑ m ∈ Finset.range M, c m * ∑ n ∈ t, b n * phase (θ * m * n)‖ ^ 2 ≤
|
| 184 |
+
(∑ m ∈ Finset.range M, ‖c m‖ ^ 2) *
|
| 185 |
+
((2 * (N : ℝ) / q + 1) *
|
| 186 |
+
(2 * (M : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ))))) *
|
| 187 |
+
(∑ n ∈ t, ‖b n‖ ^ 2) := by
|
| 188 |
+
apply norm_bilinear_sq_le_energy
|
| 189 |
+
intro n hn
|
| 190 |
+
exact near_rational_interval_correlation_row_le θ a q hq hcop happrox M t L N ht n
|
| 191 |
+
|
| 192 |
+
/-- The explicit geometric majorant itself is bounded by the truncated
|
| 193 |
+
reciprocal distance. This also allows variable inner interval lengths. -/
|
| 194 |
+
theorem geometricBound_le_truncatedInv (M : ℕ) (x : ℝ) :
|
| 195 |
+
geometricBound M x ≤
|
| 196 |
+
RationalPhaseSpacing.truncatedInv M (RationalPhaseSpacing.intDistance x) := by
|
| 197 |
+
by_cases hd : RationalPhaseSpacing.intDistance x = 0
|
| 198 |
+
· rw [RationalPhaseSpacing.truncatedInv, ite_eq_left hd]
|
| 199 |
+
unfold geometricBound
|
| 200 |
+
split_ifs
|
| 201 |
+
· exact le_rfl
|
| 202 |
+
· exact min_le_left _ _
|
| 203 |
+
have hdpos : 0 < RationalPhaseSpacing.intDistance x :=
|
| 204 |
+
lt_of_le_of_ne (RationalPhaseSpacing.intDistance_nonneg x) (Ne.symm hd)
|
| 205 |
+
have hlow : RationalPhaseSpacing.intDistance x ≤ Int.fract x := min_le_left _ _
|
| 206 |
+
have hhigh : Int.fract x ≤ 1 - RationalPhaseSpacing.intDistance x := by
|
| 207 |
+
have h := min_le_right (Int.fract x) (1 - Int.fract x)
|
| 208 |
+
change RationalPhaseSpacing.intDistance x ≤ 1 - Int.fract x at h
|
| 209 |
+
linarith
|
| 210 |
+
have hs := sin_pi_mul_lower_on_middle hdpos hlow hhigh
|
| 211 |
+
have hchord : 2 * RationalPhaseSpacing.intDistance x ≤ ‖1 - phase x‖ := by
|
| 212 |
+
rw [norm_sub_rev, ← phase_fract x, phase_eq_geometric_phase, norm_exp_phase_sub_one]
|
| 213 |
+
have habs := le_abs_self (Real.sin (Real.pi * Int.fract x))
|
| 214 |
+
nlinarith
|
| 215 |
+
have hnorm : 0 < ‖1 - phase x‖ := by linarith
|
| 216 |
+
have hx : phase x ≠ 1 := by
|
| 217 |
+
intro hx
|
| 218 |
+
simp [hx] at hnorm
|
| 219 |
+
rw [geometricBound, ite_eq_right hx, RationalPhaseSpacing.truncatedInv, ite_eq_right hd]
|
| 220 |
+
apply min_le_min_left
|
| 221 |
+
apply (div_le_div_iff₀ hnorm hdpos).mpr
|
| 222 |
+
simpa using hchord
|
| 223 |
+
|
| 224 |
+
/-- A uniform harmonic row bound for indexed integer frequencies. The map
|
| 225 |
+
into the interval must be injective, but need not exhaust the interval. -/
|
| 226 |
+
theorem sum_geometricBound_difference_le {β : Type*}
|
| 227 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 228 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 229 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 230 |
+
(M : ℕ) (t : Finset β) (f : β → ℤ) (L : ℤ) (N : ℕ)
|
| 231 |
+
(hf : ∀ k ∈ t, f k ∈ Finset.Ico L (L + N))
|
| 232 |
+
(hinj : Set.InjOn f t) (n : ℤ) :
|
| 233 |
+
(∑ k ∈ t, geometricBound M (θ * ((n - f k : ℤ) : ℝ))) ≤
|
| 234 |
+
(2 * (N : ℝ) / q + 1) *
|
| 235 |
+
(2 * (M : ℝ) + 4 * (q : ℝ) * (1 + Real.log (2 * (q : ℝ)))) := by
|
| 236 |
+
classical
|
| 237 |
+
let A := t.image (fun k => n - f k)
|
| 238 |
+
let L' : ℤ := n - L - N + 1
|
| 239 |
+
have hA : A ⊆ Finset.Ico L' (L' + N) := by
|
| 240 |
+
intro j hj
|
| 241 |
+
obtain ⟨k, hk, rfl⟩ := Finset.mem_image.mp hj
|
| 242 |
+
have hk' := Finset.mem_Ico.mp (hf k hk)
|
| 243 |
+
apply Finset.mem_Ico.mpr
|
| 244 |
+
dsimp [L']
|
| 245 |
+
omega
|
| 246 |
+
calc
|
| 247 |
+
_ ≤ ∑ k ∈ t, RationalPhaseSpacing.truncatedInv M
|
| 248 |
+
(RationalPhaseSpacing.intDistance (θ * ((n - f k : ℤ) : ℝ))) :=
|
| 249 |
+
Finset.sum_le_sum (fun k _ => geometricBound_le_truncatedInv M _)
|
| 250 |
+
_ = ∑ j ∈ A, RationalPhaseSpacing.truncatedInv M
|
| 251 |
+
(RationalPhaseSpacing.intDistance (θ * j)) := by
|
| 252 |
+
rw [Finset.sum_image]
|
| 253 |
+
intro k hk i hi heq
|
| 254 |
+
apply hinj hk hi
|
| 255 |
+
dsimp at heq
|
| 256 |
+
omega
|
| 257 |
+
_ ≤ ∑ j ∈ Finset.Ico L' (L' + N), RationalPhaseSpacing.truncatedInv M
|
| 258 |
+
(RationalPhaseSpacing.intDistance (θ * j)) :=
|
| 259 |
+
Finset.sum_le_sum_of_subset_of_nonneg hA (fun _ _ _ =>
|
| 260 |
+
RationalPhaseSpacing.truncatedInv_nonneg (Nat.cast_nonneg M)
|
| 261 |
+
(RationalPhaseSpacing.intDistance_nonneg _))
|
| 262 |
+
_ ≤ _ := RationalPhaseSpacing.sum_truncatedInv_intDistance_interval_le
|
| 263 |
+
θ a q hq hcop happrox L' N M (Nat.cast_nonneg M)
|
| 264 |
+
|
| 265 |
+
end Problem337.VaughanBilinear
|
| 266 |
+
|
| 267 |
+
end
|
| 268 |
+
|
| 269 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanOptimized.lean
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanDyadicUniform
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanCutoff
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators ArithmeticFunction
|
| 7 |
+
|
| 8 |
+
namespace Problem337.Vaughan
|
| 9 |
+
|
| 10 |
+
/-- The standard three-term envelope for a reduced rational approximation. -/
|
| 11 |
+
def approximationEnvelope (X q : ℝ) : ℝ :=
|
| 12 |
+
X / Real.sqrt q + X ^ (4 / 5 : ℝ) + Real.sqrt (X * q)
|
| 13 |
+
|
| 14 |
+
lemma approximationEnvelope_nonneg (X q : ℝ) (hX : 0 ≤ X) :
|
| 15 |
+
0 ≤ approximationEnvelope X q := by
|
| 16 |
+
unfold approximationEnvelope
|
| 17 |
+
positivity
|
| 18 |
+
|
| 19 |
+
lemma dyadic_log_le_three_scale (N : ℕ) :
|
| 20 |
+
1 + Real.log N / Real.log 2 ≤ 3 * typeIILogScale N := by
|
| 21 |
+
have hlog := Real.log_natCast_nonneg N
|
| 22 |
+
have htwo : (1 / 2 : ℝ) ≤ Real.log 2 := by linarith [Real.log_two_gt_d9]
|
| 23 |
+
have hdiv : Real.log N / Real.log 2 ≤ 2 * Real.log N := by
|
| 24 |
+
apply (div_le_iff₀ (by linarith : 0 < Real.log 2)).mpr
|
| 25 |
+
nlinarith [mul_le_mul_of_nonneg_right htwo hlog]
|
| 26 |
+
have hN := log_nat_le_typeIILogScale N N le_rfl
|
| 27 |
+
have hH := one_le_typeIILogScale N
|
| 28 |
+
linarith
|
| 29 |
+
|
| 30 |
+
/-- Balanced cutoffs turn each actual Type II block into the standard envelope. -/
|
| 31 |
+
theorem optimized_typeIIBlock_bound
|
| 32 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 33 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 34 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 35 |
+
(N j : ℕ) (hqN : q ≤ N)
|
| 36 |
+
(hpow : 2 ≤ (N : ℝ) ^ (2 / 5 : ℝ)) :
|
| 37 |
+
‖typeIIBlock N (optimizedCutoff N) (optimizedCutoff N) j
|
| 38 |
+
(fun k => VaughanBilinear.phase (θ * k))‖ ≤
|
| 39 |
+
18 * (typeIILogScale N) ^ 3 * approximationEnvelope N q := by
|
| 40 |
+
have hN : (1 : ℝ) ≤ N := by exact_mod_cast hq.trans_le hqN
|
| 41 |
+
have hU := optimizedCutoff_pos N hpow
|
| 42 |
+
have hs := typeIIBlock_sq_le_uniform θ a q hq hcop happrox N
|
| 43 |
+
(optimizedCutoff N) (optimizedCutoff N) j hqN hU hU
|
| 44 |
+
have hb := optimizedCutoff_squared_budget N q 32
|
| 45 |
+
‖typeIIBlock N (optimizedCutoff N) (optimizedCutoff N) j
|
| 46 |
+
(fun k => VaughanBilinear.phase (θ * k))‖
|
| 47 |
+
hN (by exact_mod_cast hq) (by norm_num) hpow hs
|
| 48 |
+
have hsqrt : Real.sqrt (32 : ℝ) ≤ 6 :=
|
| 49 |
+
(Real.sqrt_le_left (by norm_num)).mpr (by norm_num)
|
| 50 |
+
change _ ≤ 3 * Real.sqrt 32 * (typeIILogScale N) ^ 3 * approximationEnvelope N q at hb
|
| 51 |
+
refine hb.trans ?_
|
| 52 |
+
have hH : 0 ≤ typeIILogScale N := zero_le_one.trans (one_le_typeIILogScale N)
|
| 53 |
+
have hE := approximationEnvelope_nonneg N q (Nat.cast_nonneg N)
|
| 54 |
+
gcongr
|
| 55 |
+
norm_num at *
|
| 56 |
+
linarith
|
| 57 |
+
|
| 58 |
+
/-- Summing the genuine dyadic blocks costs one further logarithm, not a
|
| 59 |
+
power of the summation length. All cancellation hypotheses are discharged. -/
|
| 60 |
+
theorem optimized_typeII_bound
|
| 61 |
+
(θ : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 62 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 63 |
+
(happrox : |θ - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 64 |
+
(N : ℕ) (hqN : q ≤ N)
|
| 65 |
+
(hpow : 2 ≤ (N : ℝ) ^ (2 / 5 : ℝ)) :
|
| 66 |
+
‖weightedSum (Finset.Ioc 0 N) (fun k => VaughanBilinear.phase (θ * k))
|
| 67 |
+
(typeIICoefficient (optimizedCutoff N) * longPart (optimizedCutoff N) Λ)‖ ≤
|
| 68 |
+
54 * (typeIILogScale N) ^ 4 * approximationEnvelope N q := by
|
| 69 |
+
have hH : 0 ≤ typeIILogScale N := zero_le_one.trans (one_le_typeIILogScale N)
|
| 70 |
+
have hE := approximationEnvelope_nonneg N q (Nat.cast_nonneg N)
|
| 71 |
+
have hb := norm_typeII_le_dyadic_log_budget N (optimizedCutoff N) (optimizedCutoff N)
|
| 72 |
+
(fun k => VaughanBilinear.phase (θ * k))
|
| 73 |
+
(18 * (typeIILogScale N) ^ 3 * approximationEnvelope N q) (by positivity)
|
| 74 |
+
(fun j _ => optimized_typeIIBlock_bound θ a q hq hcop happrox N j hqN hpow)
|
| 75 |
+
refine hb.trans ?_
|
| 76 |
+
calc
|
| 77 |
+
_ ≤ (3 * typeIILogScale N) *
|
| 78 |
+
(18 * (typeIILogScale N) ^ 3 * approximationEnvelope N q) :=
|
| 79 |
+
mul_le_mul_of_nonneg_right (dyadic_log_le_three_scale N) (by positivity)
|
| 80 |
+
_ = _ := by ring
|
| 81 |
+
|
| 82 |
+
end Problem337.Vaughan
|
| 83 |
+
|
| 84 |
+
end
|
| 85 |
+
|
| 86 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanRealTypeIHyperbolic.lean
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanTypeI
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.RealTypeI
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
/-!
|
| 6 |
+
# Actual near-rational estimates for the two Vaughan Type I terms
|
| 7 |
+
|
| 8 |
+
The prefix adapter uses the sharper canonical harmonic hyperbola bound
|
| 9 |
+
for its scalar aggregation.
|
| 10 |
+
The variable hyperbolic lengths are retained throughout. In particular the
|
| 11 |
+
right hand side has size `N / q + A + q`, up to logarithmic factors, rather
|
| 12 |
+
than the much larger fixed-cap estimate obtained by replacing every `N / d`
|
| 13 |
+
with `N`.
|
| 14 |
+
-/
|
| 15 |
+
|
| 16 |
+
noncomputable section
|
| 17 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 18 |
+
|
| 19 |
+
namespace Problem337.VaughanHyperbolic
|
| 20 |
+
|
| 21 |
+
open Vaughan
|
| 22 |
+
|
| 23 |
+
open RationalPhaseSpacing
|
| 24 |
+
|
| 25 |
+
/-- Every hyperbolic inner prefix has the required variable-cap envelope.
|
| 26 |
+
This includes the zero-frequency case and does not require a nonresonance
|
| 27 |
+
assumption. -/
|
| 28 |
+
theorem norm_phase_Ioc_mul_le_variable (α : ℝ) (N d k : ℕ) (hk : k ≤ N / d) :
|
| 29 |
+
‖∑ b ∈ Finset.Ioc 0 k, RealPhase.phase (α * (d * b : ℕ))‖ ≤
|
| 30 |
+
truncatedInv ((N : ℝ) / d) (intDistance (α * d)) := by
|
| 31 |
+
have heq : (∑ b ∈ Finset.Ioc 0 k, RealPhase.phase (α * (d * b : ℕ))) =
|
| 32 |
+
∑ j ∈ Finset.range k, RealPhase.phase ((α * d) * (1 + j) + 0) := by
|
| 33 |
+
rw [sum_Ioc_zero_eq_sum_range_succ]
|
| 34 |
+
apply Finset.sum_congr rfl
|
| 35 |
+
intro j hj
|
| 36 |
+
congr 1
|
| 37 |
+
push_cast
|
| 38 |
+
ring
|
| 39 |
+
rw [heq]
|
| 40 |
+
exact (RealPhase.norm_sum_shift_phase_le_envelope (α * d) 0 1 k).trans
|
| 41 |
+
(RealTypeI.geometric_envelope_le_truncated_real (α * d) k ((N : ℝ) / d)
|
| 42 |
+
((by exact_mod_cast hk : (k : ℝ) ≤ (N / d : ℕ)).trans Nat.cast_div_le))
|
| 43 |
+
|
| 44 |
+
/-- The positive-initial-interval convention used by Vaughan's identity. -/
|
| 45 |
+
theorem sum_variable_reciprocal_Ioc_le
|
| 46 |
+
(α : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 47 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 48 |
+
(happrox : |α - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 49 |
+
(N A : ℕ) :
|
| 50 |
+
(∑ d ∈ Finset.Ioc 0 A,
|
| 51 |
+
truncatedInv ((N : ℝ) / d) (intDistance (α * d))) ≤
|
| 52 |
+
RealTypeI.hyperbolicCost (N : ℝ) A q := by
|
| 53 |
+
have hcast : (∑ d ∈ Finset.Ioc 0 A,
|
| 54 |
+
truncatedInv ((N : ℝ) / d) (intDistance (α * d))) =
|
| 55 |
+
∑ d ∈ Finset.Icc 1 (A : ℤ),
|
| 56 |
+
truncatedInv ((N : ℝ) / d) (intDistance (α * d)) := by
|
| 57 |
+
apply Finset.sum_nbij' (fun d : ℕ => (d : ℤ)) Int.toNat
|
| 58 |
+
· intro d hd
|
| 59 |
+
obtain ⟨hd0, hdA⟩ := Finset.mem_Ioc.mp hd
|
| 60 |
+
exact Finset.mem_Icc.mpr ⟨by exact_mod_cast hd0, by exact_mod_cast hdA⟩
|
| 61 |
+
· intro d hd
|
| 62 |
+
obtain ⟨hd1, hdA⟩ := Finset.mem_Icc.mp hd
|
| 63 |
+
apply Finset.mem_Ioc.mpr
|
| 64 |
+
omega
|
| 65 |
+
· intro d hd
|
| 66 |
+
exact Int.toNat_natCast d
|
| 67 |
+
· intro d hd
|
| 68 |
+
exact Int.toNat_of_nonneg (by have := (Finset.mem_Icc.mp hd).1; omega)
|
| 69 |
+
· intro d hd
|
| 70 |
+
simp
|
| 71 |
+
rw [hcast]
|
| 72 |
+
exact sum_truncatedInv_hyperbolic_le α a q hq hcop happrox N (Nat.cast_nonneg N) A
|
| 73 |
+
|
| 74 |
+
/-- The first actual Vaughan convolution, with its logarithmic inner weight,
|
| 75 |
+
is bounded using only a reduced rational approximation to the frequency. -/
|
| 76 |
+
theorem first_typeI_real_phase_bound
|
| 77 |
+
(α : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 78 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 79 |
+
(happrox : |α - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 80 |
+
(N U : ℕ) :
|
| 81 |
+
‖weightedSum (Finset.Ioc 0 N) (fun n => RealPhase.phase (α * n))
|
| 82 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖ ≤
|
| 83 |
+
2 * Real.log N * RealTypeI.hyperbolicCost (N : ℝ) (min U N) q := by
|
| 84 |
+
apply (first_typeI_bound (fun n => RealPhase.phase (α * n)) N U
|
| 85 |
+
(fun d => truncatedInv ((N : ℝ) / d) (intDistance (α * d)))
|
| 86 |
+
(fun d _ k hk => norm_phase_Ioc_mul_le_variable α N d k hk)).trans
|
| 87 |
+
exact mul_le_mul_of_nonneg_left
|
| 88 |
+
(sum_variable_reciprocal_Ioc_le α a q hq hcop happrox N (min U N))
|
| 89 |
+
(by positivity)
|
| 90 |
+
|
| 91 |
+
/-- The second actual Vaughan convolution has one logarithmic coefficient
|
| 92 |
+
factor and the same variable-length reciprocal budget. -/
|
| 93 |
+
theorem second_typeI_real_phase_bound
|
| 94 |
+
(α : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 95 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 96 |
+
(happrox : |α - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 97 |
+
(N U V : ℕ) :
|
| 98 |
+
‖weightedSum (Finset.Ioc 0 N) (fun n => RealPhase.phase (α * n))
|
| 99 |
+
(typeICoefficient U V * ζ)‖ ≤
|
| 100 |
+
Real.log N * RealTypeI.hyperbolicCost (N : ℝ) (min (U * V) N) q := by
|
| 101 |
+
apply (second_typeI_bound (fun n => RealPhase.phase (α * n)) N U V
|
| 102 |
+
(fun d => truncatedInv ((N : ℝ) / d) (intDistance (α * d)))
|
| 103 |
+
(fun d _ => norm_phase_Ioc_mul_le_variable α N d (N / d) le_rfl)).trans
|
| 104 |
+
exact mul_le_mul_of_nonneg_left
|
| 105 |
+
(sum_variable_reciprocal_Ioc_le α a q hq hcop happrox N (min (U * V) N))
|
| 106 |
+
(Real.log_natCast_nonneg N)
|
| 107 |
+
|
| 108 |
+
end Problem337.VaughanHyperbolic
|
| 109 |
+
|
| 110 |
+
end
|
| 111 |
+
|
| 112 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanTypeI.lean
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanWeighted
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.ThreePrimePartialSummation
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
noncomputable section
|
| 6 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 7 |
+
|
| 8 |
+
namespace Problem337.Vaughan
|
| 9 |
+
|
| 10 |
+
/-- Indexing positive initial intervals by a zero-based range. -/
|
| 11 |
+
lemma sum_Ioc_zero_eq_sum_range_succ {R : Type*} [AddCommMonoid R]
|
| 12 |
+
(f : ℕ → R) (N : ℕ) :
|
| 13 |
+
(∑ j ∈ Finset.Ioc 0 N, f j) = ∑ j ∈ Finset.range N, f (j + 1) := by
|
| 14 |
+
induction N with
|
| 15 |
+
| zero => simp
|
| 16 |
+
| succ N ih =>
|
| 17 |
+
rw [Finset.sum_Ioc_succ_top (Nat.zero_le N), Finset.sum_range_succ, ih]
|
| 18 |
+
|
| 19 |
+
/-- Adding a logarithmic weight costs at most twice the endpoint logarithm.
|
| 20 |
+
The prefix bound remains explicit; no cancellation estimate is assumed silently. -/
|
| 21 |
+
theorem log_weighted_sum_norm_le (w : ℕ → ℂ) (N : ℕ) (B : ℝ)
|
| 22 |
+
(hprefix : ∀ k ≤ N, ‖∑ j ∈ Finset.Ioc 0 k, w j‖ ≤ B) :
|
| 23 |
+
‖∑ j ∈ Finset.Ioc 0 N, (Real.log j : ℂ) * w j‖ ≤
|
| 24 |
+
2 * B * Real.log N := by
|
| 25 |
+
cases N with
|
| 26 |
+
| zero => simp
|
| 27 |
+
| succ n =>
|
| 28 |
+
have hlog (j : ℕ) : 0 ≤ Real.log (j + 1 : ℕ) :=
|
| 29 |
+
Real.log_nonneg (by exact_mod_cast Nat.succ_le_succ (Nat.zero_le j))
|
| 30 |
+
have hmono (j : ℕ) : Real.log (j + 1 : ℕ) ≤ Real.log (j + 1 + 1 : ℕ) := by
|
| 31 |
+
apply Real.log_le_log
|
| 32 |
+
· positivity
|
| 33 |
+
· exact_mod_cast Nat.le_succ (j + 1)
|
| 34 |
+
have hvar : (∑ j ∈ Finset.range n,
|
| 35 |
+
‖(Real.log (j + 1 + 1 : ℕ) : ℂ) - (Real.log (j + 1 : ℕ) : ℂ)‖) =
|
| 36 |
+
Real.log (n + 1 : ℕ) := by
|
| 37 |
+
calc
|
| 38 |
+
_ = ∑ j ∈ Finset.range n,
|
| 39 |
+
(Real.log (j + 1 + 1 : ℕ) - Real.log (j + 1 : ℕ)) := by
|
| 40 |
+
apply Finset.sum_congr rfl
|
| 41 |
+
intro j hj
|
| 42 |
+
rw [← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs,
|
| 43 |
+
abs_of_nonneg (sub_nonneg.mpr (hmono j))]
|
| 44 |
+
_ = _ := by
|
| 45 |
+
simpa using Finset.sum_range_sub (fun j => Real.log (j + 1 : ℕ)) n
|
| 46 |
+
have h := ThreePrimeAnalysis.weighted_sum_norm_le_partial_sum_bound
|
| 47 |
+
(fun j => w (j + 1)) (fun j => (Real.log (j + 1 : ℕ) : ℂ)) n B (by
|
| 48 |
+
intro k hk
|
| 49 |
+
simpa only [sum_Ioc_zero_eq_sum_range_succ] using hprefix k hk)
|
| 50 |
+
rw [hvar, Complex.norm_real, Real.norm_eq_abs, abs_of_nonneg (hlog n)] at h
|
| 51 |
+
rw [sum_Ioc_zero_eq_sum_range_succ]
|
| 52 |
+
convert h using 1
|
| 53 |
+
ring
|
| 54 |
+
|
| 55 |
+
/-- Type I logarithmic bilinear estimate for coefficients bounded by one. -/
|
| 56 |
+
theorem norm_log_bilinear_sum_le (w : ℕ → ℂ) (N A : ℕ) (c B : ℕ → ℝ)
|
| 57 |
+
(hA : A ≤ N)
|
| 58 |
+
(hc : ∀ a ∈ Finset.Ioc 0 A, |c a| ≤ 1)
|
| 59 |
+
(hprefix : ∀ a ∈ Finset.Ioc 0 A, ∀ k ≤ N / a,
|
| 60 |
+
‖∑ b ∈ Finset.Ioc 0 k, w (a * b)‖ ≤ B a) :
|
| 61 |
+
‖∑ a ∈ Finset.Ioc 0 A, (c a : ℂ) *
|
| 62 |
+
∑ b ∈ Finset.Ioc 0 (N / a), (Real.log b : ℂ) * w (a * b)‖ ≤
|
| 63 |
+
2 * Real.log N * ∑ a ∈ Finset.Ioc 0 A, B a := by
|
| 64 |
+
calc
|
| 65 |
+
_ ≤ ∑ a ∈ Finset.Ioc 0 A,
|
| 66 |
+
‖(c a : ℂ) * ∑ b ∈ Finset.Ioc 0 (N / a),
|
| 67 |
+
(Real.log b : ℂ) * w (a * b)‖ := norm_sum_le _ _
|
| 68 |
+
_ ≤ ∑ a ∈ Finset.Ioc 0 A, 2 * Real.log N * B a := by
|
| 69 |
+
apply Finset.sum_le_sum
|
| 70 |
+
intro a ha
|
| 71 |
+
obtain ⟨ha0, haA⟩ := Finset.mem_Ioc.mp ha
|
| 72 |
+
have haN := haA.trans hA
|
| 73 |
+
have hq : 1 ≤ N / a := (Nat.le_div_iff_mul_le ha0).mpr (by simpa using haN)
|
| 74 |
+
have hB : 0 ≤ B a := by simpa using hprefix a ha 0 (Nat.zero_le _)
|
| 75 |
+
have hlog : Real.log (N / a : ℕ) ≤ Real.log N := by
|
| 76 |
+
apply Real.log_le_log
|
| 77 |
+
· exact_mod_cast (Nat.zero_lt_of_lt hq)
|
| 78 |
+
· exact_mod_cast Nat.div_le_self N a
|
| 79 |
+
rw [norm_mul, Complex.norm_real, Real.norm_eq_abs]
|
| 80 |
+
calc
|
| 81 |
+
_ ≤ 1 * ‖∑ b ∈ Finset.Ioc 0 (N / a),
|
| 82 |
+
(Real.log b : ℂ) * w (a * b)‖ :=
|
| 83 |
+
mul_le_mul_of_nonneg_right (hc a ha) (norm_nonneg _)
|
| 84 |
+
_ ≤ 2 * B a * Real.log (N / a : ℕ) := by
|
| 85 |
+
simpa using log_weighted_sum_norm_le (fun b => w (a * b)) (N / a) (B a)
|
| 86 |
+
(hprefix a ha)
|
| 87 |
+
_ ≤ 2 * Real.log N * B a := by
|
| 88 |
+
nlinarith [mul_le_mul_of_nonneg_left hlog (show 0 ≤ 2 * B a by positivity)]
|
| 89 |
+
_ = _ := by rw [Finset.mul_sum]
|
| 90 |
+
|
| 91 |
+
/-- Type I bilinear estimate for coefficients with the logarithmic majorant. -/
|
| 92 |
+
theorem norm_bilinear_sum_le_log (w : ℕ → ℂ) (N A : ℕ) (c B : ℕ → ℝ)
|
| 93 |
+
(hA : A ≤ N)
|
| 94 |
+
(hc : ∀ a ∈ Finset.Ioc 0 A, |c a| ≤ Real.log a)
|
| 95 |
+
(hinner : ∀ a ∈ Finset.Ioc 0 A,
|
| 96 |
+
‖∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤ B a) :
|
| 97 |
+
‖∑ a ∈ Finset.Ioc 0 A, (c a : ℂ) *
|
| 98 |
+
∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤
|
| 99 |
+
Real.log N * ∑ a ∈ Finset.Ioc 0 A, B a := by
|
| 100 |
+
calc
|
| 101 |
+
_ ≤ ∑ a ∈ Finset.Ioc 0 A,
|
| 102 |
+
‖(c a : ℂ) * ∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ := norm_sum_le _ _
|
| 103 |
+
_ ≤ ∑ a ∈ Finset.Ioc 0 A, Real.log N * B a := by
|
| 104 |
+
apply Finset.sum_le_sum
|
| 105 |
+
intro a ha
|
| 106 |
+
obtain ⟨ha0, haA⟩ := Finset.mem_Ioc.mp ha
|
| 107 |
+
have hB : 0 ≤ B a := (norm_nonneg _).trans (hinner a ha)
|
| 108 |
+
have hlog : Real.log a ≤ Real.log N := Real.log_le_log
|
| 109 |
+
(by exact_mod_cast ha0) (by exact_mod_cast haA.trans hA)
|
| 110 |
+
have hlogN : 0 ≤ Real.log N := (abs_nonneg _).trans ((hc a ha).trans hlog)
|
| 111 |
+
rw [norm_mul, Complex.norm_real, Real.norm_eq_abs]
|
| 112 |
+
exact mul_le_mul ((hc a ha).trans hlog) (hinner a ha) (norm_nonneg _) hlogN
|
| 113 |
+
_ = _ := by rw [Finset.mul_sum]
|
| 114 |
+
|
| 115 |
+
/-- The first Vaughan Type I term in its finite bilinear form. -/
|
| 116 |
+
theorem first_typeI_sum_bound (w : ℕ → ℂ) (N U : ℕ) (B : ℕ → ℝ)
|
| 117 |
+
(hprefix : ∀ a ∈ Finset.Ioc 0 (min U N), ∀ k ≤ N / a,
|
| 118 |
+
‖∑ b ∈ Finset.Ioc 0 k, w (a * b)‖ ≤ B a) :
|
| 119 |
+
‖∑ a ∈ Finset.Ioc 0 (min U N), ((μ a : ℝ) : ℂ) *
|
| 120 |
+
∑ b ∈ Finset.Ioc 0 (N / a), (Real.log b : ℂ) * w (a * b)‖ ≤
|
| 121 |
+
2 * Real.log N * ∑ a ∈ Finset.Ioc 0 (min U N), B a := by
|
| 122 |
+
apply norm_log_bilinear_sum_le w N (min U N) (fun a => (μ a : ℝ)) B
|
| 123 |
+
(min_le_right _ _) _ hprefix
|
| 124 |
+
intro a ha
|
| 125 |
+
exact abs_real_moebius_le_one a
|
| 126 |
+
|
| 127 |
+
/-- The second Vaughan Type I term in its finite bilinear form. -/
|
| 128 |
+
theorem second_typeI_sum_bound (w : ℕ → ℂ) (N U V : ℕ) (B : ℕ → ℝ)
|
| 129 |
+
(hinner : ∀ a ∈ Finset.Ioc 0 (min (U * V) N),
|
| 130 |
+
‖∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤ B a) :
|
| 131 |
+
‖∑ a ∈ Finset.Ioc 0 (min (U * V) N), (typeICoefficient U V a : ℂ) *
|
| 132 |
+
∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤
|
| 133 |
+
Real.log N * ∑ a ∈ Finset.Ioc 0 (min (U * V) N), B a := by
|
| 134 |
+
exact norm_bilinear_sum_le_log w N (min (U * V) N) (typeICoefficient U V) B
|
| 135 |
+
(min_le_right _ _) (fun a _ => abs_typeICoefficient_le_log U V a) hinner
|
| 136 |
+
|
| 137 |
+
/-- First Type I estimate directly for the actual Vaughan convolution. -/
|
| 138 |
+
theorem first_typeI_bound (w : ℕ → ℂ) (N U : ℕ) (B : ℕ → ℝ)
|
| 139 |
+
(hprefix : ∀ a ∈ Finset.Ioc 0 (min U N), ∀ k ≤ N / a,
|
| 140 |
+
‖∑ b ∈ Finset.Ioc 0 k, w (a * b)‖ ≤ B a) :
|
| 141 |
+
‖weightedSum (Finset.Ioc 0 N) w
|
| 142 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖ ≤
|
| 143 |
+
2 * Real.log N * ∑ a ∈ Finset.Ioc 0 (min U N), B a := by
|
| 144 |
+
rw [first_typeI_eq_sum]
|
| 145 |
+
exact first_typeI_sum_bound w N U B hprefix
|
| 146 |
+
|
| 147 |
+
/-- Second Type I estimate directly for the actual Vaughan convolution. -/
|
| 148 |
+
theorem second_typeI_bound (w : ℕ → ℂ) (N U V : ℕ) (B : ℕ → ℝ)
|
| 149 |
+
(hinner : ∀ a ∈ Finset.Ioc 0 (min (U * V) N),
|
| 150 |
+
‖∑ b ∈ Finset.Ioc 0 (N / a), w (a * b)‖ ≤ B a) :
|
| 151 |
+
‖weightedSum (Finset.Ioc 0 N) w (typeICoefficient U V * ζ)‖ ≤
|
| 152 |
+
Real.log N * ∑ a ∈ Finset.Ioc 0 (min (U * V) N), B a := by
|
| 153 |
+
rw [second_typeI_eq_sum]
|
| 154 |
+
exact second_typeI_sum_bound w N U V B hinner
|
| 155 |
+
|
| 156 |
+
end Problem337.Vaughan
|
| 157 |
+
|
| 158 |
+
end
|
| 159 |
+
|
| 160 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanTypeINormalized.lean
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanRealTypeIHyperbolic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 6 |
+
|
| 7 |
+
namespace Problem337.VaughanHyperbolic
|
| 8 |
+
|
| 9 |
+
/-- A common logarithmic majorant for both actual Type I costs. -/
|
| 10 |
+
theorem hyperbolicCost_min_le (N A q : ℕ) (hN : 1 ≤ N) (hq : 0 < q)
|
| 11 |
+
(hqN : q ≤ N) :
|
| 12 |
+
RealTypeI.hyperbolicCost N (min A N) q ≤
|
| 13 |
+
8 * ((N : ℝ) / q + A + q) * (1 + Real.log (2 * (N : ℝ))) := by
|
| 14 |
+
have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN
|
| 15 |
+
have hqr : (1 : ℝ) ≤ q := by exact_mod_cast hq
|
| 16 |
+
have hqNr : (q : ℝ) ≤ N := by exact_mod_cast hqN
|
| 17 |
+
have hminA : ((min A N : ℕ) : ℝ) ≤ A := by exact_mod_cast min_le_left A N
|
| 18 |
+
have hminN : ((min A N : ℕ) : ℝ) ≤ N := by exact_mod_cast min_le_right A N
|
| 19 |
+
have hlogq : 0 ≤ 1 + Real.log (2 * (q : ℝ)) := by
|
| 20 |
+
have := Real.log_nonneg (show 1 ≤ 2 * (q : ℝ) by linarith)
|
| 21 |
+
linarith
|
| 22 |
+
have hH : 0 ≤ 1 + Real.log (2 * (N : ℝ)) := by
|
| 23 |
+
have := Real.log_nonneg (show 1 ≤ 2 * (N : ℝ) by linarith)
|
| 24 |
+
linarith
|
| 25 |
+
have hlogqN : 1 + Real.log (2 * (q : ℝ)) ≤
|
| 26 |
+
1 + Real.log (2 * (N : ℝ)) := by
|
| 27 |
+
gcongr
|
| 28 |
+
have hlogmin : 1 + Real.log (((min A N : ℕ) : ℝ) + 1) ≤
|
| 29 |
+
1 + Real.log (2 * (N : ℝ)) := by
|
| 30 |
+
exact add_le_add le_rfl (Real.log_le_log (by positivity) (by linarith))
|
| 31 |
+
unfold RealTypeI.hyperbolicCost
|
| 32 |
+
calc
|
| 33 |
+
_ ≤ 8 * ((A : ℝ) + q) * (1 + Real.log (2 * (N : ℝ))) +
|
| 34 |
+
(4 * (N : ℝ) / q) * (1 + Real.log (2 * (N : ℝ))) := by
|
| 35 |
+
apply add_le_add
|
| 36 |
+
· exact mul_le_mul (by gcongr) hlogqN hlogq (by positivity)
|
| 37 |
+
· exact mul_le_mul_of_nonneg_left hlogmin (by positivity)
|
| 38 |
+
_ ≤ _ := by
|
| 39 |
+
have hd : 0 ≤ (N : ℝ) / q := by positivity
|
| 40 |
+
simp only [mul_div_assoc]
|
| 41 |
+
nlinarith [mul_nonneg hd hH]
|
| 42 |
+
|
| 43 |
+
private lemma log_le_common (N : ℕ) (hN : 1 ≤ N) :
|
| 44 |
+
Real.log N ≤ 1 + Real.log (2 * (N : ℝ)) := by
|
| 45 |
+
have hNr : (1 : ℝ) ≤ N := by exact_mod_cast hN
|
| 46 |
+
have h := Real.log_le_log (show 0 < (N : ℝ) by linarith)
|
| 47 |
+
(show (N : ℝ) ≤ 2 * N by linarith)
|
| 48 |
+
linarith
|
| 49 |
+
|
| 50 |
+
/-- Uniform Type I bound in the parameters of the optimized Vaughan cutoff. -/
|
| 51 |
+
theorem first_typeI_normalized_bound
|
| 52 |
+
(α : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 53 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 54 |
+
(happrox : |α - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 55 |
+
(N U : ℕ) (hN : 1 ≤ N) (hqN : q ≤ N) :
|
| 56 |
+
‖Vaughan.weightedSum (Finset.Ioc 0 N) (fun n => RealPhase.phase (α * n))
|
| 57 |
+
(Vaughan.shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log)‖ ≤
|
| 58 |
+
16 * (1 + Real.log (2 * (N : ℝ))) ^ 2 * ((N : ℝ) / q + U + q) := by
|
| 59 |
+
have hH : 0 ≤ 1 + Real.log (2 * (N : ℝ)) :=
|
| 60 |
+
(Real.log_natCast_nonneg N).trans (log_le_common N hN)
|
| 61 |
+
calc
|
| 62 |
+
_ ≤ 2 * Real.log N * RealTypeI.hyperbolicCost N (min U N) q :=
|
| 63 |
+
first_typeI_real_phase_bound α a q hq hcop happrox N U
|
| 64 |
+
_ ≤ 2 * Real.log N *
|
| 65 |
+
(8 * ((N : ℝ) / q + U + q) * (1 + Real.log (2 * (N : ℝ)))) :=
|
| 66 |
+
mul_le_mul_of_nonneg_left (hyperbolicCost_min_le N U q hN hq hqN) (by positivity)
|
| 67 |
+
_ ≤ _ := by
|
| 68 |
+
have h := mul_le_mul_of_nonneg_right (log_le_common N hN)
|
| 69 |
+
(show 0 ≤ 16 * ((N : ℝ) / q + U + q) *
|
| 70 |
+
(1 + Real.log (2 * (N : ℝ))) by positivity)
|
| 71 |
+
nlinarith
|
| 72 |
+
|
| 73 |
+
/-- Uniform second Type I bound with the full product support retained. -/
|
| 74 |
+
theorem second_typeI_normalized_bound
|
| 75 |
+
(α : ℝ) (a : ℤ) (q : ℕ) (hq : 0 < q)
|
| 76 |
+
(hcop : IsCoprime a (q : ℤ))
|
| 77 |
+
(happrox : |α - (a : ℝ) / q| ≤ 1 / (q : ℝ) ^ 2)
|
| 78 |
+
(N U V : ℕ) (hN : 1 ≤ N) (hqN : q ≤ N) :
|
| 79 |
+
‖Vaughan.weightedSum (Finset.Ioc 0 N) (fun n => RealPhase.phase (α * n))
|
| 80 |
+
(Vaughan.typeICoefficient U V * ζ)‖ ≤
|
| 81 |
+
8 * (1 + Real.log (2 * (N : ℝ))) ^ 2 * ((N : ℝ) / q + U * V + q) := by
|
| 82 |
+
have hH : 0 ≤ 1 + Real.log (2 * (N : ℝ)) :=
|
| 83 |
+
(Real.log_natCast_nonneg N).trans (log_le_common N hN)
|
| 84 |
+
calc
|
| 85 |
+
_ ≤ Real.log N * RealTypeI.hyperbolicCost N (min (U * V) N) q :=
|
| 86 |
+
second_typeI_real_phase_bound α a q hq hcop happrox N U V
|
| 87 |
+
_ ≤ Real.log N *
|
| 88 |
+
(8 * ((N : ℝ) / q + (U * V : ℕ) + q) * (1 + Real.log (2 * (N : ℝ)))) :=
|
| 89 |
+
mul_le_mul_of_nonneg_left (hyperbolicCost_min_le N (U * V) q hN hq hqN)
|
| 90 |
+
(Real.log_natCast_nonneg N)
|
| 91 |
+
_ ≤ _ := by
|
| 92 |
+
have h := mul_le_mul_of_nonneg_right (log_le_common N hN)
|
| 93 |
+
(show 0 ≤ 8 * ((N : ℝ) / q + U * V + q) *
|
| 94 |
+
(1 + Real.log (2 * (N : ℝ))) by positivity)
|
| 95 |
+
push_cast
|
| 96 |
+
nlinarith
|
| 97 |
+
|
| 98 |
+
end Problem337.VaughanHyperbolic
|
| 99 |
+
|
| 100 |
+
end
|
| 101 |
+
|
| 102 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/VaughanWeighted.lean
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanIdentity
|
| 2 |
+
import OAI.NumberTheory.EgyptianFractions.VaughanHyperbola
|
| 3 |
+
import Mathlib
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
noncomputable section
|
| 7 |
+
open scoped BigOperators ArithmeticFunction ArithmeticFunction.Moebius ArithmeticFunction.zeta
|
| 8 |
+
|
| 9 |
+
namespace Problem337.Vaughan
|
| 10 |
+
|
| 11 |
+
/-- Finite complex weighted sum of a real arithmetic function. -/
|
| 12 |
+
def weightedSum (s : Finset ℕ) (w : ℕ → ℂ) (f : ArithmeticFunction ℝ) : ℂ :=
|
| 13 |
+
∑ n ∈ s, (f n : ℂ) * w n
|
| 14 |
+
|
| 15 |
+
@[simp] theorem weightedSum_add (s : Finset ℕ) (w : ℕ → ℂ)
|
| 16 |
+
(f g : ArithmeticFunction ℝ) :
|
| 17 |
+
weightedSum s w (f + g) = weightedSum s w f + weightedSum s w g := by
|
| 18 |
+
simp [weightedSum, add_mul, Finset.sum_add_distrib]
|
| 19 |
+
|
| 20 |
+
@[simp] theorem weightedSum_sub (s : Finset ℕ) (w : ℕ → ℂ)
|
| 21 |
+
(f g : ArithmeticFunction ℝ) :
|
| 22 |
+
weightedSum s w (f - g) = weightedSum s w f - weightedSum s w g := by
|
| 23 |
+
simp [sub_eq_add_neg, weightedSum, add_mul, Finset.sum_add_distrib]
|
| 24 |
+
|
| 25 |
+
/-- Exact complex weighted Vaughan decomposition, using the canonical cutoff API. -/
|
| 26 |
+
theorem weighted_identity (s : Finset ℕ) (w : ℕ → ℂ) (U V : ℕ) :
|
| 27 |
+
weightedSum s w Λ = weightedSum s w (shortPart V Λ) +
|
| 28 |
+
weightedSum s w (shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log) -
|
| 29 |
+
weightedSum s w (typeICoefficient U V * ζ) +
|
| 30 |
+
weightedSum s w (typeIICoefficient U * longPart V Λ) := by
|
| 31 |
+
have h := congrArg (weightedSum s w) (vonMangoldt_identity U V)
|
| 32 |
+
simpa only [weightedSum_add, weightedSum_sub, typeICoefficient, typeIICoefficient] using h
|
| 33 |
+
|
| 34 |
+
/-- The Type II convolution is supported where both factors exceed the cutoffs. -/
|
| 35 |
+
theorem typeII_apply (U V n : ℕ) :
|
| 36 |
+
(typeIICoefficient U * longPart V Λ) n =
|
| 37 |
+
∑ d ∈ n.divisorsAntidiagonal.filter (fun d => U < d.1 ∧ V < d.2),
|
| 38 |
+
typeIICoefficient U d.1 * Λ d.2 := by
|
| 39 |
+
rw [ArithmeticFunction.mul_apply, Finset.sum_filter]
|
| 40 |
+
apply Finset.sum_congr rfl
|
| 41 |
+
intro d hd
|
| 42 |
+
by_cases hU : U < d.1
|
| 43 |
+
· by_cases hV : V < d.2 <;> simp [hU, hV]
|
| 44 |
+
· simp [hU, typeIICoefficient_eq_zero U d.1 (not_lt.mp hU)]
|
| 45 |
+
|
| 46 |
+
lemma positive_interval (N : ℕ) : Finset.Icc 1 N = Finset.Ioc 0 N := by
|
| 47 |
+
ext n
|
| 48 |
+
simp only [Finset.mem_Icc, Finset.mem_Ioc]
|
| 49 |
+
omega
|
| 50 |
+
|
| 51 |
+
/-- A convolution sum with its outer coefficient factored out. -/
|
| 52 |
+
theorem weightedSum_mul (N : ℕ) (w : ℕ → ℂ) (f g : ArithmeticFunction ℝ) :
|
| 53 |
+
weightedSum (Finset.Ioc 0 N) w (f * g) =
|
| 54 |
+
∑ a ∈ Finset.Ioc 0 N, (f a : ℂ) *
|
| 55 |
+
∑ b ∈ Finset.Ioc 0 (N / a), (g b : ℂ) * w (a * b) := by
|
| 56 |
+
simpa only [weightedSum, positive_interval, Finset.mul_sum, Complex.ofReal_mul,
|
| 57 |
+
mul_assoc] using sum_real_convolution_eq_nested N f g w
|
| 58 |
+
|
| 59 |
+
/-- A compactly supported coefficient restricts the outer interval exactly. -/
|
| 60 |
+
theorem weightedSum_mul_of_support (N A : ℕ) (w : ℕ → ℂ)
|
| 61 |
+
(f g : ArithmeticFunction ℝ) (hf : ∀ a, A < a → f a = 0) :
|
| 62 |
+
weightedSum (Finset.Ioc 0 N) w (f * g) =
|
| 63 |
+
∑ a ∈ Finset.Ioc 0 (min A N), (f a : ℂ) *
|
| 64 |
+
∑ b ∈ Finset.Ioc 0 (N / a), (g b : ℂ) * w (a * b) := by
|
| 65 |
+
rw [weightedSum_mul]
|
| 66 |
+
symm
|
| 67 |
+
apply Finset.sum_subset
|
| 68 |
+
· intro a ha
|
| 69 |
+
obtain ⟨ha0, haAN⟩ := Finset.mem_Ioc.mp ha
|
| 70 |
+
exact Finset.mem_Ioc.mpr ⟨ha0, (le_min_iff.mp haAN).2⟩
|
| 71 |
+
· intro a ha hnot
|
| 72 |
+
have hA : A < a := by
|
| 73 |
+
simp only [Finset.mem_Ioc] at ha hnot
|
| 74 |
+
omega
|
| 75 |
+
simp [hf a hA]
|
| 76 |
+
|
| 77 |
+
/-- Exact first Type I sum with its actual short cutoff. -/
|
| 78 |
+
theorem first_typeI_eq_sum (N U : ℕ) (w : ℕ → ℂ) :
|
| 79 |
+
weightedSum (Finset.Ioc 0 N) w
|
| 80 |
+
(shortPart U (μ : ArithmeticFunction ℝ) * ArithmeticFunction.log) =
|
| 81 |
+
∑ a ∈ Finset.Ioc 0 (min U N), ((μ a : ℝ) : ℂ) *
|
| 82 |
+
∑ b ∈ Finset.Ioc 0 (N / a), (Real.log b : ℂ) * w (a * b) := by
|
| 83 |
+
rw [weightedSum_mul_of_support N U w _ _ (by
|
| 84 |
+
intro a ha
|
| 85 |
+
simp [not_le.mpr ha])]
|
| 86 |
+
apply Finset.sum_congr rfl
|
| 87 |
+
intro a ha
|
| 88 |
+
have haU := (le_min_iff.mp (Finset.mem_Ioc.mp ha).2).1
|
| 89 |
+
simp [haU]
|
| 90 |
+
|
| 91 |
+
/-- Exact second Type I sum, supported up to the product cutoff. -/
|
| 92 |
+
theorem second_typeI_eq_sum (N U V : ℕ) (w : ℕ → ℂ) :
|
| 93 |
+
weightedSum (Finset.Ioc 0 N) w (typeICoefficient U V * ζ) =
|
| 94 |
+
∑ a ∈ Finset.Ioc 0 (min (U * V) N), (typeICoefficient U V a : ℂ) *
|
| 95 |
+
∑ b ∈ Finset.Ioc 0 (N / a), w (a * b) := by
|
| 96 |
+
rw [weightedSum_mul_of_support N (U * V) w _ _ (typeICoefficient_eq_zero U V)]
|
| 97 |
+
apply Finset.sum_congr rfl
|
| 98 |
+
intro a ha
|
| 99 |
+
congr 1
|
| 100 |
+
apply Finset.sum_congr rfl
|
| 101 |
+
intro b hb
|
| 102 |
+
simp [ArithmeticFunction.zeta_apply_ne (Nat.ne_of_gt (Finset.mem_Ioc.mp hb).1)]
|
| 103 |
+
|
| 104 |
+
end Problem337.Vaughan
|
| 105 |
+
|
| 106 |
+
end
|
| 107 |
+
|
| 108 |
+
end OAI
|
lean/OAI/NumberTheory/EgyptianFractions/WeightedBinomial.lean
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
noncomputable section
|
| 5 |
+
open scoped BigOperators
|
| 6 |
+
namespace Problem337
|
| 7 |
+
|
| 8 |
+
/-- A weighted binomial bound, allowing a real cutoff on subset size. -/
|
| 9 |
+
theorem weighted_binomial_bound (L : ℕ) (t q : ℝ) (hq0 : 0 < q) (hq1 : q ≤ 1) :
|
| 10 |
+
(∑ j ∈ (Finset.range (L + 1)).filter (fun j : ℕ => (j : ℝ) ≤ t),
|
| 11 |
+
(Nat.choose L j : ℝ)) ≤ q ^ (-t) * (1 + q) ^ L := by
|
| 12 |
+
have hw : q ^ t *
|
| 13 |
+
(∑ j ∈ (Finset.range (L + 1)).filter (fun j : ℕ => (j : ℝ) ≤ t),
|
| 14 |
+
(Nat.choose L j : ℝ)) ≤ (1 + q) ^ L := by
|
| 15 |
+
rw [Finset.mul_sum]
|
| 16 |
+
calc
|
| 17 |
+
_ ≤ ∑ j ∈ (Finset.range (L + 1)).filter (fun j : ℕ => (j : ℝ) ≤ t),
|
| 18 |
+
q ^ j * (Nat.choose L j : ℝ) := by
|
| 19 |
+
apply Finset.sum_le_sum
|
| 20 |
+
intro j hj
|
| 21 |
+
apply mul_le_mul_of_nonneg_right _ (Nat.cast_nonneg _)
|
| 22 |
+
simpa only [Real.rpow_natCast] using
|
| 23 |
+
Real.rpow_le_rpow_of_exponent_ge hq0 hq1 (Finset.mem_filter.mp hj).2
|
| 24 |
+
_ ≤ ∑ j ∈ Finset.range (L + 1), q ^ j * (Nat.choose L j : ℝ) := by
|
| 25 |
+
apply Finset.sum_le_sum_of_subset_of_nonneg (Finset.filter_subset _ _)
|
| 26 |
+
intro j hj hnot
|
| 27 |
+
positivity
|
| 28 |
+
_ = (1 + q) ^ L := by
|
| 29 |
+
rw [show 1 + q = q + 1 by ring, add_pow]
|
| 30 |
+
simp
|
| 31 |
+
have hqt : 0 < q ^ t := Real.rpow_pos_of_pos hq0 t
|
| 32 |
+
have hdiv :
|
| 33 |
+
(∑ j ∈ (Finset.range (L + 1)).filter (fun j : ℕ => (j : ℝ) ≤ t),
|
| 34 |
+
(Nat.choose L j : ℝ)) ≤ (1 + q) ^ L / q ^ t :=
|
| 35 |
+
(le_div_iff₀ hqt).2 (by simpa only [mul_comm] using hw)
|
| 36 |
+
simpa only [Real.rpow_neg hq0.le, div_eq_mul_inv, mul_comm] using hdiv
|
| 37 |
+
|
| 38 |
+
/-- Exponential form of the weighted subset count used in divisor estimates. -/
|
| 39 |
+
theorem weighted_binomial_exp_bound (L : ℕ) (t q : ℝ) (hq0 : 0 < q) (hq1 : q ≤ 1) :
|
| 40 |
+
(∑ j ∈ (Finset.range (L + 1)).filter (fun j : ℕ => (j : ℝ) ≤ t),
|
| 41 |
+
(Nat.choose L j : ℝ)) ≤ Real.exp (-t * Real.log q + (L : ℝ) * q) := by
|
| 42 |
+
apply (weighted_binomial_bound L t q hq0 hq1).trans
|
| 43 |
+
have hqadd : 0 < 1 + q := by positivity
|
| 44 |
+
rw [← Real.rpow_natCast (1 + q) L,
|
| 45 |
+
Real.rpow_def_of_pos hq0, Real.rpow_def_of_pos hqadd, ← Real.exp_add]
|
| 46 |
+
apply Real.exp_le_exp.mpr
|
| 47 |
+
have hlog : Real.log (1 + q) ≤ q := by
|
| 48 |
+
simpa using Real.log_le_sub_one_of_pos hqadd
|
| 49 |
+
nlinarith [mul_le_mul_of_nonneg_left hlog (Nat.cast_nonneg L : (0 : ℝ) ≤ L)]
|
| 50 |
+
|
| 51 |
+
end Problem337
|
| 52 |
+
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
end OAI
|
lean/OAI/NumberTheory/GaussianMoat/AccurateScales.lean
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.GaussianMoat.SieveCertificate
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
namespace GaussianMoat
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
open scoped BigOperators Classical
|
| 9 |
+
|
| 10 |
+
noncomputable def bandConstant (D : ℝ) : ℝ :=
|
| 11 |
+
10000+100*|Real.log D|+100*|Real.log (max D ((latticeBall (4*D)).card:ℝ))|
|
| 12 |
+
|
| 13 |
+
lemma bandConstant_pos (D : ℝ) : 0<bandConstant D := by
|
| 14 |
+
unfold bandConstant
|
| 15 |
+
positivity
|
| 16 |
+
|
| 17 |
+
theorem entropyBand_from_margin (s : SplitSieve) (pre post : List ℕ) (N l : ℕ)
|
| 18 |
+
{D g U δ : ℝ} (hD : 1≤D) (hg : 0<g) (hg1 : g≤1/200) (hU : 0<U)
|
| 19 |
+
(hL : 1≤ s.meanLog)
|
| 20 |
+
(hmargin : bandConstant D*s.meanLog≤g^5*bandScale g U l)
|
| 21 |
+
(hcap : ⌊U/s.meanLog⌋₊≤ s.primes.card)
|
| 22 |
+
(hpost : ∀ n∈post, (n:ℝ)≤Real.exp (g*bandScale g U l))
|
| 23 |
+
(hN : (N:ℝ)≤Real.exp (g*bandScale g U l))
|
| 24 |
+
(hlen : (post.length+2:ℝ)≤Real.exp (g*bandScale g U l))
|
| 25 |
+
(hδ : (1/2:ℝ)^l+90*g≤δ) :
|
| 26 |
+
Nonempty (EntropyBand s D
|
| 27 |
+
(pre++List.ofFn (fun i : Fin l => bandLength g U i.val)++post)
|
| 28 |
+
N (bandSize s g U l) δ) := by
|
| 29 |
+
let V := bandScale g U l
|
| 30 |
+
have hV : 0<V := bandScale_pos hg hU l
|
| 31 |
+
have hg01 : g≤1 := by linarith only [hg1]
|
| 32 |
+
have hg5 : g^5≤g := by
|
| 33 |
+
have hh : g^4≤1 := pow_le_one₀ hg.le hg01
|
| 34 |
+
calc g^5=g^4*g := by ring
|
| 35 |
+
_ ≤ 1*g := mul_le_mul_of_nonneg_right hh hg.le
|
| 36 |
+
_ = g := one_mul _
|
| 37 |
+
have hg52 : g^5≤g^2 := by
|
| 38 |
+
have hh : g^3≤1 := pow_le_one₀ hg.le hg01
|
| 39 |
+
calc g^5=g^3*g^2 := by ring
|
| 40 |
+
_ ≤ 1*g^2 := mul_le_mul_of_nonneg_right hh (sq_nonneg _)
|
| 41 |
+
_ = g^2 := one_mul _
|
| 42 |
+
have hC : bandConstant D≤g^5*V := by
|
| 43 |
+
have hh := mul_le_mul_of_nonneg_left hL (bandConstant_pos D).le
|
| 44 |
+
simp only [mul_one] at hh
|
| 45 |
+
exact hh.trans hmargin
|
| 46 |
+
have hCg := hC.trans (mul_le_mul_of_nonneg_right hg5 hV.le)
|
| 47 |
+
have hCg2 := hC.trans (mul_le_mul_of_nonneg_right hg52 hV.le)
|
| 48 |
+
have hCV := hCg.trans (by nlinarith only [hg01,hV] : g*V≤V)
|
| 49 |
+
have hl16 := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<16)
|
| 50 |
+
have hl18 := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<18)
|
| 51 |
+
have hl36 := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<36)
|
| 52 |
+
have hld := le_abs_self (Real.log D)
|
| 53 |
+
have hla := le_abs_self (Real.log (max D ((latticeBall (4*D)).card:ℝ)))
|
| 54 |
+
have ha := abs_nonneg (Real.log D)
|
| 55 |
+
have hb := abs_nonneg (Real.log (max D ((latticeBall (4*D)).card:ℝ)))
|
| 56 |
+
have hC640 : 640≤bandConstant D := by unfold bandConstant; linarith only [ha,hb]
|
| 57 |
+
apply entropyBand_from_suffix s pre post N l hD hg hg1 hU hL
|
| 58 |
+
· dsimp only [bandConstant] at hCg
|
| 59 |
+
linarith only [hCg,hl18,ha,hb]
|
| 60 |
+
· exact (mul_le_mul_of_nonneg_right hC640 (by linarith only [hL])).trans hmargin
|
| 61 |
+
· dsimp only [bandConstant] at hCg2
|
| 62 |
+
linarith only [hCg2,hl16,hla,ha,hb]
|
| 63 |
+
· dsimp only [bandConstant] at hCg
|
| 64 |
+
nlinarith only [hCg,hl36,hld,ha,hb]
|
| 65 |
+
· dsimp only [bandConstant] at hCV
|
| 66 |
+
linarith only [hCV,hl16,hld,ha,hb]
|
| 67 |
+
· exact hcap
|
| 68 |
+
· exact hpost
|
| 69 |
+
· exact hN
|
| 70 |
+
· exact hlen
|
| 71 |
+
· dsimp only [bandConstant] at hCg
|
| 72 |
+
linarith only [hCg,hl36,hld,ha,hb]
|
| 73 |
+
· exact hδ
|
| 74 |
+
|
| 75 |
+
open scoped BigOperators Classical
|
| 76 |
+
open Filter
|
| 77 |
+
|
| 78 |
+
theorem eventually_poly_le_exp (C : ℝ) {a : ℝ} (ha : 0<a) (d : ℕ) :
|
| 79 |
+
∀ᶠ y : ℝ in atTop, C*y^d≤a*Real.exp y := by
|
| 80 |
+
by_cases hC : 0<C
|
| 81 |
+
· have hh := (Real.isLittleO_pow_exp_atTop (n := d)).bound (div_pos ha hC)
|
| 82 |
+
filter_upwards [hh,eventually_ge_atTop (0:ℝ)] with y hy hy0
|
| 83 |
+
rw [Real.norm_of_nonneg (pow_nonneg hy0 _),Real.norm_of_nonneg (Real.exp_nonneg _)] at hy
|
| 84 |
+
have hm := mul_le_mul_of_nonneg_left hy hC.le
|
| 85 |
+
rwa [←mul_assoc,mul_div_cancel₀ _ hC.ne'] at hm
|
| 86 |
+
· filter_upwards [eventually_ge_atTop (0:ℝ)] with y hy
|
| 87 |
+
exact (mul_nonpos_of_nonpos_of_nonneg (le_of_not_gt hC) (pow_nonneg hy _)).trans
|
| 88 |
+
(mul_nonneg ha.le (Real.exp_nonneg _))
|
| 89 |
+
|
| 90 |
+
theorem eventually_linear_le_square (A B : ℝ) :
|
| 91 |
+
∀ᶠ y : ℝ in atTop, A*y+B≤y^2 := by
|
| 92 |
+
filter_upwards [eventually_ge_atTop (max (|A|+|B|+1) 1)] with y hy
|
| 93 |
+
have h1 : 1≤y := (le_max_right _ _).trans hy
|
| 94 |
+
have h2 : |A|+|B|+1≤y := (le_max_left _ _).trans hy
|
| 95 |
+
have h3 : A≤|A| := le_abs_self _
|
| 96 |
+
have h4 : B≤|B| := le_abs_self _
|
| 97 |
+
nlinarith only [h1,h2,h3,h4,abs_nonneg A,abs_nonneg B]
|
| 98 |
+
|
| 99 |
+
noncomputable def accurateGrid (m : ℕ) : ℝ := Real.exp (-((m:ℝ)^2))
|
| 100 |
+
def accurateIterations (m : ℕ) : ℕ := 4*m^2
|
| 101 |
+
|
| 102 |
+
lemma accurateGrid_pos (m : ℕ) : 0<accurateGrid m := Real.exp_pos _
|
| 103 |
+
|
| 104 |
+
lemma accurateGrid_le_one (m : ℕ) : accurateGrid m≤1 := by
|
| 105 |
+
exact Real.exp_le_one_iff.mpr (neg_nonpos.mpr (sq_nonneg _))
|
| 106 |
+
|
| 107 |
+
lemma accurateIterations_error (m : ℕ) :
|
| 108 |
+
(1/2:ℝ)^(accurateIterations m)+90*accurateGrid m≤91*accurateGrid m := by
|
| 109 |
+
have hl : (1/2:ℝ)≤Real.log 2 := by
|
| 110 |
+
have hh := Real.one_sub_inv_le_log_of_pos (by norm_num : (0:ℝ)<2)
|
| 111 |
+
norm_num at hh
|
| 112 |
+
exact hh
|
| 113 |
+
have he : (1/2:ℝ)^(accurateIterations m)≤accurateGrid m := by
|
| 114 |
+
rw [show (1/2:ℝ)=Real.exp (-Real.log 2) by rw [Real.exp_neg,Real.exp_log (by norm_num)]; norm_num]
|
| 115 |
+
rw [←Real.exp_nat_mul]
|
| 116 |
+
apply Real.exp_le_exp.mpr
|
| 117 |
+
simp only [accurateIterations,Nat.cast_mul,Nat.cast_pow,Nat.cast_ofNat]
|
| 118 |
+
nlinarith only [sq_nonneg (m:ℝ),hl]
|
| 119 |
+
linarith only [he]
|
| 120 |
+
|
| 121 |
+
lemma accurateGrid_scale (m : ℕ) (a : ℝ) :
|
| 122 |
+
bandScale (accurateGrid m) (Real.exp (a*Real.exp m)) (accurateIterations m)=
|
| 123 |
+
Real.exp (a*Real.exp m-8*(m:ℝ)^4) := by
|
| 124 |
+
unfold bandScale accurateGrid accurateIterations
|
| 125 |
+
rw [←Real.exp_nat_mul,←Real.exp_nat_mul,←Real.exp_add]
|
| 126 |
+
congr 1
|
| 127 |
+
push_cast
|
| 128 |
+
ring
|
| 129 |
+
|
| 130 |
+
theorem eventually_accurate_scale {a : ℝ} (ha : 0<a) (k : ℕ) :
|
| 131 |
+
∀ᶠ m : ℕ in atTop,
|
| 132 |
+
Real.exp ((a/2)*Real.exp m)≤(accurateGrid m)^k *
|
| 133 |
+
bandScale (accurateGrid m) (Real.exp (a*Real.exp m)) (accurateIterations m) := by
|
| 134 |
+
have h4 := eventually_poly_le_exp 8 (a := a/4) (by positivity) 4
|
| 135 |
+
have h2 := eventually_poly_le_exp (k:ℝ) (a := a/4) (by positivity) 2
|
| 136 |
+
have hh := (h4.and h2).filter_mono (show Filter.map ((↑) : ℕ → ℝ) atTop≤atTop from tendsto_natCast_atTop_atTop)
|
| 137 |
+
change ∀ᶠ m : ℕ in atTop, _ at hh
|
| 138 |
+
filter_upwards [hh] with m hm
|
| 139 |
+
rw [accurateGrid_scale]
|
| 140 |
+
unfold accurateGrid
|
| 141 |
+
rw [←Real.exp_nat_mul,←Real.exp_add]
|
| 142 |
+
apply Real.exp_le_exp.mpr
|
| 143 |
+
nlinarith only [hm.1,hm.2]
|
| 144 |
+
|
| 145 |
+
theorem eventually_accurate_error (C : ℝ) {ε : ℝ} (hε : 0<ε) :
|
| 146 |
+
∀ᶠ m : ℕ in atTop, 91*accurateGrid m*(C*Real.exp m)≤ε := by
|
| 147 |
+
by_cases hC : 0<C
|
| 148 |
+
· have hh := eventually_linear_le_square 1 (Real.log (91*C/ε))
|
| 149 |
+
have hh' := hh.filter_mono (show Filter.map ((↑) : ℕ → ℝ) atTop≤atTop from tendsto_natCast_atTop_atTop)
|
| 150 |
+
filter_upwards [hh'] with m hm
|
| 151 |
+
change 1*(m:ℝ)+Real.log (91*C/ε)≤(m:ℝ)^2 at hm
|
| 152 |
+
have he : Real.exp ((m:ℝ)-(m:ℝ)^2)≤ε/(91*C) := by
|
| 153 |
+
rw [←Real.exp_log (show 0<ε/(91*C) by positivity)]
|
| 154 |
+
apply Real.exp_le_exp.mpr
|
| 155 |
+
rw [Real.log_div (by positivity) (by positivity)]
|
| 156 |
+
rw [Real.log_div (by positivity) hε.ne'] at hm
|
| 157 |
+
linarith only [hm]
|
| 158 |
+
have hmul := (le_div_iff₀ (show 0<91*C by positivity)).mp he
|
| 159 |
+
unfold accurateGrid
|
| 160 |
+
rw [show 91*Real.exp (-((m:ℝ)^2))*(C*Real.exp m)=
|
| 161 |
+
Real.exp ((m:ℝ)-(m:ℝ)^2)*(91*C) by rw [Real.exp_sub,Real.exp_neg]; ring]
|
| 162 |
+
exact hmul
|
| 163 |
+
· filter_upwards [] with m
|
| 164 |
+
have : C*Real.exp (m:ℝ)≤0 := mul_nonpos_of_nonpos_of_nonneg (le_of_not_gt hC) (Real.exp_nonneg _)
|
| 165 |
+
exact (mul_nonpos_of_nonneg_of_nonpos (by exact mul_nonneg (by norm_num) (accurateGrid_pos m).le : 0≤91*accurateGrid m) this).trans hε.le
|
| 166 |
+
|
| 167 |
+
end
|
| 168 |
+
|
| 169 |
+
section
|
| 170 |
+
open scoped BigOperators Classical
|
| 171 |
+
open Filter
|
| 172 |
+
|
| 173 |
+
lemma eventually_const_le_exp_mul {a : ℝ} (ha : 0<a) (C : ℝ) :
|
| 174 |
+
∀ᶠ m : ℕ in atTop, C≤a*Real.exp m := by
|
| 175 |
+
have hh : Tendsto (fun m : ℕ => Real.exp (m:ℝ)*a) atTop atTop :=
|
| 176 |
+
(Real.tendsto_exp_atTop.comp tendsto_natCast_atTop_atTop).atTop_mul_const ha
|
| 177 |
+
simpa only [mul_comm] using hh.eventually (eventually_ge_atTop C)
|
| 178 |
+
|
| 179 |
+
lemma eventually_mul_le_double_exp {a : ℝ} (ha : 0<a) (C : ℝ) :
|
| 180 |
+
∀ᶠ m : ℕ in atTop, C*Real.exp m≤Real.exp (a*Real.exp m) := by
|
| 181 |
+
have hh := eventually_poly_le_exp (C/a) (a := 1) (by norm_num) 1
|
| 182 |
+
have ht : Tendsto (fun m : ℕ => a*Real.exp m) atTop atTop := by
|
| 183 |
+
simpa only [Function.comp_apply] using Filter.Tendsto.const_mul_atTop ha
|
| 184 |
+
(Real.tendsto_exp_atTop.comp (tendsto_natCast_atTop_atTop (R := ℝ)))
|
| 185 |
+
filter_upwards [ht.eventually hh] with m hm
|
| 186 |
+
simpa only [pow_one,one_mul,←mul_assoc,div_mul_cancel₀ _ ha.ne'] using hm
|
| 187 |
+
|
| 188 |
+
lemma eventually_accurate_small {ε : ℝ} (hε : 0<ε) :
|
| 189 |
+
∀ᶠ m : ℕ in atTop, accurateGrid m≤ε := by
|
| 190 |
+
have hh := eventually_linear_le_square 0 (-Real.log ε)
|
| 191 |
+
filter_upwards [tendsto_natCast_atTop_atTop.eventually hh] with m hm
|
| 192 |
+
change 0*(m:ℝ)-Real.log ε≤(m:ℝ)^2 at hm
|
| 193 |
+
unfold accurateGrid
|
| 194 |
+
rw [←Real.exp_log hε]
|
| 195 |
+
apply Real.exp_le_exp.mpr
|
| 196 |
+
linarith only [hm]
|
| 197 |
+
|
| 198 |
+
lemma dense_sieve_cap (s : SplitSieve) (hne : s.primes.Nonempty) {T δ U : ℝ}
|
| 199 |
+
(hT : 2≤T)
|
| 200 |
+
(hp : ∀ p∈s.primes, T≤(p:ℝ) ∧ (p:ℝ)≤2*T)
|
| 201 |
+
(hdense : δ*T/Real.log (2*T)≤ s.primes.card)
|
| 202 |
+
(hsize : 2*U≤δ*T) : ⌊U/s.meanLog⌋₊≤ s.primes.card := by
|
| 203 |
+
have hT0 : 0<T := by linarith only [hT]
|
| 204 |
+
have hlogT : 0<Real.log T := Real.log_pos (by linarith only [hT])
|
| 205 |
+
have hm := s.meanLog_bounds hne hT0 hp
|
| 206 |
+
have hmean : 0<s.meanLog := hlogT.trans_le hm.1
|
| 207 |
+
have hl2 : Real.log 2≤Real.log T := Real.log_le_log (by norm_num) hT
|
| 208 |
+
have hhlog : Real.log (2*T)≤2*s.meanLog := by
|
| 209 |
+
rw [Real.log_mul (by norm_num) hT0.ne']
|
| 210 |
+
linarith only [hl2,hm.1]
|
| 211 |
+
have hlo : 0<Real.log (2*T) := Real.log_pos (by linarith only [hT])
|
| 212 |
+
have hd : δ*T≤(s.primes.card:ℝ)*Real.log (2*T) := (div_le_iff₀ hlo).mp hdense
|
| 213 |
+
have hk : δ*T≤(s.primes.card:ℝ)*(2*s.meanLog) := hd.trans
|
| 214 |
+
(mul_le_mul_of_nonneg_left hhlog (Nat.cast_nonneg _))
|
| 215 |
+
apply Nat.floor_le_of_le
|
| 216 |
+
apply (div_le_iff₀ hmean).mpr
|
| 217 |
+
nlinarith only [hsize,hk]
|
| 218 |
+
|
| 219 |
+
theorem eventually_accurate_band {D A B a b δ : ℝ}
|
| 220 |
+
(hD : 1≤D) (hA : 0<A) (ha : 0<a) (haA : a<A)
|
| 221 |
+
(hba : b≤a/2) (hδ : 0<δ) :
|
| 222 |
+
∀ᶠ m : ℕ in atTop, ∀ (s : SplitSieve) (T : ℝ) (pre post : List ℕ) (N : ℕ),
|
| 223 |
+
s.primes.Nonempty →
|
| 224 |
+
(∀ p∈s.primes, T≤(p:ℝ) ∧ (p:ℝ)≤2*T) →
|
| 225 |
+
δ*T/Real.log (2*T)≤ s.primes.card →
|
| 226 |
+
Real.exp (A*Real.exp m)≤T → Real.log T≤B*Real.exp m →
|
| 227 |
+
(∀ n∈post, (n:ℝ)≤Real.exp (Real.exp (b*Real.exp m))) →
|
| 228 |
+
(N:ℝ)≤Real.exp (Real.exp (b*Real.exp m)) →
|
| 229 |
+
(post.length+2:ℝ)≤Real.exp (Real.exp (b*Real.exp m)) →
|
| 230 |
+
Nonempty (EntropyBand s D
|
| 231 |
+
(pre++List.ofFn (fun i : Fin (accurateIterations m) =>
|
| 232 |
+
bandLength (accurateGrid m) (Real.exp (a*Real.exp m)) i.val)++post)
|
| 233 |
+
N (bandSize s (accurateGrid m) (Real.exp (a*Real.exp m)) (accurateIterations m))
|
| 234 |
+
(91*accurateGrid m)) := by
|
| 235 |
+
have hlarge := eventually_mul_le_double_exp (a := a/2) (by positivity)
|
| 236 |
+
(bandConstant D*(B+1))
|
| 237 |
+
have hgap := eventually_const_le_exp_mul (a := A-a) (by linarith only [haA]) (Real.log (2/δ))
|
| 238 |
+
have htwo := eventually_const_le_exp_mul hA 2
|
| 239 |
+
filter_upwards [eventually_accurate_scale ha 5,eventually_accurate_scale ha 1,
|
| 240 |
+
eventually_accurate_small (show (0:ℝ)<1/200 by norm_num),hlarge,hgap,htwo]
|
| 241 |
+
with m hm5 hm1 hsmall hlarge hgap htwo
|
| 242 |
+
intro s T pre post N hne hp hdense hT hThi hpost hN hlen
|
| 243 |
+
have he1 : 1≤Real.exp (m:ℝ) := Real.one_le_exp_iff.mpr (Nat.cast_nonneg _)
|
| 244 |
+
have hT0 : 0<T := (Real.exp_pos _).trans_le hT
|
| 245 |
+
have hT2 : 2≤T := by
|
| 246 |
+
have hh := Real.add_one_le_exp (A*Real.exp m)
|
| 247 |
+
linarith only [hh,htwo,hT]
|
| 248 |
+
have hm := s.meanLog_bounds hne hT0 hp
|
| 249 |
+
have hmean : 1≤ s.meanLog := by
|
| 250 |
+
have hh := Real.log_le_log (Real.exp_pos _) hT
|
| 251 |
+
rw [Real.log_exp] at hh
|
| 252 |
+
linarith only [hh,hm.1,htwo]
|
| 253 |
+
have hl2 : Real.log 2≤1 := by
|
| 254 |
+
have hh := Real.log_le_sub_one_of_pos (by norm_num : (0:ℝ)<2)
|
| 255 |
+
linarith only [hh]
|
| 256 |
+
have hmean' : s.meanLog≤(B+1)*Real.exp m := by
|
| 257 |
+
rw [Real.log_mul (by norm_num) hT0.ne'] at hm
|
| 258 |
+
nlinarith only [hm.2,hThi,hl2,he1]
|
| 259 |
+
have hmargin := (mul_le_mul_of_nonneg_left hmean' (bandConstant_pos D).le).trans
|
| 260 |
+
(by simpa only [mul_assoc] using hlarge.trans hm5)
|
| 261 |
+
have hsize : 2*Real.exp (a*Real.exp m)≤δ*T := by
|
| 262 |
+
have he : Real.exp (a*Real.exp m+Real.log (2/δ))≤Real.exp (A*Real.exp m) := by
|
| 263 |
+
apply Real.exp_le_exp.mpr
|
| 264 |
+
nlinarith only [hgap]
|
| 265 |
+
rw [Real.exp_add,Real.exp_log (div_pos (by norm_num) hδ)] at he
|
| 266 |
+
have hh := mul_le_mul_of_nonneg_left (he.trans hT) hδ.le
|
| 267 |
+
have heq : δ*(Real.exp (a*Real.exp m)*(2/δ))=2*Real.exp (a*Real.exp m) := by field_simp
|
| 268 |
+
rwa [heq] at hh
|
| 269 |
+
have hcap := dense_sieve_cap s hne hT2 hp hdense hsize
|
| 270 |
+
have htail : Real.exp (b*Real.exp m)≤accurateGrid m*
|
| 271 |
+
bandScale (accurateGrid m) (Real.exp (a*Real.exp m)) (accurateIterations m) := by
|
| 272 |
+
simpa only [pow_one] using ((Real.exp_le_exp.mpr
|
| 273 |
+
(mul_le_mul_of_nonneg_right hba (Real.exp_nonneg _))).trans hm1)
|
| 274 |
+
exact entropyBand_from_margin s pre post N (accurateIterations m) hD (accurateGrid_pos m)
|
| 275 |
+
hsmall (Real.exp_pos _) hmean hmargin hcap
|
| 276 |
+
(fun n hn => (hpost n hn).trans (Real.exp_le_exp.mpr htail))
|
| 277 |
+
(hN.trans (Real.exp_le_exp.mpr htail)) (hlen.trans (Real.exp_le_exp.mpr htail))
|
| 278 |
+
(accurateIterations_error m)
|
| 279 |
+
|
| 280 |
+
end
|
| 281 |
+
|
| 282 |
+
open scoped BigOperators Classical
|
| 283 |
+
|
| 284 |
+
lemma EntropyBand.size_cap {s : SplitSieve} {D δ : ℝ} {ns : List ℕ} {N b : ℕ}
|
| 285 |
+
(q : EntropyBand s D ns N b δ) (hmean : 0< s.meanLog) : b≤ s.primes.card := by
|
| 286 |
+
rw [q.size]
|
| 287 |
+
apply le_trans _ q.cap
|
| 288 |
+
apply Nat.floor_mono
|
| 289 |
+
apply div_le_div_of_nonneg_right _ hmean.le
|
| 290 |
+
have hh := bandScale_antitone q.positive.le (by linarith only [q.small]) q.scale.le (Nat.zero_le q.l)
|
| 291 |
+
simpa only [bandScale,pow_zero,one_mul] using hh
|
| 292 |
+
|
| 293 |
+
lemma EntropyBand.size_lower {s : SplitSieve} {D δ : ℝ} {ns : List ℕ} {N b : ℕ}
|
| 294 |
+
(q : EntropyBand s D ns N b δ) (hmean : 0< s.meanLog) :
|
| 295 |
+
bandScale q.g q.U q.l/2≤(b:ℝ)*s.meanLog := by
|
| 296 |
+
have hV := bandScale_pos q.positive q.scale q.l
|
| 297 |
+
have hg5 : q.g^5≤1 := pow_le_one₀ q.positive.le (by linarith only [q.small])
|
| 298 |
+
have hh := mul_le_mul_of_nonneg_right hg5 hV.le
|
| 299 |
+
have hlarge := q.large
|
| 300 |
+
have hVL : 2*s.meanLog≤bandScale q.g q.U q.l := by nlinarith only [hh,hlarge,hmean]
|
| 301 |
+
have hf := Nat.lt_floor_add_one (bandScale q.g q.U q.l/s.meanLog)
|
| 302 |
+
have hm := mul_lt_mul_of_pos_right hf hmean
|
| 303 |
+
rw [div_mul_cancel₀ _ hmean.ne',add_mul,one_mul] at hm
|
| 304 |
+
have ht : bandScale q.g q.U q.l/2≤(⌊bandScale q.g q.U q.l/s.meanLog⌋₊:ℝ)*s.meanLog := by
|
| 305 |
+
linarith only [hm,hVL]
|
| 306 |
+
simpa only [q.size,bandSize] using ht
|
| 307 |
+
|
| 308 |
+
lemma EntropyBand.size_pos {s : SplitSieve} {D δ : ℝ} {ns : List ℕ} {N b : ℕ}
|
| 309 |
+
(q : EntropyBand s D ns N b δ) (hmean : 0< s.meanLog) : 0<b := by
|
| 310 |
+
have hh := q.size_lower hmean
|
| 311 |
+
have hV := bandScale_pos q.positive q.scale q.l
|
| 312 |
+
by_contra h
|
| 313 |
+
have hb : b=0 := by omega
|
| 314 |
+
have he : (b:ℝ)=0 := by exact_mod_cast hb
|
| 315 |
+
rw [he,zero_mul] at hh
|
| 316 |
+
linarith only [hh,hV]
|
| 317 |
+
|
| 318 |
+
lemma bandSize_lower_of_scale {s : SplitSieve} {g U C T : ℝ} {l : ℕ}
|
| 319 |
+
(hmean : 0< s.meanLog) (hlog : 0<Real.log T)
|
| 320 |
+
(hm : s.meanLog≤2*Real.log T)
|
| 321 |
+
(hV : 2*s.meanLog≤bandScale g U l)
|
| 322 |
+
(hscale : C*T≤bandScale g U l) :
|
| 323 |
+
C*T/(4*Real.log T)≤(bandSize s g U l:ℝ) := by
|
| 324 |
+
have hf := Nat.lt_floor_add_one (bandScale g U l/s.meanLog)
|
| 325 |
+
have hh := mul_lt_mul_of_pos_right hf hmean
|
| 326 |
+
rw [div_mul_cancel₀ _ hmean.ne',add_mul,one_mul] at hh
|
| 327 |
+
have hlo : bandScale g U l/2≤(bandSize s g U l:ℝ)*s.meanLog := by
|
| 328 |
+
change _≤(⌊bandScale g U l/s.meanLog⌋₊:ℝ)*_
|
| 329 |
+
linarith only [hh,hV]
|
| 330 |
+
have hu := mul_le_mul_of_nonneg_left hm (Nat.cast_nonneg (bandSize s g U l))
|
| 331 |
+
apply (div_le_iff₀ (by positivity)).mpr
|
| 332 |
+
nlinarith only [hlo,hu,hscale]
|
| 333 |
+
|
| 334 |
+
end GaussianMoat
|
| 335 |
+
|
| 336 |
+
end OAI
|
lean/OAI/NumberTheory/GaussianMoat/BackwardCoverage.lean
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.GaussianMoat.GroupCoverage
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
universe uOmega uAlpha uBeta uIota uCapitalGamma uGroup
|
| 6 |
+
|
| 7 |
+
namespace GaussianMoat
|
| 8 |
+
open scoped BigOperators Classical
|
| 9 |
+
namespace FinLaw
|
| 10 |
+
variable {Ω : Type uOmega} {α : Type uAlpha} {β : Type uBeta} [Fintype Ω] [Fintype α] [Fintype β]
|
| 11 |
+
|
| 12 |
+
lemma short_list_probability_deficit (p : FinLaw Ω) (X : Ω → α) (C : Ω → β)
|
| 13 |
+
(L : β → Finset α) {b : ℝ} (hb : 1 ≤ b) :
|
| 14 |
+
let a := p.prob (fun ω => X ω ∈ L (C ω) ∧ ((L (C ω)).card:ℝ) ≤ b)
|
| 15 |
+
a*(Real.log (Fintype.card α)-Real.log b)-Real.binEntropy a ≤
|
| 16 |
+
Real.log (Fintype.card α)-p.cHf X C := by
|
| 17 |
+
dsimp only
|
| 18 |
+
have hh := p.short_list_deficit X C L
|
| 19 |
+
(fun ω => decide (X ω ∈ L (C ω) ∧ ((L (C ω)).card:ℝ) ≤ b)) hb
|
| 20 |
+
(fun ω _ he => of_decide_eq_true he)
|
| 21 |
+
have ha : (p.map (fun ω => decide (X ω ∈ L (C ω) ∧ ((L (C ω)).card:ℝ) ≤ b))) true =
|
| 22 |
+
p.prob (fun ω => X ω ∈ L (C ω) ∧ ((L (C ω)).card:ℝ) ≤ b) := by
|
| 23 |
+
simp only [map_mass,decide_eq_true_eq,prob]
|
| 24 |
+
apply Finset.sum_congr rfl
|
| 25 |
+
intro ω _
|
| 26 |
+
split_ifs <;> rfl
|
| 27 |
+
rw [ha] at hh
|
| 28 |
+
simpa only [condH,← Hf_eq_H,cHf] using hh
|
| 29 |
+
|
| 30 |
+
lemma average_deficit_lower {ι : Type uIota} [Fintype ι] (w : FinLaw ι)
|
| 31 |
+
(a d : ι → ℝ) {a₀ v : ℝ} (ha : ∀ i, a i ∈ Set.Icc (0:ℝ) 1)
|
| 32 |
+
(ha₀ : 0 < a₀) (hav : a₀ ≤ ∑ i, w i*a i)
|
| 33 |
+
(hv : 2*(1-Real.log a₀) ≤ v)
|
| 34 |
+
(hdef : ∀ i, a i*v-Real.binEntropy (a i) ≤ d i) :
|
| 35 |
+
a₀*v/2 ≤ ∑ i, w i*d i := by
|
| 36 |
+
let A := ∑ i, w i*a i
|
| 37 |
+
have hA : 0 < A := lt_of_lt_of_le ha₀ hav
|
| 38 |
+
have hA1 : A ≤ 1 := by
|
| 39 |
+
have hh := Finset.sum_le_sum (s := Finset.univ) (fun i _ =>
|
| 40 |
+
mul_le_mul_of_nonneg_left (ha i).2 (w.nonneg i))
|
| 41 |
+
simpa only [mul_one,w.sum_one] using hh
|
| 42 |
+
have ha₀1 : a₀ ≤ 1 := hav.trans hA1
|
| 43 |
+
have hl : Real.log a₀ ≤ Real.log A := Real.log_le_log ha₀ hav
|
| 44 |
+
have hl0 : Real.log a₀ ≤ 0 := Real.log_nonpos ha₀.le ha₀1
|
| 45 |
+
have hv0 : 0 ≤ v := by linarith only [hv,hl0]
|
| 46 |
+
have hh := w.binEntropy_sum_le a ha
|
| 47 |
+
have hp := binEntropy_le_log_inverse hA hA1
|
| 48 |
+
have hdl := Finset.sum_le_sum (s := Finset.univ) (fun i _ =>
|
| 49 |
+
mul_le_mul_of_nonneg_left (hdef i) (w.nonneg i))
|
| 50 |
+
rw [show (∑ i, w i*(a i*v-Real.binEntropy (a i))) =
|
| 51 |
+
A*v-∑ i, w i*Real.binEntropy (a i) by
|
| 52 |
+
simp only [mul_sub,Finset.sum_sub_distrib,← mul_assoc,← Finset.sum_mul,A]] at hdl
|
| 53 |
+
have hlog := mul_le_mul_of_nonneg_left hl hA.le
|
| 54 |
+
have hmult := mul_le_mul_of_nonneg_left hv hA.le
|
| 55 |
+
have ham := mul_le_mul_of_nonneg_right hav hv0
|
| 56 |
+
change (∑ i, w i*Real.binEntropy (a i)) ≤ Real.binEntropy A at hh
|
| 57 |
+
nlinarith only [hdl,hh,hp,hlog,hmult,ham]
|
| 58 |
+
|
| 59 |
+
theorem shared_coverage_deficit {Γ : Type uCapitalGamma} {G : Type uGroup} [Fintype Γ] [Fintype G] [AddCommGroup G]
|
| 60 |
+
(p : FinLaw Ω) (q : Ω → FinLaw Γ) (Y : Ω → G) (h : Γ → G)
|
| 61 |
+
(K : Finset G) (hK : K.Nonempty) (E : Ω → Finset G) (Bad : Ω → Prop)
|
| 62 |
+
{τ δ ε b : ℝ} {n : ℕ} (hn : 0<n)
|
| 63 |
+
(hτ : 0≤τ) (hτ1 : τ≤3/8) (hδ : 0<δ) (hδ1 : δ≤1/64)
|
| 64 |
+
(hε : 0≤ε) (hb : 1≤b)
|
| 65 |
+
(hp : (p.joint q).prob (fun v => Y v.1+h v.2∈K) ≤ τ*K.card/(Fintype.card G:ℝ))
|
| 66 |
+
(hq : ∀ ω, ¬ Bad ω → ∀ y ∉ E ω, (τ+4*δ)/(Fintype.card G:ℝ) ≤ (q ω).map h y)
|
| 67 |
+
(hE : ∀ ω, ¬ Bad ω → ((E ω).card:ℝ)/δ≤b)
|
| 68 |
+
(herr : (Fintype.card G:ℝ)*Real.exp (-(n:ℝ)*δ^2*K.card/(2*(Fintype.card G:ℝ)))≤ε) :
|
| 69 |
+
let P := p.joint (fun ω => (q ω).iid n)
|
| 70 |
+
let L := fun v : Fin n → Γ => coverageList K n τ δ (fun i => h (v i))
|
| 71 |
+
let a := P.prob (fun v => Y v.1 ∈ L v.2 ∧ ((L v.2).card:ℝ)≤b)
|
| 72 |
+
δ/(τ+δ)-p.prob Bad-ε ≤ a ∧
|
| 73 |
+
a*(Real.log (Fintype.card G)-Real.log b)-Real.binEntropy a ≤
|
| 74 |
+
Real.log (Fintype.card G)-P.cHf (fun v => Y v.1) Prod.snd := by
|
| 75 |
+
dsimp only
|
| 76 |
+
constructor
|
| 77 |
+
· have htrue := p.true_coverageList_probability q Y h K hK hτ hδ hn hp
|
| 78 |
+
have hsize := p.coverageList_size_probability q h K hK E Bad hτ hτ1 hδ hδ1 hε n hq hE herr
|
| 79 |
+
have hi := (p.joint (fun ω => (q ω).iid n)).prob_inter_ge
|
| 80 |
+
(fun v => Y v.1 ∈ coverageList K n τ δ (fun i => h (v.2 i)))
|
| 81 |
+
(fun v => ((coverageList K n τ δ (fun i => h (v.2 i))).card:ℝ)≤b)
|
| 82 |
+
simp only [not_le] at hi
|
| 83 |
+
linarith only [htrue,hsize,hi]
|
| 84 |
+
· exact short_list_probability_deficit (p.joint (fun ω => (q ω).iid n))
|
| 85 |
+
(fun v => Y v.1) Prod.snd
|
| 86 |
+
(fun v => coverageList K n τ δ (fun i => h (v i))) hb
|
| 87 |
+
|
| 88 |
+
end FinLaw
|
| 89 |
+
|
| 90 |
+
lemma perm_expect_apply {ι : Type uIota} [Fintype ι] [DecidableEq ι] (f : ι → ℝ) (i : ι) :
|
| 91 |
+
(𝔼 π : Equiv.Perm ι, f (π i)) = 𝔼 j, f j := by
|
| 92 |
+
let : Nonempty ι := ⟨i⟩
|
| 93 |
+
calc
|
| 94 |
+
_ = 𝔼 j : ι, 𝔼 π : Equiv.Perm ι, f (π j) := by
|
| 95 |
+
rw [show (fun j : ι => 𝔼 π : Equiv.Perm ι, f (π j)) =
|
| 96 |
+
(fun _ => 𝔼 π : Equiv.Perm ι, f (π i)) by
|
| 97 |
+
funext j; exact perm_expect_exchange f j i]
|
| 98 |
+
simp only [Fintype.expect_const]
|
| 99 |
+
_ = 𝔼 π : Equiv.Perm ι, 𝔼 j : ι, f (π j) := Finset.expect_comm _ _ _
|
| 100 |
+
_ = _ := by
|
| 101 |
+
have he (π : Equiv.Perm ι) : (𝔼 j, f (π j)) = 𝔼 j, f j :=
|
| 102 |
+
Fintype.expect_equiv π _ _ (fun _ => rfl)
|
| 103 |
+
simp only [he,Fintype.expect_const]
|
| 104 |
+
|
| 105 |
+
namespace FinLaw
|
| 106 |
+
variable {Ω : Type uOmega} {α : Type uAlpha} {β : Type uBeta} [Fintype Ω] {k : ℕ}
|
| 107 |
+
|
| 108 |
+
lemma Hf_sub_le_cHf (p : FinLaw Ω) (X : Ω → α) (Y : Ω → β) :
|
| 109 |
+
p.Hf X-p.Hf Y ≤ p.cHf X Y := by
|
| 110 |
+
have h := p.Hf_pair_ge_snd Y X
|
| 111 |
+
rw [p.Hf_pair_comm Y X] at h
|
| 112 |
+
exact sub_le_sub_right h _
|
| 113 |
+
|
| 114 |
+
lemma orderedEntropy_conditioning (p : FinLaw Ω) (X : Ω → Fin k → α)
|
| 115 |
+
(C : Ω → β) {b : ℕ} (hb : b ≤ k) :
|
| 116 |
+
p.orderedEntropy X b-p.Hf C ≤
|
| 117 |
+
b*(𝔼 i : Fin k, p.cHf (fun ω => X ω i) C) := by
|
| 118 |
+
have hh (π : Equiv.Perm (Fin k)) :
|
| 119 |
+
p.Hf (prefixVar X π b)-p.Hf C ≤
|
| 120 |
+
∑ i : Fin b, p.cHf (fun ω => X ω (π ⟨i.val,lt_of_lt_of_le i.isLt hb⟩)) C := by
|
| 121 |
+
apply (p.Hf_sub_le_cHf _ C).trans
|
| 122 |
+
apply (p.cHf_le_of_determined _
|
| 123 |
+
(fun ω (i : Fin b) => X ω (π ⟨i.val,lt_of_lt_of_le i.isLt hb⟩)) C ?_).trans
|
| 124 |
+
(p.cHf_fintype_subadd _ C)
|
| 125 |
+
intro ω ν hx _
|
| 126 |
+
funext i
|
| 127 |
+
by_cases hi : i.val<b
|
| 128 |
+
· simpa only [prefixVar,hi,ite_eq_left] using congrArg some (congrFun hx ⟨i.val,hi⟩)
|
| 129 |
+
· simp only [prefixVar,hi,ite_false]
|
| 130 |
+
have hav := Finset.expect_le_expect (s := Finset.univ) (fun π _ => hh π)
|
| 131 |
+
have he (i : Fin b) :
|
| 132 |
+
(𝔼 π : Equiv.Perm (Fin k), p.cHf (fun ω => X ω (π ⟨i.val,lt_of_lt_of_le i.isLt hb⟩)) C) =
|
| 133 |
+
𝔼 j : Fin k, p.cHf (fun ω => X ω j) C :=
|
| 134 |
+
perm_expect_apply (fun j => p.cHf (fun ω => X ω j) C) _
|
| 135 |
+
simpa only [orderedEntropy,Finset.expect_sub_distrib,Fintype.expect_const,
|
| 136 |
+
Finset.expect_sum_comm,he,Finset.sum_const,Finset.card_univ,
|
| 137 |
+
Fintype.card_fin,nsmul_eq_mul] using hav
|
| 138 |
+
|
| 139 |
+
lemma signedEntropy_conditioning (p : FinLaw Ω) (X : (Fin k → Bool) → Ω → Fin k → α)
|
| 140 |
+
(C : Ω → β) {b : ℕ} (hb : b ≤ k) :
|
| 141 |
+
p.signedEntropy X b-p.Hf C ≤
|
| 142 |
+
b*(𝔼 σ : Fin k → Bool, 𝔼 i : Fin k, p.cHf (fun ω => X σ ω i) C) := by
|
| 143 |
+
have h := Finset.expect_le_expect (s := Finset.univ) (fun σ _ =>
|
| 144 |
+
p.orderedEntropy_conditioning (X σ) C hb)
|
| 145 |
+
simpa only [signedEntropy,Finset.expect_sub_distrib,Fintype.expect_const,
|
| 146 |
+
Finset.mul_expect] using h
|
| 147 |
+
|
| 148 |
+
end FinLaw
|
| 149 |
+
|
| 150 |
+
theorem SplitSieve.coverage_conditioning {Ω : Type uOmega} {β : Type uBeta} [Fintype Ω]
|
| 151 |
+
(s : SplitSieve) (p : FinLaw Ω) (Y : Ω → GaussianInt) (C : Ω → β)
|
| 152 |
+
{b : ℕ} (hb : b ≤ s.primes.card) :
|
| 153 |
+
s.pointEntropy p Y b-p.Hf C ≤
|
| 154 |
+
b*(𝔼 σ : Fin s.primes.card → Bool, 𝔼 i : Fin s.primes.card,
|
| 155 |
+
p.cHf (fun ω => s.residueVector σ (Y ω) i) C) :=
|
| 156 |
+
p.signedEntropy_conditioning _ C hb
|
| 157 |
+
|
| 158 |
+
namespace FinLaw
|
| 159 |
+
|
| 160 |
+
section
|
| 161 |
+
|
| 162 |
+
theorem backward_coverage_step {Ω : Type uOmega} {Γ : Type uCapitalGamma} {ι : Type uIota} [Fintype Ω] [Fintype Γ] [Fintype ι]
|
| 163 |
+
(G : ι → Type uGroup) [∀ i, Fintype (G i)] [∀ i, AddCommGroup (G i)]
|
| 164 |
+
(w : FinLaw ι) (p : FinLaw Ω) (q : Ω → FinLaw Γ)
|
| 165 |
+
(Y : (i : ι) → Ω → G i) (h : (i : ι) → Γ → G i)
|
| 166 |
+
(Bad₀ : ι → Prop) (Bad₁ : ι → Ω → Prop)
|
| 167 |
+
(K : (i : ι) → Finset (G i)) (E : (i : ι) → Ω → Finset (G i))
|
| 168 |
+
(b : ι → ℝ) {τ δ ε η η' e v : ℝ} {n : ℕ}
|
| 169 |
+
(hn : 0 < n) (hτ : 0 ≤ τ) (hτ1 : τ ≤ 3/8)
|
| 170 |
+
(hδ : 0 < δ) (hδ1 : δ ≤ 1/64) (hε : 0 ≤ ε) (hη : 0 < η)
|
| 171 |
+
(hnext : ∑ i, w i*p.prob (Bad₁ i) ≤ η')
|
| 172 |
+
(hsmall : η'+ε ≤ η*δ/2)
|
| 173 |
+
(hscale : 2*(1-Real.log (η*δ/2)) ≤ v)
|
| 174 |
+
(hgap : e < η*δ*v/4)
|
| 175 |
+
(hdata : (∑ i, w i*(Real.log (Fintype.card (G i))-
|
| 176 |
+
(p.joint (fun ω => (q ω).iid n)).cHf (fun x => Y i x.1) Prod.snd)) ≤ e)
|
| 177 |
+
(hK : ∀ i, Bad₀ i → (K i).Nonempty)
|
| 178 |
+
(hb : ∀ i, Bad₀ i → 1 ≤ b i)
|
| 179 |
+
(hv : ∀ i, Bad₀ i → v ≤ Real.log (Fintype.card (G i))-Real.log (b i))
|
| 180 |
+
(hp : ∀ i, Bad₀ i → (p.joint q).prob (fun x => Y i x.1+h i x.2 ∈ K i) ≤
|
| 181 |
+
τ*(K i).card/(Fintype.card (G i):ℝ))
|
| 182 |
+
(hq : ∀ i, Bad₀ i → ∀ ω, ¬Bad₁ i ω → ∀ y ∉ E i ω,
|
| 183 |
+
(τ+4*δ)/(Fintype.card (G i):ℝ) ≤ (q ω).map (h i) y)
|
| 184 |
+
(hE : ∀ i, Bad₀ i → ∀ ω, ¬Bad₁ i ω → ((E i ω).card:ℝ)/δ ≤ b i)
|
| 185 |
+
(herr : ∀ i, Bad₀ i → (Fintype.card (G i):ℝ)*
|
| 186 |
+
Real.exp (-(n:ℝ)*δ^2*(K i).card/(2*(Fintype.card (G i):ℝ))) ≤ ε) :
|
| 187 |
+
w.prob Bad₀ ≤ η := by
|
| 188 |
+
let P := p.joint (fun ω => (q ω).iid n)
|
| 189 |
+
let L := fun i (x : Fin n → Γ) => coverageList (K i) n τ δ (fun j => h i (x j))
|
| 190 |
+
let a := fun i => if Bad₀ i then P.prob
|
| 191 |
+
(fun x => Y i x.1 ∈ L i x.2 ∧ ((L i x.2).card:ℝ) ≤ b i) else 0
|
| 192 |
+
let d := fun i => Real.log (Fintype.card (G i))-P.cHf (fun x => Y i x.1) Prod.snd
|
| 193 |
+
have hd (i : ι) : 0 ≤ d i := by
|
| 194 |
+
exact sub_nonneg.mpr ((P.cHf_le_Hf _ _).trans (P.Hf_le_log_card_type _))
|
| 195 |
+
have ha (i : ι) : a i ∈ Set.Icc (0:ℝ) 1 := by
|
| 196 |
+
dsimp only [a]
|
| 197 |
+
split_ifs
|
| 198 |
+
· exact ⟨P.prob_nonneg _,P.prob_le_one _⟩
|
| 199 |
+
· norm_num
|
| 200 |
+
have hstep (i : ι) (hi : Bad₀ i) :
|
| 201 |
+
δ-p.prob (Bad₁ i)-ε ≤ a i ∧ a i*v-Real.binEntropy (a i) ≤ d i := by
|
| 202 |
+
have hh := shared_coverage_deficit p q (Y i) (h i) (K i) (hK i hi) (E i) (Bad₁ i)
|
| 203 |
+
hn hτ hτ1 hδ hδ1 hε (hb i hi) (hp i hi) (hq i hi) (hE i hi) (herr i hi)
|
| 204 |
+
dsimp only at hh
|
| 205 |
+
have hh' : δ/(τ+δ)-p.prob (Bad₁ i)-ε ≤ a i ∧
|
| 206 |
+
a i*(Real.log (Fintype.card (G i))-Real.log (b i))-Real.binEntropy (a i) ≤ d i := by
|
| 207 |
+
simpa only [a,hi,ite_eq_left,P,L,d] using hh
|
| 208 |
+
constructor
|
| 209 |
+
· have htd : 0 < τ+δ := by linarith only [hτ,hδ]
|
| 210 |
+
have htd1 : τ+δ ≤ 1 := by linarith only [hτ1,hδ1]
|
| 211 |
+
have hfrac : δ ≤ δ/(τ+δ) := (le_div_iff₀ htd).mpr (by nlinarith only [htd1,hδ])
|
| 212 |
+
linarith only [hh'.1,hfrac]
|
| 213 |
+
· have hm := mul_le_mul_of_nonneg_left (hv i hi) (ha i).1
|
| 214 |
+
linarith only [hh'.2,hm]
|
| 215 |
+
have hl (i : ι) : δ*(if Bad₀ i then (1:ℝ) else 0)-p.prob (Bad₁ i)-ε ≤ a i := by
|
| 216 |
+
by_cases hi : Bad₀ i
|
| 217 |
+
· simpa only [hi,ite_true,mul_one] using (hstep i hi).1
|
| 218 |
+
· simp only [hi,ite_false,mul_zero,a]
|
| 219 |
+
linarith only [p.prob_nonneg (Bad₁ i),hε]
|
| 220 |
+
have hdef (i : ι) : a i*v-Real.binEntropy (a i) ≤ d i := by
|
| 221 |
+
by_cases hi : Bad₀ i
|
| 222 |
+
· exact (hstep i hi).2
|
| 223 |
+
· simpa only [a,hi,ite_false,Real.binEntropy_zero,zero_mul,sub_zero] using hd i
|
| 224 |
+
by_contra hc
|
| 225 |
+
have hθη : η < w.prob Bad₀ := lt_of_not_ge hc
|
| 226 |
+
have hlavg := Finset.sum_le_sum (s := Finset.univ) (fun i _ =>
|
| 227 |
+
mul_le_mul_of_nonneg_left (hl i) (w.nonneg i))
|
| 228 |
+
have heq : (∑ i, w i*(δ*(if Bad₀ i then (1:ℝ) else 0)-p.prob (Bad₁ i)-ε)) =
|
| 229 |
+
δ*w.prob Bad₀-(∑ i, w i*p.prob (Bad₁ i))-ε := by
|
| 230 |
+
simp only [mul_sub,Finset.sum_sub_distrib,← Finset.sum_mul,w.sum_one,one_mul,prob,
|
| 231 |
+
Finset.mul_sum]
|
| 232 |
+
congr 2
|
| 233 |
+
apply Finset.sum_congr rfl
|
| 234 |
+
intro i _
|
| 235 |
+
split_ifs <;> ring
|
| 236 |
+
rw [heq] at hlavg
|
| 237 |
+
have hav : η*δ/2 ≤ ∑ i, w i*a i := by
|
| 238 |
+
have hm := mul_le_mul_of_nonneg_left hθη.le hδ.le
|
| 239 |
+
linarith only [hlavg,hm,hnext,hsmall]
|
| 240 |
+
have hbnd := average_deficit_lower w a d ha (by positivity : 0 < η*δ/2) hav hscale hdef
|
| 241 |
+
change (∑ i, w i*d i) ≤ e at hdata
|
| 242 |
+
nlinarith only [hbnd,hdata,hgap]
|
| 243 |
+
|
| 244 |
+
variable {Ω : Type uOmega} {G : Type uGroup} [Fintype Ω] [Fintype G]
|
| 245 |
+
|
| 246 |
+
theorem low_mass_average {ι : Type uIota} [Fintype ι]
|
| 247 |
+
(G : ι → Type uGroup) [∀ i, Fintype (G i)]
|
| 248 |
+
(w : FinLaw ι) (p : (i : ι) → FinLaw (G i))
|
| 249 |
+
(K : (i : ι) → Finset (G i)) (Bad : ι → Prop) {b e : ℝ}
|
| 250 |
+
(hb : 0 < b)
|
| 251 |
+
(hK : ∀ i, ∀ x ∈ K i, p i x ≤ (3/8:ℝ)/(Fintype.card (G i):ℝ))
|
| 252 |
+
(hbad : ∀ i, Bad i → b ≤ ((K i).card:ℝ)/(8*(Fintype.card (G i):ℝ)))
|
| 253 |
+
(hdef : (∑ i, w i*(Real.log (Fintype.card (G i))-(p i).entropy)) ≤ e) :
|
| 254 |
+
w.prob Bad ≤ e/b := by
|
| 255 |
+
have h (i : ι) : b*(if Bad i then (1:ℝ) else 0) ≤
|
| 256 |
+
Real.log (Fintype.card (G i))-(p i).entropy := by
|
| 257 |
+
by_cases hi : Bad i
|
| 258 |
+
· simp only [hi,ite_true,mul_one]
|
| 259 |
+
exact (hbad i hi).trans ((p i).low_mass_deficit (K i) (by
|
| 260 |
+
intro x hx
|
| 261 |
+
convert hK i x hx using 1; ring))
|
| 262 |
+
· simp only [hi,ite_false,mul_zero]
|
| 263 |
+
exact sub_nonneg.mpr (p i).entropy_le_log_card
|
| 264 |
+
have hs := Finset.sum_le_sum (s := Finset.univ) (fun i _ =>
|
| 265 |
+
mul_le_mul_of_nonneg_left (h i) (w.nonneg i))
|
| 266 |
+
have he : (∑ i, w i*(b*(if Bad i then (1:ℝ) else 0)))=b*w.prob Bad := by
|
| 267 |
+
rw [prob,Finset.mul_sum]
|
| 268 |
+
apply Finset.sum_congr rfl
|
| 269 |
+
intro i _
|
| 270 |
+
split_ifs <;> ring
|
| 271 |
+
rw [he] at hs
|
| 272 |
+
apply (le_div_iff₀ hb).mpr
|
| 273 |
+
linarith only [hs,hdef]
|
| 274 |
+
|
| 275 |
+
end
|
| 276 |
+
|
| 277 |
+
variable {Ω : Type uOmega} {α : Type uAlpha} {β : Type uBeta} [Fintype Ω] [Fintype α] [Fintype β]
|
| 278 |
+
|
| 279 |
+
lemma uniform_map_perm [Nonempty Ω] (e : Equiv.Perm Ω) : (uniform Ω).map e = uniform Ω := by
|
| 280 |
+
ext x
|
| 281 |
+
rw [map_equiv_mass]
|
| 282 |
+
rfl
|
| 283 |
+
|
| 284 |
+
lemma prob_uniform (E : Ω → Prop) [Nonempty Ω] :
|
| 285 |
+
(uniform Ω).prob E = ((Finset.univ.filter E).card:ℝ)/(Fintype.card Ω:ℝ) := by
|
| 286 |
+
simp only [prob,uniform_mass,div_eq_mul_inv]
|
| 287 |
+
rw [← Finset.sum_boole]
|
| 288 |
+
rw [Finset.sum_mul]
|
| 289 |
+
apply Finset.sum_congr rfl
|
| 290 |
+
intro ω _
|
| 291 |
+
split_ifs <;> simp
|
| 292 |
+
|
| 293 |
+
lemma uniform_no_wrap (n a : ℕ) (ha : a ≤ n+1) :
|
| 294 |
+
(uniform (Fin (n+1))).prob (fun i => i.val+a<n+1) = 1-(a:ℝ)/(n+1) := by
|
| 295 |
+
rw [prob_uniform]
|
| 296 |
+
have he : (Finset.univ.filter (fun i : Fin (n+1) => i.val+a<n+1)) =
|
| 297 |
+
Finset.univ.filter (fun i : Fin (n+1) => i.val<n+1-a) := by
|
| 298 |
+
ext i
|
| 299 |
+
simp only [Finset.mem_filter,Finset.mem_univ,true_and]
|
| 300 |
+
omega
|
| 301 |
+
have hcard : (Finset.univ.filter (fun i : Fin (n+1) => i.val+a<n+1)).card = n+1-a := by
|
| 302 |
+
rw [he,Fin.card_filter_val_lt,Nat.min_eq_right (by omega)]
|
| 303 |
+
calc
|
| 304 |
+
_ = ((n+1-a:ℕ):ℝ)/(n+1) := by
|
| 305 |
+
congr 1
|
| 306 |
+
· convert! congrArg (fun k : ℕ => (k:ℝ)) hcard using 1
|
| 307 |
+
congr 2
|
| 308 |
+
ext i
|
| 309 |
+
simp
|
| 310 |
+
· simp
|
| 311 |
+
_ = _ := by
|
| 312 |
+
rw [Nat.cast_sub ha,Nat.cast_add,Nat.cast_one]
|
| 313 |
+
field_simp
|
| 314 |
+
|
| 315 |
+
lemma joint_perm_second (p : FinLaw Ω) {Γ : Type uCapitalGamma} [Fintype Γ] [Nonempty Γ]
|
| 316 |
+
(e : Equiv.Perm Γ) :
|
| 317 |
+
(p.joint (fun _ => uniform Γ)).map (fun v => (v.1,e v.2)) = p.joint (fun _ => uniform Γ) := by
|
| 318 |
+
have h := joint_map_fiber p (fun _ => uniform Γ) (fun _ v => e v)
|
| 319 |
+
simpa only [uniform_map_perm] using h
|
| 320 |
+
|
| 321 |
+
lemma smoothing_prob (p : FinLaw Ω) (t : Ω → ℕ) (n a : ℕ) (ha : a≤n)
|
| 322 |
+
(E : ℕ → Prop) :
|
| 323 |
+
(p.joint (fun _ => uniform (Fin (n+1)))).prob (fun v => E (t v.1+v.2.val)) ≤
|
| 324 |
+
(p.joint (fun _ => uniform (Fin (n+1)))).prob (fun v => E (t v.1+v.2.val+a))+
|
| 325 |
+
(a:ℝ)/(n+1) := by
|
| 326 |
+
let e : Equiv.Perm (Fin (n+1)) := Equiv.addRight ⟨a,by omega⟩
|
| 327 |
+
let P := p.joint (fun _ => uniform (Fin (n+1)))
|
| 328 |
+
have hprob : P.prob (fun v => E (t v.1+(e v.2).val)) =
|
| 329 |
+
P.prob (fun v => E (t v.1+v.2.val)) := by
|
| 330 |
+
have hh := congrArg (fun Q : FinLaw (Ω × Fin (n+1)) => Q.prob
|
| 331 |
+
(fun v => E (t v.1+v.2.val))) (p.joint_perm_second e)
|
| 332 |
+
simpa only [prob_map] using hh
|
| 333 |
+
have hgood : P.prob (fun v => v.2.val+a<n+1) = 1-(a:ℝ)/(n+1) := by
|
| 334 |
+
rw [prob_joint]
|
| 335 |
+
simp only [uniform_no_wrap n a (by omega),← Finset.sum_mul,p.sum_one,one_mul]
|
| 336 |
+
have hE : P.prob (fun v => E (t v.1+(e v.2).val) ∧ v.2.val+a<n+1) ≤
|
| 337 |
+
P.prob (fun v => E (t v.1+v.2.val+a)) := by
|
| 338 |
+
apply P.prob_mono
|
| 339 |
+
intro v hv
|
| 340 |
+
have he : (e v.2).val = v.2.val+a := by
|
| 341 |
+
change (v.2+(⟨a,by omega⟩ : Fin (n+1))).val = _
|
| 342 |
+
exact Fin.val_add_eq_of_add_lt hv.2
|
| 343 |
+
simpa only [he,Nat.add_assoc] using hv.1
|
| 344 |
+
have hh := P.prob_inter_ge (fun v => E (t v.1+(e v.2).val)) (fun v => v.2.val+a<n+1)
|
| 345 |
+
have hc := P.prob_compl (fun v => v.2.val+a<n+1)
|
| 346 |
+
rw [hgood] at hc
|
| 347 |
+
rw [hprob] at hh
|
| 348 |
+
linarith only [hE,hh,hc]
|
| 349 |
+
|
| 350 |
+
lemma smoothing_condH (p : FinLaw Ω) (t : Ω → ℕ) (n a : ℕ) (ha : a≤n)
|
| 351 |
+
(X : ℕ → α) (C : ℕ → β) :
|
| 352 |
+
(p.joint (fun _ => uniform (Fin (n+1)))).condH
|
| 353 |
+
(fun v => X (t v.1+v.2.val+a)) (fun v => C (t v.1+v.2.val+a)) ≤
|
| 354 |
+
(p.joint (fun _ => uniform (Fin (n+1)))).condH
|
| 355 |
+
(fun v => X (t v.1+v.2.val)) (fun v => C (t v.1+v.2.val)) +
|
| 356 |
+
2*Real.binEntropy ((a:ℝ)/(n+1))+
|
| 357 |
+
((a:ℝ)/(n+1))*(Real.log (Fintype.card α)+2*Real.log (Fintype.card β)) := by
|
| 358 |
+
let e : Equiv.Perm (Fin (n+1)) := Equiv.addRight ⟨a,by omega⟩
|
| 359 |
+
let P := p.joint (fun _ => uniform (Fin (n+1)))
|
| 360 |
+
let good := fun v : Ω × Fin (n+1) => decide (v.2.val+a<n+1)
|
| 361 |
+
have hm : P.map good true=1-(a:ℝ)/(n+1) := by
|
| 362 |
+
have hh : P.map good true=P.prob (fun v => v.2.val+a<n+1) := by
|
| 363 |
+
simp only [map_mass,good,prob,decide_eq_true_eq]
|
| 364 |
+
apply Finset.sum_congr rfl
|
| 365 |
+
intro v _
|
| 366 |
+
split_ifs <;> rfl
|
| 367 |
+
rw [hh,prob_joint]
|
| 368 |
+
simp only [uniform_no_wrap n a (by omega),
|
| 369 |
+
← Finset.sum_mul,p.sum_one,one_mul]
|
| 370 |
+
have he : P.condH (fun v => X (t v.1+(e v.2).val)) (fun v => C (t v.1+(e v.2).val)) =
|
| 371 |
+
P.condH (fun v => X (t v.1+v.2.val)) (fun v => C (t v.1+v.2.val)) := by
|
| 372 |
+
have hh := congrArg (fun Q : FinLaw (Ω × Fin (n+1)) =>
|
| 373 |
+
Q.condH (fun v => X (t v.1+v.2.val)) (fun v => C (t v.1+v.2.val))) (p.joint_perm_second e)
|
| 374 |
+
simpa only [condH,H_map,Function.comp_def] using hh
|
| 375 |
+
have h := P.condH_sub_condH_of_agree
|
| 376 |
+
(fun v => X (t v.1+v.2.val+a)) (fun v => X (t v.1+(e v.2).val))
|
| 377 |
+
(fun v => C (t v.1+v.2.val+a)) (fun v => C (t v.1+(e v.2).val)) good (by
|
| 378 |
+
intro v _ hv
|
| 379 |
+
have hlt : v.2.val+a<n+1 := of_decide_eq_true hv
|
| 380 |
+
have hev : (e v.2).val=v.2.val+a := Fin.val_add_eq_of_add_lt hlt
|
| 381 |
+
simp only [hev,Nat.add_assoc,and_self])
|
| 382 |
+
rw [hm,he,Real.binEntropy_one_sub] at h
|
| 383 |
+
linarith only [h]
|
| 384 |
+
|
| 385 |
+
end FinLaw
|
| 386 |
+
end GaussianMoat
|
| 387 |
+
|
| 388 |
+
end OAI
|
lean/OAI/NumberTheory/GaussianMoat/BatchCertificate.lean
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.GaussianMoat.DyadicSieve
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
namespace GaussianMoat
|
| 6 |
+
|
| 7 |
+
section
|
| 8 |
+
open scoped BigOperators Classical
|
| 9 |
+
|
| 10 |
+
structure BatchCertificate (D : ℝ) (ns : List ℕ) (N : ℕ) (s : SplitSieve)
|
| 11 |
+
(L : ℕ) (E r : ℝ) where
|
| 12 |
+
pre : List ℕ
|
| 13 |
+
rest : List ℕ
|
| 14 |
+
schedule : ns=pre++rest
|
| 15 |
+
T : ℝ
|
| 16 |
+
nonempty : s.primes.Nonempty
|
| 17 |
+
prime_scale : ∀ p∈s.primes, T≤(p:ℝ) ∧ (p:ℝ)≤2*T
|
| 18 |
+
large : 5≤T
|
| 19 |
+
mean : 1≤ s.meanLog
|
| 20 |
+
b : ℕ
|
| 21 |
+
n : ℕ
|
| 22 |
+
τ : ℝ
|
| 23 |
+
A : ℝ
|
| 24 |
+
η : ℝ
|
| 25 |
+
δ : ℝ
|
| 26 |
+
u : s.SignedIndex → ℝ
|
| 27 |
+
band : EntropyBand s D pre 0 b δ
|
| 28 |
+
coverage : CoverageDerivation s D N rest τ u η
|
| 29 |
+
cap : b≤ s.primes.card
|
| 30 |
+
repetitions : 0<n
|
| 31 |
+
length : 0<L
|
| 32 |
+
floor : 0≤τ
|
| 33 |
+
gain : 0≤A
|
| 34 |
+
exceptions : ∀ i, 0≤u i
|
| 35 |
+
short : ∀ i, (D*L)^2<(s.signedPrime i:ℝ)
|
| 36 |
+
smooth_length : L≤N
|
| 37 |
+
smooth_error : ∀ i, (L:ℝ)/(N+1)≤(τ/(s.signedPrime i:ℝ))/2
|
| 38 |
+
list : ∀ i, Real.log (4*u i+(s.signedPrime i:ℝ)*Real.exp
|
| 39 |
+
(-(n:ℝ)*(((L:ℝ)*(τ/(s.signedPrime i:ℝ))/2)/4)))≤Real.log (s.signedPrime i)-A
|
| 40 |
+
rate : (n:ℝ)*((L:ℝ)*r+2*(Real.log 36+2*Real.log (D*(rest.sum+N))))≤
|
| 41 |
+
(b:ℝ)*(A*(1-2*η)-δ*s.meanLog)-E
|
| 42 |
+
|
| 43 |
+
theorem BatchCertificate.sound {D E r : ℝ} {ns : List ℕ} {N L : ℕ} {s : SplitSieve}
|
| 44 |
+
(q : BatchCertificate D ns N s L E r) (hD : 1≤D)
|
| 45 |
+
(z : ℕ → GaussianInt) (hz : Function.Injective z) (ha : ∀ t, z t∈s.avoiding)
|
| 46 |
+
(hs : ∀ t, dist (z t:ℂ) (z (t+1):ℂ)≤D)
|
| 47 |
+
(F : Finset GaussianInt) (hf : ∀ f∈F, f≠0) (hF : residueWeight F≤E) :
|
| 48 |
+
∃ G : Finset GaussianInt, F⊆G ∧ G⊆F∪s.availableFactors ∧
|
| 49 |
+
r≤((TimeLaw.at 0).advance (commonSchedule z ns N)).info
|
| 50 |
+
(fun a (f : G) => residueCode f.val (z a)) (incrementWord z L)
|
| 51 |
+
(fun a (f : F) => residueCode f.val (z a)) / L := by
|
| 52 |
+
let Q := (TimeLaw.at 0).advance (commonSchedule z q.pre 0)
|
| 53 |
+
have hOld : Q.law.Hf (fun t (f : F) => residueCode f.val (z t.val))≤E :=
|
| 54 |
+
(residue_finset_entropy Q.law (fun t => z t.val) F hf).trans hF
|
| 55 |
+
obtain ⟨σ,π,hh⟩ := schedule_batch_information s q.nonempty z hz ha q.pre q.rest hD q.large
|
| 56 |
+
q.mean hs q.prime_scale q.band q.u q.coverage (fun f : F => f.val) hOld
|
| 57 |
+
q.cap q.repetitions q.length q.floor q.gain q.exceptions q.short q.smooth_length
|
| 58 |
+
q.smooth_error q.list q.rate
|
| 59 |
+
let f := fun j => s.signedFactorAt (s.selectedIndex q.cap σ π j)
|
| 60 |
+
let G := F∪Finset.univ.image f
|
| 61 |
+
refine ⟨G,Finset.subset_union_left,?_,?_⟩
|
| 62 |
+
· apply Finset.union_subset Finset.subset_union_left
|
| 63 |
+
intro g hg
|
| 64 |
+
obtain ⟨j,_,rfl⟩ := Finset.mem_image.mp hg
|
| 65 |
+
exact Finset.mem_union_right F (s.signed_mem_available _)
|
| 66 |
+
· rw [q.schedule]
|
| 67 |
+
unfold TimeLaw.info
|
| 68 |
+
rw [FinLaw.cIf_finset_union]
|
| 69 |
+
exact hh
|
| 70 |
+
|
| 71 |
+
theorem greedy_finite_selection (A : ℕ → Finset GaussianInt)
|
| 72 |
+
(hA : ∀ j, A j⊆A (j+1)) (n : ℕ)
|
| 73 |
+
(R : ℕ → Finset GaussianInt → Finset GaussianInt → Prop)
|
| 74 |
+
(hstep : ∀ j≤n, ∀ F⊆A j, ∃ G, F⊆G ∧ G⊆A (j+1) ∧ R j F G) :
|
| 75 |
+
∃ F : ℕ → Finset GaussianInt,
|
| 76 |
+
(∀ j, F j⊆A j) ∧ (∀ j, F j⊆F (j+1)) ∧ (∀ j≤n, R j (F j) (F (j+1))) := by
|
| 77 |
+
have step (j : ℕ) (F : {F : Finset GaussianInt // F⊆A j}) :
|
| 78 |
+
∃ G : {G : Finset GaussianInt // G⊆A (j+1)}, F.val⊆G.val ∧ (j≤n → R j F.val G.val) := by
|
| 79 |
+
by_cases hj : j≤n
|
| 80 |
+
· obtain ⟨G,hFG,hG,hR⟩ := hstep j hj F.val F.property
|
| 81 |
+
exact ⟨⟨G,hG⟩,hFG,fun _ => hR⟩
|
| 82 |
+
· exact ⟨⟨F.val,F.property.trans (hA j)⟩,Finset.Subset.refl _,fun h => (hj h).elim⟩
|
| 83 |
+
let f (j : ℕ) (F : {F : Finset GaussianInt // F⊆A j}) := (step j F).choose
|
| 84 |
+
let F : (j : ℕ) → {F : Finset GaussianInt // F⊆A j} :=
|
| 85 |
+
@Nat.rec (fun j => {F : Finset GaussianInt // F⊆A j}) ⟨∅,Finset.empty_subset _⟩ f
|
| 86 |
+
refine ⟨fun j => (F j).val,fun j => (F j).property,?_,?_⟩
|
| 87 |
+
· intro j
|
| 88 |
+
exact (step j (F j)).choose_spec.1
|
| 89 |
+
· intro j hj
|
| 90 |
+
exact (step j (F j)).choose_spec.2 hj
|
| 91 |
+
|
| 92 |
+
noncomputable def precedingFactors (s : ℕ → SplitSieve) (j : ℕ) : Finset GaussianInt :=
|
| 93 |
+
(Finset.range j).biUnion (fun i => (s i).availableFactors)
|
| 94 |
+
|
| 95 |
+
lemma precedingFactors_mono (s : ℕ → SplitSieve) {i j : ℕ} (h : i≤j) :
|
| 96 |
+
precedingFactors s i⊆precedingFactors s j :=
|
| 97 |
+
by
|
| 98 |
+
intro f hf
|
| 99 |
+
obtain ⟨k,hk,hf⟩ := Finset.mem_biUnion.mp hf
|
| 100 |
+
exact Finset.mem_biUnion.mpr ⟨k,(Finset.range_mono h) hk,hf⟩
|
| 101 |
+
|
| 102 |
+
lemma precedingFactors_succ (s : ℕ → SplitSieve) (j : ℕ) :
|
| 103 |
+
precedingFactors s (j+1)=precedingFactors s j∪(s j).availableFactors := by
|
| 104 |
+
simp only [precedingFactors,Finset.range_add_one,Finset.biUnion_insert,Finset.union_comm]
|
| 105 |
+
|
| 106 |
+
lemma precedingFactors_ne_zero (s : ℕ → SplitSieve) {j : ℕ} {f : GaussianInt}
|
| 107 |
+
(h : f∈precedingFactors s j) : f≠0 := by
|
| 108 |
+
obtain ⟨i,_,hi⟩ := Finset.mem_biUnion.mp h
|
| 109 |
+
exact (s i).available_ne_zero hi
|
| 110 |
+
|
| 111 |
+
theorem certificate_no_walk {D ε : ℝ} (hD : 1≤D) (ns : List ℕ) (N n : ℕ)
|
| 112 |
+
(s : ℕ → SplitSieve) (L : ℕ → ℕ) (r : ℕ → ℝ)
|
| 113 |
+
(cert : ∀ j≤n, BatchCertificate D ns N (s j) (L j)
|
| 114 |
+
(residueWeight (precedingFactors s j)) (r j))
|
| 115 |
+
(hdiv : ∀ j<n, L j∣L (j+1)) (hε : 0≤ε)
|
| 116 |
+
(herr : ∀ j<n, ∀ a<L (j+1), 2*Real.binEntropy ((a:ℝ)/(N+1))+
|
| 117 |
+
((a:ℝ)/(N+1))*((L j:ℝ)*Real.log (latticeBall D).card+
|
| 118 |
+
2*residueWeight (precedingFactors s (n+1)))≤ε)
|
| 119 |
+
(hexcess : Real.log (latticeBall D).card+n*ε<∑ j∈Finset.range (n+1), r j)
|
| 120 |
+
(z : ℕ → GaussianInt) (hz : Function.Injective z)
|
| 121 |
+
(ha : ∀ j≤n, ∀ t, z t∈(s j).avoiding)
|
| 122 |
+
(hs : ∀ t, dist (z t:ℂ) (z (t+1):ℂ)≤D) : False := by
|
| 123 |
+
let P := (TimeLaw.at 0).advance (commonSchedule z ns N)
|
| 124 |
+
let rate (j : ℕ) (F G : Finset GaussianInt) := P.info
|
| 125 |
+
(fun a (f : G) => residueCode f.val (z a)) (incrementWord z (L j))
|
| 126 |
+
(fun a (f : F) => residueCode f.val (z a)) / L j
|
| 127 |
+
obtain ⟨F,hFA,hFF,hR⟩ := greedy_finite_selection (precedingFactors s)
|
| 128 |
+
(fun j => precedingFactors_mono s (Nat.le_succ j)) n
|
| 129 |
+
(fun j F G => r j≤rate j F G) (by
|
| 130 |
+
intro j hj F hF
|
| 131 |
+
obtain ⟨G,hFG,hG,hI⟩ := (cert j hj).sound hD z hz (ha j hj) hs F
|
| 132 |
+
(fun f hf => precedingFactors_ne_zero s (hF hf)) (residueWeight_mono hF)
|
| 133 |
+
refine ⟨G,hFG,?_,hI⟩
|
| 134 |
+
rw [precedingFactors_succ]
|
| 135 |
+
exact hG.trans (Finset.union_subset_union_left hF))
|
| 136 |
+
have ht := schedule_information_telescope z hs ns N n F hFF
|
| 137 |
+
(fun j f hf => precedingFactors_ne_zero s (hFA j hf)) L
|
| 138 |
+
(fun j hj => (cert j hj).length) hdiv (fun j hj => (cert j hj).smooth_length) hε (by
|
| 139 |
+
intro j hj a ha
|
| 140 |
+
have hw := residueWeight_mono ((hFA (j+1)).trans (precedingFactors_mono s (j := n+1) (by omega)))
|
| 141 |
+
have hh := herr j hj a ha
|
| 142 |
+
have hx : 0≤(a:ℝ)/(N+1) := by positivity
|
| 143 |
+
change _+_ * (_+2*residueWeight (F (j+1)))≤ε
|
| 144 |
+
nlinarith only [hw,hh,hx])
|
| 145 |
+
have hh := Finset.sum_le_sum (s := Finset.range (n+1)) (fun j hj => hR j (by simpa only [Finset.mem_range,Nat.lt_succ_iff] using hj))
|
| 146 |
+
exact (not_lt_of_ge (hh.trans ht)) hexcess
|
| 147 |
+
|
| 148 |
+
open scoped BigOperators Classical
|
| 149 |
+
open Filter
|
| 150 |
+
|
| 151 |
+
theorem thin_bins (J : Finset ℕ) {K : ℕ} (hK : 0<K) :
|
| 152 |
+
∃ a<K, ((J.card:ℝ)/K)≤(J.filter (fun j => j%K=a)).card ∧
|
| 153 |
+
∀ i∈J.filter (fun j => j%K=a), ∀ j∈J.filter (fun j => j%K=a),
|
| 154 |
+
i<j → i+K≤j := by
|
| 155 |
+
have hh : (Finset.range K).card • ((J.card:ℝ)/K)≤(J.card:ℝ) := by
|
| 156 |
+
rw [Finset.card_range,nsmul_eq_mul,mul_div_cancel₀ _ (by exact_mod_cast hK.ne')]
|
| 157 |
+
obtain ⟨a,ha,hc⟩ := Finset.exists_le_card_fiber_of_nsmul_le_card_of_maps_to
|
| 158 |
+
(s := J) (t := Finset.range K) (f := fun j => j%K)
|
| 159 |
+
(fun j _ => Finset.mem_range.mpr (Nat.mod_lt _ hK))
|
| 160 |
+
(Finset.nonempty_range_iff.mpr hK.ne') hh
|
| 161 |
+
refine ⟨a,Finset.mem_range.mp ha,hc,?_⟩
|
| 162 |
+
intro i hi j hj hij
|
| 163 |
+
have hi' := (Finset.mem_filter.mp hi).2
|
| 164 |
+
have hj' := (Finset.mem_filter.mp hj).2
|
| 165 |
+
have hd : i%K=j%K := hi'.trans hj'.symm
|
| 166 |
+
have hei := Nat.mod_add_div i K
|
| 167 |
+
have hej := Nat.mod_add_div j K
|
| 168 |
+
have hq : i/K<j/K := by nlinarith only [hei,hej,hd,hij]
|
| 169 |
+
nlinarith only [hei,hej,hd,hq]
|
| 170 |
+
|
| 171 |
+
theorem eventually_separated_split_bins (K : ℕ) (hK : 0<K) :
|
| 172 |
+
∃ c δ : ℝ, 0<c ∧ 0<δ ∧ ∀ᶠ X : ℝ in atTop, ∃ J : Finset ℕ,
|
| 173 |
+
c*X≤J.card ∧
|
| 174 |
+
(∀ i∈J, ∀ j∈J, i<j → i+K≤j) ∧
|
| 175 |
+
∀ j∈J, X≤j*Real.log 2 ∧ j*Real.log 2≤21/20*X ∧
|
| 176 |
+
δ*(2:ℝ)^j/Real.log ((2:ℝ)^(j+1))≤(PrimeLogMass.dyadicBatch j).card := by
|
| 177 |
+
obtain ⟨c,δ,hc,hδ,he⟩ := PrimeLogMass.eventually_dense_split_bins
|
| 178 |
+
refine ⟨c/K,δ,div_pos hc (by exact_mod_cast hK),hδ,?_⟩
|
| 179 |
+
filter_upwards [he] with X hX
|
| 180 |
+
obtain ⟨J,hJ,hp⟩ := hX
|
| 181 |
+
obtain ⟨a,_,hcard,hsep⟩ := thin_bins J hK
|
| 182 |
+
refine ⟨J.filter (fun j => j%K=a),?_,hsep,?_⟩
|
| 183 |
+
· have hh := (div_le_div_of_nonneg_right hJ (Nat.cast_nonneg K)).trans hcard
|
| 184 |
+
simpa only [div_mul_eq_mul_div] using hh
|
| 185 |
+
· intro j hj
|
| 186 |
+
exact hp j (Finset.mem_filter.mp hj).1
|
| 187 |
+
|
| 188 |
+
lemma dyadicSieve_available_weight (j : ℕ) :
|
| 189 |
+
residueWeight (dyadicSieve j).availableFactors≤4*Real.log 4*(2:ℝ)^j := by
|
| 190 |
+
have hp : (∑ p∈PrimeLogMass.dyadicBatch j, Real.log (p:ℝ))≤Real.log 4*(2:ℝ)^(j+1) :=
|
| 191 |
+
PrimeLogMass.prime_log_mass_le_theta _ (by positivity) (by
|
| 192 |
+
intro p hp
|
| 193 |
+
have h := (PrimeLogMass.mem_dyadicBatch j p).mp hp
|
| 194 |
+
exact ⟨h.2.2.1,by exact_mod_cast h.2.1.le⟩)
|
| 195 |
+
have hh := (dyadicSieve j).available_weight
|
| 196 |
+
change residueWeight (dyadicSieve j).availableFactors≤2*∑ p∈PrimeLogMass.dyadicBatch j, Real.log (p:ℝ) at hh
|
| 197 |
+
rw [pow_succ] at hp
|
| 198 |
+
nlinarith only [hh,hp]
|
| 199 |
+
|
| 200 |
+
end
|
| 201 |
+
|
| 202 |
+
open scoped BigOperators Classical
|
| 203 |
+
|
| 204 |
+
lemma bandScale_add (g U : ℝ) (j k : ℕ) :
|
| 205 |
+
bandScale g U (j+k)=bandScale g (bandScale g U j) k := by
|
| 206 |
+
unfold bandScale
|
| 207 |
+
rw [pow_add]
|
| 208 |
+
ring
|
| 209 |
+
|
| 210 |
+
lemma bandLength_add (g U : ℝ) (j k : ℕ) :
|
| 211 |
+
bandLength g U (j+k)=bandLength g (bandScale g U j) k := by
|
| 212 |
+
unfold bandLength
|
| 213 |
+
rw [bandScale_add]
|
| 214 |
+
|
| 215 |
+
lemma bandList_split (g U : ℝ) (j l r : ℕ) :
|
| 216 |
+
List.ofFn (fun i : Fin (j+l+r) => bandLength g U i.val)=
|
| 217 |
+
List.ofFn (fun i : Fin j => bandLength g U i.val)++
|
| 218 |
+
List.ofFn (fun i : Fin l => bandLength g (bandScale g U j) i.val)++
|
| 219 |
+
List.ofFn (fun i : Fin r => bandLength g (bandScale g U (j+l)) i.val) := by
|
| 220 |
+
rw [List.ofFn_add,List.ofFn_add]
|
| 221 |
+
simp only [Fin.val_castLE,Fin.val_natAdd,bandLength_add]
|
| 222 |
+
|
| 223 |
+
theorem band_first_crossing {g U V : ℝ} {m : ℕ} (hg : 0<g) (hg1 : g<1)
|
| 224 |
+
(hV : 0<V) (hstart : V≤U) (hend : bandScale g U m≤V) :
|
| 225 |
+
∃ k, k ≤ m ∧ g^2*V<bandScale g U k ∧ bandScale g U k≤V := by
|
| 226 |
+
have hex : ∃ k, bandScale g U k≤V := ⟨m,hend⟩
|
| 227 |
+
let k := Nat.find hex
|
| 228 |
+
have hk : bandScale g U k≤V := Nat.find_spec hex
|
| 229 |
+
have hkm : k ≤ m := Nat.find_min' hex hend
|
| 230 |
+
refine ⟨k,hkm,?_,hk⟩
|
| 231 |
+
by_cases hk0 : k=0
|
| 232 |
+
· simp only [hk0,bandScale,pow_zero,one_mul]
|
| 233 |
+
have hg2 : g^2<1 := pow_lt_one₀ hg.le hg1 (by omega : 2≠0)
|
| 234 |
+
exact (mul_lt_of_lt_one_left hV hg2).trans_le hstart
|
| 235 |
+
· have hkpos : 0<k := Nat.pos_of_ne_zero hk0
|
| 236 |
+
have hprev : V<bandScale g U (k-1) := lt_of_not_ge (Nat.find_min hex (by omega))
|
| 237 |
+
have he : k=k-1+1 := by omega
|
| 238 |
+
rw [he,bandScale_succ]
|
| 239 |
+
exact mul_lt_mul_of_pos_left hprev (sq_pos_of_pos hg)
|
| 240 |
+
|
| 241 |
+
lemma bandScale_log {g U : ℝ} (hg : 0<g) (hU : 0<U) (k : ℕ) :
|
| 242 |
+
Real.log (bandScale g U k)=(k:ℝ)*(2*Real.log g)+Real.log U := by
|
| 243 |
+
unfold bandScale
|
| 244 |
+
rw [Real.log_mul (ne_of_gt (pow_pos (sq_pos_of_pos hg) _)) hU.ne',Real.log_pow,Real.log_pow]
|
| 245 |
+
norm_num
|
| 246 |
+
|
| 247 |
+
theorem schedule_log_bound (ns : List ℕ) (N : ℕ) {H : ℝ} (hH : 0≤H)
|
| 248 |
+
(hns : ∀ n∈ns, (n:ℝ)≤Real.exp H) :
|
| 249 |
+
Real.log ((ns.sum+N:ℕ)+1)≤Real.log ((ns.length:ℝ)+1)+H+Real.log ((N:ℝ)+1) := by
|
| 250 |
+
have hs : (ns.sum:ℝ)≤(ns.length:ℝ)*Real.exp H := by
|
| 251 |
+
induction ns with
|
| 252 |
+
| nil => simp
|
| 253 |
+
| cons n ns ih =>
|
| 254 |
+
have hn := hns n (List.mem_cons_self ..)
|
| 255 |
+
have hi := ih (fun m hm => hns m (List.mem_cons_of_mem n hm))
|
| 256 |
+
simp only [List.sum_cons,List.length_cons,Nat.cast_add,Nat.cast_one]
|
| 257 |
+
nlinarith only [hn,hi]
|
| 258 |
+
have he : 1≤Real.exp H := Real.one_le_exp_iff.mpr hH
|
| 259 |
+
have hc : 0≤(ns.length:ℝ)*Real.exp H := mul_nonneg (Nat.cast_nonneg _) (Real.exp_nonneg _)
|
| 260 |
+
have hN : 1≤(N:ℝ)+1 := by linarith only [(Nat.cast_nonneg N : (0:ℝ)≤N)]
|
| 261 |
+
have hle : ((ns.sum+N:ℕ)+1:ℝ)≤((ns.length:ℝ)+1)*Real.exp H*((N:ℝ)+1) := by
|
| 262 |
+
simp only [Nat.cast_add]
|
| 263 |
+
nlinarith only [hs,he,hc,hN,(Nat.cast_nonneg N : (0:ℝ)≤N)]
|
| 264 |
+
have hh := Real.log_le_log (show (0:ℝ)<((ns.sum+N:ℕ)+1) by positivity) hle
|
| 265 |
+
rw [Real.log_mul (by positivity) (by positivity),Real.log_mul (by positivity) (Real.exp_ne_zero _),
|
| 266 |
+
Real.log_exp] at hh
|
| 267 |
+
exact hh
|
| 268 |
+
|
| 269 |
+
end GaussianMoat
|
| 270 |
+
|
| 271 |
+
end OAI
|