Counting solutions is a central task in mathematics and computer science. By counting, we can directly compute the probability of an event, making it fundamental to many application domains. However, often, we are interested in counting solutions only with respect to a "shown part" of the instance while still satisfying the "forgotten (hidden) part" called projected solution counting (PSC). In this paper, we introduce algorithms for PSC and a large variety of knowledge representation and reasoning (KRR) formalisms. Our algorithms employ small treewidth of the input instance, which yields polynomial-time solvability in the input size for instances of bounded treewidth. We obtain a generic result that allows lifting many existing given dynamic programming (DP) algorithms from decisions to PSC. Exemplarily, we present PSC for quantified Boolean formulas (QBFs), which is a canonical reasoning problem. Finally, we present computational lower bounds for various KRR formalisms where we cannot expect significant improvement for PSC assuming that the exponential-time hypothesis (ETH) holds.
Funding Agencies|Austrian Science Fund (FWF) [J 4656, P 32830]; Society for Research Funding in Lower Austria (GFF, Gesellschaft fur Forschungsforderung NO) [ExzF-0004]; Vienna Science and Technology Fund (WWTF) [ICT19-065]; ELLIIT - Swedish government