# Computing the jth solution of a first-order query

• Volume: 42, Issue: 1, page 147-164
• ISSN: 0988-3754

top

## Abstract

top
We design algorithms of “optimal" data complexity for several natural problems about first-order queries on structures of bounded degree. For that purpose, we first introduce a framework to deal with logical or combinatorial problems R ⊂ I x O whose instances x ∈ I may admit of several solutions R(x) = {y ∈ O : (x,y) ∈ R}. One associates to such a problem several specific tasks: compute a random (for the uniform probability distribution) solution y ∈ R(x); enumerate without repetition each solution yj in some specific linear order y0 < y1 < ... < yn-1 where R(x) = {y0,...,yn-1}; compute the solution yj of rankj in the linear order <. Algorithms of “minimal" data complexity are presented for the following problems: given any first-order formula $\varphi \left(\overline{v}\right)$ and any structure S of bounded degree: (1) compute a random element of $\varphi \left(S\right)=\left\{\overline{a}:\left(S,\overline{a}\right)\vDash \varphi \left(\overline{v}\right)\right\}$; (2) compute the jth element of $\varphi \left(S\right)$ for some linear order of $\varphi \left(S\right)$; (3) enumerate the elements of $\varphi \left(S\right)$ in lexicographical order. More precisely, we prove that, for any fixed formula φ, the above problem (1) (resp. (2), (3)) can be computed within average constant time (resp. within constant time, with constant delay) after a linear (O(|S|)) precomputation. Our essential tool for deriving those complexity results is a normalization procedure of first-order formulas on bijective structures.

## How to cite

top

Bagan, Guillaume, et al. "Computing the jth solution of a first-order query ." RAIRO - Theoretical Informatics and Applications 42.1 (2008): 147-164. <http://eudml.org/doc/250274>.

