ring_theory.polynomial.bernstein
⟷
Mathlib.RingTheory.Polynomial.Bernstein
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -133,10 +133,10 @@ theorem derivative_succ_aux (n ν : ℕ) :
↑(n.choose (ν + 1)) * X ^ (ν + 1) * (1 - X) ^ (n - (ν + 1)))
by
simpa only [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
- Polynomial.derivative_mul, Polynomial.derivative_nat_cast, MulZeroClass.zero_mul,
- Nat.cast_add, algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add,
- Polynomial.derivative_sub, Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ←
- Nat.cast_succ, Polynomial.C_eq_nat_cast]
+ Polynomial.derivative_mul, Polynomial.derivative_natCast, MulZeroClass.zero_mul, Nat.cast_add,
+ algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add, Polynomial.derivative_sub,
+ Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ← Nat.cast_succ,
+ Polynomial.C_eq_natCast]
conv_rhs => rw [mul_sub]
-- We'll prove the two terms match up separately.
refine' congr (congr_arg Sub.sub _) _
@@ -184,7 +184,7 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
· simp [eval_at_0]
· simp only [derivative_succ, Int.natCast_eq_zero, mul_eq_zero, Function.comp_apply,
Function.iterate_succ, Polynomial.iterate_derivative_sub,
- Polynomial.iterate_derivative_nat_cast_mul, Polynomial.eval_mul, Polynomial.eval_nat_cast,
+ Polynomial.iterate_derivative_natCast_mul, Polynomial.eval_mul, Polynomial.eval_natCast,
Polynomial.eval_sub]
intro h
apply mul_eq_zero_of_right
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -389,7 +389,7 @@ theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPol
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, 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,
+ MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_natCast, map_natCast, map_pow,
map_mul]
· rw [(pderiv tt).leibniz_pow, (pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y]
simp only [Algebra.id.smul_eq_mul, nsmul_eq_mul, map_natCast, map_pow, map_add, map_mul, e,
@@ -437,11 +437,11 @@ theorem sum_mul_smul (n : ℕ) :
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
Bool.cond_false, add_zero, zero_add, MulZeroClass.mul_zero, smul_zero, mul_one,
MvPolynomial.aeval_X, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne,
- Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
+ Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_natCast, map_natCast, map_pow,
map_mul, map_add]
-- On the right hand side, we'll just simplify.
·
- simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
+ simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_natCast,
(pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, add_zero, mul_one,
Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, e, Bool.cond_true, Bool.cond_false,
MvPolynomial.aeval_X, add_sub_cancel, one_pow, smul_smul, smul_one_mul]
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,12 +3,12 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
-import Data.Polynomial.Derivative
+import Algebra.Polynomial.Derivative
import Data.Nat.Choose.Sum
import RingTheory.Polynomial.Pochhammer
-import Data.Polynomial.AlgebraMap
+import Algebra.Polynomial.AlgebraMap
import LinearAlgebra.LinearIndependent
-import Data.MvPolynomial.PDeriv
+import Algebra.MvPolynomial.PDeriv
#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -8,7 +8,7 @@ import Data.Nat.Choose.Sum
import RingTheory.Polynomial.Pochhammer
import Data.Polynomial.AlgebraMap
import LinearAlgebra.LinearIndependent
-import Data.MvPolynomial.Pderiv
+import Data.MvPolynomial.PDeriv
#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
@@ -182,7 +182,7 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
· rw [Nat.lt_succ_iff]
induction' k with k ih generalizing n ν
· simp [eval_at_0]
- · simp only [derivative_succ, Int.coe_nat_eq_zero, mul_eq_zero, Function.comp_apply,
+ · simp only [derivative_succ, Int.natCast_eq_zero, mul_eq_zero, Function.comp_apply,
Function.iterate_succ, Polynomial.iterate_derivative_sub,
Polynomial.iterate_derivative_nat_cast_mul, Polynomial.eval_mul, Polynomial.eval_nat_cast,
Polynomial.eval_sub]
@@ -236,7 +236,7 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 ≠ 0 :=
by
- simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
+ simp only [Int.natCast_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
Nat.cast_eq_zero]
simp only [← ascPochhammer_eval_cast]
norm_cast
@@ -381,7 +381,7 @@ theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPol
rintro (_ | k)
· simp
· rw [bernsteinPolynomial]
- simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
+ simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ']
push_cast
ring
rw [add_pow, (pderiv tt).map_sum, (MvPolynomial.aeval e).map_sum, Finset.sum_mul]
@@ -393,8 +393,8 @@ theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPol
map_mul]
· rw [(pderiv tt).leibniz_pow, (pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y]
simp only [Algebra.id.smul_eq_mul, nsmul_eq_mul, map_natCast, map_pow, map_add, map_mul, e,
- Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow,
- add_zero, mul_one]
+ Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel, one_pow, add_zero,
+ mul_one]
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
-/
@@ -427,7 +427,7 @@ theorem sum_mul_smul (n : ℕ) :
· simp
· simp
· rw [bernsteinPolynomial]
- simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
+ simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ']
push_cast
ring
rw [add_pow, (pderiv tt).map_sum, (pderiv tt).map_sum, (MvPolynomial.aeval e).map_sum,
@@ -444,7 +444,7 @@ theorem sum_mul_smul (n : ℕ) :
simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
(pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, add_zero, mul_one,
Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, e, Bool.cond_true, Bool.cond_false,
- MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow, smul_smul, smul_one_mul]
+ MvPolynomial.aeval_X, add_sub_cancel, one_pow, smul_smul, smul_one_mul]
#align bernstein_polynomial.sum_mul_smul bernsteinPolynomial.sum_mul_smul
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -222,11 +222,11 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
· simp
· have : n - 1 - (ν - 1) = n - ν :=
by
- rw [← Nat.succ_le_iff] at h''
+ rw [← Nat.succ_le_iff] at h''
rw [← tsub_add_eq_tsub_tsub, add_comm, tsub_add_cancel_of_le h'']
rw [this, ascPochhammer_eval_succ]
rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
- · simp only [not_le] at h
+ · simp only [not_le] at h
rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
simp [pos_iff_ne_zero.mp (pos_of_gt h)]
#align bernstein_polynomial.iterate_derivative_at_0 bernsteinPolynomial.iterate_derivative_at_0
@@ -243,7 +243,7 @@ theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
apply ne_of_gt
obtain rfl | h' := Nat.eq_zero_or_pos ν
· simp
- · rw [← Nat.succ_pred_eq_of_pos h'] at h
+ · rw [← Nat.succ_pred_eq_of_pos h'] at h
exact ascPochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
#align bernstein_polynomial.iterate_derivative_at_0_ne_zero bernsteinPolynomial.iterate_derivative_at_0_ne_zero
-/
@@ -305,7 +305,7 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
-- We show that the (n-k)-th derivative at 1 doesn't vanish,
-- but vanishes for everything in the span.
clear ih
- simp only [Nat.succ_eq_add_one, add_le_add_iff_right] at h
+ simp only [Nat.succ_eq_add_one, add_le_add_iff_right] at h
simp only [Fin.val_last, Fin.init_def]
dsimp
apply not_mem_span_of_apply_not_mem_span_image (@Polynomial.derivative ℚ _ ^ (n - k))
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,12 +3,12 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
-import Mathbin.Data.Polynomial.Derivative
-import Mathbin.Data.Nat.Choose.Sum
-import Mathbin.RingTheory.Polynomial.Pochhammer
-import Mathbin.Data.Polynomial.AlgebraMap
-import Mathbin.LinearAlgebra.LinearIndependent
-import Mathbin.Data.MvPolynomial.Pderiv
+import Data.Polynomial.Derivative
+import Data.Nat.Choose.Sum
+import RingTheory.Polynomial.Pochhammer
+import Data.Polynomial.AlgebraMap
+import LinearAlgebra.LinearIndependent
+import Data.MvPolynomial.Pderiv
#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/001ffdc42920050657fd45bd2b8bfbec8eaaeb29
@@ -208,7 +208,7 @@ open Polynomial
@[simp]
theorem iterate_derivative_at_0 (n ν : ℕ) :
((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 =
- (pochhammer R ν).eval (n - (ν - 1) : ℕ) :=
+ (ascPochhammer R ν).eval (n - (ν - 1) : ℕ) :=
by
by_cases h : ν ≤ n
· induction' ν with ν ih generalizing n h
@@ -217,14 +217,14 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
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]
+ eval_nat_cast, Function.comp_apply, Function.iterate_succ, ascPochhammer_succ_left]
obtain rfl | h'' := ν.eq_zero_or_pos
· simp
· have : n - 1 - (ν - 1) = n - ν :=
by
rw [← Nat.succ_le_iff] at h''
rw [← tsub_add_eq_tsub_tsub, add_comm, tsub_add_cancel_of_le h'']
- rw [this, pochhammer_eval_succ]
+ rw [this, ascPochhammer_eval_succ]
rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
· simp only [not_le] at h
rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
@@ -238,13 +238,13 @@ theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
by
simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
Nat.cast_eq_zero]
- simp only [← pochhammer_eval_cast]
+ simp only [← ascPochhammer_eval_cast]
norm_cast
apply ne_of_gt
obtain rfl | h' := Nat.eq_zero_or_pos ν
· simp
· rw [← Nat.succ_pred_eq_of_pos h'] at h
- exact pochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
+ exact ascPochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
#align bernstein_polynomial.iterate_derivative_at_0_ne_zero bernsteinPolynomial.iterate_derivative_at_0_ne_zero
-/
@@ -268,7 +268,7 @@ theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
@[simp]
theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 =
- (-1) ^ (n - ν) * (pochhammer R (n - ν)).eval (ν + 1) :=
+ (-1) ^ (n - ν) * (ascPochhammer R (n - ν)).eval (ν + 1) :=
by
rw [flip' _ _ _ h]
simp [Polynomial.eval_comp, h]
@@ -285,8 +285,8 @@ theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 ≠ 0 :=
by
rw [bernsteinPolynomial.iterate_derivative_at_1 _ _ _ h, Ne.def, neg_one_pow_mul_eq_zero_iff, ←
- Nat.cast_succ, ← pochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
- exact (pochhammer_pos _ _ (Nat.succ_pos ν)).ne'
+ Nat.cast_succ, ← ascPochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
+ exact (ascPochhammer_pos _ _ (Nat.succ_pos ν)).ne'
#align bernstein_polynomial.iterate_derivative_at_1_ne_zero bernsteinPolynomial.iterate_derivative_at_1_ne_zero
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.bernstein
-! leanprover-community/mathlib commit 36938f775671ff28bea1c0310f1608e4afbb22e0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Polynomial.Derivative
import Mathbin.Data.Nat.Choose.Sum
@@ -15,6 +10,8 @@ import Mathbin.Data.Polynomial.AlgebraMap
import Mathbin.LinearAlgebra.LinearIndependent
import Mathbin.Data.MvPolynomial.Pderiv
+#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"36938f775671ff28bea1c0310f1608e4afbb22e0"
+
/-!
# Bernstein polynomials
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -77,10 +77,12 @@ section
variable {R} {S : Type _} [CommRing S]
+#print bernsteinPolynomial.map /-
@[simp]
theorem map (f : R →+* S) (n ν : ℕ) :
(bernsteinPolynomial R n ν).map f = bernsteinPolynomial S n ν := by simp [bernsteinPolynomial]
#align bernstein_polynomial.map bernsteinPolynomial.map
+-/
end
@@ -98,6 +100,7 @@ theorem flip' (n ν : ℕ) (h : ν ≤ n) :
#align bernstein_polynomial.flip' bernsteinPolynomial.flip'
-/
+#print bernsteinPolynomial.eval_at_0 /-
theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0 then 1 else 0 :=
by
rw [bernsteinPolynomial]
@@ -105,7 +108,9 @@ theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0
· subst h; simp
· simp [zero_pow (Nat.pos_of_ne_zero h)]
#align bernstein_polynomial.eval_at_0 bernsteinPolynomial.eval_at_0
+-/
+#print bernsteinPolynomial.eval_at_1 /-
theorem eval_at_1 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 1 = if ν = n then 1 else 0 :=
by
rw [bernsteinPolynomial]
@@ -115,7 +120,9 @@ theorem eval_at_1 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 1 = if ν = n
· simp [Nat.choose_eq_zero_of_lt ((tsub_eq_zero_iff_le.mp w).lt_of_ne (Ne.symm h))]
· simp [zero_pow w]
#align bernstein_polynomial.eval_at_1 bernsteinPolynomial.eval_at_1
+-/
+#print bernsteinPolynomial.derivative_succ_aux /-
theorem derivative_succ_aux (n ν : ℕ) :
(bernsteinPolynomial R (n + 1) (ν + 1)).derivative =
(n + 1) * (bernsteinPolynomial R n ν - bernsteinPolynomial R n (ν + 1)) :=
@@ -149,7 +156,9 @@ theorem derivative_succ_aux (n ν : ℕ) :
simp
· apply mul_comm
#align bernstein_polynomial.derivative_succ_aux bernsteinPolynomial.derivative_succ_aux
+-/
+#print bernsteinPolynomial.derivative_succ /-
theorem derivative_succ (n ν : ℕ) :
(bernsteinPolynomial R n (ν + 1)).derivative =
n * (bernsteinPolynomial R (n - 1) ν - bernsteinPolynomial R (n - 1) (ν + 1)) :=
@@ -158,12 +167,16 @@ theorem derivative_succ (n ν : ℕ) :
· simp [bernsteinPolynomial]
· rw [Nat.cast_succ]; apply derivative_succ_aux
#align bernstein_polynomial.derivative_succ bernsteinPolynomial.derivative_succ
+-/
+#print bernsteinPolynomial.derivative_zero /-
theorem derivative_zero (n : ℕ) :
(bernsteinPolynomial R n 0).derivative = -n * bernsteinPolynomial R (n - 1) 0 := by
simp [bernsteinPolynomial, Polynomial.derivative_pow]
#align bernstein_polynomial.derivative_zero bernsteinPolynomial.derivative_zero
+-/
+#print bernsteinPolynomial.iterate_derivative_at_0_eq_zero_of_lt /-
theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
k < ν → ((Polynomial.derivative^[k]) (bernsteinPolynomial R n ν)).eval 0 = 0 :=
by
@@ -182,15 +195,19 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
convert ih _ _ (Nat.pred_le_pred h)
exact (Nat.succ_pred_eq_of_pos (k.succ_pos.trans_le h)).symm
#align bernstein_polynomial.iterate_derivative_at_0_eq_zero_of_lt bernsteinPolynomial.iterate_derivative_at_0_eq_zero_of_lt
+-/
+#print bernsteinPolynomial.iterate_derivative_succ_at_0_eq_zero /-
@[simp]
theorem iterate_derivative_succ_at_0_eq_zero (n ν : ℕ) :
((Polynomial.derivative^[ν]) (bernsteinPolynomial R n (ν + 1))).eval 0 = 0 :=
iterate_derivative_at_0_eq_zero_of_lt R n (lt_add_one ν)
#align bernstein_polynomial.iterate_derivative_succ_at_0_eq_zero bernsteinPolynomial.iterate_derivative_succ_at_0_eq_zero
+-/
open Polynomial
+#print bernsteinPolynomial.iterate_derivative_at_0 /-
@[simp]
theorem iterate_derivative_at_0 (n ν : ℕ) :
((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 =
@@ -216,7 +233,9 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
simp [pos_iff_ne_zero.mp (pos_of_gt h)]
#align bernstein_polynomial.iterate_derivative_at_0 bernsteinPolynomial.iterate_derivative_at_0
+-/
+#print bernsteinPolynomial.iterate_derivative_at_0_ne_zero /-
theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 ≠ 0 :=
by
@@ -230,6 +249,7 @@ theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
· rw [← Nat.succ_pred_eq_of_pos h'] at h
exact pochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
#align bernstein_polynomial.iterate_derivative_at_0_ne_zero bernsteinPolynomial.iterate_derivative_at_0_ne_zero
+-/
/-!
Rather than redoing the work of evaluating the derivatives at 1,
@@ -237,6 +257,7 @@ we use the symmetry of the Bernstein polynomials.
-/
+#print bernsteinPolynomial.iterate_derivative_at_1_eq_zero_of_lt /-
theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
k < n - ν → ((Polynomial.derivative^[k]) (bernsteinPolynomial R n ν)).eval 1 = 0 :=
by
@@ -244,7 +265,9 @@ theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
rw [flip' _ _ _ (tsub_pos_iff_lt.mp (pos_of_gt w)).le]
simp [Polynomial.eval_comp, iterate_derivative_at_0_eq_zero_of_lt R n w]
#align bernstein_polynomial.iterate_derivative_at_1_eq_zero_of_lt bernsteinPolynomial.iterate_derivative_at_1_eq_zero_of_lt
+-/
+#print bernsteinPolynomial.iterate_derivative_at_1 /-
@[simp]
theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 =
@@ -258,7 +281,9 @@ theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
norm_cast
rw [← tsub_add_eq_tsub_tsub, tsub_tsub_cancel_of_le (nat.succ_le_iff.mpr h')]
#align bernstein_polynomial.iterate_derivative_at_1 bernsteinPolynomial.iterate_derivative_at_1
+-/
+#print bernsteinPolynomial.iterate_derivative_at_1_ne_zero /-
theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 ≠ 0 :=
by
@@ -266,6 +291,7 @@ theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
Nat.cast_succ, ← pochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
exact (pochhammer_pos _ _ (Nat.succ_pos ν)).ne'
#align bernstein_polynomial.iterate_derivative_at_1_ne_zero bernsteinPolynomial.iterate_derivative_at_1_ne_zero
+-/
open Submodule
@@ -333,6 +359,7 @@ open Polynomial
open MvPolynomial
+#print bernsteinPolynomial.sum_smul /-
theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X :=
by
-- We calculate the `x`-derivative of `(x+y)^n`, evaluated at `y=(1-x)`,
@@ -372,7 +399,9 @@ theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPol
Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow,
add_zero, mul_one]
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
+-/
+#print bernsteinPolynomial.sum_mul_smul /-
theorem sum_mul_smul (n : ℕ) :
∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν =
(n * (n - 1)) • X ^ 2 :=
@@ -420,7 +449,9 @@ theorem sum_mul_smul (n : ℕ) :
Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, e, Bool.cond_true, Bool.cond_false,
MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow, smul_smul, smul_one_mul]
#align bernstein_polynomial.sum_mul_smul bernsteinPolynomial.sum_mul_smul
+-/
+#print bernsteinPolynomial.variance /-
/-- A certain linear combination of the previous three identities,
which we'll want later.
-/
@@ -455,6 +486,7 @@ theorem variance (n : ℕ) :
· simp
· simp; ring
#align bernstein_polynomial.variance bernsteinPolynomial.variance
+-/
end bernsteinPolynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -321,9 +321,9 @@ theorem linearIndependent (n : ℕ) :
-/
#print bernsteinPolynomial.sum /-
-theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = 1 :=
+theorem sum (n : ℕ) : ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν = 1 :=
calc
- (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n := by rw [add_pow];
+ ∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν = (X + (1 - X)) ^ n := by rw [add_pow];
simp only [bernsteinPolynomial, mul_comm, mul_assoc, mul_left_comm]
_ = 1 := by simp
#align bernstein_polynomial.sum bernsteinPolynomial.sum
@@ -333,7 +333,7 @@ open Polynomial
open MvPolynomial
-theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν) = n • X :=
+theorem sum_smul (n : ℕ) : ∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν = n • X :=
by
-- We calculate the `x`-derivative of `(x+y)^n`, evaluated at `y=(1-x)`,
-- either directly or by using the binomial theorem.
@@ -374,7 +374,7 @@ theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPo
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
theorem sum_mul_smul (n : ℕ) :
- (∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν) =
+ ∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν =
(n * (n - 1)) • X ^ 2 :=
by
-- We calculate the second `x`-derivative of `(x+y)^n`, evaluated at `y=(1-x)`,
@@ -425,7 +425,7 @@ theorem sum_mul_smul (n : ℕ) :
which we'll want later.
-/
theorem variance (n : ℕ) :
- (∑ ν in Finset.range (n + 1), (n • Polynomial.X - ν) ^ 2 * bernsteinPolynomial R n ν) =
+ ∑ ν in Finset.range (n + 1), (n • Polynomial.X - ν) ^ 2 * bernsteinPolynomial R n ν =
n • Polynomial.X * (1 - Polynomial.X) :=
by
have p :
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -326,7 +326,6 @@ theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n
(∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n := by rw [add_pow];
simp only [bernsteinPolynomial, mul_comm, mul_assoc, mul_left_comm]
_ = 1 := by simp
-
#align bernstein_polynomial.sum bernsteinPolynomial.sum
-/
@@ -449,7 +448,6 @@ theorem variance (n : ℕ) :
_ = _ := Finset.sum_congr rfl fun k m => _
_ = _ := p
_ = _ := _
-
· congr 1; simp only [← nat_cast_mul, push_cast]
cases k <;> · simp; ring
· simp only [← nat_cast_mul, push_cast]
mathlib commit https://github.com/leanprover-community/mathlib/commit/58a272265b5e05f258161260dd2c5d247213cbd3
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
! This file was ported from Lean 3 source module ring_theory.polynomial.bernstein
-! leanprover-community/mathlib commit bbeb185db4ccee8ed07dc48449414ebfa39cb821
+! leanprover-community/mathlib commit 36938f775671ff28bea1c0310f1608e4afbb22e0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -18,6 +18,9 @@ import Mathbin.Data.MvPolynomial.Pderiv
/-!
# Bernstein polynomials
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
The definition of the Bernstein polynomials
```
bernstein_polynomial (R : Type*) [comm_ring R] (n ν : ℕ) : R[X] :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/13361559d66b84f80b6d5a1c4a26aa5054766725
@@ -47,6 +47,7 @@ open scoped BigOperators Polynomial
variable (R : Type _) [CommRing R]
+#print bernsteinPolynomial /-
/-- `bernstein_polynomial R n ν` is `(choose n ν) * X^ν * (1 - X)^(n - ν)`.
Although the coefficients are integers, it is convenient to work over an arbitrary commutative ring.
@@ -54,6 +55,7 @@ Although the coefficients are integers, it is convenient to work over an arbitra
def bernsteinPolynomial (n ν : ℕ) : R[X] :=
choose n ν * X ^ ν * (1 - X) ^ (n - ν)
#align bernstein_polynomial bernsteinPolynomial
+-/
example : bernsteinPolynomial ℤ 3 2 = 3 * X ^ 2 - 3 * X ^ 3 :=
by
@@ -62,9 +64,11 @@ example : bernsteinPolynomial ℤ 3 2 = 3 * X ^ 2 - 3 * X ^ 3 :=
namespace bernsteinPolynomial
+#print bernsteinPolynomial.eq_zero_of_lt /-
theorem eq_zero_of_lt {n ν : ℕ} (h : n < ν) : bernsteinPolynomial R n ν = 0 := by
simp [bernsteinPolynomial, Nat.choose_eq_zero_of_lt h]
#align bernstein_polynomial.eq_zero_of_lt bernsteinPolynomial.eq_zero_of_lt
+-/
section
@@ -77,15 +81,19 @@ theorem map (f : R →+* S) (n ν : ℕ) :
end
+#print bernsteinPolynomial.flip /-
theorem flip (n ν : ℕ) (h : ν ≤ n) :
(bernsteinPolynomial R n ν).comp (1 - X) = bernsteinPolynomial R n (n - ν) := by
simp [bernsteinPolynomial, h, tsub_tsub_assoc, mul_right_comm]
#align bernstein_polynomial.flip bernsteinPolynomial.flip
+-/
+#print bernsteinPolynomial.flip' /-
theorem flip' (n ν : ℕ) (h : ν ≤ n) :
bernsteinPolynomial R n ν = (bernsteinPolynomial R n (n - ν)).comp (1 - X) := by
simp [← flip _ _ _ h, Polynomial.comp_assoc]
#align bernstein_polynomial.flip' bernsteinPolynomial.flip'
+-/
theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0 then 1 else 0 :=
by
@@ -258,6 +266,7 @@ theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
open Submodule
+#print bernsteinPolynomial.linearIndependent_aux /-
theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
LinearIndependent ℚ fun ν : Fin k => bernsteinPolynomial ℚ n ν :=
by
@@ -292,7 +301,9 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
· intro x y hx hy; simp [hx, hy]
· intro a x h; simp [h]
#align bernstein_polynomial.linear_independent_aux bernsteinPolynomial.linearIndependent_aux
+-/
+#print bernsteinPolynomial.linearIndependent /-
/-- The Bernstein polynomials are linearly independent.
We prove by induction that the collection of `bernstein_polynomial n ν` for `ν = 0, ..., k`
@@ -304,7 +315,9 @@ theorem linearIndependent (n : ℕ) :
LinearIndependent ℚ fun ν : Fin (n + 1) => bernsteinPolynomial ℚ n ν :=
linearIndependent_aux n (n + 1) le_rfl
#align bernstein_polynomial.linear_independent bernsteinPolynomial.linearIndependent
+-/
+#print bernsteinPolynomial.sum /-
theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = 1 :=
calc
(∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n := by rw [add_pow];
@@ -312,6 +325,7 @@ theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n
_ = 1 := by simp
#align bernstein_polynomial.sum bernsteinPolynomial.sum
+-/
open Polynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -133,7 +133,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
rw [mul_comm, ← mul_assoc, ← mul_assoc]; congr 1
norm_cast
congr 1
- convert(Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
+ convert (Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
· convert mul_comm _ _ using 2
simp
· apply mul_comm
@@ -394,7 +394,7 @@ theorem sum_mul_smul (n : ℕ) :
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
Bool.cond_false, add_zero, zero_add, MulZeroClass.mul_zero, smul_zero, mul_one,
- MvPolynomial.aeval_X, MvPolynomial.pderiv_x_self, MvPolynomial.pderiv_x_of_ne,
+ MvPolynomial.aeval_X, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne,
Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul, map_add]
-- On the right hand side, we'll just simplify.
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -197,11 +197,11 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
· simp
· have : n - 1 - (ν - 1) = n - ν :=
by
- rw [← Nat.succ_le_iff] at h''
+ rw [← Nat.succ_le_iff] at h''
rw [← tsub_add_eq_tsub_tsub, add_comm, tsub_add_cancel_of_le h'']
rw [this, pochhammer_eval_succ]
rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
- · simp only [not_le] at h
+ · simp only [not_le] at h
rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
simp [pos_iff_ne_zero.mp (pos_of_gt h)]
#align bernstein_polynomial.iterate_derivative_at_0 bernsteinPolynomial.iterate_derivative_at_0
@@ -216,7 +216,7 @@ theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
apply ne_of_gt
obtain rfl | h' := Nat.eq_zero_or_pos ν
· simp
- · rw [← Nat.succ_pred_eq_of_pos h'] at h
+ · rw [← Nat.succ_pred_eq_of_pos h'] at h
exact pochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
#align bernstein_polynomial.iterate_derivative_at_0_ne_zero bernsteinPolynomial.iterate_derivative_at_0_ne_zero
@@ -270,7 +270,7 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
-- We show that the (n-k)-th derivative at 1 doesn't vanish,
-- but vanishes for everything in the span.
clear ih
- simp only [Nat.succ_eq_add_one, add_le_add_iff_right] at h
+ simp only [Nat.succ_eq_add_one, add_le_add_iff_right] at h
simp only [Fin.val_last, Fin.init_def]
dsimp
apply not_mem_span_of_apply_not_mem_span_image (@Polynomial.derivative ℚ _ ^ (n - k))
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -43,7 +43,7 @@ open Nat (choose)
open Polynomial (X)
-open BigOperators Polynomial
+open scoped BigOperators Polynomial
variable (R : Type _) [CommRing R]
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -91,8 +91,7 @@ theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0
by
rw [bernsteinPolynomial]
split_ifs
- · subst h
- simp
+ · subst h; simp
· simp [zero_pow (Nat.pos_of_ne_zero h)]
#align bernstein_polynomial.eval_at_0 bernsteinPolynomial.eval_at_0
@@ -100,8 +99,7 @@ theorem eval_at_1 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 1 = if ν = n
by
rw [bernsteinPolynomial]
split_ifs
- · subst h
- simp
+ · subst h; simp
· obtain w | w := (n - ν).eq_zero_or_pos
· simp [Nat.choose_eq_zero_of_lt ((tsub_eq_zero_iff_le.mp w).lt_of_ne (Ne.symm h))]
· simp [zero_pow w]
@@ -131,10 +129,8 @@ theorem derivative_succ_aux (n ν : ℕ) :
refine' congr (congr_arg (· * ·) (congr (congr_arg (· * ·) _) rfl)) rfl
-- Now it's just about binomial coefficients
exact_mod_cast congr_arg (fun m : ℕ => (m : R[X])) (Nat.succ_mul_choose_eq n ν).symm
- · rw [← tsub_add_eq_tsub_tsub, ← mul_assoc, ← mul_assoc]
- congr 1
- rw [mul_comm, ← mul_assoc, ← mul_assoc]
- congr 1
+ · rw [← tsub_add_eq_tsub_tsub, ← mul_assoc, ← mul_assoc]; congr 1
+ rw [mul_comm, ← mul_assoc, ← mul_assoc]; congr 1
norm_cast
congr 1
convert(Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
@@ -149,8 +145,7 @@ theorem derivative_succ (n ν : ℕ) :
by
cases n
· simp [bernsteinPolynomial]
- · rw [Nat.cast_succ]
- apply derivative_succ_aux
+ · rw [Nat.cast_succ]; apply derivative_succ_aux
#align bernstein_polynomial.derivative_succ bernsteinPolynomial.derivative_succ
theorem derivative_zero (n : ℕ) :
@@ -291,14 +286,11 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
exact (iterate_derivative_at_1_ne_zero ℚ n k h).symm
apply span_induction m
· simp
- rintro ⟨a, w⟩
- simp only [Fin.val_mk]
+ rintro ⟨a, w⟩; simp only [Fin.val_mk]
rw [iterate_derivative_at_1_eq_zero_of_lt ℚ n ((tsub_lt_tsub_iff_left_of_le h).mpr w)]
· simp
- · intro x y hx hy
- simp [hx, hy]
- · intro a x h
- simp [h]
+ · intro x y hx hy; simp [hx, hy]
+ · intro a x h; simp [h]
#align bernstein_polynomial.linear_independent_aux bernsteinPolynomial.linearIndependent_aux
/-- The Bernstein polynomials are linearly independent.
@@ -315,9 +307,7 @@ theorem linearIndependent (n : ℕ) :
theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = 1 :=
calc
- (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n :=
- by
- rw [add_pow]
+ (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n := by rw [add_pow];
simp only [bernsteinPolynomial, mul_comm, mul_assoc, mul_left_comm]
_ = 1 := by simp
@@ -334,12 +324,8 @@ theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPo
-- We'll work in `mv_polynomial bool R`.
let x : MvPolynomial Bool R := MvPolynomial.X tt
let y : MvPolynomial Bool R := MvPolynomial.X ff
- have pderiv_tt_x : pderiv tt x = 1 := by
- rw [pderiv_X]
- rfl
- have pderiv_tt_y : pderiv tt y = 0 := by
- rw [pderiv_X]
- rfl
+ have pderiv_tt_x : pderiv tt x = 1 := by rw [pderiv_X]; rfl
+ have pderiv_tt_y : pderiv tt y = 0 := by rw [pderiv_X]; rfl
let e : Bool → R[X] := fun i => cond i X (1 - X)
-- Start with `(x+y)^n = (x+y)^n`,
-- take the `x`-derivative, evaluate at `x=X, y=1-X`, and multiply by `X`:
@@ -380,12 +366,8 @@ theorem sum_mul_smul (n : ℕ) :
-- We'll work in `mv_polynomial bool R`.
let x : MvPolynomial Bool R := MvPolynomial.X tt
let y : MvPolynomial Bool R := MvPolynomial.X ff
- have pderiv_tt_x : pderiv tt x = 1 := by
- rw [pderiv_X]
- rfl
- have pderiv_tt_y : pderiv tt y = 0 := by
- rw [pderiv_X]
- rfl
+ have pderiv_tt_x : pderiv tt x = 1 := by rw [pderiv_X]; rfl
+ have pderiv_tt_y : pderiv tt y = 0 := by rw [pderiv_X]; rfl
let e : Bool → R[X] := fun i => cond i X (1 - X)
-- Start with `(x+y)^n = (x+y)^n`,
-- take the second `x`-derivative, evaluate at `x=X, y=1-X`, and multiply by `X`:
@@ -451,16 +433,12 @@ theorem variance (n : ℕ) :
_ = _ := p
_ = _ := _
- · congr 1
- simp only [← nat_cast_mul, push_cast]
- cases k <;>
- · simp
- ring
+ · congr 1; simp only [← nat_cast_mul, push_cast]
+ cases k <;> · simp; ring
· simp only [← nat_cast_mul, push_cast]
cases n
· simp
- · simp
- ring
+ · simp; ring
#align bernstein_polynomial.variance bernsteinPolynomial.variance
end bernsteinPolynomial
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -137,7 +137,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
congr 1
norm_cast
congr 1
- convert (Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
+ convert(Nat.choose_mul_succ_eq n (ν + 1)).symm using 1
· convert mul_comm _ _ using 2
simp
· apply mul_comm
mathlib commit https://github.com/leanprover-community/mathlib/commit/1a313d8bba1bad05faba71a4a4e9742ab5bd9efd
@@ -327,13 +327,13 @@ open Polynomial
open MvPolynomial
-theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν) = n • x :=
+theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPolynomial R n ν) = n • X :=
by
-- We calculate the `x`-derivative of `(x+y)^n`, evaluated at `y=(1-x)`,
-- either directly or by using the binomial theorem.
-- We'll work in `mv_polynomial bool R`.
- let x : MvPolynomial Bool R := MvPolynomial.x tt
- let y : MvPolynomial Bool R := MvPolynomial.x ff
+ let x : MvPolynomial Bool R := MvPolynomial.X tt
+ let y : MvPolynomial Bool R := MvPolynomial.X ff
have pderiv_tt_x : pderiv tt x = 1 := by
rw [pderiv_X]
rfl
@@ -362,24 +362,24 @@ theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPo
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
- Bool.cond_false, add_zero, mul_one, MulZeroClass.mul_zero, smul_zero, MvPolynomial.aeval_x,
+ 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]
· rw [(pderiv tt).leibniz_pow, (pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y]
simp only [Algebra.id.smul_eq_mul, nsmul_eq_mul, map_natCast, map_pow, map_add, map_mul, e,
- Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_x, add_sub_cancel'_right, one_pow,
+ Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow,
add_zero, mul_one]
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
theorem sum_mul_smul (n : ℕ) :
(∑ ν in Finset.range (n + 1), (ν * (ν - 1)) • bernsteinPolynomial R n ν) =
- (n * (n - 1)) • x ^ 2 :=
+ (n * (n - 1)) • X ^ 2 :=
by
-- We calculate the second `x`-derivative of `(x+y)^n`, evaluated at `y=(1-x)`,
-- either directly or by using the binomial theorem.
-- We'll work in `mv_polynomial bool R`.
- let x : MvPolynomial Bool R := MvPolynomial.x tt
- let y : MvPolynomial Bool R := MvPolynomial.x ff
+ let x : MvPolynomial Bool R := MvPolynomial.X tt
+ let y : MvPolynomial Bool R := MvPolynomial.X ff
have pderiv_tt_x : pderiv tt x = 1 := by
rw [pderiv_X]
rfl
@@ -412,7 +412,7 @@ theorem sum_mul_smul (n : ℕ) :
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
Bool.cond_false, add_zero, zero_add, MulZeroClass.mul_zero, smul_zero, mul_one,
- MvPolynomial.aeval_x, MvPolynomial.pderiv_x_self, MvPolynomial.pderiv_x_of_ne,
+ MvPolynomial.aeval_X, MvPolynomial.pderiv_x_self, MvPolynomial.pderiv_x_of_ne,
Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul, map_add]
-- On the right hand side, we'll just simplify.
@@ -420,7 +420,7 @@ theorem sum_mul_smul (n : ℕ) :
simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
(pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, add_zero, mul_one,
Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, e, Bool.cond_true, Bool.cond_false,
- MvPolynomial.aeval_x, add_sub_cancel'_right, one_pow, smul_smul, smul_one_mul]
+ MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow, smul_smul, smul_one_mul]
#align bernstein_polynomial.sum_mul_smul bernsteinPolynomial.sum_mul_smul
/-- A certain linear combination of the previous three identities,
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -120,10 +120,10 @@ theorem derivative_succ_aux (n ν : ℕ) :
↑(n.choose (ν + 1)) * X ^ (ν + 1) * (1 - X) ^ (n - (ν + 1)))
by
simpa only [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
- Polynomial.derivative_mul, Polynomial.derivative_nat_cast, zero_mul, Nat.cast_add,
- algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add, Polynomial.derivative_sub,
- Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ← Nat.cast_succ,
- Polynomial.C_eq_nat_cast]
+ Polynomial.derivative_mul, Polynomial.derivative_nat_cast, MulZeroClass.zero_mul,
+ Nat.cast_add, algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add,
+ Polynomial.derivative_sub, Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ←
+ Nat.cast_succ, Polynomial.C_eq_nat_cast]
conv_rhs => rw [mul_sub]
-- We'll prove the two terms match up separately.
refine' congr (congr_arg Sub.sub _) _
@@ -362,7 +362,7 @@ theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPo
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
- Bool.cond_false, add_zero, mul_one, mul_zero, smul_zero, MvPolynomial.aeval_x,
+ 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]
· rw [(pderiv tt).leibniz_pow, (pderiv tt).map_add, pderiv_tt_x, pderiv_tt_y]
@@ -411,9 +411,10 @@ theorem sum_mul_smul (n : ℕ) :
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k hk => (w k).trans _
simp only [pderiv_tt_x, pderiv_tt_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, e, Bool.cond_true,
- Bool.cond_false, add_zero, zero_add, mul_zero, smul_zero, mul_one, MvPolynomial.aeval_x,
- MvPolynomial.pderiv_x_self, MvPolynomial.pderiv_x_of_ne, Derivation.leibniz_pow,
- Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow, map_mul, map_add]
+ Bool.cond_false, add_zero, zero_add, MulZeroClass.mul_zero, smul_zero, mul_one,
+ MvPolynomial.aeval_x, MvPolynomial.pderiv_x_self, MvPolynomial.pderiv_x_of_ne,
+ Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
+ map_mul, map_add]
-- On the right hand side, we'll just simplify.
·
simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
mathlib commit https://github.com/leanprover-community/mathlib/commit/21e3562c5e12d846c7def5eff8cdbc520d7d4936
@@ -121,7 +121,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
by
simpa only [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
Polynomial.derivative_mul, Polynomial.derivative_nat_cast, zero_mul, Nat.cast_add,
- algebraMap.coe_one, Polynomial.derivative_x, mul_one, zero_add, Polynomial.derivative_sub,
+ algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add, Polynomial.derivative_sub,
Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ← Nat.cast_succ,
Polynomial.C_eq_nat_cast]
conv_rhs => rw [mul_sub]
mathlib commit https://github.com/leanprover-community/mathlib/commit/38f16f960f5006c6c0c2bac7b0aba5273188f4e5
@@ -41,7 +41,7 @@ noncomputable section
open Nat (choose)
-open Polynomial (x)
+open Polynomial (X)
open BigOperators Polynomial
@@ -52,10 +52,10 @@ variable (R : Type _) [CommRing R]
Although the coefficients are integers, it is convenient to work over an arbitrary commutative ring.
-/
def bernsteinPolynomial (n ν : ℕ) : R[X] :=
- choose n ν * x ^ ν * (1 - x) ^ (n - ν)
+ choose n ν * X ^ ν * (1 - X) ^ (n - ν)
#align bernstein_polynomial bernsteinPolynomial
-example : bernsteinPolynomial ℤ 3 2 = 3 * x ^ 2 - 3 * x ^ 3 :=
+example : bernsteinPolynomial ℤ 3 2 = 3 * X ^ 2 - 3 * X ^ 3 :=
by
norm_num [bernsteinPolynomial, choose]
ring
@@ -78,12 +78,12 @@ theorem map (f : R →+* S) (n ν : ℕ) :
end
theorem flip (n ν : ℕ) (h : ν ≤ n) :
- (bernsteinPolynomial R n ν).comp (1 - x) = bernsteinPolynomial R n (n - ν) := by
+ (bernsteinPolynomial R n ν).comp (1 - X) = bernsteinPolynomial R n (n - ν) := by
simp [bernsteinPolynomial, h, tsub_tsub_assoc, mul_right_comm]
#align bernstein_polynomial.flip bernsteinPolynomial.flip
theorem flip' (n ν : ℕ) (h : ν ≤ n) :
- bernsteinPolynomial R n ν = (bernsteinPolynomial R n (n - ν)).comp (1 - x) := by
+ bernsteinPolynomial R n ν = (bernsteinPolynomial R n (n - ν)).comp (1 - X) := by
simp [← flip _ _ _ h, Polynomial.comp_assoc]
#align bernstein_polynomial.flip' bernsteinPolynomial.flip'
@@ -123,7 +123,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
Polynomial.derivative_mul, Polynomial.derivative_nat_cast, zero_mul, Nat.cast_add,
algebraMap.coe_one, Polynomial.derivative_x, mul_one, zero_add, Polynomial.derivative_sub,
Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero, ← Nat.cast_succ,
- Polynomial.c_eq_nat_cast]
+ Polynomial.C_eq_nat_cast]
conv_rhs => rw [mul_sub]
-- We'll prove the two terms match up separately.
refine' congr (congr_arg Sub.sub _) _
@@ -315,7 +315,7 @@ theorem linearIndependent (n : ℕ) :
theorem sum (n : ℕ) : (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = 1 :=
calc
- (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (x + (1 - x)) ^ n :=
+ (∑ ν in Finset.range (n + 1), bernsteinPolynomial R n ν) = (X + (1 - X)) ^ n :=
by
rw [add_pow]
simp only [bernsteinPolynomial, mul_comm, mul_assoc, mul_left_comm]
@@ -349,8 +349,8 @@ theorem sum_smul (n : ℕ) : (∑ ν in Finset.range (n + 1), ν • bernsteinPo
have w :
∀ k : ℕ,
k • bernsteinPolynomial R n k =
- ↑k * Polynomial.x ^ (k - 1) * (1 - Polynomial.x) ^ (n - k) * ↑(n.choose k) *
- Polynomial.x :=
+ ↑k * Polynomial.X ^ (k - 1) * (1 - Polynomial.X) ^ (n - k) * ↑(n.choose k) *
+ Polynomial.X :=
by
rintro (_ | k)
· simp
@@ -396,8 +396,8 @@ theorem sum_mul_smul (n : ℕ) :
∀ k : ℕ,
(k * (k - 1)) • bernsteinPolynomial R n k =
↑(n.choose k) *
- ((1 - Polynomial.x) ^ (n - k) * (↑k * (↑(k - 1) * Polynomial.x ^ (k - 1 - 1)))) *
- Polynomial.x ^ 2 :=
+ ((1 - Polynomial.X) ^ (n - k) * (↑k * (↑(k - 1) * Polynomial.X ^ (k - 1 - 1)))) *
+ Polynomial.X ^ 2 :=
by
rintro (_ | _ | k)
· simp
@@ -426,12 +426,12 @@ theorem sum_mul_smul (n : ℕ) :
which we'll want later.
-/
theorem variance (n : ℕ) :
- (∑ ν in Finset.range (n + 1), (n • Polynomial.x - ν) ^ 2 * bernsteinPolynomial R n ν) =
- n • Polynomial.x * (1 - Polynomial.x) :=
+ (∑ ν in Finset.range (n + 1), (n • Polynomial.X - ν) ^ 2 * bernsteinPolynomial R n ν) =
+ n • Polynomial.X * (1 - Polynomial.X) :=
by
have p :
((((Finset.range (n + 1)).Sum fun ν => (ν * (ν - 1)) • bernsteinPolynomial R n ν) +
- (1 - (2 * n) • Polynomial.x) *
+ (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 ν) =
_ :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
nat_cast
/int_cast
/rat_cast
to natCast
/intCast
/ratCast
(#11486)
Now that I am defining NNRat.cast
, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast
/intCast
/ratCast
over nat_cast
/int_cast
/rat_cast
, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -108,7 +108,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
(↑(n + 1) : R[X]) * ((n.choose ν : R[X]) * X ^ ν * (1 - X) ^ (n - ν) -
(n.choose (ν + 1) : R[X]) * X ^ (ν + 1) * (1 - X) ^ (n - (ν + 1))) by
simpa [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
- Polynomial.derivative_mul, Polynomial.derivative_nat_cast, zero_mul,
+ Polynomial.derivative_mul, Polynomial.derivative_natCast, zero_mul,
Nat.cast_add, algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add,
Polynomial.derivative_sub, Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero,
bernsteinPolynomial, map_add, map_natCast, Nat.cast_one]
@@ -152,7 +152,7 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
· simp [eval_at_0]
· simp only [derivative_succ, Int.natCast_eq_zero, mul_eq_zero, Function.comp_apply,
Function.iterate_succ, Polynomial.iterate_derivative_sub,
- Polynomial.iterate_derivative_nat_cast_mul, Polynomial.eval_mul, Polynomial.eval_nat_cast,
+ Polynomial.iterate_derivative_natCast_mul, Polynomial.eval_mul, Polynomial.eval_natCast,
Polynomial.eval_sub]
intro h
apply mul_eq_zero_of_right
@@ -179,8 +179,8 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
· have h' : ν ≤ n - 1 := le_tsub_of_add_le_right h
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, ascPochhammer_succ_left]
+ iterate_derivative_natCast_mul, eval_one, eval_mul, eval_add, eval_sub, eval_X, eval_comp,
+ eval_natCast, Function.comp_apply, Function.iterate_succ, ascPochhammer_succ_left]
obtain rfl | h'' := ν.eq_zero_or_pos
· simp
· have : n - 1 - (ν - 1) = n - ν := by
@@ -320,7 +320,7 @@ theorem sum_smul (n : ℕ) :
rintro (_ | k)
· simp
· rw [bernsteinPolynomial]
- simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
+ simp only [← natCast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
push_cast
ring
rw [add_pow, map_sum (pderiv true), map_sum (MvPolynomial.aeval e), Finset.sum_mul]
@@ -359,7 +359,7 @@ theorem sum_mul_smul (n : ℕ) :
· simp
· simp
· rw [bernsteinPolynomial]
- simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
+ simp only [← natCast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
push_cast
ring
rw [add_pow, map_sum (pderiv true), map_sum (pderiv true), map_sum (MvPolynomial.aeval e),
@@ -393,19 +393,19 @@ theorem variance (n : ℕ) :
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 [← natCast_mul]
simp only [← mul_assoc]
simp only [← add_mul]
conv at p =>
rhs
- rw [sum, sum_smul, sum_mul_smul, ← nat_cast_mul]
+ rw [sum, sum_smul, sum_mul_smul, ← natCast_mul]
calc
_ = _ := Finset.sum_congr rfl fun k m => ?_
_ = _ := p
_ = _ := ?_
- · congr 1; simp only [← nat_cast_mul, push_cast]
+ · congr 1; simp only [← natCast_mul, push_cast]
cases k <;> · simp; ring
- · simp only [← nat_cast_mul, push_cast]
+ · simp only [← natCast_mul, push_cast]
cases n
· simp
· simp; ring
@@ -328,7 +328,7 @@ theorem sum_smul (n : ℕ) :
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
simp only [x, y, e, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul,
Bool.cond_true, Bool.cond_false, add_zero, mul_one, mul_zero, smul_zero, MvPolynomial.aeval_X,
- MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_coe_nat, map_natCast, map_pow,
+ MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_natCast, map_natCast, map_pow,
map_mul]
· rw [(pderiv true).leibniz_pow, (pderiv true).map_add, pderiv_true_x, pderiv_true_y]
simp only [x, y, e, Algebra.id.smul_eq_mul, nsmul_eq_mul, map_natCast, map_pow, map_add,
@@ -369,10 +369,10 @@ theorem sum_mul_smul (n : ℕ) :
simp only [x, y, e, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul,
Bool.cond_true, Bool.cond_false, add_zero, zero_add, mul_zero, smul_zero, mul_one,
MvPolynomial.aeval_X, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne,
- Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
+ Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_natCast, map_natCast, map_pow,
map_mul, map_add]
-- On the right hand side, we'll just simplify.
- · simp only [x, y, e, pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
+ · simp only [x, y, e, pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_natCast,
(pderiv true).map_add, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, add_zero,
mul_one, Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, Bool.cond_true,
Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel, one_pow, smul_smul,
Data
(#11751)
Polynomial
and MvPolynomial
are algebraic objects, hence should be under Algebra
(or at least not under Data
)
@@ -3,12 +3,12 @@ Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-/
-import Mathlib.Data.Polynomial.Derivative
+import Mathlib.Algebra.MvPolynomial.PDeriv
+import Mathlib.Algebra.Polynomial.AlgebraMap
+import Mathlib.Algebra.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Sum
-import Mathlib.RingTheory.Polynomial.Pochhammer
-import Mathlib.Data.Polynomial.AlgebraMap
import Mathlib.LinearAlgebra.LinearIndependent
-import Mathlib.Data.MvPolynomial.PDeriv
+import Mathlib.RingTheory.Polynomial.Pochhammer
#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
coe_nat
to natCast
(#11637)
Reduce the diff of #11499
All in the Int
namespace:
ofNat_eq_cast
→ ofNat_eq_natCast
cast_eq_cast_iff_Nat
→ natCast_inj
natCast_eq_ofNat
→ ofNat_eq_natCast
coe_nat_sub
→ natCast_sub
coe_nat_nonneg
→ natCast_nonneg
sign_coe_add_one
→ sign_natCast_add_one
nat_succ_eq_int_succ
→ natCast_succ
succ_neg_nat_succ
→ succ_neg_natCast_succ
coe_pred_of_pos
→ natCast_pred_of_pos
coe_nat_div
→ natCast_div
coe_nat_ediv
→ natCast_ediv
sign_coe_nat_of_nonzero
→ sign_natCast_of_ne_zero
toNat_coe_nat
→ toNat_natCast
toNat_coe_nat_add_one
→ toNat_natCast_add_one
coe_nat_dvd
→ natCast_dvd_natCast
coe_nat_dvd_left
→ natCast_dvd
coe_nat_dvd_right
→ dvd_natCast
le_coe_nat_sub
→ le_natCast_sub
succ_coe_nat_pos
→ succ_natCast_pos
coe_nat_modEq_iff
→ natCast_modEq_iff
coe_natAbs
→ natCast_natAbs
coe_nat_eq_zero
→ natCast_eq_zero
coe_nat_ne_zero
→ natCast_ne_zero
coe_nat_ne_zero_iff_pos
→ natCast_ne_zero_iff_pos
abs_coe_nat
→ abs_natCast
coe_nat_nonpos_iff
→ natCast_nonpos_iff
Also rename Nat.coe_nat_dvd
to Nat.cast_dvd_cast
@@ -150,7 +150,7 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
· rw [Nat.lt_succ_iff]
induction' k with k ih generalizing n ν
· simp [eval_at_0]
- · simp only [derivative_succ, Int.coe_nat_eq_zero, mul_eq_zero, Function.comp_apply,
+ · simp only [derivative_succ, Int.natCast_eq_zero, mul_eq_zero, Function.comp_apply,
Function.iterate_succ, Polynomial.iterate_derivative_sub,
Polynomial.iterate_derivative_nat_cast_mul, Polynomial.eval_mul, Polynomial.eval_nat_cast,
Polynomial.eval_sub]
@@ -195,8 +195,7 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
(Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 ≠ 0 := by
- simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne,
- Nat.cast_eq_zero]
+ simp only [Int.natCast_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne, Nat.cast_eq_zero]
simp only [← ascPochhammer_eval_cast]
norm_cast
apply ne_of_gt
As discussed in https://github.com/leanprover-community/mathlib4/pull/11790 for the case of Lie derivations, it seems that this map_sum
lemma is not useful since we can use the generic version.
@@ -324,7 +324,7 @@ theorem sum_smul (n : ℕ) :
simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
push_cast
ring
- rw [add_pow, (pderiv true).map_sum, (MvPolynomial.aeval e).map_sum, Finset.sum_mul]
+ rw [add_pow, map_sum (pderiv true), map_sum (MvPolynomial.aeval e), Finset.sum_mul]
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
simp only [x, y, e, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul,
@@ -363,7 +363,7 @@ theorem sum_mul_smul (n : ℕ) :
simp only [← nat_cast_mul, Nat.succ_eq_add_one, Nat.add_succ_sub_one, add_zero, pow_succ]
push_cast
ring
- rw [add_pow, (pderiv true).map_sum, (pderiv true).map_sum, (MvPolynomial.aeval e).map_sum,
+ rw [add_pow, map_sum (pderiv true), map_sum (pderiv true), map_sum (MvPolynomial.aeval e),
Finset.sum_mul]
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
@@ -195,7 +195,7 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
(Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 ≠ 0 := by
- simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
+ simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne,
Nat.cast_eq_zero]
simp only [← ascPochhammer_eval_cast]
norm_cast
@@ -234,7 +234,7 @@ theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
(Polynomial.derivative^[n - ν] (bernsteinPolynomial R n ν)).eval 1 ≠ 0 := by
- rw [bernsteinPolynomial.iterate_derivative_at_1 _ _ _ h, Ne.def, neg_one_pow_mul_eq_zero_iff, ←
+ rw [bernsteinPolynomial.iterate_derivative_at_1 _ _ _ h, Ne, neg_one_pow_mul_eq_zero_iff, ←
Nat.cast_succ, ← ascPochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
exact (ascPochhammer_pos _ _ (Nat.succ_pos ν)).ne'
#align bernstein_polynomial.iterate_derivative_at_1_ne_zero bernsteinPolynomial.iterate_derivative_at_1_ne_zero
mul
-div
cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess.
This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero
lemma name, the Group
lemma, the AddGroup
lemma name).
| Statement | New name | Old name | |
@@ -333,7 +333,7 @@ theorem sum_smul (n : ℕ) :
map_mul]
· rw [(pderiv true).leibniz_pow, (pderiv true).map_add, pderiv_true_x, pderiv_true_y]
simp only [x, y, e, 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,
+ map_mul, Bool.cond_true, Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel,
one_pow, add_zero, mul_one]
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
@@ -376,7 +376,7 @@ theorem sum_mul_smul (n : ℕ) :
· simp only [x, y, e, pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
(pderiv true).map_add, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, add_zero,
mul_one, Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, Bool.cond_true,
- Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow, smul_smul,
+ Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel, one_pow, smul_smul,
smul_one_mul]
#align bernstein_polynomial.sum_mul_smul bernsteinPolynomial.sum_mul_smul
@@ -227,9 +227,9 @@ theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
simp [Polynomial.eval_comp, h]
obtain rfl | h' := h.eq_or_lt
· simp
- · congr
- norm_cast
- rw [← tsub_add_eq_tsub_tsub, tsub_tsub_cancel_of_le (Nat.succ_le_iff.mpr h')]
+ · norm_cast
+ congr
+ omega
#align bernstein_polynomial.iterate_derivative_at_1 bernsteinPolynomial.iterate_derivative_at_1
theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
@@ -327,14 +327,14 @@ theorem sum_smul (n : ℕ) :
rw [add_pow, (pderiv true).map_sum, (MvPolynomial.aeval e).map_sum, Finset.sum_mul]
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
- 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, mul_zero, smul_zero, MvPolynomial.aeval_X,
+ simp only [x, y, e, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul,
+ Bool.cond_true, Bool.cond_false, add_zero, mul_one, mul_zero, smul_zero, MvPolynomial.aeval_X,
MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul]
· rw [(pderiv true).leibniz_pow, (pderiv true).map_add, pderiv_true_x, pderiv_true_y]
- 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]
+ simp only [x, y, e, 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]
#align bernstein_polynomial.sum_smul bernsteinPolynomial.sum_smul
theorem sum_mul_smul (n : ℕ) :
@@ -367,13 +367,13 @@ theorem sum_mul_smul (n : ℕ) :
Finset.sum_mul]
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
- simp only [pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, Bool.cond_true,
- Bool.cond_false, add_zero, zero_add, mul_zero, smul_zero, mul_one,
+ simp only [x, y, e, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul,
+ Bool.cond_true, Bool.cond_false, add_zero, zero_add, mul_zero, smul_zero, mul_one,
MvPolynomial.aeval_X, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne,
Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul, map_add]
-- On the right hand side, we'll just simplify.
- · simp only [pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
+ · simp only [x, y, e, pderiv_one, pderiv_mul, (pderiv _).leibniz_pow, (pderiv _).map_coe_nat,
(pderiv true).map_add, pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, add_zero,
mul_one, Derivation.map_smul_of_tower, map_nsmul, map_pow, map_add, Bool.cond_true,
Bool.cond_false, MvPolynomial.aeval_X, add_sub_cancel'_right, one_pow, smul_smul,
The FunLike hierarchy is very big and gets scanned through each time we need a coercion (via the CoeFun
instance). It looks like unbundled inheritance suits Lean 4 better here. The only class that still extends FunLike
is EquivLike
, since that has a custom coe_injective'
field that is easier to implement. All other classes should take FunLike
or EquivLike
as a parameter.
Previously, morphism classes would be Type
-valued and extend FunLike
:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
extends FunLike F A B :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
After this PR, they should be Prop
-valued and take FunLike
as a parameter:
/-- `MyHomClass F A B` states that `F` is a type of `MyClass.op`-preserving morphisms.
You should extend this class when you extend `MyHom`. -/
class MyHomClass (F : Type*) (A B : outParam <| Type*) [MyClass A] [MyClass B]
[FunLike F A B] : Prop :=
(map_op : ∀ (f : F) (x y : A), f (MyClass.op x y) = MyClass.op (f x) (f y))
(Note that A B
stay marked as outParam
even though they are not purely required to be so due to the FunLike
parameter already filling them in. This is required to see through type synonyms, which is important in the category theory library. Also, I think keeping them as outParam
is slightly faster.)
Similarly, MyEquivClass
should take EquivLike
as a parameter.
As a result, every mention of [MyHomClass F A B]
should become [FunLike F A B] [MyHomClass F A B]
.
While overall this gives some great speedups, there are some cases that are noticeably slower. In particular, a failing application of a lemma such as map_mul
is more expensive. This is due to suboptimal processing of arguments. For example:
variable [FunLike F M N] [Mul M] [Mul N] (f : F) (x : M) (y : M)
theorem map_mul [MulHomClass F M N] : f (x * y) = f x * f y
example [AddHomClass F A B] : f (x * y) = f x * f y := map_mul f _ _
Before this PR, applying map_mul f
gives the goals [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Since M
and N
are out_param
s, [MulHomClass F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found.
After this PR, the goals become [FunLike F ?M ?N] [Mul ?M] [Mul ?N] [MulHomClass F ?M ?N]
. Now [FunLike F ?M ?N]
is synthesized first, supplies values for ?M
and ?N
and then the Mul M
and Mul N
instances can be found, before trying MulHomClass F M N
which fails. Since the Mul
hierarchy is very big, this can be slow to fail, especially when there is no such Mul
instance.
A long-term but harder to achieve solution would be to specify the order in which instance goals get solved. For example, we'd like to change the arguments to map_mul
to look like [FunLike F M N] [Mul M] [Mul N] [highPriority <| MulHomClass F M N]
because MulHomClass
fails or succeeds much faster than the others.
As a consequence, the simpNF
linter is much slower since by design it tries and fails to apply many map_
lemmas. The same issue occurs a few times in existing calls to simp [map_mul]
, where map_mul
is tried "too soon" and fails. Thanks to the speedup of leanprover/lean4#2478 the impact is very limited, only in files that already were close to the timeout.
simp
not firing sometimesThis affects map_smulₛₗ
and related definitions. For simp
lemmas Lean apparently uses a slightly different mechanism to find instances, so that rw
can find every argument to map_smulₛₗ
successfully but simp
can't: leanprover/lean4#3701.
Especially in the category theory library, we might sometimes have a type A
which is also accessible as a synonym (Bundled A hA).1
. Instance synthesis doesn't always work if we have f : A →* B
but x * y : (Bundled A hA).1
or vice versa. This seems to be mostly fixed by keeping A B
as outParam
s in MulHomClass F A B
. (Presumably because Lean will do a definitional check A =?= (Bundled A hA).1
instead of using the syntax in the discrimination tree.)
The timeouts can be worked around for now by specifying which map_mul
we mean, either as map_mul f
for some explicit f
, or as e.g. MonoidHomClass.map_mul
.
map_smulₛₗ
not firing as simp
lemma can be worked around by going back to the pre-FunLike situation and making LinearMap.map_smulₛₗ
a simp
lemma instead of the generic map_smulₛₗ
. Writing simp [map_smulₛₗ _]
also works.
Co-authored-by: Matthew Ballard <matt@mrb.email> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -257,7 +257,8 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
simp only [Fin.val_last, Fin.init_def]
dsimp
apply not_mem_span_of_apply_not_mem_span_image (@Polynomial.derivative ℚ _ ^ (n - k))
- simp only [not_exists, not_and, Submodule.mem_map, Submodule.span_image]
+ -- Note: #8386 had to change `span_image` into `span_image _`
+ simp only [not_exists, not_and, Submodule.mem_map, Submodule.span_image _]
intro p m
apply_fun Polynomial.eval (1 : ℚ)
simp only [LinearMap.pow_apply]
f ^ n
(#9617)
This involves moving lemmas from Algebra.GroupPower.Ring
to Algebra.GroupWithZero.Basic
and changing some 0 < n
assumptions to n ≠ 0
.
From LeanAPAP
@@ -87,16 +87,16 @@ theorem eval_at_0 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 0 = if ν = 0
rw [bernsteinPolynomial]
split_ifs with h
· subst h; simp
- · simp [zero_pow (Nat.pos_of_ne_zero h)]
+ · simp [zero_pow h]
#align bernstein_polynomial.eval_at_0 bernsteinPolynomial.eval_at_0
theorem eval_at_1 (n ν : ℕ) : (bernsteinPolynomial R n ν).eval 1 = if ν = n then 1 else 0 := by
rw [bernsteinPolynomial]
split_ifs with h
· subst h; simp
- · obtain w | w := (n - ν).eq_zero_or_pos
- · simp [Nat.choose_eq_zero_of_lt ((tsub_eq_zero_iff_le.mp w).lt_of_ne (Ne.symm h))]
- · simp [zero_pow w]
+ · obtain hνn | hnν := Ne.lt_or_lt h
+ · simp [zero_pow $ Nat.sub_ne_zero_of_lt hνn]
+ · simp [Nat.choose_eq_zero_of_lt hnν]
#align bernstein_polynomial.eval_at_1 bernsteinPolynomial.eval_at_1
theorem derivative_succ_aux (n ν : ℕ) :
exact_mod_cast
tactic with mod_cast
elaborator where possible (#8404)
We still have the exact_mod_cast
tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast
are the ones that don't work using the term elaborator by itself.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -118,7 +118,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
· simp only [← mul_assoc]
refine' congr (congr_arg (· * ·) (congr (congr_arg (· * ·) _) rfl)) rfl
-- Now it's just about binomial coefficients
- exact_mod_cast congr_arg (fun m : ℕ => (m : R[X])) (Nat.succ_mul_choose_eq n ν).symm
+ exact mod_cast congr_arg (fun m : ℕ => (m : R[X])) (Nat.succ_mul_choose_eq n ν).symm
· rw [← tsub_add_eq_tsub_tsub, ← mul_assoc, ← mul_assoc]; congr 1
rw [mul_comm, ← mul_assoc, ← mul_assoc]; congr 1
norm_cast
@@ -189,7 +189,7 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
rw [this, ascPochhammer_eval_succ]
rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
· simp only [not_le] at h
- rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
+ rw [tsub_eq_zero_iff_le.mpr (Nat.le_sub_one_of_lt h), eq_zero_of_lt R h]
simp [pos_iff_ne_zero.mp (pos_of_gt h)]
#align bernstein_polynomial.iterate_derivative_at_0 bernsteinPolynomial.iterate_derivative_at_0
@@ -172,7 +172,7 @@ open Polynomial
@[simp]
theorem iterate_derivative_at_0 (n ν : ℕ) :
(Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 =
- (pochhammer R ν).eval ((n - (ν - 1) : ℕ) : R) := by
+ (ascPochhammer R ν).eval ((n - (ν - 1) : ℕ) : R) := by
by_cases h : ν ≤ n
· induction' ν with ν ih generalizing n
· simp [eval_at_0]
@@ -180,13 +180,13 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
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]
+ eval_nat_cast, Function.comp_apply, Function.iterate_succ, ascPochhammer_succ_left]
obtain rfl | h'' := ν.eq_zero_or_pos
· simp
· 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'']
- rw [this, pochhammer_eval_succ]
+ rw [this, ascPochhammer_eval_succ]
rw_mod_cast [tsub_add_cancel_of_le (h'.trans n.pred_le)]
· simp only [not_le] at h
rw [tsub_eq_zero_iff_le.mpr (Nat.le_pred_of_lt h), eq_zero_of_lt R h]
@@ -197,13 +197,13 @@ theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n)
(Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 ≠ 0 := by
simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
Nat.cast_eq_zero]
- simp only [← pochhammer_eval_cast]
+ simp only [← ascPochhammer_eval_cast]
norm_cast
apply ne_of_gt
obtain rfl | h' := Nat.eq_zero_or_pos ν
· simp
· rw [← Nat.succ_pred_eq_of_pos h'] at h
- exact pochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
+ exact ascPochhammer_pos _ _ (tsub_pos_of_lt (Nat.lt_of_succ_le h))
#align bernstein_polynomial.iterate_derivative_at_0_ne_zero bernsteinPolynomial.iterate_derivative_at_0_ne_zero
/-!
@@ -222,7 +222,7 @@ theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
@[simp]
theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
(Polynomial.derivative^[n - ν] (bernsteinPolynomial R n ν)).eval 1 =
- (-1) ^ (n - ν) * (pochhammer R (n - ν)).eval (ν + 1 : R) := by
+ (-1) ^ (n - ν) * (ascPochhammer R (n - ν)).eval (ν + 1 : R) := by
rw [flip' _ _ _ h]
simp [Polynomial.eval_comp, h]
obtain rfl | h' := h.eq_or_lt
@@ -235,8 +235,8 @@ theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
(Polynomial.derivative^[n - ν] (bernsteinPolynomial R n ν)).eval 1 ≠ 0 := by
rw [bernsteinPolynomial.iterate_derivative_at_1 _ _ _ h, Ne.def, neg_one_pow_mul_eq_zero_iff, ←
- Nat.cast_succ, ← pochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
- exact (pochhammer_pos _ _ (Nat.succ_pos ν)).ne'
+ Nat.cast_succ, ← ascPochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
+ exact (ascPochhammer_pos _ _ (Nat.succ_pos ν)).ne'
#align bernstein_polynomial.iterate_derivative_at_1_ne_zero bernsteinPolynomial.iterate_derivative_at_1_ne_zero
open Submodule
norm_num
was passing the wrong syntax node to elabSimpArgs
when elaborating, which essentially had the effect of ignoring all arguments it was passed, i.e. norm_num [add_comm]
would not try to commute addition in the simp step.
The fix itself is very simple (though not obvious to debug!), probably using TSyntax more would help avoid such issues in future.
Due to this bug many norm_num [blah]
became rw [blah]; norm_num
or similar, sometimes with porting notes, sometimes not, we fix these porting notes and other regressions during the port also.
Interestingly cancel_denoms
uses norm_num [<- mul_assoc]
internally, so cancel_denoms
also got stronger with this change.
@@ -53,10 +53,7 @@ def bernsteinPolynomial (n ν : ℕ) : R[X] :=
#align bernstein_polynomial bernsteinPolynomial
example : bernsteinPolynomial ℤ 3 2 = 3 * X ^ 2 - 3 * X ^ 3 := by
- -- Porting note: Originally was just `norm_num [bernsteinPolynomial, choose]; ring`,
- -- but `norm_num` ignores arguments
- simp [bernsteinPolynomial, choose]
- norm_num
+ norm_num [bernsteinPolynomial, choose]
ring
namespace bernsteinPolynomial
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -111,7 +111,7 @@ theorem derivative_succ_aux (n ν : ℕ) :
(↑(n + 1) : R[X]) * ((n.choose ν : R[X]) * X ^ ν * (1 - X) ^ (n - ν) -
(n.choose (ν + 1) : R[X]) * X ^ (ν + 1) * (1 - X) ^ (n - (ν + 1))) by
simpa [Polynomial.derivative_pow, ← sub_eq_add_neg, Nat.succ_sub_succ_eq_sub,
- Polynomial.derivative_mul, Polynomial.derivative_nat_cast, MulZeroClass.zero_mul,
+ Polynomial.derivative_mul, Polynomial.derivative_nat_cast, zero_mul,
Nat.cast_add, algebraMap.coe_one, Polynomial.derivative_X, mul_one, zero_add,
Polynomial.derivative_sub, Polynomial.derivative_one, zero_sub, mul_neg, Nat.sub_zero,
bernsteinPolynomial, map_add, map_natCast, Nat.cast_one]
@@ -330,7 +330,7 @@ theorem sum_smul (n : ℕ) :
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
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,
+ Bool.cond_false, add_zero, mul_one, mul_zero, smul_zero, MvPolynomial.aeval_X,
MvPolynomial.pderiv_mul, Derivation.leibniz_pow, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul]
· rw [(pderiv true).leibniz_pow, (pderiv true).map_add, pderiv_true_x, pderiv_true_y]
@@ -370,7 +370,7 @@ theorem sum_mul_smul (n : ℕ) :
-- Step inside the sum:
refine' Finset.sum_congr rfl fun k _ => (w k).trans _
simp only [pderiv_true_x, pderiv_true_y, Algebra.id.smul_eq_mul, nsmul_eq_mul, Bool.cond_true,
- Bool.cond_false, add_zero, zero_add, MulZeroClass.mul_zero, smul_zero, mul_one,
+ Bool.cond_false, add_zero, zero_add, mul_zero, smul_zero, mul_one,
MvPolynomial.aeval_X, MvPolynomial.pderiv_X_self, MvPolynomial.pderiv_X_of_ne,
Derivation.leibniz_pow, Derivation.leibniz, Derivation.map_coe_nat, map_natCast, map_pow,
map_mul, map_add]
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -17,7 +17,7 @@ import Mathlib.Data.MvPolynomial.PDeriv
The definition of the Bernstein polynomials
```
-bernsteinPolynomial (R : Type _) [CommRing R] (n ν : ℕ) : R[X] :=
+bernsteinPolynomial (R : Type*) [CommRing R] (n ν : ℕ) : R[X] :=
(choose n ν) * X^ν * (1 - X)^(n - ν)
```
and the fact that for `ν : fin (n+1)` these are linearly independent over `ℚ`.
@@ -42,7 +42,7 @@ open Polynomial (X)
open scoped BigOperators Polynomial
-variable (R : Type _) [CommRing R]
+variable (R : Type*) [CommRing R]
/-- `bernsteinPolynomial R n ν` is `(choose n ν) * X^ν * (1 - X)^(n - ν)`.
@@ -67,7 +67,7 @@ theorem eq_zero_of_lt {n ν : ℕ} (h : n < ν) : bernsteinPolynomial R n ν = 0
section
-variable {R} {S : Type _} [CommRing S]
+variable {R} {S : Type*} [CommRing S]
@[simp]
theorem map (f : R →+* S) (n ν : ℕ) :
@@ -2,11 +2,6 @@
Copyright (c) 2020 Scott Morrison. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison
-
-! This file was ported from Lean 3 source module ring_theory.polynomial.bernstein
-! leanprover-community/mathlib commit bbeb185db4ccee8ed07dc48449414ebfa39cb821
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Polynomial.Derivative
import Mathlib.Data.Nat.Choose.Sum
@@ -15,6 +10,8 @@ import Mathlib.Data.Polynomial.AlgebraMap
import Mathlib.LinearAlgebra.LinearIndependent
import Mathlib.Data.MvPolynomial.PDeriv
+#align_import ring_theory.polynomial.bernstein from "leanprover-community/mathlib"@"bbeb185db4ccee8ed07dc48449414ebfa39cb821"
+
/-!
# Bernstein polynomials
@@ -150,7 +150,7 @@ theorem derivative_zero (n : ℕ) :
#align bernstein_polynomial.derivative_zero bernsteinPolynomial.derivative_zero
theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
- k < ν → ((Polynomial.derivative^[k]) (bernsteinPolynomial R n ν)).eval 0 = 0 := by
+ k < ν → (Polynomial.derivative^[k] (bernsteinPolynomial R n ν)).eval 0 = 0 := by
cases' ν with ν
· rintro ⟨⟩
· rw [Nat.lt_succ_iff]
@@ -169,7 +169,7 @@ theorem iterate_derivative_at_0_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
@[simp]
theorem iterate_derivative_succ_at_0_eq_zero (n ν : ℕ) :
- ((Polynomial.derivative^[ν]) (bernsteinPolynomial R n (ν + 1))).eval 0 = 0 :=
+ (Polynomial.derivative^[ν] (bernsteinPolynomial R n (ν + 1))).eval 0 = 0 :=
iterate_derivative_at_0_eq_zero_of_lt R n (lt_add_one ν)
#align bernstein_polynomial.iterate_derivative_succ_at_0_eq_zero bernsteinPolynomial.iterate_derivative_succ_at_0_eq_zero
@@ -177,7 +177,7 @@ open Polynomial
@[simp]
theorem iterate_derivative_at_0 (n ν : ℕ) :
- ((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 =
+ (Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 =
(pochhammer R ν).eval ((n - (ν - 1) : ℕ) : R) := by
by_cases h : ν ≤ n
· induction' ν with ν ih generalizing n
@@ -200,7 +200,7 @@ theorem iterate_derivative_at_0 (n ν : ℕ) :
#align bernstein_polynomial.iterate_derivative_at_0 bernsteinPolynomial.iterate_derivative_at_0
theorem iterate_derivative_at_0_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
- ((Polynomial.derivative^[ν]) (bernsteinPolynomial R n ν)).eval 0 ≠ 0 := by
+ (Polynomial.derivative^[ν] (bernsteinPolynomial R n ν)).eval 0 ≠ 0 := by
simp only [Int.coe_nat_eq_zero, bernsteinPolynomial.iterate_derivative_at_0, Ne.def,
Nat.cast_eq_zero]
simp only [← pochhammer_eval_cast]
@@ -219,7 +219,7 @@ we use the symmetry of the Bernstein polynomials.
theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
- k < n - ν → ((Polynomial.derivative^[k]) (bernsteinPolynomial R n ν)).eval 1 = 0 := by
+ k < n - ν → (Polynomial.derivative^[k] (bernsteinPolynomial R n ν)).eval 1 = 0 := by
intro w
rw [flip' _ _ _ (tsub_pos_iff_lt.mp (pos_of_gt w)).le]
simp [Polynomial.eval_comp, iterate_derivative_at_0_eq_zero_of_lt R n w]
@@ -227,7 +227,7 @@ theorem iterate_derivative_at_1_eq_zero_of_lt (n : ℕ) {ν k : ℕ} :
@[simp]
theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
- ((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 =
+ (Polynomial.derivative^[n - ν] (bernsteinPolynomial R n ν)).eval 1 =
(-1) ^ (n - ν) * (pochhammer R (n - ν)).eval (ν + 1 : R) := by
rw [flip' _ _ _ h]
simp [Polynomial.eval_comp, h]
@@ -239,7 +239,7 @@ theorem iterate_derivative_at_1 (n ν : ℕ) (h : ν ≤ n) :
#align bernstein_polynomial.iterate_derivative_at_1 bernsteinPolynomial.iterate_derivative_at_1
theorem iterate_derivative_at_1_ne_zero [CharZero R] (n ν : ℕ) (h : ν ≤ n) :
- ((Polynomial.derivative^[n - ν]) (bernsteinPolynomial R n ν)).eval 1 ≠ 0 := by
+ (Polynomial.derivative^[n - ν] (bernsteinPolynomial R n ν)).eval 1 ≠ 0 := by
rw [bernsteinPolynomial.iterate_derivative_at_1 _ _ _ h, Ne.def, neg_one_pow_mul_eq_zero_iff, ←
Nat.cast_succ, ← pochhammer_eval_cast, ← Nat.cast_zero, Nat.cast_inj]
exact (pochhammer_pos _ _ (Nat.succ_pos ν)).ne'
@@ -269,7 +269,7 @@ theorem linearIndependent_aux (n k : ℕ) (h : k ≤ n + 1) :
simp only [LinearMap.pow_apply]
-- The right hand side is nonzero,
-- so it will suffice to show the left hand side is always zero.
- suffices ((Polynomial.derivative^[n - k]) p).eval 1 = 0 by
+ suffices (Polynomial.derivative^[n - k] p).eval 1 = 0 by
rw [this]
exact (iterate_derivative_at_1_ne_zero ℚ n k h).symm
refine span_induction m ?_ ?_ ?_ ?_
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -20,7 +20,7 @@ import Mathlib.Data.MvPolynomial.PDeriv
The definition of the Bernstein polynomials
```
-bernsteinPolynomial (R : Type*) [comm_ring R] (n ν : ℕ) : R[X] :=
+bernsteinPolynomial (R : Type _) [CommRing R] (n ν : ℕ) : R[X] :=
(choose n ν) * X^ν * (1 - X)^(n - ν)
```
and the fact that for `ν : fin (n+1)` these are linearly independent over `ℚ`.
@@ -26,9 +26,9 @@ bernsteinPolynomial (R : Type*) [comm_ring R] (n ν : ℕ) : R[X] :=
and the fact that for `ν : fin (n+1)` these are linearly independent over `ℚ`.
We prove the basic identities
-* `(Finset.range (n + 1)).sum (λ ν, bernsteinPolynomial R n ν) = 1`
-* `(Finset.range (n + 1)).sum (λ ν, ν • bernsteinPolynomial R n ν) = n • X`
-* `(Finset.range (n + 1)).sum (λ ν, (ν * (ν-1)) • bernsteinPolynomial R n ν) = (n * (n-1)) • X^2`
+* `(Finset.range (n + 1)).sum (fun ν ↦ bernsteinPolynomial R n ν) = 1`
+* `(Finset.range (n + 1)).sum (fun ν ↦ ν • bernsteinPolynomial R n ν) = n • X`
+* `(Finset.range (n + 1)).sum (fun ν ↦ (ν * (ν-1)) • bernsteinPolynomial R n ν) = (n * (n-1)) • X^2`
## Notes
The unported dependencies are