l3lab/ntp-mathlib huggingface dataset:
/-- A finite group of prime order is simple. -/
@[to_additive "A finite group of prime order is simple."]
theorem isSimpleGroup_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsSimpleGroup α :=
  have : Nontrivial α := by
    have h' := Nat.Prime.one_lt (Fact.out (p := p.Prime))
    rw [← h] at h'
    exact Fintype.one_lt_card_iff_nontrivial.1 h'
  ⟨fun H _ => by
    classical
      have hcard := card_subgroup_dvd_card H
      rw [h, dvd_prime (Fact.out (p := p.Prime))] at hcard
      

Proof state:
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
this : Nontrivial α
H : Subgroup α
x✝ : Normal H
hcard : Fintype.card ↥H = 1 ∨ Fintype.card ↥H = p
⊢ H = ⊥ ∨ H = ⊤

Next tactic:
refine' hcard.imp (fun h1 => _) fun hp => _
/-- A finite group of prime order is simple. -/
@[to_additive "A finite group of prime order is simple."]
theorem isSimpleGroup_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsSimpleGroup α :=
  have : Nontrivial α := by
    have h' := Nat.Prime.one_lt (Fact.out (p := p.Prime))
    rw [← h] at h'
    exact Fintype.one_lt_card_iff_nontrivial.1 h'
  ⟨fun H _ => by
    classical
      have hcard := card_subgroup_dvd_card H
      rw [h, dvd_prime (Fact.out (p := p.Prime))] at hcard
      refine' hcard.imp (fun h1 => _) fun hp => _
      · 

Proof state:
case refine'_1
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
this : Nontrivial α
H : Subgroup α
x✝ : Normal H
hcard : Fintype.card ↥H = 1 ∨ Fintype.card ↥H = p
h1 : Fintype.card ↥H = 1
⊢ H = ⊥

Next tactic:
haveI := Fintype.card_le_one_iff_subsingleton.1 (le_of_eq h1)
/-- A finite group of prime order is simple. -/
@[to_additive "A finite group of prime order is simple."]
theorem isSimpleGroup_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsSimpleGroup α :=
  have : Nontrivial α := by
    have h' := Nat.Prime.one_lt (Fact.out (p := p.Prime))
    rw [← h] at h'
    exact Fintype.one_lt_card_iff_nontrivial.1 h'
  ⟨fun H _ => by
    classical
      have hcard := card_subgroup_dvd_card H
      rw [h, dvd_prime (Fact.out (p := p.Prime))] at hcard
      refine' hcard.imp (fun h1 => _) fun hp => _
      · haveI := Fintype.card_le_one_iff_subsingleton.1 (le_of_eq h1)
        

Proof state:
case refine'_1
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
this✝ : Nontrivial α
H : Subgroup α
x✝ : Normal H
hcard : Fintype.card ↥H = 1 ∨ Fintype.card ↥H = p
h1 : Fintype.card ↥H = 1
this : Subsingleton ↥H
⊢ H = ⊥

Next tactic:
apply eq_bot_of_subsingleton
/-- A finite group of prime order is simple. -/
@[to_additive "A finite group of prime order is simple."]
theorem isSimpleGroup_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsSimpleGroup α :=
  have : Nontrivial α := by
    have h' := Nat.Prime.one_lt (Fact.out (p := p.Prime))
    rw [← h] at h'
    exact Fintype.one_lt_card_iff_nontrivial.1 h'
  ⟨fun H _ => by
    classical
      have hcard := card_subgroup_dvd_card H
      rw [h, dvd_prime (Fact.out (p := p.Prime))] at hcard
      refine' hcard.imp (fun h1 => _) fun hp => _
      · haveI := Fintype.card_le_one_iff_subsingleton.1 (le_of_eq h1)
        apply eq_bot_of_subsingleton
      · 

Proof state:
case refine'_2
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp✝ : Fact (Nat.Prime p)
h : Fintype.card α = p
this : Nontrivial α
H : Subgroup α
x✝ : Normal H
hcard : Fintype.card ↥H = 1 ∨ Fintype.card ↥H = p
hp : Fintype.card ↥H = p
⊢ H = ⊤

