Theorem: Polynomial.monomial_mem_lifts_and_degree_eq
File: Mathlib/Data/Polynomial/Lifts.lean

tactic: by_cases hzero : s = 0
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hl : ↑(monomial n) s ∈ lifts f
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: rw [lifts_iff_set_range] at hl
state_before: case neg
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hl : ↑(monomial n) s ∈ lifts f
hzero : ¬s = 0
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: obtain ⟨q, hq⟩ := hl
state_before: case neg
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hl : ↑(monomial n) s ∈ Set.range (map f)
hzero : ¬s = 0
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: replace hq := (ext_iff.1 hq) n
state_before: case neg.intro
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : map f q = ↑(monomial n) s
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: have hcoeff : f (q.coeff n) = s := by
  simp [coeff_monomial] at hq
  exact hq
state_before: case neg.intro
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: use monomial n (q.coeff n)
state_before: case neg.intro
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: constructor
state_before: case neg.intro
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
⊢ map f (↑(monomial n) (coeff q n)) = ↑(monomial n) s ∧ degree (↑(monomial n) (coeff q n)) = degree (↑(monomial n) s)

tactic: have hqzero : q.coeff n ≠ 0 := by
  intro habs
  simp only [habs, RingHom.map_zero] at hcoeff
  exact hzero hcoeff.symm
state_before: case neg.intro.right
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
⊢ degree (↑(monomial n) (coeff q n)) = degree (↑(monomial n) s)

tactic: rw [← C_mul_X_pow_eq_monomial]
state_before: case neg.intro.right
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
hqzero : coeff q n ≠ 0
⊢ degree (↑(monomial n) (coeff q n)) = degree (↑(monomial n) s)

tactic: rw [← C_mul_X_pow_eq_monomial]
state_before: case neg.intro.right
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
hqzero : coeff q n ≠ 0
⊢ degree (↑C (coeff q n) * X ^ n) = degree (↑(monomial n) s)

tactic: simp only [hzero, hqzero, Ne.def, not_false_iff, degree_C_mul_X_pow]
state_before: case neg.intro.right
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
hqzero : coeff q n ≠ 0
⊢ degree (↑C (coeff q n) * X ^ n) = degree (↑C s * X ^ n)

tactic: use 0
state_before: case pos
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hl : ↑(monomial n) s ∈ lifts f
hzero : s = 0
⊢ ∃ q, map f q = ↑(monomial n) s ∧ degree q = degree (↑(monomial n) s)

tactic: simp only [hzero, degree_zero, eq_self_iff_true, and_self_iff, monomial_zero_right,
  Polynomial.map_zero]
state_before: case pos
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hl : ↑(monomial n) s ∈ lifts f
hzero : s = 0
⊢ map f 0 = ↑(monomial n) s ∧ degree 0 = degree (↑(monomial n) s)

tactic: simp [coeff_monomial] at hq
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
⊢ ↑f (coeff q n) = s

tactic: exact hq
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : ↑f (coeff q n) = s
⊢ ↑f (coeff q n) = s

tactic: simp only [hcoeff, map_monomial]
state_before: case neg.intro.left
R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
⊢ map f (↑(monomial n) (coeff q n)) = ↑(monomial n) s

tactic: intro habs
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
⊢ coeff q n ≠ 0

tactic: simp only [habs, RingHom.map_zero] at hcoeff
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
hcoeff : ↑f (coeff q n) = s
habs : coeff q n = 0
⊢ False

tactic: exact hzero hcoeff.symm
state_before: R : Type u
inst✝¹ : Semiring R
S : Type v
inst✝ : Semiring S
f : R →+* S
s : S
n : ℕ
hzero : ¬s = 0
q : R[X]
hq : coeff (map f q) n = coeff (↑(monomial n) s) n
habs : coeff q n = 0
hcoeff : 0 = s
⊢ False