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