Skip to content

Z3 /api/verify rejects valid SMT-LIB queries: treats user input as proof obligation #10

Closed

Description

@hyperpolymath

Summary

POST /api/verify with a straightforward SMT-LIB satisfiability query returns valid:false even when Z3 would report sat directly. This blocks use of echidna as a general SMT-LIB dispatcher (e.g., as the backend for nesy-solver.dev).

Reproduce

With echidna running via echidna server --port 8090:

curl -X POST http://localhost:8090/api/verify \
  -H "Content-Type: application/json" \
  -d '{"prover":"Z3","content":"(declare-const x Int) (assert (> x 0)) (check-sat)"}'

Response: {"valid":false,"goals_remaining":1,"tactics_used":0}

Same query sent directly to Z3 (z3 -in) returns sat.

Root cause

src/rust/server.rs:279 (verify_handler) calls prover.verify_proof(&state), which for Z3 (src/rust/provers/z3.rs:300) does:

  1. Takes ProofState produced by parse_smt_file (goals + assertions)
  2. Asserts negation of each goal
  3. Runs (check-sat)
  4. Returns true iff unsat (goal is provable)

So echidna treats the submitted SMT-LIB as proof obligations to discharge, not as a query to evaluate. The distinction is invisible in the endpoint name and documentation.

Expected behaviour (one of)

Option A — semantic fix: split the endpoints:

  • /api/verify keeps proof-obligation semantics (negate goals, check unsat)
  • /api/eval (new) runs the SMT-LIB verbatim and returns {sat|unsat|unknown, model?}

Option B — documentation fix: make the proof-obligation semantics explicit in the API docs and the VerifyResponse type. Downstream clients will wrap their SMT accordingly.

Option C — prover-aware routing: when prover=Z3 (or CVC5), detect whether input contains a (check-sat) and route to passthrough evaluation rather than obligation-negation.

Impact

The nesy-solver.dev playground (Phase E3 deploy) forwards user-submitted SMT-LIB to /api/verify expecting evaluation semantics. All Z3 submissions return valid:false regardless of satisfiability. The pipeline is technically working (requests land, attempts record in verisimdb), but the verdict column is meaningless for non-obligation input.

Environment

  • echidna 2.1.0 (commit 3695e03)
  • Z3 4.13.4 (from official GitHub release)
  • Deployed via .containerization/Containerfile.full on fly.io

Activity

  1. hyperpolymath commented on Apr 7, 2026

    @hyperpolymath
    OwnerAuthor

    Fixed in fbad8e6. now detects SMT query payloads for Z3/CVC5 (presence of ) and routes them through raw solver evaluation instead of proof-obligation negation semantics. Response now includes and () when that path is used.

  2. hyperpolymath commented on Apr 7, 2026

    @hyperpolymath
    OwnerAuthor

    Resolution details (clean copy):

    • Fixed in commit fbad8e6.
    • /api/verify now detects SMT query payloads for Z3/CVC5 when input contains (check-sat).
    • Those requests are routed through raw solver evaluation (instead of proof-obligation negation semantics).
    • Response now includes:
      • mode: "smt-query"
      • smt_status: "sat" | "unsat" | "unknown" (when available)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions