Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

PhysLib Minkowski metric in inertial coordinates

Definition
PhyslibMinkowskiCoordinates

by scuba8684 · Nov 28, 2026 · Mathlib 0df444a (Lean v4.33.1)

general-relativityphyslib-exact-spacetimes

Minkowski spacetime in inertial coordinates on R4\mathbb R^4R4, with constant metric of signature (−,+,+,+)(-,+,+,+)(−,+,+,+).

Definition code
import Definitions.Def_PhyslibCoordinateGeometry
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Lie.Classical
import Mathlib.Analysis.Calculus.ContDiff.Deriv
import Mathlib.Analysis.Calculus.Deriv.Add
import Mathlib.Analysis.Calculus.Deriv.Basic
import Mathlib.Analysis.Calculus.Deriv.Inv
import Mathlib.Analysis.Calculus.Deriv.Mul
import Mathlib.Analysis.Calculus.Deriv.Pow
import Mathlib.Analysis.Calculus.Deriv.Prod
import Mathlib.Analysis.Calculus.FDeriv.Symmetric
import Mathlib.Analysis.ODE.ExistUnique
import Mathlib.Data.Matrix.Basic
import Mathlib.Data.Real.Basic
import Mathlib.Data.Set.Basic
import Mathlib.LinearAlgebra.Matrix.Notation
import Mathlib.LinearAlgebra.Matrix.Symmetric
import Mathlib.Logic.Equiv.Fin.Basic
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NoncommRing
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Ring

section

/-
Copyright (c) 2024 Joseph Tooby-Smith. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joseph Tooby-Smith
-/

/-!

# The Minkowski matrix

## i. Overview

The aim of this module is to define the Minkowski matrix `η` in `d+1` dimensions, and
prove properties thereof.

The Minkowski matrix is the real matrix of the form `diag(1, -1, -1, -1, ...)`,
It is related to the Minkowski metric on `ℝ^(d+1)`.

Related to the Minkowski matrix is the notion of the dual of a matrix with respect to
the Minkowski metric. This is defined as `η * Λᵀ * η`, where `Λ` is a real matrix.
This will be used to help define the Lorentz group in later files.

## ii. Key results

- `minkowskiMatrix` : The Minkowski matrix in `d+1` dimensions.
- `minkowskiMatrix.dual` : The dual of a matrix with respect to the Minkowski metric,
  defined to be `η * Λᵀ * η`.

## iii. Table of contents

- A. The Minkowski Matrix
  - A.1. Basic equalities
  - A.2. Notation for the Minkowski matrix
  - A.3. Components of the Minkowski matrix
  - A.4. Squaring the Minkowski matrix
  - A.5. Symmetry properties of the Minkowski matrix
  - A.6. Determinant of the Minkowski matrix
  - A.7. Injective properties of multiplying diagonal components
  - A.8. Action of the Minkowski matrix on vectors
- B. The Minkowski dual
  - B.1. The dual on the identity
  - B.2. The dual swaps multiplication
  - B.3. The dual is an involution
  - B.4. The dual commutes with the transpose
  - B.5. The dual preserves the Minkowski matrix
  - B.6. The dual preserves the determinants
  - B.7. Components of the dual

## iv. References

* None.
-/


open Matrix
/-!

## A. The Minkowski Matrix

We first define the Minkowski matrix in `d+1` dimensions, and prove some basic properties.

-/

/-- The `d.succ`-dimensional real matrix of the form `diag(1, -1, -1, -1, ...)`. -/
def minkowskiMatrix {d : ℕ} : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ :=
  LieAlgebra.Orthogonal.indefiniteDiagonal (Fin 1) (Fin d) ℝ

namespace minkowskiMatrix

variable {d : ℕ}

/-!

### A.1. Basic equalities

We show some basic equalities for the Minkowski matrix.
In particular, we show it can be expressed as a block matrix.

-/
/-- The Minkowski matrix as a diagonal matrix. -/
lemma as_diagonal : @minkowskiMatrix d = diagonal (Sum.elim 1 (-1)) := by
  simp [minkowskiMatrix, LieAlgebra.Orthogonal.indefiniteDiagonal]

/-- The Minkowski matrix as a block matrix. -/
lemma as_block : minkowskiMatrix =
    Matrix.fromBlocks (1 : Matrix (Fin 1) (Fin 1) ℝ) 0 0 (-1 : Matrix (Fin d) (Fin d) ℝ) := by
  simp [as_diagonal, ← fromBlocks_diagonal, ← diagonal_one]

