Polygon: Symbolic Reasoning for SQL using Conflict-Driven Under-Approximation Search

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Zhao, Pinhan, Wang, Yuepeng, Wang, Xinyu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909572149542912
author Zhao, Pinhan
Wang, Yuepeng
Wang, Xinyu
author_facet Zhao, Pinhan
Wang, Yuepeng
Wang, Xinyu
contents We present a novel symbolic reasoning engine for SQL which can efficiently generate an input $I$ for $n$ queries $P_1, \cdots, P_n$, such that their outputs on $I$ satisfy a given property (expressed in SMT). This is useful in different contexts, such as disproving equivalence of two SQL queries and disambiguating a set of queries. Our first idea is to reason about an under-approximation of each $P_i$ -- that is, a subset of $P_i$'s input-output behaviors. While it makes our approach both semantics-aware and lightweight, this idea alone is incomplete (as a fixed under-approximation might miss some behaviors of interest). Therefore, our second idea is to perform search over an expressive family of under-approximations (which collectively cover all program behaviors of interest), thereby making our approach complete. We have implemented these ideas in a tool, Polygon, and evaluated it on over 30,000 benchmarks across two tasks (namely, SQL equivalence refutation and query disambiguation). Our evaluation results show that Polygon significantly outperforms all prior techniques.
format Preprint
id arxiv_https___arxiv_org_abs_2504_06542
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Polygon: Symbolic Reasoning for SQL using Conflict-Driven Under-Approximation Search
Zhao, Pinhan
Wang, Yuepeng
Wang, Xinyu
Programming Languages
Artificial Intelligence
Databases
Software Engineering
We present a novel symbolic reasoning engine for SQL which can efficiently generate an input $I$ for $n$ queries $P_1, \cdots, P_n$, such that their outputs on $I$ satisfy a given property (expressed in SMT). This is useful in different contexts, such as disproving equivalence of two SQL queries and disambiguating a set of queries. Our first idea is to reason about an under-approximation of each $P_i$ -- that is, a subset of $P_i$'s input-output behaviors. While it makes our approach both semantics-aware and lightweight, this idea alone is incomplete (as a fixed under-approximation might miss some behaviors of interest). Therefore, our second idea is to perform search over an expressive family of under-approximations (which collectively cover all program behaviors of interest), thereby making our approach complete. We have implemented these ideas in a tool, Polygon, and evaluated it on over 30,000 benchmarks across two tasks (namely, SQL equivalence refutation and query disambiguation). Our evaluation results show that Polygon significantly outperforms all prior techniques.
title Polygon: Symbolic Reasoning for SQL using Conflict-Driven Under-Approximation Search
topic Programming Languages
Artificial Intelligence
Databases
Software Engineering
url https://arxiv.org/abs/2504.06542