Partial Orders

Partial Orders

Partial Orders Margaret M. Fleck 17 November 2008 Finishes the dicussion of partial orders (section 8.6 of Rosen). 1 Announcements Last honors homework will be released shortly, probably due last Monday of classes. Quiz 3 will be in class, Wednesday after break. 2 Recap Recall from last Friday that a partial order is a relation that is reflexive, antisymmetric, and transitive. Unlike a total (linear) order, it lacks a guar- antee that two elements will be \comparable", i.e. related in one or the other direction. So ≤ is a total order on the integers because for every p; q, either p ≤ q or q ≤ p. The divides relation is a partial order, because some pairs of numbers (e.g. 3 and 5) don't divide one another in either order. The relation < isn't a partial order, because it's not reflexive, it's irreflex- ive. Relations that are irreflexive, antisymmetric, and transitive are strict partial orders. We will be concentrating on the normal (non-strict) partial orders. The strict ones are closely related and fairly similar. 1 A set with a partial order relation on it is called a partially ordered set, frequently abbreviated as poset. We also saw a new type of stripped down graph representation, used only for partial orders, called a Hasse diagram. In this representation, you leave out the reflexive loop and arcs you can infer from transitivity. You also arrange the nodes on the page so all the arrows point up, then delete the arrowheads. 3 More examples of partial orders Suppose we have a set A and build a collection S of subsets of A. Then set inclusion ⊆ is a partial order on S. For example, suppose A = fa; b; cg and S contains all subsets of A. Then we have fa; b; cg fa; bg fb; cg fa; cg fag fbg fcg ; Notice that fa; bg and fb; cg aren't comparable, because neither is a subset of the other. Partial orders can be used to represent type relations, e.g. for variables types or classes in programming languages or for modelling our knowledge about the real world for artificial intelligence. These relationships often gen- erate graphs that are a bit like trees, but have crossing branches. 2 objects sequences numbers lists ordered arrays integers reals complex ordered lists ordered arrays The set of functions from the reals to the reals can be partially ordered by f ≤ g if and only if f(x) ≤ g(x) for every real x. So 3x + 3 ≤ 17x + 20. But x2 and 2x aren't comparable, because x2 is sometimes larger than 2x and sometimes smaller, depending on the choice of x. 4 Ordering complex objects Defining an order on a set of objects is very useful in programming applica- tions, because it allows you to sort lists of objects. You can then use binary search to find things in the list much faster (as we saw a few weeks ago). But the language often supplies an explicit order only for basic objects such as numbers and letters. So the programmer must extend this ordering to complex objects such as strings, lists, arrays. Suppose we have a partial order on a set of objects A. We can then define a partial order on pairs of objects from A in several ways. The product order says that, if a; b; c; d 2 A (a; b) ≤ (c; d) if and only if a ≤ c and b ≤ d. 3 For example, suppose we let A be the set f1; 2; 3; 4g, ordered by normal numerical ≤. Then (1; 2) ≤ (3; 4) and (2; 3) ≤ (2; 4) But (2; 3) isn't compa- rable to (3; 2). So this is not a total order on the pairs, even though ≤ was a total order on the individual integers. Alternatively, we can use lexicographic order. This says that (a; b) ≤ (c; d) if and only if a < c or a = c and b ≤ d. In this ordering, (2; 3) ≤ (3; 2) because the 2 < 3. In fact, all pairs of numbers are comparable. Lexicographic ordering on pairs is a total ordering if the individual items were totally ordered. Lexicographic order is like the way you arrange words in a dictionary: sort them by the first characters, then sort by the second character etc. And we can extend the idea to longer lists: • (a1; a2; : : : ; an) ≤ (b1; b2; : : : ; bn) if a1 < b1 or if ai = bi for all i from 0 through k − 1, and (if k < n) ak < bk So (4; 3; 2) ≤ (4; 3; 3) because the first two elements are the same and 2 ≤ 3. This idea can be extended to lists of varying length by treating all shorter lists as ≤ all longer lists. Alternatively, you can compare characters up to the length of the shorter string. If the shorter string is the same as the first portion of the longer string, put the shorter string first. The first method is often used in automata theory, the second is what you'd see in a normal dictionary. 5 Scheduling example Partial orders are also used to represent the constraints in scheduling prob- lems. For example, suppose you are getting ready in the morning. Here's a Hasse diagram of which tasks need to be done before which other tasks. 4 shoes coat pants socks shirt breakfast shower Notice that some pairs of tasks can be done in either order, e.g. you can put on your socks before or after your shirt. Sometimes a set with a partial order has a greatest element, i.e. an element that is ≥ all the other elements in the set. This was true for our subset and type examples. However, in this case, our graph has two elements at with nothing larger: \shoes" and \coat". In such cases, both top elements are called maximal. Officially, if (A; ) is a partially ordered set, then x 2 A is maximal if and only if there is no y 2 A such that x =6 y and x y. Similarly, a partial order sometimes has a least element, i.e. an element that is smaller than all other elements. In this example (and in the types example above), we instead have two minimal elements. 6 Topological sorting If we have a partial order showing the constraints, we can create one or more total orders that obey the constraints. These are called total orders compatible with the partial order or a topological sort or linearization of the partial order. Typically, there are many total orders compatible with a given partial order. For example, here's two topological sorts of our scheduling example, which represent two perfectly reasonable ways to get ready in the morning. • shower pants socks shirt breakfast shoes coat 5 • breakfast shower shirt pants socks shoes coat Examples like this occur frequently in Artificial Intelligence, and in more serious-sounding scheduling applications (e.g. business, military, transporta- tion). You can compute a topological sort by repeatedly removing a minimal element from the input set and adding it to the end of the output totally ordered set. 7 Upper and lower bounds Suppose we have a partially ordered set (A; ). Suppose we pick a subset S of A. Then x is an upper bound for S if x ≤ y for all y 2 S. For example, rememeber the divides relation on the set A = f1; 15; 12; 3; 5; 2; 4; 6g. 15 12 6 4 5 3 2 1 The elements 6 and 12 are both upper bounds for the subset S = f1; 2; 3; 6g. In this case, 6 is smaller than all the other upper bounds for S, so it is called the least upper bound. There isn't always a least upper bound. Suppose we looked at the divide relation on the set f1; 3; 5; 30; 45g. Then 30 and 45 are both upper bounds for the subset T = f1; 3; 5g but 30 and 45 aren't comparable to one another So T doesn't have a least upper bound. Lower bounds and greatest lower bounds are defined similarly. 6.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us