/-!

### A.2. Notation for the Minkowski matrix

We define the notation `η` for the Minkowski matrix, which can be used when the namespace
`minkowskiMatrix` is opened.

-/

/-- Notation for `minkowskiMatrix`. -/
scoped[minkowskiMatrix] notation "η" => minkowskiMatrix

/-!

### A.3. Components of the Minkowski matrix

We prove some simple properties related to the components of the Minkowski matrix.

-/











/-!

### A.4. Squaring the Minkowski matrix

we show that the Minkowski matrix is self-inverting, i.e. `η * η = 1`,
as well as other properties related to squaring the Minkowski matrix.

-/

/-- The Minkowski matrix is self-inverting. -/
@[simp]
lemma sq : @minkowskiMatrix d * minkowskiMatrix = 1 := by
  simp [as_block, fromBlocks_multiply]





/-!

### A.5. Symmetry properties of the Minkowski matrix

The Minkowski matrix is symmetric, due to it being diagonal.

-/

/-- The Minkowski matrix is symmetric. -/
@[simp]
lemma eq_transpose : minkowskiMatrixᵀ = @minkowskiMatrix d := by
  simp [as_diagonal]

/-!

### A.6. Determinant of the Minkowski matrix

We show the determinant of the Minkowski matrix is equal to `(-1)^d` where
`d` is the number of spatial dimensions.

-/







/-!

### A.7. Injective properties of multiplying diagonal components

If `x` and `y` are reals then since `η μ μ` is non-zero for any `μ`, the equation
`η μ μ * x = η μ μ * y` implies `x = y`. We prove this as a lemma.
This is a useful part of the API but is not used often.

-/



/-!

### A.8. Action of the Minkowski matrix on vectors

We show properties of the action of the Minkowski matrix on vectors.

-/





/-!

## B. The Minkowski dual

Given a real matrix `Λ`, we define the dual of `Λ` with respect to the Minkowski metric
to be `η * Λᵀ * η`.

The ultimate idea is that for the Minkowski inner product
`⟪Λ x, y⟫ = ⟪x, dual Λ y⟫` for all vectors `x` and `y`.

An element `Λ` is in the Lorentz group if and only if `dual Λ = Λ⁻¹`. This will not be
shown in this module.

This notion of a dual is not quite a homomorphism because it reverses the order of multiplication.
-/