Next tactic:
exact eq_top_of_card_eq _ (hp.trans h.symm)
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
⊢ x ^ m = f a

Next tactic:
simpa [Subtype.ext_iff] using hm
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
⊢ x ^ n = f b

Next tactic:
simpa [Subtype.ext_iff] using hn
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
⊢ y ^ (-m) * a ∈ MonoidHom.ker f

Next tactic:
rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
⊢ y ^ (-n) * b ∈ MonoidHom.ker f

Next tactic:
rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self])
  calc
    a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
hb : y ^ (-n) * b ∈ center G
⊢ a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b)

Next tactic:
simp [mul_assoc]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self])
  calc
    a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) := by simp [mul_assoc]
    _ = y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b) := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
hb : y ^ (-n) * b ∈ center G
⊢ y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) = y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b)

Next tactic:
rw [mem_center_iff.1 ha]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self])
  calc
    a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) := by simp [mul_assoc]
    _ = y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b) := by rw [mem_center_iff.1 ha]
    _ = y ^ m * y ^ n * y ^ (-m) * (a * (y ^ (-n) * b)) := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
hb : y ^ (-n) * b ∈ center G
⊢ y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b) = y ^ m * y ^ n * y ^ (-m) * (a * (y ^ (-n) * b))

Next tactic:
simp [mul_assoc]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self])
  calc
    a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) := by simp [mul_assoc]
    _ = y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b) := by rw [mem_center_iff.1 ha]
    _ = y ^ m * y ^ n * y ^ (-m) * (a * (y ^ (-n) * b)) := by simp [mul_assoc]
    _ = y ^ m * y ^ n * y ^ (-m) * (y ^ (-n) * b * a) := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
hb : y ^ (-n) * b ∈ center G
⊢ y ^ m * y ^ n * y ^ (-m) * (a * (y ^ (-n) * b)) = y ^ m * y ^ n * y ^ (-m) * (y ^ (-n) * b * a)

Next tactic:
rw [mem_center_iff.1 hb]
/-- A group is commutative if the quotient by the center is cyclic.
  Also see `commGroup_of_cycle_center_quotient` for the `CommGroup` instance. -/
@[to_additive commutative_of_add_cyclic_center_quotient
      "A group is commutative if the quotient by the center is cyclic.
      Also see `addCommGroup_of_cycle_center_quotient` for the `AddCommGroup` instance."]
theorem commutative_of_cyclic_center_quotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G)
    (a b : G) : a * b = b * a :=
  let ⟨⟨x, y, (hxy : f y = x)⟩, (hx : ∀ a : f.range, a ∈ zpowers _)⟩ :=
    IsCyclic.exists_generator (α := f.range)
  let ⟨m, hm⟩ := hx ⟨f a, a, rfl⟩
  let ⟨n, hn⟩ := hx ⟨f b, b, rfl⟩
  have hm : x ^ m = f a := by simpa [Subtype.ext_iff] using hm
  have hn : x ^ n = f b := by simpa [Subtype.ext_iff] using hn
  have ha : y ^ (-m) * a ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x m, hm, inv_mul_self])
  have hb : y ^ (-n) * b ∈ center G :=
    hf (by rw [f.mem_ker, f.map_mul, f.map_zpow, hxy, zpow_neg x n, hn, inv_mul_self])
  calc
    a * b = y ^ m * (y ^ (-m) * a * y ^ n) * (y ^ (-n) * b) := by simp [mul_assoc]
    _ = y ^ m * (y ^ n * (y ^ (-m) * a)) * (y ^ (-n) * b) := by rw [mem_center_iff.1 ha]
    _ = y ^ m * y ^ n * y ^ (-m) * (a * (y ^ (-n) * b)) := by simp [mul_assoc]
    _ = y ^ m * y ^ n * y ^ (-m) * (y ^ (-n) * b * a) := by rw [mem_center_iff.1 hb]
    _ = b * a := by 

