Theorem: sum_bernoulli'
File: Mathlib/NumberTheory/Bernoulli.lean

Proof steps:
state_before: A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k ∈ range n, ↑(n.choose k) * bernoulli' k = ↑n
state_after: case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k ∈ range 0, ↑(Nat.choose 0 k) * bernoulli' k = ↑0

case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k ∈ range (n + 1), ↑((n + 1).choose k) * bernoulli' k = ↑(n + 1)
tactic: cases' n with n
state_before: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k ∈ range (n + 1), ↑((n + 1).choose k) * bernoulli' k = ↑(n + 1)
state_after: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (↑n + 1) * ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k =
    ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x
tactic: suffices
    ((n + 1 : ℚ) * ∑ k ∈ range n, ↑(n.choose k) / (n - k + 1) * bernoulli' k) =
      ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x by
    rw_mod_cast [sum_range_succ, bernoulli'_def, ← this, choose_succ_self_right]
    ring
state_before: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (↑n + 1) * ∑ k ∈ range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k =
    ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x
state_after: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x ∈ range n, (↑n + 1) * (↑(n.choose x) / (↑n - ↑x + 1)) * bernoulli' x =
    ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x
tactic: simp_rw [mul_sum, ← mul_assoc]
state_before: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ x ∈ range n, (↑n + 1) * (↑(n.choose x) / (↑n - ↑x + 1)) * bernoulli' x =
    ∑ x ∈ range n, ↑(n.succ.choose x) * bernoulli' x
state_after: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(n.choose k) / (↑n - ↑k + 1)) * bernoulli' k = ↑(n.succ.choose k) * bernoulli' k
tactic: refine sum_congr rfl fun k hk => ?_
state_before: case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(n.choose k) / (↑n - ↑k + 1)) * bernoulli' k = ↑(n.succ.choose k) * bernoulli' k
state_after: case succ.e_a
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(n.choose k) / (↑n - ↑k + 1)) = ↑(n.succ.choose k)
tactic: congr
state_before: case succ.e_a
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n k : ℕ
hk : k ∈ range n
⊢ (↑n + 1) * (↑(n.choose k) / (↑n - ↑k + 1)) = ↑(n.succ.choose k)
state_after: 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) * (↑(n.choose k) / (↑n - ↑k + 1)) = ↑(n.succ.choose k)
tactic: have : ((n - k : ℕ) : ℚ) + 1 ≠ 0 := by norm_cast
state_before: 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) * (↑(n.choose k) / (↑n - ↑k + 1)) = ↑(n.succ.choose k)
state_after: 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.choose k) * (↑n + 1) = ↑((n + 1).choose k) * (↑(n - k) + 1)
tactic: field_simp [← cast_sub (mem_range.1 hk).le, mul_comm]
state_before: 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.choose k) * (↑n + 1) = ↑((n + 1).choose k) * (↑(n - k) + 1)
state_after: no goals
tactic: rw_mod_cast [tsub_add_eq_add_tsub (mem_range.1 hk).le, choose_mul_succ_eq]