Algorithm Search⌘K

Definitioncore

Fourth normal form (4NF)

Also called 4NF.

A schema in which every nontrivial multivalued dependency has a superkey on its left side, which removes redundancy from independent facts.

Fourth normal form is the normal form of Fagin (1977) for schemas with multivalued dependencies as well as functional ones. It asks what BCNF asks of FDs, a superkey on the left side, of every nontrivial MVD. The normalization page places it in the chain of normal forms, and the BCNF page treats the FD case. This page proves that 4NF implies BCNF, that it is enough to check the given dependencies, and that 4NF and BCNF agree when there are no MVDs.

Definition

Let UU be a finite set of attributes and DD a finite set of FDs and MVDs over UU. We use set semantics. A set X⊆UX \subseteq U is a superkey if D⊨X→UD \models X \to U. An MVD X↠YX \twoheadrightarrow Y is trivial if Y⊆XY \subseteq X or XY=UXY = U, and then it holds in every relation over UU.

Definition (Fagin 1977). (U,D)(U, D) is in fourth normal form if for each nontrivial MVD X↠YX \twoheadrightarrow Y with D⊨X↠YD \models X \twoheadrightarrow Y, the set XX is a superkey.

Each FD X→YX \to Y gives the MVD X↠YX \twoheadrightarrow Y by replication, so the FDs of DD are covered too. With MVDs present, DD can imply FDs that no rule for FDs alone gives, through the coalescence rule, so superkeys must be found with an implication test for FDs and MVDs together, such as Beeri's dependency basis or the chase, not with the attribute closure under the FDs of DD only.

4NF implies BCNF. Let (U,D)(U, D) be in 4NF, and let D⊨X→AD \models X \to A with A∉XA \notin X. If XA=UXA = U, then X→UX \to U follows and XX is a superkey. Otherwise X↠AX \twoheadrightarrow A is a nontrivial MVD that DD implies, by replication, so XX is a superkey by 4NF. So each nontrivial implied FD has a superkey on its left side, which is BCNF. □\square

It is enough to check DD. (U,D)(U, D) is in 4NF if and only if the left side of each nontrivial MVD of DD and of each nontrivial FD of DD is a superkey.

Proof. Only if: each member of DD is implied by DD, and a nontrivial FD X→YX \to Y with XY≠UXY \ne U gives a nontrivial MVD; if XY=UXY = U, then XX is a superkey anyway. If: let KK be the set of FDs X→UX \to U, one for each left side XX of a nontrivial member of DD. Each of these XX is a superkey, so D⊨KD \models K. Each nontrivial member of DD follows from its FD X→UX \to U, and the trivial ones follow from nothing, so K⊨DK \models D. So DD and KK imply the same dependencies. Now let D⊨V↠WD \models V \twoheadrightarrow W be nontrivial, with Z=U−VWZ = U - VW. Then K⊨V↠WK \models V \twoheadrightarrow W. By Fagin's theorem (see Heath's theorem), this means that the split into VWVW and VZVZ is lossless for each relation that satisfies KK. KK holds FDs only, so by the test of the lossless join page, K⊨V→WK \models V \to W or K⊨V→ZK \models V \to Z. Both FDs are nontrivial, because W−VW - V and ZZ are not empty. Every FD of KK has a superkey on its left side, so (U,K)(U, K) is in BCNF, and by the BCNF page, the left side of each nontrivial FD that KK implies is a superkey. So VV is a superkey. □\square

With FDs only, 4NF and BCNF agree. If DD is a set of FDs, then (U,D)(U, D) is in 4NF exactly when it is in BCNF. One direction is the proposition above. For the other, BCNF means that each nontrivial FD of DD has a superkey on its left side, which is the condition of the previous proposition.

4NF decomposition. If a schema violates 4NF with X↠YX \twoheadrightarrow Y, split it into XYXY and X(U−XY)X(U - XY). Fagin's theorem shows that the split is lossless. Repeat on the parts with the MVDs that hold on them. The process stops, since the parts get smaller, and it ends with a lossless 4NF decomposition. Like BCNF decomposition, it may not preserve the dependencies.

A sufficient condition (Date and Fagin 1992). If a schema with FDs and MVDs is in BCNF and has at least one candidate key with a single attribute, then it is in 4NF.

Examples and non-examples

  • BCNF, not 4NF. CTB(C,T,B)\mathrm{CTB}(C, T, B) with course, teacher and book, and D={C↠T}D = \{C \twoheadrightarrow T\}: the teachers and the books of a course are independent. No nontrivial FD follows, so the only key is CTBCTB and the schema is in BCNF. C↠TC \twoheadrightarrow T is nontrivial and CC is not a superkey, so it is not in 4NF. A relation over it stores each teacher of a course once for each book of the course.
  • The 4NF split. Splitting CTB\mathrm{CTB} on C↠TC \twoheadrightarrow T gives CT(C,T)\mathrm{CT}(C, T) and CB(C,B)\mathrm{CB}(C, B). On each part, C↠TC \twoheadrightarrow T and C↠BC \twoheadrightarrow B become trivial, and both parts are in 4NF. A course with pp teachers and qq books needs p+qp + q tuples instead of pqpq.
  • An MVD with a key on the left. Emp(E,N,S)\mathrm{Emp}(E, N, S) with employee, name and salary, and D={E→NS}D = \{E \to NS\}. EE is a key, so every MVD with EE on the left is allowed. The schema is in BCNF and has a key with one attribute, so it is in 4NF by the result of Date and Fagin.
  • Not BCNF, so not 4NF. Emp(E,D,N)\mathrm{Emp}(E, D, N) with F={E→D, D→N}F = \{E \to D,\ D \to N\} violates BCNF with D→ND \to N, and D↠ND \twoheadrightarrow N violates 4NF.
  • No dependencies. With D=∅D = \emptyset, only trivial MVDs hold and the schema is in 4NF.
  • BCNF. BCNF is the same condition for FDs. 4NF implies BCNF, and the two agree when DD has no MVDs.
  • Fifth normal form. 5NF extends the condition to join dependencies and implies 4NF. A schema can be in 4NF and not in 5NF.
  • Multivalued dependency. The MVD page gives the definition, its forms and the inference rules used above.
  • Lossless split. Heath's theorem, in Fagin's form, is the reason the 4NF split loses nothing.

References

  1. Ronald Fagin, Multivalued dependencies and a new normal form for relational databases, ACM Transactions on Database Systems 2(3), 262 to 278 (1977), the definition of fourth normal form, the proof that it implies BCNF, and the decomposition into 4NF
  2. C. J. Date and Ronald Fagin, Simple conditions for guaranteeing higher normal forms in relational databases, ACM Transactions on Database Systems 17(3), 465 to 476 (1992), a BCNF schema with at least one key of one attribute is in 4NF
  3. Catriel Beeri, On the membership problem for functional and multivalued dependencies in relational databases, ACM Transactions on Database Systems 5(3), 241 to 259 (1980), the polynomial test for implication of FDs and MVDs, which finds the superkeys under a set of FDs and MVDs
  4. Serge Abiteboul, Richard Hull and Victor Vianu, Foundations of Databases, Addison-Wesley (1995), Chapter 11 (design and dependencies), fourth normal form
  5. Jeffrey D. Ullman, Principles of Database and Knowledge-Base Systems, Volume I, Computer Science Press (1988), Chapter 7 (design theory for relational databases), multivalued dependencies and fourth normal form

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/9VM6F5/text.yaml