Theorem: Polynomial.monomial_mem_lifts_and_degree_eq
File: Mathlib/Algebra/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 ∧ 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: 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 ∧ 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: 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 ∧ 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: 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 ∧ 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: 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
⊢ ∃ 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: 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 : (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: constructor
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: 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
⊢ ((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: 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
⊢ ((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: simp only [hzero, hqzero, Ne, not_false_iff, degree_C_mul_X_pow]
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: 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 ∧ 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 : ℕ
hl : (monomial n) s ∈ lifts f
hzero : s = 0
⊢ map f 0 = (monomial n) s ∧ degree 0 = ((monomial n) s).degree

tactic: simp only [hzero, degree_zero, eq_self_iff_true, and_self_iff, monomial_zero_right,
  Polynomial.map_zero]
state_before: case h
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 = ((monomial n) s).degree
state_after: no goals

tactic: simp? [coeff_monomial] at hq says simp only [coeff_map, coeff_monomial, ↓reduceIte] 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 : (map f q).coeff n = ((monomial n) s).coeff n
⊢ f (q.coeff n) = s
state_after: 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 (q.coeff n) = s
⊢ f (q.coeff 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 (q.coeff n) = s
⊢ f (q.coeff n) = s
state_after: no goals

tactic: simp only [coeff_map, coeff_monomial, ↓reduceIte] 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 : (map f q).coeff n = ((monomial n) s).coeff n
⊢ f (q.coeff n) = s
state_after: 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 (q.coeff n) = s
⊢ f (q.coeff n) = s

tactic: simp only [hcoeff, map_monomial]
state_before: 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
state_after: no goals

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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
⊢ q.coeff n ≠ 0
state_after: 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
habs : q.coeff n = 0
⊢ False

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 : (map f q).coeff n = ((monomial n) s).coeff n
hcoeff : f (q.coeff n) = s
habs : q.coeff n = 0
⊢ False
state_after: 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
habs : q.coeff n = 0
hcoeff : 0 = s
⊢ 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 : (map f q).coeff n = ((monomial n) s).coeff n
habs : q.coeff n = 0
hcoeff : 0 = s
⊢ False
state_after: no goals