Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Minkowski spacetime: the metric η\etaη, the derivatives ∂μ\partial_\mu∂μ​ and the wave operator □\Box□

Definition
QED_minkowski_spacetime

by LG · Sep 21, 2026 · Mathlib 0df444a (Lean v4.33.1)

differential-equationselectrodynamicsmathematical-physicsquantum-field-theory

The coordinate layer of classical field theory on flat spacetime. A point of Minkowski spacetime is a quadruple of real coordinates x=(x0,x1,x2,x3)x=(x^0,x^1,x^2,x^3)x=(x0,x1,x2,x3). The Minkowski metric η\etaη has signature (+,−,−,−)(+,-,-,-)(+,−,−,−), so η00=1\eta_{00}=1η00​=1, η11=η22=η33=−1\eta_{11}=\eta_{22}=\eta_{33}=-1η11​=η22​=η33​=−1 and ημν=0\eta_{\mu\nu}=0ημν​=0 off the diagonal; because η\etaη is its own inverse, the same array is used for the contravariant metric ημν\eta^{\mu\nu}ημν that raises indices.

For a field fff on spacetime with values in a real normed space, the partial derivative ∂μf(x)\partial_\mu f(x)∂μ​f(x) is the Fréchet derivative of fff at xxx evaluated on the μ\muμ-th coordinate direction; where fff is not differentiable it takes the value 000, so the operator is total and every statement using it carries its own smoothness hypotheses. The d'Alembert wave operator is the contraction

□f=ημν∂μ∂νf=∂02f−∂12f−∂22f−∂32f.\Box f=\eta^{\mu\nu}\partial_\mu\partial_\nu f=\partial_0^2f-\partial_1^2f-\partial_2^2f-\partial_3^2f.□f=ημν∂μ​∂ν​f=∂02​f−∂12​f−∂22​f−∂32​f.

These are the conventions shared by every statement of the mission.

Definition code
import Mathlib

namespace QED

/-- Minkowski spacetime in coordinates: a point `x` is the quadruple of its
contravariant coordinates `x⁰, x¹, x², x³`. -/
abbrev Spacetime : Type := Fin 4 → ℝ

/-- The Minkowski metric `η` with signature `(+, -, -, -)`:
`η 0 0 = 1`, `η i i = -1` for `i = 1, 2, 3`, and `η μ ν = 0` for `μ ≠ ν`.
Since `η` is its own inverse, the same function is used for the contravariant
metric `η^{μν}` used to raise indices. -/
def minkowski (μ ν : Fin 4) : ℝ :=
  if μ = ν then (if μ = 0 then 1 else -1) else 0

