In all cases, show the canonical databases needed to prove or disprove the hypothesis. Please be very careful about directionality, both in terms of what you're proving and in terms of what's being frozen and queried where; it's very easy to screw that up. Also please note that "contains" is the inverse of "e;is contained in"e;...
Questions 1-5 are worth 19% each, and question 5 is worth 5%.
Q1: p(X,Y):-r(X,Z) & g(Z,Z) & r(Z,Y)
Q2: p(A,B):-r(A,C) & g(C,D) & r(D,B)
Does Q2 contain Q1? Why or why not?
Q1: p(X,Y) :- a(X,Z) & a(Z,Y) & NOT a(X,Y)
Q2: p(X,Y) :- a(X,Y) & NOT a(Y,X)
Does Q2 contain Q1? Why or why not?
Q1: p(X,Y) :- q(X,Y) & r(U,V) & r(V,U)
Q2: p(X,Y) :- q(X,Y) & r(U,V) & U <= V
Does Q2 contain Q1? Why or why not?
Q: p(X,Y) :- a(X,Z) & a(Z,W) & a(W,Y)
P: p(X,Y) :- a(X,Y)
p(X,Y) :- p(X,Z) & p(Z,Y)
Does P contain Q? Why or why not?
Given query q and views v1 and v2:
q(X):-e1(X,Y),e2(Y,Z),e3(Z,X)
v1(A,B,C,D):-e1(A,B),e2(C,D)
v2(D,E):-e3(D,E)
Use v1 and v2 to create an equivalent query to q that does not access e1, e2, or e3. There is no need to show that they are equivalent.
Bonus thought experiment (no need to turn this in for credit): if the definition of V1 was v1(a,d), could you create an equivalent query for q using only v1 and v2? Why or why not?