CS345 Assignment #2

Due Monday, April 19, 1999

Problem Set

  1. (30 pts.) Below are two programs (with an EDB for the first program) and two proposed models for each. Apply the Gelfond-Lifschitz transform to the models and tell whether each model is or is not stable.

  2. (40 pts.) Another proposed semantics for logic with negation is inflationary semantics. Here, we start out assuming no IDB facts, and we apply the rules to infer some IDB facts. Once inferred, an IDB fact can never become false. More formally, the inflationary semantics for a Datalog program and EDB is defined by:

    1. Begin with all IDB predicates empty.

    2. Apply the rules of the program once, using as true whatever EDB facts were given and whatever IDB facts have already been inferred on previous rounds. Every other ground atom is assumed false. Note this process differs from the GL transform or alternating fixpoint in two ways:

      • The rules are only applied once, not repeatedly in this round.
      • A nonnegated IDB subgoal can be assumed true if it was true on the previous round, rather than having to be inferred on this round, as in the GL transform.

    3. If at least one new fact has been inferred:

      • Add all new facts to the set of inferred IDB facts.
      • Repeat step (2).

    Here is a simple, propositional example, that may help clarify the definition:

         p :- q
         q :- NOT r
         s :- NOT p

    Round 0: None of p, q, r, and s are true.

    Round 1: The falsehood of r lets us infer q, and the falsehood of p lets us infer s. The inflationary model so far is {q,s}.

    Round 2: The truth of q lets us infer p. The inflationary model is now {p,q,s}. Note that even though p is now true, the use of NOT p to infer s stands.

    Round 3: No new inferences are possible; the inflationary model is {p,q,s}.

    Your problems:

    What is the inflationary semantics of the red/green bus line rules and EDB given in class (second set of slides)? Recall the rules are:
         greenPath(X,Y) :- green(X,Y)
         greenPath(X,Z) :- greenPath(X,Z) & greenPath(Z,Y)
         monopoly(X,Y) :- red(X,Y) & NOT greenPath(X,Y)
    and the EDB is {red(1,2), red(2,3), green(1,2)}.

    What is the inflationary semantics of the win program. Interestingly, the inflationary semantics hardly depends on the EDB. If we know the set of boards mentioned in the EDB, and we know one simple property of the move relation (you must figure out the property), then you can describe succinctly the winning and losing boards according to the inflationary semanics.

    One of the problems with inflationary semantics, as in (a) and (b), is that if we don't write the rules carefully, we wind up inferring certain IDB facts ``too soon,'' that is, using a negated subgoal that eventually turns out not to be true (i.e., it is of the form NOT p, where p eventually becomes true). Show how to rewrite the red/green bus line rules so that, at least for this EDB, the inflationary model of your rules is the same as the stratified model of the rules given in class (i.e., greenPath(1,2) and monopoly(2,3) are the only IDB facts). You can actually rewrite the rules so that the inflationary model is the stratified model of the original rules on every EDB, and it would be great if you can discover how. But we'll accept something that works on only this EDB.

  3. (30 pts.) The win program as given in class is:
        win(X) :- move(X,Y) & NOT win(Y)

    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, as we did in class for this data.

    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.

    Select the word that will make the following statments true, and explain your choice.

    1. There is [ALWAYS, SOMETIMES, NEVER] a 2-valued well-founded model if the move graph for the win program is acyclic.

    2. There is [ALWAYS, SOMETIMES, NEVER] a 2-valued well-founded model if the move graph for the win program contains a cycle.