Approximate Counting in SMT and Value Estimation for Probabilistic Programs
This addresses the need for efficient approximate counting in SMT for applications like quantitative information flow and probabilistic program analysis, representing an incremental improvement.
The paper tackles the hard problem of approximate model counting in SMT theories by reducing it to SMT queries, resulting in algorithms that run in polynomial time with formal error bounds and are applied to estimate values in probabilistic programs.
#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.