Approximate counting in SMT and value estimation for probabilistic programs

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 the value problem for a model of loop-free probabilistic programs with nondeterminism.

[1]  Christos H. Papadimitriou,et al.  Games against nature , 1983, 24th Annual Symposium on Foundations of Computer Science (sfcs 1983).

[2]  Sanjit A. Seshia,et al.  Distribution-Aware Sampling and Weighted Model Counting for SAT , 2014, AAAI.

[3]  Guy Van den Broeck,et al.  Hashing-Based Approximate Probabilistic Inference in Hybrid Domains , 2015, UAI.

[4]  Mark Jerrum,et al.  The Markov chain Monte Carlo method: an approach to approximate counting and integration , 1996 .

[5]  Leonid A. Levin,et al.  Pseudo-random Generation from one-way functions (Extended Abstracts) , 1989, STOC 1989.

[6]  Dexter Kozen,et al.  Semantics of probabilistic programs , 1979, 20th Annual Symposium on Foundations of Computer Science (sfcs 1979).

[7]  Oded Goldreich,et al.  Computational complexity: a conceptual perspective , 2008, SIGA.

[8]  Catuscia Palamidessi,et al.  Making Random Choices Invisible to the Scheduler , 2007, CONCUR.

[9]  Patrick Cousot,et al.  Probabilistic Abstract Interpretation , 2012, ESOP.

[10]  Thomas A. Henzinger,et al.  Probabilistic programming , 2014, FOSE.

[11]  Dan Grossman,et al.  Expressing and verifying probabilistic assertions , 2014, PLDI.

[12]  Leslie G. Valiant,et al.  NP is as easy as detecting unique solutions , 1985, STOC '85.

[13]  Supratik Chakraborty,et al.  A Scalable and Nearly Uniform Generator of SAT Witnesses , 2013, CAV.

[14]  J. Lawrence Polytope volume computation , 1991 .

[15]  Dorit S. Hochbaum,et al.  Approximation Algorithms for NP-Hard Problems , 1996 .

[16]  Nir Friedman,et al.  Probabilistic Graphical Models - Principles and Techniques , 2009 .

[17]  Annabelle McIver,et al.  Linear-Invariant Generation for Probabilistic Programs: - Automated Support for Proof-Based Methods , 2010, SAS.

[18]  J. Filar,et al.  Competitive Markov Decision Processes , 1996 .

[19]  Min Zhou,et al.  Estimating the Volume of Solution Space for Satisfiability Modulo Linear Real Arithmetic , 2014, Theory of Computing Systems.

[20]  Martin E. Dyer,et al.  A random polynomial-time algorithm for approximating the volume of convex bodies , 1991, JACM.

[21]  Rupak Majumdar,et al.  Approximate Counting in SMT and Value Estimation for Probabilistic Programs , 2015, TACAS.

[22]  David Monniaux,et al.  Abstract interpretation of programs as Markov decision processes , 2003, Sci. Comput. Program..

[23]  Mate Soos,et al.  Enhanced Gaussian Elimination in DPLL-based SAT Solvers , 2010, POS@SAT.

[24]  Annabelle McIver,et al.  Abstraction, Refinement and Proof for Probabilistic Systems , 2004, Monographs in Computer Science.

[25]  Corina S. Pasareanu,et al.  Reliability analysis in Symbolic PathFinder , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[26]  Chung-chieh Shan,et al.  Monolingual Probabilistic Programming Using Generalized Coroutines , 2009, UAI.

[27]  Alexander I. Barvinok,et al.  A Polynomial Time Algorithm for Counting Integral Points in Polyhedra when the Dimension Is Fixed , 1993, FOCS.

[28]  Michael Sipser,et al.  A complexity theoretic approach to randomness , 1983, STOC.

[29]  Sheng Liu,et al.  Volume Computation for Boolean Combination of Linear Arithmetic Constraints , 2009, CADE.

[30]  Jörg Hoffmann,et al.  From Sampling to Model Counting , 2007, IJCAI.

[31]  V. Klee Can the Measure of ∪ n 1 [ a i , b i ] be Computed in Less Than O(n logn) Steps? , 1977 .

[32]  David Rudd,et al.  A Problem in Probability. , 1974 .

[33]  Bart Selman,et al.  Model Counting , 2021, Handbook of Satisfiability.

[34]  Supratik Chakraborty,et al.  A Scalable Approximate Model Counter , 2013, CP.

[35]  Mihir Bellare,et al.  Uniform Generation of NP-Witnesses Using an NP-Oracle , 2000, Inf. Comput..

[36]  Martin E. Dyer,et al.  On the Complexity of Computing the Volume of a Polyhedron , 1988, SIAM J. Comput..

[37]  C. S. Jackson A Problem in Probability , 1913 .

[38]  Steven S. Muchnick,et al.  Advanced Compiler Design and Implementation , 1997 .

[39]  Leslie G. Valiant,et al.  Random Generation of Combinatorial Structures from a Uniform Distribution , 1986, Theor. Comput. Sci..

[40]  Shweta Shinde,et al.  A model counter for constraints over unbounded strings , 2014, PLDI.

[41]  Walter R. Gilks,et al.  A Language and Program for Complex Bayesian Modelling , 1994 .

[42]  Sriram K. Rajamani,et al.  Efficiently Sampling Probabilistic Programs via Program Analysis , 2013, AISTATS.

[43]  Andrew D. Gordon,et al.  Bayesian inference using data flow analysis , 2013, ESEC/FSE 2013.

[44]  Matthew B. Dwyer,et al.  Exact and approximate probabilistic symbolic execution for nondeterministic programs , 2014, ASE.

[45]  Adnan Darwiche,et al.  Modeling and Reasoning with Bayesian Networks , 2009 .

[46]  Claude Castelluccia,et al.  Extending SAT Solvers to Cryptographic Problems , 2009, SAT.

[47]  Supratik Chakraborty,et al.  Approximate Probabilistic Inference via Word-Level Counting , 2015, AAAI.

[48]  Leslie G. Valiant,et al.  The Complexity of Computing the Permanent , 1979, Theor. Comput. Sci..

[49]  Guy Van den Broeck,et al.  Probabilistic Inference in Hybrid Domains by Weighted Model Integration , 2015, IJCAI.

[50]  Chung-Kil Hur,et al.  Slicing probabilistic programs , 2014, PLDI.

[51]  Jie-Hong Roland Jiang,et al.  When Boolean Satisfiability Meets Gaussian Elimination in a Simplex Way , 2012, CAV.

[52]  Somesh Jha,et al.  Satisfiability modulo counting: a new approach for analyzing privacy properties , 2014, CSL-LICS.

[53]  Marcelo d'Amorim,et al.  Compositional solution space quantification for probabilistic software analysis , 2014, PLDI.

[54]  Alasdair Urquhart,et al.  Formal Languages]: Mathematical Logic--mechanical theorem proving , 2022 .

[55]  R. Durrett Probability: Theory and Examples , 1993 .

[56]  Nikolaj Bjørner,et al.  Z3: An Efficient SMT Solver , 2008, TACAS.

[57]  Bart Selman,et al.  Taming the Curse of Dimensionality: Discrete Integration by Hashing and Optimization , 2013, ICML.

[58]  Larry J. Stockmeyer,et al.  On Approximation Algorithms for #P , 1985, SIAM J. Comput..

[59]  Sumit Gulwani,et al.  Static analysis for probabilistic programs: inferring whole program properties from finitely many paths , 2013, PLDI.