180 likes | 353 Views
Discrete Structure. Li Tak Sing( 李德成 ). Chapter 4 Properties of Binary Relations. Three special properties For a binary relation R on a set A, we have the following definitions. R is reflexive if xRx for all x A. R is symmetric if xRy implies yRx for all x,y A
E N D
Discrete Structure Li Tak Sing(李德成)
Chapter 4Properties of Binary Relations • Three special properties • For a binary relation R on a set A, we have the following definitions. • R is reflexive if xRx for all xA. • R is symmetric if xRy implies yRx for all x,y A • R is transitive if xRy and yRz implies xRz for all x,y,z A
Two opposite properties • For a binary relation R on a set A, we have the following definitions. • R is irreflexive if (x,x)R for all xA. • R is antisymmetric if xRy and yRx implies x=y for all x,yA.
Example • R is a binary relation on N • aRb if (a+b) mod 2 = 0 • R is reflexive because (a+a) mod 2 =0 for all a N • R is symmetric because if aRb, then (a+b) mod 2 = 0, then (b+a) mod 2 =0, then bRa • R is transitive, because if aRb and bRc, then (a+b) mod 2 =0 and (b+c) mod 2 =0, then (a+2b+c) mod 2 =0, then (a+c) mod 2 =0, then aRc
Example • Give examples of binary relations over the set {a,b,c,d} with the stated properties: • Reflexive and not symmetric and not transitive • Symmetric and not reflexive and not transitive • transitive and not reflexive and not symmetric
Composition of relations • If R and S are binary relations, then the composition of R and S, which we denote by RS, is the following relation:RS={(a,c)|(a,b)R and (b,c) S for some element b}
More examples • For each of the following binary relations state which of the three properties, reflexive, symmetric and transitive are satisfied. • xRy iff |x-y| is odd, over the integers. • xRy iff x is a parent of y, over the set of people.
Grandparents • Given the isParentOf relation. So a isParentOf b represents the fact that a is the parent of b. • isGrandparentOf can then be defined in terms of isParentOf.isGrandparentOf=isParentOfisParentOf • So a isGrandparentOf b if there is c so that a isParentOf c and c isPrentOf b.
More examples • Given the following binary relations over {a,b,c,d}.R={(a,a),(a,c),(b,a),(b,d),(c,b)}S={(a,b),(a,c),(c,b),(d,c)} • Find RS • Find SR
Representations • If R is a binary relation on A, then we'll denote the composition of R with itself n times by writing Rn. • For example, • isGrandparentOf=isParentOf2 • isGreatGrandParentOf=isParentOf3
Inheritance properties • If R is reflexive, then Rn is reflexive. • If R is symmetric, then Rn is symmetric. • If R is transitive, then Rn is transitive.
Example • Let R={(x,y)ZZ|x+y is odd}. We want to find out R2 and R3.
Closures • If R is a binary relation and p is some property, then the p closure of R is the smallest binary relation containing R that satisfies property p.
Reflexive closure • A reflexive closure of R is the smallest reflexive relation that contains R. • A reflexive closure of R is denoted as r(R) • R is a relation over {a,b,c} and R={(a,b),(b,c)}Then, r(R)={(a,a),(b,b),(c,c),(a,b),(b,c)}
Symmetric closure • A symmetric closure of R is the smallest symmetric relation that contains R. • A symmetric closure of R is denoted as s(R) • R={(a,b),(b,c)}, s(R)={(a,b),(b,a),(b,c),(c,b)}
Transitive closure • A transitive closure of R is the smallest transitive relation that contains R. It is denoted as t(R). • R= ={(a,b),(b,c)}, then t(R)= {(a,b),(b,c),(a,c)}
Constructing Closures • If R is a binary relation over a set A, then: • r(R)=RRo (Ro is the equality relation) • s(R)=R Rc (Rc is the converse relation) • t(R)=R R2 R3 R4.... • If A is finite with n elements, then t(R)= R R2 R3 R4.... Rn
Example • Given the set A={a,b,c,d}. Draw a directed graph to represent the indicated closure for each of the following binary relations over A. • r(R), where R={(a,d)} • s(R) where R={(a,b), (c,d)} • t(R) where R={(a,b),(d,a),(d,c),(c,b)}