SMT-based Constraint Answer Set Solver EZSMT+

Constraint answer set programming integrates answer set programming with constraint processing. System EZSMT+ is a constraint answer set programming tool that utilizes satisfiability modulo theory solvers for search. Its theoretical foundation lies on generalizations of Niemela's characterization of answer sets of a logic program via so called level rankings.



There are no comments yet.


page 1

page 2

page 3

page 4


Constraint Answer Set Programming: Integrational and Translational (or SMT-based) Approaches

Constraint answer set programming or CASP, for short, is a hybrid approa...

Fages' Theorem and Answer Set Programming

We generalize a theorem by Francois Fages that describes the relationshi...

The CIFF Proof Procedure for Abductive Logic Programming with Constraints: Theory, Implementation and Experiments

We present the CIFF proof procedure for abductive logic programming with...

Translating Answer-Set Programs into Bit-Vector Logic

Answer set programming (ASP) is a paradigm for declarative problem solvi...

Automated Aggregator – Rewriting with the Counting Aggregate

Answer set programming is a leading declarative constraint programming p...

aspcud: A Linux Package Configuration Tool Based on Answer Set Programming

We present the Linux package configuration tool aspcud based on Answer S...

Shared aggregate sets in answer set programming

Aggregates are among the most frequently used linguistic extensions of a...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Answer set programming (ASP) is a declarative programming paradigm for solving difficult combinatorial search problems [6]. 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, 22, 16] proposed an alternative approach that utilizes satisfiability modulo theory (SMT) solvers [4] in design of CASP systems.

System ezsmt [22] 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 [8]. 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 [19], where the author characterizes solutions of non-tight “normal” programs in terms of level rankings. Lierler and Susman generalized these concepts to programs including such commonly used ASP features as choice rules and denials [16]. Lierler and Susman 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 [16]. The developed mappings generalize the ones presented by Niemela [19]. 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 [17] and cmodels [15]. In place of designing specialized search procedures targeting logic programs, these tools compute a program’s completion and utilize Satisfiability solvers [12] – 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 [17]) to weed out such models. SMT solvers [4] 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 [3] – 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. [13]. 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 1: cmodels(diff) Architecture

Figure 2.2 illustrates the pipeline architecture of cmodels(diff) 111cmodels(diff) is posted at . It is an extension of the cmodels [15] 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 [15]. 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 [5], z3 [23] and yices [7], 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+

Figure 2: ezsmt+ Architecture

We utilize the cmodels(diff) system to build the extension ezsmt+ 222ezsmt+ is available at . 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 [8]. 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 [20] and ezcsp [2]. The experimental results are presented in the paper [21]. 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 [9] 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 [10] 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 [18] in place of smt-lib.


  • [1] 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).
  • [2] Balduccini, M., Lierler, Y.: Ezcsp. (2017), [Accessed: 2018]
  • [3] Barrett, C., Fontaine, P., Tinelli, C.: The SMT-LIB Standard: Version 2.5. Tech. rep., The University of Iowa (2015)
  • [4] Barrett, C., Tinelli, C.: Satisfiability modulo theories. In: Clarke, E., Henzinger, T., Veith, H. (eds.) Handbook of Model Checking. Springer (2014)
  • [5] Barrett, C., Tinelli, C., et al.: Cvc4. (2014), [Accessed: 2018]
  • [6] Brewka, G., Eiter, T., Truszczyński, M.: Answer set programming at a glance. Communications of the ACM 54(12), 92–103 (2011)
  • [7] Dutertre, B.: yices. (2017), [Accessed: 2018]
  • [8] Fages, F.: Consistency of Clark’s completion and existence of stable models. Journal of Methods of Logic in Computer Science 1, 51–60 (1994)
  • [9] Fu, Z., Malik, S.: On solving the partial max-sat problem. In: SAT (2006)
  • [10] 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),
  • [11] Gebser, M., Ostrowski, M., Schaub, T.: Constraint answer set solving. In: Proceedings of 25th International Conference on Logic Programming. pp. 235–249. Springer (2009)
  • [12] 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)
  • [13] 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)
  • [14]

    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)

  • [15] Lierler, Y.: SAT-based Answer Set Programming. Ph.D. thesis, University of Texas at Austin (2010)
  • [16] 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)
  • [17] Lin, F., Zhao, Y.: Assat: Computing answer sets of a logic program by sat solvers. Artificial Intelligence 157, 115–137 (2004)
  • [18] 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)
  • [19] Niemela, I.: Stable models and difference logic. Annals of Mathematics and Artificial Intelligence 53, 313–329 (2008)
  • [20] Ostrowski, M.: Clingcon. (2017), [Accessed: 2018]
  • [21] Shen, D., Lierler, Y.: Smt-based constraint answer set solver ezsmt+ for non-tight programs. In: KR (2018)
  • [22] 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)
  • [23] Wintersteiger, C.M., Bjørner, N., de Moura, L.: Z3. (2016), [Accessed: 2018]