import Mathlib import OAI.NumberTheory.CubicGram.CubicOperator namespace OAI /-! Primary cube decomposition and finite operator block bounds. -/ section noncomputable section open scoped BigOperators ContDiff open Set Filter MeasureTheory Topology attribute [local instance] Classical.propDecidable namespace CubicFirstMoment lemma primary_of_primary_mul_left {a b : Eisenstein} (ha : primary a) (hab : primary (a*b)) : primary b := by rw [primary_iff_residue_one] at ha hab ⊢ simpa only [map_mul, ha, one_mul] using hab theorem primary_cube_decomposition {n : Eisenstein} (hn : primary n) : ∃ s t c : Eisenstein, primary s ∧ primary t ∧ primary c ∧ Squarefree s ∧ Squarefree t ∧ IsCoprime s t ∧ n = s*t^2*c^3 := by apply primary_induction (b := n) ?_ ?_ hn · refine ⟨1,1,1,?_,?_,?_,squarefree_one,squarefree_one,isCoprime_one_left,?_⟩ <;> simp [primary] · intro p b hp hb ih obtain ⟨s,t,c,hs,ht,hc,hss,hst,hcop,rfl⟩ := ih by_cases hps : p ∣ s · obtain ⟨s',rfl⟩ := hps have hs' := primary_of_primary_mul_left hp.1 hs have hps' : IsCoprime p s' := isRelPrime_iff_isCoprime.mp (squarefree_mul_iff.mp hss).1 have hpt : IsCoprime p t := hcop.of_mul_left_left refine ⟨s',p*t,c,hs',primary_mul hp.1 ht,hc,hss.of_mul_right, squarefree_mul_iff.mpr ⟨hpt.isRelPrime,hp.2.squarefree,hst⟩, hps'.symm.mul_right hcop.of_mul_left_right,?_⟩ ring · by_cases hpt : p ∣ t · obtain ⟨t',rfl⟩ := hpt refine ⟨s,t',p*c,hs,primary_of_primary_mul_left hp.1 ht,primary_mul hp.1 hc, hss,hst.of_mul_right,hcop.of_mul_right_right,?_⟩ ring · have hps' := hp.2.coprime_iff_not_dvd.mpr hps have hpt' := hp.2.coprime_iff_not_dvd.mpr hpt refine ⟨p*s,t,c,primary_mul hp.1 hs,ht,hc, squarefree_mul_iff.mpr ⟨hps'.isRelPrime,hp.2.squarefree,hss⟩, hst,hpt'.mul_left hcop,?_⟩ ring lemma cubicSymbol_pow_upper {p : Eisenstein} (hp : primary p) (a : Eisenstein) (k : ℕ) : cubicSymbol p (a^k) = cubicSymbol p a ^ k := by induction k with | zero => simp only [pow_zero] apply primary_induction (b := p) ?_ ?_ hp · exact cubicSymbol_one_lower 1 · intro q b hq hb ih rw [cubicSymbol_mul_lower hq.2.ne_zero (primary_ne_zero hb), cubicSymbol_prime hq, cubicSymbolAtPrime_one hq, ih, one_mul] | succ k ih => rw [pow_succ, cubicSymbol_mul_upper hp, ih, pow_succ] lemma finiteCubicBound_twist_controls_mass (P S : Finset Eisenstein) (u z : Eisenstein → ℂ) (hz : ∀ b ∈ P, ‖z b‖ ≤ 1) : (∑ s ∈ S, ‖∑ b ∈ P, u b*z b*cubicSymbol b s‖^2) ≤ finiteCubicBound P S * ∑ b ∈ P, ‖u b‖^2 := by apply (finiteCubicBound_controls_mass P S (fun b => u b*z b)).trans apply mul_le_mul_of_nonneg_left _ (finiteCubicBound_nonneg _ _) apply Finset.sum_le_sum intro b hb rw [norm_mul, mul_pow] exact mul_le_of_le_one_right (sq_nonneg _) (by simpa using pow_le_pow_left₀ (_root_.norm_nonneg _) (hz b hb) 2) lemma finiteCubicBound_twist_conjugate_mass (P S : Finset Eisenstein) (u z : Eisenstein → ℂ) (hz : ∀ b ∈ P, ‖z b‖ ≤ 1) : (∑ s ∈ S, ‖∑ b ∈ P, u b*z b*star (cubicSymbol b s)‖^2) ≤ finiteCubicBound P S * ∑ b ∈ P, ‖u b‖^2 := by have h := finiteCubicBound_twist_controls_mass P S (fun b => star (u b)) (fun b => star (z b)) (fun b hb => by simpa using hz b hb) have he (s : Eisenstein) : (∑ b ∈ P, u b*z b*star (cubicSymbol b s)) = star (∑ b ∈ P, star (u b)*star (z b)*cubicSymbol b s) := by simp [star_sum, star_mul, mul_comm, mul_assoc] simpa only [he, norm_star] using h end CubicFirstMoment namespace CubicFirstMoment def cubeBlockMass (P S T C : Finset Eisenstein) (u : Eisenstein → ℂ) : ℝ := ∑ s ∈ S, ∑ t ∈ T, ∑ c ∈ C, ‖∑ b ∈ P, u b * cubicSymbol b (s*t^2*c^3)‖^2 lemma cubeBlockMass_le_first (P S T C : Finset Eisenstein) (hP : ∀ b ∈ P, primary b) (u : Eisenstein → ℂ) : cubeBlockMass P S T C u ≤ (T.card : ℝ) * C.card * finiteCubicBound P S * ∑ b ∈ P, ‖u b‖^2 := by have hrow (t c : Eisenstein) : (∑ s ∈ S, ‖∑ b ∈ P, u b * cubicSymbol b (s*t^2*c^3)‖^2) ≤ finiteCubicBound P S * ∑ b ∈ P, ‖u b‖^2 := by have h := finiteCubicBound_twist_controls_mass P S u (fun b => cubicSymbol b (t^2*c^3)) (fun b hb => norm_cubicSymbol_le_one (hP b hb) _) convert h using 1 apply Finset.sum_congr rfl intro s hs congr 2 apply Finset.sum_congr rfl intro b hb rw [mul_assoc s, cubicSymbol_mul_upper (hP b hb)] ring unfold cubeBlockMass rw [Finset.sum_comm (s := S) (t := T)] simp_rw [Finset.sum_comm (s := S) (t := C)] calc _ ≤ ∑ t ∈ T, ∑ c ∈ C, finiteCubicBound P S * ∑ b ∈ P, ‖u b‖^2 := Finset.sum_le_sum (fun t _ => Finset.sum_le_sum (fun c _ => hrow t c)) _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul]; ring lemma cubeBlockMass_le_second (P S T C : Finset Eisenstein) (hP : ∀ b ∈ P, primary b) (u : Eisenstein → ℂ) : cubeBlockMass P S T C u ≤ (S.card : ℝ) * C.card * finiteCubicBound P T * ∑ b ∈ P, ‖u b‖^2 := by have hrow (s c : Eisenstein) : (∑ t ∈ T, ‖∑ b ∈ P, u b * cubicSymbol b (s*t^2*c^3)‖^2) ≤ finiteCubicBound P T * ∑ b ∈ P, ‖u b‖^2 := by have h := finiteCubicBound_twist_conjugate_mass P T u (fun b => cubicSymbol b (s*c^3)) (fun b hb => norm_cubicSymbol_le_one (hP b hb) _) convert h using 1 apply Finset.sum_congr rfl intro t ht congr 2 apply Finset.sum_congr rfl intro b hb rw [cubicSymbol_mul_upper (hP b hb), cubicSymbol_mul_upper (hP b hb), cubicSymbol_mul_upper (hP b hb), cubicSymbol_pow_upper (hP b hb), cubicSymbol_sq_eq_star (hP b hb)] ring unfold cubeBlockMass simp_rw [Finset.sum_comm (s := T) (t := C)] calc _ ≤ ∑ s ∈ S, ∑ c ∈ C, finiteCubicBound P T * ∑ b ∈ P, ‖u b‖^2 := Finset.sum_le_sum (fun s _ => Finset.sum_le_sum (fun c _ => hrow s c)) _ = _ := by simp only [Finset.sum_const, nsmul_eq_mul]; ring theorem cubeBlockMass_le_min (P S T C : Finset Eisenstein) (hP : ∀ b ∈ P, primary b) (u : Eisenstein → ℂ) : cubeBlockMass P S T C u ≤ min ((T.card : ℝ) * C.card * finiteCubicBound P S) ((S.card : ℝ) * C.card * finiteCubicBound P T) * ∑ b ∈ P, ‖u b‖^2 := by rw [min_mul_of_nonneg _ _ (Finset.sum_nonneg (fun _ _ => sq_nonneg _))] exact le_min (cubeBlockMass_le_first P S T C hP u) (cubeBlockMass_le_second P S T C hP u) end CubicFirstMoment namespace CubicFirstMoment def cubeBlockSupport (S T C : Finset Eisenstein) : Finset Eisenstein := (S.product (T.product C)).image (fun z => z.1*z.2.1^2*z.2.2^3) lemma cubeBlockSupport_mass_le (P S T C : Finset Eisenstein) (u : Eisenstein → ℂ) : (∑ n ∈ cubeBlockSupport S T C, ‖∑ b ∈ P, u b*cubicSymbol b n‖^2) ≤ cubeBlockMass P S T C u := by calc _ ≤ ∑ z ∈ S.product (T.product C), ‖∑ b ∈ P, u b*cubicSymbol b (z.1*z.2.1^2*z.2.2^3)‖^2 := Finset.sum_image_le_of_nonneg (s := S.product (T.product C)) (g := fun z => z.1*z.2.1^2*z.2.2^3) (f := fun n => ‖∑ b ∈ P, u b*cubicSymbol b n‖^2) (fun _ _ => sq_nonneg _) _ = _ := by unfold cubeBlockMass exact (Finset.sum_product S (T.product C) _).trans (Finset.sum_congr rfl (fun s _ => Finset.sum_product T C _)) theorem finiteCubicBound_cubeBlock (P S T C : Finset Eisenstein) (hP : ∀ b ∈ P, primary b) : finiteCubicBound P (cubeBlockSupport S T C) ≤ min ((T.card : ℝ) * C.card * finiteCubicBound P S) ((S.card : ℝ) * C.card * finiteCubicBound P T) := by apply (finiteCubicBound_le_iff _ _ (le_min (mul_nonneg (by positivity) (finiteCubicBound_nonneg P S)) (mul_nonneg (by positivity) (finiteCubicBound_nonneg P T)))).mpr intro u exact (cubeBlockSupport_mass_le P S T C u).trans (cubeBlockMass_le_min P S T C hP u) end CubicFirstMoment end end end OAI