File: Mathlib/NumberTheory/Bernoulli.lean

full_name: bernoulli'
code: /-- The Bernoulli numbers:
the $n$-th Bernoulli number $B_n$ is defined recursively via
$$B_n = 1 - \sum_{k < n} \binom{n}{k}\frac{B_k}{n+1-k}$$ -/
def bernoulli' : ℕ → ℚ 
goal: ℕ → ℚ

full_name: bernoulli'_def'
code: theorem bernoulli'_def' (n : ℕ) :
    bernoulli' n = 1 - ∑ k : Fin n, n.choose k / (n - k + 1) * bernoulli' k 
goal: bernoulli' n = 1 - ∑ k : Fin n, ↑(n.choose ↑k) / (↑n - ↑↑k + 1) * bernoulli' ↑k

full_name: bernoulli'_def
code: theorem bernoulli'_def (n : ℕ) :
    bernoulli' n = 1 - ∑ k ∈ range n, n.choose k / (n - k + 1) * bernoulli' k 
goal: bernoulli' n = 1 - ∑ k ∈ Finset.range n, ↑(n.choose k) / (↑n - ↑k + 1) * bernoulli' k

full_name: bernoulli'_spec
code: theorem bernoulli'_spec (n : ℕ) :
    (∑ k ∈ range n.succ, (n.choose (n - k) : ℚ) / (n - k + 1) * bernoulli' k) = 1 
goal: ∑ k ∈ Finset.range n.succ, ↑(n.choose (n - k)) / (↑n - ↑k + 1) * bernoulli' k = 1

full_name: bernoulli'_spec'
code: theorem bernoulli'_spec' (n : ℕ) :
    (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli' k.1) = 1 
goal: ∑ k ∈ Finset.antidiagonal n, ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli' k.1 = 1

full_name: bernoulli'_zero
code: @[simp]
theorem bernoulli'_zero : bernoulli' 0 = 1 
goal: bernoulli' 0 = 1

full_name: bernoulli'_one
code: @[simp]
theorem bernoulli'_one : bernoulli' 1 = 1 / 2 
goal: bernoulli' 1 = 1 / 2

full_name: bernoulli'_two
code: @[simp]
theorem bernoulli'_two : bernoulli' 2 = 1 / 6 
goal: bernoulli' 2 = 1 / 6

full_name: bernoulli'_three
code: @[simp]
theorem bernoulli'_three : bernoulli' 3 = 0 
goal: bernoulli' 3 = 0

full_name: bernoulli'_four
code: @[simp]
theorem bernoulli'_four : bernoulli' 4 = -1 / 30 
goal: bernoulli' 4 = -1 / 30

full_name: sum_bernoulli'
code: @[simp]
theorem sum_bernoulli' (n : ℕ) : (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli' k) = n 
goal: ∑ k ∈ Finset.range n, ↑(n.choose k) * bernoulli' k = ↑n

full_name: bernoulli'PowerSeries
code: /-- The exponential generating function for the Bernoulli numbers `bernoulli' n`. -/
def bernoulli'PowerSeries 
goal: A⟦X⟧

full_name: bernoulli'PowerSeries_mul_exp_sub_one
code: theorem bernoulli'PowerSeries_mul_exp_sub_one :
    bernoulli'PowerSeries A * (exp A - 1) = X * exp A 
goal: bernoulli'PowerSeries A * (PowerSeries.exp A - 1) = PowerSeries.X * PowerSeries.exp A

full_name: bernoulli'_odd_eq_zero
code: /-- Odd Bernoulli numbers (greater than 1) are zero. -/
theorem bernoulli'_odd_eq_zero {n : ℕ} (h_odd : Odd n) (hlt : 1 < n) : bernoulli' n = 0 
goal: bernoulli' n = 0

full_name: bernoulli
code: /-- The Bernoulli numbers are defined to be `bernoulli'` with a parity sign. -/
def bernoulli (n : ℕ) : ℚ 
goal: ℚ

full_name: bernoulli'_eq_bernoulli
code: theorem bernoulli'_eq_bernoulli (n : ℕ) : bernoulli' n = (-1) ^ n * bernoulli n 
goal: bernoulli' n = (-1) ^ n * bernoulli n

full_name: bernoulli_zero
code: @[simp]
theorem bernoulli_zero : bernoulli 0 = 1 
goal: bernoulli 0 = 1

full_name: bernoulli_one
code: @[simp]
theorem bernoulli_one : bernoulli 1 = -1 / 2 
goal: bernoulli 1 = -1 / 2

full_name: bernoulli_eq_bernoulli'_of_ne_one
code: theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n 
goal: bernoulli n = bernoulli' n

full_name: sum_bernoulli
code: @[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k ∈ range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 
goal: ∑ k ∈ Finset.range n, ↑(n.choose k) * bernoulli k = if n = 1 then 1 else 0

full_name: bernoulli_spec'
code: theorem bernoulli_spec' (n : ℕ) :
    (∑ k ∈ antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 
goal: ∑ k ∈ Finset.antidiagonal n, ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = if n = 0 then 1 else 0

full_name: bernoulliPowerSeries
code: /-- The exponential generating function for the Bernoulli numbers `bernoulli n`. -/
def bernoulliPowerSeries 
goal: A⟦X⟧

full_name: bernoulliPowerSeries_mul_exp_sub_one
code: theorem bernoulliPowerSeries_mul_exp_sub_one : bernoulliPowerSeries A * (exp A - 1) = X 
goal: bernoulliPowerSeries A * (PowerSeries.exp A - 1) = PowerSeries.X

full_name: sum_range_pow
code: /-- **Faulhaber's theorem** relating the **sum of p-th powers** to the Bernoulli numbers:
$$\sum_{k=0}^{n-1} k^p = \sum_{i=0}^p B_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
See https://proofwiki.org/wiki/Faulhaber%27s_Formula and [orosi2018faulhaber] for
the proof provided here. -/
theorem sum_range_pow (n p : ℕ) :
    (∑ k ∈ range n, (k : ℚ) ^ p) =
      ∑ i ∈ range (p + 1), bernoulli i * ((p + 1).choose i) * (n : ℚ) ^ (p + 1 - i) / (p + 1) 
goal: ∑ k ∈ Finset.range n, ↑k ^ p =
  ∑ i ∈ Finset.range (p + 1), bernoulli i * ↑((p + 1).choose i) * ↑n ^ (p + 1 - i) / (↑p + 1)

full_name: sum_Ico_pow
code: /-- Alternate form of **Faulhaber's theorem**, relating the sum of p-th powers to the Bernoulli
numbers: $$\sum_{k=1}^{n} k^p = \sum_{i=0}^p (-1)^iB_i\binom{p+1}{i}\frac{n^{p+1-i}}{p+1}.$$
Deduced from `sum_range_pow`. -/
theorem sum_Ico_pow (n p : ℕ) :
    (∑ k ∈ Ico 1 (n + 1), (k : ℚ) ^ p) =
      ∑ i ∈ range (p + 1), bernoulli' i * (p + 1).choose i * (n : ℚ) ^ (p + 1 - i) / (p + 1) 
goal: ∑ k ∈ Finset.Ico 1 (n + 1), ↑k ^ p =
  ∑ i ∈ Finset.range (p + 1), bernoulli' i * ↑((p + 1).choose i) * ↑n ^ (p + 1 - i) / (↑p + 1)