In IS] it is proved th t N is th uniqu minimal gen rator of I.. RE SULTS In this section we introduce the concepts of minimal family of a relaton.. We show that the time complexity of fi
Trang 1T <)-p c h i Tin i ioc va Di'eu k h ien hoc, T.17,S 1 (2001), 31-34
V DUC TEl
Abstract We introduce the concepts of minimal family ofa relatio First, we show the algorithm finding a
m im family of a given relation After that, we prove th the time complexity of finding a minimal family
of a given relatio is exponential in the number of attrib es
Tom t~ t Trong bai nay chung t6i trinh bay ho t6i thieu cda mot quan h Chung t6i dua ra t huat to an tlm h toi thieu cd a mot quan h~ cho trurrc, sau do chirng minh dQ ph ire tap cda v iec tirn ho toi thieu c da mot quan h~ cho triro'c tu n theo ludt so mil doi voi s6 hrcng cac thuQc tinh
The relatio al datamodel which was introduced by E.F Codd is one of the most powerful
database models The basic concept of this mo el is a relatio It is a table every row of which
corresp nds to a record and every column to an attribute Because the structure of this model is
clear, simple and mathematical instruments can be applied in it, it becomes the theoretical basis
of databas models Semantic constrains between sets of attributes play very important roles in
lo ical and structural investigations of the relational datamodel both in practice and design theory Important amo g thes constraints is functio al dependency
This paper gives some results about computatio al problems related to relations
Let us give some necessary definito s and results that are used in next sectio The concepts
given in this section can be found in [1,2,4,6,7,8,1 1
Let R = {ai , , an} be a nonempty finie set of attributes A functional dependency (FD) is a
statement of the form A + B, where A, B R The FD A + B holds in a relation r =: {h i ,h m }
over R ifVhi, hi Er we have h ; (a) = h](a) for all a E A implies h ;( b ) = h] ( b ) for all bE 13.We also
say that r satisfies the FD A + B.
Let F; be a family ofall FDs that hold in r Then F = F; satisfies
(1) A + A E F,
(2 ) (A + B F, B + CE F) = > (A + C EF),
( 3 ) (A + B E F, A < ;: C, D <.;; : B ) == > (C + D EF ) ,
(4) (A + B E F, C + D EF) == > ( A UC + BuD EF).
A family ofFDs satisfiding (1) - (4) is called an J-family (sometimes it iscalled the full family)
over R
Clearly, F; is an J-family over R. It is known [1 that if F is an arbitrary J-amily, then there
isa relatio ro er R such that F; = F.
Given a family F of FDs, there exists aunique minimal J-family F + that co tains F. It can be seen that F+ contains all FDs which can be derived from F by the rules (1) - (4).
A relation scheme s isa pair ( R, F ) , where R isa set of attributes, an F is a set of FDs over R
Denote A+ = { a :A + { a } EF } A+ iscalled the closure of A o er s. It is clear that A + B E F iff B< A +
Clealy, if s = ( R, F ) is arelatio scheme, then there is a relatio ro er R such that F; = F
(see [1] Such a relatio is called an Armstrong relatio ofs.
Let R be anonempty finite set of attributes and P ( R ) its power set The mappin H : P (R) +
P (R) is called a closure operatio o er R iffor A , B P ( R ) , the following conditions are satisfied:
(1) A < ;;: H(A)
(2) A < B implies H(A) < ;: H(B) ,
(3) H(H(A)) = H(A)
Trang 2Let s = ( R, F) be a relation sch me Set H , (A) = { a : A - > { a } EF } , we can see tht H is a
Let r be a relation, s = (R, F ) b a relation sch me The A is a k y of r (a k y of s if
A •R E F ; (A - > R E F ) A is a minimal key of r( s ) if A is a key of r ( s ) and any pro er subset
It is known IS] hat if K is an arbitary Sp rn r system o er R , th n th re is a relatio sch me
s such that K = K.
In this paper we alwas assume that if a Spern r system plays the role of the set of minimal k ys
(antikeys), the this Spern r system is n t empty (doesn't c ntain R) We consider the comparison
A = A or A = C
M S P ( R ) De ote M + = { n M' : M ' S M } We say that M is a generator of I i M + = I Note
that R E M + but not in M , by convento i is th intersectio of the empty colection of sets
In IS] it is proved th t N is th uniqu minimal gen rator of I
It c n be sen that N is a family of members which are not intersections of two other members
N (H) is the minimal generator of H
It is sh wn [5] that i L is a meet-i educible family th n L is th m imal gen rator of some
Let r be a relato De ote A t = { a : A - > { a } E F , }. Th n r is a Bo ce-Codd n rmal form (B NF) relation ifVA S R : A t = A or A t = R.
Let T ; = { A E P( R ) :::lEi] = A , jJEp'l :A C EI " J. We say that T ; is th maximal equality
Theorem 1 1 L et K be a no n- e mpty Sp e n e t s s t e m and r a r e lati o ove r R Th e n r r ep r esen t s K
iff K-1 = T rJ where T; 2 the man mal equ a lity sy s tem of r
Corollary 1 2 L e t s= ( R , F ) b e a r lat i on sc hem e and r a relation o ve r R W e say that r r e pr ese nt s
s if K r = K ,. T hen r r ep r s ents s iff K : 1= ' I '; ; whe r T ; is the maximal eq u ality system of r
In 1 ] we pro e th followin th orem
Trang 3SOME RESULTS ABOUT RELATIONS INTHE RELATIONAL D TAMODEL 33
Theorem 1 3 L et T = {hl, , hm } be a relation, and Fan f-family over R Then F; = F i f for every A < R
{ n e , if 3Ei J Es, :A <;;; Ei} , HdA) = A R ~ E i)
otherwise ,
Theorem 1 4. 1 ] Let K = {Kl , , Km} be a Sperner system over R Set s
{Kl - >R , ,Km - >R} Then K = K.
( R, F ) with F =
2 RE SULTS
In this section we introduce the concepts of minimal family of a relaton We show that the time
complexity of finding a minimal family of a given relatio is exponential in the number of attributes
Now we introduce the following concep
Definition 2.1 Let T be a relation over Rand F; a family ofall FDs that hold in r. Put A; : = {a :
Weconstruct a following exponential time algorithm fnding a minimal family of a given relatio
Algorithm 2.2.
Input: a relation r= {h l . ,hm } o er R.
Output: a minimal family of T.
Step 1: Find the equality set E; = {Ei} :1 ::;i < J : :;m}.
Step 2: Find the minimal generator N, where N = {A E E, : A = I n {B E E; : A cB}}.
Denote elements os N by A l , At.
Step 3: For every B <;;; R if there is an Ai (1 :: i ::;t) such that B <;;; Ai, then compute
C = n Ai and set B - > C In the converse case set B - >R.
D ~ A.
Denote by T the set of all such functional dependencies
Step 4: Set F = T - Q, where Q = {X - > Y T: X - >Y isa redundant functio al dependency}
According to Theorem 1.3 and definito of M(Zr), Algorithm 2.2 finds a minimal family of T
at-tributes
Proposition 2.3 Given a BCNF relation rover R The t me complexity of finding a minimal family
Proof From a given BCNF relatio r we use Algorithm 2.2 to construct the minimal family of T. By
definition of BCNF, we obtain
M(Z r ) = {(B,C) B - >C EFr} = {(B , R): B EKr
Let us take a partition R = Xl U· ·· UXm UW, where IRI = n, m = I n / 3 ] ' and IXil = 3 (1 : :;
t::; m).
M = {C : CI = n - 3, C n Xi = 0 for some i}if IWI = 0,
M = {C: ICI = n - 3 , CnXi = 0for some i (1 : :; i : :;m - 1) or ICI = n - 4, C n (Xm u W) = 0}
if IWI = 1
For all aE R ho( a ) = 0, for i = 1, , t
Trang 4Y U D ue THI
h ; a ) = { ~
Because class of BCNF relatio s is a special subfamily of the family of relations o er R , the next
corollary is obvio s
m the numbe r of attrib - ute s
REFERENCES
I ] Armstron W W Dependency structures of database relatio ships, Information Proc essi ng ,
Hollan Pub! Co., 74 (19 4) 580-583
1 ] Beeri C., Bernstein P A., Computatio al problems related to the desig of normal form rela
-to al schemas, A CM Tr an s o n D ataba s S y st. 4 (1) (1979) 30-59
1 1Beeri C Dowd M., Fagin R., Staman R., On the structure of Armstro g relatio s for functo al
dependencies, J A C M31 (1) (1984) 30-46
[41 Bekessy A Demetrovics J Contribution to the theory of database relatio s, Di sc r te Math
1 1 Demetrovics J., Logical and structural investigatio of relational datamo el MTA· S ZTAKI Tanulman yok, Budape s t 114 (1980) 1-97 (Hungarian)
1 1 Demetrovics J., Thi V.D., Some results about functional dependencies, A c t a C yb e ne t ca 8 (3) (198 ) 2 3-278
[7 Demetrovics J., Thi V D., Relatio s and minimal keys, A c ta C ub e rn et i c a 8 (3) (1988) 279-2 5 [8 Demetrovics J., Thi V.D On keys in the relatio al datamodel Infor m Pr ocess Cy b e rn E lK
24 (10) (1988) 5 5-519
[9 Demetrovics J Thi V D On algorithm for generat g Armstrong relations and inferring func
-to al dependencies in the relatio al datamodel, Co mput e s an d Math e mati cs with Applications
26(4) (1993) 43-55
[101 Demetrovics J., Thi V D., Armtron relatio , functio al dependencies and stro g dependencies,
C o mp ut and A I 14 (3) (1995) 279-298
[111 Man n ila H., Raiha K J Desig by example: an applicatio of Armstro g relatio s, J C omput Syst Scien. 33 (1986) 126-1 1
[12] Osborn S L., Testing for existence of a covering Boyce-Codd normal form, Infor Proc L e tt
8 (1) (1979) 1 -14
[1 ] Thi V D Investigations on combinatorial characterizations related to functio al dependencies
in the relational datamodel MT A-S ZT A KI T anu lma nyok, B u dape s t 191 (1986) 1-157, Ph.D Dissertatio (Hungarian)
[1 ] Thi V D Minimal keys and antikeys, Act a Cyb e rnetica 7 (4) (1986) 3 1-371
[1 1 Thi V D On the antikeys in the relational datarnodel, Al k alm azo tt Mat e mat ik ai Lapok 12 (1986)
111-124 (Hu garian)
[1 ] Thi V D., Logical dependencies and irredundant relations, Computer s and Artificial I ntelligence
7 (2) (1988) 165-184
[171 Yu C T Johnson D T On the complexity of finding the set of candidate keys for a given set
of functio al dependencies, IPL 5 (4) (19 6) 100-101
R eceiv ed M ay 2, 2000
R e vi se d Ja n uary 4, 2 001
I n s titute of I nf or matio n T ech n olo g y