/-Copyright (c) 2026 Carles Marín. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles Marín-/module public import Mathlib.GroupTheory.CosetCoverpublic import Mathlib.GroupTheory.Indexpublic import Mathlib.Data.Finset.Prodpublic import Mathlib.Data.Set.Finite.Basic /-!# P. M. Neumann's separation lemma If a group `G` acts on `Ω` and `A`, `B` are finite subsets, some `g : G` moves `A` off `B`(`g • a ∉ B` for all `a ∈ A`) in two situations: when the action is pretransitive and`#A · #B < #Ω`, and when every point of `A` has an infinite orbit. Both follow from B. H. Neumann'scovering lemma (`Subgroup.exists_index_le_card_of_leftCoset_cover`): otherwise `G` is covered by the`#A · #B` cosets `t(a, b) • stabilizer G a`. ## Main results * `TotD.separation_lemma_of_pretransitive`, `TotD.separation_lemma_of_pretransitive'`: the finite version (with `Nat.card` and with `Fintype.card`).* `TotD.neumann_separation_lemma`, `TotD.neumann_separation_lemma'`: the infinite version. ## References * P. J. Cameron, *Synchronization*, LTCC lecture notes, 2010, Lecture 3.* J. Araújo, P. J. Cameron, B. Steinberg, *Between primitive and 2-transitive: synchronization and its friends*, EMS Surv. Math. Sci. 4 (2017) 101–184.-/ @[expose] public section open MulAction Pointwise namespace TotD variable (G : Type*) {Ω : Type*} [Group G] [MulAction G Ω] /-- Shared counting engine: if every `g : G` sends some point of `A` into `B`, then thesets `{g | g • a = b}` for `(a, b) ∈ A ×ˢ B` — each a left coset of `stabilizer G a`when nonempty — cover `G`, so by B. H. Neumann's covering lemma some point `a ∈ A` has astabilizer of finite index, bounded by `A.card * B.card`. -/private lemma exists_stabilizer_finiteIndex_of_forall_exists {A B : Finset Ω} (hcon : ∀ x : G, ∃ a ∈ A, x • a ∈ B) : ∃ p ∈ A ×ˢ B, (stabilizer G p.1).FiniteIndex ∧ (stabilizer G p.1).index ≤ A.card * B.card := by -- choose a transporter `t p` with `t p • p.1 = p.2` whenever one exists have key : ∀ p : Ω × Ω, ∃ g : G, (∃ g' : G, g' • p.1 = p.2) → g • p.1 = p.2 := by intro p by_cases hex : ∃ g' : G, g' • p.1 = p.2 · exact ⟨hex.choose, fun _ => hex.choose_spec⟩ · exact ⟨1, fun h => absurd h hex⟩ choose t ht using key -- the corresponding left cosets of the stabilizers cover G have hcovers : ⋃ p ∈ A ×ˢ B, t p • (stabilizer G p.1 : Set G) = Set.univ := by rw [Set.eq_univ_iff_forall] intro x obtain ⟨a, haA, haB⟩ := hcon x refine Set.mem_iUnion₂.mpr ⟨(a, x • a), Finset.mem_product.mpr ⟨haA, haB⟩, ?_⟩ rw [mem_leftCoset_iff, SetLike.mem_coe, mem_stabilizer_iff, mul_smul, inv_smul_eq_iff] exact (ht (a, x • a) ⟨x, rfl⟩).symm obtain ⟨p, hp, hfi, hle⟩ := Subgroup.exists_index_le_card_of_leftCoset_cover hcovers exact ⟨p, hp, hfi, by rwa [Finset.card_product] at hle⟩ /-- **Separation lemma, finite/transitive version** (Cameron, "Synchronization",Lecture 3, Theorem 6b). If `G` acts pretransitively on `Ω` and `A B : Finset Ω`satisfy `A.card * B.card < Nat.card Ω`, then some `g : G` maps `A` off `B`. No finiteness is assumed of `G` or `Ω`: the hypothesis forces `Ω` finite nonempty(`Nat.card` of an infinite type is `0`), and the counting runs through subgroupindices rather than `|G|`. -/theorem separation_lemma_of_pretransitive [IsPretransitive G Ω] {A B : Finset Ω} (h : A.card * B.card < Nat.card Ω) : ∃ g : G, ∀ a ∈ A, g • a ∉ B := by by_contra hcon push Not at hcon obtain ⟨p, -, -, hle⟩ := exists_stabilizer_finiteIndex_of_forall_exists G hcon rw [index_stabilizer_of_transitive] at hle omega /-- `Fintype.card` form of `separation_lemma_of_pretransitive`. -/theorem separation_lemma_of_pretransitive' [Fintype Ω] [IsPretransitive G Ω] {A B : Finset Ω} (h : A.card * B.card < Fintype.card Ω) : ∃ g : G, ∀ a ∈ A, g • a ∉ B := separation_lemma_of_pretransitive G (by rwa [Nat.card_eq_fintype_card]) /-- **P. M. Neumann's separation lemma** (1974), sharp hypothesis: if the orbit ofevery point of `A` is infinite, then for finite `A B : Set Ω` some `g : G`satisfies `(g • A) ∩ B = ∅`. Proof: otherwise the sets `{g | g • a = b}`, `(a, b) ∈ A × B` — left cosets of thestabilizers of points of `A` — cover `G`, so by B. H. Neumann's covering lemma some`stabilizer G a` has finite index; but its index is `(orbit G a).ncard = 0`. -/theorem neumann_separation_lemma {A B : Set Ω} (hA : A.Finite) (hB : B.Finite) (horb : ∀ a ∈ A, (orbit G a).Infinite) : ∃ g : G, (g • A) ∩ B = ∅ := by by_contra hcon push Not at hcon -- `push Not` turns `¬ (· = ∅)` directly into `Set.Nonempty` have hcon' : ∀ x : G, ∃ a ∈ hA.toFinset, x • a ∈ hB.toFinset := by intro x obtain ⟨y, hy1, hy2⟩ := hcon x obtain ⟨a, haA, rfl⟩ := Set.mem_smul_set.mp hy1 exact ⟨a, hA.mem_toFinset.mpr haA, hB.mem_toFinset.mpr hy2⟩ obtain ⟨p, hp, hfi, -⟩ := exists_stabilizer_finiteIndex_of_forall_exists G hcon' exact hfi.index_ne_zero <| (index_stabilizer G p.1).trans (horb p.1 (hA.mem_toFinset.mp (Finset.mem_product.mp hp).1)).ncard /-- P. M. Neumann's separation lemma, classical statement: if all `G`-orbits on `Ω`are infinite, then any two finite subsets of `Ω` can be separated by some `g : G`. -/theorem neumann_separation_lemma' {A B : Set Ω} (hA : A.Finite) (hB : B.Finite) (horb : ∀ x : Ω, (orbit G x).Infinite) : ∃ g : G, (g • A) ∩ B = ∅ := neumann_separation_lemma G hA hB fun a _ => horb a end TotD