Skip to main content
Log in

Bounded satisfiability checking of \(\hbox {FOL}^*\) formulas with aggregations

  • Research
  • Published:
Formal Methods in System Design Aims and scope Submit manuscript

Abstract

Software systems handling data are increasingly required to comply with legal properties (LPs) aimed at ensuring security and data privacy. Automated reasoning of LPs can be carried out by solving constraint satisfiability problems in first-order logic. However, the current logic-based reasoning approaches have limited support for capturing and reasoning about LPs with aggregation constraints, which are commonly found in financial and privacy policies. In this work, we extend first-order logic with quantifiers over relational objects (\(\hbox {FOL}^*\)) to support aggregation, resulting in a language \(\hbox {FOL}^{*+}\), and propose a satisfiability checking algorithm, LEGOS-A, for \(\hbox {FOL}^{*+}\) which supports reasoning about aggregation by over- and under-approximating the aggregated values and incrementally refining these approximations to derive the satisfiability result. Running LEGOS-A on real world and academic examples with aggregation from various domains showed that LEGOS-A was able to solve many previously intractable problems and provided substantial speed-ups compared to the state-of-the-art \(\hbox {FOL}^*\) satisfiability checker and other SMT-based alternatives.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+
from $39.99 /Month
  • Starting from 10 chapters or articles per month
  • Access and download chapters and articles from more than 300k books and 2,500 journals
  • Cancel anytime
View plans

Buy Now

Price includes VAT (Canada)

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Algorithm 1
Algorithm 2
Fig. 4

Similar content being viewed by others

Notes

  1. All source files and case studies are available in [10].

  2. \(\hbox {FOL}^*\) can also use other decidable theories such as LRA and NRA.

  3. In the implementation of LEGOS-A, \({ACTscore}\) is set to 5.

  4. https://stackoverflow.com/questions/22931415/sum-array-in-z3-solver.

