Closure of functional dependencies

Given a set of functional dependencies, there are certain other functional dependencies that are logically implied by .

The set of all functional dependencies logically implied by is called the closure of , and is denoted as .

Armstrong’s axioms

For any set of functional dependencies, the closure of can be obtained by repeatedly applying Armstrong’s axioms.

Let be sets of attributes of a relation schema with the set of functional dependency .

  • Reflexive rule:
  • Augmentation rule:
  • Transitivity rule:

The above rules are both

  • Sound: Generates only the functional dependencies that actually hold.
  • Complete: Generates all the functional dependencies that hold.

Some additional rules can be inferred from Armstrong’s axioms.

  • Union rule:
  • Decomposition rule:
  • Pseudo-transitivity rule:

Closure of attribute sets

Similarly as functional dependencies, a closure of an attribute set under , denoted by , can be defined.

The set of all attributes that are functionally determined by under are called the closure of , and is denoted as .

Usages of attribute closures

Attribute closures can be used for various purposes:

  • Testing for superkey
    • Testing if is a superkey can be done by checking if .
  • Testing functional dependencies
    • Testing if a functional dependency is in can be done by checking .
  • Computing the closure
    • can be obtained by finding for each , and for each , outputting a functional dependency .

Algorithms for computing closures

Algorithm for computing

F_closure = F
REPEAT
  FOR EACH f IN F_closure
    APPLY reflexivity AND augmentation ON f
    ADD TO F_closure
  FOR EACH PAIR f1, f2 IN F_closure
    IF f1 AND f2 APPLY transitivity
    THEN ADD TO F_closure
UNTIL (F_closure CONVERGE)

Algorithm for computing

A_closure = A
REPEAT
  FOR EACH beta -> gamma IN A
    IF beta IN A_closure
    THEN ADD gamma TO A_closure
UNTIL (A_closure CONVERGE)

Closure of multivalued dependencies

The concept of closures can also be applied to multivalued dependencies.

First, note that from the definition of multivalued dependencies:

  • .

Given a set of multivalued dependencies, the closure is the set of all functional and multivalued dependencies logically implied by .