Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Carroll's GR in coordinates: metric, Christoffel symbols, covariant derivatives, curvature, Schwarzschild and Kruskal

Definition
CarrollGR_Defs

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

differential-geometrygeneral-relativitymathematical-physics

This definition file fixes the coordinate language used by the whole No-Nonsense Introduction to General Relativity series. Everything is written in one coordinate chart of a four-dimensional spacetime, following S. M. Carroll's notes equation by equation.

  1. Points and fields. A point of the chart is x=(x0,x1,x2,x3)∈R4x=(x^0,x^1,x^2,x^3)\in\mathbb R^4x=(x0,x1,x2,x3)∈R4 (Coord). A two-index tensor field TTT (TensorField2), such as the metric gμνg_{\mu\nu}gμν​, assigns a real 4×44\times44×4 matrix to each point; a four-index field (TensorField4) assigns an array Tμνρσ(x)T_{\mu\nu\rho\sigma}(x)Tμνρσ​(x). The partial derivative ∂μf(x)\partial_\mu f(x)∂μ​f(x) (partialD) is the derivative of fff at xxx in the μ\muμ-th coordinate direction.
  2. Minkowski metric (eq. (3)): ημν=diag⁡(−1,1,1,1)\eta_{\mu\nu}=\operatorname{diag}(-1,1,1,1)ημν​=diag(−1,1,1,1) (minkowskiEta). A matrix is Lorentzian (IsLorentzian) if PTMP=ηP^{\mathsf T}MP=\etaPTMP=η for some invertible PPP, i.e. it is a symmetric nondegenerate form of signature (−+++)(-+++)(−+++). A field ggg is a spacetime metric on an open set UUU (IsSpacetimeMetricOn) if its components are smooth on UUU and g(y)g(y)g(y) is Lorentzian for every y∈Uy\in Uy∈U.
  3. Inverse metric (eq. (23)): gμνg^{\mu\nu}gμν is the matrix inverse of gμνg_{\mu\nu}gμν​ (invMetric).
  4. Christoffel symbols (eq. (36)):
Γμνσ=12gσρ(∂μgνρ+∂νgρμ−∂ρgμν).\Gamma^\sigma_{\mu\nu}=\tfrac12 g^{\sigma\rho}\left(\partial_\mu g_{\nu\rho}+\partial_\nu g_{\rho\mu}-\partial_\rho g_{\mu\nu}\right).Γμνσ​=21​gσρ(∂μ​gνρ​+∂ν​gρμ​−∂ρ​gμν​).
  1. Covariant derivatives (eq. (35)) of two-index tensors with lower or upper indices and of four-index tensors with lower indices (covDerivLower2, covDerivUpper2, covDerivLower4): one +Γ+\Gamma+Γ term per upper index and one −Γ-\Gamma−Γ term per lower index.
  2. Curvature: the Riemann tensor (eq. (44))
Rσμαβ=∂αΓμβσ−∂βΓμασ+ΓαλσΓμβλ−ΓβλσΓμαλ,R^\sigma{}_{\mu\alpha\beta}=\partial_\alpha\Gamma^\sigma_{\mu\beta}-\partial_\beta\Gamma^\sigma_{\mu\alpha}+\Gamma^\sigma_{\alpha\lambda}\Gamma^\lambda_{\mu\beta}-\Gamma^\sigma_{\beta\lambda}\Gamma^\lambda_{\mu\alpha},Rσμαβ​=∂α​Γμβσ​−∂β​Γμασ​+Γαλσ​Γμβλ​−Γβλσ​Γμαλ​,

