Skip to content

feat(Mathematics/Calculus): coordinate Wirtinger calculus on ℂⁿ#1174

Merged
jstoobysmith merged 3 commits into
leanprover-community:masterfrom
pariandrea:wirtinger-coordinate
Jun 17, 2026
Merged

feat(Mathematics/Calculus): coordinate Wirtinger calculus on ℂⁿ#1174
jstoobysmith merged 3 commits into
leanprover-community:masterfrom
pariandrea:wirtinger-coordinate

Conversation

@pariandrea

Copy link
Copy Markdown
Contributor

Contents

Coordinate.lean specialises the directional Wirtinger calculus of Basic.lean
to the coordinate space ℂⁿ (spelled ι → ℂ for a Fintype ι), fixing the
direction to the I-th basis vector Pi.single I 1. It defines the coordinate
operators ∂_I f, ∂̄_I f as the partial Wirtinger derivatives in coordinate I,
and derives the computational rules that make the basis usable: the four Kronecker
coordinate values ∂_I z^J = δ_IJ, ∂̄_I z̄^J = δ_IJ, ∂̄_I z^J = ∂_I z̄^J = 0
(so z and behave as independent variables), real-linearity, the Leibniz and
finite-sum rules, inner-field conjugation, the two-term chain rule for an outer
g : ℂ → ℂ, the holomorphic/anti-holomorphic collapse, and the coordinate
specialisation of Schwarz's theorem, ∂_I ∂̄_J f = ∂̄_J ∂_I f on a field.

A real/complex restrictScalars bridge on the ι → ℂ domain
(differentiableAt_real_of_complex, fderivReal_apply_eq_complex) lets the
fderiv ℝ-based operators read off a holomorphic field's complex derivative,
the input to the collapse, with no restrictScalars appearing in any statement.

Motivation

Indexing the directional Wirtinger calculus by a coordinate I casts it in the
language of several complex variables: first derivatives ∂_I f assemble into a
gradient, mixed second derivatives ∂_I ∂̄_J f into a complex Hessian. By Schwarz
that Hessian is Hermitian, which is exactly Kähler-metric hermiticity for a real
potential K: g_{IJ̄} = ∂_I ∂̄_J K = star (g_{JĪ}). This is the calculus the N=1
SUSY formalisation runs on, with ι the chiral index.

Scope

