File size: 3,848 Bytes
4a56cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import OAI.NumberTheory.Ostmann.Arithmetic.ArithmeticPatternErrorRate
import OAI.NumberTheory.Ostmann.Arithmetic.PatternFrequencyNormSum

namespace OAI

/-! # The diagonal budget after both giant and bulk comparisons -/

namespace Ostmann
open Filter
open scoped Classical BigOperators

/-- The actual pattern sum and paired frequency sum have an absolute bulk
constant. The cutoff includes the constructed bottom reserve `2 sqrt(m)`.
The five comparison errors retain their saving after the full history count. -/
theorem arithmetic_diagonal_pattern_norm_rate (ψ : SchwartzMap ℝ β„‚) (n k : β„•)
    (hk : 0 < k) (hn : n ≀ k) (B Cfreq Cprior Ξ΅ : ℝ)
    (hCfreq : 0 ≀ Cfreq) (hCprior : 1 ≀ Cprior) (hΞ΅ : 0 < Ξ΅)
    (hdepth : 8 * Cprior ≀ (k : ℝ) ^ 3) :
    βˆ€αΆ  L : ℝ in atTop, let m := spectatorBulkCount k L
      βˆƒ D : ℝ, 0 ≀ D ∧
        (βˆ€ q : β„•, q β‰  0 β†’ (q : ℝ) ≀ Real.exp (2 * Cfreq * m) β†’
          (q.divisors.card : ℝ) ≀ D) ∧
        βˆ€ (S : Finset β„€) (N V : β„•) (Ξ” err : ℝ),
        (S.card : ℝ) ≀ Real.exp (Cfreq * m) β†’
        (βˆ€ s ∈ S, s β‰  0 ∧ s.natAbs ≀ N) β†’
        (N : ℝ) ≀ Real.exp (Cfreq * m) β†’
        (V : ℝ) ≀ Real.exp (Ξ” + Real.sqrt (4 * m)) β†’
        0 ≀ err β†’ err ≀ Real.exp (-Real.exp ((125 / 100000 : ℝ) * L)) +
          4 * Real.exp (-Real.exp ((2 / 1000 : ℝ) * L)) β†’
        let _ := sampleSetoidFintype (Bool Γ— MovingSampleIndex n)
        let K := ((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Ξ”)) ^ (2 ^ n) *
            B ^ (2 ^ n - 1)) ^ 2 *
          ((2 : ℝ) ^ (2 ^ n * m) * 4 * 3 ^ (2 ^ n * m)) * 2 ^ (2 ^ n * m)
        βˆ€ R : Setoid (Bool Γ— MovingSampleIndex n) β†’ FrequencyTree (S Γ— S) n β†’ β„‚,
        (βˆ€ s t, β€–R s tβ€– ≀
          ((2 : ℝ) ^ Fintype.card (Quotient s) *
            (Real.exp (Cprior * L)) ^ (4 * n * 2 ^ n - Fintype.card (Quotient s))) *
          (err + K * (frequencyLeafWeight (pairedFrequencyLeaf S V) n t *
            ((frequencySplitList S n t).map (pairFrequencySupportBound D)).prod))) β†’
        β€–βˆ‘ s, βˆ‘ t, R s tβ€– ≀
          Real.exp ((2 ^ n : β„•) * Ξ” + (Real.log 12 + 1) * (2 ^ n : β„•) * m + Ξ΅ * m) +
            5 * Real.exp (-Real.exp ((12 / 10000 : ℝ) * L)) := by
  filter_upwards [arithmetic_prime_pattern_budget_rate ψ n k hk hn B Cfreq Cprior Ρ
      hCfreq hCprior hΞ΅ hdepth,
    movingPattern_five_errors_rate n k hk Cprior Cfreq hCprior hCfreq]
    with L hbudget herrors
  dsimp only
  obtain ⟨D, hD, hdiv, hbudget⟩ := hbudget
  refine ⟨D, hD, hdiv, ?_⟩
  intro S N V Ξ” err hcard hS hN hV herr herrbound R hR
  have hdivN : βˆ€ q : β„•, q β‰  0 β†’ q ≀ N ^ 2 β†’ (q.divisors.card : ℝ) ≀ D := by
    intro q hq hqN
    apply hdiv q hq
    calc
      (q : ℝ) ≀ (N : ℝ) ^ 2 := by exact_mod_cast hqN
      _ ≀ (Real.exp (Cfreq * spectatorBulkCount k L)) ^ 2 :=
        pow_le_pow_leftβ‚€ (Nat.cast_nonneg N) hN 2
      _ = Real.exp (2 * Cfreq * spectatorBulkCount k L) := by
        rw [← Real.exp_nat_mul]
        congr 1
        ring
  have hsum := pattern_frequency_norm_sum_le S n N V D (Real.exp (Cprior * L))
    (((SchwartzMap.seminorm ℝ 0 0 ψ / Real.sqrt (Real.exp Ξ”)) ^ (2 ^ n) *
      B ^ (2 ^ n - 1)) ^ 2 *
      ((2 : ℝ) ^ (2 ^ n * spectatorBulkCount k L) * 4 * 3 ^ (2 ^ n * spectatorBulkCount k L)) *
        2 ^ (2 ^ n * spectatorBulkCount k L)) err hD (Real.exp_nonneg _) (by positivity)
      herr hS hdivN R hR
  have hcost := hbudget N V Ξ” hN hV
  have he := (mul_le_mul_of_nonneg_left herrbound
    (show 0 ≀ ((2 : ℝ) ^ ((4 * n * 2 ^ n) ^ 2) *
      (max 2 (Real.exp (Cprior * L))) ^ (4 * n * 2 ^ n)) *
      (Fintype.card (FrequencyTree (S Γ— S) n) : ℝ) by positivity)).trans (herrors S hcard)
  apply hsum.trans
  nlinarith only [hcost, he]

end Ostmann

end OAI