Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

We Built a Tokio-Style Scheduler in a Theorem Prover (And It Beat Node.js)

Описание и применение

LeanIn – многопоточный планировщик, реализованный в Lean 4, превосходит Node.js по производительности и обеспечивает формальную верификацию корректности работы.

Задача

Concurrency bugs in backend systems are hard to detect and can cause catastrophic failures under specific load spikes.

Результат

LeanIn achieves higher throughput and lower P99 latency than Node.js while providing formal verification of scheduler correctness.

Рабочий процесс

  • 1. Identify concurrency challenges in backend workloads.
  • 2. Choose Lean 4 for its type‑system and native compilation.
  • 3. Encode scheduler state transitions in Lean’s type system to enable formal verification.
  • 4. Implement a multi‑threaded work‑stealing algorithm inspired by Rust’s Tokio.
  • 5. Apply Functional But In‑Place (FBIP) to enable destructive updates with reference counting.
  • 6. Compile Lean 4 code to native C and then to a binary.
  • 7. Benchmark LeanIn against Node.js across standard workloads.
  • 8. Publish the open‑source repository and benchmark results.

Доказательства

Our LeanIn server actually outpaces Node.js across almost all standard performance benchmarks.

Источник

Lean’s type system allows us to encode the actual state transitions of our scheduler. This means we can formally verify that tasks are never dropped, queues never deadlock, and memory is handled correctly.

Источник

Lean 4 doesn’t run on a virtual machine. It compiles down to highly optimised C code, which is then compiled to a native binary.

Источник

  • Дата записи: 2026-10-20T15:41:31.769Z