---
title: "How a claim gets proven"
description: "What a proof engine does with a claim: Z3 looks for a value that breaks it, SymPy works the figure out again, SQLGlot reads the query. And what is not proven."
url: https://qwedai.tech/guides/how-a-claim-gets-proven
---

[Guides](https://qwedai.tech/guides)

# How a claim gets proven

A model says a rule follows, a total is right, a query is safe. This guide shows what a proof engine does with such a claim, using the checks qwed-verification 12.0.0 runs, and where proving stops.

QWED project · Published 29 November 2026 · Updated 29 November 2026

## The short answer

A claim is proven when an engine decides it for every case its premise allows, not for a few samples. QWED's Logic engine asks Z3 whether any value meets the premise and breaks the claim: if one does, that value is the counterexample and the claim is false; if none does and the premise can hold, the claim follows. A premise that cannot hold proves nothing. SymPy works a figure out again, and SQLGlot reads a query's syntax tree. A decided claim comes back VERIFIED with a proof\_ref, a hash of its evidence, whether it turned out true or false; whether to act on it is a separate decision.

## What does proven mean?

That a claim holds for every value its premise allows, not only for the values someone tried. Trying x = 12 makes the first two claims below look true. Z3 asks a different question: is there any x that meets the premise and breaks the claim?

-   Meets the premise, and the claim holds
-   Meets the premise, and the claim fails: a counterexample
-   Does not meet the premise

1.  `x>5 => x>3`

    Is there an x above 5 that is not above 3?

    No. Every integer above 5 is above 3, so the claim follows.

    Proven to hold `VERIFIED · DENY` `status=VALID`

2.  `x>5 => x>10`

    Is there an x above 5 that is not above 10?

    Yes: 6, 7, 8, 9 and 10. Z3 returns one of them, here 6, as the counterexample.

    Proven false `VERIFIED · DENY` `status=INVALID, counterexample x=6`

3.  `x>5 AND x<3`

    Is there an x above 5 and below 3?

    No x meets both. Constraints that contradict each other prove nothing.

    Could not be proven `UNVERIFIABLE · DENY` `status=UNVERIFIABLE`

Each row is a line of `qwed test` in qwed-verification 12.0.0. Under each label: the status and admission the code returns, then the detail `qwed test -v` prints. No logic verdict is admitted yet, so all three are denied ([What comes back?](#result)). x is an integer. Z3 decides for every integer, not only the fifteen drawn, and for the second line it may return any value from 6 to 10.

## How does Z3 decide a claim?

The Logic engine writes the premise and the claim in QWED's logic DSL and hands them to Z3, a solver from Microsoft Research. It does not ask Z3 whether the claim is true. It asks for a value that meets the premise and breaks the claim. For the second line above, that question is:

```
(AND (GT x 5) (NOT (GT x 10)))
```

Z3 answers for all integers at once; it does not try them one by one. When both of its checks finish, there are three outcomes:

-   **Z3 finds such a value.** The claim is `INVALID`, and the value is the counterexample. The claim is proven false.
-   **There is none, and the premise can hold.** The claim is `VALID`: it follows for every value the premise allows.
-   **There is none, because the premise cannot hold.** The result is `VACUOUS`. Anything follows from a contradiction, so nothing is proven.

Z3 checks for a counterexample first. A counterexample meets the premise, so if one exists, the premise can hold, and only a claim with none needs the premise checked. If a check does not finish, because Z3 cannot decide or a step fails, there is no proof either way, and the result comes back `BLOCKED · DENY`.

## What comes back?

A status, and a separate decision on whether to act. `VALID` and `INVALID` both become `VERIFIED`: the engine decided the claim. `INVALID` is marked false, with the counterexample as its evidence, and is denied. `VACUOUS` becomes `UNVERIFIABLE · DENY`. `VERIFIED` means decided, not true, just as `2+2=5` comes back `VERIFIED · DENY` from the Math engine.

A logic result is not admitted yet, even when the claim follows, so today a `VALID` one is `VERIFIED · DENY` as well. `qwed test` 12.0.0 prints `ADMIT` beside `x>5 => x>3`, but that word is a label in the command; the admission rules in the code refuse the result. Its verdict covers the constraints as written, and nothing yet checks that they mean what a question asked. On `/verify/logic` a model writes them from the question, so QWED proves the model's translation, not the question ([#585](https://github.com/QWED-AI/qwed-verification/issues/585)). Every logic result records that the question's meaning was not verified, and the admission rules refuse such a result. [How a result reads](https://qwedai.tech/guides/runtime-verification)

## How does SymPy check a figure?

The Math engine parses the expression with SymPy and works it out again. Whole numbers and fractions stay exact: `997*998*999` comes out as `994010994`, as the third line of `qwed test` shows. An identity such as `(x+1)**2 = x**2 + 2*x + 1` holds when the difference of its two sides simplifies to zero, which covers every x at once. [How to check AI calculations](https://qwedai.tech/guides/llm-math)

The figure a model claims is then compared with that value. Unless you pass a tolerance, a claim must match to 9 significant digits, and is never accepted more than 0.000001 away. Below 0.001 the bound is fixed instead: within 0.000000000001 of the value. A claim with six or more significant digits may also be the value rounded at its last digit, so `0.333333` matches 1/3. The result records which it was, in its `match` field: `exact`, `default_bound`, `rounded_claim`, or `caller_tolerance` when you passed one.

## How does SQLGlot check a query?

The SQL engine parses the query with SQLGlot, in the query's own dialect, into a syntax tree. The checks run on that tree, not on the text. A condition that is always true, such as `OR 1=1`, folds to a constant. A second statement after a semicolon shows up as a second tree. Both come back proven unsafe and denied: `VERIFIED · DENY`.

MySQL runs the SQL inside its executable comments (`/*! ... */`), so those are expanded before parsing and their contents are checked too. Where SQLGlot and the database could split the same text into tokens differently, no analysis of the tree describes what would run. MySQL reads `--1 OR 1=1` as code, for example, and SQLGlot reads it as a comment. Such a query comes back `BLOCKED · DENY`. [AI-generated SQL](https://qwedai.tech/guides/ai-sql)

## What is a proof\_ref?

A SHA-256 hash of the evidence behind a `VERIFIED` result, written `sha256:` and 64 hex digits. For a logic result, the evidence is the statement decided and the counterexample, if there is one. It is written as JSON with its keys sorted before it is hashed, so the same evidence always gives the same hash, and changed evidence gives a different one.

QWED cannot build a `VERIFIED` result without a `proof_ref`. A result with no proof is `UNVERIFIABLE` and carries none. [What each decision record holds](https://qwedai.tech/guides/ai-audit-trail)

## What is not proven?

-   **The meaning of a question.** When a model turns text into constraints or an expression, the engine decides what the model wrote. Nothing yet checks that it means what was asked, so such a result is not admitted.
-   **What a search did not find.** Symbolic looks for counterexamples in code and returns `UNVERIFIABLE` or `BLOCKED`, never `VERIFIED`. Not finding a counterexample is not a proof.
-   **Signals.** The advisory engines (Fact, Graph, Image, Reasoning, Consensus) add signals for review. Graph and Image can return `VERIFIED` only on a deterministic sub-path, with a `proof_ref`, and Consensus never does.
-   **The engines themselves.** A proof is only as sound as SymPy, Z3, SQLGlot and QWED's own rules. Past soundness bugs are published as advisories, and each one in which an engine returned `VERIFIED` for a false claim is reproduced in an eval that runs at every release. [Evidence](https://qwedai.tech/evidence)
-   **Claims outside the engines.** They come back `UNVERIFIABLE`.

[Everything QWED does not verify](https://qwedai.tech/limits)

## Sources and further reading

-   [Z3 guide: introduction](https://microsoft.github.io/z3guide/docs/logic/intro/). Microsoft Research’s introduction to Z3, the SMT solver behind the Logic engine, and the logic it decides.
-   [SymPy tutorial: gotchas, equals signs](https://docs.sympy.org/latest/tutorials/intro-tutorial/gotchas.html). Why two expressions are compared by simplifying their difference to zero.
-   [SQLGlot documentation](https://sqlglot.com/sqlglot.html). The SQL parser the SQL engine uses: it reads a query, in its dialect, into a syntax tree.
-   [qwed-verification 12.0.0: cli\_logic\_proof.py](https://github.com/QWED-AI/qwed-verification/blob/v12.0.0/qwed_sdk/cli_logic_proof.py). The two logic proofs qwed test runs, and the counterexamples it accepts.
-   [qwed-verification 12.0.0: dsl\_logic\_verifier.py](https://github.com/QWED-AI/qwed-verification/blob/v12.0.0/src/qwed_new/core/dsl_logic_verifier.py). prove\_from\_dsl: the refutation Z3 is asked first, and when a claim is VALID, INVALID or VACUOUS.
-   [qwed-verification 12.0.0 README](https://github.com/QWED-AI/qwed-verification/blob/v12.0.0/README.md). What qwed test prints, how a result reads, the engines and what QWED does not do.

Written and reviewed by the QWED maintainers under the project's [governance model](https://qwedai.tech/governance). Found an error? [Contact us](https://qwedai.tech/contact).

## More guides

-   [### Runtime verification for AI output Checking each output before it is used Read](https://qwedai.tech/guides/runtime-verification)
-   [### How to verify LLM output What each kind of check catches Read](https://qwedai.tech/guides/verify-llm-output)
-   [### What fail-closed means For AI checks, and when fail-open is fine Read](https://qwedai.tech/guides/fail-closed)
-   [### Deterministic guardrails Rules, parsers and solvers for agents Read](https://qwedai.tech/guides/deterministic-guardrails)
-   [### Can LLMs do maths? How to check AI calculations Read](https://qwedai.tech/guides/llm-math)
-   [### Checking reasoning with Z3 What a solver can settle, and what it cannot Read](https://qwedai.tech/guides/llm-reasoning-z3)
-   [### JSON Schema for LLM output Checking shape and values Read](https://qwedai.tech/guides/llm-json-schema)
-   [### LLM-generated SQL Guardrails that check a query before it runs Read](https://qwedai.tech/guides/ai-sql)
-   [### AI-generated code Is it safe to run, and what a check shows first Read](https://qwedai.tech/guides/ai-code)
-   [### Agent tool calls and MCP Three checks before a tool call runs Read](https://qwedai.tech/guides/agent-tool-calls)
-   [### Financial figures Stopping a wrong figure from being used Read](https://qwedai.tech/guides/llm-finance)
-   [### Audit trails What each decision record holds Read](https://qwedai.tech/guides/ai-audit-trail)
