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

tactic: let x : MvPolynomial Bool R := MvPolynomial.X true
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: let y : MvPolynomial Bool R := MvPolynomial.X false
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: have pderiv_true_x : pderiv true x = 1 := by rw [pderiv_X]; rfl
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: have pderiv_true_y : pderiv true y = 0 := by rw [pderiv_X]; rfl
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: let e : Bool → R[X] := fun i => cond i X (1 - X)
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: trans MvPolynomial.aeval e (pderiv true ((x + y) ^ n)) * X
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X

tactic: rw [pderiv_X]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
⊢ ↑(pderiv true) x = 1

tactic: rfl
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
⊢ Pi.single true 1 true = 1

tactic: rw [pderiv_X]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
⊢ ↑(pderiv true) y = 0

tactic: rfl
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
⊢ Pi.single true 1 false = 0

tactic: rw [add_pow, (pderiv true).map_sum, (MvPolynomial.aeval e).map_sum, Finset.sum_mul]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
w : ∀ (k : ℕ), k • bernsteinPolynomial R n k = ↑k * X ^ (k - 1) * (1 - X) ^ (n - k) * ↑(choose n k) * X
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν =
    ↑(MvPolynomial.aeval e) (↑(pderiv true) ((x + y) ^ n)) * X

tactic: refine' Finset.sum_congr rfl fun k _ => (w k).trans _
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
w : ∀ (k : ℕ), k • bernsteinPolynomial R n k = ↑k * X ^ (k - 1) * (1 - X) ^ (n - k) * ↑(choose n k) * X
⊢ ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν =
    ∑ x_1 in Finset.range (n + 1),
      ↑(MvPolynomial.aeval e) (↑(pderiv true) (x ^ x_1 * y ^ (n - x_1) * ↑(choose n x_1))) * X

tactic: simp only [pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, Bool.cond_true,
  Bool.cond_false, add_zero, mul_one, MulZeroClass.mul_zero, smul_zero, MvPolynomial.aeval_X,
  MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_coe_nat, map_natCast, map_pow,
  map_mul]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
w : ∀ (k : ℕ), k • bernsteinPolynomial R n k = ↑k * X ^ (k - 1) * (1 - X) ^ (n - k) * ↑(choose n k) * X
k : ℕ
x✝ : k ∈ Finset.range (n + 1)
⊢ ↑k * X ^ (k - 1) * (1 - X) ^ (n - k) * ↑(choose n k) * X =
    ↑(MvPolynomial.aeval e) (↑(pderiv true) (x ^ k * y ^ (n - k) * ↑(choose n k))) * X

tactic: rintro (_ | k)
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
⊢ ∀ (k : ℕ), k • bernsteinPolynomial R n k = ↑k * X ^ (k - 1) * (1 - X) ^ (n - k) * ↑(choose n k) * X

tactic: simp
state_before: case zero
R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
⊢ Nat.zero • bernsteinPolynomial R n Nat.zero =
    ↑Nat.zero * X ^ (Nat.zero - 1) * (1 - X) ^ (n - Nat.zero) * ↑(choose n Nat.zero) * X

tactic: rw [bernsteinPolynomial]
state_before: case succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
k : ℕ
⊢ Nat.succ k • bernsteinPolynomial R n (Nat.succ k) =
    ↑(Nat.succ k) * X ^ (Nat.succ k - 1) * (1 - X) ^ (n - Nat.succ k) * ↑(choose n (Nat.succ k)) * X

tactic: simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
state_before: case succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
k : ℕ
⊢ Nat.succ k • (↑(choose n (Nat.succ k)) * X ^ Nat.succ k * (1 - X) ^ (n - Nat.succ k)) =
    ↑(Nat.succ k) * X ^ (Nat.succ k - 1) * (1 - X) ^ (n - Nat.succ k) * ↑(choose n (Nat.succ k)) * X

tactic: push_cast
state_before: case succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
k : ℕ
⊢ ↑(k + 1) * (↑(choose n (k + 1)) * (X * X ^ k) * (1 - X) ^ (n - (k + 1))) =
    ↑(k + 1) * X ^ k * (1 - X) ^ (n - (k + 1)) * ↑(choose n (k + 1)) * X

tactic: ring
state_before: case succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
k : ℕ
⊢ (↑k + 1) * (↑(choose n (k + 1)) * (X * X ^ k) * (1 - X) ^ (n - (k + 1))) =
    (↑k + 1) * X ^ k * (1 - X) ^ (n - (k + 1)) * ↑(choose n (k + 1)) * X

tactic: rw [(pderiv true).leibniz_pow, (pderiv true).map_add, pderiv_true_x, pderiv_true_y]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
⊢ ↑(MvPolynomial.aeval e) (↑(pderiv true) ((x + y) ^ n)) * X = n • X

tactic: simp only [Algebra.id.smul_eq_mul, nsmul_eq_mul, map_natCast, map_pow, map_add, map_mul,
  Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow,
  add_zero, mul_one]
state_before: R : Type u_1
inst✝ : CommRing R
n : ℕ
x : MvPolynomial Bool R := MvPolynomial.X true
y : MvPolynomial Bool R := MvPolynomial.X false
pderiv_true_x : ↑(pderiv true) x = 1
pderiv_true_y : ↑(pderiv true) y = 0
e : Bool → R[X] := fun i => bif i then X else 1 - X
⊢ ↑(MvPolynomial.aeval e) (n • (x + y) ^ (n - 1) • (1 + 0)) * X = n • X