Attribute Closure X+X^+ with Respect to Functional Dependencies FF: Definition and Algorithm

Attribute Closure X+X^+ with Respect to Functional Dependencies FF: Definition and Algorithm

Verified Sources
Sep 13, 2026

In relational database theory, the attribute closure X+X^+ (also written as XF+X_F^+ when emphasizing dependence on FF) is the set of all attributes that are functionally determined by a starting set of attributes XX using a set of functional dependencies (FDs) FF. Formally, X+X^+ is the set of attributes AA such that FXAF \models X \to A (i.e., XAX \to A is logically implied by FF).

A core motivation is that once you compute X+X^+, you can answer common reasoning tasks:

  • Does FXYF \models X \to Y? (Equivalent to YX+Y \subseteq X^+)
  • Find implied dependencies and support lossless reasoning for keys.
  • Test candidate keys by checking whether some X+X^+ contains all attributes.

Key terms introduced here:

  • Attribute closure
  • Functional dependency (FD)
  • Logical implication of FDs
  • Key
  • FD implication test

Attribute Closure (X+) and FD Inference

Definition (what X+X^+ means)

Given:

  • attribute sets X,Y,Z,X, Y, Z,\dots
  • a set of FDs FF

the attribute closure X+X^+ is:

X+  =  {AFXA}.X^+ \;=\;\{\, A \mid F \models X \to A \,\}.

In other words, X+X^+ contains exactly those attributes AA that you can derive as consequences of applying FDs in FF, starting from the assumption that XX holds.

A practical corollary:

  • FXYF \models X \to Y iff YX+Y \subseteq X^+.

This equivalence is the main “reasoning hook” for closure-based algorithms.

[CalloutBlock]
type: "tip"
title: "How to think about closure"
content: "Compute X+X^+ as “everything you can force to be equal (determined) if you know XX.” If YY is inside X+X^+, then XX determines YY under FF."

Why the closure algorithm works (intuition)

The standard closure computation repeatedly applies FDs whose left-hand sides are already “known” to be determined. Concretely:

  1. Start with X+X^+ containing the initially known attributes XX.
  2. If an FD UVU \to V in FF has UX+U \subseteq X^+, then you can conclude VX+V \subseteq X^+.
  3. Repeat until no more attributes can be added.

This is essentially computing a fixed point of repeated rule application, matching the semantics of logical implication for FDs (via Armstrong-style derivations).

Key terms:

  • Fixed point
  • Repeated application
  • Termination
  • Minimal augmentation step
  • Monotonicity

Algorithm: Compute attribute closure $X^+$ with respect to FDs $F$

  1. 1
    Step 1

    Set X+:=XX^+ := X.

  2. 2
    Step 2

    While there exists an FD UVU \to V in FF such that UX+U \subseteq X^+ and VsubseteqX+V subseteq X^+, update X+:=X+VX^+ := X^+ \cup V.

  3. 3
    Step 3

    When no FD can add new attributes, return the final X+X^+.

“Commuting” X+X^+ for XX (order-independence / correctness idea)

In many courses, “commuting” here refers to the fact that the order in which FDs are applied does not affect the final closure: regardless of which eligible FD you apply first, you still reach the same fixed point X+X^+.

You can view the algorithm as follows:

  • At any time, the current working set SS (initially S=XS=X) satisfies SX+S \subseteq X^+.
  • Each time you apply an FD UVU \to V with USU \subseteq S, you enlarge SS to SVS \cup V while preserving SX+S \subseteq X^+.
  • Because SS only grows and there are finitely many attributes, the algorithm terminates.
  • Once you reach a fixed point (no FD left with LHS contained), that fixed point must equal the least such fixed point—i.e., the true closure X+X^+.

This yields the “commuting” property:

  • Different application orders of eligible FDs commute to the same final closure.

[CalloutBlock]
type: "warning"
title: "Common mistake"
content: "Do not stop after a single pass over FF. Newly added attributes can enable additional FDs later, so you must iterate until no more attributes can be added."

Worked micro-example (closure computation)

Suppose:

  • F={AB,  BC,  AD}F = \{ A \to B,\; B \to C,\; A \to D \}
  • X={A}X = \{A\}

Compute:

  • Start: X+={A}X^+ = \{A\}
  • Apply ABA \to B: X+={A,B}X^+ = \{A,B\}
  • Apply BCB \to C: X+={A,B,C}X^+ = \{A,B,C\}
  • Apply ADA \to D: X+={A,B,C,D}X^+ = \{A,B,C,D\}
    No further FDs add attributes, so X+={A,B,C,D}X^+ = \{A,B,C,D\}.

Thus FACF \models A \to C and FADF \models A \to D, and so on.

Closure Growth Illustration (conceptual)

Conceptual view: each satisfied FD adds attributes to the closure until a fixed point is reached.

Practice & Edge Cases

Closure Computation Lifecycle (fixed-point iteration)

Seed

1

Set S:=XS:=X (initially known attributes)."

FD Activation

2

If some FD UVU\to V has USU\subseteq S, activate it."

Augment

3

Update S:=SVS := S \cup V (grow the determined attributes)."

Fixed Point

4

Stop when no FD can add new attributes; return S=X+S=X^+."

Knowledge Check

Question 1 of 3
Q1Single choice

Given a set of functional dependencies FF, you compute the attribute closure X+X^+ (with respect to FF). Which condition is equivalent to FXYF \models X \to Y?