Skip to content

Commit bf077b1

Browse files
committed
chore: positivity extension for the Gamma function (#7888)
1 parent 5fcd552 commit bf077b1

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,26 @@ theorem Gamma_pos_of_pos {s : ℝ} (hs : 0 < s) : 0 < Gamma s := by
534534
· exact GammaIntegral_convergent hs
535535
#align real.Gamma_pos_of_pos Real.Gamma_pos_of_pos
536536

537+
theorem Gamma_nonneg_of_nonneg {s : ℝ} (hs : 0 ≤ s) : 0 ≤ Gamma s := by
538+
obtain rfl | h := eq_or_lt_of_le hs
539+
· rw [Gamma_zero]
540+
· exact (Gamma_pos_of_pos h).le
541+
542+
open Lean.Meta Qq in
543+
/-- The `positivity` extension which identifies expressions of the form `Gamma a`. -/
544+
@[positivity Gamma (_ : ℝ)]
545+
def _root_.Mathlib.Meta.Positivity.evalGamma :
546+
Mathlib.Meta.Positivity.PositivityExt where eval {_ _α} zα pα e := do
547+
let (.app _ (a : Q($_α))) ← withReducible (whnf e) | throwError "not Gamma ·"
548+
match ← Mathlib.Meta.Positivity.core zα pα a with
549+
| .positive pa =>
550+
let pa' ← mkAppM ``Gamma_pos_of_pos #[pa]
551+
pure (.positive pa')
552+
| .nonnegative pa =>
553+
let pa' ← mkAppM ``Gamma_nonneg_of_nonneg #[pa]
554+
pure (.nonnegative pa')
555+
| _ => pure .none
556+
537557
/-- The Gamma function does not vanish on `ℝ` (except at non-positive integers, where the function
538558
is mathematically undefined and we set it to `0` by convention). -/
539559
theorem Gamma_ne_zero {s : ℝ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 := by

0 commit comments

Comments
 (0)