Journal of Automated Reasoning

, Volume 36, Issue 3, pp 213–239 | Cite as

Deciding Boolean Algebra with Presburger Arithmetic

Article

Abstract

We describe an algorithm for deciding the first-order multisorted theory BAPA, which combines Boolean algebras of sets of uninterpreted elements (BA) and Presburger arithmetic operations (PA). BAPA can express the relationship between integer variables and cardinalities of unbounded finite sets, and it supports arbitrary quantification over sets and integers. Our motivation for BAPA is deciding verification conditions that arise in the static analysis of data structure consistency properties. Data structures often use an integer variable to keep track of the number of elements they store; an invariant of such a data structure is that the value of the integer variable is equal to the number of elements stored in the data structure. When the data structure content is represented by a set, the resulting constraints can be captured in BAPA. BAPA formulas with quantifier alternations arise when verifying programs with annotations containing quantifiers or when proving simulation relation conditions for refinement and equivalence of program fragments. Furthermore, BAPA constraints can be used for proving the termination of programs that manipulate data structures, as well as in constraint database query evaluation and loop invariant inference. We give a formal description of an algorithm for deciding BAPA. We analyze our algorithm and show that it has optimal alternating time complexity and that the complexity of BAPA matches the complexity of PA. Because it works by a reduction to PA, our algorithm yields the decidability of a combination of sets of uninterpreted elements with any decidable extension of PA. When restricted to BA formulas, the algorithm can be used to decide BA in optimal alternating time. Furthermore, the algorithm can eliminate individual quantifiers from a formula with free variables and therefore perform projection onto a desirable set of variables. We have implemented our algorithm and used it to discharge verification conditions in the Jahob system for data structure consistency checking of Java programs; our experience suggest that a straightforward implementation of the algorithm is effective on nontrivial formulas as long as the number of set variables is small. We also report on a new algorithm for solving the quantifier-free fragment of BAPA.

Key words

