LexQLexQ
Back to blog

Why Business Decisions Need Formal Verification

Tests and simulation answer what happened on inputs you already have, but not what happens on inputs nobody has sent yet. Unreachable rules, conflicts nobody noticed, and uncovered gaps belong to the ruleset itself rather than to any one input, so ruling them out takes a proof over every input.

Sanghyun Park·August 7, 2026Updated November 19, 202611 min read

A pricing ruleset grows to forty rules one request at a time: a promo for new accounts, a loyalty tier bonus, a carve-out for the one enterprise account whose contract predates the current pricing model. Every rule was reviewed and tested, and the ruleset has run in production for a year without an incident.

Then a support ticket arrives. A customer on the STANDARD tier with a small cart got no discount at all, and nobody can say whether that was intended. Someone reads all forty rules in order and comes back with the answer: nothing covers that combination. Each rule was correct on its own, but there was a hole between them.

No test failed, because no test covered that case. No alert fired, because nothing errored. The system followed its rules exactly, but no rule covered that case.

Testing and simulation cannot rule out defects like this, because both look only at inputs you already have. Finding them takes an answer to a different question: what could happen on any input.

What a passing test doesn't prove

A test is an example. It picks one point in the input space and asserts the output there. A hundred tests are a hundred points.

A ruleset's input space is far larger than that. Four facts (a tier, a cart total over the non-negative reals, a country code, an account age in days) already put the combinations past enumeration. A suite samples them where the author was thinking, because the same person wrote the rule and the test in the same hour with the same mental model.

That blind spot exists in ordinary code too, but rulesets make it worse because they grow by accumulation. Rule 37 is written months after rule 6, by a different person under a different deadline. It is reviewed against its own intent rather than against the other thirty-nine rules, because checking every combination is work humans do badly. Every new rule can interact with every rule already there, and reviewers do not get more time as the ruleset grows.

Three defects no error message reports

Unreachable rules. A rule that can never fire. In LexQ, priority is an automatic 1..N ordering inside a version, and a mutex group in Single mode (mutexMode: EXCLUSIVE) lets only one member win. Put a catch-all in that group at priority 6, and every member below it, at priorities 7 through 12, is dead code. Those members still show up in the console and still get edited by someone who believes they run. Unreachability also comes from the fact domain itself: a condition requiring tier = 'GOLD' and tier = 'SILVER' at once is unsatisfiable whatever the traffic looks like.

Conflicts. Two rules whose conditions can be true at once and whose actions disagree. Two SET_FACT actions writing the same fact. A discount rule and a BLOCK that both match. Sometimes this is deliberate and a mutex group resolves it. Sometimes nobody noticed the overlap, and the outcome comes down to the two rules' priority order, which usually reflects nothing more than the order in which two unrelated tickets were filed.

Gaps. A region of the input space that no rule covers. In the opening, the STANDARD customer with a small cart fell into one. A gap produces no error and no log line. The decision comes back with nothing applied, indistinguishable from a decision where nothing was supposed to apply.

All three are properties of the ruleset itself, and they exist whether or not a single request has ever landed in them.

What simulation answers, and what it doesn't

Replaying real traffic is the strongest tool most teams have. LexQ's Impact Simulation runs a new rule version against historical execution records and reports what changed against the version it is compared with: match rates and metric deltas, plus, for each rule in the new version that decided at least one record, how many it decided. Decision Replay takes stored production decisions, one or up to 50,000 from a date range, and decides them again on a candidate version. Old and new outcomes come back side by side. Every successful decision carries a trace of which rule fired, on what inputs, at what version, and that trace lands in an immutable audit trail. Two earlier posts cover why seeing the impact of a rule change before it ships is the job that made me build this and what it takes to prove after the fact which rule produced a given outcome.

All three cover only inputs that exist: Simulation and Decision Replay work from traffic you already received, and an audit trail explains a decision that already happened.

The gap from the opening scene can stay invisible to all of it. If no STANDARD customer with a small cart checked out during the simulated period, the simulation has no record for that region, and the result looks exactly like one where nothing went wrong. The unreachable rule is worse: it never appears in the simulation's per-rule statistics, and neither does a correct rule covering a segment the sample happened to miss.

Impact Simulation, Decision Replay, per-rule latency profiling, versioned rules with instant rollback, decision traces, an immutable audit trail: all of that exists and runs in production right now. Formal verification of a ruleset does not exist in LexQ, and what follows is a problem definition and a design direction.

What formal verification does differently

Formal verification describes the whole input space instead of sampling it.

A rule condition is already a logical formula. tier = 'GOLD' AND cartTotal > 5000 is a conjunction of two constraints, one over a string domain and one over a numeric one. A ruleset is a set of those formulas plus the semantics deciding which wins: priority ordering, mutex groups, the catch-all whose empty condition matches everything.

