Presentation is loading. Please wait.

Presentation is loading. Please wait.

Discussion #27 Chapter 5, Sections 4.6-7 1/15 Discussion #27 Closures & Equivalence Relations.

Similar presentations


Presentation on theme: "Discussion #27 Chapter 5, Sections 4.6-7 1/15 Discussion #27 Closures & Equivalence Relations."— Presentation transcript:

1 Discussion #27 Chapter 5, Sections 4.6-7 1/15 Discussion #27 Closures & Equivalence Relations

2 Discussion #27 Chapter 5, Sections 4.6-7 2/15 Topics Reflexive closure Symmetric closure Transitive closure Equivalence relations Partitions

3 Discussion #27 Chapter 5, Sections 4.6-7 3/15 Closure Closure means adding something until done. –Normally adding as little as possible until some condition is satisfied –Least fixed point similarities

4 Discussion #27 Chapter 5, Sections 4.6-7 4/15 Reflexive Closure Reflexive closure of a relation: R (r) –smallest reflexive relation that contains R (i.e. fewest pairs added) –R (r) = R  I A (R is a relation on a set A, and I A is the identity relation  1’s on the diagonal and 0’s elsewhere.) 111 3 100 2 010 1 321 111 3 110 2 011 1 321 R = R (r) =  x (xRx)

5 Discussion #27 Chapter 5, Sections 4.6-7 5/15 Symmetric Closure Symmetric closure of a relation: R (s) –smallest symmetric relation that contains R (i.e. fewest pairs added) –R (s) = R  R ~ (R ~ is R inverse) 111 3 100 2 010 1 321 110 3 101 2 100 1 321 R = R ~ = 111 3 101 2 110 1 321 R  R ~ =  x  y(xRy  yRx)

6 Discussion #27 Chapter 5, Sections 4.6-7 6/15 Transitive Closure Transitive closure of a relation: R (t) = R + –smallest transitive relation that contains R (i.e. fewest pairs added) –for each path of length i, there must be a direct path. (This follows from x  y, y  z  x  z; since, if we also have v  x, we must have v  z, a path of length 3.) –R (t) = R  R 2  R 3  …  R |A|. (No path can be longer than |A|, the number of elements in A.)

7 Discussion #27 Chapter 5, Sections 4.6-7 7/15 R  R 2  R 3 = R×R 2 = R 3 = Transitive Closure – Example 1 111 3 100 2 010 1 321 111 3 111 2 100 1 321 R = R 2 = 111 3 111 2 111 1 321 1 2 3 1 2 3 1 2 3 All paths of length 3 All paths of length 2 All paths of length 1 111 3 111 2 111 1 321

8 Discussion #27 Chapter 5, Sections 4.6-7 8/15 Transitive Closure – Example 2 010 3 100 2 000 1 321 100 3 010 2 000 1 321 R = R 2 = 010 3 100 2 000 1 321 R×R 2 = R 3 = 1 2 3 1 2 3 1 2 3 110 3 110 2 000 1 321 R  R 2  R 3 = 1 2 3 All paths of length 3 All paths of length 2 Paths of any length All paths of length 1

9 Discussion #27 Chapter 5, Sections 4.6-7 9/15 Reflexive Transitive Closure Reflexive transitive closure of a relation: R * –smallest reflexive and transitive relation that contains R –R * = I A  R + = R 0  R + = R 0  R 1  R 2  …R |A| Example: 100 3 010 2 001 1 321 I A = R 0 = 110 3 110 2 001 1 321 1 2 3 R 1  R 2  R 3 = 110 3 110 2 000 1 321 R 0  R 1  R 2  R 3 =

10 Discussion #27 Chapter 5, Sections 4.6-7 10/15 Equivalence Relations A relation R on a set A is an equivalence relation if R is reflexive, symmetric, and transitive. –Equivalence relations are about “equivalence” –Examples: = for integersx = xreflexive x = y  y = xsymmetric x=y  y=z  x=ztransitive = for setsA = Areflexive A = B  B = Asymmetric A=B  B=C  A=Ctransitive Let R be “has same major as” for college students xRx  reflexive: same major as self xRy  yRx  symmetric: same major as each other xRy  yRz  xRz  transitive: same as, same as  same as

