import Mathlib.Algebra.Group.Subgroup.Pointwise /-! # Set Powers -/ namespace OAI.AlgebraicGeometry.Albanese.Construction.SetPowers open scoped Pointwise variable {G : Type*} [Group G] /-- Once consecutive powers of a set agree, all later powers agree. -/ theorem setPow_stable_add (s : Set G) (n : ℕ) (hn : s ^ n = s ^ (n + 1)) (k : ℕ) : s ^ (n + k) = s ^ n := by induction k with | zero => simp | succ k ih => rw [Nat.add_succ, pow_succ, ih] simpa only [pow_succ] using hn.symm /-- Powers of an inverse-closed set remain inverse-closed. -/ theorem inv_mem_setPow (s : Set G) (hs : ∀ x ∈ s, x⁻¹ ∈ s) (n : ℕ) {x : G} (hx : x ∈ s ^ n) : x⁻¹ ∈ s ^ n := by induction n generalizing x with | zero => simpa using hx | succ n ih => rw [pow_succ] at hx obtain ⟨a, ha, b, hb, rfl⟩ := hx rw [mul_inv_rev, pow_succ'] exact Set.mul_mem_mul (hs b hb) (ih ha) /-- A stabilized power of a symmetric set containing the identity is a subgroup. -/ def stablePowerSubgroup (s : Set G) (h1 : 1 ∈ s) (hinv : ∀ x ∈ s, x⁻¹ ∈ s) (n : ℕ) (hn : s ^ n = s ^ (n + 1)) : Subgroup G where carrier := s ^ n one_mem' := Set.one_mem_pow h1 mul_mem' {x y} hx hy := by have hxy := Set.mul_mem_mul hx hy rwa [← pow_add, setPow_stable_add s n hn n] at hxy inv_mem' {x} hx := inv_mem_setPow s hinv n hx /-- Stabilization constructs exactly the subgroup generated by the original set. -/ theorem stablePowerSubgroup_eq_closure (s : Set G) (h1 : 1 ∈ s) (hinv : ∀ x ∈ s, x⁻¹ ∈ s) (n : ℕ) (hn : s ^ n = s ^ (n + 1)) : stablePowerSubgroup s h1 hinv n hn = Subgroup.closure s := by apply le_antisymm · intro x hx exact ((Subgroup.closure_le _).mp (Subgroup.closure_pow_le (s := s) (n := n))) hx · apply (Subgroup.closure_le _).mpr intro x hx change x ∈ s ^ n rw [hn, pow_succ] simpa only [one_mul] using Set.mul_mem_mul (Set.one_mem_pow (n := n) h1) hx end OAI.AlgebraicGeometry.Albanese.Construction.SetPowers