Skip to content
Formally proved formal proof researcher

A 1,200-line kernel that proves operations-research algorithms

Rainbow machine-checks OR algorithms against a tiny trusted dependent-type kernel: the full 222-algorithm catalogue is now proved.

Jiri Knesl · Internal reviewer: Flexiana Decision Lab · 12 August 2026
Read Limitations Formal methodsOperations research

Most software is trusted because it passed its tests. For a decision that moves real money, which projects to accept, how to allocate constrained capacity, when to intervene, tests sample the input space. They do not close it. A proof does.

Rainbow is a data-oriented theorem prover written in Clojure. Its trusted base is a dependent-type kernel of roughly 1,200 lines. Everything else, search, tactics, the algorithm catalogue, sits outside that boundary and must produce a proof term the kernel independently checks. A highly optimised, untrusted engine proposes; a small trusted checker disposes.

What is proved today

Rainbow’s proving curriculum is the operations-research catalogue from the book Applied Higher Order Functions and its companion library orhof. As of this note, all 222 catalogued algorithms have machine-checked proofs across the optimisation, decision-making and validation series. The prover checks signed rationals, finite vectors, Bellman and value-iteration steps, and gradient methods natively, and compiles truth tables into proof trees.

Why “proofs as data”

Rainbow treats terms, declarations, proofs, failures and provenance as immutable, content-addressed data. A proved reformulation becomes a reusable object, not a one-off transcript. That lets an expensive parametric proof be done once and a cheap certificate be checked per decision: the pattern that makes formal methods affordable in production rather than only in a paper.

What it is not

Rainbow has explicit, documented boundaries. It complements testing rather than replacing it, and it does not prove the properties listed under Limitations. We publish the covered set and the gap together, because the gap is the honest part of the result.

Rainbow is open source. The repository, examples and kernel are linked above.

Limitations & where this does not apply

The catalogue is complete at 222 of 222, but a complete catalogue is not a general guarantee. Rainbow still does not claim infinite-horizon or chaotic-relaxation asynchronous convergence, Bellman fixed-point uniqueness, terminating optimal-policy theorems, or a proved correspondence between the checked terms and their Clojure implementations. Those four remain unclaimed until separately proved. Numbers are reported with their stated scope.

Commercial relevance

Where a decision rule is business-critical: an allocation that must never violate a capacity, or an optimiser whose output is audited: a machine-checked proof is stronger evidence than tests. This is a hypothesis about value, not a field-tested claim, until a client engagement measures it.

Cite this

Jiri Knesl (2026). A 1,200-line kernel that proves operations-research algorithms. Flexiana Research. https://flexiana.com/research/rainbow-kernel-proves-or-algorithms

Start with the decision

Have a decision this research touches?

If a result here maps onto a choice your business makes repeatedly, the next step is a short, senior conversation — not a large commitment.