References

  1. Feng N, Marsso L, Sabetzadeh M, Chechik M (2023) Early Verification of Legal Compliance via Bounded Satisfiability Checking. In: Proceedings of the 34th International Conference on Computer-Aided Verification (CAV’23), Paris, France. Lecture Notes in Computer Science. Springer

  2. Feng N, Marsso L, Getir-Yaman S, Beverley T, Calinescu R, Cavalcanti A, Chechik M (2023) Towards a formal framework for normative requirements elicitation. In: Proceedings of the 38th International Conference on Automated Software Engineering, (ASE’2023), Kirchberg, Luxembourg. IEEE

  3. Feng N, Marsso L, Yaman SG, Townsend B, Baatartogtokh Y, Ayad R, Mello VO, Kholodetska Y, Standen I, Stefanakos I, Imrie C, Rodrigues G, Cavalcanti A, Calinescu R, Chechik M (2024) Analyzing and debugging normative requirements via satisfiability checking. In: Proceedings of the 46th International Conference on Software Engineering, (ICSE 2024), Lisbon, Portugal. ACM

  4. Basin DA, Klaedtke F, Müller S (2010) Policy monitoring in first-order temporal logic. In: Touili T, Cook B, Jackson PB (eds.) Computer Aided verification, 22nd international conference, CAV 2010, Edinburgh, UK, July 15-19, 2010. Proceedings. Lecture notes in Computer Science, vol. 6174, pp. 1–18. Springer. https://doi.org/10.1007/978-3-642-14295-6_1

  5. Yaman SG, Burholt C, Jones M, Calinescu R, Cavalcanti A (2023) Specification and validation of normative rules for autonomous agents. In: Lambers L, Uchitel S (eds.) Fundamental approaches to software engineering—26th international conference, FASE 2023, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2023, Paris, France, April 22–27, 2023, Proceedings. Lecture notes in Computer Science. 13991: 241–248. Springer. https://doi.org/10.1007/978-3-031-30826-0_13

  6. EU payment services directive: directive 2007/64/EC of the European parliament and of the council of 13 october 2000 establishing a framework for payment services in the internal market amending. https://eur-lex.europa.eu/eli/dir/2007/64/2009-12-07

  7. Mohapatra A, Genesereth M (2012) Aggregation in datalog under set semantics. Technical report, Tech. rep. 2012. url: http://logic.stanford.edu/reports/LG-2012-01.pdf

  8. Alviano M, Greco G, Leone N (2011) Dynamic magic sets for programs with monotone recursive aggregates. In: Delgrande, J.P., Faber, W. (eds.) Logic programming and nonmonotonic reasoning—11th international conference, LPNMR 2011, Vancouver, Canada, May 16-19, 2011. Proceedings. Lecture notes in Computer Science. 6645: 148–160. Springer. https://doi.org/10.1007/978-3-642-20895-9_14

  9. Faber W, Pfeifer G, Leone N (2011) Semantics and complexity of recursive aggregates in answer set programming. Artif Intell 175(1):278–298. https://doi.org/10.1016/j.artint.2010.04.002

    Article  MathSciNet  Google Scholar 

  10. Nick Feng YK, Lina M, Chechik M. LEGOS-A: bounded satisfiability checking of FOL* formulas with aggregations. https://github.com/NickF0211/F-BSC-TOOL/

  11. Narodytska N, Bacchus F (2014) Maximum satisfiability using core-guided maxsat resolution. In: Brodley, C.E., Stone, P. (eds.) Proceedings of the twenty-eighth AAAI conference on artificial intelligence, July 27–31, 2014, Québec City, Québec, Canada, pp. 2717–2723. AAAI Press. http://www.aaai.org/ocs/index.php/AAAI/AAAI14/paper/view/8513

  12. De Moura L, Bjørner N. Z3: an efficient smt solver. In: International conference on tools and algorithms for the construction and analysis of systems, pp. 337–340. Springer

  13. Barbosa H, Barrett CW, Brain M, Kremer G, Lachnitt H, Mann M, Mohamed A, Mohamed M, Niemetz A, Nötzli A, Ozdemir A, Preiner M, Reynolds A, Sheng Y, Tinelli C, Zohar Y (2022) cvc5: a versatile and industrial-strength smt solver. In: Proceedings of the 28th international conference on tools and algorithms for the construction and analysis of systems (TACAS’2022), Munich, Germany. LNCS. 13243: 415–442. Springer. https://doi.org/10.1007/978-3-030-99524-9_24

  14. Kovács L, Voronkov A (2013) First-order theorem proving and vampire. In: Sharygina N, Veith H (eds.) Computer aided verification—25th international conference, CAV 2013, Saint Petersburg, Russia, July 13–19. Proceedings. Lecture notes in Computer Science. 8044: 1–35. Springer. https://doi.org/10.1007/978-3-642-39799-8_1

  15. Eppstein D, Galil Z, Italiano GF (2024) Dynamic graph algorithms. In: Atallah, M.J. (ed.) Algorithms and theory of computation handbook. Chapman & Hall/CRC Applied Algorithms and Data Structures series. CRC Press. https://doi.org/10.1201/9781420049503-c9

  16. Denecker M, De Cat B (2010) DPLL (Agg): an efficient smt module for aggregates. In: Logic and search

  17. Feng N, Marsso L, Garavel H (2021) Health record. Model checking context model (MCC’21), Dept. of Computer Science - University of Toronto. https://mcc.lip6.fr/pdf/HealthRecord-form.pdf

  18. Arfelt E, Basin DA, Debois S (2019) Monitoring the GDPR. In: Sako K, Schneider SA, Ryan PYA (eds.) Computer Security—ESORICS 2019—24th European symposium on research in computer security, Luxembourg, September 23-27, , Proceedings, Part I. Lecture notes in Computer Science. 11735: 681–699. Springer. https://doi.org/10.1007/978-3-030-29959-0_33

  19. Basin DA, Klaedtke F, Müller S, Zalinescu E (2015) Monitoring metric first-order temporal properties. J ACM 62(2):15–11545. https://doi.org/10.1145/2699444

    Article  MathSciNet  Google Scholar 

  20. Liaqat D, Lara E. The COVIDFree@Home website. https://covidfreeathome.org/

  21. Mattarei C, Cimatti A, Gario M, Tonetta S, Rozier KY (2015) Comparing different functional allocations in automated air traffic control design. In: Kaivola R, Wahl T (eds.) Formal methods in computer-aided design (FMCAD’2015), Austin, Texas, USA, pp. 112–119. IEEE

  22. Gario M, Cimatti A, Mattarei C, Tonetta S, Rozier KY (2016) Model checking at scale: automated air traffic control design space exploration. In: Chaudhuri S, Farzan A (eds.) Proceedings of the 28th international conference on computer aided verification (CAV’2016), Toronto, ON, Canada. LNCS. 9780: 3–22. Springer. https://doi.org/10.1007/978-3-319-41540-6_1

  23. Liu M (1998) Overview of datalog extensions. In: Fraternali P, Geske U, Ruiz C, Seipel D (eds.) Proceedings of the 6th international workshop on deductive databases and logic programming (DDLP’98). In Conjunction with JICSLP’98. GMD Report. 22: 99–112

  24. Jordan H, Scholz B, Subotic P (2016) Soufflé: on synthesis of program analyzers. In: Proceedings of the 28th international conference on computer aided verification (CAV’2016), Toronto, ON, Canada. Lecture notes in Computer Science. 9780: 422–430. Springer. https://doi.org/10.1007/978-3-319-41540-6_23

  25. Seo J, Guo S, Lam MS (2013) SociaLite: datalog extensions for efficient social network analysis. In: 2013 IEEE 29th International Conference on Data Engineering (ICDE), pp. 278–289. IEEE

  26. Seo J, Park J, Shin J, Lam MS (2013) Distributed socialite: a datalog-based language for large-scale graph analysis. Proc VLDB Endowment 6(14):1906–1917

    Article  Google Scholar 

  27. Shkapsky A, Yang M, Interlandi M, Chiu H, Condie T, Zaniolo C (2016) Big data analytics with datalog queries on spark. In: Proceedings of the 2016 International Conference on Management of Data. pp. 1135–1149

  28. Bartholomew M, Lee J, Meng Y (2011) First-order semantics of aggregates in answer set programming via modified circumscription. In: Logical formalizations of commonsense reasoning, papers from the 2011 AAAI Spring Symposium, Technical Report SS-11-06, Stanford, California, USA, March 21-23, 2011. AAAI

  29. Ferraris P (2011) Logic programs with propositional connectives and aggregates. ACM Trans Comput Log 12(4):25–12540. https://doi.org/10.1145/1970398.1970401

    Article  MathSciNet  Google Scholar 

  30. Alviano M, Calimeri F, Dodaro C, Fuscà D, Leone N, Perri S, Ricca F, Veltri P, Zangari J The ASP system DLV2. In: Balduccini M, Janhunen T (eds.) Logic programming and nonmonotonic reasoning—14th international conference, LPNMR 2017, Espoo, Finland, July 3–6, 2017, Proceedings. Lecture notes in Computer Science. 10377: 215–221. Springer. https://doi.org/10.1007/978-3-319-61660-5_19

  31. Alviano M, Dodaro C, Faber W, Leone N, Ricca F (2013) WASP: a native ASP solver based on constraint learning. In: Cabalar P, Son TC (eds.) Proceedings of the 12th international conference on logic programming and nonmonotonic reasoning (LPNMR’2013), Corunna, Spain. LNCS. 8148: 54–66. Springer. https://doi.org/10.1007/978-3-642-40564-8_6

  32. Jackson D (2002) Alloy: a lightweight object modelling notation. ACM Trans Softw Eng Methodol 11(2):256–290. https://doi.org/10.1145/505145.505149

    Article  Google Scholar 

  33. Brunel J, Chemouil D, Cunha A, Macedo N (2018) The electrum analyzer: model checking relational first-order temporal specifications. In: Huchard M, Kästner C, Fraser G (eds.) Proceedings of the 33rd international conference on automated software engineering, (ASE 2018), Montpellier, France, pp. 884–887. ACM. https://doi.org/10.1145/3238147.3240475

  34. Basin DA, Klaedtke F, Zalinescu E (2017) The monpoly monitoring tool. In: Reger, G., Havelund, K. (eds.) RV-CuBES 2017. An international workshop on competitions, usability, benchmarks, evaluation, and standardisation for runtime verification tools, September 15, 2017, Seattle, WA, USA. Kalpa Publications in Computing. 3: 19–28. EasyChair. https://doi.org/10.29007/89hs

  35. Denecker M, De Cat B (2010) Dpll (agg): an efficient smt module for aggregates. In: Logic and Search, Date: 2010/07/15-2010/07/15, Location: Edinburgh

  36. Piskac R, Kuncak V Linear arithmetic with stars. In: Gupta A, Malik S (eds.) Computer aided verification, 20th international conference, CAV 2008, Princeton, NJ, USA, July 7-14, 2008, Proceedings. Lecture notes in Computer Science. 5123: 268–280. Springer. https://doi.org/10.1007/978-3-540-70545-1_25

  37. Levatich M, Bjørner NS, Piskac R, Shoham S (2020) Solving \(\rm LIA^{\star }\) using approximations. In: Beyer D, Zufferey D (eds.) Verification, model checking, and abstract interpretation—21st international conference, VMCAI 2020, New Orleans, LA, USA, January 16-21, 2020, Proceedings. Lecture notes in Computer Science. 11990: 360–378. Springer. https://doi.org/10.1007/978-3-030-39322-9_17

  38. Rozier KY, Vardi MY (2007) LTL satisfiability checking. In: Bosnacki D, Edelkamp S (eds.) Proceedings of the 14th international workshop on model checking software (SPIN’07), Berlin, Germany. Lecture notes in Computer Science. 4595: 149–167. Springer. https://doi.org/10.1007/978-3-540-73370-6_11

  39. Li J, Zhang L, Pu G, Vardi MY, He J (2013) LTL satisfiability checking revisited. In: Proceedings of the 20th international symposium on temporal representation and reasoning, Pensacola, FL, USA. pp. 91–98. IEEE Computer Society. https://doi.org/10.1109/TIME.2013.19

  40. Li J, Pu G, Zhang Y, Vardi MY, Rozier KY (2020) SAT-based explicit LTLf satisfiability checking. Artif Intell 289:103369. https://doi.org/10.1016/j.artint.2020.103369

    Article  Google Scholar 

  41. Li J, Rozier KY, Pu G, Zhang Y, Vardi MY (2019) SAT-based explicit LTLf satisfiability checking. In: The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, pp. 2946–2953. AAAI Press

  42. Li J, Pu G, Zhang L, Vardi MY, He J (2018) Accelerating LTL satisfiability checking by SAT solvers. J Log Comput 28(6):1011–1030

    Article  MathSciNet  Google Scholar 

  43. Bersani MM, Frigeri A, Morzenti A, Pradella M, Rossi M, Pietro PS (2014) Constraint LTL satisfiability checking without automata. J Appl Log 12(4):522–557. https://doi.org/10.1016/j.jal.2014.07.005

    Article  MathSciNet  Google Scholar 

  44. Pradella M, Morzenti A, Pietro PS (2013) Bounded satisfiability checking of metric temporal logic specifications. ACM Trans Softw Eng Methodol 22(3):20–12054. https://doi.org/10.1145/2491509.2491514

    Article  Google Scholar 

  45. Li J, Vardi MY, Rozier KY Satisfiability checking for mission-time LTL. In: Dillig, I., Tasiran, S. (eds.) Computer aided verification—31st international conference, CAV 2019, New York City, NY, USA, July 15–18, 2019, Proceedings, Part II. Lecture notes in Computer Science. 11562: 3–22. Springer. https://doi.org/10.1007/978-3-030-25543-5_1

  46. Bae K, Lee J (2019) Bounded model checking of signal temporal logic properties using syntactic separation. Proc ACM Program Lang 3(POPL):51–15130. https://doi.org/10.1145/3290364

    Article  Google Scholar 

  47. Moura LM, Bjørner (2008) NS Z3: an efficient smt solver. In: Ramakrishnan CR, Rehof J (eds.) Proceedings of the 14th international conference on tools and algorithms for the construction and analysis of systems (TACAS’2008), Budapest, Hungary. Lecture notes in Computer Science. 4963: pp. 337–340. Springer. https://doi.org/10.1007/978-3-540-78800-3_24

  48. Reynolds A, Tinelli C, Goel A, Krstic S (2013) Finite model finding in smt. In: Sharygina N, Veith H (eds.) Computer aided verification—25th international conference, CAV 2013, Saint Petersburg, Russia, July 13-19, 2013. Proceedings. Lecture notes in Computer Science. 8044: 640–655. Springer. https://doi.org/10.1007/978-3-642-39799-8_42

  49. Reynolds A, Tinelli C, Goel A, Krstic S, Deters M, Barrett CW (2013) Quantifier instantiation techniques for finite model finding in smt. In: Bonacina MP (ed.) Automated Deduction—CADE-24—24th International conference on automated deduction, Lake Placid, NY, USA, June 9–14, 2013. Proceedings. Lecture notes in Computer Science. 7898: 377–391. Springer. https://doi.org/10.1007/978-3-642-38574-2_26

