Theorem: EulerSine.integral_cos_mul_cos_pow_aux
File: Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean

tactic: have der1 :
  ∀ x : ℝ,
    x ∈ uIcc 0 (π / 2) →
      HasDerivAt (fun y : ℝ => (cos y : ℂ) ^ n) (-n * sin x * (cos x : ℂ) ^ (n - 1)) x := by
  intro x _
  have b : HasDerivAt (fun y : ℝ => (cos y : ℂ)) (-sin x) x := by
    simpa using (hasDerivAt_cos x).ofReal_comp
  convert HasDerivAt.comp x (hasDerivAt_pow _ _) b using 1
  ring
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
⊢ (∫ (x : ℝ) in 0 ..π / 2, Complex.cos (2 * z * ↑x) * ↑(cos x) ^ n) =
    ↑n / (2 * z) * ∫ (x : ℝ) in 0 ..π / 2, Complex.sin (2 * z * ↑x) * ↑(sin x) * ↑(cos x) ^ (n - 1)

tactic: convert (config := { sameFun := true })
  integral_mul_deriv_eq_deriv_mul der1 (fun x _ => antideriv_cos_comp_const_mul hz x) _ _ using 2
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ (∫ (x : ℝ) in 0 ..π / 2, Complex.cos (2 * z * ↑x) * ↑(cos x) ^ n) =
    ↑n / (2 * z) * ∫ (x : ℝ) in 0 ..π / 2, Complex.sin (2 * z * ↑x) * ↑(sin x) * ↑(cos x) ^ (n - 1)

tactic: intro x _
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
⊢ ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x

tactic: have b : HasDerivAt (fun y : ℝ => (cos y : ℂ)) (-sin x) x := by
  simpa using (hasDerivAt_cos x).ofReal_comp
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
x : ℝ
a✝ : x ∈ uIcc 0 (π / 2)
⊢ HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x

tactic: convert HasDerivAt.comp x (hasDerivAt_pow _ _) b using 1
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
x : ℝ
a✝ : x ∈ uIcc 0 (π / 2)
b : HasDerivAt (fun y => ↑(cos y)) (-↑(sin x)) x
⊢ HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x

tactic: ring
state_before: case h.e'_7
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
x : ℝ
a✝ : x ∈ uIcc 0 (π / 2)
b : HasDerivAt (fun y => ↑(cos y)) (-↑(sin x)) x
⊢ -↑n * ↑(sin x) * ↑(cos x) ^ (n - 1) = ↑n * ↑(cos x) ^ (n - 1) * -↑(sin x)

tactic: simpa using (hasDerivAt_cos x).ofReal_comp
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
x : ℝ
a✝ : x ∈ uIcc 0 (π / 2)
⊢ HasDerivAt (fun y => ↑(cos y)) (-↑(sin x)) x

tactic: ext1 x
state_before: case h.e'_2.h.e'_5
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ (fun x => Complex.cos (2 * z * ↑x) * ↑(cos x) ^ n) = fun x => ↑(cos x) ^ n * Complex.cos (2 * z * ↑x)

tactic: rw [mul_comm]
state_before: case h.e'_2.h.e'_5.h
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
x : ℝ
⊢ Complex.cos (2 * z * ↑x) * ↑(cos x) ^ n = ↑(cos x) ^ n * Complex.cos (2 * z * ↑x)

tactic: rw [Complex.ofReal_zero, MulZeroClass.mul_zero, Complex.sin_zero, zero_div,
  MulZeroClass.mul_zero, sub_zero, cos_pi_div_two, Complex.ofReal_zero,
  zero_pow (by positivity : 0 < n), MulZeroClass.zero_mul, zero_sub, ← integral_neg, ←
  integral_const_mul]
state_before: case h.e'_3
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ (↑n / (2 * z) * ∫ (x : ℝ) in 0 ..π / 2, Complex.sin (2 * z * ↑x) * ↑(sin x) * ↑(cos x) ^ (n - 1)) =
    ↑(cos (π / 2)) ^ n * (Complex.sin (2 * z * ↑(π / 2)) / (2 * z)) -
        ↑(cos 0) ^ n * (Complex.sin (2 * z * ↑0) / (2 * z)) -
      ∫ (x : ℝ) in 0 ..π / 2, -↑n * ↑(sin x) * ↑(cos x) ^ (n - 1) * (Complex.sin (2 * z * ↑x) / (2 * z))

tactic: refine' integral_congr fun x _ => _
state_before: case h.e'_3
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ (∫ (x : ℝ) in 0 ..π / 2, ↑n / (2 * z) * (Complex.sin (2 * z * ↑x) * ↑(sin x) * ↑(cos x) ^ (n - 1))) =
    ∫ (x : ℝ) in 0 ..π / 2, -(-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1) * (Complex.sin (2 * z * ↑x) / (2 * z)))

tactic: field_simp
state_before: case h.e'_3
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
x : ℝ
x✝ : x ∈ uIcc 0 (π / 2)
⊢ ↑n / (2 * z) * (Complex.sin (2 * z * ↑x) * ↑(sin x) * ↑(cos x) ^ (n - 1)) =
    -(-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1) * (Complex.sin (2 * z * ↑x) / (2 * z)))

tactic: ring
state_before: case h.e'_3
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
x : ℝ
x✝ : x ∈ uIcc 0 (π / 2)
⊢ ↑n * (Complex.sin (2 * z * ↑x) * Complex.sin ↑x * Complex.cos ↑x ^ (n - 1)) =
    ↑n * Complex.sin ↑x * Complex.cos ↑x ^ (n - 1) * Complex.sin (2 * z * ↑x)

tactic: positivity
state_before: z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ 0 < n

tactic: apply Continuous.intervalIntegrable
state_before: case convert_1
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ IntervalIntegrable (fun x => -↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) volume 0 (π / 2)

tactic: exact
  (continuous_const.mul (Complex.continuous_ofReal.comp continuous_sin)).mul
    ((Complex.continuous_ofReal.comp continuous_cos).pow (n - 1))
state_before: case convert_1.hu
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ Continuous fun x => -↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)

tactic: apply Continuous.intervalIntegrable
state_before: case convert_2
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ IntervalIntegrable (fun x => Complex.cos (2 * z * ↑x)) volume 0 (π / 2)

tactic: exact Complex.continuous_cos.comp (continuous_const.mul Complex.continuous_ofReal)
state_before: case convert_2.hu
z : ℂ
n : ℕ
hn : 2 ≤ n
hz : z ≠ 0
der1 : ∀ (x : ℝ), x ∈ uIcc 0 (π / 2) → HasDerivAt (fun y => ↑(cos y) ^ n) (-↑n * ↑(sin x) * ↑(cos x) ^ (n - 1)) x
⊢ Continuous fun x => Complex.cos (2 * z * ↑x)