Proof state:
α : Type u
a✝ : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
a b : G
x : H
y : G
hxy : f y = x
hx : ∀ (a : ↥(MonoidHom.range f)), a ∈ zpowers { val := x, property := (_ : ∃ y, f y = x) }
m : ℤ
hm✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) m = { val := f a, property := (_ : ∃ y, f y = f a) }
n : ℤ
hn✝ :
  (fun x_1 => { val := x, property := (_ : ∃ y, f y = x) } ^ x_1) n = { val := f b, property := (_ : ∃ y, f y = f b) }
hm : x ^ m = f a
hn : x ^ n = f b
ha : y ^ (-m) * a ∈ center G
hb : y ^ (-n) * b ∈ center G
⊢ y ^ m * y ^ n * y ^ (-m) * (y ^ (-n) * b * a) = b * a

Next tactic:
group
/-- A group is commutative if the quotient by the center is cyclic. -/
@[to_additive commutativeOfAddCycleCenterQuotient
      "A group is commutative if the quotient by the center is cyclic."]
def commGroupOfCycleCenterQuotient [IsCyclic H] (f : G →* H) (hf : f.ker ≤ center G) :
    CommGroup G :=
  { show Group G by 

Proof state:
α : Type u
a : α
G : Type u_1
H : Type u_2
inst✝² : Group G
inst✝¹ : Group H
inst✝ : IsCyclic H
f : G →* H
hf : MonoidHom.ker f ≤ center G
⊢ Group G

Next tactic:
infer_instance
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  

Proof state:
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
⊢ IsCyclic α

Next tactic:
cases' subsingleton_or_nontrivial α with hi hi
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> 

Proof state:
case inl
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi : Subsingleton α
⊢ IsCyclic α

Next tactic:
haveI := hi
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> 

Proof state:
case inr
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi : Nontrivial α
⊢ IsCyclic α

Next tactic:
haveI := hi
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · 

Proof state:
case inl
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Subsingleton α
⊢ IsCyclic α

Next tactic:
apply isCyclic_of_subsingleton
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · apply isCyclic_of_subsingleton
  · 

Proof state:
case inr
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Nontrivial α
⊢ IsCyclic α

Next tactic:
obtain ⟨g, hg⟩ := exists_ne (1 : α)
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · apply isCyclic_of_subsingleton
  · obtain ⟨g, hg⟩ := exists_ne (1 : α)
    

Proof state:
case inr.intro
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Nontrivial α
g : α
hg : g ≠ 1
⊢ IsCyclic α

Next tactic:
refine' ⟨⟨g, fun x => _⟩⟩
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · apply isCyclic_of_subsingleton
  · obtain ⟨g, hg⟩ := exists_ne (1 : α)
    refine' ⟨⟨g, fun x => _⟩⟩
    

Proof state:
case inr.intro
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Nontrivial α
g : α
hg : g ≠ 1
x : α
⊢ x ∈ Subgroup.zpowers g

Next tactic:
cases' IsSimpleOrder.eq_bot_or_eq_top (Subgroup.zpowers g) with hb ht
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · apply isCyclic_of_subsingleton
  · obtain ⟨g, hg⟩ := exists_ne (1 : α)
    refine' ⟨⟨g, fun x => _⟩⟩
    cases' IsSimpleOrder.eq_bot_or_eq_top (Subgroup.zpowers g) with hb ht
    · 

Proof state:
case inr.intro.inl
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Nontrivial α
g : α
hg : g ≠ 1
x : α
hb : Subgroup.zpowers g = ⊥
⊢ x ∈ Subgroup.zpowers g

Next tactic:
exfalso
@[to_additive]
instance (priority := 100) isCyclic : IsCyclic α := by
  cases' subsingleton_or_nontrivial α with hi hi <;> haveI := hi
  · apply isCyclic_of_subsingleton
  · obtain ⟨g, hg⟩ := exists_ne (1 : α)
    refine' ⟨⟨g, fun x => _⟩⟩
    cases' IsSimpleOrder.eq_bot_or_eq_top (Subgroup.zpowers g) with hb ht
    · exfalso
      

Proof state:
case inr.intro.inl.h
α : Type u
a : α
inst✝¹ : CommGroup α
inst✝ : IsSimpleGroup α
hi this : Nontrivial α
g : α
hg : g ≠ 1
x : α
hb : Subgroup.zpowers g = ⊥
⊢ False

Next tactic:
apply hg