Download references

Acknowledgements

We would like to thank the students and instructors of NASA Summer School in Formal Methods, especially Cesare Tinelli, for interesting discussions that helped improve this manuscript. This work was funded in part by Natural Sciences and Engineering Research Council of Canada, Mitacs Globallink, and by an Amazon Research Award.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Nick Feng, Lina Marsso or Marsha Chechik.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendix: Modeling aggregation in \(\hbox {FOL}^*\)

Appendix: Modeling aggregation in \(\hbox {FOL}^*\)

Below we describe the approach used to model \(\hbox {FOL}^{*+}\) aggregation in \(\hbox {FOL}^*\) following the recursive definition of aggregation [7].

Let S be a class of relational objects, \(A \in {{Sum}, {Count}, {Max}, {Min}}\), p be a \(\hbox {FOL}^{*+}\) predicate, and \({val}\) be an \(\hbox {FOL}^{*+}\) function. In any given domain \(D\), the \(\hbox {FOL}^{*+}\) aggregation \(A(S, p, {val})\) captures a value by applying the aggregation function A over the bag (multi-set) of values defined by \({val}(o)\) for every relational object o in class S within the domain \(D\) that satisfies the predicate p. As the domain \(D\) is finite but not fixed, we model the aggregation in \(\hbox {FOL}^*\) using the recursive definition of aggregation over a symbolic, finite, and ordered list.

