X → Y iff any two tuples that agree on X value also agree on Y value
Inference of Functional
Dependencies
• Suppose R is a relation scheme, and F is a set of functional
dependencies for R
• Example
if F = { A → B, B → C } then F | − A → C
A B C
if F = { S → A, SI → P } then
F | − S I → AP, F | − SP → SAP etc. I P
S A
Functional Dependency
• Issue:
– How to represent set of ALL FD’s for a relation R?
• Solution
– Find a basic set of FD’s ((canonical) cover)
– Use axioms for inferring
– Represent the set of all FD’s as the set of FD’s that can be inferred
from a basic set of FD’s
• Axioms
– they must be a sound and complete set of inference rules
Set of Functional Dependencies F*
• Formal Definition of F*, the cover of F:
• Informal Definitions
– F* is the set of all FD’s logically implied by F
(entailed)
• Formal Definition
if F is a set of FD’s, then F+≡ { X → Y F |= X → Y }
Armstrong’s Axioms
Theorem:
Armstrong’s axioms are a sound and complete
set of inference rules
• Here
– Proof of the completeness
For the proof, we can use:
Armstrong’s Theorems
• Additional rules derived from axioms
– Union
if A → B and A → C, then A → BC
A B
– Decomposition C
if A→ BC, then A → B and A → C
B
A
C
Completeness of the
Armstrong’s Axioms
• Proving that Armstrong’s axioms are a
complete set of inference rules
F* ⊆ F +
Completeness of the
Armstrong’s Axioms
• First define X+, the closure of X with respect to F:
X+ is the set of attributes A such that X → A can be deduced
from F with Armstrong’s axioms
• Note that we can deduce that X → Y for some set Y by
applying Armstrong’s axioms if and only if Y ⊆ X+
Example:
Attr(R)=LMNO
X=L L M N
F={L → M , M → N, O → N}
O
then X+ = L+ = LMN
+
X → Y ∈ F <=> Y ⊆ X+
• Proof: We can deduce that X → Y for some set Y by applying
Armstrong’s axioms if and only if Y ⊆ X+
Y ⊆ X+ ⇒ X → Y ∈ F+
• Y ⊆ X+ and suppose that A ∈Y then X → A ∈ F+ (definition of X+)
∀ ∀ A ∈Y: X → A ∈ F+
• X → Y ∈ F+ (union rule)
X → Y ∈ F+ ⇒ Y ⊆ X+
• X → Y ∈ F+ and suppose that A ∈Y then X → A ∈ F+
(decomposition rule)
• A ∈ X+ (definition of X+)
∀ ∀ A ∈Y: A ∈ X+
• Y ⊆ X+
Completeness (F* ⊆ F +) of the
Armstrong’s Axioms
• Completeness:
(In other words) there is a relational instance r in R (r∈R) in which all the
dependencies in F are true, but X → Y does not hold
Counter example!!
Completeness of the
Armstrong’s Axioms
• Example for the proof idea for a given R, F, X:
If X → Y cannot be deduced using Armstrong’s axioms: then there
is a relational instance for R in which all the dependencies in F are
true, but X → Y does not hold
R=LMNO L → O cannot be
X=L L M N deduced (so not in F+)
F={L → M , M → N, O → N} but also does not hold
O
then X+ = LMN (not in F*)
Counter example:
What we want to prove thus:
(∀R, ∀ X,Y ⊆Attr(R), ∀F true in R : : X → Y ∉ F+ => X → Y ∉ F*)
11…1 11…1
1 1 …. 1 00…0
Completeness of the
Armstrong’s Axioms
• Check that all the dependencies in F are true
– Extended Example (more tuples)
• O → N is a dependency in F but O is not a subset of X+,
the dependency holds in r0
• M → N is a dependency in F and M is a subset of X+, then
both L → M, and L → N can be deduced by Armstrong’s
axioms. This means that N is a subset of X+, and thus M →
N holds in r0
R=LMNO
X=L
F={L → M , M → N, O → N}
then X+ = LMN
Completeness of the
Armstrong’s Axioms
(∀R, ∀ X,Y ⊆Attr(R), ∀F true in R : : X -> Y ∉ F+ => X -> Y ∉ F*)
11…1 11…1
1 1 …. 1 00…0
Completeness of the
Armstrong’s Axioms
• We have proved the correctness (last module) and
here, the completeness of Armstrong’s
Axioms:
– How can we prove the completeness of another set
of rules?
• Repeat the proof for this set
• Deduce the Armstrong’s Axioms from this set
– How can we disprove the completeness of another
set of rules?
• By showing (via a counterexample) that some
consequence of Armstrong's rules cannot be deduced
from them (see the proof technique for non-redundancy)
Completeness of the
Armstrong’s Axioms
• Exercise
– Are the following set of rules a sound and complete set of
inference rules? (X, Y, Z, W ⊆ R)
S1: X → X
S2: if X → Y then XZ → Y
S3: if X → Y, Y → Z then XW → ZW
if X → Y , Y → Z then by F3 X →Z X → Y ,Y → Z S3
so by F2 XW → ZW XW → ZW
Solution (completeness)
if Y ⊆ X then ∃Z :: YZ = X so {S1} Y → Y, hence X → Y
{S2}YZ → Y A1
if X →Y , Y →Z X → Y ,Y → Z A3
hence
then {S3} X ∪0
/ →Z ∪0
/ X →Z
Completeness of the
Armstrong’s Axioms
• Exercises
– Are the following set of rules a complete set of inference rules?
R1: X → X
R2: X → Y then XZ → Y
R3: X → Y, Y → Z then X → Z
Ø A B AB
Suppose
1 1
Ø A
Att ( R ) = { A, B}, F = {0/ → A}
Apply above rules exhaustively 1 1
B → AB obtained from F1-3
B AB 1 1 1
but not from R1-3 1 1 1 1
Hence: answer is NO
Summary
• We have learned how to prove that the
Armstrong axiom set is complete (and
we already knew it is sound)
• We can now prove the soundness and
completeness of any other set of
axioms
• Extra Question:
– Can we have a sound and complete set of
inference rules consisting of only 2 rules?
– What about 1 rule?
to follow