First-order definable counting-only queries

  • Jelle Hellings
  • Marc GyssensEmail author
  • Dirk Van Gucht
  • Yuqing Wu


Many data sources can be represented easily by collections of sets of objects. For several practical queries on such collections of sets of objects, the answer does not depend on the precise composition of these sets, but only on the number of sets to which each object belongs. This is the case k= 1 for the more general situation where the query answer only depends on the number of sets to which each collection of at most k objects belongs. We call such queries k-counting-only. Here, we focus on k-SyCALC, i.e., k-counting-only queries that are first-order definable. As k-SyCALC is semantically defined, however, it is not surprising that it is already undecidable whether a first-order query is in 1-SyCALC. Therefore, we introduce SimpleCALC-k, a syntactically defined (strict) fragment of k-SyCALC. It turns out that many practical queries in k-SyCALC can already be expressed in SimpleCALCk. We also define the query language GCountk, which expresses counting-only queries directly by using generalized counting terms, and show that this language is equivalent to SimpleCALC-k. We prove that the k-counting-only queries form a non-collapsing hierarchy: for every k, there exist (k+ 1)-counting-only queries that are not k-counting-only. This result specializes to both SimpleCALCk and k-SyCALC. Finally, we establish a strong dichotomy between 1-SyCALC and SimpleCALCk on the one hand and 2-SyCALC on the other hand by showing that satisfiability, validity, query containment, and query equivalence are decidable for the former two languages, but not for the latter one.


Bag of sets Counting-only query First-order definable query Satisfiability 

Mathematics Subject Classification (2010)

03C07 03C80 03D15 03D55 68P15 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.



