Skip to content

Commit

Permalink
Bump mathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
YaelDillies committed Oct 27, 2024
1 parent 32ec426 commit e1ce4ec
Show file tree
Hide file tree
Showing 19 changed files with 313 additions and 343 deletions.
333 changes: 154 additions & 179 deletions LeanAPAP/Extras/BSG.lean

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions LeanAPAP/FiniteField.lean
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ lemma ap_in_ff (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε) (hε
_ ≤ 1 := by linarith
obtain ⟨T, hTcard, hTε⟩ := AlmostPeriodicity.linfty_almost_periodicity_boosted ε hε₀ hε₁ k
(by positivity) (le_inv_of_le_inv₀ (by positivity) hα₂) hA₁ univ_nonempty S A₂ hS hA₂
have hT : 0 < (T.card : ℝ) := hTcard.trans_lt' (by positivity)
have hT : 0 < (#T : ℝ) := hTcard.trans_lt' (by positivity)
replace hT : T.Nonempty := by simpa using hT
let Δ := largeSpec (μ T) 2⁻¹
let V : Submodule (ZMod q) G := AddSubgroup.toZModSubmodule _ $ ⨅ γ ∈ Δ, γ.toAddMonoidHom.ker
Expand All @@ -170,9 +170,9 @@ lemma ap_in_ff (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε) (hε
have hWV : W ≤ V := by sorry
have :=
calc
log T.dens⁻¹ ≤ log (α⁻¹ ^ (-4096 * ⌈𝓛 (min 1 (A₂.card / S.card))⌉ * k ^ 2 / ε ^ 2))⁻¹ := by
log T.dens⁻¹ ≤ log (α⁻¹ ^ (-4096 * ⌈𝓛 (min 1 (#A₂ / #S))⌉ * k ^ 2 / ε ^ 2))⁻¹ := by
gcongr; rwa [nnratCast_dens, le_div_iff₀]; positivity
_ = 2 ^ 12 * log α⁻¹ * ⌈𝓛 (min 1 (A₂.card / S.card))⌉ * k ^ 2 / ε ^ 2 := by
_ = 2 ^ 12 * log α⁻¹ * ⌈𝓛 (min 1 (#A₂ / #S))⌉ * k ^ 2 / ε ^ 2 := by
rw [log_inv, log_rpow (by positivity)]; ring_nf
_ ≤ 2 ^ 12 * log α⁻¹ * ⌈𝓛 (min 1 A₂.dens)⌉ * k ^ 2 / ε ^ 2 := by
rw [nnratCast_dens, ← card_univ]; gcongr; exact S.subset_univ
Expand All @@ -194,7 +194,7 @@ lemma ap_in_ff (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε) (hε
(↑(finrank (ZMod q) G - finrank (ZMod q) V) : ℝ)
≤ ↑(finrank (ZMod q) G - finrank (ZMod q) W) := by
gcongr; exact Submodule.finrank_mono hWV
_ ≤ Δ'.card := sorry
_ ≤ #Δ' := sorry
_ ≤ ⌈changConst * exp 1 * ⌈𝓛 ↑(‖μ T‖_[1] ^ 2 / ‖μ T‖_[2] ^ 2 / card G)⌉₊ / 2⁻¹ ^ 2⌉₊ := by
gcongr
_ = ⌈2 ^ 7 * exp 1 ^ 2 * ⌈𝓛 T.dens⌉₊⌉₊ := by
Expand Down
2 changes: 1 addition & 1 deletion LeanAPAP/Integer.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import Mathlib.Combinatorics.Additive.AP.Three.Defs
open Finset Real

theorem int {A : Finset ℕ} {N : ℕ} (hAN : A ⊆ range N) (hA : ThreeAPFree (α := ℕ) A) :
∃ c > 0, A.card ≤ N / exp (- c * log N ^ (12⁻¹ : ℝ)) := sorry
∃ c > 0, #A ≤ N / exp (- c * log N ^ (12⁻¹ : ℝ)) := sorry
113 changes: 55 additions & 58 deletions LeanAPAP/Physics/AlmostPeriodicity.lean

Large diffs are not rendered by default.

64 changes: 31 additions & 33 deletions LeanAPAP/Physics/DRC.lean
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private def c (p : ℕ) (A : Finset G) (s : Fin p → G) : Finset G := univ.inf

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
(#B₁ * #B₂) • ∑ x, (μ_[ℝ] B₁ ○ μ B₂) x * (𝟭 A ○ 𝟭 A) x ^ p * f x := by
simp_rw [mul_assoc]
simp only [wInner_one_eq_sum, inner_apply, 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]
Expand All @@ -31,20 +31,20 @@ private lemma lemma_0 (p : ℕ) (B₁ B₂ A : Finset G) (f : G → ℝ) :
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
private lemma sum_c (p : ℕ) (B A : Finset G) : ∑ s, #(B ∩ c p A s) = #A ^ p * #B := 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
∑ s, (#(B ∩ c p A s) : ℝ) = #A ^ p * #B := by
rw [← Nat.cast_sum, sum_c]; norm_cast

variable [MeasurableSpace G]

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
{x | (1 - ε) * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] < (𝟭 A ○ 𝟭 A) x}

@[simp]
lemma mem_s {p : ℝ≥0} {ε : ℝ} {B₁ B₂ A : Finset G} {x : G} :
Expand Down Expand Up @@ -76,16 +76,16 @@ lemma drc (hp₂ : 2 ≤ p) (f : G → ℝ≥0) (hf : ∃ x, x ∈ B₁ - B₂
∃ 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
(4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p)
#A₁ / #B₁
(4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p)
#A₂ / #B₂ := by
have := hB.mono inter_subset_left
have := hB.mono inter_subset_right
have hp₀ : p ≠ 0 := by positivity
have := dLpNorm_conv_pos hp₀ hB hA
set M : ℝ :=
2 ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p * (sqrt B₁.card * sqrt B₂.card) / A.card ^ p
2 ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p * (sqrt #B₁ * sqrt #B₂) / #A ^ 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
Expand All @@ -98,16 +98,16 @@ lemma drc (hp₂ : 2 ≤ p) (f : G → ℝ≥0) (hf : ∃ x, x ∈ B₁ - B₂
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
set g : (Fin p → G) → ℝ := fun s ↦ #(A₁ s) * #(A₂ s) 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 hgB : ∑ s, g s = #B₁ * #B₂ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ p := by
have hAdconv : 0 ≤ 𝟭_[ℝ] A ○ 𝟭 A := dconv_nonneg indicate_nonneg indicate_nonneg
simpa only [wLpNorm_pow_eq_sum_norm hp₀, wInner_one_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 *
< ∑ s, 𝟭 ({s | M ^ 2 ≤ g s} : Finset _) 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), ?_⟩
Expand All @@ -119,8 +119,8 @@ lemma drc (hp₂ : 2 ≤ p) (f : G → ℝ≥0) (hf : ∃ x, x ∈ B₁ - B₂
-- 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
have : (4 : ℝ) ⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p)
#(A₁ s) / #B₁ * (#(A₂ s) / #B₂) := by
rw [div_mul_div_comm, le_div_iff₀]
simpa [hg_def, hM_def, mul_pow, div_pow, pow_mul', show (2 : ℝ) ^ 2 = 4 by norm_num,
mul_div_right_comm] using h
Expand Down Expand Up @@ -152,15 +152,14 @@ lemma drc (hp₂ : 2 ≤ p) (f : G → ℝ≥0) (hf : ∃ x, x ∈ B₁ - B₂
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
_ = _ := ?_
_ < ∑ 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) * sqrt #(A₂ s))
:= by simp_rw [mul_sum, sqrt_mul $ Nat.cast_nonneg _]
_ ≤ M * (sqrt (∑ s, #(A₁ s)) * sqrt (∑ s, #(A₂ s))) := by
gcongr; exact sum_sqrt_mul_sqrt_le _ fun i ↦ by positivity fun i ↦ by positivity
_ = _ := ?_
· simp only [mem_filter, mem_univ, true_and, 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
Expand All @@ -174,21 +173,20 @@ lemma sifting (B₁ B₂ : Finset G) (hε : 0 < ε) (hε₁ : ε ≤ 1) (hδ : 0
(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
(4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p) ≤
#A₁ / #B₁
(4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p) ≤
#A₂ / #B₂ := 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
have aux (c : Finset G) (r)
(h : (4 : ℝ)⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ B₁ ○ μ B₂] ^ (2 * p) / #A ^ (2 * p) ≤ #c / r) :
c.Nonempty := by
simp_rw [nonempty_iff_ne_empty]
rintro c r h rfl
rintro 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 (dLpNorm_conv_pos hp₀.ne' hB hA) 2).not_le] at h
norm_cast at h
Expand Down Expand Up @@ -247,7 +245,7 @@ lemma sifting_cor (hε : 0 < ε) (hε₁ : ε ≤ 1) (hδ : 0 < δ) (hp : Even p
· have hp₀ : p ≠ 0 := by positivity
have :
(4 : ℝ)⁻¹ * A.dens ^ (2 * p) ≤
4⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ univ] ^ (2 * p) / A.card ^ (2 * p) := by
4⁻¹ * ‖𝟭_[ℝ] A ○ 𝟭 A‖_[p, μ univ] ^ (2 * p) / #A ^ (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 [nnratCast_dens, le_div_iff₀, ← mul_div_right_comm]
Expand Down
6 changes: 3 additions & 3 deletions LeanAPAP/Physics/Unbalancing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lemma pow_inner_nonneg' {f : G → ℂ} (hf : g ○ g = f) (hν : h ○ h = (↑
simp only [WithLp.equiv_symm_pi_apply, Pi.pow_apply, RCLike.inner_apply, map_pow]
simp_rw [dconv_apply h, mul_sum]
--TODO: Please make `conv` work here :(
have : ∀ x, ∀ yz ∈ univ.filter fun yz : G × G yz.1 - yz.2 = x,
have : ∀ x, ∀ yz ∈ ({yz : G × G | yz.1 - yz.2 = x} : Finset _),
conj ((g ○ g) x) ^ k * (h yz.1 * conj (h yz.2)) =
conj ((g ○ g) (yz.1 - yz.2)) ^ k * (h yz.1 * conj (h yz.2)) := by
simp only [mem_filter, mem_univ, true_and]
Expand Down Expand Up @@ -100,8 +100,8 @@ private lemma unbalancing'' (p : ℕ) (hp : 5 ≤ p) (hp₁ : Odd p) (hε₀ : 0
pow_sub_one_mul hp₁.pos.ne', NNReal.smul_def, smul_eq_mul]
· simp [wInner_one_eq_sum, ← sum_add_distrib, ← mul_add, ← pow_sub_one_mul hp₁.pos.ne' (f _),
mul_sum, mul_left_comm (2 : ℝ), add_abs_eq_two_nsmul_posPart]
set P := univ.filter fun i ↦ 0 ≤ f i
set T := univ.filter fun i ↦ 3 / 4 * ε ≤ f i
set P : Finset _ := {i | 0 ≤ f i}
set T : Finset _ := {i | 3 / 4 * ε ≤ f i}
have hTP : T ⊆ P := monotone_filter_right _ fun i ↦ le_trans $ by positivity
have : 2⁻¹ * ε ^ p ≤ ∑ i in P, ↑(ν i) * (f ^ p) i := by
rw [inv_mul_le_iff₀ (zero_lt_two' ℝ), sum_filter]
Expand Down
2 changes: 1 addition & 1 deletion LeanAPAP/Prereqs/AddChar/PontryaginDuality.lean
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def mkZModAux {ι : Type} [DecidableEq ι] (n : ι → ℕ) (u : ∀ i, ZMod (n

lemma mkZModAux_injective {ι : Type} [DecidableEq ι] {n : ι → ℕ} (hn : ∀ i, n i ≠ 0) :
Injective (mkZModAux n) :=
AddChar.directSum_injective.comp fun f g h ↦ by simpa [Function.funext_iff, hn] using h
AddChar.directSum_injective.comp fun f g h ↦ by simpa [funext_iff, hn] using h

/-- The circle-valued characters of a finite abelian group are the same as its complex-valued
characters. -/
Expand Down
6 changes: 3 additions & 3 deletions LeanAPAP/Prereqs/Bohr/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Mathlib.Analysis.Complex.Basic
import LeanAPAP.Prereqs.AddChar.PontryaginDuality

open AddChar Function
open scoped NNReal ENNReal
open scoped NNReal ENNReal Finset

/-- A *Bohr set* `B` on an additive group `G` is a finite set of characters of `G`, called the
*frequencies*, along with an extended non-negative real number for each frequency `ψ`, called the
Expand Down Expand Up @@ -233,9 +233,9 @@ noncomputable instance [Finite G] : CompletelyDistribLattice (BohrSet G) :=
/-! ### Width, frequencies, rank -/

/-- The rank of a Bohr set is the number of characters which have finite width. -/
def rank (B : BohrSet G) : ℕ := B.frequencies.card
def rank (B : BohrSet G) : ℕ := #B.frequencies

@[simp] lemma card_frequencies (B : BohrSet G) : B.frequencies.card = B.rank := rfl
@[simp] lemma card_frequencies (B : BohrSet G) : #B.frequencies = B.rank := rfl

/-! ### Dilation -/

Expand Down
20 changes: 10 additions & 10 deletions LeanAPAP/Prereqs/Chang.lean
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ end Mathlib.Meta.Positivity

lemma AddDissociated.boringEnergy_le [DecidableEq G] {s : Finset G}
(hs : AddDissociated (s : Set G)) (n : ℕ) :
boringEnergy n s ≤ changConst ^ n * n ^ n * s.card ^ n := by
boringEnergy n s ≤ changConst ^ n * n ^ n * #s ^ n := by
obtain rfl | hn := eq_or_ne n 0
· simp
calc
Expand Down Expand Up @@ -87,14 +87,14 @@ private lemma α_le_one (f : G → ℂ) : ‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / ca

lemma general_hoelder (hη : 0 ≤ η) (ν : G → ℝ≥0) (hfν : ∀ x, f x ≠ 01 ≤ ν x)
(hΔ : Δ ⊆ largeSpec f η) (hm : m ≠ 0) :
↑Δ.card ^ (2 * m) * (η ^ (2 * m) * (‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2)) ≤
^ (2 * m) * (η ^ (2 * m) * (‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2)) ≤
energy m Δ (dft fun a ↦ ν a) := by
obtain rfl | hf := eq_or_ne f 0
· simp
choose c norm_c hc using fun γ ↦ RCLike.exists_norm_eq_mul_self (dft f γ)
have :=
calc
η * ‖f‖_[1] * Δ.card ≤ ∑ γ in Δ, ‖dft f γ‖ := ?_
η * ‖f‖_[1] * ≤ ∑ γ in Δ, ‖dft f γ‖ := ?_
_ ≤ ‖∑ x, f x * ∑ γ in Δ, c γ * conj (γ x)‖ := ?_
_ ≤ ∑ x, ‖f x * ∑ γ in Δ, c γ * conj (γ x)‖ := (norm_sum_le _ _)
_ = ∑ x, ‖f x‖ * ‖∑ γ in Δ, c γ * conj (γ x)‖ := by simp_rw [norm_mul]
Expand Down Expand Up @@ -156,7 +156,7 @@ lemma general_hoelder (hη : 0 ≤ η) (ν : G → ℝ≥0) (hfν : ∀ x, f x
open scoped ComplexOrder

lemma spec_hoelder (hη : 0 ≤ η) (hΔ : Δ ⊆ largeSpec f η) (hm : m ≠ 0) :
Δ.card ^ (2 * m) * (η ^ (2 * m) * (‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / card G)) ≤ boringEnergy m Δ := by
^ (2 * m) * (η ^ (2 * m) * (‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / card G)) ≤ boringEnergy m Δ := by
have hG : (0 : ℝ) < card G := by positivity
simpa [boringEnergy, mul_assoc, ← Pi.one_def, ← mul_div_right_comm, ← mul_div_assoc,
div_le_iff₀ hG, energy_nsmul, -nsmul_eq_mul, ← nsmul_eq_mul'] using
Expand All @@ -165,27 +165,27 @@ lemma spec_hoelder (hη : 0 ≤ η) (hΔ : Δ ⊆ largeSpec f η) (hm : m ≠ 0)
/-- **Chang's lemma**. -/
lemma chang (hf : f ≠ 0) (hη : 0 < η) :
∃ Δ, Δ ⊆ largeSpec f η ∧
Δ.card ≤ ⌈changConst * exp 1 * ⌈𝓛 ↑(‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / card G)⌉₊ / η ^ 2⌉₊ ∧
≤ ⌈changConst * exp 1 * ⌈𝓛 ↑(‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / card G)⌉₊ / η ^ 2⌉₊ ∧
largeSpec f η ⊆ Δ.addSpan := by
refine exists_subset_addSpan_card_le_of_forall_addDissociated fun Δ hΔη hΔ ↦ ?_
obtain hΔ' | hΔ' := @eq_zero_or_pos _ _ Δ.card
obtain hΔ' | hΔ' := @eq_zero_or_pos _ _
· simp [hΔ']
let α := ‖f‖_[1] ^ 2 / ‖f‖_[2] ^ 2 / card G
have : 0 < α := by positivity
set β := ⌈𝓛 α⌉₊
have hβ : 0 < β := Nat.ceil_pos.2 (curlog_pos (by positivity) $ α_le_one _)
have : 0 < ‖f‖_[1] := by positivity
refine le_of_pow_le_pow_left hβ.ne' zero_le' $ Nat.cast_le.1 $ le_of_mul_le_mul_right ?_
(by positivity : 0 < Δ.card ^ β * (η ^ (2 * β) * α))
(by positivity : 0 < ^ β * (η ^ (2 * β) * α))
push_cast
rw [← mul_assoc, ← pow_add, ← two_mul]
refine ((spec_hoelder hη.le hΔη hβ.ne').trans $ hΔ.boringEnergy_le _).trans ?_
refine le_trans ?_ $ mul_le_mul_of_nonneg_right (pow_le_pow_left ?_ (Nat.le_ceil _) _) ?_
rw [mul_right_comm, div_pow, mul_pow, mul_pow, exp_one_pow, ← pow_mul, mul_div_assoc]
calc
_ = (changConst * Δ.card * β) ^ β := by ring
_ ≤ (changConst * Δ.card * β) ^ β * (α * exp β) := ?_
_ ≤ (changConst * Δ.card * β) ^ β * ((η / η) ^ (2 * β) * α * exp β) := by
_ = (changConst * * β) ^ β := by ring
_ ≤ (changConst * * β) ^ β * (α * exp β) := ?_
_ ≤ (changConst * * β) ^ β * ((η / η) ^ (2 * β) * α * exp β) := by
rw [div_self hη.ne', one_pow, one_mul]
_ = _ := by ring
refine le_mul_of_one_le_right (by positivity) ?_
Expand Down
Loading

0 comments on commit e1ce4ec

Please sign in to comment.