- Published on
How to Find Attribute Closure Using Armstrong’s Axioms in DBMS
Table of Contents
How to Find Attribute Closure Using Armstrong’s Axioms in DBMS
In database design, the closure of a set of attributes (denoted as X⁺) is the set of all attributes that can be functionally determined from a given attribute set X using a given set of functional dependencies (FDs). This process is vital for checking whether a set of attributes is a super key and plays a central role in normalization and schema refinement.
We use Armstrong’s Axioms (Reflexivity, Augmentation, and Transitivity) to calculate the attribute closure.
🧠 Why Attribute Closure Matters
- ✅ Verifies whether an attribute (or set) is a super key
- ✅ Helps in decomposition and normal form identification
- ✅ Identifies implied dependencies from a known set of FDs
🔍 Step-by-Step Method to Compute Closure
Given:
- A set of attributes X
- A set of functional dependencies F
We want to compute X⁺ (the closure of X under F).
✅ Algorithm:
-
Start with
X⁺ = X -
Repeat:
- For each functional dependency
A → Bin F - If
A ⊆ X⁺, then addBtoX⁺
- For each functional dependency
-
Continue until no more attributes can be added to
X⁺
📘 Example 1: Simple Closure Calculation
Let’s say you have:
-
Attributes:
{A, B, C, D} -
Functional Dependencies (F):
- A → B
- B → C
- A → D
Find the closure of {A} (i.e., A⁺).
🔎 Steps:
Start: A⁺ = {A}Apply A → B ⇒ A⁺ = {A, B}Apply B → C ⇒ A⁺ = {A, B, C}Apply A → D ⇒ A⁺ = {A, B, C, D}
✅ Final closure: A⁺ = {A, B, C, D}
So, A is a super key for this relation.
📘 Example 2: Check if X is a Super Key
Given:
-
F:
- A → B
- B → C
- CD → E
- E → F
-
Find: Is
{A, D}a super key?
🔎 Steps:
Start with (A, D)⁺ = {A, D}
A → B ⇒ Add B → {A, B, D}B → C ⇒ Add C → {A, B, C, D}CD → E: C and D are in closure ⇒ Add E → {A, B, C, D, E}E → F ⇒ Add F → {A, B, C, D, E, F}
✅ Final closure: {A, B, C, D, E, F}
Yes, {A, D} is a super key.
🧮 Use Cases of Attribute Closure
| Use Case | Purpose |
|---|---|
| Super Key Check | Determines if X can uniquely identify all attributes |
| Minimal Cover Computation | Helps in simplifying the FD set |
| Normalization | Essential for 2NF, 3NF, and BCNF decomposition |
| FD Inference | Finds all implied dependencies from a known FD set |
📘 Quick Recap of Armstrong's Axioms
| Axiom | Rule Description | Example |
|---|---|---|
| Reflexivity | If Y ⊆ X then X → Y | {A, B} → A |
| Augmentation | If X → Y then XZ → YZ | A → B ⇒ AC → BC |
| Transitivity | If X → Y and Y → Z, then X → Z | A → B, B → C ⇒ A → C |
✅ Final Thoughts
Attribute closure is a foundational concept in DBMS and normalization. With a solid grasp of Armstrong’s Axioms, you can confidently determine super keys, simplify FDs, and ensure your database design is efficient and consistent.