variable (Λ Λ' : Matrix (Fin 1 ⊕ Fin d) (Fin 1 ⊕ Fin d) ℝ)



/-!

### B.1. The dual on the identity

We show that the dual of the identity matrix is the identity matrix.

-/



/-!

### B.2. The dual swaps multiplication

We show that the dual swaps multiplication, i.e. `dual (Λ * Λ') = dual Λ' * dual Λ`.

-/



/-!

### B.3. The dual is an involution

We show that the dual is an involution, i.e. `dual (dual Λ) = Λ`.
-/



/-!

### B.4. The dual commutes with the transpose

-/



/-!

### B.5. The dual preserves the Minkowski matrix

-/



/-!

### B.6. The dual preserves the determinants

-/



/-!

### B.7. Components of the dual

We show a number of properties related to the components of the duals.

-/





end minkowskiMatrix

end

section

/-
Copyright (c) 2026 Alex Vergara Gil. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alex Vergara Gil
-/


/-!

# The four-dimensional Minkowski metric

The flat metric `η = diag(-1, 1, 1, 1)` in inertial coordinates, constructed from
`Physlib.Relativity.MinkowskiMatrix`, together with its certified `MetricTensor 4` instance and its
constant field on spacetime.

## i. Overview

Throughout `GeneralRelativity`, the Minkowski metric `minkowskiMetric4` uses the mostly-plus
Lorentzian signature `(-, +, +, +)` standard in general relativity (Wald / Misner–Thorne–Wheeler),
whereas `Physlib.Relativity.MinkowskiMatrix.minkowskiMatrix` (and `realLorentzTensor.coMetric 3`)
uses the particle-physics mostly-minus convention `(+, -, -, -)`.

We define `minkowskiMetric4` directly as the negation of `minkowskiMatrix (d := 3)` transported
along `finSumFinEquiv : Fin 1 ⊕ Fin 3 ≃ Fin 4`. It inherits its symmetry and self-inverse
property from `minkowskiMatrix.eq_transpose` and `minkowskiMatrix.sq`.

## ii. Key results

- `minkowskiMetric4`, `minkowskiMetric4_symm`, `minkowskiMetric4_mul_self`,
  `sum_minkowskiMetric4_mul` : the 4D Minkowski metric `diag(-1, 1, 1, 1)`, its self-inverse
  property derived from `minkowskiMatrix`, and its index contraction law.
- `minkowski` : four-dimensional Minkowski spacetime metric as a `MetricTensor 4`.
- `minkowski_ginv_offdiag`, `metricTrace_minkowski` : diagonal property and Minkowski trace.
- `minkowskiMetricField` : the Minkowski metric as a constant field on `Fin 4 → ℝ`.

## iii. Table of contents

- A. The Minkowski matrix `η`
- B. The Minkowski spacetime metric

## iv. References

* R. M. Wald, *General Relativity* (1984), Ch. 2 (Sec. 2.3). [ref: wald_1984_general_relativity]
* C. W. Misner, K. S. Thorne, and J. A. Wheeler, *Gravitation* (1973), Ch. 2.
  [ref: mtw_1973_gravitation]
* B. O'Neill, *Semi-Riemannian Geometry With Applications to Relativity* (1983), Ch. 6.
  [ref: oneill_1983_semi_riemannian]
* S. M. Carroll, *Lecture Notes on General Relativity* (1997), Ch. 1
  (https://arxiv.org/pdf/gr-qc/9712019#page=10). [ref: Carroll1997]
-/


namespace GeneralRelativity

/-!

## A. The Minkowski matrix `η`

Fixing the `(-, +, +, +)` signature convention defines the constant reference metric
`minkowskiMetric4` and its component contractions.

-/

/-- The Minkowski metric of signature `(-, +, +, +)` in inertial coordinates, obtained by
reindexing and negating `Physlib.Relativity.MinkowskiMatrix.minkowskiMatrix`. -/
def minkowskiMetric4 : Tensor2 4 :=
  fun i j => -minkowskiMatrix (d := 3) (finSumFinEquiv.symm i) (finSumFinEquiv.symm j)





/-- The Minkowski metric is symmetric, inherited from `minkowskiMatrix.eq_transpose`. -/
lemma minkowskiMetric4_symm : IsSymm minkowskiMetric4 := by
  ext i j
  simp only [Matrix.transpose_apply, minkowskiMetric4]
  have ht := congrFun (congrFun (@minkowskiMatrix.eq_transpose 3)
    (finSumFinEquiv.symm i)) (finSumFinEquiv.symm j)
  simpa [Matrix.transpose_apply] using congrArg Neg.neg ht

/-- The Minkowski metric is its own inverse: `η * η = 1`, inherited from
`minkowskiMatrix.sq`. -/
lemma minkowskiMetric4_mul_self : minkowskiMetric4 * minkowskiMetric4 = (1 : Tensor2 4) := by
  ext i j
  rw [Matrix.mul_apply]
  have hterm : ∀ k : Fin 4, minkowskiMetric4 i k * minkowskiMetric4 k j =
      minkowskiMatrix (d := 3) (finSumFinEquiv.symm i) (finSumFinEquiv.symm k) *
        minkowskiMatrix (d := 3) (finSumFinEquiv.symm k) (finSumFinEquiv.symm j) := by
    intro k
    simp only [minkowskiMetric4, neg_mul_neg]
  simp_rw [hterm]
  rw [Equiv.sum_comp finSumFinEquiv.symm (fun μ =>
    minkowskiMatrix (d := 3) (finSumFinEquiv.symm i) μ *
      minkowskiMatrix (d := 3) μ (finSumFinEquiv.symm j))]
  have hsq := congrFun (congrFun (@minkowskiMatrix.sq 3)
    (finSumFinEquiv.symm i)) (finSumFinEquiv.symm j)
  simpa [Matrix.mul_apply, Matrix.one_apply, finSumFinEquiv.symm.injective.eq_iff] using hsq





/-!

## B. The Minkowski spacetime metric

Flat Minkowski spacetime equips the constant matrix `η` with its symmetry and self-inverse
properties as a `MetricTensor 4` and supplies the constant metric field on `ℝ⁴`.

-/







/-- The constant Minkowski metric field on `ℝ⁴` in global inertial coordinates. -/
noncomputable def minkowskiMetricField : (Fin 4 → ℝ) → Tensor2 4 := fun _ => minkowskiMetric4

end GeneralRelativity

end

section

/-
Copyright (c) 2026 Alex Vergara Gil. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Alex Vergara Gil
-/


/-!

# Flat Minkowski spacetime and the vacuum Einstein equations

Flat Minkowski spacetime in global inertial coordinates, with vanishing Christoffel symbols,
vanishing curvature tensors, and verification of the vacuum Einstein equations `G_{ij} = 0`.

## i. Overview

In global inertial coordinates `(t, x, y, z)` on `ℝ⁴`, flat Minkowski spacetime carries the
constant Lorentzian metric `η = diag(-1, 1, 1, 1)` on all of `ℝ⁴`. Because every metric component
is position independent, all Levi-Civita connection coefficients `Γ^k_{ij}` vanish identically, so
the Riemann curvature, Ricci tensor, scalar curvature, and Einstein tensor all vanish identically
and Minkowski spacetime solves the vacuum Einstein equations `G_{ij} = 0`.

## ii. Key results

- `minkowskiCoordinateMetric` : four-dimensional Minkowski spacetime as a `CoordinateMetric 4`.
- `minkowskiCoordinateMetric_christoffel`, `minkowskiCoordinateMetric_riemann`,
  `minkowskiCoordinateMetric_ricciTensor`, `minkowskiCoordinateMetric_ricciScalar`,
  `minkowskiCoordinateMetric_einsteinTensor`, `minkowskiCoordinateMetric_riemannFromData` :
  vanishing coordinate connection and curvature tensors of Minkowski spacetime.
- `minkowski_ricci_eq_zero`, `minkowski_ricciScalar_eq_zero`,
  `minkowski_einstein_eq_zero`, `minkowski_vacuum_iff_ricci_flat` : algebraic vacuum properties.

## iii. Table of contents

- A. The Minkowski coordinate metric and flatness
- B. Algebraic vacuum Einstein equations on Minkowski spacetime

## iv. References

* R. M. Wald, *General Relativity* (1984), Ch. 4 (Sec. 4.2). [ref: wald_1984_general_relativity]
* C. W. Misner, K. S. Thorne, and J. A. Wheeler, *Gravitation* (1973), Ch. 17.
  [ref: mtw_1973_gravitation]
* S. M. Carroll, *Lecture Notes on General Relativity* (1997), Ch. 4
  (https://arxiv.org/pdf/gr-qc/9712019#page=104). [ref: Carroll1997]
-/


namespace GeneralRelativity

/-!

## A. The Minkowski coordinate metric and flatness

On global inertial coordinates covering all of `ℝ⁴`, the constant Minkowski metric has identically
vanishing Levi-Civita Christoffel symbols and curvature tensors.

-/

/-- Four-dimensional Minkowski spacetime as a `CoordinateMetric 4` on all of `ℝ⁴`. -/
noncomputable def minkowskiCoordinateMetric : CoordinateMetric 4 where
  g := minkowskiMetricField
  ginv := minkowskiMetricField
  domain := Set.univ
  symm := fun _ => minkowskiMetric4_symm
  inv_left := fun _ _ => minkowskiMetric4_mul_self
  inv_right := fun _ _ => minkowskiMetric4_mul_self













/-!

## B. Algebraic vacuum Einstein equations on Minkowski spacetime

In the algebraic tensor formulation, the vanishing Riemann tensor `RiemannTensor.flat 4` on
Minkowski spacetime immediately gives `Ric = 0`, `R = 0`, and the vacuum Einstein equations.

-/









end GeneralRelativity

end
Source
https://github.com/BishopWolf/physlib/blob/8046e2b0cb30f5fa25306a69ff29e91ab5711f6b/Physlib/Relativity/MinkowskiMatrix.lean https://github.com/BishopWolf/physlib/blob/8046e2b0cb30f5fa25306a69ff29e91ab5711f6b/PhyslibAlpha/Relativity/General/MinkowskiCoordinateMetric.lean https://github.com/BishopWolf/physlib/blob/8046e2b0cb30f5fa25306a69ff29e91ab5711f6b/PhyslibAlpha/Relativity/Metrics/Minkowski.lean

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