l3lab/ntp-mathlib huggingface dataset:
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              

Proof state:
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
t : ↥(zpowers g)
ht : ∀ (y : ↥(zpowers g)), y = t
⊢ g ∈ zpowers g

Next tactic:
change g ∈ Subgroup.zpowers g
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              

Proof state:
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
t : ↥(zpowers g)
ht : ∀ (y : ↥(zpowers g)), y = t
⊢ g ∈ zpowers g

Next tactic:
exact Subgroup.mem_zpowers g
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        

Proof state:
case intro.inl.intro
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
t : ↥(zpowers g)
ht : ∀ (y : ↥(zpowers g)), y = t
hgt : { val := g, property := (_ : g ∈ zpowers g) } = t
⊢ g = 1

Next tactic:
rw [← ht 1] at hgt
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        

Proof state:
case intro.inl.intro
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
t : ↥(zpowers g)
ht : ∀ (y : ↥(zpowers g)), y = t
hgt : { val := g, property := (_ : g ∈ zpowers g) } = 1
⊢ g = 1

Next tactic:
change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        

Proof state:
case intro.inl.intro
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
t : ↥(zpowers g)
ht : ∀ (y : ↥(zpowers g)), y = t
hgt : { val := g, property := (_ : g ∈ zpowers g) } = { val := 1, property := (_ : 1 ∈ (zpowers g).toSubmonoid) }
⊢ g = 1

Next tactic:
simpa using hgt
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        simpa using hgt
      · 

Proof state:
case intro.inr
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
that : Fintype.card ↥(zpowers g) = p
⊢ ∃ g, ∀ (x : α), x ∈ zpowers g

Next tactic:
use g
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        simpa using hgt
      · use g
        

Proof state:
case h
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
that : Fintype.card ↥(zpowers g) = p
⊢ ∀ (x : α), x ∈ zpowers g

Next tactic:
intro x
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        simpa using hgt
      · use g
        intro x
        

Proof state:
case h
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
that : Fintype.card ↥(zpowers g) = p
x : α
⊢ x ∈ zpowers g

Next tactic:
rw [← h] at that
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        simpa using hgt
      · use g
        intro x
        rw [← h] at that
        

Proof state:
case h
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
that : Fintype.card ↥(zpowers g) = Fintype.card α
x : α
⊢ x ∈ zpowers g

Next tactic:
rw [Subgroup.eq_top_of_card_eq _ that]
/-- A finite group of prime order is cyclic. -/
@[to_additive "A finite group of prime order is cyclic."]
theorem isCyclic_of_prime_card {α : Type u} [Group α] [Fintype α] {p : ℕ} [hp : Fact p.Prime]
    (h : Fintype.card α = p) : IsCyclic α :=
  ⟨by
    obtain ⟨g, hg⟩ : ∃ g : α, g ≠ 1 := Fintype.exists_ne_of_one_lt_card (h.symm ▸ hp.1.one_lt) 1
    classical
      -- for Fintype (Subgroup.zpowers g)
      have : Fintype.card (Subgroup.zpowers g) ∣ p := by
        rw [← h]
        apply card_subgroup_dvd_card
      rw [Nat.dvd_prime hp.1] at this
      cases' this with that that
      · rw [Fintype.card_eq_one_iff] at that
        cases' that with t ht
        suffices g = 1 by contradiction
        have hgt :=
          ht
            ⟨g, by
              change g ∈ Subgroup.zpowers g
              exact Subgroup.mem_zpowers g⟩
        rw [← ht 1] at hgt
        change (⟨_, _⟩ : Subgroup.zpowers g) = ⟨_, _⟩ at hgt
        simpa using hgt
      · use g
        intro x
        rw [← h] at that
        rw [Subgroup.eq_top_of_card_eq _ that]
        

Proof state:
case h
α✝ : Type u
a : α✝
inst✝² : Group α✝
α : Type u
inst✝¹ : Group α
inst✝ : Fintype α
p : ℕ
hp : Fact (Nat.Prime p)
h : Fintype.card α = p
g : α
hg : g ≠ 1
that : Fintype.card ↥(zpowers g) = Fintype.card α
x : α
⊢ x ∈ ⊤

Next tactic:
exact Subgroup.mem_top _
@[to_additive]
theorem isCyclic_of_surjective {H G F : Type*} [Group H] [Group G] [hH : IsCyclic H]
    [MonoidHomClass F H G] (f : F) (hf : Function.Surjective f) : IsCyclic G := by
  

Proof state:
α : Type u
a : α
inst✝³ : Group α
H : Type u_1
G : Type u_2
F : Type u_3
inst✝² : Group H
inst✝¹ : Group G
hH : IsCyclic H
inst✝ : MonoidHomClass F H G
f : F
hf : Function.Surjective ⇑f
⊢ IsCyclic G

Next tactic:
obtain ⟨x, hx⟩ := hH
@[to_additive]
theorem isCyclic_of_surjective {H G F : Type*} [Group H] [Group G] [hH : IsCyclic H]
    [MonoidHomClass F H G] (f : F) (hf : Function.Surjective f) : IsCyclic G := by
  obtain ⟨x, hx⟩ := hH
  

Proof state:
case mk.intro
α : Type u
a : α
inst✝³ : Group α
H : Type u_1
G : Type u_2
F : Type u_3
inst✝² : Group H
inst✝¹ : Group G
inst✝ : MonoidHomClass F H G
f : F
hf : Function.Surjective ⇑f
x : H
hx : ∀ (x_1 : H), x_1 ∈ zpowers x
⊢ IsCyclic G

Next tactic:
refine ⟨f x, fun a ↦ ?_⟩
@[to_additive]
theorem isCyclic_of_surjective {H G F : Type*} [Group H] [Group G] [hH : IsCyclic H]
    [MonoidHomClass F H G] (f : F) (hf : Function.Surjective f) : IsCyclic G := by
  obtain ⟨x, hx⟩ := hH
  refine ⟨f x, fun a ↦ ?_⟩
  

Proof state:
case mk.intro
α : Type u
a✝ : α
inst✝³ : Group α
H : Type u_1
G : Type u_2
F : Type u_3
inst✝² : Group H
inst✝¹ : Group G
inst✝ : MonoidHomClass F H G
f : F
hf : Function.Surjective ⇑f
x : H
hx : ∀ (x_1 : H), x_1 ∈ zpowers x
a : G
⊢ a ∈ zpowers (f x)

Next tactic:
obtain ⟨a, rfl⟩ := hf a
@[to_additive]
theorem isCyclic_of_surjective {H G F : Type*} [Group H] [Group G] [hH : IsCyclic H]
    [MonoidHomClass F H G] (f : F) (hf : Function.Surjective f) : IsCyclic G := by
  obtain ⟨x, hx⟩ := hH
  refine ⟨f x, fun a ↦ ?_⟩
  obtain ⟨a, rfl⟩ := hf a
  

Proof state:
case mk.intro.intro
α : Type u
a✝ : α
inst✝³ : Group α
H : Type u_1
G : Type u_2
F : Type u_3
inst✝² : Group H
inst✝¹ : Group G
inst✝ : MonoidHomClass F H G
f : F
hf : Function.Surjective ⇑f
x : H
hx : ∀ (x_1 : H), x_1 ∈ zpowers x
a : H
⊢ f a ∈ zpowers (f x)

Next tactic:
obtain ⟨n, rfl⟩ := hx a
@[to_additive]
theorem isCyclic_of_surjective {H G F : Type*} [Group H] [Group G] [hH : IsCyclic H]
    [MonoidHomClass F H G] (f : F) (hf : Function.Surjective f) : IsCyclic G := by
  obtain ⟨x, hx⟩ := hH
  refine ⟨f x, fun a ↦ ?_⟩
  obtain ⟨a, rfl⟩ := hf a
  obtain ⟨n, rfl⟩ := hx a
  

Proof state:
case mk.intro.intro.intro
α : Type u
a : α
inst✝³ : Group α
H : Type u_1
G : Type u_2
F : Type u_3
inst✝² : Group H
inst✝¹ : Group G
inst✝ : MonoidHomClass F H G
f : F
hf : Function.Surjective ⇑f
x : H
hx : ∀ (x_1 : H), x_1 ∈ zpowers x
n : ℤ
⊢ f ((fun x_1 => x ^ x_1) n) ∈ zpowers (f x)

Next tactic:
exact ⟨n, (map_zpow _ _ _).symm⟩
@[to_additive addOrderOf_eq_card_of_forall_mem_zmultiples]
theorem orderOf_eq_card_of_forall_mem_zpowers [Fintype α] {g : α} (hx : ∀ x, x ∈ zpowers g) :
    orderOf g = Fintype.card α := by
  

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Fintype α
g : α
hx : ∀ (x : α), x ∈ zpowers g
⊢ orderOf g = Fintype.card α

