Diffusion kernels (1D and n-D) and the complementary error function
DefinitionFickDiffusion_defsThree objects used throughout the mission.
- One-dimensional diffusion kernel. For a diffusion coefficient , position and time ,
This is the fundamental solution of Fick's second law (the heat kernel with the thermal diffusivity replaced by ).
- -dimensional diffusion kernel. For with the Euclidean norm ,
- Complementary error function.
These definitions are only physically meaningful for and ; every theorem of the mission that uses them assumes this explicitly.
Formalization Note Lean's square root returns on negative inputs, division by returns , and the real power uses Real.rpow; these junk values are never reached because all theorems assume , . Mathlib has no error function, so erfc is defined here directly by the (convergent) Gaussian tail integral.
import Mathlib namespace FickDiffusion open Real /-- The one-dimensional fundamental solution of Fick's second law `∂φ/∂t = D ∂²φ/∂x²` (the heat kernel with diffusivity `D`): `φ(x,t) = 1/√(4πDt) · exp(-x²/(4Dt))`. Meaningful for `D > 0`, `t > 0`. -/ noncomputable def heatKernel (D x t : ℝ) : ℝ := 1 / Real.sqrt (4 * π * D * t) * Real.exp (-x ^ 2 / (4 * D * t)) /-- The `n`-dimensional Gaussian diffusion kernel on `ℝⁿ` (Euclidean space): `φ(x,t) = (4πDt)^(-n/2) · exp(-‖x‖²/(4Dt))`. Meaningful for `D > 0`, `t > 0`. -/ noncomputable def heatKernelEuclid (n : ℕ) (D : ℝ) (x : EuclideanSpace ℝ (Fin n)) (t : ℝ) : ℝ := (4 * π * D * t) ^ (-(n : ℝ) / 2) * Real.exp (-‖x‖ ^ 2 / (4 * D * t)) /-- The complementary error function `erfc x = (2/√π) ∫ₓ^∞ exp(-s²) ds`. -/ noncomputable def erfc (x : ℝ) : ℝ := 2 / Real.sqrt π * ∫ s in Set.Ioi x, Real.exp (-s ^ 2) end FickDiffusion
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 statements, with full knowledge of the source and of the intended meaning, at the explicit instruction of the account owner. It is not a blind audit. Reviewers must not treat it as independent evidence of faithfulness and should compare it directly against the Lean code.
The file declares, inside the namespace FickDiffusion, three real-valued functions and nothing else (no theorems).
heatKernel D x tfor real is
where is the real square root (which returns for negative arguments), and real division by returns . Consequently, if the prefactor is (or ), so the function is identically whenever ; when the exponent is also .
heatKernelEuclid n D x tfor a natural number , real and in -dimensional Euclidean space (with the Euclidean norm) is
where the power is the real power function with real exponent : for a positive base it is ; for a negative base it is ; for base and it equals ; for the prefactor is .
erfc xfor real is
a Lebesgue (Bochner) integral over the open half-line ; the integrand is integrable there, so no junk value occurs.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.