Given the following functional dependencies how would I compute the minimal cover:
A -> B, ABCD -> E, EF -> GH, ACDF -> EG
In the lectur
According to me,In the above functional minimal dependencies ACDF -> G should also be included because when you take closure of each letter on left side and their combination none of them produce G without including F
So it would be as follows:
(A -> B, EF -> G , EF -> H , ACD -> E , ACDF -> G )
To get the minimal cover, you have to make two steps. To demonstrate, I'll first split the dependencies into multiple (only one attribute on the right side) to make it more clean:
A -> B
ABCD -> E
EF -> G
EF -> H
ACDF -> E
ACDF -> G
The following steps must be done in this order (#1 and then #2), otherwise you can get incorrect result.
1) get rid of redundant attributes (reduce left sides):
Take each left side and try to remove one each attribute one at a time, then try to deduce the right side (which is now only one attribute for all dependencies). If you suceed you can then remove that letter from the left side, then continue. Note that there might be more than one correct result, it depends on the order in which you do the reduction.
You will find out, that you can remove B
from the dependency ABCD -> E
, because ACD -> ABCD
(use first dep.) and from ABCD -> E
. You can use the full dep. you are currently reducing, this is sometimes confusing at first, but if you think about it, it will become clear that you can do that.
Similarly, you can remove F
from ACDF -> E
, because ACD -> ABCD -> ABCDE -> E
(you can obviously deduce a single letter from the letter itself). After this step you get:
A -> B
ACD -> E
EF -> G
EF -> H
ACD -> E
ACDF -> G
These rules still represent the same dependencies as the original. Note that now we have a duplicate rule ACD -> E
. If you look at the whole thing as a set (in the mathematical sense), then of course you can't have the same element twice in one set. For now, I'm just leaving it twice here, because the next step will get rid of it anyway.
2) get rid of redundant dependencies
Now for each rule, try to remove it, and see if you deduce the same rule by only using others. In this step you, of course, cannot use the dep. you're currently trying to remove (you could in the previous step).
If you take the left side of the first rule A -> B
, hide it for now, you see you can't deduce anything from A
alone. Therefore this rule is not redundant. Do the same for all others. You'll find out, that you can (obviously) remove one of the duplicate rules ACD -> E
, but strictly speaking, you can use the algorithm also. Hide only one of the two same rules, then take the left side (ACD
), and use the other to deduce the right side. Therefore you can remove ACD -> E
(only once of course).
You'll also see you can remove ACDF -> G
, because ACDF -> ACDFE -> G
. Now the result is:
A -> B
EF -> G
EF -> H
ACD -> E
Which is the minimal cover of the original set.