5.2 Armstrong's Axioms & Secondary Inference Rules
π‘ Core Intuitionβ
π³ The Everyday Analogy: The Chain of Legal Logicβ
Imagine legal statutes establishing corporate responsibility:
- Rule 1 (Reflexivity): If you buy a company along with its fleet of delivery trucks, you obviously own the trucks. If , knowing naturally gives you .
- Rule 2 (Augmentation): If knowing a customer's Social Security Number uniquely identifies their Name, then knowing both their SSN and their Shoe Size will also uniquely identify their Name and their Shoe Size. Adding neutral context to both sides preserves truth.
- Rule 3 (Transitivity): If your Account Number determines your Client ID, and your Client ID determines your Credit Rating, then your Account Number directly determines your Credit Rating.
π» Bridging to Computer Scienceβ
Armstrong's Axioms (formulated by William W. Armstrong in 1974) are a sound and complete set of inference rules used to logically derive all functional dependencies implied by an initial set of functional dependencies .
π Core Deep-Dive & Conceptsβ
1. Soundness and Completenessβ
Armstrong's Axioms hold two profound mathematical properties:
- Soundness: Every functional dependency generated by applying these axioms to a set is logically valid and guaranteed to hold on every relation instance that satisfies . No false or illegal dependencies can ever be derived.
- Completeness: Repeated application of these axioms is guaranteed to discover all functional dependencies logically implied by . The closure is completely exhaustible.
2. The Three Primary Armstrong Axiomsβ
A. Axiom 1: Reflexivity Ruleβ
If is a subset of , then functionally determines :
- Example: holds unconditionally.
B. Axiom 2: Augmentation Ruleβ
If holds, and is any arbitrary set of attributes, then concatenating to both sides produces a valid dependency:
- Example: If , then .
C. Axiom 3: Transitivity Ruleβ
If functionally determines , and functionally determines , then functionally determines :
3. Secondary Derived Rules & Step-by-Step Formal Proofsβ
Using only the three primary axioms, database theorists derive four secondary rules that significantly accelerate closure and candidate key calculations:
A. The Union (Additive) Ruleβ
Statement: If and , then .
Mathematical Proof:
- (Given)
- (By Augmentation with )
- (Given)
- (By Augmentation with )
- and (By Transitivity).
B. The Decomposition (Projective) Ruleβ
Statement: If , then and .
Mathematical Proof:
- (By Reflexivity)
- (Given)
- and (By Transitivity).
- Similarly, , so by Transitivity .
Crucial Warning: Decomposition operates only on the Right-Hand Side (Dependent)! You can split the RHS, but you can NEVER split the Left-Hand Side (Determinant).
If , this does NOT mean or .
C. The Pseudo-Transitivity Ruleβ
Statement: If and , then .
Mathematical Proof:
- (Given)
- (By Augmentation with )
- (Given)
- and (By Transitivity).
D. The Composition Ruleβ
Statement: If and , then .
Mathematical Proof:
- (By Augmentation with )
- (By Augmentation with )
- and (By Transitivity).
4. Common Logical Fallacies in Database Inferenceβ
When solving normalization problems, beware of these three common logical fallacies:
| Invalid Inference Statement | Why It Fails Mathematically | Counter-Example |
|---|---|---|
| LHS Decomposition: | The determinant may require both attributes jointly to uniquely identify . | (Course, Semester) -> Professor. Neither Course nor Semester alone determines the professor. |
| LHS Augmentation Reduction: | could be an essential attribute without which cannot be determined. | (Roll_No, Subject) -> Marks. Removing Subject breaks uniqueness. |
| Commutativity: | Functional determination is strictly directional ( does not imply ). | SSN -> Date_of_Birth. Thousands of citizens share the same birthday. |
π Architecture / Visual Blueprintβ
π In The Real World: Production Case Studyβ
Schema Validation & Query Plan Simplification in Calcite & Spark SQLβ
Modern SQL query compilers (like Apache Calcite, used in Snowflake and Apache Spark) use Armstrong's Axioms during the query planning phase:
- The Scenario: A user writes a complex join query grouping on
(customer_id, country_code)and requestingSUM(order_total). - The Semantic Metadata: The database schema defines:
customer_id -> country_code(Every customer has a fixed country).
- The Compiler Optimization: Applying Armstrong's Reflexivity and Transitivity, Calcite realizes that grouping by
customer_idalready functionally determinescountry_code. - The Production Result: The query compiler rewrites the execution tree, removing
country_codefrom the in-memory hash aggregation operator. This eliminates of hashing key bytes in RAM, speeding up aggregation on million rows by .
π― Exam & Interview Pitfall Checkβ
Question 1: Prove the Composition Rule () using only the primary Armstrong Axioms.
Answer:
- Start with the given dependency .
- Augment both sides with attribute set :
- Start with the second given dependency .
- Augment both sides with attribute set :
- Combine steps 2 and 4 using Transitivity:
Hence, is proven.
Question 2: Why is the set of Armstrong Axioms called "Sound and Complete"?
Answer:
- Sound: Any functional dependency derived using Armstrong's Axioms is guaranteed to be logically true for all relation instances that satisfy the original dependencies. No false dependencies are generated.
- Complete: Armstrong's Axioms are sufficient to derive every single valid functional dependency logically implied by the original set. No external or missing inference rules exist.
Trap 1: "If A β B and C β B, does this imply A β C?"
Answer: Absolutely not. Two distinct attributes determining the same dependent does not create any functional dependency between them. For instance, both Student_ID -> College_Name and Professor_ID -> College_Name, but Student_ID does not determine Professor_ID.
Trap 2: "Can you decompose the left-hand side of a dependency like AB β C into A β C and B β C?"
Answer: Strictly No! This is one of the most fatal errors in database exams. Decomposition applies exclusively to the right-hand side. requires both and together to determine .