Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

19
1 Zvi Kohavi and Niraj K. Jha Sets, Relations, and Sets, Relations, and Lattices Lattices

Transcript of Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

Page 1: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

1

Zvi Kohavi and Niraj K. Jha

Sets, Relations, and LatticesSets, Relations, and Lattices

Page 2: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

2

SetsSets

Set: collection of distinct objects

Example: attendees in this class; prime numbers

Objects: elements, or members, of the set

Set with no elements: empty, or null, set

Set of all even numbers between 1 and 10: {2,4,6,8,10}

Infinite set of all positive, even numbers: {2,4,6, …}

Readers of the Kohavi-Jha book living in Antarctica: most likely empty

Page 3: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

3

Set DefinitionsSet Definitions

Universe U: set of all possible outcomes

Example: Rolling a die• U = {f1, f2, f3, f4, f5, f6}

U has 26 = 64 subsets• Null, {f1}, …, {f6}, {f1,f2}, …, {f5,f6}, {f1,f2,f3}, …, U

A=B: A and B are identical

A B: A is a subset of B

A B: A is a proper subset of B

A+B: union of A and B

AB: intersection of A and B

A’: complement of A

Page 4: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

4

Venn DiagramsVenn Diagrams

ABA

(a) AB. (b) A + B. (c) A

(d) AB = (e) A

B

.

A B AB

B..

A

A

Page 5: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

5

Ordered PairOrdered Pair

Ordered pair (a,b): specific order associated with a and b• a: first coordinate• b: second coordinate

Example: mother and daughter; teacher and student

Example: {(a,a), (a,b), (b,a), (b,c), (c,a)}

b

c

a

Generalization: Ordered n-tuple (a1, a2, …, an)

Page 6: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

6

Binary RelationBinary RelationBinary relation R: set of ordered pairs (a,b)

a R b: a is related to b by R

Cartesian product AxB: set of ordered pairs (a,b) s.t. a is in A and b is in B

Example: If A = {p,q} and B = {r,s,t}, then

AxB = {(p,r), (p,s), (p,t), (q,r), (q,s), (q,t)}

Relation from set A to A: relation in A – subset of AxA or A2

Relation R in set A is• Reflexive if it contains (a,a) for every a in A

• Symmetric if existence of (a,b) in R implies the existence of (b,a)

• Transitive if existence of (b,a) and (a,c) in R implies existence of (b,c)

Page 7: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

7

Properties of RelationsProperties of Relations

Relation R in set A is• Reflexive if it contains (a,a) for every a in A• Symmetric if existence of (a,b) in R implies the existence of (b,a)• Transitive if existence of (b,a) and (a,c) in R implies existence of (b,c)

Example: Relation {(a,a), (b,b), (a,b)} – reflexive and transitive, but not

symmetric

Example: Relation {(a,b), (b,a)} – symmetric, but not transitive since it

does not contain (a,a)

Binary relation R in set S: equivalence relation if it is reflexive, symmetric

and transitive

Example: Relation = is an equivalence relation since it satisfies for all

a, b, and c in R

• Reflexive: a = a

• Symmetric: If a = b, then b = a

• Transitive: If a = b and b = c, then a = c

Page 8: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

8

Equivalence ClassesEquivalence Classes

Equivalence relation: partitions elements of a set into disjoint subsets s.t. all

members of a subset are equivalent and members of different subsets

are not equivalent

Disjoint subsets: equivalence classes

Example: Relation of parallelism between lines in a plane

R = {(a,a), (b,b), (c,c), (d,d), (e,e), (f,f), (a,b), (b,a), (a,c), (c,a), (b,c), (c,b),

(d,e), (e,d)}

Equivalence classes: {a,b,c}, {d,e}, {f}

ab

c

f

de

Page 9: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

9

Compatibility RelationCompatibility Relation

Compatibility relation: relation that is reflexive and symmetric, but not transitive

• Nontransitivity nondisjoint subsets

• Subsets: compatibility classes

Partition: Partition on set S: collection of disjoint subsets with set union S

• Disjoint subsets: blocks of partition

• Uniform partition: each block contains the same no. of elements

Example: Equivalence relation for parallel lines induces partition {a,b,c; d,e; f}

Function: set of ordered pairs in which no two pairs have same first coordinate

Example: If A = {a,b,c} and B = {d,e}

• {(a,d), (b,e), (c,d)} is a function from A to B

• {(a,d), (b,e), (c,d), (c,e)} is not

Page 10: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

10

Partially Ordered SetsPartially Ordered Sets

Partial ordering: reflexive, antisymmetric and transitive binary relation

Example: For S = {a,b,c}, partial ordering satisfies• Reflexive: a a• Symmetric: a b and b a imply a=b• Transitive: if a b and b c, then a c

