Provensql Proves SQL Query Equivalence Instead of Guessing
Provensql is an open-source SQL equivalence checker using SMT proofs that never returns a false positive, unlike LLM-based query judges.
Provensql is an open-source tool built to answer a common code-review question: is this SQL refactor actually safe? It compares two queries and returns one of four honest verdicts — EQUIVALENT (proven), DIFFERENT (backed by a concrete counterexample row), SCHEMA_CHANGE, or UNKNOWN — refusing to guess when it can't be certain.
The tool is sound by construction: it never returns a false EQUIVALENT. Across 511 equivalence-breaking mutations, it produced zero false positives. It uses an SMT proof engine for the conjunctive fragment and falls back to counterexample search for everything else. As a baseline comparison, a gpt-5 LLM judge run over the same 213 labeled pairs incorrectly claimed EQUIVALENT on 2 pairs that actually differ — an error class Provensql's architecture structurally cannot produce.
Notably, it also catches rewrites that are valid over the reals but diverge under IEEE-754 floating point (due to reassociation) or change runtime-error behavior (e.g., a/b rewritten as SAFE_DIVIDE) — edge cases most other equivalence checkers silently treat as exact-real and accept. Provensql ships as a pip package, a GitHub Action for gating PRs, and an interactive demo, under an Apache-2.0 license.
This synthesis was produced from its source by AI; there is no human editor or manual review step. How we work