Vector calculus on and Maxwell's microscopic equations (SI)
DefinitionMaxwellWiki_DefsVector calculus on and Maxwell's microscopic equations in SI units.
- Vectors. is represented by coordinate triples .
- Partial derivatives. For a scalar field , is the Fréchet derivative of at applied to the -th standard basis vector .
- Divergence and curl. For a vector field ,
- Time derivative. For a time-dependent field , is the derivative of at .
- Maxwell's equations. Given constants , fields and a charge density , the predicate Maxwell solution asserts that at every time and every point
- Flux through a box. For in and the box , the outward flux of through is
each face integral being a two-dimensional Lebesgue integral over the remaining two coordinates.
These definitions are shared by every statement of the mission.
Formalization Note Derivatives are Mathlib's fderiv/deriv, which return at points of non-differentiability; all theorems of the mission therefore assume explicit smoothness. The flux is only defined for rectangular boxes, which is the setting in which Mathlib's divergence theorem is available.
import Mathlib
namespace MaxwellWiki
/-- Vectors in three-dimensional space, as coordinate triples. -/
abbrev Vec3 := Fin 3 → ℝ
/-- The partial derivative `∂f/∂xᵢ` of a scalar field at `x`. -/
noncomputable def partialDeriv (i : Fin 3) (f : Vec3 → ℝ) (x : Vec3) : ℝ :=
fderiv ℝ f x (Pi.single i 1)
/-- The divergence `∇ · F` of a vector field. -/
noncomputable def div (F : Vec3 → Vec3) (x : Vec3) : ℝ :=
∑ i : Fin 3, partialDeriv i (fun y => F y i) x
/-- The curl `∇ × F` of a vector field. -/
noncomputable def curl (F : Vec3 → Vec3) (x : Vec3) : Vec3 :=
![partialDeriv 1 (fun y => F y 2) x - partialDeriv 2 (fun y => F y 1) x,
partialDeriv 2 (fun y => F y 0) x - partialDeriv 0 (fun y => F y 2) x,
partialDeriv 0 (fun y => F y 1) x - partialDeriv 1 (fun y => F y 0) x]
/-- The partial time derivative `∂F/∂t` of a time-dependent field at `(t, x)`. -/
noncomputable def timeDeriv {β : Type*} [NormedAddCommGroup β] [NormedSpace ℝ β]
(F : ℝ → Vec3 → β) (t : ℝ) (x : Vec3) : β :=
deriv (fun s => F s x) t
/-- Maxwell's microscopic equations in SI units (Gauss's law, Gauss's law for magnetism,
Faraday's law, Ampère–Maxwell law), holding at every time and every point of space. -/
structure IsMaxwellSolution (ε₀ μ₀ : ℝ) (E B J : ℝ → Vec3 → Vec3) (ρ : ℝ → Vec3 → ℝ) :
Prop where
gauss : ∀ t x, div (E t) x = ρ t x / ε₀
gauss_magnetism : ∀ t x, div (B t) x = 0
faraday : ∀ t x, curl (E t) x = -timeDeriv B t x
ampere_maxwell : ∀ t x, curl (B t) x = μ₀ • (J t x + ε₀ • timeDeriv E t x)
/-- The outward flux `∯_{∂Ω} F · dS` of a vector field through the boundary of the
rectangular box `Ω = [a₀,b₀] × [a₁,b₁] × [a₂,b₂]`: for each coordinate direction `i`, the
integral of `Fᵢ` over the face `xᵢ = bᵢ` minus its integral over the face `xᵢ = aᵢ`. -/
noncomputable def boxFlux (F : Vec3 → Vec3) (a b : Vec3) : ℝ :=
∑ i : Fin 3,
((∫ y in Set.Icc (a ∘ i.succAbove) (b ∘ i.succAbove), F (i.insertNth (b i) y) i) -
∫ y in Set.Icc (a ∘ i.succAbove) (b ∘ i.succAbove), F (i.insertNth (a i) y) i)
end MaxwellWiki
Read-back
What the Lean code literally says, in plain math · Aristotle (Harmonic) - non-blind, same agent as the drafter
Non-blind read-back. This read-back was written by the same agent that drafted the Lean statement (Aristotle, by Harmonic), with full knowledge of the source and of the intended meaning. It is not independent testimony and must not be treated as a blind audit; reviewers should compare the Lean code against the source themselves.
The file declares, inside the namespace MaxwellWiki:
- : functions (coordinate triples; the ambient norm is Mathlib's sup norm, which does not affect derivatives).
- for , : the Fréchet derivative (defined to be the zero map if is not differentiable at ) evaluated at the standard basis vector .
- for , where is the -th coordinate of .
- .
- , for with any real normed space: the derivative at of (zero if that map is not differentiable at ).
- A proposition IsMaxwellSolution, for arbitrary real numbers (no sign or nonzero condition is built in), and , meaning that for all , :
Here division by would give . All four equations are required; nothing is assumed about the regularity of the fields.
- for and : the sum over of
where ranges over the closed rectangle of pairs lying between the two remaining coordinates of and of , with respect to Lebesgue measure; a non-integrable integrand contributes . No condition is imposed in the definition (an empty rectangle gives integral ).