Boolean algebra Presburger arithmetic decision procedure quantifier elimination complexity program verification 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ackermann, W.: Solvable Cases of the Decision Problem. North Holland, Amsterdam (1954)MATHGoogle Scholar
  2. 2.
    Arkoudas, K., Zee, K., Kuncak, V., Rinard, M.: Verifying a file system implementation. In: Sixth International Conference on Formal Engineering Methods (ICFEM ’04), vol. 3308 of LNCS. Seattle (2004)Google Scholar
  3. 3.
    Baader, F., Calvanese, D., McGuinness, D., Nardi, D., Patel-Schneider, P. (eds.) The Description Logic Handbook: Theory, Implementation and Applications. Cambridge University Press, Boston, Massachusetts (2003)MATHGoogle Scholar
  4. 4.
    Barrett, C., Berezin, S.: CVC lite: A new implementation of the cooperating validity checker. In: Alur, R., Peled, D.A. (eds.) Proceedings of the 16th International Conference on Computer Aided Verification (CAV ’04). Lecture Notes in Computer Science, vol. 3114, pp. 515–518. Boston, Massachusetts (2004)Google Scholar
  5. 5.
    Berman, L.: The complexity of logical theories. Theor. Comp. Sci. 11(1), 71–77 (1980)CrossRefGoogle Scholar
  6. 6.
    Boigelot, B., Jodogne, S., Wolper, P.: An effective decision procedure for linear arithmetic over the integers and reals. ACM Trans. Comput. Logic 6(3), 614–633 (2005)CrossRefMathSciNetGoogle Scholar
  7. 7.
    Börger, E., Grädel, E., Gurevich, Y.: The Classical Decision Problem. Springer, Berlin Heidelberg New York (1997)MATHGoogle Scholar
  8. 8.
    Bozga, M., Iosif, R.: On decidability within the arithmetic of addition and divisibility. In: FOSSACS’05. Lecture Notes in Computer Science. Springer, Berlin Heidelberg New York (2005)Google Scholar
  9. 9.
    Bruyére, V., Hansel, G., Michaux, C., Villemaire, R.: Logic and p-recognizable sets of integers. Bull. Belg. Math. Soc. Simon Stevin 1, 191–238 (1994)MathSciNetGoogle Scholar
  10. 10.
    Bultan, T., Gerber, R., Pugh, W.: Model-checking concurrent systems with unbounded integer variables: Symbolic representations, approximations, and experimental results. ACM Trans. Program. Lang. Syst. 21(4), 747–789 (1999)CrossRefGoogle Scholar
  11. 11.
    Cadoli, M., Schaerf, M., Giovanardi, A., Giovanardi, M.: An algorithm to evaluate quantified boolean formulae and its experimental evaluation. J. Autom. Reason. 28(2), 101–142 (2002)CrossRefMathSciNetGoogle Scholar
  12. 12.
    Cantone, D., Omodeo, E., Policriti, A.: Set Theory for Computing. Springer, Berlin Heidelberg New York (2001)MATHGoogle Scholar
  13. 13.
    Chaieb, A., Nipkow, T.: Generic proof synthesis for Presburger arithmetic. Technical report, Technische Universität München (2003)Google Scholar
  14. 14.
    Chandra, A.K., Kozen, D.C., Stockmeyer, L.J.: Alternation. J. Assoc. Comput. Mach. 28(1), 114–133 (1981)MathSciNetGoogle Scholar
  15. 15.
    Chin, W.-N., Khoo, S.-C., Xu, D.N.: Extending sized types with collection analysis. In: ACM PEPM’03, San Diego, California (2003)Google Scholar
  16. 16.
    Cooper, D.C.: Theorem proving in arithmetic without multiplication. In: Meltzer, B., Michie, D. (eds.) Machine Intelligence, vol. 7, pp. 91–100. Edinburgh University Press, London, UK (1972)Google Scholar
  17. 17.
    Dewar, R.K.: Programming by refinement, as exemplified by the SETL representation sublanguage. ACM Trans. Program. Lang. Syst. 1(1), 27–49 (1979)CrossRefGoogle Scholar
  18. 18.
    Feferman, S., Vaught, R.L.: The first order properties of products of algebraic systems. Fundam. Math. 47, 57–103 (1959)MathSciNetGoogle Scholar
  19. 19.
    Ferrante, J., Rackoff, C.W.: The Computational Complexity of Logical Theories. Lecture Notes in Mathematics, vol. 718 Springer, Berlin Heidelberg New York (1979)Google Scholar
  20. 20.
    Gordon, M.J.C., Melham, T.F.: Introduction to HOL, a Theorem Proving Environment for Higher-order Logic. Cambridge University Press, UK (1993)MATHGoogle Scholar
  21. 21.
    Henriksen, J., Jensen, J., Jørgensen, M., Klarlund, N., Paige, B., Rauhe, T., Sandholm, A.: Mona: Monadic second-order logic in practice. In: TACAS ’95. Lecture Notes in Computer Science, vol. 1019. Springer, Berlin Heidelberg New York (1995)Google Scholar
  22. 22.
    Hoare, C.A.R.: An axiomatic basis for computer programming. Commun. ACM 12(10), 576–580 (1969)CrossRefGoogle Scholar
  23. 23.
    Kapur, D.: Automatically generating loop invariants using quantifier elimination. In: IMACS International Conference on Applications of Computer Algebra, Beaumont, Texas (2004)Google Scholar
  24. 24.
    Klarlund, N., Møller, A., Schwartzbach, M.I.: MONA implementation secrets. In: Proc. 5th International Conference on Implementation and Application of Automata. Lecture Notes in Computer Science. Springer, Berlin Heidelberg New York (2000)Google Scholar
  25. 25.
    Kozen, D.: Complexity of boolean algebras. Theor. Comput. Sci. 10, 221–247 (1980)CrossRefMathSciNetGoogle Scholar
  26. 26.
    Kozen, D.: Theory of Computation. Springer, Berlin Heidelberg New York (2006)MATHGoogle Scholar
  27. 27.
    Kuncak, V., Nguyen, H.H., Rinard, M.: An algorithm for deciding BAPA: Boolean algebra with Presburger arithmetic. In: 20th International Conference on Automated Deduction, CADE-20, Tallinn, Estonia (2005)Google Scholar
  28. 28.
    Kuncak, V., Rinard, M.: On the theory of structural subtyping. Technical Report 879. Laboratory for Computer Science, Massachusetts Institute of Technology (2003a)Google Scholar
  29. 29.
    Kuncak, V., Rinard, M.: Structural subtyping of non-recursive types is decidable. In: Eighteenth Annual IEEE Symposium on Logic in Computer Science, Ottawa, Canada (2003b)Google Scholar
  30. 30.
    Kuncak, V., Rinard, M.: The first-order theory of sets with cardinality constraints is decidable. Technical Report 958, MIT CSAIL (2004)Google Scholar
  31. 31.
    Kuncak, V., Rinard, M.: Decision procedures for set-valued fields. In: 1st International Workshop on Abstract Interpretation of Object-Oriented Languages (AIOOL), Paris, France (2005)Google Scholar
  32. 32.
    Kuncak, V., Rinard, M.: An overview of the Jahob analysis system: Project goals and current status. In: NSF Next Generation Software Workshop, Rhodes, Greece (2006)Google Scholar
  33. 33.
    Lahiri, S.K., Seshia, S.A.: The UCLID decision procedure. In: CAV’04. Lecture Notes in Computer Science, vol. 3114. Springer, Berlin Heidelberg New York (2004)Google Scholar
  34. 34.
    Lam, P., Kuncak, V., Rinard, M.: Generalized typestate checking using set interfaces and pluggable analyses. SIGPLAN Not. 39, 46–55 (2004)CrossRefGoogle Scholar
  35. 35.
    Lam, P., Kuncak, V., Rinard, M.: Generalized typestate checking for data structure consistency. In: 6th International Conference on Verification, Model Checking and Abstract Interpretation, Paris (2005)Google Scholar
  36. 36.
    Loewenheim, L.: Über Mögligkeiten im Relativkalkül. Math. Ann. 76, 228–251 (1915)Google Scholar
  37. 37.
    Marnette, B., Kuncak, V., Rinard, M.: On algorithms and complexity for sets with cardinality constraints. Technical report, MIT CSAIL (2005)Google Scholar
  38. 38.
    Marriott, K., Odersky, M.: Negative boolean constraints. Technical Report 94/203, Monash University (1994)Google Scholar
  39. 39.
    Møller, A., Schwartzbach, M.I.: The pointer assertion logic engine. In: Conference on Programming Language Design and Implementation, Snowbird, Utah (2001)Google Scholar
  40. 40.
    Nelson, G., Oppen, D.C.: Simplification by cooperating decision procedures. ACM Trans. Program. Lang. Syst. 1(2), 245–257 (1979)CrossRefGoogle Scholar
  41. 41.
    Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: A Proof Assistant for Higher-Order Logic, vol. 2283 of LNCS. Springer, Berlin Heidelberg New York (2002)Google Scholar
  42. 42.
    Ohlbach, H.J., Koehler, J.: How to extend a formal system with a Boolean algebra component. In: Schmidt, W.B.P.H. (ed.) Automated Deduction. A Basis for Applications, vol. 3, pp. 57–75. Kluwer, Boston, Massachusetts (1998)Google Scholar
  43. 43.
    Owre, S., Rushby, J.M., Shankar, N.: PVS: A prototype verification system. In: Kapur, D. (ed.) 11th CADE, vol. 607 of LNAI, pp. 748–752 (1992)Google Scholar
  44. 44.
    Papadimitriou, C.H.: On the complexity of integer programming. J. Assoc. Comput. Mach. 28(4), 765–768 (1981)MathSciNetGoogle Scholar
  45. 45.
    Podelski, A., Rybalchenko, A.: Transition predicate abstraction and fair termination. In: ACM POPL, pp. 132–144. ACM, New York (2005)CrossRefGoogle Scholar
  46. 46.
    Presburger, M.: Über die Vollständigkeit eines gewissen Systems der Aritmethik ganzer Zahlen, in welchem die Addition als einzige Operation hervortritt. In: Comptes Rendus du premier Congrès des Mathématiciens des Pays slaves, Warsawa, pp. 92–101 (1929)Google Scholar
  47. 47.
    Pugh, W.: The Omega test: A fast and practical integer programming algorithm for dependence analysis. In: Supercomputing ’91: Proceedings of the 1991 ACM/IEEE Conference on Supercomputing, Albuquerque, New Mexico, pp. 4–13 (1991)Google Scholar
  48. 48.
    Reddy, C.R., Loveland, D.W.: Presburger arithmetic with bounded quantifier alternation. In: ACM STOC, pp. 320–325. ACM, New York (1978)Google Scholar
  49. 49.
    Revesz, P.: Quantifier-elimination for the first-order theory of boolean algebras with linear cardinality constraints. In: Proc. Advances in Databases and Information Systems (ADBIS’04). Lecture Notes in Computer Science, vol. 3255. Springer, Berlin Heidelberg New York (2004)Google Scholar
  50. 50.
    Ruess, H., Shankar, N.: Deconstructing Shostak. In: Proc. 16th IEEE LICS, Washington–Brussels–New York (2001)Google Scholar
  51. 51.
    Rugina, R.: Quantitative shape analysis. In: Static Analysis Symposium (SAS’04), Verona, Italy (2004)Google Scholar
  52. 52.
    Sagiv, M., Reps, T., Wilhelm, R.: Parametric shape analysis via 3-valued logic. ACM Trans. Program. Lang. Syst. 24(3), 217–298 (2002)CrossRefGoogle Scholar
  53. 53.
    Skolem, T.: Untersuchungen über die Axiome des Klassenkalküls and über “Produktations-und Summationsprobleme”, welche gewisse Klassen von Aussagen betreffen. Skrifter utgit av Vidnskapsselskapet i Kristiania, I, klasse, no. 3, Oslo (1919)Google Scholar
  54. 54.
    Thatcher, J.W., Wright, J.B.: Generalized finite automata theory with an application to a decision problem of second-order logic. Math. Syst. Theory 2(1), 57–81 (1968)CrossRefMathSciNetGoogle Scholar
  55. 55.
    Thomas, W.: Languages, automata, and logic. In: Handbook of Formal Languages Vol. 3: Beyond Words. Springer, Berlin Heidelberg New York (1997)Google Scholar
  56. 56.
    Tinelli, C., Zarba, C.: Combining non-stably infinite theories. J. Autom. Reason. 34(3), 209–238 (2005)CrossRefGoogle Scholar
  57. 57.
    Tiwari, A.: Decision procedures in automated deduction. Ph.D. thesis, Department of Computer Science, State University of New York at Stony Brook (2000)Google Scholar
  58. 58.
    Voronkov, A.: The anatomy of Vampire (implementing bottom-up procedures with code trees). J. Autom. Reason. 15(2), 237–265 (1995)CrossRefMathSciNetGoogle Scholar
  59. 59.
    Weidenbach, C.: Combining superposition, sorts and splitting. In: Robinson, A., Voronkov, A. (eds.) Handbook of Automated Reasoning, vol. 2, Chapt. 27, pp. 1965–2013. Elsevier Science, Amsterdam (2001)Google Scholar
  60. 60.
    Yorsh, G., Reps, T., Sagiv, M.: Symbolically computing most-precise abstract operations for shape analysis. In: Proceedings of 10th TACAS. Springer, Berlin Heidelberg New York (2004)Google Scholar
  61. 61.
    Zarba, C.G.: The combination problem in automated reasoning. Ph.D. thesis, Stanford University (2004a)Google Scholar
  62. 62.
    Zarba, C.G.: Combining sets with elements. In: Dershowitz, N. (ed.) Verification: Theory and Practice. Lecture Notes in Computer Science, vol 2772, pp. 762–782. Springer, Berlin Heidelberg New York (2004b)Google Scholar
  63. 63.
    Zarba, C.G.: A quantifier elimination algorithm for a fragment of set theory involving the cardinality operator. In: 18th International Workshop on Unification (2004c)Google Scholar
  64. 64.
    Zarba, C.G.: Combining sets with cardinals. J. Autom. Reason. 34(1), 1–29 (2005)CrossRefMathSciNetGoogle Scholar
  65. 65.
    Zhang, L., Malik, S.: Conflict driven learning in a quantified Boolean satisfiability solver. In: ICCAD ’02: Proceedings of the IEEE/ACM International Conference on Computer-Aided Design, pp. 442–449. New York, USA (2002)Google Scholar

Copyright information

© Springer Science+Business Media, Inc. 2006

Authors and Affiliations

  • Viktor Kuncak
    • 1
  • Huu Hai Nguyen
    • 2
  • Martin Rinard
    • 1
    • 2
  1. 1.MIT Computer Science and Artificial Intelligence LaboratoryCambridgeUSA
  2. 2.Singapore-MIT AllianceSingaporeSingapore

Personalised recommendations