+ All Categories
Home > Documents > 2.4 Comparing sizes of setsddunham/cs3512s15/notes/l06… ·  · 2015-02-17And from this it...

2.4 Comparing sizes of setsddunham/cs3512s15/notes/l06… ·  · 2015-02-17And from this it...

Date post: 12-May-2018
Category:
Upload: phungkhanh
View: 215 times
Download: 3 times
Share this document with a friend
23
§2.4 Comparing sizes of sets Sets A and B are the same size if there is a bijection from A to B . (That was a definition!) For finite sets A, B , it is not difficult to verify that there is a bijection from A to B iff |A| = |B |. Let’s do it. . . Take arbitrary finite sets A and B . LR: Assume f : A B is bijective. Then f is injective. So, by the pigeonhole principle, |A|≤|B |. Also f -1 : B A is injective. [Do you follow this step?] So, again by the pigeonhole principle, |B |≤|A|. We can conclude that |A| = |B |. RL: Assume that |A| = |B |. Since A is finite, there is a bijection f : A →{1, ..., |A|}. And since B is also finite, there is a similar bijection g : B →{1, ..., |B |}. Moreover, since |A| = |B |, the codomains of bijections f and g are the same. It follows that g -1 f is a bijection from A to B .
Transcript

§2.4 Comparing sizes of sets

Sets A and B are the same size if there is a bijection from A to B.

(That was a definition!)

For finite sets A,B, it is not difficult to verify thatthere is a bijection from A to B iff |A| = |B|.

Let’s do it. . .

Take arbitrary finite sets A and B.

LR: Assume f : A → B is bijective.Then f is injective.So, by the pigeonhole principle, |A| ≤ |B|.Also f −1 : B → A is injective. [Do you follow this step?]So, again by the pigeonhole principle, |B| ≤ |A|.We can conclude that |A| = |B|.

RL: Assume that |A| = |B|. Since A is finite, there is a bijectionf : A → {1, ..., |A|}. And since B is also finite, there is a similar bijectiong : B → {1, ..., |B|}. Moreover, since |A| = |B|, the codomains of bijections fand g are the same. It follows that g−1 ◦ f is a bijection from A to B.

Let’s not write |S | when S is an infinite set

The textbook proposes the notation

|A| = |B|

to say that A and B are the same size. But this is bad notation when A or B isinfinite!

Why? Because |A| is not defined for an infinite set A.

What do I mean? Well, it won’t do, for instance, to say that |A| = ∞ wheneverA is infinite. Why? Because then any two infinite sets would be the same size!

But aren’t infinite sets all “the same size”?

(Namely, infinite.)

Well no, but that’s a long story. . .

Countable sets

A set is countable if it is finite or is the same size as N.

So countable sets can be either finite or infinite.

The obvious question is: Are there any sets that are not countable?

Short answer: Yes.

Familiar example of an uncountable set: The set of real numbers, R.

Or the open interval of real numbers between 0 and 1.

Or power(N).

Or power({0, 1}∗).

Soon we will learn a method — called “diagonalization” — for proving thatone infinite set is larger than another.

But first let’s get a firmer understanding of countability. . .

Countability as “enumerability”Pick a natural number k . If you start listing the natural numbers in their“standard” order — that is, enumerating them — you will reach k in a finitenumber of steps (namely, k + 1 steps).

Intuitively, this is an argument that N is “enumerable”, or countable.

Similarly, take any set S for which there is a bijection

f : S → N .

Each element x of S corresponds to a natural number f (x).

If you start listing the elements of S in the order given by f

(f −1(0), f −1(1), f −1(2) . . .), you will reach x (for any given x) in a finitenumber of steps (namely f (x) + 1 steps).

This is the correct understanding of enumerability.

So how about this (fallacious) argument? To see that the real numbers arecountable, do the following. Take an arbitrary real number x . Now start listingreal numbers, one by one, and after some number of steps, include x as thenext element in the list. Since you wrote x within a finite number of steps, theset of real numbers is countable.

Every subset of N is countableClaim: Every subset of the natural numbers is countable.

Proof: Take any subset S of N. [So what is our goal now?]

If S is finite, we’re done. So assume S is infinite.

Notice that for each x ∈ S , { n | n ∈ S ,n < x } is finite.

Take f : S → N as follows. For all x ∈ S ,

f (x) = | { n | n ∈ S , n < x } | .

To see that f is injective, consider any two distinct elements x , y of S .Wlog assume that x < y . Then f (x) < f (y). To see this, notice that

x /∈ { n | n ∈ S ,n < x } but x ∈ { n | n ∈ S , n < y }

and{ n | n ∈ S ,n < x } ⊆ { n | n ∈ S ,n < y } .