its all-lower form Rμνρσ=gμλRλνρσR_{\mu\nu\rho\sigma}=g_{\mu\lambda}R^\lambda{}_{\nu\rho\sigma}Rμνρσ​=gμλ​Rλνρσ​, the Ricci tensor Rαβ=RλαλβR_{\alpha\beta}=R^\lambda{}_{\alpha\lambda\beta}Rαβ​=Rλαλβ​ (eq. (45)), the Ricci scalar R=gμνRμνR=g^{\mu\nu}R_{\mu\nu}R=gμνRμν​ (eq. (46)), the Einstein tensor Gμν=Rμν−12RgμνG_{\mu\nu}=R_{\mu\nu}-\tfrac12Rg_{\mu\nu}Gμν​=Rμν​−21​Rgμν​ (eq. (50)) and its raised form Gμν=gμαgνβGαβG^{\mu\nu}=g^{\mu\alpha}g^{\nu\beta}G_{\alpha\beta}Gμν=gμαgνβGαβ​. 7. Einstein's equation (eq. (57)) at a point: Gμν=8πG TμνG_{\mu\nu}=8\pi G\,T_{\mu\nu}Gμν​=8πGTμν​ for all μ,ν\mu,\nuμ,ν (EinsteinEq), with T=gμνTμνT=g^{\mu\nu}T_{\mu\nu}T=gμνTμν​ the trace (metricTrace). 8. Changes of coordinates: the Jacobian matrix ∂Fa/∂xμ\partial F^a/\partial x^\mu∂Fa/∂xμ (jacobian); spherical coordinates (eq. (18)) (t,r,θ,ϕ)↦(t,rsin⁡θcos⁡ϕ,rsin⁡θsin⁡ϕ,rcos⁡θ)(t,r,\theta,\phi)\mapsto(t,r\sin\theta\cos\phi,r\sin\theta\sin\phi,r\cos\theta)(t,r,θ,ϕ)↦(t,rsinθcosϕ,rsinθsinϕ,rcosθ) (sphericalToCartesian). 9. Spherically symmetric metrics (eq. (71)): in coordinates (t,r,θ,ϕ)(t,r,\theta,\phi)(t,r,θ,ϕ),

ds2=−A(r,t) dt2+B(r,t) dr2+r2(dθ2+sin⁡2θ dϕ2)ds^2=-A(r,t)\,dt^2+B(r,t)\,dr^2+r^2(d\theta^2+\sin^2\theta\,d\phi^2)ds2=−A(r,t)dt2+B(r,t)dr2+r2(dθ2+sin2θdϕ2)

(sphericalMetric A B), and the Schwarzschild metric (eq. (72)), the case A=1−2Gm/rA=1-2Gm/rA=1−2Gm/r, B=(1−2Gm/r)−1B=(1-2Gm/r)^{-1}B=(1−2Gm/r)−1 (schwarzschild G m). 10. Kruskal coordinates (eqs. (73)–(74)): u=(r/2Gm−1)1/2er/4Gmcosh⁡(t/4Gm)u=(r/2Gm-1)^{1/2}e^{r/4Gm}\cosh(t/4Gm)u=(r/2Gm−1)1/2er/4Gmcosh(t/4Gm), v=(r/2Gm−1)1/2er/4Gmsinh⁡(t/4Gm)v=(r/2Gm-1)^{1/2}e^{r/4Gm}\sinh(t/4Gm)v=(r/2Gm−1)1/2er/4Gmsinh(t/4Gm), the map (t,r,θ,ϕ)↦(v,u,θ,ϕ)(t,r,\theta,\phi)\mapsto(v,u,\theta,\phi)(t,r,θ,ϕ)↦(v,u,θ,ϕ), and the Kruskal-form components diag⁡(−F,F,r2,r2sin⁡2θ)\operatorname{diag}(-F,F,r^2,r^2\sin^2\theta)diag(−F,F,r2,r2sin2θ) with F=32(Gm)3re−r/2GmF=\frac{32(Gm)^3}{r}e^{-r/2Gm}F=r32(Gm)3​e−r/2Gm, written as a function of the values of rrr and θ\thetaθ.

These definitions are the shared vocabulary of every statement in the mission; the curvature formulas are transcribed with Carroll's index placement exactly.

Formalization Note All objects are total functions: a derivative at a point where the function is not differentiable is 000, the inverse of a singular matrix is the zero matrix, and 1/0=01/0=01/0=0. Theorems that use these definitions therefore state explicitly the open region (smoothness, nondegeneracy, r≠0r\neq0r=0, r≠2Gmr\neq2Gmr=2Gm, 0<θ<π0<\theta<\pi0<θ<π) on which they are claimed. Coordinates are x0=tx^0=tx0=t and, in the spherical charts, x1=rx^1=rx1=r, x2=θx^2=\thetax2=θ, x3=ϕx^3=\phix3=ϕ.

