Theorem: Polynomial.mono_map_natDegree_eq
File: Mathlib/Data/Polynomial/EraseLead.lean

tactic: refine' induction_with_natDegree_le (fun p => (φ p).natDegree = fu p.natDegree)
  p.natDegree (by simp [fu0]) _ _ _ rfl.le
state_before: R : Type u_3
inst✝² : Semiring R
f : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
⊢ natDegree (↑φ p) = fu (natDegree p)

tactic: simp [fu0]
state_before: R : Type u_3
inst✝² : Semiring R
f : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
⊢ (fun p => natDegree (↑φ p) = fu (natDegree p)) 0

tactic: intro n r r0 _
state_before: case refine'_1
R : Type u_3
inst✝² : Semiring R
f : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
⊢ ∀ (n : ℕ) (r : R), r ≠ 0 → n ≤ natDegree p → (fun p => natDegree (↑φ p) = fu (natDegree p)) (↑C r * X ^ n)

tactic: rw [natDegree_C_mul_X_pow _ _ r0, C_mul_X_pow_eq_monomial, φ_mon_nat _ _ r0]
state_before: case refine'_1
R : Type u_3
inst✝² : Semiring R
f : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
n : ℕ
r : R
r0 : r ≠ 0
a✝ : n ≤ natDegree p
⊢ natDegree (↑φ (↑C r * X ^ n)) = fu (natDegree (↑C r * X ^ n))

tactic: intro f g fg _ fk gk
state_before: case refine'_2
R : Type u_3
inst✝² : Semiring R
f : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
⊢ ∀ (f g : R[X]),
    natDegree f < natDegree g →
      natDegree g ≤ natDegree p →
        (fun p => natDegree (↑φ p) = fu (natDegree p)) f →
          (fun p => natDegree (↑φ p) = fu (natDegree p)) g → (fun p => natDegree (↑φ p) = fu (natDegree p)) (f + g)

tactic: rw [natDegree_add_eq_right_of_natDegree_lt fg, _root_.map_add]
state_before: case refine'_2
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
⊢ natDegree (↑φ (f + g)) = fu (natDegree (f + g))

tactic: by_cases FG : k ≤ f.natDegree
state_before: case refine'_2
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
⊢ natDegree (↑φ f + ↑φ g) = fu (natDegree g)

tactic: rw [natDegree_add_eq_right_of_natDegree_lt, gk]
state_before: case pos
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
FG : k ≤ natDegree f
⊢ natDegree (↑φ f + ↑φ g) = fu (natDegree g)

tactic: rw [fk, gk]
state_before: case pos
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
FG : k ≤ natDegree f
⊢ natDegree (↑φ f) < natDegree (↑φ g)

tactic: exact fc FG fg
state_before: case pos
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
FG : k ≤ natDegree f
⊢ fu (natDegree f) < fu (natDegree g)

tactic: cases k
state_before: case neg
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
k : ℕ
fu : ℕ → ℕ
fu0 : ∀ {n : ℕ}, n ≤ k → fu n = 0
fc : ∀ {n m : ℕ}, k ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < k → ↑φ f = 0
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
FG : ¬k ≤ natDegree f
⊢ natDegree (↑φ f + ↑φ g) = fu (natDegree g)

tactic: exact (FG (Nat.zero_le _)).elim
state_before: case neg.zero
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
fu : ℕ → ℕ
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
fu0 : ∀ {n : ℕ}, n ≤ Nat.zero → fu n = 0
fc : ∀ {n m : ℕ}, Nat.zero ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < Nat.zero → ↑φ f = 0
FG : ¬Nat.zero ≤ natDegree f
⊢ natDegree (↑φ f + ↑φ g) = fu (natDegree g)

tactic: rwa [φ_k (not_le.mp FG), zero_add]
state_before: case neg.succ
R : Type u_3
inst✝² : Semiring R
f✝ : R[X]
S : Type u_1
F : Type u_2
inst✝¹ : Semiring S
inst✝ : AddMonoidHomClass F R[X] S[X]
φ : F
p : R[X]
fu : ℕ → ℕ
φ_mon_nat : ∀ (n : ℕ) (c : R), c ≠ 0 → natDegree (↑φ (↑(monomial n) c)) = fu n
f g : R[X]
fg : natDegree f < natDegree g
a✝ : natDegree g ≤ natDegree p
fk : natDegree (↑φ f) = fu (natDegree f)
gk : natDegree (↑φ g) = fu (natDegree g)
n✝ : ℕ
fu0 : ∀ {n : ℕ}, n ≤ Nat.succ n✝ → fu n = 0
fc : ∀ {n m : ℕ}, Nat.succ n✝ ≤ n → n < m → fu n < fu m
φ_k : ∀ {f : R[X]}, natDegree f < Nat.succ n✝ → ↑φ f = 0
FG : ¬Nat.succ n✝ ≤ natDegree f
⊢ natDegree (↑φ f + ↑φ g) = fu (natDegree g)