Theorem: Polynomial.bernoulli_eval_one_add
File: Mathlib/NumberTheory/BernoulliPolynomials.lean

tactic: refine' Nat.strong_induction_on n fun d hd => _
state_before: n : ℕ
x : ℚ
⊢ eval (1 + x) (bernoulli n) = eval x (bernoulli n) + ↑n * x ^ (n - 1)

tactic: have nz : ((d.succ : ℕ) : ℚ) ≠ 0 := by
  norm_cast
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
⊢ eval (1 + x) (bernoulli d) = eval x (bernoulli d) + ↑d * x ^ (d - 1)

tactic: apply (mul_right_inj' nz).1
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (bernoulli d) = eval x (bernoulli d) + ↑d * x ^ (d - 1)

tactic: rw [← smul_eq_mul, ← eval_smul, bernoulli_eq_sub_sum, mul_add, ← smul_eq_mul, ← eval_smul,
  bernoulli_eq_sub_sum, eval_sub, eval_finset_sum]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ ↑(succ d) * eval (1 + x) (bernoulli d) = ↑(succ d) * (eval x (bernoulli d) + ↑d * x ^ (d - 1))

tactic: conv_lhs =>
  congr
  . skip
  . apply_congr
    . skip
    . rw [eval_smul, hd _ (mem_range.1 (by assumption))]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) - ∑ i in range d, eval (1 + x) (↑(Nat.choose (d + 1) i) • bernoulli i) =
    eval x (↑(monomial d) ↑(succ d) - ∑ k in range d, ↑(Nat.choose (d + 1) k) • bernoulli k) +
      ↑(succ d) * (↑d * x ^ (d - 1))

tactic: rw [eval_sub, eval_finset_sum]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) -
      ∑ x_1 in range d, ↑(Nat.choose (d + 1) x_1) • (eval x (bernoulli x_1) + ↑x_1 * x ^ (x_1 - 1)) =
    eval x (↑(monomial d) ↑(succ d) - ∑ k in range d, ↑(Nat.choose (d + 1) k) • bernoulli k) +
      ↑(succ d) * (↑d * x ^ (d - 1))

tactic: simp_rw [eval_smul, smul_add]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) -
      ∑ x_1 in range d, ↑(Nat.choose (d + 1) x_1) • (eval x (bernoulli x_1) + ↑x_1 * x ^ (x_1 - 1)) =
    eval x (↑(monomial d) ↑(succ d)) - ∑ i in range d, eval x (↑(Nat.choose (d + 1) i) • bernoulli i) +
      ↑(succ d) * (↑d * x ^ (d - 1))

tactic: rw [sum_add_distrib, sub_add, sub_eq_sub_iff_sub_eq_sub, _root_.add_sub_sub_cancel]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) -
      ∑ x_1 in range d,
        (↑(Nat.choose (d + 1) x_1) • eval x (bernoulli x_1) + ↑(Nat.choose (d + 1) x_1) • (↑x_1 * x ^ (x_1 - 1))) =
    eval x (↑(monomial d) ↑(succ d)) - ∑ x_1 in range d, ↑(Nat.choose (d + 1) x_1) • eval x (bernoulli x_1) +
      ↑(succ d) * (↑d * x ^ (d - 1))

tactic: conv_rhs =>
  congr
  . skip
  . congr
    rw [succ_eq_add_one, ← choose_succ_self_right d]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) - eval x (↑(monomial d) ↑(succ d)) =
    ∑ x_1 in range d, ↑(Nat.choose (d + 1) x_1) • (↑x_1 * x ^ (x_1 - 1)) + ↑(succ d) * (↑d * x ^ (d - 1))

tactic: rw [Nat.cast_succ, ← smul_eq_mul, ← sum_range_succ _ d, eval_monomial_one_add_sub]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ eval (1 + x) (↑(monomial d) ↑(succ d)) - eval x (↑(monomial d) ↑(succ d)) =
    ∑ x_1 in range d, ↑(Nat.choose (d + 1) x_1) • (↑x_1 * x ^ (x_1 - 1)) + ↑(Nat.choose (d + 1) d) * (↑d * x ^ (d - 1))

tactic: simp_rw [smul_eq_mul]
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
⊢ ∑ x_1 in range (d + 1), ↑(Nat.choose (d + 1) x_1) * (↑x_1 * x ^ (x_1 - 1)) =
    ∑ x_1 in range (d + 1), ↑(Nat.choose (d + 1) x_1) • (↑x_1 * x ^ (x_1 - 1))

tactic: norm_cast
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
⊢ ↑(succ d) ≠ 0

tactic: assumption
state_before: n : ℕ
x : ℚ
d : ℕ
hd : ∀ (m : ℕ), m < d → eval (1 + x) (bernoulli m) = eval x (bernoulli m) + ↑m * x ^ (m - 1)
nz : ↑(succ d) ≠ 0
x✝ : ℕ
a✝ : x✝ ∈ range d
⊢ x✝ ∈ range d