-- Mathlib/Analysis/SpecialFunctions/Trigonometric/EulerSineProd.lean
theorem antideriv_sin_comp_const_mul (hz : z ≠ 0) (x : ℝ) :
    HasDerivAt (fun y : ℝ => -Complex.cos (2 * z * y) / (2 * z)) (Complex.sin (2 * z * x)) x

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c :
  HasDerivAt (fun x => -((Complex.cos ∘ fun y => y * (2 * z)) ↑x / (2 * z)))
    (-(-Complex.sin (↑x * (2 * z)) * (2 * z) / (2 * z))) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
field_simp at c

Result:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c : HasDerivAt (fun x => -Complex.cos (↑x * (2 * z)) / (2 * z)) (Complex.sin (↑x * (2 * z))) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
have a : HasDerivAt (fun y : ℂ => y * (2 * z)) _ x := hasDerivAt_mul_const _

Result:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c : HasDerivAt (fun x => -Complex.cos (2 * z * ↑x) / (2 * z)) (Complex.sin (2 * z * ↑x)) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
exact c

Result:
no goals

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c : HasDerivAt (fun x => -Complex.cos (↑x * (2 * z)) / (2 * z)) (Complex.sin (↑x * (2 * z))) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
simp only [fun y => mul_comm y (2 * z)] at c

Result:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c : HasDerivAt (fun x => -Complex.cos (2 * z * ↑x) / (2 * z)) (Complex.sin (2 * z * ↑x)) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
have c := (b.comp_ofReal.div_const (2 * z)).neg

Result:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
c :
  HasDerivAt (fun x => -((Complex.cos ∘ fun y => y * (2 * z)) ↑x / (2 * z)))
    (-(-Complex.sin (↑x * (2 * z)) * (2 * z) / (2 * z))) x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Proof state:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x

Tactic:
have b : HasDerivAt (Complex.cos ∘ fun y : ℂ => (y * (2 * z))) _ x :=
  HasDerivAt.comp (x : ℂ) (Complex.hasDerivAt_cos (x * (2 * z))) a

Result:
z : ℂ
hz : z ≠ 0
x : ℝ
a : HasDerivAt (fun y => y * (2 * z)) (2 * z) ↑x
b : HasDerivAt (Complex.cos ∘ fun y => y * (2 * z)) (-Complex.sin (↑x * (2 * z)) * (2 * z)) ↑x
⊢ HasDerivAt (fun y => -Complex.cos (2 * z * ↑y) / (2 * z)) (Complex.sin (2 * z * ↑x)) x