Theorem: Polynomial.EisensteinCriterionAux.map_eq_C_mul_X_pow_of_forall_coeff_mem
File: Mathlib/RingTheory/EisensteinCriterion.lean

tactic: by_cases hf0 : f = 0
state_before: R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: rcases lt_trichotomy (n : WithBot ℕ) (degree f) with (h | h | h)
state_before: case neg
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: simp [hf0]
state_before: case pos
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : f = 0
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: erw [coeff_map, eq_zero_iff_mem.2 (hfP n h), coeff_C_mul, coeff_X_pow, if_neg,
  MulZeroClass.mul_zero]
state_before: case neg.inl
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : ↑n < degree f
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: rintro rfl
state_before: case neg.inl.hnc
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : ↑n < degree f
⊢ ¬n = natDegree f

tactic: exact not_lt_of_ge degree_le_natDegree h
state_before: case neg.inl.hnc
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
hf0 : ¬f = 0
h : ↑(natDegree f) < degree f
⊢ False

tactic: have : natDegree f = n := natDegree_eq_of_degree_eq_some h.symm
state_before: case neg.inr.inl
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : ↑n = degree f
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: rw [coeff_C_mul, coeff_X_pow, if_pos this.symm, mul_one, leadingCoeff, this, coeff_map]
state_before: case neg.inr.inl
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : ↑n = degree f
this : natDegree f = n
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: rw [coeff_eq_zero_of_degree_lt, coeff_eq_zero_of_degree_lt]
state_before: case neg.inr.inr
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : degree f < ↑n
⊢ coeff (map (mk P) f) n = coeff (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) n

tactic: refine' lt_of_le_of_lt (degree_C_mul_X_pow_le _ _) _
state_before: case neg.inr.inr
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : degree f < ↑n
⊢ degree (↑C (↑(mk P) (leadingCoeff f)) * X ^ natDegree f) < ↑n

tactic: rwa [← degree_eq_natDegree hf0]
state_before: case neg.inr.inr
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : degree f < ↑n
⊢ ↑(natDegree f) < ↑n

tactic: exact lt_of_le_of_lt (degree_map_le _ _) h
state_before: case neg.inr.inr
R : Type u_1
inst✝ : CommRing R
f : R[X]
P : Ideal R
hfP : ∀ (n : ℕ), ↑n < degree f → coeff f n ∈ P
n : ℕ
hf0 : ¬f = 0
h : degree f < ↑n
⊢ degree (map (mk P) f) < ↑n