diff-SAT -- A Software for Sampling and Probabilistic Reasoning for SAT and Answer Set Programming
aa r X i v : . [ c s . A I] J a n diff-SAT - A Software for Sampling and ProbabilisticReasoning for SAT and Answer Set Programming Matthias Nickles
School of Computer ScienceNational University of Ireland, [email protected]
Abstract
This paper describes diff-SAT, an Answer Set and SAT solver which com-bines regular solving with the capability to use probabilistic clauses, facts andrules, and to sample an optimal world-view (multiset of satisfying Booleanvariable assignments or answer sets) subject to user-provided probabilisticconstraints. The sampling process minimizes a user-defined differentiable ob-jective function using a gradient descent based optimization method calledDifferentiable Satisfiability Solving ( ∂ SAT) respectively Differentiable An-swer Set Programming ( ∂ ASP). Use cases are i.a. probabilistic logic pro-gramming (in form of Probabilistic Answer Set Programming), ProbabilisticBoolean Satisfiability solving (PSAT), and distribution-aware sampling ofmodel multisets (answer sets or Boolean interpretations).
Keywords:
Boolean Satisfiability, Answer Set Programming, ProbabilisticSatisfiability, Probabilistic Programming, Gradient Descent
1. Introduction
Modern solvers for the Boolean Satisfiability Problem (SAT) are power-ful, versatile and fast tools for logical inference. SAT solvers underlie a largenumber of other optimization and reasoning approaches as well as industryapplications, for example many constraint programming and SatisfiabilityModulo Theories (SMT) solvers, bounded model checking, package man-agers, hardware and software verification tools, crypto-analysis, and plan-ning and scheduling approaches [13, 8, 9]. Answer Set Programming (ASP)[5] is a form of logic programming (with syntax similar to Prolog and Data-log) which is closely related to SAT solving and oriented primarily towardsP-hard search and combinatorial problems.Regular SAT and Answer Set solvers do not have the capability to han-dle or reason about probabilistic knowledge, or to sample multisets of modelsgoverned by specific probability distributions. diff-SAT (formerly named del-SAT) is an open source SAT and ASP solver which has those capabilities.diff-SAT is programmed in Scala and runs on any contemporary standardJava VM. Its solver core incorporates modern SAT solving techniques such asCDCL (Conflict-Driven Clause Learning)-style solving, Glucose-style restartpolicy [1], adaptive branching heuristics, rephasing, and parallel portfoliosolving in multi-core environments.Symbolic knowledge can be provided in various formats, including Booleanformulas in CNF and logic programs in Answer Set Programming (ASP) in-termediate format (obtained from an ASP grounder). Soft constraints can beprovided by attaching probabilities to clauses, facts or rules, or by specify-ing differentiable objective functions directly as mathematical expressions.In contrast to most existing logic programming approaches, probabilisticdatabases and approaches based on a reduction to Weighed Model Counting[3], diff-SAT does not require any independence assumptions about proba-bilistic variables. Compared to Markov Logic Networks [12] (the arguablymost popular probabilistic logic), diff-SAT allows for probabilistic logic pro-gramming and has thus the ability to deal with inductive definitions andto use probabilities directly as weights despite being able to model complexinterdependencies.diff-SAT’s output is a multiset of models (if the given problem has a solution)corresponding to a probability distribution over possible worlds, allowing forprobabilistic inference in the usual way.On the technical level, diff-SAT achieves its functionality by finding op-timal distributions of entire multi-sets of satisfying models (related to theconcept of “worldviews” in epistemic logic programming [6]). An incremen-tal sampling process minimizes a user-defined objective function (loss func-tion) over symbol statistics in model multisets using a gradient descent-basedbranching literal selection approach called Differentiable Satisfiability Solvingrespectively Differentiable Answer Set Programming [10, 11] ( ∂ SAT , ∂
ASP).Probabilistic annotations of logical items like clauses or rules can be au-tomatically translated into such differentiable functions. Multi-models opti-mization could be stylized as a form of model optimization where the optimalmodel is a meta-model which comprises multiple models, but diff-SAT avoids2his stylization as it would require clunky techniques like model reification.Remark: Multi-models optimization should not be confused with other op-timization types involving multiple models, such as the concurrent discoveryof several optimal models.In contrast to existing approaches to ASP- or SAT-based optimizationsuch as MaxWalkSAT for Weighted MaxSAT solving [7], the differentiableobjective function evaluates and optimizes statistics over an entire multiset ofmodels instead of finding an optimal single model which is optimal wrt. thesum of the weights of satisfied soft constraints (soft clauses). Compared toother SAT sampling approaches, in particular [2], diff-SAT samples multiplemodels using a form of gradient descent until a given minimization thresholdof the objective function has been reached. Clauses can be attached proba-bilities directly instead of non-normalized weights. Note that diff-SAT is nota Stochastic Local Search (SLS) solver but a complete solver (i.e., a solverwhich returns UNSAT if the input formula is not satisfiable) with probabilis-tic optimization features.A more detailed description of diff-SAT’s algorithm and comparison withfurther related approaches can be found in [11, 10].
2. Functionality and Input
Notwithstanding being based on a single, relatively simple technical prin-ciple ( ∂ SAT / ∂
ASP), diff-SAT goes beyond regular SAT/ASP solving byproviding a wide range of additional use cases (besides plain SAT and ASPsolving), including probabilistic SAT (PSAT), Probabilistic Answer Set Pro-gramming (PrASP), and distribution-dependent model sampling where afamily of target distributions can be specified by differentiable objective func-tions of the form described in the previous section.diff-SAT is open source. The source code, recent releases and documentationcan be found at https://github.com/MatthiasNickles/diff-SAT .Features include:- Parallel portfolio ASP and SAT solving based on Conflict-Driven No-good Learning (CDNL), a variant of CDCL)- Runs on the JVM (Java 1.8 or higher)- Model sampling as randomized, gradient-steered search for optimalmultisets of models (answer sets respectively Boolean assignments)3 Objective functions are arbitrary differentiable functions over atomfrequencies in models, allowing for, e.g., probabilistic atoms (clauses,rules) and probabilistic inference, i.e., computation of the probabilitiesof logical query formulas.- A range of alternative input formats, including for Probabilistic SATand Probabilistic Answer Set Programming. See below for the completelist of supported formats.- User API for working with probabilistic and non-probabilistic clauseand rule sets- Direct support for basic non-ground ASP rules (unrestricted non-groundanswer set programs can also be used, but that requires a precedinggrounding step using a grounder such as Gringo or Clingo [4], as usualwith Answer Set solvers)Input is accepted in various standard as well as non-standard forms(where no commonly accepted format exists yet, in particular in the areaof probabilistic input):- DIMACS CNF (for regular SAT solving)- Probabilistic DIMACS CNF (PCNF) where each clause can optionallybe annotated with a probability to turn it into a soft clause- Enhanced DIMACS CNF with a list of parameter atoms and objectivefunction terms appended to the DIMACS part- ASP Intermediate Format (ASPIF), optionally extended with parame-ter atoms and objective function terms defined using special predicates- Enhanced ASPIF format with a list of parameter atoms and objectivefunction terms appended to the ASPIF part- Probabilistic ASP Intermediate Format (PASPIF) which enhances AS-PIF standard format with optional rule probabilitiesdiff-SAT’s output for satisfiable problems is a multiset of models (possibleworlds) where the normalized count of a model represents its probability.The probabilities of individual clauses, facts or rules can be obtained using asimple subsequent filtering and counting step as in most other probabilisticlogic programming approaches, but diff-SAT can optionally perform this stepitself for user-specified query clauses, facts and rules.4 ode metadataNr. Code metadata description
C1 Current code version 0.5.2C2 Link to code/repository used for thiscode version https://github.com/MatthiasNickles/diff-SAT
C4 Code License MITC5 Code versioning system used gitC6 Software code languages, tools, andservices used Scala, Java, JVMC7 Compilation requirements, operat-ing environments & dependencies JDK 1.8+ (e.g., OpenJDK), SBT orMavenC8 If available link to developer docu-mentation/manual https://github.com/MatthiasNickles/diff-SAT
C9 Support email for questions (see author contact details)
Table 1: Code metadata
References [1] Gilles Audemard and Laurent Simon. Predicting learnt clauses quality inmodern sat solvers.
IJCAI International Joint Conference on ArtificialIntelligence , pages 399–404, 07 2009.[2] Supratik Chakraborty, Daniel J. Fremont, Kuldeep S. Meel, Sanjit A.Seshia, and Moshe Y. Vardi. Distribution-aware sampling and weightedmodel counting for SAT. In Carla E. Brodley and Peter Stone, edi-tors,
Proceedings of the Twenty-Eighth AAAI Conference on ArtificialIntelligence, July 27 -31, 2014, Qu´ebec City, Qu´ebec, Canada , pages1722–1730. AAAI Press, 2014.[3] Mark Chavira and Adnan Darwiche. On probabilistic inference byweighted model counting.
Artificial Intelligence , 172(6):772 – 799, 2008.[4] Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and TorstenSchaub.
Answer Set Solving in Practice . Synthesis Lectures on Artifi-cial Intelligence and Machine Learning. Morgan & Claypool Publishers,2012.[5] M. Gelfond and V. Lifschitz. The stable model semantics for logic pro-gramming. In
Proc. of the 5th Int’l Conference on Logic Programming ,volume 161, 1988. 56] Patrick Thor Kahl and Anthony P. Leclerc. Epistemic Logic Programswith World View Constraints. In Alessandro Dal Palu’, Paul Tarau,Neda Saeedloei, and Paul Fodor, editors,
Technical Communications ofthe 34th International Conference on Logic Programming (ICLP 2018) ,volume 64 of
OpenAccess Series in Informatics (OASIcs) , pages 1:1–1:17, Dagstuhl, Germany, 2018. Schloss Dagstuhl–Leibniz-Zentrum fuerInformatik.[7] Henry Kautz, Bart Selman, and Yueyen Jiang. A general stochasticapproach to solving problems with hard and soft constraints. In
TheSatisfiability Problem: Theory and Applications , pages 573–586. Ameri-can Mathematical Society, 1996.[8] Fr´ed´eric Lafitte, Jorge Nakahara, and D. Heule. Applications of satsolvers in cryptanalysis: Finding weak keys and preimages.
Journal onSatisfiability, Boolean Modeling and Computation , 9:1–25, 08 2014.[9] Joao Marques-Silva. Practical applications of boolean satisfiability. In , pages 74 – 80,06 2008.[10] Matthias Nickles. Differentiable SAT/ASP. In Elena Bellodi and TomSchrijvers, editors,
Proceedings of the 5th International Workshop onProbabilistic Logic Programming, PLP 2018, co-located with the 28thInternational Conference on Inductive Logic Programming (ILP 2018),Ferrara, Italy, September 1, 2018 , volume 2219 of
CEUR WorkshopProceedings , pages 62–74. CEUR-WS.org, 2018.[11] Matthias Nickles. Sampling-based SAT/ASP multi-model optimizationas a framework for probabilistic inference. In Fabrizio Riguzzi, ElenaBellodi, and Riccardo Zese, editors,
Inductive Logic Programming -28th International Conference, ILP 2018, Ferrara, Italy, September 2-4,2018, Proceedings , volume 11105 of
Lecture Notes in Computer Science ,pages 88–104. Springer, 2018.[12] Matthew Richardson and Pedro Domingos. Markov logic networks.