Page 1
Simple Random Logic Programs
Gayathri Namasivayam and Miros? law Truszczy´ nski
Department of Computer Science, University of Kentucky, Lexington, KY
40506-0046, USA
Abstract. We consider random logic programs with two-literal rules
and study their properties. In particular, we obtain results on the proba-
bility that random “sparse” and “dense” programs with two-literal rules
have answer sets. We study experimentally how hard it is to compute
answer sets of such programs. For programs that are constraint-free and
purely negative we show that the easy-hard-easy pattern emerges. We
provide arguments to explain that behavior. We also show that the hard-
ness of programs from the hard region grows quickly with the number of
atoms. Our results point to the importance of purely negative constraint-
free programs for the development of ASP solvers.
1Introduction
The availability of a simple model of a random CNF theory was one of the
enabling factors behind the development of fast satisfiability testing programs
— SAT solvers. The model constrains the length of each clause to a fixed integer,
say k, and classifies k-CNF theories according to their density, that is, the ratio
of the number of clauses to the number of atoms. k-CNF theories with low
densities have few clauses relative to the number of atoms. Thus, most of them
have many solutions, and solutions are easy to find. k-CNF theories with high
densities have many clauses relative to the number of atoms. Thus, most of
them are unsatisfiable. Moreover, due to the abundance of clauses, proofs of
contradiction are easy to find. As theories in low- and high-density regions are
“easy,” they played essentially no role in the development of SAT solvers.
There is, however, a narrow range of densities “in between,” called the phase
transition, where random k-CNF theories change rapidly from most being satis-
fiable to most being unsatisfiable. Somewhere in that narrow range is a value d
such that random k-CNF theories with density d are satisfiable with the proba-
bility 1/2. The problem of determining that value has received much attention.
For instance, for 3-CNF theories, the phase-transition density was found exper-
imentally to be about 4.25 [1]. A paper by Achlioptas discusses recent progress
on the problem, including some lower and upper bounds on the phase transition
value [2]. A key property of 3-CNF theories from the phase transition region
is that they are hard.1Thus, we have the easy-hard-easy difficulty pattern as
1It should be noted that the low- and high-density regions also contain challenging
theories, but they are relatively rare [3]).
Page 2
the function of density. Moreover, deciding satisfiability of programs from the
hard region is very hard indeed! Designing solvers that could solve random un-
satisfiable 3-CNF theories with 700 atoms generated from the phase-transition
region was one of grand challenges for SAT research posed by Selman, Kautz
and McAllester [4]. It resulted in major advances in SAT solver technology.
As in the case of the SAT research, work on random logic programs is likely
to lead to new insights into the properties of answer sets of programs, and lead
to advances in ASP solvers — software for computing them. Yet, the question
of models of random logic programs has received little attention so far, with the
work of Zhao and Lin [5] being a notable exception. Our objective is to propose
a model of simple random logic programs and investigate its properties.
As in SAT, we consider random programs with rules of the same length. For
the present study, we further restrict our attention to programs with two-literal
rules. These programs are simple, which facilitates theoretical studies. But de-
spite their simplicity, they are of considerable interest. First, every problem in
NP can be reduced in polynomial time to the problem of deciding the existence of
an answer set of a program of that type [6]. Second, many problems of interest
have a simple encoding in terms of such programs [7]. We study experimen-
tally and analytically properties of programs with two-literal rules. We obtain
results on the probability that random programs with two-literal rules, both
“sparse” and “dense,” have answer sets. We study experimentally how hard it is
to compute answer sets of such programs. We show that for programs that are
constraint-free and purely negative the easy-hard-easy pattern emerges. We give
arguments to explain that phenomenon, and show that the hardness of programs
from the hard region grows quickly with the number of atoms. Our results point
to the importance of constraint-free purely negative programs for the develop-
ment of ASP solvers, as they can serve as useful benchmarks when developing
good search heuristics. However, unlike in the case of SAT, depending on the
parameters of the model, we either do not observe the phase transition or, when
we do, it is gradual not sudden.
Even relatively small programs from the hard region are very hard for the
current generation of ASP solvers. Interestingly, that observation may also have
implications for the design of SAT solvers. If P is a purely negative program,
answer sets of P are models of its completion comp(P), a certain propositional
theory [8]. For programs with two-literal rules the completion is (essentially) a
CNF theory. Our experiments showed that these theories are very hard for the
present-day SAT solvers, despite the fact that most of their clauses are binary.
2Preliminaries
Logic programs consist of rules, that is, of expressions of the form
a ← b1,...,bm,not c1,...,not cn
(1)
and
← b1,...,bm,not c1,...,not cn, (2)
Page 13
of programs, namely those with sufficiently many constraints, a transition from
consistent to inconsistent programs can be observed (Zhao and Lin’s model shows
such transition, too). However, the transition is relatively slow.
References
1. Mitchell, D., Selman, B., Levesque, H.: Hard and easy distributions of SAT prob-
lems. In: Proceedings of AAAI-92, Los Altos, CA, American Association for Arti-
ficial Intelligence, Morgan Kaufmann (1992)
2. Achlioptas, D.: Random satisfiability. In Biere, A., Heule, M., van Maaren, H.,
Walsh, T., eds.: Handbook of Satisfiability. IOS Press (2009) 245–270
3. Gent, I., Walsh, T.: Easy problems are sometimes hard. Artificial Intelligence 70
(1994) 335–345
4. Selman, B., Kautz, H., McAllester, D.: Ten challenges in propositional reasoning
and search. In: Proceedings of the 15th International Joint Conference on Artificial
Inteligence, IJCAI-97, Morgan Kaufmann (1997) 50–54
5. Zhao, Y., Lin, F.: Answer set programming phase transition: a study on randomly
generated programs. In Palamidessi, C., ed.: Proceedings of the 19th International
Conference on Logic Programming, ICLP 2003. Volume 2916 of Lecture Notes in
Computer Science., Springer (2003) 239–253
6. Marek, W., Truszczy´ nski, M.: Autoepistemic logic. Journal of the ACM 38 (1991)
588–619
7. Huang, G.S., Jia, X., Liau, C.J., You, J.H.: Two-literal logic programs and satis-
fiability representation of stable models: a comparison. In: In Proceedings of the
15th Canadian Conference on AI. Volume 2338 of LNCS., Springer (2002) 119–131
8. Clark, K.: Negation as failure. In Gallaire, H., Minker, J., eds.: Logic and data
bases. Plenum Press, New York-London (1978) 293–322
9. Simons, P., Niemel¨ a, I., Soininen, T.:
model semantics. Artificial Intelligence 138 (2002) 181–234
10. Gebser, M., Kaufmann, B., Neumann, A., Schaub, T.: Clasp : A conflict-driven
answer set solver. In Baral, C., Brewka, G., Schlipf, J., eds.: Logic Programming
and Nonmonotonic Reasoning, 9th International Conference, LPNMR 2007, Pro-
ceedings. Volume 4483 of LNCS., Springer (2007) 260–265
11. Leone, N., Pfeifer, G., Faber, W., Eiter, T., Gottlob, G., Perri, S., Scarcello, F.:
The dlv system for knowledge representation and reasoning. ACM Transactions
on Computational Logic 7(3) (2006) 499–562
12. Lin, F., Zhao, Y.: ASSAT: Computing answer sets of a logic program by SAT
solvers. In: Proceedings of the 18th National Conference on Artificial Intelligence
(AAAI 2002), AAAI Press (2002) 112–117
13. Lierler, Y., Maratea, M.: Cmodels-2: Sat-based answer set solver enhanced to
non-tight programs. In: Proceedings of LPNMR-04. LNCS (2004) 346–350
14. Bollob´ as, B.: Random Graphs. Academic Press (1985)
15. Janson, S., Luczak, T., Ruci´ nski, A.: Random Graphs. Wiley-Interscience (2000)
16. de la Vega, W.F.: Kernels in random graphs. Discrete Math. 82 (1990) 213–217
17. Janhunen, T.: Representing normal programs with clauses. In de M´ antaras, R.L.,
Saitta, L., eds.: Proceedings of the 16th Eureopean Conference on Artificial Intel-
ligence, ECAI’2004, IOS Press (2004) 358–362
18. Fages, F.: Consistency of Clark’s completion and existence of stable models. Jour-
nal of Methods of Logic in Computer Science 1 (1994) 51–60
Extending and implementing the stable
Page 14
19. E´ en, N., S¨ orensson, N.: An extensible SAT solver. In: Theory and Applications
of Satisfiability Testing, 6th International Conference, SAT-2003. Volume 2919 of
LNCS., Springer (2003) 502–518
20. Wong, D., Schlipf, J., Truszczy´ nski, M.: On the distribution of programs with stable
models. Unpublished, presented at the Dagstuhl Seminar 05171, Nonmonotonic
Reasoning, Answer Set Programming and Constraints (2005)