Theorem: Group.nat_card_center_add_sum_card_noncenter_eq_card
File: Mathlib/GroupTheory/ClassEquation.lean

tactic: cases nonempty_fintype G
state_before: G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
⊢ Nat.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Nat.card ↑x.carrier = Nat.card G
state_after: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Nat.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Nat.card ↑x.carrier = Nat.card G

tactic: rw [@Nat.card_eq_fintype_card G, ← sum_conjClasses_card_eq_card, ←
  Finset.sum_sdiff (ConjClasses.noncenter G).toFinset.subset_univ]
state_before: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Nat.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Nat.card ↑x.carrier = Nat.card G
state_after: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Nat.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Nat.card ↑x.carrier =
    ∑ x ∈ Finset.univ \ (noncenter G).toFinset, x.carrier.toFinset.card +
      ∑ x ∈ (noncenter G).toFinset, x.carrier.toFinset.card

tactic: simp only [Nat.card_eq_fintype_card, Set.toFinset_card]
state_before: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Nat.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Nat.card ↑x.carrier =
    ∑ x ∈ Finset.univ \ (noncenter G).toFinset, x.carrier.toFinset.card +
      ∑ x ∈ (noncenter G).toFinset, x.carrier.toFinset.card
state_after: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier +
      ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier

tactic: congr 1
state_before: case intro
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) + ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier +
      ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier

case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier

tactic: swap
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier

case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier

case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier

tactic: calc
  Fintype.card (Subgroup.center G) = Fintype.card ((noncenter G)ᶜ : Set _) :=
    Fintype.card_congr ((mk_bijOn G).equiv _)
  _ = Finset.card (Finset.univ \ (noncenter G).toFinset) := by
    rw [← Set.toFinset_card, Set.toFinset_compl, Finset.compl_eq_univ_sdiff]
  _ = _ := ?_
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↥(Subgroup.center G) = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ (Finset.univ \ (noncenter G).toFinset).card = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier

tactic: rw [Finset.card_eq_sum_ones]
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ (Finset.univ \ (noncenter G).toFinset).card = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ x ∈ Finset.univ \ (noncenter G).toFinset, 1 = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier

tactic: refine Finset.sum_congr rfl ?_
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ x ∈ Finset.univ \ (noncenter G).toFinset, 1 = ∑ x ∈ Finset.univ \ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∀ x ∈ Finset.univ \ (noncenter G).toFinset, 1 = Fintype.card ↑x.carrier

tactic: rintro ⟨g⟩ hg
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∀ x ∈ Finset.univ \ (noncenter G).toFinset, 1 = Fintype.card ↑x.carrier
state_after: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : Quot.mk Setoid.r g ∈ Finset.univ \ (noncenter G).toFinset
⊢ 1 = Fintype.card ↑(carrier (Quot.mk Setoid.r g))

tactic: simp only [noncenter, Set.not_subsingleton_iff, Set.toFinset_setOf, Finset.mem_univ, true_and,
           forall_true_left, Finset.mem_sdiff, Finset.mem_filter, Set.not_nontrivial_iff] at hg
state_before: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : Quot.mk Setoid.r g ∈ Finset.univ \ (noncenter G).toFinset
⊢ 1 = Fintype.card ↑(carrier (Quot.mk Setoid.r g))
state_after: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : (carrier (Quot.mk Setoid.r g)).Subsingleton
⊢ 1 = Fintype.card ↑(carrier (Quot.mk Setoid.r g))

tactic: rw [eq_comm, ← Set.toFinset_card, Finset.card_eq_one]
state_before: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : (carrier (Quot.mk Setoid.r g)).Subsingleton
⊢ 1 = Fintype.card ↑(carrier (Quot.mk Setoid.r g))
state_after: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : (carrier (Quot.mk Setoid.r g)).Subsingleton
⊢ ∃ a, (carrier (Quot.mk Setoid.r g)).toFinset = {a}

tactic: exact ⟨g, Finset.coe_injective <| by simpa using hg.eq_singleton_of_mem mem_carrier_mk⟩
state_before: case intro.e_a.mk
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : (carrier (Quot.mk Setoid.r g)).Subsingleton
⊢ ∃ a, (carrier (Quot.mk Setoid.r g)).toFinset = {a}
state_after: no goals

tactic: convert finsum_cond_eq_sum_of_cond_iff _ _
state_before: case intro.e_a
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∑ᶠ (x : ConjClasses G) (_ : x ∈ noncenter G), Fintype.card ↑x.carrier =
    ∑ x ∈ (noncenter G).toFinset, Fintype.card ↑x.carrier
state_after: case intro.e_a.convert_7
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∀ {x : ConjClasses G}, Fintype.card ↑x.carrier ≠ 0 → (x ∈ noncenter G ↔ x ∈ (noncenter G).toFinset)

tactic: simp [Set.mem_toFinset]
state_before: case intro.e_a.convert_7
G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ ∀ {x : ConjClasses G}, Fintype.card ↑x.carrier ≠ 0 → (x ∈ noncenter G ↔ x ∈ (noncenter G).toFinset)
state_after: no goals

tactic: rw [← Set.toFinset_card, Set.toFinset_compl, Finset.compl_eq_univ_sdiff]
state_before: G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
⊢ Fintype.card ↑(noncenter G)ᶜ = (Finset.univ \ (noncenter G).toFinset).card
state_after: no goals

tactic: simpa using hg.eq_singleton_of_mem mem_carrier_mk
state_before: G : Type u_1
inst✝¹ : Group G
inst✝ : Finite G
val✝ : Fintype G
x✝ : ConjClasses G
g : G
hg : (carrier (Quot.mk Setoid.r g)).Subsingleton
⊢ ↑(carrier (Quot.mk Setoid.r g)).toFinset = ↑{g}
state_after: no goals