To see that f is surjective, take any k ∈ N. Let A be the set consisting of thek + 1 smallest elements of S . (That is, |A| = k + 1 and every element of A isless than every element of S − A.) Let x be the largest element of A, andnotice that f (x) = k .

Proving countability

To show that A is countable, it is sufficient to show that there is an injectionfrom A to N.

Indeed, if f : A → N is injective, then there is a bijection

g : A → range(f )

such that, for all x ∈ A,g(x) = f (x) .

[How hard is it to see that g is bijective?] The existence of such a g shows thatA is the same size as range(f ), which is a subset of N, and so, a countable set.

Or, equivalently, it suffices to show that there is a surjection from N to A.

Why? (Because this implies that there is an injection from A to N.)

Every subset of a countable set is countable

Claim: Every subset of a countable set is countable.

Proof: Let A be a subset of countable set S .

Since S is countable, there is an injection f : S → N.

Take g : A → N s.t. for all x ∈ A,

g(x) = f (x) .

Then g is an injection from A → N, which shows that A is countable

Proving countability (more generally)

To show that A is countable, it is sufficient to show that there is an injectionfrom A to some countable set.

To see this, assume that B is countable, and that

f : A → B

is injective. Since B is countable, there is an injection

g : B → N .

It follows that (g ◦ f ) is an injection from A to N, from which we can concludethat A is countable.

And from this it follows that we can also prove A countable by showing thatthere is a surjection from some countable set to A.

[Why?]

The image of a countable set is countable

Claim: The image of a countable set (under any function) is countable.

Proof: Let f be a function from A to B.

Assume that S is a countable subset of A.

[So what is our goal now?]

Take g : S → f (S) s.t. for all x ∈ S ,

g(x) = f (x) .

Notice that g is a surjection from a countable set, namely S , to f (S).

From this we can conclude that f (S) is countable.

N× N is countableClaim: N× N is countable.

Proof idea:(0, 0) ↔ 0

(0, 1), (1, 0) ↔ 1, 2(0, 2), (1, 1), (2, 0) ↔ 3, 4, 5

(0, 3), (1, 2), (2, 1), (3, 0) ↔ 6, 7, 8, 9(0, 4), (1, 3), (2, 2), (3, 1), (4, 0) ↔ 10, 11, 12, 13, 14

...(0, n), (1, n − 1), . . . , (n, 0) ↔

∑n

i=0 i , . . . ,(∑n

i=0 i)

+ n...

This bijection is given by Cantor’s pairing function, mentioned in the last set oflecture notes as an example of an injective function.

f (x , y) =(

∑x+y

i=0 i)

+ x

= (x+y)(x+y+1)2 + x

= x2+xy+x+yx+y2+y

2 + 2x2

= (x+y)2+3x+y

2

Every “countable union” of countable sets is countableClaim: If S0,S1, . . . is a sequence of countable sets, then

n∈N

Sn

is also countable.

Proof: For each set Si , let fi be a surjection from N to Si . (Such a function fiexists, since Si is countable.) Take

g : N× N →⋃

n∈N

Sn

s.t. for all m, n ∈ N,g(m, n) = fm(n) .

Observe that g is surjective. Indeed, take any

x ∈⋃

n∈N

Sn .

Then, for some m ∈ N, x ∈ Sm .

And since fm : N → Sm is surjective, there is an n ∈ N s.t. fm(n) = x .

And since g is a surjection from the countable set N× N, we can conclude that⋃

n∈NSn is countable.

The rational numbers are countable

In the last set of lecture notes, we considered a bijection between the integersand the natural numbers. The existence of such a function shows that theintegers are countable.

Now, let’s show that the rational numbers are countable.

We’ll do this by representing them as a countable union of countable sets. . .

For each positive integer d , let

Sd ={

n

d| n ∈ Z

}

.

Since the integers are countable, so is Sd (for every d ∈ Z+).

Let S0 = ∅.

Now the set of rational numbers can be written as a countable union ofcountable sets, as follows.

Q =⋃

d∈N

Sd

And this shows that the set of rational numbers is indeed countable.

The set of all strings (over any alphabet) is countable

Recall: An alphabet is a finite set of symbols, and for any alphabet A,A∗ is the set of all strings over A.

If A is empty, then A∗ =

If A is a singleton, then it is still easy to see that A∗ is countable.

Indeed, take f : A∗ → N s.t. for all x ∈ A∗, f (x) = |x |.

If |A| > 1, we need a different approach.

As it happens though, the definition of closure is perfect for this:

A∗ =

n∈N

An

Notice that, for all n ∈ N, An is countable (in fact, finite).

Thus, A∗ is a countable union of countable sets, and so, countable.

So, is every language (over every alphabet) countable? Why?

More on comparing sizes of sets

