Mini programs from Addition Exercises for Chapter 2 encoded in SPARC.
Run them to get their answer sets.
1.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a).
q(b).
q(X) :- p(X).
2.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a).
p(b).
q(X) :- p(X).
3.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a) | p(b).
q(X) :- p(X).
4.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a) | -p(b).
q(X) :- p(X).
5.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a).
p(b).
q(X) :- p(X).
:- q(a).
6.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a) | p(b).
q(X) :- p(X).
:- q(a).
7.
sorts
#generic = {a,b}.
predicates
p(#generic).
q(#generic).
rules
p(a) | p(b).
p(a) :- p(b).