Two Structural Axes of SQL Bag Equivalence: Graph Dichotomies, Guarded Counting, and Ordered Two-Variable Counting Ideals

SQL bag equivalence asks whether two queries return each row with the same multiplicity on every legal finite database. We separate the support of a database from the positive multiplicities of its stored tuples. After this separation, equivalence reduces to a finite family of equalities between counts of satisfying assignments. On the data axis, for a fixed minor-closed class of support graphs, the resulting decidability thresholds are bounded treewidth with equality, bounded matching number with a free linear order, and bounded vertex count with Presburger comparisons. Each decidable case has a computable bound on counterexample rows per table. One outermost bag difference or bag intersection separates freely repeatable inputs from key-controlled inputs. On the query axis, we prove decidability of assignment-count comparison in guarded-negation logic with constants, and obtain undecidability when selected functionality or comparison features are added. Two-variable counting logic recovers decidability for several key and foreign-key constraints. In this logic, with equality or one linear order and its successor, we compute a finite basis for all polynomial identities among given counts of unary and binary definable sets. The ordered construction preserves the entire word of vertex colors and computes its ordered-pair statistics by unipotent matrix products.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-12-02
DOI
https://doi.org/10.5281/zenodo.24742146
Primary Topic
Advanced Graph Theory Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Two Structural Axes of SQL Bag Equivalence: Graph Dichotomies, Guarded Counting, and Ordered Two-Variable Counting Ideals

Yang Li
Zenodo (CERN European Organization for Nuclear Research)
Advanced Graph Theory Research
preprint

Two Structural Axes of SQL Bag Equivalence: Graph Dichotomies, Guarded Counting, and Ordered Two-Variable Counting Ideals

Yang Li
preprint en

Abstract

SQL bag equivalence asks whether two queries return each row with the same multiplicity on every legal finite database. We separate the support of a database from the positive multiplicities of its stored tuples. After this separation, equivalence reduces to a finite family of equalities between counts of satisfying assignments. On the data axis, for a fixed minor-closed class of support graphs, the resulting decidability thresholds are bounded treewidth with equality, bounded matching number with a free linear order, and bounded vertex count with Presburger comparisons. Each decidable case has a computable bound on counterexample rows per table. One outermost bag difference or bag intersection separates freely repeatable inputs from key-controlled inputs. On the query axis, we prove decidability of assignment-count comparison in guarded-negation logic with constants, and obtain undecidability when selected functionality or comparison features are added. Two-variable counting logic recovers decidability for several key and foreign-key constraints. In this logic, with equality or one linear order and its successor, we compute a finite basis for all polynomial identities among given counts of unary and binary definable sets. The ordered construction preserves the entire word of vertex colors and computes its ordered-pair statistics by unipotent matrix products.

Zenodo (CERN European Organization for Nuclear Research)
Advanced Graph Theory Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon