18
Set Operations Jing Yang October 4, 2010 1

Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Set Operations

Jing YangOctober 4, 2010

1

Page 2: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Review

Sets: definition, representation

Set membership, subsets, proper subsets, power set, Cartesian product

Today: set operations

2

Page 3: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Set Operations

Union: A∪B = {x|(x∈A)∨(x∈B)}

Intersection: A∩B = {x|(x∈A)∧(x∈B)}

Disjoint sets: A, B are disjoint iff A∩B=∅

Difference: A-B = {x|(x∈A)∧(x∉B)}

Complement: AC or Ā = {x|x∉A} = U-A

3

Page 4: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Union A∪B

UA

B

U

AB

UAB

Union: A∪B = {x|(x∈A)∨(x∈B)}

4

Page 5: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Intersection A∩B

UA

B

U

AB

UAB

Intersection: A∩B = {x|(x∈A)∧(x∈B)}

Disjoint setsA, B are disjoint iff A∩B=∅

5

Page 6: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Difference A-B

UA

B

U

AB

UAB

Difference: A-B = {x|(x∈A)∧(x∉B)}

U

AB

6

Page 7: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Complement Ac or Ā

UA

Complement: AC or Ā = {x|x∉A} = U-A

7

Page 8: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

ExamplesFor U = {0,1,2,3,4,5,6,7,8,9,10},

If A = {1,2,3,4,5}, B = {4,5,6,7,8}, then:

A∪B = {1,2,3,4,5,6,7,8}

A∩B = {4,5}

A-B = {1,2,3}

B-A = {6,7,8}

Ā = {6,7,8,9,10}8

Page 9: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Set Identities

Set identities correspond to logical equivalences

How to prove the set identities?

Show each set is a subset of the other

Use membership tables

9

Page 10: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Example:

10

A ! B = A " B

Proof by showing:

Let x be arbitrary, then we can treat the predicates as propositions

!x(x " A # B $ x " A % B)

Page 11: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Example:

11

A ! B = A " B

x ! A " B# x /! A " B# ¬(x ! A " B)# ¬(x ! A $ x ! B)# ¬(x ! A) % ¬(x ! B)# x /! A % x /! B# x ! A % x ! B# x ! A & B

Def. of complementDef. of ∉Def. of ∪De Morgan’s LawsDef. of ∉Def. of complementDef. of ∩

Page 12: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Example:

12

A ! B = A " B

Since:x was arbitraryBy using only logically equivalent assertions and definitions we showed

is a tautologySo we can claim:

!x(x " A # B $ x " A % B)

x ! A " B # x ! A $ B

Page 13: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Example:

13

A ! B = A " B

Proof by using a membership table

A B A∪B1 1 1 0 0 0 01 0 1 0 0 1 00 1 1 0 1 0 00 0 0 1 1 1 1

A ! B A B A ! B

Page 14: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Set Identities

Important set identities (Page 124)

Associative Laws, Distributive Laws, De Morgan’s Laws

Similarity of the laws in P124 and P24

14

Page 15: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Generalized Unions

A∪B∪C

Let A1, A2, ..., An be an indexed collection of sets, we have:

15

n!

i=1

Ai = A1 ! A2 ! ... ! An

UCB

A

Page 16: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Generalized Intersections

A∩B∩C

Let A1, A2, ..., An be an indexed collection of sets, we have:

16

UCB

A

n!

i=1

Ai = A1 ! A2 ! ... ! An

Page 17: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Example

Let Ai={i,i+1,i+2,...}, then:

17

n!

i=1

Ai = {n, n + 1, n + 2, ...}

n!

i=1

Ai = {1, 2, 3, ...}

Page 18: Set Operations - eecs.yorku.ca€¦ · Understand the relationship between set operations and logic operations Practice proving set identities Recommended exercises: 3,5,19,25 18

Reading and Notes

Understand the relationship between set operations and logic operations

Practice proving set identities

Recommended exercises: 3,5,19,25

18