Partial Order Relations Lecture 50 Section 10.5 Wed, Apr 20, 2005.

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
Bounds on Code Length Theorem: Let l ∗ 1, l ∗ 2,..., l ∗ m be optimal codeword lengths for a source distribution p and a D-ary alphabet, and let L ∗ be.
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.
Chapter 7 Relations : the second time around
Theory and Applications
Partial Orderings: Selected Exercises
1 Section 7.1 Relations and their properties. 2 Binary relation A binary relation is a set of ordered pairs that expresses a relationship between elements.
Induction and recursion
Section 7.6: Partial Orderings Def: A relation R on a set S is called a partial ordering (or partial order) if it is reflexive, antisymmetric, and transitive.
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.
Relations (3) Rosen 6th ed., ch fall.
Chapter 6. Order Relations and Structure
1 Partial Orderings Aaron Bloomfield CS 202 Rosen, section 7.6.
Copyright © Cengage Learning. All rights reserved.
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.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
2.6 Equivalence Relation §1.Equivalence relation §Definition 2.18: A relation R on a set A is called an equivalence relation if it is reflexive, symmetric,
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.
O, , and  Notations Lecture 39 Section 9.2 Wed, Mar 30, 2005.
Copyright © Cengage Learning. All rights reserved. CHAPTER 7 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 歐亞書局.
Reading and Writing Mathematical Proofs Spring 2015 Lecture 4: Beyond Basic Induction.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Relations and their Properties
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Relations, Functions.
1 Partial Orderings Aaron Bloomfield CS 202 Epp, section ???
Cardinality with Applications to Computability Lecture 33 Section 7.5 Wed, Apr 12, 2006.
Equivalence Relations. Partial Ordering Relations 1.
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.
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.
Chapter Relations and Their Properties
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.
Copyright © Cengage Learning. All rights reserved. CHAPTER 8 RELATIONS.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Equivalence Relations Lecture 45 Section 10.3 Fri, Apr 8, 2005.
Chap. 7 Relations: The Second Time Around
1 Partial Orderings Based on Slides by Chuck Allison from Rosen, Chapter 8.6 Modified by.
Section 9.1. Section Summary Relations and Functions Properties of Relations Reflexive Relations Symmetric and Antisymmetric Relations Transitive Relations.
Dilworth’s theorem and extremal set theory 張雁婷 國立交通大學應用數學系.
1 Partial Orderings Epp, section Introduction An equivalence relation is a relation that is reflexive, symmetric, and transitive A partial ordering.
Relations Chapter 9 Copyright © McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Partial Orderings: Selected Exercises
Chapter 6 Order Relations and Structures
Modular Arithmetic with Applications to Cryptography
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.
Aaron Bloomfield CS 202 Epp, section ???
Copyright © Cengage Learning. All rights reserved.
Partial Order Relations
Discrete Math (2) Haiming Chen Associate Professor, PhD
Lecture 43 Section 10.1 Wed, Apr 6, 2005
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Presentation transcript:

Partial Order Relations Lecture 50 Section 10.5 Wed, Apr 20, 2005

Antisymmetry A relation R on a set A is antisymmetric if for all a, b  A, (a, b)  R and (b, a)  R  a = b. This is equivalent to (a, b)  R and a  b  (b, a)  R.

Examples: Antisymmetry The following relations are antisymmetric. a  b, on Z +. A  B, on  (U). x  y, on R. A  B = A, on  (U). f(x)g(x) = f(x) on the set of all functions from R to R.

Partial Order Relations A relation R on a set A is a partial order relation if R is reflexive. R is antisymmetric. R is transitive. We use  as the generic symbol for a partial order relation.

Examples: Partial Order Relations The following relations are partial order relations. a  b, on Z +. A  B, on  (U). x  y, on R. Is the relation f(x)g(x) = f(x) on functions a partial order relation?

Lexicographic Order Given a finite set of symbols, let them be listed in a specific order. For example, a < b < c. Let S be the set of all finite strings over the set of symbols. Then we may define the lexicographic order relation  on S.

Lexicographic Order Let s, t  S and let s = a 1 a 2 …a m and t = b 1 b 2 …b n. Then s  t if s = , or |s|  |t| and a i = b i, for all 1  i  m, or There exists k  1 with k  m and k  n and a i = b i for all 1  i < k, but a k < b k.

Lexicographic Order The first condition says that   s for all strings s  S. The second condition says that s is no longer than t and all of s matches the first part of t. The third condition says that s and t differ at some common position.

