<<

Announcements

ICS 6B } Regrades for Quiz #3 and Homeworks #4 & Boolean Algebra & Logic 5 are due Today

Lecture Notes for Summer Quarter, 2008

Michele Rousseau

Set 8 – Ch. 8.6, 11.6 Lecture 8 - Chpts 8.6, 11.1 2

Today’s Lecture

} Chapter 8 8.6, Chapter 11 11.1 ● Partial Orderings 8.6 Chapter 8: Section 8.6 ● Boolean Functions 11.1

Partial Orderings (Continued)

Lecture Set 8 - Chpts 8.6, 11.1 3

What is a Partial ? Some more defintions Let R be a on A. The R is a partial order iff R is: } If A,R is a poset and a,b are A, reflexive, antisymmetric, & transitive we say that: } A,R is called a or “poset” ● “a and b are comparable” if ab or ba } Notation: ◘ i.e. if a,bR and b,aR ● If A, R is a poset and a and b are 2 elements of A ● “a and b are incomparable” if neither ab nor ba such that a,bR, we write a b instead of aRb ◘ i.e if a,bR and b,aR } If two objects are always related in a poset it is called a total order, linear order or simple order. NOTE: it is not required that two things be related under a partial order. ● In this case A,R is called a chain. ● i.e if any two elements of A are comparable ● That’s the “partial” of it. ● So for all a,b A, it is true that a,bR or b,aR

5 Lecture Set 8 - Chpts 8.6, 11.1 6

1 Now onto more examples… More Examples Let Aa,b,c,d and let R be the relation Let A0,1,2,3 and on A represented by the diagraph Let R0,01,1, 2,0,2,2,2,33,3

The R is reflexive, but We draw the associated digraph: a b not antisymmetric a,c &c,a It is easy to check that R is 0 and not 1 c d transitive d,cc,a, but not d,a Refl. , antisym. & trans. 2 So A,R is a poset. 3 The elements 1,3 are incomparable because 1, 3 R and 3, 1 R so A,R is not a total ordered set.

Lecture Set 8 - Chpts 8.6, 11.1 7 Lecture Set 8 - Chpts 8.6, 11.1 8

More Examples (3) Another example

Let Aa,b,c,d and let R be the related Matrix: Aall people Rthe relation “a not taller than b” 1 1 1 0 To check Then 0 1 1 0 properties ab 0 0 11 more easily R is reflexive a is not taller than a 1 1 0 1 lets convert it to a diagraph RiR is not antiiisymmetric [][ ] d c ● If “a is not taller than b” and “b is not taller than a”, then a and b have the same height, but a is not necessarily equal to b – it could be 2 people of the We see that R is reflexive loops at every vertex same height. and antisymmetric no double arrows Not a poset! It is not transitive eg. c,d & d,a, but no c,a

Lecture Set 8 - Chpts 8.6, 11.1 9 Lecture Set 8 - Chpts 8.6, 11.1 10

Lexicographic Order

Lexicographic Order Suppose that A1.1 and A2,2 are two posets. } Lexicographic order is how we order words We construct a partial ordering on the A1x A2.

in the dictionary Given 2 elements a1, a2 and b1, b2 in A1x A2 ● It is AKA dictionary order or alphabetic order We say that a1, a2b1, b2 Iff a b but a b ● First, we compare the 1st letters, if they are 1 1 1 1 or a b and a b . equal then we check the 2nd pair and etc. 1 1 2 2 ◘ E.g Let S1,2,3 In other words,

◘ The lexicographical order of a1, a2b1, b2 iff

PS ,1,1,2,1,2,3,1,3,2,2,3,3 1. the first entries of a1, a2 the first entries of b1, b2 or } We can apply this to any poset 2. the first entries of a1, a2and b1, b2 , nd nd ● On a poset it is a natural order structure on the and the 2 entries of a1, a2 the 2 entries of b1, b2 entry Cartesian product. 11 12

2 Examples Example (2) Which of the following are true? EX. A1 A2; R1 R2 Then 1,3 1,4 ; 1,3 2,0; 3,5 4,8 True 1, 3 1, 3 4,4 2,8 False

In general, ggiven a1, a2 and b1, b2, ,3,8 ,4,5 True compare a1 and b1 1,2,4,10 1,2,5,8 True If a b then 1 1 2,4,5 2,3,6 False a , a b , b 1 2 1 2 1,5,8 2,3,4 True ElseIf a1 b1 , then

