SMT-based Constraint Answer Set Solver ezsmt+\setitemize
noitemsep \setitemizetopsep=0pt \setenumeratenoitemsep \setenumeratetopsep=0pt
Answer set programming (ASP) is a declarative programming paradigm for solving difficult combinatorial search problems . Constraint answer set programming (CASP) is a recent development, which integrates ASP with constraint processing. Often, this integration allows one to tackle a challenge posed by the grounding bottleneck. Originally, systems that process CASP programs rely on combining algorithms/solvers employed in ASP and constraint processing [11, 1]. Lee and Meng; Susman and Lierler; Lierler and Susman [14, 23, 16] proposed an alternative approach that utilizes satisfiability modulo theory (SMT) solvers  in design of CASP systems.
System ezsmt  is a representative of an SMT-based approach for tackling CASP programs. Based on experimental evidence, ezsmt often outperforms its peers. Yet, it has several limitations. For instance, it is unable to process a large class of logic programs called non-tight . This restriction does not allow users, for example, to express transitive closure succinctly. System ezsmt is also unable to handle optimization statements or enumerate multiple solutions to a problem. We extend ezsmt so that the described limitations are eliminated. We call the new system ezsmt+.
2 Work So far
2.1 Theoretical Foundations
To process non-tight programs, we utilize the extension of theory originally developed by Niemela , where the author characterizes solutions of non-tight “normal” programs in terms of level rankings. We generalized these concepts to programs including such commonly used ASP features as choice rules and denials . We also develop a mapping from a logic program to an SMT logic called smt(il) such that the models of a constructed smt(il) theory are in one-to-one correspondence with answer sets of the program . The developed mappings generalize the ones presented by Niemela . Thus, any SMT solver capable of processing smt(il) expressions can be used to find answer sets of logic programs. Such generalizations allow our system to tackle non-tight programs.
2.2 SMT-based Answer Set solver cmodels(diff)
In this work, we restricts our input to pure answer set programs, which can be either tight or non-tight. The cmodels(diff) system follows the tradition of answer set solvers such as assat  and cmodels . In place of designing specialized search procedures targeting logic programs, these tools compute a program’s completion and utilize Satisfiability solvers  – systems for finding satisfying assignments for propositional formulas – for search. Since not all models of a program’s completion are answer sets of a program, both assat and cmodels implement specialized procedures (based on loop formulas ) to weed out such models. SMT solvers  extend Satisfiability solvers. They process formulas that go beyond propositional logic and may contain, for example, integer linear expressions. The cmodels(diff) system utilizes this fact and translates a logic program into an SMT formula so that any model of this formula corresponds to an answer set of the program. It then uses SMT solvers for search. Unlike cmodels or assat, the cmodels(diff) system does not need an additional step to weed out unwanted models. Also, it utilizes smt-lib– a standard input language of SMT solvers  – to interface with these systems. This makes its architecture open towards new developments in the realm of SMT solving. There is practically no effort involved in incorporating a new SMT system into the cmodels(diff) implementation.
The theoretical foundation of the cmodels(diff) system lies on the generalizations of Niemela’s ideas described in section 2.1. In this sense, the cmodels(diff) system is a close relative of an earlier answer set solver lp2diff developed by Janhunen et al. . Yet, lp2diff only accepts programs of a very restricted form. For example, neither choice rules nor aggregate expressions are allowed. Solver cmodels(diff) permits such important modeling constructs in its input. Also, unlike lp2diff, the cmodels(diff) system is able to generate multiple solutions.
Figure 2.2 illustrates the pipeline architecture of cmodels(diff) 111cmodels(diff) is posted at https://www.unomaha.edu/college-of-information-science-and-technology/natural-language-processing-and-knowledge-representation-lab/software/cmodels-diff.php . It is an extension of the cmodels  system. The cmodels(diff) system takes an arbitrary (tight or non-tight) logic program in the language supported by cmodels as an input. These logic programs may contain such features as choice rules and aggregate expressions. The rules with these features are translated away by cmodels’ original algorithms . Our main contribution is block 2, where the cmodels(diff) system adds the corresponding level ranking formula if the program is not tight. After that, the transformer taken from ezsmt v1.1 is called to convert output from block 2 into smt-lib syntax. Finally, any SMT solvers supporting smt-lib, such as cvc4 , z3  and yices , can be called to compute solutions (that correspond to answer sets).
The cmodels(diff) system allows us to compute multiple answer sets. Currently, SMT solvers typically find only a single model. We design a process to enumerate all models. After computing an answer set of a program, the cmodels(diff) system invokes an SMT solver again by adding formulas encoding the fact that a newly computed model should be different from . This process is repeated until the pre-specified number of solutions is enumerated or it has been established that no more solutions exist.
2.3 SMT-based Constraint Answer Set solver ezsmt+
We utilize the cmodels(diff) system to build the extension ezsmt+ 222ezsmt+ is available at https://www.unomaha.edu/college-of-information-science-and-technology/natural-language-processing-and-knowledge-representation-lab/software/ezsmt.php . Figure 2 illustrates its architecture. The ezsmt+ system accepts an arbitrary (tight or non-tight) CASP program as input, and utilizes existing ASP tools for grounding and computing completion . Our main contribution is block 2, which produces corresponding formulas for a non-tight program. These formulas are a combination of the program’s completion and level ranking formulas. We find a way to set minimal upper bounds for level rankings in order to reduce search space. Then, the original ezsmt transformer is used to translate them into a text file written in smt-lib, and an SMT solver is called to find models of these formulas. The procedure used by ezsmt+ to compute multiple solutions is identical to that of cmodels(diff).
We benchmark ezsmt+ with eight problems. ezsmt+ is compared to state-of-the-art CASP solvers clingcon  and ezcsp . The experimental results are presented in the paper . They show that ezsmt+ is a viable tool for finding answer sets of CASP programs, and can solve some difficult instances where its peers time out. Utilizing different SMT solvers may improve the performance of ezsmt+ in the future.
The ezsmt+ system removes the inability to process non-tight input and enumerate multiple answer sets. It provides new capabilities towards utilizing declarative answer set programming paradigm for problems containing a wide variety of constraints including linear constraints over real numbers, mixed integer and real numbers, as well as nonlinear constraints. We believe that, by making clear the translation of arbitrary CASP logic programs to SMT, our work will boost the cross-fertilization between the two areas.
3 Future Work
In the future, we will extend ezsmt+ to allow processing of optimization statements. Using partial weighted maxSMT problems  is one potential approach. Yet, it requires theoretical work on connecting semantics of ASP and SMT constructs for optimizations.
The technique implemented by our systems for enumerating multiple answer sets of a program is basic. In the future we would like to adopt a nontrivial methods for model enumeration discussed in  to our settings.
The contributions of our work also open a door to the development of a novel constraint-based method in processing logic programs by producing intermediate output in minizinc  in place of smt-lib.
-  Balduccini, M., Lierler, Y.: Constraint answer set solver ezcsp and why integration schemas matter. Theory and Practice of Logic Programming 17(4), 462–515 (2017). https://doi.org/10.1017/S1471068417000102
-  Balduccini, M., Lierler, Y.: Ezcsp. http://www.mbal.tk/ezcsp/index.html (2017), [Accessed: 2018]
-  Barrett, C., Fontaine, P., Tinelli, C.: The SMT-LIB Standard: Version 2.5. Tech. rep., The University of Iowa (2015)
-  Barrett, C., Tinelli, C.: Satisfiability modulo theories. In: Clarke, E., Henzinger, T., Veith, H. (eds.) Handbook of Model Checking. Springer (2014)
-  Barrett, C., Tinelli, C., et al.: Cvc4. http://cvc4.cs.nyu.edu (2014), [Accessed: 2018]
-  Brewka, G., Eiter, T., Truszczyński, M.: Answer set programming at a glance. Communications of the ACM 54(12), 92–103 (2011)
-  Dutertre, B.: yices. http://yices.csl.sri.com/ (2017), [Accessed: 2018]
-  Fages, F.: Consistency of Clark’s completion and existence of stable models. Journal of Methods of Logic in Computer Science 1, 51–60 (1994)
-  Fu, Z., Malik, S.: On solving the partial max-sat problem. In: SAT (2006)
-  Gebser, M., Kaufmann, B., Neumann, A., Schaub, T.: Conflict-driven answer set enumeration. In: Proceedings of the 9th International Conference on Logic Programming and Nonmonotonic Reasoning. pp. 136–148. LPNMR’07, Springer-Verlag, Berlin, Heidelberg (2007), http://dl.acm.org/citation.cfm?id=1758481.1758496
-  Gebser, M., Ostrowski, M., Schaub, T.: Constraint answer set solving. In: Proceedings of 25th International Conference on Logic Programming. pp. 235–249. Springer (2009)
-  Gomes, C.P., Kautz, H., Sabharwal, A., Selman, B.: Satisfiability solvers. In: van Harmelen, F., Lifschitz, V., Porter, B. (eds.) Handbook of Knowledge Representation, pp. 89–134. Elsevier (2008)
-  Janhunen, T., Niemelä, I., Sevalnev, M.: Computing stable models via reductions to difference logic. In: Logic Programming and Nonmonotonic Reasoning. pp. 142–154. Springer Berlin Heidelberg (2009)
-  Lee, J., Meng, Y.: Answer set programming modulo theories and reasoning about continuous changes. In: Proceedings of the 23rd International Joint Conference on Artificial Intelligence (IJCAI-13), Beijing, China, August 3-9, 2013 (2013)
-  Lierler, Y.: SAT-based Answer Set Programming. Ph.D. thesis, University of Texas at Austin (2010)
-  Lierler, Y., Susman, B.: On relation between constraint answer set programming and satisfiability modulo theories. Theory and Practice of Logic Programming 17(4), 559–590 (2017)
-  Lin, F., Zhao, Y.: Assat: Computing answer sets of a logic program by sat solvers. Artificial Intelligence 157, 115–137 (2004)
-  Nethercote, N., Stuckey, P., Becket, R., Brand, S., Duck, G., , Tack, G.: Minizinc: Towards a standard cp modelling language. In: Proceedings of the 13th International Conference on Principles and Practice of Constraint Programming. pp. 529–543 (2007)
-  Niemela, I.: Stable models and difference logic. Annals of Mathematics and Artificial Intelligence 53, 313–329 (2008)
-  Ostrowski, M.: Clingcon. https://github.com/potassco/clingcon/releases/tag/v3.3.0 (2017), [Accessed: 2018]
-  Shen, D., Lierler, Y.: Smt-based answer set solver cmodels-diff (system description). In: Technical Communications of the 34th International Conference on Logic Programming (ICLP 2018) (2018)
-  Shen, D., Lierler, Y.: Smt-based constraint answer set solver ezsmt+ for non-tight programs. In: KR (2018)
-  Susman, B., Lierler, Y.: SMT-Based Constraint Answer Set Solver EZSMT (System Description). In: Technical Communications of the 32nd International Conference on Logic Programming (ICLP 2016). vol. 52, pp. 1:1–1:15 (2016)
-  Wintersteiger, C.M., Bjørner, N., de Moura, L.: Z3. https://github.com/Z3Prover/z3/releases/tag/z3-4.5.0 (2016), [Accessed: 2018]