Conjunctive query evaluation and containment are NP-complete
No public endorsements yet.
Loading review…
Sign in with ORCIDAbstract
The two classical decision problems about Boolean conjunctive queries, evaluation and containment, from the descriptive-complexity library's worked example on database theory, built on the NP core registered as lax-904597 and on the catalog registered as lax-799700. The schema is a single binary relation, that of graph databases, which loses no complexity-theoretic generality. An evaluation instance is a query and a database over a shared universe, a containment instance a pair of queries over shared constants.
Both problems are NP-complete in the core's sense, the results of Chandra and Merlin (1977): evaluation is definable in existential second-order logic and 3-colorability reduces to it by a quantifier-free first-order reduction, assumed from the catalog's statement; containment reduces to evaluation by the Chandra–Merlin theorem in reduction form, containment holding exactly when the right query maps homomorphically into the canonical database of the left one, and evaluation reduces to containment, a database being a variable-free query. The Chandra–Merlin theorem itself is a statement of the submission, as are the two reductions, so the archive's proof network shows containment's completeness resting on evaluation's.
As in the graph-crawling submission, the problem is also stated on packaged instances: concrete queries and databases, encoded faithfully and size-honestly, and decoded back from any raw relation table with a constant, with evaluation on such well-formed instances NP-complete too.
The proofs are those of version 1.2.2 of the library, sliced to what these statements use. The library and its documentation are at https://github.com/PierreSenellart/descriptive-complexity and https://pierresenellart.github.io/descriptive-complexity/DescriptiveComplexity.html. The Lean code was written with the assistance of several Claude models; the design and the statements are the author's.
Concepts
- thm✓
ChandraMerlin - lem✓
ContainmentInvariance - thm✓
ContainmentNPComplete - thm✓
DecodingAndWellFormed - thm✓
EncodingFaithful - thm✓
EvaluationContainmentReductions - lem✓
EvaluationInvariance - thm✓
EvaluationNPComplete
- def
Evaluation - def
PackagedInstances - def
QueryDatabases - def
QueryPairs
Concept map
Proofs
Proof networkview on GitHub
Proof list
Lean sources for these proofs: proofs/ on GitHub
Proof code is not displayed; the archive records each proof's checked relationship between claims.
Related submissions
Submission map
Cite this
This is only the formalizers. The authors of the formalized results may be different (see References).
@misc{lax-420092,
author = {Pierre Senellart and Claude (Anthropic)},
title = {Conjunctive query evaluation and containment are NP-complete},
year = {2026},
howpublished = {Lax Archive, lax-420092},
url = {https://laxarchive.org/lax-420092/},
}
References
- Ashok K. Chandra and Philip M. Merlin. Optimal Implementation of Conjunctive Queries in Relational Data Bases. In Proceedings of the 9th Annual ACM Symposium on Theory of Computing, May 4-6, 1977, Boulder, Colorado, USA 77–90, 1977. doi:10.1145/800105.803397
- Pierre Senellart and Anton Gnatenko. Descriptive Complexity in Lean: Completeness by First-Order Reductions. 2026. arXiv:2609.18261
- Pierre Senellart. DescriptiveComplexity: Completeness by First-Order Reductions in Lean. 2026. doi:10.5281/zenodo.21678423 · github.com/PierreSenellart/descriptive-complexity
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments