Theorem: Real.BohrMollerup.logGammaSeq_add_one
File: Mathlib/Analysis/SpecialFunctions/Gamma/BohrMollerup.lean

tactic: dsimp only [Nat.factorial_succ, logGammaSeq]
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ logGammaSeq (x + 1) n = logGammaSeq x (n + 1) + log x - (x + 1) * (log (↑n + 1) - log ↑n)
state_after: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + log ↑((n + 1) * n !) - ∑ m ∈ Finset.range (n + 1 + 1), log (x + ↑m) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

tactic: conv_rhs => rw [Finset.sum_range_succ', Nat.cast_zero, add_zero]
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + log ↑((n + 1) * n !) - ∑ m ∈ Finset.range (n + 1 + 1), log (x + ↑m) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)
state_after: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + log ↑((n + 1) * n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

tactic: rw [Nat.cast_mul, log_mul]
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + log ↑((n + 1) * n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)
state_after: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑(n + 1) ≠ 0

case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑n ! ≠ 0

tactic: rotate_left
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑(n + 1) ≠ 0

case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑n ! ≠ 0
state_after: case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑(n + 1) ≠ 0

case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑n ! ≠ 0

f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

tactic: have :
  ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) := by
  congr! 2 with m
  push_cast
  abel
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)
state_after: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
this : ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) = ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1))
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

tactic: rw [← this, Nat.cast_add_one n]
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
this : ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) = ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1))
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log ↑(n + 1) + (log ↑(n + 1) + log ↑n !) - (∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1)) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)
state_after: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
this : ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) = ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1))
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log (↑n + 1) + (log (↑n + 1) + log ↑n !) - (∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)

tactic: ring
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
this : ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) = ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1))
⊢ (x + 1) * log ↑n + log ↑n ! - ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) =
    x * log (↑n + 1) + (log (↑n + 1) + log ↑n !) - (∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) + log x) + log x -
      (x + 1) * (log (↑n + 1) - log ↑n)
state_after: no goals

tactic: rw [Nat.cast_ne_zero]
state_before: case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑(n + 1) ≠ 0
state_after: case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ n + 1 ≠ 0

tactic: exact Nat.succ_ne_zero n
state_before: case hx
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ n + 1 ≠ 0
state_after: no goals

tactic: rw [Nat.cast_ne_zero]
state_before: case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ↑n ! ≠ 0
state_after: case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ n ! ≠ 0

tactic: exact Nat.factorial_ne_zero n
state_before: case hy
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ n ! ≠ 0
state_after: no goals

tactic: congr! 2 with m
state_before: f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n : ℕ
⊢ ∑ m ∈ Finset.range (n + 1), log (x + 1 + ↑m) = ∑ k ∈ Finset.range (n + 1), log (x + ↑(k + 1))
state_after: case a.h.e'_1
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n m : ℕ
a✝ : m ∈ Finset.range (n + 1)
⊢ x + 1 + ↑m = x + ↑(m + 1)

tactic: push_cast
state_before: case a.h.e'_1
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n m : ℕ
a✝ : m ∈ Finset.range (n + 1)
⊢ x + 1 + ↑m = x + ↑(m + 1)
state_after: case a.h.e'_1
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n m : ℕ
a✝ : m ∈ Finset.range (n + 1)
⊢ x + 1 + ↑m = x + (↑m + 1)

tactic: abel
state_before: case a.h.e'_1
f : ℝ → ℝ
x✝ : ℝ
n✝ : ℕ
x : ℝ
n m : ℕ
a✝ : m ∈ Finset.range (n + 1)
⊢ x + 1 + ↑m = x + (↑m + 1)
state_after: no goals