Partition on S “smaller than or equal to” than on S, denoted • if each pair of elements in a common block of is also in a common block of • two partitions incomparable if neither is smaller than or equal to the other

1 2 21 21

Example: Consider S and its three partitions:

S = {a,b,c,d,e,f,g,h,i}

= {a,b; c,d; e,f; g,h,i}

= {a,f; b,c; d,e; g,h; i}

= {a,b,e,f; c,d; g,h,i}

, but and are incomparable, as are and

1

2

3

31 1 2 2 3

Page 11: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

11

Totally Ordered SetsTotally Ordered Sets

Total ordering: if for every pair a,b in S, either or , then S is totally ordered by binary relation

Example: Set of all prime numbers is totally ordered by

Displaying the ordering relation with a Hasse diagram

Example: Partial ordering displaying divisibility relation among all positive divisors of 45, such that the quotient is an integer

ba ab

5

1

15

45

9

3

Hasse diagram

Page 12: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

12

Least/Greatest Member of a SetLeast/Greatest Member of a Set

a b

c

d

e f

Maximal members

Minimal members

Least member: if for every b in S, then a is called the least member of S• When least member exists, it is unique

Example: When the set does not have a least member, define minimal member

Greatest member: if for every b in S, then a is called the greatest member of S• When greatest member exists, it is unique• When greatest member does not exist, define maximal member

ba

ab

Page 13: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

13

Lower/Upper Bound of a Subset of Set Lower/Upper Bound of a Subset of Set SS

Upper bound: Let S be partially ordered and P be a subset of S, then an element s in S is an upper bound of P if and only if, for every p in P,

• s is not necessarily a member of P

Least upper bound (lub): smallest of all upper bounds

Lower bound: Element s in S is an lower bound of P if and only if, for every p in P,

Greatest lower bound (glb): largest of all lower bounds

Example: S = {1,3,5,9,15,45} and P = {3,5}• Upper bounds: 15, 45• lub: 15• glb = 1

sp

ps

Page 14: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

14

LatticeLattice

5

1

15

45

9

3

a0

Lattice: partially ordered set in which every pair of elements has a unique glb and a unique lub

• Least element: denoted as 0• Greatest element: denoted as 1• For each element a of lattice: and

Example:

1a

Lattice

a b

c

d

e f

Maximal members

Minimal members

Not a lattice

Page 15: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

15

Lattice (Contd.)Lattice (Contd.)

Example: Lattice of all subsets of set S = {a,b,c}, under the ordering relation

of set inclusion, where {a,b,c} = 1 and = 0

{a,b,c}

{a,c}{a,b} {b,c}

{c}{b} {a}

Page 16: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

16

Binary OperationBinary Operation

Because of their uniqueness, lub and glb may be viewed as binary operations

• Sum a+b = lub(a,b)• Product a.b = glb(a,b)

lub and glb satisfy:

• Idempotency: a.a = a+a = a

• Commutativity: a.b = b.a and a+b = b+a

• Absorption: a+a.b = a and a.(a+b) = a

• Associativity: a.(b.c) = (a.b).c and a+(b+c) = (a+b)+c

Following properties valid for every finite lattice:

• a+0 = a

• a.0 = 0

• a.1 = a

• a+1 = 1

Page 17: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

17

Partially Ordered Set Whose Elements Partially Ordered Set Whose Elements are Partitionsare Partitions

2.1

Example: Let = {a,b; c,d,e; f,h; g,i} and = {a,b,c; d,e; f,g; h,i}

= {a,b,c,d,e; f,g,h,i}

= {a,b; c; d,e; f; g; h; i}

= {a,b,c,d,e,f,g,h,i}: greatest partition with just one block

= {a;b;c;d;e;f;g;h;i}: least partition with single-element

blocks

)(I)0(

21

21

Page 18: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

18

Distributive Law Not Necessarily ValidDistributive Law Not Necessarily Valid

0

34

Lattice is distributive if and only if

• a.(b+c) = a.b+a.c

• a+(b.c) = (a+b)(a+c)

Example: Consider

= {a;b;c} =

= {a,b;c}

= {a;b,c}

= {a,c;b}

= {a,b,c} = )(I

)0(12

Product , but , hence lattice not distributive 1)32.(1 03.12.1

4 (I)=

0 (0)=

1 2 3

Page 19: Zvi Kohavi and Niraj K. Jha 1 Sets, Relations, and Lattices.

19

Complemented LatticeComplemented Lattice

Lattice is said to be complemented, if for each element a, there exist a’ s.t.• a.a’ = 0• a+a’ = 1• a’ is the complement of a and vice versa

{a,b,c}

{a,c}{a,b} {b,c}

{c}{b} {a}

Distributed and complemented lattice

Example: