5

I got the following answer set programming problem but not sure if my answer is correct:

  • A(X) are normally E(X)
  • U(X) are normally not E(X)
  • G(X) are normally E(X)
  • Every G(X) is U(X)
  • U(X) are normally A(X)
  • G(t1)
  • G(t2) and not E(t2)
  • U(t3)

The following is my Clingo code:

  g(t1).
g(t2).
-e(t2). 
u(t3).
e(X) :- a(X), not -e(X).
-e(X) :- u(X), not e(X).
e(X) :- g(X), not -e(X).
u(X) :- g(X).
a(X) :- u(X), not -a(X).

clingo 0 pm.lp is :

    Reading from pm.lp
pm.lp:9:15-24: info: atom does not occur in any rule head:
  not (-a(X))

Solving...
Answer: 1
g(t1) g(t2) u(t3) -e(t2) u(t1) u(t2) a(t3) a(t1) a(t2) e(t3) e(t1)
Answer: 2
g(t1) g(t2) u(t3) -e(t2) u(t1) u(t2) a(t3) a(t1) a(t2) e(t3) -e(t1)
Answer: 3
g(t1) g(t2) u(t3) -e(t2) u(t1) u(t2) a(t3) a(t1) a(t2) -e(t3) e(t1)
Answer: 4
g(t1) g(t2) u(t3) -e(t2) u(t1) u(t2) a(t3) a(t1) a(t2) -e(t3) -e(t1)
SATISFIABLE

Not sure if my code is correct and complete?

Matt
  • 739
  • 2
  • 6
  • 10

0 Answers0