CSc 8710, DDLP - Fall 2008
Exam 3: Take Home (Due: Tue, 9 December, 2008 - by midnight)
Electronic submission under assignment 6
NOTE: This exam should be done individually WITHOUT any collaboration. 
----------------------------------------------------------------------

(1) Compute the well-founded model (using its definition) for the 
    following program:

    a.
    c :- not b, a 
    b :- not c 
    e :- not d 
    f :- e 
    f :- not a 

    Show the values after each iteration.

(2) Consider the program:

    win(X) :- move(X,Y), NOT win(Y)

    a) For the EDB:

          {move(1,2), move(2,3), move(3,4), move(3,1)} 

       find the well-founded model by repeatedly making positive inferences and 
       looking for unfounded sets. Do not use the alternating fixpoint method.

    b) Adding an additional EDB fact, for the EDB:

          {move(1,2), move(2,3), move(3,4), move(3,1), move(4,5)} 

       find the well-founded model by the alternating fixpoint method.

(3) Consider the following program:

t(Z) :- t0(Z).
t(Z) :- g(X,Y,Z),t(X).
t(Z) :- g(X,Y,Z), not t(Y).

t0(1).
g(1,2,3).
g(2,5,4).
g(2,4,5).
g(5,3,6).
g(1,2,4).

Transform it into a logic program which contains "plus" and "minus" predicates
for each predicate such that the bottom-up computation of the transformed 
program generates the "Fitting" semantics using the paraconsistent algebra. 
Run the transformed program under SWI Prolog and query the tplus and
tminus predicates, to see the "Fitting" model.