l3lab/ntp-mathlib huggingface dataset:
/-- Asymptotic bound for the `Γ` function integrand. -/
theorem Gamma_integrand_isLittleO (s : ℝ) :
    (fun x : ℝ => exp (-x) * x ^ s) =o[atTop] fun x : ℝ => exp (-(1 / 2) * x) := by
  refine' isLittleO_of_tendsto (fun x hx => _) _
  · exfalso; exact (exp_pos (-(1 / 2) * x)).ne' hx
  have : (fun x : ℝ => exp (-x) * x ^ s / exp (-(1 / 2) * x)) =
      (fun x : ℝ => exp (1 / 2 * x) / x ^ s)⁻¹ := by
    ext1 x
    field_simp [exp_ne_zero, exp_neg, ← Real.exp_add]
    left
    ring
  rw [this]
  

Proof state:
case refine'_2
s : ℝ
this : (fun x => rexp (-x) * x ^ s / rexp (-(1 / 2) * x)) = (fun x => rexp (1 / 2 * x) / x ^ s)⁻¹
⊢ Tendsto (fun x => rexp (1 / 2 * x) / x ^ s)⁻¹ atTop (𝓝 0)

Next tactic:
exact (tendsto_exp_mul_div_rpow_atTop s (1 / 2) one_half_pos).inv_tendsto_atTop
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  

Proof state:
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Ioi 0)

Next tactic:
rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  

Proof state:
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Ioc 0 1) ∧ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Ioi 1)

Next tactic:
constructor
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · 

Proof state:
case left
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Ioc 0 1)

Next tactic:
rw [← integrableOn_Icc_iff_integrableOn_Ioc]
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    

Proof state:
case left
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Icc 0 1)

Next tactic:
refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    

Proof state:
case left
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => x ^ (s - 1)) (Icc 0 1)

Next tactic:
refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    

Proof state:
case left
s : ℝ
h : 0 < s
⊢ IntervalIntegrable (fun x => x ^ (s - 1)) volume 0 1

Next tactic:
exact intervalIntegrable_rpow' (by linarith)
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    exact intervalIntegrable_rpow' (by 

Proof state:
s : ℝ
h : 0 < s
⊢ -1 < s - 1

Next tactic:
linarith
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    exact intervalIntegrable_rpow' (by linarith)
  · 

Proof state:
case right
s : ℝ
h : 0 < s
⊢ IntegrableOn (fun x => rexp (-x) * x ^ (s - 1)) (Ioi 1)

Next tactic:
refine' integrable_of_isBigO_exp_neg one_half_pos _ (Gamma_integrand_isLittleO _).isBigO
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    exact intervalIntegrable_rpow' (by linarith)
  · refine' integrable_of_isBigO_exp_neg one_half_pos _ (Gamma_integrand_isLittleO _).isBigO
    

Proof state:
case right
s : ℝ
h : 0 < s
⊢ ContinuousOn (fun x => rexp (-x) * x ^ (s - 1)) (Ici 1)

Next tactic:
refine' continuousOn_id.neg.exp.mul (continuousOn_id.rpow_const _)
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    exact intervalIntegrable_rpow' (by linarith)
  · refine' integrable_of_isBigO_exp_neg one_half_pos _ (Gamma_integrand_isLittleO _).isBigO
    refine' continuousOn_id.neg.exp.mul (continuousOn_id.rpow_const _)
    

Proof state:
case right
s : ℝ
h : 0 < s
⊢ ∀ x ∈ Ici 1, id x ≠ 0 ∨ 0 ≤ s - 1