This is the second instalment of a layered development (after #1163). The module
overview forward-references the downstream UpperHalfPlane application and the N=1
SUSY layer; both follow in subsequent PRs. The forward references are intentional.

AI disclosure

AI (Claude Code) was used extensively to draft lemma statements, proofs, and
documentation under my direction. I reviewed every declaration and take full
responsibility for the content.

Author responsibility

I am a PhD student in theoretical physics and am not an expert in complex calculus;
this development is needed for my current SUSY formalisation work. As with #1163, the
PR proves no novel mathematics: every result is the d = Pi.single I 1 specialisation
of a foundation lemma already merged in #1163, or a direct fderiv ℝ computation of a
coordinate projection. Correctness therefore rests on the machine-checked foundation
and Mathlib's Fréchet-derivative API, and the whole development compiles under the
kernel with no sorry and no new axioms.

References

Coordinate.lean adds no new external references; the notation and conventions are
inherited from Basic.lean (verified in #1163).

Lemmas and definitions added

No declarations are removed. All additions live in the new file, plus a one-line
import in Physlib.lean (the library aggregator).

Coordinate maps as continuous linear maps

  • coordProjCLM, coordProjCLM_apply — the I-th coordinate z^I = u I as an
    -linear CLM.
  • conjCoordCLM, conjCoordCLM_apply — the conjugated coordinate z̄^I = star (u I).
  • conjConfig, conjConfig_apply — pointwise conjugation of a point of ι → ℂ.
  • conjCLM, conjCLM_apply — pointwise conjugation bundled as an -linear CLM.
  • conjCLM_smul_IconjCLM is conjugate--linear, conj (i·d) = −(i · conj d).

§A — the coordinate operators

  • dWirtingerCoord, dWirtingerAntiCoord (def) — the coordinate Wirtinger operators
    ∂_I f, ∂̄_I f, definitionally the directional operators along Pi.single I 1.
  • dWirtingerCoord_eq_dWirtingerDir, dWirtingerAntiCoord_eq_dWirtingerAntiDir
    the definitional identification with the foundation operators.
  • dWirtingerCoord_apply, dWirtingerAntiCoord_apply — the real-Fréchet form
    ∂_I f = ½(∂_x ∓ i·∂_y) f, unconditional.

§B — the Pi-domain restrictScalars bridge

  • differentiableAt_real_of_complex — a -differentiable field on ι → ℂ is
    -differentiable.
  • fderivReal_apply_eq_complex — its real and complex Fréchet derivatives agree
    pointwise, fderiv ℝ f u d = fderiv ℂ f u d; no restrictScalars in the type.

§C — properties of dWirtingerCoord

  • dWirtingerCoord_congr_of_eventuallyEq_apply — locality at the base point.
  • dWirtingerCoord_const, dWirtingerCoord_zero — vanish on constants (@[simp]).
  • dWirtingerCoord_neg_apply — negation.
  • dWirtingerCoord_coordProj∂_I z^J = δ_IJ (@[simp]).
  • dWirtingerCoord_add_apply, dWirtingerCoord_smul_apply,
    dWirtingerCoord_mul_apply, dWirtingerCoord_fun_sum_apply — additivity,
    -linearity, Leibniz, the finite-sum rule.
  • dWirtingerCoord_eq_complex_fderiv_apply — holomorphic collapse,
    ∂_I f = fderiv ℂ f u (Pi.single I 1).
  • dWirtingerCoord_eq_zero_of_antiHolomorphic_apply∂_I annihilates an
    antiholomorphic field g ∘ conjConfig.

§D — properties of dWirtingerAntiCoord, and the coordinate values

  • dWirtingerAntiCoord_congr_of_eventuallyEq_apply, dWirtingerAntiCoord_const,
    dWirtingerAntiCoord_zero, dWirtingerAntiCoord_neg_apply,
    dWirtingerAntiCoord_add_apply, dWirtingerAntiCoord_smul_apply,
    dWirtingerAntiCoord_mul_apply, dWirtingerAntiCoord_fun_sum_apply — the §C
    mirror.
  • dWirtingerAntiCoord_coordProj∂̄_I z^J = 0 (@[simp]).
  • dWirtingerCoord_conjCoord∂_I z̄^J = 0.
  • dWirtingerAntiCoord_conjCoord∂̄_I z̄^J = δ_IJ.
  • dWirtingerAntiCoord_eq_complex_fderiv_apply — anti-holomorphic collapse for an
    antiholomorphic field.
  • dWirtingerAntiCoord_eq_zero_of_holomorphic_apply∂̄_I f = 0 for holomorphic f.
  • differentiable_coordDiff, dWirtingerCoord_coordDiff,
    dWirtingerAntiCoord_coordDiff — Wirtinger derivatives of the coordinate
    difference z^J − z̄^J, ∂_I = δ_IJ and ∂̄_I = −δ_IJ.

§E — Wirtinger chain rules for an outer function

  • dWirtingerCoord_comp_apply, dWirtingerAntiCoord_comp_apply — the two-term chain
    rule for an outer g : ℂ → ℂ, ∂_I(g∘f) = (∂g/∂f)·∂_I f + (∂g/∂f̄)·∂_I f̄.
  • dWirtingerCoord_comp_holomorphic_apply, dWirtingerAntiCoord_comp_holomorphic_apply
    — the single-term collapse deriv g (f u) · ∂_I f for holomorphic g.
  • dWirtingerCoord_star_comp_apply, dWirtingerAntiCoord_star_comp_apply
    conjugating the inner field swaps the operators, ∂_I f̄ = conj (∂̄_I f) and dual.

§F — Schwarz's theorem for the coordinate operators

  • differentiableAt_dWirtingerCoord, differentiableAt_dWirtingerAntiCoord — on a
    field a first coordinate derivative is itself real-differentiable.
  • dWirtingerCoord_dWirtingerAntiCoord_comm — Schwarz's theorem in coordinate form,
    ∂_I ∂̄_J f = ∂̄_J ∂_I f, the Pi.single specialisation of the foundation
    dWirtingerDir_dWirtingerAntiDir_comm.

Private helpers (not exported)

smul_single_one, clinear_of_holomorphic, fderiv_coordProj,
conjConfig_single_one, coordDiff_eq_add_neg, outerHolo_fderiv_restrictScalars,
outerHolo_clinear, dWirtingerDir_one_eq_deriv, dWirtingerAntiDir_one_eq_zero.

Reviewer map

Suggested reading order:

  1. Module overview (§i–§iii) — notation, the coordinate values, and the table
    of contents.
  2. §A — the two operator definitions and their real-Fréchet form.
  3. §B — the restrictScalars bridge feeding the holomorphic collapse.
  4. §C–§D — the dWirtingerCoord rules, then the dWirtingerAntiCoord mirror and
    the four Kronecker coordinate values.
  5. §E — the two-term chain rule and its holomorphic single-term collapse.
  6. §F — differentiability of a first derivative, then the capstone Schwarz
    theorem dWirtingerCoord_dWirtingerAntiCoord_comm.

Each holomorphic lemma is immediately followed by its anti-holomorphic dual, so the
two can be reviewed as a pair. Every rule is the d = Pi.single I 1 specialisation of
its Basic.lean analogue from #1163.

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this PR, which will now be reviewed. Please
see our review guidelines
if you are not familiar with the process. You should expect a back and forth
with a reviewer before your PR is merged. See also that link for how to
add appropriate labels to your PR. The PR will also go through a number
of automated checks. You can learn more about these here,
including how to run them locally.

If you want to bring attention to this PR, please write a message on this
thread of the Lean Zulip.

@jstoobysmith jstoobysmith self-assigned this Jun 16, 2026

@jstoobysmith jstoobysmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lot of lemmas and definitions here that I don't think actually need making (i.e. they are simple rewrites of things already in Mathlib).

variable {ι : Type*}

/-- The I-th coordinate `z^I = u I` as an ℝ-linear CLM on `ι → ℂ`. -/
def coordProjCLM (I : ι) : (ι → ℂ) →L[ℝ] ℂ := ContinuousLinearMap.proj (R := ℝ) I

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be needed here (can't we just use ContinuousLinearMap.proj )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise with the other results before section A. below.

omit [Fintype ι] in
/-- `c • Pi.single I 1 = Pi.single I c`: in particular the imaginary coordinate
direction `Pi.single I i` is `i` times the real one. -/
private lemma smul_single_one (I : ι) (c : ℂ) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed?

Comment on lines +239 to +240
(I : ι)
(u : (ι → ℂ)) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One line

lemma differentiableAt_real_of_complex {f : (ι → ℂ) → ℂ}
{u : (ι → ℂ)} (hf : DifferentiableAt ℂ f u) :
DifferentiableAt ℝ f u :=
(hf.hasFDerivAt.restrictScalars ℝ).differentiableAt

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed as a new lemma?

lemma fderivReal_apply_eq_complex {f : (ι → ℂ) → ℂ}
{u : (ι → ℂ)} (hf : DifferentiableAt ℂ f u)
(d : (ι → ℂ)) :
fderiv ℝ f u d = fderiv ℂ f u d := by

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise

@jstoobysmith jstoobysmith added the awaiting-author A reviewer has asked the author a question or requested changes label Jun 17, 2026
pariandrea and others added 3 commits June 17, 2026 11:31
Specialize the directional Wirtinger calculus of `Wirtinger.Basic` to the
standard coordinate basis on `ℂ^n` (`ι → ℂ`, `ι` a `Fintype`), fixing the
direction to the I-th basis vector `Pi.single I 1`. New file
`Wirtinger/Coordinate.lean` (registered in `Physlib.lean`) provides:

- `dWirtingerCoord` / `dWirtingerAntiCoord` (`∂_I` / `∂̄_I`): the partial
  Wirtinger derivatives w.r.t. coordinate `I`, definitionally the directional
  operators along `Pi.single I 1`, with real-Fréchet form `(1/2)(∂_x ∓ i ∂_y)`;
- the coordinate CLMs `coordProjCLM`, `conjCoordCLM`, `conjCLM`, and the four
  Kronecker coordinate values `∂_I z^J = δ_IJ`, `∂̄_I z̄^J = δ_IJ`,
  `∂̄_I z^J = ∂_I z̄^J = 0`;
- additivity, `ℂ`-linearity, the Leibniz rule, and the finite-sum rule;
  conjugation swapping the two operators; holomorphic collapse; and the
  two-term chain rule for an outer `g : ℂ → ℂ`;
- the `ℝ`/`ℂ` `restrictScalars` bridge on the `ι → ℂ` domain
  (`differentiableAt_real_of_complex`, `fderivReal_apply_eq_complex`), stated
  with no `restrictScalars` in their types;
- Schwarz's theorem for the coordinate operators,
  `∂_I ∂̄_J f = ∂̄_J ∂_I f` on `C²` `f`, yielding Kähler-metric hermiticity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…review

Collapse the post-review polish on the coordinate Wirtinger layer:

- Drop helpers that duplicate Mathlib and inline the remaining trivial
  ones, shrinking the internal surface to what the public lemmas need.
- Prove the coordinate-difference rules via fun_prop and restructure the
  sections (A–E) for a cleaner read.
- Tighten the module and per-lemma docstrings; fix the dual-basis claim
  (the coordinate functionals z^J are the dual basis to Pi.single I 1),
  normalize anti-holomorphic hyphenation, and attribute the §B/§C
  holomorphic-collapse statements to the right sections.
@pariandrea pariandrea force-pushed the wirtinger-coordinate branch from 19ddddc to fc8ae95 Compare June 17, 2026 10:32
@pariandrea

Copy link
Copy Markdown
Contributor Author

There is a lot of lemmas and definitions here that I don't think actually need making (i.e. they are simple rewrites of things already in Mathlib).

Thanks you for the feedback. I agree on the bloat. I've cut the the code to the minimal set of lemmas needed to do computations.

  • Coordinate CLM wrappers (coordProjCLM, conjCoordCLM, and the conjConfig family before §A) removed; the projections now use ContinuousLinearMap.proj (and its star) directly.
  • Trivial restatements / Mathlib duplicatessmul_single_one inline; the _eq_dWirtingerDir inlined; differentiableAt_real_of_complexDifferentiableAt.restrictScalars; fderivReal_apply_eq_complexfderiv_restrictScalars + coe_restrictScalars' inline; the _zero and dWirtingerDir_one_eq_* lemmas folded into the proofs that used them; differentiable_coordDiffby fun_prop; and the two outerHolo_* helpers merged into a single clinear_of_holomorphic.

Two things I kept, since they aren't Mathlib rewrites:

  1. conjCLM (with conjCLM_apply and conjCLM_smul_I). The foundation conjugate-linear chain rules dWirtingerDir_comp_conjLinear / dWirtingerAntiDir_comp_conjLinear require the inner conjugation supplied as a bundled →L[ℝ]. I have however made it private.

  2. The coordinate-difference derivatives (dWirtingerCoord_coordDiff, dWirtingerAntiCoord_coordDiff, and the private coordDiff_eq_add_neg). These give ∂_I (z^J − z̄^J) = δ_IJ and ∂̄_I (z^J − z̄^J) = −δ_IJ. Since z^J − z̄^J = 2i·Im(u^J), this is the combination any function of the coordinates' imaginary parts differentiates against ( useful for log Kähler potentials).

@jstoobysmith jstoobysmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now looks good to me - approved.

@jstoobysmith jstoobysmith added ready-to-merge This PR is approved and will be merged shortly and removed awaiting-author A reviewer has asked the author a question or requested changes labels Jun 17, 2026
@jstoobysmith jstoobysmith merged commit 044ba53 into leanprover-community:master Jun 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR is approved and will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants