Extra problems

This homework is meant to serve as practice problems on newer material.  DO NOT turn it in.  Yes, this material (along with other topics we talked about in class) is fair material for the test.

Problem 1

Consider the following two Prolog terms:
Τ1 ≡ [[a,f(b),c,d],g(X1,[e|X2]),X3,X4|X5]
T2 ≡ [Y1,g(d,Y2)|Y1]

Do the two terms unify?  If so, what is the most general unifier (mgu), Θ?  If not, explain how the unification fails.

Problem 2

Consider the following program:
foo(X,Z) :-
  not(bar1(X,Y)),
  bar2(Y,Z).
foo2(A,A) :- !.
foo2(A,B) :- foo(A,B).

Write down an FOL expression equivalent to Prolog's interpretation of foo/2.  You are allowed to use only the following operators: negation, or, and, universal quantification, existential quantification.  You should write your answer using only FOL (not set/clausal notation).

Now, repeat the problem for foo2/2.  

Problem 3

Looking back at the first two Prolog assignments, pick the predicate that you found the hardest due to infinite looping, and call your original [non-working] solution P.

A) In class, we talked about how Mu/Nu Prolog uses wait declarations (and 'implicit wait declarations' for primitives).  Add wait declarations to P so that it would work.  Give a convincing argument that this would work by proving a partial trace of the program's execution.

B) Again considering P, discuss whether a CLP approach would work.  Make sure you state the domains for which you would need solvers for the CLP approach to work.

Problem 4

In class, we identified four types of parallelism in logic programming.  For each of the analysis predicates from the project, discuss whether or not any of these types applies, and if so, which type is likely to yield the greatest amount of parallelism.  You may have a different answer for each mode.  As always, but especially here, your answer is less important than your reasons and ability to argue for your answer.

Problem 5

11.14-15 (ed2: 9.14-15)

Note that a symbol table is basically a table, with each row corresponding to a variable in the program. The table has 2 columns: the name of the variable, and a list of attributes. For the purposes of this problem, you may assume that an attribute is a string.

Hints/Clarifications/Corrections

None!