-
Notifications
You must be signed in to change notification settings - Fork 5
/
DRC.lean
248 lines (235 loc) · 14.9 KB
/
DRC.lean
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
import LeanAPAP.Prereqs.Discrete.Convolution.Norm
import LeanAPAP.Prereqs.Discrete.LpNorm.Weighted
/-!
# Dependent Random Choice
-/
open Real Finset Fintype Function
open scoped BigOperators NNReal Pointwise
variable {G : Type*} [DecidableEq G] [Fintype G] [AddCommGroup G] {p : ℕ} {B₁ B₂ A : Finset G}
{ε δ : ℝ}
/-- Auxiliary definition for the Dependent Random Choice step. We intersect `B₁` and `B₂` with
`c p A s` for some `s`. -/
private def c (p : ℕ) (A : Finset G) (s : Fin p → G) : Finset G := univ.inf fun i ↦ s i +ᵥ A
private lemma lemma_0 (p : ℕ) (B₁ B₂ A : Finset G) (f : G → ℝ) :
∑ s, ⟪𝟭_[ℝ] (B₁ ∩ c p A s) ○ 𝟭 (B₂ ∩ c p A s), f⟫_[ℝ] =
(B₁.card * B₂.card) • ∑ x, (μ_[ℝ] B₁ ○ μ B₂) x * (𝟭 A ○ 𝟭 A) x ^ p * f x := by
simp_rw [mul_assoc]
simp only [l2Inner_eq_sum, RCLike.conj_to_real, mul_sum, sum_mul, smul_sum,
@sum_comm _ _ (Fin p → G), sum_dconv_mul, dconv_apply_sub, Fintype.sum_pow, map_indicate]
congr with b₁
congr with b₂
refine' Fintype.sum_equiv (Equiv.neg $ Fin p → G) _ _ fun s ↦ _
rw [←smul_mul_assoc, ←smul_mul_smul, card_smul_mu_apply, card_smul_mu_apply, indicate_inter_apply,
indicate_inter_apply, mul_mul_mul_comm, prod_mul_distrib]
simp [c, indicate_inf_apply, ←translate_indicate, sub_eq_add_neg, mul_assoc, add_comm]
private lemma sum_c (p : ℕ) (B A : Finset G) : ∑ s, (B ∩ c p A s).card = A.card ^ p * B.card := by
simp only [card_eq_sum_indicate, indicate_inter_apply, c, indicate_inf_apply, mul_sum, sum_mul,
sum_pow', @sum_comm G, Fintype.piFinset_univ, ←translate_indicate, translate_apply]
congr with x
exact Fintype.sum_equiv (Equiv.subLeft fun _ ↦ x) _ _ fun s ↦ mul_comm _ _
private lemma sum_cast_c (p : ℕ) (B A : Finset G) :
∑ s, ((B ∩ c p A s).card : ℝ) = A.card ^ p * B.card := by
rw [←Nat.cast_sum, sum_c]; norm_cast
/-- If `A` is nonempty, and `B₁` and `B₂` intersect, then the `μ B₁ ○ μ B₂`-weighted Lp norm of
`𝟭 A ○ 𝟭 A` is positive. -/
private lemma lpNorm_conv_pos (hp : p ≠ 0) (hB : (B₁ ∩ B₂).Nonempty) (hA : A.Nonempty) :
0 < ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p := by
rw [wlpNorm_pow_eq_sum]
refine sum_pos' (fun x _ ↦ smul_nonneg zero_le' $ by positivity)
⟨0, mem_univ _, smul_pos ?_ $ pow_pos ?_ _⟩
· rwa [pos_iff_ne_zero, ← Function.mem_support, support_dconv, support_mu, support_mu, ← coe_sub,
mem_coe, zero_mem_sub_iff, not_disjoint_iff_nonempty_inter] <;> exact mu_nonneg
· rw [norm_pos_iff, ←Function.mem_support, support_dconv, support_indicate]
exact hA.to_set.zero_mem_sub
all_goals exact indicate_nonneg -- positivity
· positivity
lemma drc (hp₂ : 2 ≤ p) (f : G → ℝ≥0) (hf : ∃ x, x ∈ B₁ - B₂ ∧ x ∈ A - A ∧ x ∈ f.support)
(hB : (B₁ ∩ B₂).Nonempty) (hA : A.Nonempty) :
∃ A₁, A₁ ⊆ B₁ ∧ ∃ A₂, A₂ ⊆ B₂ ∧
⟪μ_[ℝ] A₁ ○ μ A₂, (↑) ∘ f⟫_[ℝ] * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p
≤ 2 * ∑ x, (μ B₁ ○ μ B₂) x * (𝟭_[ℝ] A ○ 𝟭 A) x ^ p * f x ∧
(4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p)
≤ A₁.card / B₁.card ∧
(4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p)
≤ A₂.card / B₂.card := by
have := hB.mono inter_subset_left
have := hB.mono inter_subset_right
have hp₀ : p ≠ 0 := by positivity
have := lpNorm_conv_pos hp₀ hB hA
set M : ℝ :=
2 ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p * (sqrt B₁.card * sqrt B₂.card) / A.card ^ p
with hM_def
have hM : 0 < M := by rw [hM_def]; positivity
replace hf : 0 < ∑ x, (μ_[ℝ] B₁ ○ μ B₂) x * (𝟭 A ○ 𝟭 A) x ^ p * f x := by
have : 0 ≤ μ_[ℝ] B₁ ○ μ B₂ * (𝟭 A ○ 𝟭 A) ^ p * (↑) ∘ f :=
mul_nonneg (mul_nonneg (dconv_nonneg mu_nonneg mu_nonneg) $ pow_nonneg
(dconv_nonneg indicate_nonneg indicate_nonneg) _) fun _ ↦ by simp -- positivity
refine Fintype.sum_pos $ this.gt_iff_ne.2 $ support_nonempty_iff.1 ?_
simp only [support_comp_eq, Set.Nonempty, and_assoc, support_mul', support_dconv,
indicate_nonneg, mu_nonneg, support_indicate, support_mu, NNReal.coe_eq_zero, iff_self_iff,
forall_const, Set.mem_inter_iff, ←coe_sub, mem_coe, support_pow' _ hp₀, hf]
set A₁ := fun s ↦ B₁ ∩ c p A s
set A₂ := fun s ↦ B₂ ∩ c p A s
set g : (Fin p → G) → ℝ := fun s ↦ (A₁ s).card * (A₂ s).card with hg_def
have hg : ∀ s, 0 ≤ g s := fun s ↦ by rw [hg_def]; dsimp; positivity
have hgB : ∑ s, g s = B₁.card * B₂.card * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p := by
have hAdconv : 0 ≤ 𝟭_[ℝ] A ○ 𝟭 A := dconv_nonneg indicate_nonneg indicate_nonneg
simpa only [wlpNorm_pow_eq_sum hp₀, l2Inner_eq_sum, sum_dconv, sum_indicate, Pi.one_apply,
RCLike.inner_apply, RCLike.conj_to_real, norm_of_nonneg (hAdconv _), mul_one, nsmul_eq_mul,
Nat.cast_mul, ←hg_def, NNReal.smul_def, NNReal.coe_dconv, NNReal.coe_comp_mu]
using lemma_0 p B₁ B₂ A 1
suffices ∑ s, ⟪𝟭_[ℝ] (A₁ s) ○ 𝟭 (A₂ s), (↑) ∘ f⟫_[ℝ] * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p
< ∑ s, 𝟭 (univ.filter fun s ↦ M ^ 2 ≤ g s) s * g s *
(2 * ∑ x, (μ B₁ ○ μ B₂) x * (𝟭_[ℝ] A ○ 𝟭 A) x ^ p * f x) by
obtain ⟨s, -, hs⟩ := exists_lt_of_sum_lt this
refine ⟨_, inter_subset_left (s₂ := c p A s), _, inter_subset_left (s₂ := c p A s), ?_⟩
simp only [indicate_apply, mem_filter, mem_univ, true_and_iff, boole_mul] at hs
split_ifs at hs with h; swap
· simp only [zero_mul, l2Inner_eq_sum, Function.comp_apply, RCLike.inner_apply,
RCLike.conj_to_real] at hs
have : 0 ≤ 𝟭_[ℝ] (A₁ s) ○ 𝟭 (A₂ s) := dconv_nonneg indicate_nonneg indicate_nonneg
-- positivity
cases hs.not_le $ mul_nonneg (sum_nonneg fun x _ ↦ mul_nonneg (this _) $ by positivity) $ by
positivity
have : (4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p)
≤ (A₁ s).card / B₁.card * ((A₂ s).card / B₂.card) := by
rw [div_mul_div_comm, le_div_iff]
simpa [hg_def, hM_def, mul_pow, pow_mul', show (2 : ℝ) ^ 2 = 4 by norm_num,
mul_div_right_comm] using h
positivity
refine ⟨(lt_of_mul_lt_mul_left (hs.trans_eq' ?_) $ hg s).le, this.trans $ mul_le_of_le_one_right
?_ $ div_le_one_of_le ?_ ?_, this.trans $ mul_le_of_le_one_left ?_ $ div_le_one_of_le ?_ ?_⟩
· simp_rw [A₁, A₂, g, ←card_smul_mu, smul_dconv, dconv_smul, l2Inner_smul_left, star_trivial,
nsmul_eq_mul, mul_assoc]
any_goals positivity
all_goals exact Nat.cast_le.2 $ card_mono inter_subset_left
rw [←sum_mul, lemma_0, nsmul_eq_mul, Nat.cast_mul, ←sum_mul, mul_right_comm, ←hgB, mul_left_comm,
←mul_assoc]
simp only [indicate_apply, boole_mul, mem_filter, mem_univ, true_and_iff, ←sum_filter,
mul_lt_mul_right hf, Function.comp_apply]
by_cases h : ∀ s, g s ≠ 0 → M ^ 2 ≤ g s
· rw [←sum_filter_ne_zero (s := filter _ _), Finset.filter_comm,
filter_true_of_mem fun s hs ↦ h s (mem_filter.1 hs).2, ←sum_filter_ne_zero]
refine lt_mul_of_one_lt_left (sum_pos (fun s hs ↦ (h _ (mem_filter.1 hs).2).trans_lt' $
by positivity) ?_) one_lt_two
rw [←sum_filter_ne_zero] at hgB
exact nonempty_of_sum_ne_zero $ hgB.trans_ne $ by positivity
push_neg at h
obtain ⟨s, hs⟩ := h
suffices h : (2 : ℝ) * ∑ s with g s < M ^ 2, g s < ∑ s, g s by
refine (le_or_lt_of_add_le_add ?_).resolve_left h.not_le
simp_rw [←not_le, ←compl_filter, ←two_mul, ←mul_add, sum_compl_add_sum]
rfl
rw [←lt_div_iff' (zero_lt_two' ℝ), div_eq_inv_mul]
calc
∑ s with g s < M ^ 2, g s = ∑ s with g s < M ^ 2 ∧ g s ≠ 0, sqrt (g s) * sqrt (g s)
:= by simp_rw [mul_self_sqrt (hg _), ←filter_filter, sum_filter_ne_zero]
_ < ∑ s with g s < M ^ 2 ∧ g s ≠ 0, M * sqrt (g s)
:= sum_lt_sum_of_nonempty ⟨s, mem_filter.2 ⟨mem_univ _, hs.symm⟩⟩ ?_
_ ≤ ∑ s, M * sqrt (g s) := sum_le_univ_sum_of_nonneg fun s ↦ by positivity
_ = M * (∑ s, sqrt (A₁ s).card * sqrt (A₂ s).card)
:= by simp_rw [mul_sum, sqrt_mul $ Nat.cast_nonneg _]
_ ≤ M * (sqrt (∑ s, (A₁ s).card) * sqrt (∑ s, (A₂ s).card))
:= mul_le_mul_of_nonneg_left
(sum_sqrt_mul_sqrt_le _ fun i ↦ by positivity fun i ↦ by positivity) hM.le
_ = _ := ?_
· simp only [mem_filter, mem_univ, true_and_iff, Nat.cast_nonneg, and_imp]
exact fun s hsM hs ↦ mul_lt_mul_of_pos_right ((sqrt_lt' hM).2 hsM) $
sqrt_pos.2 $ (hg _).lt_of_ne' hs
rw [sum_cast_c, sum_cast_c, sqrt_mul', sqrt_mul', mul_mul_mul_comm (sqrt _), mul_self_sqrt,
←mul_assoc, hM_def, div_mul_cancel₀, ←sqrt_mul, mul_assoc, mul_self_sqrt, hgB, mul_right_comm,
mul_assoc]
all_goals positivity
noncomputable def s (p : ℝ≥0) (ε : ℝ) (B₁ B₂ A : Finset G) : Finset G :=
univ.filter fun x ↦ (1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] < (𝟭 A ○ 𝟭 A) x
@[simp]
lemma mem_s {p : ℝ≥0} {ε : ℝ} {B₁ B₂ A : Finset G} {x : G} :
x ∈ s p ε B₁ B₂ A ↔ (1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] < (𝟭 A ○ 𝟭 A) x := by simp [s]
--TODO: When `1 < ε`, the result is trivial since `S = univ`.
lemma sifting (B₁ B₂ : Finset G) (hε : 0 < ε) (hε₁ : ε ≤ 1) (hδ : 0 < δ) (hp : Even p)
(hp₂ : 2 ≤ p) (hpε : ε⁻¹ * log (2 / δ) ≤ p) (hB : (B₁ ∩ B₂).Nonempty) (hA : A.Nonempty)
(hf : ∃ x, x ∈ B₁ - B₂ ∧ x ∈ A - A ∧ x ∉ s p ε B₁ B₂ A) :
∃ A₁, A₁ ⊆ B₁ ∧ ∃ A₂, A₂ ⊆ B₂ ∧ 1 - δ ≤ ∑ x in s p ε B₁ B₂ A, (μ A₁ ○ μ A₂) x ∧
(4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p) ≤
A₁.card / B₁.card ∧
(4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p) ≤
A₂.card / B₂.card := by
obtain ⟨A₁, hAB₁, A₂, hAB₂, h, hcard₁, hcard₂⟩ :=
drc hp₂ (𝟭 (s p ε B₁ B₂ A)ᶜ)
(by simpa only [support_indicate, coe_compl, Set.mem_compl_iff, mem_coe]) hB hA
refine ⟨A₁, hAB₁, A₂, hAB₂, ?_, hcard₁, hcard₂⟩
have hp₀ : 0 < p := by positivity
have aux :
∀ (c : Finset G) (r),
(4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / A.card ^ (2 * p) ≤ c.card / r →
c.Nonempty := by
simp_rw [nonempty_iff_ne_empty]
rintro c r h rfl
simp [pow_mul', (zero_lt_four' ℝ).not_le, inv_mul_le_iff (zero_lt_four' ℝ), mul_assoc,
div_nonpos_iff, mul_nonpos_iff, (pow_pos (lpNorm_conv_pos hp₀.ne' hB hA) 2).not_le] at h
norm_cast at h
simp [hp₀, hA.ne_empty] at h
have hA₁ : A₁.Nonempty := aux _ _ hcard₁
have hA₂ : A₂.Nonempty := aux _ _ hcard₂
clear hcard₁ hcard₂ aux
rw [sub_le_comm]
calc
_ = ∑ x in (s p ε B₁ B₂ A)ᶜ, (μ A₁ ○ μ A₂) x := ?_
_ = ⟪μ_[ℝ] A₁ ○ μ A₂, (↑) ∘ 𝟭_[ℝ≥0] ((s (↑p) ε B₁ B₂ A)ᶜ)⟫_[ℝ] := by
simp [l2Inner_eq_sum, -mem_compl, -mem_s, apply_ite NNReal.toReal, indicate_apply]
_ ≤ _ := (le_div_iff $ lpNorm_conv_pos hp₀.ne' hB hA).2 h
_ ≤ _ := ?_
· simp_rw [sub_eq_iff_eq_add', sum_add_sum_compl, sum_dconv, map_mu]
rw [sum_mu _ hA₁, sum_mu _ hA₂, one_mul]
rw [div_le_iff (lpNorm_conv_pos hp₀.ne' hB hA), ←le_div_iff' (zero_lt_two' ℝ)]
simp only [apply_ite NNReal.toReal, indicate_apply, NNReal.coe_one, NNReal.coe_zero, mul_boole,
sum_ite_mem, univ_inter, mul_div_right_comm]
calc
∑ x in (s p ε B₁ B₂ A)ᶜ, (μ B₁ ○ μ B₂) x * (𝟭 A ○ 𝟭 A) x ^ p ≤
∑ x in (s p ε B₁ B₂ A)ᶜ,
(μ B₁ ○ μ B₂) x * ((1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂]) ^ p := by
gcongr with x hx
· exact dconv_nonneg (β := ℝ) mu_nonneg mu_nonneg _
· exact dconv_nonneg indicate_nonneg indicate_nonneg _
· simpa using hx
_ ≤ ∑ x, (μ B₁ ○ μ B₂) x * ((1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂]) ^ p :=
sum_le_univ_sum_of_nonneg fun x ↦
mul_nonneg (dconv_nonneg (mu_nonneg (β := ℝ)) mu_nonneg _) $ hp.pow_nonneg _
_ = ‖μ_[ℝ] B₁‖_[1] * ‖μ_[ℝ] B₂‖_[1] * ((1 - ε) ^ p * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p)
:= ?_
_ ≤ _ :=
(mul_le_of_le_one_left (mul_nonneg (hp.pow_nonneg _) $ hp.pow_nonneg _) $
mul_le_one l1Norm_mu_le_one lpNorm_nonneg l1Norm_mu_le_one)
_ ≤ _ := mul_le_mul_of_nonneg_right ?_ $ hp.pow_nonneg _
· have : 0 ≤ μ_[ℝ] B₁ ○ μ B₂ := dconv_nonneg mu_nonneg mu_nonneg
simp_rw [←l1Norm_dconv mu_nonneg mu_nonneg, l1Norm_eq_sum, norm_of_nonneg (this _), sum_mul,
mul_pow]
calc
(1 - ε) ^ p ≤ exp (-ε) ^ p := pow_le_pow_left (sub_nonneg.2 hε₁) (one_sub_le_exp_neg _) _
_ = exp (-(ε * p)) := by rw [←neg_mul, exp_mul, rpow_natCast]
_ ≤ exp (-log (2 / δ)) :=
(exp_monotone $ neg_le_neg $ (inv_mul_le_iff $ by positivity).1 hpε)
_ = δ / 2 := by rw [exp_neg, exp_log, inv_div]; positivity
--TODO: When `1 < ε`, the result is trivial since `S = univ`.
/-- Special case of `sifting` when `B₁ = B₂ = univ`. -/
lemma sifting_cor (hε : 0 < ε) (hε₁ : ε ≤ 1) (hδ : 0 < δ) (hp : Even p) (hp₂ : 2 ≤ p)
(hpε : ε⁻¹ * log (2 / δ) ≤ p) (hA : A.Nonempty)
(hf : ∃ x, x ∈ A - A ∧ (𝟭 A ○ 𝟭 A) x ≤ (1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ univ]) :
∃ A₁ A₂, 1 - δ ≤ ∑ x in s p ε univ univ A, (μ A₁ ○ μ A₂) x ∧
(4 : ℝ)⁻¹ * (A.card / card G : ℝ) ^ (2 * p) ≤ A₁.card / card G ∧
(4 : ℝ)⁻¹ * (A.card / card G : ℝ) ^ (2 * p) ≤ A₂.card / card G := by
have hp₀ : p ≠ 0 := by positivity
have :
(4 : ℝ)⁻¹ * (A.card / card G) ^ (2 * p) ≤
4⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ univ] ^ (2 * p) / A.card ^ (2 * p) := by
rw [mul_div_assoc, ←div_pow]
refine mul_le_mul_of_nonneg_left (pow_le_pow_left (by positivity) ?_ _) (by norm_num)
rw [le_div_iff, ←mul_div_right_comm]
calc
_ = ‖𝟭_[ℝ] A ○ 𝟭 A‖_[1, μ univ] := by
simp [mu, wlpNorm_smul_right, hp₀, l1Norm_dconv, card_univ, inv_mul_eq_div]
_ ≤ _ := wlpNorm_mono_right (one_le_two.trans $ by norm_cast) _ _
· exact Nat.cast_pos.2 hA.card_pos
obtain ⟨A₁, -, A₂, -, h, hcard₁, hcard₂⟩ :=
sifting univ univ hε hε₁ hδ hp hp₂ hpε (by simp [univ_nonempty]) hA (by simpa)
exact ⟨A₁, A₂, h, this.trans $ by simpa using hcard₁, this.trans $ by simpa using hcard₂⟩