|
℉min = ℉ // Initialization
/* =====================================================
Prepare to find minimal RHS
We find a mininal RHS by "dropping dependencies"
====================================================== */
For each FD X → A1A2...AN ∈ ℉min do
{
replace X → A1A2...AN by:
X → A1
X → A2
...
X → AN
}
/* ============================================================
Find the minimal LHS's
============================================================ */
For each FD X → A ∈ ℉min do:
{
// Remove one attribute from LHS at a time.....
For each attribute B ∈ X do:
{
/* =========================================
Check if attribute B ∈ X is neccesary
========================================= */
Compute (X - B)+ using FDs in ℉min;
if ( A ∈ (X - B)+ )
{
replace X → A by (X-B) → A in ℉min // B was not neccessary
}
}
/* ============================================================
Find the minimal RHS's
============================================================ */
For each FD X → A ∈ ℉min do:
{
// Remove 1 RHS at a time.....
/* =========================================
Check if X → A is neccesary
========================================= */
compute X+ using ℉min - {X → A}
if ( A ∈ X+ )
{
remove X → A from ℉min // X → A was not necessary
}
}
/* =========================================
Finalize....
========================================= */
Group the FDs with common LHS into one single FD.
|
Relation R = (A, B, C, D, E, F)
℉1 = { A → C
AC → D
E → ADF }
|
℉min = ℉1
= { A → C
AC → D
E → ADF }
|
Before:
℉min = ℉1
= { A → C
AC → D
E → ADF
}
|
For each FD X → A ∈ ℉min do:
{
// Remove one attribute from LHS at a time.....
For each attribute B ∈ X do:
{
/* =========================================
Check if attribute B ∈ X is neccesary
========================================= */
Compute (X - B)+ using FDs in ℉min;
if ( A ∈ (X - B)+ )
{
replace X → Ai by (X-B) → Ai in ℉min // B was not neccessary
}
}
|
NOTE:
|
Execution:
℉min = { A → C
AC → D <---- Consider this FD
E → A
E → D
E → F
}
|
Result:
Before:
℉min = { A → C
AC → D
E → A
E → D
E → F
}
|
Note:
|
Initially:
℉min = { A → C
A → D
E → A
E → D
E → F }
|
Result:
℉min = { A → C
A → D
E → A
E → F }
|
Final Result: minimal cover
℉min = { A → CD
E → AF }
|
The resulting set of functional dependencies is a minimal cover of the original set of functional dependencies
The minimal cover is equivalent to the original set of functional dependencies but may have a fewer number of functional dependencies