l3lab/ntp-mathlib huggingface dataset:
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     

Proof state:
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
⊢ 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1

Next tactic:
rw [hpk', Nat.factorization_div hpk]
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     rw [hpk', Nat.factorization_div hpk]
     

Proof state:
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
⊢ 1 = (Nat.factorization (orderOf t) - Nat.factorization (p ^ k)) p + 1

Next tactic:
simp [hp]
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     rw [hpk', Nat.factorization_div hpk]
     simp [hp]
    

Proof state:
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
this : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1
⊢ ¬p ^ 1 ∣ orderOf (t ^ p ^ k)

Next tactic:
rw [this]
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     rw [hpk', Nat.factorization_div hpk]
     simp [hp]
    rw [this]
    -- Porting note: convert made to_additive complain
    

Proof state:
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
this : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1
⊢ ¬p ^ ((Nat.factorization (orderOf (t ^ p ^ k))) p + 1) ∣ orderOf (t ^ p ^ k)

Next tactic:
apply Nat.pow_succ_factorization_not_dvd (h <| t ^ p ^ k).ne' hp
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     rw [hpk', Nat.factorization_div hpk]
     simp [hp]
    rw [this]
    -- Porting note: convert made to_additive complain
    apply Nat.pow_succ_factorization_not_dvd (h <| t ^ p ^ k).ne' hp
  

Proof state:
case intro.intro.intro.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
hcoprime : Nat.Coprime (orderOf (t ^ p ^ k)) (orderOf g)
⊢ orderOf t < orderOf (t ^ p ^ k * g)

Next tactic:
rw [(Commute.all _ g).orderOf_mul_eq_mul_orderOf_of_coprime hcoprime, hpk',
    hg, ha, ← ht, ← hk, pow_add, pow_add, pow_one, ← mul_assoc, ← mul_assoc,
    Nat.div_mul_cancel, mul_assoc, lt_mul_iff_one_lt_right <| h t, ← pow_succ']
@[to_additive]
theorem exponent_eq_iSup_orderOf (h : ∀ g : G, 0 < orderOf g) :
    exponent G = ⨆ g : G, orderOf g := by
  rw [iSup]
  rcases eq_or_ne (exponent G) 0 with (he | he)
  · rw [he, Set.Infinite.Nat.sSup_eq_zero <| (exponent_eq_zero_iff_range_orderOf_infinite h).1 he]
  have hne : (Set.range (orderOf : G → ℕ)).Nonempty := ⟨1, 1, orderOf_one⟩
  have hfin : (Set.range (orderOf : G → ℕ)).Finite := by
    rwa [← exponent_ne_zero_iff_range_orderOf_finite h]
  obtain ⟨t, ht⟩ := hne.cSup_mem hfin
  apply Nat.dvd_antisymm _
  · rw [← ht]
    apply order_dvd_exponent
  refine' Nat.dvd_of_factors_subperm he _
  rw [List.subperm_ext_iff]
  by_contra! h
  obtain ⟨p, hp, hpe⟩ := h
  replace hp := Nat.prime_of_mem_factors hp
  simp only [Nat.factors_count_eq] at hpe
  set k := (orderOf t).factorization p with hk
  obtain ⟨g, hg⟩ := hp.exists_orderOf_eq_pow_factorization_exponent G
  suffices orderOf t < orderOf (t ^ p ^ k * g) by
    rw [ht] at this
    exact this.not_le (le_csSup hfin.bddAbove <| Set.mem_range_self _)
  have hpk : p ^ k ∣ orderOf t := Nat.ord_proj_dvd _ _
  have hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k := by
    rw [orderOf_pow' t (pow_ne_zero k hp.ne_zero), Nat.gcd_eq_right hpk]
  obtain ⟨a, ha⟩ := Nat.exists_eq_add_of_lt hpe
  have hcoprime : (orderOf (t ^ p ^ k)).Coprime (orderOf g) := by
    rw [hg, Nat.coprime_pow_right_iff (pos_of_gt hpe), Nat.coprime_comm]
    apply Or.resolve_right (Nat.coprime_or_dvd_of_prime hp _)
    nth_rw 1 [← pow_one p]
    have : 1 = (Nat.factorization (orderOf (t ^ p ^ k))) p + 1 := by
     rw [hpk', Nat.factorization_div hpk]
     simp [hp]
    rw [this]
    -- Porting note: convert made to_additive complain
    apply Nat.pow_succ_factorization_not_dvd (h <| t ^ p ^ k).ne' hp
  rw [(Commute.all _ g).orderOf_mul_eq_mul_orderOf_of_coprime hcoprime, hpk',
    hg, ha, ← ht, ← hk, pow_add, pow_add, pow_one, ← mul_assoc, ← mul_assoc,
    Nat.div_mul_cancel, mul_assoc, lt_mul_iff_one_lt_right <| h t, ← pow_succ']
  exact one_lt_pow hp.one_lt a.succ_ne_zero
  

Proof state:
case intro.intro.intro.intro
G : Type u
inst✝ : CommMonoid G
h : ∀ (g : G), 0 < orderOf g
he : exponent G ≠ 0
hne : Set.Nonempty (Set.range orderOf)
hfin : Set.Finite (Set.range orderOf)
t : G
ht : orderOf t = sSup (Set.range orderOf)
p : ℕ
hp : Nat.Prime p
hpe : (Nat.factorization (sSup (Set.range fun g => orderOf g))) p < (Nat.factorization (exponent G)) p
k : ℕ := (Nat.factorization (orderOf t)) p
hk : k = (Nat.factorization (orderOf t)) p
g : G
hg : orderOf g = p ^ (Nat.factorization (exponent G)) p
hpk : p ^ k ∣ orderOf t
hpk' : orderOf (t ^ p ^ k) = orderOf t / p ^ k
a : ℕ
ha : (Nat.factorization (exponent G)) p = (Nat.factorization (sSup (Set.range fun g => orderOf g))) p + a + 1
hcoprime : Nat.Coprime (orderOf (t ^ p ^ k)) (orderOf g)
⊢ p ^ k ∣ orderOf t

Next tactic:
exact hpk
@[to_additive]
theorem exponent_eq_iSup_orderOf' :
    exponent G = if ∃ g : G, orderOf g = 0 then 0 else ⨆ g : G, orderOf g := by
  

Proof state:
G : Type u
inst✝ : CommMonoid G
⊢ exponent G = if ∃ g, orderOf g = 0 then 0 else ⨆ g, orderOf g

Next tactic:
split_ifs with h
@[to_additive]
theorem exponent_eq_iSup_orderOf' :
    exponent G = if ∃ g : G, orderOf g = 0 then 0 else ⨆ g : G, orderOf g := by
  split_ifs with h
  · 

Proof state:
case pos
G : Type u
inst✝ : CommMonoid G
h : ∃ g, orderOf g = 0
⊢ exponent G = 0

Next tactic:
obtain ⟨g, hg⟩ := h
@[to_additive]
theorem exponent_eq_iSup_orderOf' :
    exponent G = if ∃ g : G, orderOf g = 0 then 0 else ⨆ g : G, orderOf g := by
  split_ifs with h
  · obtain ⟨g, hg⟩ := h
    

Proof state:
case pos.intro
G : Type u
inst✝ : CommMonoid G
g : G
hg : orderOf g = 0
⊢ exponent G = 0

Next tactic:
exact exponent_eq_zero_of_order_zero hg
@[to_additive]
theorem exponent_eq_iSup_orderOf' :
    exponent G = if ∃ g : G, orderOf g = 0 then 0 else ⨆ g : G, orderOf g := by
  split_ifs with h
  · obtain ⟨g, hg⟩ := h
    exact exponent_eq_zero_of_order_zero hg
  · 

Proof state:
case neg
G : Type u
inst✝ : CommMonoid G
h : ¬∃ g, orderOf g = 0
⊢ exponent G = ⨆ g, orderOf g

Next tactic:
have := not_exists.mp h
@[to_additive]
theorem exponent_eq_iSup_orderOf' :
    exponent G = if ∃ g : G, orderOf g = 0 then 0 else ⨆ g : G, orderOf g := by
  split_ifs with h
  · obtain ⟨g, hg⟩ := h
    exact exponent_eq_zero_of_order_zero hg
  · have := not_exists.mp h
    

Proof state:
case neg
G : Type u
inst✝ : CommMonoid G
h : ¬∃ g, orderOf g = 0
this : ∀ (x : G), ¬orderOf x = 0
⊢ exponent G = ⨆ g, orderOf g

Next tactic:
exact exponent_eq_iSup_orderOf fun g => Ne.bot_lt <| this g
@[to_additive]
theorem exponent_eq_max'_orderOf [Fintype G] :
    exponent G = ((@Finset.univ G _).image orderOf).max' ⟨1, by 

Proof state:
G : Type u
inst✝¹ : CancelCommMonoid G
inst✝ : Fintype G
⊢ 1 ∈ Finset.image orderOf Finset.univ

Next tactic:
simp
@[to_additive]
theorem exponent_eq_max'_orderOf [Fintype G] :
    exponent G = ((@Finset.univ G _).image orderOf).max' ⟨1, by simp⟩ := by
  

Proof state:
G : Type u
inst✝¹ : CancelCommMonoid G
inst✝ : Fintype G
⊢ exponent G = Finset.max' (Finset.image orderOf Finset.univ) (_ : ∃ x, x ∈ Finset.image orderOf Finset.univ)

Next tactic:
rw [← Finset.Nonempty.cSup_eq_max', Finset.coe_image, Finset.coe_univ, Set.image_univ, ← iSup]
@[to_additive]
theorem exponent_eq_max'_orderOf [Fintype G] :
    exponent G = ((@Finset.univ G _).image orderOf).max' ⟨1, by simp⟩ := by
  rw [← Finset.Nonempty.cSup_eq_max', Finset.coe_image, Finset.coe_univ, Set.image_univ, ← iSup]
  

Proof state:
G : Type u
inst✝¹ : CancelCommMonoid G
inst✝ : Fintype G
⊢ exponent G = iSup orderOf

Next tactic:
exact exponent_eq_iSup_orderOf orderOf_pos
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  

Proof state:
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
⊢ 1 < Monoid.exponent G

Next tactic:
let _inst := Fintype.ofFinite G
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  

Proof state:
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
⊢ 1 < Monoid.exponent G

Next tactic:
obtain ⟨g, hg⟩ := exists_ne (1 : G)
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  

Proof state:
case intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
⊢ 1 < Monoid.exponent G

Next tactic:
rw [← Monoid.lcm_order_eq_exponent]
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  

Proof state:
case intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
⊢ 1 < Finset.lcm Finset.univ orderOf

Next tactic:
have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    

Proof state:
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
⊢ ¬1 = orderOf g

Next tactic:
simpa [eq_comm, orderOf_eq_one_iff] using hg
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
  

Proof state:
case intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
hg' : 2 ≤ orderOf g
⊢ 1 < Finset.lcm Finset.univ orderOf

Next tactic:
refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by simp)
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
  refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by 

Proof state:
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
hg' : 2 ≤ orderOf g
⊢ g ∈ Finset.univ

Next tactic:
simp
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
  refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by simp)
  

Proof state:
case intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
hg' : 2 ≤ orderOf g
⊢ 0 < Finset.lcm Finset.univ orderOf

Next tactic:
rw [Nat.pos_iff_ne_zero, Ne.def, Finset.lcm_eq_zero_iff]
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
  refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by simp)
  rw [Nat.pos_iff_ne_zero, Ne.def, Finset.lcm_eq_zero_iff]
  

Proof state:
case intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
hg' : 2 ≤ orderOf g
⊢ 0 ∉ orderOf '' ↑Finset.univ

Next tactic:
rintro ⟨x, -, hx⟩
@[to_additive AddGroup.one_lt_exponent]
lemma Group.one_lt_exponent [Group G] [Finite G] [Nontrivial G] :
    1 < Monoid.exponent G := by
  let _inst := Fintype.ofFinite G
  obtain ⟨g, hg⟩ := exists_ne (1 : G)
  rw [← Monoid.lcm_order_eq_exponent]
  have hg' : 2 ≤ orderOf g := Nat.lt_of_le_of_ne (orderOf_pos g) <| by
    simpa [eq_comm, orderOf_eq_one_iff] using hg
  refine hg'.trans <| Nat.le_of_dvd ?_ <| Finset.dvd_lcm (by simp)
  rw [Nat.pos_iff_ne_zero, Ne.def, Finset.lcm_eq_zero_iff]
  rintro ⟨x, -, hx⟩
  

Proof state:
case intro.intro.intro
G : Type u
inst✝² : Group G
inst✝¹ : Finite G
inst✝ : Nontrivial G
_inst : Fintype G := Fintype.ofFinite G
g : G
hg : g ≠ 1
hg' : 2 ≤ orderOf g
x : G
hx : orderOf x = 0
⊢ False

Next tactic:
exact (orderOf_pos x).ne' hx
@[to_additive]
theorem card_dvd_exponent_pow_rank : Nat.card G ∣ Monoid.exponent G ^ Group.rank G := by
  

Proof state:
G : Type u
inst✝¹ : CommGroup G
inst✝ : Group.FG G
⊢ Nat.card G ∣ Monoid.exponent G ^ Group.rank G

Next tactic:
obtain ⟨S, hS1, hS2⟩ := Group.rank_spec G