Approximate Counting in SMT and Value Estimation for Probabilistic Programs

  • Dmitry Chistikov
  • Rayna Dimitrova
  • Rupak Majumdar
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9035)

Abstract

#SMT, or model counting for logical theories, is a well-known hard problem that generalizes such tasks as counting the number of satisfying assignments to a Boolean formula and computing the volume of a polytope. In the realm of satisfiability modulo theories (SMT) there is a growing need for model counting solvers, coming from several application domains (quantitative information flow, static analysis of probabilistic programs). In this paper, we show a reduction from an approximate version of #SMT to SMT.

We focus on the theories of integer arithmetic and linear real arithmetic. We propose model counting algorithms that provide approximate solutions with formal bounds on the approximation error. They run in polynomial time and make a polynomial number of queries to the SMT solver for the underlying theory, exploiting “for free” the sophisticated heuristics implemented within modern SMT solvers. We have implemented the algorithms and used them to solve a value estimation problem for a model of loop-free probabilistic programs with nondeterminism.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Barvinok, A.: A polynomial time algorithm for counting integral points in polyhedra when the dimension is fixed. In: FOCS 1993. ACM (1993)Google Scholar
  2. 2.
    Bellare, M., Goldreich, O., Petrank, E.: Uniform generation of NP-witnesses using an NP-oracle. Inf. Comput. 163(2), 510–526 (2000)CrossRefMATHMathSciNetGoogle Scholar
  3. 3.
    Borges, M., Filieri, A., d’Amorim, M., Pasareanu, C., Visser, W.: Compositional solution space quantification for probabilistic software analysis. In: PLDI, p. 15. ACM (2014)Google Scholar
  4. 4.
    Chaganty, A., Nori, A., Rajamani, S.: Efficiently sampling probabilistic programs via program analysis. In: AISTATS. JMLR Proceedings, vol. 31, pp. 153–160. JMLR.org (2013)Google Scholar
  5. 5.
    Chakraborty, S., Fremont, D., Meel, K., Seshia, S., Vardi, M.: Distribution-aware sampling and weighted model counting for SAT. In: AAAI 2014, pp. 1722–1730 (2014)Google Scholar
  6. 6.
    Chakraborty, S., Meel, K.S., Vardi, M.Y.: A scalable and nearly uniform generator of SAT witnesses. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 608–623. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  7. 7.
    Chakraborty, S., Meel, K.S., Vardi, M.Y.: A scalable approximate model counter. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 200–216. Springer, Heidelberg (2013)CrossRefGoogle Scholar
  8. 8.
    Chistikov, D., Dimitrova, R., Majumdar, R.: Approximate counting in SMT and value estimation for probabilistic programs. CoRR, abs/1411.0659 (2014)Google Scholar
  9. 9.
    Claret, G., Rajamani, S.K., Nori, A.V., Gordon, A.D., Borgström, J.: Bayesian inference using data flow analysis. In: ESEC/FSE 2013, pp. 92–102 (2013)Google Scholar
  10. 10.
    De Moura, L., Bjørner, N.S.: Z3: An efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  11. 11.
    Dyer, M., Frieze, A.: On the complexity of computing the volume of a polyhedron. SIAM J. Comput. 17(5), 967–974 (1988)CrossRefMATHMathSciNetGoogle Scholar
  12. 12.
    Dyer, M., Frieze, A., Kannan, R.: A random polynomial time algorithm for approximating the volume of convex bodies. J. ACM 38(1), 1–17 (1991)CrossRefMATHMathSciNetGoogle Scholar
  13. 13.
    Ermon, S., Gomes, C., Sabharwal, A., Selman, B.: Taming the curse of dimensionality: Discrete integration by hashing and optimization. In: ICML (2), pp. 334–342 (2013)Google Scholar
  14. 14.
    Filieri, A., Pasareanu, C., Visser, W.: Reliability analysis in symbolic Pathfinder. In: ICSE, pp. 622–631 (2013)Google Scholar
  15. 15.
    Fredrikson, M., Jha, S.: Satisfiability modulo counting: A new approach for analyzing privacy properties. In: CSL-LICS, p. 42. ACM (2014)Google Scholar
  16. 16.
    Gomes, C., Hoffmann, J., Sabharwal, A., Selman, B.: From sampling to model counting. In: IJCAI, pp. 2293–2299 (2007)Google Scholar
  17. 17.
    Gomes, C., Sabharwal, A., Selman, B.: Model counting. In: Handbook of Satisfiability. Frontiers in Artificial Intelligence and Applications, vol. 185, pp. 633–654. IOS Press (2009)Google Scholar
  18. 18.
    Gordon, A., Henzinger, T., Nori, A., Rajamani, S., Samuel, S.: Probabilistic programming. In: FOSE 2014, pp. 167–181. ACM (2014)Google Scholar
  19. 19.
    Hur, C.-K., Nori, A., Rajamani, S., Samuel, S.: Slicing probabilistic programs. In: PLDI, p. 16. ACM (2014)Google Scholar
  20. 20.
    Jerrum, M., Sinclair, A.: The Markov chain Monte Carlo method: An approach to approximate counting and integration. In: Approximation Algorithms for NP-hard Problems, pp. 482–520. PWS Publishing (1996)Google Scholar
  21. 21.
    Jerrum, M., Valiant, L., Vazirani, V.: Random generation of combinatorial structures from a uniform distribution. TCS 43, 169–188 (1986)CrossRefMATHMathSciNetGoogle Scholar
  22. 22.
    Kiselyov, O., Shan, C.-C.: Monolingual probabilistic programming using generalized coroutines. In: UAI, pp. 285–292. AUAI Press (2009)Google Scholar
  23. 23.
  24. 24.
    Luckow, K.S., Pasareanu, C.S., Dwyer, M.B., Filieri, A., Visser, W.: Exact and approximate probabilistic symbolic execution for nondeterministic programs. In: ASE 2014, pp. 575–586 (2014)Google Scholar
  25. 25.
    Luu, L., Shinde, S., Saxena, P., Demsky, B.: A model counter for constraints over unbounded strings. In: PLDI, p. 57. ACM (2014)Google Scholar
  26. 26.
    Ma, F., Liu, S., Zhang, J.: Volume computation for boolean combination of linear arithmetic constraints. In: Schmidt, R.A. (ed.) CADE 2009. LNCS (LNAI), vol. 5663, pp. 453–468. Springer, Heidelberg (2009)Google Scholar
  27. 27.
    Sampson, A., Panchekha, P., Mytkowicz, T., McKinley, K., Grossman, D., Ceze, L.: Expressing and verifying probabilistic assertions. In: PLDI, p. 14. ACM Press (2014)Google Scholar
  28. 28.
    Sankaranarayanan, S., Chakarov, A., Gulwani, S.: Static analysis for probabilistic programs: inferring whole program properties from finitely many paths. In: PLDI, pp. 447–458. ACM (2013)Google Scholar
  29. 29.
    Selvin, S.: A problem in probability. American Statistician 29(1), 67 (1975)CrossRefGoogle Scholar
  30. 30.
    Sipser, M.: A complexity-theoretic approach to randomness. In: STOC, pp. 330–335. ACM (1983)Google Scholar
  31. 31.
    Stockmeyer, L.: On approximation algorithms for #P. SIAM J. of Computing 14, 849–861 (1985)CrossRefMATHMathSciNetGoogle Scholar
  32. 32.
    Urquhart, A.: Hard examples for resolution. J. ACM 34(1), 209–219 (1987)CrossRefMATHMathSciNetGoogle Scholar
  33. 33.
    Valiant, L.: The complexity of computing the permanent. Theoretical Computer Science 9, 189–201 (1979)CrossRefMathSciNetGoogle Scholar
  34. 34.
    Valiant, L., Vazirani, V.: NP is as easy as detecting unique solutions. Theoretical Computer Science 47, 85–93 (1986)CrossRefMATHMathSciNetGoogle Scholar
  35. 35.
    Zhou, M., He, F., Song, X., He, S., Chen, G., Gu, M.: Estimating the volume of solution space for satisfiability modulo linear real arithmetic. Theory of Computing Systems 56(2), 347–371 (2015)CrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2015

Authors and Affiliations

  • Dmitry Chistikov
    • 1
  • Rayna Dimitrova
    • 1
  • Rupak Majumdar
    • 1
  1. 1.Max Planck Institute for Software Systems (MPI-SWS)KaiserslauternGermany

Personalised recommendations