Recall: Sets A and B are the same size if there is a bijection from A to B.A set is countable if it is finite or is the same size as N.

Some methods for showing that a set is countable.

◮ Every subset of a countable set is countable.

◮ Set S is countable iff there is an injection from S to some countable set.

◮ Set S is countable iff there is a surjection from some countable set to S .

◮ The image of a countable set is countable.

◮ A countable union of countable sets is countable.

Some countable sets:

◮ N× N,

◮ rational numbers,

◮ A∗ for any alphabet A,

◮ lists(N),

◮ the set of finite subsets of N.

Diagonalization — first version

All this activity presupposes that some infinite sets are not countable. . .

Now we will now investigate a proof method — called “diagonalization” — forproving that one set is larger than another.

Let’s look at a sketch of the idea, applied to the real numbers from 0 to 1,each represented by a countably infinite sequence of digits 0–9.

Here is a representation of (the beginning of) a countably infinite sequence ofsuch sequences. . .

d0,0, d0,1, d0,2, d0,3, d0,4, d0,5 d0,6, d0,7, . . .d1,0, d1,1, d1,2, d1,3, d1,4, d1,5, d1,6, d1,7, . . .d2,0, d2,1, d2,2, d2,3, d2,4, d2,5, d2,6, d2,7, . . .d3,0, d3,1, d3,2, d3,3, d3,4, d3,5, d3,6, d3,7, . . .d4,0, d4,1, d4,2, d4,3, d4,4, d4,5, d4,6, d4,7, . . .d5,0, d5,1, d5,2, d5,3, d5,4, d5,5, d5,6, d5,7, . . .d6,0, d6,1, d6,2, d6,3, d6,4, d6,5, d6,6, d6,7, . . .d7,0, d7,1, d7,2, d7,3, d7,4, d7,5, d7,6, d7,7, . . ....

......

......

......

.... . .

Since the sequence below is arbitrary, if we can show that not all real numbersfrom 0 to 1 are represented in this sequence, then we can conclude that noenumeration of all real numbers exists.

d0,0, d0,1, d0,2, d0,3, d0,4, d0,5 d0,6, d0,7, . . .d1,0, d1,1, d1,2, d1,3, d1,4, d1,5, d1,6, d1,7, . . .d2,0, d2,1, d2,2, d2,3, d2,4, d2,5, d2,6, d2,7, . . .d3,0, d3,1, d3,2, d3,3, d3,4, d3,5, d3,6, d3,7, . . .d4,0, d4,1, d4,2, d4,3, d4,4, d4,5, d4,6, d4,7, . . .d5,0, d5,1, d5,2, d5,3, d5,4, d5,5, d5,6, d5,7, . . .d6,0, d6,1, d6,2, d6,3, d6,4, d6,5, d6,6, d6,7, . . .d7,0, d7,1, d7,2, d7,3, d7,4, d7,5, d7,6, d7,7, . . ....

......

......

......

.... . .

OK, so how can we show that this is not an enumeration of all real numbersfrom 0 to 1? We should produce an infinite sequence of digits 0–9 that doesnot occur here!

And this is where the name “diagonalization” comes from. It is easy to producesuch a sequence — it need only differ from each of the sequences above at onedigit, right?

We produce this new sequence by taking each of the digits along the diagonaland altering it! Thus, the new sequence will differ from nth sequence in theenumeration at the nth digit...

d0,0, d0,1, d0,2, d0,3, d0,4, d0,5 d0,6, d0,7, . . .d1,0, d1,1, d1,2, d1,3, d1,4, d1,5, d1,6, d1,7, . . .d2,0, d2,1, d2,2, d2,3, d2,4, d2,5, d2,6, d2,7, . . .d3,0, d3,1, d3,2, d3,3, d3,4, d3,5, d3,6, d3,7, . . .d4,0, d4,1, d4,2, d4,3, d4,4, d4,5, d4,6, d4,7, . . .d5,0, d5,1, d5,2, d5,3, d5,4, d5,5, d5,6, d5,7, . . .d6,0, d6,1, d6,2, d6,3, d6,4, d6,5, d6,6, d6,7, . . .d7,0, d7,1, d7,2, d7,3, d7,4, d7,5, d7,6, d7,7, . . ....

......

......

......

.... . .

For all n ∈ N, dn =

