1 Partial Orderings Aaron Bloomfield CS 202 Rosen, section 7.6.

20
1 Partial Orderings Partial Orderings Aaron Bloomfield Aaron Bloomfield CS 202 CS 202 Rosen, section 7.6 Rosen, section 7.6

Transcript of 1 Partial Orderings Aaron Bloomfield CS 202 Rosen, section 7.6.

11

Partial OrderingsPartial OrderingsAaron BloomfieldAaron Bloomfield

CS 202CS 202

Rosen, section 7.6Rosen, section 7.6

22

IntroductionIntroduction

An equivalence relation is a relation that is reflexive, An equivalence relation is a relation that is reflexive, symmetric, and transitivesymmetric, and transitive

A partial ordering (or partial order) is a relation that is A partial ordering (or partial order) is a relation that is reflexive, reflexive, antiantisymmetric, and transitivesymmetric, and transitive

Recall that antisymmetric means that if (Recall that antisymmetric means that if (a,ba,b) ) RR, then (, then (b,ab,a)) RR unless unless bb = = aa

Thus, (Thus, (a,aa,a) is allowed to be in ) is allowed to be in RR But since it’s reflexive, all possible (But since it’s reflexive, all possible (a,aa,a) must be in ) must be in RR

A set A set SS with a partial ordering with a partial ordering RR is called a is called a partially partially ordered setordered set, or , or posetposet

Denoted by (Denoted by (S,RS,R))

33

Partial ordering examplesPartial ordering examples

Show that ≥ is a partial order on the set of Show that ≥ is a partial order on the set of integersintegers It is reflexive: It is reflexive: aa ≥ ≥ aa for all for all aa ZZ It is antisymmetric: if It is antisymmetric: if aa ≥ ≥ bb then the only way that then the only way that

bb ≥ ≥ aa is when is when bb = = aa It is transitive: if It is transitive: if aa ≥ ≥ bb and and bb ≥ ≥ cc, then , then aa ≥ ≥ cc

Note that ≥ is the partial ordering on the set of Note that ≥ is the partial ordering on the set of integersintegers

((ZZ, ≥) is the partially ordered set, or poset, ≥) is the partially ordered set, or poset

44

Symbol usageSymbol usage

The symbolThe symbol is used to represent is used to represent anyany relation relation when discussing partial orderswhen discussing partial orders Not just the less than or equals to relationNot just the less than or equals to relation Can represent ≤, ≥,Can represent ≤, ≥,, etc, etc Thus, Thus, aa bb denotes that ( denotes that (a,ba,b) ) RR The poset is (S,The poset is (S,))

The symbol The symbol is used to denote is used to denote aa bb but but aa ≠ ≠ bb If If represents ≥, then represents ≥, then represents > represents >

Fonts for this lecture set (specifically for the Fonts for this lecture set (specifically for the and and symbols) is symbols) is available on the course websiteavailable on the course website

55

ComparabilityComparability

The elements The elements aa and and bb of a poset ( of a poset (SS,,) are called ) are called comparable comparable if either if either aa bb or or bb aa.. Meaning if (Meaning if (a,ba,b) ) RR or ( or (b,ab,a) ) RR It can’t be both because It can’t be both because is antisymmetric is antisymmetric

Unless Unless a a = = bb, of course, of course If neither If neither aa bb nor nor bb aa, then , then aa and and bb are are

incomparableincomparableMeaning they are not related to each otherMeaning they are not related to each other

This is definition 2 in the textThis is definition 2 in the text

If all elements in If all elements in SS are comparable, the relation are comparable, the relation is a is a total orderingtotal ordering

66

Comparability examplesComparability examples

Let Let be the “divides” operator | be the “divides” operator |

In the poset (In the poset (ZZ++,|), are the integers 3 and 9 ,|), are the integers 3 and 9 comparable?comparable? Yes, as 3 | 9Yes, as 3 | 9

Are 7 and 5 comparable?Are 7 and 5 comparable? No, as 7 | 5 and 5 | 7No, as 7 | 5 and 5 | 7

Thus, as there are pairs of elements in Thus, as there are pairs of elements in ZZ++ that that are not comparable, the poset (are not comparable, the poset (ZZ++,|) is a partial ,|) is a partial orderorder

77

Comparability examplesComparability examples

Let Let be the less than or equals operator be the less than or equals operator ≤≤

In the poset (In the poset (ZZ++,,≤≤), are the integers 3 and 9 ), are the integers 3 and 9 comparable?comparable? Yes, as 3 Yes, as 3 ≤≤ 9 9

Are 7 and 5 comparable?Are 7 and 5 comparable? Yes, as 5 Yes, as 5 ≤≤ 7 7

As all pairs of elements in As all pairs of elements in ZZ++ are comparable, are comparable, the poset (the poset (ZZ++,,≤≤) is a total order) is a total order a.k.a. totally ordered poset, linear order, chain, etc.a.k.a. totally ordered poset, linear order, chain, etc.

88

A bit of Star Wars humor…A bit of Star Wars humor…

1010

Well-ordered setsWell-ordered sets

((SS,,) is a well-ordered set if:) is a well-ordered set if: ((SS,,) is a totally ordered poset) is a totally ordered poset Every non-empty subset of Every non-empty subset of SS has at least element has at least element

Example: (Example: (ZZ,≤),≤) Is a total ordered poset (every element is comparable to every Is a total ordered poset (every element is comparable to every

other element)other element) It has no least elementIt has no least element Thus, it is not a well-ordered setThus, it is not a well-ordered set

