R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν =
    ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
R : Type u_1
inst✝ : CommRing R
n : ℕ
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
have p : ((((Finset.range (n + 1)).sum fun ν => (ν * (ν - 1)) • bernsteinPolynomial R n ν) +
    (1 - (2 * n) • Polynomial.X) * (Finset.range (n + 1)).sum fun ν =>
      ν • bernsteinPolynomial R n ν) + n ^ 2 • X ^ 2 *
        (Finset.range (n + 1)).sum fun ν => bernsteinPolynomial R n ν) = _ :=
  rfl
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν =
    ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
conv at p =>
  lhs
  rw [Finset.mul_sum, Finset.mul_sum, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib]
  simp only [← nat_cast_mul]
  simp only [← mul_assoc]
  simp only [← add_mul]
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν +
        (↑1 - (2 * n) • X) * ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν +
      n ^ 2 • X ^ 2 * ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
conv at p =>
  rhs
  rw [sum, sum_smul, sum_mul_smul, ← nat_cast_mul]
case calc_1
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
k : ℕ
m : k ∈ Finset.range (n + 1)
⊢ (n • X - ↑k) ^ 2 * bernsteinPolynomial R n k =
    (↑(k * (k - 1)) + (↑1 - ↑(2 * n) * X) * ↑k + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n k

case calc_2
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1 = n • X * (1 - X)
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ∑ ν in Finset.range (n + 1), (n • X - ↑ν) ^ 2 * bernsteinPolynomial R n ν = n • X * (1 - X)
calc
  _ = _ := Finset.sum_congr rfl fun k m => ?_
  _ = _ := p
  _ = _ := ?_
case calc_1.e_a
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
k : ℕ
m : k ∈ Finset.range (n + 1)
⊢ (n • X - ↑k) ^ 2 = ↑(k * (k - 1)) + (↑1 - ↑(2 * n) * X) * ↑k + ↑(n ^ 2) * X ^ 2
case calc_1
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
k : ℕ
m : k ∈ Finset.range (n + 1)
⊢ (n • X - ↑k) ^ 2 * bernsteinPolynomial R n k =
    (↑(k * (k - 1)) + (↑1 - ↑(2 * n) * X) * ↑k + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n k
congr 1
case calc_1.e_a
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
k : ℕ
m : k ∈ Finset.range (n + 1)
⊢ (↑n * X - ↑k) ^ 2 = ↑k * ↑(k - 1) + (1 - 2 * ↑n * X) * ↑k + ↑n ^ 2 * X ^ 2
case calc_1.e_a
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
k : ℕ
m : k ∈ Finset.range (n + 1)
⊢ (n • X - ↑k) ^ 2 = ↑(k * (k - 1)) + (↑1 - ↑(2 * n) * X) * ↑k + ↑(n ^ 2) * X ^ 2
simp only [← nat_cast_mul, push_cast]
case calc_1.e_a.succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
n✝ : ℕ
m : Nat.succ n✝ ∈ Finset.range (n + 1)
⊢ (↑n * X - (↑n✝ + 1)) ^ 2 = (↑n✝ + 1) * ↑n✝ + (1 - 2 * ↑n * X) * (↑n✝ + 1) + ↑n ^ 2 * X ^ 2
case calc_1.e_a.succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
n✝ : ℕ
m : Nat.succ n✝ ∈ Finset.range (n + 1)
⊢ (↑n * X - ↑(Nat.succ n✝)) ^ 2 =
    ↑(Nat.succ n✝) * ↑(Nat.succ n✝ - 1) + (1 - 2 * ↑n * X) * ↑(Nat.succ n✝) + ↑n ^ 2 * X ^ 2
simp
no goals
case calc_1.e_a.succ
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
n✝ : ℕ
m : Nat.succ n✝ ∈ Finset.range (n + 1)
⊢ (↑n * X - (↑n✝ + 1)) ^ 2 = (↑n✝ + 1) * ↑n✝ + (1 - 2 * ↑n * X) * (↑n✝ + 1) + ↑n ^ 2 * X ^ 2
ring
case calc_2
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ↑n * ↑(n - 1) * X ^ 2 + (1 - 2 * ↑n * X) * (↑n * X) + ↑n ^ 2 * X ^ 2 * 1 = ↑n * X * (1 - X)
case calc_2
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1 = n • X * (1 - X)
simp only [← nat_cast_mul, push_cast]
case calc_2.zero
R : Type u_1
inst✝ : CommRing R
p :
  ∑ x in Finset.range (Nat.zero + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.zero) * X) * ↑x + ↑(Nat.zero ^ 2) * X ^ 2) * bernsteinPolynomial R Nat.zero x =
    ↑(Nat.zero * (Nat.zero - 1)) * X ^ 2 + (↑1 - (2 * Nat.zero) • X) * Nat.zero • X + Nat.zero ^ 2 • X ^ 2 * 1
⊢ ↑Nat.zero * ↑(Nat.zero - 1) * X ^ 2 + (1 - 2 * ↑Nat.zero * X) * (↑Nat.zero * X) + ↑Nat.zero ^ 2 * X ^ 2 * 1 =
    ↑Nat.zero * X * (1 - X)

