← All articles

Inside Verus's Three-Mode Pipeline (spec, proof, exec)

Verus checks spec, proof and exec code in three modes, then erases the ghost logic before the binary is compiled.

How does Verus verify low-level systems code—raw pointers, interior mutability, and concurrency—with zero runtime cost?

It partitions every function and variable into three strict modes:

  • spec mode (spec fn, Ghost<T>): Pure, deterministic math (requires / ensures). Checked for termination, erased before codegen.
  • proof mode (proof fn, Tracked<T>): Ghost code checked by Rust's borrow checker for linearity and ownership.
  • exec mode (fn): Ordinary executable Rust.

Once type checking, borrow checking, and SMT verification pass, Verus strips away every spec and proof artifact. Your compiled binary ships with zero verification checks attached.

Two-phase pipeline diagram: spec, proof and exec code go through verification, then spec and proof are erased and only exec code is compiled

Clean mental model. Zero runtime tax.

#RustLang #Verus #SystemsEngineering #FormalVerification