explaingit

lanyonai/advectiondiffusion

Analysis updated 2026-05-18

65CAudience · researcherComplexity · 5/5Setup · hard

TLDR

Nine formally verified C solvers for advection and diffusion equations, each proven correct with Lean 4 and generated automatically by a tool called Lanyon.

Mindmap

mindmap
  root((repo))
    What it does
      Advection solvers
      Diffusion solvers
      Formal proofs
    Tech stack
      C
      Lean 4
    Use cases
      Verified simulation
      Research reference
    Audience
      Researchers
      Numerical methods

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Study a worked example of formally verified numerical simulation code.

USE CASE 2

Compare machine generated C solvers against hand written ones for advection-diffusion problems.

USE CASE 3

Learn how Lean 4 proofs can back correctness claims for scientific computing code.

What is it built with?

CLean 4

How does it compare?

lanyonai/advectiondiffusionfreertos/freertos-smp-demosxiaojianbang8888/xiaojianbang-stealth-hook
Stars656868
LanguageCCC
Last pushed2025-02-16
MaintenanceStale
Setup difficultyhardmoderatehard
Complexity5/53/55/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

No build or usage instructions are given, understanding the code requires PDE and Lean background.

In plain English

This repository holds a set of solvers for advection and diffusion equations, which are mathematical equations used to describe how a quantity, like heat or a dissolved substance, spreads and moves through space over time. The project covers three versions of the problem: simple linear advection, advection combined with diffusion that behaves the same in every direction, and a fuller version where diffusion can behave differently depending on direction. Each version is solved in one, two, and three dimensions, giving nine solvers in total. What makes this project unusual is that every solver comes with a formal, machine checked proof of correctness. The proofs are written in Lean 4, a programming language built for verifying mathematical statements, and the repository reports close to 9,600 lines of that proof code alongside roughly 8,300 lines of the actual C code that runs the simulations. The README states there are 438 definitions and 282 theorems backing the correctness claims. All of this, both the C solvers and their Lean proofs, was generated by a tool called Lanyon in about 156 seconds total, with individual solvers taking anywhere from about 7 to 31 seconds each. The README includes the general mathematical form of the advection-diffusion equation and links to a separate technical writeup on the Lanyon website that covers the numerical methods and the prompts used to produce the code. It also includes screen captures and images showing example solutions, such as a one dimensional case on a periodic domain and a two dimensional case showing a shape being carried along by a rotating flow. This project will mainly interest people working in scientific computing, numerical methods, or formal verification who want to see machine generated, proven correct simulation code. It assumes familiarity with partial differential equations and is not aimed at general audiences. No license file or explicit usage instructions are mentioned in the README shown here.

Copy-paste prompts

Prompt 1
Explain what the advection-diffusion equation in this repo's README describes in plain terms.
Prompt 2
Walk me through how a formal Lean 4 proof could show a C solver like this one is correct.
Prompt 3
Summarize the difference between the linear advection, isotropic, and full advection-diffusion solvers in this repo.

Frequently asked questions

What is advectiondiffusion?

Nine formally verified C solvers for advection and diffusion equations, each proven correct with Lean 4 and generated automatically by a tool called Lanyon.

What language is advectiondiffusion written in?

Mainly C. The stack also includes C, Lean 4.

How hard is advectiondiffusion to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is advectiondiffusion for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.