Skip to content

Commit

Permalink
chore: positivity extension for the Gamma function (#7888)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrmacbeth committed Oct 24, 2023
1 parent 5fcd552 commit bf077b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean
Expand Up @@ -534,6 +534,26 @@ theorem Gamma_pos_of_pos {s : ℝ} (hs : 0 < s) : 0 < Gamma s := by
· exact GammaIntegral_convergent hs
#align real.Gamma_pos_of_pos Real.Gamma_pos_of_pos

theorem Gamma_nonneg_of_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ Gamma s := by
obtain rfl | h := eq_or_lt_of_le hs
· rw [Gamma_zero]
· exact (Gamma_pos_of_pos h).le

open Lean.Meta Qq in
/-- The `positivity` extension which identifies expressions of the form `Gamma a`. -/
@[positivity Gamma (_ : ℝ)]
def _root_.Mathlib.Meta.Positivity.evalGamma :
Mathlib.Meta.Positivity.PositivityExt where eval {_ _α} zα pα e := do
let (.app _ (a : Q($_α))) ← withReducible (whnf e) | throwError "not Gamma ·"
match ← Mathlib.Meta.Positivity.core zα pα a with
| .positive pa =>
let pa' ← mkAppM ``Gamma_pos_of_pos #[pa]
pure (.positive pa')
| .nonnegative pa =>
let pa' ← mkAppM ``Gamma_nonneg_of_nonneg #[pa]
pure (.nonnegative pa')
| _ => pure .none

/-- The Gamma function does not vanish on `ℝ` (except at non-positive integers, where the function
is mathematically undefined and we set it to `0` by convention). -/
theorem Gamma_ne_zero {s : ℝ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 := by
Expand Down

0 comments on commit bf077b1

Please sign in to comment.