Definition code
import Mathlib

/-!
# Coordinate general relativity after Carroll, "A No-Nonsense Introduction to General Relativity"

All objects are written in a single coordinate chart of a 4-dimensional spacetime.
A point of the chart is `x : Fin 4 → ℝ`, with `x 0 = t`, `x 1`, `x 2`, `x 3` the remaining
coordinates (for the spherical charts of §3 and §6: `x 1 = r`, `x 2 = θ`, `x 3 = φ`).
A (0,2)-tensor field (such as the metric `g_{μν}`) is a function giving at each point the
`4 × 4` matrix of its components.  Partial derivatives are Fréchet derivatives in the
coordinate directions.  Formulas follow Carroll's equation numbers.
-/

open scoped ContDiff

namespace CarrollGR

open Finset

/-- A point `(x⁰, x¹, x², x³)` of a coordinate chart of four-dimensional spacetime. -/
abbrev Coord : Type := Fin 4 → ℝ

/-- The components `T_{μν}(x)` of a two-index tensor field in a chart (e.g. the metric `g_{μν}`). -/
abbrev TensorField2 : Type := Coord → Matrix (Fin 4) (Fin 4) ℝ

/-- The components `T_{μνρσ}(x)` of a four-index tensor field in a chart. -/
abbrev TensorField4 : Type := Coord → Fin 4 → Fin 4 → Fin 4 → Fin 4 → ℝ

/-- The coordinate partial derivative `∂_μ f(x) = ∂f/∂x^μ (x)`. -/
noncomputable def partialD (μ : Fin 4) (f : Coord → ℝ) (x : Coord) : ℝ :=
  fderiv ℝ f x (Pi.single μ 1)

/-- The Minkowski metric `η_{μν} = diag(-1, 1, 1, 1)` (Carroll eq. (3)). -/
def minkowskiEta : Matrix (Fin 4) (Fin 4) ℝ := Matrix.diagonal ![-1, 1, 1, 1]

/-- A symmetric matrix `M` has Lorentzian signature `(− + + +)`: it is congruent to the
Minkowski metric, i.e. `Pᵀ M P = η` for some invertible matrix `P`. -/
def IsLorentzian (M : Matrix (Fin 4) (Fin 4) ℝ) : Prop :=
  ∃ P : Matrix (Fin 4) (Fin 4) ℝ, IsUnit P.det ∧ P.transpose * M * P = minkowskiEta

/-- `g` is a spacetime metric on the open set `U` of the chart: its components are smooth on `U`
and at every point of `U` it is a (symmetric) metric of signature `(− + + +)`. -/
def IsSpacetimeMetricOn (g : TensorField2) (U : Set Coord) : Prop :=
  IsOpen U ∧ (∀ μ ν : Fin 4, ContDiffOn ℝ ∞ (fun y => g y μ ν) U) ∧ ∀ y ∈ U, IsLorentzian (g y)

/-- The inverse metric `g^{μν}(x)`, the matrix inverse of `g_{μν}(x)` (Carroll eq. (23)). -/
noncomputable def invMetric (g : TensorField2) : TensorField2 := fun x => (g x)⁻¹

/-- The Christoffel symbols (Carroll eq. (36)):
`Γ^σ_{μν} = ½ g^{σρ} (∂_μ g_{νρ} + ∂_ν g_{ρμ} − ∂_ρ g_{μν})`. -/
noncomputable def christoffel (g : TensorField2) (σ μ ν : Fin 4) (x : Coord) : ℝ :=
  (1 / 2 : ℝ) * ∑ ρ : Fin 4, invMetric g x σ ρ *
    (partialD μ (fun y => g y ν ρ) x + partialD ν (fun y => g y ρ μ) x
      - partialD ρ (fun y => g y μ ν) x)

