Skip to content

Commit d34f0e9

Browse files
committed
chore: add basic @[simp]s for Gamma (#7977)
I don't personally have any need for these. It just seemed like these would make the API more complete.
1 parent 761f297 commit d34f0e9

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Mathlib/Analysis/SpecialFunctions/Gamma/Basic.lean

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ theorem GammaIntegral_ofReal (s : ℝ) :
142142
simp
143143
#align complex.Gamma_integral_of_real Complex.GammaIntegral_ofReal
144144

145+
@[simp]
145146
theorem GammaIntegral_one : GammaIntegral 1 = 1 := by
146147
simpa only [← ofReal_one, GammaIntegral_ofReal, ofReal_inj, sub_self, rpow_zero,
147148
mul_one] using integral_exp_neg_Ioi_zero
@@ -340,17 +341,24 @@ theorem Gamma_eq_integral {s : ℂ} (hs : 0 < s.re) : Gamma s = GammaIntegral s
340341
Gamma_eq_GammaAux s 0 (by norm_cast; linarith)
341342
#align complex.Gamma_eq_integral Complex.Gamma_eq_integral
342343

343-
theorem Gamma_one : Gamma 1 = 1 := by rw [Gamma_eq_integral]; simpa using GammaIntegral_one; simp
344+
@[simp]
345+
theorem Gamma_one : Gamma 1 = 1 := by rw [Gamma_eq_integral]; simp; simp
344346
#align complex.Gamma_one Complex.Gamma_one
345347

346348
theorem Gamma_nat_eq_factorial (n : ℕ) : Gamma (n + 1) = n ! := by
347349
induction' n with n hn
348-
· simpa using Gamma_one
350+
· simp
349351
· rw [Gamma_add_one n.succ <| Nat.cast_ne_zero.mpr <| Nat.succ_ne_zero n]
350352
simp only [Nat.cast_succ, Nat.factorial_succ, Nat.cast_mul]; congr
351353
#align complex.Gamma_nat_eq_factorial Complex.Gamma_nat_eq_factorial
352354

355+
@[simp]
356+
theorem Gamma_ofNat_eq_factorial (n : ℕ) [(n + 1).AtLeastTwo] :
357+
Gamma (no_index (OfNat.ofNat (n + 1) : ℂ)) = n ! := by
358+
exact_mod_cast Gamma_nat_eq_factorial (n : ℕ)
359+
353360
/-- At `0` the Gamma function is undefined; by convention we assign it the value `0`. -/
361+
@[simp]
354362
theorem Gamma_zero : Gamma 0 = 0 := by
355363
simp_rw [Gamma, zero_re, sub_zero, Nat.floor_one, GammaAux, div_zero]
356364
#align complex.Gamma_zero Complex.Gamma_zero
@@ -493,6 +501,7 @@ theorem Gamma_add_one {s : ℝ} (hs : s ≠ 0) : Gamma (s + 1) = s * Gamma s :=
493501
rwa [Complex.ofReal_ne_zero]
494502
#align real.Gamma_add_one Real.Gamma_add_one
495503

504+
@[simp]
496505
theorem Gamma_one : Gamma 1 = 1 := by
497506
rw [Gamma, Complex.ofReal_one, Complex.Gamma_one, Complex.one_re]
498507
#align real.Gamma_one Real.Gamma_one
@@ -506,7 +515,13 @@ theorem Gamma_nat_eq_factorial (n : ℕ) : Gamma (n + 1) = n ! := by
506515
Complex.Gamma_nat_eq_factorial, ← Complex.ofReal_nat_cast, Complex.ofReal_re]
507516
#align real.Gamma_nat_eq_factorial Real.Gamma_nat_eq_factorial
508517

518+
@[simp]
519+
theorem Gamma_ofNat_eq_factorial (n : ℕ) [(n + 1).AtLeastTwo] :
520+
Gamma (no_index (OfNat.ofNat (n + 1) : ℝ)) = n ! := by
521+
exact_mod_cast Gamma_nat_eq_factorial (n : ℕ)
522+
509523
/-- At `0` the Gamma function is undefined; by convention we assign it the value `0`. -/
524+
@[simp]
510525
theorem Gamma_zero : Gamma 0 = 0 := by
511526
simpa only [← Complex.ofReal_zero, Complex.Gamma_ofReal, Complex.ofReal_inj] using
512527
Complex.Gamma_zero

Mathlib/Analysis/SpecialFunctions/Gamma/BohrMollerup.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ end BohrMollerup
397397
-- (section)
398398
section StrictMono
399399

400-
theorem Gamma_two : Gamma 2 = 1 := by
401-
simpa [one_add_one_eq_two, Nat.factorial] using Gamma_nat_eq_factorial 1
400+
theorem Gamma_two : Gamma 2 = 1 := by simp [Nat.factorial_one]
402401
#align real.Gamma_two Real.Gamma_two
403402

404403
theorem Gamma_three_div_two_lt_one : Gamma (3 / 2) < 1 := by

0 commit comments

Comments
 (0)