Vector calculus in : cross product, divergence, curl
DefinitionLarmor_vec3This file fixes the three-dimensional arena in which the whole development takes place.
Points and vectors live in equipped with its standard Euclidean inner product and the associated norm. Three operations are introduced.
- The cross product of is
components being indexed by .
-
For a vector field , a direction index and a component index , the partial derivative is the -th component of the derivative of at in the -th coordinate direction.
-
From these, the divergence and the curl of a vector field are
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 rather than undefined.
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 LarmorRead-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 carried by the Euclidean inner product and norm (indices run over ).
It defines four things.
- A binary operation on whose three components are, in order,
This is an unconditional algebraic formula; no hypothesis on is imposed.
- For a map , indices and a point , the quantity
the -th component of the Fréchet derivative of at applied to the -th standard basis vector. No differentiability of is assumed anywhere: if is not differentiable at the Fréchet derivative is taken to be the zero linear map, and the value above is then .
-
, a real number.
-
, the vector with components
Every declaration is a definition; nothing is asserted or proved. Because the underlying derivative is total, both and return the value at points of non-differentiability instead of being undefined.