Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Mathlib/GroupTheory/Index.lean
Original file line number Diff line number Diff line change
Expand Up @@ -615,3 +615,26 @@ theorem index_center_le_pow [Finite (commutatorSet G)] [Group.FG G] :
end FiniteIndex

end Subgroup

namespace MonoidHom

open Finset

variable {G M F : Type*} [Group G] [Fintype G] [Monoid M] [DecidableEq M]
[FunLike F G M] [MonoidHomClass F G M]

@[to_additive]
lemma card_fiber_eq_of_mem_range (f : F) {x y : M} (hx : x ∈ Set.range f) (hy : y ∈ Set.range f) :
(univ.filter <| fun g => f g = x).card = (univ.filter <| fun g => f g = y).card := by
rcases hx with ⟨x, rfl⟩
rcases hy with ⟨y, rfl⟩
rcases mul_left_surjective x y with ⟨y, rfl⟩
conv_lhs =>
rw [← map_univ_equiv (Equiv.mulRight y⁻¹), filter_map, card_map]
congr 2 with g
simp only [Function.comp, Equiv.toEmbedding_apply, Equiv.coe_mulRight, map_mul]
let f' := MonoidHomClass.toMonoidHom f
show f' g * f' y⁻¹ = f' x ↔ f' g = f' x * f' y
rw [← f'.coe_toHomUnits y⁻¹, map_inv, Units.mul_inv_eq_iff_eq_mul, f'.coe_toHomUnits]

end MonoidHom
11 changes: 1 addition & 10 deletions Mathlib/RingTheory/IntegralDomain.lean
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@ end EuclideanDivision

variable [Fintype G]

theorem card_fiber_eq_of_mem_range {H : Type*} [Group H] [DecidableEq H] (f : G →* H) {x y : H}
(hx : x ∈ Set.range f) (hy : y ∈ Set.range f) :
-- Porting note: the `filter` had an index `ₓ` that I removed.
(univ.filter fun g => f g = x).card = (univ.filter fun g => f g = y).card := by
rcases hx with ⟨x, rfl⟩
rcases hy with ⟨y, rfl⟩
exact card_equiv (Equiv.mulRight (x⁻¹ * y)) (by simp [mul_inv_eq_one])
#align card_fiber_eq_of_mem_range card_fiber_eq_of_mem_range

/-- In an integral domain, a sum indexed by a nontrivial homomorphism from a finite group is zero.
-/
theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0 := by
Expand Down Expand Up @@ -236,7 +227,7 @@ theorem sum_hom_units_eq_zero (f : G →* R) (hf : f ≠ 1) : ∑ g : G, f g = 0
_ = (0 : R) := smul_zero _
· -- remaining goal 1
show (univ.filter fun g : G => f.toHomUnits g = u).card = c
apply card_fiber_eq_of_mem_range f.toHomUnits
apply MonoidHom.card_fiber_eq_of_mem_range f.toHomUnits
· simpa only [mem_image, mem_univ, true_and, Set.mem_range] using hu
· exact ⟨1, f.toHomUnits.map_one⟩
-- remaining goal 2
Expand Down