import Mathlib import OAI.Probability.CriticalPercolation.Criticality.NormalClosureGrowth namespace OAI section noncomputable section open Set Function Filter Topology open scoped Classical Pointwise namespace CriticalPercolation.RelativeGrowth variable {A : Type*} [Group A] def ball (K : Subgroup A) (S : Set A) (n : ℕ) : Set (A ⧸ K) := (QuotientGroup.mk : A → A ⧸ K) '' S^n def HasDegree (K : Subgroup A) (S : Set A) (d : ℕ) : Prop := (∀ n, (ball K S n).Finite) ∧ ∃ C : ℕ, ∀ R : ℕ, ∃ n≥R, (ball K S n).ncard≤C*n^d lemma ball_mono (K : Subgroup A) (S : Set A) (h1 : (1:A)∈S) : Monotone (ball K S) := fun _ _ h => Set.image_mono (Set.pow_subset_pow_right h1 h) lemma not_quadratic_exponential_lower (K : Subgroup A) (S : Set A) (h1 : (1:A)∈S) (d : ℕ) (hg : HasDegree K S d) (L : ℕ) (hL : 0 simp [SparseGrowth.binaryProducts,Set.InjOn] | succ n ih => intro x hx y hy he have hKn : K≤H n := hK.trans (hH (Nat.zero_le n)) have hmem := SparseGrowth.binaryProducts_mem H hH g hg n have hbad (x y : A) (hx : x∈SparseGrowth.binaryProducts g n) (hy : y∈SparseGrowth.binaryProducts g n) (he : (QuotientGroup.mk x : A ⧸ K)=QuotientGroup.mk (g n*y)) : False := by have hxy : x⁻¹*(g n*y)∈H n := hKn (QuotientGroup.eq.mp he) have hz := (H n).mul_mem ((H n).mul_mem (hmem x hx) hxy) ((H n).inv_mem (hmem y hy)) apply hout n simpa only [mul_inv_cancel_left,mul_assoc,mul_inv_cancel,mul_one] using hz rcases Finset.mem_union.mp hx with hx|hx <;> rcases Finset.mem_union.mp hy with hy|hy · exact ih hx hy he · obtain ⟨z,hz,rfl⟩ := Finset.mem_image.mp hy exact False.elim (hbad x z hx hz he) · obtain ⟨z,hz,rfl⟩ := Finset.mem_image.mp hx exact False.elim (hbad y z hy hz he.symm) · obtain ⟨a,ha,rfl⟩ := Finset.mem_image.mp hx obtain ⟨b,hb,rfl⟩ := Finset.mem_image.mp hy apply congrArg (fun t => g n*t) apply ih ha hb apply QuotientGroup.eq.mpr have hh := QuotientGroup.eq.mp he simpa only [mul_inv_rev,mul_assoc,inv_mul_cancel_left] using hh lemma binaryProducts_subset_pow (S : Set A) (h1 : (1:A)∈S) (g : ℕ → A) (L : ℕ) (hg : ∀ n, g n∈S^(L*(n+1))) : ∀ n, (SparseGrowth.binaryProducts g n : Set A) ⊆ S^(L*n^2) := by intro n induction n with | zero => simp [SparseGrowth.binaryProducts] | succ n ih => intro x hx rcases Finset.mem_union.mp hx with hx | hx · exact Set.pow_subset_pow_right h1 (Nat.mul_le_mul_left L (Nat.pow_le_pow_left (Nat.le_succ n) 2)) (ih hx) · obtain ⟨y,hy,rfl⟩ := Finset.mem_image.mp hx have hlen : L*(n+1)+L*n^2 ≤ L*(n+1)^2 := by calc _ = L*(n+1+n^2) := by ring _ ≤ L*(n+1)^2 := Nat.mul_le_mul_left L (by nlinarith) apply Set.pow_subset_pow_right h1 hlen rw [pow_add] exact Set.mul_mem_mul (hg n) (ih hy) lemma no_linear_strict_chain (K : Subgroup A) (S : Set A) (h1 : (1:A)∈S) (d : ℕ) (hg : HasDegree K S d) (H : ℕ → Subgroup A) (hH : Monotone H) (hK : K≤H 0) (g : ℕ → A) (hgin : ∀ n, g n∈H (n+1)) (hgout : ∀ n, g n∉H n) (L : ℕ) (hL : 0