analysis.special_functions.gamma.betaMathlib.Analysis.SpecialFunctions.Gamma.Beta

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -585,7 +585,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℝ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
   ext1 n
   dsimp only [Gamma_seq, Function.comp_apply, Complex.GammaSeq]
   push_cast
-  rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_nat_cast]
+  rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_natCast]
 #align real.Gamma_seq_tendsto_Gamma Real.GammaSeq_tendsto_Gamma
 -/
 
Diff
@@ -444,7 +444,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
     conv at this in _ / _ * _ => rw [mul_comm]
     rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
     simp_rw [add_assoc]
-    exact tendsto_coe_nat_div_add_atTop (1 + s)
+    exact tendsto_natCast_div_add_atTop (1 + s)
 #align complex.Gamma_seq_tendsto_Gamma Complex.GammaSeq_tendsto_Gamma
 -/
 
@@ -510,7 +510,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
     tendsto.congr'
       ((eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => (Gamma_seq_mul z hn).symm))
       (tendsto.mul _ _)
-  · convert tendsto_coe_nat_div_add_atTop (1 - z); ext1 n; rw [add_sub_assoc]
+  · convert tendsto_natCast_div_add_atTop (1 - z); ext1 n; rw [add_sub_assoc]
   · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp; rw [this]
     refine' tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
     rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel₀ _ pi_ne]
Diff
@@ -500,7 +500,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
       neg_eq_iff_eq_neg] at hk
     rw [hk]
     cases k
