What can a solver settle about reasoning?
An SMT solver decides statements in formal logic over values such as integers, real numbers and true-or-false. Given premises and a claim, it can settle three things exactly:
- The claim follows. There is no case that meets every premise and breaks the claim.
- The claim does not follow. There is such a case, and the solver returns it as a counterexample.
- The premises contradict each other. Then anything follows, which proves nothing.
It cannot settle whether a premise is true about the world, and it cannot judge reasoning that has not been written as formal logic. How a claim gets proven explains how Z3 is asked for a counterexample first.
Who does which part?
A check of a model's reasoning has three parts, and only one of them is a proof:
- A modelWrites the premises and the claim as formal logic, from the text.Not verified
- Z3Looks for a case that meets every premise and breaks the claim.Decided
- QWEDReturns the verdict, the evidence and a separate decision to act on it.Not admitted today
The first part is where most of the risk is. If the model writes a premise the text did not say, or drops one it did, Z3 proves the model's version exactly and the result says nothing about the original.
An example
Three short pieces of reasoning about a shipping rule, each written in QWED's logic DSL and decided by the Logic engine on qwed 13.0.0. Here total is an integer and free is true or false.
“Orders over 100 ship free. This order is 120, so it ships free.”
(IMPLIES (AND (IMPLIES (GT total 100) free) (EQ total 120)) free)VALID→VERIFIED · DENYThe claim follows: no case meets both premises and breaks it.
“Orders over 100 ship free. This order is 80, so it does not ship free.”
(IMPLIES (AND (IMPLIES (GT total 100) free) (EQ total 80)) (NOT free))INVALID→VERIFIED · DENYProven false. Counterexample: total = 80, free = True. The rule says nothing about orders of 100 or less.
“This order is over 100 and under 50, so it ships free.”
(IMPLIES (AND (GT total 100) (LT total 50)) free)VACUOUS→UNVERIFIABLE · DENYThe premises cannot both hold, so anything would follow from them, and nothing is proven.
The second one is a common slip, concluding the opposite of a rule for the cases it does not cover. Z3 finds the order of 80 that ships free anyway, and that case is the evidence. To run it yourself with the core package (pip install qwed; the package reads API_KEY_SECRET when it is imported, as the server does):
from qwed_new.core.dsl_logic_verifier import DSLLogicVerifierresult = DSLLogicVerifier().prove_from_dsl( "(AND (IMPLIES (GT total 100) free) (EQ total 80))", "(NOT free)", [{"name": "total", "type": "Int"}, {"name": "free", "type": "Bool"}],)print(result.status, result.model)# INVALID {'free': 'True', 'total': '80'}What does QWED return?
A verdict, and a separate decision on whether to act. VALID and INVALID both become VERIFIED: the engine decided the claim, and INVALID carries the counterexample as evidence. VACUOUS becomes UNVERIFIABLE, and a check that does not finish comes back BLOCKED.
The decision is DENY for all of them, today. A logic result covers the formal statement as written, and nothing yet checks that it means what a question asked, so the admission rules refuse it even when the claim follows (#585). Read a VERIFIED logic result as evidence about the reasoning, not as permission to act.
From a question
On the self-hosted API, /verify/logic takes a question in plain words. A model you configure writes the constraints and the claim, after the text is screened for known prompt-injection patterns, and Z3 decides them. The formal statement is part of the result, so a person can check that it says what was meant. Since qwed 11.0.0 the route proves a claim rather than reporting that some values fit (#631), and since 13.0.0 a claim about a term with no value, such as a division by zero, is never satisfied or proved.
One problem on this route is still open: some documents claim more for it than it delivers (#581). Known open issues
What does it not check?
- Whether the premises are true. A conclusion that follows from false premises still follows.
- Whether the translation is faithful. When a model writes the logic, QWED proves what the model wrote. That is why the result is not admitted.
- Reasoning outside the logic. Probabilities, judgement and claims about the world that are not stated as premises are out of reach.
- A different solver. Results come from the z3-solver version QWED pins. Which solver version
Everything QWED does not verify · What each engine may claim
Sources and further reading
- Z3 guide: introduction. Microsoft Research’s introduction to Z3 and the logic it decides.
- The Z3 Theorem Prover. Z3’s source code and releases.
- qwed-verification: dsl_logic_verifier.py. prove_from_dsl: the refutation Z3 is asked first, and when a claim is VALID, INVALID or VACUOUS.
Written and reviewed by the QWED maintainers under the project's governance model. Found an error? Contact us.
