Skip to content

Commit

Permalink
Fresh start on di_in_ff
Browse files Browse the repository at this point in the history
  • Loading branch information
YaelDillies committed Sep 2, 2024
1 parent 3b8ec20 commit c185c8a
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 107 deletions.
1 change: 1 addition & 0 deletions LeanAPAP.lean
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import LeanAPAP.Prereqs.Expect.Complex
import LeanAPAP.Prereqs.FourierTransform.Compact
import LeanAPAP.Prereqs.FourierTransform.Discrete
import LeanAPAP.Prereqs.Function.Indicator.Basic
import LeanAPAP.Prereqs.Function.Indicator.Complex
import LeanAPAP.Prereqs.Function.Indicator.Defs
import LeanAPAP.Prereqs.Function.Translate
import LeanAPAP.Prereqs.LargeSpec
Expand Down
43 changes: 21 additions & 22 deletions LeanAPAP/FiniteField/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import LeanAPAP.Mathlib.Data.Finset.Preimage
import LeanAPAP.Prereqs.Convolution.ThreeAP
import LeanAPAP.Prereqs.LargeSpec
import LeanAPAP.Physics.AlmostPeriodicity
import LeanAPAP.Physics.DRC
import LeanAPAP.Physics.Unbalancing

/-!
Expand Down Expand Up @@ -122,36 +123,34 @@ lemma ap_in_ff (hS : S.Nonempty) (hα₀ : 0 < α) (hε₀ : 0 < ε) (hε₁ :
sorry

lemma di_in_ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hε₀ : 0 < ε) (hε₁ : ε < 1) (hαA : α ≤ A.dens)
(hA₀ : A.Nonempty)
(hγC : γ ≤ C.dens) (hγ : 0 < γ) (hAC : ε ≤ |card G * ⟪μ A ∗ μ A, μ C⟫_[ℝ] - 1|) :
∃ (V : Submodule (ZMod q) G) (_ : DecidablePred (· ∈ V)),
↑(finrank (ZMod q) G - finrank (ZMod q) V) ≤
2 ^ 171 * 𝓛 α ^ 4 * 𝓛 γ ^ 4 / ε ^ 24
(1 + ε / 32) * α ≤ ‖𝟭_[ℝ] A ∗ μ (Set.toFinset V)‖_[⊤] := by
obtain rfl | hA := A.eq_empty_or_nonempty
· stop
refine ⟨⊤, univ, _⟩
rw [AffineSubspace.direction_top]
simp only [AffineSubspace.top_coe, coe_univ, eq_self_iff_true, finrank_top, tsub_self,
Nat.cast_zero, indicate_empty, zero_mul, nnLpNorm_zero, true_and_iff,
Finset.card_empty, zero_div] at hαA ⊢
exact ⟨by positivity, mul_nonpos_of_nonneg_of_nonpos (by positivity) hαA⟩
have hγ₁ : γ ≤ 1 := hγC.trans (by norm_cast; exact dens_le_one)
have hG : (card G : ℝ) ≠ 0 := by positivity
have := unbalancing _ (mul_ne_zero two_ne_zero (Nat.ceil_pos.2 $ curlog_pos hγ.le hγ₁).ne') (ε / 2)
(by positivity) (div_le_one_of_le (hε₁.le.trans $ by norm_num) $ by norm_num)
(const _ (card G)⁻¹) (card G • (balance (μ A) ○ balance (μ A)))
(sqrt (card G) • balance (μ A)) (const _ (card G)⁻¹) ?_ ?_ ?_ ?_
let p : ℕ := 2 * ⌈𝓛 γ⌉₊
let p' : ℝ := 240 / ε * log (6 / ε) * p
let f : G → ℝ := balance (μ A)
have :=
calc
1 + ε / 4 = 1 + ε / 2 / 2 := by ring
_ ≤ _ :=
unbalancing _ (mul_ne_zero two_ne_zero (Nat.ceil_pos.2 $ curlog_pos hγ.le hγ₁).ne') (ε / 2)
(by positivity) (div_le_one_of_le (hε₁.le.trans $ by norm_num) $ by norm_num)
(card G • (balance (μ A) ○ balance (μ A))) (sqrt (card G) • balance (μ A))
(const _ (card G)⁻¹) ?_ ?_ ?_
_ = card G ^ (-(↑p')⁻¹ : ℝ) * ‖card G • (f ○ f) + 1‖_[.ofReal p'] := by
congr 3 <;> ring_nf; simp [hε₀.ne']; ring
let q : ℝ := 2 * ⌈p' + 2 ^ 8 * ε⁻¹ ^ 2 * log (64 / ε)⌉₊
-- have := sifting_cor (ε := ε / 16) (δ := ε / 32) (by positivity) (by linarith) (by positivity)
-- _ _ _ hA₀
rotate_left
· stop
ext a : 1
simp [smul_dconv, dconv_smul, smul_smul]
· ext a : 1
simp [smul_dconv, dconv_smul, smul_smul, ← mul_assoc, ← sq, ← Complex.ofReal_pow]
· simp [card_univ, show (card G : ℂ) ≠ 0 by sorry]
· simp only [comp_const, Nonneg.coe_inv, NNReal.coe_natCast]
unfold const
rw [dLpNorm_const one_ne_zero]
sorry
-- simp only [Nonneg.coe_one, inv_one, rpow_one, norm_inv, norm_coe_nat,
-- mul_inv_cancel₀ (show (card G : ℝ) ≠ 0 by positivity)]
· have hγ' : (1 : ℝ≥0) ≤ 2 * ⌈𝓛 γ⌉₊ := sorry
sorry
-- simpa [wLpNorm_nsmul hγ', ← nsmul_eq_mul, div_le_iff' (show (0 : ℝ) < card G by positivity),
Expand Down Expand Up @@ -211,7 +210,7 @@ theorem ff (hq₃ : 3 ≤ q) (hq : q.Prime) {A : Finset G} (hA₀ : A.Nonempty)
rw [abs_sub_comm, le_abs, le_sub_comm]
norm_num at hB' ⊢
exact .inl hB'.le
obtain ⟨V', _, hVV', hv'⟩ := di_in_ff hq₃ hq (by positivity) two_inv_lt_one le_rfl (by
obtain ⟨V', _, hVV', hv'⟩ := di_in_ff hq₃ hq (by positivity) two_inv_lt_one le_rfl sorry (by
rwa [Finset.dens_image (Nat.Coprime.nsmul_right_bijective _)]
simpa [card_eq_pow_finrank (K := ZMod q) (V := V), ZMod.card] using hq'.pow) hα₀ this
rw [dLinftyNorm_eq_iSup_norm, ← Finset.sup'_univ_eq_ciSup, Finset.le_sup'_iff] at hv'
Expand Down
2 changes: 1 addition & 1 deletion LeanAPAP/Physics/DRC.lean
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import LeanAPAP.Prereqs.Convolution.Discrete.Basic
import LeanAPAP.Prereqs.Convolution.Norm
import LeanAPAP.Prereqs.Convolution.Order
import LeanAPAP.Prereqs.Function.Indicator.Basic
import LeanAPAP.Prereqs.Function.Indicator.Complex
import LeanAPAP.Prereqs.LpNorm.Weighted

/-!
Expand Down
28 changes: 23 additions & 5 deletions LeanAPAP/Physics/Unbalancing.lean
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import LeanAPAP.Prereqs.LpNorm.Weighted
# Unbalancing
-/

open Finset Real MeasureTheory
open Finset hiding card
open Fintype (card)
open Function Real MeasureTheory
open scoped ComplexConjugate ComplexOrder NNReal ENNReal

variable {G : Type*} [Fintype G] [MeasurableSpace G] [DiscreteMeasurableSpace G] [DecidableEq G]
Expand Down Expand Up @@ -54,7 +56,7 @@ private lemma p'_pos (hp : 5 ≤ p) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1) : 0 <
have := log_ε_pos hε₀ hε₁; positivity

/-- Note that we do the physical proof in order to avoid the Fourier transform. -/
private lemma unbalancing' (p : ℕ) (hp : 5 ≤ p) (hp₁ : Odd p) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1)
private lemma unbalancing'' (p : ℕ) (hp : 5 ≤ p) (hp₁ : Odd p) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1)
(hf : (↑) ∘ f = g ○ g) (hν : (↑) ∘ ν = h ○ h) (hν₁ : ‖((↑) ∘ ν : G → ℝ)‖_[1] = 1)
(hε : ε ≤ ‖f‖_[p, ν]) :
1 + ε / 2 ≤ ‖f + 1‖_[.ofReal (24 / ε * log (3 / ε) * p), ν] := by
Expand Down Expand Up @@ -193,10 +195,10 @@ private lemma unbalancing' (p : ℕ) (hp : 5 ≤ p) (hp₁ : Odd p) (hε₀ : 0

/-- The unbalancing step. Note that we do the physical proof in order to avoid the Fourier
transform. -/
lemma unbalancing (p : ℕ) (hp : p ≠ 0) (ε : ℝ) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1) (ν : G → ℝ≥0)
lemma unbalancing' (p : ℕ) (hp : p ≠ 0) (ε : ℝ) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1) (ν : G → ℝ≥0)
(f : G → ℝ) (g h : G → ℂ) (hf : (↑) ∘ f = g ○ g) (hν : (↑) ∘ ν = h ○ h)
(hν₁ : ‖((↑) ∘ ν : G → ℝ)‖_[1] = 1) (hε : ε ≤ ‖f‖_[p, ν]) :
1 + ε / 2 ≤‖f + 1‖_[.ofReal (120 / ε * log (3 / ε) * p), ν] := by
1 + ε / 2 ‖f + 1‖_[.ofReal (120 / ε * log (3 / ε) * p), ν] := by
have := log_ε_pos hε₀ hε₁
have :=
calc
Expand All @@ -205,7 +207,7 @@ lemma unbalancing (p : ℕ) (hp : p ≠ 0) (ε : ℝ) (hε₀ : 0 < ε) (hε₁
:= add_le_add_right (mul_le_mul_left' (Nat.one_le_iff_ne_zero.2 hp) _) _
calc
_ ≤ ↑‖f + 1‖_[.ofReal (24 / ε * log (3 / ε) * ↑(2 * p + 3)), ν] :=
unbalancing' (2 * p + 3) this ((even_two_mul _).add_odd $ by decide) hε₀ hε₁ hf hν hν₁ $
unbalancing'' (2 * p + 3) this ((even_two_mul _).add_odd $ by decide) hε₀ hε₁ hf hν hν₁ $
hε.trans $
wLpNorm_mono_right
(Nat.cast_le.2 $ le_add_of_le_left $ le_mul_of_one_le_left' one_le_two) _ _
Expand All @@ -216,3 +218,19 @@ lemma unbalancing (p : ℕ) (hp : p ≠ 0) (ε : ℝ) (hε₀ : 0 < ε) (hε₁
_ = 24 / ε * log (3 / ε) * ↑(2 * p + 3 * 1) := by simp
_ ≤ 24 / ε * log (3 / ε) * ↑(2 * p + 3 * p) := by gcongr
_ = _ := by push_cast; ring

/-- The unbalancing step. Note that we do the physical proof in order to avoid the Fourier
transform. -/
lemma unbalancing (p : ℕ) (hp : p ≠ 0) (ε : ℝ) (hε₀ : 0 < ε) (hε₁ : ε ≤ 1) (f : G → ℝ) (g h : G → ℂ)
(hf : (↑) ∘ f = g ○ g) (hh : ∀ x, (h ○ h) x = (card G : ℝ)⁻¹)
(hε : ε ≤ (card G) ^ (-(↑p)⁻¹ : ℝ) * ‖f‖_[p]) :
1 + ε / 2 ≤ card G ^ (-(ε / 120 * (log (3 / ε))⁻¹ * (↑p)⁻¹)) *
‖f + 1‖_[.ofReal (120 / ε * log (3 / ε) * p)] :=
calc
1 + ε / 2 ≤ ‖f + 1‖_[.ofReal (120 / ε * log (3 / ε) * p), const _ (card G)⁻¹] :=
unbalancing' p hp ε hε₀ hε₁ _ _ g h hf (funext fun x ↦ (hh x).symm)
(by simp; simp [← const_def]) (by simpa [rpow_neg, inv_rpow] using hε)
_ ≤ _ := by
have : 0 ≤ log (3 / ε) := log_nonneg $ (one_le_div hε₀).2 (by linarith)
have : 0120 / ε * log (3 / ε) * p := by positivity
simp [*, inv_rpow, ← rpow_neg, -mul_inv_rev, mul_inv]
1 change: 1 addition & 0 deletions LeanAPAP/Prereqs/Energy.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import LeanAPAP.Prereqs.AddChar.Basic
import LeanAPAP.Prereqs.Convolution.Discrete.Basic
import LeanAPAP.Prereqs.Expect.Complex
import LeanAPAP.Prereqs.FourierTransform.Discrete
import LeanAPAP.Prereqs.Function.Indicator.Complex

noncomputable section

Expand Down
27 changes: 5 additions & 22 deletions LeanAPAP/Prereqs/Expect/Basic.lean
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import Mathlib.Algebra.BigOperators.Ring
import Mathlib.Algebra.Order.Module.Rat
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Algebra.Algebra.Field
import Mathlib.Algebra.Star.Order
import Mathlib.Analysis.CStarAlgebra.Basic
import Mathlib.Analysis.Normed.Operator.ContinuousLinearMap
import Mathlib.Data.Real.Sqrt
import Mathlib.Tactic.Positivity.Finset

/-!
Expand Down Expand Up @@ -480,27 +484,6 @@ lemma expect_eq_zero_iff_of_nonpos [Nonempty ι] (hf : f ≤ 0) : 𝔼 i, f i =
end OrderedAddCommMonoid
end Fintype

namespace RCLike
variable [RCLike α] [Fintype ι] (f : ι → ℝ) (a : ι)

@[simp, norm_cast]
lemma coe_balance : (↑(balance f a) : α) = balance ((↑) ∘ f) a := map_balance (algebraMap ℝ α) _ _

@[simp] lemma coe_comp_balance : ((↑) : ℝ → α) ∘ balance f = balance ((↑) ∘ f) :=
funext $ coe_balance _

end RCLike

section
variable {ι K E : Type*} [RCLike K] [NormedField E] [CharZero E] [NormedSpace K E]

include K in
@[bound]
lemma norm_expect_le {s : Finset ι} {f : ι → E} : ‖𝔼 i ∈ s, f i‖ ≤ 𝔼 i ∈ s, ‖f i‖ :=
s.le_expect_of_subadditive norm norm_zero norm_add_le (fun _ _ ↦ by rw [RCLike.norm_nnqsmul K]) f

end

open Finset

instance [Preorder α] [MulAction ℚ α] [PosSMulMono ℚ α] : PosSMulMono ℚ≥0 α where
Expand Down
41 changes: 35 additions & 6 deletions LeanAPAP/Prereqs/Expect/Complex.lean
Original file line number Diff line number Diff line change
@@ -1,31 +1,60 @@
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Data.Complex.Basic
import LeanAPAP.Prereqs.Expect.Basic

open Finset
open scoped BigOperators NNReal

section
variable {ι K E : Type*} [RCLike K] [NormedField E] [CharZero E] [NormedSpace K E]

include K in
@[bound]
lemma norm_expect_le {s : Finset ι} {f : ι → E} : ‖𝔼 i ∈ s, f i‖ ≤ 𝔼 i ∈ s, ‖f i‖ :=
s.le_expect_of_subadditive norm norm_zero norm_add_le (fun _ _ ↦ by rw [RCLike.norm_nnqsmul K]) f

end

namespace NNReal
variable {ι : Type*}

@[simp, norm_cast]
lemma coe_expect (s : Finset ι) (a : ι → ℝ≥0) : 𝔼 i ∈ s, a i = 𝔼 i ∈ s, (a i : ℝ) :=
map_expect toRealHom _ _
lemma coe_expect (s : Finset ι) (f : ι → ℝ≥0) : 𝔼 i ∈ s, f i = 𝔼 i ∈ s, (f i : ℝ) :=
map_expect toRealHom ..

end NNReal

namespace Complex
variable {ι : Type*}

@[simp, norm_cast]
lemma ofReal_expect (s : Finset ι) (a : ι → ℝ) : 𝔼 i ∈ s, a i = 𝔼 i ∈ s, (a i : ℂ) :=
map_expect ofReal _ _
lemma ofReal_expect (s : Finset ι) (f : ι → ℝ) : 𝔼 i ∈ s, f i = 𝔼 i ∈ s, (f i : ℂ) :=
map_expect ofReal ..

@[simp] lemma ofReal_comp_balance [Fintype ι] (f : ι → ℝ) :
ofReal ∘ balance f = balance (ofReal ∘ f) := by simp [balance]

@[simp] lemma ofReal'_comp_balance [Fintype ι] (f : ι → ℝ) :
ofReal' ∘ balance f = balance (ofReal' ∘ f) := ofReal_comp_balance _

end Complex

namespace RCLike
variable {ι 𝕜 : Type*} [RCLike 𝕜]

@[simp, norm_cast]
lemma coe_expect (s : Finset ι) (a : ι → ℝ) : 𝔼 i ∈ s, a i = 𝔼 i ∈ s, (a i : 𝕜) :=
map_expect (algebraMap _ _) _ _
lemma coe_expect (s : Finset ι) (f : ι → ℝ) : 𝔼 i ∈ s, f i = 𝔼 i ∈ s, (f i : 𝕜) :=
map_expect (algebraMap ..) ..

variable [Fintype ι] (f : ι → ℝ) (a : ι)

@[simp, norm_cast]
lemma coe_balance : (↑(balance f a) : 𝕜) = balance ((↑) ∘ f) a := map_balance (algebraMap ..) ..

@[simp] lemma coe_comp_balance : ((↑) : ℝ → 𝕜) ∘ balance f = balance ((↑) ∘ f) :=
funext $ coe_balance _

@[simp] lemma ofReal_comp_balance : ofReal ∘ balance f = balance (ofReal ∘ f : ι → 𝕜) := by
simp [balance]

end RCLike
73 changes: 73 additions & 0 deletions LeanAPAP/Prereqs/Function/Indicator/Complex.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import Mathlib.Analysis.RCLike.Basic
import Mathlib.Data.Complex.Basic
import Mathlib.Data.Complex.Module
import LeanAPAP.Prereqs.Function.Indicator.Defs

open Finset Function
open Fintype (card)
open scoped ComplexConjugate Pointwise NNRat

/-! ### Indicator -/

variable {ι α β γ : Type*} [DecidableEq α]

section Semiring
variable [Semiring β] [Semiring γ] {s : Finset α}

variable (β)
variable {β}
variable [StarRing β]

lemma indicate_isSelfAdjoint (s : Finset α) : IsSelfAdjoint (𝟭_[β] s) :=
Pi.isSelfAdjoint.2 fun g ↦ by rw [indicate]; split_ifs <;> simp

end Semiring

namespace NNReal
open scoped NNReal

@[simp, norm_cast] lemma coe_indicate (s : Finset α) (x : α) : ↑(𝟭_[ℝ≥0] s x) = 𝟭_[ℝ] s x :=
map_indicate NNReal.toRealHom _ _

@[simp] lemma coe_comp_indicate (s : Finset α) : (↑) ∘ 𝟭_[ℝ≥0] s = 𝟭_[ℝ] s := by
ext; exact coe_indicate _ _

end NNReal

namespace Complex

@[simp, norm_cast] lemma ofReal_indicate (s : Finset α) (x : α) : ↑(𝟭_[ℝ] s x) = 𝟭_[ℂ] s x :=
map_indicate ofReal _ _

@[simp] lemma ofReal_comp_indicate (s : Finset α) : (↑) ∘ 𝟭_[ℝ] s = 𝟭_[ℂ] s := by
ext; exact ofReal_indicate _ _

end Complex

/-! ### Normalised indicator -/

namespace Complex
variable (s : Finset α) (a : α)

@[simp, norm_cast] lemma ofReal_mu : ↑(μ_[ℝ] s a) = μ_[ℂ] s a := map_mu (algebraMap ℝ ℂ) ..
@[simp] lemma ofReal_comp_mu : (↑) ∘ μ_[ℝ] s = μ_[ℂ] s := funext $ ofReal_mu _

end Complex

namespace RCLike
variable {𝕜 : Type*} [RCLike 𝕜] (s : Finset α) (a : α)

@[simp, norm_cast] lemma coe_mu : ↑(μ_[ℝ] s a) = μ_[𝕜] s a := map_mu (algebraMap ℝ 𝕜) _ _
@[simp] lemma coe_comp_mu : (↑) ∘ μ_[ℝ] s = μ_[𝕜] s := funext $ coe_mu _

end RCLike

namespace NNReal
open scoped NNReal

@[simp, norm_cast]
lemma coe_mu (s : Finset α) (x : α) : ↑(μ_[ℝ≥0] s x) = μ_[ℝ] s x := map_mu NNReal.toRealHom _ _

@[simp] lemma coe_comp_mu (s : Finset α) : (↑) ∘ μ_[ℝ≥0] s = μ_[ℝ] s := funext $ coe_mu _

end NNReal
Loading

0 comments on commit c185c8a

Please sign in to comment.