Next tactic:
intro x hx
/-- The Euler integral for the `Γ` function converges for positive real `s`. -/
theorem GammaIntegral_convergent {s : ℝ} (h : 0 < s) :
    IntegrableOn (fun x : ℝ => exp (-x) * x ^ (s - 1)) (Ioi 0) := by
  rw [← Ioc_union_Ioi_eq_Ioi (@zero_le_one ℝ _ _ _ _), integrableOn_union]
  constructor
  · rw [← integrableOn_Icc_iff_integrableOn_Ioc]
    refine' IntegrableOn.continuousOn_mul continuousOn_id.neg.exp _ isCompact_Icc
    refine' (intervalIntegrable_iff_integrableOn_Icc_of_le zero_le_one).mp _
    exact intervalIntegrable_rpow' (by linarith)
  · refine' integrable_of_isBigO_exp_neg one_half_pos _ (Gamma_integrand_isLittleO _).isBigO
    refine' continuousOn_id.neg.exp.mul (continuousOn_id.rpow_const _)
    intro x hx
    

Proof state:
case right
s : ℝ
h : 0 < s
x : ℝ
hx : x ∈ Ici 1
⊢ id x ≠ 0 ∨ 0 ≤ s - 1

Next tactic:
exact Or.inl ((zero_lt_one : (0 : ℝ) < 1).trans_le hx).ne'
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  

Proof state:
s : ℂ
hs : 0 < s.re
⊢ IntegrableOn (fun x => ↑(rexp (-x)) * ↑x ^ (s - 1)) (Ioi 0)

Next tactic:
constructor
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · 

Proof state:
case left
s : ℂ
hs : 0 < s.re
⊢ AEStronglyMeasurable (fun x => ↑(rexp (-x)) * ↑x ^ (s - 1)) (Measure.restrict volume (Ioi 0))

Next tactic:
refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    

Proof state:
case left
s : ℂ
hs : 0 < s.re
⊢ ContinuousOn (fun x => ↑(rexp (-x)) * ↑x ^ (s - 1)) (Ioi 0)

Next tactic:
apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    

Proof state:
case left
s : ℂ
hs : 0 < s.re
⊢ ContinuousOn (fun x => ↑x ^ (s - 1)) (Ioi 0)

Next tactic:
apply ContinuousAt.continuousOn
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    

Proof state:
case left.hcont
s : ℂ
hs : 0 < s.re
⊢ ∀ x ∈ Ioi 0, ContinuousAt (fun x => ↑x ^ (s - 1)) x

Next tactic:
intro x hx
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    

Proof state:
case left.hcont
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ ContinuousAt (fun x => ↑x ^ (s - 1)) x

Next tactic:
have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      

Proof state:
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ ContinuousAt (fun x => x ^ (s - 1)) ↑x

Next tactic:
apply continuousAt_cpow_const
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; 

Proof state:
case ha
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ 0 < (↑x).re ∨ (↑x).im ≠ 0

Next tactic:
rw [ofReal_re]
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; 

Proof state:
case ha
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ 0 < x ∨ (↑x).im ≠ 0

Next tactic:
exact Or.inl hx
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    

Proof state:
case left.hcont
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
this : ContinuousAt (fun x => x ^ (s - 1)) ↑x
⊢ ContinuousAt (fun x => ↑x ^ (s - 1)) x

Next tactic:
exact ContinuousAt.comp this continuous_ofReal.continuousAt
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · 

Proof state:
case right
s : ℂ
hs : 0 < s.re
⊢ HasFiniteIntegral fun x => ↑(rexp (-x)) * ↑x ^ (s - 1)

Next tactic:
rw [← hasFiniteIntegral_norm_iff]
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · rw [← hasFiniteIntegral_norm_iff]
    

Proof state:
case right
s : ℂ
hs : 0 < s.re
⊢ HasFiniteIntegral fun a => ‖↑(rexp (-a)) * ↑a ^ (s - 1)‖

Next tactic:
refine' HasFiniteIntegral.congr (Real.GammaIntegral_convergent hs).2 _
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · rw [← hasFiniteIntegral_norm_iff]
    refine' HasFiniteIntegral.congr (Real.GammaIntegral_convergent hs).2 _
    

