-- Mathlib/RingTheory/Polynomial/Cyclotomic/Eval.lean
theorem cyclotomic_neg_one_pos {n : ℕ} (hn : 2 < n) {R} [LinearOrderedCommRing R] :
    0 < eval (-1 : R) (cyclotomic n R)

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (↑(-1)) (cyclotomic n ℝ)

Tactic:
simp only [Int.cast_one, Int.cast_neg]

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Proof state:
case intro
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hy : IsPrimitiveRoot y n
⊢ False

Tactic:
rw [hy.eq_orderOf] at hn

Result:
case intro
n : ℕ
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hn : 2 < orderOf y
hy : IsPrimitiveRoot y n
⊢ False

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (↑(-1)) (cyclotomic n ℤ)

Tactic:
suffices 0 < eval (↑(-1 : ℤ)) (cyclotomic n ℝ) by
  rw [← map_cyclotomic_int n ℝ, eval_intCast_map, Int.coe_castRingHom] at this
  simpa only [Int.cast_pos] using this

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (↑(-1)) (cyclotomic n ℝ)

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : (cyclotomic n ℝ).coeff 0 = 1
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Tactic:
rw [coeff_zero_eq_eval_zero] at h0

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (-1) (cyclotomic n R)

Tactic:
rw [← map_cyclotomic_int, ← Int.cast_one, ← Int.cast_neg, eval_intCast_map, Int.coe_castRingHom,
  Int.cast_pos]

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (↑(-1)) (cyclotomic n ℤ)

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
this : 0 < (fun x => ↑x) (eval (↑(-1)) (cyclotomic n ℤ))
⊢ 0 < eval (↑(-1)) (cyclotomic n ℤ)

Tactic:
simpa only [Int.cast_pos] using this

Result:
no goals

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
⊢ 0 < eval (-1) (cyclotomic n R)

Tactic:
haveI := NeZero.of_gt hn

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (-1) (cyclotomic n R)

Proof state:
case intro
n : ℕ
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hn : 2 < orderOf y
hy : IsPrimitiveRoot y n
⊢ False

Tactic:
exact hn.not_le LinearOrderedRing.orderOf_le_two

Result:
no goals

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
this : 0 < eval (↑(-1)) (cyclotomic n ℝ)
⊢ 0 < eval (↑(-1)) (cyclotomic n ℤ)

Tactic:
rw [← map_cyclotomic_int n ℝ, eval_intCast_map, Int.coe_castRingHom] at this

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
this : 0 < (fun x => ↑x) (eval (↑(-1)) (cyclotomic n ℤ))
⊢ 0 < eval (↑(-1)) (cyclotomic n ℤ)

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
⊢ False

Tactic:
obtain ⟨y, hy : IsRoot _ y⟩ := this (show (0 : ℝ) ∈ Set.Icc _ _ by simpa [h0] using hx)

Result:
case intro
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hy : (cyclotomic n ℝ).IsRoot y
⊢ False

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Tactic:
have h0 := cyclotomic_coeff_zero ℝ hn.le

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : (cyclotomic n ℝ).coeff 0 = 1
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Proof state:
case intro
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hy : (cyclotomic n ℝ).IsRoot y
⊢ False

Tactic:
rw [@isRoot_cyclotomic_iff] at hy

Result:
case intro
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
y : ℝ
hy : IsPrimitiveRoot y n
⊢ False

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
⊢ 0 < eval (-1) (cyclotomic n ℝ)

Tactic:
by_contra! hx

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
⊢ False

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
⊢ 0 ∈ Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ))

Tactic:
simpa [h0] using hx

Result:
no goals

Proof state:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
⊢ False

Tactic:
have := intermediate_value_univ (-1) 0 (cyclotomic n ℝ).continuous

Result:
n : ℕ
hn : 2 < n
R : Type u_1
inst✝ : LinearOrderedCommRing R
this✝ : NeZero n
h0 : eval 0 (cyclotomic n ℝ) = 1
hx : eval (-1) (cyclotomic n ℝ) ≤ 0
this : Set.Icc (eval (-1) (cyclotomic n ℝ)) (eval 0 (cyclotomic n ℝ)) ⊆ Set.range fun x => eval x (cyclotomic n ℝ)
⊢ False