Add lean source and binary files (part 109)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSampledComparison.lean +65 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSplitProbability.lean +49 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSquareLiftExclusions.lean +76 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LcmFrequencySum.lean +117 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafFrequencyBudget.lean +62 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafFrequencySupport.lean +50 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafModulusRanges.lean +53 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LinearReversal.lean +72 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionBoundary.lean +94 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionBoxes.lean +88 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionGrid.lean +144 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionIntegerBoundary.lean +111 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionIntegers.lean +87 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMesh.lean +56 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixed.lean +98 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixedMesh.lean +32 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixedTuples.lean +50 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionPrimes.lean +82 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionReplacement.lean +57 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionTuples.lean +65 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MatchedHistoryEnergy.lean +48 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MatchedPriorCorrelation.lean +78 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacement.lean +142 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementAssigned.lean +107 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementBasic.lean +125 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementDiscrete.lean +144 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementSmooth.lean +117 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezing.lean +131 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezingLog.lean +106 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezingMass.lean +85 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellJointReplacementAlgebra.lean +53 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellJointReplacementPrior.lean +55 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MonomialDenominators.lean +48 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingActualLineComparison.lean +86 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAdaptiveSupport.lean +106 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAlphabetRestriction.lean +85 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeAlphabet.lean +53 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeCoefficientSupport.lean +339 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeEnergyLogNorm.lean +101 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeFullHarmonicCost.lean +132 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeHarmonicCost.lean +103 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeHarmonicDiagonal.lean +58 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeIndex.lean +58 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveCost.lean +88 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveHarmonic.lean +59 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveStep.lean +68 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveSupport.lean +33 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveSymmetrization.lean +63 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveTransfer.lean +117 -0
- lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeMaskedEnergy.lean +120 -0
lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSampledComparison.lean
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.SampledPrimeCoincidence
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-! # Joint signed replacement with actual internal-prime coordinates
|
| 6 |
+
|
| 7 |
+
Different tests can use different sampled primes and can depend on the other
|
| 8 |
+
prime coordinates. Each test only excludes its own prime coordinate.
|
| 9 |
+
-/
|
| 10 |
+
|
| 11 |
+
namespace Ostmann
|
| 12 |
+
|
| 13 |
+
open scoped BigOperators Classical
|
| 14 |
+
|
| 15 |
+
theorem joint_sampled_polynomial_comparison_le {A I : Type*}
|
| 16 |
+
[Fintype A] [Nonempty A] [Fintype I] {n : ℕ}
|
| 17 |
+
(value : A → ℤ) (hinj : Function.Injective value)
|
| 18 |
+
(prime : A → ℕ) (hpInj : Function.Injective prime) (hprime : ∀ a, (prime a).Prime)
|
| 19 |
+
(F : I → MvPolynomial (Fin (n + 1)) ℤ) (coordinate : I → Fin (n + 1))
|
| 20 |
+
(habsent : ∀ i, coordinate i ∉ (F i).vars)
|
| 21 |
+
(μ : Fin (n + 1) → A → ℝ) (hμ : ∀ j a, 0 ≤ μ j a)
|
| 22 |
+
(hmass : ∀ j, ∑ a, μ j a = 1)
|
| 23 |
+
(α β V H : ℝ) (hα : 0 ≤ α) (hβ : 0 ≤ β) (hV : 0 < V) (hH : 1 ≤ H)
|
| 24 |
+
(hmax : ∀ j a, μ j a ≤ α) (hpmax : ∀ i a, μ (coordinate i) a ≤ β)
|
| 25 |
+
(hsize : ∀ i a, μ (coordinate i) a ≠ 0 → V ≤ Real.log (prime a : ℝ))
|
| 26 |
+
(hvalue : ∀ i x, |(integerTestValue value (F i) x : ℝ)| ≤ H)
|
| 27 |
+
(Ψ : (Fin (n + 1) → A) → (I → Bool) → ℂ)
|
| 28 |
+
(B : ℝ) (hB : 0 ≤ B) (hΨ : ∀ x flags, ‖Ψ x flags‖ ≤ B) :
|
| 29 |
+
‖∑ x, (productPrior μ x : ℂ) *
|
| 30 |
+
(Ψ x (fun i => arithmeticTestFlag
|
| 31 |
+
(prime (x (coordinate i)) ∣ (integerTestValue value (F i) x).natAbs)) -
|
| 32 |
+
Ψ x (fun i => arithmeticTestFlag (F i = 0)))‖ ≤
|
| 33 |
+
2 * B * ∑ i, (((F i).totalDegree : ℝ) * α + (Real.log H / V) * β) := by
|
| 34 |
+
let bad := fun i x => F i ≠ 0 ∧ prime (x (coordinate i)) ∣ (integerTestValue value (F i) x).natAbs
|
| 35 |
+
have hprob (i : I) : (∑ x, productPrior μ x * if bad i x then (1 : ℝ) else 0) ≤
|
| 36 |
+
((F i).totalDegree : ℝ) * α + (Real.log H / V) * β := by
|
| 37 |
+
by_cases hi : F i = 0
|
| 38 |
+
· simp only [bad, hi, ne_eq, not_true_eq_false, false_and, ite_false, mul_zero,
|
| 39 |
+
Finset.sum_const_zero]
|
| 40 |
+
exact add_nonneg (mul_nonneg (Nat.cast_nonneg _) hα)
|
| 41 |
+
(mul_nonneg (div_nonneg (Real.log_nonneg hH) hV.le) hβ)
|
| 42 |
+
· simp only [bad, hi, ne_eq, not_false_eq_true, true_and]
|
| 43 |
+
exact sampled_coordinate_prime_coincidence_le value hinj prime hpInj hprime (F i) hi
|
| 44 |
+
(coordinate i) (habsent i) μ hμ hmass α β V H hα hβ hV hH hmax (hpmax i) (hsize i) (hvalue i)
|
| 45 |
+
have heq (x : Fin (n + 1) → A) (hx : ∀ i, ¬bad i x) :
|
| 46 |
+
(fun i => arithmeticTestFlag
|
| 47 |
+
(prime (x (coordinate i)) ∣ (integerTestValue value (F i) x).natAbs)) =
|
| 48 |
+
(fun i => arithmeticTestFlag (F i = 0)) := by
|
| 49 |
+
funext i
|
| 50 |
+
by_cases hi : F i = 0
|
| 51 |
+
· simp [hi, integerTestValue]
|
| 52 |
+
· have hnd : ¬prime (x (coordinate i)) ∣ (integerTestValue value (F i) x).natAbs :=
|
| 53 |
+
fun h => hx i ⟨hi, h⟩
|
| 54 |
+
simp [hi, hnd]
|
| 55 |
+
have h := @weighted_flag_comparison_le (Fin (n + 1) → A) I inferInstance inferInstance
|
| 56 |
+
(productPrior μ) (productPrior_nonneg μ hμ)
|
| 57 |
+
(fun x i => arithmeticTestFlag
|
| 58 |
+
(prime (x (coordinate i)) ∣ (integerTestValue value (F i) x).natAbs))
|
| 59 |
+
(fun _ i => arithmeticTestFlag (F i = 0)) bad (fun _ _ => inferInstance)
|
| 60 |
+
heq Ψ B hB hΨ
|
| 61 |
+
exact h.trans (mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun i _ => hprob i) (by positivity))
|
| 62 |
+
|
| 63 |
+
end Ostmann
|
| 64 |
+
|
| 65 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSplitProbability.lean
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.SplitSquareSupport
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-! # The joint support bound for two genuine arithmetic history splits -/
|
| 6 |
+
|
| 7 |
+
namespace Ostmann
|
| 8 |
+
|
| 9 |
+
open scoped BigOperators Classical
|
| 10 |
+
|
| 11 |
+
theorem reduced_modulus_pos {s v : ℕ} (hs : s ≠ 0) : 0 < s / v.gcd s :=
|
| 12 |
+
Nat.div_pos (Nat.le_of_dvd (Nat.pos_of_ne_zero hs) (Nat.gcd_dvd_right v s))
|
| 13 |
+
(Nat.gcd_pos_of_pos_right v (Nat.pos_of_ne_zero hs))
|
| 14 |
+
|
| 15 |
+
/-- The two histories share the random child product but may have different
|
| 16 |
+
parent products, pivots, and frequencies. No complete-history validity event
|
| 17 |
+
has been conditioned on in this average. -/
|
| 18 |
+
theorem joint_split_probability_le {s t Q : ℕ} [NeZero s] [NeZero t] [NeZero Q]
|
| 19 |
+
(hs : s ∣ Q) (ht : t ∣ Q) (v w v' w' : ℕ)
|
| 20 |
+
(hgcd : v.gcd s = w.gcd s) (hgcd' : v'.gcd t = w'.gcd t)
|
| 21 |
+
(A B P : (ZMod s)ˣ) (A' B' P' : (ZMod t)ˣ) :
|
| 22 |
+
(Fintype.card (ZMod Q)ˣ : ℝ)⁻¹ * (∑ x : (ZMod Q)ˣ,
|
| 23 |
+
if (v : ZMod s) * (A * (P / ZMod.unitsMap hs x) : (ZMod s)ˣ) =
|
| 24 |
+
(w : ZMod s) * (B * ZMod.unitsMap hs x : (ZMod s)ˣ) ∧
|
| 25 |
+
(v' : ZMod t) * (A' * (P' / ZMod.unitsMap ht x) : (ZMod t)ˣ) =
|
| 26 |
+
(w' : ZMod t) * (B' * ZMod.unitsMap ht x : (ZMod t)ˣ)
|
| 27 |
+
then (1 : ℝ) else 0) ≤
|
| 28 |
+
2 * (((s / v.gcd s).lcm (t / v'.gcd t)).divisors.card : ℝ) ^ 2 /
|
| 29 |
+
(s / v.gcd s).lcm (t / v'.gcd t) := by
|
| 30 |
+
let a := s / v.gcd s
|
| 31 |
+
let b := t / v'.gcd t
|
| 32 |
+
let _ : NeZero a := ⟨Nat.ne_of_gt (reduced_modulus_pos (v := v) (NeZero.ne s))⟩
|
| 33 |
+
let _ : NeZero b := ⟨Nat.ne_of_gt (reduced_modulus_pos (v := v') (NeZero.ne t))⟩
|
| 34 |
+
have ha : a ∣ s := Nat.div_dvd_of_dvd (Nat.gcd_dvd_right v s)
|
| 35 |
+
have hb : b ∣ t := Nat.div_dvd_of_dvd (Nat.gcd_dvd_right v' t)
|
| 36 |
+
have hleft (x : (ZMod Q)ˣ) :
|
| 37 |
+
ZMod.unitsMap ha (ZMod.unitsMap hs x) = ZMod.unitsMap (ha.trans hs) x :=
|
| 38 |
+
DFunLike.congr_fun (ZMod.unitsMap_comp ha hs) x
|
| 39 |
+
have hright (x : (ZMod Q)ˣ) :
|
| 40 |
+
ZMod.unitsMap hb (ZMod.unitsMap ht x) = ZMod.unitsMap (hb.trans ht) x :=
|
| 41 |
+
DFunLike.congr_fun (ZMod.unitsMap_comp hb ht) x
|
| 42 |
+
simp_rw [unit_split_iff_square v w hgcd, unit_split_iff_square v' w' hgcd',
|
| 43 |
+
hleft, hright]
|
| 44 |
+
exact reduced_simultaneous_square_probability_le (ha.trans hs) (hb.trans ht)
|
| 45 |
+
(splitSquareTarget v w hgcd A B P) (splitSquareTarget v' w' hgcd' A' B' P')
|
| 46 |
+
|
| 47 |
+
end Ostmann
|
| 48 |
+
|
| 49 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/JointSquareLiftExclusions.lean
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Tree.UniformCoordinateAverage
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.SquareLiftExclusions
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.WeightedFlagComparison
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-! # Dropping all prime-square exclusions in the uniform CRT fibers -/
|
| 8 |
+
|
| 9 |
+
namespace Ostmann
|
| 10 |
+
open scoped BigOperators Classical
|
| 11 |
+
|
| 12 |
+
theorem squareLiftPairs_card (p : ℕ) [Fact p.Prime] (x₀ y₀ : ZMod p) :
|
| 13 |
+
Fintype.card (SquareLiftPairs p x₀ y₀) = p ^ 2 := by
|
| 14 |
+
rw [Fintype.card_prod, card_squareReduction_fiber, card_squareReduction_fiber, pow_two]
|
| 15 |
+
|
| 16 |
+
theorem squareLiftPairs_nonempty (p : ℕ) [Fact p.Prime] (x₀ y₀ : ZMod p) :
|
| 17 |
+
Nonempty (SquareLiftPairs p x₀ y₀) := by
|
| 18 |
+
exact ⟨⟨⟨(x₀.val : ZMod (p ^ 2)), by simp only [squareReduction_natCast, ZMod.natCast_zmod_val]⟩, ⟨(y₀.val : ZMod (p ^ 2)), by simp only [squareReduction_natCast, ZMod.natCast_zmod_val]⟩⟩⟩
|
| 19 |
+
|
| 20 |
+
/-- A simultaneous lift comparison for a signed integrand. The remaining
|
| 21 |
+
arithmetic conditions can be included in `F`; they are never conditioned away. -/
|
| 22 |
+
theorem joint_square_lift_removed_mass_le {I : Type*} [Fintype I] [DecidableEq I]
|
| 23 |
+
(p : I → ℕ) [∀ i, Fact (p i).Prime] (J : I → Type*) [∀ i, Fintype (J i)]
|
| 24 |
+
(a b : ∀ i, J i → ZMod (p i ^ 2)) (x₀ y₀ : ∀ i, ZMod (p i))
|
| 25 |
+
(hy : ∀ i, y₀ i ≠ 0)
|
| 26 |
+
(hrow : ∀ i j, squareReduction (p i) (a i j) ≠ 0 ∨ squareReduction (p i) (b i j) ≠ 0)
|
| 27 |
+
(hbase : ∀ i j, squareReduction (p i) (a i j) * x₀ i +
|
| 28 |
+
squareReduction (p i) (b i j) * y₀ i = 0)
|
| 29 |
+
(F : (∀ i, SquareLiftPairs (p i) (x₀ i) (y₀ i)) → ℂ)
|
| 30 |
+
(B : ℝ) (hB : 0 ≤ B) (hF : ∀ x, ‖F x‖ ≤ B) :
|
| 31 |
+
(Fintype.card (∀ i, SquareLiftPairs (p i) (x₀ i) (y₀ i)) : ℝ)⁻¹ *
|
| 32 |
+
‖(∑ x, if ∀ i j, a i j * (x i).1.1 + b i j * (x i).2.1 ≠ 0 then F x else 0) -
|
| 33 |
+
∑ x, F x‖ ≤ 2 * B * ∑ i, (Fintype.card (J i) : ℝ) / p i := by
|
| 34 |
+
let X := fun i => SquareLiftPairs (p i) (x₀ i) (y₀ i)
|
| 35 |
+
let : ∀ i, Nonempty (X i) := fun i => squareLiftPairs_nonempty _ _ _
|
| 36 |
+
let bad := fun i (x : X i) => ∃ j, a i j * x.1.1 + b i j * x.2.1 = 0
|
| 37 |
+
let w : ℝ := (Fintype.card (∀ i, X i) : ℝ)⁻¹
|
| 38 |
+
have hw : 0 ≤ w := inv_nonneg.mpr (Nat.cast_nonneg _)
|
| 39 |
+
have hlocal (i : I) : (Fintype.card (X i) : ℝ)⁻¹ *
|
| 40 |
+
(∑ x : X i, if bad i x then (1 : ℝ) else 0) ≤
|
| 41 |
+
(Fintype.card (J i) : ℝ) / p i := by
|
| 42 |
+
have h := square_lift_nonzero_rows_removed_mass_le (a i) (b i) (x₀ i) (y₀ i)
|
| 43 |
+
(hy i) (hrow i) (hbase i) (fun _ => (1 : ℂ)) 1 (by norm_num) (by simp)
|
| 44 |
+
rw [squareLiftPairs_card]
|
| 45 |
+
simpa only [bad, X, ← Finset.sum_filter, Finset.sum_const, Finset.card_univ,
|
| 46 |
+
nsmul_eq_mul, mul_one, Nat.cast_pow, norm_natCast, one_mul, div_eq_mul_inv, mul_comm] using h
|
| 47 |
+
have hprob (i : I) : ∑ x : ∀ i, X i, w * (if bad i (x i) then (1 : ℝ) else 0) ≤
|
| 48 |
+
(Fintype.card (J i) : ℝ) / p i := by
|
| 49 |
+
rw [← Finset.mul_sum]
|
| 50 |
+
exact (uniform_pi_coordinate_average X i (fun x => if bad i x then 1 else 0)).trans_le (hlocal i)
|
| 51 |
+
let Ψ := fun (x : ∀ i, X i) (flags : I → Bool) => if ∀ i, flags i = true then F x else 0
|
| 52 |
+
have h := weighted_flag_comparison_le (fun _ : ∀ i, X i => w) (fun _ => hw)
|
| 53 |
+
(fun x i => decide (¬bad i (x i))) (fun _ _ => true)
|
| 54 |
+
(fun i x => bad i (x i))
|
| 55 |
+
(by intro x hx; funext i; simp [hx i]) Ψ B hB (by
|
| 56 |
+
intro x flags
|
| 57 |
+
dsimp only [Ψ]
|
| 58 |
+
split_ifs
|
| 59 |
+
· exact hF x
|
| 60 |
+
· simpa using hB)
|
| 61 |
+
have he (x : ∀ i, X i) : Ψ x (fun i => decide (¬bad i (x i))) =
|
| 62 |
+
if ∀ i j, a i j * (x i).1.1 + b i j * (x i).2.1 ≠ 0 then F x else 0 := by
|
| 63 |
+
simp only [Ψ, decide_eq_true_eq, bad, not_exists]
|
| 64 |
+
simp only [he, Ψ, implies_true, ite_true] at h
|
| 65 |
+
have hn : ‖∑ x : ∀ i, X i, (w : ℂ) *
|
| 66 |
+
((if ∀ i j, a i j * (x i).1.1 + b i j * (x i).2.1 ≠ 0 then F x else 0) - F x)‖ =
|
| 67 |
+
w * ‖(∑ x, if ∀ i j, a i j * (x i).1.1 + b i j * (x i).2.1 ≠ 0 then F x else 0) -
|
| 68 |
+
∑ x, F x‖ := by
|
| 69 |
+
rw [← Finset.mul_sum, Finset.sum_sub_distrib, norm_mul, Complex.norm_real,
|
| 70 |
+
Real.norm_of_nonneg hw]
|
| 71 |
+
rw [hn] at h
|
| 72 |
+
exact h.trans (mul_le_mul_of_nonneg_left (Finset.sum_le_sum fun i _ => hprob i) (by positivity))
|
| 73 |
+
|
| 74 |
+
end Ostmann
|
| 75 |
+
|
| 76 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LcmFrequencySum.lean
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.NumberTheory.Harmonic.Bounds
|
| 2 |
+
import Mathlib.Data.Nat.GCD.Basic
|
| 3 |
+
import Mathlib.Tactic.Ring
|
| 4 |
+
import Mathlib.Tactic.Positivity
|
| 5 |
+
|
| 6 |
+
namespace OAI
|
| 7 |
+
|
| 8 |
+
/-! # The reciprocal-lcm sum in the frequency budget
|
| 9 |
+
|
| 10 |
+
The gcd coordinates embed each frequency pair into three independent
|
| 11 |
+
positive harmonic sums. No asymptotic divisor estimate is used here.
|
| 12 |
+
-/
|
| 13 |
+
|
| 14 |
+
namespace Ostmann
|
| 15 |
+
|
| 16 |
+
open scoped BigOperators
|
| 17 |
+
|
| 18 |
+
def gcdFrequencyCoordinates (x : ℕ × ℕ) : ℕ × ℕ × ℕ :=
|
| 19 |
+
(x.1.gcd x.2, x.1 / x.1.gcd x.2, x.2 / x.1.gcd x.2)
|
| 20 |
+
|
| 21 |
+
theorem gcdFrequencyCoordinates_recover (x : ℕ × ℕ) :
|
| 22 |
+
(gcdFrequencyCoordinates x).1 * (gcdFrequencyCoordinates x).2.1 = x.1 ∧
|
| 23 |
+
(gcdFrequencyCoordinates x).1 * (gcdFrequencyCoordinates x).2.2 = x.2 := by
|
| 24 |
+
exact ⟨Nat.mul_div_cancel' (Nat.gcd_dvd_left _ _),
|
| 25 |
+
Nat.mul_div_cancel' (Nat.gcd_dvd_right _ _)⟩
|
| 26 |
+
|
| 27 |
+
theorem gcdFrequencyCoordinates_injective : Function.Injective gcdFrequencyCoordinates := by
|
| 28 |
+
intro x y h
|
| 29 |
+
obtain ⟨hx₁, hx₂⟩ := gcdFrequencyCoordinates_recover x
|
| 30 |
+
obtain ⟨hy₁, hy₂⟩ := gcdFrequencyCoordinates_recover y
|
| 31 |
+
apply Prod.ext
|
| 32 |
+
· exact hx₁.symm.trans ((congrArg (fun z : ℕ × ℕ × ℕ => z.1 * z.2.1) h).trans hy₁)
|
| 33 |
+
· exact hx₂.symm.trans ((congrArg (fun z : ℕ × ℕ × ℕ => z.1 * z.2.2) h).trans hy₂)
|
| 34 |
+
|
| 35 |
+
theorem gcdFrequencyCoordinates_lcm (a b : ℕ) (ha : 0 < a) :
|
| 36 |
+
(gcdFrequencyCoordinates (a, b)).1 * (gcdFrequencyCoordinates (a, b)).2.1 *
|
| 37 |
+
(gcdFrequencyCoordinates (a, b)).2.2 = a.lcm b := by
|
| 38 |
+
have hg := Nat.gcd_pos_of_pos_left b ha
|
| 39 |
+
obtain ⟨ha', hb'⟩ := gcdFrequencyCoordinates_recover (a, b)
|
| 40 |
+
apply Nat.eq_of_mul_eq_mul_left hg
|
| 41 |
+
calc
|
| 42 |
+
_ = ((gcdFrequencyCoordinates (a, b)).1 * (gcdFrequencyCoordinates (a, b)).2.1) *
|
| 43 |
+
((gcdFrequencyCoordinates (a, b)).1 * (gcdFrequencyCoordinates (a, b)).2.2) := by
|
| 44 |
+
dsimp [gcdFrequencyCoordinates]
|
| 45 |
+
ring
|
| 46 |
+
_ = a * b := by rw [ha', hb']
|
| 47 |
+
_ = _ := (Nat.gcd_mul_lcm a b).symm
|
| 48 |
+
|
| 49 |
+
theorem gcdFrequencyCoordinates_mem {N a b : ℕ}
|
| 50 |
+
(ha : a ∈ Finset.Icc 1 N) (hb : b ∈ Finset.Icc 1 N) :
|
| 51 |
+
gcdFrequencyCoordinates (a, b) ∈
|
| 52 |
+
(Finset.Icc 1 N).product ((Finset.Icc 1 N).product (Finset.Icc 1 N)) := by
|
| 53 |
+
obtain ⟨ha₀, haN⟩ := Finset.mem_Icc.mp ha
|
| 54 |
+
obtain ⟨hb₀, hbN⟩ := Finset.mem_Icc.mp hb
|
| 55 |
+
have hap : 0 < a := ha₀
|
| 56 |
+
have hbp : 0 < b := hb₀
|
| 57 |
+
have hg := Nat.gcd_pos_of_pos_left b hap
|
| 58 |
+
have hga := Nat.le_of_dvd hap (Nat.gcd_dvd_left a b)
|
| 59 |
+
have hgb := Nat.le_of_dvd hbp (Nat.gcd_dvd_right a b)
|
| 60 |
+
apply Finset.mem_product.mpr
|
| 61 |
+
refine ⟨Finset.mem_Icc.mpr ⟨hg, hga.trans haN⟩, Finset.mem_product.mpr ⟨?_, ?_⟩⟩
|
| 62 |
+
· exact Finset.mem_Icc.mpr ⟨Nat.div_pos hga hg, (Nat.div_le_self _ _).trans haN⟩
|
| 63 |
+
· exact Finset.mem_Icc.mpr ⟨Nat.div_pos hgb hg, (Nat.div_le_self _ _).trans hbN⟩
|
| 64 |
+
|
| 65 |
+
/-- Exact finite bound before estimating the harmonic sum. -/
|
| 66 |
+
theorem reciprocal_lcm_sum_le_harmonic_cube (N : ℕ) :
|
| 67 |
+
(∑ a ∈ Finset.Icc 1 N, ∑ b ∈ Finset.Icc 1 N, ((a.lcm b : ℕ) : ℝ)⁻¹) ≤
|
| 68 |
+
(∑ n ∈ Finset.Icc 1 N, (n : ℝ)⁻¹) ^ 3 := by
|
| 69 |
+
let S := Finset.Icc 1 N
|
| 70 |
+
let w : ℕ × ℕ × ℕ → ℝ := fun z => (z.1 : ℝ)⁻¹ * (z.2.1 : ℝ)⁻¹ * (z.2.2 : ℝ)⁻¹
|
| 71 |
+
have hw (x : ℕ × ℕ) (hx : x ∈ S.product S) :
|
| 72 |
+
((x.1.lcm x.2 : ℕ) : ℝ)⁻¹ = w (gcdFrequencyCoordinates x) := by
|
| 73 |
+
have ha : 0 < x.1 := (Finset.mem_Icc.mp (Finset.mem_product.mp hx).1).1
|
| 74 |
+
rw [← gcdFrequencyCoordinates_lcm x.1 x.2 ha]
|
| 75 |
+
simp only [w, Nat.cast_mul, mul_inv_rev]
|
| 76 |
+
ring
|
| 77 |
+
have hsub : (S.product S).image gcdFrequencyCoordinates ⊆ S.product (S.product S) := by
|
| 78 |
+
intro z hz
|
| 79 |
+
obtain ⟨x, hx, rfl⟩ := Finset.mem_image.mp hz
|
| 80 |
+
exact gcdFrequencyCoordinates_mem (Finset.mem_product.mp hx).1 (Finset.mem_product.mp hx).2
|
| 81 |
+
calc
|
| 82 |
+
_ = ∑ x ∈ S.product S, w (gcdFrequencyCoordinates x) := by
|
| 83 |
+
simp only [Finset.product_eq_sprod]
|
| 84 |
+
rw [Finset.sum_product S S (fun x => w (gcdFrequencyCoordinates x))]
|
| 85 |
+
apply Finset.sum_congr rfl
|
| 86 |
+
intro a ha
|
| 87 |
+
apply Finset.sum_congr rfl
|
| 88 |
+
intro b hb
|
| 89 |
+
exact hw (a, b) (Finset.mem_product.mpr ⟨ha, hb⟩)
|
| 90 |
+
_ = ∑ z ∈ (S.product S).image gcdFrequencyCoordinates, w z := by
|
| 91 |
+
exact (Finset.sum_image (fun _ _ _ _ h => gcdFrequencyCoordinates_injective h)).symm
|
| 92 |
+
_ ≤ ∑ z ∈ S.product (S.product S), w z :=
|
| 93 |
+
Finset.sum_le_sum_of_subset_of_nonneg hsub (fun _ _ _ => by dsimp [w]; positivity)
|
| 94 |
+
_ = ∑ a ∈ S, ∑ b ∈ S, ∑ c ∈ S, (a : ℝ)⁻¹ * (b : ℝ)⁻¹ * (c : ℝ)⁻¹ := by
|
| 95 |
+
simp only [Finset.product_eq_sprod]
|
| 96 |
+
rw [Finset.sum_product S (S ×ˢ S) w]
|
| 97 |
+
apply Finset.sum_congr rfl
|
| 98 |
+
intro a _
|
| 99 |
+
exact Finset.sum_product S S (fun z => w (a, z))
|
| 100 |
+
_ = _ := by
|
| 101 |
+
simp only [← Finset.mul_sum, ← Finset.sum_mul]
|
| 102 |
+
dsimp [S]
|
| 103 |
+
ring
|
| 104 |
+
|
| 105 |
+
/-- The quantitative frequency-pair estimate used by the norm comparison. -/
|
| 106 |
+
theorem reciprocal_lcm_sum_le_log_cube (N : ℕ) :
|
| 107 |
+
(∑ a ∈ Finset.Icc 1 N, ∑ b ∈ Finset.Icc 1 N, ((a.lcm b : ℕ) : ℝ)⁻¹) ≤
|
| 108 |
+
(1 + Real.log N) ^ 3 := by
|
| 109 |
+
have hH : (∑ n ∈ Finset.Icc 1 N, (n : ℝ)⁻¹) ≤ 1 + Real.log N := by
|
| 110 |
+
simpa only [harmonic_eq_sum_Icc, Rat.cast_sum, Rat.cast_inv, Rat.cast_natCast]
|
| 111 |
+
using harmonic_le_one_add_log N
|
| 112 |
+
exact (reciprocal_lcm_sum_le_harmonic_cube N).trans
|
| 113 |
+
(pow_le_pow_left₀ (Finset.sum_nonneg fun _ _ => by positivity) hH 3)
|
| 114 |
+
|
| 115 |
+
end Ostmann
|
| 116 |
+
|
| 117 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafFrequencyBudget.lean
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Analysis.SpecialFunctions.Log.Basic
|
| 2 |
+
import Mathlib.Analysis.Real.Sqrt
|
| 3 |
+
import Mathlib.Tactic.Linarith
|
| 4 |
+
import Mathlib.Tactic.Ring
|
| 5 |
+
import Mathlib.Tactic.Positivity
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
/-! # The remaining leaf-frequency budget in the norm comparison -/
|
| 10 |
+
|
| 11 |
+
namespace Ostmann
|
| 12 |
+
|
| 13 |
+
theorem sqrt_cost_sublinear (A B ε : ℝ) (_hA : 0 ≤ A) (hε : 0 < ε) :
|
| 14 |
+
∃ M : ℝ, ∀ m : ℝ, M ≤ m → A * Real.sqrt m + B ≤ ε * m := by
|
| 15 |
+
refine ⟨max ((2 * A / ε) ^ 2) (2 * max B 0 / ε), fun m hm => ?_⟩
|
| 16 |
+
have hmA : (2 * A / ε) ^ 2 ≤ m := (le_max_left _ _).trans hm
|
| 17 |
+
have hmB : 2 * max B 0 / ε ≤ m := (le_max_right _ _).trans hm
|
| 18 |
+
have hm0 : 0 ≤ m := (sq_nonneg _).trans hmA
|
| 19 |
+
have hr := Real.le_sqrt_of_sq_le hmA
|
| 20 |
+
have hA' : A ≤ ε / 2 * Real.sqrt m := by
|
| 21 |
+
have h := (div_le_iff₀ hε).mp hr
|
| 22 |
+
nlinarith
|
| 23 |
+
have hprod := mul_le_mul_of_nonneg_right hA' (Real.sqrt_nonneg m)
|
| 24 |
+
have hsq := Real.sq_sqrt hm0
|
| 25 |
+
have hB' : B ≤ ε / 2 * m := by
|
| 26 |
+
have h := (div_le_iff₀ hε).mp hmB
|
| 27 |
+
have hmax := le_max_left B 0
|
| 28 |
+
nlinarith
|
| 29 |
+
nlinarith
|
| 30 |
+
|
| 31 |
+
theorem leaf_frequency_budget (r V : ℕ) (Δ m K : ℝ)
|
| 32 |
+
(hV : (V : ℝ) ≤ Real.exp (Δ + Real.sqrt m)) :
|
| 33 |
+
(2 * (V : ℝ)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K) ≤
|
| 34 |
+
Real.exp ((r : ℝ) * Δ + 2 * r * Real.sqrt m + 2 * r * Real.log 2 + K) := by
|
| 35 |
+
calc
|
| 36 |
+
_ ≤ (2 * Real.exp (Δ + Real.sqrt m)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K) :=
|
| 37 |
+
mul_le_mul_of_nonneg_right
|
| 38 |
+
(pow_le_pow_left₀ (by positivity) (by linarith) _) (Real.exp_pos _).le
|
| 39 |
+
_ = _ := by
|
| 40 |
+
nth_rw 1 [show (2 : ℝ) = Real.exp (Real.log 2) by rw [Real.exp_log (by norm_num)]]
|
| 41 |
+
rw [← Real.exp_add, ← Real.exp_nat_mul, ← Real.exp_add]
|
| 42 |
+
congr 1
|
| 43 |
+
simp only [Nat.cast_mul, Nat.cast_ofNat]
|
| 44 |
+
ring
|
| 45 |
+
|
| 46 |
+
/-- After the smooth factor `exp(-r*Delta)`, summing the two histories'
|
| 47 |
+
leaf frequencies costs `exp(r*Delta + o(m))`. -/
|
| 48 |
+
theorem leaf_frequency_budget_sublinear (r : ℕ) (K ε : ℝ) (hε : 0 < ε) :
|
| 49 |
+
∃ M : ℝ, ∀ m : ℝ, M ≤ m → ∀ Δ : ℝ, ∀ V : ℕ,
|
| 50 |
+
(V : ℝ) ≤ Real.exp (Δ + Real.sqrt m) →
|
| 51 |
+
(2 * (V : ℝ)) ^ (2 * r) * Real.exp (-(r : ℝ) * Δ + K) ≤
|
| 52 |
+
Real.exp ((r : ℝ) * Δ + ε * m) := by
|
| 53 |
+
obtain ⟨M, hM⟩ := sqrt_cost_sublinear (2 * r) (2 * r * Real.log 2 + K) ε
|
| 54 |
+
(by positivity) hε
|
| 55 |
+
refine ⟨M, fun m hm Δ V hV => (leaf_frequency_budget r V Δ m K hV).trans ?_⟩
|
| 56 |
+
apply Real.exp_le_exp.mpr
|
| 57 |
+
have h := hM m hm
|
| 58 |
+
linarith
|
| 59 |
+
|
| 60 |
+
end Ostmann
|
| 61 |
+
|
| 62 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafFrequencySupport.lean
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib.Analysis.SpecialFunctions.ExpDeriv
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Construction.HistorySmoothFactor
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Frequency support forced by the actual leaf Fourier factor -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
|
| 10 |
+
open Filter
|
| 11 |
+
|
| 12 |
+
theorem archimedeanLeaf_frequency_le (X M s cutoff Δ C K : ℝ) (ψhat : ℝ → ℂ)
|
| 13 |
+
(hX : 0 < X) (hM : 0 < M) (hupper : M ≤ X * Real.exp (Δ + C))
|
| 14 |
+
(hsupport : ∀ t, ψhat t ≠ 0 → |t| ≤ Real.exp K)
|
| 15 |
+
(hne : archimedeanLeafFactor X M s cutoff ψhat ≠ 0) :
|
| 16 |
+
|s| ≤ Real.exp (Δ + C + K) := by
|
| 17 |
+
have hψ : ψhat (-s * X / M) ≠ 0 := by
|
| 18 |
+
intro hz
|
| 19 |
+
apply hne
|
| 20 |
+
simp only [archimedeanLeafFactor, hz, mul_zero]
|
| 21 |
+
have harg := hsupport _ hψ
|
| 22 |
+
rw [abs_div, abs_mul, abs_neg, abs_of_pos hX, abs_of_pos hM] at harg
|
| 23 |
+
have harg' := (div_le_iff₀ hM).mp harg
|
| 24 |
+
apply (mul_le_mul_iff_left₀ hX).mp
|
| 25 |
+
calc
|
| 26 |
+
|s| * X ≤ Real.exp K * M := harg'
|
| 27 |
+
_ ≤ Real.exp K * (X * Real.exp (Δ + C)) :=
|
| 28 |
+
mul_le_mul_of_nonneg_left hupper (Real.exp_pos _).le
|
| 29 |
+
_ = Real.exp (Δ + C + K) * X := by
|
| 30 |
+
simp only [Real.exp_add]
|
| 31 |
+
ring
|
| 32 |
+
|
| 33 |
+
/-- The square-root margin in E_0 eventually covers the fixed Fourier
|
| 34 |
+
support radius and all bounded errors in the leaf modulus. -/
|
| 35 |
+
theorem archimedeanLeaf_frequency_window (C K : ℝ) :
|
| 36 |
+
∀ᶠ m : ℝ in atTop, ∀ X M s cutoff Δ : ℝ, ∀ ψhat : ℝ → ℂ,
|
| 37 |
+
0 < X → 0 < M → M ≤ X * Real.exp (Δ + C) →
|
| 38 |
+
(∀ t, ψhat t ≠ 0 → |t| ≤ Real.exp K) →
|
| 39 |
+
archimedeanLeafFactor X M s cutoff ψhat ≠ 0 →
|
| 40 |
+
|s| ≤ Real.exp (Δ + Real.sqrt m) := by
|
| 41 |
+
filter_upwards [eventually_ge_atTop ((C + K) ^ 2)] with m hm
|
| 42 |
+
intro X M s cutoff Δ ψhat hX hM hupper hsupport hne
|
| 43 |
+
have hsqrt : C + K ≤ Real.sqrt m := Real.le_sqrt_of_sq_le hm
|
| 44 |
+
apply (archimedeanLeaf_frequency_le X M s cutoff Δ C K ψhat hX hM hupper hsupport hne).trans
|
| 45 |
+
apply Real.exp_le_exp.mpr
|
| 46 |
+
linarith
|
| 47 |
+
|
| 48 |
+
end Ostmann
|
| 49 |
+
|
| 50 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LeafModulusRanges.lean
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Construction.HistorySmoothBound
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
/-! # The leaf modulus from the giant, protected and compensation ranges -/
|
| 6 |
+
|
| 7 |
+
namespace Ostmann
|
| 8 |
+
|
| 9 |
+
/-- `P`, `U`, and `D` are the products of protected, compensation, and
|
| 10 |
+
outside spectator slots. The center identity is equation (45). -/
|
| 11 |
+
theorem leaf_modulus_lower_from_ranges
|
| 12 |
+
(X x₁ x₂ P U D G tD J W Δ cG cP cU cD : ℝ)
|
| 13 |
+
(hX : 0 < X) (hx₁ : 0 < x₁) (hx₂ : 0 < x₂)
|
| 14 |
+
(hP : 0 < P) (hU : 0 < U) (hD : 0 < D)
|
| 15 |
+
(hcenter : 2 * G + 2 * tD + J + W = Real.log X + Δ)
|
| 16 |
+
(hg₁ : G - cG ≤ Real.log x₁) (hg₂ : G - cG ≤ Real.log x₂)
|
| 17 |
+
(hp : J - cP ≤ Real.log P) (hu : W - cU ≤ Real.log U)
|
| 18 |
+
(hd : 2 * tD - cD ≤ Real.log D) :
|
| 19 |
+
X * Real.exp (Δ - (2 * cG + cP + cU + cD)) ≤ x₁ * x₂ * P * U * D := by
|
| 20 |
+
have hM : 0 < x₁ * x₂ * P * U * D := by positivity
|
| 21 |
+
have hlog : Real.log (x₁ * x₂ * P * U * D) =
|
| 22 |
+
Real.log x₁ + Real.log x₂ + Real.log P + Real.log U + Real.log D := by
|
| 23 |
+
rw [Real.log_mul (by positivity) (ne_of_gt hD),
|
| 24 |
+
Real.log_mul (by positivity) (ne_of_gt hU),
|
| 25 |
+
Real.log_mul (by positivity) (ne_of_gt hP),
|
| 26 |
+
Real.log_mul (ne_of_gt hx₁) (ne_of_gt hx₂)]
|
| 27 |
+
have hlow : Real.log X + (Δ - (2 * cG + cP + cU + cD)) ≤
|
| 28 |
+
Real.log (x₁ * x₂ * P * U * D) := by rw [hlog]; linarith
|
| 29 |
+
calc
|
| 30 |
+
_ = Real.exp (Real.log X + (Δ - (2 * cG + cP + cU + cD))) := by
|
| 31 |
+
rw [Real.exp_add, Real.exp_log hX]
|
| 32 |
+
_ ≤ Real.exp (Real.log (x₁ * x₂ * P * U * D)) := Real.exp_le_exp.mpr hlow
|
| 33 |
+
_ = _ := Real.exp_log hM
|
| 34 |
+
|
| 35 |
+
/-- The corresponding size of the square-root prefactor in a leaf of
|
| 36 |
+
equation (50); the error in the exponent is independent of frequency. -/
|
| 37 |
+
theorem leaf_sqrt_ratio_from_ranges
|
| 38 |
+
(X x₁ x₂ P U D G tD J W Δ cG cP cU cD : ℝ)
|
| 39 |
+
(hX : 0 < X) (hx₁ : 0 < x₁) (hx₂ : 0 < x₂)
|
| 40 |
+
(hP : 0 < P) (hU : 0 < U) (hD : 0 < D)
|
| 41 |
+
(hcenter : 2 * G + 2 * tD + J + W = Real.log X + Δ)
|
| 42 |
+
(hg₁ : G - cG ≤ Real.log x₁) (hg₂ : G - cG ≤ Real.log x₂)
|
| 43 |
+
(hp : J - cP ≤ Real.log P) (hu : W - cU ≤ Real.log U)
|
| 44 |
+
(hd : 2 * tD - cD ≤ Real.log D) :
|
| 45 |
+
Real.sqrt (X / (x₁ * x₂ * P * U * D)) ≤
|
| 46 |
+
Real.exp (((2 * cG + cP + cU + cD) - Δ) / 2) :=
|
| 47 |
+
sqrt_ratio_le_exp X _ Δ _ (by positivity)
|
| 48 |
+
(leaf_modulus_lower_from_ranges X x₁ x₂ P U D G tD J W Δ cG cP cU cD
|
| 49 |
+
hX hx₁ hx₂ hP hU hD hcenter hg₁ hg₂ hp hu hd)
|
| 50 |
+
|
| 51 |
+
end Ostmann
|
| 52 |
+
|
| 53 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LinearReversal.lean
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import Mathlib
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.LinearReversal
|
| 7 |
+
|
| 8 |
+
variable {K : Type*} [Field K]
|
| 9 |
+
|
| 10 |
+
def leftStep (a b : K) (hb : b ≠ 0) : (K × K) ≃ₗ[K] (K × K) where
|
| 11 |
+
toFun z := (a*z.1+b*z.2,z.1)
|
| 12 |
+
invFun z := (z.2,(z.1-a*z.2)/b)
|
| 13 |
+
left_inv z := by
|
| 14 |
+
apply Prod.ext
|
| 15 |
+
· rfl
|
| 16 |
+
· dsimp
|
| 17 |
+
field_simp
|
| 18 |
+
ring
|
| 19 |
+
right_inv z := by
|
| 20 |
+
apply Prod.ext
|
| 21 |
+
· dsimp
|
| 22 |
+
field_simp
|
| 23 |
+
ring
|
| 24 |
+
· rfl
|
| 25 |
+
map_add' z w := by ext <;> dsimp; ring
|
| 26 |
+
map_smul' c z := by ext <;> dsimp; ring
|
| 27 |
+
|
| 28 |
+
def rightStep (a b : K) (ha : a ≠ 0) : (K × K) ≃ₗ[K] (K × K) where
|
| 29 |
+
toFun z := (a*z.1+b*z.2,z.2)
|
| 30 |
+
invFun z := ((z.1-b*z.2)/a,z.2)
|
| 31 |
+
left_inv z := by
|
| 32 |
+
apply Prod.ext
|
| 33 |
+
· dsimp
|
| 34 |
+
field_simp
|
| 35 |
+
ring
|
| 36 |
+
· rfl
|
| 37 |
+
right_inv z := by
|
| 38 |
+
apply Prod.ext
|
| 39 |
+
· dsimp
|
| 40 |
+
field_simp
|
| 41 |
+
ring
|
| 42 |
+
· rfl
|
| 43 |
+
map_add' z w := by ext <;> dsimp; ring
|
| 44 |
+
map_smul' c z := by ext <;> dsimp; ring
|
| 45 |
+
|
| 46 |
+
theorem pivot_linear {v w Cp Cm s u p Xp Xm : K}
|
| 47 |
+
(hs : s ≠ 0) (hu : u ≠ 0)
|
| 48 |
+
(h : v*(Xm*Cm)-w*(Xp*Cp)=s*u*p) :
|
| 49 |
+
p = (-w*Cp/(s*u))*Xp+(v*Cm/(s*u))*Xm := by
|
| 50 |
+
field_simp
|
| 51 |
+
linear_combination -h
|
| 52 |
+
|
| 53 |
+
theorem nonzero_form_comp (e : (K × K) ≃ₗ[K] (K × K)) (a b : K)
|
| 54 |
+
(h : a ≠ 0 ∨ b ≠ 0) :
|
| 55 |
+
¬ ∀ z : K × K, a*(e z).1+b*(e z).2=0 := by
|
| 56 |
+
intro hz
|
| 57 |
+
have h₁ := hz (e.symm (1,0))
|
| 58 |
+
have h₂ := hz (e.symm (0,1))
|
| 59 |
+
simp only [e.apply_symm_apply,mul_one,mul_zero,add_zero,zero_add] at h₁ h₂
|
| 60 |
+
exact h.elim (fun ha => ha h₁) (fun hb => hb h₂)
|
| 61 |
+
|
| 62 |
+
theorem left_row_coefficients (a b c d x y : K) :
|
| 63 |
+
c*(a*x+b*y)+d*x=(c*a+d)*x+(c*b)*y := by ring
|
| 64 |
+
|
| 65 |
+
theorem right_row_coefficients (a b c d x y : K) :
|
| 66 |
+
c*(a*x+b*y)+d*y=(c*a)*x+(c*b+d)*y := by ring
|
| 67 |
+
|
| 68 |
+
end Ostmann.Arithmetic.LinearReversal
|
| 69 |
+
|
| 70 |
+
end
|
| 71 |
+
|
| 72 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionBoundary.lean
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionPrimes
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellReplacementUniform
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 7 |
+
|
| 8 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 12 |
+
open PrimeProgression PrimeCellReplacement Classical
|
| 13 |
+
|
| 14 |
+
theorem log_eq_left_of_closed_not_assigned (N : ℕ) (lo hi η : ℝ)
|
| 15 |
+
(j : Fin (gridCount lo hi η)) {p : ℕ}
|
| 16 |
+
(hp : p ∈ logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)))
|
| 17 |
+
(hpnot : p ∉ assignedPrimeSupport N lo hi η j) :
|
| 18 |
+
Real.log (p:ℝ) = gridPoint lo hi η j.val := by
|
| 19 |
+
have hclosed := (mem_logPrimeSupport _ _ _ _).mp hp
|
| 20 |
+
have hnot : ¬(j.val=0 ∨ gridPoint lo hi η j.val < Real.log (p:ℝ)) := by
|
| 21 |
+
intro h
|
| 22 |
+
exact hpnot (Finset.mem_filter.mpr ⟨hp,h⟩)
|
| 23 |
+
push Not at hnot
|
| 24 |
+
exact le_antisymm hnot.2 hclosed.2.2.1
|
| 25 |
+
|
| 26 |
+
theorem closed_assigned_difference_card_le (N : ℕ) (lo hi η : ℝ)
|
| 27 |
+
(j : Fin (gridCount lo hi η)) :
|
| 28 |
+
((logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 29 |
+
assignedPrimeSupport N lo hi η j).card ≤ 1 := by
|
| 30 |
+
apply Finset.card_le_one.mpr
|
| 31 |
+
intro p hp q hq
|
| 32 |
+
have hp' := Finset.mem_sdiff.mp hp
|
| 33 |
+
have hq' := Finset.mem_sdiff.mp hq
|
| 34 |
+
have hpl := log_eq_left_of_closed_not_assigned N lo hi η j hp'.1 hp'.2
|
| 35 |
+
have hql := log_eq_left_of_closed_not_assigned N lo hi η j hq'.1 hq'.2
|
| 36 |
+
have hpp := ((mem_logPrimeSupport _ _ _ _).mp hp'.1).2.1.pos
|
| 37 |
+
have hqp := ((mem_logPrimeSupport _ _ _ _).mp hq'.1).2.1.pos
|
| 38 |
+
have he : (p:ℝ)=(q:ℝ) := Real.log_injOn_pos
|
| 39 |
+
(by change (0:ℝ)<p; exact_mod_cast hpp) (by change (0:ℝ)<q; exact_mod_cast hqp) (hpl.trans hql.symm)
|
| 40 |
+
exact_mod_cast he
|
| 41 |
+
|
| 42 |
+
theorem norm_closed_assigned_test_error {E : Type*} [NormedAddCommGroup E]
|
| 43 |
+
(N : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) (f : ℕ → E)
|
| 44 |
+
{A : ℝ} (hA : 0 ≤ A)
|
| 45 |
+
(hf : ∀ p ∈ logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)),
|
| 46 |
+
p ∉ assignedPrimeSupport N lo hi η j → ‖f p‖ ≤ A) :
|
| 47 |
+
‖(∑ p ∈ logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)), f p) -
|
| 48 |
+
(∑ p ∈ assignedPrimeSupport N lo hi η j, f p)‖ ≤ A := by
|
| 49 |
+
have hsub : assignedPrimeSupport N lo hi η j ⊆
|
| 50 |
+
logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) :=
|
| 51 |
+
Finset.filter_subset _ _
|
| 52 |
+
rw [← Finset.sum_sdiff_eq_sub hsub]
|
| 53 |
+
apply (norm_sum_le _ _).trans
|
| 54 |
+
calc
|
| 55 |
+
_ ≤ ∑ _p ∈ (logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 56 |
+
assignedPrimeSupport N lo hi η j, A :=
|
| 57 |
+
Finset.sum_le_sum (fun p hp => hf p (Finset.mem_sdiff.mp hp).1 (Finset.mem_sdiff.mp hp).2)
|
| 58 |
+
_ = (((logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 59 |
+
assignedPrimeSupport N lo hi η j).card:ℝ)*A := by simp
|
| 60 |
+
_ ≤ A := by
|
| 61 |
+
have hc : (((logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 62 |
+
assignedPrimeSupport N lo hi η j).card:ℝ) ≤ 1 := by
|
| 63 |
+
exact_mod_cast closed_assigned_difference_card_le N lo hi η j
|
| 64 |
+
simpa using mul_le_mul_of_nonneg_right hc hA
|
| 65 |
+
|
| 66 |
+
def assignedResidueMass (N M : ℕ) (a : ZMod M) (lo hi η Z : ℝ)
|
| 67 |
+
(j : Fin (gridCount lo hi η)) : ℝ :=
|
| 68 |
+
∑ p ∈ (assignedPrimeSupport N lo hi η j).filter (fun p : ℕ => (p:ZMod M)=a),
|
| 69 |
+
(Z*(p:ℝ))⁻¹
|
| 70 |
+
|
| 71 |
+
theorem residueMass_assigned_error (N M : ℕ) (a : ZMod M) (lo hi η : ℝ)
|
| 72 |
+
(j : Fin (gridCount lo hi η)) {Z : ℝ} (hZ : 0 < Z) :
|
| 73 |
+
|residueMass N M a (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) Z -
|
| 74 |
+
assignedResidueMass N M a lo hi η Z j| ≤ (Z*Real.exp (gridPoint lo hi η j.val))⁻¹ := by
|
| 75 |
+
unfold residueMass assignedResidueMass
|
| 76 |
+
simp only [Finset.sum_filter]
|
| 77 |
+
change ‖(∑ p ∈ logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)),
|
| 78 |
+
if (p:ZMod M)=a then (Z*(p:ℝ))⁻¹ else 0) -
|
| 79 |
+
(∑ p ∈ assignedPrimeSupport N lo hi η j, if (p:ZMod M)=a then (Z*(p:ℝ))⁻¹ else 0)‖ ≤ _
|
| 80 |
+
apply norm_closed_assigned_test_error N lo hi η j _ (by positivity)
|
| 81 |
+
intro p hp hpnot
|
| 82 |
+
have hpl := log_eq_left_of_closed_not_assigned N lo hi η j hp hpnot
|
| 83 |
+
have hpp : (0:ℝ) < p := by exact_mod_cast ((mem_logPrimeSupport _ _ _ _).mp hp).2.1.pos
|
| 84 |
+
have he : (p:ℝ)=Real.exp (gridPoint lo hi η j.val) := by rw [← hpl,Real.exp_log hpp]
|
| 85 |
+
split_ifs
|
| 86 |
+
· rw [he,Real.norm_eq_abs,abs_of_nonneg (by positivity)]
|
| 87 |
+
· simp
|
| 88 |
+
positivity
|
| 89 |
+
|
| 90 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 91 |
+
|
| 92 |
+
end
|
| 93 |
+
|
| 94 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionBoxes.lean
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionGrid
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellIntegralFreezing
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 8 |
+
open MeasureTheory PrimeCellFreezing
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
abbrev GridBoxIndex (lo hi η : ι → ℝ) := ∀ i, Fin (gridCount (lo i) (hi i) (η i))
|
| 12 |
+
|
| 13 |
+
def boxLower (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) (i : ι) : ℝ :=
|
| 14 |
+
gridPoint (lo i) (hi i) (η i) (j i).val
|
| 15 |
+
|
| 16 |
+
def boxUpper (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) (i : ι) : ℝ :=
|
| 17 |
+
gridPoint (lo i) (hi i) (η i) ((j i).val+1)
|
| 18 |
+
|
| 19 |
+
def assignedBox (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) : Set (ι → ℝ) :=
|
| 20 |
+
Set.univ.pi fun i => assignedCell (lo i) (hi i) (η i) (j i)
|
| 21 |
+
|
| 22 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 23 |
+
theorem assignedBox_subset_rectangle {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i)
|
| 24 |
+
(j : GridBoxIndex lo hi η) : assignedBox lo hi η j ⊆ logRectangle lo hi := by
|
| 25 |
+
intro t ht i hi'
|
| 26 |
+
exact assignedCell_subset_interval (h i) (j i) (ht i hi')
|
| 27 |
+
|
| 28 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 29 |
+
theorem iUnion_assignedBox {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i) :
|
| 30 |
+
(⋃ j : GridBoxIndex lo hi η, assignedBox lo hi η j) = logRectangle lo hi := by
|
| 31 |
+
ext t
|
| 32 |
+
constructor
|
| 33 |
+
· intro ht
|
| 34 |
+
obtain ⟨j,hj⟩ := Set.mem_iUnion.mp ht
|
| 35 |
+
exact assignedBox_subset_rectangle h j hj
|
| 36 |
+
· intro ht
|
| 37 |
+
have hc : ∀ i, ∃ j : Fin (gridCount (lo i) (hi i) (η i)),
|
| 38 |
+
t i ∈ assignedCell (lo i) (hi i) (η i) j :=
|
| 39 |
+
fun i => exists_assignedCell (h i) (ht i (Set.mem_univ i))
|
| 40 |
+
choose j hj using hc
|
| 41 |
+
exact Set.mem_iUnion.mpr ⟨j,fun i _ => hj i⟩
|
| 42 |
+
|
| 43 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 44 |
+
theorem assignedBox_pairwiseDisjoint {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i) :
|
| 45 |
+
Pairwise (fun j k : GridBoxIndex lo hi η => Disjoint (assignedBox lo hi η j) (assignedBox lo hi η k)) := by
|
| 46 |
+
intro j k hjk
|
| 47 |
+
obtain ⟨i,hi⟩ := Function.ne_iff.mp hjk
|
| 48 |
+
apply Set.disjoint_left.mpr
|
| 49 |
+
intro t htj htk
|
| 50 |
+
exact Set.disjoint_left.mp (assignedCell_pairwiseDisjoint (h i) hi)
|
| 51 |
+
(htj i (Set.mem_univ i)) (htk i (Set.mem_univ i))
|
| 52 |
+
|
| 53 |
+
omit [DecidableEq ι] in
|
| 54 |
+
theorem measurableSet_assignedBox (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) :
|
| 55 |
+
MeasurableSet (assignedBox lo hi η j) :=
|
| 56 |
+
MeasurableSet.univ_pi fun i => measurableSet_assignedCell (lo i) (hi i) (η i) (j i)
|
| 57 |
+
|
| 58 |
+
omit [DecidableEq ι] in
|
| 59 |
+
theorem assignedBox_ae_eq_closed (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) :
|
| 60 |
+
assignedBox lo hi η j =ᵐ[volume] logRectangle (boxLower lo hi η j) (boxUpper lo hi η j) := by
|
| 61 |
+
change (Set.univ.pi fun i => assignedCell (lo i) (hi i) (η i) (j i)) =ᵐ[Measure.pi (fun _ : ι => (volume : Measure ℝ))]
|
| 62 |
+
(Set.univ.pi fun i => Set.Icc (boxLower lo hi η j i) (boxUpper lo hi η j i))
|
| 63 |
+
exact Measure.ae_eq_set_pi fun i _ => assignedCell_ae_eq_closed (lo i) (hi i) (η i) (j i)
|
| 64 |
+
|
| 65 |
+
theorem integral_rectangle_eq_sum_boxes {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 66 |
+
(lo hi η : ι → ℝ) (h : ∀ i, lo i ≤ hi i) (f : (ι → ℝ) → E)
|
| 67 |
+
(hf : IntegrableOn f (logRectangle lo hi)) :
|
| 68 |
+
(∫ t in logRectangle lo hi, f t) =
|
| 69 |
+
∑ j : GridBoxIndex lo hi η, ∫ t in logRectangle (boxLower lo hi η j) (boxUpper lo hi η j), f t := by
|
| 70 |
+
rw [← iUnion_assignedBox (η:=η) h]
|
| 71 |
+
rw [integral_iUnion_fintype (measurableSet_assignedBox lo hi η)
|
| 72 |
+
(assignedBox_pairwiseDisjoint h) (fun j => hf.mono_set (assignedBox_subset_rectangle h j))]
|
| 73 |
+
apply Finset.sum_congr rfl
|
| 74 |
+
intro j hj
|
| 75 |
+
exact setIntegral_congr_set (assignedBox_ae_eq_closed lo hi η j)
|
| 76 |
+
|
| 77 |
+
theorem logCellMass_eq_sum_boxes (w lo hi η : ι → ℝ)
|
| 78 |
+
(h : ∀ i, lo i ≤ hi i) (hlo : ∀ i, 0 < lo i) :
|
| 79 |
+
logCellMass w lo hi = ∑ j : GridBoxIndex lo hi η,
|
| 80 |
+
logCellMass w (boxLower lo hi η j) (boxUpper lo hi η j) :=
|
| 81 |
+
integral_rectangle_eq_sum_boxes lo hi η h (logCellDensity w)
|
| 82 |
+
(integrableOn_logCellDensity w lo hi hlo)
|
| 83 |
+
|
| 84 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 85 |
+
|
| 86 |
+
end
|
| 87 |
+
|
| 88 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionGrid.lean
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeProgression
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 7 |
+
open MeasureTheory
|
| 8 |
+
|
| 9 |
+
def gridCount (lo hi η : ℝ) : ℕ := ⌈(hi-lo)/η⌉₊+1
|
| 10 |
+
|
| 11 |
+
def gridStep (lo hi η : ℝ) : ℝ := (hi-lo)/(gridCount lo hi η:ℝ)
|
| 12 |
+
|
| 13 |
+
def gridPoint (lo hi η : ℝ) (j : ℕ) : ℝ := lo+(j:ℝ)*gridStep lo hi η
|
| 14 |
+
|
| 15 |
+
def assignedCell (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) : Set ℝ :=
|
| 16 |
+
if j.val=0 then Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))
|
| 17 |
+
else Set.Ioc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))
|
| 18 |
+
|
| 19 |
+
theorem gridCount_pos (lo hi η : ℝ) : 0 < gridCount lo hi η := by unfold gridCount; omega
|
| 20 |
+
|
| 21 |
+
theorem gridStep_nonneg {lo hi η : ℝ} (h : lo ≤ hi) : 0 ≤ gridStep lo hi η := by
|
| 22 |
+
unfold gridStep
|
| 23 |
+
exact div_nonneg (sub_nonneg.mpr h) (Nat.cast_nonneg _)
|
| 24 |
+
|
| 25 |
+
@[simp] theorem gridPoint_zero (lo hi η : ℝ) : gridPoint lo hi η 0 = lo := by simp [gridPoint]
|
| 26 |
+
|
| 27 |
+
@[simp] theorem gridPoint_last (lo hi η : ℝ) :
|
| 28 |
+
gridPoint lo hi η (gridCount lo hi η) = hi := by
|
| 29 |
+
have hn : (gridCount lo hi η:ℝ) ≠ 0 := by exact_mod_cast (gridCount_pos lo hi η).ne'
|
| 30 |
+
unfold gridPoint gridStep
|
| 31 |
+
field_simp
|
| 32 |
+
ring
|
| 33 |
+
|
| 34 |
+
theorem gridPoint_mono {lo hi η : ℝ} (h : lo ≤ hi) : Monotone (gridPoint lo hi η) := by
|
| 35 |
+
intro i j hij
|
| 36 |
+
unfold gridPoint
|
| 37 |
+
have hs := gridStep_nonneg (η:=η) h
|
| 38 |
+
gcongr
|
| 39 |
+
|
| 40 |
+
theorem gridPoint_mem {lo hi η : ℝ} (h : lo ≤ hi) {j : ℕ} (hj : j ≤ gridCount lo hi η) :
|
| 41 |
+
gridPoint lo hi η j ∈ Set.Icc lo hi := by
|
| 42 |
+
have hm := gridPoint_mono (η:=η) h
|
| 43 |
+
exact ⟨by simpa using hm (Nat.zero_le j),by simpa using hm hj⟩
|
| 44 |
+
|
| 45 |
+
theorem gridPoint_width (lo hi η : ℝ) (j : ℕ) :
|
| 46 |
+
gridPoint lo hi η (j+1)-gridPoint lo hi η j = gridStep lo hi η := by
|
| 47 |
+
unfold gridPoint
|
| 48 |
+
push_cast
|
| 49 |
+
ring
|
| 50 |
+
|
| 51 |
+
theorem gridStep_le {lo hi η : ℝ} (_h : lo ≤ hi) (hη : 0 < η) : gridStep lo hi η ≤ η := by
|
| 52 |
+
have hn : (0:ℝ) < gridCount lo hi η := by exact_mod_cast gridCount_pos lo hi η
|
| 53 |
+
have hc := Nat.le_ceil ((hi-lo)/η)
|
| 54 |
+
have hc' : (hi-lo)/η ≤ (gridCount lo hi η:ℝ) := by
|
| 55 |
+
unfold gridCount
|
| 56 |
+
push_cast
|
| 57 |
+
linarith
|
| 58 |
+
apply (div_le_iff₀ hn).mpr
|
| 59 |
+
have hh := (div_le_iff₀ hη).mp hc'
|
| 60 |
+
nlinarith
|
| 61 |
+
|
| 62 |
+
theorem gridCount_le_ceiling {lo hi η U : ℝ} (hη : 0 < η) (hU : hi-lo ≤ U) :
|
| 63 |
+
gridCount lo hi η ≤ ⌈U/η⌉₊+1 := by
|
| 64 |
+
unfold gridCount
|
| 65 |
+
exact Nat.add_le_add_right (Nat.ceil_mono (div_le_div_of_nonneg_right hU hη.le)) 1
|
| 66 |
+
|
| 67 |
+
theorem assignedCell_subset_closed (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) :
|
| 68 |
+
assignedCell lo hi η j ⊆ Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) := by
|
| 69 |
+
unfold assignedCell
|
| 70 |
+
split_ifs
|
| 71 |
+
· exact Set.Subset.rfl
|
| 72 |
+
· exact Set.Ioc_subset_Icc_self
|
| 73 |
+
|
| 74 |
+
theorem assignedCell_subset_interval {lo hi η : ℝ} (h : lo ≤ hi)
|
| 75 |
+
(j : Fin (gridCount lo hi η)) : assignedCell lo hi η j ⊆ Set.Icc lo hi := by
|
| 76 |
+
intro x hx
|
| 77 |
+
have hc := assignedCell_subset_closed lo hi η j hx
|
| 78 |
+
have hl := gridPoint_mem (η:=η) h j.isLt.le
|
| 79 |
+
have hu := gridPoint_mem (η:=η) h (show j.val+1 ≤ gridCount lo hi η by omega)
|
| 80 |
+
exact ⟨hl.1.trans hc.1,hc.2.trans hu.2⟩
|
| 81 |
+
|
| 82 |
+
theorem assignedCell_disjoint_of_lt {lo hi η : ℝ} (h : lo ≤ hi)
|
| 83 |
+
{i j : Fin (gridCount lo hi η)} (hij : i < j) :
|
| 84 |
+
Disjoint (assignedCell lo hi η i) (assignedCell lo hi η j) := by
|
| 85 |
+
apply Set.disjoint_left.mpr
|
| 86 |
+
intro x hxi hxj
|
| 87 |
+
have hi' := (assignedCell_subset_closed lo hi η i hxi).2
|
| 88 |
+
have hj0 : j.val ≠ 0 := by
|
| 89 |
+
have hh : i.val < j.val := hij
|
| 90 |
+
omega
|
| 91 |
+
have hjc : x ∈ Set.Ioc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) := by
|
| 92 |
+
simpa only [assignedCell,ite_eq_right hj0] using hxj
|
| 93 |
+
have hj' := hjc.1
|
| 94 |
+
have hm := gridPoint_mono (η:=η) h (show i.val+1 ≤ j.val by exact hij)
|
| 95 |
+
linarith
|
| 96 |
+
|
| 97 |
+
theorem assignedCell_pairwiseDisjoint {lo hi η : ℝ} (h : lo ≤ hi) :
|
| 98 |
+
Pairwise (fun i j : Fin (gridCount lo hi η) => Disjoint (assignedCell lo hi η i) (assignedCell lo hi η j)) := by
|
| 99 |
+
intro i j hne
|
| 100 |
+
rcases lt_or_gt_of_ne hne with hij | hji
|
| 101 |
+
· exact assignedCell_disjoint_of_lt h hij
|
| 102 |
+
· exact (assignedCell_disjoint_of_lt h hji).symm
|
| 103 |
+
|
| 104 |
+
theorem exists_assignedCell {lo hi η x : ℝ} (h : lo ≤ hi) (hx : x ∈ Set.Icc lo hi) :
|
| 105 |
+
∃ j : Fin (gridCount lo hi η), x ∈ assignedCell lo hi η j := by
|
| 106 |
+
by_cases hx0 : x=lo
|
| 107 |
+
· refine ⟨⟨0,gridCount_pos lo hi η⟩,?_⟩
|
| 108 |
+
have hu := gridPoint_mem (η:=η) h (gridCount_pos lo hi η)
|
| 109 |
+
simp only [assignedCell,ite_true,gridPoint_zero,Set.mem_Icc]
|
| 110 |
+
exact ⟨by linarith,by simpa only [hx0,Nat.zero_add] using hu.1⟩
|
| 111 |
+
· have hx' : x ∈ Set.Ioc (gridPoint lo hi η 0) (gridPoint lo hi η (gridCount lo hi η)) := by
|
| 112 |
+
simp only [gridPoint_zero,gridPoint_last,Set.mem_Ioc]
|
| 113 |
+
exact ⟨lt_of_le_of_ne hx.1 (Ne.symm hx0),hx.2⟩
|
| 114 |
+
obtain ⟨j,hj,hxj⟩ := Set.mem_iUnion₂.mp (Ioc_subset_biUnion_Ioc (gridCount lo hi η)
|
| 115 |
+
(gridPoint lo hi η) hx')
|
| 116 |
+
refine ⟨⟨j,Finset.mem_range.mp hj⟩,?_⟩
|
| 117 |
+
unfold assignedCell
|
| 118 |
+
split_ifs
|
| 119 |
+
· exact ⟨hxj.1.le,hxj.2⟩
|
| 120 |
+
· exact hxj
|
| 121 |
+
|
| 122 |
+
theorem iUnion_assignedCell {lo hi η : ℝ} (h : lo ≤ hi) :
|
| 123 |
+
(⋃ j : Fin (gridCount lo hi η), assignedCell lo hi η j) = Set.Icc lo hi := by
|
| 124 |
+
ext x
|
| 125 |
+
simp only [Set.mem_iUnion]
|
| 126 |
+
exact ⟨fun ⟨j,hj⟩ => assignedCell_subset_interval h j hj,exists_assignedCell h⟩
|
| 127 |
+
|
| 128 |
+
theorem measurableSet_assignedCell (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) :
|
| 129 |
+
MeasurableSet (assignedCell lo hi η j) := by
|
| 130 |
+
unfold assignedCell
|
| 131 |
+
split_ifs <;> measurability
|
| 132 |
+
|
| 133 |
+
theorem assignedCell_ae_eq_closed (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) :
|
| 134 |
+
assignedCell lo hi η j =ᵐ[volume] Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) := by
|
| 135 |
+
unfold assignedCell
|
| 136 |
+
split_ifs
|
| 137 |
+
· rfl
|
| 138 |
+
· exact Ioc_ae_eq_Icc
|
| 139 |
+
|
| 140 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 141 |
+
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionIntegerBoundary.lean
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionIntegers
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 7 |
+
open IntegerCell Classical
|
| 8 |
+
|
| 9 |
+
theorem integer_log_eq_left_of_closed_not_assigned (N : ℕ) (lo hi η : ℝ)
|
| 10 |
+
(j : Fin (gridCount lo hi η)) {p : ℕ}
|
| 11 |
+
(hp : p ∈ cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)))
|
| 12 |
+
(hpnot : p ∉ assignedIntegerSupport N lo hi η j) :
|
| 13 |
+
Real.log (p:ℝ) = gridPoint lo hi η j.val := by
|
| 14 |
+
have hclosed := (mem_cellSupport _ _ _ _).mp hp
|
| 15 |
+
have hnot : ¬(j.val=0 ∨ gridPoint lo hi η j.val < Real.log (p:ℝ)) := by
|
| 16 |
+
intro h
|
| 17 |
+
exact hpnot (Finset.mem_filter.mpr ⟨hp,h⟩)
|
| 18 |
+
push Not at hnot
|
| 19 |
+
exact le_antisymm hnot.2 hclosed.2.2.1
|
| 20 |
+
|
| 21 |
+
theorem integer_closed_assigned_difference_card_le (N : ℕ) (lo hi η : ℝ)
|
| 22 |
+
(j : Fin (gridCount lo hi η)) :
|
| 23 |
+
((cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 24 |
+
assignedIntegerSupport N lo hi η j).card ≤ 1 := by
|
| 25 |
+
apply Finset.card_le_one.mpr
|
| 26 |
+
intro p hp q hq
|
| 27 |
+
have hp' := Finset.mem_sdiff.mp hp
|
| 28 |
+
have hq' := Finset.mem_sdiff.mp hq
|
| 29 |
+
have hpl := integer_log_eq_left_of_closed_not_assigned N lo hi η j hp'.1 hp'.2
|
| 30 |
+
have hql := integer_log_eq_left_of_closed_not_assigned N lo hi η j hq'.1 hq'.2
|
| 31 |
+
have hpp := ((mem_cellSupport _ _ _ _).mp hp'.1).2.1
|
| 32 |
+
have hqp := ((mem_cellSupport _ _ _ _).mp hq'.1).2.1
|
| 33 |
+
have he : (p:ℝ)=(q:ℝ) := Real.log_injOn_pos
|
| 34 |
+
(by change (0:ℝ)<p; exact_mod_cast hpp) (by change (0:ℝ)<q; exact_mod_cast hqp) (hpl.trans hql.symm)
|
| 35 |
+
exact_mod_cast he
|
| 36 |
+
|
| 37 |
+
theorem norm_integer_closed_assigned_test_error {E : Type*} [NormedAddCommGroup E]
|
| 38 |
+
(N : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) (f : ℕ → E)
|
| 39 |
+
{A : ℝ} (hA : 0 ≤ A)
|
| 40 |
+
(hf : ∀ p ∈ cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)),
|
| 41 |
+
p ∉ assignedIntegerSupport N lo hi η j → ‖f p‖ ≤ A) :
|
| 42 |
+
‖(∑ p ∈ cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)), f p) -
|
| 43 |
+
(∑ p ∈ assignedIntegerSupport N lo hi η j, f p)‖ ≤ A := by
|
| 44 |
+
have hsub : assignedIntegerSupport N lo hi η j ⊆
|
| 45 |
+
cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) :=
|
| 46 |
+
Finset.filter_subset _ _
|
| 47 |
+
rw [← Finset.sum_sdiff_eq_sub hsub]
|
| 48 |
+
apply (norm_sum_le _ _).trans
|
| 49 |
+
calc
|
| 50 |
+
_ ≤ ∑ _p ∈ (cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 51 |
+
assignedIntegerSupport N lo hi η j, A :=
|
| 52 |
+
Finset.sum_le_sum (fun p hp => hf p (Finset.mem_sdiff.mp hp).1 (Finset.mem_sdiff.mp hp).2)
|
| 53 |
+
_ = (((cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 54 |
+
assignedIntegerSupport N lo hi η j).card:ℝ)*A := by simp
|
| 55 |
+
_ ≤ A := by
|
| 56 |
+
have hc : (((cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))) \
|
| 57 |
+
assignedIntegerSupport N lo hi η j).card:ℝ) ≤ 1 := by
|
| 58 |
+
exact_mod_cast integer_closed_assigned_difference_card_le N lo hi η j
|
| 59 |
+
simpa using mul_le_mul_of_nonneg_right hc hA
|
| 60 |
+
|
| 61 |
+
def assignedIntegerResidueMass (N M : ℕ) (a : ZMod M) (lo hi η G : ℝ) (φ : ℝ → ℝ)
|
| 62 |
+
(j : Fin (gridCount lo hi η)) : ℝ :=
|
| 63 |
+
∑ n ∈ (assignedIntegerSupport N lo hi η j).filter (fun n : ℕ => (n:ZMod M)=a),
|
| 64 |
+
Real.exp (-G)*φ (Real.log n-G)
|
| 65 |
+
|
| 66 |
+
theorem integerResidueMass_assigned_error (N M : ℕ) (a : ZMod M) (lo hi η G : ℝ)
|
| 67 |
+
(φ : ℝ → ℝ) (j : Fin (gridCount lo hi η)) {B : ℝ} (hB : 0 ≤ B)
|
| 68 |
+
(hφ : ∀ t ∈ Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)),
|
| 69 |
+
|φ (t-G)| ≤ B) :
|
| 70 |
+
|integerResidueMass N M a (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) G φ -
|
| 71 |
+
assignedIntegerResidueMass N M a lo hi η G φ j| ≤ Real.exp (-G)*B := by
|
| 72 |
+
unfold integerResidueMass assignedIntegerResidueMass
|
| 73 |
+
rw [integerSupport_eq_filter]
|
| 74 |
+
simp only [Finset.sum_filter]
|
| 75 |
+
change ‖(∑ n ∈ cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)),
|
| 76 |
+
if (n:ZMod M)=a then Real.exp (-G)*φ (Real.log n-G) else 0) -
|
| 77 |
+
(∑ n ∈ assignedIntegerSupport N lo hi η j,
|
| 78 |
+
if (n:ZMod M)=a then Real.exp (-G)*φ (Real.log n-G) else 0)‖ ≤ _
|
| 79 |
+
apply norm_integer_closed_assigned_test_error N lo hi η j _ (mul_nonneg (Real.exp_pos _).le hB)
|
| 80 |
+
intro n hn hnnot
|
| 81 |
+
split_ifs
|
| 82 |
+
· rw [Real.norm_eq_abs,abs_mul,abs_of_pos (Real.exp_pos _)]
|
| 83 |
+
exact mul_le_mul_of_nonneg_left (hφ _ ((mem_cellSupport _ _ _ _).mp hn).2.2)
|
| 84 |
+
(Real.exp_pos _).le
|
| 85 |
+
· simpa using mul_nonneg (Real.exp_pos (-G)).le hB
|
| 86 |
+
|
| 87 |
+
theorem assignedIntegerResidueMass_error (N M : ℕ) [NeZero M] (a : ZMod M)
|
| 88 |
+
(lo hi η G : ℝ) (φ ψ : ℝ → ℝ) (j : Fin (gridCount lo hi η)) (B D : ℝ)
|
| 89 |
+
(h : lo ≤ hi) (hB : 0 ≤ B)
|
| 90 |
+
(hN : ⌊Real.exp (gridPoint lo hi η (j.val+1))⌋₊ ≤ N)
|
| 91 |
+
(hφ : ∀ t, HasDerivAt φ (ψ t) t) (hψ : Continuous ψ)
|
| 92 |
+
(hφB : ∀ t ∈ Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)), |φ (t-G)| ≤ B)
|
| 93 |
+
(hψD : ∀ t ∈ Set.Icc (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)), |ψ (t-G)| ≤ D) :
|
| 94 |
+
|assignedIntegerResidueMass N M a lo hi η G φ j -
|
| 95 |
+
integerDensityMass M (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) G φ| ≤
|
| 96 |
+
Real.exp (-G)*(6*B+2*D*(gridPoint lo hi η (j.val+1)-gridPoint lo hi η j.val)) := by
|
| 97 |
+
have hb := integerResidueMass_assigned_error N M a lo hi η G φ j hB hφB
|
| 98 |
+
have he := integerResidueMass_error N M a φ ψ G
|
| 99 |
+
(gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) B D
|
| 100 |
+
(gridPoint_mono h (Nat.le_succ _)) hN hφ hψ hφB hψD
|
| 101 |
+
have ht := abs_sub_le (assignedIntegerResidueMass N M a lo hi η G φ j)
|
| 102 |
+
(integerResidueMass N M a (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) G φ)
|
| 103 |
+
(integerDensityMass M (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) G φ)
|
| 104 |
+
rw [abs_sub_comm] at hb
|
| 105 |
+
nlinarith
|
| 106 |
+
|
| 107 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 108 |
+
|
| 109 |
+
end
|
| 110 |
+
|
| 111 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionIntegers.lean
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.IntegerCellTests
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionGrid
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 8 |
+
open IntegerCell Classical
|
| 9 |
+
|
| 10 |
+
theorem mem_cellSupport (N p : ℕ) (lo hi : ℝ) :
|
| 11 |
+
p ∈ cellSupport N lo hi ↔ p ≤ N ∧ 0 < p ∧ lo ≤ Real.log (p:ℝ) ∧ Real.log (p:ℝ) ≤ hi := by
|
| 12 |
+
simp only [cellSupport, Finset.mem_filter, Finset.mem_range, Nat.lt_succ_iff]
|
| 13 |
+
|
| 14 |
+
def assignedIntegerSupport (N : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) : Finset ℕ :=
|
| 15 |
+
(cellSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))).filter
|
| 16 |
+
(fun p => j.val=0 ∨ gridPoint lo hi η j.val < Real.log (p:ℝ))
|
| 17 |
+
|
| 18 |
+
theorem mem_assignedIntegerSupport (N p : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) :
|
| 19 |
+
p ∈ assignedIntegerSupport N lo hi η j ↔ p ≤ N ∧ 0 < p ∧ Real.log (p:ℝ) ∈ assignedCell lo hi η j := by
|
| 20 |
+
classical
|
| 21 |
+
simp only [assignedIntegerSupport,Finset.mem_filter,mem_cellSupport]
|
| 22 |
+
unfold assignedCell
|
| 23 |
+
split_ifs with hj
|
| 24 |
+
· simp [hj,Set.mem_Icc]
|
| 25 |
+
· simp [hj,Set.mem_Ioc]
|
| 26 |
+
constructor
|
| 27 |
+
· rintro ⟨⟨hpN,hp,hlo,hhi⟩,hlo'⟩
|
| 28 |
+
exact ⟨hpN,hp,hlo',hhi⟩
|
| 29 |
+
· rintro ⟨hpN,hp,hlo,hhi⟩
|
| 30 |
+
exact ⟨⟨hpN,hp,hlo.le,hhi⟩,hlo⟩
|
| 31 |
+
|
| 32 |
+
theorem assignedIntegerSupport_subset {N : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 33 |
+
(j : Fin (gridCount lo hi η)) : assignedIntegerSupport N lo hi η j ⊆ cellSupport N lo hi := by
|
| 34 |
+
intro p hp
|
| 35 |
+
obtain ⟨hpN,hpp,hcell⟩ := (mem_assignedIntegerSupport N p lo hi η j).mp hp
|
| 36 |
+
have hb := assignedCell_subset_interval h j hcell
|
| 37 |
+
exact (mem_cellSupport N p lo hi).mpr ⟨hpN,hpp,hb.1,hb.2⟩
|
| 38 |
+
|
| 39 |
+
theorem assignedIntegerSupport_eq_filter {N : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 40 |
+
(j : Fin (gridCount lo hi η)) :
|
| 41 |
+
assignedIntegerSupport N lo hi η j = (cellSupport N lo hi).filter
|
| 42 |
+
(fun p : ℕ => Real.log (p:ℝ) ∈ assignedCell lo hi η j) := by
|
| 43 |
+
classical
|
| 44 |
+
ext p
|
| 45 |
+
simp only [Finset.mem_filter]
|
| 46 |
+
constructor
|
| 47 |
+
· intro hp
|
| 48 |
+
exact ⟨assignedIntegerSupport_subset h j hp,(mem_assignedIntegerSupport N p lo hi η j).mp hp |>.2.2⟩
|
| 49 |
+
· rintro ⟨hp,hcell⟩
|
| 50 |
+
have hp' := (mem_cellSupport N p lo hi).mp hp
|
| 51 |
+
exact (mem_assignedIntegerSupport N p lo hi η j).mpr ⟨hp'.1,hp'.2.1,hcell⟩
|
| 52 |
+
|
| 53 |
+
theorem exists_unique_assignedInteger {N p : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 54 |
+
(hp : p ∈ cellSupport N lo hi) :
|
| 55 |
+
∃! j : Fin (gridCount lo hi η), p ∈ assignedIntegerSupport N lo hi η j := by
|
| 56 |
+
have hp' := (mem_cellSupport N p lo hi).mp hp
|
| 57 |
+
obtain ⟨j,hj⟩ := exists_assignedCell (η:=η) h hp'.2.2
|
| 58 |
+
refine ⟨j,(mem_assignedIntegerSupport N p lo hi η j).mpr ⟨hp'.1,hp'.2.1,hj⟩,?_⟩
|
| 59 |
+
intro k hk
|
| 60 |
+
by_contra hkj
|
| 61 |
+
exact Set.disjoint_left.mp (assignedCell_pairwiseDisjoint h hkj)
|
| 62 |
+
((mem_assignedIntegerSupport N p lo hi η k).mp hk).2.2 hj
|
| 63 |
+
|
| 64 |
+
theorem sum_assignedIntegerSupport {A : Type*} [AddCommMonoid A]
|
| 65 |
+
(N : ℕ) (lo hi η : ℝ) (h : lo ≤ hi) (f : ℕ → A) :
|
| 66 |
+
(∑ j : Fin (gridCount lo hi η), ∑ p ∈ assignedIntegerSupport N lo hi η j, f p) =
|
| 67 |
+
∑ p ∈ cellSupport N lo hi, f p := by
|
| 68 |
+
classical
|
| 69 |
+
simp_rw [assignedIntegerSupport_eq_filter h,Finset.sum_filter]
|
| 70 |
+
rw [Finset.sum_comm]
|
| 71 |
+
apply Finset.sum_congr rfl
|
| 72 |
+
intro p hp
|
| 73 |
+
have hp' := (mem_cellSupport N p lo hi).mp hp
|
| 74 |
+
obtain ⟨j,hj⟩ := exists_assignedCell (η:=η) h hp'.2.2
|
| 75 |
+
rw [Finset.sum_eq_single j]
|
| 76 |
+
· simp [hj]
|
| 77 |
+
· intro k hk hkj
|
| 78 |
+
have hnot : Real.log (p:ℝ) ∉ assignedCell lo hi η k := fun hkp =>
|
| 79 |
+
Set.disjoint_left.mp (assignedCell_pairwiseDisjoint h hkj) hkp hj
|
| 80 |
+
simp [hnot]
|
| 81 |
+
· simp
|
| 82 |
+
|
| 83 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 84 |
+
|
| 85 |
+
end
|
| 86 |
+
|
| 87 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMesh.lean
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionBoxes
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellMeshCounts
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 8 |
+
open PrimeCellMeshBudget
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 12 |
+
theorem boxLower_le_boxUpper {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i)
|
| 13 |
+
(j : GridBoxIndex lo hi η) (i : ι) : boxLower lo hi η j i ≤ boxUpper lo hi η j i :=
|
| 14 |
+
gridPoint_mono (h i) (Nat.le_succ _)
|
| 15 |
+
|
| 16 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 17 |
+
theorem boxLower_mem_interval {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i)
|
| 18 |
+
(j : GridBoxIndex lo hi η) (i : ι) : boxLower lo hi η j i ∈ Set.Icc (lo i) (hi i) :=
|
| 19 |
+
gridPoint_mem (h i) (j i).isLt.le
|
| 20 |
+
|
| 21 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 22 |
+
theorem boxUpper_mem_interval {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i)
|
| 23 |
+
(j : GridBoxIndex lo hi η) (i : ι) : boxUpper lo hi η j i ∈ Set.Icc (lo i) (hi i) :=
|
| 24 |
+
gridPoint_mem (h i) (show (j i).val+1 ≤ gridCount (lo i) (hi i) (η i) by omega)
|
| 25 |
+
|
| 26 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 27 |
+
theorem box_width_le {lo hi η : ι → ℝ} (h : ∀ i, lo i ≤ hi i) (hη : ∀ i, 0 < η i)
|
| 28 |
+
(j : GridBoxIndex lo hi η) (i : ι) : boxUpper lo hi η j i-boxLower lo hi η j i ≤ η i := by
|
| 29 |
+
rw [boxUpper,boxLower,gridPoint_width]
|
| 30 |
+
exact gridStep_le (h i) (hη i)
|
| 31 |
+
|
| 32 |
+
theorem gridCount_le_meshIntervals (r : ScaleBudget.Row) (L lo hi : ℝ)
|
| 33 |
+
(hlen : hi-lo ≤ Real.exp (r.a₁*L)) :
|
| 34 |
+
gridCount lo hi (meshWidth r L) ≤ meshIntervals r L := by
|
| 35 |
+
exact gridCount_le_ceiling (by unfold meshWidth; positivity) hlen
|
| 36 |
+
|
| 37 |
+
theorem gridBoxIndex_card (lo hi η : ι → ℝ) :
|
| 38 |
+
Fintype.card (GridBoxIndex lo hi η) = ∏ i, gridCount (lo i) (hi i) (η i) := by
|
| 39 |
+
rw [Fintype.card_pi]
|
| 40 |
+
simp
|
| 41 |
+
|
| 42 |
+
theorem gridBoxIndex_card_le_mesh_power (r : ScaleBudget.Row) (L : ℝ) (lo hi : ι → ℝ)
|
| 43 |
+
(hlen : ∀ i, hi i-lo i ≤ Real.exp (r.a₁*L)) :
|
| 44 |
+
Fintype.card (GridBoxIndex lo hi (fun _ => meshWidth r L)) ≤
|
| 45 |
+
(meshIntervals r L)^(Fintype.card ι) := by
|
| 46 |
+
rw [gridBoxIndex_card]
|
| 47 |
+
calc
|
| 48 |
+
_ ≤ ∏ _i : ι, meshIntervals r L :=
|
| 49 |
+
Finset.prod_le_prod (fun i hi' => gridCount_le_meshIntervals r L (lo i) (hi i) (hlen i))
|
| 50 |
+
_ = _ := by simp
|
| 51 |
+
|
| 52 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 53 |
+
|
| 54 |
+
end
|
| 55 |
+
|
| 56 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixed.lean
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionBoxes
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellIntegralFreezingMass
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 8 |
+
open MeasureTheory PrimeCellFreezing MixedCellIntegralFreezing
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
abbrev MixedGridIndex (loI hiI ηI : ℝ) (lo hi η : ι → ℝ) :=
|
| 12 |
+
Fin (gridCount loI hiI ηI) × GridBoxIndex lo hi η
|
| 13 |
+
|
| 14 |
+
def assignedMixedBox (loI hiI ηI : ℝ) (lo hi η : ι → ℝ)
|
| 15 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) : Set (ℝ × (ι → ℝ)) :=
|
| 16 |
+
assignedCell loI hiI ηI j.1 ×ˢ assignedBox lo hi η j.2
|
| 17 |
+
|
| 18 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 19 |
+
theorem assignedMixedBox_subset {loI hiI ηI : ℝ} {lo hi η : ι → ℝ}
|
| 20 |
+
(hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i) (j : MixedGridIndex loI hiI ηI lo hi η) :
|
| 21 |
+
assignedMixedBox loI hiI ηI lo hi η j ⊆ mixedLogRectangle loI hiI lo hi := by
|
| 22 |
+
intro t ht
|
| 23 |
+
exact ⟨assignedCell_subset_interval hI j.1 ht.1,assignedBox_subset_rectangle h j.2 ht.2⟩
|
| 24 |
+
|
| 25 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 26 |
+
theorem iUnion_assignedMixedBox {loI hiI ηI : ℝ} {lo hi η : ι → ℝ}
|
| 27 |
+
(hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i) :
|
| 28 |
+
(⋃ j : MixedGridIndex loI hiI ηI lo hi η, assignedMixedBox loI hiI ηI lo hi η j) =
|
| 29 |
+
mixedLogRectangle loI hiI lo hi := by
|
| 30 |
+
ext t
|
| 31 |
+
constructor
|
| 32 |
+
· rintro ht
|
| 33 |
+
obtain ⟨j,hj⟩ := Set.mem_iUnion.mp ht
|
| 34 |
+
exact assignedMixedBox_subset hI h j hj
|
| 35 |
+
· intro ht
|
| 36 |
+
obtain ⟨j,hj⟩ := exists_assignedCell (η:=ηI) hI ht.1
|
| 37 |
+
have hp : t.2 ∈ ⋃ k : GridBoxIndex lo hi η, assignedBox lo hi η k := by
|
| 38 |
+
rw [iUnion_assignedBox h]
|
| 39 |
+
exact ht.2
|
| 40 |
+
obtain ⟨k,hk⟩ := Set.mem_iUnion.mp hp
|
| 41 |
+
exact Set.mem_iUnion.mpr ⟨(j,k),hj,hk⟩
|
| 42 |
+
|
| 43 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 44 |
+
theorem assignedMixedBox_pairwiseDisjoint {loI hiI ηI : ℝ} {lo hi η : ι → ℝ}
|
| 45 |
+
(hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i) :
|
| 46 |
+
Pairwise (fun j k : MixedGridIndex loI hiI ηI lo hi η =>
|
| 47 |
+
Disjoint (assignedMixedBox loI hiI ηI lo hi η j) (assignedMixedBox loI hiI ηI lo hi η k)) := by
|
| 48 |
+
intro j k hjk
|
| 49 |
+
apply Set.disjoint_left.mpr
|
| 50 |
+
intro t htj htk
|
| 51 |
+
by_cases hfirst : j.1=k.1
|
| 52 |
+
· have hsecond : j.2≠k.2 := fun hh => hjk (Prod.ext hfirst hh)
|
| 53 |
+
exact Set.disjoint_left.mp (assignedBox_pairwiseDisjoint h hsecond) htj.2 htk.2
|
| 54 |
+
· exact Set.disjoint_left.mp (assignedCell_pairwiseDisjoint hI hfirst) htj.1 htk.1
|
| 55 |
+
|
| 56 |
+
omit [DecidableEq ι] in
|
| 57 |
+
theorem assignedMixedBox_ae_eq_closed (loI hiI ηI : ℝ) (lo hi η : ι → ℝ)
|
| 58 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) :
|
| 59 |
+
assignedMixedBox loI hiI ηI lo hi η j =ᵐ[volume]
|
| 60 |
+
mixedLogRectangle (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 61 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2) := by
|
| 62 |
+
exact Measure.set_prod_ae_eq (assignedCell_ae_eq_closed loI hiI ηI j.1)
|
| 63 |
+
(assignedBox_ae_eq_closed lo hi η j.2)
|
| 64 |
+
|
| 65 |
+
theorem integral_mixedRectangle_eq_sum_boxes {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
|
| 66 |
+
(loI hiI ηI : ℝ) (lo hi η : ι → ℝ) (hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i)
|
| 67 |
+
(f : (ℝ × (ι → ℝ)) → E) (hf : IntegrableOn f (mixedLogRectangle loI hiI lo hi)) :
|
| 68 |
+
(∫ t in mixedLogRectangle loI hiI lo hi, f t) =
|
| 69 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 70 |
+
∫ t in mixedLogRectangle (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 71 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2), f t := by
|
| 72 |
+
have hm (j : MixedGridIndex loI hiI ηI lo hi η) :
|
| 73 |
+
MeasurableSet (assignedMixedBox loI hiI ηI lo hi η j) :=
|
| 74 |
+
(measurableSet_assignedCell loI hiI ηI j.1).prod (measurableSet_assignedBox lo hi η j.2)
|
| 75 |
+
have hint (j : MixedGridIndex loI hiI ηI lo hi η) :
|
| 76 |
+
IntegrableOn f (assignedMixedBox loI hiI ηI lo hi η j) :=
|
| 77 |
+
hf.mono_set (assignedMixedBox_subset hI h j)
|
| 78 |
+
rw [← iUnion_assignedMixedBox (ηI:=ηI) (η:=η) hI h]
|
| 79 |
+
rw [integral_iUnion_fintype hm (assignedMixedBox_pairwiseDisjoint hI h) hint]
|
| 80 |
+
apply Finset.sum_congr rfl
|
| 81 |
+
intro j hj
|
| 82 |
+
exact setIntegral_congr_set (assignedMixedBox_ae_eq_closed loI hiI ηI lo hi η j)
|
| 83 |
+
|
| 84 |
+
theorem mixedLogMass_eq_sum_boxes (M : ℕ) (loI hiI ηI G : ℝ) (φ : ℝ → ℝ)
|
| 85 |
+
(w lo hi η : ι → ℝ) (hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i)
|
| 86 |
+
(hφ : Continuous φ) (hlo : ∀ i, 0 < lo i) :
|
| 87 |
+
mixedLogMass M loI hiI G φ w lo hi =
|
| 88 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 89 |
+
mixedLogMass M (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1)) G φ w
|
| 90 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2) :=
|
| 91 |
+
integral_mixedRectangle_eq_sum_boxes loI hiI ηI lo hi η hI h _
|
| 92 |
+
(integrableOn_mixedLogDensity M loI hiI G φ w lo hi hφ hlo)
|
| 93 |
+
|
| 94 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 95 |
+
|
| 96 |
+
end
|
| 97 |
+
|
| 98 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixedMesh.lean
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionMesh
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionMixed
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 8 |
+
open PrimeCellMeshBudget
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
theorem mixedGridIndex_card (loI hiI ηI : ℝ) (lo hi η : ι → ℝ) :
|
| 12 |
+
Fintype.card (MixedGridIndex loI hiI ηI lo hi η) =
|
| 13 |
+
gridCount loI hiI ηI * ∏ i, gridCount (lo i) (hi i) (η i) := by
|
| 14 |
+
rw [Fintype.card_prod, Fintype.card_fin, gridBoxIndex_card]
|
| 15 |
+
|
| 16 |
+
theorem mixedGridIndex_card_le_mesh_power (r : ScaleBudget.Row) (L loI hiI : ℝ)
|
| 17 |
+
(lo hi : ι → ℝ) (hI : hiI-loI ≤ Real.exp (r.a₁*L))
|
| 18 |
+
(hlen : ∀ i, hi i-lo i ≤ Real.exp (r.a₁*L)) :
|
| 19 |
+
Fintype.card (MixedGridIndex loI hiI (meshWidth r L) lo hi (fun _ => meshWidth r L)) ≤
|
| 20 |
+
(meshIntervals r L)^(Fintype.card ι+1) := by
|
| 21 |
+
rw [Fintype.card_prod, Fintype.card_fin]
|
| 22 |
+
calc
|
| 23 |
+
_ ≤ meshIntervals r L * (meshIntervals r L)^(Fintype.card ι) :=
|
| 24 |
+
Nat.mul_le_mul (gridCount_le_meshIntervals r L loI hiI hI)
|
| 25 |
+
(gridBoxIndex_card_le_mesh_power r L lo hi hlen)
|
| 26 |
+
_ = _ := by rw [pow_succ, Nat.mul_comm]
|
| 27 |
+
|
| 28 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 29 |
+
|
| 30 |
+
end
|
| 31 |
+
|
| 32 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionMixedTuples.lean
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionIntegers
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionMixed
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionTuples
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 8 |
+
|
| 9 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 10 |
+
|
| 11 |
+
noncomputable section
|
| 12 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 13 |
+
open IntegerCell PrimeCellReplacement
|
| 14 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 15 |
+
|
| 16 |
+
theorem sum_mixedTuples_eq_sum_assigned {A : Type*} [AddCommMonoid A]
|
| 17 |
+
(NI : ℕ) (N : ι → ℕ) (loI hiI ηI : ℝ) (lo hi η : ι → ℝ)
|
| 18 |
+
(hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i) (F : ℕ → (ι → ℕ) → A) :
|
| 19 |
+
(∑ n ∈ cellSupport NI loI hiI, ∑ p : PrimeCellTuple N lo hi, F n (fun i => (p i).val)) =
|
| 20 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 21 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 22 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2, F n (fun i => (p i).val) := by
|
| 23 |
+
classical
|
| 24 |
+
rw [← sum_assignedIntegerSupport NI loI hiI ηI hI]
|
| 25 |
+
rw [Fintype.sum_prod_type]
|
| 26 |
+
apply Finset.sum_congr rfl
|
| 27 |
+
intro j hj
|
| 28 |
+
simp_rw [sum_primeTuples_eq_sum_assigned N lo hi η h]
|
| 29 |
+
exact Finset.sum_comm
|
| 30 |
+
|
| 31 |
+
theorem sum_mixed_prior_eq_sum_assigned
|
| 32 |
+
(NI : ℕ) (N : ι → ℕ) (loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 33 |
+
(hI : loI ≤ hiI) (h : ∀ i, lo i ≤ hi i) (F : ℕ → (ι → ℕ) → ℂ) :
|
| 34 |
+
(∑ n ∈ cellSupport NI loI hiI, ∑ p : PrimeCellTuple N lo hi,
|
| 35 |
+
((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ) *
|
| 36 |
+
(∏ i, (((Z i*(p i).val)⁻¹:ℝ):ℂ)) * F n (fun i => (p i).val)) =
|
| 37 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 38 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 39 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2,
|
| 40 |
+
((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ) *
|
| 41 |
+
(∏ i, (((Z i*(p i).val)⁻¹:ℝ):ℂ)) * F n (fun i => (p i).val) :=
|
| 42 |
+
sum_mixedTuples_eq_sum_assigned NI N loI hiI ηI lo hi η hI h
|
| 43 |
+
(fun n p => ((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ) *
|
| 44 |
+
(∏ i, (((Z i*p i)⁻¹:ℝ):ℂ)) * F n p)
|
| 45 |
+
|
| 46 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 47 |
+
|
| 48 |
+
end
|
| 49 |
+
|
| 50 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionPrimes.lean
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionGrid
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 7 |
+
open PrimeProgression Classical
|
| 8 |
+
|
| 9 |
+
def assignedPrimeSupport (N : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) : Finset ℕ :=
|
| 10 |
+
(logPrimeSupport N (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))).filter
|
| 11 |
+
(fun p => j.val=0 ∨ gridPoint lo hi η j.val < Real.log (p:ℝ))
|
| 12 |
+
|
| 13 |
+
theorem mem_assignedPrimeSupport (N p : ℕ) (lo hi η : ℝ) (j : Fin (gridCount lo hi η)) :
|
| 14 |
+
p ∈ assignedPrimeSupport N lo hi η j ↔ p ≤ N ∧ p.Prime ∧ Real.log (p:ℝ) ∈ assignedCell lo hi η j := by
|
| 15 |
+
classical
|
| 16 |
+
simp only [assignedPrimeSupport,Finset.mem_filter,mem_logPrimeSupport]
|
| 17 |
+
unfold assignedCell
|
| 18 |
+
split_ifs with hj
|
| 19 |
+
· simp [hj,Set.mem_Icc]
|
| 20 |
+
· simp [hj,Set.mem_Ioc]
|
| 21 |
+
constructor
|
| 22 |
+
· rintro ⟨⟨hpN,hp,hlo,hhi⟩,hlo'⟩
|
| 23 |
+
exact ⟨hpN,hp,hlo',hhi⟩
|
| 24 |
+
· rintro ⟨hpN,hp,hlo,hhi⟩
|
| 25 |
+
exact ⟨⟨hpN,hp,hlo.le,hhi⟩,hlo⟩
|
| 26 |
+
|
| 27 |
+
theorem assignedPrimeSupport_subset {N : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 28 |
+
(j : Fin (gridCount lo hi η)) : assignedPrimeSupport N lo hi η j ⊆ logPrimeSupport N lo hi := by
|
| 29 |
+
intro p hp
|
| 30 |
+
obtain ⟨hpN,hpp,hcell⟩ := (mem_assignedPrimeSupport N p lo hi η j).mp hp
|
| 31 |
+
have hb := assignedCell_subset_interval h j hcell
|
| 32 |
+
exact (mem_logPrimeSupport N p lo hi).mpr ⟨hpN,hpp,hb.1,hb.2⟩
|
| 33 |
+
|
| 34 |
+
theorem assignedPrimeSupport_eq_filter {N : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 35 |
+
(j : Fin (gridCount lo hi η)) :
|
| 36 |
+
assignedPrimeSupport N lo hi η j = (logPrimeSupport N lo hi).filter
|
| 37 |
+
(fun p : ℕ => Real.log (p:ℝ) ∈ assignedCell lo hi η j) := by
|
| 38 |
+
classical
|
| 39 |
+
ext p
|
| 40 |
+
simp only [Finset.mem_filter]
|
| 41 |
+
constructor
|
| 42 |
+
· intro hp
|
| 43 |
+
exact ⟨assignedPrimeSupport_subset h j hp,(mem_assignedPrimeSupport N p lo hi η j).mp hp |>.2.2⟩
|
| 44 |
+
· rintro ⟨hp,hcell⟩
|
| 45 |
+
have hp' := (mem_logPrimeSupport N p lo hi).mp hp
|
| 46 |
+
exact (mem_assignedPrimeSupport N p lo hi η j).mpr ⟨hp'.1,hp'.2.1,hcell⟩
|
| 47 |
+
|
| 48 |
+
theorem exists_unique_assignedPrime {N p : ℕ} {lo hi η : ℝ} (h : lo ≤ hi)
|
| 49 |
+
(hp : p ∈ logPrimeSupport N lo hi) :
|
| 50 |
+
∃! j : Fin (gridCount lo hi η), p ∈ assignedPrimeSupport N lo hi η j := by
|
| 51 |
+
have hp' := (mem_logPrimeSupport N p lo hi).mp hp
|
| 52 |
+
obtain ⟨j,hj⟩ := exists_assignedCell (η:=η) h hp'.2.2
|
| 53 |
+
refine ⟨j,(mem_assignedPrimeSupport N p lo hi η j).mpr ⟨hp'.1,hp'.2.1,hj⟩,?_⟩
|
| 54 |
+
intro k hk
|
| 55 |
+
by_contra hkj
|
| 56 |
+
exact Set.disjoint_left.mp (assignedCell_pairwiseDisjoint h hkj)
|
| 57 |
+
((mem_assignedPrimeSupport N p lo hi η k).mp hk).2.2 hj
|
| 58 |
+
|
| 59 |
+
theorem sum_assignedPrimeSupport {A : Type*} [AddCommMonoid A]
|
| 60 |
+
(N : ℕ) (lo hi η : ℝ) (h : lo ≤ hi) (f : ℕ → A) :
|
| 61 |
+
(∑ j : Fin (gridCount lo hi η), ∑ p ∈ assignedPrimeSupport N lo hi η j, f p) =
|
| 62 |
+
∑ p ∈ logPrimeSupport N lo hi, f p := by
|
| 63 |
+
classical
|
| 64 |
+
simp_rw [assignedPrimeSupport_eq_filter h,Finset.sum_filter]
|
| 65 |
+
rw [Finset.sum_comm]
|
| 66 |
+
apply Finset.sum_congr rfl
|
| 67 |
+
intro p hp
|
| 68 |
+
have hp' := (mem_logPrimeSupport N p lo hi).mp hp
|
| 69 |
+
obtain ⟨j,hj⟩ := exists_assignedCell (η:=η) h hp'.2.2
|
| 70 |
+
rw [Finset.sum_eq_single j]
|
| 71 |
+
· simp [hj]
|
| 72 |
+
· intro k hk hkj
|
| 73 |
+
have hnot : Real.log (p:ℝ) ∉ assignedCell lo hi η k := fun hkp =>
|
| 74 |
+
Set.disjoint_left.mp (assignedCell_pairwiseDisjoint h hkj) hkp hj
|
| 75 |
+
simp [hnot]
|
| 76 |
+
· simp
|
| 77 |
+
|
| 78 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 79 |
+
|
| 80 |
+
end
|
| 81 |
+
|
| 82 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionReplacement.lean
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionBoundary
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 6 |
+
|
| 7 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 11 |
+
open PrimeProgression PrimeCellReplacement
|
| 12 |
+
|
| 13 |
+
theorem exists_assigned_residueMass_error_constants :
|
| 14 |
+
∃ d K L₀ : ℝ, 0 < d ∧ 0 < K ∧ 1 ≤ L₀ ∧ ∀ lo hi η : ℝ,
|
| 15 |
+
L₀ ≤ lo → lo ≤ hi → 0 < η → η ≤ 1 → ∀ (N M : ℕ) [NeZero M] (Z : ℝ),
|
| 16 |
+
⌊Real.exp hi⌋₊ ≤ N → 0 < Z → (M:ℝ) ≤ Real.exp (d*lo^(1/3:ℝ)) →
|
| 17 |
+
∀ j : Fin (gridCount lo hi η), ∀ a : ZMod M, IsUnit a →
|
| 18 |
+
|assignedResidueMass N M a lo hi η Z j -
|
| 19 |
+
harmonicIntegral M (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))/Z| ≤
|
| 20 |
+
(K/Z)*Real.exp (-d*(gridPoint lo hi η j.val)^(1/3:ℝ)) +
|
| 21 |
+
(Z*Real.exp (gridPoint lo hi η j.val))⁻¹ := by
|
| 22 |
+
obtain ⟨d,K,L₀,hd,hK,hL₀,hAP⟩ := exists_residueMass_error_constants
|
| 23 |
+
refine ⟨d,K,L₀,hd,hK,hL₀,?_⟩
|
| 24 |
+
intro lo hi η hlo horder hη hη1 N M _ Z hN hZ hmod j a ha
|
| 25 |
+
have hl := gridPoint_mem (η:=η) horder j.isLt.le
|
| 26 |
+
have hu := gridPoint_mem (η:=η) horder (show j.val+1≤gridCount lo hi η by omega)
|
| 27 |
+
have hcell : gridPoint lo hi η j.val ≤ gridPoint lo hi η (j.val+1) :=
|
| 28 |
+
gridPoint_mono horder (Nat.le_succ _)
|
| 29 |
+
have hlen : gridPoint lo hi η (j.val+1)-gridPoint lo hi η j.val ≤ 1 := by
|
| 30 |
+
rw [gridPoint_width]
|
| 31 |
+
exact (gridStep_le horder hη).trans hη1
|
| 32 |
+
have hcut : ⌊Real.exp (gridPoint lo hi η (j.val+1))⌋₊ ≤ N :=
|
| 33 |
+
(Nat.floor_mono (Real.exp_le_exp.mpr hu.2)).trans hN
|
| 34 |
+
have hmod' : (M:ℝ) ≤ Real.exp (d*(gridPoint lo hi η j.val)^(1/3:ℝ)) := by
|
| 35 |
+
apply hmod.trans
|
| 36 |
+
apply Real.exp_le_exp.mpr
|
| 37 |
+
exact mul_le_mul_of_nonneg_left
|
| 38 |
+
(Real.rpow_le_rpow (by linarith : 0≤lo) hl.1 (by norm_num)) hd.le
|
| 39 |
+
have hc := hAP (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))
|
| 40 |
+
(hlo.trans hl.1) hcell hlen N M a Z hcut (NeZero.pos M) ha hZ hmod'
|
| 41 |
+
have hb := residueMass_assigned_error N M a lo hi η j hZ
|
| 42 |
+
calc
|
| 43 |
+
_ ≤ |assignedResidueMass N M a lo hi η Z j -
|
| 44 |
+
residueMass N M a (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) Z| +
|
| 45 |
+
|residueMass N M a (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1)) Z -
|
| 46 |
+
harmonicIntegral M (gridPoint lo hi η j.val) (gridPoint lo hi η (j.val+1))/Z| :=
|
| 47 |
+
abs_sub_le _ _ _
|
| 48 |
+
_ ≤ (Z*Real.exp (gridPoint lo hi η j.val))⁻¹ +
|
| 49 |
+
(K/Z)*Real.exp (-d*(gridPoint lo hi η j.val)^(1/3:ℝ)) :=
|
| 50 |
+
add_le_add (by simpa only [abs_sub_comm] using hb) hc
|
| 51 |
+
_ = _ := by ring
|
| 52 |
+
|
| 53 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 54 |
+
|
| 55 |
+
end
|
| 56 |
+
|
| 57 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/LogCellPartitionTuples.lean
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionBoxes
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionPrimes
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellJointReplacementPrior
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 8 |
+
|
| 9 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 10 |
+
|
| 11 |
+
noncomputable section
|
| 12 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 13 |
+
open PrimeProgression PrimeCellReplacement
|
| 14 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 15 |
+
|
| 16 |
+
abbrev AssignedPrimeTuple (N : ι → ℕ) (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η) :=
|
| 17 |
+
∀ i, {p : ℕ // p ∈ assignedPrimeSupport (N i) (lo i) (hi i) (η i) (j i)}
|
| 18 |
+
|
| 19 |
+
def assignedTupleEquiv (N : ι → ℕ) (lo hi η : ι → ℝ) (h : ∀ i, lo i ≤ hi i) :
|
| 20 |
+
(Σ j : GridBoxIndex lo hi η, AssignedPrimeTuple N lo hi η j) ≃ PrimeCellTuple N lo hi :=
|
| 21 |
+
Equiv.ofBijective
|
| 22 |
+
(fun x i => ⟨(x.2 i).val,assignedPrimeSupport_subset (h i) (x.1 i) (x.2 i).property⟩) (by
|
| 23 |
+
constructor
|
| 24 |
+
· rintro ⟨j,p⟩ ⟨k,q⟩ he
|
| 25 |
+
have hv (i : ι) : (p i).val=(q i).val := congrArg Subtype.val (congrFun he i)
|
| 26 |
+
have hjk : j=k := by
|
| 27 |
+
funext i
|
| 28 |
+
have hu := exists_unique_assignedPrime (η:=η i) (h i)
|
| 29 |
+
(assignedPrimeSupport_subset (h i) (j i) (p i).property)
|
| 30 |
+
exact hu.unique (p i).property (by rw [hv i]; exact (q i).property)
|
| 31 |
+
cases hjk
|
| 32 |
+
apply congrArg (Sigma.mk j)
|
| 33 |
+
funext i
|
| 34 |
+
exact Subtype.ext (hv i)
|
| 35 |
+
· intro p
|
| 36 |
+
have hc : ∀ i, ∃ j : Fin (gridCount (lo i) (hi i) (η i)),
|
| 37 |
+
(p i).val ∈ assignedPrimeSupport (N i) (lo i) (hi i) (η i) j :=
|
| 38 |
+
fun i => (exists_unique_assignedPrime (η:=η i) (h i) (p i).property).exists
|
| 39 |
+
choose j hj using hc
|
| 40 |
+
refine ⟨⟨j,fun i => ⟨(p i).val,hj i⟩⟩,?_⟩
|
| 41 |
+
funext i
|
| 42 |
+
rfl)
|
| 43 |
+
|
| 44 |
+
theorem sum_primeTuples_eq_sum_assigned {A : Type*} [AddCommMonoid A]
|
| 45 |
+
(N : ι → ℕ) (lo hi η : ι → ℝ) (h : ∀ i, lo i ≤ hi i) (F : (ι → ℕ) → A) :
|
| 46 |
+
(∑ p : PrimeCellTuple N lo hi, F (fun i => (p i).val)) =
|
| 47 |
+
∑ j : GridBoxIndex lo hi η, ∑ p : AssignedPrimeTuple N lo hi η j, F (fun i => (p i).val) := by
|
| 48 |
+
classical
|
| 49 |
+
have hh := Fintype.sum_equiv (assignedTupleEquiv N lo hi η h)
|
| 50 |
+
(fun x => F (fun i => (x.2 i).val)) (fun p => F (fun i => (p i).val)) (fun x => rfl)
|
| 51 |
+
simpa only [Fintype.sum_sigma] using hh.symm
|
| 52 |
+
|
| 53 |
+
theorem sum_product_prime_prior_eq_sum_assigned
|
| 54 |
+
(N : ι → ℕ) (lo hi η Z : ι → ℝ) (h : ∀ i, lo i ≤ hi i) (F : (ι → ℕ) → ℂ) :
|
| 55 |
+
(∑ p : PrimeCellTuple N lo hi,
|
| 56 |
+
(∏ i, (((Z i*(p i).val)⁻¹:ℝ):ℂ))*F (fun i => (p i).val)) =
|
| 57 |
+
∑ j : GridBoxIndex lo hi η, ∑ p : AssignedPrimeTuple N lo hi η j,
|
| 58 |
+
(∏ i, (((Z i*(p i).val)⁻¹:ℝ):ℂ))*F (fun i => (p i).val) :=
|
| 59 |
+
sum_primeTuples_eq_sum_assigned N lo hi η h (fun p => (∏ i, (((Z i*p i)⁻¹:ℝ):ℂ))*F p)
|
| 60 |
+
|
| 61 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 62 |
+
|
| 63 |
+
end
|
| 64 |
+
|
| 65 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MatchedHistoryEnergy.lean
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Construction.MatchedDiagonalEnergy
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Construction.ConstituentUniqueRootEnergy
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Matched diagonal energy without a frequency-history multiplicity loss -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped BigOperators Classical ComplexConjugate
|
| 10 |
+
|
| 11 |
+
theorem permuted_root_energy_le {A R : Type*} [Fintype A] [Fintype R]
|
| 12 |
+
(e : Equiv.Perm A) (μ : A → ℝ) (F : R → A → ℂ) (A₀ : ℝ)
|
| 13 |
+
(hA₀ : 0 ≤ A₀) (hμ : ∀ a, 0 ≤ μ a) (hbound : ∀ a, μ a ≤ A₀) :
|
| 14 |
+
‖∑ s, ∑ a, ((μ a * μ (e a) : ℝ) : ℂ) * F s a * conj (F s (e a))‖ ≤
|
| 15 |
+
A₀ * ∑ s, ∑ a, μ a * ‖F s a‖ ^ 2 := by
|
| 16 |
+
have hs (s : R) := matched_diagonal_energy e μ μ (F s) (F s) (fun _ => 1) A₀
|
| 17 |
+
hA₀ hμ hμ (fun _ => by simp) (fun a _ _ => ⟨hbound a, hbound (e a)⟩)
|
| 18 |
+
simp only [mul_one] at hs
|
| 19 |
+
calc
|
| 20 |
+
_ ≤ ∑ s, ‖∑ a, ((μ a * μ (e a) : ℝ) : ℂ) * F s a * conj (F s (e a))‖ := norm_sum_le _ _
|
| 21 |
+
_ ≤ ∑ s, A₀ / 2 * ((∑ a, μ a * ‖F s a‖ ^ 2) + ∑ a, μ a * ‖F s a‖ ^ 2) :=
|
| 22 |
+
Finset.sum_le_sum fun s _ => hs s
|
| 23 |
+
_ = _ := by rw [← Finset.mul_sum, Finset.sum_add_distrib]; ring
|
| 24 |
+
|
| 25 |
+
/-- Root equality is retained in the diagonal. Uniqueness removes the entire
|
| 26 |
+
frequency-history multiplicity from its square-energy estimate. -/
|
| 27 |
+
theorem permuted_history_energy_le {A D R : Type*}
|
| 28 |
+
[Fintype A] [Fintype D] [Fintype R]
|
| 29 |
+
(e : Equiv.Perm A) (μ : A → ℝ) (root : D → R) (F : D → A → ℂ) (A₀ : ℝ)
|
| 30 |
+
(hA₀ : 0 ≤ A₀) (hμ : ∀ a, 0 ≤ μ a) (hbound : ∀ a, μ a ≤ A₀)
|
| 31 |
+
(hunique : ∀ a d d', F d a ≠ 0 → F d' a ≠ 0 → root d = root d' → d = d') :
|
| 32 |
+
‖∑ d, ∑ d', if root d = root d' then
|
| 33 |
+
∑ a, ((μ a * μ (e a) : ℝ) : ℂ) * (F d a * conj (F d' (e a))) else 0‖ ≤
|
| 34 |
+
A₀ * ∑ d, ∑ a, μ a * ‖F d a‖ ^ 2 := by
|
| 35 |
+
rw [← rootFibreSum_weighted_pair root root (fun a => μ a * μ (e a)) F
|
| 36 |
+
(fun d a => F d (e a))]
|
| 37 |
+
have h := permuted_root_energy_le e μ (fun s a => rootFibreSum root s (fun d => F d a))
|
| 38 |
+
A₀ hA₀ hμ hbound
|
| 39 |
+
simp only [mul_assoc] at h
|
| 40 |
+
apply h.trans_eq
|
| 41 |
+
congr 1
|
| 42 |
+
rw [Finset.sum_comm]
|
| 43 |
+
simp_rw [← Finset.mul_sum, rootFibreSum_energy_of_unique root _ (hunique _), Finset.mul_sum]
|
| 44 |
+
exact Finset.sum_comm
|
| 45 |
+
|
| 46 |
+
end Ostmann
|
| 47 |
+
|
| 48 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MatchedPriorCorrelation.lean
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Construction.MatchedHarmonicPrior
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Construction.MatchedGraphQuotient
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Exact counterpart-prior extraction before the external-pivot sum -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
|
| 10 |
+
open scoped BigOperators Classical
|
| 11 |
+
|
| 12 |
+
noncomputable def counterpartRoleUnary {n : ℕ} (Q : Fin n → Finset ℕ)
|
| 13 |
+
(e : Equiv.Perm (Fin n)) (ν : Fin n → ℕ → ℂ) (i : Fin n) (p : ℕ) : ℂ :=
|
| 14 |
+
(if p ∈ Q (e.symm i) then 1 else 0) * ν i p
|
| 15 |
+
|
| 16 |
+
theorem counterpartRoleUnary_norm {n : ℕ} (Q : Fin n → Finset ℕ)
|
| 17 |
+
(e : Equiv.Perm (Fin n)) (ν : Fin n → ℕ → ℂ)
|
| 18 |
+
(hν : ∀ i p, ‖ν i p‖ ≤ 1) (i : Fin n) (p : ℕ) :
|
| 19 |
+
‖counterpartRoleUnary Q e ν i p‖ ≤ 1 := by
|
| 20 |
+
unfold counterpartRoleUnary
|
| 21 |
+
split_ifs
|
| 22 |
+
· simpa only [one_mul] using hν i p
|
| 23 |
+
· simp only [zero_mul, norm_zero, zero_le_one]
|
| 24 |
+
|
| 25 |
+
theorem counterpartRole_finiteEdgeWeight {n : ℕ} (P : Finset ℕ)
|
| 26 |
+
(Q : Fin n → Finset ℕ) (e : Equiv.Perm (Fin n))
|
| 27 |
+
(E : Fin n → Fin n → ℕ → ℕ → ℂ) (ν : Fin n → ℕ → ℂ) (x : Fin n → P) :
|
| 28 |
+
((∏ i, counterpartRoleFactor P Q e i (x i) : ℝ) : ℂ) *
|
| 29 |
+
finiteEdgeWeight E ν (fun i => (x i : ℕ)) =
|
| 30 |
+
finiteEdgeWeight E (counterpartRoleUnary Q e ν) (fun i => (x i : ℕ)) := by
|
| 31 |
+
simp only [Complex.ofReal_prod, finiteEdgeWeight, ← Finset.prod_mul_distrib]
|
| 32 |
+
apply Finset.prod_congr rfl
|
| 33 |
+
intro i _
|
| 34 |
+
simp only [counterpartRoleFactor, counterpartRoleUnary]
|
| 35 |
+
split_ifs <;> simp only [Complex.ofReal_one, Complex.ofReal_zero, one_mul, zero_mul]
|
| 36 |
+
|
| 37 |
+
/-- This equality factors out the harmonic normalizer and the reciprocal
|
| 38 |
+
product scale before any external integer is summed. -/
|
| 39 |
+
theorem matched_harmonic_correlation_eq {n : ℕ} (P : Finset ℕ)
|
| 40 |
+
(Q : Fin n → Finset ℕ) (e : Equiv.Perm (Fin n))
|
| 41 |
+
(μ : (Fin n → P) → ℝ) (G : (Fin n → P) → ℂ)
|
| 42 |
+
(X : ℝ) (hX : X ≠ 0) :
|
| 43 |
+
(∑ x, (μ x : ℂ) *
|
| 44 |
+
(productPrior (fun i => primeSubsetPrior P (Q i)) (fun i => x (e i)) : ℂ) * G x) =
|
| 45 |
+
(((∏ i, (∑ p ∈ Q i, (p : ℝ)⁻¹)⁻¹) * X⁻¹ : ℝ) : ℂ) *
|
| 46 |
+
∑ x, (μ x : ℂ) * ((X / (∏ i, (x i : ℝ)) : ℝ) : ℂ) *
|
| 47 |
+
((∏ i, counterpartRoleFactor P Q e i (x i) : ℝ) : ℂ) * G x := by
|
| 48 |
+
rw [Finset.mul_sum]
|
| 49 |
+
apply Finset.sum_congr rfl
|
| 50 |
+
intro x _
|
| 51 |
+
rw [matched_harmonic_prior]
|
| 52 |
+
have he (C H R : ℝ) : C * H⁻¹ * R = (C * X⁻¹) * (X / H) * R := by
|
| 53 |
+
rw [div_eq_mul_inv]
|
| 54 |
+
calc
|
| 55 |
+
_ = C * (X⁻¹ * X) * H⁻¹ * R := by rw [inv_mul_cancel₀ hX]; ring
|
| 56 |
+
_ = _ := by ring
|
| 57 |
+
rw [he]
|
| 58 |
+
push_cast
|
| 59 |
+
ring
|
| 60 |
+
|
| 61 |
+
/-- The actual two-prior correlation has the already-extracted small factor.
|
| 62 |
+
Its hypothesis is the normalized ratio bound supplied by FullPrimeRatioPair. -/
|
| 63 |
+
theorem matched_harmonic_correlation_bound {n : ℕ} (P : Finset ℕ)
|
| 64 |
+
(Q : Fin n → Finset ℕ) (e : Equiv.Perm (Fin n))
|
| 65 |
+
(μ : (Fin n → P) → ℝ) (G : (Fin n → P) → ℂ)
|
| 66 |
+
(X δ : ℝ) (hX : 0 < X)
|
| 67 |
+
(hbound : ‖∑ x, (μ x : ℂ) * ((X / (∏ i, (x i : ℝ)) : ℝ) : ℂ) *
|
| 68 |
+
((∏ i, counterpartRoleFactor P Q e i (x i) : ℝ) : ℂ) * G x‖ ≤ δ) :
|
| 69 |
+
‖∑ x, (μ x : ℂ) *
|
| 70 |
+
(productPrior (fun i => primeSubsetPrior P (Q i)) (fun i => x (e i)) : ℂ) * G x‖ ≤
|
| 71 |
+
(∏ i, (∑ p ∈ Q i, (p : ℝ)⁻¹)⁻¹) * X⁻¹ * δ := by
|
| 72 |
+
rw [matched_harmonic_correlation_eq P Q e μ G X hX.ne', norm_mul,
|
| 73 |
+
Complex.norm_real, Real.norm_of_nonneg (by positivity)]
|
| 74 |
+
exact mul_le_mul_of_nonneg_left hbound (by positivity)
|
| 75 |
+
|
| 76 |
+
end Ostmann
|
| 77 |
+
|
| 78 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacement.lean
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellGridReplacementAssigned
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellGridReplacementSmooth
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 7 |
+
|
| 8 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 12 |
+
open scoped BigOperators
|
| 13 |
+
open PrimeProgression PrimeCellReplacement PrimeCellFreezing MixedCellIntegralFreezing Characters.RationalHistory
|
| 14 |
+
|
| 15 |
+
theorem exists_mixed_grid_smooth_replacement_constants :
|
| 16 |
+
∃ d K L₀ : ℝ, 0 < d ∧ 0 < K ∧ 1 ≤ L₀ ∧
|
| 17 |
+
∀ (ι : Type*) [Fintype ι] [DecidableEq ι]
|
| 18 |
+
(NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 19 |
+
(loI hiI ηI G Bφ Dφ : ℝ) (φ ψ : ℝ → ℝ) (lo hi η Z : ι → ℝ),
|
| 20 |
+
loI ≤ hiI → 0 < ηI → ⌊Real.exp hiI⌋₊ ≤ NI →
|
| 21 |
+
(∀ t, HasDerivAt φ (ψ t) t) → Continuous ψ →
|
| 22 |
+
(∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G)) →
|
| 23 |
+
(∀ t ∈ Set.Icc loI hiI, |φ (t-G)| ≤ Bφ) →
|
| 24 |
+
(∀ t ∈ Set.Icc loI hiI, |ψ (t-G)| ≤ Dφ) →
|
| 25 |
+
(∀ i, L₀ ≤ lo i ∧ lo i ≤ hi i ∧ 0 < η i ∧ η i ≤ 1 ∧
|
| 26 |
+
⌊Real.exp (hi i)⌋₊ ≤ N i ∧ 0 < Z i ∧
|
| 27 |
+
(M:ℝ) ≤ Real.exp (d*(lo i)^(1/3:ℝ))) →
|
| 28 |
+
∀ ε B error : ℝ, 0 ≤ ε → 1 ≤ B → 0 ≤ error →
|
| 29 |
+
(∀ (j : MixedGridIndex loI hiI ηI lo hi η) i,
|
| 30 |
+
(K/Z i)*Real.exp (-d*(boxLower lo hi η j.2 i)^(1/3:ℝ))+
|
| 31 |
+
(Z i*Real.exp (boxLower lo hi η j.2 i))⁻¹ ≤ ε) →
|
| 32 |
+
(∀ (j : MixedGridIndex loI hiI ηI lo hi η) i,
|
| 33 |
+
|harmonicIntegral M (boxLower lo hi η j.2 i) (boxUpper lo hi η j.2 i)/Z i|+
|
| 34 |
+
((K/Z i)*Real.exp (-d*(boxLower lo hi η j.2 i)^(1/3:ℝ))+
|
| 35 |
+
(Z i*Real.exp (boxLower lo hi η j.2 i))⁻¹) ≤ B) →
|
| 36 |
+
(∀ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 37 |
+
mixedGridError (ι:=ι) M loI hiI ηI G Bφ Dφ φ ε B j.1 ≤ error) →
|
| 38 |
+
∀ (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ) (D mesh A : ℝ),
|
| 39 |
+
0 ≤ D → 0 ≤ mesh → ηI ≤ mesh → (∀ i, η i ≤ mesh) →
|
| 40 |
+
(∀ z∈logRectangle (Option.elim' loI lo) (Option.elim' hiI hi),
|
| 41 |
+
DifferentiableAt ℝ (fun y => f (fun i => Real.exp (y i))) z) →
|
| 42 |
+
(∀ z∈logRectangle (Option.elim' loI lo) (Option.elim' hiI hi),∀ i,
|
| 43 |
+
‖deriv (fun t => f (Expr.logCurve (fun i => Real.exp (z i)) i t)) 0‖ ≤ D) →
|
| 44 |
+
(∀ z∈logRectangle (Option.elim' loI lo) (Option.elim' hiI hi),
|
| 45 |
+
‖f (fun i => Real.exp (z i))‖ ≤ A) →
|
| 46 |
+
‖mixedSmoothTestSum NI N M loI hiI G φ lo hi Z F f-
|
| 47 |
+
mixedPrincipalIntegral M loI hiI G φ lo hi Z f*
|
| 48 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u‖ ≤
|
| 49 |
+
(2*(((Fintype.card ι:ℝ)+1)*D*mesh)*mixedPrincipalMass M loI hiI G φ lo hi Z+
|
| 50 |
+
(((Fintype.card ι:ℝ)+1)*D*mesh+A)*
|
| 51 |
+
(Fintype.card (MixedGridIndex loI hiI ηI lo hi η)*error))*
|
| 52 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖ := by
|
| 53 |
+
obtain ⟨d,K,L₀,hd,hK,hL₀,hAP⟩ := exists_assigned_mixedCell_replacement_constants
|
| 54 |
+
refine ⟨d,K,L₀,hd,hK,hL₀,?_⟩
|
| 55 |
+
intro ι _ _ NI N M _ loI hiI ηI G Bφ Dφ φ ψ lo hi η Z
|
| 56 |
+
hI hηI hNI hφ hψ hφ0 hBφ hDφ hcell ε B error hε hB herror hE hbound herrorBound
|
| 57 |
+
F f D mesh A hD hm hmeshI hmesh hf hderiv hA
|
| 58 |
+
classical
|
| 59 |
+
have hφc : Continuous φ := continuous_iff_continuousAt.mpr fun t => (hφ t).continuousAt
|
| 60 |
+
have horder : ∀ i, lo i ≤ hi i := fun i => (hcell i).2.1
|
| 61 |
+
have hlo : ∀ i, 0 < lo i := fun i => lt_of_lt_of_le (by linarith) (hcell i).1
|
| 62 |
+
have hη : ∀ i, 0 < η i := fun i => (hcell i).2.2.1
|
| 63 |
+
have hZ : ∀ i, 0 < Z i := fun i => (hcell i).2.2.2.2.2.1
|
| 64 |
+
let v : ℝ := ((Fintype.card ι:ℝ)+1)*D*mesh
|
| 65 |
+
let T : ℝ := ∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖
|
| 66 |
+
let mass : MixedGridIndex loI hiI ηI lo hi η → ℝ := fun j =>
|
| 67 |
+
mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 68 |
+
G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z
|
| 69 |
+
have hT0 : 0 ≤ T := Finset.sum_nonneg fun _ _ => Finset.sum_nonneg fun _ _ => norm_nonneg _
|
| 70 |
+
have hlocal (j : MixedGridIndex loI hiI ηI lo hi η) :
|
| 71 |
+
‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 72 |
+
mixedPrincipalIntegral M (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 73 |
+
G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z f*
|
| 74 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u‖ ≤ (v*(2*mass j+error)+A*error)*T := by
|
| 75 |
+
have hl := gridPoint_mem (η:=ηI) hI j.1.isLt.le
|
| 76 |
+
have hu := gridPoint_mem (η:=ηI) hI (show j.1.val+1 ≤ gridCount loI hiI ηI by omega)
|
| 77 |
+
have hsubI : Set.Icc (gridPoint loI hiI ηI j.1.val)
|
| 78 |
+
(gridPoint loI hiI ηI (j.1.val+1)) ⊆ Set.Icc loI hiI :=
|
| 79 |
+
fun _ ht => ⟨hl.1.trans ht.1,ht.2.trans hu.2⟩
|
| 80 |
+
have hsub : logRectangle
|
| 81 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 82 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)) ⊆
|
| 83 |
+
logRectangle (Option.elim' loI lo) (Option.elim' hiI hi) := by
|
| 84 |
+
intro z hz i hi'
|
| 85 |
+
cases i with
|
| 86 |
+
| none => exact hsubI (hz none (Set.mem_univ _))
|
| 87 |
+
| some i =>
|
| 88 |
+
exact ⟨(boxLower_ge lo hi η horder j.2 i).trans (hz (some i) (Set.mem_univ _)).1,
|
| 89 |
+
(hz (some i) (Set.mem_univ _)).2.trans (boxUpper_le lo hi η horder j.2 i)⟩
|
| 90 |
+
let base : ℝ × (ι → ℝ) := (gridPoint loI hiI ηI j.1.val,boxLower lo hi η j.2)
|
| 91 |
+
have hbase : base∈mixedLogRectangle
|
| 92 |
+
(gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 93 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2) :=
|
| 94 |
+
⟨⟨le_rfl,gridPoint_mono hI (Nat.le_succ _)⟩,
|
| 95 |
+
fun i _ => ⟨le_rfl,box_order lo hi η horder j.2 i⟩⟩
|
| 96 |
+
have hb := mixed_assigned_smooth_replacement_of_errors (error:=error)
|
| 97 |
+
NI N loI hiI ηI G φ lo hi η Z j hφc (fun t ht => hφ0 t (hsubI ht)) hZ
|
| 98 |
+
(fun i => (hlo i).trans_le (boxLower_ge lo hi η horder j.2 i)) F f hD hm
|
| 99 |
+
((gridPoint_width loI hiI ηI j.1.val).trans_le ((gridStep_le hI hηI).trans hmeshI))
|
| 100 |
+
(fun i => (box_width_le lo hi η horder hη j.2 i).trans (hmesh i))
|
| 101 |
+
(fun z hz => hf z (hsub hz)) (fun z hz => hderiv z (hsub hz)) hbase
|
| 102 |
+
have he := hAP ι NI N M loI hiI ηI G Bφ Dφ φ ψ lo hi η Z
|
| 103 |
+
hI hNI hφ hψ hBφ hDφ hcell j ε B hε hB (hE j) (hbound j) F
|
| 104 |
+
have heAbs := hAP ι NI N M loI hiI ηI G Bφ Dφ φ ψ lo hi η Z
|
| 105 |
+
hI hNI hφ hψ hBφ hDφ hcell j ε B hε hB (hE j) (hbound j) (fun r u => (‖F r u‖:ℂ))
|
| 106 |
+
have he' := he.trans (mul_le_mul_of_nonneg_right (herrorBound j) hT0)
|
| 107 |
+
have heAbs' : ‖mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j (fun r u => (‖F r u‖:ℂ))-
|
| 108 |
+
(mass j:ℂ)*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,(‖F r u‖:ℂ)‖ ≤ error*T := by
|
| 109 |
+
simp only [Complex.norm_real,Real.norm_eq_abs,abs_norm] at heAbs
|
| 110 |
+
exact heAbs.trans (mul_le_mul_of_nonneg_right (herrorBound j) hT0)
|
| 111 |
+
have hAbase : ‖f (optionCoordinates (mixedExp base))‖ ≤ A := by
|
| 112 |
+
simpa only [optionCoordinates_mixedExp] using
|
| 113 |
+
hA _ (hsub ((optionCoordinates_mem_logRectangle _ _ _ _).mpr hbase))
|
| 114 |
+
exact (hb he' heAbs').trans (mul_le_mul_of_nonneg_right
|
| 115 |
+
(add_le_add le_rfl (mul_le_mul_of_nonneg_right hAbase herror)) hT0)
|
| 116 |
+
have hsum : (∑ j : MixedGridIndex loI hiI ηI lo hi η,(v*(2*mass j+error)+A*error)) =
|
| 117 |
+
2*v*mixedPrincipalMass M loI hiI G φ lo hi Z+
|
| 118 |
+
(v+A)*(Fintype.card (MixedGridIndex loI hiI ηI lo hi η)*error) := by
|
| 119 |
+
simp_rw [mul_add]
|
| 120 |
+
rw [Finset.sum_add_distrib,Finset.sum_add_distrib]
|
| 121 |
+
simp only [← mul_assoc,← Finset.mul_sum,Finset.sum_const,Finset.card_univ,nsmul_eq_mul]
|
| 122 |
+
rw [show (∑ j : MixedGridIndex loI hiI ηI lo hi η,mass j)=mixedPrincipalMass M loI hiI G φ lo hi Z from
|
| 123 |
+
(mixedPrincipalMass_eq_sum_boxes M loI hiI ηI G φ lo hi η Z hI horder hφc hlo).symm]
|
| 124 |
+
ring
|
| 125 |
+
rw [mixedSmoothTestSum_eq_sum_assigned NI N loI hiI ηI G φ lo hi η Z hI horder F f,
|
| 126 |
+
mixedPrincipalIntegral_eq_sum_boxes M loI hiI ηI G φ lo hi η Z hI horder hφc hlo f
|
| 127 |
+
(fun z hz => (hf z hz).continuousAt.continuousWithinAt),Finset.sum_mul,← Finset.sum_sub_distrib]
|
| 128 |
+
calc
|
| 129 |
+
_ ≤ ∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 130 |
+
‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 131 |
+
mixedPrincipalIntegral M (gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 132 |
+
G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z f*
|
| 133 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u‖ := norm_sum_le _ _
|
| 134 |
+
_ ≤ ∑ j : MixedGridIndex loI hiI ηI lo hi η,(v*(2*mass j+error)+A*error)*T :=
|
| 135 |
+
Finset.sum_le_sum fun j _ => hlocal j
|
| 136 |
+
_ = _ := by rw [← Finset.sum_mul,hsum]
|
| 137 |
+
|
| 138 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 139 |
+
|
| 140 |
+
end
|
| 141 |
+
|
| 142 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementAssigned.lean
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellGridReplacementBasic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 6 |
+
|
| 7 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
open PrimeProgression PrimeCellReplacement PrimeCellFreezing MixedCellJointReplacement
|
| 13 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 14 |
+
|
| 15 |
+
def mixedGridIntegerError (loI hiI ηI G Bφ Dφ : ℝ)
|
| 16 |
+
(j : Fin (gridCount loI hiI ηI)) : ℝ :=
|
| 17 |
+
Real.exp (-G)*(6*Bφ+2*Dφ*(gridPoint loI hiI ηI (j.val+1)-gridPoint loI hiI ηI j.val))
|
| 18 |
+
|
| 19 |
+
def mixedGridError (M : ℕ) (loI hiI ηI G Bφ Dφ : ℝ) (φ : ℝ → ℝ)
|
| 20 |
+
(ε B : ℝ) (j : Fin (gridCount loI hiI ηI)) : ℝ :=
|
| 21 |
+
(mixedGridIntegerError loI hiI ηI G Bφ Dφ j +
|
| 22 |
+
(|IntegerCell.integerDensityMass M (gridPoint loI hiI ηI j.val)
|
| 23 |
+
(gridPoint loI hiI ηI (j.val+1)) G φ|+
|
| 24 |
+
mixedGridIntegerError loI hiI ηI G Bφ Dφ j)*(Fintype.card ι:ℝ)*ε)*B^Fintype.card ι
|
| 25 |
+
|
| 26 |
+
theorem exists_assigned_mixedCell_replacement_constants :
|
| 27 |
+
∃ d K L₀ : ℝ, 0 < d ∧ 0 < K ∧ 1 ≤ L₀ ∧
|
| 28 |
+
∀ (ι : Type*) [Fintype ι] [DecidableEq ι]
|
| 29 |
+
(NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 30 |
+
(loI hiI ηI G Bφ Dφ : ℝ) (φ ψ : ℝ → ℝ) (lo hi η Z : ι → ℝ),
|
| 31 |
+
loI ≤ hiI → ⌊Real.exp hiI⌋₊ ≤ NI →
|
| 32 |
+
(∀ t, HasDerivAt φ (ψ t) t) → Continuous ψ →
|
| 33 |
+
(∀ t ∈ Set.Icc loI hiI, |φ (t-G)| ≤ Bφ) →
|
| 34 |
+
(∀ t ∈ Set.Icc loI hiI, |ψ (t-G)| ≤ Dφ) →
|
| 35 |
+
(∀ i, L₀ ≤ lo i ∧ lo i ≤ hi i ∧ 0 < η i ∧ η i ≤ 1 ∧
|
| 36 |
+
⌊Real.exp (hi i)⌋₊ ≤ N i ∧ 0 < Z i ∧
|
| 37 |
+
(M:ℝ) ≤ Real.exp (d*(lo i)^(1/3:ℝ))) →
|
| 38 |
+
∀ (j : MixedGridIndex loI hiI ηI lo hi η) (ε B : ℝ), 0 ≤ ε → 1 ≤ B →
|
| 39 |
+
(∀ i, (K/Z i)*Real.exp (-d*(boxLower lo hi η j.2 i)^(1/3:ℝ))+
|
| 40 |
+
(Z i*Real.exp (boxLower lo hi η j.2 i))⁻¹ ≤ ε) →
|
| 41 |
+
(∀ i, |harmonicIntegral M (boxLower lo hi η j.2 i) (boxUpper lo hi η j.2 i)/Z i|+
|
| 42 |
+
((K/Z i)*Real.exp (-d*(boxLower lo hi η j.2 i)^(1/3:ℝ))+
|
| 43 |
+
(Z i*Real.exp (boxLower lo hi η j.2 i))⁻¹) ≤ B) →
|
| 44 |
+
∀ F : ZMod M → (ι → (ZMod M)ˣ) → ℂ,
|
| 45 |
+
‖mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F-
|
| 46 |
+
(mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 47 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ
|
| 48 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z:ℂ)*
|
| 49 |
+
(∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ, F r u)‖ ≤
|
| 50 |
+
mixedGridError (ι:=ι) M loI hiI ηI G Bφ Dφ φ ε B j.1*
|
| 51 |
+
(∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ, ‖F r u‖) := by
|
| 52 |
+
obtain ⟨d,K,L₀,hd,hK,hL₀,hprime⟩ := exists_assigned_joint_primeCell_replacement_constants
|
| 53 |
+
refine ⟨d,K,L₀,hd,hK,hL₀,?_⟩
|
| 54 |
+
intro ι _ _ NI N M _ loI hiI ηI G Bφ Dφ φ ψ lo hi η Z
|
| 55 |
+
hI hNI hφ hψ hBφ hDφ hcell j ε B hε hB hE hbound F
|
| 56 |
+
classical
|
| 57 |
+
have hBφ0 : 0 ≤ Bφ := (abs_nonneg _).trans (hBφ loI ⟨le_rfl,hI⟩)
|
| 58 |
+
have hDφ0 : 0 ≤ Dφ := (abs_nonneg _).trans (hDφ loI ⟨le_rfl,hI⟩)
|
| 59 |
+
have hl := gridPoint_mem (η:=ηI) hI j.1.isLt.le
|
| 60 |
+
have hu := gridPoint_mem (η:=ηI) hI (show j.1.val+1 ≤ gridCount loI hiI ηI by omega)
|
| 61 |
+
have horderI := gridPoint_mono (η:=ηI) hI (Nat.le_succ j.1.val)
|
| 62 |
+
have hsub : Set.Icc (gridPoint loI hiI ηI j.1.val)
|
| 63 |
+
(gridPoint loI hiI ηI (j.1.val+1)) ⊆ Set.Icc loI hiI :=
|
| 64 |
+
fun _ ht => ⟨hl.1.trans ht.1,ht.2.trans hu.2⟩
|
| 65 |
+
have hEI : 0 ≤ mixedGridIntegerError loI hiI ηI G Bφ Dφ j.1 := by
|
| 66 |
+
unfold mixedGridIntegerError
|
| 67 |
+
exact mul_nonneg (Real.exp_pos _).le
|
| 68 |
+
(add_nonneg (mul_nonneg (by norm_num) hBφ0)
|
| 69 |
+
(mul_nonneg (mul_nonneg (by norm_num) hDφ0) (sub_nonneg.mpr horderI)))
|
| 70 |
+
have hInteger (r : ZMod M) := assignedIntegerResidueMass_error NI M r loI hiI ηI G φ ψ j.1 Bφ Dφ
|
| 71 |
+
hI hBφ0 ((Nat.floor_mono (Real.exp_le_exp.mpr hu.2)).trans hNI) hφ hψ
|
| 72 |
+
(fun t ht => hBφ t (hsub ht)) (fun t ht => hDφ t (hsub ht))
|
| 73 |
+
have hProd : ‖∏ i, ((harmonicIntegral M (boxLower lo hi η j.2 i)
|
| 74 |
+
(boxUpper lo hi η j.2 i)/Z i:ℝ):ℂ)‖ ≤ B^Fintype.card ι := by
|
| 75 |
+
rw [norm_prod]
|
| 76 |
+
calc
|
| 77 |
+
_ ≤ ∏ _i : ι, B := by
|
| 78 |
+
apply Finset.prod_le_prod₀ (fun i _ => norm_nonneg _)
|
| 79 |
+
intro i _
|
| 80 |
+
have hZi := (hcell i).2.2.2.2.2.1
|
| 81 |
+
have hEi : 0 ≤ (K/Z i)*Real.exp (-d*(boxLower lo hi η j.2 i)^(1/3:ℝ))+
|
| 82 |
+
(Z i*Real.exp (boxLower lo hi η j.2 i))⁻¹ := by positivity
|
| 83 |
+
simp only [Complex.norm_real,Real.norm_eq_abs]
|
| 84 |
+
linarith [hbound i]
|
| 85 |
+
_ = _ := by simp
|
| 86 |
+
have hJoint (r : ZMod M) := hprime ι N M lo hi η Z hcell j.2 ε B hε hB hE hbound (F r)
|
| 87 |
+
have hh := mixed_sum_error
|
| 88 |
+
(fun r : ZMod M => assignedIntegerResidueMass NI M r loI hiI ηI G φ j.1)
|
| 89 |
+
(IntegerCell.integerDensityMass M (gridPoint loI hiI ηI j.1.val)
|
| 90 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ)
|
| 91 |
+
(fun r => assignedJointComplexTestSum N M lo hi η Z j.2 (F r))
|
| 92 |
+
(∏ i, ((harmonicIntegral M (boxLower lo hi η j.2 i) (boxUpper lo hi η j.2 i)/Z i:ℝ):ℂ)) F
|
| 93 |
+
hEI (show 0 ≤ (Fintype.card ι:ℝ)*ε*B^Fintype.card ι by positivity)
|
| 94 |
+
(show 0 ≤ B^Fintype.card ι by positivity) hInteger hProd hJoint
|
| 95 |
+
rw [← mixedAssignedTestSum_eq_integer] at hh
|
| 96 |
+
rw [mixedPrincipalMass,MixedCellIntegralFreezing.residue_mixedLogMass_eq M _ _ _ _ _ _ _
|
| 97 |
+
horderI (box_order lo hi η (fun i => (hcell i).2.1) j.2)]
|
| 98 |
+
simp only [Complex.ofReal_mul,Complex.ofReal_prod]
|
| 99 |
+
convert hh using 1
|
| 100 |
+
dsimp [mixedGridError]
|
| 101 |
+
ring
|
| 102 |
+
|
| 103 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 104 |
+
|
| 105 |
+
end
|
| 106 |
+
|
| 107 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementBasic.lean
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionIntegerBoundary
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.LogCellPartitionMixedTuples
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellIntegralFreezingLog
|
| 4 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellJointReplacementAlgebra
|
| 5 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellAssignedReplacement
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 10 |
+
|
| 11 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 12 |
+
|
| 13 |
+
noncomputable section
|
| 14 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 15 |
+
open scoped BigOperators
|
| 16 |
+
open MeasureTheory PrimeProgression PrimeCellReplacement PrimeCellFreezing MixedCellIntegralFreezing
|
| 17 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι] {M : ℕ} [NeZero M]
|
| 18 |
+
|
| 19 |
+
def mixedSmoothTestSum (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 20 |
+
(loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 21 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ) : ℂ :=
|
| 22 |
+
∑ n ∈ IntegerCell.cellSupport NI loI hiI, ∑ p : PrimeCellTuple N lo hi,
|
| 23 |
+
((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ)*
|
| 24 |
+
(∏ i, (((Z i*(p i).val)⁻¹:ℝ):ℂ))*
|
| 25 |
+
jointUnitTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M))*
|
| 26 |
+
f (Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)))
|
| 27 |
+
|
| 28 |
+
def mixedAssignedTestSum (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 29 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 30 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) : ℂ :=
|
| 31 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 32 |
+
((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ)*
|
| 33 |
+
assignedJointComplexTestSum N M lo hi η Z j.2 (F (n:ZMod M))
|
| 34 |
+
|
| 35 |
+
def mixedSmoothAssignedTestSum (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 36 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 37 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ)
|
| 38 |
+
(f : (Option ι → ℝ) → ℂ) : ℂ :=
|
| 39 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 40 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2,
|
| 41 |
+
((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ)*
|
| 42 |
+
(assignedTupleWeight N lo hi η Z j.2 p:ℂ)*
|
| 43 |
+
jointUnitTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M))*
|
| 44 |
+
f (Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)))
|
| 45 |
+
|
| 46 |
+
def mixedAssignedAbsMass (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 47 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 48 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) : ℝ :=
|
| 49 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 50 |
+
(Real.exp (-G)*φ (Real.log n-G))*assignedAbsMass N M lo hi η Z j.2 (F (n:ZMod M))
|
| 51 |
+
|
| 52 |
+
def mixedPrincipalMass (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ) : ℝ :=
|
| 53 |
+
mixedLogMass M loI hiI G φ (fun i => ((Nat.totient M:ℝ)*Z i)⁻¹) lo hi
|
| 54 |
+
|
| 55 |
+
def mixedPrincipalIntegral (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 56 |
+
(f : (Option ι → ℝ) → ℂ) : ℂ :=
|
| 57 |
+
mixedLogIntegral M loI hiI G φ (fun i => ((Nat.totient M:ℝ)*Z i)⁻¹) lo hi
|
| 58 |
+
(fun x => f (optionCoordinates x))
|
| 59 |
+
|
| 60 |
+
theorem mixedAssignedTestSum_eq_integer (NI : ℕ) (N : ι → ℕ)
|
| 61 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 62 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) :
|
| 63 |
+
mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F =
|
| 64 |
+
∑ r : ZMod M, (assignedIntegerResidueMass NI M r loI hiI ηI G φ j.1:ℂ)*
|
| 65 |
+
assignedJointComplexTestSum N M lo hi η Z j.2 (F r) := by
|
| 66 |
+
unfold mixedAssignedTestSum
|
| 67 |
+
rw [IntegerCell.sum_weighted_residueTest (assignedIntegerSupport NI loI hiI ηI j.1)
|
| 68 |
+
(fun n : ℕ => ((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ))
|
| 69 |
+
(fun r : ZMod M => assignedJointComplexTestSum N M lo hi η Z j.2 (F r))]
|
| 70 |
+
simp only [assignedIntegerResidueMass,Complex.ofReal_sum]
|
| 71 |
+
|
| 72 |
+
theorem mixedAssignedAbsMass_cast (NI : ℕ) (N : ι → ℕ)
|
| 73 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 74 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) :
|
| 75 |
+
(mixedAssignedAbsMass NI N M loI hiI ηI G φ lo hi η Z j F:ℂ) =
|
| 76 |
+
mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j (fun r u => (‖F r u‖:ℂ)) := by
|
| 77 |
+
simp only [mixedAssignedAbsMass,mixedAssignedTestSum,Complex.ofReal_sum,
|
| 78 |
+
Complex.ofReal_mul,assignedAbsMass_cast]
|
| 79 |
+
|
| 80 |
+
theorem mixedSmoothTestSum_eq_sum_assigned (NI : ℕ) (N : ι → ℕ)
|
| 81 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 82 |
+
(hI : loI ≤ hiI) (horder : ∀ i, lo i ≤ hi i)
|
| 83 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ) :
|
| 84 |
+
mixedSmoothTestSum NI N M loI hiI G φ lo hi Z F f =
|
| 85 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 86 |
+
mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f := by
|
| 87 |
+
simpa only [mixedSmoothTestSum,mixedSmoothAssignedTestSum,assignedTupleWeight,
|
| 88 |
+
Complex.ofReal_prod,mul_assoc] using
|
| 89 |
+
sum_mixed_prior_eq_sum_assigned NI N loI hiI ηI G φ lo hi η Z hI horder
|
| 90 |
+
(fun n p => jointUnitTest (F (n:ZMod M)) (fun i => (p i:ZMod M))*
|
| 91 |
+
f (Option.elim' (n:ℝ) (fun i => (p i:ℝ))))
|
| 92 |
+
|
| 93 |
+
theorem mixedPrincipalMass_eq_sum_boxes (M : ℕ) (loI hiI ηI G : ℝ)
|
| 94 |
+
(φ : ℝ → ℝ) (lo hi η Z : ι → ℝ) (hI : loI ≤ hiI)
|
| 95 |
+
(horder : ∀ i, lo i ≤ hi i) (hφ : Continuous φ) (hlo : ∀ i, 0 < lo i) :
|
| 96 |
+
mixedPrincipalMass M loI hiI G φ lo hi Z =
|
| 97 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 98 |
+
mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 99 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z :=
|
| 100 |
+
mixedLogMass_eq_sum_boxes M loI hiI ηI G φ _ lo hi η hI horder hφ hlo
|
| 101 |
+
|
| 102 |
+
theorem mixedPrincipalIntegral_eq_sum_boxes (M : ℕ) (loI hiI ηI G : ℝ)
|
| 103 |
+
(φ : ℝ → ℝ) (lo hi η Z : ι → ℝ) (hI : loI ≤ hiI)
|
| 104 |
+
(horder : ∀ i, lo i ≤ hi i) (hφ : Continuous φ) (hlo : ∀ i, 0 < lo i)
|
| 105 |
+
(f : (Option ι → ℝ) → ℂ)
|
| 106 |
+
(hf : ContinuousOn (fun z => f (fun i => Real.exp (z i)))
|
| 107 |
+
(logRectangle (Option.elim' loI lo) (Option.elim' hiI hi))) :
|
| 108 |
+
mixedPrincipalIntegral M loI hiI G φ lo hi Z f =
|
| 109 |
+
∑ j : MixedGridIndex loI hiI ηI lo hi η,
|
| 110 |
+
mixedPrincipalIntegral M (gridPoint loI hiI ηI j.1.val)
|
| 111 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z f := by
|
| 112 |
+
apply integral_mixedRectangle_eq_sum_boxes loI hiI ηI lo hi η hI horder
|
| 113 |
+
have hh : ContinuousOn (fun z => f (optionCoordinates (mixedExp z)))
|
| 114 |
+
(mixedLogRectangle loI hiI lo hi) := by
|
| 115 |
+
simp only [optionCoordinates_mixedExp]
|
| 116 |
+
exact hf.comp continuous_optionCoordinates.continuousOn
|
| 117 |
+
(fun z hz => (optionCoordinates_mem_logRectangle loI hiI lo hi).mpr hz)
|
| 118 |
+
exact ((continuousOn_mixedLogDensity M loI hiI G φ _ lo hi hφ hlo).smul hh).integrableOn_compact
|
| 119 |
+
(isCompact_mixedLogRectangle loI hiI lo hi)
|
| 120 |
+
|
| 121 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 122 |
+
|
| 123 |
+
end
|
| 124 |
+
|
| 125 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementDiscrete.lean
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellGridReplacementBasic
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 6 |
+
|
| 7 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
open PrimeCellReplacement PrimeCellFreezing MixedCellIntegralFreezing Characters.RationalHistory
|
| 13 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι] {M : ℕ} [NeZero M]
|
| 14 |
+
|
| 15 |
+
def mixedAssignedLog (N : ι → ℕ) (lo hi η : ι → ℝ) (j : GridBoxIndex lo hi η)
|
| 16 |
+
(n : ℕ) (p : AssignedPrimeTuple N lo hi η j) : Option ι → ℝ :=
|
| 17 |
+
Option.elim' (Real.log (n:ℝ)) (assignedTupleLog N lo hi η j p)
|
| 18 |
+
|
| 19 |
+
theorem mixedAssignedLog_mem (NI : ℕ) (N : ι → ℕ) (loI hiI ηI : ℝ) (lo hi η : ι → ℝ)
|
| 20 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) {n : ℕ}
|
| 21 |
+
(hn : n ∈ assignedIntegerSupport NI loI hiI ηI j.1) (p : AssignedPrimeTuple N lo hi η j.2) :
|
| 22 |
+
mixedAssignedLog N lo hi η j.2 n p ∈
|
| 23 |
+
logRectangle (Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 24 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)) := by
|
| 25 |
+
intro i _
|
| 26 |
+
cases i with
|
| 27 |
+
| none => exact ((mem_cellSupport _ _ _ _).mp (Finset.mem_filter.mp hn).1).2.2
|
| 28 |
+
| some i => exact assignedTupleLog_mem N lo hi η j.2 p i (Set.mem_univ _)
|
| 29 |
+
|
| 30 |
+
theorem exp_mixedAssignedLog (NI : ℕ) (N : ι → ℕ) (loI hiI ηI : ℝ) (lo hi η : ι → ℝ)
|
| 31 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) {n : ℕ}
|
| 32 |
+
(hn : n ∈ assignedIntegerSupport NI loI hiI ηI j.1) (p : AssignedPrimeTuple N lo hi η j.2) :
|
| 33 |
+
(fun i => Real.exp (mixedAssignedLog N lo hi η j.2 n p i)) =
|
| 34 |
+
Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)) := by
|
| 35 |
+
funext i
|
| 36 |
+
cases i with
|
| 37 |
+
| none =>
|
| 38 |
+
apply Real.exp_log
|
| 39 |
+
exact_mod_cast ((mem_cellSupport _ _ _ _).mp (Finset.mem_filter.mp hn).1).2.1
|
| 40 |
+
| some i => exact congrFun (exp_assignedTupleLog N lo hi η j.2 p) i
|
| 41 |
+
|
| 42 |
+
theorem mixed_assigned_freezing_of_variation (NI : ℕ) (N : ι → ℕ)
|
| 43 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 44 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (hZ : ∀ i, 0 ≤ Z i)
|
| 45 |
+
(hφ0 : ∀ t ∈ Set.Icc (gridPoint loI hiI ηI j.1.val)
|
| 46 |
+
(gridPoint loI hiI ηI (j.1.val+1)), 0 ≤ φ (t-G))
|
| 47 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ)
|
| 48 |
+
(f₀ : ℂ) {v : ℝ}
|
| 49 |
+
(hvar : ∀ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 50 |
+
∀ p : AssignedPrimeTuple N lo hi η j.2,
|
| 51 |
+
‖f (Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)))-f₀‖ ≤ v) :
|
| 52 |
+
‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 53 |
+
f₀*mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F‖ ≤
|
| 54 |
+
v*mixedAssignedAbsMass NI N M loI hiI ηI G φ lo hi η Z j F := by
|
| 55 |
+
classical
|
| 56 |
+
have heq : mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 57 |
+
f₀*mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F =
|
| 58 |
+
∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 59 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2,
|
| 60 |
+
(((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ)*(assignedTupleWeight N lo hi η Z j.2 p:ℂ)*
|
| 61 |
+
jointUnitTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M)))*
|
| 62 |
+
(f (Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)))-f₀) := by
|
| 63 |
+
simp only [mixedSmoothAssignedTestSum,mixedAssignedTestSum,assignedJointTestSum_tupleWeight,
|
| 64 |
+
Finset.mul_sum,← Finset.sum_sub_distrib]
|
| 65 |
+
apply Finset.sum_congr rfl
|
| 66 |
+
intro n hn
|
| 67 |
+
apply Finset.sum_congr rfl
|
| 68 |
+
intro p hp
|
| 69 |
+
ring
|
| 70 |
+
rw [heq]
|
| 71 |
+
calc
|
| 72 |
+
_ ≤ ∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 73 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2,
|
| 74 |
+
‖(((Real.exp (-G)*φ (Real.log n-G):ℝ):ℂ)*(assignedTupleWeight N lo hi η Z j.2 p:ℂ)*
|
| 75 |
+
jointUnitTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M)))*
|
| 76 |
+
(f (Option.elim' (n:ℝ) (fun i => ((p i).val:ℝ)))-f₀)‖ :=
|
| 77 |
+
(norm_sum_le _ _).trans (Finset.sum_le_sum fun n _ => norm_sum_le _ _)
|
| 78 |
+
_ ≤ ∑ n ∈ assignedIntegerSupport NI loI hiI ηI j.1,
|
| 79 |
+
∑ p : AssignedPrimeTuple N lo hi η j.2,
|
| 80 |
+
v*((Real.exp (-G)*φ (Real.log n-G))*
|
| 81 |
+
(assignedTupleWeight N lo hi η Z j.2 p*
|
| 82 |
+
jointAbsTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M)))) := by
|
| 83 |
+
apply Finset.sum_le_sum
|
| 84 |
+
intro n hn
|
| 85 |
+
have hwI : 0 ≤ Real.exp (-G)*φ (Real.log n-G) :=
|
| 86 |
+
mul_nonneg (Real.exp_pos _).le
|
| 87 |
+
(hφ0 _ ((mem_cellSupport _ _ _ _).mp (Finset.mem_filter.mp hn).1).2.2)
|
| 88 |
+
apply Finset.sum_le_sum
|
| 89 |
+
intro p hp
|
| 90 |
+
have hwP := assignedTupleWeight_nonneg N lo hi η Z hZ j.2 p
|
| 91 |
+
rw [norm_mul,norm_mul,norm_mul,Complex.norm_real,Real.norm_eq_abs,
|
| 92 |
+
abs_of_nonneg hwI,Complex.norm_real,Real.norm_eq_abs,abs_of_nonneg hwP]
|
| 93 |
+
calc
|
| 94 |
+
_ ≤ ((Real.exp (-G)*φ (Real.log n-G))*assignedTupleWeight N lo hi η Z j.2 p*
|
| 95 |
+
jointAbsTest (F (n:ZMod M)) (fun i => ((p i).val:ZMod M)))*v :=
|
| 96 |
+
mul_le_mul (mul_le_mul_of_nonneg_left (jointUnitTest_norm_le _ _) (mul_nonneg hwI hwP))
|
| 97 |
+
(hvar n hn p) (norm_nonneg _) (mul_nonneg (mul_nonneg hwI hwP) (jointAbsTest_nonneg _ _))
|
| 98 |
+
_ = _ := by ring
|
| 99 |
+
_ = _ := by
|
| 100 |
+
simp only [mixedAssignedAbsMass,assignedAbsMass,Finset.mul_sum]
|
| 101 |
+
|
| 102 |
+
theorem smooth_mixed_assigned_freezing_bound (NI : ℕ) (N : ι → ℕ)
|
| 103 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 104 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (hZ : ∀ i, 0 ≤ Z i)
|
| 105 |
+
(hφ0 : ∀ t ∈ Set.Icc (gridPoint loI hiI ηI j.1.val)
|
| 106 |
+
(gridPoint loI hiI ηI (j.1.val+1)), 0 ≤ φ (t-G))
|
| 107 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ)
|
| 108 |
+
{D mesh : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 109 |
+
(hwidthI : gridPoint loI hiI ηI (j.1.val+1)-gridPoint loI hiI ηI j.1.val ≤ mesh)
|
| 110 |
+
(hwidth : ∀ i, boxUpper lo hi η j.2 i-boxLower lo hi η j.2 i ≤ mesh)
|
| 111 |
+
(hf : ∀ z∈logRectangle
|
| 112 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 113 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)),
|
| 114 |
+
DifferentiableAt ℝ (fun y => f (fun i => Real.exp (y i))) z)
|
| 115 |
+
(hd : ∀ z∈logRectangle
|
| 116 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 117 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)), ∀ i,
|
| 118 |
+
‖deriv (fun t => f (Expr.logCurve (fun i => Real.exp (z i)) i t)) 0‖ ≤ D)
|
| 119 |
+
{base : Option ι → ℝ} (hbase : base∈logRectangle
|
| 120 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 121 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2))) :
|
| 122 |
+
‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 123 |
+
f (fun i => Real.exp (base i))*mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F‖ ≤
|
| 124 |
+
((Fintype.card ι:ℝ)+1)*D*mesh*mixedAssignedAbsMass NI N M loI hiI ηI G φ lo hi η Z j F := by
|
| 125 |
+
apply mixed_assigned_freezing_of_variation NI N loI hiI ηI G φ lo hi η Z j hZ hφ0 F f
|
| 126 |
+
intro n hn p
|
| 127 |
+
have hp := mixedAssignedLog_mem NI N loI hiI ηI lo hi η j hn p
|
| 128 |
+
have hwidth' : ∀ i : Option ι,
|
| 129 |
+
Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2) i -
|
| 130 |
+
Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2) i ≤ mesh := by
|
| 131 |
+
intro i
|
| 132 |
+
cases i with
|
| 133 |
+
| none => exact hwidthI
|
| 134 |
+
| some i => exact hwidth i
|
| 135 |
+
have hh := positive_norm_sub_le f _ _ hD hm hf hd hp hbase
|
| 136 |
+
(logRectangle_coordinate_dist_le _ _ hwidth' hp hbase)
|
| 137 |
+
simpa only [exp_mixedAssignedLog NI N loI hiI ηI lo hi η j hn p,
|
| 138 |
+
Fintype.card_option,Nat.cast_add,Nat.cast_one] using hh
|
| 139 |
+
|
| 140 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 141 |
+
|
| 142 |
+
end
|
| 143 |
+
|
| 144 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellGridReplacementSmooth.lean
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellGridReplacementDiscrete
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 6 |
+
|
| 7 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
namespace Ostmann.Arithmetic.LogCellPartition
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
open PrimeCellFreezing MixedCellIntegralFreezing Characters.RationalHistory
|
| 13 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι] {M : ℕ} [NeZero M]
|
| 14 |
+
|
| 15 |
+
theorem mixedAssignedAbsMass_le_of_error (NI : ℕ) (N : ι → ℕ)
|
| 16 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 17 |
+
(j : MixedGridIndex loI hiI ηI lo hi η) (F : ZMod M → (ι → (ZMod M)ˣ) → ℂ)
|
| 18 |
+
(main error : ℝ)
|
| 19 |
+
(he : ‖mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j (fun r u => (‖F r u‖:ℂ))-
|
| 20 |
+
(main:ℂ)*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,(‖F r u‖:ℂ)‖ ≤
|
| 21 |
+
error*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖) :
|
| 22 |
+
mixedAssignedAbsMass NI N M loI hiI ηI G φ lo hi η Z j F ≤
|
| 23 |
+
(main+error)*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖ := by
|
| 24 |
+
rw [← mixedAssignedAbsMass_cast] at he
|
| 25 |
+
simp only [← Complex.ofReal_sum,← Complex.ofReal_mul,← Complex.ofReal_sub,
|
| 26 |
+
Complex.norm_real,Real.norm_eq_abs] at he
|
| 27 |
+
have hh := (le_abs_self _).trans he
|
| 28 |
+
linarith
|
| 29 |
+
|
| 30 |
+
theorem mixed_assigned_smooth_replacement_of_errors (NI : ℕ) (N : ι → ℕ)
|
| 31 |
+
(loI hiI ηI G : ℝ) (φ : ℝ → ℝ) (lo hi η Z : ι → ℝ)
|
| 32 |
+
(j : MixedGridIndex loI hiI ηI lo hi η)
|
| 33 |
+
(hφ : Continuous φ)
|
| 34 |
+
(hφ0 : ∀ t ∈ Set.Icc (gridPoint loI hiI ηI j.1.val)
|
| 35 |
+
(gridPoint loI hiI ηI (j.1.val+1)), 0 ≤ φ (t-G))
|
| 36 |
+
(hZ : ∀ i, 0 < Z i) (hlo : ∀ i, 0 < boxLower lo hi η j.2 i)
|
| 37 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) (f : (Option ι → ℝ) → ℂ)
|
| 38 |
+
{D mesh error : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 39 |
+
(hwidthI : gridPoint loI hiI ηI (j.1.val+1)-gridPoint loI hiI ηI j.1.val ≤ mesh)
|
| 40 |
+
(hwidth : ∀ i, boxUpper lo hi η j.2 i-boxLower lo hi η j.2 i ≤ mesh)
|
| 41 |
+
(hf : ∀ z∈logRectangle
|
| 42 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 43 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)),
|
| 44 |
+
DifferentiableAt ℝ (fun y => f (fun i => Real.exp (y i))) z)
|
| 45 |
+
(hd : ∀ z∈logRectangle
|
| 46 |
+
(Option.elim' (gridPoint loI hiI ηI j.1.val) (boxLower lo hi η j.2))
|
| 47 |
+
(Option.elim' (gridPoint loI hiI ηI (j.1.val+1)) (boxUpper lo hi η j.2)), ∀ i,
|
| 48 |
+
‖deriv (fun t => f (Expr.logCurve (fun i => Real.exp (z i)) i t)) 0‖ ≤ D)
|
| 49 |
+
{base : ℝ × (ι → ℝ)} (hbase : base∈mixedLogRectangle
|
| 50 |
+
(gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1))
|
| 51 |
+
(boxLower lo hi η j.2) (boxUpper lo hi η j.2))
|
| 52 |
+
(he : ‖mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F-
|
| 53 |
+
(mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 54 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z:ℂ)*
|
| 55 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u‖ ≤ error*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖)
|
| 56 |
+
(heAbs : ‖mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j (fun r u => (‖F r u‖:ℂ))-
|
| 57 |
+
(mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 58 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z:ℂ)*
|
| 59 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,(‖F r u‖:ℂ)‖ ≤ error*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖) :
|
| 60 |
+
‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-
|
| 61 |
+
mixedPrincipalIntegral M (gridPoint loI hiI ηI j.1.val)
|
| 62 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z f*
|
| 63 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u‖ ≤
|
| 64 |
+
(((Fintype.card ι:ℝ)+1)*D*mesh*
|
| 65 |
+
(2*mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 66 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z+error)+
|
| 67 |
+
‖f (optionCoordinates (mixedExp base))‖*error)*∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖ := by
|
| 68 |
+
classical
|
| 69 |
+
let v : ℝ := ((Fintype.card ι:ℝ)+1)*D*mesh
|
| 70 |
+
let f₀ := f (optionCoordinates (mixedExp base))
|
| 71 |
+
let S := ∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,F r u
|
| 72 |
+
let T := ∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,‖F r u‖
|
| 73 |
+
let mass := mixedPrincipalMass M (gridPoint loI hiI ηI j.1.val)
|
| 74 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z
|
| 75 |
+
let integral := mixedPrincipalIntegral M (gridPoint loI hiI ηI j.1.val)
|
| 76 |
+
(gridPoint loI hiI ηI (j.1.val+1)) G φ (boxLower lo hi η j.2) (boxUpper lo hi η j.2) Z f
|
| 77 |
+
let actual := mixedAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F
|
| 78 |
+
have hv : 0 ≤ v := by dsimp [v]; positivity
|
| 79 |
+
have hmass := mixedAssignedAbsMass_le_of_error NI N loI hiI ηI G φ lo hi η Z j F mass error heAbs
|
| 80 |
+
have hdisc := smooth_mixed_assigned_freezing_bound NI N loI hiI ηI G φ lo hi η Z j
|
| 81 |
+
(fun i => (hZ i).le) hφ0 F f hD hm hwidthI hwidth hf hd
|
| 82 |
+
((optionCoordinates_mem_logRectangle _ _ _ _).mpr hbase)
|
| 83 |
+
have hdisc' : ‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-f₀*actual‖ ≤
|
| 84 |
+
v*((mass+error)*T) := by
|
| 85 |
+
simpa only [f₀,optionCoordinates_mixedExp] using
|
| 86 |
+
hdisc.trans (mul_le_mul_of_nonneg_left hmass hv)
|
| 87 |
+
have hap : ‖f₀*actual-f₀*((mass:ℂ)*S)‖ ≤ ‖f₀‖*(error*T) := by
|
| 88 |
+
rw [← mul_sub,norm_mul]
|
| 89 |
+
exact mul_le_mul_of_nonneg_left he (norm_nonneg _)
|
| 90 |
+
have hint := mixed_integral_freezing_of_log_partials M
|
| 91 |
+
(gridPoint loI hiI ηI j.1.val) (gridPoint loI hiI ηI (j.1.val+1)) G φ
|
| 92 |
+
(fun i => ((Nat.totient M:ℝ)*Z i)⁻¹) (boxLower lo hi η j.2) (boxUpper lo hi η j.2)
|
| 93 |
+
hφ hφ0 (fun i => inv_nonneg.mpr (mul_nonneg (Nat.cast_nonneg _) (hZ i).le)) hlo
|
| 94 |
+
f hD hm hwidthI hwidth hf hd hbase
|
| 95 |
+
have hint' : ‖(mass:ℂ)*f₀-integral‖ ≤ v*mass := by
|
| 96 |
+
rw [norm_sub_rev]
|
| 97 |
+
simpa only [integral,mass,mixedPrincipalIntegral,mixedPrincipalMass,Complex.real_smul] using hint
|
| 98 |
+
have hS : ‖S‖ ≤ T := (norm_sum_le _ _).trans (Finset.sum_le_sum fun r _ => norm_sum_le _ _)
|
| 99 |
+
have hmain : ‖f₀*((mass:ℂ)*S)-integral*S‖ ≤ (v*mass)*T := by
|
| 100 |
+
have heq : f₀*((mass:ℂ)*S)-integral*S = ((mass:ℂ)*f₀-integral)*S := by ring
|
| 101 |
+
rw [heq,norm_mul]
|
| 102 |
+
exact mul_le_mul hint' hS (norm_nonneg _) ((norm_nonneg _).trans hint')
|
| 103 |
+
calc
|
| 104 |
+
_ ≤ ‖mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f-f₀*actual‖+
|
| 105 |
+
‖f₀*actual-f₀*((mass:ℂ)*S)‖+‖f₀*((mass:ℂ)*S)-integral*S‖ := by
|
| 106 |
+
have h₁ := norm_sub_le_norm_sub_add_norm_sub
|
| 107 |
+
(mixedSmoothAssignedTestSum NI N M loI hiI ηI G φ lo hi η Z j F f) (f₀*actual) (integral*S)
|
| 108 |
+
have h₂ := norm_sub_le_norm_sub_add_norm_sub (f₀*actual) (f₀*((mass:ℂ)*S)) (integral*S)
|
| 109 |
+
simpa only [add_assoc] using h₁.trans (add_le_add le_rfl h₂)
|
| 110 |
+
_ ≤ v*((mass+error)*T)+‖f₀‖*(error*T)+(v*mass)*T := add_le_add (add_le_add hdisc' hap) hmain
|
| 111 |
+
_ = _ := by dsimp only [v,f₀,T,mass]; ring
|
| 112 |
+
|
| 113 |
+
end Ostmann.Arithmetic.LogCellPartition
|
| 114 |
+
|
| 115 |
+
end
|
| 116 |
+
|
| 117 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezing.lean
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellIntegralFreezingMass
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 7 |
+
open MeasureTheory PrimeCellFreezing
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
def mixedExp (t : ℝ × (ι → ℝ)) : ℝ × (ι → ℝ) :=
|
| 12 |
+
(Real.exp t.1, fun i => Real.exp (t.2 i))
|
| 13 |
+
|
| 14 |
+
def mixedLogIntegral (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 15 |
+
(w lo hi : ι → ℝ) (f : (ℝ × (ι → ℝ)) → ℂ) : ℂ :=
|
| 16 |
+
∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t • f (mixedExp t)
|
| 17 |
+
|
| 18 |
+
omit [DecidableEq ι] in
|
| 19 |
+
theorem mixed_freezing_of_variation (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 20 |
+
(w lo hi : ι → ℝ) (hφ : Continuous φ)
|
| 21 |
+
(hφ0 : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 22 |
+
(hw : ∀ i, 0 ≤ w i) (hlo : ∀ i, 0 < lo i)
|
| 23 |
+
(F : (ℝ × (ι → ℝ)) → ℂ)
|
| 24 |
+
(hF : ContinuousOn F (mixedLogRectangle loI hiI lo hi))
|
| 25 |
+
(base : ℝ × (ι → ℝ)) {C : ℝ}
|
| 26 |
+
(hvar : ∀ t ∈ mixedLogRectangle loI hiI lo hi, ‖F t - F base‖ ≤ C) :
|
| 27 |
+
‖(∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t • F t) -
|
| 28 |
+
mixedLogMass M loI hiI G φ w lo hi • F base‖ ≤
|
| 29 |
+
C * mixedLogMass M loI hiI G φ w lo hi := by
|
| 30 |
+
have hc := isCompact_mixedLogRectangle loI hiI lo hi
|
| 31 |
+
have hdc := continuousOn_mixedLogDensity M loI hiI G φ w lo hi hφ hlo
|
| 32 |
+
have hdi := integrableOn_mixedLogDensity M loI hiI G φ w lo hi hφ hlo
|
| 33 |
+
have hFi : IntegrableOn (fun t => mixedLogDensity M G φ w t • F t)
|
| 34 |
+
(mixedLogRectangle loI hiI lo hi) :=
|
| 35 |
+
(hdc.smul hF).integrableOn_compact hc
|
| 36 |
+
have hbi : IntegrableOn (fun t => mixedLogDensity M G φ w t • F base)
|
| 37 |
+
(mixedLogRectangle loI hiI lo hi) :=
|
| 38 |
+
(hdc.smul continuousOn_const).integrableOn_compact hc
|
| 39 |
+
have heq : (∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t • F t) -
|
| 40 |
+
mixedLogMass M loI hiI G φ w lo hi • F base =
|
| 41 |
+
∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t • (F t-F base) := by
|
| 42 |
+
unfold mixedLogMass
|
| 43 |
+
rw [← integral_smul_const, ← integral_sub hFi hbi]
|
| 44 |
+
congr 1
|
| 45 |
+
funext t
|
| 46 |
+
exact (smul_sub _ _ _).symm
|
| 47 |
+
rw [heq]
|
| 48 |
+
calc
|
| 49 |
+
_ ≤ ∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t * C := by
|
| 50 |
+
apply norm_integral_le_of_norm_le (hdi.mul_const C)
|
| 51 |
+
filter_upwards [ae_restrict_mem hc.measurableSet] with t ht
|
| 52 |
+
have hn := mixedLogDensity_nonneg M loI hiI G φ w lo hi hφ0 hw hlo ht
|
| 53 |
+
rw [norm_smul, Real.norm_eq_abs, abs_of_nonneg hn]
|
| 54 |
+
exact mul_le_mul_of_nonneg_left (hvar t ht) hn
|
| 55 |
+
_ = C * mixedLogMass M loI hiI G φ w lo hi := by
|
| 56 |
+
rw [integral_mul_const]
|
| 57 |
+
exact mul_comm _ _
|
| 58 |
+
|
| 59 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 60 |
+
theorem mixedLogRectangle_convex (loI hiI : ℝ) (lo hi : ι → ℝ) :
|
| 61 |
+
Convex ℝ (mixedLogRectangle loI hiI lo hi) :=
|
| 62 |
+
(convex_Icc loI hiI).prod (logRectangle_convex lo hi)
|
| 63 |
+
|
| 64 |
+
omit [DecidableEq ι] in
|
| 65 |
+
theorem mixedLogRectangle_dist_le (loI hiI : ℝ) (lo hi : ι → ℝ)
|
| 66 |
+
{mesh : ℝ} (hm : 0 ≤ mesh) (hwidthI : hiI-loI ≤ mesh)
|
| 67 |
+
(hwidth : ∀ i, hi i-lo i ≤ mesh)
|
| 68 |
+
{x y : ℝ × (ι → ℝ)}
|
| 69 |
+
(hx : x ∈ mixedLogRectangle loI hiI lo hi)
|
| 70 |
+
(hy : y ∈ mixedLogRectangle loI hiI lo hi) : ‖x-y‖ ≤ mesh := by
|
| 71 |
+
rw [Prod.norm_def, max_le_iff]
|
| 72 |
+
constructor
|
| 73 |
+
· simp only [Prod.fst_sub, Real.norm_eq_abs]
|
| 74 |
+
exact abs_le.mpr ⟨by linarith [hx.1.1, hy.1.2], by linarith [hy.1.1, hx.1.2]⟩
|
| 75 |
+
· apply (pi_norm_le_iff_of_nonneg hm).mpr
|
| 76 |
+
intro i
|
| 77 |
+
simpa only [Prod.snd_sub, Pi.sub_apply, Real.norm_eq_abs] using
|
| 78 |
+
logRectangle_coordinate_dist_le lo hi hwidth hx.2 hy.2 i
|
| 79 |
+
|
| 80 |
+
omit [DecidableEq ι] in
|
| 81 |
+
theorem mixed_positive_integral_freezing_bound (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 82 |
+
(w lo hi : ι → ℝ) (hφ : Continuous φ)
|
| 83 |
+
(hφ0 : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 84 |
+
(hw : ∀ i, 0 ≤ w i) (hlo : ∀ i, 0 < lo i)
|
| 85 |
+
(f : (ℝ × (ι → ℝ)) → ℂ) {D mesh : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 86 |
+
(hwidthI : hiI-loI ≤ mesh) (hwidth : ∀ i, hi i-lo i ≤ mesh)
|
| 87 |
+
(hf : ∀ z ∈ mixedLogRectangle loI hiI lo hi,
|
| 88 |
+
DifferentiableAt ℝ (fun y => f (mixedExp y)) z)
|
| 89 |
+
(hd : ∀ z ∈ mixedLogRectangle loI hiI lo hi,
|
| 90 |
+
‖fderiv ℝ (fun y => f (mixedExp y)) z‖ ≤ D)
|
| 91 |
+
{base : ℝ × (ι → ℝ)} (hbase : base ∈ mixedLogRectangle loI hiI lo hi) :
|
| 92 |
+
‖mixedLogIntegral M loI hiI G φ w lo hi f -
|
| 93 |
+
mixedLogMass M loI hiI G φ w lo hi • f (mixedExp base)‖ ≤
|
| 94 |
+
D * mesh * mixedLogMass M loI hiI G φ w lo hi := by
|
| 95 |
+
apply mixed_freezing_of_variation M loI hiI G φ w lo hi hφ hφ0 hw hlo
|
| 96 |
+
(fun y => f (mixedExp y))
|
| 97 |
+
(fun z hz => (hf z hz).continuousAt.continuousWithinAt) base
|
| 98 |
+
intro z hz
|
| 99 |
+
have h := (mixedLogRectangle_convex loI hiI lo hi).norm_image_sub_le_of_norm_fderiv_le
|
| 100 |
+
hf hd hbase hz
|
| 101 |
+
exact h.trans (mul_le_mul_of_nonneg_left
|
| 102 |
+
(mixedLogRectangle_dist_le loI hiI lo hi hm hwidthI hwidth hz hbase) hD)
|
| 103 |
+
|
| 104 |
+
omit [DecidableEq ι] in
|
| 105 |
+
theorem residue_mixed_integral_freezing_bound (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 106 |
+
(Z lo hi : ι → ℝ) (hφ : Continuous φ)
|
| 107 |
+
(hφ0 : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 108 |
+
(hZ : ∀ i, 0 < Z i) (hlo : ∀ i, 0 < lo i)
|
| 109 |
+
(hI : loI ≤ hiI) (horder : ∀ i, lo i ≤ hi i)
|
| 110 |
+
(f : (ℝ × (ι → ℝ)) → ℂ) {D mesh : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 111 |
+
(hwidthI : hiI-loI ≤ mesh) (hwidth : ∀ i, hi i-lo i ≤ mesh)
|
| 112 |
+
(hf : ∀ z ∈ mixedLogRectangle loI hiI lo hi,
|
| 113 |
+
DifferentiableAt ℝ (fun y => f (mixedExp y)) z)
|
| 114 |
+
(hd : ∀ z ∈ mixedLogRectangle loI hiI lo hi,
|
| 115 |
+
‖fderiv ℝ (fun y => f (mixedExp y)) z‖ ≤ D)
|
| 116 |
+
{base : ℝ × (ι → ℝ)} (hbase : base ∈ mixedLogRectangle loI hiI lo hi) :
|
| 117 |
+
‖mixedLogIntegral M loI hiI G φ (fun i => ((Nat.totient M : ℝ) * Z i)⁻¹) lo hi f -
|
| 118 |
+
(IntegerCell.integerDensityMass M loI hiI G φ *
|
| 119 |
+
∏ i, PrimeProgression.harmonicIntegral M (lo i) (hi i) / Z i) • f (mixedExp base)‖ ≤
|
| 120 |
+
D * mesh * (IntegerCell.integerDensityMass M loI hiI G φ *
|
| 121 |
+
∏ i, PrimeProgression.harmonicIntegral M (lo i) (hi i) / Z i) := by
|
| 122 |
+
rw [← residue_mixedLogMass_eq M loI hiI G φ Z lo hi hI horder]
|
| 123 |
+
exact mixed_positive_integral_freezing_bound M loI hiI G φ _ lo hi hφ hφ0
|
| 124 |
+
(fun i => inv_nonneg.mpr (mul_nonneg (Nat.cast_nonneg _) (hZ i).le))
|
| 125 |
+
hlo f hD hm hwidthI hwidth hf hd hbase
|
| 126 |
+
|
| 127 |
+
end Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 128 |
+
|
| 129 |
+
end
|
| 130 |
+
|
| 131 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezingLog.lean
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
noncomputable section
|
| 6 |
+
namespace Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 7 |
+
open MeasureTheory PrimeCellFreezing Characters.RationalHistory
|
| 8 |
+
open scoped BigOperators
|
| 9 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 10 |
+
|
| 11 |
+
def optionCoordinates (t : ℝ × (ι → ℝ)) : Option ι → ℝ := Option.elim' t.1 t.2
|
| 12 |
+
|
| 13 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 14 |
+
theorem continuous_optionCoordinates : Continuous (optionCoordinates (ι := ι)) := by
|
| 15 |
+
apply continuous_pi
|
| 16 |
+
intro i
|
| 17 |
+
cases i with
|
| 18 |
+
| none => exact continuous_fst
|
| 19 |
+
| some i => exact (continuous_apply i).comp continuous_snd
|
| 20 |
+
|
| 21 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 22 |
+
theorem optionCoordinates_mem_logRectangle (loI hiI : ℝ) (lo hi : ι → ℝ)
|
| 23 |
+
{t : ℝ × (ι → ℝ)} :
|
| 24 |
+
optionCoordinates t ∈ logRectangle (Option.elim' loI lo) (Option.elim' hiI hi) ↔
|
| 25 |
+
t ∈ mixedLogRectangle loI hiI lo hi := by
|
| 26 |
+
constructor
|
| 27 |
+
· intro h
|
| 28 |
+
exact ⟨h none (Set.mem_univ _), fun i _ => h (some i) (Set.mem_univ _)⟩
|
| 29 |
+
· intro h i _
|
| 30 |
+
cases i with
|
| 31 |
+
| none => exact h.1
|
| 32 |
+
| some i => exact h.2 i (Set.mem_univ i)
|
| 33 |
+
|
| 34 |
+
omit [Fintype ι] [DecidableEq ι] in
|
| 35 |
+
@[simp] theorem optionCoordinates_mixedExp (t : ℝ × (ι → ℝ)) :
|
| 36 |
+
optionCoordinates (mixedExp t) = fun j => Real.exp (optionCoordinates t j) := by
|
| 37 |
+
funext j
|
| 38 |
+
cases j <;> rfl
|
| 39 |
+
|
| 40 |
+
theorem mixed_integral_freezing_of_log_partials
|
| 41 |
+
(M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (w lo hi : ι → ℝ)
|
| 42 |
+
(hφ : Continuous φ) (hφ0 : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 43 |
+
(hw : ∀ i, 0 ≤ w i) (hlo : ∀ i, 0 < lo i)
|
| 44 |
+
(f : (Option ι → ℝ) → ℂ) {D mesh : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 45 |
+
(hwidthI : hiI-loI ≤ mesh) (hwidth : ∀ i, hi i-lo i ≤ mesh)
|
| 46 |
+
(hf : ∀ z ∈ logRectangle (Option.elim' loI lo) (Option.elim' hiI hi),
|
| 47 |
+
DifferentiableAt ℝ (fun y => f (fun j => Real.exp (y j))) z)
|
| 48 |
+
(hd : ∀ z ∈ logRectangle (Option.elim' loI lo) (Option.elim' hiI hi), ∀ i,
|
| 49 |
+
‖deriv (fun t => f (Expr.logCurve (fun j => Real.exp (z j)) i t)) 0‖ ≤ D)
|
| 50 |
+
{base : ℝ × (ι → ℝ)} (hbase : base ∈ mixedLogRectangle loI hiI lo hi) :
|
| 51 |
+
‖mixedLogIntegral M loI hiI G φ w lo hi (fun x => f (optionCoordinates x)) -
|
| 52 |
+
mixedLogMass M loI hiI G φ w lo hi • f (optionCoordinates (mixedExp base))‖ ≤
|
| 53 |
+
((Fintype.card ι : ℝ)+1)*D*mesh * mixedLogMass M loI hiI G φ w lo hi := by
|
| 54 |
+
have hF : ContinuousOn (fun z => f (optionCoordinates (mixedExp z)))
|
| 55 |
+
(mixedLogRectangle loI hiI lo hi) := by
|
| 56 |
+
intro z hz
|
| 57 |
+
have hh := (hf (optionCoordinates z)
|
| 58 |
+
((optionCoordinates_mem_logRectangle loI hiI lo hi).mpr hz)).continuousAt.comp
|
| 59 |
+
continuous_optionCoordinates.continuousAt
|
| 60 |
+
simpa only [Function.comp_def, optionCoordinates_mixedExp] using hh.continuousWithinAt
|
| 61 |
+
(s := mixedLogRectangle loI hiI lo hi)
|
| 62 |
+
apply mixed_freezing_of_variation M loI hiI G φ w lo hi hφ hφ0 hw hlo
|
| 63 |
+
(fun z => f (optionCoordinates (mixedExp z))) hF base
|
| 64 |
+
intro z hz
|
| 65 |
+
have hwidth' : ∀ i : Option ι,
|
| 66 |
+
Option.elim' hiI hi i - Option.elim' loI lo i ≤ mesh := by
|
| 67 |
+
intro i
|
| 68 |
+
cases i with
|
| 69 |
+
| none => exact hwidthI
|
| 70 |
+
| some i => exact hwidth i
|
| 71 |
+
have hz' := (optionCoordinates_mem_logRectangle loI hiI lo hi).mpr hz
|
| 72 |
+
have hb' := (optionCoordinates_mem_logRectangle loI hiI lo hi).mpr hbase
|
| 73 |
+
have h := positive_norm_sub_le f (Option.elim' loI lo) (Option.elim' hiI hi)
|
| 74 |
+
hD hm hf hd hz' hb'
|
| 75 |
+
(logRectangle_coordinate_dist_le _ _ hwidth' hz' hb')
|
| 76 |
+
simpa only [Fintype.card_option, Nat.cast_add, Nat.cast_one, optionCoordinates_mixedExp] using h
|
| 77 |
+
|
| 78 |
+
theorem residue_mixed_integral_freezing_of_log_partials
|
| 79 |
+
(M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (Z lo hi : ι → ℝ)
|
| 80 |
+
(hφ : Continuous φ) (hφ0 : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 81 |
+
(hZ : ∀ i, 0 < Z i) (hlo : ∀ i, 0 < lo i)
|
| 82 |
+
(hI : loI ≤ hiI) (horder : ∀ i, lo i ≤ hi i)
|
| 83 |
+
(f : (Option ι → ℝ) → ℂ) {D mesh : ℝ} (hD : 0 ≤ D) (hm : 0 ≤ mesh)
|
| 84 |
+
(hwidthI : hiI-loI ≤ mesh) (hwidth : ∀ i, hi i-lo i ≤ mesh)
|
| 85 |
+
(hf : ∀ z ∈ logRectangle (Option.elim' loI lo) (Option.elim' hiI hi),
|
| 86 |
+
DifferentiableAt ℝ (fun y => f (fun j => Real.exp (y j))) z)
|
| 87 |
+
(hd : ∀ z ∈ logRectangle (Option.elim' loI lo) (Option.elim' hiI hi), ∀ i,
|
| 88 |
+
‖deriv (fun t => f (Expr.logCurve (fun j => Real.exp (z j)) i t)) 0‖ ≤ D)
|
| 89 |
+
{base : ℝ × (ι → ℝ)} (hbase : base ∈ mixedLogRectangle loI hiI lo hi) :
|
| 90 |
+
‖mixedLogIntegral M loI hiI G φ (fun i => ((Nat.totient M : ℝ)*Z i)⁻¹) lo hi
|
| 91 |
+
(fun x => f (optionCoordinates x)) -
|
| 92 |
+
(IntegerCell.integerDensityMass M loI hiI G φ *
|
| 93 |
+
∏ i, PrimeProgression.harmonicIntegral M (lo i) (hi i)/Z i) •
|
| 94 |
+
f (optionCoordinates (mixedExp base))‖ ≤
|
| 95 |
+
((Fintype.card ι : ℝ)+1)*D*mesh * (IntegerCell.integerDensityMass M loI hiI G φ *
|
| 96 |
+
∏ i, PrimeProgression.harmonicIntegral M (lo i) (hi i)/Z i) := by
|
| 97 |
+
rw [← residue_mixedLogMass_eq M loI hiI G φ Z lo hi hI horder]
|
| 98 |
+
exact mixed_integral_freezing_of_log_partials M loI hiI G φ _ lo hi hφ hφ0
|
| 99 |
+
(fun i => inv_nonneg.mpr (mul_nonneg (Nat.cast_nonneg _) (hZ i).le))
|
| 100 |
+
hlo f hD hm hwidthI hwidth hf hd hbase
|
| 101 |
+
|
| 102 |
+
end Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 103 |
+
|
| 104 |
+
end
|
| 105 |
+
|
| 106 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellIntegralFreezingMass.lean
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.IntegerCell
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellIntegralFreezing
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 8 |
+
open MeasureTheory PrimeCellFreezing
|
| 9 |
+
open scoped BigOperators
|
| 10 |
+
variable {ι : Type*} [Fintype ι]
|
| 11 |
+
|
| 12 |
+
def mixedLogRectangle (loI hiI : ℝ) (lo hi : ι → ℝ) : Set (ℝ × (ι → ℝ)) :=
|
| 13 |
+
Set.Icc loI hiI ×ˢ logRectangle lo hi
|
| 14 |
+
|
| 15 |
+
def mixedLogDensity (M : ℕ) (G : ℝ) (φ : ℝ → ℝ) (w : ι → ℝ)
|
| 16 |
+
(t : ℝ × (ι → ℝ)) : ℝ :=
|
| 17 |
+
(Real.exp (t.1-G) * φ (t.1-G) / (M : ℝ)) * logCellDensity w t.2
|
| 18 |
+
|
| 19 |
+
def mixedLogMass (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (w lo hi : ι → ℝ) : ℝ :=
|
| 20 |
+
∫ t in mixedLogRectangle loI hiI lo hi, mixedLogDensity M G φ w t
|
| 21 |
+
|
| 22 |
+
theorem mixedLogMass_eq (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (w lo hi : ι → ℝ)
|
| 23 |
+
(hI : loI ≤ hiI) :
|
| 24 |
+
mixedLogMass M loI hiI G φ w lo hi =
|
| 25 |
+
IntegerCell.integerDensityMass M loI hiI G φ * logCellMass w lo hi := by
|
| 26 |
+
unfold mixedLogMass mixedLogDensity mixedLogRectangle
|
| 27 |
+
change (∫ t in Set.Icc loI hiI ×ˢ logRectangle lo hi,
|
| 28 |
+
(Real.exp (t.1-G) * φ (t.1-G) / (M : ℝ)) * logCellDensity w t.2
|
| 29 |
+
∂(volume.prod volume)) = _
|
| 30 |
+
rw [setIntegral_prod_mul (fun t : ℝ => Real.exp (t-G) * φ (t-G) / (M : ℝ))
|
| 31 |
+
(logCellDensity w) (Set.Icc loI hiI) (logRectangle lo hi)]
|
| 32 |
+
congr 1
|
| 33 |
+
simp_rw [div_eq_mul_inv]
|
| 34 |
+
rw [integral_mul_const, integral_Icc_eq_integral_Ioc,
|
| 35 |
+
← intervalIntegral.integral_of_le hI]
|
| 36 |
+
rfl
|
| 37 |
+
|
| 38 |
+
theorem residue_mixedLogMass_eq (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ) (Z lo hi : ι → ℝ)
|
| 39 |
+
(hI : loI ≤ hiI) (horder : ∀ i, lo i ≤ hi i) :
|
| 40 |
+
mixedLogMass M loI hiI G φ (fun i => ((Nat.totient M : ℝ) * Z i)⁻¹) lo hi =
|
| 41 |
+
IntegerCell.integerDensityMass M loI hiI G φ *
|
| 42 |
+
∏ i, PrimeProgression.harmonicIntegral M (lo i) (hi i) / Z i := by
|
| 43 |
+
rw [mixedLogMass_eq M loI hiI G φ _ lo hi hI,
|
| 44 |
+
residue_logCellMass_eq_prod M Z lo hi horder]
|
| 45 |
+
|
| 46 |
+
omit [Fintype ι] in
|
| 47 |
+
theorem isCompact_mixedLogRectangle (loI hiI : ℝ) (lo hi : ι → ℝ) :
|
| 48 |
+
IsCompact (mixedLogRectangle loI hiI lo hi) :=
|
| 49 |
+
isCompact_Icc.prod (isCompact_logRectangle lo hi)
|
| 50 |
+
|
| 51 |
+
theorem continuousOn_mixedLogDensity (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 52 |
+
(w lo hi : ι → ℝ) (hφ : Continuous φ) (hlo : ∀ i, 0 < lo i) :
|
| 53 |
+
ContinuousOn (mixedLogDensity M G φ w) (mixedLogRectangle loI hiI lo hi) := by
|
| 54 |
+
have hI : Continuous (fun t : ℝ × (ι → ℝ) =>
|
| 55 |
+
Real.exp (t.1-G) * φ (t.1-G) / (M : ℝ)) := by fun_prop
|
| 56 |
+
exact hI.continuousOn.mul ((continuousOn_logCellDensity w lo hi hlo).comp
|
| 57 |
+
continuous_snd.continuousOn (fun _ ht => ht.2))
|
| 58 |
+
|
| 59 |
+
theorem integrableOn_mixedLogDensity (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 60 |
+
(w lo hi : ι → ℝ) (hφ : Continuous φ) (hlo : ∀ i, 0 < lo i) :
|
| 61 |
+
IntegrableOn (mixedLogDensity M G φ w) (mixedLogRectangle loI hiI lo hi) :=
|
| 62 |
+
(continuousOn_mixedLogDensity M loI hiI G φ w lo hi hφ hlo).integrableOn_compact
|
| 63 |
+
(isCompact_mixedLogRectangle loI hiI lo hi)
|
| 64 |
+
|
| 65 |
+
theorem mixedLogDensity_nonneg (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 66 |
+
(w lo hi : ι → ℝ) (hφ : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 67 |
+
(hw : ∀ i, 0 ≤ w i) (hlo : ∀ i, 0 < lo i)
|
| 68 |
+
{t : ℝ × (ι → ℝ)} (ht : t ∈ mixedLogRectangle loI hiI lo hi) :
|
| 69 |
+
0 ≤ mixedLogDensity M G φ w t :=
|
| 70 |
+
mul_nonneg (div_nonneg (mul_nonneg (Real.exp_pos _).le (hφ t.1 ht.1)) (Nat.cast_nonneg M))
|
| 71 |
+
(logCellDensity_nonneg w lo hi hw hlo ht.2)
|
| 72 |
+
|
| 73 |
+
theorem mixedLogMass_nonneg (M : ℕ) (loI hiI G : ℝ) (φ : ℝ → ℝ)
|
| 74 |
+
(w lo hi : ι → ℝ) (hφ : ∀ t ∈ Set.Icc loI hiI, 0 ≤ φ (t-G))
|
| 75 |
+
(hw : ∀ i, 0 ≤ w i) (hlo : ∀ i, 0 < lo i) :
|
| 76 |
+
0 ≤ mixedLogMass M loI hiI G φ w lo hi := by
|
| 77 |
+
apply setIntegral_nonneg (isCompact_mixedLogRectangle loI hiI lo hi).measurableSet
|
| 78 |
+
intro t ht
|
| 79 |
+
exact mixedLogDensity_nonneg M loI hiI G φ w lo hi hφ hw hlo ht
|
| 80 |
+
|
| 81 |
+
end Ostmann.Arithmetic.MixedCellIntegralFreezing
|
| 82 |
+
|
| 83 |
+
end
|
| 84 |
+
|
| 85 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellJointReplacementAlgebra.lean
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MixedCellJointReplacementPrior
|
| 2 |
+
|
| 3 |
+
namespace OAI
|
| 4 |
+
|
| 5 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 6 |
+
|
| 7 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 8 |
+
|
| 9 |
+
noncomputable section
|
| 10 |
+
namespace Ostmann.Arithmetic.MixedCellJointReplacement
|
| 11 |
+
open scoped BigOperators
|
| 12 |
+
|
| 13 |
+
theorem mixed_sum_error {α β : Type*} [Fintype α] [Fintype β]
|
| 14 |
+
(μ : α → ℝ) (J : ℝ) (X : α → ℂ) (P : ℂ) (F : α → β → ℂ)
|
| 15 |
+
{E Q B : ℝ} (hE : 0 ≤ E) (_hQ : 0 ≤ Q) (hB : 0 ≤ B)
|
| 16 |
+
(hμ : ∀ r, |μ r-J| ≤ E) (hP : ‖P‖ ≤ B)
|
| 17 |
+
(hX : ∀ r, ‖X r-P*(∑ u, F r u)‖ ≤ Q*(∑ u, ‖F r u‖)) :
|
| 18 |
+
‖(∑ r, (μ r : ℂ)*X r)-(J : ℂ)*P*(∑ r, ∑ u, F r u)‖ ≤
|
| 19 |
+
(E*B+(|J|+E)*Q)*(∑ r, ∑ u, ‖F r u‖) := by
|
| 20 |
+
have hm (r : α) : ‖(μ r : ℂ)‖ ≤ |J|+E := by
|
| 21 |
+
have h := abs_add_le (μ r-J) J
|
| 22 |
+
rw [sub_add_cancel] at h
|
| 23 |
+
simp only [Complex.norm_real, Real.norm_eq_abs]
|
| 24 |
+
linarith [hμ r]
|
| 25 |
+
have hd (r : α) : ‖(μ r : ℂ)-(J : ℂ)‖ ≤ E := by
|
| 26 |
+
simpa only [← Complex.ofReal_sub, Complex.norm_real, Real.norm_eq_abs] using hμ r
|
| 27 |
+
have hp (r : α) : ‖(μ r : ℂ)*X r-(J : ℂ)*P*(∑ u, F r u)‖ ≤
|
| 28 |
+
(E*B+(|J|+E)*Q)*(∑ u, ‖F r u‖) := by
|
| 29 |
+
have he : (μ r : ℂ)*X r-(J : ℂ)*P*(∑ u, F r u) =
|
| 30 |
+
(μ r : ℂ)*(X r-P*(∑ u, F r u))+
|
| 31 |
+
((μ r : ℂ)-(J : ℂ))*P*(∑ u, F r u) := by ring
|
| 32 |
+
rw [he]
|
| 33 |
+
calc
|
| 34 |
+
_ ≤ ‖(μ r : ℂ)*(X r-P*(∑ u, F r u))‖+
|
| 35 |
+
‖((μ r : ℂ)-(J : ℂ))*P*(∑ u, F r u)‖ := norm_add_le _ _
|
| 36 |
+
_ = ‖(μ r : ℂ)‖*‖X r-P*(∑ u, F r u)‖+
|
| 37 |
+
‖(μ r : ℂ)-(J : ℂ)‖*‖P‖*‖∑ u, F r u‖ := by simp only [norm_mul]
|
| 38 |
+
_ ≤ (|J|+E)*(Q*(∑ u, ‖F r u‖))+E*B*(∑ u, ‖F r u‖) := by
|
| 39 |
+
apply add_le_add
|
| 40 |
+
· exact mul_le_mul (hm r) (hX r) (norm_nonneg _) (by positivity)
|
| 41 |
+
· exact mul_le_mul (mul_le_mul (hd r) hP (norm_nonneg _) hE)
|
| 42 |
+
(norm_sum_le _ _) (norm_nonneg _) (mul_nonneg hE hB)
|
| 43 |
+
_ = _ := by ring
|
| 44 |
+
rw [Finset.mul_sum, ← Finset.sum_sub_distrib]
|
| 45 |
+
calc
|
| 46 |
+
_ ≤ ∑ r, ‖(μ r : ℂ)*X r-(J : ℂ)*P*(∑ u, F r u)‖ := norm_sum_le _ _
|
| 47 |
+
_ ≤ ∑ r, (E*B+(|J|+E)*Q)*(∑ u, ‖F r u‖) := Finset.sum_le_sum (fun r _ => hp r)
|
| 48 |
+
_ = _ := (Finset.mul_sum _ _ _).symm
|
| 49 |
+
|
| 50 |
+
end Ostmann.Arithmetic.MixedCellJointReplacement
|
| 51 |
+
end
|
| 52 |
+
|
| 53 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MixedCellJointReplacementPrior.lean
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.IntegerCell
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.PrimeCellJointReplacement
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
open _root_.Erdos970 _root_.OAI.Erdos970
|
| 7 |
+
|
| 8 |
+
open Erdos970.Erdos970Dependency.SiegelWalfisz
|
| 9 |
+
|
| 10 |
+
noncomputable section
|
| 11 |
+
namespace Ostmann.Arithmetic.MixedCellJointReplacement
|
| 12 |
+
open scoped BigOperators
|
| 13 |
+
open PrimeCellReplacement
|
| 14 |
+
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
|
| 15 |
+
|
| 16 |
+
def mixedComplexTestSum (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 17 |
+
(loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 18 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) : ℂ :=
|
| 19 |
+
∑ n ∈ IntegerCell.cellSupport NI loI hiI,
|
| 20 |
+
((Real.exp (-G)*φ (Real.log n-G) : ℝ) : ℂ)*
|
| 21 |
+
jointComplexTestSum N M lo hi Z (F (n : ZMod M))
|
| 22 |
+
|
| 23 |
+
theorem mixedComplexTestSum_expanded (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 24 |
+
(loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 25 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) :
|
| 26 |
+
mixedComplexTestSum NI N M loI hiI G φ lo hi Z F =
|
| 27 |
+
∑ n ∈ IntegerCell.cellSupport NI loI hiI, ∑ p : PrimeCellTuple N lo hi,
|
| 28 |
+
((Real.exp (-G)*φ (Real.log n-G) : ℝ) : ℂ)*
|
| 29 |
+
(∏ i, (((Z i*((p i).val : ℝ))⁻¹ : ℝ) : ℂ))*
|
| 30 |
+
jointUnitTest (F (n : ZMod M)) (fun i => ((p i).val : ZMod M)) := by
|
| 31 |
+
simp only [mixedComplexTestSum, jointComplexTestSum, Finset.mul_sum, mul_assoc]
|
| 32 |
+
|
| 33 |
+
theorem mixedComplexTestSum_eq_integer (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 34 |
+
(loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 35 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) :
|
| 36 |
+
mixedComplexTestSum NI N M loI hiI G φ lo hi Z F =
|
| 37 |
+
∑ r : ZMod M, (IntegerCell.integerResidueMass NI M r loI hiI G φ : ℂ)*
|
| 38 |
+
jointComplexTestSum N M lo hi Z (F r) := by
|
| 39 |
+
exact IntegerCell.complexTestSum_eq NI M loI hiI G φ
|
| 40 |
+
(fun r => jointComplexTestSum N M lo hi Z (F r))
|
| 41 |
+
|
| 42 |
+
theorem mixedComplexTestSum_eq (NI : ℕ) (N : ι → ℕ) (M : ℕ) [NeZero M]
|
| 43 |
+
(loI hiI G : ℝ) (φ : ℝ → ℝ) (lo hi Z : ι → ℝ)
|
| 44 |
+
(F : ZMod M → (ι → (ZMod M)ˣ) → ℂ) :
|
| 45 |
+
mixedComplexTestSum NI N M loI hiI G φ lo hi Z F =
|
| 46 |
+
∑ r : ZMod M, ∑ u : ι → (ZMod M)ˣ,
|
| 47 |
+
(IntegerCell.integerResidueMass NI M r loI hiI G φ : ℂ)*
|
| 48 |
+
(∏ i, (residueMass (N i) M (u i) (lo i) (hi i) (Z i) : ℂ))*F r u := by
|
| 49 |
+
rw [mixedComplexTestSum_eq_integer]
|
| 50 |
+
simp only [jointComplexTestSum_eq, Finset.mul_sum, mul_assoc]
|
| 51 |
+
|
| 52 |
+
end Ostmann.Arithmetic.MixedCellJointReplacement
|
| 53 |
+
end
|
| 54 |
+
|
| 55 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MonomialDenominators.lean
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.HistoryFieldEvaluation
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Characters.RationalHistoryVariables
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
noncomputable section
|
| 7 |
+
namespace Ostmann.Arithmetic.MonomialDenominators
|
| 8 |
+
open MvPolynomial
|
| 9 |
+
|
| 10 |
+
variable {ι : Type*}
|
| 11 |
+
|
| 12 |
+
inductive Generated (S : Set ℤ) : MvPolynomial ι ℤ → Prop
|
| 13 |
+
| one : Generated S 1
|
| 14 |
+
| constant (c : ℤ) (hc : c ∈ S) : Generated S (C c)
|
| 15 |
+
| var (i : ι) : Generated S (X i)
|
| 16 |
+
| mul {P Q : MvPolynomial ι ℤ} : Generated S P → Generated S Q → Generated S (P*Q)
|
| 17 |
+
|
| 18 |
+
theorem Generated.exists_monomial {S : Set ℤ} {P : MvPolynomial ι ℤ}
|
| 19 |
+
(hP : Generated S P) {K : Type*} [Field K]
|
| 20 |
+
(hS : ∀ c ∈ S, (c:K) ≠ 0) :
|
| 21 |
+
∃ (d : ι →₀ ℕ) (c : ℤ), P = monomial d c ∧ (c:K) ≠ 0 := by
|
| 22 |
+
classical
|
| 23 |
+
induction hP with
|
| 24 |
+
| one => exact ⟨0,1,by simp,by simp⟩
|
| 25 |
+
| constant c hc => exact ⟨0,c,rfl,hS c hc⟩
|
| 26 |
+
| var i => exact ⟨Finsupp.single i 1,1,rfl,by simp⟩
|
| 27 |
+
| @mul P Q hP hQ ihP ihQ =>
|
| 28 |
+
obtain ⟨d,c,rfl,hc⟩ := ihP
|
| 29 |
+
obtain ⟨e,b,rfl,hb⟩ := ihQ
|
| 30 |
+
exact ⟨d+e,c*b,by rw [monomial_mul_monomial],by simpa only [Int.cast_mul] using mul_ne_zero hc hb⟩
|
| 31 |
+
|
| 32 |
+
theorem Generated.eval₂_ne_zero {S : Set ℤ} {P : MvPolynomial ι ℤ}
|
| 33 |
+
(hP : Generated S P) {K : Type*} [Field K] [DecidableEq ι]
|
| 34 |
+
(hS : ∀ c ∈ S, (c:K) ≠ 0) (x : ι → K)
|
| 35 |
+
(hx : ∀ i ∈ P.vars, x i ≠ 0) : eval₂ (Int.castRingHom K) x P ≠ 0 := by
|
| 36 |
+
obtain ⟨d,c,rfl,hc⟩ := hP.exists_monomial hS
|
| 37 |
+
have hcZ : c ≠ 0 := by intro h; exact hc (by simp [h])
|
| 38 |
+
rw [vars_monomial hcZ] at hx
|
| 39 |
+
rw [eval₂_monomial]
|
| 40 |
+
apply mul_ne_zero hc
|
| 41 |
+
change (∏ i ∈ d.support, x i ^ d i) ≠ 0
|
| 42 |
+
exact Finset.prod_ne_zero_iff.mpr (fun i hi => pow_ne_zero _ (hx i hi))
|
| 43 |
+
|
| 44 |
+
end Ostmann.Arithmetic.MonomialDenominators
|
| 45 |
+
|
| 46 |
+
end
|
| 47 |
+
|
| 48 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingActualLineComparison.lean
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingSampledIndexedProbability
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingLineProductComparison
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Symbolic replacement for the actual two-history internal line factors -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
theorem moving_actual_line_product_comparison {A J : Type*}
|
| 12 |
+
[Fintype A] [Nonempty A] [Fintype J] {N n : ℕ}
|
| 13 |
+
(prime : A → ℕ) (hpInj : Function.Injective prime) (hprime : ∀ a, (prime a).Prime)
|
| 14 |
+
(T : Bool → MovingSlotData (Fin (N + 1)) n) (tier : Fin (N + 1) → ℕ)
|
| 15 |
+
(hlevels : ∀ side, (T side).Levels tier)
|
| 16 |
+
(rep : J → Fin (N + 1)) (base : ∀ j, MovingPairRepresentativeOccurrences T (rep j))
|
| 17 |
+
(d : ℕ) (F U : ℝ) (hF : 1 ≤ F) (hU : 1 ≤ U)
|
| 18 |
+
(hsize : ∀ side, (T side).SizeLE d)
|
| 19 |
+
(hfreq : ∀ side, (T side).Frequencies (fun s => |(s : ℝ)| ≤ F))
|
| 20 |
+
(hvalues : ∀ a, |((prime a : ℤ) : ℝ)| ≤ U)
|
| 21 |
+
(μ : Fin (N + 1) → A → ℝ) (hμ : ∀ i a, 0 ≤ μ i a)
|
| 22 |
+
(hmass : ∀ i, ∑ a, μ i a = 1)
|
| 23 |
+
(α β V : ℝ) (hα : 0 ≤ α) (hβ : 0 ≤ β) (hV : 0 < V)
|
| 24 |
+
(hmax : ∀ i a, μ i a ≤ α) (hpmax : ∀ j a, μ (rep j) a ≤ β)
|
| 25 |
+
(hprimeSize : ∀ j a, μ (rep j) a ≠ 0 → V ≤ Real.log (prime a : ℝ))
|
| 26 |
+
(weight : (Fin (N + 1) → A) → ℂ) (B : ℝ) (hB : 0 ≤ B)
|
| 27 |
+
(hweight : ∀ x, ‖weight x‖ * ∏ j, internalLineScalar true (prime (x (rep j))) ≤ B)
|
| 28 |
+
(hdisjoint : ∀ x, weight x ≠ 0 → ∀ i j,
|
| 29 |
+
tier i ≠ tier j → prime (x i) ≠ prime (x j))
|
| 30 |
+
(hunique : ∀ x, weight x ≠ 0 → ∀ j i, prime (x i) = prime (x (rep j)) → i = rep j)
|
| 31 |
+
(hfmod : ∀ x, weight x ≠ 0 → ∀ j side,
|
| 32 |
+
(T side).Frequencies (fun s => (s : ZMod (prime (x (rep j)))) ≠ 0)) :
|
| 33 |
+
‖∑ x, (productPrior μ x : ℂ) * weight x *
|
| 34 |
+
((∏ j, (movingSampledInternalProbability prime hprime T x (rep j) : ℂ)) -
|
| 35 |
+
∏ j, (internalLineFlagWeight true (prime (x (rep j)))
|
| 36 |
+
(fun s => arithmeticTestFlag (lineTestPolynomials
|
| 37 |
+
(movingIndexedLine T (rep j) (base j)) ⟨(base j).1, (base j).2.val⟩ s = 0)) : ℂ))‖ ≤
|
| 38 |
+
2 * B * (Fintype.card J * (2 + Fintype.card (MovingPairOccurrenceIndex T))) *
|
| 39 |
+
((2 * ((n + 1) * d) : ℕ) * α +
|
| 40 |
+
(Real.log (2 * ((2 * (F * U ^ d)) ^ (n + 1)) ^ 2) / V) * β) := by
|
| 41 |
+
let path := fun j o => (movingIndexedOccurrence T (rep j) (base j) o).path
|
| 42 |
+
let current := fun j o => (movingIndexedOccurrence T (rep j) (base j) o).current
|
| 43 |
+
let b : J → MovingPairOccurrenceIndex T := fun j => ⟨(base j).1, (base j).2.val⟩
|
| 44 |
+
have hi : Function.Injective (fun a => (prime a : ℤ)) := by
|
| 45 |
+
intro a b h
|
| 46 |
+
apply hpInj
|
| 47 |
+
exact Int.ofNat.inj h
|
| 48 |
+
have hu (x : Fin (N + 1) → A) (hx : weight x ≠ 0) (j : J) (o : MovingPairOccurrenceIndex T) :=
|
| 49 |
+
movingIndexedOccurrence_units T tier (fun i => prime (x i)) (fun i => hprime (x i))
|
| 50 |
+
(hdisjoint x hx) hlevels (rep j) (base j) (hfmod x hx j) o
|
| 51 |
+
have h := moving_slot_line_product_comparison (fun a => (prime a : ℤ)) hi prime hpInj hprime
|
| 52 |
+
path current b rep (fun _ => true) n d F U hF hU
|
| 53 |
+
(fun j o => movingIndexedOccurrence_path_length T tier hlevels (rep j) (base j) o)
|
| 54 |
+
(fun j o => movingIndexedOccurrence_size T d F hsize hfreq (rep j) (base j) o)
|
| 55 |
+
(fun j o => movingIndexedOccurrence_absent T tier hlevels (rep j) (base j) o)
|
| 56 |
+
hvalues μ hμ hmass α β V hα hβ hV hmax hpmax hprimeSize weight B hB hweight
|
| 57 |
+
(by
|
| 58 |
+
intro x hx j o s hs
|
| 59 |
+
simpa only [integerLineReduction, MovingSlotReversal.naturalReduction, Int.cast_natCast] using
|
| 60 |
+
(hu x hx j o).1 s hs)
|
| 61 |
+
(by
|
| 62 |
+
intro x hx j
|
| 63 |
+
simpa only [integerLineReduction, MovingSlotReversal.naturalReduction, Int.cast_natCast] using
|
| 64 |
+
(hu x hx j (b j)).2)
|
| 65 |
+
have he (x : Fin (N + 1) → A) :
|
| 66 |
+
weight x * (∏ j, (movingSampledInternalProbability prime hprime T x (rep j) : ℂ)) =
|
| 67 |
+
weight x * ∏ j, (movingSlotLineProbability (fun a => (prime a : ℤ)) prime hprime
|
| 68 |
+
(path j) (current j) true x (x (rep j)) : ℂ) := by
|
| 69 |
+
by_cases hx : weight x = 0
|
| 70 |
+
· simp only [hx, zero_mul]
|
| 71 |
+
· congr 1
|
| 72 |
+
apply Finset.prod_congr rfl
|
| 73 |
+
intro j _
|
| 74 |
+
exact congrArg (fun r : ℝ => (r : ℂ))
|
| 75 |
+
(movingSampledIndexedProbability prime hprime x T tier (hdisjoint x hx) hlevels
|
| 76 |
+
(rep j) (base j) (hunique x hx j) (hfmod x hx j))
|
| 77 |
+
convert h using 1
|
| 78 |
+
congr 1
|
| 79 |
+
apply Finset.sum_congr rfl
|
| 80 |
+
intro x _
|
| 81 |
+
rw [mul_assoc, mul_sub, he, ← mul_sub, ← mul_assoc]
|
| 82 |
+
rfl
|
| 83 |
+
|
| 84 |
+
end Ostmann
|
| 85 |
+
|
| 86 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAdaptiveSupport.lean
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingNodeUnits
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Construction.CompensatedAdaptiveSupport
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.ForwardHistorySupport
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-! # Constructed adaptive support for the original moving-giant sampler -/
|
| 8 |
+
|
| 9 |
+
namespace Ostmann
|
| 10 |
+
open scoped Classical
|
| 11 |
+
|
| 12 |
+
noncomputable def movingSampledPivotHistory {σ : Type*} (value : σ → ℕ)
|
| 13 |
+
(childBound pivotBound : ℕ → ℕ) (n Q : ℕ) (t : FrequencyTree ℤ n)
|
| 14 |
+
(small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (XL XR : ℕ)
|
| 15 |
+
(y : TreeLeafTuple (ZMod Q)ˣ n)
|
| 16 |
+
(hy : treeIntegerResidues Q n
|
| 17 |
+
(treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) y) :
|
| 18 |
+
SampledPivotHistory n Q where
|
| 19 |
+
bulk := treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)
|
| 20 |
+
residue := y
|
| 21 |
+
pivots := movingGiantArray value childBound pivotBound n
|
| 22 |
+
⟨n, buildMovingSlotData n t small bulk a, XL, XR⟩ t
|
| 23 |
+
compatible := hy
|
| 24 |
+
|
| 25 |
+
theorem movingSampledPivotHistory_valid {σ : Type*} (value : σ → ℕ)
|
| 26 |
+
(outside : List ℕ) (childBound pivotBound : ℕ → ℕ)
|
| 27 |
+
(F : MovingSlotState σ → ℤ → ℂ) (E : MovingSlotState σ → ℤ → ℤ → ℤ → ℝ)
|
| 28 |
+
(S : Finset ℤ) (n Q : ℕ) (t : FrequencyTree S n)
|
| 29 |
+
(small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (XL XR : ℕ)
|
| 30 |
+
(y : TreeLeafTuple (ZMod Q)ˣ n)
|
| 31 |
+
(hy : treeIntegerResidues Q n
|
| 32 |
+
(treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) y)
|
| 33 |
+
(hsmall : ∀ i s, s ∈ S → IsCoprime (value i : ℤ) s)
|
| 34 |
+
(hw : recursiveTransferWeight (movingSlotSystem value childBound pivotBound) F
|
| 35 |
+
(movingSlotCutoff value childBound pivotBound (movingGuardedExtra value outside E)) n
|
| 36 |
+
⟨n, buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a, XL, XR⟩
|
| 37 |
+
(frequencyTreeMap Subtype.val n t) ≠ 0) :
|
| 38 |
+
(movingSampledPivotHistory value childBound pivotBound n Q
|
| 39 |
+
(frequencyTreeMap Subtype.val n t) small bulk a XL XR y hy).compensatedValid
|
| 40 |
+
(movingSampleAncestorScheme value S n t small a XL XR)
|
| 41 |
+
(movingSampleCompensation value n small a) := by
|
| 42 |
+
exact ⟨movingSample_compensatedEquations value childBound pivotBound F
|
| 43 |
+
(movingGuardedExtra value outside E) S n t small bulk a XL XR hw,
|
| 44 |
+
movingSample_coefficient_units value outside childBound pivotBound F E S n t
|
| 45 |
+
small bulk a XL XR hsmall hw⟩
|
| 46 |
+
|
| 47 |
+
theorem movingFrameConstants_compensation_coprime {σ : Type*} (value : σ → ℕ)
|
| 48 |
+
(R : ℤ) (hsmall : ∀ i, IsCoprime (value i : ℤ) R) (n : ℕ)
|
| 49 |
+
(small : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (path : List Bool) :
|
| 50 |
+
IsCoprime ((movingFrameConstants value n small a path).compensation : ℤ) R := by
|
| 51 |
+
induction n generalizing path with
|
| 52 |
+
| zero =>
|
| 53 |
+
cases a
|
| 54 |
+
change IsCoprime (1 : ℤ) R
|
| 55 |
+
exact isCoprime_one_left
|
| 56 |
+
| succ n ih =>
|
| 57 |
+
cases a with
|
| 58 |
+
| node a l r =>
|
| 59 |
+
cases path with
|
| 60 |
+
| nil => exact movingNaturalProduct_coprime value _ R (fun i _ => hsmall i)
|
| 61 |
+
| cons b path => cases b <;> apply ih
|
| 62 |
+
|
| 63 |
+
/-- The prefix tests are built from actual samples and are passed by every
|
| 64 |
+
nonzero original history. There is no assumed adaptive-support event. -/
|
| 65 |
+
theorem movingSample_adaptive_support {σ : Type*} (value : σ → ℕ)
|
| 66 |
+
(outside : List ℕ) (childBound pivotBound : ℕ → ℕ)
|
| 67 |
+
(F : MovingSlotState σ → ℤ → ℂ) (E : MovingSlotState σ → ℤ → ℤ → ℤ → ℝ)
|
| 68 |
+
(S : Finset ℤ) (n R : ℕ) [NeZero (R ^ (n + 2))] (t : FrequencyTree S n)
|
| 69 |
+
(hS : ∀ s ∈ S, s ≠ 0 ∧ s.natAbs ∣ R)
|
| 70 |
+
(small bulk : TreeLeafTuple (List σ) n) (a : MovingSampleSlots σ n) (XL XR : ℕ)
|
| 71 |
+
(hsmall : ∀ i, IsCoprime (value i : ℤ) (R : ℤ))
|
| 72 |
+
(y : TreeLeafTuple (ZMod (R ^ (n + 2)))ˣ n)
|
| 73 |
+
(hy : treeIntegerResidues (R ^ (n + 2)) n
|
| 74 |
+
(treeLeafMap (fun q : ℕ => (q : ℤ)) n (movingSlotValues value n bulk)) y)
|
| 75 |
+
(hw : recursiveTransferWeight (movingSlotSystem value childBound pivotBound) F
|
| 76 |
+
(movingSlotCutoff value childBound pivotBound (movingGuardedExtra value outside E)) n
|
| 77 |
+
⟨n, buildMovingSlotData n (frequencyTreeMap Subtype.val n t) small bulk a, XL, XR⟩
|
| 78 |
+
(frequencyTreeMap Subtype.val n t) ≠ 0) :
|
| 79 |
+
let D := movingSampleAncestorScheme value S n t small a XL XR
|
| 80 |
+
let hs : ∀ i, (D.frequencies i).root ≠ 0 :=
|
| 81 |
+
fun i => (hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)).1
|
| 82 |
+
let hsR : ∀ i, (D.frequencies i).root.natAbs ∣ R :=
|
| 83 |
+
fun i => (hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)).2
|
| 84 |
+
singleArithmeticLeafSupport n
|
| 85 |
+
(compensatedAdaptiveData n R n D (movingSampleCompensation value n small a) hs hsR) y = 1 := by
|
| 86 |
+
dsimp only
|
| 87 |
+
let hist := movingSampledPivotHistory value childBound pivotBound n (R ^ (n + 2))
|
| 88 |
+
(frequencyTreeMap Subtype.val n t) small bulk a XL XR y hy
|
| 89 |
+
have hs : ∀ i s, s ∈ S → IsCoprime (value i : ℤ) s := by
|
| 90 |
+
intro i s hmem
|
| 91 |
+
exact (hsmall i).of_isCoprime_of_dvd_right
|
| 92 |
+
(Int.natAbs_dvd.mp (Int.natCast_dvd_natCast.mpr (hS s hmem).2))
|
| 93 |
+
apply compensatedAdaptiveData_actual_support n R n
|
| 94 |
+
(movingSampleAncestorScheme value S n t small a XL XR)
|
| 95 |
+
(movingSampleCompensation value n small a)
|
| 96 |
+
(fun i => movingFrameConstants_compensation_coprime value R hsmall n small a _)
|
| 97 |
+
(fun i => (preorderNodePath_length n i).le)
|
| 98 |
+
(fun i => (hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)).1)
|
| 99 |
+
(fun i => (hS _ (singleTreeNodeFrequencies_root_mem S n t i.val i.isLt)).2)
|
| 100 |
+
hist
|
| 101 |
+
exact movingSampledPivotHistory_valid value outside childBound pivotBound F E S n _ t
|
| 102 |
+
small bulk a XL XR y hy hs hw
|
| 103 |
+
|
| 104 |
+
end Ostmann
|
| 105 |
+
|
| 106 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAlphabetRestriction.lean
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Construction.SupportedAlphabetSum
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingOriginalWeightRelabel
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingFrequencyCoefficient
|
| 4 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateCoefficient
|
| 5 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingPatternTree
|
| 6 |
+
|
| 7 |
+
namespace OAI
|
| 8 |
+
|
| 9 |
+
/-! # The original moving sampler on a smaller live alphabet -/
|
| 10 |
+
namespace Ostmann
|
| 11 |
+
open scoped Classical BigOperators SchwartzMap
|
| 12 |
+
|
| 13 |
+
theorem movingCompensationExtra_map {A B : Type*} (e : B → A) (value : A → ℕ)
|
| 14 |
+
{n : ℕ} (T : MovingSlotData B n) (s v w : ℤ) :
|
| 15 |
+
movingCompensationExtra value (T.map e) s v w =
|
| 16 |
+
movingCompensationExtra (value ∘ e) T s v w := by
|
| 17 |
+
cases T <;> simp only [MovingSlotData.map, movingCompensationExtra,
|
| 18 |
+
MovingSlotReversal.naturalProduct_map]
|
| 19 |
+
|
| 20 |
+
theorem movingOriginalSampleAverage_alphabet {A B I : Type} [Fintype A] [Fintype B]
|
| 21 |
+
(e : B ↪ A) (q : I → ℕ) [∀ i, Fact (q i).Prime]
|
| 22 |
+
(value : A → ℕ) (outside : List ℕ) (μ : ℕ → A → ℝ)
|
| 23 |
+
(childBound pivotBound : ℕ → ℕ)
|
| 24 |
+
(F : {n : ℕ} → MovingSlotData A n → ℤ → ℂ)
|
| 25 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset I)
|
| 26 |
+
(ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (φ : ℝ → ℝ) (G : ℕ → ℝ)
|
| 27 |
+
(n : ℕ) (t : FrequencyTree ℤ n) (small bulk : TreeLeafTuple (List B) n)
|
| 28 |
+
(XL XR : ℕ) (hμ : ∀ j a, j < n → μ j a ≠ 0 → a ∈ Set.range e) :
|
| 29 |
+
movingOriginalSampleAverage q value outside μ childBound pivotBound F g Dq S ψ X lo hi φ G
|
| 30 |
+
n t (treeLeafMap (List.map e) n small) (treeLeafMap (List.map e) n bulk) XL XR =
|
| 31 |
+
movingOriginalSampleAverage q (value ∘ e) outside (fun j b => μ j (e b)) childBound pivotBound
|
| 32 |
+
(fun T => F (T.map e)) g Dq S ψ X lo hi φ G n t small bulk XL XR := by
|
| 33 |
+
unfold movingOriginalSampleAverage
|
| 34 |
+
rw [movingSamplesPrior_alphabet_sum e μ n _ hμ]
|
| 35 |
+
apply Finset.sum_congr rfl
|
| 36 |
+
intro a _
|
| 37 |
+
congr 1
|
| 38 |
+
rw [← buildMovingSlotData_map, movingOriginalGiantWeight_map, movingSupportedWeight_map]
|
| 39 |
+
congr 2
|
| 40 |
+
funext d T s v w
|
| 41 |
+
exact movingCompensationExtra_map e value T s v w
|
| 42 |
+
|
| 43 |
+
theorem movingFrequencyCoefficient_original_alphabet {A B I : Type} [Fintype A] [Fintype B]
|
| 44 |
+
(e : B ↪ A) (q : I → ℕ) [∀ i, Fact (q i).Prime]
|
| 45 |
+
(value : A → ℕ) (outside : List ℕ) (μ : ℕ → A → ℝ)
|
| 46 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 47 |
+
(F : {n : ℕ} → MovingSlotData A n → ℤ → ℂ)
|
| 48 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset I)
|
| 49 |
+
(ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (φ : ℝ → ℝ) (G : ℕ → ℝ)
|
| 50 |
+
(n : ℕ) (s : ℤ) (small bulk : TreeLeafTuple (List B) n)
|
| 51 |
+
(XL XR : ℕ) (hμ : ∀ j a, j < n → μ j a ≠ 0 → a ∈ Set.range e) :
|
| 52 |
+
movingFrequencyCoefficient value outside μ childBound pivotBound V
|
| 53 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n s
|
| 54 |
+
(treeLeafMap (List.map e) n small) (treeLeafMap (List.map e) n bulk) XL XR =
|
| 55 |
+
movingFrequencyCoefficient (value ∘ e) outside (fun j b => μ j (e b)) childBound pivotBound V
|
| 56 |
+
(movingOriginalLeaf (value ∘ e) q (fun T => F (T.map e)) g Dq S ψ X lo hi)
|
| 57 |
+
φ G n s small bulk XL XR := by
|
| 58 |
+
simp only [movingFrequencyCoefficient_original]
|
| 59 |
+
apply Finset.sum_congr rfl
|
| 60 |
+
intro t _
|
| 61 |
+
exact movingOriginalSampleAverage_alphabet e q value outside μ childBound pivotBound F g Dq S
|
| 62 |
+
ψ X lo hi φ G n _ small bulk XL XR hμ
|
| 63 |
+
|
| 64 |
+
theorem movingTemplateCoefficient_original_alphabet {A B I : Type} [Fintype A] [Fintype B]
|
| 65 |
+
(e : B ↪ A) (q : I → ℕ) [∀ i, Fact (q i).Prime]
|
| 66 |
+
(value : A → ℕ) (outside : List ℕ) (μ : ℕ → A → ℝ)
|
| 67 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 68 |
+
(F : {n : ℕ} → MovingSlotData A n → ℤ → ℂ)
|
| 69 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset I)
|
| 70 |
+
(ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (φ : ℝ → ℝ) (G : ℕ → ℝ)
|
| 71 |
+
(n r m : ℕ) (s : ℤ) (y : MovingRegularSlot n r m → B)
|
| 72 |
+
(XL XR : ℕ) (hμ : ∀ j a, j < n → μ j a ≠ 0 → a ∈ Set.range e) :
|
| 73 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V
|
| 74 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n r m s (e ∘ y) XL XR =
|
| 75 |
+
movingTemplateCoefficient (value ∘ e) outside (fun j b => μ j (e b)) childBound pivotBound V
|
| 76 |
+
(movingOriginalLeaf (value ∘ e) q (fun T => F (T.map e)) g Dq S ψ X lo hi)
|
| 77 |
+
φ G n r m s y XL XR := by
|
| 78 |
+
unfold movingTemplateCoefficient
|
| 79 |
+
rw [← treeLeafMap_list_comp, ← treeLeafMap_list_comp]
|
| 80 |
+
exact movingFrequencyCoefficient_original_alphabet e q value outside μ childBound pivotBound V F
|
| 81 |
+
g Dq S ψ X lo hi φ G n s _ _ XL XR hμ
|
| 82 |
+
|
| 83 |
+
end Ostmann
|
| 84 |
+
|
| 85 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeAlphabet.lean
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAlphabetRestriction
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateAmplitude
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The literal prime amplitude is unchanged by restricting live regular primes -/
|
| 7 |
+
namespace Ostmann
|
| 8 |
+
open scoped Classical BigOperators SchwartzMap
|
| 9 |
+
|
| 10 |
+
theorem movingTemplatePrimeAmplitude_original_alphabet {A B I : Type}
|
| 11 |
+
[Fintype A] [Fintype B]
|
| 12 |
+
(e : B ↪ A) (q : I → ℕ) [∀ i, Fact (q i).Prime]
|
| 13 |
+
(value : A → ℕ) (outside : List ℕ) (μ : ℕ → A → ℝ)
|
| 14 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 15 |
+
(F : {n : ℕ} → MovingSlotData A n → ℤ → ℂ)
|
| 16 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset I)
|
| 17 |
+
(ψ : 𝓢(ℝ, ℂ)) (X lo hi : ℝ) (φ : ℝ → ℝ) (G : ℕ → ℝ)
|
| 18 |
+
(n r m : ℕ) (Pg : Finset ℕ) (ρ : Pg → ℝ)
|
| 19 |
+
(ν : MovingRegularSlot n r m → A → ℝ)
|
| 20 |
+
(hμ : ∀ j a, j < n → μ j a ≠ 0 → a ∈ Set.range e)
|
| 21 |
+
(hν : ∀ i a, ν i a ≠ 0 → a ∈ Set.range e)
|
| 22 |
+
(greg ggiant : ∀ p : ℕ, ZMod p → ℂ) (favorable : ℕ → Bool) :
|
| 23 |
+
movingTemplatePrimeAmplitude value outside μ childBound pivotBound V
|
| 24 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n r m Pg ρ ν greg ggiant favorable =
|
| 25 |
+
movingTemplatePrimeAmplitude (value ∘ e) outside (fun j b => μ j (e b)) childBound pivotBound V
|
| 26 |
+
(movingOriginalLeaf (value ∘ e) q (fun T => F (T.map e)) g Dq S ψ X lo hi)
|
| 27 |
+
φ G n r m Pg ρ (fun i b => ν i (e b)) greg ggiant favorable := by
|
| 28 |
+
unfold movingTemplatePrimeAmplitude
|
| 29 |
+
apply Finset.sum_congr rfl
|
| 30 |
+
intro XL _
|
| 31 |
+
congr 1
|
| 32 |
+
apply Finset.sum_congr rfl
|
| 33 |
+
intro XR _
|
| 34 |
+
congr 1
|
| 35 |
+
apply Finset.sum_congr rfl
|
| 36 |
+
intro s _
|
| 37 |
+
have he := productPrior_alphabet_sum e ν (fun y =>
|
| 38 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V
|
| 39 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n r m s.val y XL XR *
|
| 40 |
+
movingTaggedTransform
|
| 41 |
+
(Sum.elim (fun b : Bool => if b then (XL : ℕ) else (XR : ℕ)) (value ∘ y))
|
| 42 |
+
(Sum.elim (fun _ => true) (fun _ => false)) greg ggiant favorable outside.prod s.val) hν
|
| 43 |
+
simp only [finite_univ_canonical] at he ⊢
|
| 44 |
+
rw [he]
|
| 45 |
+
apply Finset.sum_congr rfl
|
| 46 |
+
intro y _
|
| 47 |
+
rw [movingTemplateCoefficient_original_alphabet e q value outside μ childBound pivotBound V
|
| 48 |
+
F g Dq S ψ X lo hi φ G n r m s.val y XL XR hμ]
|
| 49 |
+
rfl
|
| 50 |
+
|
| 51 |
+
end Ostmann
|
| 52 |
+
|
| 53 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeCoefficientSupport.lean
ADDED
|
@@ -0,0 +1,339 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingNodeCoefficientSupport
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingConstructedLiveProductStep
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The full moving transfer with separation on its actual coefficient support -/
|
| 7 |
+
namespace Ostmann
|
| 8 |
+
open scoped Classical BigOperators ComplexConjugate
|
| 9 |
+
|
| 10 |
+
private theorem coefficient_amplitude_pair_sum {A B C : Type} [Fintype A] [Fintype B] [Fintype C]
|
| 11 |
+
(ρ : A → ℝ) (ν : B → ℝ) (F : A → A → B → B → C → C → ℂ) :
|
| 12 |
+
(∑ a : A × (B × C), ∑ b : A × (B × C),
|
| 13 |
+
((ρ a.1 * ν a.2.1 : ℝ) : ℂ) * ((ρ b.1 * ν b.2.1 : ℝ) : ℂ) *
|
| 14 |
+
F a.1 b.1 a.2.1 b.2.1 a.2.2 b.2.2) =
|
| 15 |
+
∑ x, (ρ x : ℂ) * ∑ z, (ρ z : ℂ) *
|
| 16 |
+
∑ y, (ν y : ℂ) * ∑ t, (ν t : ℂ) * ∑ v, ∑ w, F x z y t v w := by
|
| 17 |
+
simp only [Fintype.sum_prod_type, Finset.mul_sum, Complex.ofReal_mul]
|
| 18 |
+
conv_lhs =>
|
| 19 |
+
arg 2
|
| 20 |
+
ext x
|
| 21 |
+
arg 2
|
| 22 |
+
ext y
|
| 23 |
+
rw [Finset.sum_comm]
|
| 24 |
+
conv_lhs =>
|
| 25 |
+
arg 2
|
| 26 |
+
ext x
|
| 27 |
+
rw [Finset.sum_comm]
|
| 28 |
+
conv_lhs =>
|
| 29 |
+
arg 2
|
| 30 |
+
ext x
|
| 31 |
+
arg 2
|
| 32 |
+
ext z
|
| 33 |
+
arg 2
|
| 34 |
+
ext y
|
| 35 |
+
rw [Finset.sum_comm]
|
| 36 |
+
apply Finset.sum_congr rfl
|
| 37 |
+
intro x _
|
| 38 |
+
apply Finset.sum_congr rfl
|
| 39 |
+
intro z _
|
| 40 |
+
apply Finset.sum_congr rfl
|
| 41 |
+
intro y _
|
| 42 |
+
apply Finset.sum_congr rfl
|
| 43 |
+
intro t _
|
| 44 |
+
apply Finset.sum_congr rfl
|
| 45 |
+
intro v _
|
| 46 |
+
apply Finset.sum_congr rfl
|
| 47 |
+
intro w _
|
| 48 |
+
ring
|
| 49 |
+
|
| 50 |
+
private theorem coefficient_amplitude_full_sum {U S A B C : Type}
|
| 51 |
+
[Fintype U] [Fintype S] [Fintype A] [Fintype B] [Fintype C]
|
| 52 |
+
(M : U → ℂ) (ρ : A → ℝ) (ν : B → ℝ)
|
| 53 |
+
(F : U → S → A → A → B → B → C → C → ℂ) :
|
| 54 |
+
(∑ u, M u * ∑ s, ∑ a : A × (B × C), ∑ b : A × (B × C),
|
| 55 |
+
((ρ a.1 * ν a.2.1 : ℝ) : ℂ) * ((ρ b.1 * ν b.2.1 : ℝ) : ℂ) *
|
| 56 |
+
F u s a.1 b.1 a.2.1 b.2.1 a.2.2 b.2.2) =
|
| 57 |
+
∑ XL, (ρ XL : ℂ) * ∑ XR, (ρ XR : ℂ) * ∑ s, ∑ u, M u *
|
| 58 |
+
∑ left, (ν left : ℂ) * ∑ right, (ν right : ℂ) * ∑ v, ∑ w,
|
| 59 |
+
F u s XL XR left right v w := by
|
| 60 |
+
simp_rw [coefficient_amplitude_pair_sum]
|
| 61 |
+
simp only [Finset.mul_sum]
|
| 62 |
+
conv_lhs =>
|
| 63 |
+
arg 2
|
| 64 |
+
ext u
|
| 65 |
+
rw [Finset.sum_comm]
|
| 66 |
+
rw [Finset.sum_comm]
|
| 67 |
+
apply Finset.sum_congr rfl
|
| 68 |
+
intro XL _
|
| 69 |
+
conv_lhs =>
|
| 70 |
+
arg 2
|
| 71 |
+
ext u
|
| 72 |
+
rw [Finset.sum_comm]
|
| 73 |
+
rw [Finset.sum_comm]
|
| 74 |
+
apply Finset.sum_congr rfl
|
| 75 |
+
intro XR _
|
| 76 |
+
rw [Finset.sum_comm]
|
| 77 |
+
apply Finset.sum_congr rfl
|
| 78 |
+
intro s _
|
| 79 |
+
apply Finset.sum_congr rfl
|
| 80 |
+
intro u _
|
| 81 |
+
apply Finset.sum_congr rfl
|
| 82 |
+
intro left _
|
| 83 |
+
apply Finset.sum_congr rfl
|
| 84 |
+
intro right _
|
| 85 |
+
apply Finset.sum_congr rfl
|
| 86 |
+
intro v _
|
| 87 |
+
apply Finset.sum_congr rfl
|
| 88 |
+
intro w _
|
| 89 |
+
ring
|
| 90 |
+
|
| 91 |
+
theorem movingAmplitudeOffDiagonal_eq_next_on_coefficients {σ : Type} [Fintype σ]
|
| 92 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime) (outside : List ℕ)
|
| 93 |
+
(μ : ℕ → σ → ℝ) (childBound pivotBound V : ℕ → ℕ) (hV : Monotone V)
|
| 94 |
+
(F : MovingSlotState σ → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 95 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 96 |
+
(Pg : Finset ℕ) (hPg : ∀ q ∈ Pg, q.Prime) (ρ : Pg → ℝ)
|
| 97 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 98 |
+
(hlarge : ∀ q : Pg, V (n + 1) < (q : ℕ))
|
| 99 |
+
(I : Finset ℕ) (hI : ∀ p ∈ I, 0 < p)
|
| 100 |
+
(hφ : ∀ p : ℕ, 0 < p → φ (Real.log p - G (n + 1)) ≠ 0 → p ∈ I)
|
| 101 |
+
(hchild : V n ≤ childBound (n + 1))
|
| 102 |
+
(hgap : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 103 |
+
∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 104 |
+
∀ (p : ℕ) (w : ℤ),
|
| 105 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V F φ G n (4 + r) m w
|
| 106 |
+
(movingRestoreSample n r m u right) p XR ≠ 0 →
|
| 107 |
+
2 * pivotBound (n + 1) * childBound (n + 1) < (XR : ℕ) * ∏ i, value (right i))
|
| 108 |
+
(hRH : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 109 |
+
∀ q, q.Prime → q ∣ (XR : ℕ) * (∏ i, value (right i)) → V (n + 1) < q)
|
| 110 |
+
(hcomp : ∀ u : TreeLeafIndex n × Fin 4 → σ, (∏ i, μ n (u i)) ≠ 0 →
|
| 111 |
+
(∀ p ∈ I, p * (∏ i, value (u i)) ≤ pivotBound (n + 1)) ∧
|
| 112 |
+
(∀ q, q.Prime → q ∣ ∏ i, value (u i) → childBound (n + 1) < q))
|
| 113 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 114 |
+
movingAmplitudeOffDiagonal value outside μ childBound pivotBound V F φ G n r m Pg I
|
| 115 |
+
ρ ν greg ggiant favorable =
|
| 116 |
+
movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G (n + 1) r m
|
| 117 |
+
Pg ρ (movingTemplateDoubledPrior n r m ν) greg ggiant favorable := by
|
| 118 |
+
rw [movingTemplatePrimeAmplitude_next_on_coefficients value hvalue outside μ childBound pivotBound V hV
|
| 119 |
+
F hF φ G n r m Pg hPg ρ (movingTemplateDoubledPrior n r m ν) hlarge I hI hφ hchild
|
| 120 |
+
(by simpa only [movingTemplateDoubledPrior_side] using hgap)
|
| 121 |
+
(by simpa only [movingTemplateDoubledPrior_side] using hRH) hcomp]
|
| 122 |
+
simp only [movingTemplateDoubledPrior_side]
|
| 123 |
+
unfold movingAmplitudeOffDiagonal
|
| 124 |
+
dsimp only [movingAmplitudePrior]
|
| 125 |
+
have hr := coefficient_amplitude_full_sum
|
| 126 |
+
(U := TreeLeafIndex n × Fin 4 → σ) (S := transferFrequencyRange (V (n + 1)))
|
| 127 |
+
(A := Pg) (B := MovingRegularSlot n r m → σ) (C := transferFrequencyRange (V n))
|
| 128 |
+
(fun u => (((∏ i, μ n (u i)) * (∏ i, value (u i) : ℕ) : ℝ) : ℂ))
|
| 129 |
+
ρ (fun y => ∏ i, ν i (y i))
|
| 130 |
+
(fun u s XL XR left right v w => movingTemplateIntegerFourierTerm value outside μ
|
| 131 |
+
childBound pivotBound V F φ G n r m I XL XR s.val left right greg ggiant favorable
|
| 132 |
+
u v.val w.val)
|
| 133 |
+
convert hr using 1
|
| 134 |
+
simp only [Nat.cast_prod]
|
| 135 |
+
|
| 136 |
+
theorem movingTemplatePrimeAmplitude_step_on_coefficients {σ : Type} [Fintype σ]
|
| 137 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime)
|
| 138 |
+
(outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 139 |
+
(childBound pivotBound V : ℕ → ℕ) (hV : Monotone V)
|
| 140 |
+
(F : MovingSlotState σ → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 141 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 142 |
+
(Pg I : Finset ℕ) (hPg : ∀ p ∈ Pg, p.Prime) (hPI : Pg ⊆ I)
|
| 143 |
+
(hI : ∀ p ∈ I, 0 < p) (hφ : ∀ x, 0 ≤ φ x)
|
| 144 |
+
(hpos : 0 < smoothGiantMass Pg φ (G (n + 1)))
|
| 145 |
+
(hμ : ∀ a, 0 ≤ μ n a) (hμmass : ∑ a, μ n a = 1)
|
| 146 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 147 |
+
(sets : ∀ q : ℕ, Finset (ZMod q))
|
| 148 |
+
(hsets : ∀ a, (sets (value a)).Nonempty)
|
| 149 |
+
(hcard : ∀ a, (sets (value a)).card < value a)
|
| 150 |
+
(ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool)
|
| 151 |
+
(hgiant : ∀ q : Pg, ∀ x, ggiant q (-x) = conj (ggiant q x))
|
| 152 |
+
(H : ℕ)
|
| 153 |
+
(hH : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 154 |
+
∀ (p : ℕ), p ∈ I →
|
| 155 |
+
∀ (q : Pg) (y : MovingRegularSlot n r m → σ) (s : transferFrequencyRange (V n)),
|
| 156 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V F φ G
|
| 157 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p q ≠ 0 →
|
| 158 |
+
(q : ℕ) * (∏ i, value (y i)) ≤ H)
|
| 159 |
+
(hscale : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 → ∀ p ∈ I,
|
| 160 |
+
2 * V n * H ≤ V (n + 1) * (p * ∏ i, value (u i)))
|
| 161 |
+
(hlarge : ∀ (q : Pg) (y : MovingRegularSlot n r m → σ),
|
| 162 |
+
(∏ i, ν i (y i)) ≠ 0 → ∀ ℓ, ℓ.Prime → ℓ ∣ (q : ℕ) * (∏ i, value (y i)) → V (n + 1) < ℓ)
|
| 163 |
+
(hvg : ∀ q : Pg, V (n + 1) < (q : ℕ))
|
| 164 |
+
(hφsupport : ∀ p : ℕ, 0 < p → φ (Real.log p - G (n + 1)) ≠ 0 → p ∈ I)
|
| 165 |
+
(hchild : V n ≤ childBound (n + 1))
|
| 166 |
+
(hgap : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 167 |
+
∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 168 |
+
∀ (p : ℕ) (w : ℤ),
|
| 169 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V F φ G n (4 + r) m w
|
| 170 |
+
(movingRestoreSample n r m u right) p XR ≠ 0 →
|
| 171 |
+
2 * pivotBound (n + 1) * childBound (n + 1) < (XR : ℕ) * ∏ i, value (right i))
|
| 172 |
+
(hcomp : ∀ u : TreeLeafIndex n × Fin 4 → σ, (∏ i, μ n (u i)) ≠ 0 →
|
| 173 |
+
(∀ p ∈ I, p * (∏ i, value (u i)) ≤ pivotBound (n + 1)) ∧
|
| 174 |
+
(∀ q, q.Prime → q ∣ ∏ i, value (u i) → childBound (n + 1) < q)) :
|
| 175 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 176 |
+
let greg := normalizedResidueFamily sets
|
| 177 |
+
Real.exp (-smoothGiantLogNormalizer Pg φ (G (n + 1))) *
|
| 178 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n (4 + r) m
|
| 179 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable‖ ^ 2 ≤
|
| 180 |
+
movingAmplitudeDiagonal value outside μ childBound pivotBound V F φ G n r m Pg I
|
| 181 |
+
ρ ν greg ggiant favorable +
|
| 182 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G (n + 1) r m
|
| 183 |
+
Pg ρ (movingTemplateDoubledPrior n r m ν) greg ggiant favorable‖ := by
|
| 184 |
+
intro ρ greg
|
| 185 |
+
have he := movingAmplitudeOffDiagonal_eq_next_on_coefficients value hvalue outside μ childBound pivotBound V
|
| 186 |
+
hV F hF φ G n r m Pg hPg ρ ν hvg I hI hφsupport hchild hgap
|
| 187 |
+
(fun XR right hr => hlarge XR right hr) hcomp greg ggiant favorable
|
| 188 |
+
rw [← he]
|
| 189 |
+
exact movingTemplatePrimeAmplitude_transfer_on_live value hvalue outside μ childBound pivotBound V F
|
| 190 |
+
φ G n r m Pg I hPg hPI hI hφ hpos hμ hμmass ν sets hsets hcard ggiant favorable
|
| 191 |
+
hgiant H hH hscale hlarge
|
| 192 |
+
|
| 193 |
+
theorem movingTemplatePrimeAmplitude_step_of_live_coefficients {σ J : Type} [Fintype σ]
|
| 194 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime)
|
| 195 |
+
(outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 196 |
+
(childBound pivotBound V : ℕ → ℕ) (hV : Monotone V)
|
| 197 |
+
(q : J → ℕ) [∀ i, Fact (q i).Prime]
|
| 198 |
+
(F : {n : ℕ} → MovingSlotData σ n → ℤ → ℂ)
|
| 199 |
+
(hF : ∀ {n} (T : MovingSlotData σ n), F T 0 = 0)
|
| 200 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset J)
|
| 201 |
+
(ψ : SchwartzMap ℝ ℂ) (X lo hi W : ℝ) (hX : 0 < X)
|
| 202 |
+
(hwindow : X * hi ≤ Real.exp W)
|
| 203 |
+
(φ : ℝ → ℝ) (G c : ℕ → ℝ) (hout : ∀ t, 1 ≤ |t| → φ t = 0)
|
| 204 |
+
(hμlower : ∀ j x, μ j x ≠ 0 → Real.exp (c j - 1) ≤ (value x : ℝ))
|
| 205 |
+
(n r m : ℕ)
|
| 206 |
+
(Pg I : Finset ℕ) (hPg : ∀ p ∈ Pg, p.Prime) (hPI : Pg ⊆ I)
|
| 207 |
+
(hI : ∀ p ∈ I, 0 < p) (hφ : ∀ x, 0 ≤ φ x)
|
| 208 |
+
(hpos : 0 < smoothGiantMass Pg φ (G (n + 1)))
|
| 209 |
+
(hμ : ∀ a, 0 ≤ μ n a) (hμmass : ∑ a, μ n a = 1)
|
| 210 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 211 |
+
(sets : ∀ q : ℕ, Finset (ZMod q))
|
| 212 |
+
(hsets : ∀ a, (sets (value a)).Nonempty)
|
| 213 |
+
(hcard : ∀ a, (sets (value a)).card < value a)
|
| 214 |
+
(ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool)
|
| 215 |
+
(hgiant : ∀ q : Pg, ∀ x, ggiant q (-x) = conj (ggiant q x))
|
| 216 |
+
(H : ℕ)
|
| 217 |
+
(hcap : ⌈Real.exp (movingProductExponent (movingCellPivotExponent G c) W n -
|
| 218 |
+
movingCellPivotExponent G c n)⌉₊ ≤ H)
|
| 219 |
+
(hIlower : ∀ p ∈ I, Real.exp (G (n + 1) - 1) ≤ (p : ℝ))
|
| 220 |
+
(hscale : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 → ∀ p ∈ I,
|
| 221 |
+
2 * V n * H ≤ V (n + 1) * (p * ∏ i, value (u i)))
|
| 222 |
+
(hlarge : ∀ (q : Pg) (y : MovingRegularSlot n r m → σ),
|
| 223 |
+
(∏ i, ν i (y i)) ≠ 0 → ∀ ℓ, ℓ.Prime → ℓ ∣ (q : ℕ) * (∏ i, value (y i)) → V (n + 1) < ℓ)
|
| 224 |
+
(hvg : ∀ q : Pg, V (n + 1) < (q : ℕ))
|
| 225 |
+
(hφsupport : ∀ p : ℕ, 0 < p → φ (Real.log p - G (n + 1)) ≠ 0 → p ∈ I)
|
| 226 |
+
(hchild : V n ≤ childBound (n + 1))
|
| 227 |
+
(hgap : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 228 |
+
∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 229 |
+
∀ (p : ℕ) (w : ℤ),
|
| 230 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V (movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n (4 + r) m w
|
| 231 |
+
(movingRestoreSample n r m u right) p XR ≠ 0 →
|
| 232 |
+
2 * pivotBound (n + 1) * childBound (n + 1) < (XR : ℕ) * ∏ i, value (right i))
|
| 233 |
+
(hcomp : ∀ u : TreeLeafIndex n × Fin 4 → σ, (∏ i, μ n (u i)) ≠ 0 →
|
| 234 |
+
(∀ p ∈ I, p * (∏ i, value (u i)) ≤ pivotBound (n + 1)) ∧
|
| 235 |
+
(∀ q, q.Prime → q ∣ ∏ i, value (u i) → childBound (n + 1) < q)) :
|
| 236 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 237 |
+
let greg := normalizedResidueFamily sets
|
| 238 |
+
Real.exp (-smoothGiantLogNormalizer Pg φ (G (n + 1))) *
|
| 239 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V
|
| 240 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n (4 + r) m
|
| 241 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable‖ ^ 2 ≤
|
| 242 |
+
movingAmplitudeDiagonal value outside μ childBound pivotBound V
|
| 243 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n r m Pg I
|
| 244 |
+
ρ ν greg ggiant favorable +
|
| 245 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V
|
| 246 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G (n + 1) r m
|
| 247 |
+
Pg ρ (movingTemplateDoubledPrior n r m ν) greg ggiant favorable‖ := by
|
| 248 |
+
let F₀ := movingOriginalLeaf value q F g Dq S ψ X lo hi
|
| 249 |
+
have hzero : ∀ x, F₀ x 0 = 0 :=
|
| 250 |
+
movingOriginalLeaf_zero value q F hF g Dq S ψ X lo hi
|
| 251 |
+
have hH (u : TreeLeafIndex n × Fin 4 → σ) (hu : (∏ i, μ n (u i)) ≠ 0)
|
| 252 |
+
(p : ℕ) (hp : p ∈ I) (q' : Pg) (y : MovingRegularSlot n r m → σ)
|
| 253 |
+
(s : transferFrequencyRange (V n))
|
| 254 |
+
(hc : movingTemplateCoefficient value outside μ childBound pivotBound V F₀ φ G
|
| 255 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p q' ≠ 0) :
|
| 256 |
+
(q' : ℕ) * (∏ i, value (y i)) ≤ H :=
|
| 257 |
+
(movingTemplateCoefficient_recursive_cell_cap value outside μ childBound pivotBound V
|
| 258 |
+
q F g Dq S ψ X lo hi W hX hwindow φ G c hout hμlower n r m u hu
|
| 259 |
+
s.val y p q' (hIlower p hp) hc).trans hcap
|
| 260 |
+
exact movingTemplatePrimeAmplitude_step_on_coefficients value hvalue outside μ childBound pivotBound V
|
| 261 |
+
hV F₀ hzero φ G n r m Pg I hPg hPI hI hφ hpos hμ hμmass ν sets hsets hcard
|
| 262 |
+
ggiant favorable hgiant H hH hscale hlarge hvg hφsupport hchild hgap hcomp
|
| 263 |
+
|
| 264 |
+
theorem movingTemplatePrimeAmplitude_step_constructed_coefficients {σ J : Type} [Fintype σ]
|
| 265 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime)
|
| 266 |
+
(outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 267 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 268 |
+
(q : J → ℕ) [∀ i, Fact (q i).Prime]
|
| 269 |
+
(F : {n : ℕ} → MovingSlotData σ n → ℤ → ℂ)
|
| 270 |
+
(hF : ∀ {n} (T : MovingSlotData σ n), F T 0 = 0)
|
| 271 |
+
(g : ∀ i, ZMod (q i) → ℂ) (Dq : ∀ i, (ZMod (q i))ˣ) (S : Finset J)
|
| 272 |
+
(ψ : SchwartzMap ℝ ℂ) (X lo hi W : ℝ) (hX : 0 < X)
|
| 273 |
+
(hwindow : X * hi ≤ Real.exp W)
|
| 274 |
+
(φ : ℝ → ℝ) (G c : ℕ → ℝ) (hout : ∀ t, 1 ≤ |t| → φ t = 0)
|
| 275 |
+
(hμlower : ∀ j x, μ j x ≠ 0 → Real.exp (c j - 1) ≤ (value x : ℝ))
|
| 276 |
+
(n r m : ℕ) (Y reserveMass : ℝ) (hm : 64 ≤ reserveMass) (hY : Y ≤ W)
|
| 277 |
+
(hVeq : V = movingProductNaturalCutoff (movingCellPivotExponent G c) W Y reserveMass)
|
| 278 |
+
(hbudget : ∀ j, 2 * movingCellPivotExponent G c j ≤
|
| 279 |
+
movingProductExponent (movingCellPivotExponent G c) W j)
|
| 280 |
+
(hpositive : 0 ≤ movingProductExponent (movingCellPivotExponent G c) W n -
|
| 281 |
+
movingCellPivotExponent G c n)
|
| 282 |
+
(Pg I : Finset ℕ) (hPg : ∀ p ∈ Pg, p.Prime) (hPI : Pg ⊆ I)
|
| 283 |
+
(hI : ∀ p ∈ I, 0 < p) (hφ : ∀ x, 0 ≤ φ x)
|
| 284 |
+
(hpos : 0 < smoothGiantMass Pg φ (G (n + 1)))
|
| 285 |
+
(hμ : ∀ a, 0 ≤ μ n a) (hμmass : ∑ a, μ n a = 1)
|
| 286 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 287 |
+
(sets : ∀ q : ℕ, Finset (ZMod q))
|
| 288 |
+
(hsets : ∀ a, (sets (value a)).Nonempty)
|
| 289 |
+
(hcard : ∀ a, (sets (value a)).card < value a)
|
| 290 |
+
(ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool)
|
| 291 |
+
(hgiant : ∀ q : Pg, ∀ x, ggiant q (-x) = conj (ggiant q x))
|
| 292 |
+
(H : ℕ)
|
| 293 |
+
(hHeq : H = ⌈Real.exp (movingProductExponent (movingCellPivotExponent G c) W n -
|
| 294 |
+
movingCellPivotExponent G c n)⌉₊)
|
| 295 |
+
(hIlower : ∀ p ∈ I, Real.exp (G (n + 1) - 1) ≤ (p : ℝ))
|
| 296 |
+
(hlarge : ∀ (q : Pg) (y : MovingRegularSlot n r m → σ),
|
| 297 |
+
(∏ i, ν i (y i)) ≠ 0 → ∀ ℓ, ℓ.Prime → ℓ ∣ (q : ℕ) * (∏ i, value (y i)) → V (n + 1) < ℓ)
|
| 298 |
+
(hvg : ∀ q : Pg, V (n + 1) < (q : ℕ))
|
| 299 |
+
(hφsupport : ∀ p : ℕ, 0 < p → φ (Real.log p - G (n + 1)) ≠ 0 → p ∈ I)
|
| 300 |
+
(hchild : V n ≤ childBound (n + 1))
|
| 301 |
+
(hgap : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 302 |
+
∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 303 |
+
∀ (p : ℕ) (w : ℤ),
|
| 304 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V (movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n (4 + r) m w
|
| 305 |
+
(movingRestoreSample n r m u right) p XR ≠ 0 →
|
| 306 |
+
2 * pivotBound (n + 1) * childBound (n + 1) < (XR : ℕ) * ∏ i, value (right i))
|
| 307 |
+
(hcomp : ∀ u : TreeLeafIndex n × Fin 4 → σ, (∏ i, μ n (u i)) ≠ 0 →
|
| 308 |
+
(∀ p ∈ I, p * (∏ i, value (u i)) ≤ pivotBound (n + 1)) ∧
|
| 309 |
+
(∀ q, q.Prime → q ∣ ∏ i, value (u i) → childBound (n + 1) < q)) :
|
| 310 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 311 |
+
let greg := normalizedResidueFamily sets
|
| 312 |
+
Real.exp (-smoothGiantLogNormalizer Pg φ (G (n + 1))) *
|
| 313 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V
|
| 314 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n (4 + r) m
|
| 315 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable‖ ^ 2 ≤
|
| 316 |
+
movingAmplitudeDiagonal value outside μ childBound pivotBound V
|
| 317 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G n r m Pg I
|
| 318 |
+
ρ ν greg ggiant favorable +
|
| 319 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V
|
| 320 |
+
(movingOriginalLeaf value q F g Dq S ψ X lo hi) φ G (n + 1) r m
|
| 321 |
+
Pg ρ (movingTemplateDoubledPrior n r m ν) greg ggiant favorable‖ := by
|
| 322 |
+
have hV : Monotone V := by
|
| 323 |
+
rw [hVeq]
|
| 324 |
+
exact movingProductNaturalCutoff_monotone (movingCellPivotExponent G c) W Y reserveMass hbudget
|
| 325 |
+
have hcap : ⌈Real.exp (movingProductExponent (movingCellPivotExponent G c) W n -
|
| 326 |
+
movingCellPivotExponent G c n)⌉₊ ≤ H := by rw [hHeq]
|
| 327 |
+
have hscale (u : TreeLeafIndex n × Fin 4 → σ) (hu : (∏ i, μ n (u i)) ≠ 0)
|
| 328 |
+
(p : ℕ) (hp : p ∈ I) : 2 * V n * H ≤ V (n + 1) * (p * ∏ i, value (u i)) := by
|
| 329 |
+
rw [hVeq, hHeq]
|
| 330 |
+
exact movingProductNaturalCutoff_compensation_scale value μ G c hμlower W Y reserveMass
|
| 331 |
+
hm hY hbudget n hpositive u hu p (hIlower p hp)
|
| 332 |
+
exact movingTemplatePrimeAmplitude_step_of_live_coefficients value hvalue outside μ childBound pivotBound V hV
|
| 333 |
+
q F hF g Dq S ψ X lo hi W hX hwindow φ G c hout hμlower n r m Pg I hPg hPI hI hφ
|
| 334 |
+
hpos hμ hμmass ν sets hsets hcard ggiant favorable hgiant H hcap hIlower hscale
|
| 335 |
+
hlarge hvg hφsupport hchild hgap hcomp
|
| 336 |
+
|
| 337 |
+
end Ostmann
|
| 338 |
+
|
| 339 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeEnergyLogNorm.lean
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeHarmonicCost
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateLogNorm
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The retained bulk cutoff in the one-branch diagonal energy -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
/-- This comparison is applied after the harmonic diagonal reduction.
|
| 12 |
+
The signed two-branch comparison keeps the log weights throughout. -/
|
| 13 |
+
theorem movingAmplitudeRegularEnergy_bulk_log_le
|
| 14 |
+
(P Pg I : Finset ℕ) (tier : P → ℕ) (k : ℕ)
|
| 15 |
+
(outside : List ℕ) (cb cd : ℝ) (μ : ℕ → P → ℝ)
|
| 16 |
+
(hμ0 : ∀ j a, 0 ≤ μ j a) (hμ : ∀ j a, μ j a ≠ 0 → tier a = j)
|
| 17 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 18 |
+
(φ : ℝ → ℝ) (hφ : ∀ x, 0 ≤ φ x) (G : ℕ → ℝ)
|
| 19 |
+
(n r m : ℕ) (hn : n < k) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 20 |
+
(hsmall : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 21 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → tier q ≠ k)
|
| 22 |
+
(hbulk : ∀ j : TreeLeafIndex n × Fin m, ∀ q : P,
|
| 23 |
+
primeSubsetPrior P (Q (j.1, .inr j.2)) q ≠ 0 → tier q = k)
|
| 24 |
+
(greg : ∀ q : ℕ, ZMod q → ℂ) :
|
| 25 |
+
movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V
|
| 26 |
+
(fun x s => (movingBulkLeafLogWeight Subtype.val tier k outside cb cd x.data : ℂ) * F x s)
|
| 27 |
+
φ G n r m Q greg ≤
|
| 28 |
+
movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg := by
|
| 29 |
+
unfold movingAmplitudeRegularEnergy
|
| 30 |
+
dsimp only
|
| 31 |
+
apply Finset.sum_le_sum
|
| 32 |
+
intro u _
|
| 33 |
+
by_cases hu : (∏ i, μ n (u i)) = 0
|
| 34 |
+
· simp only [hu, zero_mul, le_refl]
|
| 35 |
+
apply mul_le_mul_of_nonneg_left _
|
| 36 |
+
(mul_nonneg (Finset.prod_nonneg (fun i _ => hμ0 n (u i))) (Nat.cast_nonneg _))
|
| 37 |
+
apply Finset.sum_le_sum
|
| 38 |
+
intro p _
|
| 39 |
+
apply mul_le_mul_of_nonneg_left _ (hφ _)
|
| 40 |
+
apply Finset.sum_le_sum
|
| 41 |
+
intro a _
|
| 42 |
+
let α := movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 43 |
+
(fun i => primeSubsetPrior P (Q i)) a
|
| 44 |
+
have hα : 0 ≤ α := mul_nonneg (smoothGiantPrior_nonneg Pg φ (G (n + 1)) hφ a.1)
|
| 45 |
+
(Finset.prod_nonneg (fun i _ => primeSubsetPrior_nonneg P (Q i) (a.2.1 i)))
|
| 46 |
+
by_cases ha : α = 0
|
| 47 |
+
· simp only [show movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 48 |
+
(fun i => primeSubsetPrior P (Q i)) a = 0 from ha, zero_mul, le_refl]
|
| 49 |
+
have hν i : primeSubsetPrior P (Q i) (a.2.1 i) ≠ 0 :=
|
| 50 |
+
Finset.prod_ne_zero_iff.mp (right_ne_zero_of_mul ha) i (Finset.mem_univ i)
|
| 51 |
+
apply mul_le_mul_of_nonneg_left _ hα
|
| 52 |
+
apply pow_le_pow_left₀ (norm_nonneg _) _ 2
|
| 53 |
+
rw [norm_mul, norm_mul]
|
| 54 |
+
apply mul_le_mul_of_nonneg_right _ (norm_nonneg _)
|
| 55 |
+
exact movingTemplateCoefficient_restored_bulk_log_norm_le Subtype.val tier k outside cb cd
|
| 56 |
+
μ hμ childBound pivotBound V F φ G n r m a.2.2.val u hu a.2.1 hn
|
| 57 |
+
(fun j => hsmall j _ (hν _)) (fun j => hbulk j _ (hν _)) p a.1
|
| 58 |
+
|
| 59 |
+
/-- The full diagonal reduces to the original one-branch energy with its explicit counterpart cost. -/
|
| 60 |
+
theorem movingAmplitude_harmonic_unweighted_cost_le
|
| 61 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 62 |
+
(tier : P → ℕ) (k : ℕ) (outside : List ℕ) (cb cd : ℝ)
|
| 63 |
+
(μ : ℕ → P → ℝ) (hμ0 : ∀ j a, 0 ≤ μ j a)
|
| 64 |
+
(hμ : ∀ j a, μ j a ≠ 0 → tier a = j)
|
| 65 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 66 |
+
(hF : ∀ x, F x 0 = 0)
|
| 67 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 68 |
+
(n r m : ℕ) (hn : n < k) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 69 |
+
(hsmall : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 70 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → tier q ≠ k)
|
| 71 |
+
(hbulk : ∀ j : TreeLeafIndex n × Fin m, ∀ q : P,
|
| 72 |
+
primeSubsetPrior P (Q (j.1, .inr j.2)) q ≠ 0 → tier q = k)
|
| 73 |
+
(hvg : ∀ q : Pg, V n < (q : ℕ)) (hvr : ∀ q : P, V n < (q : ℕ))
|
| 74 |
+
(hsep : ∀ q : Pg, ∀ a : P, (q : ℕ) ≠ (a : ℕ))
|
| 75 |
+
(Gmin : ℝ) (hX : ∀ q : Pg, Real.exp Gmin ≤ (q : ℝ))
|
| 76 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 77 |
+
let Fw := fun x s =>
|
| 78 |
+
(movingBulkLeafLogWeight Subtype.val tier k outside cb cd x.data : ℂ) * F x s
|
| 79 |
+
let K := Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1)) - Gmin -
|
| 80 |
+
(2 ^ n : ℕ) * (cb - 1)) * ((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 81 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹)
|
| 82 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V Fw φ G n r m Pg I
|
| 83 |
+
(smoothGiantPrior Pg φ (G (n + 1))) (fun i => primeSubsetPrior P (Q i)) greg ggiant favorable ≤
|
| 84 |
+
K * movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg := by
|
| 85 |
+
intro Fw K
|
| 86 |
+
have hcost := movingAmplitude_harmonic_cost_le P Pg I hP hPg tier k outside cb cd μ hμ0 hμ
|
| 87 |
+
childBound pivotBound V F hF φ hφ0 hφ1 G n r m hn Q hsmall hbulk hvg hvr hsep
|
| 88 |
+
Gmin hX greg ggiant favorable
|
| 89 |
+
have hK : 0 ≤ K := by
|
| 90 |
+
dsimp only [K]
|
| 91 |
+
apply mul_nonneg
|
| 92 |
+
· exact mul_nonneg (Real.exp_nonneg _) (Nat.cast_nonneg _)
|
| 93 |
+
· exact Finset.prod_nonneg (fun i _ => inv_nonneg.mpr
|
| 94 |
+
(Finset.sum_nonneg (fun q _ => inv_nonneg.mpr (Nat.cast_nonneg q))))
|
| 95 |
+
exact hcost.trans (mul_le_mul_of_nonneg_left
|
| 96 |
+
(movingAmplitudeRegularEnergy_bulk_log_le P Pg I tier k outside cb cd μ hμ0 hμ
|
| 97 |
+
childBound pivotBound V F φ hφ0 G n r m hn Q hsmall hbulk greg) hK)
|
| 98 |
+
|
| 99 |
+
end Ostmann
|
| 100 |
+
|
| 101 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeFullHarmonicCost.lean
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeEnergyLogNorm
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingFullHarmonicCost
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The complete small and bulk denominator in the original diagonal -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
theorem movingAmplitude_full_harmonic_cost_le
|
| 12 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 13 |
+
(tier : P → ℕ) (k : ℕ) (outside : List ℕ) (cb cd : ℝ)
|
| 14 |
+
(μ : ℕ → P → ℝ) (hμ0 : ∀ j a, 0 ≤ μ j a)
|
| 15 |
+
(hμ : ∀ j a, μ j a ≠ 0 → tier a = j)
|
| 16 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 17 |
+
(hF : ∀ x, F x 0 = 0)
|
| 18 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 19 |
+
(n r m : ℕ) (hn : n < k) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 20 |
+
(hsmall : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 21 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → tier q ≠ k)
|
| 22 |
+
(hbulk : ∀ j : TreeLeafIndex n × Fin m, ∀ q : P,
|
| 23 |
+
primeSubsetPrior P (Q (j.1, .inr j.2)) q ≠ 0 → tier q = k)
|
| 24 |
+
(lower : TreeLeafIndex n × Fin r → ℝ)
|
| 25 |
+
(hlower : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 26 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → Real.exp (lower j) ≤ (q : ℝ))
|
| 27 |
+
(hvg : ∀ q : Pg, V n < (q : ℕ)) (hvr : ∀ q : P, V n < (q : ℕ))
|
| 28 |
+
(hsep : ∀ q : Pg, ∀ a : P, (q : ℕ) ≠ (a : ℕ))
|
| 29 |
+
(Gmin : ℝ) (hX : ∀ q : Pg, Real.exp Gmin ≤ (q : ℝ))
|
| 30 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 31 |
+
let Fw := fun x s =>
|
| 32 |
+
(movingBulkLeafLogWeight Subtype.val tier k outside cb cd x.data : ℂ) * F x s
|
| 33 |
+
let K := Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1)) - Gmin -
|
| 34 |
+
((∑ j, lower j) + (2 ^ n : ℕ) * (cb - 1))) * ((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 35 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹)
|
| 36 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V Fw φ G n r m Pg I
|
| 37 |
+
(smoothGiantPrior Pg φ (G (n + 1))) (fun i => primeSubsetPrior P (Q i)) greg ggiant favorable ≤
|
| 38 |
+
K * movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V Fw φ G n r m Q greg := by
|
| 39 |
+
intro Fw K
|
| 40 |
+
have hFw x : Fw x 0 = 0 := by simp only [Fw, hF, mul_zero]
|
| 41 |
+
have hdiag := movingAmplitude_harmonic_diagonal_le P Pg I hP hPg outside μ hμ0
|
| 42 |
+
childBound pivotBound V Fw hFw φ hφ0 hφ1 G n r m Q hvg hvr hsep greg ggiant favorable
|
| 43 |
+
apply hdiag.trans
|
| 44 |
+
dsimp only at hdiag ⊢
|
| 45 |
+
unfold movingAmplitudeRegularEnergy
|
| 46 |
+
simp only [Finset.mul_sum]
|
| 47 |
+
apply Finset.sum_le_sum
|
| 48 |
+
intro u _
|
| 49 |
+
by_cases hu : (∏ i, μ n (u i)) = 0
|
| 50 |
+
· simp only [hu, zero_mul, mul_zero, Finset.sum_const_zero, le_refl]
|
| 51 |
+
have hU : 0 ≤ (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) :=
|
| 52 |
+
mul_nonneg (Finset.prod_nonneg (fun i _ => hμ0 n (u i))) (Nat.cast_nonneg _)
|
| 53 |
+
apply Finset.sum_le_sum
|
| 54 |
+
intro p hp
|
| 55 |
+
apply Finset.sum_le_sum
|
| 56 |
+
intro a _
|
| 57 |
+
let α := movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 58 |
+
(fun i => primeSubsetPrior P (Q i)) a
|
| 59 |
+
have hα : 0 ≤ α := mul_nonneg (smoothGiantPrior_nonneg Pg φ (G (n + 1)) hφ0 a.1)
|
| 60 |
+
(Finset.prod_nonneg (fun i _ => primeSubsetPrior_nonneg P (Q i) (a.2.1 i)))
|
| 61 |
+
by_cases ha : α = 0
|
| 62 |
+
· simp only [show movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 63 |
+
(fun i => primeSubsetPrior P (Q i)) a = 0 from ha, zero_mul, mul_zero, le_refl]
|
| 64 |
+
have hν i : primeSubsetPrior P (Q i) (a.2.1 i) ≠ 0 :=
|
| 65 |
+
Finset.prod_ne_zero_iff.mp (right_ne_zero_of_mul ha) i (Finset.mem_univ i)
|
| 66 |
+
by_cases hc : movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V Fw φ G
|
| 67 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 = 0
|
| 68 |
+
· simp only [hc, zero_mul, norm_zero, zero_pow (by norm_num : 2 ≠ 0), mul_zero, le_refl]
|
| 69 |
+
have hcost := movingTemplate_restored_full_harmonic_cost_le Subtype.val tier
|
| 70 |
+
(fun q => (hP q q.property).pos) k outside cb cd μ hμ childBound pivotBound V F φ G
|
| 71 |
+
n r m a.2.2.val u hu a.2.1 hn (fun j => hsmall j _ (hν _))
|
| 72 |
+
(fun j => hbulk j _ (hν _)) lower (fun j => hlower j _ (hν _)) p a.1 Q (smoothGiantLogNormalizer Pg φ (G (n + 1)))
|
| 73 |
+
Gmin (hX a.1) hc
|
| 74 |
+
have hpos := mul_nonneg hU (hφ0 (Real.log p - G (n + 1)))
|
| 75 |
+
have hcost' := mul_le_mul_of_nonneg_left hcost
|
| 76 |
+
(mul_nonneg (mul_nonneg hpos hα) (sq_nonneg
|
| 77 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V Fw φ G
|
| 78 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 *
|
| 79 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 80 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖))
|
| 81 |
+
dsimp only [α] at hcost'
|
| 82 |
+
simp only [Nat.cast_prod] at hcost'
|
| 83 |
+
dsimp only [K]
|
| 84 |
+
simp only [Nat.cast_prod]
|
| 85 |
+
convert hcost' using 1 <;> ring
|
| 86 |
+
|
| 87 |
+
/-- The full diagonal reduces to the original one-branch energy with its explicit counterpart cost. -/
|
| 88 |
+
theorem movingAmplitude_full_harmonic_unweighted_cost_le
|
| 89 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 90 |
+
(tier : P → ℕ) (k : ℕ) (outside : List ℕ) (cb cd : ℝ)
|
| 91 |
+
(μ : ℕ → P → ℝ) (hμ0 : ∀ j a, 0 ≤ μ j a)
|
| 92 |
+
(hμ : ∀ j a, μ j a ≠ 0 → tier a = j)
|
| 93 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 94 |
+
(hF : ∀ x, F x 0 = 0)
|
| 95 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 96 |
+
(n r m : ℕ) (hn : n < k) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 97 |
+
(hsmall : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 98 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → tier q ≠ k)
|
| 99 |
+
(hbulk : ∀ j : TreeLeafIndex n × Fin m, ∀ q : P,
|
| 100 |
+
primeSubsetPrior P (Q (j.1, .inr j.2)) q ≠ 0 → tier q = k)
|
| 101 |
+
(lower : TreeLeafIndex n × Fin r → ℝ)
|
| 102 |
+
(hlower : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 103 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → Real.exp (lower j) ≤ (q : ℝ))
|
| 104 |
+
(hvg : ∀ q : Pg, V n < (q : ℕ)) (hvr : ∀ q : P, V n < (q : ℕ))
|
| 105 |
+
(hsep : ∀ q : Pg, ∀ a : P, (q : ℕ) ≠ (a : ℕ))
|
| 106 |
+
(Gmin : ℝ) (hX : ∀ q : Pg, Real.exp Gmin ≤ (q : ℝ))
|
| 107 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 108 |
+
let Fw := fun x s =>
|
| 109 |
+
(movingBulkLeafLogWeight Subtype.val tier k outside cb cd x.data : ℂ) * F x s
|
| 110 |
+
let K := Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1)) - Gmin -
|
| 111 |
+
((∑ j, lower j) + (2 ^ n : ℕ) * (cb - 1))) * ((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 112 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹)
|
| 113 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V Fw φ G n r m Pg I
|
| 114 |
+
(smoothGiantPrior Pg φ (G (n + 1))) (fun i => primeSubsetPrior P (Q i)) greg ggiant favorable ≤
|
| 115 |
+
K * movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg := by
|
| 116 |
+
intro Fw K
|
| 117 |
+
have hcost := movingAmplitude_full_harmonic_cost_le P Pg I hP hPg tier k outside cb cd μ hμ0 hμ
|
| 118 |
+
childBound pivotBound V F hF φ hφ0 hφ1 G n r m hn Q hsmall hbulk lower hlower hvg hvr hsep
|
| 119 |
+
Gmin hX greg ggiant favorable
|
| 120 |
+
have hK : 0 ≤ K := by
|
| 121 |
+
dsimp only [K]
|
| 122 |
+
apply mul_nonneg
|
| 123 |
+
· exact mul_nonneg (Real.exp_nonneg _) (Nat.cast_nonneg _)
|
| 124 |
+
· exact Finset.prod_nonneg (fun i _ => inv_nonneg.mpr
|
| 125 |
+
(Finset.sum_nonneg (fun q _ => inv_nonneg.mpr (Nat.cast_nonneg q))))
|
| 126 |
+
exact hcost.trans (mul_le_mul_of_nonneg_left
|
| 127 |
+
(movingAmplitudeRegularEnergy_bulk_log_le P Pg I tier k outside cb cd μ hμ0 hμ
|
| 128 |
+
childBound pivotBound V F φ hφ0 G n r m hn Q hsmall hbulk greg) hK)
|
| 129 |
+
|
| 130 |
+
end Ostmann
|
| 131 |
+
|
| 132 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeHarmonicCost.lean
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeHarmonicDiagonal
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingRestoredHarmonicCost
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # A uniform counterpart cost for the complete original-prior diagonal -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
noncomputable def movingAmplitudeRegularEnergy
|
| 12 |
+
(P Pg I : Finset ℕ) (outside : List ℕ) (μ : ℕ → P → ℝ)
|
| 13 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 14 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 15 |
+
(Q : MovingRegularSlot n r m → Finset ℕ)
|
| 16 |
+
(greg : ∀ q : ℕ, ZMod q → ℂ) : ℝ :=
|
| 17 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 18 |
+
let ν := fun i => primeSubsetPrior P (Q i)
|
| 19 |
+
∑ u : TreeLeafIndex n × Fin 4 → P, (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) *
|
| 20 |
+
∑ p ∈ I, φ (Real.log p - G (n + 1)) *
|
| 21 |
+
∑ a : MovingAmplitudeIndex P Pg n r m V,
|
| 22 |
+
movingAmplitudePrior Pg n r m V ρ ν a *
|
| 23 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 24 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 *
|
| 25 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 26 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖ ^ 2
|
| 27 |
+
|
| 28 |
+
theorem movingAmplitude_harmonic_cost_le
|
| 29 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 30 |
+
(tier : P → ℕ) (k : ℕ) (outside : List ℕ) (cb cd : ℝ)
|
| 31 |
+
(μ : ℕ → P → ℝ) (hμ0 : ∀ j a, 0 ≤ μ j a)
|
| 32 |
+
(hμ : ∀ j a, μ j a ≠ 0 → tier a = j)
|
| 33 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 34 |
+
(hF : ∀ x, F x 0 = 0)
|
| 35 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 36 |
+
(n r m : ℕ) (hn : n < k) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 37 |
+
(hsmall : ∀ j : TreeLeafIndex n × Fin r, ∀ q : P,
|
| 38 |
+
primeSubsetPrior P (Q (j.1, .inl j.2)) q ≠ 0 → tier q ≠ k)
|
| 39 |
+
(hbulk : ∀ j : TreeLeafIndex n × Fin m, ∀ q : P,
|
| 40 |
+
primeSubsetPrior P (Q (j.1, .inr j.2)) q ≠ 0 → tier q = k)
|
| 41 |
+
(hvg : ∀ q : Pg, V n < (q : ℕ)) (hvr : ∀ q : P, V n < (q : ℕ))
|
| 42 |
+
(hsep : ∀ q : Pg, ∀ a : P, (q : ℕ) ≠ (a : ℕ))
|
| 43 |
+
(Gmin : ℝ) (hX : ∀ q : Pg, Real.exp Gmin ≤ (q : ℝ))
|
| 44 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 45 |
+
let Fw := fun x s =>
|
| 46 |
+
(movingBulkLeafLogWeight Subtype.val tier k outside cb cd x.data : ℂ) * F x s
|
| 47 |
+
let K := Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1)) - Gmin -
|
| 48 |
+
(2 ^ n : ℕ) * (cb - 1)) * ((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 49 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹)
|
| 50 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V Fw φ G n r m Pg I
|
| 51 |
+
(smoothGiantPrior Pg φ (G (n + 1))) (fun i => primeSubsetPrior P (Q i)) greg ggiant favorable ≤
|
| 52 |
+
K * movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V Fw φ G n r m Q greg := by
|
| 53 |
+
intro Fw K
|
| 54 |
+
have hFw x : Fw x 0 = 0 := by simp only [Fw, hF, mul_zero]
|
| 55 |
+
have hdiag := movingAmplitude_harmonic_diagonal_le P Pg I hP hPg outside μ hμ0
|
| 56 |
+
childBound pivotBound V Fw hFw φ hφ0 hφ1 G n r m Q hvg hvr hsep greg ggiant favorable
|
| 57 |
+
apply hdiag.trans
|
| 58 |
+
dsimp only at hdiag ⊢
|
| 59 |
+
unfold movingAmplitudeRegularEnergy
|
| 60 |
+
simp only [Finset.mul_sum]
|
| 61 |
+
apply Finset.sum_le_sum
|
| 62 |
+
intro u _
|
| 63 |
+
by_cases hu : (∏ i, μ n (u i)) = 0
|
| 64 |
+
· simp only [hu, zero_mul, mul_zero, Finset.sum_const_zero, le_refl]
|
| 65 |
+
have hU : 0 ≤ (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) :=
|
| 66 |
+
mul_nonneg (Finset.prod_nonneg (fun i _ => hμ0 n (u i))) (Nat.cast_nonneg _)
|
| 67 |
+
apply Finset.sum_le_sum
|
| 68 |
+
intro p hp
|
| 69 |
+
apply Finset.sum_le_sum
|
| 70 |
+
intro a _
|
| 71 |
+
let α := movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 72 |
+
(fun i => primeSubsetPrior P (Q i)) a
|
| 73 |
+
have hα : 0 ≤ α := mul_nonneg (smoothGiantPrior_nonneg Pg φ (G (n + 1)) hφ0 a.1)
|
| 74 |
+
(Finset.prod_nonneg (fun i _ => primeSubsetPrior_nonneg P (Q i) (a.2.1 i)))
|
| 75 |
+
by_cases ha : α = 0
|
| 76 |
+
· simp only [show movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 77 |
+
(fun i => primeSubsetPrior P (Q i)) a = 0 from ha, zero_mul, mul_zero, le_refl]
|
| 78 |
+
have hν i : primeSubsetPrior P (Q i) (a.2.1 i) ≠ 0 :=
|
| 79 |
+
Finset.prod_ne_zero_iff.mp (right_ne_zero_of_mul ha) i (Finset.mem_univ i)
|
| 80 |
+
by_cases hc : movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V Fw φ G
|
| 81 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 = 0
|
| 82 |
+
· simp only [hc, zero_mul, norm_zero, zero_pow (by norm_num : 2 ≠ 0), mul_zero, le_refl]
|
| 83 |
+
have hcost := movingTemplate_restored_harmonic_cost_le Subtype.val tier
|
| 84 |
+
(fun q => (hP q q.property).pos) k outside cb cd μ hμ childBound pivotBound V F φ G
|
| 85 |
+
n r m a.2.2.val u hu a.2.1 hn (fun j => hsmall j _ (hν _))
|
| 86 |
+
(fun j => hbulk j _ (hν _)) p a.1 Q (smoothGiantLogNormalizer Pg φ (G (n + 1)))
|
| 87 |
+
Gmin (hX a.1) hc
|
| 88 |
+
have hpos := mul_nonneg hU (hφ0 (Real.log p - G (n + 1)))
|
| 89 |
+
have hcost' := mul_le_mul_of_nonneg_left hcost
|
| 90 |
+
(mul_nonneg (mul_nonneg hpos hα) (sq_nonneg
|
| 91 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V Fw φ G
|
| 92 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 *
|
| 93 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 94 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖))
|
| 95 |
+
dsimp only [α] at hcost'
|
| 96 |
+
simp only [Nat.cast_prod] at hcost'
|
| 97 |
+
dsimp only [K]
|
| 98 |
+
simp only [Nat.cast_prod]
|
| 99 |
+
convert hcost' using 1 <;> ring
|
| 100 |
+
|
| 101 |
+
end Ostmann
|
| 102 |
+
|
| 103 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeHarmonicDiagonal.lean
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeTerms
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateHarmonicDiagonal
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Harmonic product-fibre control of the whole prime amplitude diagonal -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
theorem movingAmplitude_harmonic_diagonal_le
|
| 12 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 13 |
+
(outside : List ℕ) (μ : ℕ → P → ℝ) (hμ : ∀ j a, 0 ≤ μ j a)
|
| 14 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 15 |
+
(F : MovingSlotState P → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 16 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 17 |
+
(n r m : ℕ) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 18 |
+
(hvg : ∀ q : Pg, V n < (q : ℕ)) (hvr : ∀ q : P, V n < (q : ℕ))
|
| 19 |
+
(hsep : ∀ q : Pg, ∀ a : P, (q : ℕ) ≠ (a : ℕ))
|
| 20 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 21 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 22 |
+
let ν := fun i => primeSubsetPrior P (Q i)
|
| 23 |
+
let A := MovingAmplitudeIndex P Pg n r m V
|
| 24 |
+
let α := fun a : A => movingAmplitudePrior Pg n r m V ρ ν a
|
| 25 |
+
let θ := fun a : A =>
|
| 26 |
+
(Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1))) / (a.1 : ℕ)) *
|
| 27 |
+
((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 28 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹) * ((∏ i, (a.2.1 i : ℕ)) : ℝ)⁻¹
|
| 29 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V F φ G n r m Pg I
|
| 30 |
+
ρ ν greg ggiant favorable ≤
|
| 31 |
+
∑ u : TreeLeafIndex n × Fin 4 → P, (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) *
|
| 32 |
+
∑ p ∈ I, φ (Real.log p - G (n + 1)) * ∑ a : A, α a * θ a *
|
| 33 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 34 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 *
|
| 35 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 36 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖ ^ 2 := by
|
| 37 |
+
intro ρ ν A α θ
|
| 38 |
+
unfold movingAmplitudeDiagonal
|
| 39 |
+
dsimp only
|
| 40 |
+
apply Finset.sum_le_sum
|
| 41 |
+
intro u _
|
| 42 |
+
apply mul_le_mul_of_nonneg_left _
|
| 43 |
+
(mul_nonneg (Finset.prod_nonneg (fun i _ => hμ n (u i))) (Nat.cast_nonneg _))
|
| 44 |
+
apply Finset.sum_le_sum
|
| 45 |
+
intro p _
|
| 46 |
+
apply mul_le_mul_of_nonneg_left _ (hφ0 _)
|
| 47 |
+
have hd := movingTemplate_harmonic_diagonal_le P Pg hP hPg outside μ childBound pivotBound V
|
| 48 |
+
F hF φ hφ0 hφ1 G (G (n + 1)) n r m Q u p hvg hvr hsep greg ggiant favorable
|
| 49 |
+
dsimp only at hd
|
| 50 |
+
let : ∀ a : A, Fact (a.1 : ℕ).Prime := fun a => ⟨hPg _ a.1.property⟩
|
| 51 |
+
let : ∀ a : A, ∀ i, Fact (a.2.1 i : ℕ).Prime := fun a i => ⟨hP _ (a.2.1 i).property⟩
|
| 52 |
+
simpa only [movingTemplateTransferWeight, movingAmplitudePrior, movingOneGiant_transform_tagged,
|
| 53 |
+
ρ, ν, α, θ, Nat.cast_prod, Function.comp_def]
|
| 54 |
+
using hd
|
| 55 |
+
|
| 56 |
+
end Ostmann
|
| 57 |
+
|
| 58 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeIndex.lean
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateAmplitudeRestore
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateWeightedSupport
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The surviving giant, regular tuple and frequency as one transfer index -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
abbrev MovingAmplitudeIndex (σ : Type) (Pg : Finset ℕ) (n r m : ℕ) (V : ℕ → ℕ) :=
|
| 12 |
+
Pg × ((MovingRegularSlot n r m → σ) × transferFrequencyRange (V n))
|
| 13 |
+
|
| 14 |
+
noncomputable def movingAmplitudePrior {σ : Type} (Pg : Finset ℕ) (n r m : ℕ)
|
| 15 |
+
(V : ℕ → ℕ) (ρ : Pg → ℝ) (ν : MovingRegularSlot n r m → σ → ℝ)
|
| 16 |
+
(a : MovingAmplitudeIndex σ Pg n r m V) : ℝ :=
|
| 17 |
+
ρ a.1 * ∏ i, ν i (a.2.1 i)
|
| 18 |
+
|
| 19 |
+
/-- The frequency is part of the transfer index and has counting measure.
|
| 20 |
+
Only the giant and regular prime coordinates carry probability weights. -/
|
| 21 |
+
theorem movingTemplatePrimeAmplitude_index {σ : Type} [Fintype σ]
|
| 22 |
+
(value : σ → ℕ) (outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 23 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState σ → ℤ → ℂ)
|
| 24 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 25 |
+
(Pg : Finset ℕ) (ρ : Pg → ℝ) (ν : MovingRegularSlot n r m → σ → ℝ)
|
| 26 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 27 |
+
movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n (4 + r) m
|
| 28 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable =
|
| 29 |
+
∑ u : TreeLeafIndex n × Fin 4 → σ, ((∏ i, μ n (u i) : ℝ) : ℂ) *
|
| 30 |
+
∑ p : Pg, (ρ p : ℂ) * ∑ a : MovingAmplitudeIndex σ Pg n r m V,
|
| 31 |
+
movingTemplateTransferWeight value outside μ childBound pivotBound V F φ G n r m
|
| 32 |
+
(fun a => a.2.2.val) (fun a => (movingAmplitudePrior Pg n r m V ρ ν a : ℂ))
|
| 33 |
+
(fun a => (a.1 : ℕ)) (fun a => a.2.1) u p a *
|
| 34 |
+
movingTaggedTransform
|
| 35 |
+
(Sum.elim (fun b : Bool => if b then (p : ℕ) else (a.1 : ℕ))
|
| 36 |
+
(value ∘ movingRestoreSample n r m u a.2.1))
|
| 37 |
+
(Sum.elim (fun _ => true) (fun _ => false)) greg ggiant favorable outside.prod a.2.2.val := by
|
| 38 |
+
rw [movingTemplatePrimeAmplitude_restore]
|
| 39 |
+
apply Finset.sum_congr rfl
|
| 40 |
+
intro u _
|
| 41 |
+
congr 1
|
| 42 |
+
apply Finset.sum_congr rfl
|
| 43 |
+
intro p _
|
| 44 |
+
congr 1
|
| 45 |
+
simp only [MovingAmplitudeIndex, Fintype.sum_prod_type, movingTemplateTransferWeight,
|
| 46 |
+
movingAmplitudePrior, Complex.ofReal_mul, Finset.mul_sum]
|
| 47 |
+
apply Finset.sum_congr rfl
|
| 48 |
+
intro X _
|
| 49 |
+
rw [Finset.sum_comm]
|
| 50 |
+
apply Finset.sum_congr rfl
|
| 51 |
+
intro s _
|
| 52 |
+
apply Finset.sum_congr rfl
|
| 53 |
+
intro y _
|
| 54 |
+
ring
|
| 55 |
+
|
| 56 |
+
end Ostmann
|
| 57 |
+
|
| 58 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveCost.lean
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeSymmetrizedCost
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeLiveSymmetrization
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Harmonic cost for live priors and the literal coefficient support -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
theorem movingAmplitude_symmetrized_full_harmonic_cost_live
|
| 12 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 13 |
+
(outside : List ℕ)
|
| 14 |
+
(μ : ℕ → P → ℝ) (hμ0 : ∀ j a, 0 ≤ μ j a)
|
| 15 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 16 |
+
(hF : ∀ x, F x 0 = 0)
|
| 17 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 18 |
+
(n r m : ℕ) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 19 |
+
(hidentical : ∀ j k : TreeLeafIndex n × Fin m,
|
| 20 |
+
primeSubsetPrior P (Q (movingTemplateBulk n r m j)) =
|
| 21 |
+
primeSubsetPrior P (Q (movingTemplateBulk n r m k)))
|
| 22 |
+
(hvg : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 → V n < (q : ℕ)) (hvr : ∀ i (q : P), primeSubsetPrior P (Q i) q ≠ 0 → V n < (q : ℕ))
|
| 23 |
+
(hsep : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 →
|
| 24 |
+
∀ i (a : P), primeSubsetPrior P (Q i) a ≠ 0 → (q : ℕ) ≠ (a : ℕ))
|
| 25 |
+
(Gmin : ℝ) (hX : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 → Real.exp Gmin ≤ (q : ℝ))
|
| 26 |
+
(totalLower : ℝ)
|
| 27 |
+
(hproduct : ∀ (u : TreeLeafIndex n × Fin 4 → P), (∏ i, μ n (u i)) ≠ 0 →
|
| 28 |
+
∀ (a : MovingAmplitudeIndex P Pg n r m V),
|
| 29 |
+
(∀ i, primeSubsetPrior P (Q i) (a.2.1 i) ≠ 0) →
|
| 30 |
+
∀ p : ℕ, movingSymmetrizedTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 31 |
+
n r m a.2.2.val u a.2.1 p a.1 ≠ 0 →
|
| 32 |
+
Real.exp totalLower ≤ ((∏ i, (a.2.1 i : ℕ) : ℕ) : ℝ))
|
| 33 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 34 |
+
let K := Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1)) - Gmin -
|
| 35 |
+
totalLower) * ((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 36 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹)
|
| 37 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V F φ G n r m Pg I
|
| 38 |
+
(smoothGiantPrior Pg φ (G (n + 1))) (fun i => primeSubsetPrior P (Q i)) greg ggiant favorable ≤
|
| 39 |
+
K * movingAmplitudeSymmetrizedRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg := by
|
| 40 |
+
intro K
|
| 41 |
+
have hdiag := movingAmplitude_symmetrized_harmonic_diagonal_live P Pg I hP hPg outside μ hμ0
|
| 42 |
+
childBound pivotBound V F hF φ hφ0 hφ1 G n r m Q hidentical hvg hvr hsep greg ggiant favorable
|
| 43 |
+
apply hdiag.trans
|
| 44 |
+
dsimp only at hdiag ⊢
|
| 45 |
+
unfold movingAmplitudeSymmetrizedRegularEnergy
|
| 46 |
+
simp only [Finset.mul_sum]
|
| 47 |
+
apply Finset.sum_le_sum
|
| 48 |
+
intro u _
|
| 49 |
+
by_cases hu : (∏ i, μ n (u i)) = 0
|
| 50 |
+
· simp only [hu, zero_mul, mul_zero, Finset.sum_const_zero, le_refl]
|
| 51 |
+
have hU : 0 ≤ (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) :=
|
| 52 |
+
mul_nonneg (Finset.prod_nonneg (fun i _ => hμ0 n (u i))) (Nat.cast_nonneg _)
|
| 53 |
+
apply Finset.sum_le_sum
|
| 54 |
+
intro p hp
|
| 55 |
+
apply Finset.sum_le_sum
|
| 56 |
+
intro a _
|
| 57 |
+
let α := movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 58 |
+
(fun i => primeSubsetPrior P (Q i)) a
|
| 59 |
+
have hα : 0 ≤ α := mul_nonneg (smoothGiantPrior_nonneg Pg φ (G (n + 1)) hφ0 a.1)
|
| 60 |
+
(Finset.prod_nonneg (fun i _ => primeSubsetPrior_nonneg P (Q i) (a.2.1 i)))
|
| 61 |
+
by_cases ha : α = 0
|
| 62 |
+
· simp only [show movingAmplitudePrior Pg n r m V (smoothGiantPrior Pg φ (G (n + 1)))
|
| 63 |
+
(fun i => primeSubsetPrior P (Q i)) a = 0 from ha, zero_mul, mul_zero, le_refl]
|
| 64 |
+
have hν i : primeSubsetPrior P (Q i) (a.2.1 i) ≠ 0 :=
|
| 65 |
+
Finset.prod_ne_zero_iff.mp (right_ne_zero_of_mul ha) i (Finset.mem_univ i)
|
| 66 |
+
by_cases hc : movingSymmetrizedTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 67 |
+
n r m a.2.2.val u a.2.1 p a.1 = 0
|
| 68 |
+
· simp only [hc, zero_mul, norm_zero, zero_pow (by norm_num : 2 ≠ 0), mul_zero, le_refl]
|
| 69 |
+
have hcost := moving_harmonic_full_counterpart_le n r m Q
|
| 70 |
+
(smoothGiantLogNormalizer Pg φ (G (n + 1))) Gmin totalLower
|
| 71 |
+
(a.1 : ℕ) (fun i => (a.2.1 i : ℕ)) (hX a.1 (left_ne_zero_of_mul ha))
|
| 72 |
+
(hproduct u hu a hν p hc)
|
| 73 |
+
have hpos := mul_nonneg hU (hφ0 (Real.log p - G (n + 1)))
|
| 74 |
+
have hcost' := mul_le_mul_of_nonneg_left hcost
|
| 75 |
+
(mul_nonneg (mul_nonneg hpos hα) (sq_nonneg
|
| 76 |
+
‖movingSymmetrizedTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 77 |
+
n r m a.2.2.val u a.2.1 p a.1 *
|
| 78 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 79 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖))
|
| 80 |
+
dsimp only [α] at hcost'
|
| 81 |
+
simp only [Nat.cast_prod] at hcost'
|
| 82 |
+
dsimp only [K]
|
| 83 |
+
simp only [Nat.cast_prod]
|
| 84 |
+
convert hcost' using 1 <;> ring
|
| 85 |
+
|
| 86 |
+
end Ostmann
|
| 87 |
+
|
| 88 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveHarmonic.lean
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeTerms
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateLiveHarmonic
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Harmonic product-fibre control of the whole prime amplitude diagonal -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators
|
| 10 |
+
|
| 11 |
+
theorem movingAmplitude_harmonic_diagonal_live
|
| 12 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 13 |
+
(outside : List ℕ) (μ : ℕ → P → ℝ) (hμ : ∀ j a, 0 ≤ μ j a)
|
| 14 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 15 |
+
(F : MovingSlotState P → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 16 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 17 |
+
(n r m : ℕ) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 18 |
+
(hvg : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 → V n < (q : ℕ)) (hvr : ∀ i (q : P), primeSubsetPrior P (Q i) q ≠ 0 → V n < (q : ℕ))
|
| 19 |
+
(hsep : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 →
|
| 20 |
+
∀ i (a : P), primeSubsetPrior P (Q i) a ≠ 0 → (q : ℕ) ≠ (a : ℕ))
|
| 21 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 22 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 23 |
+
let ν := fun i => primeSubsetPrior P (Q i)
|
| 24 |
+
let A := MovingAmplitudeIndex P Pg n r m V
|
| 25 |
+
let α := fun a : A => movingAmplitudePrior Pg n r m V ρ ν a
|
| 26 |
+
let θ := fun a : A =>
|
| 27 |
+
(Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1))) / (a.1 : ℕ)) *
|
| 28 |
+
((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 29 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹) * ((∏ i, (a.2.1 i : ℕ)) : ℝ)⁻¹
|
| 30 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V F φ G n r m Pg I
|
| 31 |
+
ρ ν greg ggiant favorable ≤
|
| 32 |
+
∑ u : TreeLeafIndex n × Fin 4 → P, (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) *
|
| 33 |
+
∑ p ∈ I, φ (Real.log p - G (n + 1)) * ∑ a : A, α a * θ a *
|
| 34 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 35 |
+
n (4 + r) m a.2.2.val (movingRestoreSample n r m u a.2.1) p a.1 *
|
| 36 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 37 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖ ^ 2 := by
|
| 38 |
+
intro ρ ν A α θ
|
| 39 |
+
unfold movingAmplitudeDiagonal
|
| 40 |
+
dsimp only
|
| 41 |
+
apply Finset.sum_le_sum
|
| 42 |
+
intro u _
|
| 43 |
+
apply mul_le_mul_of_nonneg_left _
|
| 44 |
+
(mul_nonneg (Finset.prod_nonneg (fun i _ => hμ n (u i))) (Nat.cast_nonneg _))
|
| 45 |
+
apply Finset.sum_le_sum
|
| 46 |
+
intro p _
|
| 47 |
+
apply mul_le_mul_of_nonneg_left _ (hφ0 _)
|
| 48 |
+
have hd := movingTemplate_harmonic_diagonal_live P Pg hP hPg outside μ childBound pivotBound V
|
| 49 |
+
F hF φ hφ0 hφ1 G (G (n + 1)) n r m Q u p hvg hvr hsep greg ggiant favorable
|
| 50 |
+
dsimp only at hd
|
| 51 |
+
let : ∀ a : A, Fact (a.1 : ℕ).Prime := fun a => ⟨hPg _ a.1.property⟩
|
| 52 |
+
let : ∀ a : A, ∀ i, Fact (a.2.1 i : ℕ).Prime := fun a i => ⟨hP _ (a.2.1 i).property⟩
|
| 53 |
+
simpa only [movingTemplateTransferWeight, movingAmplitudePrior, movingOneGiant_transform_tagged,
|
| 54 |
+
ρ, ν, α, θ, Nat.cast_prod, Function.comp_def]
|
| 55 |
+
using hd
|
| 56 |
+
|
| 57 |
+
end Ostmann
|
| 58 |
+
|
| 59 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveStep.lean
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeLiveTransfer
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeNext
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Consecutive original amplitudes with their supported product windows -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators ComplexConjugate
|
| 10 |
+
|
| 11 |
+
/-- The next term is the actual doubled-prior amplitude. The transfer
|
| 12 |
+
inequality is derived rather than imposed as a recurrence hypothesis. -/
|
| 13 |
+
theorem movingTemplatePrimeAmplitude_step_on_live {σ : Type} [Fintype σ]
|
| 14 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime)
|
| 15 |
+
(outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 16 |
+
(childBound pivotBound V : ℕ → ℕ) (hV : Monotone V)
|
| 17 |
+
(F : MovingSlotState σ → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 18 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 19 |
+
(Pg I : Finset ℕ) (hPg : ∀ p ∈ Pg, p.Prime) (hPI : Pg ⊆ I)
|
| 20 |
+
(hI : ∀ p ∈ I, 0 < p) (hφ : ∀ x, 0 ≤ φ x)
|
| 21 |
+
(hpos : 0 < smoothGiantMass Pg φ (G (n + 1)))
|
| 22 |
+
(hμ : ∀ a, 0 ≤ μ n a) (hμmass : ∑ a, μ n a = 1)
|
| 23 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 24 |
+
(sets : ∀ q : ℕ, Finset (ZMod q))
|
| 25 |
+
(hsets : ∀ a, (sets (value a)).Nonempty)
|
| 26 |
+
(hcard : ∀ a, (sets (value a)).card < value a)
|
| 27 |
+
(ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool)
|
| 28 |
+
(hgiant : ∀ q : Pg, ∀ x, ggiant q (-x) = conj (ggiant q x))
|
| 29 |
+
(H : ℕ)
|
| 30 |
+
(hH : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 31 |
+
∀ (p : ℕ), p ∈ I →
|
| 32 |
+
∀ (q : Pg) (y : MovingRegularSlot n r m → σ) (s : transferFrequencyRange (V n)),
|
| 33 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V F φ G
|
| 34 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p q ≠ 0 →
|
| 35 |
+
(q : ℕ) * (∏ i, value (y i)) ≤ H)
|
| 36 |
+
(hscale : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 → ∀ p ∈ I,
|
| 37 |
+
2 * V n * H ≤ V (n + 1) * (p * ∏ i, value (u i)))
|
| 38 |
+
(hlarge : ∀ (q : Pg) (y : MovingRegularSlot n r m → σ),
|
| 39 |
+
(∏ i, ν i (y i)) ≠ 0 → ∀ ℓ, ℓ.Prime → ℓ ∣ (q : ℕ) * (∏ i, value (y i)) → V (n + 1) < ℓ)
|
| 40 |
+
(hvg : ∀ q : Pg, V (n + 1) < (q : ℕ))
|
| 41 |
+
(hφsupport : ∀ p : ℕ, 0 < p → φ (Real.log p - G (n + 1)) ≠ 0 → p ∈ I)
|
| 42 |
+
(hchild : V n ≤ childBound (n + 1))
|
| 43 |
+
(hgap : ∀ XR : Pg, ∀ right : MovingRegularSlot n r m → σ, (∏ i, ν i (right i)) ≠ 0 →
|
| 44 |
+
2 * pivotBound (n + 1) * childBound (n + 1) < (XR : ℕ) * ∏ i, value (right i))
|
| 45 |
+
(hcomp : ∀ u : TreeLeafIndex n × Fin 4 → σ, (∏ i, μ n (u i)) ≠ 0 →
|
| 46 |
+
(∀ p ∈ I, p * (∏ i, value (u i)) ≤ pivotBound (n + 1)) ∧
|
| 47 |
+
(∀ q, q.Prime → q ∣ ∏ i, value (u i) → childBound (n + 1) < q)) :
|
| 48 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 49 |
+
let greg := normalizedResidueFamily sets
|
| 50 |
+
Real.exp (-smoothGiantLogNormalizer Pg φ (G (n + 1))) *
|
| 51 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n (4 + r) m
|
| 52 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable‖ ^ 2 ≤
|
| 53 |
+
movingAmplitudeDiagonal value outside μ childBound pivotBound V F φ G n r m Pg I
|
| 54 |
+
ρ ν greg ggiant favorable +
|
| 55 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G (n + 1) r m
|
| 56 |
+
Pg ρ (movingTemplateDoubledPrior n r m ν) greg ggiant favorable‖ := by
|
| 57 |
+
intro ρ greg
|
| 58 |
+
have he := movingAmplitudeOffDiagonal_eq_next value hvalue outside μ childBound pivotBound V
|
| 59 |
+
hV F hF φ G n r m Pg hPg ρ ν hvg I hI hφsupport hchild hgap
|
| 60 |
+
(fun XR right hr => hlarge XR right hr) hcomp greg ggiant favorable
|
| 61 |
+
rw [← he]
|
| 62 |
+
exact movingTemplatePrimeAmplitude_transfer_on_live value hvalue outside μ childBound pivotBound V F
|
| 63 |
+
φ G n r m Pg I hPg hPI hI hφ hpos hμ hμmass ν sets hsets hcard ggiant favorable
|
| 64 |
+
hgiant H hH hscale hlarge
|
| 65 |
+
|
| 66 |
+
end Ostmann
|
| 67 |
+
|
| 68 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveSupport.lean
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Construction.SmoothGiantLiveSupport
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateAmplitude
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # The exact full giant amplitude on its nonzero finite support -/
|
| 7 |
+
namespace Ostmann
|
| 8 |
+
open scoped Classical BigOperators
|
| 9 |
+
|
| 10 |
+
theorem movingTemplatePrimeAmplitude_live {σ : Type} [Fintype σ]
|
| 11 |
+
(value : σ → ℕ) (outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 12 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState σ → ℤ → ℂ)
|
| 13 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 14 |
+
(P : Finset ℕ) (H : ℝ) (ν : MovingRegularSlot n r m → σ → ℝ)
|
| 15 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 16 |
+
movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n r m
|
| 17 |
+
P (smoothGiantPrior P φ H) ν greg ggiant favorable =
|
| 18 |
+
movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n r m
|
| 19 |
+
(smoothGiantLivePrimes P φ H) (smoothGiantPrior (smoothGiantLivePrimes P φ H) φ H)
|
| 20 |
+
ν greg ggiant favorable := by
|
| 21 |
+
unfold movingTemplatePrimeAmplitude
|
| 22 |
+
exact smoothGiantPrior_double_sum_live P φ H (fun XL XR =>
|
| 23 |
+
∑ s : transferFrequencyRange (V n),
|
| 24 |
+
∑ y : MovingRegularSlot n r m → σ, ((∏ i, ν i (y i) : ℝ) : ℂ) *
|
| 25 |
+
(movingTemplateCoefficient value outside μ childBound pivotBound V F φ G n r m
|
| 26 |
+
s.val y XL XR *
|
| 27 |
+
movingTaggedTransform
|
| 28 |
+
(Sum.elim (fun b : Bool => if b then XL else XR) (value ∘ y))
|
| 29 |
+
(Sum.elim (fun _ => true) (fun _ => false)) greg ggiant favorable outside.prod s.val))
|
| 30 |
+
|
| 31 |
+
end Ostmann
|
| 32 |
+
|
| 33 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveSymmetrization.lean
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeTerms
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateLiveSymmetrization
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingSymmetrizedProductLower
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-! # Harmonic product-fibre control of the whole prime amplitude diagonal -/
|
| 8 |
+
|
| 9 |
+
namespace Ostmann
|
| 10 |
+
open scoped Classical BigOperators
|
| 11 |
+
|
| 12 |
+
theorem movingAmplitude_symmetrized_harmonic_diagonal_live
|
| 13 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (hPg : ∀ p ∈ Pg, p.Prime)
|
| 14 |
+
(outside : List ℕ) (μ : ℕ → P → ℝ) (hμ : ∀ j a, 0 ≤ μ j a)
|
| 15 |
+
(childBound pivotBound V : ℕ → ℕ)
|
| 16 |
+
(F : MovingSlotState P → ℤ → ℂ) (hF : ∀ x, F x 0 = 0)
|
| 17 |
+
(φ : ℝ → ℝ) (hφ0 : ∀ x, 0 ≤ φ x) (hφ1 : ∀ x, φ x ≤ 1) (G : ℕ → ℝ)
|
| 18 |
+
(n r m : ℕ) (Q : MovingRegularSlot n r m → Finset ℕ)
|
| 19 |
+
(hν : ∀ j k : TreeLeafIndex n × Fin m,
|
| 20 |
+
primeSubsetPrior P (Q (movingTemplateBulk n r m j)) =
|
| 21 |
+
primeSubsetPrior P (Q (movingTemplateBulk n r m k)))
|
| 22 |
+
(hvg : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 → V n < (q : ℕ)) (hvr : ∀ i (q : P), primeSubsetPrior P (Q i) q ≠ 0 → V n < (q : ℕ))
|
| 23 |
+
(hsep : ∀ q : Pg, smoothGiantPrior Pg φ (G (n + 1)) q ≠ 0 →
|
| 24 |
+
∀ i (a : P), primeSubsetPrior P (Q i) a ≠ 0 → (q : ℕ) ≠ (a : ℕ))
|
| 25 |
+
(greg ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool) :
|
| 26 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 27 |
+
let ν := fun i => primeSubsetPrior P (Q i)
|
| 28 |
+
let A := MovingAmplitudeIndex P Pg n r m V
|
| 29 |
+
let α := fun a : A => movingAmplitudePrior Pg n r m V ρ ν a
|
| 30 |
+
let θ := fun a : A =>
|
| 31 |
+
(Real.exp (smoothGiantLogNormalizer Pg φ (G (n + 1))) / (a.1 : ℕ)) *
|
| 32 |
+
((Fintype.card (MovingRegularSlot n r m)).factorial : ℝ) *
|
| 33 |
+
(∏ i, (∑ q ∈ Q i, (q : ℝ)⁻¹)⁻¹) * ((∏ i, (a.2.1 i : ℕ)) : ℝ)⁻¹
|
| 34 |
+
movingAmplitudeDiagonal Subtype.val outside μ childBound pivotBound V F φ G n r m Pg I
|
| 35 |
+
ρ ν greg ggiant favorable ≤
|
| 36 |
+
∑ u : TreeLeafIndex n × Fin 4 → P, (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) *
|
| 37 |
+
∑ p ∈ I, φ (Real.log p - G (n + 1)) * ∑ a : A, α a * θ a *
|
| 38 |
+
‖movingSymmetrizedTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 39 |
+
n r m a.2.2.val u a.2.1 p a.1 *
|
| 40 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (a.1 : ℕ))
|
| 41 |
+
(∏ i, (a.2.1 i : ℕ)) a.2.2.val‖ ^ 2 := by
|
| 42 |
+
intro ρ ν A α θ
|
| 43 |
+
unfold movingAmplitudeDiagonal
|
| 44 |
+
dsimp only
|
| 45 |
+
apply Finset.sum_le_sum
|
| 46 |
+
intro u _
|
| 47 |
+
apply mul_le_mul_of_nonneg_left _
|
| 48 |
+
(mul_nonneg (Finset.prod_nonneg (fun i _ => hμ n (u i))) (Nat.cast_nonneg _))
|
| 49 |
+
apply Finset.sum_le_sum
|
| 50 |
+
intro p _
|
| 51 |
+
apply mul_le_mul_of_nonneg_left _ (hφ0 _)
|
| 52 |
+
have hd := movingTemplate_symmetrized_harmonic_diagonal_live P Pg hP hPg outside μ childBound pivotBound V
|
| 53 |
+
F hF φ hφ0 hφ1 G (G (n + 1)) n r m Q hν u p hvg hvr hsep greg ggiant favorable
|
| 54 |
+
dsimp only at hd
|
| 55 |
+
let : ∀ a : A, Fact (a.1 : ℕ).Prime := fun a => ⟨hPg _ a.1.property⟩
|
| 56 |
+
let : ∀ a : A, ∀ i, Fact (a.2.1 i : ℕ).Prime := fun a i => ⟨hP _ (a.2.1 i).property⟩
|
| 57 |
+
simpa only [movingSymmetrizedTemplateCoefficient, movingTemplateTransferWeight, movingAmplitudePrior, movingOneGiant_transform_tagged,
|
| 58 |
+
ρ, ν, α, θ, Nat.cast_prod, Function.comp_def]
|
| 59 |
+
using hd
|
| 60 |
+
|
| 61 |
+
end Ostmann
|
| 62 |
+
|
| 63 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeLiveTransfer.lean
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeTerms
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingTemplateLiveTransfer
|
| 3 |
+
|
| 4 |
+
namespace OAI
|
| 5 |
+
|
| 6 |
+
/-! # Transfer of the original amplitude with its supported product window -/
|
| 7 |
+
|
| 8 |
+
namespace Ostmann
|
| 9 |
+
open scoped Classical BigOperators ComplexConjugate
|
| 10 |
+
|
| 11 |
+
/-- Specialization to the actual surviving giant, regular tuple and frequency.
|
| 12 |
+
The compensation draw and the giant harmonic normalization are unchanged. -/
|
| 13 |
+
theorem movingTemplatePrimeAmplitude_transfer_on_live {σ : Type} [Fintype σ]
|
| 14 |
+
(value : σ → ℕ) (hvalue : ∀ a, (value a).Prime)
|
| 15 |
+
(outside : List ℕ) (μ : ℕ → σ → ℝ)
|
| 16 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState σ → ℤ → ℂ)
|
| 17 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 18 |
+
(Pg I : Finset ℕ) (hPg : ∀ p ∈ Pg, p.Prime) (hPI : Pg ⊆ I)
|
| 19 |
+
(hI : ∀ p ∈ I, 0 < p) (hφ : ∀ x, 0 ≤ φ x)
|
| 20 |
+
(hpos : 0 < smoothGiantMass Pg φ (G (n + 1)))
|
| 21 |
+
(hμ : ∀ a, 0 ≤ μ n a) (hμmass : ∑ a, μ n a = 1)
|
| 22 |
+
(ν : MovingRegularSlot n r m → σ → ℝ)
|
| 23 |
+
(sets : ∀ q : ℕ, Finset (ZMod q))
|
| 24 |
+
(hsets : ∀ a, (sets (value a)).Nonempty)
|
| 25 |
+
(hcard : ∀ a, (sets (value a)).card < value a)
|
| 26 |
+
(ggiant : ∀ q : ℕ, ZMod q → ℂ) (favorable : ℕ → Bool)
|
| 27 |
+
(hgiant : ∀ q : Pg, ∀ x, ggiant q (-x) = conj (ggiant q x))
|
| 28 |
+
(H : ℕ)
|
| 29 |
+
(hH : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 →
|
| 30 |
+
∀ (p : ℕ), p ∈ I →
|
| 31 |
+
∀ (q : Pg) (y : MovingRegularSlot n r m → σ) (s : transferFrequencyRange (V n)),
|
| 32 |
+
movingTemplateCoefficient value outside μ childBound pivotBound V F φ G
|
| 33 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p q ≠ 0 →
|
| 34 |
+
(q : ℕ) * (∏ i, value (y i)) ≤ H)
|
| 35 |
+
(hscale : ∀ (u : TreeLeafIndex n × Fin 4 → σ), (∏ i, μ n (u i)) ≠ 0 → ∀ p ∈ I,
|
| 36 |
+
2 * V n * H ≤ V (n + 1) * (p * ∏ i, value (u i)))
|
| 37 |
+
(hlarge : ∀ (q : Pg) (y : MovingRegularSlot n r m → σ),
|
| 38 |
+
(∏ i, ν i (y i)) ≠ 0 → ∀ ℓ, ℓ.Prime → ℓ ∣ (q : ℕ) * (∏ i, value (y i)) → V (n + 1) < ℓ) :
|
| 39 |
+
let ρ := smoothGiantPrior Pg φ (G (n + 1))
|
| 40 |
+
let greg := normalizedResidueFamily sets
|
| 41 |
+
Real.exp (-smoothGiantLogNormalizer Pg φ (G (n + 1))) *
|
| 42 |
+
‖movingTemplatePrimeAmplitude value outside μ childBound pivotBound V F φ G n (4 + r) m
|
| 43 |
+
Pg ρ (movingTemplateRestoredPrior n r m (μ n) ν) greg ggiant favorable‖ ^ 2 ≤
|
| 44 |
+
movingAmplitudeDiagonal value outside μ childBound pivotBound V F φ G n r m Pg I
|
| 45 |
+
ρ ν greg ggiant favorable +
|
| 46 |
+
‖movingAmplitudeOffDiagonal value outside μ childBound pivotBound V F φ G n r m Pg I
|
| 47 |
+
ρ ν greg ggiant favorable‖ := by
|
| 48 |
+
intro ρ greg
|
| 49 |
+
let A := MovingAmplitudeIndex σ Pg n r m V
|
| 50 |
+
let X := fun a : A => (a.1 : ℕ)
|
| 51 |
+
let y := fun a : A => a.2.1
|
| 52 |
+
let v := fun a : A => a.2.2.val
|
| 53 |
+
let α := fun a : A => (movingAmplitudePrior Pg n r m V ρ ν a : ℂ)
|
| 54 |
+
let : ∀ a : A, Fact (X a).Prime := fun a => ⟨hPg _ a.1.property⟩
|
| 55 |
+
let : ∀ a : A, ∀ i, Fact (value (y a i)).Prime := fun a i => ⟨hvalue (y a i)⟩
|
| 56 |
+
let : ∀ a : A, ∀ i, NeZero ((value ∘ y a) i) :=
|
| 57 |
+
fun a i => ⟨(hvalue (y a i)).ne_zero⟩
|
| 58 |
+
let L := fun a => movingOneGiantModuli (X a) (value ∘ y a)
|
| 59 |
+
let W := movingTemplateTransferWeight value outside μ childBound pivotBound V F φ G
|
| 60 |
+
n r m v α X y
|
| 61 |
+
have ht := movingTemplate_prior_transfer_on_live value hvalue outside μ childBound pivotBound V F
|
| 62 |
+
φ G n r m Pg I hPg hPI hI hφ hpos hμ hμmass X (fun a => hPg _ a.1.property)
|
| 63 |
+
y v α sets hsets hcard ggiant favorable (fun a => hgiant a.1)
|
| 64 |
+
(V n) H (V (n + 1)) (fun a => (mem_transferFrequencyRange _ _).mp a.2.2.property)
|
| 65 |
+
(fun u hu p hp a ha => hH u hu p hp a.1 (y a) a.2.2 (right_ne_zero_of_mul ha)) hscale (fun a ha => by
|
| 66 |
+
have hprior : movingAmplitudePrior Pg n r m V ρ ν a ≠ 0 :=
|
| 67 |
+
Complex.ofReal_ne_zero.mp ha
|
| 68 |
+
exact hlarge a.1 (y a) (right_ne_zero_of_mul hprior))
|
| 69 |
+
dsimp only at ht
|
| 70 |
+
rw [← movingTemplatePrimeAmplitude_index] at ht
|
| 71 |
+
have hC u p : movingRegularCoefficient L
|
| 72 |
+
(fun a => movingOneGiantFactors (X a) (value ∘ y a) greg ggiant favorable)
|
| 73 |
+
outside.prod (∏ i, value (u i)) v (W u) p =
|
| 74 |
+
fun a => W u p a * movingTaggedTransform (L a)
|
| 75 |
+
(Sum.elim (fun _ => true) (fun _ => false)) greg ggiant favorable
|
| 76 |
+
(p * (∏ i, value (u i)) * outside.prod) (v a) := by
|
| 77 |
+
funext a
|
| 78 |
+
exact congrArg (fun z => W u p a * z)
|
| 79 |
+
(movingOneGiant_transform_tagged (X a) (value ∘ y a) greg ggiant favorable
|
| 80 |
+
(p * (∏ i, value (u i)) * outside.prod) (v a))
|
| 81 |
+
convert ht using 1
|
| 82 |
+
congr 1
|
| 83 |
+
· unfold movingAmplitudeDiagonal
|
| 84 |
+
apply Finset.sum_congr rfl
|
| 85 |
+
intro u _
|
| 86 |
+
congr 1
|
| 87 |
+
apply Finset.sum_congr rfl
|
| 88 |
+
intro p _
|
| 89 |
+
congr 1
|
| 90 |
+
simp only [movingOneGiantModuli_product, Function.comp_apply]
|
| 91 |
+
exact congrArg (fun c : A → ℂ =>
|
| 92 |
+
(pivotDiagonal (fun a => X a * ∏ i, value (y a i)) v c).re) (hC u p).symm
|
| 93 |
+
· congr 1
|
| 94 |
+
unfold movingAmplitudeOffDiagonal
|
| 95 |
+
apply Finset.sum_congr rfl
|
| 96 |
+
intro u _
|
| 97 |
+
congr 1
|
| 98 |
+
conv_rhs => rw [← Finset.sum_coe_sort]
|
| 99 |
+
apply Finset.sum_congr rfl
|
| 100 |
+
intro s hs
|
| 101 |
+
apply Finset.sum_congr rfl
|
| 102 |
+
intro a _
|
| 103 |
+
apply Finset.sum_congr rfl
|
| 104 |
+
intro b _
|
| 105 |
+
simp only [movingOneGiantModuli_product, Function.comp_apply,
|
| 106 |
+
movingOneGiant_pair_transform_tagged]
|
| 107 |
+
dsimp only [movingTemplateIntegerFourierTerm, movingTemplateTransferWeight, A, X, y, v, α, W]
|
| 108 |
+
split_ifs
|
| 109 |
+
· simp only [map_mul, Complex.conj_ofReal]
|
| 110 |
+
simp only [starRingEnd_apply]
|
| 111 |
+
dsimp only [greg]
|
| 112 |
+
ring
|
| 113 |
+
· simp only [mul_zero]
|
| 114 |
+
|
| 115 |
+
end Ostmann
|
| 116 |
+
|
| 117 |
+
end OAI
|
lean/OAI/NumberTheory/Ostmann/Arithmetic/MovingAmplitudeMaskedEnergy.lean
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingAmplitudeHarmonicCost
|
| 2 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingRestoredEnergy
|
| 3 |
+
import OAI.NumberTheory.Ostmann.Arithmetic.MovingMaskedTemplateEnergy
|
| 4 |
+
|
| 5 |
+
namespace OAI
|
| 6 |
+
|
| 7 |
+
/-! # The actual one-branch amplitude energy in restored arithmetic coordinates -/
|
| 8 |
+
|
| 9 |
+
namespace Ostmann
|
| 10 |
+
open scoped Classical BigOperators
|
| 11 |
+
|
| 12 |
+
private theorem amplitude_energy_fubini {U T X Y S : Type}
|
| 13 |
+
[Fintype U] [Fintype X] [Fintype Y] [Fintype S]
|
| 14 |
+
(I : Finset T) (M : U → ℝ) (w : T → ℝ) (ρ : X → ℝ) (ν : Y → ℝ)
|
| 15 |
+
(F : U → T → X → Y → S → ℝ) :
|
| 16 |
+
(∑ u, M u * ∑ p ∈ I, w p * ∑ a : X × (Y × S),
|
| 17 |
+
(ρ a.1 * ν a.2.1) * F u p a.1 a.2.1 a.2.2) =
|
| 18 |
+
∑ u, M u * ∑ y, ν y * ∑ p ∈ I, w p * ∑ x, ρ x * ∑ s, F u p x y s := by
|
| 19 |
+
simp only [Fintype.sum_prod_type, Finset.mul_sum]
|
| 20 |
+
apply Finset.sum_congr rfl
|
| 21 |
+
intro u _
|
| 22 |
+
conv_lhs =>
|
| 23 |
+
arg 2
|
| 24 |
+
ext p
|
| 25 |
+
rw [Finset.sum_comm]
|
| 26 |
+
rw [Finset.sum_comm]
|
| 27 |
+
apply Finset.sum_congr rfl
|
| 28 |
+
intro y _
|
| 29 |
+
apply Finset.sum_congr rfl
|
| 30 |
+
intro p _
|
| 31 |
+
apply Finset.sum_congr rfl
|
| 32 |
+
intro x _
|
| 33 |
+
apply Finset.sum_congr rfl
|
| 34 |
+
intro s _
|
| 35 |
+
ring
|
| 36 |
+
|
| 37 |
+
/-- The compensation draw and the surviving draw are independent original
|
| 38 |
+
priors; this reordering introduces no frequency probability factor. -/
|
| 39 |
+
theorem movingAmplitudeRegularEnergy_fubini
|
| 40 |
+
(P Pg I : Finset ℕ) (outside : List ℕ) (μ : ℕ → P → ℝ)
|
| 41 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 42 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 43 |
+
(Q : MovingRegularSlot n r m → Finset ℕ) (greg : ∀ q : ℕ, ZMod q → ℂ) :
|
| 44 |
+
movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg =
|
| 45 |
+
∑ u : TreeLeafIndex n × Fin 4 → P, (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ) *
|
| 46 |
+
∑ y : MovingRegularSlot n r m → P, (∏ i, primeSubsetPrior P (Q i) (y i)) *
|
| 47 |
+
∑ p ∈ I, φ (Real.log p - G (n + 1)) *
|
| 48 |
+
∑ X : Pg, smoothGiantPrior Pg φ (G (n + 1)) X *
|
| 49 |
+
∑ s : transferFrequencyRange (V n),
|
| 50 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 51 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p X *
|
| 52 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (X : ℕ))
|
| 53 |
+
(∏ i, (y i : ℕ)) s.val‖ ^ 2 := by
|
| 54 |
+
unfold movingAmplitudeRegularEnergy
|
| 55 |
+
dsimp only
|
| 56 |
+
have h := amplitude_energy_fubini
|
| 57 |
+
(U := TreeLeafIndex n × Fin 4 → P) (X := Pg)
|
| 58 |
+
(Y := MovingRegularSlot n r m → P) (S := transferFrequencyRange (V n)) I
|
| 59 |
+
(fun u => (∏ i, μ n (u i)) * (∏ i, (u i : ℕ) : ℕ))
|
| 60 |
+
(fun p => φ (Real.log p - G (n + 1)))
|
| 61 |
+
(smoothGiantPrior Pg φ (G (n + 1)))
|
| 62 |
+
(fun y => ∏ i, primeSubsetPrior P (Q i) (y i))
|
| 63 |
+
(fun u p X y s =>
|
| 64 |
+
‖movingTemplateCoefficient Subtype.val outside μ childBound pivotBound V F φ G
|
| 65 |
+
n (4 + r) m s.val (movingRestoreSample n r m u y) p X *
|
| 66 |
+
primeProductTransform greg (p * (∏ i, (u i : ℕ)) * outside.prod * (X : ℕ))
|
| 67 |
+
(∏ i, (y i : ℕ)) s.val‖ ^ 2)
|
| 68 |
+
convert h using 1
|
| 69 |
+
simp only [movingAmplitudePrior, Nat.cast_prod]
|
| 70 |
+
|
| 71 |
+
/-- This is the literal arithmetic energy under the original restored prior.
|
| 72 |
+
The extracted compensation product is a weight, not a change of measure. -/
|
| 73 |
+
theorem movingAmplitudeRegularEnergy_eq_masked
|
| 74 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (outside : List ℕ) (μ : ℕ → P → ℝ)
|
| 75 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 76 |
+
(φ : ℝ → ℝ) (G : ℕ → ℝ) (n r m : ℕ)
|
| 77 |
+
(Q : MovingRegularSlot n r m → Finset ℕ) (greg : ∀ q : ℕ, ZMod q → ℂ) :
|
| 78 |
+
movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg =
|
| 79 |
+
movingMaskedTemplateEnergy P Pg I hP outside μ childBound pivotBound V F φ G n r m Q greg
|
| 80 |
+
(fun x => (movingRestoredCompensationProduct Subtype.val n r m x : ℝ)) := by
|
| 81 |
+
rw [movingAmplitudeRegularEnergy_fubini]
|
| 82 |
+
unfold movingMaskedTemplateEnergy
|
| 83 |
+
rw [movingTemplateRestoredPrior_average_real]
|
| 84 |
+
simp only [movingRestoredCompensationProduct_restore, Finset.mul_sum]
|
| 85 |
+
apply Finset.sum_congr rfl
|
| 86 |
+
intro u _
|
| 87 |
+
apply Finset.sum_congr rfl
|
| 88 |
+
intro y _
|
| 89 |
+
apply Finset.sum_congr rfl
|
| 90 |
+
intro p _
|
| 91 |
+
apply Finset.sum_congr rfl
|
| 92 |
+
intro X _
|
| 93 |
+
apply Finset.sum_congr rfl
|
| 94 |
+
intro s _
|
| 95 |
+
rw [movingMaskedTemplateKernel_restore]
|
| 96 |
+
ring
|
| 97 |
+
|
| 98 |
+
/-- The compensation cost is now explicit, with the same original prior in
|
| 99 |
+
both energies. The bound is used only after the nonnegative diagonal reduction. -/
|
| 100 |
+
theorem movingAmplitudeRegularEnergy_le_masked
|
| 101 |
+
(P Pg I : Finset ℕ) (hP : ∀ p ∈ P, p.Prime) (outside : List ℕ) (μ : ℕ → P → ℝ)
|
| 102 |
+
(hμ : ∀ j a, 0 ≤ μ j a)
|
| 103 |
+
(childBound pivotBound V : ℕ → ℕ) (F : MovingSlotState P → ℤ → ℂ)
|
| 104 |
+
(φ : ℝ → ℝ) (hφ : ∀ t, 0 ≤ φ t) (G : ℕ → ℝ) (n r m : ℕ)
|
| 105 |
+
(Q : MovingRegularSlot n r m → Finset ℕ) (greg : ∀ q : ℕ, ZMod q → ℂ)
|
| 106 |
+
(b : ℝ) (hb : ∀ a, μ n a ≠ 0 → (a : ℝ) ≤ Real.exp b) :
|
| 107 |
+
movingAmplitudeRegularEnergy P Pg I outside μ childBound pivotBound V F φ G n r m Q greg ≤
|
| 108 |
+
Real.exp (((2 ^ n * 4 : ℕ) : ℝ) * b) *
|
| 109 |
+
movingMaskedTemplateEnergy P Pg I hP outside μ childBound pivotBound V F φ G n r m Q greg
|
| 110 |
+
(fun _ => 1) := by
|
| 111 |
+
rw [movingAmplitudeRegularEnergy_eq_masked P Pg I hP]
|
| 112 |
+
apply movingMaskedTemplateEnergy_weight_le P Pg I hP outside μ hμ
|
| 113 |
+
childBound pivotBound V F φ hφ G n r m Q greg
|
| 114 |
+
intro x hx
|
| 115 |
+
exact movingRestoredCompensationProduct_le_exp P (μ n) n r m
|
| 116 |
+
(fun i => primeSubsetPrior P (Q i)) b hb x hx
|
| 117 |
+
|
| 118 |
+
end Ostmann
|
| 119 |
+
|
| 120 |
+
end OAI
|