To begin, we establish an ordering for relational objects of class S. We define a function, denoted by \(ord_{S}\), which maps each relational object o of class S to a natural number with the following \(\hbox {FOL}^*\) rules:

  • \(\forall o, o':S \cdot o\equiv o' \Rightarrow ord(o) = ord(o')\) (deterministic)

  • \(\forall o: S \cdot ord(o) \ge 0\) (range)

Now that we have established an ordering for relational objects, we can proceed to define the aggregation rules. We denote an empty list by [], a list with a single element x by [x], and a concatination of lists N and [x] by \(N + [x]\).

  1. (1)

    \({Sum}([]) = 0\), \({Sum}(N + [x]) = {Sum}(N) + {\textbf {ite}}(p(x), {val}(x), 0)\);

  2. (2)

    \({Count}([]) = 0\), \({Count}(N + [x]) = {Count}(N) + {\textbf {ite}}(p(x), 1, 0)\);

  3. (3)

    \({Max}([]) = -\infty\), \({Max}(N + [x]) = {max}({Max}(N), {\textbf {ite}}(p(x), {val}(x), -\infty ))\); and

  4. (4)

    \({Min}([]) = \infty\), \({Min}(N + [x]) = {min}({Min}(N), {\textbf {ite}}(p(x), {val}(x), \infty ))\).

Since the list is ordered, the last relational object in the list (e.g., x) has the greatest order. Moreover, since the list captures all relational objects of class S in a domain where duplicates are collapsed, we can use the relational object with the greatest ordering to uniquely define a list whose last element is the object. Therefore, we can model the intermediate result of aggregation over any list with a new class of relational objects \(A_{S}\) (where A is the aggregation function) with two attributes: \({lst}\) and \({value}\). The attribute \({lst}\) is the order of the last relational object in the list which has been aggregated over, and \({value}\) is the intermediate aggregation result. We can then define the aggregation rules in \(\hbox {FOL}^*\). We show the rule for Sum ,and the others can be defined analogously.

  • \(\forall s:{Sum}_{S} \cdot s.lst < 0 \Rightarrow s.{value} = 0\) (over an empty list)

  • \(\forall s:{Sum}_{S} \cdot s.lst \ge 0 \Rightarrow \exists s': {Sum}_{S}\exists o:S (ord(o) =s.{lst} \wedge {\textbf {Pred}}(s', s) \wedge s.{value} = s'.{value} + {\textbf {ite}}(p(o), {val}(o), 0))\) (step backward consistency)

  • \({\textbf {Pred}}(s, s') = \lnot (\exists s*:{Sum}_{S} \cdot s'.{lst}< s*.{lst} < s.{lst})\)

  • \(\forall o:S \exists s:{Sum}_{S} \cdot s.{lst} = ord(o)\) (step forward consistency)

  • \(\forall s,s': {Sum}_{S} s.lst = s'.lst \Rightarrow s.{value} = s'.{value}\) (aggregation determinism)

We can then capture the final aggregation result with the relational object s in \(A_{S}\) that contains the element with the greatest order:

$$\begin{aligned} \exists s: A_{S} \cdot \forall s':A_{S} (s'.{lst} \le s.{lst}) \wedge s.{\textbf {value}} = A(S, p, {val}) \end{aligned}$$

We use the above encoding for aggregation Sum and Count. On the other hand, for aggregation functions Max and Min, we uses an alternative and more succinct \(\hbox {FOL}^*\) encoding depending on the usage context of the aggregated term:

  • \({Max}(S,p,val) \ge t:= \exists s:S. p(s) \wedge val(s) \ge t \wedge \forall s':S \cdot p(s') \Rightarrow val(s') \le val(s)\)

  • \({Max}(S,p,val) \le t:= \forall s':S \cdot p(s') \Rightarrow val(s') \le t\)

  • \({Max}(S,p,val) \ge t:= \forall s':S \cdot p(s') \Rightarrow val(s') \ge t\)

  • \({Min}(S,p,val) \le t:= \exists s:S. p(s) \wedge val(s) \le t \wedge \forall s':S \cdot p(s') \Rightarrow val(s') \ge val(s)\)

where t is a term in \(\hbox {FOL}^{*+}\). Other \(\hbox {FOL}^{*+}\) usage of \(\hbox {FOL}^{*+}\) terms in the resulting formulas are recursively encoded into \(\hbox {FOL}^*\) formulas. For example, the formula \(Max(S, p_1, val_1) \ge Min(S, p_2, val_s)\) is first encoded into \(\exists :S \cdot p_1(s) \wedge val_1(s) \ge {Min}(S, p_2, val_s) \wedge \forall s':S \cdot p_1(s') \Rightarrow p_1(s') \le p_1(s)\) by expanding \({Max}(S, p_1, val_1)\). Then, we can encode the usage of \({Min}(S, p_2, val_s)\) in \(val_1(s) \ge {Min}(S, p_2, val_s)\) and yield a final \(\hbox {FOL}^*\) formula: \(\exists :S \cdot p_1(s) \wedge (\exists s'': S: \cdot p_2(s'') \wedge val_2(s'') \le val_1(s) \wedge \forall s*:S \cdot p_2(s*) \Rightarrow val_2(s*) \ge val_2(s''))(S, p_2, val_s) \wedge \forall s':S \cdot p_1(s') \Rightarrow p_1(s') \le p_1(s)\).

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Feng, N., Marsso, L., Kholodetska, Y. et al. Bounded satisfiability checking of \(\hbox {FOL}^*\) formulas with aggregations. Form Methods Syst Des 67, 282–315 (2025). https://doi.org/10.1007/s10703-025-00483-4

Download citation

  • Received:

  • Accepted:

  • Published:

  • Version of record:

  • Issue date:

  • DOI: https://doi.org/10.1007/s10703-025-00483-4

Keywords

Profiles

  1. Marsha Chechik