/-- The covariant derivative of a two-index tensor with lower indices (Carroll eq. (35)):
`∇_σ T_{μν} = ∂_σ T_{μν} − Γ^λ_{σμ} T_{λν} − Γ^λ_{σν} T_{μλ}`. -/
noncomputable def covDerivLower2 (g T : TensorField2) (σ μ ν : Fin 4) (x : Coord) : ℝ :=
  partialD σ (fun y => T y μ ν) x
    - ∑ l : Fin 4, christoffel g l σ μ x * T x l ν
    - ∑ l : Fin 4, christoffel g l σ ν x * T x μ l

/-- The covariant derivative of a two-index tensor with upper indices (Carroll eq. (35)):
`∇_σ T^{μν} = ∂_σ T^{μν} + Γ^μ_{σλ} T^{λν} + Γ^ν_{σλ} T^{μλ}`. -/
noncomputable def covDerivUpper2 (g T : TensorField2) (σ μ ν : Fin 4) (x : Coord) : ℝ :=
  partialD σ (fun y => T y μ ν) x
    + ∑ l : Fin 4, christoffel g μ σ l x * T x l ν
    + ∑ l : Fin 4, christoffel g ν σ l x * T x μ l

/-- The covariant derivative of a four-index tensor with lower indices (Carroll eq. (35)):
`∇_λ T_{μνρσ} = ∂_λ T_{μνρσ} − Γ^κ_{λμ} T_{κνρσ} − Γ^κ_{λν} T_{μκρσ} − Γ^κ_{λρ} T_{μνκσ}
 − Γ^κ_{λσ} T_{μνρκ}`. -/
noncomputable def covDerivLower4 (g : TensorField2) (T : TensorField4) (l μ ν ρ σ : Fin 4)
    (x : Coord) : ℝ :=
  partialD l (fun y => T y μ ν ρ σ) x
    - ∑ k : Fin 4, christoffel g k l μ x * T x k ν ρ σ
    - ∑ k : Fin 4, christoffel g k l ν x * T x μ k ρ σ
    - ∑ k : Fin 4, christoffel g k l ρ x * T x μ ν k σ
    - ∑ k : Fin 4, christoffel g k l σ x * T x μ ν ρ k

/-- The Riemann curvature tensor (Carroll eq. (44)):
`R^σ_{μαβ} = ∂_α Γ^σ_{μβ} − ∂_β Γ^σ_{μα} + Γ^σ_{αλ} Γ^λ_{μβ} − Γ^σ_{βλ} Γ^λ_{μα}`. -/
noncomputable def riemann (g : TensorField2) (σ μ α β : Fin 4) (x : Coord) : ℝ :=
  partialD α (christoffel g σ μ β) x - partialD β (christoffel g σ μ α) x
    + ∑ l : Fin 4, (christoffel g σ α l x * christoffel g l μ β x
      - christoffel g σ β l x * christoffel g l μ α x)

/-- The Riemann tensor with all indices lowered, `R_{μνρσ} = g_{μλ} R^λ_{νρσ}` (Carroll, before
eq. (47)). -/
noncomputable def riemannLower (g : TensorField2) : TensorField4 :=
  fun x μ ν ρ σ => ∑ l : Fin 4, g x μ l * riemann g l ν ρ σ x

/-- The Ricci tensor `R_{αβ} = R^λ_{αλβ}` (Carroll eq. (45)). -/
noncomputable def ricci (g : TensorField2) (α β : Fin 4) (x : Coord) : ℝ :=
  ∑ l : Fin 4, riemann g l α l β x

/-- The Ricci scalar `R = g^{μν} R_{μν}` (Carroll eq. (46)). -/
noncomputable def ricciScalar (g : TensorField2) (x : Coord) : ℝ :=
  ∑ μ : Fin 4, ∑ ν : Fin 4, invMetric g x μ ν * ricci g μ ν x

/-- The Einstein tensor `G_{μν} = R_{μν} − ½ R g_{μν}` (Carroll eq. (50)). -/
noncomputable def einstein (g : TensorField2) (μ ν : Fin 4) (x : Coord) : ℝ :=
  ricci g μ ν x - (1 / 2 : ℝ) * ricciScalar g x * g x μ ν

