Formal Verification
Four parts of NSR carry machine-checked proofs in Lean 4: the verified-decision outcome gate, the rule engine, the target-binding token matcher, and the lifting lemma that carries the engine results from a ground model to the first-order engine that actually ships. 58 theorems and supporting lemmas across four modules. Zerosorry. Every proof but one is
constructive.
sorryAx, and fails
if any of the three exported conformance corpora has drifted from the model.
The proofs are not the interesting claim on their own — the differential conformance
harnesses are. They are what makes these theorems
statements about production rather than about a model.
What is proved
The outcome gate
Machine-checked properties of the decision logic:The rule engine
Budget soundness and fail-closed negation are the two that matter most operationally. Together they
mean an overloaded engine degrades into refusing, not into approving — the failure mode you
want when the alternative is an unauthorised action.
The token matcher
text_mentions_target decides whether a rule’s conclusion actually refers to the thing the request
is about. It is the primitive underneath the gate’s binding heuristics, so a fragment match here
would be an authorization bug.
The last one is the security property. Combined with mismatched effect is inert on the gate, it
means a rule that fired about a different order contributes no signal of any polarity — it cannot
approve, and it cannot deny either.
The lifting lemma
The engine properties above were originally proved about a ground model — variable-free rules. The shipped engine runs with variables, unification, and substitutions. The lifting lemma closes that distance.Trust base
The verify script prints the axiom dependencies of every result, so this table is reproducible rather
than asserted.
What ties the proofs to the shipped code
A proof about a model is decoration if nobody checks the model against the code. Three differential harnesses replay the Lean models through the real Rust functions and assert agreement on every row:
For the axes those corpora cover the models are not idealisations — they are exact descriptions of
the shipped functions, and the theorems transfer to production directly.
The verify script regenerates all three corpora and fails if any differs from the committed
copy — so the model and the tests cannot silently drift apart. CI runs the script and all three
harnesses on every push.
What the proofs do not cover
Two of the original gaps have since been closed and one narrowed. The rest are real, and none is hidden inside a theorem statement.Closed: the engine model is no longer ground — the lifting lemma covers variables, matching, and
substitution. Narrowed: the gate’s binding heuristics are no longer opaque booleans — the
primitive underneath them is now characterised exactly.
How to state this accurately
The precise claim, which is strong enough without overreach:
NSR’s decision gate, rule engine, token matcher, and the lifting lemma connecting them are
machine-checked in Lean 4 with zero sorry. Three differential conformance harnesses bind
those models to the shipped Rust — the gate across its entire decision table, the token matcher
exhaustively over a saturating alphabet, and first-order forward chaining across 150 generated
scenarios. The engine’s soundness properties, including multi-tenant isolation and fail-closed
degradation under budget exhaustion, hold for the engine that actually runs, not only for a
simplified model of it.
Why this is unusual
Most AI platforms offer benchmark scores. A smaller number offer audit logs. Machine-checked proofs that an approval cannot occur without grounding — and that an overloaded engine refuses rather than approves — is a different category of claim, because it holds for inputs nobody tested. Paired with the 1,260-case soundness corpus, the picture is: proofs for the properties that can be stated formally, adversarial testing for the rest.Related
- Verified Decisions API — the endpoint these proofs are about
- Policy Engine & Decision Gate — how the gate is used
- Neuro-Symbolic Architecture