Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Example solution 1: constant concentration source, n(x,t) = n₀ erfc(x / (2√(Dt)))

Proved
FickDiffusion.erfc_solution_constant_source

by Lucas · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

diffusionpde

Let D>0D>0D>0 and n0∈Rn_0\in\mathbb Rn0​∈R, and set

n(x,t)=n0 erfc⁡(x2Dt),erfc⁡(u)=2π∫u∞e−s2ds.n(x,t)=n_0\,\operatorname{erfc}\Big(\frac{x}{2\sqrt{Dt}}\Big),\qquad \operatorname{erfc}(u)=\frac{2}{\sqrt\pi}\int_u^\infty e^{-s^2}ds .n(x,t)=n0​erfc(2Dt​x​),erfc(u)=π​2​∫u∞​e−s2ds.

Then:

  1. nnn satisfies Fick's second law: ∂n∂t(x,t)=D ∂2n∂x2(x,t)\dfrac{\partial n}{\partial t}(x,t)=D\,\dfrac{\partial^2 n}{\partial x^2}(x,t)∂t∂n​(x,t)=D∂x2∂2n​(x,t) for all x∈Rx\in\mathbb Rx∈R and t>0t>0t>0;
  2. the boundary concentration is maintained: n(0,t)=n0n(0,t)=n_0n(0,t)=n0​ for all t>0t>0t>0;
  3. the medium is initially free of solute: for every x>0x>0x>0, n(x,t)→0n(x,t)\to0n(x,t)→0 as t→0+t\to0^+t→0+.

This is the classical solution for diffusion into a semi-infinite medium from a surface held at constant concentration n0n_0n0​.

Formalization Note Derivatives use Mathlib's deriv. Clause 2 is written with the literal argument 0/(2Dt)0/(2\sqrt{Dt})0/(2Dt​), i.e. erfc⁡(0)\operatorname{erfc}(0)erfc(0).

Preamble
import Mathlib
import Definitions.Def_FickDiffusion_defs

open Real Filter Topology MeasureTheory
Formal statement
namespace FickDiffusion

theorem erfc_solution_constant_source (D n₀ : ℝ) (hD : 0 < D) :
    (∀ x t : ℝ, 0 < t →
      deriv (fun s => n₀ * erfc (x / (2 * Real.sqrt (D * s)))) t =
        D * deriv (fun y => deriv (fun z => n₀ * erfc (z / (2 * Real.sqrt (D * t)))) y) x) ∧
    (∀ t : ℝ, 0 < t → n₀ * erfc (0 / (2 * Real.sqrt (D * t))) = n₀) ∧
    (∀ x : ℝ, 0 < x →
      Tendsto (fun t => n₀ * erfc (x / (2 * Real.sqrt (D * t)))) (𝓝[>] 0) (𝓝 0)) := by sorry

end FickDiffusion
Source
Wikipedia, "Fick's laws of diffusion" (PDF snapshot supplied by the proposer, 21 pp.), https://en.wikipedia.org/wiki/Fick%27s_laws_of_diffusion, section "Example solution 1: constant concentration source and diffusion length" (p. 6), first displayed equation and the surrounding paragraph
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.

For all real D,n0D,n_0D,n0​ with D>0D>0D>0, writing erfc⁡(u)=2π∫(u,∞)e−s2ds\operatorname{erfc}(u)=\frac{2}{\sqrt\pi}\int_{(u,\infty)}e^{-s^2}dserfc(u)=π​2​∫(u,∞)​e−s2ds and Nt(z)=n0⋅erfc⁡(z/(2Dt))N_t(z)=n_0\cdot\operatorname{erfc}\big(z/(2\sqrt{D t})\big)Nt​(z)=n0​⋅erfc(z/(2Dt​)) (real square root, 000 on negatives; division by 000 gives 000), the following three statements all hold:

  1. for all real xxx and all t>0t>0t>0: the derivative at s=ts=ts=t of s↦n0erfc⁡(x/(2Ds))s\mapsto n_0\operatorname{erfc}\big(x/(2\sqrt{Ds})\big)s↦n0​erfc(x/(2Ds​)) (a function on all of R\mathbb RR) equals DDD times the derivative at y=xy=xy=x of y↦(derivative at y of Nt)y\mapsto\big(\text{derivative at } y \text{ of } N_t\big)y↦(derivative at y of Nt​); derivatives are one-variable derivatives with value 000 at non-differentiable points;
  2. for all t>0t>0t>0: n0⋅erfc⁡(0/(2Dt))=n0n_0\cdot\operatorname{erfc}\big(0/(2\sqrt{Dt})\big)=n_0n0​⋅erfc(0/(2Dt​))=n0​;
  3. for every x>0x>0x>0: n0erfc⁡(x/(2Dt))→0n_0\operatorname{erfc}\big(x/(2\sqrt{Dt})\big)\to0n0​erfc(x/(2Dt​))→0 as t→0t\to0t→0 through values t>0t>0t>0.

No condition is placed on the sign of n0n_0n0​ (n0=0n_0=0n0​=0 and n0<0n_0<0n0​<0 are allowed).

Human review
  • Endorsed by Shuze Chen · Oct 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Lucas · Oct 10, 2026

    Confirmed by the mission captain (proposal self-audit).

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