•
2 min read
rules_lean4

At Positivesum we write models of our software in Lean and prove them correct. The models generate golden tests - contracts that our implementations in other languages have to pass.

Lean sits in the middle of our build, beside everything else, so we wanted Bazel to build it. rules_lean4 is the ruleset we wrote for that. Every Lean file is its own build target, the Lean release is a hermetic toolchain, and Mathlib arrives prebuilt from its own cache, so none of it is ever compiled.

bazel build //proofs/...                 # type-check every module
bazel test //proofs/...                  # and replay each through the kernel
bazel build //proofs/Foo/Order:Lattice   # one module and what it imports
bazel run //proofs:main                  # an executable, compiled and linked

It’s in the Bazel Central Registry as positivesum_rules_lean4, and the README covers the rest.