I am having issues proving functional dependencies with Armstrong's Axioms. This one i'm struggling
with. Let R(A,B,C,D,E) be a relation schema and F = {A→CD, C→E, B→D} 1. Prove: F: BC-> DE
What I have:
1 Given B->D
1.
Augment C on 1, BC->DC
2.
Decomposition on 2, BC->D BC->C
3.
Transitivity on BC->C, BC->E
4.
Union on BC ->D and and 4, BC->DE
Unsure if this is a proper solution.
Also Prove: AC-> BD I don't think this can be proven.
Please Help!
your solutions are correct, apart from some apparent misspelling:
Given B->D, C->E
Augment C on 1: BC -> DC
Decomposition on 2: BC -> C (3.1), BC -> D (3.2)
Transitivity on 1, 3.1: BC -> C, C -> E: BC -> E
Union on 3.2 and 4: BC -> DE
alternatively:
B->D, C->E
augment(1.1, c): bc -> dc
augment(1.2, d): cd -> ed
trans(2, 3): bc -> de (note: bc -> dc <=> bc -> cd <=> cb -> cd <=> cb -> dc)
ac -> bd cannot be proven in general: inspecting the armstrong axioms you notice that for some X to appear on the rhs of a derived fd, it must occur on the rhs of one of the original fds, except for
X is a subset of some X' on the lhs of an original fd
or
the fd is derived by augmentation with X
1.) constitutes a constraint never mentioned.
if 2.) applies, X would appear on a lhs of the original fd too. the only way to eliminate X is by transitivity which requires X to appear on the rhs of one of the original fds.
take b as X to see that ac -> bd is unprovable.
Abbreviations:
Shorthand
Expansion
fd(s)
Functional dependency(/-cies)
lhs
Left-hand side (of an equation / a derivation )
rhs
Right-hand side
Related
I have a relation r(A,B,C,D,E,F) satisfying:
AB->C
C->A
BC->D
ACD->B
BE->C
CE->FA
CF->BD
D->EF
I need to find the canonical cover for this relation?
I know the algorithm to find the canonical cover. However in the algorithm, we need to find the extraneous attributes. Is there an algorithm to find extraneous attributes?
The algorithm to find extraneous attributes is the following:
let F the initial set of functional dependencies
assume that each dependency F is in the form A1, A2, ..., An -> B
for each functional dependency A1, A2, ..., An -> B in F with n > 1
for each Ai
if B ∈ ({A1, A2, ..., An} - Ai)+
then Ai is an extraneous attribute and must be removed from the left hand side
Note that the closure of the remaining attributes must be computed by considering all the dependencies of F, including the dependency under examination (this can be counterintuitive).
For instance, applying this algorithm to your example, starting from the dependencies:
{ A B → C
A C D → B
B C → D
B E → C
C → A
C E → A
C E → F
C F → B
C F → D
D → E
D → F }
In A C D → B, A is estraneous since {C D}+ = (A B C D E F), while in C E → A, E is estraneous since {C}+ = (A C).
I have a relation r(A,B,C,D,E,F) satisfying:
AB->C
C->A
BC->D
ACD->B
BE->C
CE->FA
CF->BD
D->EF
I need to find the canonical cover for this relation?
I know the algorithm to find the canonical cover. However in the algorithm, we need to find the extraneous attributes. Is there an algorithm to find extraneous attributes?
The algorithm to find extraneous attributes is the following:
let F the initial set of functional dependencies
assume that each dependency F is in the form A1, A2, ..., An -> B
for each functional dependency A1, A2, ..., An -> B in F with n > 1
for each Ai
if B ∈ ({A1, A2, ..., An} - Ai)+
then Ai is an extraneous attribute and must be removed from the left hand side
Note that the closure of the remaining attributes must be computed by considering all the dependencies of F, including the dependency under examination (this can be counterintuitive).
For instance, applying this algorithm to your example, starting from the dependencies:
{ A B → C
A C D → B
B C → D
B E → C
C → A
C E → A
C E → F
C F → B
C F → D
D → E
D → F }
In A C D → B, A is estraneous since {C D}+ = (A B C D E F), while in C E → A, E is estraneous since {C}+ = (A C).
I want to find the minimal cover for the following set of functional dependencies:
A -> BC
B -> C
A -> B
AB -> C
first step: Break down the RHS of each functional dependency into a single attribute:
A -> B
A -> C
B -> C
A -> B
AB -> C
then I will remove of the two A -> B, so we will get:
A -> B
A -> C
B -> C
AB -> C
second step: Trying to remove unnecessary attributes from the LHS of each functional dependency (whose LHS has 2 or more attributes):
for AB -> C , check if A is necessary by:
replace AB -> C with B -> C so if B+ contains C then A is unnecessary:
B+ = B (B -> C)
= BC (so A is unnecessary)
check if B is necessary by:
replace AB -> C with A -> C so if A+ contains C then B is unnecessary:
A+ = A (A -> B)
= AB (A -> C)
= ABC (so B is unnecessary)
now we have:
A -> B
A -> C
B -> C
third step: Trying to remove unecessary functional dependencies:
for A -> B check if A+ contains B without using A -> B:
A+ = A (A -> C)
= AC (so A -> B is necessary)
for A -> C check if A+ contains C without using A -> C:
A+ = A (A -> B)
= AB (so A -> C is necessary)
for B -> C check if B+ contains C without using B -> C:
B+ = B (so B -> C is necessary)
now we have:
A -> B
A -> C
B -> C
Finally, group the functional dependencies that have common LHS together:
A -> BC
B -> C
so we can say that these functional dependencies are the minimal cover of the set, is that true ? and how we can deduce the key(s) of the set?
To compute a canonical cover for F:
Use the union rule to replace any dependencies with common left-side.
so Combine A ->BC and A -> B into A -> BC
Set is now {A -> BC, B -> C, AB -> C}
A is extraneous in AB -> C
Check if the result of deleting A from AB -> C is implied by the other dependencies
Yes: in fact, B -> C is already present!
Set is now {A -> BC, B -> C}
C is extraneous in A -> BC
Check if A -> C is logically implied by A B and the other dependencies
Yes: using transitivity on A -> B and B -> C.
Can use attribute closure of A in more complex cases
The canonical cover is: A ->B, B -> C
source:Korth,sudarshan DBMS book.
Consider the relation schema R = ABCDG with following functional dependencies (FD)
AB -> C
C -> A
BC -> D
ACD -> D
D -> EG
BE -> C
CG -> BD
CE -> AG
Compute closure of BD and CA.
How we can find them?
The closure of a set of functional dependencies, F, means all the functional dependencies logically implied by F. For example, given
BC -> D, and
D -> EG
we can apply Armstrong's axioms to derive
D -> E,
D -> G,
BC -> E,
BC -> G,
and so on.
When you've derived every FD implied by F, you have the closure of F with respect to R. In your case, you want to derive every FD logically implied by BD and CA.
As far as I know, every textbook on relational database theory includes one or more algorithms to compute the closure of a set of functional dependencies. Your best bet is to follow one of the algorithms in your textbook, if you have one.
Here is a simple algorithm for computing the closure of a set of attributes X:
Closure(X, F)
1 INITIALIZE V:= X
2 WHILE there is a Y -> Z in F such that:
- Y is contained in V and
- Z is not contained in V
3 DO add Z to V
4 RETURN V
Given the following functional dependendies on a relation R(A B C D E F G)
AB → CF
BG → C
AEF → C
ABG → ED
CF → AE
A → CG
AD → FE
AC → B
I have worked out the candidate keys by using the method where you put the attribute in either a left, middle, right column depending if it is seen on the left hand side of a dependency, right hand side or both. Left means that the attribute is necessary, middle is unknown and right means not part of a key.
I got this:
L | M | R
--|---------|----
- | ABCDEFG | -
From here I worked out the closures for each individual attribute and the permutations: BC, BD, BE, BF, BG, CD, CF...
I found that only the closure of A and CF contain all attributes and therefore are candidate keys however the solution the problem also has BFG.
Can someone explain what I am doing wrong in calculating candidate keys?
Thanks
This algorithm tries to find shortcuts (pg 3), but in your case it doesn't find any. To determine whether any particular combination of attributes is a key, you try to figure out whether that combination determines every other attribute. In your case, you've done all the work; you're just missing something about BFG.
Logic Attributes
--
BFG -> BFG, ∴ ... { B FG}
BG -> C, ∴ BFG -> CF { BC FG}
BFG -> CF and CF -> AE, ∴ BFG -> AE {ABC EFG}
BFG -> AE, ∴ BFG -> A
BFG -> A and ABG -> ED, ∴ BFG -> ED {ABCDEFG}
So BFG is a candidate key.