This is a revised and extended version of the conference paper ‘First-order definable counting-only queries’, presented at the 10th International Symposium on Foundations of Information and Knowledge Systems, Budapest, Hungary (FoIKS 2018) [15].


  1. 1.
    Abiteboul, S., Hull, R., Vianu, V. (eds.): Foundations of Databases: The Logical Level, 1st edn. Addison-Wesley Longman Publishing Co. Inc, Reading (1995)Google Scholar
  2. 2.
    Anderson, I.: Combinatorics of Finite Sets. Dover Publications, New York (2011)Google Scholar
  3. 3.
    Bachmair, L., Ganzinger, H., Waldmann, U.: Set constraints are the monadic class. In: Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science, pp. 75–83 (1993)Google Scholar
  4. 4.
    Badia, A., Van Gucht, D., Gyssens, M.: Querying with Generalized Quantifiers, pp 235–258. Springer, Boston (1995)Google Scholar
  5. 5.
    Bancilhon, F.: On the completeness of query languages for relational data bases. In: Winkowski, J. (ed.) Mathematical Foundations of Computer Science 1978, Proceedings, 7th Symposium, Zakopane, Poland, September 4-8, 1978, Lecture Notes in Computer Science., vol. 64, pp 112–123. Springer (1978)
  6. 6.
    Bayer, A.E., Smart, J.C., McLaughlin, G.W.: Mapping intellectual structure of a scientific subfield through author cocitations. J. Amer. Soc. Inf. Sci. 41(6), 444–452 (1990)CrossRefGoogle Scholar
  7. 7.
    Calders, T., Goethals, B.: Non-derivable itemset mining. Data Min. Knowl. Disc. 14(1), 171–206 (2007)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Fletcher, G.H.L., Van Den Bussche, J., Van Gucht, D., Vansummeren, S.: Towards a theory of search queries. ACM Trans. Database Syst. 35(4), 28:1–28:33 (2010)CrossRefGoogle Scholar
  9. 9.
    Goethals, B.: Survey on Frequent Pattern Mining. Technical report, University of Helsinki (2003)Google Scholar
  10. 10.
    Grädel, E., Otto, M.: On logics with two variables. Theor. Comput. Sci. 224 (1–2), 73–113 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  11. 11.
    Grohe, M.: Finite variable logics in descriptive complexity theory. Bull. Symb. Log. 4, 345–398 (1998)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Gyssens, M., Hellings, J., Paredaens, J., Van Gucht, D., Wijsen, J., Wu, Y.: Calculi for symmetric queries. J. Comput. Syst. Sci. 105, 54–86 (2019)Google Scholar
  13. 13.
    Gyssens, M., Paredaens, J., Van Gucht, D., Wijsen, J., Wu, Y.: An approach towards the study of symmetric queries. Proc. VLDB Endow. 7(1), 25–36 (2013)CrossRefGoogle Scholar
  14. 14.
    Han, J., Pei, J., Yin, Y., Mao, R.: Mining frequent patterns without candidate generation: a frequent-pattern tree approach. Data Min. Knowl. Disc. 8(1), 53–87 (2004)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Hellings, J., Gyssens, M., Van Gucht, D., Wu, Y.: First-order definable counting-only queries. In: Foundations of Information and Knowledge Systems, pp. 225–243. Springer International Publishing (2018)Google Scholar
  16. 16.
    Kuske, D., Schweikardt, N.: First-order logic with counting. In: 2017 32nd Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), pp. 1–12 (2017)Google Scholar
  17. 17.
    Lewis, H.R.: Complexity results for classes of quantificational formulas. J. Comput. Syst. Sci. 21(3), 317–353 (1980)MathSciNetCrossRefzbMATHGoogle Scholar
  18. 18.
    Libkin, L.: Elements of Finite Model Theory. Springer, Berlin (2004)CrossRefzbMATHGoogle Scholar
  19. 19.
    Paredaens, J.: On the expressive power of the relational algebra. Inf. Process. Lett. 7(2), 107–111 (1978). MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Paredaens, J., Van Gucht, D.: Converting nested algebra expressions into flat algebra expressions. ACM Trans. Database Syst. 17(1), 65–93 (1992). MathSciNetCrossRefGoogle Scholar
  21. 21.
    Peters, S., Westerståhl, D.: Quantifiers in Language and Logic. Oxford University Press, London (2008). CrossRefGoogle Scholar
  22. 22.
    Quine, W.V.: Selected Logic Papers. Harvard University Press, Cambridge (1995)Google Scholar
  23. 23.
    Sayrafi, B., Van Gucht, D.: Differential constraints. In: Proceedings of the Twenty-fourth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems, pp. 348–357. ACM (2005)Google Scholar
  24. 24.
    Sayrafi, B., Van Gucht, D., Gyssens, M.: Measures in Databases and Data Mining. Tech. Rep. TR602, Indiana University. (2004)
  25. 25.
    Thomas, S.J., Fischer, P.C.: Nested relational structures. Adv. Comput. Res. 3, 269–307 (1986)Google Scholar
  26. 26.
    Väänänen, J.: Generalized Quantifiers, an Introduction. In: Generalized Quantifiers and Computation: 9th European Summer School in Logic, Language, and Information, pp. 1–17. Springer, Berlin (1999)Google Scholar
  27. 27.
    Vianu, V., Van Gucht, D.: Computationally complete relational query languages. In: Liu, L., Özsu, M.T. (eds.) Encyclopedia of Database Systems. 1st edn., pp 1–7. Springer, New York (2017)Google Scholar
  28. 28.
    Westerståhl, D.: Generalized quantifiers. In: Zalta, E. N. (ed.) The Stanford Encyclopedia of Philosophy, winter 2016 edn. Metaphysics Research Lab, Stanford University (2016)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Exploratory Systems Lab, Department of Computer ScienceUniversity of CaliforniaDavisUSA
  2. 2.Faculty of Sciences, Hasselt UniversityHasseltBelgium
  3. 3.School of Informatics, Computing, and Engineering, Indiana UniversityBloomingtonUSA
  4. 4.Pomona CollegeClaremontUSA

Personalised recommendations