Zulip Chat Archive

Stream: Is there code for X?

Topic: Complex derivatives treated as a real derivatives


Geoffrey Irving (Feb 16 2024 at 20:55):

Do we have this? My guess is that it exists in some quite abstract form, but I don't know where:

import Mathlib

/-- A complex derivative, treated as `ℂ →L[ℝ] → ℂ` -/
lemma Complex.real_hasFDerivAt {f :   } {z : } {f' : } (h : HasDerivAt f f' z) :
    HasFDerivAt f (ContinuousLinearMap.lsmul   f') z := by
  sorry

Geoffrey Irving (Feb 16 2024 at 20:58):

It's roughly

  1. HasDerivAt.hasFDerivAt
  2. Dropping a CLM over to one over , as these are an appropriate tower.
  3. A bit of commutativity at the end to swap left and right.

(2) is the only bit I don't know how to do idiomatically. (Unless the whole thing already exists.)

Jireh Loreaux (Feb 16 2024 at 21:03):

(2) is docs#ContinuousLinearMap.restrictScalars

Geoffrey Irving (Feb 16 2024 at 21:03):

Great, thank you!

Jireh Loreaux (Feb 16 2024 at 21:03):

But notice we also have docs#HasFDerivAt.restrictScalars

Geoffrey Irving (Feb 16 2024 at 21:04):

Even better, that's everything but the (3) bit.

Geoffrey Irving (Feb 16 2024 at 21:05):

Ah, no, that's also just (2).

Geoffrey Irving (Feb 16 2024 at 21:05):

But in any case I'm set.

Jireh Loreaux (Feb 16 2024 at 21:10):

This works as a proof:

import Mathlib

/-- A complex derivative, treated as `ℂ →L[ℝ] → ℂ` -/
lemma Complex.real_hasFDerivAt {f :   } {z : } {f' : } (h : HasDerivAt f f' z) :
    HasFDerivAt f (ContinuousLinearMap.lsmul   f') z := by
  convert h.hasFDerivAt.restrictScalars 
  ext
  exact mul_comm _ _

Geoffrey Irving (Feb 16 2024 at 21:11):

Ha, nice. I was stuck trying to simplify things at that third line, and was blocked because (1) ContinuousLinearMap.restrictScalars_apply doesn't exist and (2) ContinuousLinearMap.coe_restrictScalars wasn't firing.

Geoffrey Irving (Feb 16 2024 at 21:13):

Excellent, and now I can do things like

/-- A complex derivative, treated as `ℂ →L[ℝ] → ℂ` -/
lemma Complex.real_hasFDerivAt {f :   } {z : } {f' : } (h : HasDerivAt f f' z) :
    HasFDerivAt f (ContinuousLinearMap.lsmul   f') z := by
  convert h.hasFDerivAt.restrictScalars 
  ext
  exact mul_comm _ _

/-- The derivative of `.im` -/
lemma hasFDerivAt_im {z : } : HasFDerivAt Complex.im imCLM z := by
  have e : Complex.im = (fun z  imCLM z) := by ext z; simp only [Complex.imCLM_apply]
  rw [e]; apply ContinuousLinearMap.hasFDerivAt

/-- The derivative of `arg`, via `log` -/
lemma hasFDerivAt_arg {z : } (m : z  slitPlane) :
    HasFDerivAt arg (imCLM L ContinuousLinearMap.lsmul   z⁻¹) z := by
  have e : arg = (fun z  (log z).im) := by ext z; rw [Complex.log_im]
  rw [e]
  exact HasFDerivAt.comp _ hasDerivAt_im (Complex.real_hasFDerivAt (Complex.hasDerivAt_log m))

Geoffrey Irving (Feb 16 2024 at 21:14):

(Sorry, not a working example because of opens. :/)

Geoffrey Irving (Feb 16 2024 at 21:14):

I am using monotonicity of arg to show a region is star-shaped.


Last updated: May 02 2025 at 03:31 UTC