-- Mathlib/FieldTheory/IsSepClosed.lean
theorem exists_pow_nat_eq [IsSepClosed k] (x : k) (n : ℕ) [hn : NeZero (n : k)] :
    ∃ z, z ^ n = x

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero 0
h : n = 0
⊢ False

Tactic:
exact hn.out rfl

Result:
no goals

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
h : n = 0
⊢ False

Tactic:
rw [h, Nat.cast_zero] at hn

Result:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero 0
h : n = 0
⊢ False

Proof state:
case pos
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : x = 0
⊢ ∃ z, z ^ n = x

Tactic:
exact ⟨0, by rw [hx, pow_eq_zero_iff hn'.ne']⟩

Result:
no goals

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
⊢ ∃ z, z ^ n = x

Tactic:
have hn' : 0 < n := Nat.pos_of_ne_zero fun h => by
  rw [h, Nat.cast_zero] at hn
  exact hn.out rfl

Result:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
⊢ ∃ z, z ^ n = x

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
⊢ ∃ z, z ^ n = x

Tactic:
by_cases hx : x = 0

Result:
case pos
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : x = 0
⊢ ∃ z, z ^ n = x

case neg
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
⊢ ∃ z, z ^ n = x

Proof state:
case neg.intro
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
z : k
hz : (X ^ n - C x).IsRoot z
⊢ ∃ z, z ^ n = x

Tactic:
use z

Result:
case h
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
z : k
hz : (X ^ n - C x).IsRoot z
⊢ z ^ n = x

Proof state:
case h
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
z : k
hz : (X ^ n - C x).IsRoot z
⊢ z ^ n = x

Tactic:
simpa [eval_C, eval_X, eval_pow, eval_sub, IsRoot.def, sub_eq_zero] using hz

Result:
no goals

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
⊢ ∃ z, z ^ n = x

Tactic:
have : degree (X ^ n - C x) ≠ 0 := by
  rw [degree_X_pow_sub_C hn' x]
  exact (WithBot.coe_lt_coe.2 hn').ne'

Result:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
⊢ ∃ z, z ^ n = x

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
⊢ (X ^ n - C x).degree ≠ 0

Tactic:
rw [degree_X_pow_sub_C hn' x]

Result:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
⊢ ↑n ≠ 0

Proof state:
case neg
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
⊢ ∃ z, z ^ n = x

Tactic:
obtain ⟨z, hz⟩ := exists_root _ this <| separable_X_pow_sub_C x hn.out hx

Result:
case neg.intro
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : ¬x = 0
z : k
hz : (X ^ n - C x).IsRoot z
⊢ ∃ z, z ^ n = x

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
⊢ ↑n ≠ 0

Tactic:
exact (WithBot.coe_lt_coe.2 hn').ne'

Result:
no goals

Proof state:
k : Type u
inst✝¹ : Field k
inst✝ : IsSepClosed k
x : k
n : ℕ
hn : NeZero ↑n
hn' : 0 < n
this : (X ^ n - C x).degree ≠ 0
hx : x = 0
⊢ 0 ^ n = x

Tactic:
rw [hx, pow_eq_zero_iff hn'.ne']

Result:
no goals