Once conditions are formulas rather than code paths, the three defects turn into satisfiability questions, and satisfiability is a problem the research community has spent forty years making tractable. An SMT solver such as Z3 takes a first-order formula and tries to find an assignment that satisfies it or to prove that none exists. It can also return unknown when a formula falls outside what it can decide, and nonlinear integer arithmetic, such as two facts multiplied together, is one such case.

  • Unreachable rule. Ask whether the rule's condition, conjoined with the negation of every higher-priority condition that would preempt it, is satisfiable. UNSAT means it can never fire under any input whatsoever.
  • Conflict. Ask whether two rules with contradicting actions and no mutex separation can both be satisfied at once. If SAT, the solver hands back an input that triggers both.
  • Gap. Ask whether the negation of the disjunction of every condition is satisfiable. If SAT, there is an uncovered region, and the solver names a point inside it.

A green suite says the cases someone checked worked. On a conflict or gap query, UNSAT says no failing case exists anywhere in the input space, including inputs that will not arrive for another three years.

The name I am claiming for this is LexQ Verify, and the output I have in mind would look roughly like this sketch:

✅ No unreachable rules
⚠️  2 potential conflicts:
   "vip-discount" ∧ "loyalty-bonus"
   → Resolved by mutex group "promo-exclusive"
❌ 1 gap:
   tier=STANDARD, cartTotal < 5000 is uncovered

Nothing behind that sketch is implemented. I am putting the name and the shape in public anyway, because the industry has no accepted phrase for "this ruleset is provably free of unreachable rules," and a team cannot ask a vendor for something that has no name.

Why proving business rules is hard

Engineers with SMT experience are rare. The skill sits in compilers and verification research, and barely overlaps with the population building rule engines.

The compiler from a rule condition DSL down to SMT formulas is research-grade design work. Facts are typed and mixed: strings over finite domains, unbounded numerics, booleans, arrays for membership tests. Modeling those faithfully is the smaller part of the work. The larger part is modeling what a ruleset means beyond its conditions: priority ordering and mutex resolution decide which matching rule wins, and MUTATE_FACT actions pass values from one winning rule to the next, so the result depends on the order the actions apply in.

Some commercial engines already check rules without running them. IBM ODM analyzes a whole ruleset for conflicting, redundant, and never-applicable rules and for cases no rule covers. Corticon, Pega, Oracle, SAP, and TIBCO check one rule sheet or decision table at a time, and OpenRules turns decision tables into a constraint problem for a solver to validate. Even open-source Drools, one of the engines in a comparison of what self-hosted and managed engines actually give you operationally, statically checks DMN decision tables for gaps and overlaps. None of their documentation claims a proof, and IBM says so outright: an empty consistency checking report is "not a guarantee that there are no problems in the analyzed rules." The list covers only the engines reviewed.

Amazon's Cedar did this first, and did it well. It has formal verification productized for authorization, built on Lean and automated reasoning, shipped and documented. On the technique itself LexQ is a follower.

Among the engines reviewed, none claims a proof over the rules that make business decisions. AWS does apply the same kind of reasoning to written business policy, in Bedrock's Automated Reasoning checks, and it flags rules in that policy that contradict each other. But the policy there is used to check an LLM's answers, and it never makes the decision itself. Cedar verifies who can access what. LexQ verifies what decision will be made.

The two sentences name two different problems. When I wrote that a Decision Operations Platform is not authorization, the distinction was about scope. Formalization is where it turns technical. An authorization decision is largely boolean over an entity graph: principal, action, resource, allow or deny. A business decision produces values: a discount amount, a mutated running total, a blocked transfer, a proration over mixed arithmetic. "Can this principal read this document" and "Is there a cart that triggers two contradictory discounts" are different formulas over different theories. On the technique, Cedar gives a head start to anyone who follows, and on business decisions the engines reviewed stop at checks. A closer look at what Cedar proves and why decision rules are the harder target compares the two in more detail.

When you don't need this, and when you don't need LexQ

Formal verification of a ruleset is not free, and in these three cases it is not worth the cost.

Your ruleset is small and stable. Five rules unchanged in two years fit in one person's head. Read them.

Your rules are disjoint by construction. If the ruleset is a lookup keyed on one field with one row per value, conflicts and unreachable rules are ruled out by the table's shape, and any gap shows up as a missing row, so there is nothing to prove.

A wrong decision is cheap. If the worst outcome of a gap is a customer paying full price and emailing support, the cost is bounded.

Formal verification can also wait, and LexQ itself is not always needed either. If your rules are still if-else branches inside a service and changing one means a pull request and a deploy, getting the decision out of the release cycle comes before unreachable rules. And if the decisions rarely change at all, you don't need a Decision Operations Platform either: leave the logic in the if-else block.

Today, LexQ, a Decision Operations Platform for engineering teams, answers "what will this rule change do" with Impact Simulation against real traffic, an answer about the inputs you have. What a ruleset does across every input it could ever receive is a different question with a known mathematical shape, and LexQ Verify is the name for the work of answering it.

→ See what runs today. Start free at lexq.io

Move one rule out of your code.

Free to start, no credit card. Send facts, get back a result and the reasoning.

Start Free