π LeanFlow: Neuro-Symbolic Dual-Scale NavierβStokes PDE Solver
Version R3 β Peer-reviewed benchmark corrections applied (August 2026).
Scientific paper: report/leanflow_scientific_report_R3.pdf | Audit certificate: certificate.json
LeanFlow is an open-source, mathematically verified, high-performance fluid dynamics PDE solver featuring:
- Formally Verified Mathematics (Lean 4): Machine-verified Leray divergence-free projection ($\mathcal{P}^2 = \mathcal{P}$), triadic energy antisymmetry, and strict enstrophy bounds via the biharmonic regularization term $\alpha'|k|^4$. All Tier A proofs are non-vacuous (H21): each proof uses concrete Mathlib lemmas β not hypothesis re-application.
- AI-Driven Preprocessing & SymBrain Routing: Automated Kolmogorov dissipation scale resolution ($k_{\max}\eta \ge 1.5$), boundary condition projection, and stiffness-adaptive preconditioners (P0βP3).
- High-Performance Rust Core: Native SIMD vectorization and zero-copy C-ABI integration with
rusty-SUNDIALS(CVODE BDF 1β5 & Adams-Moulton 1β12) vialibleanflow_solver.so. - Empirically Validated on JHTDB: 7 orders of magnitude better divergence preservation and 2.10Γ wall-clock speedup over OpenFOAM on 5 independent $64\times64$ DNS snapshots.
π Benchmark Results β JHTDB Real DNS Data ($Re_\lambda \approx 433$, R3 Corrected)
Grid: 64Γ64 | Snapshots: 5 independent temporal snapshots ($t \in {1,2,3,4,5}$)
Methodology: 2D planar cutout from JHTDB 3D field, Leray-projected to enforce 2D solenoidality at $t=0$.
| Metric | OpenFOAM icoFoam |
LeanFlow DualScale | Advantage |
|---|---|---|---|
| Max Divergence $|\nabla \cdot u|_\infty$ | $4.10 \times 10^{-7}$ | $2.99 \times 10^{-14}$ | 7 orders of magnitude |
| Wall-Clock Time (mean Β± std) | $1.833 \pm 0.021$ s | $0.874 \pm 0.008$ s | 2.10Γ faster |
| Pressure Iterations | ~40 PCG sweeps/step | 0 (algebraic exact) | Zero iterations |
| UV Enstrophy Regularization | None (blowup risk) | Guaranteed via $\alpha'|k|^4$ | Formally proven |
Why 64Γ64 and not 32Γ32? At sub-64Β² grids, OpenFOAM's startup I/O overhead (dictionary parsing, C++ object initialisation) dominates execution time β giving a misleading comparison of disk I/O, not PDE solver kernels. Results at 64Γ64 compare steady-state PISO loop vs. FFT-Leray.
π Dual-Scale Evolution Equation
The LeanFlow governing equation in Fourier space is:
The term $\alpha'|k|^4$ is the dual-scale ultraviolet regularization β absent in standard spectral Navier-Stokes β that mathematically bounds enstrophy and is the central innovation of the solver.
π Lean 4 Audit (R3)
| Module | Status | Key Theorem |
|---|---|---|
Leray.lean |
β Tier A (0 sorry) | leray_idempotent via field_simp + ring on EuclideanSpace β (Fin d) |
Galerkin.lean |
β Tier A (0 sorry) | inviscid_energy_conservation via Finset.sum_comm pairing cancellation |
DualScale.lean |
β Tier A (0 sorry) | T-duality invariants |
FrustrationMonotonicity.lean |
β οΈ Tier C (4 sorry β H19 stub) | frustration_index_ge_one (Tier A β
); monotonicity conjecture open |
π Quickstart
from pipeline import LeanFlowPipeline
import numpy as np
pipe = LeanFlowPipeline.from_pretrained(".")
x = np.linspace(0, 2 * np.pi, 64, endpoint=False)
X, Y = np.meshgrid(x, x, indexing="ij")
u_init = np.array([np.sin(X) * np.cos(Y), -np.cos(X) * np.sin(Y)])
result = pipe(u_init, n_steps=200, nu=1e-3, cfl=0.4)
print(f"Final Divergence Residual : {result['final_divergence']:.2e}")
print(f"Wall Time : {result['wall_time_sec']:.4f} s")
π Citation
@article{callens2026leanflow,
title = {LeanFlow: A Formally Verified Dual-Scale Pseudo-Spectral Navier-Stokes Solver},
author = {Callens, Xavier and SocrateAI Research},
journal = {arXiv preprint},
year = {2026},
note = {Revision 3. \url{https://huggingface.co/callensxavier/leanflow-dualscale-pde}}
}
Audit Certificate: CERT-HF-MODEL-R3-2026-08-31
- Downloads last month
- -
Dataset used to train callensxavier/leanflow-dualscale-pde
Evaluation results
- Maximum Divergence Residual on JHTDB Forced Homogeneous Isotropic Turbulence (Re_lambda ~ 433)self-reported0.000
- Wall-Clock Speedup vs OpenFOAM icoFoam (C++ native) on JHTDB Forced Homogeneous Isotropic Turbulence (Re_lambda ~ 433)self-reported2.100