Imports
/- Copyright (c) 2026 Zhi Kai Pong. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Zhi Kai Pong -/ module public import Physlib.Electromagnetism.ThreeDimension.Basic public import Physlib.Electromagnetism.Dynamics.IsExtrema

A. Maxwell's equations in three dimensions

Maxwell's equations relate electric and magnetic fields to electric charge and current. In three spatial dimensions they can be written using the familiar divergence, curl, and time-derivative operators of vector calculus.

A.1. Main results

This module proves the four differential equations:

    gaussLawElectric, relating the divergence of the electric field to charge density;

    gaussLawMagnetic, stating that the magnetic field is divergence-free;

    ampereLaw, including both the electric current and displacement-current terms;

    faradayLaw, relating the curl of the electric field to the time derivative of the magnetic field.

A.2. Relation to the covariant formulation

The electric and magnetic fields are obtained from an electromagnetic potential. Gauss's law for the electric field and Ampère's law are derived from the covariant extremality condition IsExtrema, while the two homogeneous equations follow from the potential definitions and smoothness assumptions. The results therefore connect the tensorial backend to the standard three-dimensional presentation.

A.3. Current scope

The statements here are pointwise differential equations in free space. Integral formulations, boundary conditions, and constitutive laws for material media are outside the current scope of this module.

local notation "φ" => V.scalarPotential 𝓕.clocal notation "A" => V.vectorPotential 𝓕.clocal notation "E" => V.electricField 𝓕.clocal notation "B" => V.magneticField 𝓕.clocal notation "ρ" => J₄.chargeDensity 𝓕.clocal notation "J" => J₄.currentDensity 𝓕.clocal notation "ε₀" => 𝓕.ε₀local notation "μ₀" => 𝓕.μ₀

Gauss's law for the electric field.

theorem gaussLawElectric (t : Time) (x : Space) (h : IsExtrema 𝓕 V J₄) (hV : ContDiff V) (hJ : ContDiff J₄) : ( E t) x = ρ t x / ε₀ := 𝓕:FreeSpaceV:ElectromagneticPotentialJ₄:LorentzCurrentDensityt:Timex:Spaceh:IsExtrema 𝓕 V J₄hV:ContDiff (V.val 3)hJ:ContDiff J₄Space.div (electricField 𝓕.c V t) x = LorentzCurrentDensity.chargeDensity 𝓕.c J₄ t x / 𝓕.ε₀ All goals completed! 🐙

Gauss's law for the magnetic field.

All goals completed! 🐙

Ampère's law.

𝓕:FreeSpaceV:ElectromagneticPotentialJ₄:LorentzCurrentDensityt:Timex:Spaceh:IsExtrema 𝓕 V J₄hV:ContDiff (V.val 3)hJ:ContDiff J₄i:Fin 3hdE:𝓕.μ₀ * 𝓕.ε₀ * (∂ₜ (fun t => electricField 𝓕.c V t x) t).ofLp i = (curl (magneticField 𝓕.c V t) x).ofLp i - 𝓕.μ₀ * (LorentzCurrentDensity.currentDensity 𝓕.c J₄ t x).ofLp i(curl (magneticField 𝓕.c V t) x).ofLp i = (𝓕.μ₀ LorentzCurrentDensity.currentDensity 𝓕.c J₄ t x + 𝓕.μ₀ 𝓕.ε₀ ∂ₜ (fun t => electricField 𝓕.c V t x) t).ofLp i All goals completed! 🐙

Faraday's law.

𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)(fun i => (fun i => -0 i) i - curl (fun x => ∂ₜ (fun t => vectorPotential 𝓕.c V t x) t) i) x = -curl (fun x => ∂ₜ (fun t => vectorPotential 𝓕.c V t x) t) x𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)ContDiff 2 (vectorPotential 𝓕.c V)𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)ContDiff 2 (scalarPotential 𝓕.c V t)𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable ( (scalarPotential 𝓕.c V t))𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable fun x => - (scalarPotential 𝓕.c V t) x𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable fun x => ∂ₜ (fun t => vectorPotential 𝓕.c V t x) t 𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)ContDiff 2 (vectorPotential 𝓕.c V)𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)ContDiff 2 (scalarPotential 𝓕.c V t)𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable ( (scalarPotential 𝓕.c V t))𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable fun x => - (scalarPotential 𝓕.c V t) x𝓕:FreeSpaceV:ElectromagneticPotentialt:Timex:SpacehV:ContDiff (V.val 3)Differentiable fun x => ∂ₜ (fun t => vectorPotential 𝓕.c V t x) t all_goals All goals completed! 🐙