-- Mathlib/GroupTheory/OrderOfElement.lean
theorem orderOf_eq_iff {n} (h : 0 < n) :
    orderOf x = n ↔ x ^ n = 1 ∧ ∀ m, m < n → 0 < m → x ^ m ≠ 1

Proof state:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ Nat.find h1 = n ↔ IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
rw [find_eq_iff]

Result:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ ((n > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n 1) ∧ ∀ n_1 < n, ¬(n_1 > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n_1 1)) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Proof state:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ (IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ n_1 < n, ¬(n_1 > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n_1 1)) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
push_neg

Result:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ (IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ n_1 < n, n_1 > 0 → ¬IsPeriodicPt (fun x_1 => x * x_1) n_1 1) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Proof state:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ ((n > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n 1) ∧ ∀ n_1 < n, ¬(n_1 > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n_1 1)) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
simp only [h, true_and]

Result:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ (IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ n_1 < n, ¬(n_1 > 0 ∧ IsPeriodicPt (fun x_1 => x * x_1) n_1 1)) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Proof state:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ (IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ n_1 < n, n_1 > 0 → ¬IsPeriodicPt (fun x_1 => x * x_1) n_1 1) ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
rfl

Result:
no goals

Proof state:
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
⊢ orderOf x = n ↔ x ^ n = 1 ∧ ∀ m < n, 0 < m → x ^ m ≠ 1

Tactic:
simp_rw [Ne, ← isPeriodicPt_mul_iff_pow_eq_one, orderOf, minimalPeriod]

Result:
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
⊢ (if h : 1 ∈ periodicPts fun x_1 => x * x_1 then Nat.find h else 0) = n ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Proof state:
case neg
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
⊢ 0 = n ↔ IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
rw [iff_false_left h.ne]

Result:
case neg
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
⊢ ¬(IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1)

Proof state:
case neg
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
⊢ ¬(IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1)

Tactic:
rintro ⟨h', -⟩

Result:
case neg.intro
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
h' : IsPeriodicPt (fun x_1 => x * x_1) n 1
⊢ False

Proof state:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ Nat.find h1 = n ↔ IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
classical
rw [find_eq_iff]
simp only [h, true_and]
push_neg
rfl

Result:
no goals

Proof state:
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
⊢ (if h : 1 ∈ periodicPts fun x_1 => x * x_1 then Nat.find h else 0) = n ↔
    IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Tactic:
split_ifs with h1

Result:
case pos
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∈ periodicPts fun x_1 => x * x_1
⊢ Nat.find h1 = n ↔ IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

case neg
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
⊢ 0 = n ↔ IsPeriodicPt (fun x_1 => x * x_1) n 1 ∧ ∀ m < n, 0 < m → ¬IsPeriodicPt (fun x_1 => x * x_1) m 1

Proof state:
case neg.intro
G : Type u_1
inst✝ : Monoid G
x : G
n : ℕ
h : 0 < n
h1 : 1 ∉ periodicPts fun x_1 => x * x_1
h' : IsPeriodicPt (fun x_1 => x * x_1) n 1
⊢ False

Tactic:
exact h1 ⟨n, h, h'⟩

Result:
no goals