Module docstring
{"# Centralizers of subgroups "}
{"# Centralizers of subgroups "}
Subgroup.centralizer
      definition
     (s : Set G) : Subgroup G
        /-- The `centralizer` of `s` is the subgroup of `g : G` commuting with every `h : s`. -/
@[to_additive
      "The `centralizer` of `s` is the additive subgroup of `g : G` commuting with every `h : s`."]
def centralizer (s : Set G) : Subgroup G :=
  { Submonoid.centralizer s with
    carrier := Set.centralizer s
    inv_mem' := Set.inv_mem_centralizer }
        Subgroup.mem_centralizer_iff
      theorem
     {g : G} {s : Set G} : g ∈ centralizer s ↔ ∀ h ∈ s, h * g = g * h
        @[to_additive]
theorem mem_centralizer_iff {g : G} {s : Set G} : g ∈ centralizer sg ∈ centralizer s ↔ ∀ h ∈ s, h * g = g * h :=
  Iff.rfl
        Subgroup.mem_centralizer_iff_commutator_eq_one
      theorem
     {g : G} {s : Set G} : g ∈ centralizer s ↔ ∀ h ∈ s, h * g * h⁻¹ * g⁻¹ = 1
        @[to_additive]
theorem mem_centralizer_iff_commutator_eq_one {g : G} {s : Set G} :
    g ∈ centralizer sg ∈ centralizer s ↔ ∀ h ∈ s, h * g * h⁻¹ * g⁻¹ = 1 := by
  simp only [mem_centralizer_iff, mul_inv_eq_iff_eq_mul, one_mul]
        Subgroup.mem_centralizer_singleton_iff
      theorem
     {g k : G} : k ∈ Subgroup.centralizer { g } ↔ k * g = g * k
        @[to_additive]
lemma mem_centralizer_singleton_iff {g k : G} :
    k ∈ Subgroup.centralizer {g}k ∈ Subgroup.centralizer {g} ↔ k * g = g * k := by
  simp only [mem_centralizer_iff, Set.mem_singleton_iff, forall_eq]
  exact eq_comm
        Subgroup.centralizer_univ
      theorem
     : centralizer Set.univ = center G
        @[to_additive]
theorem centralizer_univ : centralizer Set.univ = center G :=
  SetLike.ext' (Set.centralizer_univ G)
        Subgroup.le_centralizer_iff
      theorem
     : H ≤ centralizer K ↔ K ≤ centralizer H
        
      Subgroup.center_le_centralizer
      theorem
     (s) : center G ≤ centralizer s
        @[to_additive]
theorem center_le_centralizer (s) : center G ≤ centralizer s :=
  Set.center_subset_centralizer s
        Subgroup.centralizer_le
      theorem
     {s t : Set G} (h : s ⊆ t) : centralizer t ≤ centralizer s
        @[to_additive]
theorem centralizer_le {s t : Set G} (h : s ⊆ t) : centralizer t ≤ centralizer s :=
  Submonoid.centralizer_le h
        Subgroup.centralizer_eq_top_iff_subset
      theorem
     {s : Set G} : centralizer s = ⊤ ↔ s ⊆ center G
        @[to_additive (attr := simp)]
theorem centralizer_eq_top_iff_subset {s : Set G} : centralizercentralizer s = ⊤ ↔ s ⊆ center G :=
  SetLike.ext'_iff.trans Set.centralizer_eq_top_iff_subset
        Subgroup.map_centralizer_le_centralizer_image
      theorem
     (s : Set G) (f : G →* G') : (Subgroup.centralizer s).map f ≤ Subgroup.centralizer (f '' s)
        @[to_additive]
theorem map_centralizer_le_centralizer_image (s : Set G) (f : G →* G') :
    (Subgroup.centralizer s).map f ≤ Subgroup.centralizer (f '' s) := by
  rintro - ⟨g, hg, rfl⟩ - ⟨h, hh, rfl⟩
  rw [← map_mul, ← map_mul, hg h hh]
        Subgroup.Centralizer.characteristic
      instance
     [hH : H.Characteristic] : (centralizer (H : Set G)).Characteristic
        @[to_additive]
instance Centralizer.characteristic [hH : H.Characteristic] :
    (centralizer (H : Set G)).Characteristic := by
  refine Subgroup.characteristic_iff_comap_le.mpr fun ϕ g hg h hh => ϕ.injective ?_
  rw [map_mul, map_mul]
  exact hg (ϕ h) (Subgroup.characteristic_iff_le_comap.mp hH ϕ hh)
        Subgroup.le_centralizer_iff_isMulCommutative
      theorem
     : K ≤ centralizer K ↔ IsMulCommutative K
        
      Subgroup.le_centralizer
      theorem
     [h : IsMulCommutative H] : H ≤ centralizer H
        @[to_additive]
theorem le_centralizer [h : IsMulCommutative H] : H ≤ centralizer H :=
  le_centralizer_iff_isMulCommutative.mpr h
        Subgroup.closure_le_centralizer_centralizer
      theorem
     (s : Set G) : closure s ≤ centralizer (centralizer s)
        @[to_additive]
lemma closure_le_centralizer_centralizer (s : Set G) :
    closure s ≤ centralizer (centralizer s) :=
  closure_le _ |>.mpr Set.subset_centralizer_centralizer
        Subgroup.closureCommGroupOfComm
      abbrev
     {k : Set G} (hcomm : ∀ x ∈ k, ∀ y ∈ k, x * y = y * x) : CommGroup (closure k)
        /-- If all the elements of a set `s` commute, then `closure s` is a commutative group. -/
@[to_additive
      "If all the elements of a set `s` commute, then `closure s` is an additive
      commutative group."]
abbrev closureCommGroupOfComm {k : Set G} (hcomm : ∀ x ∈ k, ∀ y ∈ k, x * y = y * x) :
    CommGroup (closure k) :=
  { (closure k).toGroup with
    mul_comm := fun ⟨_, h₁⟩ ⟨_, h₂⟩ ↦
      have := closure_le_centralizer_centralizer k
      Subtype.ext <| Set.centralizer_centralizer_comm_of_comm hcomm _ (this h₁) _ (this h₂) }
        Subgroup.instMulDistribMulActionSubtypeMemNormalizer
      instance
     : MulDistribMulAction H.normalizer H
        /-- The conjugation action of N(H) on H. -/
@[simps]
instance : MulDistribMulAction H.normalizer H where
  smul g h := ⟨g * h * g⁻¹, (g.2 h).mp h.2⟩
  one_smul g := by simp [HSMul.hSMul]
  mul_smul := by simp [HSMul.hSMul, mul_assoc]
  smul_one := by simp [HSMul.hSMul]
  smul_mul := by simp [HSMul.hSMul]
        Subgroup.normalizerMonoidHom
      definition
     : H.normalizer →* MulAut H
        /-- The homomorphism N(H) → Aut(H) with kernel C(H). -/
@[simps!]
def normalizerMonoidHom : H.normalizer →* MulAut H :=
  MulDistribMulAction.toMulAut H.normalizer H
        Subgroup.normalizerMonoidHom_ker
      theorem
     : H.normalizerMonoidHom.ker = (Subgroup.centralizer H).subgroupOf H.normalizer
        theorem normalizerMonoidHom_ker :
    H.normalizerMonoidHom.ker = (Subgroup.centralizer H).subgroupOf H.normalizer := by
  simp [Subgroup.ext_iff, DFunLike.ext_iff, Subtype.ext_iff,
    mem_subgroupOf, mem_centralizer_iff, eq_mul_inv_iff_mul_eq, eq_comm]