Proof state:
case right
s : ℂ
hs : 0 < s.re
⊢ (fun x => rexp (-x) * x ^ (s.re - 1)) =ᵐ[Measure.restrict volume (Ioi 0)] fun a => ‖↑(rexp (-a)) * ↑a ^ (s - 1)‖

Next tactic:
refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · rw [← hasFiniteIntegral_norm_iff]
    refine' HasFiniteIntegral.congr (Real.GammaIntegral_convergent hs).2 _
    refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
    

Proof state:
case right
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ (fun x => rexp (-x) * x ^ (s.re - 1)) x = (fun a => ‖↑(rexp (-a)) * ↑a ^ (s - 1)‖) x

Next tactic:
dsimp only
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · rw [← hasFiniteIntegral_norm_iff]
    refine' HasFiniteIntegral.congr (Real.GammaIntegral_convergent hs).2 _
    refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
    dsimp only
    

Proof state:
case right
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ rexp (-x) * x ^ (s.re - 1) = ‖↑(rexp (-x)) * ↑x ^ (s - 1)‖

Next tactic:
rw [norm_eq_abs, map_mul, abs_of_nonneg <| le_of_lt <| exp_pos <| -x,
      abs_cpow_eq_rpow_re_of_pos hx _]
/-- The integral defining the `Γ` function converges for complex `s` with `0 < re s`.

This is proved by reduction to the real case. -/
theorem GammaIntegral_convergent {s : ℂ} (hs : 0 < s.re) :
    IntegrableOn (fun x => (-x).exp * x ^ (s - 1) : ℝ → ℂ) (Ioi 0) := by
  constructor
  · refine' ContinuousOn.aestronglyMeasurable _ measurableSet_Ioi
    apply (continuous_ofReal.comp continuous_neg.exp).continuousOn.mul
    apply ContinuousAt.continuousOn
    intro x hx
    have : ContinuousAt (fun x : ℂ => x ^ (s - 1)) ↑x := by
      apply continuousAt_cpow_const; rw [ofReal_re]; exact Or.inl hx
    exact ContinuousAt.comp this continuous_ofReal.continuousAt
  · rw [← hasFiniteIntegral_norm_iff]
    refine' HasFiniteIntegral.congr (Real.GammaIntegral_convergent hs).2 _
    refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
    dsimp only
    rw [norm_eq_abs, map_mul, abs_of_nonneg <| le_of_lt <| exp_pos <| -x,
      abs_cpow_eq_rpow_re_of_pos hx _]
    

Proof state:
case right
s : ℂ
hs : 0 < s.re
x : ℝ
hx : x ∈ Ioi 0
⊢ rexp (-x) * x ^ (s.re - 1) = rexp (-x) * x ^ (s - 1).re

Next tactic:
simp
theorem GammaIntegral_conj (s : ℂ) : GammaIntegral (conj s) = conj (GammaIntegral s) := by
  

Proof state:
s : ℂ
⊢ GammaIntegral ((starRingEnd ℂ) s) = (starRingEnd ℂ) (GammaIntegral s)

Next tactic:
rw [GammaIntegral, GammaIntegral, ← integral_conj]
theorem GammaIntegral_conj (s : ℂ) : GammaIntegral (conj s) = conj (GammaIntegral s) := by
  rw [GammaIntegral, GammaIntegral, ← integral_conj]
  

Proof state:
s : ℂ
⊢ ∫ (x : ℝ) in Ioi 0, ↑(rexp (-x)) * ↑x ^ ((starRingEnd ℂ) s - 1) =
    ∫ (a : ℝ) in Ioi 0, (starRingEnd ℂ) (↑(rexp (-a)) * ↑a ^ (s - 1))

Next tactic:
refine' set_integral_congr measurableSet_Ioi fun x hx => _
theorem GammaIntegral_conj (s : ℂ) : GammaIntegral (conj s) = conj (GammaIntegral s) := by
  rw [GammaIntegral, GammaIntegral, ← integral_conj]
  refine' set_integral_congr measurableSet_Ioi fun x hx => _
  

