discrete structures algorithms basics of set theory
Download
Skip this Video
Download Presentation
Discrete Structures & Algorithms Basics of Set Theory

Loading in 2 Seconds...

play fullscreen
1 / 33

Discrete Structures & Algorithms Basics of Set Theory - PowerPoint PPT Presentation


  • 359 Views
  • Uploaded on

Discrete Structures & Algorithms Basics of Set Theory. EECE 320 — UBC. Set Theory: Definitions and notation. A set is an unordered collection of elements . Some examples {1, 2, 3} is the set containing “1” and “2” and “3.” {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Discrete Structures & Algorithms Basics of Set Theory' - bernad


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
set theory definitions and notation
Set Theory: Definitions and notation

A set is an unordered collection of elements.

Some examples

  • {1, 2, 3} is the set containing “1” and “2” and “3.”
  • {1, 1, 2, 3, 3} = {1, 2, 3} since repetition is irrelevant.
  • {1, 2, 3} = {3, 2, 1} since sets are unordered.
  • {1, 2, 3, …} is a way we denote an infinite set (in this case, the natural numbers).
  •  = {} is the empty set, or the set containing no elements.

Note:   {}

definitions and notation
A

B

Definitions and notation

x  S means “x is an element of set S.”

x  S means “x is not an element of set S.”

A  B means “A is a subset of B.”

or, “B contains A.”

or, “every element of A is also in B.”

or, x ((x  A)  (x  B)).

Venn Diagram

definitions and notation1
Definitions and notation

A  B means “A is a subset of B.”

A  B means “A is a superset of B.”

A = B if and only if A and B have exactly the same elements.

iff, A  B and B  A

iff, A  B and A  B

iff, x ((x  A)  (x  B)).

  • So to show equality of sets A and B, show:
    • A  B
    • B  A
definitions and notation2
A

B

Definitions and notation

A  B means “A is a proper subset of B.”

  • A  B, and A  B.
  • x ((x  A)  (x  B))  x ((x  B)  (x  A))
  • x ((x  A)  (x  B))  x ((x  B) v (x  A))
  • x ((x  A)  (x  B)) x ((x  B) (x  A))
  • x ((x  A)  (x  B)) x ((x  B)  (x  A))
definitions and notation3
Definitions and notation

Quick examples:

  • {1,2,3}  {1,2,3,4,5}
  • {1,2,3}  {1,2,3,4,5}

Is   {1,2,3}?

Yes!x (x  )  (x  {1,2,3}) holds, because (x  ) is false.

Vacuously

Is   {1,2,3}?

No!

Is   {,1,2,3}?

Yes!

definitions and notation4
Yes

Yes

Yes

No

Definitions and notation

Quiz Time

Is {x}  {x}?

Is {x}  {x,{x}}?

Is {x}  {x,{x}}?

Is {x}  {x}?

how to specify sets
: and | are read “such that” or “where”

Primes

How to specify sets
  • Explicitly: {John, Paul, George, Ringo}
  • Implicitly: {1,2,3,…}, or {2,3,5,7,11,13,17,…}
  • Set builder: { x : x is prime }, { x | x is odd }. In general { x : P(x) is true }, where P(x) is some description of the set.

Example: Let D(x,y) denote “x is divisible by y.”

Give another name for

{ x : y ((y > 1)  (y < x)) D(x,y) }.

Can we use any predicate P to define a set S = { x : P(x) }?

predicates for defining sets
Doh!

So S must not be in S, right?

No!

Who shaves the barber?

Predicates for defining sets

Can we use anypredicate P to define a set

S = { x : P(x) }?

Define S = { x : x is a set where x  x }

Then, if S  S, then by the definition of S, S  S.

But, if S  S, then by the definition of S, S  S.

There is a town with a barber who shaves all the people (and only the people) who do not shave themselves.

cardinality of sets
Cardinality of sets

If S is finite, then the cardinality of S, |S|, is the number of distinct elements in S.

If S = {1,2,3},

|S| = 3.

If S = {3,3,3,3,3},

|S| = 1.

If S = ,

|S| = 0.

|S| = 3.

If S = { , {}, {,{}} },

If S = {0,1,2,3,…}, |S| is infinite. (more on this later)

power sets
Power sets

If S is a set, then the power set of S is

2S = { x : x  S }.

or P(S)

We say, “P(S) is the set of all subsets of S.”

2S = {, {a}}.

If S = {a},

If S = {a,b},

2S = {, {a}, {b}, {a,b}}.

2S = {}.

If S = ,

2S = {, {}, {{}}, {,{}}}.

If S = {,{}},

Fact: if S is finite, |2S| = 2|S|. (If |S| = n, |2S| = 2n.)

cartesian product
Cartesian product

The Cartesian product of two sets A and B is:

A x B = { : a  A  b  B}

We’ll use these special sets soon!

If A = {Charlie, Lucy, Linus}, and

B = {Brown, VanPelt}, then

A x B = {, , , , , }

A1 x A2 x … x An = {: a1  A1, a2  A2, …, an  An}

AxB

|A|+|B|

|A+B|

|A||B|

A,B finite  |AxB| = ?

operators
B

A

Operators

The union of two sets A and B is:

A  B = { x : x  A v x  B}

If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then

A  B = {Charlie, Lucy, Linus, Desi}

operators1
B

A

Operators

The intersection of two sets A and B is:

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

If A = {Charlie, Lucy, Linus}, and B = {Lucy, Desi}, then

A  B = {Lucy}

operators2
Operators

The intersection of two sets A and B is:

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

If A = {x : x is a US president}, and B = {x : x is deceased}, then

A  B = {x : x is a deceased US president}

B

A

operators3
B

A

Sets whose intersection is empty are called disjoint sets

Operators

The intersection of two sets A and B is:

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

If A = {x : x is a US president}, and B = {x : x is in this room}, then

A  B = {x : x is a US president in this room} = 

operators4
AOperators

The complement of a set A is

Ac = { x : x  A}

If A = {x : x is bored}, then

A = {x : x is not bored}

= 

U

  • c = U and

Uc = 

operators5
U

A

B

Operators

The set difference, A - B, is:

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

A - B = A  Bc

operators6
U

A

B

like “exclusive or”

Operators

The symmetric difference, A  B, is:

A  B = { x : (x  A  x  B) v (x  B  x  A)}

= (A - B) U (B - A)

operators7
Operators

A  B = { x : (x  A  x  B) v (x  B  x  A)}

= (A - B) U (B - A)

Proof:

{ x : (x  A  x  B) v (x  B  x  A)}

= { x : (x  A - B) v (x  B - A)}

= { x : x  ((A - B) U (B - A))}

= (A - B) U (B - A)

famous identities
Famous identities
  • Two pages of (almost) obvious equivalences.
  • One page of HS algebra.
  • Some new material?

Don’t memorize them, understand them!

They’re in Rosen, Sec. 2.2

identities
A  U = A

A U U = U

A U A = A

A U  = A

A  = 

A A = A

Identities
  • Identity
  • Domination
  • Idempotent
identities1
A U A = U

A = A

A A=

Identities
  • Excluded middle
  • Uniqueness
  • Double complement
identities2
B U A

B  A

A U (B U C)

A U (B C) =

A  (B C)

A  (B U C) =

Identities
  • Commutativity
  • Associativity
  • Distributivity

A U B =

A  B =

(A U B)U C =

(A  B) C =

(A U B)  (A U C)

(A  B) U (A  C)

identities3
Identities
  • DeMorgan’s Law I
  • DeMorgan’s Law II

(A UB)c= Ac  Bc

(A  B)c= Ac U Bc

Hand waving is good for intuition, but we aim for a more formal proof.

p

q

proving identities
New & important

Like truth tables

Like 

Not hard, a little tedious

Proving identities
  • Show that A  B and that A  B.
  • Use a membership table.
  • Use previously proven identities.
  • Use logical equivalences to prove equivalent set definitions.
proving identities 1
Proving identities (1)

Prove that

  • () (x  (A U B)c)  (x  A U B)  (x  A and x  B)  (x  Ac  Bc)
  • () (x  Ac  Bc)  (x  A and x  B)  (x  A U B)  (x  (A U B)c)

(A UB)c= Ac  Bc

proving identities 2
Proving identities (2)

Prove that (A UB)c= Ac  Bc using a membership table.

0 : x is not in the specified set

1 : otherwise

Have we not seen this before?

proving identities 3
(A UB)= A U B

= A  B

= A  B

Proving identities (3)

Prove that (A UB)c= Ac  Bc using identities.

proving identities 4
Proving identities (4)

Prove that (A UB)c= Ac  Bc using logically equivalent set definitions.

(A UB)c= {x : (x  A v x  B)}

= {x : (x  A)  (x  B)}

= {x : (x  Ac)  (x  Bc)}

= Ac  Bc

a proof to do
A proof to do

X  (Y - Z) = (X  Y) - (X  Z). True or False?

Prove your response.

(X  Y) - (X  Z) = (X  Y)  (X  Z)’

= (X  Y)  (X’ U Z’)

= (X  Y  X’) U (X  Y  Z’)

=  U (X  Y  Z’)

= (X  Y  Z’)

another proof to do
Another proof to do

Prove that if (A - B) U (B - A) = (A U B) then ______

A  B = 

A U B = 

A = B

A  B = 

A-B = B-A = 

Suppose to the contrary, that A  B  , and that x  A  B.

Then x cannot be in A-B and x cannot be in B-A.

DeMorgan’s Law

Then x is not in (A - B) U (B - A).

Do you see the contradiction yet?

But x is in A U B since (A  B)  (A U B).

Trying to prove p  q

Assume p and not q, and find a contradiction.

Our contradiction was that sets were not equal.

Thus, A  B = .

wrap up
Wrap up
  • Sets are an essential structure for all mathematics.
  • We covered the basic definitions and identities that will allow us to reason about sets.
ad