-- Mathlib/NumberTheory/Bernoulli.lean
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

Proof state:
n : ℕ
⊢ (1, n) ∈ antidiagonal n.succ

Tactic:
simp [mem_antidiagonal, add_comm]

Result:
no goals

Proof state:
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
⊢ (1 + n).choose n = n + 1

Tactic:
simp [add_comm]

Result:
no goals

Proof state:
case succ.h
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli x.1 =
    0 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1

Tactic:
convert eq_sub_of_add_eq' H using 1

Result:
case h.e'_2
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli x.1 =
    ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1

case h.e'_3
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ 0 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1 =
    1 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1

Proof state:
case h.e'_3
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ 1 = 2 - 1

Tactic:
norm_num

Result:
no goals

Proof state:
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal n.succ \ {(1, n)}
⊢ p ∈ ?m.164855 ∧ p ≠ ?m.164926

Tactic:
rwa [mem_sdiff, mem_singleton] at h

Result:
no goals

Proof state:
case succ
n : ℕ
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Tactic:
have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]

Result:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Proof state:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Tactic:
have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]

Result:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Proof state:
case h.e'_2
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli x.1 =
    ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1

Tactic:
refine sum_congr rfl fun p h => ?_

Result:
case h.e'_2
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal n.succ \ {(1, n)}
⊢ ↑((p.1 + p.2).choose p.2) / (↑p.2 + 1) * bernoulli p.1 = ↑((p.1 + p.2).choose p.2) / (↑p.2 + 1) * bernoulli' p.1

Proof state:
case succ
n : ℕ
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = if n + 1 = 0 then 1 else 0

Tactic:
rw [if_neg (succ_ne_zero _)]

Result:
case succ
n : ℕ
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Proof state:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli x.1 =
    0

Tactic:
apply add_eq_of_eq_sub'

Result:
case succ.h
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli x.1 =
    0 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1

Proof state:
case h.e'_3
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ 0 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1 =
    1 - ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1

Tactic:
field_simp [h₃]

Result:
case h.e'_3
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ 1 = 2 - 1

Proof state:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Tactic:
have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast

Result:
case succ
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
⊢ ∑ k ∈ antidiagonal (n + 1), ↑((k.1 + k.2).choose k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Proof state:
case h.e'_2.intro
n : ℕ
h₁ : (1, n) ∈ antidiagonal n.succ
h₂ : ↑n + 1 ≠ 0
h₃ : (1 + n).choose n = n + 1
H :
  ↑(((1, n).1 + (1, n).2).choose (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x ∈ antidiagonal n.succ \ {(1, n)}, ↑((x.1 + x.2).choose x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
p : ℕ × ℕ
h : p ∈ antidiagonal n.succ \ {(1, n)}
h' : p ∈ antidiagonal n.succ
h'' : p ≠ (1, n)
⊢ ↑((p.1 + p.2).choose p.2) / (↑p.2 + 1) * bernoulli p.1 = ↑((p.1 + p.2).choose p.2) / (↑p.2 + 1) * bernoulli' p.1

Tactic:
simp [bernoulli_eq_bernoulli'_of_ne_one ((not_congr (antidiagonal_congr h' h₁)).mp h'')]

Result:
no goals