Lexicographic Order Theorem: The lexicographic order relation is a partial order. Proof: Reflexive: Obvious (?) Antisymmetric: Suppose s  t and t  s for some s, t  S. There are potentially 9 combinations of reasons for this.

Lexicographic Order Maybe both are true because of the first condition. Then s =  and t = , so s = t. Maybe both are true because of the second condition. Then |s|  |t| and |t|  |s|, implying that s and t have the same length. But also s matches “the first part” of t and t matches “the first part” of s. Therefore, s = t. The second and third conditions are incompatible. Etc.

Lexicographic Order Transitivity: Suppose that s  t and t  u, for some s, t, u  S. There are potentially 27 combinations of reasons for this. (!!!) Maybe s =  and t = . Then s  u. Etc.

Hasse Diagrams A Hasse diagram is a drawing that represents a partial order relation. Draw a diagram in which a  b is represented by a  b. a is drawn below b. If there exists c such that a  c and c  b, then we represent only a  c and c  b; a  b is implied by transitivity.

Example: Hasse Diagram Let the relation be  on  ({a, b, c}). {a, b, c} {a, c}{b, c} {a, b} {a}{a} {b}{b}{c}{c} {}

Example: Hasse Diagram Let the relation be  on {1, 2, 3, 4, 6, 12}

Example: Partial Order Relation Let F be the set of all functions f : R +  R +. Let E be the set of equivalence classes [f] of F, under the equivalence relation f ~ g if f(x) is  (g(x)). Define  on E by [f]  [g] if f(x) is O(g(x)).

[f]  [g] is Well Defined First, we must show that  is well defined on E. Let f 1, f 2  [f] and g 1, g 2  [g]. Then f 1 ~ f 2 and g 1 ~ g 2. To show that  is well defined, we must show that if [f 1 ]  [g 1 ], then [f 2 ]  [g 2 ], meaning that it does not matter which function we select to represent the class.

[f]  [g] is Well Defined So suppose that [f 1 ]  [g 1 ]. Then f 2 (x) is O(f 1 (x)), and f 1 (x) is O(g 1 (x)) and g 1 (x) is O(g 2 (x)). So, f 2 (x) is O(g 2 (x)). Therefore, [f 2 ]  [g 2 ].

Example: Partial Order Relation Theorem:  is a partial order relation on E. Proof: Reflexivity It is clear that [f]  [f]. (Use M = 1, x 0 = 0.)

Example: Partial Order Relation Antisymmetry Suppose that [f]  [g] and [g]  [f]. Then f(x) is O(g(x)) and g(x) is O(f(x)). Then f(x) is  (g(x)). Therefore, f ~ g. Therefore, [f] = [g].

Example: Partial Order Relation Transitivity Suppose that [f]  [g] and [g]  [h]. Then f(x) is O(g(x)) and g(x) is O(h(x)). We have already shown that this implies that f(x) is O(h(x)). Therefore, [f]  [h]. Thus,  is a partial order relation on E.

Comparable Elements and Total Orders Given a partial order  on a set A, two elements a, b  A are comparable if a  b or b  a. A partial order relation is a total order relation if any two elements are comparable under that relation.

Total Order Relations Which of the following partial orders are total orders? x  y, on R. A  B, on  (U). a  b, on Z +.

Total Order Relations Define [f]  [g] to mean f(x) is O(g(x)). Is this a total order relation on the set of equivalence classes of functions? Which are total orders on R  R. (a, b)  (c, d) if a  c and b  d. (a, b)  (c, d) if a  c or b  d. (a, b)  (c, d) if a + b  c + d. (a, b)  (c, d) if a < c or (a = c and b  d).

Example: Total Ordering and Sorting In order to sort the list {(2, 3), (3, 3), (3, 2), (2, 2)}. it is necessary that  be a total ordering of the Point class. If  is not a total order relation, then the results of any sorting algorithm are unpredictable. Why?

Example: Total Ordering and Sorting Define a Point object to consist of two double s. class Point { double x; double y; };

Example: Total Ordering and Sorting Define operator<() on the Point class as follows. Then define operator<=() to mean that a < b or a == b. bool operator<(const Point& p, const Point& q) { if (p.x != q.x) return p.x < q.x; else return p.y < q.y; }

C Library Functions There are two standard library functions, bsearch() and qsort(), that perform a binary search and a quicksort on an array, respectively. For each function, one parameter is a function compare(a, b) that returns < 0 if a < b = 0 if a == b > 0 if a > b

