1- import Mathlib.Algebra.Group.Subgroup.Defs
21import Mathlib.Algebra.Order.BigOperators.Ring.Finset
32import Mathlib.Combinatorics.Additive.SmallTripling
3+ import Mathlib.Tactic.Bound
44import LeanCamCombi.Mathlib.Algebra.Group.Pointwise.Finset.Basic
55import LeanCamCombi.Mathlib.Algebra.Group.Pointwise.Set.Basic
6+ import LeanCamCombi.Mathlib.Algebra.Group.Subgroup.Pointwise
67import LeanCamCombi.Mathlib.Combinatorics.Additive.RuzsaCovering
78import LeanCamCombi.Mathlib.Data.Finset.Basic
9+ import LeanCamCombi.Mathlib.Data.Set.Basic
10+ import LeanCamCombi.Mathlib.Data.Set.Lattice
11+ import LeanCamCombi.Mathlib.Data.Set.Pointwise.SMul
12+
13+ -- TODO: Unsimp in mathlib
14+ attribute [-simp] Set.image_subset_iff
815
916open scoped Finset Pointwise
1017
11- variable {G : Type *} [Group G] {S : Set G} {K L : ℝ} {n : ℕ}
18+ variable {G : Type *} [Group G] {A B : Set G} {K L : ℝ} {m n : ℕ}
1219
13- structure IsApproximateAddSubgroup {G : Type *} [AddGroup G] (S : Set G ) (K : ℝ ) : Prop where
14- nonempty : S .Nonempty
15- neg_eq_self : -S = S
16- exists_two_nsmul_subset_add : ∃ F : Finset G, #F ≤ K ∧ 2 • S ⊆ F + S
20+ structure IsApproximateAddSubgroup {G : Type *} [AddGroup G] (K : ℝ ) (A : Set G ) : Prop where
21+ nonempty : A .Nonempty
22+ neg_eq_self : -A = A
23+ exists_two_nsmul_subset_add : ∃ F : Finset G, #F ≤ K ∧ 2 • A ⊆ F + A
1724
1825@[to_additive]
19- structure IsApproximateSubgroup (S : Set G ) (K : ℝ ) : Prop where
20- nonempty : S .Nonempty
21- inv_eq_self : S ⁻¹ = S
22- exists_sq_subset_mul : ∃ F : Finset G, #F ≤ K ∧ S ^ 2 ⊆ F * S
26+ structure IsApproximateSubgroup (K : ℝ ) (A : Set G ) : Prop where
27+ nonempty : A .Nonempty
28+ inv_eq_self : A ⁻¹ = A
29+ exists_sq_subset_mul : ∃ F : Finset G, #F ≤ K ∧ A ^ 2 ⊆ F * A
2330
2431namespace IsApproximateSubgroup
2532
2633@[to_additive one_le]
27- lemma one_le (hS : IsApproximateSubgroup S K ) : 1 ≤ K := by
28- obtain ⟨F, hF, hSF⟩ := hS .exists_sq_subset_mul
29- have hF₀ : F ≠ ∅ := by rintro rfl; simp [hS .nonempty.pow.ne_empty] at hSF
34+ lemma one_le (hA : IsApproximateSubgroup K A ) : 1 ≤ K := by
35+ obtain ⟨F, hF, hSF⟩ := hA .exists_sq_subset_mul
36+ have hF₀ : F ≠ ∅ := by rintro rfl; simp [hA .nonempty.pow.ne_empty] at hSF
3037 exact hF.trans' <| by simpa [Finset.nonempty_iff_ne_empty]
3138
3239@[to_additive]
33- lemma mono (hKL : K ≤ L) (hS : IsApproximateSubgroup S K ) : IsApproximateSubgroup S L where
34- nonempty := hS .nonempty
35- inv_eq_self := hS .inv_eq_self
36- exists_sq_subset_mul := let ⟨F, hF, hSF⟩ := hS .exists_sq_subset_mul; ⟨F, hF.trans hKL, hSF⟩
40+ lemma mono (hKL : K ≤ L) (hA : IsApproximateSubgroup K A ) : IsApproximateSubgroup L A where
41+ nonempty := hA .nonempty
42+ inv_eq_self := hA .inv_eq_self
43+ exists_sq_subset_mul := let ⟨F, hF, hSF⟩ := hA .exists_sq_subset_mul; ⟨F, hF.trans hKL, hSF⟩
3744
3845@[to_additive]
39- lemma card_pow_le [DecidableEq G] {S : Finset G} (hS : IsApproximateSubgroup (S : Set G) K ) :
40- ∀ {n}, #(S ^ n) ≤ K ^ (n - 1 ) * #S
41- | 0 => by simpa using hS .nonempty
46+ lemma card_pow_le [DecidableEq G] {A : Finset G} (hA : IsApproximateSubgroup K (A : Set G)) :
47+ ∀ {n}, #(A ^ n) ≤ K ^ (n - 1 ) * #A
48+ | 0 => by simpa using hA .nonempty
4249 | 1 => by simp
4350 | n + 2 => by
44- obtain ⟨F, hF, hSF⟩ := hS .exists_sq_subset_mul
51+ obtain ⟨F, hF, hSF⟩ := hA .exists_sq_subset_mul
4552 calc
46- (#(S ^ (n + 2 )) : ℝ) ≤ #(F ^ (n + 1 ) * S ) := by
53+ (#(A ^ (n + 2 )) : ℝ) ≤ #(F ^ (n + 1 ) * A ) := by
4754 gcongr; exact mod_cast Set.pow_subset_pow_mul_of_sq_subset_mul hSF (by omega)
48- _ ≤ #(F ^ (n + 1 )) * #S := mod_cast Finset.card_mul_le
49- _ ≤ #F ^ (n + 1 ) * #S := by gcongr; exact mod_cast Finset.card_pow_le
50- _ ≤ K ^ (n + 1 ) * #S := by gcongr
55+ _ ≤ #(F ^ (n + 1 )) * #A := mod_cast Finset.card_mul_le
56+ _ ≤ #F ^ (n + 1 ) * #A := by gcongr; exact mod_cast Finset.card_pow_le
57+ _ ≤ K ^ (n + 1 ) * #A := by gcongr
5158
5259@[to_additive]
53- lemma pi {ι : Type *} {G : ι → Type *} [Fintype ι] [∀ i, Group (G i)] {S : ∀ i, Set (G i)} {K : ι → ℝ}
54- (hS : ∀ i, IsApproximateSubgroup (S i) (K i)) :
55- IsApproximateSubgroup (Set.univ.pi S) (∏ i, K i) where
56- nonempty := Set.univ_pi_nonempty_iff.2 fun i ↦ (hS i).nonempty
57- inv_eq_self := by simp [(hS _).inv_eq_self]
60+ lemma image {F H : Type *} [Group H] [FunLike F G H] [MonoidHomClass F G H] (f : F)
61+ (hA : IsApproximateSubgroup K A) : IsApproximateSubgroup K (f '' A) where
62+ nonempty := hA.nonempty.image _
63+ inv_eq_self := by simp [← Set.image_inv', hA.inv_eq_self]
5864 exists_sq_subset_mul := by
59- choose F hF hFS using fun i ↦ (hS i).exists_sq_subset_mul
65+ classical
66+ obtain ⟨F, hF, hAF⟩ := hA.exists_sq_subset_mul
67+ refine ⟨F.image f, ?_, ?_⟩
68+ · calc
69+ (#(F.image f) : ℝ) ≤ #F := mod_cast F.card_image_le
70+ _ ≤ K := hF
71+ · simp only [← Set.image_pow, Finset.coe_image, ← Set.image_mul]
72+ gcongr
73+
74+ @[to_additive]
75+ lemma pi {ι : Type *} {G : ι → Type *} [Fintype ι] [∀ i, Group (G i)] {A : ∀ i, Set (G i)} {K : ι → ℝ}
76+ (hA : ∀ i, IsApproximateSubgroup (K i) (A i)) :
77+ IsApproximateSubgroup (∏ i, K i) (Set.univ.pi A) where
78+ nonempty := Set.univ_pi_nonempty_iff.2 fun i ↦ (hA i).nonempty
79+ inv_eq_self := by simp [(hA _).inv_eq_self]
80+ exists_sq_subset_mul := by
81+ choose F hF hFS using fun i ↦ (hA i).exists_sq_subset_mul
6082 classical
6183 refine ⟨Fintype.piFinset F, ?_, ?_⟩
6284 · calc
6385 #(Fintype.piFinset F) = ∏ i, (#(F i) : ℝ) := by simp
6486 _ ≤ ∏ i, K i := by gcongr; exact hF _
6587 · sorry
6688
89+ @[to_additive]
90+ lemma subgroup {S : Type *} [SetLike S G] [SubgroupClass S G] {H : S} :
91+ IsApproximateSubgroup 1 (H : Set G) where
92+ nonempty := .of_subtype
93+ inv_eq_self := inv_coe_set
94+ exists_sq_subset_mul := ⟨{1 }, by simp⟩
95+
6796open Finset in
6897@[to_additive]
6998lemma of_small_tripling [DecidableEq G] {A : Finset G} (hA₀ : A.Nonempty) (hAsymm : A⁻¹ = A)
70- (hA : #(A ^ 3 ) ≤ K * #A) : IsApproximateSubgroup (A ^ 2 : Set G) (K ^ 3 ) where
99+ (hA : #(A ^ 3 ) ≤ K * #A) : IsApproximateSubgroup (K ^ 3 ) ( A ^ 2 : Set G) where
71100 nonempty := hA₀.to_set.pow
72101 inv_eq_self := by simp [← inv_pow, hAsymm, ← coe_inv]
73102 exists_sq_subset_mul := by
@@ -78,4 +107,67 @@ lemma of_small_tripling [DecidableEq G] {A : Finset G} (hA₀ : A.Nonempty) (hAs
78107 have hF₀ : F.Nonempty := nonempty_iff_ne_empty.2 <| by rintro rfl; simp [hA₀.ne_empty] at hAF
79108 exact ⟨F, hF, by norm_cast; simpa [div_eq_mul_inv, pow_succ, mul_assoc, hAsymm] using hAF⟩
80109
110+ open Set in
111+ @[to_additive]
112+ lemma exists_pow_inter_pow_subset (hA : IsApproximateSubgroup K A) (hB : IsApproximateSubgroup L B)
113+ (hm : 2 ≤ m) (hn : 2 ≤ n) :
114+ ∃ F : Finset G, #F ≤ K ^ (m - 1 ) * L ^ (n - 1 ) ∧ A ^ m ∩ B ^ n ⊆ F * (A ^ 2 ∩ B ^ 2 ) := by
115+ classical
116+ obtain ⟨F₁, hF₁, hAF₁⟩ := hA.exists_sq_subset_mul
117+ obtain ⟨F₂, hF₂, hBF₂⟩ := hB.exists_sq_subset_mul
118+ have := hA.one_le
119+ choose f hf using exists_smul_inter_smul_subset_smul_sq_inter_sq hA.inv_eq_self hB.inv_eq_self
120+ refine ⟨.image₂ f (F₁ ^ (m - 1 )) (F₂ ^ (n - 1 )), ?_, ?_⟩
121+ · calc
122+ (#(.image₂ f (F₁ ^ (m - 1 )) (F₂ ^ (n - 1 ))) : ℝ)
123+ _ ≤ #(F₁ ^ (m - 1 )) * #(F₂ ^ (n - 1 )) := mod_cast Finset.card_image₂_le ..
124+ _ ≤ #F₁ ^ (m - 1 ) * #F₂ ^ (n - 1 ) := by gcongr <;> exact mod_cast Finset.card_pow_le
125+ _ ≤ K ^ (m - 1 ) * L ^ (n - 1 ) := by gcongr
126+ · calc
127+ A ^ m ∩ B ^ n ⊆ (F₁ ^ (m - 1 ) * A) ∩ (F₂ ^ (n - 1 ) * B) := by
128+ gcongr <;> apply pow_subset_pow_mul_of_sq_subset_mul <;> assumption
129+ _ = ⋃ (a ∈ F₁ ^ (m - 1 )) (b ∈ F₂ ^ (n - 1 )), a • A ∩ b • B := by
130+ simp_rw [← smul_eq_mul, ← iUnion_smul_set, iUnion₂_inter_iUnion₂]; norm_cast
131+ _ ⊆ ⋃ (a ∈ F₁ ^ (m - 1 )) (b ∈ F₂ ^ (n - 1 )), f a b • (A ^ 2 ∩ B ^ 2 ) := by gcongr; exact hf ..
132+ _ = (Finset.image₂ f (F₁ ^ (m - 1 )) (F₂ ^ (n - 1 ))) * (A ^ 2 ∩ B ^ 2 ) := by
133+ rw [Finset.coe_image₂, ← smul_eq_mul, ← iUnion_smul_set, biUnion_image2]
134+ simp_rw [Finset.mem_coe]
135+
136+ open Set in
137+ @[to_additive]
138+ lemma pow_inter_pow (hA : IsApproximateSubgroup K A) (hB : IsApproximateSubgroup L B) (hm : 2 ≤ m)
139+ (hn : 2 ≤ n) (hAB : (A ^ m ∩ B ^ n).Nonempty) :
140+ IsApproximateSubgroup (K ^ (2 * m - 1 ) * L ^ (2 * n - 1 )) (A ^ m ∩ B ^ n) where
141+ nonempty := hAB
142+ inv_eq_self := by simp_rw [inter_inv, ← inv_pow, hA.inv_eq_self, hB.inv_eq_self]
143+ exists_sq_subset_mul := by
144+ obtain ⟨F, hF, hABF⟩ := hA.exists_pow_inter_pow_subset hB hm hn
145+ sorry
146+
81147end IsApproximateSubgroup
148+
149+ @[to_additive (attr := simp)]
150+ lemma isApproximateSubgroup_one {S : Type *} [SetLike S G] [SubgroupClass S G] {A : Set G} :
151+ IsApproximateSubgroup 1 (A : Set G) ↔ ∃ H : Subgroup G, A = H := by
152+ refine ⟨fun hA ↦ ?_, by rintro ⟨H, rfl⟩; exact .subgroup⟩
153+ sorry
154+
155+ open Finset in
156+ open scoped RightActions in
157+ @[to_additive]
158+ lemma exists_isApproximateSubgroup_of_small_doubling [DecidableEq G] {A : Finset G}
159+ (hA₀ : A.Nonempty) (hA : #(A ^ 2 ) ≤ K * #A) :
160+ ∃ S ⊆ (A⁻¹ * A) ^ 2 , IsApproximateSubgroup (2 ^ 12 * K ^ 36 ) (S : Set G) ∧
161+ #S ≤ 16 * K ^ 12 * #A ∧ ∃ a ∈ A, #A / (2 * K) ≤ #(A ∩ S <• a) := by
162+ have hK : 1 ≤ K := sorry
163+ let S : Finset G := {g ∈ A⁻¹ * A | #A / (2 * K) ≤ #(A <• g ∩ A)}
164+ have hS₀ : S.Nonempty := ⟨1 , by simp [S, hA₀.ne_empty]; bound⟩
165+ have hSA : S ⊆ A⁻¹ * A := filter_subset ..
166+ have hSsymm : S⁻¹ = S := by ext; simp [S]; simp [← mem_inv']; sorry
167+ have hScard :=
168+ calc
169+ (#S : ℝ) ≤ #(A⁻¹ * A) := by gcongr
170+ _ ≤ K ^ 2 * #A := sorry
171+ refine ⟨S ^ 2 , by gcongr, ⟨sorry , sorry , sorry ⟩, ?_, ?_⟩
172+ sorry
173+ sorry
0 commit comments