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

tactic: cases' n with n n
state_before: A : Type ?u.636004
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in range n, ↑(Nat.choose n k) * bernoulli k = if n = 1 then 1 else 0

tactic: cases' n with n n
state_before: case succ
A : Type ?u.636004
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

tactic: 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
state_before: case succ.succ
A : Type ?u.636004
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

tactic: have f := sum_bernoulli' n.succ.succ
state_before: case succ.succ
A : Type ?u.636004
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ i in range n, ↑(Nat.choose (n + 2) (i + 2)) * bernoulli (i + 2) = ↑n / 2

tactic: simp_rw [sum_range_succ', bernoulli'_one, choose_one_right, cast_succ, ← eq_sub_iff_add_eq] at f
state_before: case succ.succ
A : Type ?u.636004
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

tactic: refine' Eq.trans _ (Eq.trans  f _)
state_before: case succ.succ
A : Type ?u.636004
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

tactic: simp
state_before: case zero
A : Type ?u.636004
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in range zero, ↑(Nat.choose zero k) * bernoulli k = if zero = 1 then 1 else 0

tactic: rw [sum_range_one]
state_before: case succ.zero
A : Type ?u.636004
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

tactic: simp
state_before: case succ.zero
A : Type ?u.636004
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ↑(Nat.choose (succ zero) 0) * bernoulli 0 = if succ zero = 1 then 1 else 0

tactic: 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]
state_before: A : Type ?u.636004
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

tactic: ring
state_before: A : Type ?u.636004
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

tactic: congr
state_before: case succ.succ.refine'_1
A : Type ?u.636004
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)

tactic: funext x
state_before: case succ.succ.refine'_1.e_f
A : Type ?u.636004
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)

tactic: rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
state_before: case succ.succ.refine'_1.e_f.h
A : Type ?u.636004
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)

tactic: 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]
state_before: case succ.succ.refine'_2
A : Type ?u.636004
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

tactic: ring
state_before: case succ.succ.refine'_2
A : Type ?u.636004
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