Docsity

Set Operations, Lecture Notes - Computer Science, Study notes of Number Theory

Partial preview of the text

Download Set Operations, Lecture Notes - Computer Science and more Study notes Number Theory in PDF only on Docsity!

Set Operations

Zeph Grunschlag

Announcements

HW2 due next time

 Check homepage for possible announcements over week-end. May change a couple of problems.

Universe of Reference

When talking about a set, a universe of

reference ( universal set ) needs to

be specified. Even though a set is

defined by the elements which it

contains, those elements cannot be

arbitrary. If arbitrary elements are

allowed paradoxes can result arising

from self reference.

Set Builder Notation

Up to now sets have been defined using the curly brace notation ―{ … }‖ or descriptively ―the set of all natural numbers‖. The set builder notation allows for concise definition of new sets. For example  { x | x is an even integer }  { 2x | x is an integer } are equivalent ways of specifying the set of all even integers.

Set Builder Notation.

Shortcuts.

To specify a subset of a pre-defined set,

f ( x ) takes the form x S. For example

{x  N |  y (x = 2y ) }

defines the set of all even natural numbers (assuming universe of reference Z ).

When universe of reference is understood,

don’t need to specify propositional function

EG: { x 3 | } or simply {x 3 } specifies the set

of perfect cubes

{0,1,8,27,64,125, …}

assuming U is the set of natural numbers.

Set Builder Notation.

Examples.

Q1: U = N. { x |  y (y  x ) } =?

Q2: U = Z. { x |  y (y  x ) } =?

Q3: U = Z. { x |  y (y  R  y 2 = x )} =?

Q4: U = Z. { x |  y (y  R  y 3 = x )} =?

Q5: U = R. { |x | | x  Z } =?

Q6: U = R. { |x | } =?

Set Theoretic Operations

Set theoretic operations allow us to build new sets out of old, just as the logical connectives allowed us to create compound propositions

from simpler propositions. Given sets A and B,

the set theoretic operators are:  Union ()  Intersection ()  Difference (-)  Complement (―—‖)  Symmetric Difference ()

give us new sets A B, A B, A-B, A B, and A.

Venn Diagrams

Venn diagrams are useful in representing

sets and set operations. Various sets

are represented by circles inside a big

rectangle representing the universe of

reference.

Intersection

A  B = { x | x  A  x  B }

Elements in exactly one of the two sets:

A B

U

A  B

Disjoint Sets

DEF: If A and B have no common elements, they

are said to be disjoint , i.e. A  B = .

A B

U

Disjoint Union

FACT: In a disjoint union of finite sets,

cardinality of the union is the sum of

the cardinalities. I.e.

A  B  A  B

Set Difference

A - B = { x | x  A  x  B }

Elements in first set but not second:

A

B

U

A - B

Complement

 A = { x | x  A }

Elements not in the set (unary operator):

A

U

 A

Set Identities

Table 1, Rosen p. 49  Identity laws  Domination laws  Idempotent laws  Double complementation  Commutativity  Associativity  Distribuitivity  DeMorgan This table is gotten from the previous table of logical identities (Table 5, p. 17) by rewriting as follows:  disjunction ―‖ becomes union ―‖  conjunction ―‖ becomes intersection ―‖  negation ―‖ becomes complementation ―–‖  false ―F‖ becomes the empty set   true ―T‖ becomes the universe of reference U