Example: (Example: (SS,≤) where ,≤) where SS = { 1, 2, 3, 4, 5 } = { 1, 2, 3, 4, 5 } Is a total ordered poset (every element is comparable to every Is a total ordered poset (every element is comparable to every

other element)other element) Has a least element (1)Has a least element (1) Thus, it is a well-ordered setThus, it is a well-ordered set

1111

Lexicographic orderingLexicographic ordering

Consider two posets: (Consider two posets: (SS,,11) and () and (TT,,22))

We can order Cartesian products of these two We can order Cartesian products of these two posets via lexicographic orderingposets via lexicographic ordering Let Let ss11 S and S and ss22 SS Let Let tt11 TT and and tt22 TT ((ss11,,tt11) ) ( (ss22,,tt22) if either:) if either:

ss11 11 ss22

ss11 = = ss22 and and tt11 22 tt22

Lexicographic ordering is used to order Lexicographic ordering is used to order dictionariesdictionaries

1212

Lexicographic orderingLexicographic ordering

Let Let SS be the set of word strings (i.e. no spaces) be the set of word strings (i.e. no spaces)

Let Let TT bet the set of strings with spaces bet the set of strings with spaces

Both the relations are alphabetic sortingBoth the relations are alphabetic sorting We will formalize alphabetic sorting laterWe will formalize alphabetic sorting later

Thus, our posets are: (Thus, our posets are: (SS,,) and () and (TT,,))

Order (“run”, “noun: to…”) and (“set”, “verb: to…”)Order (“run”, “noun: to…”) and (“set”, “verb: to…”) As “run” As “run” “set”, the “run” Cartesian product comes before the “set”, the “run” Cartesian product comes before the

“set” one“set” one

Order (“run”, “noun: to…”) and (“run”, “verb: to…”)Order (“run”, “noun: to…”) and (“run”, “verb: to…”) Both the first part of the Cartesian products are equalBoth the first part of the Cartesian products are equal ““noun” is first (alphabetically) than “verb”, so it is ordered firstnoun” is first (alphabetically) than “verb”, so it is ordered first

1313

Lexicographic orderingLexicographic ordering

We can do this on more than 2-tuplesWe can do this on more than 2-tuples

(1,2,3,5) (1,2,3,5) (1,2,4,3) (1,2,4,3) When When is is ≤≤

1414

Lexicographic orderingLexicographic ordering

Consider the two strings Consider the two strings aa11aa22aa33……aamm, and , and bb11bb22bb33……bbnn

Here follows the formal definition for lexicographic ordering of stringsHere follows the formal definition for lexicographic ordering of strings

If If mm = = nn (i.e. the strings are equal in length) (i.e. the strings are equal in length) ((aa11, , aa22, , aa33, …, , …, aamm) ) ( (bb11, , bb22, , bb33, …, , …, bbnn) using the comparisons just discussed) using the comparisons just discussed Example: “run” Example: “run” “set” “set”

If If mm ≠ ≠ nn, then let , then let tt be the minimum of be the minimum of mm and and nn Then Then aa11aa22aa33……aamm, is less than , is less than bb11bb22bb33……bbnn if and only if either of the following if and only if either of the following

are true:are true: ((aa11, , aa22, , aa33, …, , …, aatt) ) ( (bb11, , bb22, , bb33, …, , …, bbtt))

Example: “run” Example: “run” “sets” ( “sets” (tt = 3) = 3) ((aa11, , aa22, , aa33, …, , …, aatt) = () = (bb11, , bb22, , bb33, …, , …, bbtt) and ) and mm < < nn

Example: “run” Example: “run” “running” “running”

1515

Hasse DiagramsHasse Diagrams

Consider the graph for a finite poset ({1,2,3,4},≤)Consider the graph for a finite poset ({1,2,3,4},≤)

When we KNOW it’s a poset, we can simplify the When we KNOW it’s a poset, we can simplify the graphgraph

4

3

2

1

4

3

2

1

4

3

2

1

4

3

2

1

Called the Hasse diagram

1616

Hasse DiagramHasse Diagram

For the poset ({1,2,3,4,6,8,12}, |)For the poset ({1,2,3,4,6,8,12}, |)

1717

Not being coveredNot being covered

The remainder of 7.6 is not being covered due to The remainder of 7.6 is not being covered due to lack of timelack of time Maximal and minimal elementsMaximal and minimal elements LatticesLattices Topological sortingTopological sorting

18

Quick surveyQuick survey

I felt I understood the material in this I felt I understood the material in this slide set…slide set…

a)a) Very wellVery well

b)b) With some review, I’ll be goodWith some review, I’ll be good

c)c) Not reallyNot really

d)d) Not at allNot at all

19

Quick surveyQuick survey

The pace of the lecture for this The pace of the lecture for this slide set was…slide set was…

a)a) FastFast

b)b) About rightAbout right

c)c) A little slowA little slow

d)d) Too slowToo slow

20

Quick surveyQuick survey

How interesting was the material in How interesting was the material in this slide set? Be honest!this slide set? Be honest!

a)a) Wow! That was SOOOOOO cool!Wow! That was SOOOOOO cool!

b)b) Somewhat interestingSomewhat interesting

c)c) Rather bortingRather borting

d)d) ZzzzzzzzzzzZzzzzzzzzzz

2121

A bit of humor…A bit of humor…