/-- The Einstein tensor with both indices raised, `G^{μν} = g^{μα} g^{νβ} G_{αβ}`. -/
noncomputable def einsteinUpper (g : TensorField2) : TensorField2 :=
  fun x => Matrix.of fun μ ν =>
    ∑ α : Fin 4, ∑ β : Fin 4, invMetric g x μ α * invMetric g x ν β * einstein g α β x

/-- The trace `T = g^{μν} T_{μν}` of a two-index tensor with respect to the metric `g`. -/
noncomputable def metricTrace (g T : TensorField2) (x : Coord) : ℝ :=
  ∑ μ : Fin 4, ∑ ν : Fin 4, invMetric g x μ ν * T x μ ν

/-- Einstein's equation `R_{μν} − ½ R g_{μν} = 8πG T_{μν}` at the point `x` (Carroll eq. (57)),
for the metric `g`, Newton's constant `GN` and energy-momentum tensor `T`. -/
def EinsteinEq (g : TensorField2) (GN : ℝ) (T : TensorField2) (x : Coord) : Prop :=
  ∀ μ ν : Fin 4, einstein g μ ν x = 8 * Real.pi * GN * T x μ ν

/-- The Jacobian matrix `∂F^a/∂x^μ (x)` of a change of coordinates `F` (row `a`, column `μ`). -/
noncomputable def jacobian (F : Coord → Coord) (x : Coord) : Matrix (Fin 4) (Fin 4) ℝ :=
  Matrix.of fun a μ => partialD μ (fun y => F y a) x

/-- Spherical coordinates on space (Carroll eq. (18)):
`(t, r, θ, φ) ↦ (t, r sin θ cos φ, r sin θ sin φ, r cos θ)`. -/
noncomputable def sphericalToCartesian (x : Coord) : Coord :=
  ![x 0, x 1 * Real.sin (x 2) * Real.cos (x 3), x 1 * Real.sin (x 2) * Real.sin (x 3),
    x 1 * Real.cos (x 2)]

/-- The general spherically symmetric metric in spherical coordinates `(t, r, θ, φ)`
(Carroll eq. (71)): `ds² = −A(r,t) dt² + B(r,t) dr² + r² (dθ² + sin²θ dφ²)`. -/
noncomputable def sphericalMetric (A B : ℝ → ℝ → ℝ) : TensorField2 := fun x =>
  Matrix.diagonal ![-A (x 1) (x 0), B (x 1) (x 0), (x 1) ^ 2, (x 1) ^ 2 * Real.sin (x 2) ^ 2]

/-- The Schwarzschild metric (Carroll eq. (72)) with Newton's constant `GN` and mass `m`:
`ds² = −(1 − 2Gm/r) dt² + (1 − 2Gm/r)⁻¹ dr² + r² (dθ² + sin²θ dφ²)`. -/
noncomputable def schwarzschild (GN m : ℝ) : TensorField2 :=
  sphericalMetric (fun r _ => 1 - 2 * GN * m / r) (fun r _ => (1 - 2 * GN * m / r)⁻¹)

/-- The Kruskal coordinate `u` (Carroll eq. (73)):
`u = (r/2Gm − 1)^{1/2} e^{r/4Gm} cosh(t/4Gm)`. -/
noncomputable def kruskalU (GN m t r : ℝ) : ℝ :=
  Real.sqrt (r / (2 * GN * m) - 1) * Real.exp (r / (4 * GN * m)) * Real.cosh (t / (4 * GN * m))

/-- The Kruskal coordinate `v` (Carroll eq. (73)):
`v = (r/2Gm − 1)^{1/2} e^{r/4Gm} sinh(t/4Gm)`. -/
noncomputable def kruskalV (GN m t r : ℝ) : ℝ :=
  Real.sqrt (r / (2 * GN * m) - 1) * Real.exp (r / (4 * GN * m)) * Real.sinh (t / (4 * GN * m))

/-- The change of coordinates `(t, r, θ, φ) ↦ (v, u, θ, φ)` from Schwarzschild to Kruskal
coordinates (Carroll eq. (73)); in Kruskal coordinates `v` is listed first. -/
noncomputable def schwarzschildToKruskal (GN m : ℝ) (x : Coord) : Coord :=
  ![kruskalV GN m (x 0) (x 1), kruskalU GN m (x 0) (x 1), x 2, x 3]

