Theorem: IsPrimitiveRoot.zpow_of_gcd_eq_one
File: Mathlib/RingTheory/RootsOfUnity/Basic.lean

tactic: by_cases h0 : 0 ≤ i
state_before: M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: have : 0 ≤ -i := by simp only [not_le, neg_nonneg] at h0 ⊢; exact le_of_lt h0
state_before: case neg
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: lift -i to ℕ using this with i' hi'
state_before: case neg
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
this : 0 ≤ -i
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: rw [← inv_iff, ← zpow_neg, ← hi', zpow_ofNat]
state_before: case neg.intro
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
i' : ℕ
hi' : ↑i' = -i
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: apply h.pow_of_coprime
state_before: case neg.intro
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
i' : ℕ
hi' : ↑i' = -i
⊢ IsPrimitiveRoot (ζ ^ i') k

tactic: rw [Int.gcd, ← Int.natAbs_neg, ← hi'] at hi
state_before: case neg.intro.hi
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
i' : ℕ
hi' : ↑i' = -i
⊢ Nat.coprime i' k

tactic: exact hi
state_before: case neg.intro.hi
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
h0 : ¬0 ≤ i
i' : ℕ
hi : Nat.gcd (Int.natAbs ↑i') (Int.natAbs ↑k) = 1
hi' : ↑i' = -i
⊢ Nat.coprime i' k

tactic: lift i to ℕ using h0
state_before: case pos
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : 0 ≤ i
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: rw [zpow_ofNat]
state_before: case pos.intro
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℕ
hi : Int.gcd ↑i ↑k = 1
⊢ IsPrimitiveRoot (ζ ^ ↑i) k

tactic: exact h.pow_of_coprime i hi
state_before: case pos.intro
M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℕ
hi : Int.gcd ↑i ↑k = 1
⊢ IsPrimitiveRoot (ζ ^ i) k

tactic: simp only [not_le, neg_nonneg] at h0 ⊢
state_before: M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : ¬0 ≤ i
⊢ 0 ≤ -i

tactic: exact le_of_lt h0
state_before: M : Type ?u.2707630
N : Type ?u.2707633
G : Type u_1
R : Type ?u.2707639
S : Type ?u.2707642
F : Type ?u.2707645
inst✝² : CommMonoid M
inst✝¹ : CommMonoid N
inst✝ : DivisionCommMonoid G
k l : ℕ
ζ : G
h : IsPrimitiveRoot ζ k
i : ℤ
hi : Int.gcd i ↑k = 1
h0 : i < 0
⊢ i ≤ 0