case calc_2.succ
R : Type u_1
inst✝ : CommRing R
n✝ : ℕ
p :
  ∑ x in Finset.range (Nat.succ n✝ + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.succ n✝) * X) * ↑x + ↑(Nat.succ n✝ ^ 2) * X ^ 2) *
        bernsteinPolynomial R (Nat.succ n✝) x =
    ↑(Nat.succ n✝ * (Nat.succ n✝ - 1)) * X ^ 2 + (↑1 - (2 * Nat.succ n✝) • X) * Nat.succ n✝ • X +
      Nat.succ n✝ ^ 2 • X ^ 2 * 1
⊢ ↑(Nat.succ n✝) * ↑(Nat.succ n✝ - 1) * X ^ 2 + (1 - 2 * ↑(Nat.succ n✝) * X) * (↑(Nat.succ n✝) * X) +
      ↑(Nat.succ n✝) ^ 2 * X ^ 2 * 1 =
    ↑(Nat.succ n✝) * X * (1 - X)
case calc_2
R : Type u_1
inst✝ : CommRing R
n : ℕ
p :
  ∑ x in Finset.range (n + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * n) * X) * ↑x + ↑(n ^ 2) * X ^ 2) * bernsteinPolynomial R n x =
    ↑(n * (n - 1)) * X ^ 2 + (↑1 - (2 * n) • X) * n • X + n ^ 2 • X ^ 2 * 1
⊢ ↑n * ↑(n - 1) * X ^ 2 + (1 - 2 * ↑n * X) * (↑n * X) + ↑n ^ 2 * X ^ 2 * 1 = ↑n * X * (1 - X)
cases n
no goals
case calc_2.zero
R : Type u_1
inst✝ : CommRing R
p :
  ∑ x in Finset.range (Nat.zero + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.zero) * X) * ↑x + ↑(Nat.zero ^ 2) * X ^ 2) * bernsteinPolynomial R Nat.zero x =
    ↑(Nat.zero * (Nat.zero - 1)) * X ^ 2 + (↑1 - (2 * Nat.zero) • X) * Nat.zero • X + Nat.zero ^ 2 • X ^ 2 * 1
⊢ ↑Nat.zero * ↑(Nat.zero - 1) * X ^ 2 + (1 - 2 * ↑Nat.zero * X) * (↑Nat.zero * X) + ↑Nat.zero ^ 2 * X ^ 2 * 1 =
    ↑Nat.zero * X * (1 - X)
simp
case calc_2.succ
R : Type u_1
inst✝ : CommRing R
n✝ : ℕ
p :
  ∑ x in Finset.range (Nat.succ n✝ + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.succ n✝) * X) * ↑x + ↑(Nat.succ n✝ ^ 2) * X ^ 2) *
        bernsteinPolynomial R (Nat.succ n✝) x =
    ↑(Nat.succ n✝ * (Nat.succ n✝ - 1)) * X ^ 2 + (↑1 - (2 * Nat.succ n✝) • X) * Nat.succ n✝ • X +
      Nat.succ n✝ ^ 2 • X ^ 2 * 1
⊢ (↑n✝ + 1) * ↑n✝ * X ^ 2 + (1 - 2 * (↑n✝ + 1) * X) * ((↑n✝ + 1) * X) + (↑n✝ + 1) ^ 2 * X ^ 2 = (↑n✝ + 1) * X * (1 - X)
case calc_2.succ
R : Type u_1
inst✝ : CommRing R
n✝ : ℕ
p :
  ∑ x in Finset.range (Nat.succ n✝ + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.succ n✝) * X) * ↑x + ↑(Nat.succ n✝ ^ 2) * X ^ 2) *
        bernsteinPolynomial R (Nat.succ n✝) x =
    ↑(Nat.succ n✝ * (Nat.succ n✝ - 1)) * X ^ 2 + (↑1 - (2 * Nat.succ n✝) • X) * Nat.succ n✝ • X +
      Nat.succ n✝ ^ 2 • X ^ 2 * 1
⊢ ↑(Nat.succ n✝) * ↑(Nat.succ n✝ - 1) * X ^ 2 + (1 - 2 * ↑(Nat.succ n✝) * X) * (↑(Nat.succ n✝) * X) +
      ↑(Nat.succ n✝) ^ 2 * X ^ 2 * 1 =
    ↑(Nat.succ n✝) * X * (1 - X)
simp
no goals
case calc_2.succ
R : Type u_1
inst✝ : CommRing R
n✝ : ℕ
p :
  ∑ x in Finset.range (Nat.succ n✝ + 1),
      (↑(x * (x - 1)) + (↑1 - ↑(2 * Nat.succ n✝) * X) * ↑x + ↑(Nat.succ n✝ ^ 2) * X ^ 2) *
        bernsteinPolynomial R (Nat.succ n✝) x =
    ↑(Nat.succ n✝ * (Nat.succ n✝ - 1)) * X ^ 2 + (↑1 - (2 * Nat.succ n✝) • X) * Nat.succ n✝ • X +
      Nat.succ n✝ ^ 2 • X ^ 2 * 1
⊢ (↑n✝ + 1) * ↑n✝ * X ^ 2 + (1 - 2 * (↑n✝ + 1) * X) * ((↑n✝ + 1) * X) + (↑n✝ + 1) ^ 2 * X ^ 2 = (↑n✝ + 1) * X * (1 - X)
ring