@article{Bagan2008,
abstract = { We design algorithms of “optimal" data complexity for several natural problems about first-order queries on structures of bounded degree. For that purpose, we first introduce a framework to deal with logical or combinatorial problems R ⊂ I x O whose instances x ∈ I may admit of several solutions R(x) = \{y ∈ O : (x,y) ∈ R\}. One associates to such a problem several specific tasks: compute a random (for the uniform probability distribution) solution y ∈ R(x); enumerate without repetition each solution yj in some specific linear order y0 < y1 < ... < yn-1 where R(x) = \{y0,...,yn-1\}; compute the solution yj of rankj in the linear order <. Algorithms of “minimal" data complexity are presented for the following problems: given any first-order formula $\varphi(\bar\{v\})$ and any structure S of bounded degree: (1) compute a random element of $\varphi(S)=\\{\bar\{a\}: (S,\bar\{a\})\models\varphi(\bar\{v\})\\}$; (2) compute the jth element of $\varphi(S)$ for some linear order of $\varphi(S)$; (3) enumerate the elements of $\varphi(S)$ in lexicographical order. More precisely, we prove that, for any fixed formula φ, the above problem (1) (resp. (2), (3)) can be computed within average constant time (resp. within constant time, with constant delay) after a linear (O(|S|)) precomputation. Our essential tool for deriving those complexity results is a normalization procedure of first-order formulas on bijective structures. },
author = {Bagan, Guillaume, Durand, Arnaud, Grandjean, Etienne, Olive, Frédéric},
journal = {RAIRO - Theoretical Informatics and Applications},
keywords = {Complexity of enumeration; first-order queries; structures of bounded degree; linear time; constant time; constant delay},
language = {eng},
month = {1},
number = {1},
pages = {147-164},
publisher = {EDP Sciences},
title = {Computing the jth solution of a first-order query },
url = {http://eudml.org/doc/250274},
volume = {42},
year = {2008},
}

TY - JOUR
AU - Bagan, Guillaume
AU - Durand, Arnaud
AU - Grandjean, Etienne
AU - Olive, Frédéric
TI - Computing the jth solution of a first-order query
JO - RAIRO - Theoretical Informatics and Applications
DA - 2008/1//
PB - EDP Sciences
VL - 42
IS - 1
SP - 147
EP - 164
AB - We design algorithms of “optimal" data complexity for several natural problems about first-order queries on structures of bounded degree. For that purpose, we first introduce a framework to deal with logical or combinatorial problems R ⊂ I x O whose instances x ∈ I may admit of several solutions R(x) = {y ∈ O : (x,y) ∈ R}. One associates to such a problem several specific tasks: compute a random (for the uniform probability distribution) solution y ∈ R(x); enumerate without repetition each solution yj in some specific linear order y0 < y1 < ... < yn-1 where R(x) = {y0,...,yn-1}; compute the solution yj of rankj in the linear order <. Algorithms of “minimal" data complexity are presented for the following problems: given any first-order formula $\varphi(\bar{v})$ and any structure S of bounded degree: (1) compute a random element of $\varphi(S)=\{\bar{a}: (S,\bar{a})\models\varphi(\bar{v})\}$; (2) compute the jth element of $\varphi(S)$ for some linear order of $\varphi(S)$; (3) enumerate the elements of $\varphi(S)$ in lexicographical order. More precisely, we prove that, for any fixed formula φ, the above problem (1) (resp. (2), (3)) can be computed within average constant time (resp. within constant time, with constant delay) after a linear (O(|S|)) precomputation. Our essential tool for deriving those complexity results is a normalization procedure of first-order formulas on bijective structures.
LA - eng
KW - Complexity of enumeration; first-order queries; structures of bounded degree; linear time; constant time; constant delay
UR - http://eudml.org/doc/250274
ER -

## References

top
1. G. Bagan, Mso queries on tree decomposable structures are computable with linear delay, in Proc. 15th Annual Conference of the EACSL (CSL'06). Lect. Notes Comput. Sci.4207 (2006) 167–181.  Zbl1225.68268
2. G. Bagan, A. Durand and E. Grandjean, On acyclic conjunctive queries and constant delay enumeration, in Proc. 16th Annual Conference of the EACSL (CSL'07). Lect. Notes Comput. Sci. (2007) 208–222.  Zbl1179.68047
3. B. Courcelle, Linear delay enumeration and monadic second-order logic. Discrete Appl. Math. (2007) (to appear).  Zbl1217.03024
4. A. Durand and E. Grandjean, First-order queries on structures of bounded degree are computable with constant delay. ACM T. Comput. Logic (2007) 1–18.
5. A. Durand and F. Olive, First-order queries over one unary function, in Proc. 15th Annual Conference of the EACSL (CSL'06). Lect. Notes Comput. Sci.4207 (2006) 334–348.  Zbl1225.68085
6. J. Flum, M. Frick and M. Grohe, Query evaluation via tree decompositions. J. ACM49 (2002) 716–752.  Zbl1326.68123
7. M. Frick and M. Grohe, Deciding first-order properties of locally tree decomposable structures. J. ACM48 (2001) 1184–1206.  Zbl1323.03014
8. G. Gottlob, N. Leone and F. Scarcello, The complexity of acyclic conjunctive queries. J. ACM48 (2001) 431–498.  Zbl1323.68250
9. S. Grigorieff, Décidabilité et complexité des théories logiques. Collection Didactique INRIA8 (1991) 7–97.
10. E. Grandjean and T. Schwentick, Machine-independent characterizations and complete problems for deterministic linear time. SIAM J. Comput.32 (2002) 196–230.  Zbl1029.68058
11. L. Libkin, Elements of finite model theory. EATCS Series, Springer (2004).  Zbl1060.03002
12. S. Lindell, A normal form for first-order logic over doubly-linked data structures. Int. J. Found. Comput. Sci. (2006) (to appear).  Zbl1161.68401
13. R. Motwani and P. Raghavan, Randomized algorithms. Cambridge University Press (1995).  Zbl0849.68039
14. C. Papadimitriou and M. Yannakakis, On the complexity of database queries. J. Comput. Syst. Sci.58 (1999) 407–427.  Zbl0939.68024
15. M.Y. Vardi, On the complexity of bounded-variable queries. Proc. Principles of Databases Systems (PODS'95), ACM Press (1995) 266–276.
16. D. Seese, Linear time computable problems and first-order descriptions. Math. Structures Comput. Sci.6 (1996) 505–526.  Zbl0862.68056
17. M. Yannakakis, Algorithms for acyclic database schemes. Proc. Very Large Data Bases Conference (VLDB'81) (1981) 82–94.

## NotesEmbed?

top

You must be logged in to post comments.

To embed these notes on your page include the following JavaScript code on your page where you want the notes to appear.

Only the controls for the widget will be shown in your chosen language. Notes will be shown in their authored language.

Tells the widget how many notes to show per page. You can cycle through additional notes using the next and previous controls.

Note: Best practice suggests putting the JavaScript code just before the closing </body> tag.