-- Mathlib/Analysis/SpecialFunctions/Gamma/Beta.lean
theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
    Tendsto (fun n : ℕ => ∫ x : ℝ in (0)..n, ((1 - x / n) ^ n : ℝ) * (x : ℂ) ^ (s - 1)) atTop
      (𝓝 <| Gamma s)

Proof state:
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
⊢ ∀ᵐ (x : ℝ), x ∈ Ioi 0 → ‖f n x‖ ≤ rexp (-x) * x ^ (s.re - 1)

Tactic:
filter_upwards with x hx

Result:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
x : ℝ
hx : x ∈ Ioi 0
⊢ ‖f n x‖ ≤ rexp (-x) * x ^ (s.re - 1)

Proof state:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
n : ℕ
hn : x ≤ ↑n
⊢ ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = (Ioc 0 ↑n).indicator (fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)) x

Tactic:
rw [indicator_of_mem]

Result:
case h.h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
n : ℕ
hn : x ≤ ↑n
⊢ x ∈ Ioc 0 ↑n

Proof state:
case hl
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ ?f₁ =ᶠ[atTop] fun n => f n x

Tactic:
show ∀ᶠ n : ℕ in atTop, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x

Result:
case hl
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ ∀ᶠ (n : ℕ) in atTop, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = f n x

Proof state:
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
x : ℝ
hx : x ∈ Ioi 0
hxn : x ≤ ↑n
⊢ 0 ≤ ↑n

Tactic:
positivity

Result:
no goals

Proof state:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ Tendsto (fun x_1 => (1 - x / ↑x_1) ^ x_1) atTop (𝓝 (rexp (-x)))

Tactic:
convert tendsto_one_plus_div_pow_exp (-x) using 1

Result:
case h.e'_3
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ (fun x_1 => (1 - x / ↑x_1) ^ x_1) = fun x_1 => (1 + -x / ↑x_1) ^ x_1

Proof state:
case hl
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ ∀ᶠ (n : ℕ) in atTop, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = f n x

Tactic:
filter_upwards [eventually_ge_atTop ⌈x⌉₊] with n hn

Result:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
n : ℕ
hn : ⌈x⌉₊ ≤ n
⊢ ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = f n x

Proof state:
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
⊢ Tendsto (fun n => ∫ (x : ℝ) in 0 ..↑n, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)) atTop (𝓝 s.GammaIntegral)

Tactic:
convert tendsto_integral_of_dominated_convergence _ (fun n => (f_ible n).1)
  (Real.GammaIntegral_convergent hs) _
  ((ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ f_tends)) using 1

Result:
case h.e'_3
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
⊢ (fun n => ∫ (x : ℝ) in 0 ..↑n, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)) = fun n => ∫ (a : ℝ) in Ioi 0, f n a

s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
⊢ ∀ (n : ℕ), ∀ᵐ (a : ℝ) ∂volume.restrict (Ioi 0), ‖f n a‖ ≤ rexp (-a) * a ^ (s.re - 1)

Proof state:
case h.inl
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
x : ℝ
hx : x ∈ Ioi 0
hxn : ↑n < x
⊢ 0 ≤ x ^ (s.re - 1)

Tactic:
exact rpow_nonneg (le_of_lt hx) _

Result:
no goals

Proof state:
case h.e'_3
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
⊢ (fun n => ∫ (x : ℝ) in 0 ..↑n, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)) = fun n => ∫ (a : ℝ) in Ioi 0, f n a

Tactic:
ext1 n

Result:
case h.e'_3.h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
⊢ ∫ (x : ℝ) in 0 ..↑n, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = ∫ (a : ℝ) in Ioi 0, f n a

Proof state:
case h.e'_3.h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
f_tends : ∀ x ∈ Ioi 0, Tendsto (fun n => f n x) atTop (𝓝 (↑(rexp (-x)) * ↑x ^ (s - 1)))
n : ℕ
⊢ ∫ (x : ℝ) in 0 ..↑n, ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1) = ∫ (a : ℝ) in Ioi 0, f n a

Tactic:
rw [MeasureTheory.integral_indicator (measurableSet_Ioc : MeasurableSet (Ioc (_ : ℝ) _)),
  intervalIntegral.integral_of_le (by positivity : 0 ≤ (n : ℝ)),
  Measure.restrict_restrict_of_subset Ioc_subset_Ioi_self]

Result:
no goals

Proof state:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ Tendsto (fun x_1 => ↑x ^ (s - 1) * ↑((1 - x / ↑x_1) ^ x_1)) atTop (𝓝 (↑x ^ (s - 1) * ↑(rexp (-x))))

Tactic:
refine (Tendsto.comp (continuous_ofReal.tendsto _) ?_).const_mul _

Result:
case h
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
f_ible : ∀ (n : ℕ), Integrable (f n) (volume.restrict (Ioi 0))
x : ℝ
hx : x ∈ Ioi 0
⊢ Tendsto (fun x_1 => (1 - x / ↑x_1) ^ x_1) atTop (𝓝 (rexp (-x)))

Proof state:
s : ℂ
hs : 0 < s.re
f : ℕ → ℝ → ℂ := fun n => (Ioc 0 ↑n).indicator fun x => ↑((1 - x / ↑n) ^ n) * ↑x ^ (s - 1)
n : ℕ
⊢ 0 ≤ ↑n

Tactic:
positivity

Result:
no goals