Skip to main content
The Logic Engine uses Z3, a Satisfiability Modulo Theories (SMT) solver from Microsoft Research, to verify logical constraints.
The legacy VerificationEngine.verify_logic_rule() method has been removed as of v5.1.0. It now raises NotImplementedError. Use LogicVerifier from qwed_new.core.logic_verifier or the SDK’s client.verify_logic() method instead. See the changelog for migration details.

Capabilities


Quick start


QWED-Logic DSL

QWED uses a secure S-expression DSL for logic expressions.

Operators

Comparison and arithmetic operators accept multiple aliases for convenience. For example, GTE and GE both mean “greater than or equal to”, NEQ and NE both mean “not equal”, and MUL and MULT both mean multiplication.

Examples


Satisfiability checking

Basic check

Finding all solutions


Business rules

Age verification

Discount eligibility

Approval workflow


Quantifiers

Universal (FORALL)

Existential (EXISTS)


Security: operator whitelist

The DSL uses a strict whitelist — only approved operators are allowed:

Fail-closed constraint parsing

The logic engine uses SafeEvaluator for all constraint parsing. If SafeEvaluator is unavailable, the engine raises a RuntimeError instead of falling back to raw evaluation. This fail-closed design ensures that untrusted input is never passed to Python’s eval().

Provider tracking

When you verify a natural-language logic query, QWED translates it to DSL using the configured LLM provider. The response includes a provider_used field so you can see which provider handled the translation — even when the request falls back to a different provider or ends in an error.
This field also appears in error responses, which helps you debug provider-related issues without inspecting server logs.

Error handling


Performance


Next steps