3.2 Computing all Canonical Covers
3.2.3 Implication Dependencies
In section 2.1.5 we have seen how minimal keys can be computed efficiently, and we noted that the problem of finding canonical covers is similar. However, in the case of the key finding problem, a set of FDs was used to describe determination between attribute sets, whereas implication of FDs is given implicitly. To utilize our linear resolution algorithm, we need to make implications explicit. This is done as follows.
Definition 3.43. Let Σ be a set of FDs. We call an expression of the form S ⇒T where
S, T ⊆Σ an implication dependency (ID).
An IDS ⇒T is the equivalent of a FDS →T over Σ, where Σ is regarded as attribute set (i.e., we regard the FDs in Σ as independent attributes without any connection). We thus use the terminology defined for FDs for IDs as well, assuming an equivalent definition. In particular, we say that a set Π of IDs implies an ID S ⇒T iff S ⇒ T can be derived from Π using the equivalent of the Armstrong axioms (with → replaced by⇒).
Definition 3.44. Let Σ be a set of FDs. We call a set Π of IDs on Σ animplication cover
of Σ if for all sets S, T ⊆Σ we have
S ⇒T ∈Π∗ iff S ²T
We call Π sound if S ⇒ T ∈ Π∗ implies S ² T, and complete for Σ if S ² T implies
S ⇒ T ∈ Π∗. Furthermore, we call Π
H a relative implication cover on H ⊆ Σ if for all
S, T ⊆H we have
S ⇒T ∈Π∗
Note that the relationship of implication covers and relative implication covers is the same as for covers and relative covers: For any implication cover Π the condition
S ⇒T ∈Π∗
H iff S∪(Σ\H)²T
is equivalent to
ΠH ²S⇒T iff Π²S∪(Σ\H)⇒T
which resembles precisely Definition 3.37. In particular this gives us Theorem 3.42 for implication covers:
Corollary 3.45. LetΣbe a set of FDs with implication cover Π andH ⊆Σ. ThenΠ ]H[
is a relative implication cover of Σ on H.
Let us now recall Lemma 3.21. For the hypergraphCC(Σ) it states the following:
Corollary 3.46. Let Σ be a set of FDs and H ⊆Σ∗a. A set S ⊆H is a partial cover on
H iff S∪(Σ∗a\H) is a cover of Σ.
The last condition of Corollary 3.46 is equivalent toS∪(Σ∗a\H)²Σ∗a, and thus to
S∪(Σ∗a\H)²H
Comparing this to Definition 3.44, we can rewrite the condition as
S⇒H ∈Π∗H
for any relative implication cover ΠH of Σ∗a on H. This characterizes S as a key of H
w.r.t. the set of IDs ΠH, giving us the following lemma. Lemma 3.47. Let S ⊆ H ⊆ Σ∗a, and Π
H be a relative implication cover of Σ∗a on H.
Then S is a partial cover of Σ∗a on H iff S ⇒H ∈Π∗
H.
Proof. See above.
The last lemma allows us to find partial canonical covers as follows: We first find a relative implication cover ΠH, then use linear resolution to find all minimal keys w.r.t.
ΠH, which are the partial canonical covers needed.
The next theorem allows us to compute a relative implication cover. To make the soundness proof for a (relative) implication cover easier, we first show a simple lemma.
Lemma 3.48. A set Π of IDs on Σ is sound iff S ² T for all S ⇒T ∈Π. A set ΠH of
IDs on H ⊆Σ is sound iff S∪(Σ\H)²T for all S⇒T ∈ΠH.
Proof. We only need to show thatS²T for all derived IDsS ⇒T ∈Π∗, andS∪(Σ\H)²
T for IDs S ⇒T ∈Π∗
H. For each application of the armstrong axioms for IDs, it is easy
to see that soundness of the premises (i.e.,S ²T orS∪(Σ\H)²T, respectively) implies soundness of the derived IDs.
Theorem 3.49. Let Σ be a set of FDs, EQ the partition of Σ∗a into equivalence classes,
and H = EQX for some set EQX ∈ EQ. Construct ΠX as follows: For every pair of
(different) FDs Y →A ∈H, Z →A∈Σ∗a with Σ²Y →Z let Π
X contain the ID
{Y →Zi ∈H |Zi ∈Z} ∪ {Z →A} ⇒Y →A (3.2)
provided Z →A∈H, or
{Y →Zi ∈H |Zi ∈Z} ⇒Y →A (3.3)
otherwise. Then ΠX is a relative implication cover of Σ∗a on H.
Proof. We first show that ΠX is sound. By Lemma 3.48 it suffices to show that for every
ID in ΠX of the form (3.2) or (3.3) we have
{Y →Zi ∈H |Zi ∈Z} ∪ {Z →A} ∪(Σ∗a\H)²Y →A (3.4)
For every Zi ∈Z\Y there is a minimal Yi ⊂Y such that Yi →Zi ∈Σ∗a. If Yi 6=Y, then
Yi and Y are not equivalent, since Y is a minimal LHS. ThusYi →Zi ∈Σ∗a\H, so that
allYi →Zi are contained in the LHS of (3.4). Clearly {Yi →Zi |Zi ∈Z\Y} ∪ {Z →A}
implies Y →A.
To prove that ΠX is complete, let S, T ⊆H with S∪(Σ∗a\H)²T. We need to show
that S ⇒ T ∈ Π∗
X. Assume the contrary, so that for U0 :=S∪(Σ∗a\H) there exists a
FD Y0 →A0 ∈T (and thus Y0 →A0 ∈H) with (note that U0 ∩H=S):
U0 ²Y0 →A0 and U0∩H ⇒Y0 →A0 ∈/ Π∗X
Now let U ⊆U0 be minimal such that there exists a FD Y →A∈H for which
U ²Y →A and U ∩H ⇒Y →A /∈Π∗
X
Consider closure computation for Y underU: Since we haveU ²Y →A there must be a FDZ →A∈U such thatUA:=U\{Z →A}impliesY →Z. EquivalentlyUA ²Y →Zi
for all Zi ∈Z. SinceUA (U and U was chosen minimal, we get
UA∩H ⇒Y →Zi ∈Π∗X
for all Y →Zi ∈H, Zi ∈Z. SinceUA∩H ⊆U0∩H =S this gives us
S ⇒ {Y →Zi ∈H |Zi ∈Z} ∈Π∗X
If Z →A ∈H then Z →A ∈U ∩H ⊆S, and since ΠX contains the ID (3.2) it follows
that
S ⇒Y →A∈Π∗X
which contradict our assumption. ForZ →A /∈Hthe same follows with the ID (3.3). The size of the relative implication cover of EQX constructed is clearly polynomial
in the size of Σ∗a. We note that using Theorem 3.36 to split up the problem of finding
canonical covers into finding partial canonical covers for equivalence classes of FDs is helpful in two ways. First it allow us to represent the set of all canonical covers in an efficient manner. At the same time it simplifies the problem of finding implication covers by allowing for small relative implication covers. As example 3.7 demonstrates, it can happen that every implication cover of Σ∗a is exponential in the size of Σ∗a.
Example 3.7. LetX1. . . X2n, Y1. . . Yn, A be attributes and
X =X1. . . X2n, Xi =X\Xi, Y =Y1. . . Yn, Yi =Y \Yi
be attribute sets. Let further
Σ = X1 →Y 1, X2 →Y1, X3 →Y 2, X4 →Y2, . . . . . . X2n−1 →Y n, X2n→Yn, Y →A
and thus (note that Xi∪Xj =X for i6=j)
Σ∗a = Σ∪ X1Y1 →A, X2Y1 →A, X3Y2 →A, X4Y2 →A, . . . . . . X2n−1Yn→A, X2nYn→A, X →A
Then every implication cover of Σ∗a contains (at least) the 2n atomic IDs
{Z1Y1 →A, Z2 →Y2, Z3 →Y3, . . . , Zn →Yn} ⇒X →A
where each Zi is replaced by X2i−1 or X2i. This is because the FDs in the LHSs do not
imply any other FD in Σ∗a\ {X →A}.