0% found this document useful (0 votes)
181 views6 pages

Canonical Cover

The document defines a canonical cover of functional dependencies as a simplified set that has the same closure as the original set, with no extraneous attributes and unique left sides. An algorithm is provided to compute the canonical cover by repeatedly applying union and decomposition rules and removing extraneous attributes until the set does not change. An example applies the algorithm to find the canonical cover of a set of functional dependencies.

Uploaded by

Sayani Chandra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views6 pages

Canonical Cover

The document defines a canonical cover of functional dependencies as a simplified set that has the same closure as the original set, with no extraneous attributes and unique left sides. An algorithm is provided to compute the canonical cover by repeatedly applying union and decomposition rules and removing extraneous attributes until the set does not change. An example applies the algorithm to find the canonical cover of a set of functional dependencies.

Uploaded by

Sayani Chandra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

A canonical cover of a set of functional dependencies F is a simplified set of functional

dependencies that has the same closure as the original set F.


Important definitions:
Extraneous attributes: An attribute of a functional dependency is said to be extraneous if
we can remove it without changing the closure of the set of functional dependencies.
Canonical cover: A canonical cover Fc of a set of functional dependencies F such that
ALL the following properties are satisfied:
 F logically implies all dependencies in Fc.
 Fc logically implies all dependencies in F.
 No functional dependency in Fc contains an extraneous attribute.
 Each left side of a functional dependency in Fc is unique. That is, there are no
two dependencies α1 → β1 and α2 → β2 in such that α1 → α2.

Finding Canonical Cover

Algorithm to compute canonical cover of set F:

repeat
1. Use the union rule to replace any dependencies in α 1 → β1 and α1 → β2 with α1 →
β 1 β2 .
2. Find a functional dependency α → β with an extraneous attribute either in α or in β.
3. If an extraneous attribute is found, delete it from α → β.
until F does not change

Example1:

Consider the following set F of functional dependencies:


F= {
A → BC
B → C
A → B
AB → C
}
Steps to find canonical cover:
1. There are two functional dependencies with the same set of attributes on the left:
A → BC
A → B

These two can be combined to get


A → BC.

Now, the revised set F becomes:

F= {
A → BC
B → C
AB → C
}
2. There is an extraneous attribute in AB → C because even after removing AB → C
from the set F, we get the same closures. This is because B → C is already a part
of F.
Now, the revised set F becomes:

F= {
A → BC
B → C
}
3. C is an extraneous attribute in A → BC, also A → B is logically implied by A → B
and B → C (by transitivity).

F= {
A → B
B → C
}
4. After this step, F does not change anymore.
Hence the required canonical cover is,

Fc = {
A → B
B → C
}

1. The left side of each functional dependency in F is unique.


2. None of the attributes in the left or right side of any functional dependency is
extraneous (Checked by applying definition of extraneous attributes on every functional
dependency).
3. Hence, the canonical cover F c is equal to F.

Note: There can be more than one canonical cover Fc of a set F of functional


dependencies.
How to check whether a set of fds F canonically cover another set of fds G?
Consider the following two sets of functional dependencies:
F={
A → B
AB → C
D → AC
D → E
}

G={
A → BC
D → AB
}
Now, we are required to find out whether one of these fds canonically covers the other set
of fds. This means, we need to find out whether F canonically covers G, G canonically
covers F, or none of the two canonically cover the other.
To find out, we follow the following steps:
 Create a singleton right hand side. This means, the attributes to the right side of the
fd arrow should all be singleton.
The functional dependency D → AC gets broken down into two functional
dependencies, D → A and D → C (using decomposition rule).
F={
A → B
AB → C
D → A
D → C
D → E
}
 Remove all extraneous attributes.
Consider any functional dependency XY → Z. If X in itself can determine Z, then
the attribute Y is extraneous and can be removed. As we can see, the
occurrence of extraneous attributes is possible only in those functional
dependencies where there are more than one attributes in the LHS.
So, consider the functional dependency AB → C.
Now, we must find the closures of A and B to find whether any of these is
extraneous.
[A]+ = ABC
[B]+ = B
As we can see, C can be determined from A. This means we can remove B
from the functional dependency AB → C.
F={
A → B
A → C
D → A
D → C
D → E
}
 Remove all redundant functional dependencies.
