Zulip Chat Archive

Stream: Is there code for X?

Topic: Differentiability of the natural map ℝ → ℂ


Michael Stoll (Jan 25 2024 at 12:51):

I'm looking for

import Mathlib

namespace Complex

lemma differentiable_ofReal : Differentiable  ofReal' := by sorry

which I'm expecting to exist in Mathlib, but
@loogle "ifferentiable", "ofReal"

loogle (Jan 25 2024 at 12:51):

:shrug: nothing found

Michael Stoll (Jan 25 2024 at 12:53):

Can this really be missing, or am I looking for it in the wrong way?

Johan Commelin (Jan 25 2024 at 13:08):

cc @Yury G. Kudryashov

Michael Stoll (Jan 25 2024 at 13:10):

Here is a proof:

lemma differentiable_ofReal : Differentiable  ofReal' := by
  intro x
  have H : HasDerivAt ofReal' 1 x
  · refine hasDerivAt_iff_tendsto.mpr ?_
    simp only [Real.norm_eq_abs, real_smul, ofReal_sub, mul_one, sub_self, norm_zero, mul_zero,
      tendsto_const_nhds_iff]
  exact _, H.hasFDerivAt

(without investing too much thought).

Ruben Van de Velde (Jan 25 2024 at 13:11):

Can you derive it from isometry_ofReal?

Michael Stoll (Jan 25 2024 at 13:12):

There are docs#HasDerivAt.comp_ofReal and docs#HasDerivAt.ofReal_comp, which one could use, but it is a bit strange that the derivative of the function itself does not seem to be available.

Michael Stoll (Jan 25 2024 at 13:15):

A one-liner:

lemma differentiable_ofReal : Differentiable  ofReal' :=
  fun x  _, (HasDerivAt.ofReal_comp <| hasDerivAt_id x).hasFDerivAt

Michael Stoll (Jan 25 2024 at 13:18):

Maybe this is better:

lemma hasDerivAt_ofReal (x : ) : HasDerivAt ofReal' 1 x :=
  HasDerivAt.ofReal_comp <| hasDerivAt_id x

lemma differentiableAt_ofReal (x : ) : DifferentiableAt  ofReal' x :=
  (hasDerivAt_ofReal x).differentiableAt

lemma differentiable_ofReal : Differentiable  ofReal' :=
  fun x  _, (hasDerivAt_ofReal x).hasFDerivAt

Yury G. Kudryashov (Jan 25 2024 at 14:47):

If all you need is Differentiable, then the shortest proof is Complex.ofRealClm.differentiable.

Yury G. Kudryashov (Jan 25 2024 at 14:48):

But we should add a bunch of lemmas about Complex.ofReal' to the library.

Yury G. Kudryashov (Jan 25 2024 at 14:48):

Do you volunteer to do that?

Michael Stoll (Jan 25 2024 at 14:49):

docs#Complex.ofRealClm
Now I know what "Clm" stands for :smile:

Yury G. Kudryashov (Jan 25 2024 at 14:49):

BTW, it should be renamed to ofRealCLM

Yury G. Kudryashov (Jan 25 2024 at 14:49):

(in this and several other definitions)

Yury G. Kudryashov (Jan 25 2024 at 14:50):

Same for Cle -> CLE

Michael Stoll (Jan 25 2024 at 14:51):

Yury G. Kudryashov said:

Do you volunteer to do that?

I can do that eventually.

I have a fairly long list of API lemmas that should go to various parts of Mathlib and that I'm planning to PR at some point; I can include the lemmas I've stated above (and perhaps more if somebody tells me what else might be needed) in that list.

Yury G. Kudryashov (Jan 25 2024 at 14:53):

We should also have lemmas about ContDiffAt etc (if we don't have them yet).

Yury G. Kudryashov (Jan 25 2024 at 14:53):

Possibly, about iterated derivatives.

Anatole Dedecker (Jan 25 2024 at 15:33):

Yury G. Kudryashov said:

BTW, it should be renamed to ofRealCLM

Or ofRealL?

Jireh Loreaux (Jan 25 2024 at 15:48):

I prefer CLM personally. The L is too closely tied to notation.

Jireh Loreaux (Jan 25 2024 at 15:48):

And what would you call a non-continuous version (nevermind that we don't need one in this case)?

Anatole Dedecker (Jan 25 2024 at 16:00):

We have some names with the small l I believe?

Jireh Loreaux (Jan 25 2024 at 16:21):

My point is it doesn't adhere to the naming convention, e.g. Complex.OfReall. Or did you mean subscript \_l?

Ruben Van de Velde (Jan 25 2024 at 16:57):

Michael Stoll said:

Yury G. Kudryashov said:

Do you volunteer to do that?

I can do that eventually.

I have a fairly long list of API lemmas that should go to various parts of Mathlib and that I'm planning to PR at some point; I can include the lemmas I've stated above (and perhaps more if somebody tells me what else might be needed) in that list.

By the way, I recommend starting on making such PRs sooner rather than later, both to prevent the task from seeming insurmountable and so other people can use your work already

Anatole Dedecker (Jan 25 2024 at 17:08):

Jireh Loreaux said:

My point is it doesn't adhere to the naming convention, e.g. Complex.OfReall. Or did you mean subscript \_l?

Yes I meant subscript.

Jireh Loreaux (Jan 25 2024 at 17:43):

Yeah, that's possible, I suppose, but it still feels like we're letting notation infect naming.

Yury G. Kudryashov (Jan 26 2024 at 00:47):

#10018 fixes Clm/Cle


Last updated: May 02 2025 at 03:31 UTC