Next tactic:
classical
    rw [← Fintype.card_zpowers]
    apply Fintype.card_of_finset'
    simpa using hx
@[to_additive addOrderOf_eq_card_of_forall_mem_zmultiples]
theorem orderOf_eq_card_of_forall_mem_zpowers [Fintype α] {g : α} (hx : ∀ x, x ∈ zpowers g) :
    orderOf g = Fintype.card α := by
  classical
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Fintype α
g : α
hx : ∀ (x : α), x ∈ zpowers g
⊢ orderOf g = Fintype.card α

Next tactic:
rw [← Fintype.card_zpowers]
@[to_additive addOrderOf_eq_card_of_forall_mem_zmultiples]
theorem orderOf_eq_card_of_forall_mem_zpowers [Fintype α] {g : α} (hx : ∀ x, x ∈ zpowers g) :
    orderOf g = Fintype.card α := by
  classical
    rw [← Fintype.card_zpowers]
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Fintype α
g : α
hx : ∀ (x : α), x ∈ zpowers g
⊢ Fintype.card ↥(zpowers g) = Fintype.card α

Next tactic:
apply Fintype.card_of_finset'
@[to_additive addOrderOf_eq_card_of_forall_mem_zmultiples]
theorem orderOf_eq_card_of_forall_mem_zpowers [Fintype α] {g : α} (hx : ∀ x, x ∈ zpowers g) :
    orderOf g = Fintype.card α := by
  classical
    rw [← Fintype.card_zpowers]
    apply Fintype.card_of_finset'
    

Proof state:
case H
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Fintype α
g : α
hx : ∀ (x : α), x ∈ zpowers g
⊢ ∀ (x : α), x ∈ Finset.univ ↔ x ∈ ↑(zpowers g)

Next tactic:
simpa using hx
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  

Proof state:
α : Type u
a : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
G_cyclic : IsCyclic G
k : ℕ
k_pos : k ≠ 0
k_lt_card_G : k < Fintype.card G
⊢ ∃ a, a ^ k ≠ 1

Next tactic:
rcases G_cyclic with ⟨a, ha⟩
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  rcases G_cyclic with ⟨a, ha⟩
  

Proof state:
case mk.intro
α : Type u
a✝ : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
k : ℕ
k_pos : k ≠ 0
k_lt_card_G : k < Fintype.card G
a : G
ha : ∀ (x : G), x ∈ zpowers a
⊢ ∃ a, a ^ k ≠ 1

Next tactic:
use a
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  rcases G_cyclic with ⟨a, ha⟩
  use a
  

Proof state:
case h
α : Type u
a✝ : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
k : ℕ
k_pos : k ≠ 0
k_lt_card_G : k < Fintype.card G
a : G
ha : ∀ (x : G), x ∈ zpowers a
⊢ a ^ k ≠ 1

Next tactic:
contrapose! k_lt_card_G
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  rcases G_cyclic with ⟨a, ha⟩
  use a
  contrapose! k_lt_card_G
  

Proof state:
case h
α : Type u
a✝ : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
k : ℕ
k_pos : k ≠ 0
a : G
ha : ∀ (x : G), x ∈ zpowers a
k_lt_card_G : a ^ k = 1
⊢ Fintype.card G ≤ k

Next tactic:
convert orderOf_le_of_pow_eq_one k_pos.bot_lt k_lt_card_G
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  rcases G_cyclic with ⟨a, ha⟩
  use a
  contrapose! k_lt_card_G
  convert orderOf_le_of_pow_eq_one k_pos.bot_lt k_lt_card_G
  

Proof state:
case h.e'_3
α : Type u
a✝ : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
k : ℕ
k_pos : k ≠ 0
a : G
ha : ∀ (x : G), x ∈ zpowers a
k_lt_card_G : a ^ k = 1
⊢ Fintype.card G = orderOf a

Next tactic:
rw [← Fintype.card_zpowers, eq_comm, Subgroup.card_eq_iff_eq_top, eq_top_iff]
@[to_additive]
theorem exists_pow_ne_one_of_isCyclic {G : Type*} [Group G] [Fintype G] [G_cyclic : IsCyclic G]
    {k : ℕ} (k_pos : k ≠ 0) (k_lt_card_G : k < Fintype.card G) : ∃ a : G, a ^ k ≠ 1 := by
  rcases G_cyclic with ⟨a, ha⟩
  use a
  contrapose! k_lt_card_G
  convert orderOf_le_of_pow_eq_one k_pos.bot_lt k_lt_card_G
  rw [← Fintype.card_zpowers, eq_comm, Subgroup.card_eq_iff_eq_top, eq_top_iff]
  

