Theorem: Complex.integral_rpow_mul_exp_neg_rpow
File: Mathlib/MeasureTheory/Integral/Gamma.lean

tactic: calc
  _ = ∫ x in Ioi (0:ℝ) ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) := by
    rw [← Complex.integral_comp_polarCoord_symm, polarCoord_target]
    simp_rw [Complex.norm_eq_abs, Complex.polardCoord_symm_abs, smul_eq_mul]
  _ = (∫ x in Ioi (0:ℝ), x * |x| ^ q * rexp (-|x| ^ p)) * ∫ _ in Ioo (-π) π, 1 := by
    rw [← setIntegral_prod_mul, volume_eq_prod]
    simp_rw [mul_one]
    congr! 2; ring
  _ = 2 * π * ∫ x in Ioi (0:ℝ), x * |x| ^ q * rexp (-|x| ^ p) := by
    simp_rw [integral_const, Measure.restrict_apply MeasurableSet.univ, Set.univ_inter,
      volume_Ioo, sub_neg_eq_add, ← two_mul, ENNReal.toReal_ofReal (by positivity : 0 ≤ 2 * π),
      smul_eq_mul, mul_one, mul_comm]
  _ = 2 * π * ∫ x in Ioi (0:ℝ), x ^ (q + 1) * rexp (-x ^ p) := by
    congr 1
    refine setIntegral_congr measurableSet_Ioi (fun x hx => ?_)
    rw [abs_eq_self.mpr (le_of_lt (by exact hx)), rpow_add hx, rpow_one]
    ring
  _ = (2 * Real.pi / p) * Real.Gamma ((q + 2) / p) := by
    rw [_root_.integral_rpow_mul_exp_neg_rpow (by linarith) (by linarith), add_assoc,
      one_add_one_eq_two]
    ring
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℂ), ‖x‖ ^ q * rexp (-‖x‖ ^ p) = 2 * π / p * Real.Gamma ((q + 2) / p)
state_after: no goals

tactic: rw [← Complex.integral_comp_polarCoord_symm, polarCoord_target]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℂ), ‖x‖ ^ q * rexp (-‖x‖ ^ p) = ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p))
state_after: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (p_1 : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π,
      p_1.1 • (‖↑Complex.polarCoord.symm p_1‖ ^ q * rexp (-‖↑Complex.polarCoord.symm p_1‖ ^ p)) =
    ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p))

tactic: simp_rw [Complex.norm_eq_abs, Complex.polardCoord_symm_abs, smul_eq_mul]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (p_1 : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π,
      p_1.1 • (‖↑Complex.polarCoord.symm p_1‖ ^ q * rexp (-‖↑Complex.polarCoord.symm p_1‖ ^ p)) =
    ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p))
state_after: no goals

tactic: rw [← setIntegral_prod_mul, volume_eq_prod]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) =
    (∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p)) * ∫ (x : ℝ) in Ioo (-π) π, 1
state_after: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) ∂volume.prod volume =
    ∫ (z : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, z.1 * |z.1| ^ q * rexp (-|z.1| ^ p) * 1 ∂volume.prod volume

tactic: simp_rw [mul_one]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) ∂volume.prod volume =
    ∫ (z : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, z.1 * |z.1| ^ q * rexp (-|z.1| ^ p) * 1 ∂volume.prod volume
state_after: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) ∂volume.prod volume =
    ∫ (z : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, z.1 * |z.1| ^ q * rexp (-|z.1| ^ p) ∂volume.prod volume

tactic: congr! 2
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, x.1 * (|x.1| ^ q * rexp (-|x.1| ^ p)) ∂volume.prod volume =
    ∫ (z : ℝ × ℝ) in Ioi 0 ×ˢ Ioo (-π) π, z.1 * |z.1| ^ q * rexp (-|z.1| ^ p) ∂volume.prod volume
state_after: case h.e'_7.h
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x✝ : ℝ × ℝ
⊢ x✝.1 * (|x✝.1| ^ q * rexp (-|x✝.1| ^ p)) = x✝.1 * |x✝.1| ^ q * rexp (-|x✝.1| ^ p)

tactic: ring
state_before: case h.e'_7.h
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x✝ : ℝ × ℝ
⊢ x✝.1 * (|x✝.1| ^ q * rexp (-|x✝.1| ^ p)) = x✝.1 * |x✝.1| ^ q * rexp (-|x✝.1| ^ p)
state_after: no goals

tactic: simp_rw [integral_const, Measure.restrict_apply MeasurableSet.univ, Set.univ_inter,
  volume_Ioo, sub_neg_eq_add, ← two_mul, ENNReal.toReal_ofReal (by positivity : 0 ≤ 2 * π),
  smul_eq_mul, mul_one, mul_comm]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ (∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p)) * ∫ (x : ℝ) in Ioo (-π) π, 1 =
    2 * π * ∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p)
state_after: no goals

tactic: positivity
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 0 ≤ 2 * π
state_after: no goals

tactic: congr 1
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 2 * π * ∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p) = 2 * π * ∫ (x : ℝ) in Ioi 0, x ^ (q + 1) * rexp (-x ^ p)
state_after: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p) = ∫ (x : ℝ) in Ioi 0, x ^ (q + 1) * rexp (-x ^ p)

tactic: refine setIntegral_congr measurableSet_Ioi (fun x hx => ?_)
state_before: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ ∫ (x : ℝ) in Ioi 0, x * |x| ^ q * rexp (-|x| ^ p) = ∫ (x : ℝ) in Ioi 0, x ^ (q + 1) * rexp (-x ^ p)
state_after: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x : ℝ
hx : x ∈ Ioi 0
⊢ x * |x| ^ q * rexp (-|x| ^ p) = x ^ (q + 1) * rexp (-x ^ p)

tactic: rw [abs_eq_self.mpr (le_of_lt (by exact hx)), rpow_add hx, rpow_one]
state_before: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x : ℝ
hx : x ∈ Ioi 0
⊢ x * |x| ^ q * rexp (-|x| ^ p) = x ^ (q + 1) * rexp (-x ^ p)
state_after: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x : ℝ
hx : x ∈ Ioi 0
⊢ x * x ^ q * rexp (-x ^ p) = x ^ q * x * rexp (-x ^ p)

tactic: ring
state_before: case e_a
p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x : ℝ
hx : x ∈ Ioi 0
⊢ x * x ^ q * rexp (-x ^ p) = x ^ q * x * rexp (-x ^ p)
state_after: no goals

tactic: exact hx
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
x : ℝ
hx : x ∈ Ioi 0
⊢ 0 < x
state_after: no goals

tactic: rw [_root_.integral_rpow_mul_exp_neg_rpow (by linarith) (by linarith), add_assoc,
  one_add_one_eq_two]
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 2 * π * ∫ (x : ℝ) in Ioi 0, x ^ (q + 1) * rexp (-x ^ p) = 2 * π / p * Real.Gamma ((q + 2) / p)
state_after: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 2 * π * (1 / p * Real.Gamma ((q + 2) / p)) = 2 * π / p * Real.Gamma ((q + 2) / p)

tactic: ring
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 2 * π * (1 / p * Real.Gamma ((q + 2) / p)) = 2 * π / p * Real.Gamma ((q + 2) / p)
state_after: no goals

tactic: linarith
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ 0 < p
state_after: no goals

tactic: linarith
state_before: p q : ℝ
hp : 1 ≤ p
hq : -2 < q
⊢ -1 < q + 1
state_after: no goals