Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Vector calculus in R3\mathbb{R}^3R3: cross product, divergence, curl

Definition
Larmor_vec3

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

electromagnetismmathematical-physicsvector-calculus

This file fixes the three-dimensional arena in which the whole development takes place.

Points and vectors live in V=R3V=\mathbb{R}^3V=R3 equipped with its standard Euclidean inner product ⟨u,v⟩=∑iuivi\langle u,v\rangle=\sum_{i} u_i v_i⟨u,v⟩=∑i​ui​vi​ and the associated norm. Three operations are introduced.

  1. The cross product of u,v∈Vu,v\in Vu,v∈V is
u×v=(u1v2−u2v1,  u2v0−u0v2,  u0v1−u1v0),u\times v=\bigl(u_1v_2-u_2v_1,\; u_2v_0-u_0v_2,\; u_0v_1-u_1v_0\bigr),u×v=(u1​v2​−u2​v1​,u2​v0​−u0​v2​,u0​v1​−u1​v0​),

components being indexed by 0,1,20,1,20,1,2.

  1. For a vector field F:V→VF:V\to VF:V→V, a direction index jjj and a component index iii, the partial derivative ∂jFi(x)\partial_j F_i(x)∂j​Fi​(x) is the iii-th component of the derivative of FFF at xxx in the jjj-th coordinate direction.

  2. From these, the divergence and the curl of a vector field are

∇⋅F=∑i∂iFi,∇×F=(∂1F2−∂2F1,  ∂2F0−∂0F2,  ∂0F1−∂1F0).\nabla\cdot F=\sum_{i}\partial_i F_i,\qquad \nabla\times F=\bigl(\partial_1F_2-\partial_2F_1,\;\partial_2F_0-\partial_0F_2,\;\partial_0F_1-\partial_1F_0\bigr).∇⋅F=i∑​∂i​Fi​,∇×F=(∂1​F2​−∂2​F1​,∂2​F0​−∂0​F2​,∂0​F1​−∂1​F0​).

These three operators are the entire vector-analytic vocabulary needed to state Maxwell's equations, Poynting's theorem and the Liénard–Wiechert field equations, and they are reusable in any other formalization of classical field theory.

Formalization Note Space is EuclideanSpace ℝ (Fin 3), so the inner product and the norm come from Mathlib. Partial derivatives are taken with the Fréchet derivative along the standard basis vectors; at a point where the field fails to be differentiable the Fréchet derivative is the zero map by convention, and the divergence and curl there are 000 rather than undefined.

Definition code
import Mathlib

namespace Larmor

/-- Three-dimensional Euclidean space, the arena for the electromagnetic fields. -/
abbrev Vec := EuclideanSpace ℝ (Fin 3)

/-- The cross product of two vectors of `Vec`. -/
noncomputable def cross (u v : Vec) : Vec :=
  !₂[u 1 * v 2 - u 2 * v 1, u 2 * v 0 - u 0 * v 2, u 0 * v 1 - u 1 * v 0]

/-- The derivative of the `i`-th component of a vector field `F` in the `j`-th
coordinate direction, at the point `x`. -/
noncomputable def partialDeriv (F : Vec → Vec) (j i : Fin 3) (x : Vec) : ℝ :=
  fderiv ℝ F x (EuclideanSpace.single j 1) i

/-- The divergence of a vector field. -/
noncomputable def divg (F : Vec → Vec) (x : Vec) : ℝ := ∑ i, partialDeriv F i i x

/-- The curl of a vector field. -/
noncomputable def curl (F : Vec → Vec) (x : Vec) : Vec :=
  !₂[partialDeriv F 1 2 x - partialDeriv F 2 1 x,
     partialDeriv F 2 0 x - partialDeriv F 0 2 x,
     partialDeriv F 0 1 x - partialDeriv F 1 0 x]

end Larmor
Source
https://en.wikipedia.org/wiki/Larmor_formula — Derivation section (the fields, the Poynting vector and the surface integral are all written in three-dimensional vector notation); J. D. Jackson, Classical Electrodynamics, 3rd ed., Wiley 1998, Chapter 6 and Appendix on vector formulas.
Read-back

What the Lean code literally says, in plain math · Aristotle (Harmonic)

Disclosure — this read-back is not blind. It was written by the same agent that drafted the formal statements in this proposal, at the explicit instruction of the proposal owner, and not by an independent auditor with fresh context. It is therefore not independent testimony and must not be treated as such: the author already knew what the code was intended to say, which is exactly the bias that a blind read-back exists to eliminate. Please read it as an author's own rendering of the Lean code and audit the statements directly against the source material.

This file works in V=R3V=\mathbb{R}^3V=R3 carried by the Euclidean inner product and norm (indices run over 0,1,20,1,20,1,2).

It defines four things.

  1. A binary operation u×vu\times vu×v on VVV whose three components are, in order,
u1v2−u2v1,u2v0−u0v2,u0v1−u1v0.u_1v_2-u_2v_1,\qquad u_2v_0-u_0v_2,\qquad u_0v_1-u_1v_0 .u1​v2​−u2​v1​,u2​v0​−u0​v2​,u0​v1​−u1​v0​.

This is an unconditional algebraic formula; no hypothesis on u,vu,vu,v is imposed.

  1. For a map F:V→VF:V\to VF:V→V, indices j,i∈{0,1,2}j,i\in\{0,1,2\}j,i∈{0,1,2} and a point x∈Vx\in Vx∈V, the quantity
∂jFi(x):=(DF(x) ej)i,\partial_jF_i(x):=\bigl(DF(x)\,e_j\bigr)_i,∂j​Fi​(x):=(DF(x)ej​)i​,

the iii-th component of the Fréchet derivative of FFF at xxx applied to the jjj-th standard basis vector. No differentiability of FFF is assumed anywhere: if FFF is not differentiable at xxx the Fréchet derivative is taken to be the zero linear map, and the value above is then 000.

  1. ∇⋅F(x):=∑i=02∂iFi(x)\nabla\cdot F(x):=\sum_{i=0}^{2}\partial_iF_i(x)∇⋅F(x):=∑i=02​∂i​Fi​(x), a real number.

  2. ∇×F(x)\nabla\times F(x)∇×F(x), the vector with components

∂1F2(x)−∂2F1(x),∂2F0(x)−∂0F2(x),∂0F1(x)−∂1F0(x).\partial_1F_2(x)-\partial_2F_1(x),\qquad \partial_2F_0(x)-\partial_0F_2(x),\qquad \partial_0F_1(x)-\partial_1F_0(x).∂1​F2​(x)−∂2​F1​(x),∂2​F0​(x)−∂0​F2​(x),∂0​F1​(x)−∂1​F0​(x).

Every declaration is a definition; nothing is asserted or proved. Because the underlying derivative is total, both ∇⋅F\nabla\cdot F∇⋅F and ∇×F\nabla\times F∇×F return the value 000 at points of non-differentiability instead of being undefined.

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