cs604-2010 lecture 2

8
Armstrong's inference rules: IR1. (Reflexive) If Y subset-of X, then X -> Y IR2. (Augmentation) If X -> Y, then XZ -> YZ IR3. (Transitive) If X -> Y and Y -> Z, then X -> Z Prove or disprove the following inference rules for functional dependencies. A proof can be made either by a proof argument or by using inference rules lRl through IR3.A disproof should be performed by demonstrating a relation instance that satisfies the conditions and functional dependencies in the left-hand side of the inference rule but does not satisfy the dependencies in the right-hand side. a. {W -> Y, X -> Z} ╞ {WX -> Y} Proof of a 1. W -> Y (given). 2. WX -> YX (using IR2on 1 by augmenting with X) 3. YX -> Y (using IR1 and knowing that Y subset of YX). 4. WX -> Y (using lR3 on 2 and 3). c. {X -> Y, X -> W, WY -> Z} ╞ {X -> Z} Proof of c 1. X -> Y (given).

Upload: ayaz

Post on 27-Oct-2015

46 views

Category:

Documents


5 download

DESCRIPTION

Ms cs

TRANSCRIPT

Page 1: CS604-2010  Lecture 2

Armstrong's inference rules:IR1. (Reflexive) If Y subset-of X, then X -> YIR2. (Augmentation) If X -> Y, then XZ -> YZIR3. (Transitive) If X -> Y and Y -> Z, then X -> Z

Prove or disprove the following inference rules for functional dependencies. A proof can be made either by a proof argument or by using inference rules lRl through IR3.A disproof should be performed by demonstrating a relation instance that satisfies the conditions and functional dependencies in the left-hand side of the inference rule but does not satisfy the dependencies in the right-hand side.

a. {W -> Y, X -> Z} ╞ {WX -> Y}Proof of a

1. W -> Y (given).2. WX -> YX (using IR2on 1 by augmenting with X)3. YX -> Y (using IR1 and knowing that Y subset of YX).4. WX -> Y (using lR3 on 2 and 3).

c. {X -> Y, X -> W, WY -> Z} ╞ {X -> Z}Proof of c

1. X -> Y (given).2. X -> W (given).3. X -> XY (using IR2on 1 by augmenting with X; notice that XX

= X).4. XY-> WY (using IR2on 2 by augmenting with Y).5. X -> WY (using lR3 on 3 and 4).6. WY -> Z (given).7. X -> Z (using lR3 on 5 and 6).

Page 2: CS604-2010  Lecture 2

h. {XY -> Z, Z -> X} ╞ {Z -> Y}

X Y Z

Disprove of hConsider the following relation instance:

X Y Za m ca n cb m db n d

The previous relation instance satisfies the functional dependencies in the left-hand side but does not satisfy the dependencies in the right-hand side. Then, the inference rule is disproved.

Page 3: CS604-2010  Lecture 2

Consider the following two sets of functional dependencies: F = {A -> C, AC -> D, E -> AD, E -> H} and G = {A -> CD, E -> AH}. Check whether they are equivalent.

SolutionF equivalent to G if F covers G and G covers F

1. A -> C(given).2. AC -> D (given).3. AA -> D (using lR6 on 1 and 2).4. A -> D (from 3 where AA=A)5. A -> CD (using lR5 on 1 and 4).

6. E -> AD (given).7. E -> A (using lR4 on 6).8. E -> H (given).9. E -> AH (using lR5 on 7 and 8).

Then we deduce {A -> C, AC -> D, E -> AD, E -> H} ╞{A -> CD, E -> AH} or F covers G .

1. A -> CD (given).2. A -> C (using lR4 on 1).

3. A -> D (using lR4 on 1).4. AC -> DC (using IR2on 3 by augmenting with C)5. AC -> D (using lR4 on 4).

6. E -> AH (given).7. E -> A (using lR4 on 6).8. E -> D (using IR3 on 7 and 3)9. E -> AD (using IR5 on 7 and 8)

10. E -> H (using lR4 on 6).

Then we deduce {A -> CD, E -> AH}╞{A -> C, AC -> D, E -> AD, E -> H} or G covers F. F and G are equivalent.

Page 4: CS604-2010  Lecture 2

Consider the relation schema EMP_DEPT

and the following set G of functional dependencies on EMP_DEPT: G = {SSN -> {ENAME, BDATE, ADDRESS, DNUMBER},

DNUMBER -> {DNAME, DMGRSSN}, { SSN, ENAME }-> DNAME }

Is the set of functional dependencies G minimal? If not, try to find a minimal set of functional dependencies that is equivalent to G.

SolutionG is not a minimal set of functional dependencies. {SSN -> {ENAME, BDATE, ADDRESS, DNUMBER}, DNUMBER -> {DNAME, DMGRSSN}, { SSN, ENAME }->

DNAME}

{SSN -> ENAME, SSN -> BDATE, SSN -> ADDRESS, SSN -> DNUMBER, DNUMBER -> DNAME,DNUMBER -> DMGRSSN,{ SSN, ENAME}-> DNAME }

{SSN -> ENAME, SSN -> BDATE, SSN -> ADDRESS, SSN -> DNUMBER, DNUMBER -> DNAME,DNUMBER -> DMGRSSN,SSN-> DNAME }

{SSN -> ENAME, SSN -> BDATE, SSN -> ADDRESS, SSN -> DNUMBER, DNUMBER -> DNAME,DNUMBER -> DMGRSSN}

Page 5: CS604-2010  Lecture 2

Consider the universal relation R = {A, B, C, D, E, F, G, H, I,J} and the set of functional dependencies F = {{A, B} -> {C}, {A} -> {D, E}, {B} -> {F}, {F} -> {G, H},{D}-> {I, J}}. What is the key for R? Decompose R into 2NF and then 3NF relations.

The key for R: {A,B}

2NF:

3NF:

A B C D E F G H I J

A B C

D EA I J

F G HB

A B C

D EA

FB

D I J

F G H