/-- The components of the Schwarzschild metric in Kruskal coordinates `(v, u, θ, φ)`
(Carroll eq. (74)), written as a function of the values of `r` and `θ` at the point:
`diag(−F, F, r², r² sin²θ)` with `F = 32 (Gm)³ / r · e^{−r/2Gm}`. -/
noncomputable def kruskalMetricAt (GN m r θ : ℝ) : Matrix (Fin 4) (Fin 4) ℝ :=
  Matrix.diagonal
    ![-(32 * (GN * m) ^ 3 / r * Real.exp (-r / (2 * GN * m))),
      32 * (GN * m) ^ 3 / r * Real.exp (-r / (2 * GN * m)), r ^ 2, r ^ 2 * Real.sin θ ^ 2]

end CarrollGR
Source
S. M. Carroll, "A No-Nonsense Introduction to General Relativity" (lecture notes, 2001), uploaded PDF, eqs. (3), (18), (23), (35), (36), (44)–(46), (50), (57), (71)–(74)
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic) - same agent as the drafter; non-blind

Non-blind read-back — not independent testimony. This read-back was written by the same agent that drafted the Lean statement, with full knowledge of the source text and of the intended meaning. It is not a blind audit by an independent reader and must not be treated as one; reviewers should compare the Lean code against the source themselves.