11 Discussion #27 Chapter 5, Sections 4.6-7 11/15 Partitions A partition of a set S is –a set of subsets S i=1,2,…n of S –such that  n i=1 S i = S, S j  S k =  for j  k. Each S i is called a block (also called an equivalence class) Example: –Suppose we form teams (e.g. for a doubles tennis tournament) from the set: {Abe, Kay, Jim, Nan, Pat, Zed} then teams could be: { {Abe, Nan}, {Kay, Jim}, {Pat, Zed} } Note: “on same team as” is reflexive, symmetric, transitive  an equivalence relation. Equivalence relations and partitions are the same thing (two sides of the same coin).

12 Discussion #27 Chapter 5, Sections 4.6-7 12/15 Partitions (continued…) Since individual elements can only appear in one block (S j  S k =  for j  k), blocks can be represented by any element within the block. e.g.Nan’s Team Jimmer’s 2011 sweet-16 team Formally, [x] = set of all elements related to x and y  [x] iff xRy e.g.[Nan] represents {Abe, Nan}, Nan’s team [Abe] represents {Abe, Nan}, Abe’s team [Jimmer] represents the set of players who played on BYU’s 2011 sweet-16 team

13 Discussion #27 Chapter 5, Sections 4.6-7 13/15 Partitions & Equivalence Relations The mod function partitions the natural numbers into equivalence classes. –0 mod 3 = 0 so 0 forms a class [0] –1 mod 3 = 1 so 1 forms new class [1] –2 mod 3 = 2 so 2 forms new class [2] –3 mod 3 = 0 so 3 belongs to [0] –4 mod 3 = 1 so 4 belongs to [1] –5 mod 3 = 2 so 5 belongs to [2] –6 mod 3 = 0 so 6 belongs to [0] –… Thus, the mod function partitions the natural numbers into equivalence classes. –[0] = {0, 3, 6, …} –[1] = {1, 4, 7,…} –[2] = {2, 5, 8, …} Example:

14 Discussion #27 Chapter 5, Sections 4.6-7 14/15 Partitions  Equivalence Relations Theorem: If {S 1, …, S n } is a partition of S, then R:S  S is an equivalence relation, where R is “in same block as.” Note: to prove that R is an equivalence relation, we must prove that R is reflexive, symmetric, and transitive. Proof: Reflexive: since every element is in the same block as itself. Symmetric: since if x is in the same block as y, y is in the same block as x. Transitive: since if x and y are in the same block and y and z are in the same block, x and z are in the same block.

15 Discussion #27 Chapter 5, Sections 4.6-7 15/15 Equivalence Relations  Partitions Theorem: If R:S  S is an equivalence relation and [x] = { y | xRy }, then { [x] | x  S } is a partition P of S. Note: to prove that we have a partition, we must prove (1) that every element of S is in a block of P, and (2) that for every pair of distinct blocks S j and S k (j  k) of P, S j  S k = . Proof: (1) Since R is reflexive, xRx, every element of S is at least in its own block and thus in some block of P. (2) Suppose S j  S k   for distinct blocks S j and S k of P. Then, at least one element y is in both S j and S k. Let S j = {y, x 1, … x n } and S k = {y, z 1, … z m }, then yRx i, i=1, 2, …, n, and yRz p, p=1, 2, …, m. Since R is symmetric, x i Ry, and since R is transitive x i Rz p. But now, since the elements of S j are R-related to the elements of S k, x 1, …, x n, y, z 1, …, z m are together in a block of P and thus S i and S k are not distinct blocks of P.


Download ppt "Discussion #27 Chapter 5, Sections 4.6-7 1/15 Discussion #27 Closures & Equivalence Relations."

Similar presentations


Ads by Google