If b1 b2 then

a1, a2b1, b2 Lecture Set 8 - Chpts 8.6, 11.1 13 Lecture Set 8 - Chpts 8.6, 11.1 14

Strings Well Ordered Set } We apply this ordering to strings of symbols where } Let A,R be a poset there is an underlying 'alphabetical' or partial order which is a total order in this case. We say that A is a well‐ordered set if any non‐empty BA has a least element. Example: In other words, } Let A a, b, c and suppose R is the natural aB is a least element if ab for all bB. alphabetical order on A: recall that R is denoted by a R b and b R c. Example Then , is well ordered ● Any shorter string is related to any longer string comes ● Any subset B which is not empty has a least element. before it in the ordering. ● Eg if B2,3,4,5,27,248,1253 then the least element is ● If two strings have the same length then use the induced a2, because a b for all bB. partial order from the alphabetical order: aabc R abac , is not well ordered 15 ● Choose B, there is no least element 16

Hasse Diagram Example Construct the Hasse diagram of To every poset A,R we associate a Hasse diagram A1, 2, 3, R ● A graph that carries less info than the diagraph } Thus R1,1,1,2,1,3,2,2,2,3,3,3 To construct a Hasse diagram: Step 2: 1 Construct a digraph representation of the poset Step 1:Draw the Digraph Remove loops A, R so that all arcs point up except the loops. With arrows ppgpointing up 2 Eliminate all loops 3 • R is reflexive – SO we know they are there 3 Eliminate all arcs that are redundant because of Step 3: Eliminate 2 transitivity redundant transitive arcs • Keep a,b and b,c Æ remove a,c 4 Eliminate the arrows at the ends of arcs since 1 everything points up. and it is antisymmetric so arrows Step 4: Remove arrows

go only 1 way 17 Lecture Set 8 - Chpts 8.6, 11.1 18

3 Example (2) Example (3) Construct the Hasse diagram of Pa, b, c, } The elements of Pa, b, c are } Given the Hasse diagram write down all the ordered pairs in R

a, b, c } Okay, so what do we know about this diagram a, b, a, c, b, c {a, b, c} c d } We know it is antisymmetric a, b, c • and that the arrows point up } Basically, it shows } {a, c} {a, b} {b, c} We know it is reflexive a hierarchy } We also know it is transitive {a} {b} b {c} } Now that we have the diagraph R is easy to find

a Ra,a,a,b,a,c,a,d,b,b,b,c, b,d,c,c,d,d Lecture Set 8 - Chpts 8.6, 11.1 19 Lecture Set 8 - Chpts 8.6, 11.1 20

Maximal and Minimal Elements Example

Let S, be a poset } In this diagram An element a S is called maximal if there What is the maximal element? is no b such that a b. What is the minimal element?

In other words {a, b, c} MMiaxima l a is not less than any element in the poset. Similarly, Note: there can {a, c} {a, b} {b, c} An element B S is called minimal if there is be more than 1 minimal and {a} {b} no b such that b a. maximal element {c} in a poset These are easy to find in a Hasse diagram Minimal Because they are the “top” and “bottom” elements Lecture Set 8 - Chpts 8.6, 11.1 21 Lecture Set 8 - Chpts 8.6, 11.1 22

Example (2) Greatest and Least Elements aS is called the greatest element of poset 3 Maximal elements S, , if b a , b S } If there is only 1 maximal element then it Note: Every poset is the greatest. h1has 1 or more aS is called the least element of poset S, maximal elements and 1 or more , if a b , b S Minimal elements } If there is only 1 minimal element then it is the least 2 Minimal elements Note: The greatest and least may not exist

Lecture Set 8 - Chpts 8.6, 11.1 23 Lecture Set 8 - Chpts 8.6, 11.1 24

4 Examples Let S be a subset of A in the poset A, R. Greatest Let A S – be any subset No Greatest } An element bS is an upper bound for A if a b , a S Note:Not : B is not necessarilyn c ssarily in A

} b is a lower bound for A if b a , a S

Note: There can be more than 1 upper or lower bound No least least

Lecture Set 8 - Chpts 8.6, 11.1 25 Lecture Set 8 - Chpts 8.6, 11.1 26

