Download Relations and Partial Orders and more Slides Discrete Mathematics in PDF only on Docsity! Relations RelationsCSCE 235, Fall 2008 2 Outline • Relation: • Properties • Combining relations • Representing relations • Closure of relations – Reflexive closure, diagonal relation, Warshall’s Algorithm, • Equivalence relations: – Equivalence class, partitions, • Partial order (POSET) – Hasse Diagram, POSET, Minimal, Maximal, Minimum, Maximum, Upper bound, lower bond, Least Upper bound, greatest lower bound, Lattices RelationsCSCE 235, Fall 2008 5 5 Reflexive Closure • Example: Consider the relation R = {(1,1), (1,2), (2,1), (3,2)} on set {1,2,3} – Is it reflexive? – How can we produce a reflective relation containing R that is as small as possible? RelationsCSCE 235, Fall 2008 6 6 Reflexive Closure – cont. • When a relation R on a set A is not reflexive: – How to minimally augment R (adding the minimum number of ordered pairs) to make it a reflexive relation? • The reflexive closure of R. • The reflexive closure of R can be formed by adding all of the pairs of the form (a,a) to R. In other words we should find: {( , ) | }R R a a a A R = { (1,1), (1,2), (2,1), (3,2) } U { (1,1), (2,2), (3,3) } RelationsCSCE 235, Fall 2008 7 7 Reflexive Closure – Cont. • The diagonal relation on A is: = {(a,a) | a A}. • The reflexive closure of R is then: R . • Properties: – R (R ); – R is reflexive; – S (R S S is reflexive) (R ) S. • In zero-one matrix notation: MR M • Turn on all the diagonal bits! RelationsCSCE 235, Fall 2008 10 10 Symmetric Closure (optional) • Example: Consider R ={(1,1), (1,2), (2,2), (2,3), (3,1), (3,2)} – R is not symmetric; the pairs missing are: (2,1), (1,3). – If we add those, we obtain the new relation: {(1,1), (1,2), (1,3), (2,1), (2,2), (2,3), (3,1), (3,2)}. The new relation is symmetric. RelationsCSCE 235, Fall 2008 11 11 Symmetric Closure (optional) • When a relation R on a set A is not symmetric: – How to minimally augment R (adding the minimum number of ordered pairs) to have a symmetric relation? – The symmetric closure of R. RelationsCSCE 235, Fall 2008 12 12 Example (optional) • Consider R = {(a,b)ZZ | a < b} • The symmetric closure of relation R is: R R-1 = {(a,b)ZZ | a < b} {(a,b)ZZ | b < a} = {(a,b)ZZ | a b} RelationsCSCE 235, Fall 2008 15 Transitive Closure • To compute the transitive closure we use the theorem • Theorem: A relation R is transitive if and only if Rn R for n=1,2,3,… • Thus, if we compute Rk such that Rk Rn for all nk, then Rk is the transitive closure • The Warshall’s Algorithm allows us to do this efficiently RelationsCSCE 235, Fall 2008 16 Warshall’s Algorithm: Example • Compute the transitive closure of – The relation R={(1,1),(1,2),(1,4),(2,2),(2,3),(3,1), (3,4),(4,1),(4,4)} – On the set A={1,2,3,4} RelationsCSCE 235, Fall 2008 17 Warshall’s Algorithm • Let A={a,b,c,d} • R={(a,b),(b,a),(b,c),(c,d)} RelationsCSCE 235, Fall 2008 20 Equivalence Relation • A={1,2,3} • R= {(1,1),(2,2),(3,3)} RelationsCSCE 235, Fall 2008 21 Equivalence Class Equivalence class of x is denoted by [x] -[x] = {y|yЄA and (x,y) ЄR} A={1,2,3,4,5} R={(1,2),(2,2) ,(3,3) ,(4,4) ,(5,5) ,(1,2) ,(2,1) ,(4,5), (5,4)} [1]={1,2} [2]= [3]= RelationsCSCE 235, Fall 2008 22 Partial order Relation, POSET • Reflexive • Anti-symmetric • Transitive RelationsCSCE 235, Fall 2008 25 POSET • A relation R on a set S is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive. A set S together with a partial ordering R is called a partially ordered set, or poset, and is denoted by (S, R). • ({1,2,3,4,5}, ≤) • ({1,2,3,4,6,12}, /) RelationsCSCE 235, Fall 2008 26 Maximal and Minimal • Maximal Element: If in a poset, an element is not related to any other element. • Minimal Element: if in a poset, no element is related to an element. RelationsCSCE 235, Fall 2008 27 Maximum and Minimum • Maximum: if it is the maximal and every element is related to it. • Minimum: if it is minimal and it is related to every element in poset. RelationsCSCE 235, Fall 2008 30 Join Semi-lattice • In a poset if LUB/join/V exist for every pair of elements, thus poset is called join semi-lattice. a b dc f e RelationsCSCE 235, Fall 2008 31 Meet Semi-Lattice • In a poset if GLB/ Meet/^ exist for any pair of elements, then poset is called Meet semi-lattice. a b dc f e RelationsCSCE 235, Fall 2008 32 Lattice • A Poset is called Lattice if it is both Meet Semi- Lattice and Join Semi-Lattice. a e d c b f