Check all fds one by one, and see if by removing a fd X → Y, we can still find
out Y from X by some other fd A more formal way to state this is find [X]
+
 without making use of the fd we are testing and check whether Y is a part of
the closure. If yes, then the fd is redundant.
Here, when checking for the fd D → C, we observe that even after hiding it, the
closure of D contains C. This is because we can obtain C from D by the
combination of two other fds D → A and A → C. So, D → C is redundant.
F={
A → B
A → C
D → A
D → E
}
Now, do the same for G.
 Create a singleton right hand side. This means, the attributes to the right side of
the fd arrow should all be singleton.
G={
A → B
A → C
D → A
D → B
}
 Remove all extraneous attributes.
Since the RHS of all fds contains only 1 attribute, there is no extraneous
attribute possible.
 Remove all redundant functional dependencies.
By looping over all fds and checking the closure of the LHS in all cases, we
observe that the fd D → B is redundant as it can be obtained through a
combination of 2 other fds, D → A and A → B.
G={
A → B
A → C
D → A
}
Now, since all fds of G are already covered in F, we conclude that F covers G.
Example2:

The following functional dependencies hold true for the relational scheme R (W, X, Y, Z) –
X→W
WZ → XY
Y → WXZ
Write the irreducible equivalent for this set of functional dependencies
OR
Find out the canonical cover for this set of functional dependencies.
Solution:

Step-01:
Write all the functional dependencies such that each contains exactly one attribute on its
right side-
X→W
WZ → X
WZ → Y
Y→W
Y→X
Y→Z

Step-02:
Check the essentiality of each functional dependency one by one.
For X → W:
Considering X → W, (X)+ = {X, W}
Ignoring X → W, (X)+ = {X}
Now,
Clearly, the two results are different.
Thus, we conclude that X → W is essential and cannot be eliminated.
For WZ → X:
Considering WZ → X, (WZ)+ = {W, X, Y, Z}
Ignoring WZ → X, (WZ)+ = {W, X, Y, Z}
Now,
Clearly, the two results are same.
Thus, we conclude that WZ → X is non-essential and can be eliminated.
Eliminating WZ → X, our set of functional dependencies reduces to -
X→W
WZ → Y
Y→W
Y→X
Y→Z

Now, we will consider this reduced set for further checks.


For WZ → Y:
Considering WZ → Y, (WZ)+ = {W, X, Y, Z}
Ignoring WZ → Y, (WZ)+ = {W, Z}
Now,
Clearly, the two results are different.
Thus, we conclude that WZ → Y is essential and cannot be eliminated.
For Y → W:
Considering Y → W, (Y)+ = {W, X, Y, Z}
Ignoring Y → W, (Y)+ = {W, X, Y, Z}
Now,
Clearly, the two results are same.
Thus, we conclude that Y → W is non-essential and can be eliminated.
Eliminating Y → W, our set of functional dependencies reduces to -
X→W
WZ → Y
Y→X
Y→Z

For Y → X:
Considering Y → X, (Y)+ = {W, X, Y, Z}
Ignoring Y → X, (Y)+ = {Y, Z}
Now,
Clearly, the two results are different.
Thus, we conclude that Y → X is essential and cannot be eliminated.
For Y → Z:
Considering Y → Z, (Y)+ = {W, X, Y, Z}
Ignoring Y → Z, (Y)+ = {W, X, Y}
Now,
Clearly, the two results are different.
Thus, we conclude that Y → Z is essential and cannot be eliminated.
From here, our essential functional dependencies are -
X→W
WZ → Y
Y→X
Y→Z

Step-03:
Consider the functional dependencies having more than one attribute on their left side.
Check if their left side can be reduced.
In our set,
Only WZ → Y contains more than one attribute on its left side.
Considering WZ → Y, (WZ)+ = {W, X, Y, Z}
Now,
Consider all the possible subsets of WZ.
Check if the closure result of any subset matches to the closure result of WZ.
(W)+ = {W}
(Z)+ = {Z}
Clearly,
None of the subsets have the same closure result same as that of the entire left side.
Thus, we conclude that we cannot write WZ → Y as W → Y or Z → Y.
Thus, set of functional dependencies obtained in step-02 is the canonical cover.
Finally, the canonical cover is-
X→W
WZ → Y
Y→X
Y→Z

You might also like