[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ bernoulli' n = 1 - ∑ k in range n, ↑(Nat.choose n k) / (↑n - ↑k + 1) * bernoulli' k
[PROOFSTEP]
rw [bernoulli'_def', ← Fin.sum_univ_eq_sum_range]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range (succ n), ↑(Nat.choose n (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1
[PROOFSTEP]
rw [sum_range_succ_comm, bernoulli'_def n, tsub_self, choose_zero_right, sub_self, zero_add, div_one, cast_one, one_mul,
  sub_add, ← sum_sub_distrib, ← sub_eq_zero, sub_sub_cancel_left, neg_eq_zero]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x in range n,
      (↑(Nat.choose n x) / (↑n - ↑x + 1) * bernoulli' x - ↑(Nat.choose n (n - x)) / (↑n - ↑x + 1) * bernoulli' x) =
    0
[PROOFSTEP]
exact Finset.sum_eq_zero (fun x hx => by rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self])
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n x : ℕ
hx : x ∈ range n
⊢ ↑(Nat.choose n x) / (↑n - ↑x + 1) * bernoulli' x - ↑(Nat.choose n (n - x)) / (↑n - ↑x + 1) * bernoulli' x = 0
[PROOFSTEP]
rw [choose_symm (le_of_lt (mem_range.1 hx)), sub_self]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal n, ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli' k.fst = 1
[PROOFSTEP]
refine' ((sum_antidiagonal_eq_sum_range_succ_mk _ n).trans _).trans (bernoulli'_spec n)
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range (succ n),
      ↑(Nat.choose ((k, n - k).fst + (k, n - k).snd) (k, n - k).snd) / (↑(k, n - k).snd + 1) *
        bernoulli' (k, n - k).fst =
    ∑ k in range (succ n), ↑(Nat.choose n (n - k)) / (↑n - ↑k + 1) * bernoulli' k
[PROOFSTEP]
refine' sum_congr rfl fun x hx => _
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n x : ℕ
hx : x ∈ range (succ n)
⊢ ↑(Nat.choose ((x, n - x).fst + (x, n - x).snd) (x, n - x).snd) / (↑(x, n - x).snd + 1) * bernoulli' (x, n - x).fst =
    ↑(Nat.choose n (n - x)) / (↑n - ↑x + 1) * bernoulli' x
[PROOFSTEP]
simp only [add_tsub_cancel_of_le, mem_range_succ_iff.mp hx, cast_sub]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli' 0 = 1
[PROOFSTEP]
rw [bernoulli'_def]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ 1 - ∑ k in range 0, ↑(Nat.choose 0 k) / (↑0 - ↑k + 1) * bernoulli' k = 1
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli' 1 = 1 / 2
[PROOFSTEP]
rw [bernoulli'_def]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ 1 - ∑ k in range 1, ↑(Nat.choose 1 k) / (↑1 - ↑k + 1) * bernoulli' k = 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli' 2 = 1 / 6
[PROOFSTEP]
rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_zero]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ 1 - (0 + ↑(Nat.choose 2 0) / (↑2 - ↑0 + 1) * bernoulli' 0 + ↑(Nat.choose 2 1) / (↑2 - ↑1 + 1) * bernoulli' 1) = 1 / 6
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli' 3 = 0
[PROOFSTEP]
rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_succ, sum_range_zero]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ 1 -
      (0 + ↑(Nat.choose 3 0) / (↑3 - ↑0 + 1) * bernoulli' 0 + ↑(Nat.choose 3 1) / (↑3 - ↑1 + 1) * bernoulli' 1 +
        ↑(Nat.choose 3 2) / (↑3 - ↑2 + 1) * bernoulli' 2) =
    0
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli' 4 = -1 / 30
[PROOFSTEP]
have : Nat.choose 4 2 = 6 := by
  decide
    -- shrug
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ Nat.choose 4 2 = 6
[PROOFSTEP]
decide
  -- shrug
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
this : Nat.choose 4 2 = 6
⊢ bernoulli' 4 = -1 / 30
[PROOFSTEP]
rw [bernoulli'_def, sum_range_succ, sum_range_succ, sum_range_succ, sum_range_succ, sum_range_zero, this]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
this : Nat.choose 4 2 = 6
⊢ 1 -
      (0 + ↑(Nat.choose 4 0) / (↑4 - ↑0 + 1) * bernoulli' 0 + ↑(Nat.choose 4 1) / (↑4 - ↑1 + 1) * bernoulli' 1 +
          ↑6 / (↑4 - ↑2 + 1) * bernoulli' 2 +
        ↑(Nat.choose 4 3) / (↑4 - ↑3 + 1) * bernoulli' 3) =
    -1 / 30
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range n, ↑(Nat.choose n k) * bernoulli' k = ↑n
[PROOFSTEP]
cases' n with n
[GOAL]
case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in range zero, ↑(Nat.choose zero k) * bernoulli' k = ↑zero
[PROOFSTEP]
simp
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range (succ n), ↑(Nat.choose (succ n) k) * bernoulli' k = ↑(succ n)
[PROOFSTEP]
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
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
this :
  (↑n + 1) * ∑ k in range n, ↑(Nat.choose n k) / (↑n - ↑k + 1) * bernoulli' k =
    ∑ x in range n, ↑(Nat.choose (succ n) x) * bernoulli' x
⊢ ∑ k in range (succ n), ↑(Nat.choose (succ n) k) * bernoulli' k = ↑(succ n)
[PROOFSTEP]
rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
this :
  ↑(n + 1) * ∑ x in range n, Rat.divInt (↑(Nat.choose n x)) (Int.subNatNat n x + 1) * bernoulli' x =
    ∑ x in range n, ↑(Nat.choose (succ n) x) * bernoulli' x
⊢ ↑(n + 1) * ∑ x in range n, Rat.divInt (↑(Nat.choose n x)) (Int.subNatNat n x + 1) * bernoulli' x +
      ↑(n + 1) * (1 - ∑ x in range n, Rat.divInt (↑(Nat.choose n x)) (Int.subNatNat n x + 1) * bernoulli' x) =
    ↑(succ n)
[PROOFSTEP]
ring
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (↑n + 1) * ∑ k in range n, ↑(Nat.choose n k) / (↑n - ↑k + 1) * bernoulli' k =
    ∑ x in range n, ↑(Nat.choose (succ n) x) * bernoulli' x
[PROOFSTEP]
simp_rw [mul_sum, ← mul_assoc]
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x in range n, (↑n + 1) * (↑(Nat.choose n x) / (↑n - ↑x + 1)) * bernoulli' x =
    ∑ x in range n, ↑(Nat.choose (succ n) x) * bernoulli' x
[PROOFSTEP]
refine' sum_congr rfl fun k hk => _
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(Nat.choose n k) / (↑n - ↑k + 1)) * bernoulli' k = ↑(Nat.choose (succ n) k) * bernoulli' k
[PROOFSTEP]
congr
[GOAL]
case succ.e_a
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(Nat.choose n k) / (↑n - ↑k + 1)) = ↑(Nat.choose (succ n) k)
[PROOFSTEP]
have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ ↑(n - k) + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ ¬n - k + 1 = 0
[PROOFSTEP]
exact succ_ne_zero _
[GOAL]
case succ.e_a
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
this : ↑(n - k) + 1 ≠ 0
⊢ (↑n + 1) * (↑(Nat.choose n k) / (↑n - ↑k + 1)) = ↑(Nat.choose (succ n) k)
[PROOFSTEP]
field_simp [← cast_sub (mem_range.1 hk).le, mul_comm]
[GOAL]
case succ.e_a
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
this : ↑(n - k) + 1 ≠ 0
⊢ ↑(Nat.choose n k) * (↑n + 1) = ↑(Nat.choose (succ n) k) * (↑(n - k) + 1)
[PROOFSTEP]
rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli'PowerSeries A * (exp A - 1) = X * exp A
[PROOFSTEP]
ext n
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(coeff A n) (bernoulli'PowerSeries A * (exp A - 1)) = ↑(coeff A n) (X * exp A)
[PROOFSTEP]
cases' n with n
[GOAL]
case h.zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ↑(coeff A zero) (bernoulli'PowerSeries A * (exp A - 1)) = ↑(coeff A zero) (X * exp A)
[PROOFSTEP]
simp
[GOAL]
case h.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(coeff A (succ n)) (bernoulli'PowerSeries A * (exp A - 1)) = ↑(coeff A (succ n)) (X * exp A)
[PROOFSTEP]
rw [bernoulli'PowerSeries, coeff_mul, mul_comm X, sum_antidiagonal_succ']
[GOAL]
case h.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(coeff A (n + 1, 0).fst) (PowerSeries.mk fun n => ↑(algebraMap ℚ A) (bernoulli' n / ↑n !)) *
        ↑(coeff A (n + 1, 0).snd) (exp A - 1) +
      ∑ p in antidiagonal n,
        ↑(coeff A (p.fst, p.snd + 1).fst) (PowerSeries.mk fun n => ↑(algebraMap ℚ A) (bernoulli' n / ↑n !)) *
          ↑(coeff A (p.fst, p.snd + 1).snd) (exp A - 1) =
    ↑(coeff A (succ n)) (exp A * X)
[PROOFSTEP]
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
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
this : ∑ p in antidiagonal n, bernoulli' p.fst / ↑p.fst ! * ((↑p.snd + 1) * ↑p.snd !)⁻¹ = (↑n !)⁻¹
⊢ ↑(coeff A (n + 1, 0).fst) (PowerSeries.mk fun n => ↑(algebraMap ℚ A) (bernoulli' n / ↑n !)) *
        ↑(coeff A (n + 1, 0).snd) (exp A - 1) +
      ∑ p in antidiagonal n,
        ↑(coeff A (p.fst, p.snd + 1).fst) (PowerSeries.mk fun n => ↑(algebraMap ℚ A) (bernoulli' n / ↑n !)) *
          ↑(coeff A (p.fst, p.snd + 1).snd) (exp A - 1) =
    ↑(coeff A (succ n)) (exp A * X)
[PROOFSTEP]
simpa [map_sum] using congr_arg (algebraMap ℚ A) this
[GOAL]
case h.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ p in antidiagonal n, bernoulli' p.fst / ↑p.fst ! * ((↑p.snd + 1) * ↑p.snd !)⁻¹ = (↑n !)⁻¹
[PROOFSTEP]
apply eq_inv_of_mul_eq_one_left
[GOAL]
case h.succ.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (∑ p in antidiagonal n, bernoulli' p.fst / ↑p.fst ! * ((↑p.snd + 1) * ↑p.snd !)⁻¹) * ↑n ! = 1
[PROOFSTEP]
rw [sum_mul]
[GOAL]
case h.succ.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x in antidiagonal n, bernoulli' x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑x.snd !)⁻¹ * ↑n ! = 1
[PROOFSTEP]
convert bernoulli'_spec' n using 1
[GOAL]
case h.e'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x in antidiagonal n, bernoulli' x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑x.snd !)⁻¹ * ↑n ! =
    ∑ k in antidiagonal n, ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli' k.fst
[PROOFSTEP]
apply sum_congr rfl
[GOAL]
case h.e'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∀ (x : ℕ × ℕ),
    x ∈ antidiagonal n →
      bernoulli' x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑x.snd !)⁻¹ * ↑n ! =
        ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst
[PROOFSTEP]
simp_rw [mem_antidiagonal]
[GOAL]
case h.e'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∀ (x : ℕ × ℕ),
    x.fst + x.snd = n →
      bernoulli' x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑x.snd !)⁻¹ * ↑n ! =
        ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst
[PROOFSTEP]
rintro ⟨i, j⟩ rfl
[GOAL]
case h.e'_2.mk
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
i j : ℕ
⊢ bernoulli' (i, j).fst / ↑(i, j).fst ! * ((↑(i, j).snd + 1) * ↑(i, j).snd !)⁻¹ * ↑((i, j).fst + (i, j).snd)! =
    ↑(Nat.choose ((i, j).fst + (i, j).snd) (i, j).snd) / (↑(i, j).snd + 1) * bernoulli' (i, j).fst
[PROOFSTEP]
have := factorial_mul_factorial_dvd_factorial_add i j
[GOAL]
case h.e'_2.mk
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
i j : ℕ
this : i ! * j ! ∣ (i + j)!
⊢ bernoulli' (i, j).fst / ↑(i, j).fst ! * ((↑(i, j).snd + 1) * ↑(i, j).snd !)⁻¹ * ↑((i, j).fst + (i, j).snd)! =
    ↑(Nat.choose ((i, j).fst + (i, j).snd) (i, j).snd) / (↑(i, j).snd + 1) * bernoulli' (i, j).fst
[PROOFSTEP]
field_simp [mul_comm _ (bernoulli' i), mul_assoc, add_choose]
[GOAL]
case h.e'_2.mk
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
i j : ℕ
this : i ! * j ! ∣ (i + j)!
⊢ bernoulli' i * ↑(i + j)! / (↑i ! * ((↑j + 1) * ↑j !)) = bernoulli' i * ↑(i + j)! / (↑i ! * (↑j ! * (↑j + 1)))
[PROOFSTEP]
norm_cast
[GOAL]
case h.e'_2.mk
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
i j : ℕ
this : i ! * j ! ∣ (i + j)!
⊢ bernoulli' i * ↑(i + j)! / ↑(i ! * ((j + 1) * j !)) = bernoulli' i * ↑(i + j)! / ↑(i ! * (j ! * (j + 1)))
[PROOFSTEP]
rw [mul_comm (j + 1), mul_div_assoc, ← mul_assoc]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
⊢ bernoulli' n = 0
[PROOFSTEP]
let B := mk fun n => bernoulli' n / (n ! : ℚ)
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
⊢ bernoulli' n = 0
[PROOFSTEP]
suffices (B - evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
  by
  cases' mul_eq_mul_right_iff.mp this with h h <;> 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]
  · simpa using h 1
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
⊢ bernoulli' n = 0
[PROOFSTEP]
cases' mul_eq_mul_right_iff.mp this with h h
[GOAL]
case inl
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h : B - ↑evalNegHom B = X
⊢ bernoulli' n = 0
[PROOFSTEP]
simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h
[GOAL]
case inr
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h : exp ℚ - 1 = 0
⊢ bernoulli' n = 0
[PROOFSTEP]
simp only [PowerSeries.ext_iff, evalNegHom, coeff_X] at h
[GOAL]
case inl
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h :
  ∀ (n : ℕ),
    ↑(coeff ℚ n)
        ((PowerSeries.mk fun n => bernoulli' n / ↑n !) -
          ↑(rescale (-1)) (PowerSeries.mk fun n => bernoulli' n / ↑n !)) =
      if n = 1 then 1 else 0
⊢ bernoulli' n = 0
[PROOFSTEP]
apply eq_zero_of_neg_eq
[GOAL]
case inl.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h :
  ∀ (n : ℕ),
    ↑(coeff ℚ n)
        ((PowerSeries.mk fun n => bernoulli' n / ↑n !) -
          ↑(rescale (-1)) (PowerSeries.mk fun n => bernoulli' n / ↑n !)) =
      if n = 1 then 1 else 0
⊢ -bernoulli' n = bernoulli' n
[PROOFSTEP]
specialize h n
[GOAL]
case inl.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h :
  ↑(coeff ℚ n)
      ((PowerSeries.mk fun n => bernoulli' n / ↑n !) - ↑(rescale (-1)) (PowerSeries.mk fun n => bernoulli' n / ↑n !)) =
    if n = 1 then 1 else 0
⊢ -bernoulli' n = bernoulli' n
[PROOFSTEP]
split_ifs at h
[GOAL]
case pos
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h✝ : n = 1
h :
  ↑(coeff ℚ n)
      ((PowerSeries.mk fun n => bernoulli' n / ↑n !) - ↑(rescale (-1)) (PowerSeries.mk fun n => bernoulli' n / ↑n !)) =
    1
⊢ -bernoulli' n = bernoulli' n
[PROOFSTEP]
simp_all [h_odd.neg_one_pow, factorial_ne_zero]
[GOAL]
case neg
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h✝ : ¬n = 1
h :
  ↑(coeff ℚ n)
      ((PowerSeries.mk fun n => bernoulli' n / ↑n !) - ↑(rescale (-1)) (PowerSeries.mk fun n => bernoulli' n / ↑n !)) =
    0
⊢ -bernoulli' n = bernoulli' n
[PROOFSTEP]
simp_all [h_odd.neg_one_pow, factorial_ne_zero]
[GOAL]
case inr
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
this : (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
h : ∀ (n : ℕ), ↑(coeff ℚ n) (exp ℚ - 1) = ↑(coeff ℚ n) 0
⊢ bernoulli' n = 0
[PROOFSTEP]
simpa using h 1
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
⊢ (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
[PROOFSTEP]
have h : B * (exp ℚ - 1) = X * exp ℚ := by simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
⊢ B * (exp ℚ - 1) = X * exp ℚ
[PROOFSTEP]
simpa [bernoulli'PowerSeries] using bernoulli'PowerSeries_mul_exp_sub_one ℚ
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
h : B * (exp ℚ - 1) = X * exp ℚ
⊢ (B - ↑evalNegHom B) * (exp ℚ - 1) = X * (exp ℚ - 1)
[PROOFSTEP]
rw [sub_mul, h, mul_sub X, sub_right_inj, ← neg_sub, mul_neg, neg_eq_iff_eq_neg]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
h : B * (exp ℚ - 1) = X * exp ℚ
⊢ ↑evalNegHom B * (1 - exp ℚ) = -(X * 1)
[PROOFSTEP]
suffices evalNegHom (B * (exp ℚ - 1)) * exp ℚ = evalNegHom (X * exp ℚ) * exp ℚ
  by
  rw [map_mul, map_mul] at this
  simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp ℚ)), exp_mul_exp_neg_eq_one]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
h : B * (exp ℚ - 1) = X * exp ℚ
this : ↑evalNegHom (B * (exp ℚ - 1)) * exp ℚ = ↑evalNegHom (X * exp ℚ) * exp ℚ
⊢ ↑evalNegHom B * (1 - exp ℚ) = -(X * 1)
[PROOFSTEP]
rw [map_mul, map_mul] at this
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
h : B * (exp ℚ - 1) = X * exp ℚ
this : ↑evalNegHom B * ↑evalNegHom (exp ℚ - 1) * exp ℚ = ↑evalNegHom X * ↑evalNegHom (exp ℚ) * exp ℚ
⊢ ↑evalNegHom B * (1 - exp ℚ) = -(X * 1)
[PROOFSTEP]
simpa [mul_assoc, sub_mul, mul_comm (evalNegHom (exp ℚ)), exp_mul_exp_neg_eq_one]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h_odd : Odd n
hlt : 1 < n
B : PowerSeries ℚ := PowerSeries.mk fun n => bernoulli' n / ↑n !
h : B * (exp ℚ - 1) = X * exp ℚ
⊢ ↑evalNegHom (B * (exp ℚ - 1)) * exp ℚ = ↑evalNegHom (X * exp ℚ) * exp ℚ
[PROOFSTEP]
congr
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ bernoulli' n = (-1) ^ n * bernoulli n
[PROOFSTEP]
simp [bernoulli, ← mul_assoc, ← sq, ← pow_mul, mul_comm n 2, pow_mul]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli 0 = 1
[PROOFSTEP]
simp [bernoulli]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli 1 = -1 / 2
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulli 1 = -(1 / 2)
[PROOFSTEP]
simp [bernoulli]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
⊢ bernoulli n = bernoulli' n
[PROOFSTEP]
by_cases h0 : n = 0
[GOAL]
case pos
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
h0 : n = 0
⊢ bernoulli n = bernoulli' n
[PROOFSTEP]
simp [h0]
[GOAL]
case neg
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
h0 : ¬n = 0
⊢ bernoulli n = bernoulli' n
[PROOFSTEP]
rw [bernoulli, neg_one_pow_eq_pow_mod_two]
[GOAL]
case neg
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
h0 : ¬n = 0
⊢ (-1) ^ (n % 2) * bernoulli' n = bernoulli' n
[PROOFSTEP]
cases' mod_two_eq_zero_or_one n with h h
[GOAL]
case neg.inl
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
h0 : ¬n = 0
h : n % 2 = 0
⊢ (-1) ^ (n % 2) * bernoulli' n = bernoulli' n
[PROOFSTEP]
simp [h]
[GOAL]
case neg.inr
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hn : n ≠ 1
h0 : ¬n = 0
h : n % 2 = 1
⊢ (-1) ^ (n % 2) * bernoulli' n = bernoulli' n
[PROOFSTEP]
simp [bernoulli'_odd_eq_zero (odd_iff.mpr h) (one_lt_iff_ne_zero_and_ne_one.mpr ⟨h0, hn⟩)]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range n, ↑(Nat.choose n k) * bernoulli k = if n = 1 then 1 else 0
[PROOFSTEP]
cases' n with n n
[GOAL]
case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in range zero, ↑(Nat.choose zero k) * bernoulli k = if zero = 1 then 1 else 0
[PROOFSTEP]
simp
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range (succ n), ↑(Nat.choose (succ n) k) * bernoulli k = if succ n = 1 then 1 else 0
[PROOFSTEP]
cases' n with n n
[GOAL]
case succ.zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in range (succ zero), ↑(Nat.choose (succ zero) k) * bernoulli k = if succ zero = 1 then 1 else 0
[PROOFSTEP]
rw [sum_range_one]
[GOAL]
case succ.zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ↑(Nat.choose (succ zero) 0) * bernoulli 0 = if succ zero = 1 then 1 else 0
[PROOFSTEP]
simp
[GOAL]
case succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range (succ (succ n)), ↑(Nat.choose (succ (succ n)) k) * bernoulli k = if succ (succ n) = 1 then 1 else 0
[PROOFSTEP]
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]
  ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
this : ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2
⊢ ∑ k in range (succ (succ n)), ↑(Nat.choose (succ (succ n)) k) * bernoulli k = if succ (succ n) = 1 then 1 else 0
[PROOFSTEP]
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]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
this : ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2
⊢ ↑n / 2 + (↑n + 1 + 1) * (-1 / 2) + 1 = 0
[PROOFSTEP]
ring
[GOAL]
case succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2
[PROOFSTEP]
have f := sum_bernoulli' n.succ.succ
[GOAL]
case succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f : ∑ k in range (succ (succ n)), ↑(Nat.choose (succ (succ n)) k) * bernoulli' k = ↑(succ (succ n))
⊢ ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2
[PROOFSTEP]
simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
[GOAL]
case succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
⊢ ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2
[PROOFSTEP]
refine' Eq.trans _ (Eq.trans f _)
[GOAL]
case succ.succ.refine'_1
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
⊢ ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) =
    ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1)
[PROOFSTEP]
congr
[GOAL]
case succ.succ.refine'_1.e_f
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
⊢ (fun i => ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2)) = fun k =>
    ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1)
[PROOFSTEP]
funext x
[GOAL]
case succ.succ.refine'_1.e_f.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
x : ℕ
⊢ ↑(Nat.choose (n + 2) (x + 2)) * bernoulli (x + 2) = ↑(Nat.choose (succ (succ n)) (x + 1 + 1)) * bernoulli' (x + 1 + 1)
[PROOFSTEP]
rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
[GOAL]
case succ.succ.refine'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
⊢ ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1) =
    ↑n / 2
[PROOFSTEP]
simp only [one_div, mul_one, bernoulli'_zero, cast_one, choose_zero_right, add_sub_cancel, zero_add, choose_one_right,
  cast_succ, cast_add, cast_one, bernoulli'_one, one_div]
[GOAL]
case succ.succ.refine'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
f :
  ∑ k in range n, ↑(Nat.choose (succ (succ n)) (k + 1 + 1)) * bernoulli' (k + 1 + 1) =
    ↑n + 1 + 1 - ↑(Nat.choose (succ (succ n)) 0) * bernoulli' 0 -
      ↑(Nat.choose (succ (succ n)) (0 + 1)) * bernoulli' (0 + 1)
⊢ ↑n + 1 + 1 - (↑0 + 1) - (↑n + 1 + 1) * 2⁻¹ = ↑n / 2
[PROOFSTEP]
ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal n, ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = if n = 0 then 1 else 0
[PROOFSTEP]
cases' n with n n
[GOAL]
case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in antidiagonal zero, ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst =
    if zero = 0 then 1 else 0
[PROOFSTEP]
simp
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst =
    if succ n = 0 then 1 else 0
[PROOFSTEP]
rw [if_neg (succ_ne_zero _)]
  -- algebra facts
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = 0
[PROOFSTEP]
have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (1, n) ∈ antidiagonal (succ n)
[PROOFSTEP]
simp [mem_antidiagonal, add_comm]
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = 0
[PROOFSTEP]
have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
⊢ ↑n + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
⊢ ¬n + 1 = 0
[PROOFSTEP]
exact succ_ne_zero _
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = 0
[PROOFSTEP]
have h₃ : (1 + n).choose n = n + 1 := by
  simp [add_comm]
    -- key equation: the corresponding fact for `bernoulli'`
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
⊢ Nat.choose (1 + n) n = n + 1
[PROOFSTEP]
simp [add_comm]
  -- key equation: the corresponding fact for `bernoulli'`
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = 0
[PROOFSTEP]
have H := bernoulli'_spec' n.succ
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H : ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli' k.fst = 1
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.fst + k.snd) k.snd) / (↑k.snd + 1) * bernoulli k.fst = 0
[PROOFSTEP]
rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
⊢ ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst =
    0
[PROOFSTEP]
apply add_eq_of_eq_sub'
[GOAL]
case succ.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
⊢ ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst =
    0 - ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli (1, n).fst
[PROOFSTEP]
convert eq_sub_of_add_eq' H using 1
[GOAL]
case h.e'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
⊢ ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst =
    ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst
[PROOFSTEP]
refine' sum_congr rfl fun p h => _
[GOAL]
case h.e'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal (succ n) \ {(1, n)}
⊢ ↑(Nat.choose (p.fst + p.snd) p.snd) / (↑p.snd + 1) * bernoulli p.fst =
    ↑(Nat.choose (p.fst + p.snd) p.snd) / (↑p.snd + 1) * bernoulli' p.fst
[PROOFSTEP]
obtain ⟨h', h''⟩ : p ∈ _ ∧ p ≠ _ := by rwa [mem_sdiff, mem_singleton] at h
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal (succ n) \ {(1, n)}
⊢ p ∈ ?m.773103 ∧ p ≠ ?m.773150
[PROOFSTEP]
rwa [mem_sdiff, mem_singleton] at h
[GOAL]
case h.e'_2.intro
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal (succ n) \ {(1, n)}
h' : p ∈ antidiagonal (succ n)
h'' : p ≠ (1, n)
⊢ ↑(Nat.choose (p.fst + p.snd) p.snd) / (↑p.snd + 1) * bernoulli p.fst =
    ↑(Nat.choose (p.fst + p.snd) p.snd) / (↑p.snd + 1) * bernoulli' p.fst
[PROOFSTEP]
simp [bernoulli_eq_bernoulli'_of_ne_one ((not_congr (antidiagonal_congr h' h₁)).mp h'')]
[GOAL]
case h.e'_3
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
⊢ 0 - ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli (1, n).fst =
    1 - ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst
[PROOFSTEP]
field_simp [h₃]
[GOAL]
case h.e'_3
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
h₂ : ↑n + 1 ≠ 0
h₃ : Nat.choose (1 + n) n = n + 1
H :
  ↑(Nat.choose ((1, n).fst + (1, n).snd) (1, n).snd) / (↑(1, n).snd + 1) * bernoulli' (1, n).fst +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli' x.fst =
    1
⊢ 1 = 2 - 1
[PROOFSTEP]
norm_num
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ bernoulliPowerSeries A * (exp A - 1) = X
[PROOFSTEP]
ext n
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(coeff A n) (bernoulliPowerSeries A * (exp A - 1)) = ↑(coeff A n) X
[PROOFSTEP]
cases' n with n n
[GOAL]
case h.zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ↑(coeff A zero) (bernoulliPowerSeries A * (exp A - 1)) = ↑(coeff A zero) X
[PROOFSTEP]
simp
[GOAL]
case h.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(coeff A (succ n)) (bernoulliPowerSeries A * (exp A - 1)) = ↑(coeff A (succ n)) X
[PROOFSTEP]
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, ← map_sum]
[GOAL]
case h.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(algebraMap ℚ A) (bernoulli (n + 1) / ((↑n + 1) * ↑(Nat.add n 0)!)) * (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A) (∑ x in antidiagonal n, bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    if succ n = 1 then 1 else 0
[PROOFSTEP]
cases' n with n
[GOAL]
case h.succ.zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ↑(algebraMap ℚ A) (bernoulli (zero + 1) / ((↑zero + 1) * ↑(Nat.add zero 0)!)) * (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A)
        (∑ x in antidiagonal zero, bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    if succ zero = 1 then 1 else 0
[PROOFSTEP]
simp
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(algebraMap ℚ A) (bernoulli (succ n + 1) / ((↑(succ n) + 1) * ↑(Nat.add (succ n) 0)!)) *
        (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A)
        (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    if succ (succ n) = 1 then 1 else 0
[PROOFSTEP]
rw [if_neg n.succ_succ_ne_one]
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ↑(algebraMap ℚ A) (bernoulli (succ n + 1) / ((↑(succ n) + 1) * ↑(Nat.add (succ n) 0)!)) *
        (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A)
        (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    0
[PROOFSTEP]
have hfact : ∀ m, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n m : ℕ
⊢ ↑m ! ≠ 0
[PROOFSTEP]
exact_mod_cast factorial_ne_zero m
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
⊢ ↑(algebraMap ℚ A) (bernoulli (succ n + 1) / ((↑(succ n) + 1) * ↑(Nat.add (succ n) 0)!)) *
        (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A)
        (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    0
[PROOFSTEP]
have hite2 : ite (n.succ = 0) 1 0 = (0 : ℚ) := if_neg n.succ_ne_zero
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
⊢ ↑(algebraMap ℚ A) (bernoulli (succ n + 1) / ((↑(succ n) + 1) * ↑(Nat.add (succ n) 0)!)) *
        (↑(algebraMap ℚ A) (↑0 + 1)⁻¹ - 1) +
      ↑(algebraMap ℚ A)
        (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(Nat.add x.snd 0)!)⁻¹) =
    0
[PROOFSTEP]
simp only [CharP.cast_eq_zero, zero_add, inv_one, map_one, sub_self, mul_zero, add_eq]
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
⊢ ↑(algebraMap ℚ A) (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹) = 0
[PROOFSTEP]
rw [← map_zero (algebraMap ℚ A), ← zero_div (n.succ ! : ℚ), ← hite2, ← bernoulli_spec', sum_div]
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
⊢ ↑(algebraMap ℚ A) (∑ x in antidiagonal (succ n), bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹) =
    ↑(algebraMap ℚ A)
      (∑ x in antidiagonal (succ n), ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst / ↑(succ n)!)
[PROOFSTEP]
refine' congr_arg (algebraMap ℚ A) (sum_congr rfl fun x h => eq_div_of_mul_eq (hfact n.succ) _)
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x ∈ antidiagonal (succ n)
⊢ bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹ * ↑(succ n)! =
    ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst
[PROOFSTEP]
rw [mem_antidiagonal] at h
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
⊢ bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹ * ↑(succ n)! =
    ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst
[PROOFSTEP]
have hj : (x.2 + 1 : ℚ) ≠ 0 := by norm_cast; exact succ_ne_zero _
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
⊢ ↑x.snd + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
⊢ ¬x.snd + 1 = 0
[PROOFSTEP]
exact succ_ne_zero _
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
hj : ↑x.snd + 1 ≠ 0
⊢ bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹ * ↑(succ n)! =
    ↑(Nat.choose (x.fst + x.snd) x.snd) / (↑x.snd + 1) * bernoulli x.fst
[PROOFSTEP]
rw [← h, add_choose, cast_div_charZero (factorial_mul_factorial_dvd_factorial_add _ _)]
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
hj : ↑x.snd + 1 ≠ 0
⊢ bernoulli x.fst / ↑x.fst ! * ((↑x.snd + 1) * ↑(x.snd + 0)!)⁻¹ * ↑(x.fst + x.snd)! =
    ↑(x.fst + x.snd)! / ↑(x.fst ! * x.snd !) / (↑x.snd + 1) * bernoulli x.fst
[PROOFSTEP]
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
[GOAL]
case h.succ.succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
hj : ↑x.snd + 1 ≠ 0
⊢ ↑x.snd ! * (↑x.snd + 1) = (↑x.snd + 1) * ↑x.snd ! ∨ bernoulli x.fst = 0
[PROOFSTEP]
left
[GOAL]
case h.succ.succ.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
hfact : ∀ (m : ℕ), ↑m ! ≠ 0
hite2 : (if succ n = 0 then 1 else 0) = 0
x : ℕ × ℕ
h : x.fst + x.snd = succ n
hj : ↑x.snd + 1 ≠ 0
⊢ ↑x.snd ! * (↑x.snd + 1) = (↑x.snd + 1) * ↑x.snd !
[PROOFSTEP]
ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p m : ℕ
⊢ ↑m ! ≠ 0
[PROOFSTEP]
exact_mod_cast factorial_ne_zero m
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
have h_cauchy :
  ((mk fun p => bernoulli p / p !) * mk fun q => coeff ℚ (q + 1) (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)
          -- 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
  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
  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, cast_succ,
    MonoidHom.coe_mk, OneHom.coe_mk, coeff_exp, Algebra.id.map_eq_id, one_div, map_inv₀, map_natCast, coeff_mk,
    mul_inv_rev]
  rw [mul_comm ((n : ℚ) ^ (q - m + 1)), ← mul_assoc _ _ ((n : ℚ) ^ (q - m + 1)), ← one_div, mul_one_div, div_div,
    tsub_add_eq_add_tsub (le_of_lt_succ h), cast_div, cast_mul]
  · ring
  · exact factorial_mul_factorial_dvd_factorial h.le
  ·
    simp [hne, factorial_ne_zero]
      -- same as our goal except we pull out `p!` for convenience
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
⊢ ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
ext q : 1
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
⊢ ↑(coeff ℚ q) ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    ↑(coeff ℚ q)
      (PowerSeries.mk fun p =>
        ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)
[PROOFSTEP]
let f a b :=
  bernoulli a / a ! *
    coeff ℚ (b + 1)
      (exp ℚ ^ n)
        -- key step: use `PowerSeries.coeff_mul` and then rewrite sums
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ↑(coeff ℚ q) ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    ↑(coeff ℚ q)
      (PowerSeries.mk fun p =>
        ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)
[PROOFSTEP]
simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ∑ x in range (succ q), bernoulli x / ↑x ! * ↑(coeff ℚ (q - x + 1)) (exp ℚ ^ n) =
    ∑ i in range (q + 1), bernoulli i * ↑(Nat.choose (q + 1) i) * ↑n ^ (q + 1 - i) / ↑(q + 1)!
[PROOFSTEP]
apply sum_congr rfl
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ∀ (x : ℕ),
    x ∈ range (succ q) →
      bernoulli x / ↑x ! * ↑(coeff ℚ (q - x + 1)) (exp ℚ ^ n) =
        bernoulli x * ↑(Nat.choose (q + 1) x) * ↑n ^ (q + 1 - x) / ↑(q + 1)!
[PROOFSTEP]
intros m h
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m ∈ range (succ q)
⊢ bernoulli m / ↑m ! * ↑(coeff ℚ (q - m + 1)) (exp ℚ ^ n) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!
[PROOFSTEP]
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
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m ∈ range (succ q)
⊢ bernoulli m / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ)) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!
[PROOFSTEP]
simp at h
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ)) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!
[PROOFSTEP]
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]
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * ↑((q + 1)! / (m ! * (q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ))
[PROOFSTEP]
simp only [add_eq, add_zero, ge_iff_le, IsUnit.mul_iff, Nat.isUnit_iff, succ.injEq, cast_mul, cast_succ,
  MonoidHom.coe_mk, OneHom.coe_mk, coeff_exp, Algebra.id.map_eq_id, one_div, map_inv₀, map_natCast, coeff_mk,
  mul_inv_rev]
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * ↑((q + 1)! / (m ! * (q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / ↑m ! * (↑n ^ (q - m + 1) * (↑(q - m + 1)!)⁻¹)
[PROOFSTEP]
rw [mul_comm ((n : ℚ) ^ (q - m + 1)), ← mul_assoc _ _ ((n : ℚ) ^ (q - m + 1)), ← one_div, mul_one_div, div_div,
  tsub_add_eq_add_tsub (le_of_lt_succ h), cast_div, cast_mul]
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * (↑(q + 1)! / (↑m ! * ↑(q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / (↑m ! * ↑(q + 1 - m)!) * ↑n ^ (q + 1 - m)
[PROOFSTEP]
ring
[GOAL]
case h.n_dvd
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ m ! * (q + 1 - m)! ∣ (q + 1)!
[PROOFSTEP]
exact factorial_mul_factorial_dvd_factorial h.le
[GOAL]
case h.n_nonzero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ ↑(m ! * (q + 1 - m)!) ≠ 0
[PROOFSTEP]
simp [hne, factorial_ne_zero]
  -- same as our goal except we pull out `p!` for convenience
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
have hps :
  (∑ 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
    (mk fun p => ∑ k in range n, (k : ℚ) ^ p * algebraMap ℚ ℚ p !⁻¹) =
      mk fun 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
    simpa using this p
  have hexp : exp ℚ - 1 ≠ 0 := by
    simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
    use 1
    simp
  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]
  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
    congr
  ·
    simp only [mul_comm, factorial, cast_succ, cast_pow]
      -- massage `hps` into our goal
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
[PROOFSTEP]
suffices
  (mk fun p => ∑ k in range n, (k : ℚ) ^ p * algebraMap ℚ ℚ p !⁻¹) =
    mk fun 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
  simpa using this p
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
[PROOFSTEP]
rw [← div_eq_iff (hne p), div_eq_mul_inv, sum_mul]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ x in range n, ↑x ^ p * (↑p !)⁻¹ =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
rw [PowerSeries.ext_iff] at this
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this✝ :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  ∀ (n_1 : ℕ),
    ↑(coeff ℚ n_1) (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
      ↑(coeff ℚ n_1)
        (PowerSeries.mk fun p =>
          ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)
⊢ ∑ x in range n, ↑x ^ p * (↑p !)⁻¹ =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
simpa using this p
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
have hexp : exp ℚ - 1 ≠ 0 := by
  simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
  use 1
  simp
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ exp ℚ - 1 ≠ 0
[PROOFSTEP]
simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∃ x, ¬↑(coeff ℚ x) ((PowerSeries.mk fun n => ↑(algebraMap ℚ ℚ) (1 / ↑n !)) - 1) = ↑(coeff ℚ x) 0
[PROOFSTEP]
use 1
[GOAL]
case h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ¬↑(coeff ℚ 1) ((PowerSeries.mk fun n => ↑(algebraMap ℚ ℚ) (1 / ↑n !)) - 1) = ↑(coeff ℚ 1) 0
[PROOFSTEP]
simp
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
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
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
[PROOFSTEP]
have h_const : C ℚ (constantCoeff ℚ (exp ℚ ^ n)) = 1 := by simp
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ ↑(C ℚ) (↑(constantCoeff ℚ) (exp ℚ ^ n)) = 1
[PROOFSTEP]
simp
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_const : ↑(C ℚ) (↑(constantCoeff ℚ) (exp ℚ ^ n)) = 1
⊢ exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
[PROOFSTEP]
rw [← h_const, sub_const_eq_X_mul_shift]
  -- key step: a chain of equalities of power series
      -- porting note: altered proof slightly
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
rw [← mul_right_inj' hexp, mul_comm]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) * (exp ℚ - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
[PROOFSTEP]
simp only [← cast_pow]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ x in range n, ↑(x ^ p) * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) * (exp ℚ - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p =>
        ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑(n ^ (p + 1 - x)) / ↑(p + 1)!
[PROOFSTEP]
rw [← exp_pow_sum, geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one, bernoulliPowerSeries, mul_right_comm]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ((fun x => ℚ) (exp ℚ ^ n))) (bernoulli n_1 / ↑n_1 !)) *
        PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) *
      (exp ((fun x => ℚ) (exp ℚ ^ n)) - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p =>
        ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑(n ^ (p + 1 - x)) / ↑(p + 1)!
[PROOFSTEP]
simp only [mul_comm, mul_eq_mul_left_iff, hexp, or_false]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) *
      PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p =>
      ∑ x in range (p + 1), ↑(n ^ (p + 1 - x)) * (bernoulli x * ↑(Nat.choose (p + 1) x)) / ↑(p + 1)!
[PROOFSTEP]
refine' Eq.trans (mul_eq_mul_right_iff.mpr _) (Eq.trans h_cauchy _)
[GOAL]
case refine'_1
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) =
      PowerSeries.mk fun p => bernoulli p / ↑p !) ∨
    (PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) = 0
[PROOFSTEP]
left
[GOAL]
case refine'_1.h
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) = PowerSeries.mk fun p => bernoulli p / ↑p !
[PROOFSTEP]
congr
[GOAL]
case refine'_2
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) =
    PowerSeries.mk fun p =>
      ∑ x in range (p + 1), ↑(n ^ (p + 1 - x)) * (bernoulli x * ↑(Nat.choose (p + 1) x)) / ↑(p + 1)!
[PROOFSTEP]
simp only [mul_comm, factorial, cast_succ, cast_pow]
  -- massage `hps` into our goal
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
rw [hps, sum_mul]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
⊢ ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / ↑(p + 1)! * ↑p ! =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
refine' sum_congr rfl fun x _ => _
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
x : ℕ
x✝ : x ∈ range (p + 1)
⊢ bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / ↑(p + 1)! * ↑p ! =
    bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / (↑p + 1)
[PROOFSTEP]
field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
x : ℕ
x✝ : x ∈ range (p + 1)
⊢ bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) * ↑p ! * (↑p + 1) =
    bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) * ((↑p + 1) * ↑p !)
[PROOFSTEP]
ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ p =
    ∑ i in range (p + 1), bernoulli' i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)
[PROOFSTEP]
rw [← Nat.cast_succ]
  -- dispose of the trivial case
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ p =
    ∑ i in range (p + 1), bernoulli' i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(succ p)
[PROOFSTEP]
cases' p with p p
[GOAL]
case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ zero =
    ∑ i in range (zero + 1), bernoulli' i * ↑(Nat.choose (zero + 1) i) * ↑n ^ (zero + 1 - i) / ↑(succ zero)
[PROOFSTEP]
simp
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ succ p =
    ∑ i in range (succ p + 1), bernoulli' i * ↑(Nat.choose (succ p + 1) i) * ↑n ^ (succ p + 1 - i) / ↑(succ (succ p))
[PROOFSTEP]
let f i := bernoulli i * p.succ.succ.choose i * (n : ℚ) ^ (p.succ.succ - i) / p.succ.succ
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ succ p =
    ∑ i in range (succ p + 1), bernoulli' i * ↑(Nat.choose (succ p + 1) i) * ↑n ^ (succ p + 1 - i) / ↑(succ (succ p))
[PROOFSTEP]
let f' i := bernoulli' i * p.succ.succ.choose i * (n : ℚ) ^ (p.succ.succ - i) / p.succ.succ
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ succ p =
    ∑ i in range (succ p + 1), bernoulli' i * ↑(Nat.choose (succ p + 1) i) * ↑n ^ (succ p + 1 - i) / ↑(succ (succ p))
[PROOFSTEP]
suffices (∑ k in Ico 1 n.succ, (k : ℚ) ^ p.succ) = ∑ i in range p.succ.succ, f' i by convert this
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
this : ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
⊢ ∑ k in Ico 1 (n + 1), ↑k ^ succ p =
    ∑ i in range (succ p + 1), bernoulli' i * ↑(Nat.choose (succ p + 1) i) * ↑n ^ (succ p + 1 - i) / ↑(succ (succ p))
[PROOFSTEP]
convert this
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
have hle := Nat.le_add_left 1 n
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
have hne : (p + 1 + 1 : ℚ) ≠ 0 := by norm_cast; exact succ_ne_zero p.succ
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
⊢ ↑p + 1 + 1 ≠ 0
[PROOFSTEP]
norm_cast
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
⊢ ¬p + 1 + 1 = 0
[PROOFSTEP]
exact succ_ne_zero p.succ
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
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]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
r : ℚ
⊢ r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
[PROOFSTEP]
rw [mul_div_right_comm, mul_div_cancel _ hne]
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
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]
  ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
⊢ f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
[PROOFSTEP]
simp_rw [bernoulli_one, choose_one_right, succ_sub_succ_eq_sub, cast_succ, tsub_zero, h1]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
⊢ -1 / 2 * ↑n ^ succ p + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
[PROOFSTEP]
ring
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
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) :=
  sum_congr rfl fun i _ => by rw [bernoulli_eq_bernoulli'_of_ne_one (succ_succ_ne_one i)]
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
i : ℕ
x✝ : i ∈ range p
⊢ bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
[PROOFSTEP]
rw [bernoulli_eq_bernoulli'_of_ne_one (succ_succ_ne_one i)]
[GOAL]
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
calc
  (
        -- 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 := 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]
      -- 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']
  _ = (∑ 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 := by
    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 := by simp_rw [sum_range_succ']
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ k in Ico 1 (succ n), ↑k ^ succ p = ∑ k in range (succ n), ↑k ^ succ p
[PROOFSTEP]
simp [sum_Ico_eq_sub _ hle, succ_ne_zero]
  -- extract the last term of the sum
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ k in range (succ n), ↑k ^ succ p = ∑ k in range n, ↑k ^ succ p + ↑n ^ succ p
[PROOFSTEP]
rw [sum_range_succ]
  -- apply the key lemma, `sum_range_pow`
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ k in range n, ↑k ^ succ p + ↑n ^ succ p = ∑ i in range (succ (succ p)), f i + ↑n ^ succ p
[PROOFSTEP]
simp [sum_range_pow]
  -- extract the first two terms of the sum
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ i in range (succ (succ p)), f i + ↑n ^ succ p = ∑ i in range p, f (succ (succ i)) + f 1 + f 0 + ↑n ^ succ p
[PROOFSTEP]
simp_rw [sum_range_succ']
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ i in range p, f (succ (succ i)) + f 1 + f 0 + ↑n ^ succ p =
    ∑ i in range p, f (succ (succ i)) + (f 1 + ↑n ^ succ p) + f 0
[PROOFSTEP]
ring
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ i in range p, f (succ (succ i)) + (f 1 + ↑n ^ succ p) + f 0 =
    ∑ i in range p, f (succ (succ i)) + 1 / 2 * ↑n ^ succ p + f 0
[PROOFSTEP]
rw [h2]
  -- convert from `bernoulli` to `bernoulli'`
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ i in range p, f (succ (succ i)) + 1 / 2 * ↑n ^ succ p + f 0 = ∑ i in range p, f' (succ (succ i)) + f' 1 + f' 0
[PROOFSTEP]
simpa [h1, fun i => show i + 2 = i + 1 + 1 from rfl]
  -- rejoin the first two terms of the sum
[GOAL]
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
f : ℕ → ℚ := fun i => bernoulli i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
f' : ℕ → ℚ := fun i => bernoulli' i * ↑(Nat.choose (succ (succ p)) i) * ↑n ^ (succ (succ p) - i) / ↑(succ (succ p))
hle : 1 ≤ n + 1
hne : ↑p + 1 + 1 ≠ 0
h1 : ∀ (r : ℚ), r * (↑p + 1 + 1) * ↑n ^ succ p / (↑p + 1 + 1) = r * ↑n ^ succ p
h2 : f 1 + ↑n ^ succ p = 1 / 2 * ↑n ^ succ p
this :
  ∑ i in range p, bernoulli (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2) =
    ∑ i in range p, bernoulli' (i + 2) * ↑(Nat.choose (p + 2) (i + 2)) * ↑n ^ (p - i) / ↑(p + 2)
⊢ ∑ i in range p, f' (succ (succ i)) + f' 1 + f' 0 = ∑ i in range (succ (succ p)), f' i
[PROOFSTEP]
simp_rw [sum_range_succ']