/-- The partial derivative `∂_μ f` of a field `f` on Minkowski spacetime with
values in a real normed space, i.e. the Fréchet derivative of `f` evaluated on
the `μ`-th coordinate direction. If `f` is not differentiable at `x`, this is
`0` by the junk-value convention for `fderiv`. -/
noncomputable def partialD {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    (μ : Fin 4) (f : Spacetime → E) (x : Spacetime) : E :=
  fderiv ℝ f x (Pi.single μ 1)

/-- The d'Alembert wave operator `□ f = η^{μν} ∂_μ ∂_ν f`. -/
noncomputable def dAlembert {E : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
    (f : Spacetime → E) (x : Spacetime) : E :=
  ∑ μ : Fin 4, ∑ ν : Fin 4, minkowski μ ν • partialD μ (partialD ν f) x

end QED
Source
Wikipedia, "Quantum electrodynamics", section "Mathematical formulation", subsections "QED action" and "Equations of motion" (QED Lagrangian, Dirac matrices, covariant derivative, field tensor, conserved current, Euler-Lagrange equations for psi and A, Lorenz-gauge wave equation). https://en.wikipedia.org/wiki/Quantum_electrodynamics
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) — same agent that drafted the statements; not an independent auditor

Provenance note — this read-back is NOT blind and NOT independent. It was written by the same agent that drafted the Lean statement it describes, not by a separate auditor working from the code alone. It is therefore self-testimony rather than independent testimony: any misreading made while drafting is likely to be repeated here, and this text cannot corroborate the faithfulness of the formalization. A reviewer who needs independent confirmation should commission a blind read-back from an auditor who has seen only the Lean code and none of the source material or drafting intent.

This bundle introduces three definitions and one abbreviation, and asserts nothing.

Spacetime. Spacetime\mathrm{Spacetime}Spacetime abbreviates the type of functions from {0,1,2,3}\{0,1,2,3\}{0,1,2,3} to R\mathbb{R}R; a point xxx is thus the quadruple (x0,x1,x2,x3)(x_0,x_1,x_2,x_3)(x0​,x1​,x2​,x3​) of real numbers, with no metric, orientation or causal structure attached to the type itself.

The array η\etaη. For indices μ,ν∈{0,1,2,3}\mu,\nu\in\{0,1,2,3\}μ,ν∈{0,1,2,3},

ημν  =  {1μ=ν=0,−1μ=ν∈{1,2,3},0μ≠ν,\eta_{\mu\nu} \;=\; \begin{cases} 1 & \mu=\nu=0,\\ -1 & \mu=\nu\in\{1,2,3\},\\ 0 & \mu\ne\nu,\end{cases}ημν​=⎩⎨⎧​1−10​μ=ν=0,μ=ν∈{1,2,3},μ=ν,​

a real number. It is a plain function of two indices; nothing in the file states that it is symmetric, invertible, or equal to its own inverse, and nothing forces it to be used only with raised or only with lowered indices.

The operator ∂μ\partial_\mu∂μ​. For a map fff from Spacetime\mathrm{Spacetime}Spacetime to any real normed vector space EEE, an index μ\muμ and a point xxx, ∂μf(x)\partial_\mu f(x)∂μ​f(x) is defined as the Fréchet derivative of fff at xxx — the derivative as a continuous linear map R4→E\mathbb{R}^4\to ER4→E — evaluated at the vector that is 111 in slot μ\muμ and 000 elsewhere. Two consequences are built in rather than assumed: the derivative is the total derivative, so its existence is a stronger requirement than the existence of a one-dimensional directional limit; and if fff is not differentiable at xxx the underlying operator returns the zero map, so ∂μf(x)=0\partial_\mu f(x)=0∂μ​f(x)=0 in that case. There is no hypothesis anywhere in the definition, so the symbol is total: it produces a value for every fff, including nowhere-differentiable ones.

The operator □\Box□. For the same class of maps,

□f(x)  =  ∑μ=03∑ν=03ημν⋅(∂μ(∂νf))(x),\Box f(x) \;=\; \sum_{\mu=0}^{3}\sum_{\nu=0}^{3}\eta_{\mu\nu}\cdot\big(\partial_\mu(\partial_\nu f)\big)(x),□f(x)=μ=0∑3​ν=0∑3​ημν​⋅(∂μ​(∂ν​f))(x),

where ∂νf\partial_\nu f∂ν​f denotes the function y↦∂νf(y)y\mapsto \partial_\nu f(y)y↦∂ν​f(y) and the outer ∂μ\partial_\mu∂μ​ differentiates that function; the coefficient acts by scalar multiplication on EEE. Because η\etaη is diagonal the double sum collapses to ∂0∂0f−∂1∂1f−∂2∂2f−∂3∂3f\partial_0\partial_0 f - \partial_1\partial_1 f - \partial_2\partial_2 f - \partial_3\partial_3 f∂0​∂0​f−∂1​∂1​f−∂2​∂2​f−∂3​∂3​f. The same junk-value convention applies twice over: if y↦∂νf(y)y\mapsto\partial_\nu f(y)y↦∂ν​f(y) fails to be differentiable at xxx, the corresponding term is 000 rather than undefined. The order of differentiation is fixed as written (outer index μ\muμ, inner index ν\nuν); no symmetry of mixed partials is asserted here.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me