Partial Order Relations

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.
Partial Orderings: Selected Exercises
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.
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.
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.
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.
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
1 Partial Orderings Aaron Bloomfield CS 202 Epp, section ???
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 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.
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.
Partial Order Relations Lecture 50 Section 10.5 Wed, Apr 20, 2005.
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.
Equivalence Relations
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
Partial Orderings: Selected Exercises
Chapter 6 Order Relations and Structures
Modular Arithmetic with Applications to Cryptography
A Universal Turing Machine
CSE 2813 Discrete Structures
Unit-III Algebraic Structures
Partial Orders.
Partial Orderings CSE 2813 Discrete Structures.
Introduction to Relations
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.
Cardinality of Sets Section 2.5.
CS201: Data Structures and Discrete Mathematics I
Chapter 2 Sets and Functions.
Discrete Math (2) Haiming Chen Associate Professor, PhD
Applied Discrete Mathematics Week 6: Relations/Digraphs
Partial Orders Section 9.6 of Rosen Spring 2018
MCS680: Foundations Of Computer Science
Relations.
Copyright © Cengage Learning. All rights reserved.
교환 학생 프로그램 내년 1월 중순부터 6월 초 현재 학부 2,3 학년?
Copyright © Cengage Learning. All rights reserved.
Lecture 44 Section 9.2 Mon, Apr 23, 2007
Equivalence Relations
Theory of Computation Lecture 17: Calculations on Strings II
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 = a1a2…am and t = b1b2…bn. Then s  t if s = , or |s|  |t| and ai = bi, for all 1  i  m, or There exists k  1 with k  m and k  n and ai = bi for all 1  i < k, but ak < bk.

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, b} {a, c} {b, c} {a} {b} {c} {}

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

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 f1, f2  [f] and g1, g2  [g]. Then f1~ f2 and g1 ~ g2. To show that  is well defined, we must show that if [f1]  [g1], then [f2]  [g2], meaning that it does not matter which function we select to represent the class.

[f]  [g] is Well Defined So suppose that [f1]  [g1]. Then f2(x) is O(f1(x)), and f1(x) is O(g1(x)) and g1(x) is O(g2(x)). So, f2(x) is O(g2(x)). Therefore, [f2]  [g2].

Example: Partial Order Relation Theorem:  is a partial order relation on E. Proof: Reflexivity It is clear that [f]  [f] . (Use M = 1, x0 = 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 doubles. 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.

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?

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?

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 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 x0 be a minimal element of A. Let A1 = A – {x0}.

Topological Sorting A1 is again a partially ordered finite set, so it must have a minimal element. Let x1 be a minimal element of A1 and define A2 = A1 – {x1}. Continue in this manner, defining x3, x4, x5, and so on, until no elements remain. Then define 2 as follows: xi 2 xj if and only if i  j.

Example Let A = {1, 2, 3, …, 10} under the “divides” relation. 8 10 9 4 6 2 3 5 7 1

Example Let x0 = 1 and remove 1 from the set. 8 10 9 4 6 2 3 5 7

Example Let x1 = 7 and remove 7 from the set. 8 10 9 4 6 2 3 5

Example Let x2 = 5 and remove 5 from the set. 8 10 9 4 6 2 3

Example Let x3 = 3 and remove 3 from the set. 8 10 9 4 6 2

Example Let x4 = 9 and remove 9 from the set. 8 10 4 6 2

Example Let x5 = 2 and remove 2 from the set. 8 10 4 6

Example Let x6 = 10 and remove 10 from the set. 8 4 6

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

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

Example Let x9 = 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.