Chapter 7 Relations : the second time around

Slides:



Advertisements
Similar presentations
Partial Orderings Section 8.6.
Advertisements

CSCI 115 Chapter 6 Order Relations and Structures.
Relations Relations on a Set. Properties of Relations.
Equivalence, Order, and Inductive Proof
8.6 Partial Orderings. Definition Partial ordering– a relation R on a set S that is Reflexive, Antisymmetric, and Transitive Examples? R={(a,b)| a is.
Discrete Structures Chapter 5 Relations Nurul Amelina Nasharuddin Multimedia Department.
1 Relations: The Second Time Around Chapter 7 Equivalence Classes.
Relations binary relations xRy on sets x  X y  Y R  X  Y Example: “less than” relation from A={0,1,2} to B={1,2,3} use traditional notation 0 < 1,
Theory and Applications
Discrete Mathematics Lecture#11.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Partially Ordered Sets (POSets)
Relations Chapter 9.
Chapter 9 1. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing.
Chapter 6. Order Relations and Structure
Chapter Relations and Their Properties 8.2 n-ary Relations and Their Applications 8.3 Representing Relations 8.4 Closures of Relations 8.5 Equivalence.
Exam 2 Review 7.5, 7.6, |A1  A2  A3| =∑|Ai| - ∑|Ai ∩ Aj| + |A1∩ A2 ∩ A3| |A1  A2  A3  A4| =∑|Ai| - ∑|Ai ∩ Aj| + ∑ |Ai∩ Aj ∩ Ak| - |A1∩
Chapter 9. Chapter Summary Relations and Their Properties Representing Relations Equivalence Relations Partial Orderings.
Discrete Structures – CNS2300
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Discrete Math for CS Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation.
Chapter 9. Section 9.1 Binary Relations Definition: A binary relation R from a set A to a set B is a subset R ⊆ A × B. Example: Let A = { 0, 1,2 } and.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
8.3 Representing Relations Directed Graphs –Vertex –Arc (directed edge) –Initial vertex –Terminal vertex.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 8 Relations 歐亞書局.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Relations.
Discrete Mathematics Relation.
Relations and their Properties
Sets, Relations, and Lattices
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
Sets and Subsets Set A set is a collection of well-defined objects (elements/members). The elements of the set are said to belong to (or be contained in)
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Relations. Important Definitions We covered all of these definitions on the board on Monday, November 7 th. Definition 1 Definition 2 Definition 3 Definition.
1 Partial Orderings Aaron Bloomfield CS 202 Epp, section ???
Relation. Combining Relations Because relations from A to B are subsets of A x B, two relations from A to B can be combined in any way two sets can be.
Problem Statement How do we represent relationship between two related elements ?
Chapter 9. Chapter Summary Relations and Their Properties n-ary Relations and Their Applications (not currently included in overheads) Representing Relations.
Unit II Discrete Structures Relations and Functions SE (Comp.Engg.)
1 Section 4.3 Order Relations A binary relation is an partial order if it transitive and antisymmetric. If R is a partial order over the set S, we also.
Representing Relations Using Matrices A relation between finite sets can be represented using a zero-one matrix Suppose R is a relation from A = {a 1,
1 RELATIONS Learning outcomes Students are able to: a. determine the properties of relations – reflexive, symmetric, transitive, and antisymmetric b. determine.
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
Chap. 7 Relations: The Second Time Around
CSCI 115 Course Review.
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Advanced Digital Designs Jung H. Kim. Chapter 1. Sets, Relations, and Lattices.
1 Partial Orderings Epp, section Introduction An equivalence relation is a relation that is reflexive, symmetric, and transitive A partial ordering.
Binary Relation: A binary relation between sets A and B is a subset of the Cartesian Product A x B. If A = B we say that the relation is a relation on.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Relations and Their Properties
Chapter 5 Relations and Operations
Chapter 6 Order Relations and Structures
CSE 2813 Discrete Structures
Unit-III Algebraic Structures
Partial Orders.
Partial Orderings CSE 2813 Discrete Structures.
Relations Binary relations represent relationships between the elements of two sets. A binary relation R from set A to set B is defined by: R  A 
Equivalence Relations
Relations Chapter 9.
Partial Orderings.
Relations and Digraphs
Representing Relations
CS201: Data Structures and Discrete Mathematics I
Discrete Math (2) Haiming Chen Associate Professor, PhD
Sungho Kang Yonsei University
Background material.
Relations.
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Relations: The Second Time Around
Foundations of Discrete Mathematics
Presentation transcript:

Chapter 7 Relations : the second time around Yen-Liang Chen Dept of Information Management National Central University

7.1. Relations revisited: properties of relations Definition 7.1. For sets A, B, any subset of AB is called a (binary) relation from A to B. Any subset of AA is called a binary relation on A .

Examples Ex 7.1 Ex 7.2: For x, y A, define xy if x is a prefix of y. Define the relation  on the set Z by ab, if ab. For x, yZ and nZ+, the modulo n relation  is defined by xy if x-y is a multiple of n. Ex 7.2: For x, y A, define xy if x is a prefix of y.

Ex 7.3. s1s2 if v(s1,x)=s2. Here,  denotes the first level of reachability. s1s2 if v(s1,x1x2)=s2. Here,  denotes the second level of reachability. 1-equivalence relation: s1E1s2 if w(s1,x)=w(s2,x) for xIA. k-equivalence relation: s1Eks2 if w(s1,x)=w(s2,x) for xIAk. equivalence relation: if two states are k-equivalent for all k.

reflexive Definition 7.2. A relation  on a set A is called reflexive if for all xA, (x, x). Ex 7.4. For A={1, 2, 3, 4}, a relation AA will be reflexive if and only if {(1, 1), (2, 2), (3, 3), (4, 4)}. Ex 7.5. Given a finite set A with A=n, we have AA=n2, so there are relations on A. Among them, is reflexive.

symmetric Definition 7.3. A relation  on a set A is called symmetric if (x, y) (y, x) for all x, yA. Ex 7.6. With A={1, 2, 3}, what properties do the following relations have? 1={(1, 2), (2, 1), (1, 3), (3, 1)} 2={(1, 1), (2, 2), (3, 3), (2, 3)} 3={(1, 1), (2, 2), (3, 3)} 4={(1, 1), (2, 2), (2, 3), (2, 3), (3, 2)} 5={(1, 1), (2, 3), (3, 3)}

symmetric To count the symmetric relations on A={a1, a2,…, an}. AA=A1A2, where A1={(a1, a1),…, (an, an)} and A2={(ai, aj)ij}. A1 contains n pairs, and A2 contains n2-n pairs. A2 contains (n2-n)/2 subsets Si,j of the form {(ai, aj), (aj, ai)ij}. So, we have totally symmetric relations on A. If the relations are both symmetric and reflexive, we have choices.

transitive Definition 7.4. A relation  on a set A is called transitive if (x,y), (y,z) (x,z) for all x, y, zA. Ex 7.8. Define the relation  on the set Z+ by ab if a divides b. This is a transitive and reflexive relation but not symmetric. Ex 7.9. Define the relation  on the set Z by ab if ab0. What properties do they have?

anti-symmetric Definition 7.5. A relation  on a set A is called anti-symmetric if (x, y) and (x, y)  x=y for all x, yA. Ex 7.11. Define the relation (A, B) if AB. Then it is an anti-symmetric relation. Note that “not symmetric” is different from anti-symmetric. Ex 7.12. What properties do they have? ={(1, 2), (2, 1), (2, 3)} ={(1, 2), (2, 2)}

anti-symmetric To count the anti-symmetric relations on A={a1, a2,…, an}. AA=A1A2, where A1={(a1, a1),…, (an, an)} and A2={(ai, aj)ij}. A1 contains n pairs, and A2 contains n2-n pairs. A2 contains (n2-n)/2 subsets Si,j of the form {(ai, aj), (aj, ai)ij}. Each element in A1 can be selected or not. Each element in Si,j can be selected either one or none. So, we have totally anti-symmetric relations on A. Ex 7.13. Define the relation  on the functions by f  g if f is dominated by g (or fO(g)). What are their properties?

partial order relation Definition 7.6. A relation  is called a partial order, if  is reflexive, anti-symmetric and transitive. Ex 7.15. Define the relation  on the set Z+ by ab if a divides b.

equivalence relation Definition 7.7. A relation  is called an equivalence relation, if  is reflexive, symmetric and transitive. Ex 7.16.(b) If A={1, 2, 3}, the following are all equivalence relations 1={(1, 1), (2, 2), (3, 3)} 2={(1, 1), (2, 2), (3, 3), (2, 3), (3,2)} 3={(1, 1), (1, 3), (2, 2), (3, 1), (3, 3)} 4={(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)}

Examples Ex 7. 16(c). For a finite set A, A A is the largest equivalence relation on A. The equality relation is the smallest equivalence relation on A. Ex 7.16(d). Let f: AB be the onto function. Define the relation  on A by ab if f(a)=f(b). Ex 7. 16(e). If  is a relation on A, then  is both an equivalence relation and a partial order relation iff  is the equality relation on A.

7.2. Computer recognition: zero-one matrices and directed graphs Definition 7.8. Let relations 1AB and 2BC. The composite relation of 12 is a relation defined by 12={(x, z) y in B such that (x, y) 1 and (y, z) 2. Ex 7.17. Consider 1={(1, x), (2, x), (3, y), (3, z)} and 2={(w, 5), (x, 6)}. What is 12?

composite relation Ex 7. 18. Let A be the set of employees at a computer center, while B denotes a set of programming language, and C is a set of projects…… Theorem 7.1. 1(23)= (12)3

the power of relation Definition 7.9. We define the powers of relation  by (a) 1=; (b) n+1= n Ex 7.19. If ={(1, 2), (1, 3), (2, 4), (3, 2)}, then what is 2 and 3 and 4.

matrix representation A relation can be represented by an mn zero-one matrix. Ex 7.17. Consider 1={(1, x), (2, x), (3, y), (3, z)} and 2={(w, 5), (x, 6)}. What is 12?

matrix representation Ex 7.19. If ={(1, 2), (1, 3), (2, 4), (3, 2)}, then what is 2 and 3 and 4.

matrix representation Let A be a set with A=n and  be a relation on A. If M() is the relation matrix for , then M()=0 if and only if =. M()=1 if and only if =AA. M(m)=[M()]m

less than Definition 7.11. Let E=(eij)mn F=(fij)mn be two zero-one matrices. We say that E precedes, or is less than , F, written as EF, if eij fij for all i, j. Ex 7.23. EF.

Identity matrix I2= I3=

Transpose of a matrix A= Atr=

Theorem 7.2 Let M denote the relation matrix for . Then (A) R is reflexive if and only if InM. (B) R is symmetric if and only if M=Mtr. (C) R is transitive if and only if M2M. (D) R is anti-symmetric if and only if MMtrIn.

Graph representation Definition 7.14. A directed graph can be denoted as G=(V, E), where V is the vertex set and E is the edge set. V={1,2,3,4,5}, E={(1,1),(1,2),(1,4),(3,2)}

Ex 7.27 R={(1,1),(1,2),(2,3),(3,2),(3,3),(3,4),(4,2)} directed graph, undirected graph, connected, undirected cycle, directed cycle

Terms in graph strongly connected and loop-free disconnected graph, components

complete graphs

Graph representation for a relation Ex 7.30, Fig 7.8,  is reflexive if and only if its directed graph contains a loop at each vertex Ex 7.31, Fig 7.9,  is symmetric if and only if its directed graph may be drawn only by loops and undirected edges Ex 7.32, Fig 7.10,  is anti-symmetric if and only if for any xy the graph contains at most one of the edges (x, y) or (y, x) Ex 7.33, Fig 7.11, a relation is an equivalence relation if and only if its graph consists of disjoint union of complete graphs augmented by loops at each vertex

7.3. Partial orders: Hasse Diagrams Definition: Let A be a set with  a relation on A. The pair (A, ) is called a partially ordered set, or poset, if relation  on A is partially ordered. If A is called a poset, we understand that there is a partially order  on A that makes A into this set.

Examples of Poset Ex 7.34. Let A be the set of courses offered at a college. Define the relation  on A by xy if x ,y are the same course or if x is a prerequisite for y. Ex 7.35. Define  on A={1, 2, 3, 4} by xy if x divide y. Then (A, ) is a poset. Ex 7.36. Let A be the set of tasks that must be performed to build a house. Define the relation  on A by xy if x ,y are the same task or if x must be performed before y.

Original graph and Hasse diagram

Hasse Diagram If (A, ) is a poset, we construct a Hasse diagram for  on A by drawing a line segment from x up to y, if xy there is no z such that xz and zy. Ex 7.38, Fig 7.18. The relation on (a) is the subset relation, while the relations on the others are the divide relations.

totally ordered Definition 7.16. If (A, ) is a poset, we say that A is totally ordered if for all x, y A either xy or yx. In this case,  is called a total order. Ex 7.40. On the set N, the relation  defined by xy if xy is a total order. The subset relation is a partial order but not total order. Fig 7.19 is a total order.

Topological sorting Given a Hasse diagram for a partial order relation , how to find a total order  for which .

maximal and minimal Definition 7.17. If (A, ) is a poset, then x is a maximal element of A if for all aA, axx a. Similarly, y is a minimal element of A if for all bA, byb y . Ex 7.42. For the poset (P(U), ), U is the maximal and  is the minimal. Let B be the proper subsets of {1, 2, 3}. Then we have multiple maximal elements for the poset (B, ).

Examples Ex 7.43. For the poset (Z, ), we have neither a maximal nor a minimal element. For the poset (N, ), we have no maximal element but a minimal element 0. Ex 7.44. How about the poset in Fig. 7.18? Do they have maximal or minimal elements? Theorem 7.3. If (A, ) is a poset and A is finite, then A has both a maximal and a minimal element.

Least and greatest Definition 7.18. If (A, ) is a poset, then x is a least element of A if for all aA, xa. Similarly, y is a greatest element of A if for all aA, ay. Ex 7.45. For the poset (P(U), ), U is the greatest and  is the least. Let B be the nonempty subsets of {1, 2, 3}. Then we have U as the greatest maximal element and three minimal elements for the poset (B, ). Theorem 7.4. If poset (A, ) has a greatest or a least element, then that element is unique.

Lower bound and upper bound Definition 7.19. If (A, ) is a poset with BA, then xA is called a lower bound of B if xb for all bB. Likewise, yA is called an upper bound of B if by for all bB. An element xA is called a greatest lower bound of B if for all other lower bounds x of B we have xx. Similarly, an element xA is called a least upper bound of B if for all other upper bounds x of B we have xx. Theorem 7.5. If (A, ) is a poset and BA, then B has at most one lub (glb).

Examples Ex 7.47. Let U={1, 2, 3, 4} with A=P(U) and let  be the subset relation on B. If B={{1}, {2}, {1, 2}}, then what are the upper bounds of B, lower bounds of B, the greatest lower bound and the least upper bound? Ex 7.48. Let  be the “” relation on A. What are the results for the following cases? A=R and B=[0, 1] A=R and B={qQq2<2} A=Q and B={qQq2<2}

Lattice Definition 7.20. The poset (A, ) is called a lattice if for all x, yA the elements lub{x, y} and glb{x, y} both exist in A. Ex 7.49. For A=N and x, yN, define xy by xy. Then lub{x, y}=max{x, y} and glb{x, y}=min{x, y}. (N,) is a lattice. Ex 7.50. For the poset (P(U), ), if S, TU, we have lub{S, T}=ST and glb{S, T}=ST and it is a lattice.

7.4. Equivalence relation and partitions For any set A, the relation of equality is an equivalence relation on A. Let the relation on Z defined by xy if x-y is a multiple of 2, then  is an equivalence relation on Z, where one contains all even integers and the other odd integers.

partition Definition 7.21. Given a set A and index set I, let AiA for iI. Then {Ai}iI is a partition of A if (a) A=iIAi and (b) AiAj= for ij. Ex 7.52, A={1,…,10}…. Ex 7.53. A partition of R

equivalence class Definition 7.22. the equivalence class of x, denoted [x], is defined by [x]={yAyx} Ex 7.54. Define the relation  on Z by xy if 4(x-y). Ex 7.55. Define the relation  on Z by ab if a2=b2.

equivalence class Theorem 7.6. If  is an equivalence relation on a set A and x, yA, then (a) x[x]; (b) xy if and only if [x]=[y]; and (c) [x]=[y] or [x][y]=. Ex 7.56. Let A={1, 2, 3, 4, 5}, ={(1, 1), (2, 2), (2, 3), (3, 2), (3, 3), (4, 4), (4, 5), (5, 4), (5, 5)}, Then, we have A=[1][2][4]. Consider an onto function f:AB. f({1, 3, 7})=x; f({4, 6})=y; f({2, 5})=z. The relation  defined on A by ab if f(a)=f(b). A=[1][4][2]. Ex 7.58. If an equivalence relation  on A={1, 2, 3, 4, 5, 6, 7} induces the partition A={1, 2} {3}{4, 5, 7}{6}, what is ?

Theorems Theorem 7.7. If A is a set, then any equivalence relation  on A induces a partition of A, and any partition of A gives rise to an equivalence relation  on A. Theorem 7.8. For any set A, there is one-to-one correspondence between the set of equivalence relations on A and the set of partitions of A.

7.5. Finite state machine: the minimization process Two finite state machines of the same function may have different number of internal states. Some of these states are redundant. A process of transforming a given machine into one that has no redundant internal states is called the minimization process.

1-equivalence For the states S, we define the relation E1 on S by s1E1s2 if w(s1, x)=w(s2, x) for all xI. The relation E1 is an equivalence relation on S, and it partitions S into subsets such that two states are in the same subset if they produce the same output for each xI.

k-equivalence For the states S, we define the k-equivalence relation Ek on S by s1Eks2 if w(s1, x)=W(s2, x) for all xIk. The relation Ek is an equivalence relation on S, and it partitions S into subsets such that two states are in the same subset if they produce the same output for each xIk. Finally, we call two states equivalent if they are k-equivalent for all k1.

Goal and tips Hence, our objective is to determine the partition of S induced by E and to select one state for each equivalent class. Observations: If two states are not 2-equivalent, they can not be 3-equivalent. For s1, s2S, where s1Eks2, we find that s1Ek+1s2 if and only if v(s1, x)Ekv(s2,x) for all xI.

The procedure for the minimization Set k=1. We determine the states that are 1-equivalent. Having determined Pk, we determine the states that are (k+1)-equivalent. Note that if s1Eks2, then s1Ek+1s2 if and only if v(s1, x)Ekv(s2,x) for all xI. If Pk+1=Pk, the process is completed.

Ex 7.60. the original table in Table 7.1 and P1:{s1}, {s2, s5, s6}, {s3, s4} Table 7.2. P2:{s1}, {s2, s5}, {s6}, {s3, s4}, P2=P3

refinement Definition 7.23. If P1 and P2 are partitions of set A, then P2 is called a refinement of P1, denoted as P2P1, if every cell of P2 is contained in a cell of P1. When P2P1 and P2P1, we write P2<P1. Theorem 7.9. In the minimization process, if Pk+1=Pk, then Pr+1=Pr for all rk+1.

distinguishing string If s1Eks2 but s1Ek+1s2, then we have a string x=x1x2…xkxk+1Ik+1 such that w(s1, x)w(s2, x) but w(s1, x1x2…xk)=w(s2, x1x2…xk). We call this string as distinguishing string. s1Ek+1s2x1I [v(s1, x1) Ek v(s2, x1)]

Ex 7.61 s2E1s6 but s2E2s6. X=00 is the minimal distinguishing string for s2 and s6

Ex 7.62 s1 and s4 are 2 equivalent but are not 3-equivalent. X=111 is the minimal distinguishing string for s1 and s4