C Library Functions Those three requirements are not sufficient to guarantee that operator<=() is a total order relation. It is the programmer’s responsibility to be sure that it is. Otherwise, neither bsearch() nor qsort() is guaranteed to work properly.

Chains of Elements Let a partial order  be defined on a set A. A subset B  A is called a chain if any two elements of B are comparable. That is,  is a total order on B (although not on A).

Chains of Elements Find a chain of subsets in  ({a, b, c}) under the subset relation. What is the longest possible chain? Find a chain of integers in Z + under the divides relation. What is the longest possible chain?

Maximal and Greatest Elements Let A be a partially ordered set under . An element a  A is a maximal element if, for all b  A, either b  a or a and b are not comparable. An element a  A is a greatest element if, for all b  A, b  a.

Example Let A = {1, 2, 3, …, 20} and let the relation be a  b. Are there any maximal elements? If so, what are they? Are there any greatest elements? If so, what are they?

Example Let B = {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60} and let the relation be a  b. Are there any maximal elements? If so, what are they? Are there any greatest elements? If so, what are they?

Maximal and Greatest Elements Must maximal elements be exist? Must greatest elements be exist? If maximal elements exist, must they be unique? If greatest elements exist, must they be unique?

Minimal and Least Elements Minimal and least elements are similar to maximal and greatest elements, respectively. An element a  A is a minimal element if, for all b  A, either a  b or a and b are not comparable. An element a  A is a least element if, for all b  A, a  b.

Examples What are the minimal and least elements (if any) of the sets A = {1, 2, 3, …, 20} and B = {1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60} under the relation a  b?

Compatible Order Relations Let  1 and  2 be partial order relations defined on a set A. We call  2 compatible with  1 if, whenever a  1 b, it is also the case that a  2 b. In other words,  a, b  A, a  1 b  a  2 b.

Topological Sorting Given a partial order relation  1 defined on a set A, a topological sorting for  1 is a total order relation  2 that is compatible with  1. For example, the ordinary “less than or equal to” relation  is a topological sorting for the “divides” relation because  is a total order, and If a  b, then a  b.

Application: Computer Graphics In the “old days,” a difficult problem in computer graphics was to draw the objects of a scene in such a way that when two objects were on the same line of sight, the closer object obscured the farther object. One solution was the Painter’s Algorithm: sort the shapes from front to back, and then draw them from back to front.

Application: Computer Graphics Define the relation a  1 b on the shapes to mean that shape a hides part of shape b. Define the relation a  2 b on the shapes to mean that shape a is closer to the viewer than is shape b. Clearly,  2 is a topological sorting for  1.

Application: Computer Graphics Therefore, the Painter’s Algorithm was to Determine which shapes hide which shapes (relation  1 ). Find a topological sorting for  1 (relation  2 ). Draw the shapes in reverse order according to the total ordering  2.

Example Consider the following scene, with the viewpoint inside the house, looking out at the tree.

Example The scene might be rendered like this:

Topological Sorting Theorem: If A is a finite set with a partial order  1 defined on it, then there exists a topological sorting for  1. The proof is the following algorithm. A partially ordered finite set must have a minimal element. Let x 0 be a minimal element of A. Let A 1 = A – {x 0 }.

Topological Sorting A 1 is again a partially ordered finite set, so it must have a minimal element. Let x 1 be a minimal element of A 1 and define A 2 = A 1 – {x 1 }. Continue in this manner, defining x 3, x 4, x 5, and so on, until no elements remain. Then define  2 as follows: x i  2 x j if and only if i  j.

Example Let A = {1, 2, 3, …, 10} under the “divides” relation

Example Let x 0 = 1 and remove 1 from the set

Example Let x 1 = 7 and remove 7 from the set

Example Let x 2 = 5 and remove 5 from the set

Example Let x 3 = 3 and remove 3 from the set

Example Let x 4 = 9 and remove 9 from the set

Example Let x 5 = 2 and remove 2 from the set

Example Let x 6 = 10 and remove 10 from the set. 46 8

Example Let x 7 = 6 and remove 6 from the set. 4 8

Example Let x 8 = 4 and remove 4 from the set. 8

Example Let x 9 = 8 and remove 8 from the set.

Example The total ordering is 1, 7, 5, 3, 9, 2, 10, 6, 4, 8. This ordering is compatible with the divide relation. A number of the choices were arbitrary, so there are many other topological sortings for the divide relation on this set.