Inference Rule - Database Theory - Homework, Exercises of Introduction to Database Management Systems

In the course of the database theory, we study the key concept regarding the database. The major points in these homework exercises are:Inference Rule, Attributes, Set of Conjunctive Queries, Relational Schema, Query Inclusion Dependency, Implication Problem, Relation Schema, Brownie Point, Stream of Consciousness Intuition, Same Schema

Typology: Exercises

2012/2013

Uploaded on 04/24/2013

bandhula
bandhula 🇮🇳

4.7

(10)

91 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE 233 Spring, 2012
Problem Set #3
Due on Tuesday, May 15
This is an individual assignment and the usual criteria for academic
integrity apply. Please typeset your answer (latex recommended). More
difficult problems are marked with ?.
1. (3 points) Prove the following inference rule (Rhas attributes ABC and
Shas attributes DEF ):
If R[AB]S[DE ], R[AC]S[D F ] and Ssatisfies DE
then
R[ABC ]S[DEF ]
2. (9 points) Let CQ=denote the set of conjunctive queries with equality
(i.e. CQs allowing atoms x=cand x=ywhere x, y are variables and cis a
constant). Let σbe a relational schema. We define the following dependency
on instances over σ, called query inclusion dependency. For q1,q2CQ=
over schema σ, an instance Iover σsatisfies q1q2iff q1(I)q2(I). The
implication problem for CQ=query inclusions is to determine, given a finite
set Σ of CQ=query inclusion dependencies and an additional CQ=query
inclusion dependency q1q2over the same schema σ, whether Σ |=q1q2,
meaning that every instance over σsatisfying all inclusions in Σ also satisfies
q1q2.
(i) (4 points) Show that for every relation schema Rand FD fover R,
there exist CQ=queries q, q0such that for every instance Iover R,
I|=fiff q(I)q0(I).
(ii) (3 points) Show that (i) does not hold if equality is not allowed.
(iii) (2 points) Show that the implication problem for CQ=query inclusion
dependencies is undecidable.
(iv) (brownie point) Do you think the implication problem for CQ query
inclusion dependencies (without equality) is decidable? (stream of
consciousness intuition is ok here, as long as you don’t say something
terribly wrong).
1
Docsity.com
pf3

Partial preview of the text

Download Inference Rule - Database Theory - Homework and more Exercises Introduction to Database Management Systems in PDF only on Docsity!

CSE 233 Spring, 2012

Problem Set

Due on Tuesday, May 15

This is an individual assignment and the usual criteria for academic integrity apply. Please typeset your answer (latex recommended). More difficult problems are marked with ?.

  1. (3 points) Prove the following inference rule (R has attributes ABC and S has attributes DEF ):

If R[AB] ⊆ S[DE], R[AC] ⊆ S[DF ] and S satisfies D → E then R[ABC] ⊆ S[DEF ]

  1. (9 points) Let CQ=^ denote the set of conjunctive queries with equality (i.e. CQs allowing atoms x = c and x = y where x, y are variables and c is a constant). Let σ be a relational schema. We define the following dependency on instances over σ, called query inclusion dependency. For q 1 , q 2 ∈ CQ= over schema σ, an instance I over σ satisfies q 1 ⊆ q 2 iff q 1 (I) ⊆ q 2 (I). The implication problem for CQ=^ query inclusions is to determine, given a finite set Σ of CQ=^ query inclusion dependencies and an additional CQ=^ query inclusion dependency q 1 ⊆ q 2 over the same schema σ, whether Σ |= q 1 ⊆ q 2 , meaning that every instance over σ satisfying all inclusions in Σ also satisfies q 1 ⊆ q 2.

(i) (4 points) Show that for every relation schema R and FD f over R, there exist CQ=^ queries q, q′^ such that for every instance I over R, I |= f iff q(I) ⊆ q′(I).

(ii) (3 points) Show that (i) does not hold if equality is not allowed.

(iii) (2 points) Show that the implication problem for CQ=^ query inclusion dependencies is undecidable.

(iv) (brownie point) Do you think the implication problem for CQ query inclusion dependencies (without equality) is decidable? (stream of consciousness intuition is ok here, as long as you don’t say something terribly wrong).

  1. (?) (9 points) Let R be a relation schema of arity 2. Let q be a CQ (no equality) over R. Since R is binary, the body of q can be viewed as a directed graph among its variables and constants. The undirected body U (q) of q is obtained from the body of q by making all edges undirected. We say that q is acyclic if U (q) is acyclic. For example, (P 1) below is acyclic, while (P 2) is cyclic:

(P 1) : answer(x) ← R(x, y), R(y, x), R(z, y), R(y, w) (P 2) : answer(x) ← R(x, y), R(y, x), R(z, y), R(y, w), R(w, z)

(i) (7 points) Show that the combined recognition complexity^1 for evalua- tion of acyclic CQs over R is in PTIME (recall that this is NP-complete in general, by reduction from graph 3-colorability).

(ii) (2 points) Show that testing whether^2 q 1 ⊆ q 2 is in PTIME for CQs q 1 , q 2 over σ where q 2 is acyclic.

  1. (6 points) (Automorphisms)

(i) (4 points) Show that CALC queries are invariant under automor- phisms. In other words, if ϕ(¯x) is a CALC query without constants over schema σ, then for every instance I over σ and one-to-one map- ping f : dom → dom, if f (I) = I then f (ϕ(I)) = ϕ(I). Hint: Assume without loss of generality that ϕ uses only ∧, ∃, ¬, and use structural induction on the formula.

(ii) (2 points) Let σ consist of a binary relation R. Using (i), show that there is no CALC query without constants which on input

R a b b c c d d a

produces as answer (^1) Combined complexity: both the query and the instance are part of the input to the algorithm. (^2) Here q 1 ⊆ q 2 is usual inclusion of CQs, meaning that q 1 (I) ⊆ q 2 (I) for every instance I.