Example Example (2) A c,d Upper bound: } In this diagram g What is the upper bound for all ? Lower bound: What is the lower bound for all subsets? fg a {a, b, c} UUbdpper bound A a c d e Upper bounds: Note: Because {a, c} {a, b} {b, c} a,c,d,f,g we are dealing a b Lower bound: with subsets the {a} {b} bounds don’t {c} a necessarily Lower bound Note: It must be reachable have to be in the From all elements in the subset Lecturesubset Set 8 - Chpts 8.6, 11.1 27 Lecture Set 8 - Chpts 8.6, 11.1 28

Least Upper Bound & Example (2) Greatest Lower Bound A a,b,c h xS is called the least upper bound of A iff Upper bound: gf 1 – x is an upper bound for A e, f, h 2 – x is less than any other upper bound of A e Lower bound: d a xS is called the greatest lower bound of A iff b c 1 – x is an lower bound for A A a, c, d, f a 2 – x is greater than any other upper bound of A Upper bounds: h,f Lower bound: Note: These bounds may not exist if they do they are unique Lecture Set 8 - Chpts 8.6, 11.1 a 29 Lecture Set 8 - Chpts 8.6, 11.1 30

5 Example (2) Example (2) S, , | ‐‐‐ assume 0 A b, d, g A3,9,12 ik Upper bound: Upper bounds: h g, h, I, k common multiples of 3,9,12 Ù Lower bound: gf b, a any positive which is divisible by 3, 9, 12 Ù e any positive integer which is divisible by 36 d Least upper bound: g Lower bounds: 3,1 Å common divisors of 3,9,12 b c Greatest lower bound: Least upper bound: b 36 least common multiple of 3,9,12 a Greatest lower bound: 3 greatest common divisor of 3,9,12 Lecture Set 8 - Chpts 8.6, 11.1 31 Lecture Set 8 - Chpts 8.6, 11.1 32

Lattices More Examples d Is this a ? A poset S, is called a lattice if every pair c e of elements a, b S has both a greatest what is the lub of b,c?

lower bound and a least upper bound b None – not a lattice

a ElExample h Is this a lattice? Is this a lattice? Yes de g what is the glb of a,b? f {a, b} e Is this a lattice? c None – not a lattice d {a} {b} Yes b c ab

a 33 Lecture Set 8 - Chpts 8.6, 11.1 34

Homework for 8.6

} 1c‐d3a‐d,5,7,9,11,19,21,23b‐c, 25,33 a‐h,35a‐h,43a‐c Chapter 11: Section 11.1

Boolean Functions

Lecture Set 8 - Chpts 8.6, 11.1 35

6 Bit Operations Boolean Functions

n Let B={0,1}. Then B ={x1, x2,…, xn} |B for 1in is the Boolean Sum ‐ denoted by , OR, or set of all possible n‐tuples of 0s and 1s. The variable x is 101, 01 1, 111 called a Boolean variable if it assumes values only from B A function form Bn to B is called a Boolean Function of 000 Only time it =s 0 degree n. Boolean Product‐ ydenoted by · ,,, AND, or AlA Boolean varia ble x is a bit binary digit 1 · 11 Only time it =s 1 – accepts values 0 and 1. So x 0,1. 1 · 00, 0 · 1 0, 0 · 00 _ A Boolean function of degree 1 is a function of Complement notated by , –NOT, or _ 1 Boolean variable with the values in 0,1 0 1_ F: 0,10,1, x Fx 1 0

Lecture Set 8 - Chpts 8.6, 11.1 37 Lecture Set 8 - Chpts 8.6, 11.1 38

Examples x F x x Examples (2) For Example: 1 10 F1x x A Boolean function of degree 2 is a function of two 01 variables with values in 0,1 x¬xF2x x Example: xy F x,y x+y F x x 1 2 10 1 00 0 F1x,y xy 01 0 01 1 10 1 x G(x)=x Notice these are = 11 1 Gx x 11 xy F1x,y xy 00 00 0 F1x,y xy 01 0 If G(x) takes exactly the same value as F2. We say 10 0 11 1 F2 and G are the same function Even if they are defined by different expressions! Lecture Set 8 - Chpts 8.6, 11.1 39 Lecture Set 8 - Chpts 8.6, 11.1 40

Order of Operations

} In order to evaluate these we need to understand the order of ● Things in Parenthesis come first ● Then ◘ 1 – Complement ◘ 2 – Product ◘ 3 – Sum

Lecture Set 8 - Chpts 8.6, 11.1 41

7