number_theory.bernoulli
⟷
Mathlib.NumberTheory.Bernoulli
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)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -186,7 +186,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
· simp
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
suffices ∑ p in antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2!)⁻¹ = n !⁻¹ by
- simpa [RingHom.map_sum] using congr_arg (algebraMap ℚ A) this
+ simpa [map_sum] using congr_arg (algebraMap ℚ A) this
apply eq_inv_of_mul_eq_one_left
rw [sum_mul]
convert bernoulli'_spec' n using 1
@@ -326,7 +326,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
simp only [bernoulliPowerSeries, coeff_mul, coeff_X, sum_antidiagonal_succ', one_div, coeff_mk,
coeff_one, coeff_exp, LinearMap.map_sub, factorial, if_pos, cast_succ, cast_one, cast_mul,
sub_zero, RingHom.map_one, add_eq_zero_iff, if_false, _root_.inv_one, zero_add, one_ne_zero,
- MulZeroClass.mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← RingHom.map_sum]
+ MulZeroClass.mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← map_sum]
cases n; · simp
rw [if_neg n.succ_succ_ne_one]
have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -279,7 +279,7 @@ theorem sum_bernoulli (n : ℕ) :
simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
convert f
· funext x; rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
- · simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel]
+ · simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel_right]
ring
#align sum_bernoulli sum_bernoulli
-/
@@ -430,7 +430,7 @@ theorem sum_Ico_pow (n p : ℕ) :
have hle := Nat.le_add_left 1 n
have hne : (p + 1 + 1 : ℚ) ≠ 0 := by exact_mod_cast succ_ne_zero p.succ
have h1 : ∀ r : ℚ, r * (p + 1 + 1) * n ^ p.succ / (p + 1 + 1 : ℚ) = r * n ^ p.succ := fun r => by
- rw [mul_div_right_comm, mul_div_cancel _ hne]
+ rw [mul_div_right_comm, mul_div_cancel_right₀ _ hne]
have h2 : f 1 + n ^ p.succ = 1 / 2 * n ^ p.succ :=
by
simp_rw [f, bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -211,10 +211,10 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
suffices (B - eval_neg_hom B) * (NormedSpace.exp ℚ - 1) = X * (NormedSpace.exp ℚ - 1)
by
cases mul_eq_mul_right_iff.mp this <;>
- simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
+ simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
· apply eq_zero_of_neg_eq
specialize h n
- split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
+ split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
· simpa using h 1
have h : B * (NormedSpace.exp ℚ - 1) = X * NormedSpace.exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
@@ -276,7 +276,7 @@ theorem sum_bernoulli (n : ℕ) :
mul_one, choose_zero_right, cast_zero, if_false, zero_add, succ_succ_ne_one]
ring
have f := sum_bernoulli' n.succ.succ
- simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
+ simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
convert f
· funext x; rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
· simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel]
@@ -302,7 +302,7 @@ theorem bernoulli_spec' (n : ℕ) :
apply add_eq_of_eq_sub'
convert eq_sub_of_add_eq' H using 1
· refine' sum_congr rfl fun p h => _
- obtain ⟨h', h''⟩ : p ∈ _ ∧ p ≠ _ := by rwa [mem_sdiff, mem_singleton] at h
+ obtain ⟨h', h''⟩ : p ∈ _ ∧ p ≠ _ := by rwa [mem_sdiff, mem_singleton] at h
simp [bernoulli_eq_bernoulli'_of_ne_one ((not_congr (antidiagonal_congr h' h₁)).mp h'')]
· field_simp [h₃]
norm_num
@@ -333,7 +333,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
have hite2 : ite (n.succ = 0) 1 0 = (0 : ℚ) := if_neg n.succ_ne_zero
rw [← map_zero (algebraMap ℚ A), ← zero_div (n.succ ! : ℚ), ← hite2, ← bernoulli_spec', sum_div]
refine' congr_arg (algebraMap ℚ A) (sum_congr rfl fun x h => eq_div_of_mul_eq (hfact n.succ) _)
- rw [mem_antidiagonal] at h
+ rw [mem_antidiagonal] at h
have hj : (x.2 + 1 : ℚ) ≠ 0 := by exact_mod_cast succ_ne_zero _
field_simp [← h, mul_ne_zero hj (hfact x.2), hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc,
add_choose, cast_div_char_zero (factorial_mul_factorial_dvd_factorial_add _ _),
@@ -387,7 +387,7 @@ theorem sum_range_pow (n p : ℕ) :
∑ i in range (p + 1), bernoulli i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1)!
by
rw [← div_eq_iff (hne p), div_eq_mul_inv, sum_mul]
- rw [PowerSeries.ext_iff] at this
+ rw [PowerSeries.ext_iff] at this
simpa using this p
-- the power series `exp ℚ - 1` is non-zero, a fact we need in order to use `mul_right_inj'`
have hexp : NormedSpace.exp ℚ - 1 ≠ 0 :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -208,7 +208,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 :=
by
let B := mk fun n => bernoulli' n / n !
- suffices (B - eval_neg_hom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
+ suffices (B - eval_neg_hom B) * (NormedSpace.exp ℚ - 1) = X * (NormedSpace.exp ℚ - 1)
by
cases mul_eq_mul_right_iff.mp this <;>
simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
@@ -216,11 +216,14 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
specialize h n
split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
· simpa using h 1
- have h : B * (exp ℚ - 1) = X * exp ℚ := by
+ have h : B * (NormedSpace.exp ℚ - 1) = X * NormedSpace.exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
- suffices eval_neg_hom (B * (exp ℚ - 1)) * exp ℚ = eval_neg_hom (X * exp ℚ) * exp ℚ by
- simpa [mul_assoc, sub_mul, mul_comm (eval_neg_hom (exp ℚ)), exp_mul_exp_neg_eq_one]
+ suffices
+ eval_neg_hom (B * (NormedSpace.exp ℚ - 1)) * NormedSpace.exp ℚ =
+ eval_neg_hom (X * NormedSpace.exp ℚ) * NormedSpace.exp ℚ
+ by
+ simpa [mul_assoc, sub_mul, mul_comm (eval_neg_hom (NormedSpace.exp ℚ)), exp_mul_exp_neg_eq_one]
congr
#align bernoulli'_odd_eq_zero bernoulli'_odd_eq_zero
-/
@@ -353,12 +356,12 @@ theorem sum_range_pow (n p : ℕ) :
have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
-- compute the Cauchy product of two power series
have h_cauchy :
- ((mk fun p => bernoulli p / p !) * mk fun q => coeff ℚ (q + 1) (exp ℚ ^ n)) =
+ ((mk fun p => bernoulli p / p !) * mk fun q => coeff ℚ (q + 1) (NormedSpace.exp ℚ ^ n)) =
mk fun p =>
∑ i in range (p + 1), bernoulli i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1)! :=
by
ext q : 1
- let f a b := bernoulli a / a ! * coeff ℚ (b + 1) (exp ℚ ^ n)
+ let f a b := bernoulli a / a ! * coeff ℚ (b + 1) (NormedSpace.exp ℚ ^ n)
-- key step: use `power_series.coeff_mul` and then rewrite sums
simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
apply sum_congr rfl
@@ -387,14 +390,15 @@ theorem sum_range_pow (n p : ℕ) :
rw [PowerSeries.ext_iff] at this
simpa using this p
-- the power series `exp ℚ - 1` is non-zero, a fact we need in order to use `mul_right_inj'`
- have hexp : exp ℚ - 1 ≠ 0 :=
+ have hexp : NormedSpace.exp ℚ - 1 ≠ 0 :=
by
- simp only [exp, PowerSeries.ext_iff, Ne, Classical.not_forall]
+ simp only [NormedSpace.exp, PowerSeries.ext_iff, Ne, Classical.not_forall]
use 1
simp
- have h_r : exp ℚ ^ n - 1 = X * mk fun p => coeff ℚ (p + 1) (exp ℚ ^ n) :=
+ have h_r :
+ NormedSpace.exp ℚ ^ n - 1 = X * mk fun p => coeff ℚ (p + 1) (NormedSpace.exp ℚ ^ n) :=
by
- have h_const : C ℚ (constant_coeff ℚ (exp ℚ ^ n)) = 1 := by simp
+ have h_const : C ℚ (constant_coeff ℚ (NormedSpace.exp ℚ ^ n)) = 1 := by simp
rw [← h_const, sub_const_eq_X_mul_shift]
-- key step: a chain of equalities of power series
rw [← mul_right_inj' hexp, mul_comm, ← exp_pow_sum, geom_sum_mul, h_r, ←
mathlib commit https://github.com/leanprover-community/mathlib/commit/b1abe23ae96fef89ad30d9f4362c307f72a55010
@@ -389,7 +389,7 @@ theorem sum_range_pow (n p : ℕ) :
-- the power series `exp ℚ - 1` is non-zero, a fact we need in order to use `mul_right_inj'`
have hexp : exp ℚ - 1 ≠ 0 :=
by
- simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
+ simp only [exp, PowerSeries.ext_iff, Ne, Classical.not_forall]
use 1
simp
have h_r : exp ℚ ^ n - 1 = X * mk fun p => coeff ℚ (p + 1) (exp ℚ ^ n) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kevin Buzzard
-/
-import Mathbin.Algebra.BigOperators.NatAntidiagonal
-import Mathbin.Algebra.GeomSum
-import Mathbin.Data.Fintype.BigOperators
-import Mathbin.RingTheory.PowerSeries.WellKnown
-import Mathbin.Tactic.FieldSimp
+import Algebra.BigOperators.NatAntidiagonal
+import Algebra.GeomSum
+import Data.Fintype.BigOperators
+import RingTheory.PowerSeries.WellKnown
+import Tactic.FieldSimp
#align_import number_theory.bernoulli from "leanprover-community/mathlib"@"0b7c740e25651db0ba63648fbae9f9d6f941e31b"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kevin Buzzard
-
-! This file was ported from Lean 3 source module number_theory.bernoulli
-! leanprover-community/mathlib commit 0b7c740e25651db0ba63648fbae9f9d6f941e31b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.BigOperators.NatAntidiagonal
import Mathbin.Algebra.GeomSum
@@ -14,6 +9,8 @@ import Mathbin.Data.Fintype.BigOperators
import Mathbin.RingTheory.PowerSeries.WellKnown
import Mathbin.Tactic.FieldSimp
+#align_import number_theory.bernoulli from "leanprover-community/mathlib"@"0b7c740e25651db0ba63648fbae9f9d6f941e31b"
+
/-!
# Bernoulli numbers
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -79,16 +79,21 @@ def bernoulli' : ℕ → ℚ :=
#align bernoulli' bernoulli'
-/
+#print bernoulli'_def' /-
theorem bernoulli'_def' (n : ℕ) :
bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k :=
WellFounded.fix_eq _ _ _
#align bernoulli'_def' bernoulli'_def'
+-/
+#print bernoulli'_def /-
theorem bernoulli'_def (n : ℕ) :
bernoulli' n = 1 - ∑ k in range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]; rfl
#align bernoulli'_def bernoulli'_def
+-/
+#print bernoulli'_spec /-
theorem bernoulli'_spec (n : ℕ) :
∑ k in range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k = 1 :=
by
@@ -96,7 +101,9 @@ theorem bernoulli'_spec (n : ℕ) :
conv in n.choose (_ - _) => rw [choose_symm (mem_range.1 H).le]
simp only [one_mul, cast_one, sub_self, sub_add_cancel, choose_zero_right, zero_add, div_one]
#align bernoulli'_spec bernoulli'_spec
+-/
+#print bernoulli'_spec' /-
theorem bernoulli'_spec' (n : ℕ) :
∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1 = 1 :=
by
@@ -104,6 +111,7 @@ theorem bernoulli'_spec' (n : ℕ) :
refine' sum_congr rfl fun x hx => _
simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub]
#align bernoulli'_spec' bernoulli'_spec'
+-/
/-! ### Examples -/
@@ -147,6 +155,7 @@ theorem bernoulli'_four : bernoulli' 4 = -1 / 30 :=
end Examples
+#print sum_bernoulli' /-
@[simp]
theorem sum_bernoulli' (n : ℕ) : ∑ k in range n, (n.choose k : ℚ) * bernoulli' k = n :=
by
@@ -162,6 +171,7 @@ theorem sum_bernoulli' (n : ℕ) : ∑ k in range n, (n.choose k : ℚ) * bernou
field_simp [← cast_sub (mem_range.1 hk).le, mul_comm]
rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
#align sum_bernoulli' sum_bernoulli'
+-/
#print bernoulli'PowerSeries /-
/-- The exponential generating function for the Bernoulli numbers `bernoulli' n`. -/
@@ -170,6 +180,7 @@ def bernoulli'PowerSeries :=
#align bernoulli'_power_series bernoulli'PowerSeries
-/
+#print bernoulli'PowerSeries_mul_exp_sub_one /-
theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A :=
by
ext n
@@ -193,6 +204,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
rw [cast_mul, cast_mul, mul_div_mul_right, cast_div_char_zero, cast_mul]
assumption; rwa [Nat.cast_succ]
#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
+-/
#print bernoulli'_odd_eq_zero /-
/-- Odd Bernoulli numbers (greater than 1) are zero. -/
@@ -251,6 +263,7 @@ theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n
#align bernoulli_eq_bernoulli'_of_ne_one bernoulli_eq_bernoulli'_of_ne_one
-/
+#print sum_bernoulli /-
@[simp]
theorem sum_bernoulli (n : ℕ) :
∑ k in range n, (n.choose k : ℚ) * bernoulli k = if n = 1 then 1 else 0 :=
@@ -269,7 +282,9 @@ theorem sum_bernoulli (n : ℕ) :
· simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel]
ring
#align sum_bernoulli sum_bernoulli
+-/
+#print bernoulli_spec' /-
theorem bernoulli_spec' (n : ℕ) :
∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1 =
if n = 0 then 1 else 0 :=
@@ -292,6 +307,7 @@ theorem bernoulli_spec' (n : ℕ) :
· field_simp [h₃]
norm_num
#align bernoulli_spec' bernoulli_spec'
+-/
#print bernoulliPowerSeries /-
/-- The exponential generating function for the Bernoulli numbers `bernoulli n`. -/
@@ -300,6 +316,7 @@ def bernoulliPowerSeries :=
#align bernoulli_power_series bernoulliPowerSeries
-/
+#print bernoulliPowerSeries_mul_exp_sub_one /-
theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X :=
by
ext n
@@ -323,9 +340,11 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
Nat.factorial_ne_zero, hj]
cc
#align bernoulli_power_series_mul_exp_sub_one bernoulliPowerSeries_mul_exp_sub_one
+-/
section Faulhaber
+#print sum_range_pow /-
/-- **Faulhaber's theorem** relating the **sum of of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
@@ -389,7 +408,9 @@ theorem sum_range_pow (n p : ℕ) :
refine' sum_congr rfl fun x hx => _
field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
#align sum_range_pow sum_range_pow
+-/
+#print sum_Ico_pow /-
/-- Alternate form of **Faulhaber's theorem**, relating the sum of p-th powers to the Bernoulli
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. -/
@@ -445,6 +466,7 @@ theorem sum_Ico_pow (n p : ℕ) :
∑ i in range p.succ.succ, f' i :=
by simp_rw [sum_range_succ']
#align sum_Ico_pow sum_Ico_pow
+-/
end Faulhaber
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -90,7 +90,7 @@ theorem bernoulli'_def (n : ℕ) :
#align bernoulli'_def bernoulli'_def
theorem bernoulli'_spec (n : ℕ) :
- (∑ k in range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 :=
+ ∑ k in range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k = 1 :=
by
rw [sum_range_succ_comm, bernoulli'_def n, tsub_self]
conv in n.choose (_ - _) => rw [choose_symm (mem_range.1 H).le]
@@ -98,7 +98,7 @@ theorem bernoulli'_spec (n : ℕ) :
#align bernoulli'_spec bernoulli'_spec
theorem bernoulli'_spec' (n : ℕ) :
- (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 :=
+ ∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1 = 1 :=
by
refine' ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans _).trans (bernoulli'_spec n)
refine' sum_congr rfl fun x hx => _
@@ -148,11 +148,11 @@ theorem bernoulli'_four : bernoulli' 4 = -1 / 30 :=
end Examples
@[simp]
-theorem sum_bernoulli' (n : ℕ) : (∑ k in range n, (n.choose k : ℚ) * bernoulli' k) = n :=
+theorem sum_bernoulli' (n : ℕ) : ∑ k in range n, (n.choose k : ℚ) * bernoulli' k = n :=
by
cases n; · simp
suffices
- ((n + 1 : ℚ) * ∑ k in range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) =
+ (n + 1 : ℚ) * ∑ k in range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k =
∑ x in range n, ↑(n.succ.choose x) * bernoulli' x
by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right]; ring
simp_rw [mul_sum, ← mul_assoc]
@@ -177,7 +177,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
cases n;
· simp
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
- suffices (∑ p in antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2!)⁻¹) = n !⁻¹ by
+ suffices ∑ p in antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2!)⁻¹ = n !⁻¹ by
simpa [RingHom.map_sum] using congr_arg (algebraMap ℚ A) this
apply eq_inv_of_mul_eq_one_left
rw [sum_mul]
@@ -253,11 +253,11 @@ theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n
@[simp]
theorem sum_bernoulli (n : ℕ) :
- (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 :=
+ ∑ k in range n, (n.choose k : ℚ) * bernoulli k = if n = 1 then 1 else 0 :=
by
cases n; · simp
cases n; · simp
- suffices (∑ i in range n, ↑((n + 2).choose (i + 2)) * bernoulli (i + 2)) = n / 2
+ suffices ∑ i in range n, ↑((n + 2).choose (i + 2)) * bernoulli (i + 2) = n / 2
by
simp only [this, sum_range_succ', cast_succ, bernoulli_one, bernoulli_zero, choose_one_right,
mul_one, choose_zero_right, cast_zero, if_false, zero_add, succ_succ_ne_one]
@@ -271,7 +271,7 @@ theorem sum_bernoulli (n : ℕ) :
#align sum_bernoulli sum_bernoulli
theorem bernoulli_spec' (n : ℕ) :
- (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
+ ∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1 =
if n = 0 then 1 else 0 :=
by
cases n; · simp
@@ -331,7 +331,7 @@ $$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
the proof provided here. -/
theorem sum_range_pow (n p : ℕ) :
- (∑ k in range n, (k : ℚ) ^ p) =
+ ∑ k in range n, (k : ℚ) ^ p =
∑ i in range (p + 1), bernoulli i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1) :=
by
have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
@@ -359,7 +359,7 @@ theorem sum_range_pow (n p : ℕ) :
· simp [hne]
-- same as our goal except we pull out `p!` for convenience
have hps :
- (∑ k in range n, ↑k ^ p) =
+ ∑ k in range n, ↑k ^ p =
(∑ i in range (p + 1), bernoulli i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1)!) * p ! :=
by
suffices
@@ -394,7 +394,7 @@ theorem sum_range_pow (n p : ℕ) :
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. -/
theorem sum_Ico_pow (n p : ℕ) :
- (∑ k in Ico 1 (n + 1), (k : ℚ) ^ p) =
+ ∑ k in Ico 1 (n + 1), (k : ℚ) ^ p =
∑ i in range (p + 1), bernoulli' i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1) :=
by
rw [← Nat.cast_succ]
@@ -403,7 +403,7 @@ theorem sum_Ico_pow (n p : ℕ) :
· simp
let f i := bernoulli i * p.succ.succ.choose i * n ^ (p.succ.succ - i) / p.succ.succ
let f' i := bernoulli' i * p.succ.succ.choose i * n ^ (p.succ.succ - i) / p.succ.succ
- suffices (∑ k in Ico 1 n.succ, ↑k ^ p.succ) = ∑ i in range p.succ.succ, f' i by convert this
+ suffices ∑ k in Ico 1 n.succ, ↑k ^ p.succ = ∑ i in range p.succ.succ, f' i by convert this
-- prove some algebraic facts that will make things easier for us later on
have hle := Nat.le_add_left 1 n
have hne : (p + 1 + 1 : ℚ) ≠ 0 := by exact_mod_cast succ_ne_zero p.succ
@@ -414,31 +414,31 @@ theorem sum_Ico_pow (n p : ℕ) :
simp_rw [f, bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
ring
have :
- (∑ i in range p, bernoulli (i + 2) * (p + 2).choose (i + 2) * n ^ (p - i) / ↑(p + 2)) =
+ ∑ i in range p, bernoulli (i + 2) * (p + 2).choose (i + 2) * n ^ (p - i) / ↑(p + 2) =
∑ i in range p, bernoulli' (i + 2) * (p + 2).choose (i + 2) * n ^ (p - i) / ↑(p + 2) :=
sum_congr rfl fun i h => by rw [bernoulli_eq_bernoulli'_of_ne_one (succ_succ_ne_one i)]
calc
- (-- replace sum over `Ico` with sum over `range` and simplify
- ∑ k in Ico 1 n.succ, ↑k ^ p.succ) =
+ -- replace sum over `Ico` with sum over `range` and simplify
+ ∑ k in Ico 1 n.succ, ↑k ^ p.succ =
∑ k in range n.succ, ↑k ^ p.succ :=
by simp [sum_Ico_eq_sub _ hle, succ_ne_zero]
-- extract the last term of the sum
_ =
- (∑ k in range n, (k : ℚ) ^ p.succ) + n ^ p.succ :=
+ ∑ k in range n, (k : ℚ) ^ p.succ + n ^ p.succ :=
by rw [sum_range_succ]
-- apply the key lemma, `sum_range_pow`
_ =
- (∑ i in range p.succ.succ, f i) + n ^ p.succ :=
+ ∑ i in range p.succ.succ, f i + n ^ p.succ :=
by simp [f, sum_range_pow]
-- extract the first two terms of the sum
_ =
- (∑ i in range p, f i.succ.succ) + f 1 + f 0 + n ^ p.succ :=
+ ∑ i in range p, f i.succ.succ + f 1 + f 0 + n ^ p.succ :=
by simp_rw [sum_range_succ']
- _ = (∑ i in range p, f i.succ.succ) + (f 1 + n ^ p.succ) + f 0 := by ring
- _ = (∑ i in range p, f i.succ.succ) + 1 / 2 * n ^ p.succ + f 0 := by rw [h2]
+ _ = ∑ i in range p, f i.succ.succ + (f 1 + n ^ p.succ) + f 0 := by ring
+ _ = ∑ i in range p, f i.succ.succ + 1 / 2 * n ^ p.succ + f 0 := by rw [h2]
-- convert from `bernoulli` to `bernoulli'`
_ =
- (∑ i in range p, f' i.succ.succ) + f' 1 + f' 0 :=
+ ∑ i in range p, f' i.succ.succ + f' 1 + f' 0 :=
by simp only [f, f']; simpa [h1, fun i => show i + 2 = i + 1 + 1 from rfl]
-- rejoin the first two terms of the sum
_ =
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -444,7 +444,6 @@ theorem sum_Ico_pow (n p : ℕ) :
_ =
∑ i in range p.succ.succ, f' i :=
by simp_rw [sum_range_succ']
-
#align sum_Ico_pow sum_Ico_pow
end Faulhaber
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -205,7 +205,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
· apply eq_zero_of_neg_eq
specialize h n
- split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
+ split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
· simpa using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -202,10 +202,10 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
suffices (B - eval_neg_hom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
by
cases mul_eq_mul_right_iff.mp this <;>
- simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
+ simp only [PowerSeries.ext_iff, eval_neg_hom, coeff_X] at h
· apply eq_zero_of_neg_eq
specialize h n
- split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
+ split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
· simpa using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
@@ -263,7 +263,7 @@ theorem sum_bernoulli (n : ℕ) :
mul_one, choose_zero_right, cast_zero, if_false, zero_add, succ_succ_ne_one]
ring
have f := sum_bernoulli' n.succ.succ
- simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
+ simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
convert f
· funext x; rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
· simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel]
@@ -283,11 +283,11 @@ theorem bernoulli_spec' (n : ℕ) :
-- key equation: the corresponding fact for `bernoulli'`
have H := bernoulli'_spec' n.succ
-- massage it to match the structure of the goal, then convert piece by piece
- rw [sum_eq_add_sum_diff_singleton h₁] at H⊢
+ rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
apply add_eq_of_eq_sub'
convert eq_sub_of_add_eq' H using 1
· refine' sum_congr rfl fun p h => _
- obtain ⟨h', h''⟩ : p ∈ _ ∧ p ≠ _ := by rwa [mem_sdiff, mem_singleton] at h
+ obtain ⟨h', h''⟩ : p ∈ _ ∧ p ≠ _ := by rwa [mem_sdiff, mem_singleton] at h
simp [bernoulli_eq_bernoulli'_of_ne_one ((not_congr (antidiagonal_congr h' h₁)).mp h'')]
· field_simp [h₃]
norm_num
@@ -316,7 +316,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
have hite2 : ite (n.succ = 0) 1 0 = (0 : ℚ) := if_neg n.succ_ne_zero
rw [← map_zero (algebraMap ℚ A), ← zero_div (n.succ ! : ℚ), ← hite2, ← bernoulli_spec', sum_div]
refine' congr_arg (algebraMap ℚ A) (sum_congr rfl fun x h => eq_div_of_mul_eq (hfact n.succ) _)
- rw [mem_antidiagonal] at h
+ rw [mem_antidiagonal] at h
have hj : (x.2 + 1 : ℚ) ≠ 0 := by exact_mod_cast succ_ne_zero _
field_simp [← h, mul_ne_zero hj (hfact x.2), hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc,
add_choose, cast_div_char_zero (factorial_mul_factorial_dvd_factorial_add _ _),
@@ -368,7 +368,7 @@ theorem sum_range_pow (n p : ℕ) :
∑ i in range (p + 1), bernoulli i * (p + 1).choose i * n ^ (p + 1 - i) / (p + 1)!
by
rw [← div_eq_iff (hne p), div_eq_mul_inv, sum_mul]
- rw [PowerSeries.ext_iff] at this
+ rw [PowerSeries.ext_iff] at this
simpa using this p
-- the power series `exp ℚ - 1` is non-zero, a fact we need in order to use `mul_right_inj'`
have hexp : exp ℚ - 1 ≠ 0 :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -60,7 +60,7 @@ then defined as `bernoulli := (-1)^n * bernoulli'`.
-/
-open Nat BigOperators
+open scoped Nat BigOperators
open Finset Nat Finset.Nat PowerSeries
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -79,34 +79,16 @@ def bernoulli' : ℕ → ℚ :=
#align bernoulli' bernoulli'
-/
-/- warning: bernoulli'_def' -> bernoulli'_def' is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (Finset.sum.{0, 0} Rat (Fin n) Rat.addCommMonoid (Finset.univ.{0} (Fin n) (Fin.fintype n)) (fun (k : Fin n) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Rat (HasLiftT.mk.{1, 1} (Fin n) Rat (CoeTCₓ.coe.{1, 1} (Fin n) Rat (coeTrans.{1, 1, 1} (Fin n) Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))) (Fin.coeToNat n)))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) k)))))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (Finset.sum.{0, 0} Rat (Fin n) Rat.addCommMonoid (Finset.univ.{0} (Fin n) (Fin.fintype n)) (fun (k : Fin n) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n (Fin.val n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Fin.val n k))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' (Fin.val n k)))))
-Case conversion may be inaccurate. Consider using '#align bernoulli'_def' bernoulli'_def'ₓ'. -/
theorem bernoulli'_def' (n : ℕ) :
bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k :=
WellFounded.fix_eq _ _ _
#align bernoulli'_def' bernoulli'_def'
-/- warning: bernoulli'_def -> bernoulli'_def is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' k))))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' k))))
-Case conversion may be inaccurate. Consider using '#align bernoulli'_def bernoulli'_defₓ'. -/
theorem bernoulli'_def (n : ℕ) :
bernoulli' n = 1 - ∑ k in range n, n.choose k / (n - k + 1) * bernoulli' k := by
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]; rfl
#align bernoulli'_def bernoulli'_def
-/- warning: bernoulli'_spec -> bernoulli'_spec is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (Nat.succ n)) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' k))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne)))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (Nat.succ n)) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' k))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1))
-Case conversion may be inaccurate. Consider using '#align bernoulli'_spec bernoulli'_specₓ'. -/
theorem bernoulli'_spec (n : ℕ) :
(∑ k in range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 :=
by
@@ -115,12 +97,6 @@ theorem bernoulli'_spec (n : ℕ) :
simp only [one_mul, cast_one, sub_self, sub_add_cancel, choose_zero_right, zero_add, div_one]
#align bernoulli'_spec bernoulli'_spec
-/- warning: bernoulli'_spec' -> bernoulli'_spec' is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' (Prod.fst.{0, 0} Nat Nat k)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne)))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' (Prod.fst.{0, 0} Nat Nat k)))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1))
-Case conversion may be inaccurate. Consider using '#align bernoulli'_spec' bernoulli'_spec'ₓ'. -/
theorem bernoulli'_spec' (n : ℕ) :
(∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 :=
by
@@ -171,12 +147,6 @@ theorem bernoulli'_four : bernoulli' 4 = -1 / 30 :=
end Examples
-/- warning: sum_bernoulli' -> sum_bernoulli' is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (bernoulli' k))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n)
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (bernoulli' k))) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n)
-Case conversion may be inaccurate. Consider using '#align sum_bernoulli' sum_bernoulli'ₓ'. -/
@[simp]
theorem sum_bernoulli' (n : ℕ) : (∑ k in range n, (n.choose k : ℚ) * bernoulli' k) = n :=
by
@@ -200,12 +170,6 @@ def bernoulli'PowerSeries :=
#align bernoulli'_power_series bernoulli'PowerSeries
-/
-/- warning: bernoulli'_power_series_mul_exp_sub_one -> bernoulli'PowerSeries_mul_exp_sub_one is a dubious translation:
-lean 3 declaration is
- forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (bernoulli'PowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (SubNegMonoid.toHasSub.{u1} (PowerSeries.{u1} A) (AddGroup.toSubNegMonoid.{u1} (PowerSeries.{u1} A) (PowerSeries.addGroup.{u1} A (AddGroupWithOne.toAddGroup.{u1} A (AddCommGroupWithOne.toAddGroupWithOne.{u1} A (Ring.toAddCommGroupWithOne.{u1} A (CommRing.toRing.{u1} A _inst_1)))))))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (OfNat.mk.{u1} (PowerSeries.{u1} A) 1 (One.one.{u1} (PowerSeries.{u1} A) (AddMonoidWithOne.toOne.{u1} (PowerSeries.{u1} A) (AddGroupWithOne.toAddMonoidWithOne.{u1} (PowerSeries.{u1} A) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (PowerSeries.{u1} A) (Ring.toAddCommGroupWithOne.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))))))))) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (PowerSeries.X.{u1} A (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2))
-but is expected to have type
- forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (bernoulli'PowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (Ring.toSub.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (One.toOfNat1.{u1} (PowerSeries.{u1} A) (Semiring.toOne.{u1} (PowerSeries.{u1} A) (PowerSeries.instSemiringPowerSeries.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))))))) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (PowerSeries.X.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2))
-Case conversion may be inaccurate. Consider using '#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_oneₓ'. -/
theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A :=
by
ext n
@@ -287,12 +251,6 @@ theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n
#align bernoulli_eq_bernoulli'_of_ne_one bernoulli_eq_bernoulli'_of_ne_one
-/
-/- warning: sum_bernoulli -> sum_bernoulli is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (bernoulli k))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (Nat.decidableEq n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (OfNat.ofNat.{0} Rat 0 (OfNat.mk.{0} Rat 0 (Zero.zero.{0} Rat Rat.hasZero))))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (bernoulli k))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (instDecidableEqNat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (OfNat.ofNat.{0} Rat 0 (Rat.instOfNatRat 0)))
-Case conversion may be inaccurate. Consider using '#align sum_bernoulli sum_bernoulliₓ'. -/
@[simp]
theorem sum_bernoulli (n : ℕ) :
(∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 :=
@@ -312,12 +270,6 @@ theorem sum_bernoulli (n : ℕ) :
ring
#align sum_bernoulli sum_bernoulli
-/- warning: bernoulli_spec' -> bernoulli_spec' is a dubious translation:
-lean 3 declaration is
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli (Prod.fst.{0, 0} Nat Nat k)))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (Nat.decidableEq n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (OfNat.ofNat.{0} Rat 0 (OfNat.mk.{0} Rat 0 (Zero.zero.{0} Rat Rat.hasZero))))
-but is expected to have type
- forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli (Prod.fst.{0, 0} Nat Nat k)))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (instDecidableEqNat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (OfNat.ofNat.{0} Rat 0 (Rat.instOfNatRat 0)))
-Case conversion may be inaccurate. Consider using '#align bernoulli_spec' bernoulli_spec'ₓ'. -/
theorem bernoulli_spec' (n : ℕ) :
(∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
if n = 0 then 1 else 0 :=
@@ -348,12 +300,6 @@ def bernoulliPowerSeries :=
#align bernoulli_power_series bernoulliPowerSeries
-/
-/- warning: bernoulli_power_series_mul_exp_sub_one -> bernoulliPowerSeries_mul_exp_sub_one is a dubious translation:
-lean 3 declaration is
- forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (bernoulliPowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (SubNegMonoid.toHasSub.{u1} (PowerSeries.{u1} A) (AddGroup.toSubNegMonoid.{u1} (PowerSeries.{u1} A) (PowerSeries.addGroup.{u1} A (AddGroupWithOne.toAddGroup.{u1} A (AddCommGroupWithOne.toAddGroupWithOne.{u1} A (Ring.toAddCommGroupWithOne.{u1} A (CommRing.toRing.{u1} A _inst_1)))))))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (OfNat.mk.{u1} (PowerSeries.{u1} A) 1 (One.one.{u1} (PowerSeries.{u1} A) (AddMonoidWithOne.toOne.{u1} (PowerSeries.{u1} A) (AddGroupWithOne.toAddMonoidWithOne.{u1} (PowerSeries.{u1} A) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (PowerSeries.{u1} A) (Ring.toAddCommGroupWithOne.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))))))))) (PowerSeries.X.{u1} A (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1)))
-but is expected to have type
- forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (bernoulliPowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (Ring.toSub.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (One.toOfNat1.{u1} (PowerSeries.{u1} A) (Semiring.toOne.{u1} (PowerSeries.{u1} A) (PowerSeries.instSemiringPowerSeries.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))))))) (PowerSeries.X.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))
-Case conversion may be inaccurate. Consider using '#align bernoulli_power_series_mul_exp_sub_one bernoulliPowerSeries_mul_exp_sub_oneₓ'. -/
theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X :=
by
ext n
@@ -380,12 +326,6 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
section Faulhaber
-/- warning: sum_range_pow -> sum_range_pow is a dubious translation:
-lean 3 declaration is
- forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (bernoulli i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) p) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))))
-but is expected to have type
- forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (bernoulli i) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) p) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))))
-Case conversion may be inaccurate. Consider using '#align sum_range_pow sum_range_powₓ'. -/
/-- **Faulhaber's theorem** relating the **sum of of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
@@ -450,12 +390,6 @@ theorem sum_range_pow (n p : ℕ) :
field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
#align sum_range_pow sum_range_pow
-/- warning: sum_Ico_pow -> sum_Ico_pow is a dubious translation:
-lean 3 declaration is
- forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.Ico.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) Nat.locallyFiniteOrder (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (bernoulli' i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) p) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))))
-but is expected to have type
- forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.Ico.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) instLocallyFiniteOrderNatToPreorderToPartialOrderStrictOrderedSemiring (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (bernoulli' i) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) p) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))))
-Case conversion may be inaccurate. Consider using '#align sum_Ico_pow sum_Ico_powₓ'. -/
/-- Alternate form of **Faulhaber's theorem**, relating the sum of p-th powers to the Bernoulli
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -97,10 +97,8 @@ but is expected to have type
forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' k))))
Case conversion may be inaccurate. Consider using '#align bernoulli'_def bernoulli'_defₓ'. -/
theorem bernoulli'_def (n : ℕ) :
- bernoulli' n = 1 - ∑ k in range n, n.choose k / (n - k + 1) * bernoulli' k :=
- by
- rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]
- rfl
+ bernoulli' n = 1 - ∑ k in range n, n.choose k / (n - k + 1) * bernoulli' k := by
+ rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]; rfl
#align bernoulli'_def bernoulli'_def
/- warning: bernoulli'_spec -> bernoulli'_spec is a dubious translation:
@@ -138,37 +136,25 @@ section Examples
#print bernoulli'_zero /-
@[simp]
-theorem bernoulli'_zero : bernoulli' 0 = 1 :=
- by
- rw [bernoulli'_def]
- norm_num
+theorem bernoulli'_zero : bernoulli' 0 = 1 := by rw [bernoulli'_def]; norm_num
#align bernoulli'_zero bernoulli'_zero
-/
#print bernoulli'_one /-
@[simp]
-theorem bernoulli'_one : bernoulli' 1 = 1 / 2 :=
- by
- rw [bernoulli'_def]
- norm_num
+theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by rw [bernoulli'_def]; norm_num
#align bernoulli'_one bernoulli'_one
-/
#print bernoulli'_two /-
@[simp]
-theorem bernoulli'_two : bernoulli' 2 = 1 / 6 :=
- by
- rw [bernoulli'_def]
- norm_num [sum_range_succ]
+theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by rw [bernoulli'_def]; norm_num [sum_range_succ]
#align bernoulli'_two bernoulli'_two
-/
#print bernoulli'_three /-
@[simp]
-theorem bernoulli'_three : bernoulli' 3 = 0 :=
- by
- rw [bernoulli'_def]
- norm_num [sum_range_succ]
+theorem bernoulli'_three : bernoulli' 3 = 0 := by rw [bernoulli'_def]; norm_num [sum_range_succ]
#align bernoulli'_three bernoulli'_three
-/
@@ -194,14 +180,11 @@ Case conversion may be inaccurate. Consider using '#align sum_bernoulli' sum_ber
@[simp]
theorem sum_bernoulli' (n : ℕ) : (∑ k in range n, (n.choose k : ℚ) * bernoulli' k) = n :=
by
- cases n
- · simp
+ cases n; · simp
suffices
((n + 1 : ℚ) * ∑ k in range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) =
∑ x in range n, ↑(n.succ.choose x) * bernoulli' x
- by
- rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right]
- ring
+ by rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right]; ring
simp_rw [mul_sum, ← mul_assoc]
refine' sum_congr rfl fun k hk => _
congr
@@ -227,7 +210,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
by
ext n
-- constant coefficient is a special case
- cases n
+ cases n;
· simp
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
suffices (∑ p in antidiagonal n, bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2!)⁻¹) = n !⁻¹ by
@@ -244,8 +227,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose]
rw_mod_cast [mul_comm (j + 1), mul_div_assoc, ← mul_assoc]
rw [cast_mul, cast_mul, mul_div_mul_right, cast_div_char_zero, cast_mul]
- assumption
- rwa [Nat.cast_succ]
+ assumption; rwa [Nat.cast_succ]
#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
#print bernoulli'_odd_eq_zero /-
@@ -315,10 +297,8 @@ Case conversion may be inaccurate. Consider using '#align sum_bernoulli sum_bern
theorem sum_bernoulli (n : ℕ) :
(∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 :=
by
- cases n
- · simp
- cases n
- · simp
+ cases n; · simp
+ cases n; · simp
suffices (∑ i in range n, ↑((n + 2).choose (i + 2)) * bernoulli (i + 2)) = n / 2
by
simp only [this, sum_range_succ', cast_succ, bernoulli_one, bernoulli_zero, choose_one_right,
@@ -327,8 +307,7 @@ theorem sum_bernoulli (n : ℕ) :
have f := sum_bernoulli' n.succ.succ
simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
convert f
- · funext x
- rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
+ · funext x; rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
· simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel]
ring
#align sum_bernoulli sum_bernoulli
@@ -486,7 +465,7 @@ theorem sum_Ico_pow (n p : ℕ) :
by
rw [← Nat.cast_succ]
-- dispose of the trivial case
- cases p
+ cases p;
· simp
let f i := bernoulli i * p.succ.succ.choose i * n ^ (p.succ.succ - i) / p.succ.succ
let f' i := bernoulli' i * p.succ.succ.choose i * n ^ (p.succ.succ - i) / p.succ.succ
@@ -526,9 +505,7 @@ theorem sum_Ico_pow (n p : ℕ) :
-- convert from `bernoulli` to `bernoulli'`
_ =
(∑ i in range p, f' i.succ.succ) + f' 1 + f' 0 :=
- by
- simp only [f, f']
- simpa [h1, fun i => show i + 2 = i + 1 + 1 from rfl]
+ by simp only [f, f']; simpa [h1, fun i => show i + 2 = i + 1 + 1 from rfl]
-- rejoin the first two terms of the sum
_ =
∑ i in range p.succ.succ, f' i :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kevin Buzzard
! This file was ported from Lean 3 source module number_theory.bernoulli
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
+! leanprover-community/mathlib commit 0b7c740e25651db0ba63648fbae9f9d6f941e31b
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -17,6 +17,9 @@ import Mathbin.Tactic.FieldSimp
/-!
# Bernoulli numbers
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
The Bernoulli numbers are a sequence of rational numbers that frequently show up in
number theory.
mathlib commit https://github.com/leanprover-community/mathlib/commit/ef95945cd48c932c9e034872bd25c3c220d9c946
@@ -66,6 +66,7 @@ variable (A : Type _) [CommRing A] [Algebra ℚ A]
/-! ### Definitions -/
+#print bernoulli' /-
/-- The Bernoulli numbers:
the $n$-th Bernoulli number $B_n$ is defined recursively via
$$B_n = 1 - \sum_{k < n} \binom{n}{k}\frac{B_k}{n+1-k}$$ -/
@@ -73,12 +74,25 @@ def bernoulli' : ℕ → ℚ :=
WellFounded.fix lt_wfRel fun n bernoulli' =>
1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2
#align bernoulli' bernoulli'
+-/
+/- warning: bernoulli'_def' -> bernoulli'_def' is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (Finset.sum.{0, 0} Rat (Fin n) Rat.addCommMonoid (Finset.univ.{0} (Fin n) (Fin.fintype n)) (fun (k : Fin n) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Rat (HasLiftT.mk.{1, 1} (Fin n) Rat (CoeTCₓ.coe.{1, 1} (Fin n) Rat (coeTrans.{1, 1, 1} (Fin n) Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))) (Fin.coeToNat n)))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) k)))))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (Finset.sum.{0, 0} Rat (Fin n) Rat.addCommMonoid (Finset.univ.{0} (Fin n) (Fin.fintype n)) (fun (k : Fin n) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n (Fin.val n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Fin.val n k))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' (Fin.val n k)))))
+Case conversion may be inaccurate. Consider using '#align bernoulli'_def' bernoulli'_def'ₓ'. -/
theorem bernoulli'_def' (n : ℕ) :
bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k :=
WellFounded.fix_eq _ _ _
#align bernoulli'_def' bernoulli'_def'
+/- warning: bernoulli'_def -> bernoulli'_def is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' k))))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (bernoulli' n) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' k))))
+Case conversion may be inaccurate. Consider using '#align bernoulli'_def bernoulli'_defₓ'. -/
theorem bernoulli'_def (n : ℕ) :
bernoulli' n = 1 - ∑ k in range n, n.choose k / (n - k + 1) * bernoulli' k :=
by
@@ -86,6 +100,12 @@ theorem bernoulli'_def (n : ℕ) :
rfl
#align bernoulli'_def bernoulli'_def
+/- warning: bernoulli'_spec -> bernoulli'_spec is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (Nat.succ n)) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat (SubNegMonoid.toHasSub.{0} Rat (AddGroup.toSubNegMonoid.{0} Rat Rat.addGroup))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' k))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne)))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (Nat.succ n)) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (HSub.hSub.{0, 0, 0} Rat Rat Rat (instHSub.{0} Rat Rat.instSubRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' k))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1))
+Case conversion may be inaccurate. Consider using '#align bernoulli'_spec bernoulli'_specₓ'. -/
theorem bernoulli'_spec (n : ℕ) :
(∑ k in range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 :=
by
@@ -94,6 +114,12 @@ theorem bernoulli'_spec (n : ℕ) :
simp only [one_mul, cast_one, sub_self, sub_add_cancel, choose_zero_right, zero_add, div_one]
#align bernoulli'_spec bernoulli'_spec
+/- warning: bernoulli'_spec' -> bernoulli'_spec' is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli' (Prod.fst.{0, 0} Nat Nat k)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne)))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli' (Prod.fst.{0, 0} Nat Nat k)))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1))
+Case conversion may be inaccurate. Consider using '#align bernoulli'_spec' bernoulli'_spec'ₓ'. -/
theorem bernoulli'_spec' (n : ℕ) :
(∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 :=
by
@@ -107,34 +133,43 @@ theorem bernoulli'_spec' (n : ℕ) :
section Examples
+#print bernoulli'_zero /-
@[simp]
theorem bernoulli'_zero : bernoulli' 0 = 1 :=
by
rw [bernoulli'_def]
norm_num
#align bernoulli'_zero bernoulli'_zero
+-/
+#print bernoulli'_one /-
@[simp]
theorem bernoulli'_one : bernoulli' 1 = 1 / 2 :=
by
rw [bernoulli'_def]
norm_num
#align bernoulli'_one bernoulli'_one
+-/
+#print bernoulli'_two /-
@[simp]
theorem bernoulli'_two : bernoulli' 2 = 1 / 6 :=
by
rw [bernoulli'_def]
norm_num [sum_range_succ]
#align bernoulli'_two bernoulli'_two
+-/
+#print bernoulli'_three /-
@[simp]
theorem bernoulli'_three : bernoulli' 3 = 0 :=
by
rw [bernoulli'_def]
norm_num [sum_range_succ]
#align bernoulli'_three bernoulli'_three
+-/
+#print bernoulli'_four /-
@[simp]
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 :=
by
@@ -143,9 +178,16 @@ theorem bernoulli'_four : bernoulli' 4 = -1 / 30 :=
rw [bernoulli'_def]
norm_num [sum_range_succ, this]
#align bernoulli'_four bernoulli'_four
+-/
end Examples
+/- warning: sum_bernoulli' -> sum_bernoulli' is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (bernoulli' k))) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n)
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (bernoulli' k))) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n)
+Case conversion may be inaccurate. Consider using '#align sum_bernoulli' sum_bernoulli'ₓ'. -/
@[simp]
theorem sum_bernoulli' (n : ℕ) : (∑ k in range n, (n.choose k : ℚ) * bernoulli' k) = n :=
by
@@ -165,11 +207,19 @@ theorem sum_bernoulli' (n : ℕ) : (∑ k in range n, (n.choose k : ℚ) * berno
rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
#align sum_bernoulli' sum_bernoulli'
+#print bernoulli'PowerSeries /-
/-- The exponential generating function for the Bernoulli numbers `bernoulli' n`. -/
def bernoulli'PowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli' n / n !)
#align bernoulli'_power_series bernoulli'PowerSeries
+-/
+/- warning: bernoulli'_power_series_mul_exp_sub_one -> bernoulli'PowerSeries_mul_exp_sub_one is a dubious translation:
+lean 3 declaration is
+ forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (bernoulli'PowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (SubNegMonoid.toHasSub.{u1} (PowerSeries.{u1} A) (AddGroup.toSubNegMonoid.{u1} (PowerSeries.{u1} A) (PowerSeries.addGroup.{u1} A (AddGroupWithOne.toAddGroup.{u1} A (AddCommGroupWithOne.toAddGroupWithOne.{u1} A (Ring.toAddCommGroupWithOne.{u1} A (CommRing.toRing.{u1} A _inst_1)))))))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (OfNat.mk.{u1} (PowerSeries.{u1} A) 1 (One.one.{u1} (PowerSeries.{u1} A) (AddMonoidWithOne.toOne.{u1} (PowerSeries.{u1} A) (AddGroupWithOne.toAddMonoidWithOne.{u1} (PowerSeries.{u1} A) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (PowerSeries.{u1} A) (Ring.toAddCommGroupWithOne.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))))))))) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (PowerSeries.X.{u1} A (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2))
+but is expected to have type
+ forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (bernoulli'PowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (Ring.toSub.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (One.toOfNat1.{u1} (PowerSeries.{u1} A) (Semiring.toOne.{u1} (PowerSeries.{u1} A) (PowerSeries.instSemiringPowerSeries.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))))))) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (PowerSeries.X.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2))
+Case conversion may be inaccurate. Consider using '#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_oneₓ'. -/
theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A :=
by
ext n
@@ -195,6 +245,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A
rwa [Nat.cast_succ]
#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
+#print bernoulli'_odd_eq_zero /-
/-- Odd Bernoulli numbers (greater than 1) are zero. -/
theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 :=
by
@@ -214,24 +265,34 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
simpa [mul_assoc, sub_mul, mul_comm (eval_neg_hom (exp ℚ)), exp_mul_exp_neg_eq_one]
congr
#align bernoulli'_odd_eq_zero bernoulli'_odd_eq_zero
+-/
+#print bernoulli /-
/-- The Bernoulli numbers are defined to be `bernoulli'` with a parity sign. -/
def bernoulli (n : ℕ) : ℚ :=
(-1) ^ n * bernoulli' n
#align bernoulli bernoulli
+-/
+#print bernoulli'_eq_bernoulli /-
theorem bernoulli'_eq_bernoulli (n : ℕ) : bernoulli' n = (-1) ^ n * bernoulli n := by
simp [bernoulli, ← mul_assoc, ← sq, ← pow_mul, mul_comm n 2, pow_mul]
#align bernoulli'_eq_bernoulli bernoulli'_eq_bernoulli
+-/
+#print bernoulli_zero /-
@[simp]
theorem bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli]
#align bernoulli_zero bernoulli_zero
+-/
+#print bernoulli_one /-
@[simp]
theorem bernoulli_one : bernoulli 1 = -1 / 2 := by norm_num [bernoulli]
#align bernoulli_one bernoulli_one
+-/
+#print bernoulli_eq_bernoulli'_of_ne_one /-
theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n :=
by
by_cases h0 : n = 0; · simp [h0]
@@ -239,7 +300,14 @@ theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n
cases mod_two_eq_zero_or_one n; · simp [h]
simp [bernoulli'_odd_eq_zero (odd_iff.mpr h) (one_lt_iff_ne_zero_and_ne_one.mpr ⟨h0, hn⟩)]
#align bernoulli_eq_bernoulli'_of_ne_one bernoulli_eq_bernoulli'_of_ne_one
+-/
+/- warning: sum_bernoulli -> sum_bernoulli is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose n k)) (bernoulli k))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (Nat.decidableEq n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (OfNat.ofNat.{0} Rat 0 (OfNat.mk.{0} Rat 0 (Zero.zero.{0} Rat Rat.hasZero))))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose n k)) (bernoulli k))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (instDecidableEqNat n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (OfNat.ofNat.{0} Rat 0 (Rat.instOfNatRat 0)))
+Case conversion may be inaccurate. Consider using '#align sum_bernoulli sum_bernoulliₓ'. -/
@[simp]
theorem sum_bernoulli (n : ℕ) :
(∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 :=
@@ -262,6 +330,12 @@ theorem sum_bernoulli (n : ℕ) :
ring
#align sum_bernoulli sum_bernoulli
+/- warning: bernoulli_spec' -> bernoulli_spec' is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))) (bernoulli (Prod.fst.{0, 0} Nat Nat k)))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (Nat.decidableEq n (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))) (OfNat.ofNat.{0} Rat 0 (OfNat.mk.{0} Rat 0 (Zero.zero.{0} Rat Rat.hasZero))))
+but is expected to have type
+ forall (n : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat (Prod.{0, 0} Nat Nat) Rat.addCommMonoid (Finset.Nat.antidiagonal n) (fun (k : Prod.{0, 0} Nat Nat) => HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Prod.fst.{0, 0} Nat Nat k) (Prod.snd.{0, 0} Nat Nat k)) (Prod.snd.{0, 0} Nat Nat k))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Prod.snd.{0, 0} Nat Nat k)) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))) (bernoulli (Prod.fst.{0, 0} Nat Nat k)))) (ite.{1} Rat (Eq.{1} Nat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (instDecidableEqNat n (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)) (OfNat.ofNat.{0} Rat 0 (Rat.instOfNatRat 0)))
+Case conversion may be inaccurate. Consider using '#align bernoulli_spec' bernoulli_spec'ₓ'. -/
theorem bernoulli_spec' (n : ℕ) :
(∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
if n = 0 then 1 else 0 :=
@@ -285,11 +359,19 @@ theorem bernoulli_spec' (n : ℕ) :
norm_num
#align bernoulli_spec' bernoulli_spec'
+#print bernoulliPowerSeries /-
/-- The exponential generating function for the Bernoulli numbers `bernoulli n`. -/
def bernoulliPowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli n / n !)
#align bernoulli_power_series bernoulliPowerSeries
+-/
+/- warning: bernoulli_power_series_mul_exp_sub_one -> bernoulliPowerSeries_mul_exp_sub_one is a dubious translation:
+lean 3 declaration is
+ forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (Distrib.toHasMul.{u1} (PowerSeries.{u1} A) (Ring.toDistrib.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))) (bernoulliPowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (SubNegMonoid.toHasSub.{u1} (PowerSeries.{u1} A) (AddGroup.toSubNegMonoid.{u1} (PowerSeries.{u1} A) (PowerSeries.addGroup.{u1} A (AddGroupWithOne.toAddGroup.{u1} A (AddCommGroupWithOne.toAddGroupWithOne.{u1} A (Ring.toAddCommGroupWithOne.{u1} A (CommRing.toRing.{u1} A _inst_1)))))))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (OfNat.mk.{u1} (PowerSeries.{u1} A) 1 (One.one.{u1} (PowerSeries.{u1} A) (AddMonoidWithOne.toOne.{u1} (PowerSeries.{u1} A) (AddGroupWithOne.toAddMonoidWithOne.{u1} (PowerSeries.{u1} A) (AddCommGroupWithOne.toAddGroupWithOne.{u1} (PowerSeries.{u1} A) (Ring.toAddCommGroupWithOne.{u1} (PowerSeries.{u1} A) (PowerSeries.ring.{u1} A (CommRing.toRing.{u1} A _inst_1))))))))))) (PowerSeries.X.{u1} A (Ring.toSemiring.{u1} A (CommRing.toRing.{u1} A _inst_1)))
+but is expected to have type
+ forall (A : Type.{u1}) [_inst_1 : CommRing.{u1} A] [_inst_2 : Algebra.{0, u1} Rat A Rat.commSemiring (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1))], Eq.{succ u1} (PowerSeries.{u1} A) (HMul.hMul.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHMul.{u1} (PowerSeries.{u1} A) (NonUnitalNonAssocRing.toMul.{u1} (PowerSeries.{u1} A) (NonAssocRing.toNonUnitalNonAssocRing.{u1} (PowerSeries.{u1} A) (Ring.toNonAssocRing.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))))) (bernoulliPowerSeries.{u1} A _inst_1 _inst_2) (HSub.hSub.{u1, u1, u1} (PowerSeries.{u1} A) (PowerSeries.{u1} A) (PowerSeries.{u1} A) (instHSub.{u1} (PowerSeries.{u1} A) (Ring.toSub.{u1} (PowerSeries.{u1} A) (PowerSeries.instRingPowerSeries.{u1} A (CommRing.toRing.{u1} A _inst_1)))) (PowerSeries.exp.{u1} A (CommRing.toRing.{u1} A _inst_1) _inst_2) (OfNat.ofNat.{u1} (PowerSeries.{u1} A) 1 (One.toOfNat1.{u1} (PowerSeries.{u1} A) (Semiring.toOne.{u1} (PowerSeries.{u1} A) (PowerSeries.instSemiringPowerSeries.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))))))) (PowerSeries.X.{u1} A (CommSemiring.toSemiring.{u1} A (CommRing.toCommSemiring.{u1} A _inst_1)))
+Case conversion may be inaccurate. Consider using '#align bernoulli_power_series_mul_exp_sub_one bernoulliPowerSeries_mul_exp_sub_oneₓ'. -/
theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X :=
by
ext n
@@ -316,6 +398,12 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
section Faulhaber
+/- warning: sum_range_pow -> sum_range_pow is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (bernoulli i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) p) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))))
+but is expected to have type
+ forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range n) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (bernoulli i) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) p) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))))
+Case conversion may be inaccurate. Consider using '#align sum_range_pow sum_range_powₓ'. -/
/-- **Faulhaber's theorem** relating the **sum of of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
@@ -380,6 +468,12 @@ theorem sum_range_pow (n p : ℕ) :
field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
#align sum_range_pow sum_range_pow
+/- warning: sum_Ico_pow -> sum_Ico_pow is a dubious translation:
+lean 3 declaration is
+ forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.Ico.{0} Nat (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) Nat.locallyFiniteOrder (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.hasDiv) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.hasMul) (bernoulli' i) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) p (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.hasAdd) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Rat (HasLiftT.mk.{1, 1} Nat Rat (CoeTCₓ.coe.{1, 1} Nat Rat (Nat.castCoe.{0} Rat (AddMonoidWithOne.toNatCast.{0} Rat (AddGroupWithOne.toAddMonoidWithOne.{0} Rat (AddCommGroupWithOne.toAddGroupWithOne.{0} Rat (Ring.toAddCommGroupWithOne.{0} Rat (DivisionRing.toRing.{0} Rat Rat.divisionRing)))))))) p) (OfNat.ofNat.{0} Rat 1 (OfNat.mk.{0} Rat 1 (One.one.{0} Rat Rat.hasOne))))))
+but is expected to have type
+ forall (n : Nat) (p : Nat), Eq.{1} Rat (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.Ico.{0} Nat (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) instLocallyFiniteOrderNatToPreorderToPartialOrderStrictOrderedSemiring (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (k : Nat) => HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) k) p)) (Finset.sum.{0, 0} Rat Nat Rat.addCommMonoid (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => HDiv.hDiv.{0, 0, 0} Rat Rat Rat (instHDiv.{0} Rat Rat.instDivRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (HMul.hMul.{0, 0, 0} Rat Rat Rat (instHMul.{0} Rat Rat.instMulRat) (bernoulli' i) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) (Nat.choose (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HPow.hPow.{0, 0, 0} Rat Nat Rat (instHPow.{0, 0} Rat Nat (Monoid.Pow.{0} Rat Rat.monoid)) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) n) (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) p (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) i))) (HAdd.hAdd.{0, 0, 0} Rat Rat Rat (instHAdd.{0} Rat Rat.instAddRat) (Nat.cast.{0} Rat (Semiring.toNatCast.{0} Rat Rat.semiring) p) (OfNat.ofNat.{0} Rat 1 (Rat.instOfNatRat 1)))))
+Case conversion may be inaccurate. Consider using '#align sum_Ico_pow sum_Ico_powₓ'. -/
/-- Alternate form of **Faulhaber's theorem**, relating the sum of p-th powers to the Bernoulli
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/75e7fca56381d056096ce5d05e938f63a6567828
@@ -170,7 +170,7 @@ def bernoulli'PowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli' n / n !)
#align bernoulli'_power_series bernoulli'PowerSeries
-theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = x * exp A :=
+theorem bernoulli'PowerSeries_mul_exp_sub_one : bernoulli'PowerSeries A * (exp A - 1) = X * exp A :=
by
ext n
-- constant coefficient is a special case
@@ -290,7 +290,7 @@ def bernoulliPowerSeries :=
mk fun n => algebraMap ℚ A (bernoulli n / n !)
#align bernoulli_power_series bernoulliPowerSeries
-theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = x :=
+theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X :=
by
ext n
-- constant coefficient is a special case
mathlib commit https://github.com/leanprover-community/mathlib/commit/2196ab363eb097c008d4497125e0dde23fb36db2
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kevin Buzzard
! This file was ported from Lean 3 source module number_theory.bernoulli
-! leanprover-community/mathlib commit c3019c79074b0619edb4b27553a91b2e82242395
+! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -209,9 +209,9 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
· simpa using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
- rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_neg_eq]
+ rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
suffices eval_neg_hom (B * (exp ℚ - 1)) * exp ℚ = eval_neg_hom (X * exp ℚ) * exp ℚ by
- simpa [mul_assoc, sub_mul, mul_comm (eval_neg_hom (exp ℚ)), exp_mul_exp_neg_eq_one, eq_comm]
+ simpa [mul_assoc, sub_mul, mul_comm (eval_neg_hom (exp ℚ)), exp_mul_exp_neg_eq_one]
congr
#align bernoulli'_odd_eq_zero bernoulli'_odd_eq_zero
mathlib commit https://github.com/leanprover-community/mathlib/commit/3180fab693e2cee3bff62675571264cb8778b212
@@ -299,7 +299,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
simp only [bernoulliPowerSeries, coeff_mul, coeff_X, sum_antidiagonal_succ', one_div, coeff_mk,
coeff_one, coeff_exp, LinearMap.map_sub, factorial, if_pos, cast_succ, cast_one, cast_mul,
sub_zero, RingHom.map_one, add_eq_zero_iff, if_false, _root_.inv_one, zero_add, one_ne_zero,
- mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← RingHom.map_sum]
+ MulZeroClass.mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← RingHom.map_sum]
cases n; · simp
rw [if_neg n.succ_succ_ne_one]
have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
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 | |
@@ -240,7 +240,7 @@ theorem sum_bernoulli (n : ℕ) :
· congr
funext x
rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
- · simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel,
+ · simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel_right,
zero_add, choose_one_right, cast_succ, cast_add, cast_one, bernoulli'_one, one_div]
ring
#align sum_bernoulli sum_bernoulli
@@ -389,7 +389,7 @@ theorem sum_Ico_pow (n p : ℕ) :
have hle := Nat.le_add_left 1 n
have hne : (p + 1 + 1 : ℚ) ≠ 0 := by norm_cast; exact succ_ne_zero p.succ
have h1 : ∀ r : ℚ, r * (p + 1 + 1) * (n : ℚ) ^ p.succ / (p + 1 + 1 : ℚ) = r * (n : ℚ) ^ p.succ :=
- fun r => by rw [mul_div_right_comm, mul_div_cancel _ hne]
+ fun r => by rw [mul_div_right_comm, mul_div_cancel_right₀ _ hne]
have h2 : f 1 + (n : ℚ) ^ p.succ = 1 / 2 * (n : ℚ) ^ p.succ := by
simp_rw [f, bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
ring
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -185,7 +185,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h
· apply eq_zero_of_neg_eq
specialize h n
- split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
+ split_ifs at h <;> simp_all [B, h_odd.neg_one_pow, factorial_ne_zero]
· simpa (config := {decide := true}) [Nat.factorial] using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
@@ -320,7 +320,7 @@ theorem sum_range_pow (n p : ℕ) :
simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
apply sum_congr rfl
intros m h
- simp only [exp_pow_eq_rescale_exp, rescale, one_div, coeff_mk, RingHom.coe_mk, coeff_exp,
+ simp only [f, exp_pow_eq_rescale_exp, rescale, one_div, coeff_mk, RingHom.coe_mk, coeff_exp,
RingHom.id_apply, cast_mul, algebraMap_rat_rat]
-- manipulate factorials and binomial coefficients
simp? at h says simp only [mem_range] at h
@@ -391,7 +391,7 @@ theorem sum_Ico_pow (n p : ℕ) :
have h1 : ∀ r : ℚ, r * (p + 1 + 1) * (n : ℚ) ^ p.succ / (p + 1 + 1 : ℚ) = r * (n : ℚ) ^ p.succ :=
fun r => by rw [mul_div_right_comm, mul_div_cancel _ hne]
have h2 : f 1 + (n : ℚ) ^ p.succ = 1 / 2 * (n : ℚ) ^ p.succ := by
- simp_rw [bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
+ simp_rw [f, bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
ring
have :
(∑ i in range p, bernoulli (i + 2) * (p + 2).choose (i + 2) * (n : ℚ) ^ (p - i) / ↑(p + 2)) =
@@ -406,7 +406,7 @@ theorem sum_Ico_pow (n p : ℕ) :
by rw [sum_range_succ]
-- apply the key lemma, `sum_range_pow`
_ = (∑ i in range p.succ.succ, f i) + (n : ℚ) ^ p.succ :=
- by simp [sum_range_pow]
+ by simp [f, sum_range_pow]
-- extract the first two terms of the sum
_ = (∑ i in range p, f i.succ.succ) + f 1 + f 0 + (n : ℚ) ^ p.succ :=
by simp_rw [sum_range_succ']
@@ -414,7 +414,7 @@ theorem sum_Ico_pow (n p : ℕ) :
_ = (∑ i in range p, f i.succ.succ) + 1 / 2 * (n : ℚ) ^ p.succ + f 0 := by rw [h2]
-- convert from `bernoulli` to `bernoulli'`
_ = (∑ i in range p, f' i.succ.succ) + f' 1 + f' 0 :=
- by simpa [h1, fun i => show i + 2 = i + 1 + 1 from rfl]
+ by simpa [f, f', h1, fun i => show i + 2 = i + 1 + 1 from rfl]
-- rejoin the first two terms of the sum
_ = ∑ i in range p.succ.succ, f' i :=
by simp_rw [sum_range_succ']
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -191,7 +191,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
suffices evalNegHom (B * (exp ℚ - 1)) * exp ℚ = evalNegHom (X * exp ℚ) * exp ℚ by
- rw [map_mul, map_mul] at this --Porting note: Why doesn't simp do this?
+ rw [map_mul, map_mul] at this -- Porting note: Why doesn't simp do this?
simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp ℚ)), exp_mul_exp_neg_eq_one]
congr
#align bernoulli'_odd_eq_zero bernoulli'_odd_eq_zero
@@ -235,7 +235,7 @@ theorem sum_bernoulli (n : ℕ) :
ring
have f := sum_bernoulli' n.succ.succ
simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
- -- porting note: was `convert f`
+ -- Porting note: was `convert f`
refine' Eq.trans _ (Eq.trans f _)
· congr
funext x
@@ -293,7 +293,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
rw [mem_antidiagonal] at h
rw [← h, add_choose, cast_div_charZero (factorial_mul_factorial_dvd_factorial_add _ _)]
field_simp [hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc]
- -- porting note: was `cc`, which was not yet ported
+ -- Porting note: was `cc`, which was not yet ported
left
left
ring
@@ -355,7 +355,7 @@ theorem sum_range_pow (n p : ℕ) :
have h_const : C ℚ (constantCoeff ℚ (exp ℚ ^ n)) = 1 := by simp
rw [← h_const, sub_const_eq_X_mul_shift]
-- key step: a chain of equalities of power series
- -- porting note: altered proof slightly
+ -- Porting note: altered proof slightly
rw [← mul_right_inj' hexp, mul_comm]
rw [← exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
bernoulliPowerSeries, mul_right_comm]
This PR split the files devoted to power series (especially RingTheory/PowerSeries/Basic) into several ones:
RingTheory/MvPowerSeries/Basic - initial definitions (multivariate)
RingTheory/MvPowerSeries/Trunc - truncation
RingTheory/MvPowerSeries/Inverse - stuff pertaining to inverses
RingTheory/PowerSeries/Basic - initial definitions (univariate)
RingTheory/PowerSeries/Trunc - truncation
RingTheory/PowerSeries/Inverse - stuff pertaining to inverses
RingTheory/PowerSeries/Order - stuff pertaining to order
it remains to adjust the other files (PowerSeries/Derivative and PowerSeries/WellKnown)
Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr> Co-authored-by: Johan Commelin <johan@commelin.net> Co-authored-by: faenuccio <filippo.nuccio@univ-st-etienne.fr>
@@ -6,6 +6,7 @@ Authors: Johan Commelin, Kevin Buzzard
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.GeomSum
import Mathlib.Data.Fintype.BigOperators
+import Mathlib.RingTheory.PowerSeries.Inverse
import Mathlib.RingTheory.PowerSeries.WellKnown
import Mathlib.Tactic.FieldSimp
@@ -322,7 +322,7 @@ theorem sum_range_pow (n p : ℕ) :
simp only [exp_pow_eq_rescale_exp, rescale, one_div, coeff_mk, RingHom.coe_mk, coeff_exp,
RingHom.id_apply, cast_mul, algebraMap_rat_rat]
-- manipulate factorials and binomial coefficients
- simp at h
+ simp? at h says simp only [mem_range] at h
rw [choose_eq_factorial_div_factorial h.le, eq_comm, div_eq_iff (hne q.succ), succ_eq_add_one,
mul_assoc _ _ (q.succ ! : ℚ), mul_comm _ (q.succ ! : ℚ), ← mul_assoc, div_mul_eq_mul_div]
simp only [add_eq, add_zero, ge_iff_le, IsUnit.mul_iff, Nat.isUnit_iff, succ.injEq, cast_mul,
@@ -65,7 +65,7 @@ variable (A : Type*) [CommRing A] [Algebra ℚ A]
the $n$-th Bernoulli number $B_n$ is defined recursively via
$$B_n = 1 - \sum_{k < n} \binom{n}{k}\frac{B_k}{n+1-k}$$ -/
def bernoulli' : ℕ → ℚ :=
- WellFounded.fix lt_wfRel.wf fun n bernoulli' =>
+ WellFounded.fix Nat.lt_wfRel.wf fun n bernoulli' =>
1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k k.2
#align bernoulli' bernoulli'
@@ -356,7 +356,7 @@ theorem sum_range_pow (n p : ℕ) :
-- key step: a chain of equalities of power series
-- porting note: altered proof slightly
rw [← mul_right_inj' hexp, mul_comm]
- rw [←exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
+ rw [← exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
bernoulliPowerSeries, mul_right_comm]
simp only [mul_comm, mul_eq_mul_left_iff, hexp, or_false]
refine' Eq.trans (mul_eq_mul_right_iff.mpr _) (Eq.trans h_cauchy _)
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>
@@ -284,7 +284,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
cases' n with n
· simp
rw [if_neg n.succ_succ_ne_one]
- have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
+ have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => mod_cast factorial_ne_zero m
have hite2 : ite (n.succ = 0) 1 0 = (0 : ℚ) := if_neg n.succ_ne_zero
simp only [CharP.cast_eq_zero, zero_add, inv_one, map_one, sub_self, mul_zero, add_eq]
rw [← map_zero (algebraMap ℚ A), ← zero_div (n.succ ! : ℚ), ← hite2, ← bernoulli_spec', sum_div]
@@ -307,7 +307,7 @@ the proof provided here. -/
theorem sum_range_pow (n p : ℕ) :
(∑ k in range n, (k : ℚ) ^ p) =
∑ i in range (p + 1), bernoulli i * ((p + 1).choose i) * (n : ℚ) ^ (p + 1 - i) / (p + 1) := by
- have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
+ have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => mod_cast factorial_ne_zero m
-- compute the Cauchy product of two power series
have h_cauchy :
((mk fun p => bernoulli p / p !) * mk fun q => coeff ℚ (q + 1) (exp ℚ ^ n)) =
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -125,7 +125,7 @@ theorem bernoulli'_three : bernoulli' 3 = 0 := by
@[simp]
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 := by
- have : Nat.choose 4 2 = 6 := by norm_num -- shrug
+ have : Nat.choose 4 2 = 6 := by decide -- shrug
rw [bernoulli'_def]
norm_num [sum_range_succ, sum_range_succ, sum_range_zero, this]
#align bernoulli'_four bernoulli'_four
@@ -185,7 +185,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
· apply eq_zero_of_neg_eq
specialize h n
split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
- · simpa [Nat.factorial] using h 1
+ · simpa (config := {decide := true}) [Nat.factorial] using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
@@ -349,16 +349,15 @@ theorem sum_range_pow (n p : ℕ) :
have hexp : exp ℚ - 1 ≠ 0 := by
simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
use 1
- simp
+ simp [factorial_ne_zero]
have h_r : exp ℚ ^ n - 1 = X * mk fun p => coeff ℚ (p + 1) (exp ℚ ^ n) := by
have h_const : C ℚ (constantCoeff ℚ (exp ℚ ^ n)) = 1 := by simp
rw [← h_const, sub_const_eq_X_mul_shift]
-- key step: a chain of equalities of power series
-- porting note: altered proof slightly
rw [← mul_right_inj' hexp, mul_comm]
- simp only [← cast_pow]
rw [←exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
- bernoulliPowerSeries, mul_right_comm]
+ bernoulliPowerSeries, mul_right_comm]
simp only [mul_comm, mul_eq_mul_left_iff, hexp, or_false]
refine' Eq.trans (mul_eq_mul_right_iff.mpr _) (Eq.trans h_cauchy _)
· left
@@ -155,7 +155,7 @@ def bernoulli'PowerSeries :=
#align bernoulli'_power_series bernoulli'PowerSeries
theorem bernoulli'PowerSeries_mul_exp_sub_one :
- bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by
+ bernoulli'PowerSeries A * (exp A - 1) = X * exp A := by
ext n
-- constant coefficient is a special case
cases' n with n
@@ -163,7 +163,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one :
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
suffices (∑ p in antidiagonal n,
bernoulli' p.1 / p.1! * ((p.2 + 1) * p.2! : ℚ)⁻¹) = (n ! : ℚ)⁻¹ by
- simpa [map_sum] using congr_arg (algebraMap ℚ A) this
+ simpa [map_sum, Nat.factorial] using congr_arg (algebraMap ℚ A) this
apply eq_inv_of_mul_eq_one_left
rw [sum_mul]
convert bernoulli'_spec' n using 1
@@ -185,7 +185,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
· apply eq_zero_of_neg_eq
specialize h n
split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
- · simpa using h 1
+ · simpa [Nat.factorial] using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
@@ -368,7 +368,7 @@ theorem sum_range_pow (n p : ℕ) :
-- massage `hps` into our goal
rw [hps, sum_mul]
refine' sum_congr rfl fun x _ => _
- field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !]
+ field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, factorial]
ring
#align sum_range_pow sum_range_pow
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.
@@ -113,23 +113,21 @@ theorem bernoulli'_one : bernoulli' 1 = 1 / 2 := by
@[simp]
theorem bernoulli'_two : bernoulli' 2 = 1 / 6 := by
- rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_zero]
- norm_num
+ rw [bernoulli'_def]
+ norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
#align bernoulli'_two bernoulli'_two
@[simp]
theorem bernoulli'_three : bernoulli' 3 = 0 := by
- rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_succ, sum_range_zero]
- norm_num
+ rw [bernoulli'_def]
+ norm_num [sum_range_succ, sum_range_succ, sum_range_zero]
#align bernoulli'_three bernoulli'_three
@[simp]
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 := by
- have : Nat.choose 4 2 = 6 := by decide
- -- shrug
- rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_succ,
- sum_range_succ, sum_range_zero, this]
- norm_num
+ have : Nat.choose 4 2 = 6 := by norm_num -- shrug
+ rw [bernoulli'_def]
+ norm_num [sum_range_succ, sum_range_succ, sum_range_zero, this]
#align bernoulli'_four bernoulli'_four
end Examples
@@ -211,7 +209,7 @@ theorem bernoulli_zero : bernoulli 0 = 1 := by simp [bernoulli]
#align bernoulli_zero bernoulli_zero
@[simp]
-theorem bernoulli_one : bernoulli 1 = -1 / 2 := by norm_num; simp [bernoulli]
+theorem bernoulli_one : bernoulli 1 = -1 / 2 := by norm_num [bernoulli]
#align bernoulli_one bernoulli_one
theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n := by
The main reasons is that having h : 0 < denom
in the context should suffice for field_simp
to do its job, without the need to manually pass h.ne
or similar.
Quite a few have := … ≠ 0
could be dropped, and some field_simp
calls no longer need explicit arguments; this is promising.
This does break some proofs where field_simp
was not used as a closing tactic, and it now
shuffles terms around a bit different. These were fixed. Using field_simp
in the middle of a proof seems rather fragile anyways.
As a drive-by contribution, positivity
now knows about π > 0
.
fixes: #4835
Co-authored-by: Matthew Ballard <matt@mrb.email>
@@ -175,7 +175,7 @@ theorem bernoulli'PowerSeries_mul_exp_sub_one :
have := factorial_mul_factorial_dvd_factorial_add i j
field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose]
norm_cast
- rw [mul_comm (j + 1), mul_div_assoc, ← mul_assoc]
+ simp [mul_comm (j + 1)]
#align bernoulli'_power_series_mul_exp_sub_one bernoulli'PowerSeries_mul_exp_sub_one
/-- Odd Bernoulli numbers (greater than 1) are zero. -/
@@ -292,12 +292,11 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
rw [← map_zero (algebraMap ℚ A), ← zero_div (n.succ ! : ℚ), ← hite2, ← bernoulli_spec', sum_div]
refine' congr_arg (algebraMap ℚ A) (sum_congr rfl fun x h => eq_div_of_mul_eq (hfact n.succ) _)
rw [mem_antidiagonal] at h
- have hj : (x.2 + 1 : ℚ) ≠ 0 := by norm_cast; exact succ_ne_zero _
rw [← h, add_choose, cast_div_charZero (factorial_mul_factorial_dvd_factorial_add _ _)]
- field_simp [mul_ne_zero hj (hfact x.2), hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc,
- Nat.factorial_ne_zero, hj]
+ field_simp [hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc]
-- porting note: was `cc`, which was not yet ported
left
+ left
ring
#align bernoulli_power_series_mul_exp_sub_one bernoulliPowerSeries_mul_exp_sub_one
@@ -371,7 +370,7 @@ theorem sum_range_pow (n p : ℕ) :
-- massage `hps` into our goal
rw [hps, sum_mul]
refine' sum_congr rfl fun x _ => _
- field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
+ field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !]
ring
#align sum_range_pow sum_range_pow
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).
@@ -282,7 +282,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
simp only [bernoulliPowerSeries, coeff_mul, coeff_X, sum_antidiagonal_succ', one_div, coeff_mk,
coeff_one, coeff_exp, LinearMap.map_sub, factorial, if_pos, cast_succ, cast_one, cast_mul,
sub_zero, RingHom.map_one, add_eq_zero_iff, if_false, _root_.inv_one, zero_add, one_ne_zero,
- MulZeroClass.mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← map_sum]
+ mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← map_sum]
cases' n with n
· simp
rw [if_neg n.succ_succ_ne_one]
@@ -235,7 +235,7 @@ theorem sum_bernoulli (n : ℕ) :
mul_one, choose_zero_right, cast_zero, if_false, zero_add, succ_succ_ne_one]
ring
have f := sum_bernoulli' n.succ.succ
- simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
+ simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
-- porting note: was `convert f`
refine' Eq.trans _ (Eq.trans f _)
· congr
@@ -297,7 +297,6 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
field_simp [mul_ne_zero hj (hfact x.2), hfact x.1, mul_comm _ (bernoulli x.1), mul_assoc,
Nat.factorial_ne_zero, hj]
-- porting note: was `cc`, which was not yet ported
- simp only
left
ring
#align bernoulli_power_series_mul_exp_sub_one bernoulliPowerSeries_mul_exp_sub_one
@@ -323,7 +322,6 @@ theorem sum_range_pow (n p : ℕ) :
simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
apply sum_congr rfl
intros m h
- simp only [Finset.mem_range]
simp only [exp_pow_eq_rescale_exp, rescale, one_div, coeff_mk, RingHom.coe_mk, coeff_exp,
RingHom.id_apply, cast_mul, algebraMap_rat_rat]
-- manipulate factorials and binomial coefficients
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -56,7 +56,7 @@ then defined as `bernoulli := (-1)^n * bernoulli'`.
open Nat BigOperators Finset Finset.Nat PowerSeries
-variable (A : Type _) [CommRing A] [Algebra ℚ A]
+variable (A : Type*) [CommRing A] [Algebra ℚ A]
/-! ### Definitions -/
@@ -304,7 +304,7 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
section Faulhaber
-/-- **Faulhaber's theorem** relating the **sum of of p-th powers** to the Bernoulli numbers:
+/-- **Faulhaber's theorem** relating the **sum of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
the proof provided here. -/
@@ -2,11 +2,6 @@
Copyright (c) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kevin Buzzard
-
-! This file was ported from Lean 3 source module number_theory.bernoulli
-! leanprover-community/mathlib commit 2196ab363eb097c008d4497125e0dde23fb36db2
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.BigOperators.NatAntidiagonal
import Mathlib.Algebra.GeomSum
@@ -14,6 +9,8 @@ import Mathlib.Data.Fintype.BigOperators
import Mathlib.RingTheory.PowerSeries.WellKnown
import Mathlib.Tactic.FieldSimp
+#align_import number_theory.bernoulli from "leanprover-community/mathlib"@"2196ab363eb097c008d4497125e0dde23fb36db2"
+
/-!
# Bernoulli numbers
@@ -240,7 +240,7 @@ theorem sum_bernoulli (n : ℕ) :
have f := sum_bernoulli' n.succ.succ
simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
-- porting note: was `convert f`
- refine' Eq.trans _ (Eq.trans f _)
+ refine' Eq.trans _ (Eq.trans f _)
· congr
funext x
rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
@@ -365,7 +365,7 @@ theorem sum_range_pow (n p : ℕ) :
-- porting note: altered proof slightly
rw [← mul_right_inj' hexp, mul_comm]
simp only [← cast_pow]
- rw [←exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
+ rw [←exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
bernoulliPowerSeries, mul_right_comm]
simp only [mul_comm, mul_eq_mul_left_iff, hexp, or_false]
refine' Eq.trans (mul_eq_mul_right_iff.mpr _) (Eq.trans h_cauchy _)
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
@@ -189,7 +189,7 @@ theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoul
simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h
· apply eq_zero_of_neg_eq
specialize h n
- split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
+ split_ifs at h <;> simp_all [h_odd.neg_one_pow, factorial_ne_zero]
· simpa using h 1
have h : B * (exp ℚ - 1) = X * exp ℚ := by
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
@@ -262,7 +262,7 @@ theorem bernoulli_spec' (n : ℕ) :
-- key equation: the corresponding fact for `bernoulli'`
have H := bernoulli'_spec' n.succ
-- massage it to match the structure of the goal, then convert piece by piece
- rw [sum_eq_add_sum_diff_singleton h₁] at H⊢
+ rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
apply add_eq_of_eq_sub'
convert eq_sub_of_add_eq' H using 1
· refine' sum_congr rfl fun p h => _
@@ -53,13 +53,11 @@ then defined as `bernoulli := (-1)^n * bernoulli'`.
## Main theorems
-`sum_bernoulli : ∑ k in finset.range n, (n.choose k : ℚ) * bernoulli k = 0`
+`sum_bernoulli : ∑ k in Finset.range n, (n.choose k : ℚ) * bernoulli k = if n = 1 then 1 else 0`
-/
-open Nat BigOperators
-
-open Finset Nat Finset.Nat PowerSeries
+open Nat BigOperators Finset Finset.Nat PowerSeries
variable (A : Type _) [CommRing A] [Algebra ℚ A]
@@ -288,7 +286,8 @@ theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A -
coeff_one, coeff_exp, LinearMap.map_sub, factorial, if_pos, cast_succ, cast_one, cast_mul,
sub_zero, RingHom.map_one, add_eq_zero_iff, if_false, _root_.inv_one, zero_add, one_ne_zero,
MulZeroClass.mul_zero, and_false_iff, sub_self, ← RingHom.map_mul, ← map_sum]
- cases' n with n; · simp
+ cases' n with n
+ · simp
rw [if_neg n.succ_succ_ne_one]
have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
have hite2 : ite (n.succ = 0) 1 0 = (0 : ℚ) := if_neg n.succ_ne_zero
@@ -323,7 +322,7 @@ theorem sum_range_pow (n p : ℕ) :
bernoulli i * (p + 1).choose i * (n : ℚ) ^ (p + 1 - i) / (p + 1)! := by
ext q : 1
let f a b := bernoulli a / a ! * coeff ℚ (b + 1) (exp ℚ ^ n)
- -- key step: use `power_series.coeff_mul` and then rewrite sums
+ -- key step: use `PowerSeries.coeff_mul` and then rewrite sums
simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
apply sum_congr rfl
intros m h
The unported dependencies are