Rules of Functional Dependencies
Rules of Functional Dependencies
Dependencies
Closure of FDs F+
If F is a set of functional dependencies then
the closure of F denoted as F+, is the set of
all functional dependencies logically
implied by F.
F+ is the set of all FDs deduced from F by
applying the inference rules (Armstrong’s
Axioms)
Rules of functional
Dependencies
Armstrong’s Axioms
Armstrong’s Axioms
Armstrong's Axioms are a set of rules (rules of
inference), that when applied repeatedly, generate a
closure of functional dependencies.
They were developed by William W. Armstrong and
others (Armstrong, Nakamura and Rudnicki, 2003)
The axioms must be sound and complete set of
inference rules
These rules are sound because they generate only FDs
that actual hold on R (only correct FDs).
They are also complete as they generate all FDs (of F+) of
R that hold.
A1: Reflexive rule
If X is a set of attributes and Y is a subset of X then X
determines Y
If Y ⊆ X, then X→Y Such FDs are called trivial FDs
Given a relation Schema R(A,B,C,D)
Given AB ⊆ AB then ABAB is a trivial dependency
Given A ⊆ AB then AB A is a trivial dependency
Given B ⊆ AB then AB B is a trivial dependency
Trivial dependency − If a functional dependency (FD) X → Y holds,
where Y is a subset of X, then it is called a trivial FD. Trivial FDs
always hold.
Non-trivial dependency − If an FD X → Y holds, where Y is not a
subset of X, then it is called a non-trivial FD.
Given a relation Schema R(A,B,C,D)
I A then AB is a non-trivial dependency
A2: Augmentation rule
If a → b holds and y is attribute set, then ay → by also
holds.
That is adding attributes in dependencies, does not
change the basic dependencies.
Also known as a Partial dependency
If X Y, then XZ YZ for any Z
XZ Y is a partial dependency
Y is partially dependent on XZ
Y is not fully dependent on XY because Y
XZ Z; is a partial dependency,
Z is partially dependent on XZ
Z
XZZ is a trivial dependency
A3:Transitivity rule
If a → b holds and b → c holds, then a → c also holds.
Given a relation Schema R(A,B,C,D) and a set of FDs
F= {ABC, CD)
D is transitively dependent on AB
ADDITIONAL RULES
Union Rule
Decomposition Rule
Pseudo-Transitivity Rule
UNION RULE
Union Rule
If XY and X Z then X YZ
If X determines Y and X
determines Z then X must also
determines Y and Z.
DECOMPOSITION RULE
Decomposition Rule
IF XYZ then X Y and X Z
If X determines Y and Z, then X
determines Y and X determines Z
separately. This is the reverse of Union. If
you have a table that appears to contain
two entities that are determined by the
same PK, consider breaking them up into
two tables.
PSEUDO-TRANSITIVITY RULE
Pseudo-Transitivity Rule
if XY holds, and aYZ holds,
then XaZ holds.
Exercise
Use Armstrong's Axioms to prove the
following rules
Union Rule
Decomposition Rule
Pseudo-Transitivity Rule
Proof Union Rule
If X → Y and X → Z then X → Y Z.
Proof:
1. X → Y , Given
2. X → Z, Given
3. XX → XZ X → XZ, Augment 2 by X
4. XZ → YZ, Augment 1 by Z
5. If X → XZ and XZ → YZ then X → YZ, Transitivity
using 3 and 4
Proof Decomposition Rule
If X → YZ then X → Y and X → Z
Proof:
1. X → YZ, Given
2. YZ → Y , Reflexivity
3. If X → YZ and YZ → Y then X → Y , Transitivity
on 1 and 2.
Similar proof for X → Z.
Proof Pseudo-transitivity Rule
if XY holds, and aYZ holds, then XaZ holds
Proof:
1. X → Y, Given
2. aYZ , Given
3. XaYa; Augment 1 by a
4. If Xa→ Ya and Ya → Z then Xa → Z , Transitivity on
2 and 3.
Exercise
Given R(A,B,C) and F={AB, BC}
Apply Armstrong’s axioms to determine
non-trivial FDs in F+
Rules of functional
Dependencies
Attribute Closure
Closure of a Attribute Sets
To test whether a set of attributes or
attribute is a super key, we need to find
ABC is redundant
F becomes {A → C, AB D}
Exercise
Consider following set F of functional dependencies on schema R(A, B,
C) and compute the minimal cover for F = {A BC, B C, A B, AB
C}
Canonical form
F={AB, AC, BC, AB, ABC}
Remove extraneous FDs from LHS
F={AB, AC, BC, AB, ABC}
ABC; B is extraneous because AB
F becomes F={AB, AC, BC, AB}
Remove redundant FDs
F={AB, AC, BC, AB}
Minimal cover
F={AB, BC}
Exercise
Consider relation R(ABCDE) with the following set of FDs
F={AC → B, CE → D, C → E, D → B } and compute the
minimal cover of F.
Express F in canonical form
F={AC → B, CE → D, C → E, D → B }
Remove extraneous attributes LHS
F={AC → B, CE → D, C → E, D → B }
F={AC → B, C → D, C → E, D → B }
Remove redundant FDs
F={AC → B; C → D; C → E; D → B }
Minimal cover F={C → D, C → E, D → B }
Exercise
Given R(A, B, C) and F = {A → BC, B → C, A → B, AB →
C} that hold on R. Find the minimal cover of F
1. F= {A → B, AC, B → C, A → B, AB → C} {A →
B, AC, B → C, AB → C}
2. A is extraneous in AB → C, B → C is already present
Now, F = {A → B, AC, B → C}
3. AC is redundant, A → C is logically implied by A
→ B and B C transitively. Or use attribute closure
The minimal set is: {A → B, B → C}