Properties of Functional Dependencies

4.4 Properties of Functional Dependencies

In order to determine all the functional dependencies that exist from a given set of functional dependency, we define an important property of FD called Closure Set of Functional Dependencies.

Closure Set of Functional Dependencies - All the functional dependencies that are implied from a given set of functional dependency, S is called Closure Set of Function

Dependency, S . Hence, it follows that any instance of the relation r that satisfies the given set of FD, S will

+ also satisfy the closure set of this FD, S . In the following sub-sections, we will go through the rules to compute the closure set of

functional dependencies.

4.4.1 Armstrong’s Axioms

Armstrong's axioms are also known as ‘Inference Rules’ which help us infer all the implied functional dependencies from a given set of FDs.

There are three Inference Rules:

1. Reflexivity: If B is a subset of attributes in set A, then A → B. (by trivial FD)

2. Augmentation: If A → B and C is another attribute, then AC → BC Applying reflexivity to this rule, we can also say that, AC → B.

3. Transitivity: If A → B and B → C, then A → C. In addition, we have the following additional rules that can be proved from the above 3

axioms to ease out our task of building the closure set of FD from a given FD.

1. Union: If A → B and A → C, then A → BC.

2. Decomposition: If A → BC, then A → B and A → C.

Chapter 4 – Relational Database Design 95 Armstrong’s Axioms are sound and complete. They generate only FDs in the closure set of

+ a given FD, S and they generate the complete set of FDs in S .

4.4.2 Computing the closure set of attributes

This is an alternate method to build the closure set of functional dependencies from a given FD. It can also be used to determine if a given attribute set is the super key in a relation.

Closure set of attributes of a given attribute, A, is set of all attributes in the relation, R that can be uniquely determined by A, based on the given FDs. Note: Given closure(A), and A + is such a set that it includes all the attributes in a given

relation R, then we can say that attribute A is a super key for the relation R.

Computation

Given a relation, R with a set of attributes, we calculate closure set of attributes for A, closure (A) as follows:

1. Initially set closure (A) = A

2. For each given FD, if A → B, then add B to closure (A), that is, closure (A) U B

3. For any subset of A, (let C be a subset of A), A → C (by trivial FD) and if C → D such that D is not a subset of A, then add D to the closure (A)

4. Repeat step 3 until there are no more attribute sets to be added to closure (A)

Example

Consider a relation, R (A, B, C, D, E) with the given FDs A → B, B → DE and D → C

Computation

Step 1. Closure (A) = A Step 2. A → B, hence closure (A) = A U B, can be denoted as AB Step 3.

1 st Iteration: B → DE and B is now a subset of closure (A), hence closure (A) = ABDE

2 nd Iteration: AD → C, D is a subset of closure (A) and C in not a subset of closure (A),

hence closure (A), A + = ABDEC.

Similarly, closure (B), B + = BDEC Closure(C), C + =C + Closure (D), D = DC Closure (E), E + =E

Database Fundamentals

4.4.3 Entailment

Functional Dependencies (FDs) guide us on how to best decompose relations so that the dependent values may be stored in a single table.

When data is inserted into the database, it needs to conform to the constraints specified. Apart from other integrity constraints, the data also needs to conform to the functional dependencies.

The properties of functional dependencies help us reason about the closure set of functional dependencies so that we have a structured formula to derive an exhaustive set of constraints to effectively model the real-world dependencies.

Armstrong’s Axioms help us work out such a sound and complete set. The Closure of Attributes for a given set of functional dependencies not only provides an alternate method to calculate the closure set of FDs but also help us determine the super key of a relation and check whether a given functional dependency, X → Y belongs to the closure set of functional dependency.