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

Proof steps:
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 ∧ q.degree = ((monomial n) s).degree
state_after: 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 ∧ q.degree = ((monomial n) s).degree

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 ∧ q.degree = ((monomial n) s).degree
tactic: by_cases hzero : s = 0
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 ∧ q.degree = ((monomial n) s).degree
state_after: 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 ∧ q.degree = ((monomial n) s).degree
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 ∈ Set.range (map f)
hzero : ¬s = 0
⊢ ∃ q, map f q = (monomial n) s ∧ q.degree = ((monomial n) s).degree
state_after: 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 ∧ q.degree = ((monomial n) s).degree
tactic: obtain ⟨q, hq⟩ := hl
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 ∧ q.degree = ((monomial n) s).degree
state_after: 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).coeff n = ((monomial n) s).coeff n
⊢ ∃ q, map f q = (monomial n) s ∧ q.degree = ((monomial n) s).degree
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).coeff n = ((monomial n) s).coeff n
⊢ ∃ q, map f q = (monomial n) s ∧ q.degree = ((monomial n) s).degree
state_after: 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).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ ∃ q, map f q = (monomial n) s ∧ q.degree = ((monomial n) s).degree
tactic: have hcoeff : f (q.coeff n) = s := by
    simp? [coeff_monomial] at hq says simp only [coeff_map, coeff_monomial, ↓reduceIte] 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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ ∃ q, map f q = (monomial n) s ∧ q.degree = ((monomial n) s).degree
state_after: case h
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).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ map f ((monomial n) (q.coeff n)) = (monomial n) s ∧ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
tactic: use monomial n (q.coeff n)
state_before: case h
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).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ map f ((monomial n) (q.coeff n)) = (monomial n) s ∧ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
state_after: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ map f ((monomial n) (q.coeff n)) = (monomial n) s

case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
tactic: constructor
state_before: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
state_after: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
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 h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ ((monomial n) (q.coeff n)).degree = ((monomial n) s).degree
state_after: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ (C (q.coeff n) * X ^ n).degree = ((monomial n) s).degree
tactic: rw [← C_mul_X_pow_eq_monomial]
state_before: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ (C (q.coeff n) * X ^ n).degree = ((monomial n) s).degree
state_after: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ (C (q.coeff n) * X ^ n).degree = (C s * X ^ n).degree
tactic: rw [← C_mul_X_pow_eq_monomial]
state_before: case h.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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
hqzero : q.coeff n ≠ 0
⊢ (C (q.coeff n) * X ^ n).degree = (C s * X ^ n).degree
state_after: no goals
tactic: simp only [hzero, hqzero, Ne, not_false_iff, degree_C_mul_X_pow]