The file declares, inside the namespace CarrollGR, the following objects (no theorems).

  • Coord is R4\mathbb R^4R4 written as functions {0,1,2,3}→R\{0,1,2,3\}\to\mathbb R{0,1,2,3}→R; TensorField2 is the type of maps R4→R4×4\mathbb R^4\to\mathbb R^{4\times4}R4→R4×4; TensorField4 is the type of maps assigning to a point and four indices a real number.
  • partialD μ f x\mu\,f\,xμfx is Df(x)(eμ)Df(x)(e_\mu)Df(x)(eμ​), the Fréchet derivative of f:R4→Rf:\mathbb R^4\to\mathbb Rf:R4→R at xxx applied to the μ\muμ-th standard basis vector eμe_\mueμ​; it equals 000 if fff is not differentiable at xxx.
  • minkowskiEta is the diagonal matrix diag(−1,1,1,1)\mathrm{diag}(-1,1,1,1)diag(−1,1,1,1).
  • IsLorentzian MMM holds iff there is a real 4×44\times44×4 matrix PPP with det⁡P≠0\det P\neq0detP=0 and PTMP=diag(−1,1,1,1)P^{\mathsf T}MP=\mathrm{diag}(-1,1,1,1)PTMP=diag(−1,1,1,1).
  • IsSpacetimeMetricOn g Ug\,UgU holds iff UUU is open, each component y↦g(y)μνy\mapsto g(y)_{\mu\nu}y↦g(y)μν​ is C∞C^\inftyC∞ on UUU, and g(y)g(y)g(y) is Lorentzian for every y∈Uy\in Uy∈U.
  • invMetric ggg is the field x↦g(x)−1x\mapsto g(x)^{-1}x↦g(x)−1 (Mathlib's matrix inverse, which is the zero matrix when det⁡g(x)=0\det g(x)=0detg(x)=0).
  • christoffel g σ μ ν x=12∑ρgσρ(x)(∂μgνρ+∂νgρμ−∂ρgμν)(x)g\,\sigma\,\mu\,\nu\,x=\frac12\sum_\rho g^{\sigma\rho}(x)\big(\partial_\mu g_{\nu\rho}+\partial_\nu g_{\rho\mu}-\partial_\rho g_{\mu\nu}\big)(x)gσμνx=21​∑ρ​gσρ(x)(∂μ​gνρ​+∂ν​gρμ​−∂ρ​gμν​)(x).
  • covDerivLower2 g T σ μ ν x=∂σTμν(x)−∑λΓσμλ(x)Tλν(x)−∑λΓσνλ(x)Tμλ(x)g\,T\,\sigma\,\mu\,\nu\,x=\partial_\sigma T_{\mu\nu}(x)-\sum_\lambda\Gamma^\lambda_{\sigma\mu}(x)T_{\lambda\nu}(x)-\sum_\lambda\Gamma^\lambda_{\sigma\nu}(x)T_{\mu\lambda}(x)gTσμνx=∂σ​Tμν​(x)−∑λ​Γσμλ​(x)Tλν​(x)−∑λ​Γσνλ​(x)Tμλ​(x).
  • covDerivUpper2 g T σ μ ν x=∂σTμν(x)+∑λΓσλμ(x)Tλν(x)+∑λΓσλν(x)Tμλ(x)g\,T\,\sigma\,\mu\,\nu\,x=\partial_\sigma T_{\mu\nu}(x)+\sum_\lambda\Gamma^\mu_{\sigma\lambda}(x)T_{\lambda\nu}(x)+\sum_\lambda\Gamma^\nu_{\sigma\lambda}(x)T_{\mu\lambda}(x)gTσμνx=∂σ​Tμν​(x)+∑λ​Γσλμ​(x)Tλν​(x)+∑λ​Γσλν​(x)Tμλ​(x) (the matrix entries of TTT play the role of upper-index components).
  • covDerivLower4 g T λ μ ν ρ σ x=∂λTμνρσ−∑κ(ΓλμκTκνρσ+ΓλνκTμκρσ+ΓλρκTμνκσ+ΓλσκTμνρκ)g\,T\,\lambda\,\mu\,\nu\,\rho\,\sigma\,x=\partial_\lambda T_{\mu\nu\rho\sigma}-\sum_\kappa\big(\Gamma^\kappa_{\lambda\mu}T_{\kappa\nu\rho\sigma}+\Gamma^\kappa_{\lambda\nu}T_{\mu\kappa\rho\sigma}+\Gamma^\kappa_{\lambda\rho}T_{\mu\nu\kappa\sigma}+\Gamma^\kappa_{\lambda\sigma}T_{\mu\nu\rho\kappa}\big)gTλμνρσx=∂λ​Tμνρσ​−∑κ​(Γλμκ​Tκνρσ​+Γλνκ​Tμκρσ​+Γλρκ​Tμνκσ​+Γλσκ​Tμνρκ​), all at xxx.
  • riemann g σ μ α β x=∂αΓμβσ(x)−∂βΓμασ(x)+∑λ(ΓαλσΓμβλ−ΓβλσΓμαλ)(x)g\,\sigma\,\mu\,\alpha\,\beta\,x=\partial_\alpha\Gamma^\sigma_{\mu\beta}(x)-\partial_\beta\Gamma^\sigma_{\mu\alpha}(x)+\sum_\lambda\big(\Gamma^\sigma_{\alpha\lambda}\Gamma^\lambda_{\mu\beta}-\Gamma^\sigma_{\beta\lambda}\Gamma^\lambda_{\mu\alpha}\big)(x)gσμαβx=∂α​Γμβσ​(x)−∂β​Γμασ​(x)+∑λ​(Γαλσ​Γμβλ​−Γβλσ​Γμαλ​)(x), where the derivatives are of the functions y↦Γ(y)y\mapsto\Gamma(y)y↦Γ(y).
  • riemannLower ggg is x,μ,ν,ρ,σ↦∑λgμλ(x)Rλνρσ(x)x,\mu,\nu,\rho,\sigma\mapsto\sum_\lambda g_{\mu\lambda}(x)R^\lambda{}_{\nu\rho\sigma}(x)x,μ,ν,ρ,σ↦∑λ​gμλ​(x)Rλνρσ​(x).
  • ricci g α β x=∑λRλαλβ(x)g\,\alpha\,\beta\,x=\sum_\lambda R^\lambda{}_{\alpha\lambda\beta}(x)gαβx=∑λ​Rλαλβ​(x); ricciScalar g x=∑μ,νgμν(x)Rμν(x)g\,x=\sum_{\mu,\nu}g^{\mu\nu}(x)R_{\mu\nu}(x)gx=∑μ,ν​gμν(x)Rμν​(x); einstein g μ ν x=Rμν(x)−12R(x)gμν(x)g\,\mu\,\nu\,x=R_{\mu\nu}(x)-\frac12R(x)g_{\mu\nu}(x)gμνx=Rμν​(x)−21​R(x)gμν​(x); einsteinUpper ggg is the field whose (μ,ν)(\mu,\nu)(μ,ν) entry is ∑α,βgμαgνβGαβ\sum_{\alpha,\beta}g^{\mu\alpha}g^{\nu\beta}G_{\alpha\beta}∑α,β​gμαgνβGαβ​.
  • metricTrace g T x=∑μ,νgμν(x)Tμν(x)g\,T\,x=\sum_{\mu,\nu}g^{\mu\nu}(x)T_{\mu\nu}(x)gTx=∑μ,ν​gμν(x)Tμν​(x).
  • EinsteinEq g G T xg\,G\,T\,xgGTx is the proposition: for all μ,ν\mu,\nuμ,ν, Gμν(x)=8π G Tμν(x)G_{\mu\nu}(x)=8\pi\,G\,T_{\mu\nu}(x)Gμν​(x)=8πGTμν​(x).
  • jacobian F xF\,xFx is the matrix with entry (a,μ)(a,\mu)(a,μ) equal to ∂μFa(x)\partial_\mu F^a(x)∂μ​Fa(x).
  • sphericalToCartesian x=(x0,  x1sin⁡x2cos⁡x3,  x1sin⁡x2sin⁡x3,  x1cos⁡x2)x=(x^0,\;x^1\sin x^2\cos x^3,\;x^1\sin x^2\sin x^3,\;x^1\cos x^2)x=(x0,x1sinx2cosx3,x1sinx2sinx3,x1cosx2).
  • sphericalMetric A BA\,BAB is the field x↦diag(−A(x1,x0), B(x1,x0), (x1)2, (x1)2sin⁡2x2)x\mapsto\mathrm{diag}\big(-A(x^1,x^0),\,B(x^1,x^0),\,(x^1)^2,\,(x^1)^2\sin^2x^2\big)x↦diag(−A(x1,x0),B(x1,x0),(x1)2,(x1)2sin2x2) for arbitrary functions A,B:R×R→RA,B:\mathbb R\times\mathbb R\to\mathbb RA,B:R×R→R (first argument r=x1r=x^1r=x1, second t=x0t=x^0t=x0).
  • schwarzschild G mG\,mGm is sphericalMetric with A(r,t)=1−2Gm/rA(r,t)=1-2Gm/rA(r,t)=1−2Gm/r and B(r,t)=(1−2Gm/r)−1B(r,t)=(1-2Gm/r)^{-1}B(r,t)=(1−2Gm/r)−1 (with Lean's conventions a/0=0a/0=0a/0=0 and 0−1=00^{-1}=00−1=0, so at r=0r=0r=0 both equal 111 and 0−1=00^{-1}=00−1=0 at r=2Gmr=2Gmr=2Gm).
  • kruskalU G m t r=r/(2Gm)−1  er/(4Gm)cosh⁡(t/(4Gm))G\,m\,t\,r=\sqrt{r/(2Gm)-1}\;e^{r/(4Gm)}\cosh(t/(4Gm))Gmtr=r/(2Gm)−1​er/(4Gm)cosh(t/(4Gm)) and kruskalV the same with sinh⁡\sinhsinh; here ⋅\sqrt{\cdot}⋅​ is the real square root, equal to 000 on negative arguments.
  • schwarzschildToKruskal G m x=(kruskalV(x0,x1), kruskalU(x0,x1), x2, x3)G\,m\,x=(\mathrm{kruskalV}(x^0,x^1),\,\mathrm{kruskalU}(x^0,x^1),\,x^2,\,x^3)Gmx=(kruskalV(x0,x1),kruskalU(x0,x1),x2,x3).
  • kruskalMetricAt G m r θ=diag(−F,F,r2,r2sin⁡2θ)G\,m\,r\,\theta=\mathrm{diag}(-F,F,r^2,r^2\sin^2\theta)Gmrθ=diag(−F,F,r2,r2sin2θ) with F=32(Gm)3re−r/(2Gm)F=\frac{32(Gm)^3}{r}e^{-r/(2Gm)}F=r32(Gm)3​e−r/(2Gm).

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