l3lab/ntp-mathlib huggingface dataset:
theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n := by
  by_cases h0 : n = 0; · simp [h0]
  rw [bernoulli, neg_one_pow_eq_pow_mod_two]
  

Proof state:
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

Next tactic:
cases' mod_two_eq_zero_or_one n with h h
theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n := by
  by_cases h0 : n = 0; · simp [h0]
  rw [bernoulli, neg_one_pow_eq_pow_mod_two]
  cases' mod_two_eq_zero_or_one n with h h
  · 

Proof state:
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

Next tactic:
simp [h]
theorem bernoulli_eq_bernoulli'_of_ne_one {n : ℕ} (hn : n ≠ 1) : bernoulli n = bernoulli' n := by
  by_cases h0 : n = 0; · simp [h0]
  rw [bernoulli, neg_one_pow_eq_pow_mod_two]
  cases' mod_two_eq_zero_or_one n with h h
  · simp [h]
  · 

Proof state:
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

Next tactic:
simp [bernoulli'_odd_eq_zero (odd_iff.mpr h) (one_lt_iff_ne_zero_and_ne_one.mpr ⟨h0, hn⟩)]
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  

Proof state:
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

Next tactic:
cases' n with n n
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · 

Proof state:
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

Next tactic:
simp
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  

Proof state:
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

Next tactic:
cases' n with n n
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · 

Proof state:
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

Next tactic:
rw [sum_range_one]
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    

Proof state:
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

Next tactic:
simp
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  

Proof state:
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

Next 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
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  suffices (∑ i in range n, ↑((n + 2).choose (i + 2)) * bernoulli (i + 2)) = n / 2 by
    

Proof state:
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

Next 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]
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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]
    

Proof state:
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

Next tactic:
ring
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  

Proof state:
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

Next tactic:
have f := sum_bernoulli' n.succ.succ
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  

Proof state:
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

Next tactic:
simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  

Proof state:
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

Next tactic:
refine' Eq.trans _ (Eq.trans f _)
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  refine' Eq.trans _ (Eq.trans f _)
  · 

Proof state:
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)

Next tactic:
congr
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  refine' Eq.trans _ (Eq.trans f _)
  · congr
    

Proof state:
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)

Next tactic:
funext x
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  refine' Eq.trans _ (Eq.trans f _)
  · congr
    funext x
    

Proof state:
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)

Next tactic:
rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  refine' Eq.trans _ (Eq.trans f _)
  · congr
    funext x
    rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
  · 

Proof state:
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

Next 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]
@[simp]
theorem sum_bernoulli (n : ℕ) :
    (∑ k in range n, (n.choose k : ℚ) * bernoulli k) = if n = 1 then 1 else 0 := by
  cases' n with n n
  · simp
  cases' n with n n
  · rw [sum_range_one]
    simp
  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
  have f := sum_bernoulli' n.succ.succ
  simp_rw [sum_range_succ', cast_succ, ← eq_sub_iff_add_eq] at f
  -- porting note: was `convert f`
  refine' Eq.trans _ (Eq.trans f _)
  · congr
    funext x
    rw [bernoulli_eq_bernoulli'_of_ne_one (succ_ne_zero x ∘ succ.inj)]
  · 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]
    

Proof state:
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

Next tactic:
ring
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  

Proof state:
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal n, ↑(Nat.choose (k.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = if n = 0 then 1 else 0

Next tactic:
cases' n with n n
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · 

Proof state:
case zero
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
⊢ ∑ k in antidiagonal zero, ↑(Nat.choose (k.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = if zero = 0 then 1 else 0

Next tactic:
simp
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  

Proof state:
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = if succ n = 0 then 1 else 0

Next tactic:
rw [if_neg (succ_ne_zero _)]
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  

Proof state:
case succ
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Next tactic:
have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by 

Proof state:
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
⊢ (1, n) ∈ antidiagonal (succ n)

Next tactic:
simp [mem_antidiagonal, add_comm]
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  

Proof state:
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.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Next tactic:
have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by 

Proof state:
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
⊢ ↑n + 1 ≠ 0

Next tactic:
norm_cast
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; 

Proof state:
A : Type u_1
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n : ℕ
h₁ : (1, n) ∈ antidiagonal (succ n)
⊢ ¬n + 1 = 0

Next tactic:
exact succ_ne_zero _
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  

Proof state:
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.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Next tactic:
have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  have h₃ : (1 + n).choose n = n + 1 := by 

Proof state:
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

Next tactic:
simp [add_comm]
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]
  -- key equation: the corresponding fact for `bernoulli'`
  

Proof state:
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.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Next tactic:
have H := bernoulli'_spec' n.succ
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]
  -- key equation: the corresponding fact for `bernoulli'`
  have H := bernoulli'_spec' n.succ
  -- massage it to match the structure of the goal, then convert piece by piece
  

Proof state:
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.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli' k.1 = 1
⊢ ∑ k in antidiagonal (succ n), ↑(Nat.choose (k.1 + k.2) k.2) / (↑k.2 + 1) * bernoulli k.1 = 0

Next tactic:
rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]
  -- key equation: the corresponding fact for `bernoulli'`
  have H := bernoulli'_spec' n.succ
  -- massage it to match the structure of the goal, then convert piece by piece
  rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
  

Proof state:
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).1 + (1, n).2) (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.1 + x.2) x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ↑(Nat.choose ((1, n).1 + (1, n).2) (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1 +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.1 + x.2) x.2) / (↑x.2 + 1) * bernoulli x.1 =
    0

Next tactic:
apply add_eq_of_eq_sub'
theorem bernoulli_spec' (n : ℕ) :
    (∑ k in antidiagonal n, ((k.1 + k.2).choose k.2 : ℚ) / (k.2 + 1) * bernoulli k.1) =
      if n = 0 then 1 else 0 := by
  cases' n with n n;
  · simp
  rw [if_neg (succ_ne_zero _)]
  -- algebra facts
  have h₁ : (1, n) ∈ antidiagonal n.succ := by simp [mem_antidiagonal, add_comm]
  have h₂ : (n : ℚ) + 1 ≠ 0 := by norm_cast; exact succ_ne_zero _
  have h₃ : (1 + n).choose n = n + 1 := by simp [add_comm]
  -- key equation: the corresponding fact for `bernoulli'`
  have H := bernoulli'_spec' n.succ
  -- massage it to match the structure of the goal, then convert piece by piece
  rw [sum_eq_add_sum_diff_singleton h₁] at H ⊢
  apply add_eq_of_eq_sub'
  

Proof state:
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).1 + (1, n).2) (1, n).2) / (↑(1, n).2 + 1) * bernoulli' (1, n).1 +
      ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.1 + x.2) x.2) / (↑x.2 + 1) * bernoulli' x.1 =
    1
⊢ ∑ x in antidiagonal (succ n) \ {(1, n)}, ↑(Nat.choose (x.1 + x.2) x.2) / (↑x.2 + 1) * bernoulli x.1 =
    0 - ↑(Nat.choose ((1, n).1 + (1, n).2) (1, n).2) / (↑(1, n).2 + 1) * bernoulli (1, n).1

Next tactic:
convert eq_sub_of_add_eq' H using 1