{

1 , if dn,n > 12 , otherwise

It is easy to see that every one of the included sequences

dn,0, dn,1, dn,2, . . . , dn,n−1, dn,n, dn,n+1, . . .

is different from the defined sequence

d0, d1, d2, . . . , dn−1, dn, dn+1, . . .

Just notice that dn,n 6= dn, for all n ∈ N.

It is a little harder to see that every one of the included sequences represents adifferent real number than that represented by the defined sequence.

(The problem: .099 . . . = .1000 . . .)

The key: we don’t replace 0 with 9 or replace 9 with 0.

OK, that’s the basic idea of diagonalization, but it seems to apply only to theproblem of showing that a set is uncountably infinite. (By showing that the setis not enumerable.)

We can simplify things, now that we have seen the idea, and in doing so makethe method more generally applicable. . .

Simplifying the prior argument

Notice: A countably infinite sequence of elements from a set S can beunderstood as a function from N to S .

So, for all n ∈ N, let fn be an arbitrary function from N to {0, . . . , 9}.

Now, each of these countably many, arbitrarily chosen functions fn represents acountable sequence of digits 0 through 9.

We will show that at least one function from N to {0, . . . , 9} is not among

f0, f1 . . . .

Take f : N → {0, . . . , 9} s.t. for all n ∈ N,

f (n) =

{

1 , if fn(n) 6= 10 , otherwise

Then, for all n ∈ N,f 6= fn

sincef (n) 6= fn(n) .

Further simplifying the prior argumentNotice that in the prior argument, we represent each countably infinitesequence of digits as a function from N, but we did not do the same for thearbitrary countably infinite sequence

f0, f1 . . .

of such functions. Let’s do so this time. . .

Take an arbitrary function

g : N → (N → {0, . . . , 9}) .

(So g maps each natural number n to a function from N to {0, . . . , 9}. Thatis, g represents an arbitrary countably infinite sequence of countably infinitesequences of digits 0 through 9.)

To show that g is not surjective, take f : N → {0, . . . , 9} s.t. for all n ∈ N,

f (n) =

{

1 , if g(n)(n) 6= 10 , otherwise

Notice that for all n ∈ N, g(n)(n) 6= f (n), and so g(n) 6= f .

Since g was an arbitrary function from N to N → {0, . . . , 9}, we can concludethat no function of this type is surjective, and so there is no bijection from N

to N → {0, . . . , 9}. That is, the sets are not the same size.

Example: no surjection from N to power(N)Let’s use this approach to show there is no surjection from N to power(N). . .

Take an arbitrary function g : N → power(N).

We want to use diagonalization to show that g is not surjective. So what is theidea? We will use g to construct an element of power(N) that does not belongto range(g).

We need a set D of natural numbers s.t. for all n ∈ N,

D 6= g(n) .

That is, for each n ∈ N, there must be some m ∈ N s.t.

m ∈ D iff m /∈ g(n) .

That may seem hard, but it turns out not to be.

Take D s.t. for all n ∈ N,

n ∈ D iff n /∈ g(n) .

That is,D = { n | n ∈ N, n /∈ g(n) } .

Notice that, for all n ∈ N, g(n) 6= D . (Do you see why?)

No surjection from A to power(A) !The prior example still involved showing uncountability. But by talking aboutsurjections instead of enumerations, we have shown how to generalize thediagonalization method.

For example, essentially the same argument as before can show thatno set is the same size as its powerset!

We’ll show there is no surjection from A to power(A). (So there is nobijection, so they are not the same size.)

Take an arbitrary g : A → power(A). (What is our goal?)

We want a subset D of A s.t. for all x ∈ A,

D 6= g(x) .

TakeD = { x | x ∈ A, x /∈ g(x) } .

Notice that, for all x ∈ A, g(x) 6= D . (Do you see why?)

Claim: This result implies that there are infinitely many sizes of infinite sets.(How does it imply this?)

Not everything is computableHere’s the idea. . . Let’s consider algorithms, or programs, that take as input abinary string and return a binary string as output. So each algorithm“encodes” a function from {0, 1}∗ to {0, 1}∗.

The problem? There are too many such functions.

Every algorithm, or program, can be represented as a binary string.(Or it can be represented as a string over some alphabet, and then translatedto binary, right?)

But {0, 1}∗ is countable, whereas the set of functions from {0, 1}∗ to {0, 1}∗ isnot countable.

Idea: Let F be the set of functions from {0, 1}∗ to {0, 1}∗. Show there is nosurjection from N to F . To do this, take an arbitrary g : N → F , and constructa “diagonal” function f : {0, 1}∗ → {0, 1}∗, so that f /∈ range(g). That is,construct f so that, for all n ∈ N, g(n) 6= f . That is, construct f so that, forall n ∈ N, there is an x ∈ {0, 1}∗ s.t. g(n)(x) 6= f (x). Here’s a way to do it:Let s be a bijection from N to {0, 1}∗. (Such an s exists, since {0, 1}∗ iscountably infinite.) For all n ∈ N, let

f (s(n)) =

{

Λ , if g(n)(s(n)) 6= Λ0 , otherwise.


Recommended