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

tactic: have hne : ∀ m : ℕ, (m ! : ℚ) ≠ 0 := fun m => by exact_mod_cast factorial_ne_zero m
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)

tactic: rw [hps, sum_mul]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
⊢ ∑ k in range n, ↑k ^ p = ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)

tactic: refine' sum_congr rfl fun x _ => _
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
⊢ ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / ↑(p + 1)! * ↑p ! =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / (↑p + 1)

tactic: field_simp [mul_right_comm _ ↑p !, ← mul_assoc _ _ ↑p !, cast_add_one_ne_zero, hne]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
x : ℕ
x✝ : x ∈ range (p + 1)
⊢ bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / ↑(p + 1)! * ↑p ! =
    bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) / (↑p + 1)

tactic: ring
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hps :
  ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !
x : ℕ
x✝ : x ∈ range (p + 1)
⊢ bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) * ↑p ! * (↑p + 1) =
    bernoulli x * ↑(Nat.choose (p + 1) x) * ↑n ^ (p + 1 - x) * ((↑p + 1) * ↑p !)

tactic: exact_mod_cast factorial_ne_zero m
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p m : ℕ
⊢ ↑m ! ≠ 0

tactic: ext q : 1
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
⊢ ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: let f a b := bernoulli a / a ! * coeff ℚ (b + 1) (exp ℚ ^ n)
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
⊢ ↑(coeff ℚ q) ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    ↑(coeff ℚ q)
      (PowerSeries.mk fun p =>
        ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)

tactic: simp only [coeff_mul, coeff_mk, cast_mul, sum_antidiagonal_eq_sum_range_succ f]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ↑(coeff ℚ q) ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    ↑(coeff ℚ q)
      (PowerSeries.mk fun p =>
        ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)

tactic: apply sum_congr rfl
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ∑ x in range (succ q), bernoulli x / ↑x ! * ↑(coeff ℚ (q - x + 1)) (exp ℚ ^ n) =
    ∑ i in range (q + 1), bernoulli i * ↑(Nat.choose (q + 1) i) * ↑n ^ (q + 1 - i) / ↑(q + 1)!

tactic: intros m h
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
⊢ ∀ (x : ℕ),
    x ∈ range (succ q) →
      bernoulli x / ↑x ! * ↑(coeff ℚ (q - x + 1)) (exp ℚ ^ n) =
        bernoulli x * ↑(Nat.choose (q + 1) x) * ↑n ^ (q + 1 - x) / ↑(q + 1)!

tactic: simp only [Finset.mem_range]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m ∈ range (succ q)
⊢ bernoulli m / ↑m ! * ↑(coeff ℚ (q - m + 1)) (exp ℚ ^ n) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!

tactic: simp only [exp_pow_eq_rescale_exp, rescale, one_div, coeff_mk, RingHom.coe_mk, coeff_exp,
  RingHom.id_apply, cast_mul, algebraMap_rat_rat]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m ∈ range (succ q)
⊢ bernoulli m / ↑m ! * ↑(coeff ℚ (q - m + 1)) (exp ℚ ^ n) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!

tactic: simp at h
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m ∈ range (succ q)
⊢ bernoulli m / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ)) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!

tactic: rw [choose_eq_factorial_div_factorial h.le, eq_comm, div_eq_iff (hne q.succ), succ_eq_add_one,
  mul_assoc _ _ (q.succ ! : ℚ), mul_comm _ (q.succ ! : ℚ), ← mul_assoc, div_mul_eq_mul_div]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ)) =
    bernoulli m * ↑(Nat.choose (q + 1) m) * ↑n ^ (q + 1 - m) / ↑(q + 1)!

tactic: simp only [add_eq, add_zero, ge_iff_le, IsUnit.mul_iff, Nat.isUnit_iff, succ.injEq, cast_mul,
  cast_succ, MonoidHom.coe_mk, OneHom.coe_mk, coeff_exp, Algebra.id.map_eq_id, one_div,
  map_inv₀, map_natCast, coeff_mk, mul_inv_rev]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * ↑((q + 1)! / (m ! * (q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / ↑m ! *
      ↑(coeff ℚ (q - m + 1))
        (↑{
              toOneHom :=
                { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                  map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) },
              map_mul' :=
                (_ :
                  ∀ (f g : PowerSeries ℚ),
                    OneHom.toFun
                        { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                          map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                        (f * g) =
                      OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          f *
                        OneHom.toFun
                          { toFun := fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f,
                            map_one' := (_ : (fun f => PowerSeries.mk fun n_1 => ↑n ^ n_1 * ↑(coeff ℚ n_1) f) 1 = 1) }
                          g) }
          (exp ℚ))

tactic: rw [mul_comm ((n : ℚ) ^ (q - m + 1)), ← mul_assoc _ _ ((n : ℚ) ^ (q - m + 1)), ← one_div,
  mul_one_div, div_div, tsub_add_eq_add_tsub (le_of_lt_succ h), cast_div, cast_mul]
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * ↑((q + 1)! / (m ! * (q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / ↑m ! * (↑n ^ (q - m + 1) * (↑(q - m + 1)!)⁻¹)

tactic: ring
state_before: case h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ bernoulli m * (↑(q + 1)! / (↑m ! * ↑(q + 1 - m)!)) * ↑n ^ (q + 1 - m) =
    bernoulli m * ↑(succ q)! / (↑m ! * ↑(q + 1 - m)!) * ↑n ^ (q + 1 - m)

tactic: exact factorial_mul_factorial_dvd_factorial h.le
state_before: case h.n_dvd
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ m ! * (q + 1 - m)! ∣ (q + 1)!

tactic: simp [hne, factorial_ne_zero]
state_before: case h.n_nonzero
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
q : ℕ
f : ℕ → ℕ → ℚ := fun a b => bernoulli a / ↑a ! * ↑(coeff ℚ (b + 1)) (exp ℚ ^ n)
m : ℕ
h : m < succ q
⊢ ↑(m ! * (q + 1 - m)!) ≠ 0

tactic: suffices
  (mk fun p => ∑ k in range n, (k : ℚ) ^ p * algebraMap ℚ ℚ p !⁻¹) =
    mk fun p =>
      ∑ i in range (p + 1), bernoulli i * (p + 1).choose i * (n : ℚ) ^ (p + 1 - i) / (p + 1)! by
  rw [← div_eq_iff (hne p), div_eq_mul_inv, sum_mul]
  rw [PowerSeries.ext_iff] at this
  simpa using this p
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !

tactic: have hexp : exp ℚ - 1 ≠ 0 := by
  simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
  use 1
  simp
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: have h_r : exp ℚ ^ n - 1 = X * mk fun p => coeff ℚ (p + 1) (exp ℚ ^ n) := by
  have h_const : C ℚ (constantCoeff ℚ (exp ℚ ^ n)) = 1 := by simp
  rw [← h_const, sub_const_eq_X_mul_shift]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: rw [← mul_right_inj' hexp, mul_comm]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: simp only [← cast_pow]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) * (exp ℚ - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: rw [←exp_pow_sum,  geom_sum_mul, h_r, ← bernoulliPowerSeries_mul_exp_sub_one,
bernoulliPowerSeries, mul_right_comm]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ x in range n, ↑(x ^ p) * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) * (exp ℚ - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p =>
        ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑(n ^ (p + 1 - x)) / ↑(p + 1)!

tactic: simp only [mul_comm, mul_eq_mul_left_iff, hexp, or_false]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ((fun x => ℚ) (exp ℚ ^ n))) (bernoulli n_1 / ↑n_1 !)) *
        PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) *
      (exp ((fun x => ℚ) (exp ℚ ^ n)) - 1) =
    (exp ℚ - 1) *
      PowerSeries.mk fun p =>
        ∑ x in range (p + 1), bernoulli x * ↑(Nat.choose (p + 1) x) * ↑(n ^ (p + 1 - x)) / ↑(p + 1)!

tactic: refine' Eq.trans (mul_eq_mul_right_iff.mpr _) (Eq.trans h_cauchy _)
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) *
      PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p =>
      ∑ x in range (p + 1), ↑(n ^ (p + 1 - x)) * (bernoulli x * ↑(Nat.choose (p + 1) x)) / ↑(p + 1)!

tactic: rw [← div_eq_iff (hne p), div_eq_mul_inv, sum_mul]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ k in range n, ↑k ^ p =
    (∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) * ↑p !

tactic: rw [PowerSeries.ext_iff] at this
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∑ x in range n, ↑x ^ p * (↑p !)⁻¹ =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: simpa using this p
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this✝ :
  (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
this :
  ∀ (n_1 : ℕ),
    ↑(coeff ℚ n_1) (PowerSeries.mk fun p => ∑ k in range n, ↑k ^ p * ↑(algebraMap ℚ ℚ) (↑p !)⁻¹) =
      ↑(coeff ℚ n_1)
        (PowerSeries.mk fun p =>
          ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!)
⊢ ∑ x in range n, ↑x ^ p * (↑p !)⁻¹ =
    ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!

tactic: simp only [exp, PowerSeries.ext_iff, Ne, not_forall]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ exp ℚ - 1 ≠ 0

tactic: use 1
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ∃ x, ¬↑(coeff ℚ x) ((PowerSeries.mk fun n => ↑(algebraMap ℚ ℚ) (1 / ↑n !)) - 1) = ↑(coeff ℚ x) 0

tactic: simp
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
⊢ ¬↑(coeff ℚ 1) ((PowerSeries.mk fun n => ↑(algebraMap ℚ ℚ) (1 / ↑n !)) - 1) = ↑(coeff ℚ 1) 0

tactic: have h_const : C ℚ (constantCoeff ℚ (exp ℚ ^ n)) = 1 := by simp
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)

tactic: rw [← h_const, sub_const_eq_X_mul_shift]
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_const : ↑(C ℚ) (↑(constantCoeff ℚ) (exp ℚ ^ n)) = 1
⊢ exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)

tactic: simp
state_before: A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
⊢ ↑(C ℚ) (↑(constantCoeff ℚ) (exp ℚ ^ n)) = 1

tactic: left
state_before: case refine'_1
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ ((PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) =
      PowerSeries.mk fun p => bernoulli p / ↑p !) ∨
    (PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)) = 0

tactic: congr
state_before: case refine'_1.h
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun n_1 => ↑(algebraMap ℚ ℚ) (bernoulli n_1 / ↑n_1 !)) = PowerSeries.mk fun p => bernoulli p / ↑p !

tactic: simp only [mul_comm, factorial, cast_succ, cast_pow]
state_before: case refine'_2
A : Type ?u.791691
inst✝¹ : CommRing A
inst✝ : Algebra ℚ A
n p : ℕ
hne : ∀ (m : ℕ), ↑m ! ≠ 0
h_cauchy :
  ((PowerSeries.mk fun p => bernoulli p / ↑p !) * PowerSeries.mk fun q => ↑(coeff ℚ (q + 1)) (exp ℚ ^ n)) =
    PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!
hexp : exp ℚ - 1 ≠ 0
h_r : exp ℚ ^ n - 1 = X * PowerSeries.mk fun p => ↑(coeff ℚ (p + 1)) (exp ℚ ^ n)
⊢ (PowerSeries.mk fun p => ∑ i in range (p + 1), bernoulli i * ↑(Nat.choose (p + 1) i) * ↑n ^ (p + 1 - i) / ↑(p + 1)!) =
    PowerSeries.mk fun p =>
      ∑ x in range (p + 1), ↑(n ^ (p + 1 - x)) * (bernoulli x * ↑(Nat.choose (p + 1) x)) / ↑(p + 1)!