Theorem: Polynomial.IsUnitTrinomial.irreducible_of_coprime'
File: Mathlib/Data/Polynomial/UnitTrinomial.lean

tactic: refine' hp.irreducible_of_coprime fun q hq hq' => _
state_before: p q : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
⊢ Irreducible p

tactic: suffices ¬0 < q.natDegree by
  rcases hq with ⟨p, rfl⟩
  replace hp := hp.leadingCoeff_isUnit
  rw [leadingCoeff_mul] at hp
  replace hp := isUnit_of_mul_isUnit_left hp
  rw [not_lt, le_zero_iff] at this
  rwa [eq_C_of_natDegree_eq_zero this, isUnit_C, ← this]
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
⊢ IsUnit q

tactic: intro hq''
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
⊢ ¬0 < natDegree q

tactic: rw [natDegree_pos_iff_degree_pos] at hq''
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < natDegree q
⊢ False

tactic: rw [← degree_map_eq_of_injective (algebraMap ℤ ℂ).injective_int] at hq''
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree q
⊢ False

tactic: cases' Complex.exists_root hq'' with z hz
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
⊢ False

tactic: rw [IsRoot, eval_map, ← aeval_def] at hz
state_before: case intro
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : IsRoot (map (algebraMap ℤ ℂ) q) z
⊢ False

tactic: refine' h z ⟨_, _⟩
state_before: case intro
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : ↑(aeval z) q = 0
⊢ False

tactic: rcases hq with ⟨p, rfl⟩
state_before: p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
this : ¬0 < natDegree q
⊢ IsUnit q

tactic: replace hp := hp.leadingCoeff_isUnit
state_before: case intro
q✝ q : ℤ[X]
this : ¬0 < natDegree q
p : ℤ[X]
hp : IsUnitTrinomial (q * p)
h : ∀ (z : ℂ), ¬(↑(aeval z) (q * p) = 0 ∧ ↑(aeval z) (mirror (q * p)) = 0)
hq' : q ∣ mirror (q * p)
⊢ IsUnit q

tactic: rw [leadingCoeff_mul] at hp
state_before: case intro
q✝ q : ℤ[X]
this : ¬0 < natDegree q
p : ℤ[X]
h : ∀ (z : ℂ), ¬(↑(aeval z) (q * p) = 0 ∧ ↑(aeval z) (mirror (q * p)) = 0)
hq' : q ∣ mirror (q * p)
hp : IsUnit (leadingCoeff (q * p))
⊢ IsUnit q

tactic: replace hp := isUnit_of_mul_isUnit_left hp
state_before: case intro
q✝ q : ℤ[X]
this : ¬0 < natDegree q
p : ℤ[X]
h : ∀ (z : ℂ), ¬(↑(aeval z) (q * p) = 0 ∧ ↑(aeval z) (mirror (q * p)) = 0)
hq' : q ∣ mirror (q * p)
hp : IsUnit (leadingCoeff q * leadingCoeff p)
⊢ IsUnit q

tactic: rw [not_lt, le_zero_iff] at this
state_before: case intro
q✝ q : ℤ[X]
this : ¬0 < natDegree q
p : ℤ[X]
h : ∀ (z : ℂ), ¬(↑(aeval z) (q * p) = 0 ∧ ↑(aeval z) (mirror (q * p)) = 0)
hq' : q ∣ mirror (q * p)
hp : IsUnit (leadingCoeff q)
⊢ IsUnit q

tactic: rwa [eq_C_of_natDegree_eq_zero this, isUnit_C, ← this]
state_before: case intro
q✝ q : ℤ[X]
this : natDegree q = 0
p : ℤ[X]
h : ∀ (z : ℂ), ¬(↑(aeval z) (q * p) = 0 ∧ ↑(aeval z) (mirror (q * p)) = 0)
hq' : q ∣ mirror (q * p)
hp : IsUnit (leadingCoeff q)
⊢ IsUnit q

tactic: cases' hq with g' hg'
state_before: case intro.refine'_1
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : ↑(aeval z) q = 0
⊢ ↑(aeval z) p = 0

tactic: rw [hg', aeval_mul, hz, zero_mul]
state_before: case intro.refine'_1.intro
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : ↑(aeval z) q = 0
g' : ℤ[X]
hg' : p = q * g'
⊢ ↑(aeval z) p = 0

tactic: cases' hq' with g' hg'
state_before: case intro.refine'_2
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq' : q ∣ mirror p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : ↑(aeval z) q = 0
⊢ ↑(aeval z) (mirror p) = 0

tactic: rw [hg', aeval_mul, hz, zero_mul]
state_before: case intro.refine'_2.intro
p q✝ : ℤ[X]
hp : IsUnitTrinomial p
h : ∀ (z : ℂ), ¬(↑(aeval z) p = 0 ∧ ↑(aeval z) (mirror p) = 0)
q : ℤ[X]
hq : q ∣ p
hq'' : 0 < degree (map (algebraMap ℤ ℂ) q)
z : ℂ
hz : ↑(aeval z) q = 0
g' : ℤ[X]
hg' : mirror p = q * g'
⊢ ↑(aeval z) (mirror p) = 0