OAI/Probability/TraceReconstruction/Binomial.lean

GitHub source file

162 declarations, 0 contain sorry, 0 declared as axioms

Binomial

Fair and biased binomial laws, generating series, differences, concentration, Gaussian overlap, hidden counts, and local lower bounds.

  1. def OAI.TraceReconstruction.fairBinomial line 24

    Source documentation

    Fair-binomial mass, extended by zero beyond its natural support.

    def fairBinomial (n k : ℕ) : ℝ := (n.choose k : ℝ) / 2 ^ n
  2. theorem OAI.TraceReconstruction.fairBinomial_nonneg line 26
  3. theorem OAI.TraceReconstruction.centralBinom_square_bound line 30
  4. theorem OAI.TraceReconstruction.choose_odd_le_twice_central line 59
  5. theorem OAI.TraceReconstruction.fairBinomial_square_bound line 69
  6. abbrev OAI.TraceReconstruction.IntSeries line 108
  7. def OAI.TraceReconstruction.seriesL1 line 110
  8. def OAI.TraceReconstruction.seriesL2Sq line 111
  9. theorem OAI.TraceReconstruction.series_summable line 113
  10. theorem OAI.TraceReconstruction.seriesL1_nonneg line 117
  11. theorem OAI.TraceReconstruction.seriesL2Sq_nonneg line 120
  12. theorem OAI.TraceReconstruction.seriesL1_eq_sum line 123
  13. theorem OAI.TraceReconstruction.seriesL2Sq_eq_sum line 129
  14. theorem OAI.TraceReconstruction.series_summable_shift line 135
  15. theorem OAI.TraceReconstruction.series_sum_shift line 140
  16. theorem OAI.TraceReconstruction.series_coeff_mul_abs_le line 144
  17. theorem OAI.TraceReconstruction.seriesL1_mul_le line 150
  18. theorem OAI.TraceReconstruction.series_coeff_mul_sq_le line 166
  19. theorem OAI.TraceReconstruction.seriesL2Sq_mul_le line 176
  20. theorem OAI.TraceReconstruction.series_coeff_mul_bound line 195
  21. def OAI.TraceReconstruction.fairSeries line 206
  22. theorem OAI.TraceReconstruction.fairSeries_add line 209
  23. theorem OAI.TraceReconstruction.fairSeries_sum line 212
  24. theorem OAI.TraceReconstruction.fairSeries_coeff_nat line 230
  25. theorem OAI.TraceReconstruction.fairSeries_coeff_neg line 246
  26. theorem OAI.TraceReconstruction.seriesL1_eq_sum_range line 254
  27. def OAI.TraceReconstruction.firstDifference line 273
  28. theorem OAI.TraceReconstruction.firstDifference_coeff line 276
  29. theorem OAI.TraceReconstruction.fairSeries_difference_coeff_zero line 283
  30. theorem OAI.TraceReconstruction.fairSeries_difference_coeff_succ line 290
  31. theorem OAI.TraceReconstruction.fairBinomial_unimodal_left line 296
  32. theorem OAI.TraceReconstruction.fairBinomial_unimodal_right line 301
  33. theorem OAI.TraceReconstruction.fairBinomial_variation line 309
  34. theorem OAI.TraceReconstruction.fairSeries_difference_L1 line 338
  35. def OAI.TraceReconstruction.binomialBound line 356
  36. theorem OAI.TraceReconstruction.binomialBound_nonneg line 358
  37. theorem OAI.TraceReconstruction.fairBinomial_le_bound line 360
  38. theorem OAI.TraceReconstruction.fairSeries_nonneg line 365
  39. theorem OAI.TraceReconstruction.fairSeries_coeff_bound line 371
  40. theorem OAI.TraceReconstruction.fairSeries_L1 line 380
  41. theorem OAI.TraceReconstruction.seriesL2Sq_le_L1_mul_bound line 392
  42. theorem OAI.TraceReconstruction.fairSeries_L2Sq_bound line 405
  43. theorem OAI.TraceReconstruction.fairSeries_difference_L1_bound line 409
  44. theorem OAI.TraceReconstruction.seriesL1_single line 414
  45. theorem OAI.TraceReconstruction.seriesL1_one line 421
  46. theorem OAI.TraceReconstruction.seriesL1_pow_le line 425
  47. theorem OAI.TraceReconstruction.fairSeries_mul_power line 433
  48. theorem OAI.TraceReconstruction.binomial_difference_coeff_bound line 441

    Source documentation

    Quantitative higher-order smoothing, with n trials assigned to each difference and one further group reserved for anti-concentration.

    theorem binomial_difference_coeff_bound (n s : ℕ) (z : ℤ) :
        |(firstDifference ^ s * fairSeries ((s + 1) * n)).coeff z| ≤
          (2 * binomialBound n) ^ s * binomialBound n := by
    …

    Mentions: OAI.TraceReconstruction.firstDifference, OAI.TraceReconstruction.fairSeries, OAI.TraceReconstruction.binomialBound

  49. theorem OAI.TraceReconstruction.binomial_difference_L2Sq_bound line 450
  50. theorem OAI.TraceReconstruction.seriesL1_add_le line 463
  51. theorem OAI.TraceReconstruction.seriesL1_zero line 475
  52. theorem OAI.TraceReconstruction.seriesL1_sum_le line 478
  53. theorem OAI.TraceReconstruction.seriesL1_prod_le line 487
  54. def OAI.TraceReconstruction.geomSeries line 496
  55. def OAI.TraceReconstruction.prouhetSeries line 498
  56. def OAI.TraceReconstruction.prouhetQuotient line 501
  57. theorem OAI.TraceReconstruction.geomSeries_difference line 504
  58. theorem OAI.TraceReconstruction.geomSeries_L1_le line 508
  59. theorem OAI.TraceReconstruction.prouhetSeries_factor line 513
  60. theorem OAI.TraceReconstruction.prouhetQuotient_L1_le line 520
  61. theorem OAI.TraceReconstruction.prouhet_binomial_coeff_bound line 538

    Source documentation

    Prouhet smoothing in an explicit finite-trial form. The constants 2^(s*s) and (2 sqrt(2/(n+1)))^s are exp(O(s^2)) after assigning n = floor(g/(s+1)) trials to each group. No Fourier theorem or probabilistic estimate is assumed.

    theorem prouhet_binomial_coeff_bound (n s : ℕ) (z : ℤ) :
        |(prouhetSeries s * fairSeries ((s + 1) * n)).coeff z| ≤
          (2 : ℝ) ^ (s * s) * ((2 * binomialBound n) ^ s * binomialBound n) := by
    …

    Mentions: OAI.TraceReconstruction.prouhetSeries, OAI.TraceReconstruction.fairSeries, OAI.TraceReconstruction.binomialBound

  62. theorem OAI.TraceReconstruction.prouhet_binomial_L2Sq_bound line 546
  63. theorem OAI.TraceReconstruction.prouhet_binomial_coeff_bound_remainder line 559

    Source documentation

    Arbitrary trial counts are obtained by convolving with the independent unused trials; this cannot enlarge the coefficient or squared-L2 bounds.

    theorem prouhet_binomial_coeff_bound_remainder (n s r : ℕ) (z : ℤ) :
        |(prouhetSeries s * fairSeries ((s + 1) * n + r)).coeff z| ≤
          (2 : ℝ) ^ (s * s) * ((2 * binomialBound n) ^ s * binomialBound n) := by
    …

    Mentions: OAI.TraceReconstruction.prouhetSeries, OAI.TraceReconstruction.fairSeries, OAI.TraceReconstruction.binomialBound

  64. theorem OAI.TraceReconstruction.prouhet_binomial_L2Sq_bound_remainder line 567
  65. theorem OAI.TraceReconstruction.signed_binomial_smoothing line 577
  66. theorem OAI.TraceReconstruction.binomialBound_quotient_le line 592
  67. theorem OAI.TraceReconstruction.prouhetSeries_succ_coeff line 606
  68. theorem OAI.TraceReconstruction.prouhetSeries_coeff_spec line 618

    Source documentation

    The exact generating polynomial from the manuscript has unit signed coefficients at every index 0,...,2^s-1, and no other coefficients.

    theorem prouhetSeries_coeff_spec (s : ℕ) :
        (∀ z : ℤ, (z < 0 ∨ (2 ^ s : ℕ) ≤ z) → (prouhetSeries s).coeff z = 0) ∧
        (∀ z : ℤ, 0 ≤ z → z < (2 ^ s : ℕ) → |(prouhetSeries s).coeff z| = 1) := by
    …

    Mentions: OAI.TraceReconstruction.prouhetSeries

  69. def OAI.TraceReconstruction.binomialMass line 657
  70. theorem OAI.TraceReconstruction.binomialMass_nonneg line 660
  71. theorem OAI.TraceReconstruction.sum_binomialMass line 665
  72. theorem OAI.TraceReconstruction.binomialMass_harmonic_step line 675
  73. theorem OAI.TraceReconstruction.binomialMass_harmonic_identity line 686
  74. theorem OAI.TraceReconstruction.binomialMass_harmonic_le line 698
  75. theorem OAI.TraceReconstruction.weighted_sum_sq_le line 707

    Source documentation

    The weighted Cauchy--Schwarz step for mixing the fair estimates.

    theorem weighted_sum_sq_le {ι : Type*} (S : Finset ι) (w f : ι → ℝ)
        (hw : ∀ i, 0 ≤ w i) :
        (∑ i ∈ S, w i * f i) ^ 2 ≤ (∑ i ∈ S, w i) * ∑ i ∈ S, w i * f i ^ 2 := by
    …
  76. theorem OAI.TraceReconstruction.mixed_binomialBound_le line 717
  77. def OAI.TraceReconstruction.mixedFairSeries line 747
  78. def OAI.TraceReconstruction.biasedSeries line 750
  79. theorem OAI.TraceReconstruction.mixedFairSeries_expansion line 753
  80. theorem OAI.TraceReconstruction.mixedFairSeries_eq_biased line 765
  81. theorem OAI.TraceReconstruction.mixedFairSeries_coeff_bound line 775
  82. theorem OAI.TraceReconstruction.biasedSeries_coeff_bound_low line 792

    Source documentation

    At success probabilities at most 1/2, this gives the sharp variance scale up to an absolute constant, using only the fair-coin estimate.

    theorem biasedSeries_coeff_bound_low (n : ℕ) {p : ℝ}
        (hp : p ∈ Set.Ioc 0 (1 / 2)) (z : ℤ) :
        |(biasedSeries n p).coeff z| ≤ Real.sqrt (1 / (((n : ℝ) + 1) * p)) := by
    …

    Mentions: OAI.TraceReconstruction.biasedSeries

  83. theorem OAI.TraceReconstruction.biasedSeries_sum line 803
  84. theorem OAI.TraceReconstruction.biasedSeries_coeff_nat line 817
  85. theorem OAI.TraceReconstruction.biasedSeries_coeff_neg line 833
  86. theorem OAI.TraceReconstruction.biasedSeries_coeff_high line 841
  87. theorem OAI.TraceReconstruction.binomialMass_symm line 849
  88. theorem OAI.TraceReconstruction.biasedSeries_coeff_reflect line 855
  89. theorem OAI.TraceReconstruction.biasedSeries_coeff_bound line 872

    Source documentation

    Uniform nonfair-binomial anti-concentration. This is the absolute variance-scale upper bound used in the manuscript's rank kernels.

    theorem biasedSeries_coeff_bound (n : ℕ) {p : ℝ}
        (hp : p ∈ Set.Ioo 0 1) (z : ℤ) :
        |(biasedSeries n p).coeff z| ≤
          Real.sqrt (1 / (((n : ℝ) + 1) * p * (1 - p))) := by
    …

    Mentions: OAI.TraceReconstruction.biasedSeries

  90. theorem OAI.TraceReconstruction.binomialMass_mul_index line 893
  91. theorem OAI.TraceReconstruction.binomialMass_index_sum line 901
  92. theorem OAI.TraceReconstruction.binomialMass_mean line 913
  93. theorem OAI.TraceReconstruction.binomialMass_second_moment line 921
  94. theorem OAI.TraceReconstruction.binomialMass_variance line 938
  95. theorem OAI.TraceReconstruction.binomialMass_adjacent line 951
  96. theorem OAI.TraceReconstruction.binomialMass_le_mode line 963
  97. theorem OAI.TraceReconstruction.discrete_mode_lower line 1005

    Source documentation

    A discrete law cannot have a very small maximum when its variance is bounded. The explicit constant is deliberately loose, avoiding any use of Stirling.

    theorem discrete_mode_lower (n l : ℕ) (f : ℕ → ℝ) (M v : ℝ)
        (hf : ∀ k, 0 ≤ f k) (hsum : ∑ k ∈ Finset.range (n + 1), f k = 1)
        (hmax : ∀ k, f k ≤ M)
        (hvar : ∑ k ∈ Finset.range (n + 1), f k * ((k : ℝ) - l) ^ 2 = v)
        (hv : 1 ≤ v) : 1 / (12 * Real.sqrt v) ≤ M := by
    …
  98. theorem OAI.TraceReconstruction.binomialMass_mean_lower line 1062
  99. theorem OAI.TraceReconstruction.binomialMass_mean_inverse_sq line 1074
  100. theorem OAI.TraceReconstruction.seriesL1_smul line 1090
  101. theorem OAI.TraceReconstruction.mixedFairSeries_difference_L1_bound line 1096
  102. theorem OAI.TraceReconstruction.biasedSeries_difference_L1_bound_low line 1116
  103. theorem OAI.TraceReconstruction.biasedSeries_difference_reflect line 1130
  104. theorem OAI.TraceReconstruction.biasedSeries_difference_L1_reflect line 1146
  105. theorem OAI.TraceReconstruction.biasedSeries_difference_L1_bound line 1154
  106. def OAI.TraceReconstruction.biasedBinomialBound line 1175
  107. theorem OAI.TraceReconstruction.biasedSeries_L1 line 1178
  108. theorem OAI.TraceReconstruction.biasedSeries_L2Sq_bound line 1186
  109. theorem OAI.TraceReconstruction.biasedSeries_add line 1191
  110. theorem OAI.TraceReconstruction.biasedSeries_mul_power line 1195
  111. theorem OAI.TraceReconstruction.biased_difference_coeff_bound line 1201
  112. theorem OAI.TraceReconstruction.biased_difference_L2Sq_bound line 1210
  113. theorem OAI.TraceReconstruction.biased_difference_coeff_bound_remainder line 1223
  114. theorem OAI.TraceReconstruction.biased_difference_L2Sq_bound_remainder line 1232
  115. theorem OAI.TraceReconstruction.biased_difference_smoothing line 1245

    Source documentation

    All fixed-order nonfair binomial differences, at the exact variance scale. This is the analytic estimate needed for the initial conditional rank kernels.

    theorem biased_difference_smoothing (g s : ℕ) {p : ℝ} (hp : p ∈ Set.Ioo 0 1) :
        (∀ z : ℤ, |(firstDifference ^ s * biasedSeries g p).coeff z| ≤
          (2 * biasedBinomialBound (g / (s + 1)) p) ^ s *
            biasedBinomialBound (g / (s + 1)) p) ∧
        (seriesL2Sq (firstDifference ^ s * biasedSeries g p) ≤
          ((2 * biasedBinomialBound (g / (s + 1)) p) ^ s) ^ 2 *
            biasedBinomialBound (g / (s + 1)) p) := by
    …

    Mentions: OAI.TraceReconstruction.firstDifference, OAI.TraceReconstruction.biasedSeries, OAI.TraceReconstruction.biasedBinomialBound, OAI.TraceReconstruction.seriesL2Sq

  116. theorem OAI.TraceReconstruction.biasedBinomialBound_quotient_le line 1260
  117. theorem OAI.TraceReconstruction.binomialMass_tilt line 1282
  118. theorem OAI.TraceReconstruction.binomialMass_tilt_product line 1299
  119. theorem OAI.TraceReconstruction.binomial_overlap_tilt_bound line 1316

    Source documentation

    Tilting on opposite sides retains an anti-concentration factor as well as the Gaussian penalty for different numbers of trials.

    theorem binomial_overlap_tilt_bound (g h : ℕ) {p a : ℝ}
        (hp : p ∈ Set.Ioo 0 1) (ha : 0 < a) :
        (∑ k ∈ Finset.range (h + 1), binomialMass g p k * binomialMass h p k) ≤
          ((1 - p + p * a) ^ g * (1 - p + p / a) ^ h) *
            biasedBinomialBound g (p * a / (1 - p + p * a)) := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass, OAI.TraceReconstruction.biasedBinomialBound

  120. theorem OAI.TraceReconstruction.binomial_tilt_variance line 1346
  121. theorem OAI.TraceReconstruction.binomial_tilt_normalizer line 1366
  122. theorem OAI.TraceReconstruction.binomial_gaussian_overlap line 1424

    Source documentation

    The Gaussian cross-overlap estimate used by the conditional rank-kernel square-sum argument. The constant is absolute, also as p tends to one.

    theorem binomial_gaussian_overlap (g h : ℕ) {p : ℝ}
        (hp : p ∈ Set.Ico (1 / 2 : ℝ) 1) (hhg : h ≤ g) (hS : 0 < g + h) :
        (∑ k ∈ Finset.range (h + 1), binomialMass g p k * binomialMass h p k) ≤
          Real.sqrt (2 / (((g : ℝ) + 1) * p * (1 - p))) *
            Real.exp (-((g : ℝ) - h) ^ 2 / (16 * ((g : ℝ) + h))) := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass

  123. theorem OAI.TraceReconstruction.sqrt_times_gaussian_le line 1460
  124. theorem OAI.TraceReconstruction.sqrt_recip_product_le line 1472
  125. theorem OAI.TraceReconstruction.binomialMass_le_bound line 1481
  126. theorem OAI.TraceReconstruction.binomial_product_sup line 1489

    Source documentation

    A uniform product-supremum estimate, including very unequal trial counts. This justifies eliminating a largest gap in the rank kernel.

    theorem binomial_product_sup (g h k : ℕ) {p : ℝ}
        (hp : p ∈ Set.Ico (1 / 2 : ℝ) 1) :
        binomialMass g p k * binomialMass h p k ≤
          32 / (((g : ℝ) + 1) * p * (1 - p)) := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass

  127. theorem OAI.TraceReconstruction.binomialMass_mgf line 1553

    Source documentation

    Exact moment generating function, including both endpoint channels.

    theorem binomialMass_mgf (n : ℕ) (p t : ℝ) :
        (∑ k ∈ Finset.range (n + 1), binomialMass n p k * Real.exp (t * k)) =
          (1 - p + p * Real.exp t) ^ n := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass

  128. theorem OAI.TraceReconstruction.binomialMass_mgf_le line 1563
  129. theorem OAI.TraceReconstruction.finite_exp_markov line 1575

    Source documentation

    Exponential Markov bound for a finite nonnegative measure.

    theorem finite_exp_markov {α : Type*} (S : Finset α) (w X : α → ℝ)
        (hw : ∀ a ∈ S, 0 ≤ w a) (a t : ℝ) (ht : 0 ≤ t) :
        (∑ z ∈ S with a ≤ X z, w z) ≤
          Real.exp (-t * a) * ∑ z ∈ S, w z * Real.exp (t * X z) := by
    …
  130. theorem OAI.TraceReconstruction.binomialMass_lower_half line 1600

    Source documentation

    A uniform multiplicative lower tail, sufficient for hidden-flag counts.

    theorem binomialMass_lower_half (n : ℕ) {p : ℝ} (hp : p ∈ Set.Icc 0 1) :
        (∑ k ∈ (Finset.range (n + 1)).filter (fun k : ℕ => (k : ℝ) ≤ n * p / 2),
          binomialMass n p k) ≤ Real.exp (-(n : ℝ) * p / 12) := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass

  131. theorem OAI.TraceReconstruction.fairBinomial_centered_mgf line 1639
  132. theorem OAI.TraceReconstruction.fairBinomial_upper_tail line 1666
  133. def OAI.TraceReconstruction.hypergeomMass line 1688
  134. theorem OAI.TraceReconstruction.hypergeomMass_nonneg line 1691
  135. theorem OAI.TraceReconstruction.hypergeomMass_eq_binomial line 1695
  136. theorem OAI.TraceReconstruction.binomialMass_sq_upper line 1722
  137. theorem OAI.TraceReconstruction.hypergeomMass_sq_upper line 1732
  138. theorem OAI.TraceReconstruction.sum_hypergeomMass line 1756
  139. theorem OAI.TraceReconstruction.hypergeomMass_high line 1774
  140. theorem OAI.TraceReconstruction.hypergeom_hidden_adjacent line 1781

    Source documentation

    Adjacent-mass identity for the hidden count. The central regime has full support on 0,...,M; this is exactly the regime used in adjacent-power lifting.

    theorem hypergeom_hidden_adjacent (V M m k : ℕ) (hM : M ≤ m) (hV : m ≤ V) (hk : k < M) :
        (((k:ℝ)+1)*((V:ℝ)-m+k+1)) * hypergeomMass M V m (k+1) =
        (((M:ℝ)-k)*((m:ℝ)-k)) * hypergeomMass M V m k := by
    …

    Mentions: OAI.TraceReconstruction.hypergeomMass

  141. def OAI.TraceReconstruction.hypergeomHiddenMode line 1808
  142. theorem OAI.TraceReconstruction.hypergeomHiddenMode_le line 1810
  143. theorem OAI.TraceReconstruction.hypergeom_hidden_unimodal_left line 1819
  144. theorem OAI.TraceReconstruction.hypergeom_hidden_unimodal_right line 1835
  145. theorem OAI.TraceReconstruction.unimodal_variation line 1853

    Source documentation

    Exact total variation of a zero-extended unimodal sequence.

    theorem unimodal_variation (f : ℕ → ℝ) (n l : ℕ) (hl : l ≤ n+1)
        (hleft : ∀ k < l, f k ≤ f (k+1))
        (hright : ∀ k, l ≤ k → f (k+1) ≤ f k) (hz : f (n+1)=0) :
        f 0 + ∑ k ∈ Finset.range (n+1), |f (k+1)-f k| = 2*f l := by
    …
  146. theorem OAI.TraceReconstruction.hypergeom_hidden_variation line 1873
  147. theorem OAI.TraceReconstruction.choose_pred_weight line 1882
  148. theorem OAI.TraceReconstruction.choose_pred_weight_succ line 1890
  149. def OAI.TraceReconstruction.hypergeomHiddenFlux line 1896
  150. theorem OAI.TraceReconstruction.hypergeomHiddenFlux_formula line 1899
  151. theorem OAI.TraceReconstruction.hypergeomHiddenFlux_high line 1927
  152. theorem OAI.TraceReconstruction.hypergeomHiddenFlux_boundary line 1931
  153. theorem OAI.TraceReconstruction.hypergeom_adjacent_hidden_difference line 1940
  154. theorem OAI.TraceReconstruction.hypergeom_next_zero line 1995
  155. def OAI.TraceReconstruction.adjacentHypergeomTV line 2015

    Source documentation

    Exact adjacent visible-count TV, expressed with complementary hidden counts. The shift by one is essential: the two totals are different.

    def adjacentHypergeomTV (V M m : ℕ) : ℝ :=
    …
  156. theorem OAI.TraceReconstruction.adjacentHypergeomTV_eq_flux line 2019
  157. theorem OAI.TraceReconstruction.adjacentHypergeomTV_le_mass line 2036
  158. def OAI.TraceReconstruction.bernoulliRelativeEntropy line 2051
  159. theorem OAI.TraceReconstruction.bernoulliRelativeEntropy_upper line 2054
  160. theorem OAI.TraceReconstruction.binomialMass_change_probability line 2066
  161. theorem OAI.TraceReconstruction.binomialMass_mean_change_probability line 2077
  162. theorem OAI.TraceReconstruction.binomialMass_local_lower line 2091

    Source documentation

    Uniform local binomial lower bound without Stirling. It applies at a count k by changing to the channel with mean exactly k.

    theorem binomialMass_local_lower (n k : ℕ) {θ p : ℝ}
        (hθ : θ ∈ Set.Ioo 0 1) (hp : p ∈ Set.Ioo 0 1)
        (hk : k ≤ n) (hmean : (n:ℝ)*θ = k) (hv : 1 ≤ (n:ℝ)*θ*(1-θ)) :
        Real.exp (-(n:ℝ)*(θ-p)^2/(p*(1-p))) /
          (12*Real.sqrt ((n:ℝ)*θ*(1-θ))) ≤ binomialMass n p k := by
    …

    Mentions: OAI.TraceReconstruction.binomialMass