Databases: An Axiom System for Functional Dependencies

Axiom System of Functional Dependence

In this chapter, the most important thing is several relationship solving algorithms, which will be sought after.

Each algorithm is well organized and recorded.

basic definition

{ X → Y , Y → Z } ⊨ X → Z \{X→Y,Y→Z\}⊨ X→Z { XAND ANDZ}XZ where: ⊨ means logical implication.

Definition 6.6 (logical implication): Let F be a set of functional dependencies satisfied by the relational schema R(U), and X→Y is a functional dependency of R that is not included in F. If any of the functional dependencies in F is satisfied The specific relationship r also satisfies X → YX→YXY , then the functional dependency set F logically implies the functional dependency X→Y, or X→Y can be deduced from F. Can be expressed as:F ⊨ X → YF ⊨ X → YFXY

Definition 6.7: The whole set of functional dependencies logically implied by the functional dependency set F is called the closure of F, denoted as F + F^+F+,即 F + = { X → Y | F ⊨ X → Y } F^+=\{X→Y|F⊨X→Y\} F+{ XYFXY}

Armstrong Axiom System

basic rules

A1: Reflexivity If YX, then X→Y holds, which is a trivial functional dependency.

According to A1, trivial functional dependencies such as X→Ф, U→X, etc. can be derived (because ϕ ⊆ X ⊆ U \phi \subseteq X \subseteq UϕXU)。

A2: Augmentation
if X→Y, and Z ⊆ WZ \subseteq WZW , then XW→YZ is established.

A3: Transitivity:
If X→Y and Y→Z, then X→Z holds.

inference

Corollary 1: The Union Rule
{ X → Y , X → Z } ⊨ X → YZ {X→Y, X→Z}⊨ X→YZXYXZXYZ

Inference 2: The Decomposition Rule (The Decomposition Rule)
If X → Y , Z ⊆ Y , then X → Z is established If X\to Y, Z\subseteq Y, then X→Z is establishedif xYZY , then XZ established

Corollary 3: The Pseudo Transitivity Rule
${X→Y,WY→Z}⊨ XW→Z $

Theorem 6.1: Young A i ( i = 1 , 2 , … , n ) A_i(i=1, 2, …, n)Ai(i=12,n ) is an attribute of relation schema R, thenX → ( A 1 , A 2 , … , A n ) X→ (A_1, A_2, …,A_n)X(A1A2,An) is the necessary and sufficient condition for the establishment of X→Ai to be established.

property set closure

Assuming a relational schema R(U), U={A1, A2,...,An}, X is a subset of U, and F is a functional dependency set on U, then the closure of the attribute set X with respect to the functional dependency set F XF + X_F^+XF+defined as:

$ X_F^+={Ai{|}Ai∈U, and X→Ai can be deduced from F by Armstrong}$

In short, it is an attribute set. On a dependency set, all the attributes that can be derived are the closure of this attribute set on the dependency set.

seek closure

Recursive algorithm:

  • (1) 令 X ( 0 ) = X , i = 0 X(0)=X,i=0 X(0)=Xi0

  • (2) KaTeX parse error: Undefined control sequence: \and at position 47: …)V \to W \in F \̲a̲n̲d̲ ̲V \subseteq X^{…

  • (3) X ( i + 1 ) = X ( i ) ∪ B X^{(i+1)}=X^{(i)} ∪B X(i+1)X(i)B

  • (4)判断 X ( i + 1 ) = X ( i ) X^{(i+1)}= X^{(i)} X(i+1)=X( i ) ?

  • (4)若 X ( i + 1 ) ≠ X ( i ) X^{(i+1)} \not= X^{(i)} X(i+1)=X(i),则用 i + 1   r e p l a c e   i i+1 \space {replace} \space i i+1 r e p l a c e i   , return(2)

  • (5)若 X ( i + 1 ) = X ( i ) X^{(i+1)} = X^{(i)} X(i+1)=X(i),则 X F + = X ( i ) X_F^+=X^{(i)} XF+=X( i ) , end

Summarize

In fact, we have an original set XXX , for the original set, we find on the dependent set what can be derived about the attribute set.

Use one dependency at a time, XXX expands a bit until complete.

Equivalence and coverage of functional dependencies

minimal set of dependencies

Lemma 6.1: Let G be a set of functional dependencies in which all dependent right parts have only one attribute, then G covers any set of functional dependencies whose left part is the same as G(left part).

A functional dependency set F may have several equivalent functional dependency sets, from which we can choose a better functional dependency set for application.

Standards are at least:

All functional dependencies are independent, that is, there is no such functional dependency in the functional dependency set, and it can be deduced from other functional dependencies in this set .

It represents the simplest, that is, the right part of each functional dependency is a single attribute, and the left part is the simplest (must be completely dependent) .

Definition 6.10 (Minimum Functional Dependency Set) : If the functional dependency set F satisfies the following conditions, then F is called the minimum function coverage, recorded as Fmin:

  • (1) The right-hand side of every functional dependency in F is a single attribute. ( right side is easiest )

  • (2) If any function in F depends on X→A, F-{X→A} is not equivalent to F.

    • (A can only depend on an entire attribute set, that is, there is only one X → AX \to AXA ,no redundant functional dependencies)
  • (3) For any functional dependency X→A in F, {F-{X→A}}∪{Z→A} is not equivalent to F, where Z is any proper subset of X.

    • ( The left part should be the simplest, and the subset of the left part cannot replace the left part )

in conclusion:

  1. The right part is the easiest
  2. The left side is the easiest
    1. Note the simplest difference between left and right
  3. no redundant dependencies

Selection of candidate keywords

First recall what a code is:

k → a b s U k \to^ {abs} U kabsU

Attribute tuples are completely dependent on the code


Given a relational schema R(U, F), U={A1, A2,...An}, F is the functional dependency set of R, then the visible attributes are divided into the following four categories:

  • L: attributes that appear only on the left side of the functional dependency set F
  • R: Attributes appearing only in the right part of the functional dependency set F
  • LR: Attributes appearing in both the left and right parts of the functional dependency set F
  • NLR: Attributes that do not appear in the left and right parts of the functional dependency set F

Rules for finding candidate codes

  • (1) If there is an attribute that does not appear in the functional dependency set, it must be included in the candidate code
  • (2) If there is an attribute that does not appear to the right of any functional dependency in the functional dependency set, then it must be included in the candidate code
  • (3) If there is an attribute that only appears on the left side of the functional dependency set, then the attribute must be included in the candidate code
  • (4) If there is an attribute or attribute group that can uniquely identify the tuple, it is a candidate code (test result)

The result is a dependency preserving decomposition in 3NF

Don't need to master it? ? ?

Recall what maintain dependencies are:

That is, after decomposition, the dependency has not been reduced

Lossless:

That is, after splicing, it can be restored

One is decomposed into two, and its intersection function depends (not depends) on its difference, and it is lossless.

Think about it, the intersection represents the public part, if the public part can determine their respective private parts, then it must be restored after natural splicing.

The result is a decomposition in 3NF with dependency-preserving and connection-indistortion

Guess you like

Origin blog.csdn.net/interval_package/article/details/125111515