Proof state:
s : ℂ
x : ℝ
hx : x ∈ Ioi 0
⊢ ↑(rexp (-x)) * ↑x ^ ((starRingEnd ℂ) s - 1) = (starRingEnd ℂ) (↑(rexp (-x)) * ↑x ^ (s - 1))

Next tactic:
dsimp only
theorem GammaIntegral_conj (s : ℂ) : GammaIntegral (conj s) = conj (GammaIntegral s) := by
  rw [GammaIntegral, GammaIntegral, ← integral_conj]
  refine' set_integral_congr measurableSet_Ioi fun x hx => _
  dsimp only
  

Proof state:
s : ℂ
x : ℝ
hx : x ∈ Ioi 0
⊢ ↑(rexp (-x)) * ↑x ^ ((starRingEnd ℂ) s - 1) = (starRingEnd ℂ) (↑(rexp (-x)) * ↑x ^ (s - 1))

Next tactic:
rw [RingHom.map_mul, conj_ofReal, cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)),
    cpow_def_of_ne_zero (ofReal_ne_zero.mpr (ne_of_gt hx)), ← exp_conj, RingHom.map_mul, ←
    ofReal_log (le_of_lt hx), conj_ofReal, RingHom.map_sub, RingHom.map_one]
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  

Proof state:
s : ℝ
⊢ GammaIntegral ↑s = ↑(∫ (x : ℝ) in Ioi 0, rexp (-x) * x ^ (s - 1))

Next tactic:
have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
  

Proof state:
s : ℝ
this : ∀ (r : ℝ), ↑r = ↑r
⊢ GammaIntegral ↑s = ↑(∫ (x : ℝ) in Ioi 0, rexp (-x) * x ^ (s - 1))

Next tactic:
rw [GammaIntegral]
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
  rw [GammaIntegral]
  

Proof state:
s : ℝ
this : ∀ (r : ℝ), ↑r = ↑r
⊢ ∫ (x : ℝ) in Ioi 0, ↑(rexp (-x)) * ↑x ^ (↑s - 1) = ↑(∫ (x : ℝ) in Ioi 0, rexp (-x) * x ^ (s - 1))

Next tactic:
conv_rhs => rw [this, ← _root_.integral_ofReal]
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
  rw [GammaIntegral]
  conv_rhs => 

Proof state:
s : ℝ
this : ∀ (r : ℝ), ↑r = ↑r
| ↑(∫ (x : ℝ) in Ioi 0, rexp (-x) * x ^ (s - 1))

Next tactic:
rw [this, ← _root_.integral_ofReal]
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
  rw [GammaIntegral]
  conv_rhs => rw [this, ← _root_.integral_ofReal]
  

Proof state:
s : ℝ
this : ∀ (r : ℝ), ↑r = ↑r
⊢ ∫ (x : ℝ) in Ioi 0, ↑(rexp (-x)) * ↑x ^ (↑s - 1) = ∫ (a : ℝ) in Ioi 0, ↑(rexp (-a) * a ^ (s - 1))

Next tactic:
refine' set_integral_congr measurableSet_Ioi _
theorem GammaIntegral_ofReal (s : ℝ) :
    GammaIntegral ↑s = ↑(∫ x : ℝ in Ioi 0, Real.exp (-x) * x ^ (s - 1)) := by
  have : ∀ r : ℝ, Complex.ofReal' r = @IsROrC.ofReal ℂ _ r := fun r => rfl
  rw [GammaIntegral]
  conv_rhs => rw [this, ← _root_.integral_ofReal]
  refine' set_integral_congr measurableSet_Ioi _
  

Proof state:
s : ℝ
this : ∀ (r : ℝ), ↑r = ↑r
⊢ EqOn (fun x => ↑(rexp (-x)) * ↑x ^ (↑s - 1)) (fun a => ↑(rexp (-a) * a ^ (s - 1))) (Ioi 0)

Next tactic:
intro x hx