Proof state:
case h.e'_3
α : Type u
a✝ : α
inst✝² : Group α
G : Type u_1
inst✝¹ : Group G
inst✝ : Fintype G
k : ℕ
k_pos : k ≠ 0
a : G
ha : ∀ (x : G), x ∈ zpowers a
k_lt_card_G : a ^ k = 1
⊢ ⊤ ≤ zpowers a

Next tactic:
exact fun x _ ↦ ha x
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
⊢ orderOf g = 0

Next tactic:
classical
    rw [orderOf_eq_zero_iff']
    refine' fun n hn hgn => _
    have ho := isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn, hgn⟩
    obtain ⟨x, hx⟩ :=
      Infinite.exists_not_mem_finset
        (Finset.image (fun x => g ^ x) <| Finset.range <| orderOf g)
    apply hx
    rw [← ho.mem_powers_iff_mem_range_orderOf, Submonoid.mem_powers_iff]
    obtain ⟨k, hk⟩ := h x
    dsimp at hk
    obtain ⟨k, rfl | rfl⟩ := k.eq_nat_or_neg
    · exact ⟨k, mod_cast hk⟩
    rw [← zpow_mod_orderOf] at hk
    have : 0 ≤ (-k % orderOf g : ℤ) := Int.emod_nonneg (-k) (mod_cast ho.orderOf_pos.ne')
    refine' ⟨(-k % orderOf g : ℤ).toNat, _⟩
    rwa [← zpow_ofNat, Int.toNat_of_nonneg this]
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
⊢ orderOf g = 0

Next tactic:
rw [orderOf_eq_zero_iff']
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    rw [orderOf_eq_zero_iff']
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
⊢ ∀ (n : ℕ), 0 < n → g ^ n ≠ 1

Next tactic:
refine' fun n hn hgn => _
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    rw [orderOf_eq_zero_iff']
    refine' fun n hn hgn => _
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
n : ℕ
hn : 0 < n
hgn : g ^ n = 1
⊢ False

Next tactic:
have ho := isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn, hgn⟩
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    rw [orderOf_eq_zero_iff']
    refine' fun n hn hgn => _
    have ho := isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn, hgn⟩
    

Proof state:
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
n : ℕ
hn : 0 < n
hgn : g ^ n = 1
ho : IsOfFinOrder g
⊢ False

Next tactic:
obtain ⟨x, hx⟩ :=
      Infinite.exists_not_mem_finset
        (Finset.image (fun x => g ^ x) <| Finset.range <| orderOf g)
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    rw [orderOf_eq_zero_iff']
    refine' fun n hn hgn => _
    have ho := isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn, hgn⟩
    obtain ⟨x, hx⟩ :=
      Infinite.exists_not_mem_finset
        (Finset.image (fun x => g ^ x) <| Finset.range <| orderOf g)
    

Proof state:
case intro
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
n : ℕ
hn : 0 < n
hgn : g ^ n = 1
ho : IsOfFinOrder g
x : α
hx : x ∉ Finset.image (fun x => g ^ x) (Finset.range (orderOf g))
⊢ False

Next tactic:
apply hx
@[to_additive Infinite.addOrderOf_eq_zero_of_forall_mem_zmultiples]
theorem Infinite.orderOf_eq_zero_of_forall_mem_zpowers [Infinite α] {g : α}
    (h : ∀ x, x ∈ zpowers g) : orderOf g = 0 := by
  classical
    rw [orderOf_eq_zero_iff']
    refine' fun n hn hgn => _
    have ho := isOfFinOrder_iff_pow_eq_one.mpr ⟨n, hn, hgn⟩
    obtain ⟨x, hx⟩ :=
      Infinite.exists_not_mem_finset
        (Finset.image (fun x => g ^ x) <| Finset.range <| orderOf g)
    apply hx
    

Proof state:
case intro
α : Type u
a : α
inst✝¹ : Group α
inst✝ : Infinite α
g : α
h : ∀ (x : α), x ∈ zpowers g
n : ℕ
hn : 0 < n
hgn : g ^ n = 1
ho : IsOfFinOrder g
x : α
hx : x ∉ Finset.image (fun x => g ^ x) (Finset.range (orderOf g))
⊢ x ∈ Finset.image (fun x => g ^ x) (Finset.range (orderOf g))

Next tactic:
rw [← ho.mem_powers_iff_mem_range_orderOf, Submonoid.mem_powers_iff]