-    · rw [Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
+    · rw [Int.cast_natCast, Complex.Gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
     ·
       rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel_left,
         Complex.Gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
Diff
@@ -140,11 +140,11 @@ theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
   dsimp only
   rw [mul_mul_mul_comm]
   congr 1
-  · rw [← mul_cpow_of_real_nonneg ha.le (div_pos hx.1 ha).le, of_real_div, mul_div_cancel' _ ha']
+  · rw [← mul_cpow_of_real_nonneg ha.le (div_pos hx.1 ha).le, of_real_div, mul_div_cancel₀ _ ha']
   · rw [(by push_cast : (1 : ℂ) - ↑(x / a) = ↑(1 - x / a)), ←
       mul_cpow_of_real_nonneg ha.le (sub_nonneg.mpr <| (div_le_one ha).mpr hx.2)]
     push_cast
-    rw [mul_sub, mul_one, mul_div_cancel' _ ha']
+    rw [mul_sub, mul_one, mul_div_cancel₀ _ ha']
 #align complex.beta_integral_scaled Complex.betaIntegral_scaled
 -/
 
@@ -221,7 +221,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     ((beta_integral_convergent hu hv').const_mul u).sub
       ((beta_integral_convergent hu' hv).const_mul v)
   dsimp only at h_int
-  rw [add_sub_cancel, add_sub_cancel] at h_int
+  rw [add_sub_cancel_right, add_sub_cancel_right] 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
@@ -239,10 +239,10 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     convert int_ev <;> · ext1 x; congr; abel
   · apply IntervalIntegrable.const_mul
     convert beta_integral_convergent hu hv'
-    ext1 x; rw [add_sub_cancel]
+    ext1 x; rw [add_sub_cancel_right]
   · apply IntervalIntegrable.const_mul
     convert beta_integral_convergent hu' hv
-    ext1 x; rw [add_sub_cancel]
+    ext1 x; rw [add_sub_cancel_right]
 #align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
 -/
 
@@ -314,7 +314,7 @@ theorem GammaSeq_add_one_left (s : ℂ) {n : ℕ} (hn : n ≠ 0) :
 theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (hn : n ≠ 0) :
     GammaSeq s n = ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) :=
   by
-  have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel]; exact nat.cast_ne_zero.mpr hn
+  have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel₀]; exact nat.cast_ne_zero.mpr hn
   conv in ↑_ ^ _ =>
     congr
     rw [this x]
@@ -322,7 +322,7 @@ theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
   rw [beta_integral,
     @intervalIntegral.integral_comp_div _ _ _ _ 0 n _
       (fun x => ↑((1 - x) ^ n) * ↑(x * ↑n) ^ (s - 1) : ℝ → ℂ) (nat.cast_ne_zero.mpr hn),
-    real_smul, zero_div, div_self, add_sub_cancel, ← intervalIntegral.integral_const_mul, ←
+    real_smul, zero_div, div_self, add_sub_cancel_right, ← intervalIntegral.integral_const_mul, ←
     intervalIntegral.integral_const_mul]
   swap; · exact nat.cast_ne_zero.mpr hn
   simp_rw [intervalIntegral.integral_of_le zero_le_one]
@@ -468,7 +468,7 @@ theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros; ring
   rw [Gamma_seq, Gamma_seq, div_mul_div_comm, aux, ← pow_two]
   have : (n : ℂ) ^ z * n ^ (1 - z) = n := by
-    rw [← cpow_add _ _ (nat.cast_ne_zero.mpr hn), add_sub_cancel'_right, cpow_one]
+    rw [← cpow_add _ _ (nat.cast_ne_zero.mpr hn), add_sub_cancel, cpow_one]
   rw [this, Finset.prod_range_succ', Finset.prod_range_succ, aux, ← Finset.prod_mul_distrib,
     Nat.cast_zero, add_zero, add_comm (1 - z) n, ← add_sub_assoc]
   have : ∀ j : ℕ, (z + ↑(j + 1)) * (1 - z + ↑j) = ↑((j + 1) ^ 2) * (1 - z ^ 2 / (↑j + 1) ^ 2) :=
@@ -481,7 +481,7 @@ theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   rw [Finset.prod_mul_distrib, ← Nat.cast_prod, Finset.prod_pow,
     Finset.prod_range_add_one_eq_factorial, Nat.cast_pow,
     (by intros; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
-    mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
+    mul_div_cancel_right₀, ← div_div, mul_comm z _, mul_one_div]
   exact pow_ne_zero 2 (nat.cast_ne_zero.mpr <| Nat.factorial_ne_zero n)
 #align complex.Gamma_seq_mul Complex.GammaSeq_mul
 -/
@@ -502,7 +502,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
     cases k
     · rw [Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
     ·
-      rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel',
+      rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel_left,
         Complex.Gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
   refine' tendsto_nhds_unique ((Gamma_seq_tendsto_Gamma z).mul (Gamma_seq_tendsto_Gamma <| 1 - z)) _
   have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]; rw [this]
@@ -513,7 +513,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
   · convert tendsto_coe_nat_div_add_atTop (1 - z); ext1 n; rw [add_sub_assoc]
   · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp; rw [this]
     refine' tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
-    rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel _ pi_ne]
+    rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel₀ _ pi_ne]
     convert tendsto_euler_sin_prod z
     ext1 n; rw [mul_comm, ← mul_assoc]
 #align complex.Gamma_mul_Gamma_one_sub Complex.Gamma_mul_Gamma_one_sub
Diff
@@ -73,7 +73,7 @@ theorem betaIntegral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
     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 
+    rw [uIcc_of_le (by positivity : (0 : ℝ) ≤ 1 / 2)] at hx
     apply ContinuousAt.cpow
     · exact (continuous_const.sub continuous_of_real).ContinuousAt
     · exact continuousAt_const
@@ -105,7 +105,7 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
   have :=
     intervalIntegral.integral_comp_mul_add (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 
+  rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this
   convert this
   · ext1 x; rw [mul_comm]; congr <;> · push_cast; ring
   · ring; · ring
@@ -158,7 +158,7 @@ theorem Gamma_mul_Gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   have conv_int :=
     integral_posConvolution (Gamma_integral_convergent hs) (Gamma_integral_convergent ht)
       (ContinuousLinearMap.mul ℝ ℂ)
-  simp_rw [ContinuousLinearMap.mul_apply'] at conv_int 
+  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, Gamma_integral,
     Gamma_integral, Gamma_integral, ← conv_int, ← integral_mul_right (beta_integral _ _)]
@@ -203,14 +203,14 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     have U : HasDerivAt (fun y : ℂ => y ^ u) (u * ↑x ^ (u - 1)) ↑x :=
       by
       have := HasDerivAt.cpow_const (hasDerivAt_id ↑x) (Or.inl _)
-      · rw [mul_one] at this ; exact this
+      · rw [mul_one] at this; exact this
       · rw [id.def, of_real_re]; exact hx.1
     have V : HasDerivAt (fun y : ℂ => (1 - y) ^ v) (-v * (1 - ↑x) ^ (v - 1)) ↑x :=
       by
       have A := HasDerivAt.cpow_const (hasDerivAt_id (1 - ↑x)) (Or.inl _)
       rotate_left; · exact v
       · rw [id.def, sub_re, one_re, of_real_re, sub_pos]; exact hx.2
-      simp_rw [id.def] at A 
+      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
@@ -220,8 +220,8 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   have h_int :=
     ((beta_integral_convergent hu hv').const_mul u).sub
       ((beta_integral_convergent hu' hv).const_mul v)
-  dsimp only at h_int 
-  rw [add_sub_cancel, add_sub_cancel] at h_int 
+  dsimp only at h_int
+  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
@@ -234,7 +234,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
       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 
+    intervalIntegral.integral_const_mul] at int_ev
   · rw [beta_integral, beta_integral, ← sub_eq_zero]
     convert int_ev <;> · ext1 x; congr; abel
   · apply IntervalIntegrable.const_mul
@@ -257,7 +257,7 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
       zero_add, Finset.prod_range_one, Nat.cast_zero, add_zero]
   · have := beta_integral_recurrence hu (_ : 0 < re n.succ)
     swap; · rw [← of_real_nat_cast, of_real_re]; positivity
-    rw [mul_comm u _, ← eq_div_iff] at this 
+    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
@@ -373,7 +373,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     apply tendsto.congr'
     show ∀ᶠ n : ℕ in at_top, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
     · refine' eventually.mp (eventually_ge_at_top ⌈x⌉₊) (eventually_of_forall fun n hn => _)
-      rw [Nat.ceil_le] at hn 
+      rw [Nat.ceil_le] at hn
       dsimp only [f]
       rw [indicator_of_mem]
       exact ⟨hx, hn⟩
@@ -426,7 +426,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
   induction' m with m IH generalizing s
   · -- Base case: `0 < re s`, so Gamma is given by the integral formula
     intro hs
-    rw [Nat.cast_zero, neg_zero] at hs 
+    rw [Nat.cast_zero, neg_zero] at hs
     rw [← Gamma_eq_Gamma_aux]
     · refine' tendsto.congr' _ (approx_Gamma_integral_tendsto_Gamma_integral hs)
       refine' (eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => _)
@@ -434,7 +434,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
     · rwa [Nat.cast_zero, neg_lt_zero]
   · -- Induction step: use recurrence formulae in `s` for Gamma and Gamma_seq
     intro hs
-    rw [Nat.cast_succ, neg_add, ← sub_eq_add_neg, sub_lt_iff_lt_add, ← one_re, ← add_re] at hs 
+    rw [Nat.cast_succ, neg_add, ← sub_eq_add_neg, sub_lt_iff_lt_add, ← one_re, ← add_re] at hs
     rw [Gamma_aux]
     have :=
       tendsto.congr' ((eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => _))
@@ -442,7 +442,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
     pick_goal 3; · exact Gamma_seq_add_one_left s hn
     -- doesn't work if inlined?
     conv at this in _ / _ * _ => rw [mul_comm]
-    rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this 
+    rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
     simp_rw [add_assoc]
     exact tendsto_coe_nat_div_add_atTop (1 + s)
 #align complex.Gamma_seq_tendsto_Gamma Complex.GammaSeq_tendsto_Gamma
@@ -494,10 +494,10 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
   by_cases hs : sin (↑π * z) = 0
   · -- first deal with silly case z = integer
     rw [hs, div_zero]
-    rw [← neg_eq_zero, ← Complex.sin_neg, ← mul_neg, Complex.sin_eq_zero_iff, mul_comm] at hs 
+    rw [← neg_eq_zero, ← Complex.sin_neg, ← mul_neg, Complex.sin_eq_zero_iff, mul_comm] at hs
     obtain ⟨k, hk⟩ := hs
     rw [mul_eq_mul_right_iff, eq_false (of_real_ne_zero.mpr pi_pos.ne'), or_false_iff,
-      neg_eq_iff_eq_neg] at hk 
+      neg_eq_iff_eq_neg] at hk
     rw [hk]
     cases k
     · rw [Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
@@ -539,7 +539,7 @@ theorem Gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
       rw [of_real_mul_im, ← of_real_int_cast, ← of_real_mul, of_real_im]
       exact mul_ne_zero real.pi_pos.ne' h_im
     have A := div_ne_zero (of_real_ne_zero.mpr real.pi_pos.ne') this
-    rw [← Complex.Gamma_mul_Gamma_one_sub s, mul_ne_zero_iff] at A 
+    rw [← Complex.Gamma_mul_Gamma_one_sub s, mul_ne_zero_iff] at A
     exact A.1
 #align complex.Gamma_ne_zero Complex.Gamma_ne_zero
 -/
@@ -639,7 +639,7 @@ theorem differentiable_one_div_Gamma : Differentiable ℂ fun s : ℂ => (Gamma
   intro n
   induction' n with m hm
   · intro s hs
-    rw [Nat.cast_zero, neg_lt_zero] at hs 
+    rw [Nat.cast_zero, neg_lt_zero] at hs
     suffices : ∀ m : ℕ, s ≠ -↑m; exact (differentiable_at_Gamma _ this).inv (Gamma_ne_zero this)
     contrapose! hs
     rcases hs with ⟨m, rfl⟩
Diff
@@ -358,7 +358,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     intro n
     rw [integrable_indicator_iff (measurableSet_Ioc : MeasurableSet (Ioc (_ : ℝ) _)), integrable_on,
       measure.restrict_restrict_of_subset Ioc_subset_Ioi_self, ← integrable_on, ←
-      intervalIntegrable_iff_integrable_Ioc_of_le (by positivity : (0 : ℝ) ≤ n)]
+      intervalIntegrable_iff_integrableOn_Ioc_of_le (by positivity : (0 : ℝ) ≤ n)]
     apply IntervalIntegrable.continuousOn_mul
     · refine' intervalIntegral.intervalIntegrable_cpow' _
       rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
Diff
@@ -92,7 +92,7 @@ theorem betaIntegral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   convert ((beta_integral_convergent_left hv u).comp_add_right 1).symm
   · ext1 x
     conv_lhs => rw [mul_comm]
-    congr 2 <;> · push_cast ; ring
+    congr 2 <;> · push_cast; ring
   · norm_num
   · norm_num
 #align complex.beta_integral_convergent Complex.betaIntegral_convergent
@@ -107,7 +107,7 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
       neg_one_lt_zero.ne 1
   rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this 
   convert this
-  · ext1 x; rw [mul_comm]; congr <;> · push_cast ; ring
+  · ext1 x; rw [mul_comm]; congr <;> · push_cast; ring
   · ring; · ring
 #align complex.beta_integral_symm Complex.betaIntegral_symm
 -/
@@ -264,7 +264,7 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
     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
+    push_cast; abel
 #align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
 -/
 
@@ -305,7 +305,7 @@ theorem GammaSeq_add_one_left (s : ℂ) {n : ℕ} (hn : n ≠ 0) :
   congr 3
   · rw [cpow_add _ _ (nat.cast_ne_zero.mpr hn), cpow_one, mul_comm]
   · refine' Finset.prod_congr (by rfl) fun x hx => _
-    push_cast ; ring
+    push_cast; ring
   · abel
 #align complex.Gamma_seq_add_one_left Complex.GammaSeq_add_one_left
 -/
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2023 David Loeffler. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
 -/
-import Mathbin.Analysis.Convolution
-import Mathbin.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
-import Mathbin.Analysis.SpecialFunctions.Gamma.BohrMollerup
-import Mathbin.Analysis.Analytic.IsolatedZeros
+import Analysis.Convolution
+import Analysis.SpecialFunctions.Trigonometric.EulerSineProd
+import Analysis.SpecialFunctions.Gamma.BohrMollerup
+import Analysis.Analytic.IsolatedZeros
 
 #align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2023 David Loeffler. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
-
-! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Convolution
 import Mathbin.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
 import Mathbin.Analysis.SpecialFunctions.Gamma.BohrMollerup
 import Mathbin.Analysis.Analytic.IsolatedZeros
 
+#align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"9240e8be927a0955b9a82c6c85ef499ee3a626b8"
+
 /-!
 # The Beta function, and further properties of the Gamma function
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
 
 ! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit a3209ddf94136d36e5e5c624b10b2a347cc9d090
+! leanprover-community/mathlib commit 9240e8be927a0955b9a82c6c85ef499ee3a626b8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.Analysis.Analytic.IsolatedZeros
 /-!
 # The Beta function, and further properties of the Gamma function
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 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.
 
Diff
@@ -56,13 +56,16 @@ namespace Complex
 
 notation "cexp" => Complex.exp
 
+#print Complex.betaIntegral /-
 /-- 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
+-/
 
+#print Complex.betaIntegral_convergent_left /-
 /-- Auxiliary lemma for `beta_integral_convergent`, showing convergence at the left endpoint. -/
-theorem beta_integral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
+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
@@ -76,10 +79,12 @@ theorem beta_integral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
     · exact continuousAt_const
     · rw [sub_re, one_re, of_real_re, sub_pos]
       exact Or.inl (hx.2.trans_lt (by norm_num : (1 / 2 : ℝ) < 1))
-#align complex.beta_integral_convergent_left Complex.beta_integral_convergent_left
+#align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
+-/
 
+#print Complex.betaIntegral_convergent /-
 /-- The Beta integral is convergent for all `u, v` of positive real part. -/
-theorem beta_integral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
+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' (beta_integral_convergent_left hu v).trans _
@@ -90,8 +95,10 @@ theorem beta_integral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     congr 2 <;> · push_cast ; ring
   · norm_num
   · norm_num
-#align complex.beta_integral_convergent Complex.beta_integral_convergent
+#align complex.beta_integral_convergent Complex.betaIntegral_convergent
+-/
 
+#print Complex.betaIntegral_symm /-
 theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
   by
   rw [beta_integral, beta_integral]
@@ -103,7 +110,9 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
   · ext1 x; rw [mul_comm]; congr <;> · push_cast ; ring
   · ring; · ring
 #align complex.beta_integral_symm Complex.betaIntegral_symm
+-/
 
+#print Complex.betaIntegral_eval_one_right /-
 theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1 = 1 / u :=
   by
   simp_rw [beta_integral, sub_self, cpow_zero, mul_one]
@@ -113,7 +122,9 @@ theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1
     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
+-/
 
+#print Complex.betaIntegral_scaled /-
 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
@@ -135,9 +146,11 @@ theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
     push_cast
     rw [mul_sub, mul_one, mul_div_cancel' _ ha']
 #align complex.beta_integral_scaled Complex.betaIntegral_scaled
+-/
 
+#print Complex.Gamma_mul_Gamma_eq_betaIntegral /-
 /-- Relation between Beta integral and Gamma function.  -/
-theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re t) :
+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
@@ -156,8 +169,10 @@ theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   push_cast
   suffices cexp (-x) = cexp (-y) * cexp (-(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
+#align complex.Gamma_mul_Gamma_eq_beta_integral Complex.Gamma_mul_Gamma_eq_betaIntegral
+-/
 
+#print Complex.betaIntegral_recurrence /-
 /-- 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 :=
@@ -229,7 +244,9 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     convert beta_integral_convergent hu' hv
     ext1 x; rw [add_sub_cancel]
 #align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
+-/
 
+#print Complex.betaIntegral_eval_nat_add_one_right /-
 /-- 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) :=
@@ -249,6 +266,7 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
     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
 
@@ -261,19 +279,24 @@ section LimitFormula
 
 namespace Complex
 
+#print Complex.GammaSeq /-
 /-- 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 : ℕ) :=
+noncomputable def GammaSeq (s : ℂ) (n : ℕ) :=
   (n : ℂ) ^ s * n ! / ∏ j : ℕ in Finset.range (n + 1), (s + j)
-#align complex.Gamma_seq Complex.gammaSeq
+#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
+#print Complex.GammaSeq_eq_betaIntegral_of_re_pos /-
+theorem GammaSeq_eq_betaIntegral_of_re_pos {s : ℂ} (hs : 0 < re s) (n : ℕ) :
+    GammaSeq s n = n ^ s * betaIntegral s (n + 1) := by
   rw [Gamma_seq, beta_integral_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
+#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 :=
+#print Complex.GammaSeq_add_one_left /-
+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 [Gamma_seq, Finset.prod_range_succ, div_div]
   conv_rhs =>
@@ -284,10 +307,12 @@ theorem gammaSeq_add_one_left (s : ℂ) {n : ℕ} (hn : n ≠ 0) :
   · refine' Finset.prod_congr (by rfl) fun x hx => _
     push_cast ; ring
   · abel
-#align complex.Gamma_seq_add_one_left Complex.gammaSeq_add_one_left
+#align complex.Gamma_seq_add_one_left Complex.GammaSeq_add_one_left
+-/
 
-theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (hn : n ≠ 0) :
-    gammaSeq s n = ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) :=
+#print Complex.GammaSeq_eq_approx_Gamma_integral /-
+theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (hn : n ≠ 0) :
+    GammaSeq s n = ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) :=
   by
   have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel]; exact nat.cast_ne_zero.mpr hn
   conv in ↑_ ^ _ =>
@@ -312,11 +337,13 @@ theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
     rw [← of_real_nat_cast,
       mul_cpow_of_real_nonneg hx.1.le (nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).le]
   rw [A, B, cpow_nat_cast]; ring
-#align complex.Gamma_seq_eq_approx_Gamma_integral Complex.gammaSeq_eq_approx_Gamma_integral
+#align complex.Gamma_seq_eq_approx_Gamma_integral Complex.GammaSeq_eq_approx_Gamma_integral
+-/
 
+#print Complex.approx_Gamma_integral_tendsto_Gamma_integral /-
 /-- The main techical lemma for `Gamma_seq_tendsto_Gamma`, expressing the integral defining the
 Gamma function for `0 < re s` as the limit of a sequence of integrals over finite intervals. -/
-theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
+theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     Tendsto (fun n : ℕ => ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1)) atTop
       (𝓝 <| Gamma s) :=
   by
@@ -379,10 +406,12 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
         Complex.norm_eq_abs, abs_cpow_eq_rpow_re_of_pos hx, sub_re, one_re,
         mul_le_mul_right (rpow_pos_of_pos hx _)]
       exact one_sub_div_pow_le_exp_neg hxn
-#align complex.approx_Gamma_integral_tendsto_Gamma_integral Complex.approx_gamma_integral_tendsto_gamma_integral
+#align complex.approx_Gamma_integral_tendsto_Gamma_integral Complex.approx_Gamma_integral_tendsto_Gamma_integral
+-/
 
+#print Complex.GammaSeq_tendsto_Gamma /-
 /-- Euler's limit formula for the complex Gamma function. -/
-theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| Gamma s) :=
+theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| Gamma s) :=
   by
   suffices ∀ m : ℕ, -↑m < re s → tendsto (Gamma_seq s) at_top (𝓝 <| Gamma_aux m s)
     by
@@ -416,7 +445,8 @@ theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| G
     rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this 
     simp_rw [add_assoc]
     exact tendsto_coe_nat_div_add_atTop (1 + s)
-#align complex.Gamma_seq_tendsto_Gamma Complex.gammaSeq_tendsto_gamma
+#align complex.Gamma_seq_tendsto_Gamma Complex.GammaSeq_tendsto_Gamma
+-/
 
 end Complex
 
@@ -429,8 +459,9 @@ section GammaReflection
 
 namespace Complex
 
-theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
-    gammaSeq z n * gammaSeq (1 - z) n =
+#print Complex.GammaSeq_mul /-
+theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
+    GammaSeq z n * GammaSeq (1 - z) n =
       n / (n + 1 - z) * (1 / (z * ∏ j in Finset.range n, (1 - z ^ 2 / (j + 1) ^ 2))) :=
   by
   -- also true for n = 0 but we don't need it
@@ -452,10 +483,12 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
     (by intros; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
     mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
   exact pow_ne_zero 2 (nat.cast_ne_zero.mpr <| Nat.factorial_ne_zero n)
-#align complex.Gamma_seq_mul Complex.gammaSeq_mul
+#align complex.Gamma_seq_mul Complex.GammaSeq_mul
+-/
 
+#print Complex.Gamma_mul_Gamma_one_sub /-
 /-- Euler's reflection formula for the complex Gamma function. -/
-theorem gamma_mul_gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (π * z) :=
+theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (π * z) :=
   by
   have pi_ne : (π : ℂ) ≠ 0 := complex.of_real_ne_zero.mpr pi_ne_zero
   by_cases hs : sin (↑π * z) = 0
@@ -483,11 +516,13 @@ theorem gamma_mul_gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
     rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel _ pi_ne]
     convert tendsto_euler_sin_prod z
     ext1 n; rw [mul_comm, ← mul_assoc]
-#align complex.Gamma_mul_Gamma_one_sub Complex.gamma_mul_gamma_one_sub
+#align complex.Gamma_mul_Gamma_one_sub Complex.Gamma_mul_Gamma_one_sub
+-/
 
+#print Complex.Gamma_ne_zero /-
 /-- 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 :=
+theorem Gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
   by
   by_cases h_im : s.im = 0
   · have : s = ↑s.re := by conv_lhs => rw [← Complex.re_add_im s];
@@ -504,54 +539,65 @@ theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
       rw [of_real_mul_im, ← of_real_int_cast, ← of_real_mul, of_real_im]
       exact mul_ne_zero real.pi_pos.ne' h_im
     have A := div_ne_zero (of_real_ne_zero.mpr real.pi_pos.ne') this
-    rw [← Complex.gamma_mul_gamma_one_sub s, mul_ne_zero_iff] at A 
+    rw [← Complex.Gamma_mul_Gamma_one_sub s, mul_ne_zero_iff] at A 
     exact A.1
-#align complex.Gamma_ne_zero Complex.gamma_ne_zero
+#align complex.Gamma_ne_zero Complex.Gamma_ne_zero
+-/
 
-theorem gamma_eq_zero_iff (s : ℂ) : Gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
+#print Complex.Gamma_eq_zero_iff /-
+theorem Gamma_eq_zero_iff (s : ℂ) : Gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
   by
   constructor
   · contrapose!; exact Gamma_ne_zero
   · rintro ⟨m, rfl⟩; exact Gamma_neg_nat_eq_zero m
-#align complex.Gamma_eq_zero_iff Complex.gamma_eq_zero_iff
+#align complex.Gamma_eq_zero_iff Complex.Gamma_eq_zero_iff
+-/
 
+#print Complex.Gamma_ne_zero_of_re_pos /-
 /-- A weaker, but easier-to-apply, version of `complex.Gamma_ne_zero`. -/
-theorem gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : Gamma s ≠ 0 :=
+theorem Gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : Gamma s ≠ 0 :=
   by
   refine' Gamma_ne_zero fun m => _
   contrapose! hs
   simpa only [hs, neg_re, ← of_real_nat_cast, of_real_re, neg_nonpos] using Nat.cast_nonneg _
-#align complex.Gamma_ne_zero_of_re_pos Complex.gamma_ne_zero_of_re_pos
+#align complex.Gamma_ne_zero_of_re_pos Complex.Gamma_ne_zero_of_re_pos
+-/
 
 end Complex
 
 namespace Real
 
+#print Real.GammaSeq /-
 /-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for real `s`. We
 will show that this tends to `Γ(s)` as `n → ∞`. -/
-noncomputable def gammaSeq (s : ℝ) (n : ℕ) :=
+noncomputable def GammaSeq (s : ℝ) (n : ℕ) :=
   (n : ℝ) ^ s * n ! / ∏ j : ℕ in Finset.range (n + 1), (s + j)
-#align real.Gamma_seq Real.gammaSeq
+#align real.Gamma_seq Real.GammaSeq
+-/
 
+#print Real.GammaSeq_tendsto_Gamma /-
 /-- Euler's limit formula for the real Gamma function. -/
-theorem gammaSeq_tendsto_gamma (s : ℝ) : Tendsto (gammaSeq s) atTop (𝓝 <| Gamma s) :=
+theorem GammaSeq_tendsto_Gamma (s : ℝ) : Tendsto (GammaSeq s) atTop (𝓝 <| Gamma s) :=
   by
   suffices : tendsto (coe ∘ Gamma_seq s : ℕ → ℂ) at_top (𝓝 <| Complex.Gamma s)
   exact (complex.continuous_re.tendsto (Complex.Gamma ↑s)).comp this
-  convert Complex.gammaSeq_tendsto_gamma s
+  convert Complex.GammaSeq_tendsto_Gamma s
   ext1 n
-  dsimp only [Gamma_seq, Function.comp_apply, Complex.gammaSeq]
+  dsimp only [Gamma_seq, Function.comp_apply, Complex.GammaSeq]
   push_cast
   rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_nat_cast]
-#align real.Gamma_seq_tendsto_Gamma Real.gammaSeq_tendsto_gamma
+#align real.Gamma_seq_tendsto_Gamma Real.GammaSeq_tendsto_Gamma
+-/
 
+#print Real.Gamma_mul_Gamma_one_sub /-
 /-- Euler's reflection formula for the real Gamma function. -/
-theorem gamma_mul_gamma_one_sub (s : ℝ) : Gamma s * Gamma (1 - s) = π / sin (π * s) :=
+theorem Gamma_mul_Gamma_one_sub (s : ℝ) : Gamma s * Gamma (1 - s) = π / sin (π * s) :=
   by
   simp_rw [← Complex.ofReal_inj, Complex.ofReal_div, Complex.ofReal_sin, Complex.ofReal_mul, ←
     Complex.Gamma_ofReal, Complex.ofReal_sub, Complex.ofReal_one]
-  exact Complex.gamma_mul_gamma_one_sub s
-#align real.Gamma_mul_Gamma_one_sub Real.gamma_mul_gamma_one_sub
+  exact Complex.Gamma_mul_Gamma_one_sub s
+#align real.Gamma_mul_Gamma_one_sub Real.Gamma_mul_Gamma_one_sub
+-/
 
 end Real
 
@@ -570,18 +616,21 @@ case at least) mathlib's conventions for division by zero do actually give a mat
 answer! (These results are useful in the theory of zeta and L-functions.) -/
 
 
+#print Complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one /-
 /-- A reformulation of the Gamma recurrence relation which is true for `s = 0` as well. -/
-theorem one_div_gamma_eq_self_mul_one_div_gamma_add_one (s : ℂ) :
+theorem one_div_Gamma_eq_self_mul_one_div_Gamma_add_one (s : ℂ) :
     (Gamma s)⁻¹ = s * (Gamma (s + 1))⁻¹ :=
   by
   rcases ne_or_eq s 0 with (h | rfl)
   · rw [Gamma_add_one s h, mul_inv, mul_inv_cancel_left₀ h]
   · rw [zero_add, Gamma_zero, inv_zero, MulZeroClass.zero_mul]
-#align complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one Complex.one_div_gamma_eq_self_mul_one_div_gamma_add_one
+#align complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one Complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one
+-/
 
+#print Complex.differentiable_one_div_Gamma /-
 /-- The reciprocal of the Gamma function is differentiable everywhere (including the points where
 Gamma itself is not). -/
-theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (Gamma s)⁻¹ :=
+theorem differentiable_one_div_Gamma : Differentiable ℂ fun s : ℂ => (Gamma s)⁻¹ :=
   by
   suffices : ∀ n : ℕ, ∀ (s : ℂ) (hs : -s.re < n), DifferentiableAt ℂ (fun u : ℂ => (Gamma u)⁻¹) s
   exact fun s =>
@@ -600,7 +649,8 @@ theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (Gamma
     specialize hm (s + 1) (by rwa [add_re, one_re, neg_add', sub_lt_iff_lt_add, ← Nat.cast_succ])
     refine' differentiable_at_id.mul (hm.comp s _)
     exact differentiable_at_id.add (differentiableAt_const _)
-#align complex.differentiable_one_div_Gamma Complex.differentiable_one_div_gamma
+#align complex.differentiable_one_div_Gamma Complex.differentiable_one_div_Gamma
+-/
 
 end Complex
 
@@ -619,7 +669,8 @@ do not have to do any special-case handling for the poles of `Γ`.)
 
 namespace Complex
 
-theorem gamma_mul_gamma_add_half (s : ℂ) :
+#print Complex.Gamma_mul_Gamma_add_half /-
+theorem Gamma_mul_Gamma_add_half (s : ℂ) :
     Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * ↑(Real.sqrt π) :=
   by
   suffices
@@ -655,7 +706,8 @@ theorem gamma_mul_gamma_add_half (s : ℂ) :
     mul_inv, mul_inv, (by push_cast : 2 * (t : ℂ) = ↑(2 * t)), Gamma_of_real,
     of_real_cpow zero_le_two, of_real_bit0, of_real_one, ← cpow_neg, of_real_sub, of_real_one,
     neg_sub, ← div_eq_mul_inv]
-#align complex.Gamma_mul_Gamma_add_half Complex.gamma_mul_gamma_add_half
+#align complex.Gamma_mul_Gamma_add_half Complex.Gamma_mul_Gamma_add_half
+-/
 
 end Complex
 
@@ -663,13 +715,15 @@ namespace Real
 
 open Complex
 
-theorem gamma_mul_gamma_add_half (s : ℝ) :
+#print Real.Gamma_mul_Gamma_add_half /-
+theorem Gamma_mul_Gamma_add_half (s : ℝ) :
     Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt π :=
   by
   rw [← of_real_inj]
   simpa only [← Gamma_of_real, of_real_cpow zero_le_two, of_real_mul, of_real_add, of_real_div,
-    of_real_bit0, of_real_one, of_real_sub] using Complex.gamma_mul_gamma_add_half ↑s
-#align real.Gamma_mul_Gamma_add_half Real.gamma_mul_gamma_add_half
+    of_real_bit0, of_real_one, of_real_sub] using Complex.Gamma_mul_Gamma_add_half ↑s
+#align real.Gamma_mul_Gamma_add_half Real.Gamma_mul_Gamma_add_half
+-/
 
 end Real
 
Diff
@@ -143,7 +143,7 @@ theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   -- 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_pos_convolution (Gamma_integral_convergent hs) (Gamma_integral_convergent ht)
+    integral_posConvolution (Gamma_integral_convergent hs) (Gamma_integral_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
Diff
@@ -138,7 +138,7 @@ theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
 
 /-- 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 :=
+    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.
@@ -318,7 +318,7 @@ theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
 Gamma function for `0 < re s` as the limit of a sequence of integrals over finite intervals. -/
 theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
     Tendsto (fun n : ℕ => ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1)) atTop
-      (𝓝 <| gamma s) :=
+      (𝓝 <| Gamma s) :=
   by
   rw [Gamma_eq_integral hs]
   -- We apply dominated convergence to the following function, which we will show is uniformly
@@ -358,7 +358,7 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
   -- let `convert` identify the remaining goals
   convert
     tendsto_integral_of_dominated_convergence _ (fun n => (f_ible n).1)
-      (Real.Gamma_integral_convergent hs) _
+      (Real.GammaIntegral_convergent hs) _
       ((ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ f_tends))
   -- limit of f is the integrand we want
   · ext1 n
@@ -382,7 +382,7 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
 #align complex.approx_Gamma_integral_tendsto_Gamma_integral Complex.approx_gamma_integral_tendsto_gamma_integral
 
 /-- Euler's limit formula for the complex Gamma function. -/
-theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| gamma s) :=
+theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| Gamma s) :=
   by
   suffices ∀ m : ℕ, -↑m < re s → tendsto (Gamma_seq s) at_top (𝓝 <| Gamma_aux m s)
     by
