Theorem: bernsteinPolynomial.iterate_derivative_at_0
File: Mathlib/RingTheory/Polynomial/Bernstein.lean

tactic: by_cases h : ν ≤ n
state_before: R : Type u_1
inst✝ : CommRing R
n ν : ℕ
⊢ eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)

tactic: induction' ν with ν ih generalizing n
state_before: case pos
R : Type u_1
inst✝ : CommRing R
n ν : ℕ
h : ν ≤ n
⊢ eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)

tactic: simp [eval_at_0]
state_before: case pos.zero
R : Type u_1
inst✝ : CommRing R
n✝ ν : ℕ
h✝ : ν ≤ n✝
n : ℕ
h : Nat.zero ≤ n
⊢ eval 0 ((↑derivative^[Nat.zero]) (bernsteinPolynomial R n Nat.zero)) =
    eval (↑(n - (Nat.zero - 1))) (pochhammer R Nat.zero)

tactic: have h' : ν ≤ n - 1 := le_tsub_of_add_le_right h
state_before: case pos.succ
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
⊢ eval 0 ((↑derivative^[Nat.succ ν]) (bernsteinPolynomial R n (Nat.succ ν))) =
    eval (↑(n - (Nat.succ ν - 1))) (pochhammer R (Nat.succ ν))

tactic: simp only [derivative_succ, ih (n - 1) h', iterate_derivative_succ_at_0_eq_zero,
  Nat.succ_sub_succ_eq_sub, tsub_zero, sub_zero, iterate_derivative_sub,
  iterate_derivative_nat_cast_mul, eval_one, eval_mul, eval_add, eval_sub, eval_X, eval_comp,
  eval_nat_cast, Function.comp_apply, Function.iterate_succ, pochhammer_succ_left]
state_before: case pos.succ
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
⊢ eval 0 ((↑derivative^[Nat.succ ν]) (bernsteinPolynomial R n (Nat.succ ν))) =
    eval (↑(n - (Nat.succ ν - 1))) (pochhammer R (Nat.succ ν))

tactic: obtain rfl | h'' := ν.eq_zero_or_pos
state_before: case pos.succ
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
⊢ ↑n * eval (↑(n - 1 - (ν - 1))) (pochhammer R ν) = ↑(n - ν) * eval (↑(n - ν) + 1) (pochhammer R ν)

tactic: simp
state_before: case pos.succ.inl
R : Type u_1
inst✝ : CommRing R
n✝ ν : ℕ
h✝ : ν ≤ n✝
n : ℕ
ih : ∀ (n : ℕ), 0 ≤ n → eval 0 ((↑derivative^[0]) (bernsteinPolynomial R n 0)) = eval (↑(n - (0 - 1))) (pochhammer R 0)
h : Nat.succ 0 ≤ n
h' : 0 ≤ n - 1
⊢ ↑n * eval (↑(n - 1 - (0 - 1))) (pochhammer R 0) = ↑(n - 0) * eval (↑(n - 0) + 1) (pochhammer R 0)

tactic: have : n - 1 - (ν - 1) = n - ν := by
  rw [gt_iff_lt, ← Nat.succ_le_iff] at h''
  rw [← tsub_add_eq_tsub_tsub, add_comm, tsub_add_cancel_of_le h'']
state_before: case pos.succ.inr
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
h'' : ν > 0
⊢ ↑n * eval (↑(n - 1 - (ν - 1))) (pochhammer R ν) = ↑(n - ν) * eval (↑(n - ν) + 1) (pochhammer R ν)

tactic: rw [this, pochhammer_eval_succ]
state_before: case pos.succ.inr
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
h'' : ν > 0
this : n - 1 - (ν - 1) = n - ν
⊢ ↑n * eval (↑(n - 1 - (ν - 1))) (pochhammer R ν) = ↑(n - ν) * eval (↑(n - ν) + 1) (pochhammer R ν)

tactic: rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
state_before: case pos.succ.inr
R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
h'' : ν > 0
this : n - 1 - (ν - 1) = n - ν
⊢ ↑n * eval (↑(n - ν)) (pochhammer R ν) = (↑(n - ν) + ↑ν) * eval (↑(n - ν)) (pochhammer R ν)

tactic: rw [gt_iff_lt, ← Nat.succ_le_iff] at h''
state_before: R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
h'' : ν > 0
⊢ n - 1 - (ν - 1) = n - ν

tactic: rw [← tsub_add_eq_tsub_tsub, add_comm, tsub_add_cancel_of_le h'']
state_before: R : Type u_1
inst✝ : CommRing R
n✝ ν✝ : ℕ
h✝ : ν✝ ≤ n✝
ν : ℕ
ih : ∀ (n : ℕ), ν ≤ n → eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)
n : ℕ
h : Nat.succ ν ≤ n
h' : ν ≤ n - 1
h'' : Nat.succ 0 ≤ ν
⊢ n - 1 - (ν - 1) = n - ν

tactic: simp only [not_le] at h
state_before: case neg
R : Type u_1
inst✝ : CommRing R
n ν : ℕ
h : ¬ν ≤ n
⊢ eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)

tactic: rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
state_before: case neg
R : Type u_1
inst✝ : CommRing R
n ν : ℕ
h : n < ν
⊢ eval 0 ((↑derivative^[ν]) (bernsteinPolynomial R n ν)) = eval (↑(n - (ν - 1))) (pochhammer R ν)

tactic: simp [pos_iff_ne_zero.mp (pos_of_gt h)]
state_before: case neg
R : Type u_1
inst✝ : CommRing R
n ν : ℕ
h : n < ν
⊢ eval 0 ((↑derivative^[ν]) 0) = eval (↑0) (pochhammer R ν)