An FPRAS and Polynomial-Time Uniform Sampler for Tree Automata

05/20/2020
by   Marcelo Arenas, et al.
0

In this work, we introduce the first fully polynomial time randomized approximation scheme (FPRAS) for counting the number of trees of size n accepted by a tree automaton, where n is given in unary, and the first polynomial time algorithm for sampling uniformly from this set of trees. Our results improve over the prior quasi-polynomial time randomized approximation scheme (QPRAS) and sampling algorithm of Gore, Jerrum, Kannan, Sweedyk, and Mahaney 97'. At the heart of our algorithm is a reduction to the problem of estimating the number of strings of length n accepted by a succinct non-deterministic finite automaton (NFA), which is an NFA where the transitions are labeled by succinctly encoded sets of symbols, whose sizes can be exponential in the encoding length. Assuming these sets of symbols can be efficiently sampled from, and their sizes approximated, we show that there is an FPRAS and polynomial time almost uniform sampler for succinct NFAs, which may be of independent interest. We demonstrate that, by applying our FPRAS for tree automata, we can obtain an FPRAS for many hitherto open problems in the fields of constraint satisfaction problems (CSPs), database systems, software verification, and knowledge compilation. Specifically, we obtain an FPRAS for counting solutions for CSPs that are acyclic or, more generally, that have bounded hypertree-width, which results in an FPRAS for counting the number of answers to conjunctive queries that are acyclic or which have bounded hypertree-width. Moreover, these results can be extended to unions of acyclic conjunctive queries, and to the more general class of unions of conjunctive queries with bounded hypertree-width. Finally, we also obtain FPRAS for the problems of counting the number of error threads in programs with nested call subroutines, and counting valid assignments to structured DNNF circuits.

READ FULL TEXT

Please sign up or login with your details

Forgot password? Click here to reset