discrete mathematics
play

Discrete Mathematics -- Chapter 7: Relations: The Ch t 7 R l ti - PowerPoint PPT Presentation

Discrete Mathematics -- Chapter 7: Relations: The Ch t 7 R l ti Th Second Time Round Hung-Yu Kao ( ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U Outline Relations


  1. Discrete Mathematics -- Chapter 7: Relations: The Ch t 7 R l ti Th Second Time Round Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U

  2. Outline � Relations Revisited: Properties of Relations � Computer Recognition: Zero-One Matrices and Computer Recognition: Zero One Matrices and Directed Graphs � Partial Orders : Hasse Diagrams � Partial Orders : Hasse Diagrams � Equivalence Relations and Partitions � Finite State Machine: The Minimization Process Fi it St t M hi Th Mi i i ti P � Application of equivalence relation � Minimization process: find a machine with the same function but fewer internal states 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 2

  3. 7.1 Relations Revisited: Properties of p 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 on A . Ex 7.1 � Define the relation ℜ on the set Z by a ℜ b, if a ≤ b. ℜ ℜ b if ≤ b D fi th l ti th t Z 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, e.g., with n=7, 9 ℜ 2, -3 ℜ 11, but 3 ℜ 7 Ex 7.2 : Language A ⊆ Σ ∗ . For x, y ∈ A, define x ℜ y if x is a prefix of y. � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 3

  4. Relations Revisited: Properties of p Relations Finite state machine M = ( S , I , O , v , w ) � Reachability � s 1 ℜ s 2 if v ( s 1 , x ) = s 2 , x ∈ I . ℜ denotes the first level of � reachability. s 1 ℜ s 2 if v ( s 1 , x 1 x 2 ) = s 2 , x 1 x 2 ∈ I 2 . ℜ denotes the second level of ( 1 , 1 2 ) 2 , � 1 2 1 2 reachability. Equivalence � 1-equivalence relation: s 1 E 1 s 2 if w ( s 1 , x ) = w ( s 2 , x ) for x ∈ I . 1 i l l ti E if ( ) ( ) f I � k -equivalence relation: s 1 E k s 2 if w ( s 1 , y ) = w ( s 2 , y ) for y ∈ I k . � If two states are k -equivalent for all k ∈ Z + , they are called q , y � equivalent . 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 4

  5. Reflexive Definition 7.2: A relation ℜ on a set A is called reflexive if (x, � x) ∈ℜ , for all x ∈ A . Ex 7 4 : For A = {1 2 3 4} a relation ℜ ⊆ A × A will be reflexive 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)}. But ℜ 1 = {(1, 1), (2, 2), (3, 3)} is not reflexive, ℜ 2 = {( x , y )| x ≤ y , x , y ∈ A } is reflexive reflexive. Ex 7.5 : Given a finite set A with | A | = n , we have | A × A | = n 2 , so � 2 2 n n − there are relations on A . Among them are reflexive. there are relations on A . Among them 2 are reflexive. ( ) n 2 2 一定要 留 著 A = { a 1 , a 2 ,…, a n } � A × A = {( a i , a j )|1 ≤ i , j ≤ n} = A 1 ∪ A 2 {( i j )| } j � 1 2 A 1 A A A 2 A 1 = {( a i , a i )|1 ≤ i ≤ n} � ( n ) ( n 2 - n ) A 2 = {( a i , a j )| i ≠ j , 1 ≤ i , j ≤ n} � A × A ( n 2 ) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 5

  6. Symmetric Definition 7.3: A relation ℜ on a set A is called symmetric if for � all x, y ∈ A , (x, y ) ∈ℜ ⇒ ( y , x ) ∈ℜ . Ex 7.6 : A = {1, 2, 3} � ℜ 1 = {(1, 2), (2, 1), (1, 3), (3, 1)}, symmetric, but not reflexive. � ℜ 2 = {(1, 1), (2, 2), (3, 3), (2, 3)}, reflexive, but not symmetric. � ℜ 3 = {(1, 1), (2, 2), (3, 3)} and ℜ 4 = {(1, 1), (2, 2), (3, 3), (2, 3), � (3, 2)}, both reflexive and symmetric. (3, 2)}, both reflexive and symmetric. ℜ 5 = {(1, 1), (2, 3), (3, 3)}, neither reflexive nor symmetric. � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 6

  7. Symmetric � To count the symmetric relations on A = { a 1 , a 2 ,…, a n }. A × A = A 1 ∪ A 2 , A 1 = {( a i , a i )|1 ≤ i ≤ n}, A 2 = {( a i , a j )| i ≠ j , 1 ≤ i , j ≤ n } � A contains n pairs and A contains n 2 n pairs A 1 contains n pairs, and A 2 contains n 2 - n pairs. � � A 2 contains ( n 2 - n )/2 subsets S i,j of the form {( a i , a j ), ( a j , a i ) ⎪ i < j }. � × 2 − n ( 1 / 2 )( n n ) 2 2 So, we have totally symmetric relations on A. � n − 2 ( 1 / 2 )( ) � If the relations are both reflexive and symmetric, we have n 2 choices choices. 1 A 1 A 2 ( n ) ( n 2 - n ) A × A ( n 2 ) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 7

  8. 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? � Reflexive, symmetric � Not transitive, e.g., (3,0),(0,-7) ∈ℜ , but (3,-7) not 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 8

  9. Antisymmetric � Definition 7.5: A relation ℜ on a set A is called antisymmetric if ( x , y ) ∈ℜ and ( y , x ) ∈ℜ ⇒ x = y for all x, y ∈ A . Both a related to b and b related to a if a and b are one and the same Both a related to b and b related to a if a and b are one and the same � � element from A Ex 7.11 : Define the relation ( A , B ) ∈ℜ if A ⊆ B . Then it is an anti- ( A B ) ℜ if A B Th E 7 11 D fi th l ti it i ti � symmetric relation. � Note that “ not symmetric ” is different from anti-symmetric. Ex 7.12 : A = {1, 2, 3}, what properties do the following relations on A � have? have? ℜ ={(1, 2), (2, 1), (2, 3)} (not symmetric, not antisymmetric) � ℜ ={(1, 1), (2, 2)} (symmetric and antisymmetric) � 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 9

  10. Antisymmetric � To count the antisymmetric relations on A = { a 1 , a 2 ,…, a n }. A × A = A 1 ∪ A 2 , A 1 = {( a i , a i )|1 ≤ i ≤ n}, A 2 = {( a i , a j )| i ≠ j , 1 ≤ i , j ≤ n } � A 1 contains n pairs, and A 2 contains n 2 - n pairs. 1 co ta s n pa s, a d 2 co ta s n n pa s. � A 2 contains ( n 2 - n )/2 subsets S i,j of the form {( a i , a j ), ( a j , a i ) ⎪ i < j }. � Each element in A 1 can be selected or not. � Each element in S can be selected in three alternatives : either (a a ) Each element in S i,j can be selected in three alternatives : either (a i , a j ), � � or (a j , a i ), or none . So, we have totally anti-symmetric relations on A. × 2 − � n ( 1 / 2 )( n n ) 2 3 A 1 A 2 ( n ) ( n ) ( n 2 - n ) ( n - n ) A × A ( n 2 ) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 10

  11. Antisymmetric 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? � Reflexive � Transitive � not symmetric (e.g., g =n, f =n 2, g=O(f), but f ≠ O(g) ) � not antisymmetric (e.g., g (n)= n, f(n) = n+5, f ℜ g and g ℜ f, but f ≠ g ) 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 11

  12. Partial Order � Definition 7.6: A relation ℜ is called a partial order (partial ordering relation), if ℜ is reflexive, anti-symmetric and transitive . d t iti � (A,R) is a p artially o rdered set / poset if R is a partial ordering on A. Typical notation: (A, ≤ ); think “no loops”. � If a ≤ b or b ≤ a, the elements a and b are comparable. � If all pairs are comparable, ≤ is a total ordering or chain. 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 12

  13. Partial Order Ex 7.15 : Let A be the set of positive integers divisors of n , the � relation ℜ on A by a ℜ b if a divides b , it defines a partial order . How many ordered pairs does it occur in ℜ . many ordered pairs does it occur in ℜ . E.g. A = {1, 2, 3, 4, 6, 12}, ℜ = {(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 12), (2, 2), � (2, 4), (2, 6), (2, 12), (3, 3), (3, 6), (3, 12), (4, 4), (4, 12), (6, 6), (6, 12), (12, 12)} If ( a , b ) ∈ ℜ , then a = 2 m . 3 n and b = 2 p . 3 q with 0 ≤ m ≤ p ≤ 2, 0 ≤ n ≤ q ≤ 1 . � Selection of size 2 from a set of size 3, with repetition . � ( ) ( ) ( ) ( ) + − = = + − = = 3 2 1 4 2 2 1 3 6 for , ; 3 for , m p n q 2 2 2 2 ∴ ∴ = = ⋅ = = total total 6 6 3 3 18 18 ordered ordered pairs pairs ( ) ( ) For � k k ∏ ∏ = ⇒ = + + − + ( 1 ) 2 1 2 e e the number of ordered pairs n e e e 1 2 ⋅ ⋅ ⋅ k = i i p p p 1 2 k 2 2 = = 1 1 i i Maximal element 2009 Spring 2009 Spring Discrete Mathematics Discrete Mathematics – – CH7 CH7 13

Recommend


More recommend