state
stringlengths 0
159k
| srcUpToTactic
stringlengths 387
167k
| nextTactic
stringlengths 3
9k
| declUpToTactic
stringlengths 22
11.5k
| declId
stringlengths 38
95
| decl
stringlengths 16
1.89k
| file_tag
stringlengths 17
73
|
---|---|---|---|---|---|---|
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x,
((ContinuousLinearMap.mul β β) (β(rexp (-t_1)) * βt_1 ^ (s - 1)))
(β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
((ContinuousLinearMap.mul β β) (β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume))
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume)
β’ Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
| simp_rw [ContinuousLinearMap.mul_apply'] at conv_int | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
β’ Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
| have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
β’ 0 < (s + t).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by | rw [add_re] | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
β’ 0 < s.re + t.re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; | exact add_pos hs ht | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
β’ Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
| rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)] | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
β’ β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
β« (a : β) in Ioi 0, β(rexp (-a)) * βa ^ (s + t - 1) * betaIntegral s t | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
| refine' set_integral_congr measurableSet_Ioi fun x hx => _ | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
β’ β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) =
β(rexp (-x)) * βx ^ (s + t - 1) * betaIntegral s t | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
| rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul] | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
β’ β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) =
β« (x_1 : β) in 0 ..x, β(rexp (-x)) * (βx_1 ^ (s - 1) * (βx - βx_1) ^ (t - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
| congr 1 with y : 1 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ β(rexp (-y)) * βy ^ (s - 1) * (β(rexp (-(x - y))) * β(x - y) ^ (t - 1)) =
β(rexp (-x)) * (βy ^ (s - 1) * (βx - βy) ^ (t - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
| push_cast | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ cexp (-βy) * βy ^ (s - 1) * (cexp (-(βx - βy)) * (βx - βy) ^ (t - 1)) =
cexp (-βx) * (βy ^ (s - 1) * (βx - βy) ^ (t - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
| suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
this : cexp (-βx) = cexp (-βy) * cexp (-(βx - βy))
β’ cexp (-βy) * βy ^ (s - 1) * (cexp (-(βx - βy)) * (βx - βy) ^ (t - 1)) =
cexp (-βx) * (βy ^ (s - 1) * (βx - βy) ^ (t - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by | rw [this] | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
this : cexp (-βx) = cexp (-βy) * cexp (-(βx - βy))
β’ cexp (-βy) * βy ^ (s - 1) * (cexp (-(βx - βy)) * (βx - βy) ^ (t - 1)) =
cexp (-βy) * cexp (-(βx - βy)) * (βy ^ (s - 1) * (βx - βy) ^ (t - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; | ring | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ cexp (-βx) = cexp (-βy) * cexp (-(βx - βy)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· | rw [β Complex.exp_add] | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ cexp (-βx) = cexp (-βy + -(βx - βy)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; | congr 1 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h.e_z
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ -βx = -βy + -(βx - βy) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; | abel | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case e_f.h.e_z
s t : β
hs : 0 < s.re
ht : 0 < t.re
conv_int :
β« (x : β) in Ioi 0,
β« (t_1 : β) in 0 ..x, β(rexp (-t_1)) * βt_1 ^ (s - 1) * (β(rexp (-(x - t_1))) * β(x - t_1) ^ (t - 1)) βvolume =
(β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (s - 1) βvolume) * β« (x : β) in Ioi 0, β(rexp (-x)) * βx ^ (t - 1) βvolume
hst : 0 < (s + t).re
x : β
hx : x β Ioi 0
y : β
β’ -βx = -βy + -(βx - βy) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; | abel | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.134_0.in2QiCFW52coQT2 | /-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
| let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
| have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
β’ 0 < (u + 1).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by | rw [add_re, one_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
β’ 0 < u.re + 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; | positivity | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
| have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
β’ 0 < (v + 1).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by | rw [add_re, one_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
β’ 0 < v.re + 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; | positivity | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
| have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
β’ ContinuousOn F (Icc 0 1) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
| refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _) | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ ContinuousAt (fun x => βx ^ u) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· | refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ 0 β€ (βx).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
| rw [ofReal_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ 0 β€ x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; | exact hx.1 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ ContinuousAt (fun x => (1 - βx) ^ v) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· | refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ 0 β€ (1 - βx).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
| rw [sub_re, one_re, ofReal_re, sub_nonneg] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine'_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
x : β
hx : x β Icc 0 1
β’ x β€ 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
| exact hx.2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
| have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
β’ β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
| intro x hx | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
β’ HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
| have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
β’ HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
| have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_) | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
this : HasDerivAt (fun x => id x ^ u) (u * id βx ^ (u - 1) * 1) βx
β’ HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
β’ 0 < (id βx).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
| simp only [id_eq, mul_one] at this | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
this : HasDerivAt (fun x => x ^ u) (u * βx ^ (u - 1)) βx
β’ HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· | exact this | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
β’ 0 < (id βx).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· | rw [id_eq, ofReal_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
β’ 0 < x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; | exact hx.1 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
β’ HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
| have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
β’ HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
| have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_) | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => id x ^ v) (v * id (1 - βx) ^ (v - 1) * 1) (1 - βx)
β’ HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
β’ 0 < (id (1 - βx)).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
| swap | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
β’ 0 < (id (1 - βx)).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· | rw [id.def, sub_re, one_re, ofReal_re, sub_pos] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_1
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
β’ x < 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; | exact hx.2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => id x ^ v) (v * id (1 - βx) ^ (v - 1) * 1) (1 - βx)
β’ HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
| simp_rw [id.def] at A | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => x ^ v) (v * (1 - βx) ^ (v - 1) * 1) (1 - βx)
β’ HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
| have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => x ^ v) (v * (1 - βx) ^ (v - 1) * 1) (1 - βx)
β’ HasDerivAt (fun y => 1 - y) (-1) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
| apply HasDerivAt.const_sub | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case hf
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => x ^ v) (v * (1 - βx) ^ (v - 1) * 1) (1 - βx)
β’ HasDerivAt (fun x => x) 1 βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; | apply hasDerivAt_id | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case refine_2
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => x ^ v) (v * (1 - βx) ^ (v - 1) * 1) (1 - βx)
B : HasDerivAt (fun y => 1 - y) (-1) βx
β’ HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
| convert HasDerivAt.comp (βx) A B using 1 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_7
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
A : HasDerivAt (fun x => x ^ v) (v * (1 - βx) ^ (v - 1) * 1) (1 - βx)
B : HasDerivAt (fun y => 1 - y) (-1) βx
β’ -v * (1 - βx) ^ (v - 1) = v * (1 - βx) ^ (v - 1) * 1 * -1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
| ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
V : HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx
β’ HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
| convert (U.mul V).comp_ofReal using 1 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_7
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
x : β
hx : x β Ioo 0 1
U : HasDerivAt (fun y => y ^ u) (u * βx ^ (u - 1)) βx
V : HasDerivAt (fun y => (1 - y) ^ v) (-v * (1 - βx) ^ (v - 1)) βx
β’ u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1)) =
u * βx ^ (u - 1) * (1 - βx) ^ v + βx ^ u * (-v * (1 - βx) ^ (v - 1)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
| ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
| have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v) | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int :
IntervalIntegrable
(fun x => u * (βx ^ (u - 1) * (1 - βx) ^ (v + 1 - 1)) - v * (βx ^ (u + 1 - 1) * (1 - βx) ^ (v - 1))) volume 0 1
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
| rw [add_sub_cancel, add_sub_cancel] at h_int | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
| have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
| have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
β’ F 0 = 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
| simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
β’ Β¬u = 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
| contrapose! hu | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hu : u = 0
β’ u.re β€ 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; | rw [hu, zero_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hF0 : F 0 = 0
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
| have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hF0 : F 0 = 0
β’ F 1 = 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
| simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hF0 : F 0 = 0
β’ Β¬v = 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
| contrapose! hv | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hF0 : F 0 = 0
hv : v = 0
β’ v.re β€ 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; | rw [hv, zero_re] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = F 1 - F 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
| rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : (u * β« (x : β) in 0 ..1, βx ^ (u - 1) * (1 - βx) ^ v) - v * β« (x : β) in 0 ..1, βx ^ u * (1 - βx) ^ (v - 1) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· | rw [betaIntegral, betaIntegral, β sub_eq_zero] | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : (u * β« (x : β) in 0 ..1, βx ^ (u - 1) * (1 - βx) ^ v) - v * β« (x : β) in 0 ..1, βx ^ u * (1 - βx) ^ (v - 1) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ (u * β« (x : β) in 0 ..1, βx ^ (u - 1) * (1 - βx) ^ (v + 1 - 1)) -
v * β« (x : β) in 0 ..1, βx ^ (u + 1 - 1) * (1 - βx) ^ (v - 1) =
0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
| convert int_ev | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_2.h.e'_5.h.e'_6.h.e'_4.h.h.e'_6.h.e'_6
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : (u * β« (x : β) in 0 ..1, βx ^ (u - 1) * (1 - βx) ^ v) - v * β« (x : β) in 0 ..1, βx ^ u * (1 - βx) ^ (v - 1) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
xβ : β
β’ v + 1 - 1 = v | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> | ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_2.h.e'_6.h.e'_6.h.e'_4.h.h.e'_5.h.e'_6
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : (u * β« (x : β) in 0 ..1, βx ^ (u - 1) * (1 - βx) ^ v) - v * β« (x : β) in 0 ..1, βx ^ u * (1 - βx) ^ (v - 1) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
xβ : β
β’ u + 1 - 1 = u | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> | ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case hf
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ IntervalIntegrable (fun y => u * (βy ^ (u - 1) * (1 - βy) ^ v)) volume 0 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· | apply IntervalIntegrable.const_mul | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case hf.hf
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ IntervalIntegrable (fun x => βx ^ (u - 1) * (1 - βx) ^ v) volume 0 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
| convert betaIntegral_convergent hu hv' | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_3.h.h.e'_6.h.e'_6
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
xβ : β
β’ v = v + 1 - 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; | ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case hg
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ IntervalIntegrable (fun y => v * (βy ^ u * (1 - βy) ^ (v - 1))) volume 0 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· | apply IntervalIntegrable.const_mul | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case hg.hf
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
β’ IntervalIntegrable (fun x => βx ^ u * (1 - βx) ^ (v - 1)) volume 0 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
| convert betaIntegral_convergent hu' hv | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case h.e'_3.h.h.e'_5.h.e'_6
u v : β
hu : 0 < u.re
hv : 0 < v.re
F : β β β := fun x => βx ^ u * (1 - βx) ^ v
hu' : 0 < (u + 1).re
hv' : 0 < (v + 1).re
hc : ContinuousOn F (Icc 0 1)
hder : β x β Ioo 0 1, HasDerivAt F (u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) x
h_int : IntervalIntegrable (fun x => u * (βx ^ (u - 1) * (1 - βx) ^ v) - v * (βx ^ u * (1 - βx) ^ (v - 1))) volume 0 1
int_ev : β« (y : β) in 0 ..1, u * (βy ^ (u - 1) * (1 - βy) ^ v) - v * (βy ^ u * (1 - βy) ^ (v - 1)) = 0
hF0 : F 0 = 0
hF1 : F 1 = 0
xβ : β
β’ u = u + 1 - 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; | ring | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.153_0.in2QiCFW52coQT2 | /-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
u : β
hu : 0 < u.re
n : β
β’ betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
| induction' n with n IH generalizing u | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case zero
u : β
hu : 0 < u.re
β’ betaIntegral u (βNat.zero + 1) = βNat.zero ! / β j in Finset.range (Nat.zero + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· | rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case zero
u : β
hu : 0 < u.re
β’ 1 / u = 1 / β j in Finset.range (Nat.zero + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
| simp | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
β’ betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n)! / β j in Finset.range (Nat.succ n + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· | have := betaIntegral_recurrence hu (?_ : 0 < re n.succ) | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : u * betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n)
β’ betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n)! / β j in Finset.range (Nat.succ n + 1), (u + βj)
case succ.refine_1
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
β’ 0 < (β(Nat.succ n)).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
| swap | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_1
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
β’ 0 < (β(Nat.succ n)).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· | rw [β ofReal_nat_cast, ofReal_re] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_1
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
β’ 0 < β(Nat.succ n) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; | positivity | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : u * betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n)
β’ betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n)! / β j in Finset.range (Nat.succ n + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
| rw [mul_comm u _, β eq_div_iff] at this | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n)! / β j in Finset.range (Nat.succ n + 1), (u + βj)
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) * u = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n)
β’ u β 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
| swap | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) * u = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n)
β’ u β 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· | contrapose! hu | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
this : betaIntegral u (β(Nat.succ n) + 1) * u = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n)
hu : u = 0
β’ u.re β€ 0 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; | rw [hu, zero_re] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n)! / β j in Finset.range (Nat.succ n + 1), (u + βj) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
| rw [this, Finset.prod_range_succ', Nat.cast_succ, IH] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ (βn + 1) * (βn ! / β j in Finset.range (n + 1), (u + 1 + βj)) / u =
β(Nat.succ n)! / ((β k in Finset.range (n + 1), (u + β(k + 1))) * (u + β0))
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ 0 < (u + 1).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
| swap | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ 0 < (u + 1).re | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· | rw [add_re, one_re] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ 0 < u.re + 1 | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; | positivity | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ (βn + 1) * (βn ! / β j in Finset.range (n + 1), (u + 1 + βj)) / u =
β(Nat.succ n)! / ((β k in Finset.range (n + 1), (u + β(k + 1))) * (u + β0)) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
| rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div] | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
β’ ((βn + 1) * βn ! / β j in Finset.range (n + 1), (u + 1 + βj)) / u =
((βn + 1) * βn ! / β k in Finset.range (n + 1), (u + β(k + 1))) / u | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
| congr 3 with j : 1 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2.e_a.e_a.e_f.h
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
j : β
β’ u + 1 + βj = u + β(j + 1) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
| push_cast | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2.e_a.e_a.e_f.h
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
j : β
β’ u + 1 + βj = u + (βj + 1) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; | abel | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
case succ.refine_2.e_a.e_a.e_f.h
n : β
IH : β {u : β}, 0 < u.re β betaIntegral u (βn + 1) = βn ! / β j in Finset.range (n + 1), (u + βj)
u : β
hu : 0 < u.re
this : betaIntegral u (β(Nat.succ n) + 1) = β(Nat.succ n) * betaIntegral (u + 1) β(Nat.succ n) / u
j : β
β’ u + 1 + βj = u + (βj + 1) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; | abel | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.211_0.in2QiCFW52coQT2 | /-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
hs : 0 < s.re
n : β
β’ GammaSeq s n = βn ^ s * betaIntegral s (βn + 1) | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
| rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc] | theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.246_0.in2QiCFW52coQT2 | theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
n : β
hn : n β 0
β’ GammaSeq (s + 1) n / s = βn / (βn + 1 + s) * GammaSeq s n | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc]
#align complex.Gamma_seq_eq_beta_integral_of_re_pos Complex.GammaSeq_eq_betaIntegral_of_re_pos
theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
| conv_lhs => rw [GammaSeq, Finset.prod_range_succ, div_div] | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.251_0.in2QiCFW52coQT2 | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
n : β
hn : n β 0
| GammaSeq (s + 1) n / s | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc]
#align complex.Gamma_seq_eq_beta_integral_of_re_pos Complex.GammaSeq_eq_betaIntegral_of_re_pos
theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | rw [GammaSeq, Finset.prod_range_succ, div_div] | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.251_0.in2QiCFW52coQT2 | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
n : β
hn : n β 0
| GammaSeq (s + 1) n / s | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc]
#align complex.Gamma_seq_eq_beta_integral_of_re_pos Complex.GammaSeq_eq_betaIntegral_of_re_pos
theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | rw [GammaSeq, Finset.prod_range_succ, div_div] | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.251_0.in2QiCFW52coQT2 | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
n : β
hn : n β 0
| GammaSeq (s + 1) n / s | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc]
#align complex.Gamma_seq_eq_beta_integral_of_re_pos Complex.GammaSeq_eq_betaIntegral_of_re_pos
theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | rw [GammaSeq, Finset.prod_range_succ, div_div] | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => | Mathlib.Analysis.SpecialFunctions.Gamma.Beta.251_0.in2QiCFW52coQT2 | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
s : β
n : β
hn : n β 0
β’ βn ^ (s + 1) * βn ! / ((β x in Finset.range n, (s + 1 + βx)) * (s + 1 + βn) * s) = βn / (βn + 1 + s) * GammaSeq s n | /-
Copyright (c) 2023 David Loeffler. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: David Loeffler
-/
import Mathlib.Analysis.Convolution
import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
import Mathlib.Analysis.Analytic.IsolatedZeros
#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
/-!
# The Beta function, and further properties of the Gamma function
In this file we define the Beta integral, relate Beta and Gamma functions, and prove some
refined properties of the Gamma function using these relations.
## Results on the Beta function
* `Complex.betaIntegral`: the Beta function `Ξ(u, v)`, where `u`, `v` are complex with positive
real part.
* `Complex.Gamma_mul_Gamma_eq_betaIntegral`: the formula
`Gamma u * Gamma v = Gamma (u + v) * betaIntegral u v`.
## Results on the Gamma function
* `Complex.Gamma_ne_zero`: for all `s : β` with `s β {-n : n β β}` we have `Ξ s β 0`.
* `Complex.GammaSeq_tendsto_Gamma`: for all `s`, the limit as `n β β` of the sequence
`n β¦ n ^ s * n! / (s * (s + 1) * ... * (s + n))` is `Ξ(s)`.
* `Complex.Gamma_mul_Gamma_one_sub`: Euler's reflection formula
`Gamma s * Gamma (1 - s) = Ο / sin Ο s`.
* `Complex.differentiable_one_div_Gamma`: the function `1 / Ξ(s)` is differentiable everywhere.
* `Complex.Gamma_mul_Gamma_add_half`: Legendre's duplication formula
`Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt Ο`.
* `Real.Gamma_ne_zero`, `Real.GammaSeq_tendsto_Gamma`,
`Real.Gamma_mul_Gamma_one_sub`, `Real.Gamma_mul_Gamma_add_half`: real versions of the above.
-/
noncomputable section
set_option linter.uppercaseLean3 false
open Filter intervalIntegral Set Real MeasureTheory
open scoped Nat Topology BigOperators Real
section BetaIntegral
/-! ## The Beta function -/
namespace Complex
/-- The Beta function `Ξ (u, v)`, defined as `β« x:β in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
noncomputable def betaIntegral (u v : β) : β :=
β« x : β in (0)..1, (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)
#align complex.beta_integral Complex.betaIntegral
/-- Auxiliary lemma for `betaIntegral_convergent`, showing convergence at the left endpoint. -/
theorem betaIntegral_convergent_left {u : β} (hu : 0 < re u) (v : β) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 (1 / 2) := by
apply IntervalIntegrable.mul_continuousOn
Β· refine' intervalIntegral.intervalIntegrable_cpow' _
rwa [sub_re, one_re, β zero_sub, sub_lt_sub_iff_right]
Β· apply ContinuousAt.continuousOn
intro x hx
rw [uIcc_of_le (by positivity : (0 : β) β€ 1 / 2)] at hx
apply ContinuousAt.cpow
Β· exact (continuous_const.sub continuous_ofReal).continuousAt
Β· exact continuousAt_const
Β· rw [sub_re, one_re, ofReal_re, sub_pos]
exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : β) < 1))
#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
/-- The Beta integral is convergent for all `u, v` of positive real part. -/
theorem betaIntegral_convergent {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
IntervalIntegrable (fun x =>
(x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1) : β β β) volume 0 1 := by
refine' (betaIntegral_convergent_left hu v).trans _
rw [IntervalIntegrable.iff_comp_neg]
convert ((betaIntegral_convergent_left hv u).comp_add_right 1).symm using 1
Β· ext1 x
conv_lhs => rw [mul_comm]
congr 2 <;> Β· push_cast; ring
Β· norm_num
Β· norm_num
#align complex.beta_integral_convergent Complex.betaIntegral_convergent
theorem betaIntegral_symm (u v : β) : betaIntegral v u = betaIntegral u v := by
rw [betaIntegral, betaIntegral]
have := intervalIntegral.integral_comp_mul_add (a := 0) (b := 1) (c := -1)
(fun x : β => (x : β) ^ (u - 1) * (1 - (x : β)) ^ (v - 1)) neg_one_lt_zero.ne 1
rw [inv_neg, inv_one, neg_one_smul, β intervalIntegral.integral_symm] at this
simp? at this says
simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel'', neg_neg,
mul_one, add_left_neg, mul_zero, zero_add] at this
conv_lhs at this => arg 1; intro x; rw [add_comm, β sub_eq_add_neg, mul_comm]
exact this
#align complex.beta_integral_symm Complex.betaIntegral_symm
theorem betaIntegral_eval_one_right {u : β} (hu : 0 < re u) : betaIntegral u 1 = 1 / u := by
simp_rw [betaIntegral, sub_self, cpow_zero, mul_one]
rw [integral_cpow (Or.inl _)]
Β· rw [ofReal_zero, ofReal_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
rw [sub_add_cancel]
contrapose! hu; rw [hu, zero_re]
Β· rwa [sub_re, one_re, β sub_pos, sub_neg_eq_add, sub_add_cancel]
#align complex.beta_integral_eval_one_right Complex.betaIntegral_eval_one_right
theorem betaIntegral_scaled (s t : β) {a : β} (ha : 0 < a) :
β« x in (0)..a, (x : β) ^ (s - 1) * ((a : β) - x) ^ (t - 1) =
(a : β) ^ (s + t - 1) * betaIntegral s t := by
have ha' : (a : β) β 0 := ofReal_ne_zero.mpr ha.ne'
rw [betaIntegral]
have A : (a : β) ^ (s + t - 1) = a * ((a : β) ^ (s - 1) * (a : β) ^ (t - 1)) := by
rw [(by abel : s + t - 1 = 1 + (s - 1) + (t - 1)), cpow_add _ _ ha', cpow_add 1 _ ha', cpow_one,
mul_assoc]
rw [A, mul_assoc, β intervalIntegral.integral_const_mul, β real_smul, β zero_div a, β
div_self ha.ne', β intervalIntegral.integral_comp_div _ ha.ne', zero_div]
simp_rw [intervalIntegral.integral_of_le ha.le]
refine' set_integral_congr measurableSet_Ioc fun x hx => _
rw [mul_mul_mul_comm]
congr 1
Β· rw [β mul_cpow_ofReal_nonneg ha.le (div_pos hx.1 ha).le, ofReal_div, mul_div_cancel' _ ha']
Β· rw [(by norm_cast : (1 : β) - β(x / a) = β(1 - x / a)), β
mul_cpow_ofReal_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
push_cast
rw [mul_sub, mul_one, mul_div_cancel' _ ha']
#align complex.beta_integral_scaled Complex.betaIntegral_scaled
/-- Relation between Beta integral and Gamma function. -/
theorem Gamma_mul_Gamma_eq_betaIntegral {s t : β} (hs : 0 < re s) (ht : 0 < re t) :
Gamma s * Gamma t = Gamma (s + t) * betaIntegral s t := by
-- Note that we haven't proved (yet) that the Gamma function has no zeroes, so we can't formulate
-- this as a formula for the Beta function.
have conv_int := integral_posConvolution
(GammaIntegral_convergent hs) (GammaIntegral_convergent ht) (ContinuousLinearMap.mul β β)
simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
have hst : 0 < re (s + t) := by rw [add_re]; exact add_pos hs ht
rw [Gamma_eq_integral hs, Gamma_eq_integral ht, Gamma_eq_integral hst, GammaIntegral,
GammaIntegral, GammaIntegral, β conv_int, β integral_mul_right (betaIntegral _ _)]
refine' set_integral_congr measurableSet_Ioi fun x hx => _
rw [mul_assoc, β betaIntegral_scaled s t hx, β intervalIntegral.integral_const_mul]
congr 1 with y : 1
push_cast
suffices Complex.exp (-x) = Complex.exp (-y) * Complex.exp (-(x - y)) by rw [this]; ring
Β· rw [β Complex.exp_add]; congr 1; abel
#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
/-- Recurrence formula for the Beta function. -/
theorem betaIntegral_recurrence {u v : β} (hu : 0 < re u) (hv : 0 < re v) :
u * betaIntegral u (v + 1) = v * betaIntegral (u + 1) v := by
-- NB: If we knew `Gamma (u + v + 1) β 0` this would be an easy consequence of
-- `Gamma_mul_Gamma_eq_betaIntegral`; but we don't know that yet. We will prove it later, but
-- this lemma is needed in the proof. So we give a (somewhat laborious) direct argument.
let F : β β β := fun x => (x : β) ^ u * (1 - (x : β)) ^ v
have hu' : 0 < re (u + 1) := by rw [add_re, one_re]; positivity
have hv' : 0 < re (v + 1) := by rw [add_re, one_re]; positivity
have hc : ContinuousOn F (Icc 0 1) := by
refine' (ContinuousAt.continuousOn fun x hx => _).mul (ContinuousAt.continuousOn fun x hx => _)
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_ofReal.continuousAt
rw [ofReal_re]; exact hx.1
Β· refine' (continuousAt_cpow_const_of_re_pos (Or.inl _) hv).comp
(continuous_const.sub continuous_ofReal).continuousAt
rw [sub_re, one_re, ofReal_re, sub_nonneg]
exact hx.2
have hder : β x : β, x β Ioo (0 : β) 1 β
HasDerivAt F (u * ((x : β) ^ (u - 1) * (1 - (x : β)) ^ v) -
v * ((x : β) ^ u * (1 - (x : β)) ^ (v - 1))) x := by
intro x hx
have U : HasDerivAt (fun y : β => y ^ u) (u * (x : β) ^ (u - 1)) βx := by
have := @HasDerivAt.cpow_const _ _ _ u (hasDerivAt_id (x : β)) (Or.inl ?_)
simp only [id_eq, mul_one] at this
Β· exact this
Β· rw [id_eq, ofReal_re]; exact hx.1
have V : HasDerivAt (fun y : β => (1 - y) ^ v) (-v * (1 - (x : β)) ^ (v - 1)) βx := by
have A := @HasDerivAt.cpow_const _ _ _ v (hasDerivAt_id (1 - (x : β))) (Or.inl ?_)
swap; Β· rw [id.def, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
simp_rw [id.def] at A
have B : HasDerivAt (fun y : β => 1 - y) (-1) βx := by
apply HasDerivAt.const_sub; apply hasDerivAt_id
convert HasDerivAt.comp (βx) A B using 1
ring
convert (U.mul V).comp_ofReal using 1
ring
have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
((betaIntegral_convergent hu' hv).const_mul v)
rw [add_sub_cancel, add_sub_cancel] at h_int
have int_ev := intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le zero_le_one hc hder h_int
have hF0 : F 0 = 0 := by
simp only [mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def, true_and_iff,
sub_zero, one_cpow, one_ne_zero, or_false_iff]
contrapose! hu; rw [hu, zero_re]
have hF1 : F 1 = 0 := by
simp only [mul_eq_zero, ofReal_one, one_cpow, one_ne_zero, sub_self, cpow_eq_zero_iff,
eq_self_iff_true, Ne.def, true_and_iff, false_or_iff]
contrapose! hv; rw [hv, zero_re]
rw [hF0, hF1, sub_zero, intervalIntegral.integral_sub, intervalIntegral.integral_const_mul,
intervalIntegral.integral_const_mul] at int_ev
Β· rw [betaIntegral, betaIntegral, β sub_eq_zero]
convert int_ev <;> ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu hv'; ring
Β· apply IntervalIntegrable.const_mul
convert betaIntegral_convergent hu' hv; ring
#align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
/-- Explicit formula for the Beta function when second argument is a positive integer. -/
theorem betaIntegral_eval_nat_add_one_right {u : β} (hu : 0 < re u) (n : β) :
betaIntegral u (n + 1) = n ! / β j : β in Finset.range (n + 1), (u + j) := by
induction' n with n IH generalizing u
Β· rw [Nat.cast_zero, zero_add, betaIntegral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one]
simp
Β· have := betaIntegral_recurrence hu (?_ : 0 < re n.succ)
swap; Β· rw [β ofReal_nat_cast, ofReal_re]; positivity
rw [mul_comm u _, β eq_div_iff] at this
swap; Β· contrapose! hu; rw [hu, zero_re]
rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
swap; Β· rw [add_re, one_re]; positivity
rw [Nat.factorial_succ, Nat.cast_mul, Nat.cast_add, Nat.cast_one, Nat.cast_zero, add_zero, β
mul_div_assoc, β div_div]
congr 3 with j : 1
push_cast; abel
#align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
end Complex
end BetaIntegral
section LimitFormula
/-! ## The Euler limit formula -/
namespace Complex
/-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for complex `s`.
We will show that this tends to `Ξ(s)` as `n β β`. -/
noncomputable def GammaSeq (s : β) (n : β) :=
(n : β) ^ s * n ! / β j : β in Finset.range (n + 1), (s + j)
#align complex.Gamma_seq Complex.GammaSeq
theorem GammaSeq_eq_betaIntegral_of_re_pos {s : β} (hs : 0 < re s) (n : β) :
GammaSeq s n = (n : β) ^ s * betaIntegral s (n + 1) := by
rw [GammaSeq, betaIntegral_eval_nat_add_one_right hs n, β mul_div_assoc]
#align complex.Gamma_seq_eq_beta_integral_of_re_pos Complex.GammaSeq_eq_betaIntegral_of_re_pos
theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => rw [GammaSeq, Finset.prod_range_succ, div_div]
| conv_rhs =>
rw [GammaSeq, Finset.prod_range_succ', Nat.cast_zero, add_zero, div_mul_div_comm, β mul_assoc,
β mul_assoc, mul_comm _ (Finset.prod _ _)] | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n := by
conv_lhs => rw [GammaSeq, Finset.prod_range_succ, div_div]
| Mathlib.Analysis.SpecialFunctions.Gamma.Beta.251_0.in2QiCFW52coQT2 | theorem GammaSeq_add_one_left (s : β) {n : β} (hn : n β 0) :
GammaSeq (s + 1) n / s = n / (n + 1 + s) * GammaSeq s n | Mathlib_Analysis_SpecialFunctions_Gamma_Beta |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.