@@ -455,7 +455,7 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
 #align complex.Gamma_seq_mul Complex.gammaSeq_mul
 
 /-- Euler's reflection formula for the complex Gamma function. -/
-theorem gamma_mul_gamma_one_sub (z : ℂ) : gamma z * gamma (1 - z) = π / sin (π * z) :=
+theorem gamma_mul_gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (π * z) :=
   by
   have pi_ne : (π : ℂ) ≠ 0 := complex.of_real_ne_zero.mpr pi_ne_zero
   by_cases hs : sin (↑π * z) = 0
@@ -467,10 +467,10 @@ theorem gamma_mul_gamma_one_sub (z : ℂ) : gamma z * gamma (1 - z) = π / sin (
       neg_eq_iff_eq_neg] at hk 
     rw [hk]
     cases k
-    · rw [Int.cast_ofNat, Complex.gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
+    · rw [Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
     ·
       rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel',
-        Complex.gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
+        Complex.Gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
   refine' tendsto_nhds_unique ((Gamma_seq_tendsto_Gamma z).mul (Gamma_seq_tendsto_Gamma <| 1 - z)) _
   have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]; rw [this]
   refine'
@@ -487,13 +487,13 @@ theorem gamma_mul_gamma_one_sub (z : ℂ) : gamma z * gamma (1 - z) = π / sin (
 
 /-- 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 :=
+theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
   by
   by_cases h_im : s.im = 0
   · have : s = ↑s.re := by conv_lhs => rw [← Complex.re_add_im s];
       rw [h_im, of_real_zero, MulZeroClass.zero_mul, add_zero]
     rw [this, Gamma_of_real, of_real_ne_zero]
-    refine' Real.gamma_ne_zero fun n => _
+    refine' Real.Gamma_ne_zero fun n => _
     specialize hs n
     contrapose! hs
     rwa [this, ← of_real_nat_cast, ← of_real_neg, of_real_inj]
@@ -508,7 +508,7 @@ theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : gamma s ≠ 0 :=
     exact A.1
 #align complex.Gamma_ne_zero Complex.gamma_ne_zero
 
-theorem gamma_eq_zero_iff (s : ℂ) : gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
+theorem gamma_eq_zero_iff (s : ℂ) : Gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
   by
   constructor
   · contrapose!; exact Gamma_ne_zero
@@ -516,7 +516,7 @@ theorem gamma_eq_zero_iff (s : ℂ) : gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
 #align complex.Gamma_eq_zero_iff Complex.gamma_eq_zero_iff
 
 /-- A weaker, but easier-to-apply, version of `complex.Gamma_ne_zero`. -/
-theorem gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : gamma s ≠ 0 :=
+theorem gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : Gamma s ≠ 0 :=
   by
   refine' Gamma_ne_zero fun m => _
   contrapose! hs
@@ -534,10 +534,10 @@ noncomputable def gammaSeq (s : ℝ) (n : ℕ) :=
 #align real.Gamma_seq Real.gammaSeq
 
 /-- Euler's limit formula for the real Gamma function. -/
-theorem gammaSeq_tendsto_gamma (s : ℝ) : Tendsto (gammaSeq s) atTop (𝓝 <| gamma s) :=
+theorem gammaSeq_tendsto_gamma (s : ℝ) : Tendsto (gammaSeq s) atTop (𝓝 <| Gamma s) :=
   by
-  suffices : tendsto (coe ∘ Gamma_seq s : ℕ → ℂ) at_top (𝓝 <| Complex.gamma s)
-  exact (complex.continuous_re.tendsto (Complex.gamma ↑s)).comp this
+  suffices : tendsto (coe ∘ Gamma_seq s : ℕ → ℂ) at_top (𝓝 <| Complex.Gamma s)
+  exact (complex.continuous_re.tendsto (Complex.Gamma ↑s)).comp this
   convert Complex.gammaSeq_tendsto_gamma s
   ext1 n
   dsimp only [Gamma_seq, Function.comp_apply, Complex.gammaSeq]
@@ -546,10 +546,10 @@ theorem gammaSeq_tendsto_gamma (s : ℝ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
 #align real.Gamma_seq_tendsto_Gamma Real.gammaSeq_tendsto_gamma
 
 /-- Euler's reflection formula for the real Gamma function. -/
-theorem gamma_mul_gamma_one_sub (s : ℝ) : gamma s * gamma (1 - s) = π / sin (π * s) :=
+theorem gamma_mul_gamma_one_sub (s : ℝ) : Gamma s * Gamma (1 - s) = π / sin (π * s) :=
   by
   simp_rw [← Complex.ofReal_inj, Complex.ofReal_div, Complex.ofReal_sin, Complex.ofReal_mul, ←
-    Complex.gamma_of_real, Complex.ofReal_sub, Complex.ofReal_one]
+    Complex.Gamma_ofReal, Complex.ofReal_sub, Complex.ofReal_one]
   exact Complex.gamma_mul_gamma_one_sub s
 #align real.Gamma_mul_Gamma_one_sub Real.gamma_mul_gamma_one_sub
 
@@ -572,7 +572,7 @@ answer! (These results are useful in the theory of zeta and L-functions.) -/
 
 /-- A reformulation of the Gamma recurrence relation which is true for `s = 0` as well. -/
 theorem one_div_gamma_eq_self_mul_one_div_gamma_add_one (s : ℂ) :
-    (gamma s)⁻¹ = s * (gamma (s + 1))⁻¹ :=
+    (Gamma s)⁻¹ = s * (Gamma (s + 1))⁻¹ :=
   by
   rcases ne_or_eq s 0 with (h | rfl)
   · rw [Gamma_add_one s h, mul_inv, mul_inv_cancel_left₀ h]
@@ -581,7 +581,7 @@ theorem one_div_gamma_eq_self_mul_one_div_gamma_add_one (s : ℂ) :
 
 /-- The reciprocal of the Gamma function is differentiable everywhere (including the points where
 Gamma itself is not). -/
-theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (gamma s)⁻¹ :=
+theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (Gamma s)⁻¹ :=
   by
   suffices : ∀ n : ℕ, ∀ (s : ℂ) (hs : -s.re < n), DifferentiableAt ℂ (fun u : ℂ => (Gamma u)⁻¹) s
   exact fun s =>
@@ -620,7 +620,7 @@ do not have to do any special-case handling for the poles of `Γ`.)
 namespace Complex
 
 theorem gamma_mul_gamma_add_half (s : ℂ) :
-    gamma s * gamma (s + 1 / 2) = gamma (2 * s) * 2 ^ (1 - 2 * s) * ↑(Real.sqrt π) :=
+    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * ↑(Real.sqrt π) :=
   by
   suffices
     (fun z => (Gamma z)⁻¹ * (Gamma (z + 1 / 2))⁻¹) = fun z =>
@@ -664,7 +664,7 @@ namespace Real
 open Complex
 
 theorem gamma_mul_gamma_add_half (s : ℝ) :
-    gamma s * gamma (s + 1 / 2) = gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt π :=
+    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt π :=
   by
   rw [← of_real_inj]
   simpa only [← Gamma_of_real, of_real_cpow zero_le_two, of_real_mul, of_real_add, of_real_div,
Diff
@@ -54,7 +54,6 @@ section BetaIntegral
 
 namespace Complex
 
--- mathport name: exprcexp
 notation "cexp" => Complex.exp
 
 /-- The Beta function `Β (u, v)`, defined as `∫ x:ℝ in 0..1, x ^ (u - 1) * (1 - x) ^ (v - 1)`. -/
Diff
@@ -116,7 +116,7 @@ theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1
 #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 :=
+    ∫ x in 0 ..a, (x : ℂ) ^ (s - 1) * (a - x) ^ (t - 1) = a ^ (s + t - 1) * betaIntegral s t :=
   by
   have ha' : (a : ℂ) ≠ 0 := of_real_ne_zero.mpr ha.ne'
   rw [beta_integral]
@@ -233,7 +233,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
 
 /-- 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 :=
+    betaIntegral u (n + 1) = n ! / ∏ j : ℕ in Finset.range (n + 1), (u + j) :=
   by
   induction' n with n IH generalizing u
   ·
@@ -265,7 +265,7 @@ 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
+  (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 : ℕ) :
@@ -432,7 +432,7 @@ namespace Complex
 
 theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
     gammaSeq z n * gammaSeq (1 - z) n =
-      n / (n + 1 - z) * (1 / (z * ∏ j in Finset.range n, 1 - z ^ 2 / (j + 1) ^ 2)) :=
+      n / (n + 1 - z) * (1 / (z * ∏ j in Finset.range n, (1 - z ^ 2 / (j + 1) ^ 2))) :=
   by
   -- also true for n = 0 but we don't need it
   have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros; ring
@@ -531,7 +531,7 @@ namespace Real
 /-- The sequence with `n`-th term `n ^ s * n! / (s * (s + 1) * ... * (s + n))`, for real `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
+  (n : ℝ) ^ s * n ! / ∏ j : ℕ in Finset.range (n + 1), (s + j)
 #align real.Gamma_seq Real.gammaSeq
 
 /-- Euler's limit formula for the real Gamma function. -/
Diff
@@ -201,7 +201,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
         apply hasDerivAt_id
       convert HasDerivAt.comp (↑x) A B using 1
       ring
-    convert (U.mul V).comp_of_real
+    convert (U.mul V).comp_ofReal
     ring
   have h_int :=
     ((beta_integral_convergent hu hv').const_mul u).sub
@@ -543,7 +543,7 @@ theorem gammaSeq_tendsto_gamma (s : ℝ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
   ext1 n
   dsimp only [Gamma_seq, Function.comp_apply, Complex.gammaSeq]
   push_cast
-  rw [Complex.of_real_cpow n.cast_nonneg, Complex.ofReal_nat_cast]
+  rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_nat_cast]
 #align real.Gamma_seq_tendsto_Gamma Real.gammaSeq_tendsto_gamma
 
 /-- Euler's reflection formula for the real Gamma function. -/
Diff
@@ -4,13 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
 
 ! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit cca40788df1b8755d5baf17ab2f27dacc2e17acb
+! leanprover-community/mathlib commit a3209ddf94136d36e5e5c624b10b2a347cc9d090
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Analysis.Convolution
 import Mathbin.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
-import Mathbin.Analysis.SpecialFunctions.Gamma.Basic
+import Mathbin.Analysis.SpecialFunctions.Gamma.BohrMollerup
+import Mathbin.Analysis.Analytic.IsolatedZeros
 
 /-!
 # The Beta function, and further properties of the Gamma function
@@ -33,8 +34,10 @@ refined properties of the Gamma function using these relations.
 * `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.Gamma_seq_tendsto_Gamma`,
-  `real.Gamma_mul_Gamma_one_sub`: real versions of the above results.
+  `real.Gamma_mul_Gamma_one_sub`, `real.Gamma_mul_Gamma_add_half`: real versions of the above.
 -/
 
 
@@ -604,3 +607,72 @@ end Complex
 
 end InvGamma
 
+section Doubling
+
+/-!
+## The doubling formula for Gamma
+
+We prove the doubling formula for arbitrary real or complex arguments, by analytic continuation from
+the positive real case. (Knowing that `Γ⁻¹` is analytic everywhere makes this much simpler, since we
+do not have to do any special-case handling for the poles of `Γ`.)
+-/
+
+
+namespace Complex
+
+theorem gamma_mul_gamma_add_half (s : ℂ) :
+    gamma s * gamma (s + 1 / 2) = gamma (2 * s) * 2 ^ (1 - 2 * s) * ↑(Real.sqrt π) :=
+  by
+  suffices
+    (fun z => (Gamma z)⁻¹ * (Gamma (z + 1 / 2))⁻¹) = fun z =>
+      (Gamma (2 * z))⁻¹ * 2 ^ (2 * z - 1) / ↑(Real.sqrt π)
+    by
+    convert congr_arg Inv.inv (congr_fun this s) using 1
+    · rw [mul_inv, inv_inv, inv_inv]
+    · rw [div_eq_mul_inv, mul_inv, mul_inv, inv_inv, inv_inv, ← cpow_neg, neg_sub]
+  have h1 : AnalyticOn ℂ (fun z : ℂ => (Gamma z)⁻¹ * (Gamma (z + 1 / 2))⁻¹) univ :=
+    by
+    refine' DifferentiableOn.analyticOn _ isOpen_univ
+    refine' (differentiable_one_div_Gamma.mul _).DifferentiableOn
+    exact differentiable_one_div_Gamma.comp (differentiable_id.add (differentiable_const _))
+  have h2 : AnalyticOn ℂ (fun z => (Gamma (2 * z))⁻¹ * 2 ^ (2 * z - 1) / ↑(Real.sqrt π)) univ :=
+    by
+    refine' DifferentiableOn.analyticOn _ isOpen_univ
+    refine' (Differentiable.mul _ (differentiable_const _)).DifferentiableOn
+    apply Differentiable.mul
+    · exact differentiable_one_div_Gamma.comp (differentiable_id'.const_mul _)
+    · refine' fun t => DifferentiableAt.const_cpow _ (Or.inl two_ne_zero)
+      refine' DifferentiableAt.sub_const (differentiable_at_id.const_mul _) _
+  have h3 : tendsto (coe : ℝ → ℂ) (𝓝[≠] 1) (𝓝[≠] 1) :=
+    by
+    rw [tendsto_nhdsWithin_iff]; constructor
+    · exact tendsto_nhdsWithin_of_tendsto_nhds continuous_of_real.continuous_at
+    · exact eventually_nhds_within_iff.mpr (eventually_of_forall fun t ht => of_real_ne_one.mpr ht)
+  refine' AnalyticOn.eq_of_frequently_eq h1 h2 (h3.frequently _)
+  refine' ((eventually.filter_mono nhdsWithin_le_nhds) _).Frequently
+  refine' (eventually_gt_nhds zero_lt_one).mp (eventually_of_forall fun t ht => _)
+  rw [← mul_inv, Gamma_of_real, (by push_cast : (t : ℂ) + 1 / 2 = ↑(t + 1 / 2)), Gamma_of_real, ←
+    of_real_mul, Gamma_mul_Gamma_add_half_of_pos ht, of_real_mul, of_real_mul, ← Gamma_of_real,
+    mul_inv, mul_inv, (by push_cast : 2 * (t : ℂ) = ↑(2 * t)), Gamma_of_real,
+    of_real_cpow zero_le_two, of_real_bit0, of_real_one, ← cpow_neg, of_real_sub, of_real_one,
+    neg_sub, ← div_eq_mul_inv]
+#align complex.Gamma_mul_Gamma_add_half Complex.gamma_mul_gamma_add_half
+
+end Complex
+
+namespace Real
+
+open Complex
+
+theorem gamma_mul_gamma_add_half (s : ℝ) :
+    gamma s * gamma (s + 1 / 2) = gamma (2 * s) * 2 ^ (1 - 2 * s) * sqrt π :=
+  by
+  rw [← of_real_inj]
+  simpa only [← Gamma_of_real, of_real_cpow zero_le_two, of_real_mul, of_real_add, of_real_div,
+    of_real_bit0, of_real_one, of_real_sub] using Complex.gamma_mul_gamma_add_half ↑s
+#align real.Gamma_mul_Gamma_add_half Real.gamma_mul_gamma_add_half
+
+end Real
+
+end Doubling
+
Diff
@@ -82,7 +82,7 @@ theorem beta_integral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   by
   refine' (beta_integral_convergent_left hu v).trans _
   rw [IntervalIntegrable.iff_comp_neg]
-  convert((beta_integral_convergent_left hv u).comp_add_right 1).symm
+  convert ((beta_integral_convergent_left hv u).comp_add_right 1).symm
   · ext1 x
     conv_lhs => rw [mul_comm]
     congr 2 <;> · push_cast ; ring
@@ -198,7 +198,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
         apply hasDerivAt_id
       convert HasDerivAt.comp (↑x) A B using 1
       ring
-    convert(U.mul V).comp_of_real
+    convert (U.mul V).comp_of_real
     ring
   have h_int :=
     ((beta_integral_convergent hu hv').const_mul u).sub
@@ -354,7 +354,8 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
       ext1 n
       rw [neg_div, ← sub_eq_add_neg]
   -- let `convert` identify the remaining goals
-  convert tendsto_integral_of_dominated_convergence _ (fun n => (f_ible n).1)
+  convert
+    tendsto_integral_of_dominated_convergence _ (fun n => (f_ible n).1)
       (Real.Gamma_integral_convergent hs) _
       ((ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ f_tends))
   -- limit of f is the integrand we want
Diff
@@ -68,7 +68,7 @@ theorem beta_integral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
     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
+    rw [uIcc_of_le (by positivity : (0 : ℝ) ≤ 1 / 2)] at hx 
     apply ContinuousAt.cpow
     · exact (continuous_const.sub continuous_of_real).ContinuousAt
     · exact continuousAt_const
@@ -96,7 +96,7 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
   have :=
     intervalIntegral.integral_comp_mul_add (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
+  rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this 
   convert this
   · ext1 x; rw [mul_comm]; congr <;> · push_cast ; ring
   · ring; · ring
@@ -143,7 +143,7 @@ theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   have conv_int :=
     integral_pos_convolution (Gamma_integral_convergent hs) (Gamma_integral_convergent ht)
       (ContinuousLinearMap.mul ℝ ℂ)
-  simp_rw [ContinuousLinearMap.mul_apply'] at conv_int
+  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, Gamma_integral,
     Gamma_integral, Gamma_integral, ← conv_int, ← integral_mul_right (beta_integral _ _)]
@@ -186,14 +186,14 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     have U : HasDerivAt (fun y : ℂ => y ^ u) (u * ↑x ^ (u - 1)) ↑x :=
       by
       have := HasDerivAt.cpow_const (hasDerivAt_id ↑x) (Or.inl _)
-      · rw [mul_one] at this; exact this
+      · rw [mul_one] at this ; exact this
       · rw [id.def, of_real_re]; exact hx.1
     have V : HasDerivAt (fun y : ℂ => (1 - y) ^ v) (-v * (1 - ↑x) ^ (v - 1)) ↑x :=
       by
       have A := HasDerivAt.cpow_const (hasDerivAt_id (1 - ↑x)) (Or.inl _)
       rotate_left; · exact v
       · rw [id.def, sub_re, one_re, of_real_re, sub_pos]; exact hx.2
-      simp_rw [id.def] at A
+      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
@@ -203,8 +203,8 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   have h_int :=
     ((beta_integral_convergent hu hv').const_mul u).sub
       ((beta_integral_convergent hu' hv).const_mul v)
-  dsimp only at h_int
-  rw [add_sub_cancel, add_sub_cancel] at h_int
+  dsimp only at h_int 
+  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
@@ -217,9 +217,9 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
       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
+    intervalIntegral.integral_const_mul] at int_ev 
   · rw [beta_integral, beta_integral, ← sub_eq_zero]
-    convert int_ev <;> · ext1 x; congr ; abel
+    convert int_ev <;> · ext1 x; congr; abel
   · apply IntervalIntegrable.const_mul
     convert beta_integral_convergent hu hv'
     ext1 x; rw [add_sub_cancel]
@@ -238,7 +238,7 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
       zero_add, Finset.prod_range_one, Nat.cast_zero, add_zero]
   · have := beta_integral_recurrence hu (_ : 0 < re n.succ)
     swap; · rw [← of_real_nat_cast, of_real_re]; positivity
-    rw [mul_comm u _, ← eq_div_iff] at this
+    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
@@ -344,7 +344,7 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
     apply tendsto.congr'
     show ∀ᶠ n : ℕ in at_top, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
     · refine' eventually.mp (eventually_ge_at_top ⌈x⌉₊) (eventually_of_forall fun n hn => _)
-      rw [Nat.ceil_le] at hn
+      rw [Nat.ceil_le] at hn 
       dsimp only [f]
       rw [indicator_of_mem]
       exact ⟨hx, hn⟩
@@ -394,7 +394,7 @@ theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
   induction' m with m IH generalizing s
   · -- Base case: `0 < re s`, so Gamma is given by the integral formula
     intro hs
-    rw [Nat.cast_zero, neg_zero] at hs
+    rw [Nat.cast_zero, neg_zero] at hs 
     rw [← Gamma_eq_Gamma_aux]
     · refine' tendsto.congr' _ (approx_Gamma_integral_tendsto_Gamma_integral hs)
       refine' (eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => _)
@@ -402,7 +402,7 @@ theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
     · rwa [Nat.cast_zero, neg_lt_zero]
   · -- Induction step: use recurrence formulae in `s` for Gamma and Gamma_seq
     intro hs
-    rw [Nat.cast_succ, neg_add, ← sub_eq_add_neg, sub_lt_iff_lt_add, ← one_re, ← add_re] at hs
+    rw [Nat.cast_succ, neg_add, ← sub_eq_add_neg, sub_lt_iff_lt_add, ← one_re, ← add_re] at hs 
     rw [Gamma_aux]
     have :=
       tendsto.congr' ((eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => _))
@@ -410,7 +410,7 @@ theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
     pick_goal 3; · exact Gamma_seq_add_one_left s hn
     -- doesn't work if inlined?
     conv at this in _ / _ * _ => rw [mul_comm]
-    rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
+    rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this 
     simp_rw [add_assoc]
     exact tendsto_coe_nat_div_add_atTop (1 + s)
 #align complex.Gamma_seq_tendsto_Gamma Complex.gammaSeq_tendsto_gamma
@@ -431,7 +431,7 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
       n / (n + 1 - z) * (1 / (z * ∏ j in Finset.range n, 1 - z ^ 2 / (j + 1) ^ 2)) :=
   by
   -- also true for n = 0 but we don't need it
-  have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros ; ring
+  have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros; ring
   rw [Gamma_seq, Gamma_seq, div_mul_div_comm, aux, ← pow_two]
   have : (n : ℂ) ^ z * n ^ (1 - z) = n := by
     rw [← cpow_add _ _ (nat.cast_ne_zero.mpr hn), add_sub_cancel'_right, cpow_one]
@@ -446,7 +446,7 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   simp_rw [this]
   rw [Finset.prod_mul_distrib, ← Nat.cast_prod, Finset.prod_pow,
     Finset.prod_range_add_one_eq_factorial, Nat.cast_pow,
-    (by intros ; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
+    (by intros; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
     mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
   exact pow_ne_zero 2 (nat.cast_ne_zero.mpr <| Nat.factorial_ne_zero n)
 #align complex.Gamma_seq_mul Complex.gammaSeq_mul
@@ -458,10 +458,10 @@ theorem gamma_mul_gamma_one_sub (z : ℂ) : gamma z * gamma (1 - z) = π / sin (
   by_cases hs : sin (↑π * z) = 0
   · -- first deal with silly case z = integer
     rw [hs, div_zero]
-    rw [← neg_eq_zero, ← Complex.sin_neg, ← mul_neg, Complex.sin_eq_zero_iff, mul_comm] at hs
+    rw [← neg_eq_zero, ← Complex.sin_neg, ← mul_neg, Complex.sin_eq_zero_iff, mul_comm] at hs 
     obtain ⟨k, hk⟩ := hs
     rw [mul_eq_mul_right_iff, eq_false (of_real_ne_zero.mpr pi_pos.ne'), or_false_iff,
-      neg_eq_iff_eq_neg] at hk
+      neg_eq_iff_eq_neg] at hk 
     rw [hk]
     cases k
     · rw [Int.cast_ofNat, Complex.gamma_neg_nat_eq_zero, MulZeroClass.zero_mul]
@@ -501,7 +501,7 @@ theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : gamma s ≠ 0 :=
       rw [of_real_mul_im, ← of_real_int_cast, ← of_real_mul, of_real_im]
       exact mul_ne_zero real.pi_pos.ne' h_im
     have A := div_ne_zero (of_real_ne_zero.mpr real.pi_pos.ne') this
-    rw [← Complex.gamma_mul_gamma_one_sub s, mul_ne_zero_iff] at A
+    rw [← Complex.gamma_mul_gamma_one_sub s, mul_ne_zero_iff] at A 
     exact A.1
 #align complex.Gamma_ne_zero Complex.gamma_ne_zero
 
@@ -587,7 +587,7 @@ theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (gamma
   intro n
   induction' n with m hm
   · intro s hs
-    rw [Nat.cast_zero, neg_lt_zero] at hs
+    rw [Nat.cast_zero, neg_lt_zero] at hs 
     suffices : ∀ m : ℕ, s ≠ -↑m; exact (differentiable_at_Gamma _ this).inv (Gamma_ne_zero this)
     contrapose! hs
     rcases hs with ⟨m, rfl⟩
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
 
 ! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit b76e9f654df09f8a832aeee712511fe5f3e57869
+! leanprover-community/mathlib commit cca40788df1b8755d5baf17ab2f27dacc2e17acb
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -512,6 +512,14 @@ theorem gamma_eq_zero_iff (s : ℂ) : gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
   · rintro ⟨m, rfl⟩; exact Gamma_neg_nat_eq_zero m
 #align complex.Gamma_eq_zero_iff Complex.gamma_eq_zero_iff
 
+/-- A weaker, but easier-to-apply, version of `complex.Gamma_ne_zero`. -/
+theorem gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : gamma s ≠ 0 :=
+  by
+  refine' Gamma_ne_zero fun m => _
+  contrapose! hs
+  simpa only [hs, neg_re, ← of_real_nat_cast, of_real_re, neg_nonpos] using Nat.cast_nonneg _
+#align complex.Gamma_ne_zero_of_re_pos Complex.gamma_ne_zero_of_re_pos
+
 end Complex
 
 namespace Real
Diff
@@ -42,7 +42,7 @@ noncomputable section
 
 open Filter intervalIntegral Set Real MeasureTheory
 
-open Nat Topology BigOperators Real
+open scoped Nat Topology BigOperators Real
 
 section BetaIntegral
 
@@ -548,7 +548,7 @@ end GammaReflection
 
 section InvGamma
 
-open Real
+open scoped Real
 
 namespace Complex
 
Diff
@@ -85,9 +85,7 @@ theorem beta_integral_convergent {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   convert((beta_integral_convergent_left hv u).comp_add_right 1).symm
   · ext1 x
     conv_lhs => rw [mul_comm]
-    congr 2 <;>
-      · push_cast
-        ring
+    congr 2 <;> · push_cast ; ring
   · norm_num
   · norm_num
 #align complex.beta_integral_convergent Complex.beta_integral_convergent
@@ -100,11 +98,7 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v :=
       neg_one_lt_zero.ne 1
   rw [inv_neg, inv_one, neg_one_smul, ← intervalIntegral.integral_symm] at this
   convert this
-  · ext1 x
-    rw [mul_comm]
-    congr <;>
-      · push_cast
-        ring
+  · ext1 x; rw [mul_comm]; congr <;> · push_cast ; ring
   · ring; · ring
 #align complex.beta_integral_symm Complex.betaIntegral_symm
 
@@ -114,8 +108,7 @@ theorem betaIntegral_eval_one_right {u : ℂ} (hu : 0 < re u) : betaIntegral u 1
   rw [integral_cpow (Or.inl _)]
   · rw [of_real_zero, of_real_one, one_cpow, zero_cpow, sub_zero, sub_add_cancel]
     rw [sub_add_cancel]
-    contrapose! hu
-    rw [hu, zero_re]
+    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
 
@@ -151,9 +144,7 @@ theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
     integral_pos_convolution (Gamma_integral_convergent hs) (Gamma_integral_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
+  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, Gamma_integral,
     Gamma_integral, Gamma_integral, ← conv_int, ← integral_mul_right (beta_integral _ _)]
   refine' set_integral_congr measurableSet_Ioi fun x hx => _
@@ -161,13 +152,8 @@ theorem gamma_mul_gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   rw [mul_assoc, ← beta_integral_scaled s t hx, ← intervalIntegral.integral_const_mul]
   congr 1 with y : 1
   push_cast
-  suffices cexp (-x) = cexp (-y) * cexp (-(x - y))
-    by
-    rw [this]
-    ring
-  · rw [← Complex.exp_add]
-    congr 1
-    abel
+  suffices cexp (-x) = cexp (-y) * cexp (-(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. -/
@@ -178,19 +164,14 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   -- `Gamma_mul_Gamma_eq_beta_integral`; 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 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'
         (continuous_at_cpow_const_of_re_pos (Or.inl _) hu).comp continuous_of_real.continuous_at
-      rw [of_real_re]
-      exact hx.1
+      rw [of_real_re]; exact hx.1
     · refine'
         (continuous_at_cpow_const_of_re_pos (Or.inl _) hv).comp
           (continuous_const.sub continuous_of_real).ContinuousAt
@@ -205,21 +186,15 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     have U : HasDerivAt (fun y : ℂ => y ^ u) (u * ↑x ^ (u - 1)) ↑x :=
       by
       have := HasDerivAt.cpow_const (hasDerivAt_id ↑x) (Or.inl _)
-      · rw [mul_one] at this
-        exact this
-      · rw [id.def, of_real_re]
-        exact hx.1
+      · rw [mul_one] at this; exact this
+      · rw [id.def, of_real_re]; exact hx.1
     have V : HasDerivAt (fun y : ℂ => (1 - y) ^ v) (-v * (1 - ↑x) ^ (v - 1)) ↑x :=
       by
       have A := HasDerivAt.cpow_const (hasDerivAt_id (1 - ↑x)) (Or.inl _)
-      rotate_left
-      · exact v
-      · rw [id.def, sub_re, one_re, of_real_re, sub_pos]
-        exact hx.2
+      rotate_left; · exact v
+      · rw [id.def, sub_re, one_re, of_real_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
+      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
@@ -235,29 +210,22 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     by
     simp only [mul_eq_zero, of_real_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]
+    contrapose! hu; rw [hu, zero_re]
   have hF1 : F 1 = 0 :=
     by
     simp only [mul_eq_zero, of_real_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]
+    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 [beta_integral, beta_integral, ← sub_eq_zero]
-    convert int_ev <;>
-      · ext1 x
-        congr
-        abel
+    convert int_ev <;> · ext1 x; congr ; abel
   · apply IntervalIntegrable.const_mul
     convert beta_integral_convergent hu hv'
-    ext1 x
-    rw [add_sub_cancel]
+    ext1 x; rw [add_sub_cancel]
   · apply IntervalIntegrable.const_mul
     convert beta_integral_convergent hu' hv
-    ext1 x
-    rw [add_sub_cancel]
+    ext1 x; rw [add_sub_cancel]
 #align complex.beta_integral_recurrence Complex.betaIntegral_recurrence
 
 /-- Explicit formula for the Beta function when second argument is a positive integer. -/
@@ -269,22 +237,15 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
     rw [Nat.cast_zero, zero_add, beta_integral_eval_one_right hu, Nat.factorial_zero, Nat.cast_one,
       zero_add, Finset.prod_range_one, Nat.cast_zero, add_zero]
   · have := beta_integral_recurrence hu (_ : 0 < re n.succ)
-    swap
-    · rw [← of_real_nat_cast, of_real_re]
-      positivity
+    swap; · rw [← of_real_nat_cast, of_real_re]; positivity
     rw [mul_comm u _, ← eq_div_iff] at this
-    swap
-    · contrapose! hu
-      rw [hu, zero_re]
+    swap; · contrapose! hu; rw [hu, zero_re]
     rw [this, Finset.prod_range_succ', Nat.cast_succ, IH]
-    swap
-    · rw [add_re, one_re]
-      positivity
+    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
+    push_cast ; abel
 #align complex.beta_integral_eval_nat_add_one_right Complex.betaIntegral_eval_nat_add_one_right
 
 end Complex
@@ -319,18 +280,14 @@ theorem gammaSeq_add_one_left (s : ℂ) {n : ℕ} (hn : n ≠ 0) :
   congr 3
   · rw [cpow_add _ _ (nat.cast_ne_zero.mpr hn), cpow_one, mul_comm]
   · refine' Finset.prod_congr (by rfl) fun x hx => _
-    push_cast
-    ring
+    push_cast ; ring
   · abel
 #align complex.Gamma_seq_add_one_left Complex.gammaSeq_add_one_left
 
 theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (hn : n ≠ 0) :
     gammaSeq s n = ∫ x : ℝ in 0 ..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) :=
   by
-  have : ∀ x : ℝ, x = x / n * n := by
-    intro x
-    rw [div_mul_cancel]
-    exact nat.cast_ne_zero.mpr hn
+  have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel]; exact nat.cast_ne_zero.mpr hn
   conv in ↑_ ^ _ =>
     congr
     rw [this x]
@@ -340,8 +297,7 @@ theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
       (fun x => ↑((1 - x) ^ n) * ↑(x * ↑n) ^ (s - 1) : ℝ → ℂ) (nat.cast_ne_zero.mpr hn),
     real_smul, zero_div, div_self, add_sub_cancel, ← intervalIntegral.integral_const_mul, ←
     intervalIntegral.integral_const_mul]
-  swap
-  · exact nat.cast_ne_zero.mpr hn
+  swap; · exact nat.cast_ne_zero.mpr hn
   simp_rw [intervalIntegral.integral_of_le zero_le_one]
   refine' set_integral_congr measurableSet_Ioc fun x hx => _
   push_cast
@@ -353,8 +309,7 @@ theorem gammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
   have B : ((x : ℂ) * ↑n) ^ (s - 1) = (x : ℂ) ^ (s - 1) * ↑n ^ (s - 1) := by
     rw [← of_real_nat_cast,
       mul_cpow_of_real_nonneg hx.1.le (nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).le]
-  rw [A, B, cpow_nat_cast]
-  ring
+  rw [A, B, cpow_nat_cast]; ring
 #align complex.Gamma_seq_eq_approx_Gamma_integral Complex.gammaSeq_eq_approx_Gamma_integral
 
 /-- The main techical lemma for `Gamma_seq_tendsto_Gamma`, expressing the integral defining the
@@ -378,8 +333,7 @@ theorem approx_gamma_integral_tendsto_gamma_integral {s : ℂ} (hs : 0 < re s) :
     apply IntervalIntegrable.continuousOn_mul
     · refine' intervalIntegral.intervalIntegrable_cpow' _
       rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
-    · apply Continuous.continuousOn
-      continuity
+    · apply Continuous.continuousOn; continuity
   -- pointwise limit of f
   have f_tends :
     ∀ x : ℝ,
@@ -453,8 +407,7 @@ theorem gammaSeq_tendsto_gamma (s : ℂ) : Tendsto (gammaSeq s) atTop (𝓝 <| g
     have :=
       tendsto.congr' ((eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => _))
         ((IH _ hs).div_const s)
-    pick_goal 3
-    · exact Gamma_seq_add_one_left s hn
+    pick_goal 3; · exact Gamma_seq_add_one_left s hn
     -- doesn't work if inlined?
     conv at this in _ / _ * _ => rw [mul_comm]
     rwa [← mul_one (Gamma_aux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
@@ -478,10 +431,7 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
       n / (n + 1 - z) * (1 / (z * ∏ j in Finset.range n, 1 - z ^ 2 / (j + 1) ^ 2)) :=
   by
   -- also true for n = 0 but we don't need it
-  have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) :=
-    by
-    intros
-    ring
+  have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros ; ring
   rw [Gamma_seq, Gamma_seq, div_mul_div_comm, aux, ← pow_two]
   have : (n : ℂ) ^ z * n ^ (1 - z) = n := by
     rw [← cpow_add _ _ (nat.cast_ne_zero.mpr hn), add_sub_cancel'_right, cpow_one]
@@ -491,18 +441,13 @@ theorem gammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
     by
     intro j
     push_cast
-    have : (j : ℂ) + 1 ≠ 0 := by
-      rw [← Nat.cast_succ, Nat.cast_ne_zero]
-      exact Nat.succ_ne_zero j
-    field_simp
-    ring
+    have : (j : ℂ) + 1 ≠ 0 := by rw [← Nat.cast_succ, Nat.cast_ne_zero]; exact Nat.succ_ne_zero j
+    field_simp; ring
   simp_rw [this]
   rw [Finset.prod_mul_distrib, ← Nat.cast_prod, Finset.prod_pow,
     Finset.prod_range_add_one_eq_factorial, Nat.cast_pow,
-    (by
-      intros
-      ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))),
-    ← div_div, mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
+    (by intros ; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
+    mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
   exact pow_ne_zero 2 (nat.cast_ne_zero.mpr <| Nat.factorial_ne_zero n)
 #align complex.Gamma_seq_mul Complex.gammaSeq_mul
 
@@ -524,22 +469,17 @@ theorem gamma_mul_gamma_one_sub (z : ℂ) : gamma z * gamma (1 - z) = π / sin (
       rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel',
         Complex.gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
   refine' tendsto_nhds_unique ((Gamma_seq_tendsto_Gamma z).mul (Gamma_seq_tendsto_Gamma <| 1 - z)) _
-  have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]
-  rw [this]
+  have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]; rw [this]
   refine'
     tendsto.congr'
       ((eventually_ne_at_top 0).mp (eventually_of_forall fun n hn => (Gamma_seq_mul z hn).symm))
       (tendsto.mul _ _)
-  · convert tendsto_coe_nat_div_add_atTop (1 - z)
-    ext1 n
-    rw [add_sub_assoc]
-  · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp
-    rw [this]
+  · convert tendsto_coe_nat_div_add_atTop (1 - z); ext1 n; rw [add_sub_assoc]
+  · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp; rw [this]
     refine' tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
     rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel _ pi_ne]
     convert tendsto_euler_sin_prod z
-    ext1 n
-    rw [mul_comm, ← mul_assoc]
+    ext1 n; rw [mul_comm, ← mul_assoc]
 #align complex.Gamma_mul_Gamma_one_sub Complex.gamma_mul_gamma_one_sub
 
 /-- The Gamma function does not vanish on `ℂ` (except at non-positive integers, where the function
@@ -547,8 +487,7 @@ is mathematically undefined and we set it to `0` by convention). -/
 theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : gamma s ≠ 0 :=
   by
   by_cases h_im : s.im = 0
-  · have : s = ↑s.re := by
-      conv_lhs => rw [← Complex.re_add_im s]
+  · have : s = ↑s.re := by conv_lhs => rw [← Complex.re_add_im s];
       rw [h_im, of_real_zero, MulZeroClass.zero_mul, add_zero]
     rw [this, Gamma_of_real, of_real_ne_zero]
     refine' Real.gamma_ne_zero fun n => _
@@ -569,10 +508,8 @@ theorem gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : gamma s ≠ 0 :=
 theorem gamma_eq_zero_iff (s : ℂ) : gamma s = 0 ↔ ∃ m : ℕ, s = -m :=
   by
   constructor
-  · contrapose!
-    exact Gamma_ne_zero
-  · rintro ⟨m, rfl⟩
-    exact Gamma_neg_nat_eq_zero m
+  · contrapose!; exact Gamma_ne_zero
+  · rintro ⟨m, rfl⟩; exact Gamma_neg_nat_eq_zero m
 #align complex.Gamma_eq_zero_iff Complex.gamma_eq_zero_iff
 
 end Complex
@@ -643,8 +580,7 @@ theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (gamma
   induction' n with m hm
   · intro s hs
     rw [Nat.cast_zero, neg_lt_zero] at hs
-    suffices : ∀ m : ℕ, s ≠ -↑m
-    exact (differentiable_at_Gamma _ this).inv (Gamma_ne_zero this)
+    suffices : ∀ m : ℕ, s ≠ -↑m; exact (differentiable_at_Gamma _ this).inv (Gamma_ne_zero this)
     contrapose! hs
     rcases hs with ⟨m, rfl⟩
     simpa only [neg_re, ← of_real_nat_cast, of_real_re, neg_nonpos] using Nat.cast_nonneg m
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
 
 ! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit 7982767093ae38cba236487f9c9dd9cd99f63c16
+! leanprover-community/mathlib commit b76e9f654df09f8a832aeee712511fe5f3e57869
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -32,6 +32,7 @@ refined properties of the Gamma function using these relations.
   `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.
 * `real.Gamma_ne_zero`, `real.Gamma_seq_tendsto_Gamma`,
   `real.Gamma_mul_Gamma_one_sub`: real versions of the above results.
 -/
@@ -608,3 +609,53 @@ end Real
 
 end GammaReflection
 
+section InvGamma
+
+open Real
+
+namespace Complex
+
+/-! ## The reciprocal Gamma function
+
+We show that the reciprocal Gamma function `1 / Γ(s)` is entire. These lemmas show that (in this
+case at least) mathlib's conventions for division by zero do actually give a mathematically useful
+answer! (These results are useful in the theory of zeta and L-functions.) -/
+
+
+/-- A reformulation of the Gamma recurrence relation which is true for `s = 0` as well. -/
+theorem one_div_gamma_eq_self_mul_one_div_gamma_add_one (s : ℂ) :
+    (gamma s)⁻¹ = s * (gamma (s + 1))⁻¹ :=
+  by
+  rcases ne_or_eq s 0 with (h | rfl)
+  · rw [Gamma_add_one s h, mul_inv, mul_inv_cancel_left₀ h]
+  · rw [zero_add, Gamma_zero, inv_zero, MulZeroClass.zero_mul]
+#align complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one Complex.one_div_gamma_eq_self_mul_one_div_gamma_add_one
+
+/-- The reciprocal of the Gamma function is differentiable everywhere (including the points where
+Gamma itself is not). -/
+theorem differentiable_one_div_gamma : Differentiable ℂ fun s : ℂ => (gamma s)⁻¹ :=
+  by
+  suffices : ∀ n : ℕ, ∀ (s : ℂ) (hs : -s.re < n), DifferentiableAt ℂ (fun u : ℂ => (Gamma u)⁻¹) s
+  exact fun s =>
+    let ⟨n, h⟩ := exists_nat_gt (-s.re)
+    this n s h
+  intro n
+  induction' n with m hm
+  · intro s hs
+    rw [Nat.cast_zero, neg_lt_zero] at hs
+    suffices : ∀ m : ℕ, s ≠ -↑m
+    exact (differentiable_at_Gamma _ this).inv (Gamma_ne_zero this)
+    contrapose! hs
+    rcases hs with ⟨m, rfl⟩
+    simpa only [neg_re, ← of_real_nat_cast, of_real_re, neg_nonpos] using Nat.cast_nonneg m
+  · intro s hs
+    rw [funext one_div_Gamma_eq_self_mul_one_div_Gamma_add_one]
+    specialize hm (s + 1) (by rwa [add_re, one_re, neg_add', sub_lt_iff_lt_add, ← Nat.cast_succ])
+    refine' differentiable_at_id.mul (hm.comp s _)
+    exact differentiable_at_id.add (differentiableAt_const _)
+#align complex.differentiable_one_div_Gamma Complex.differentiable_one_div_gamma
+
+end Complex
+
+end InvGamma
+

Changes in mathlib4

mathlib3
mathlib4
chore: adapt to multiple goal linter 2 (#12361)

A PR analogous to #12338: reformatting proofs following the multiple goals linter of #12339.

Diff
@@ -174,8 +174,8 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     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
+      · 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 ?_)
@@ -313,8 +313,8 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
       Tendsto (fun n : ℕ => f n x) atTop (𝓝 <| ↑(Real.exp (-x)) * (x : ℂ) ^ (s - 1)) := by
     intro x hx
     apply Tendsto.congr'
-    show ∀ᶠ n : ℕ in atTop, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
-    · filter_upwards [eventually_ge_atTop ⌈x⌉₊] with n hn
+    · show ∀ᶠ n : ℕ in atTop, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
+      filter_upwards [eventually_ge_atTop ⌈x⌉₊] with n hn
       rw [Nat.ceil_le] at hn
       dsimp only [f]
       rw [indicator_of_mem]
chore: replace set_integral with setIntegral (#12215)

Done with a global search and replace, and then (to fix the #align lines), replace (#align \S*)setIntegral with $1set_integral.

Diff
@@ -122,7 +122,7 @@ theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
   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 => _
+  refine' setIntegral_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']
@@ -143,7 +143,7 @@ theorem Gamma_mul_Gamma_eq_betaIntegral {s t : ℂ} (hs : 0 < re s) (ht : 0 < re
   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 => _
+  refine' setIntegral_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
@@ -274,7 +274,7 @@ theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
     ← intervalIntegral.integral_const_mul, ← intervalIntegral.integral_const_mul]
   swap; · exact Nat.cast_ne_zero.mpr hn
   simp_rw [intervalIntegral.integral_of_le zero_le_one]
-  refine' set_integral_congr measurableSet_Ioc fun x hx => _
+  refine' setIntegral_congr measurableSet_Ioc fun x hx => _
   push_cast
   have hn' : (n : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr hn
   have A : (n : ℂ) ^ s = (n : ℂ) ^ (s - 1) * n := by
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -216,7 +216,7 @@ theorem betaIntegral_eval_nat_add_one_right {u : ℂ} (hu : 0 < re u) (n : ℕ)
   · 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
+    swap; · rw [← ofReal_natCast, 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]
@@ -281,9 +281,9 @@ theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
     conv_lhs => rw [(by ring : s = s - 1 + 1), cpow_add _ _ hn']
     simp
   have B : ((x : ℂ) * ↑n) ^ (s - 1) = (x : ℂ) ^ (s - 1) * (n : ℂ) ^ (s - 1) := by
-    rw [← ofReal_nat_cast,
+    rw [← ofReal_natCast,
       mul_cpow_ofReal_nonneg hx.1.le (Nat.cast_pos.mpr (Nat.pos_of_ne_zero hn)).le]
-  rw [A, B, cpow_nat_cast]; ring
+  rw [A, B, cpow_natCast]; ring
 #align complex.Gamma_seq_eq_approx_Gamma_integral Complex.GammaSeq_eq_approx_Gamma_integral
 
 /-- The main techical lemma for `GammaSeq_tendsto_Gamma`, expressing the integral defining the
@@ -456,12 +456,12 @@ theorem Gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
     refine' Real.Gamma_ne_zero fun n => _
     specialize hs n
     contrapose! hs
-    rwa [this, ← ofReal_nat_cast, ← ofReal_neg, ofReal_inj]
+    rwa [this, ← ofReal_natCast, ← ofReal_neg, ofReal_inj]
   · have : sin (↑π * s) ≠ 0 := by
       rw [Complex.sin_ne_zero_iff]
       intro k
       apply_fun im
-      rw [im_ofReal_mul, ← ofReal_int_cast, ← ofReal_mul, ofReal_im]
+      rw [im_ofReal_mul, ← ofReal_intCast, ← ofReal_mul, ofReal_im]
       exact mul_ne_zero Real.pi_pos.ne' h_im
     have A := div_ne_zero (ofReal_ne_zero.mpr Real.pi_pos.ne') this
     rw [← Complex.Gamma_mul_Gamma_one_sub s, mul_ne_zero_iff] at A
@@ -478,7 +478,7 @@ theorem Gamma_eq_zero_iff (s : ℂ) : Gamma s = 0 ↔ ∃ m : ℕ, s = -m := by
 theorem Gamma_ne_zero_of_re_pos {s : ℂ} (hs : 0 < re s) : Gamma s ≠ 0 := by
   refine' Gamma_ne_zero fun m => _
   contrapose! hs
-  simpa only [hs, neg_re, ← ofReal_nat_cast, ofReal_re, neg_nonpos] using Nat.cast_nonneg _
+  simpa only [hs, neg_re, ← ofReal_natCast, ofReal_re, neg_nonpos] using Nat.cast_nonneg _
 #align complex.Gamma_ne_zero_of_re_pos Complex.Gamma_ne_zero_of_re_pos
 
 end Complex
@@ -499,7 +499,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℝ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
   ext1 n
   dsimp only [GammaSeq, Function.comp_apply, Complex.GammaSeq]
   push_cast
-  rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_nat_cast]
+  rw [Complex.ofReal_cpow n.cast_nonneg, Complex.ofReal_natCast]
 #align real.Gamma_seq_tendsto_Gamma Real.GammaSeq_tendsto_Gamma
 
 /-- Euler's reflection formula for the real Gamma function. -/
chore: avoid id.def (adaptation for nightly-2024-03-27) (#11829)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -179,8 +179,8 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
       · 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
+      swap; · rw [id, sub_re, one_re, ofReal_re, sub_pos]; exact hx.2
+      simp_rw [id] 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
refactor(SpecialFunctions/Gaussian): shorten long pole (#12104)

This splits up Analysis/SpecialFunctions/Gaussian.lean into three pieces, with the heaviest imports only needed in the later chunks. As only the first chunk is needed for many applications, including those on the critical path towards NumberTheory/Cyclotomic/PID.lean, this should improve overall build parallelism and shorten mathlib's overall compilation time.

Diff
@@ -7,6 +7,7 @@ import Mathlib.Analysis.Convolution
 import Mathlib.Analysis.SpecialFunctions.Trigonometric.EulerSineProd
 import Mathlib.Analysis.SpecialFunctions.Gamma.BohrMollerup
 import Mathlib.Analysis.Analytic.IsolatedZeros
+import Mathlib.Analysis.Complex.CauchyIntegral
 
 #align_import analysis.special_functions.gamma.beta from "leanprover-community/mathlib"@"a3209ddf94136d36e5e5c624b10b2a347cc9d090"
 
feat: add notation for Real.sqrt (#12056)

This adds the notation √r for Real.sqrt r. The precedence is such that √x⁻¹ is parsed as √(x⁻¹); not because this is particularly desirable, but because it's the default and the choice doesn't really matter.

This is extracted from #7907, which adds a more general nth root typeclass. The idea is to perform all the boring substitutions downstream quickly, so that we can play around with custom elaborators with a much slower rate of code-rot. This PR also won't rot as quickly, as it does not forbid writing x.sqrt as that PR does.

While perhaps claiming for Real.sqrt is greedy; it:

  • Is far more common thatn NNReal.sqrt and Nat.sqrt
  • Is far more interesting to mathlib than sqrt on Float
  • Can be overloaded anyway, so this does not prevent downstream code using the notation on their own types.
  • Will be replaced by a more general typeclass in a future PR.

Zulip

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -32,7 +32,7 @@ refined properties of the Gamma function using these relations.
   `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 π`.
+  `Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * 2 ^ (1 - 2 * s) * √π`.
 * `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.
 -/
@@ -568,9 +568,9 @@ do not have to do any special-case handling for the poles of `Γ`.)
 namespace Complex
 
 theorem Gamma_mul_Gamma_add_half (s : ℂ) :
-    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * (2 : ℂ) ^ (1 - 2 * s) * ↑(Real.sqrt π) := by
+    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * (2 : ℂ) ^ (1 - 2 * s) * ↑(√π) := by
   suffices (fun z => (Gamma z)⁻¹ * (Gamma (z + 1 / 2))⁻¹) = fun z =>
-      (Gamma (2 * z))⁻¹ * (2 : ℂ) ^ (2 * z - 1) / ↑(Real.sqrt π) by
+      (Gamma (2 * z))⁻¹ * (2 : ℂ) ^ (2 * z - 1) / ↑(√π) by
     convert congr_arg Inv.inv (congr_fun this s) using 1
     · rw [mul_inv, inv_inv, inv_inv]
     · rw [div_eq_mul_inv, mul_inv, mul_inv, inv_inv, inv_inv, ← cpow_neg, neg_sub]
@@ -579,7 +579,7 @@ theorem Gamma_mul_Gamma_add_half (s : ℂ) :
     refine' (differentiable_one_div_Gamma.mul _).differentiableOn
     exact differentiable_one_div_Gamma.comp (differentiable_id.add (differentiable_const _))
   have h2 : AnalyticOn ℂ
-      (fun z => (Gamma (2 * z))⁻¹ * (2 : ℂ) ^ (2 * z - 1) / ↑(Real.sqrt π)) univ := by
+      (fun z => (Gamma (2 * z))⁻¹ * (2 : ℂ) ^ (2 * z - 1) / ↑(√π)) univ := by
     refine' DifferentiableOn.analyticOn _ isOpen_univ
     refine' (Differentiable.mul _ (differentiable_const _)).differentiableOn
     apply Differentiable.mul
@@ -607,7 +607,7 @@ namespace Real
 open Complex
 
 theorem Gamma_mul_Gamma_add_half (s : ℝ) :
-    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * (2 : ℝ) ^ (1 - 2 * s) * sqrt π := by
+    Gamma s * Gamma (s + 1 / 2) = Gamma (2 * s) * (2 : ℝ) ^ (1 - 2 * s) * √π := by
   rw [← ofReal_inj]
   simpa only [← Gamma_ofReal, ofReal_cpow zero_le_two, ofReal_mul, ofReal_add, ofReal_div,
     ofReal_sub] using Complex.Gamma_mul_Gamma_add_half ↑s
chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast (#11499)

This is less exhaustive than its sibling #11486 because edge cases are harder to classify. No fundamental difficulty, just me being a bit fast and lazy.

Reduce the diff of #11203

Diff
@@ -379,7 +379,7 @@ theorem GammaSeq_tendsto_Gamma (s : ℂ) : Tendsto (GammaSeq s) atTop (𝓝 <| G
     conv at this => arg 1; intro n; rw [mul_comm]
     rwa [← mul_one (GammaAux m (s + 1) / s), tendsto_mul_iff_of_ne_zero _ (one_ne_zero' ℂ)] at this
     simp_rw [add_assoc]
-    exact tendsto_coe_nat_div_add_atTop (1 + s)
+    exact tendsto_natCast_div_add_atTop (1 + s)
 #align complex.Gamma_seq_tendsto_Gamma Complex.GammaSeq_tendsto_Gamma
 
 end Complex
@@ -436,7 +436,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
   have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]
   convert Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn =>
     (GammaSeq_mul z hn).symm)) (Tendsto.mul _ _)
-  · convert tendsto_coe_nat_div_add_atTop (1 - z) using 1; ext1 n; rw [add_sub_assoc]
+  · convert tendsto_natCast_div_add_atTop (1 - z) using 1; ext1 n; rw [add_sub_assoc]
   · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp
     convert tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
     rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel₀ _ pi_ne]
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -429,7 +429,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
       neg_eq_iff_eq_neg] at hk
     rw [hk]
     cases k
-    · rw [Int.ofNat_eq_coe, Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, zero_mul]
+    · rw [Int.ofNat_eq_coe, Int.cast_natCast, Complex.Gamma_neg_nat_eq_zero, zero_mul]
     · rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel_left,
         Complex.Gamma_neg_nat_eq_zero, mul_zero]
   refine' tendsto_nhds_unique ((GammaSeq_tendsto_Gamma z).mul (GammaSeq_tendsto_Gamma <| 1 - z)) _
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -191,12 +191,12 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
   rw [add_sub_cancel_right, add_sub_cancel_right] 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 [F, mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def,
+    simp only [F, mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne,
       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 [F, 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]
+      eq_self_iff_true, Ne, 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
chore: Rename IsROrC to RCLike (#10819)

IsROrC contains data, which goes against the expectation that classes prefixed with Is are prop-valued. People have been complaining about this on and off, so this PR renames IsROrC to RCLike.

Diff
@@ -305,7 +305,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     · refine' intervalIntegral.intervalIntegrable_cpow' _
       rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
     · apply Continuous.continuousOn
-      exact IsROrC.continuous_ofReal.comp -- Porting note: was `continuity`
+      exact RCLike.continuous_ofReal.comp -- Porting note: was `continuity`
         ((continuous_const.sub (continuous_id'.div_const ↑n)).pow n)
   -- pointwise limit of f
   have f_tends : ∀ x : ℝ, x ∈ Ioi (0 : ℝ) →
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -95,7 +95,7 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v := b
     (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,
+    simp only [neg_mul, one_mul, ofReal_add, ofReal_neg, ofReal_one, sub_add_cancel_right, 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
@@ -124,11 +124,11 @@ theorem betaIntegral_scaled (s t : ℂ) {a : ℝ} (ha : 0 < a) :
   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 [← 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']
+    rw [mul_sub, mul_one, mul_div_cancel₀ _ ha']
 #align complex.beta_integral_scaled Complex.betaIntegral_scaled
 
 /-- Relation between Beta integral and Gamma function.  -/
@@ -188,7 +188,7 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     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
+  rw [add_sub_cancel_right, add_sub_cancel_right] 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 [F, mul_eq_zero, ofReal_zero, cpow_eq_zero_iff, eq_self_iff_true, Ne.def,
@@ -263,13 +263,13 @@ theorem GammaSeq_add_one_left (s : ℂ) {n : ℕ} (hn : n ≠ 0) :
 
 theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (hn : n ≠ 0) :
     GammaSeq s n = ∫ x : ℝ in (0)..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) := by
-  have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel]; exact Nat.cast_ne_zero.mpr hn
+  have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel₀]; exact Nat.cast_ne_zero.mpr hn
   conv_rhs => enter [1, x, 2, 1]; rw [this x]
   rw [GammaSeq_eq_betaIntegral_of_re_pos hs]
   have := intervalIntegral.integral_comp_div (a := 0) (b := n)
     (fun x => ↑((1 - x) ^ n) * ↑(x * ↑n) ^ (s - 1) : ℝ → ℂ) (Nat.cast_ne_zero.mpr hn)
   dsimp only at this
-  rw [betaIntegral, this, real_smul, zero_div, div_self, add_sub_cancel,
+  rw [betaIntegral, this, real_smul, zero_div, div_self, add_sub_cancel_right,
     ← intervalIntegral.integral_const_mul, ← intervalIntegral.integral_const_mul]
   swap; · exact Nat.cast_ne_zero.mpr hn
   simp_rw [intervalIntegral.integral_of_le zero_le_one]
@@ -400,7 +400,7 @@ theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   have aux : ∀ a b c d : ℂ, a * b * (c * d) = a * c * (b * d) := by intros; ring
   rw [GammaSeq, GammaSeq, div_mul_div_comm, aux, ← pow_two]
   have : (n : ℂ) ^ z * (n : ℂ) ^ (1 - z) = n := by
-    rw [← cpow_add _ _ (Nat.cast_ne_zero.mpr hn), add_sub_cancel'_right, cpow_one]
+    rw [← cpow_add _ _ (Nat.cast_ne_zero.mpr hn), add_sub_cancel, cpow_one]
   rw [this, Finset.prod_range_succ', Finset.prod_range_succ, aux, ← Finset.prod_mul_distrib,
     Nat.cast_zero, add_zero, add_comm (1 - z) n, ← add_sub_assoc]
   have : ∀ j : ℕ, (z + ↑(j + 1)) * (↑1 - z + ↑j) =
@@ -413,7 +413,7 @@ theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   rw [Finset.prod_mul_distrib, ← Nat.cast_prod, Finset.prod_pow,
     Finset.prod_range_add_one_eq_factorial, Nat.cast_pow,
     (by intros; ring : ∀ a b c d : ℂ, a * b * (c * d) = a * (d * (b * c))), ← div_div,
-    mul_div_cancel, ← div_div, mul_comm z _, mul_one_div]
+    mul_div_cancel_right₀, ← div_div, mul_comm z _, mul_one_div]
   exact pow_ne_zero 2 (Nat.cast_ne_zero.mpr <| Nat.factorial_ne_zero n)
 #align complex.Gamma_seq_mul Complex.GammaSeq_mul
 
@@ -430,7 +430,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
     rw [hk]
     cases k
     · rw [Int.ofNat_eq_coe, Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, zero_mul]
-    · rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel',
+    · rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel_left,
         Complex.Gamma_neg_nat_eq_zero, mul_zero]
   refine' tendsto_nhds_unique ((GammaSeq_tendsto_Gamma z).mul (GammaSeq_tendsto_Gamma <| 1 - z)) _
   have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]
@@ -439,7 +439,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
   · convert tendsto_coe_nat_div_add_atTop (1 - z) using 1; ext1 n; rw [add_sub_assoc]
   · have : ↑π / sin (↑π * z) = 1 / (sin (π * z) / π) := by field_simp
     convert tendsto_const_nhds.div _ (div_ne_zero hs pi_ne)
-    rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel _ pi_ne]
+    rw [← tendsto_mul_iff_of_ne_zero tendsto_const_nhds pi_ne, div_mul_cancel₀ _ pi_ne]
     convert tendsto_euler_sin_prod z using 1
     ext1 n; rw [mul_comm, ← mul_assoc]
 #align complex.Gamma_mul_Gamma_one_sub Complex.Gamma_mul_Gamma_one_sub
chore: golf using filter_upwards (#11208)

This is presumably not exhaustive, but covers about a hundred instances.

Style opinions (e.g., why a particular change is great/not a good idea) are very welcome; I'm still forming my own.

Diff
@@ -313,7 +313,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     intro x hx
     apply Tendsto.congr'
     show ∀ᶠ n : ℕ in atTop, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
-    · refine' Eventually.mp (eventually_ge_atTop ⌈x⌉₊) (eventually_of_forall fun n hn => _)
+    · filter_upwards [eventually_ge_atTop ⌈x⌉₊] with n hn
       rw [Nat.ceil_le] at hn
       dsimp only [f]
       rw [indicator_of_mem]
@@ -334,7 +334,8 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
       Measure.restrict_restrict_of_subset Ioc_subset_Ioi_self]
   -- f is uniformly bounded by the Gamma integrand
   · intro n
-    refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
+    rw [ae_restrict_iff' measurableSet_Ioi]
+    filter_upwards with x hx
     dsimp only [f]
     rcases lt_or_le (n : ℝ) x with (hxn | hxn)
     · rw [indicator_of_not_mem (not_mem_Ioc_of_gt hxn), norm_zero,
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -191,11 +191,11 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re 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]
+    simp only [F, 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,
+    simp only [F, 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,
@@ -315,7 +315,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     show ∀ᶠ n : ℕ in atTop, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1) = f n x
     · refine' Eventually.mp (eventually_ge_atTop ⌈x⌉₊) (eventually_of_forall fun n hn => _)
       rw [Nat.ceil_le] at hn
-      dsimp only
+      dsimp only [f]
       rw [indicator_of_mem]
       exact ⟨hx, hn⟩
     · simp_rw [mul_comm]
@@ -335,7 +335,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
   -- f is uniformly bounded by the Gamma integrand
   · intro n
     refine' (ae_restrict_iff' measurableSet_Ioi).mpr (ae_of_all _ fun x hx => _)
-    dsimp only
+    dsimp only [f]
     rcases lt_or_le (n : ℝ) x with (hxn | hxn)
     · rw [indicator_of_not_mem (not_mem_Ioc_of_gt hxn), norm_zero,
         mul_nonneg_iff_right_nonneg_of_pos (exp_pos _)]
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -584,7 +584,7 @@ theorem Gamma_mul_Gamma_add_half (s : ℂ) :
     apply Differentiable.mul
     · exact differentiable_one_div_Gamma.comp (differentiable_id'.const_mul _)
     · refine' fun t => DifferentiableAt.const_cpow _ (Or.inl two_ne_zero)
-      refine' DifferentiableAt.sub_const (differentiableAt_id.const_mul _) _
+      exact DifferentiableAt.sub_const (differentiableAt_id.const_mul _) _
   have h3 : Tendsto ((↑) : ℝ → ℂ) (𝓝[≠] 1) (𝓝[≠] 1) := by
     rw [tendsto_nhdsWithin_iff]; constructor
     · exact tendsto_nhdsWithin_of_tendsto_nhds continuous_ofReal.continuousAt
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -491,8 +491,8 @@ noncomputable def GammaSeq (s : ℝ) (n : ℕ) :=
 
 /-- Euler's limit formula for the real Gamma function. -/
 theorem GammaSeq_tendsto_Gamma (s : ℝ) : Tendsto (GammaSeq s) atTop (𝓝 <| Gamma s) := by
-  suffices : Tendsto ((↑) ∘ GammaSeq s : ℕ → ℂ) atTop (𝓝 <| Complex.Gamma s)
-  exact (Complex.continuous_re.tendsto (Complex.Gamma ↑s)).comp this
+  suffices Tendsto ((↑) ∘ GammaSeq s : ℕ → ℂ) atTop (𝓝 <| Complex.Gamma s) by
+    exact (Complex.continuous_re.tendsto (Complex.Gamma ↑s)).comp this
   convert Complex.GammaSeq_tendsto_Gamma s
   ext1 n
   dsimp only [GammaSeq, Function.comp_apply, Complex.GammaSeq]
@@ -539,7 +539,7 @@ theorem differentiable_one_div_Gamma : Differentiable ℂ fun s : ℂ => (Gamma
   induction n generalizing s with
   | zero =>
     rw [Nat.cast_zero, neg_lt_zero] at hs
-    suffices : ∀ m : ℕ, s ≠ -↑m; exact (differentiableAt_Gamma _ this).inv (Gamma_ne_zero this)
+    suffices ∀ m : ℕ, s ≠ -↑m from (differentiableAt_Gamma _ this).inv (Gamma_ne_zero this)
     rintro m rfl
     apply hs.not_le
     simp
feat: Basic Complex lemmas (#9527)

and rename ofReal_mul_re → re_mul_ofReal, ofReal_mul_im → im_mul_ofReal.

From LeanAPAP

Diff
@@ -459,7 +459,7 @@ theorem Gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
       rw [Complex.sin_ne_zero_iff]
       intro k
       apply_fun im
-      rw [ofReal_mul_im, ← ofReal_int_cast, ← ofReal_mul, ofReal_im]
+      rw [im_ofReal_mul, ← ofReal_int_cast, ← ofReal_mul, ofReal_im]
       exact mul_ne_zero Real.pi_pos.ne' h_im
     have A := div_ne_zero (ofReal_ne_zero.mpr Real.pi_pos.ne') this
     rw [← Complex.Gamma_mul_Gamma_one_sub s, mul_ne_zero_iff] at A
chore: Rename rpow_nonneg_of_nonneg to rpow_nonneg (#9518)

This better matches other lemma names.

From LeanAPAP

Diff
@@ -339,7 +339,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     rcases lt_or_le (n : ℝ) x with (hxn | hxn)
     · rw [indicator_of_not_mem (not_mem_Ioc_of_gt hxn), norm_zero,
         mul_nonneg_iff_right_nonneg_of_pos (exp_pos _)]
-      exact rpow_nonneg_of_nonneg (le_of_lt hx) _
+      exact rpow_nonneg (le_of_lt hx) _
     · rw [indicator_of_mem (mem_Ioc.mpr ⟨mem_Ioi.mp hx, hxn⟩), norm_mul, Complex.norm_eq_abs,
         Complex.abs_of_nonneg
           (pow_nonneg (sub_nonneg.mpr <| div_le_one_of_le hxn <| by positivity) _),
chore(SpecialFunctions/Gamma): golf a proof (#9277)

Use induction .. generalizing instead of suffices.

Diff
@@ -532,26 +532,21 @@ theorem one_div_Gamma_eq_self_mul_one_div_Gamma_add_one (s : ℂ) :
   · rw [zero_add, Gamma_zero, inv_zero, zero_mul]
 #align complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one Complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one
 
-/-- The reciprocal of the Gamma function is differentiable everywhere (including the points where
-Gamma itself is not). -/
-theorem differentiable_one_div_Gamma : Differentiable ℂ fun s : ℂ => (Gamma s)⁻¹ := by
-  suffices : ∀ n : ℕ, ∀ (s : ℂ) (_ : -s.re < n), DifferentiableAt ℂ (fun u : ℂ => (Gamma u)⁻¹) s
-  exact fun s =>
-    let ⟨n, h⟩ := exists_nat_gt (-s.re)
-    this n s h
-  intro n
-  induction' n with m hm
-  · intro s hs
+/-- The reciprocal of the Gamma function is differentiable everywhere
+(including the points where Gamma itself is not). -/
+theorem differentiable_one_div_Gamma : Differentiable ℂ fun s : ℂ => (Gamma s)⁻¹ := fun s ↦ by
+  rcases exists_nat_gt (-s.re) with ⟨n, hs⟩
+  induction n generalizing s with
+  | zero =>
     rw [Nat.cast_zero, neg_lt_zero] at hs
     suffices : ∀ m : ℕ, s ≠ -↑m; exact (differentiableAt_Gamma _ this).inv (Gamma_ne_zero this)
-    contrapose! hs
-    rcases hs with ⟨m, rfl⟩
-    simpa only [neg_re, ← ofReal_nat_cast, ofReal_re, neg_nonpos] using Nat.cast_nonneg m
-  · intro s hs
+    rintro m rfl
+    apply hs.not_le
+    simp
+  | succ n ihn =>
     rw [funext one_div_Gamma_eq_self_mul_one_div_Gamma_add_one]
-    specialize hm (s + 1) (by rwa [add_re, one_re, neg_add', sub_lt_iff_lt_add, ← Nat.cast_succ])
-    refine' differentiableAt_id.mul (hm.comp s _)
-    exact differentiableAt_id.add (differentiableAt_const _)
+    specialize ihn (s + 1) (by rwa [add_re, one_re, neg_add', sub_lt_iff_lt_add, ← Nat.cast_succ])
+    exact differentiableAt_id.mul (ihn.comp s <| differentiableAt_id.add_const _)
 #align complex.differentiable_one_div_Gamma Complex.differentiable_one_div_Gamma
 
 end Complex
feat(Analysis/SpecialFunctions/Complex/Arg): add definition for slit plane and API, and use it (#9116)

In preparation of future PRs dealing with estimates of the complex logarithm and its Taylor series, this introduces Complex.slitPlane for the set of complex numbers not on the closed negative real axis (in Analysis.SpecialFunctions.Complex.Arg), adds a bunch of API lemmas, and replaces hypotheses of the form 0 < x.re ∨ x.im ≠ 0 by x ∈ slitPlane in several other files.

(We do not introduce a new file for that to avoid circular imports with Analysis.SpecialFunctions.Complex.Arg.)

Co-authored-by: Yury G. Kudryashov <urkud@urkud.name>

Diff
@@ -71,8 +71,8 @@ theorem betaIntegral_convergent_left {u : ℂ} (hu : 0 < re u) (v : ℂ) :
     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))
+    · norm_cast
+      exact ofReal_mem_slitPlane.2 <| by linarith only [hx.2]
 #align complex.beta_integral_convergent_left Complex.betaIntegral_convergent_left
 
 /-- The Beta integral is convergent for all `u, v` of positive real part. -/
feat: non-integrability results of derivatives on [a, +oo) (#8712)

We have in the library the lemma not_intervalIntegrable_of_tendsto_norm_atTop_of_deriv_isBigO_filter, saying that if a function tends to infinity at a point in an interval [a, b], then its derivative is not interval-integrable on [a, b]. We generalize this result to allow for any set instead of [a, b], and apply it to half-infinite intervals.

In particular, we characterize integrability of x^s on [a, +oo), and deduce that x^s is never integrable on [0, +oo). This makes it possible to remove one assumption in Lemma mellin_comp_rpow on the Mellin transform.

Diff
@@ -300,7 +300,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
     intro n
     rw [integrable_indicator_iff (measurableSet_Ioc : MeasurableSet (Ioc (_ : ℝ) _)), IntegrableOn,
       Measure.restrict_restrict_of_subset Ioc_subset_Ioi_self, ← IntegrableOn, ←
-      intervalIntegrable_iff_integrable_Ioc_of_le (by positivity : (0 : ℝ) ≤ n)]
+      intervalIntegrable_iff_integrableOn_Ioc_of_le (by positivity : (0 : ℝ) ≤ n)]
     apply IntervalIntegrable.continuousOn_mul
     · refine' intervalIntegral.intervalIntegrable_cpow' _
       rwa [sub_re, one_re, ← zero_sub, sub_lt_sub_iff_right]
chore: Remove nonterminal simp at (#7795)

Removes nonterminal uses of simp at. Replaces most of these with instances of simp? ... says.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -94,7 +94,9 @@ theorem betaIntegral_symm (u v : ℂ) : betaIntegral v u = betaIntegral u v := b
   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
+  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
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -40,8 +40,6 @@ refined properties of the Gamma function using these relations.
 
 noncomputable section
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
 set_option linter.uppercaseLean3 false
 
 open Filter intervalIntegral Set Real MeasureTheory
@@ -288,13 +286,13 @@ theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
 /-- The main techical lemma for `GammaSeq_tendsto_Gamma`, expressing the integral defining the
 Gamma function for `0 < re s` as the limit of a sequence of integrals over finite intervals. -/
 theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
-    Tendsto (fun n : ℕ => ∫ x : ℝ in (0)..n, ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1)) atTop
+    Tendsto (fun n : ℕ => ∫ x : ℝ in (0)..n, ((1 - x / n) ^ n : ℝ) * (x : ℂ) ^ (s - 1)) atTop
       (𝓝 <| Gamma s) := by
   rw [Gamma_eq_integral hs]
   -- We apply dominated convergence to the following function, which we will show is uniformly
   -- bounded above by the Gamma integrand `exp (-x) * x ^ (re s - 1)`.
   let f : ℕ → ℝ → ℂ := fun n =>
-    indicator (Ioc 0 (n : ℝ)) fun x : ℝ => ↑((1 - x / n) ^ n) * (x : ℂ) ^ (s - 1)
+    indicator (Ioc 0 (n : ℝ)) fun x : ℝ => ((1 - x / n) ^ n : ℝ) * (x : ℂ) ^ (s - 1)
   -- integrability of f
   have f_ible : ∀ n : ℕ, Integrable (f n) (volume.restrict (Ioi 0)) := by
     intro n
@@ -322,7 +320,7 @@ theorem approx_Gamma_integral_tendsto_Gamma_integral {s : ℂ} (hs : 0 < re s) :
       refine' (Tendsto.comp (continuous_ofReal.tendsto _) _).const_mul _
       convert tendsto_one_plus_div_pow_exp (-x) using 1
       ext1 n
-      rw [neg_div, ← sub_eq_add_neg]; norm_cast
+      rw [neg_div, ← sub_eq_add_neg]
   -- let `convert` identify the remaining goals
   convert tendsto_integral_of_dominated_convergence _ (fun n => (f_ible n).1)
     (Real.GammaIntegral_convergent hs) _
@@ -403,7 +401,7 @@ theorem GammaSeq_mul (z : ℂ) {n : ℕ} (hn : n ≠ 0) :
   rw [this, Finset.prod_range_succ', Finset.prod_range_succ, aux, ← Finset.prod_mul_distrib,
     Nat.cast_zero, add_zero, add_comm (1 - z) n, ← add_sub_assoc]
   have : ∀ j : ℕ, (z + ↑(j + 1)) * (↑1 - z + ↑j) =
-      ↑((j + 1) ^ 2) * (↑1 - z ^ 2 / ((j : ℂ) + 1) ^ 2) := by
+      ((j + 1) ^ 2 :) * (↑1 - z ^ 2 / ((j : ℂ) + 1) ^ 2) := by
     intro j
     push_cast
     have : (j : ℂ) + 1 ≠ 0 := by rw [← Nat.cast_succ, Nat.cast_ne_zero]; exact Nat.succ_ne_zero j
fix: deduplicate and make exp notation scoped (#7297)

Zulip

Diff
@@ -55,8 +55,6 @@ section BetaIntegral
 
 namespace Complex
 
-notation "cexp" => Complex.exp
-
 /-- 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)
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -432,7 +432,7 @@ theorem Gamma_mul_Gamma_one_sub (z : ℂ) : Gamma z * Gamma (1 - z) = π / sin (
     cases k
     · rw [Int.ofNat_eq_coe, Int.cast_ofNat, Complex.Gamma_neg_nat_eq_zero, zero_mul]
     · rw [Int.cast_negSucc, neg_neg, Nat.cast_add, Nat.cast_one, add_comm, sub_add_cancel',
-        Complex.Gamma_neg_nat_eq_zero, MulZeroClass.mul_zero]
+        Complex.Gamma_neg_nat_eq_zero, mul_zero]
   refine' tendsto_nhds_unique ((GammaSeq_tendsto_Gamma z).mul (GammaSeq_tendsto_Gamma <| 1 - z)) _
   have : ↑π / sin (↑π * z) = 1 * (π / sin (π * z)) := by rw [one_mul]
   convert Tendsto.congr' ((eventually_ne_atTop 0).mp (eventually_of_forall fun n hn =>
@@ -451,7 +451,7 @@ theorem Gamma_ne_zero {s : ℂ} (hs : ∀ m : ℕ, s ≠ -m) : Gamma s ≠ 0 :=
   by_cases h_im : s.im = 0
   · have : s = ↑s.re := by
       conv_lhs => rw [← Complex.re_add_im s]
-      rw [h_im, ofReal_zero, MulZeroClass.zero_mul, add_zero]
+      rw [h_im, ofReal_zero, zero_mul, add_zero]
     rw [this, Gamma_ofReal, ofReal_ne_zero]
     refine' Real.Gamma_ne_zero fun n => _
     specialize hs n
@@ -531,7 +531,7 @@ theorem one_div_Gamma_eq_self_mul_one_div_Gamma_add_one (s : ℂ) :
     (Gamma s)⁻¹ = s * (Gamma (s + 1))⁻¹ := by
   rcases ne_or_eq s 0 with (h | rfl)
   · rw [Gamma_add_one s h, mul_inv, mul_inv_cancel_left₀ h]
-  · rw [zero_add, Gamma_zero, inv_zero, MulZeroClass.zero_mul]
+  · rw [zero_add, Gamma_zero, inv_zero, zero_mul]
 #align complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one Complex.one_div_Gamma_eq_self_mul_one_div_Gamma_add_one
 
 /-- The reciprocal of the Gamma function is differentiable everywhere (including the points where
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -190,7 +190,6 @@ theorem betaIntegral_recurrence {u v : ℂ} (hu : 0 < re u) (hv : 0 < re v) :
     ring
   have h_int := ((betaIntegral_convergent hu hv').const_mul u).sub
     ((betaIntegral_convergent hu' hv).const_mul v)
-  dsimp only at h_int
   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
chore: regularize HPow.hPow porting notes (#6465)
Diff
@@ -40,7 +40,7 @@ refined properties of the Gamma function using these relations.
 
 noncomputable section
 
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
 
 set_option linter.uppercaseLean3 false
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2023 David Loeffler. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: David Loeffler
-
-! This file was ported from Lean 3 source module analysis.special_functions.gamma.beta
-! leanprover-community/mathlib commit a3209ddf94136d36e5e5c624b10b2a347cc9d090
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 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
 
feat(MeasureTheory.Integral.Bochner): drop completeness requirement from the definition (#5910)

The notion of Bochner integral of a function taking values in a normed space E requires that E is complete. This means that whenever we write down an integral, the term contains the assertion that E is complete.

In this PR, we remove the completeness requirement from the definition, using the junk value 0 when the space is not complete. Mathematically this does not make any difference, as all reasonable applications will be with a complete E. But it means that terms involving integrals become a little bit simpler and that completeness will not have to be checked by the system when applying a bunch of basic lemmas on integrals.

Diff
@@ -272,7 +272,7 @@ theorem GammaSeq_eq_approx_Gamma_integral {s : ℂ} (hs : 0 < re s) {n : ℕ} (h
   have : ∀ x : ℝ, x = x / n * n := by intro x; rw [div_mul_cancel]; exact Nat.cast_ne_zero.mpr hn
   conv_rhs => enter [1, x, 2, 1]; rw [this x]
   rw [GammaSeq_eq_betaIntegral_of_re_pos hs]
-  have := @intervalIntegral.integral_comp_div _ _ _ _ 0 n _
+  have := intervalIntegral.integral_comp_div (a := 0) (b := n)
     (fun x => ↑((1 - x) ^ n) * ↑(x * ↑n) ^ (s - 1) : ℝ → ℂ) (Nat.cast_ne_zero.mpr hn)
   dsimp only at this
   rw [betaIntegral, this, real_smul, zero_div, div_self, add_sub_cancel,
feat: port Analysis.SpecialFunctions.Gamma.Beta (#5514)

Dependencies 12 + 1174

1175 files ported (99.0%)
527738 lines ported (98.9%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file