Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Example solution 1 (infinite medium): n(x,t) = (n₀/2) erfc(x / (2√(Dt)))

Proved
FickDiffusion.erfc_solution_infinite_medium

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)=n02 erfc⁡(x2Dt).n(x,t)=\frac{n_0}{2}\,\operatorname{erfc}\Big(\frac{x}{2\sqrt{Dt}}\Big).n(x,t)=2n0​​erfc(2Dt​x​).

Then:

  1. ∂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. for every x>0x>0x>0, n(x,t)→0n(x,t)\to0n(x,t)→0 as t→0+t\to0^+t→0+;
  3. for every x<0x<0x<0, n(x,t)→n0n(x,t)\to n_0n(x,t)→n0​ as t→0+t\to0^+t→0+.

So nnn solves Fick's second law on the whole line with initial profile n0n_0n0​ on x<0x<0x<0 and 000 on x>0x>0x>0: a solution of concentration n0n_0n0​ brought into contact with pure solvent.

Formalization Note The initial condition is expressed as pointwise limits as t→0+t\to0^+t→0+ away from the interface x=0x=0x=0 (at x=0x=0x=0 the value is n0/2n_0/2n0​/2 for all t>0t>0t>0, consistent with any choice of n(0,0)n(0,0)n(0,0)).

Preamble
import Mathlib
import Definitions.Def_FickDiffusion_defs

open Real Filter Topology MeasureTheory
Formal statement
namespace FickDiffusion

theorem erfc_solution_infinite_medium (D n₀ : ℝ) (hD : 0 < D) :
    (∀ x t : ℝ, 0 < t →
      deriv (fun s => n₀ / 2 * erfc (x / (2 * Real.sqrt (D * s)))) t =
        D * deriv (fun y => deriv (fun z => n₀ / 2 * erfc (z / (2 * Real.sqrt (D * t)))) y) x) ∧
    (∀ x : ℝ, 0 < x →
      Tendsto (fun t => n₀ / 2 * erfc (x / (2 * Real.sqrt (D * t)))) (𝓝[>] 0) (𝓝 0)) ∧
    (∀ x : ℝ, x < 0 →
      Tendsto (fun t => n₀ / 2 * erfc (x / (2 * Real.sqrt (D * t)))) (𝓝[>] 0) (𝓝 n₀)) := 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), sentence beginning "If, in its turn, the diffusion space is infinite"
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, with 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 real square root (000 on negatives), the following three statements all hold:

  1. for all real xxx and t>0t>0t>0: the derivative at s=ts=ts=t of s↦n02erfc⁡(x/(2Ds))s\mapsto\frac{n_0}{2}\operatorname{erfc}\big(x/(2\sqrt{Ds})\big)s↦2n0​​erfc(x/(2Ds​)) equals DDD times the derivative at y=xy=xy=x of the derivative function of z↦n02erfc⁡(z/(2Dt))z\mapsto\frac{n_0}{2}\operatorname{erfc}\big(z/(2\sqrt{Dt})\big)z↦2n0​​erfc(z/(2Dt​)) (one-variable derivatives, 000 where not differentiable);
  2. for every x>0x>0x>0: n02erfc⁡(x/(2Dt))→0\frac{n_0}{2}\operatorname{erfc}\big(x/(2\sqrt{Dt})\big)\to02n0​​erfc(x/(2Dt​))→0 as t→0t\to0t→0 with t>0t>0t>0;
  3. for every x<0x<0x<0: n02erfc⁡(x/(2Dt))→n0\frac{n_0}{2}\operatorname{erfc}\big(x/(2\sqrt{Dt})\big)\to n_02n0​​erfc(x/(2Dt​))→n0​ as t→0t\to0t→0 with t>0t>0t>0.

Nothing is asserted at x=0x=0x=0 in clauses 2–3; n0n_0n0​ has no sign condition.

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