Ora

What is the minimal set of functional dependencies?

Published in Database Normalization 5 mins read

A minimal set of functional dependencies, widely known as a minimal cover, is the smallest possible set of functional dependencies that can logically derive all functional dependencies in a given original set. It represents a non-redundant and simplified representation of the full set of dependencies for a relation.

Understanding the Minimal Set of Functional Dependencies

A set of functional dependencies (FDs), let's call it F, is considered a minimal cover of another set of FDs, G, if F is the smallest set of functional dependencies that covers G. This means that every functional dependency in G can be inferred from F, and F itself cannot be further reduced without losing its ability to infer all dependencies in G. More formally, F covers G if G+ ⊆ F+, where + denotes the closure of the set of functional dependencies.

The concept of a minimal cover is crucial in database design, particularly in the process of normalization. It helps in:

  • Reducing Redundancy: By eliminating superfluous dependencies, it ensures that the database schema is as concise and efficient as possible.
  • Simplifying Schema Analysis: A smaller set of FDs is easier to understand and manage, facilitating better database design decisions.
  • Ensuring Non-Loss Decomposition: It aids in decomposing relations into smaller, well-structured relations without losing information.

Characteristics of a Minimal Cover

A set of functional dependencies F is considered a minimal cover if it satisfies the following three conditions:

  1. Single Attribute Right-Hand Side: Every functional dependency in F has only a single attribute on its right-hand side. For example, A → B, C would be decomposed into A → B and A → C.
  2. No Extraneous Attributes on Left-Hand Side: For every functional dependency X → A in F, the set X contains no extraneous attributes. An attribute B in X is extraneous if (X - B) → A can still be inferred from F.
  3. No Redundant Functional Dependencies: No functional dependency in F is redundant. A functional dependency X → A in F is redundant if it can be inferred from the other functional dependencies in F - {X → A}.

Steps to Find a Minimal Cover

Finding a minimal cover for a given set of functional dependencies (G) involves a systematic three-step process:

  1. Decompose Composite Right-Hand Sides:

    • For every functional dependency X → A1, A2, ..., An in G, replace it with individual functional dependencies: X → A1, X → A2, ..., X → An.
    • Example: If A → BC is in G, replace it with A → B and A → C.
    • Reference: Database System Concepts
  2. Eliminate Extraneous Attributes from Left-Hand Sides:

    • For each functional dependency X → A in the current set F:
      • For each attribute B in X:
        • Calculate the closure of X - B using the dependencies in F.
        • If A is in the closure of (X - B)+ (i.e., (X - B) → A can be derived), then B is extraneous. Remove B from X, effectively replacing X → A with (X - B) → A.
    • Example: If AB → C and A → C can be inferred from the current set, then B is extraneous in AB → C. The FD should be A → C.
    • Reference: Relational Database Theory
  3. Remove Redundant Functional Dependencies:

    • For each functional dependency X → A in the current set F:
      • Temporarily remove X → A from F to form a new set F' = F - {X → A}.
      • Calculate the closure of X using only the dependencies in F'.
      • If A is in the closure of X+ based on F', then X → A is redundant and can be permanently removed from F.
    • Example: If A → B can be derived from A → C and C → B, then A → B is redundant.
    • Reference: Fundamentals of Database Systems

Illustrative Example

Consider a relation schema R(A, B, C, D) with the following set of functional dependencies G:

G = {A → BC, B → D, AD → C}

Let's find its minimal cover:

  1. Decompose Composite Right-Hand Sides:

    • A → BC becomes A → B and A → C.
    • Current set F: {A → B, A → C, B → D, AD → C}
  2. Eliminate Extraneous Attributes from Left-Hand Sides:

    • Consider AD → C:
      • Is D extraneous? Check if A → C can be inferred from F. From A → C in F, yes. So, AD → C can be replaced by A → C.
      • However, A → C is already present. So, this step effectively simplifies redundant expressions.
    • Current set F: {A → B, A → C, B → D} (after removing redundant AD → C if A → C can explain it entirely). Let's re-evaluate more rigorously:
      • For AD → C:
        • Check if D is extraneous: Can (AD - D)+ (i.e., A+) derive C using F?
          • A+ using {A → B, A → C, B → D} is {A, B, C, D}. Since C is in A+, D is extraneous in AD → C.
          • Replace AD → C with A → C.
      • The set F is now: {A → B, A → C, B → D, A → C}. Since A → C is duplicated, we effectively have {A → B, A → C, B → D}.
  3. Remove Redundant Functional Dependencies:

    • Consider A → B:
      • Is A → B redundant? Can it be inferred from {A → C, B → D}?
      • A+ using {A → C, B → D} is {A, C}. B is not in A+. So, A → B is not redundant.
    • Consider A → C:
      • Is A → C redundant? Can it be inferred from {A → B, B → D}?
      • A+ using {A → B, B → D} is {A, B, D}. C is not in A+. So, A → C is not redundant.
    • Consider B → D:
      • Is B → D redundant? Can it be inferred from {A → B, A → C}?
      • B+ using {A → B, A → C} is {B}. D is not in B+. So, B → D is not redundant.

Therefore, the minimal cover F for G is:

F = {A → B, A → C, B → D}

This minimal cover provides the same logical dependencies as the original set but in its most concise form, essential for robust relational database design.