# SP18:Lecture 8 Cardinality

We proved some of the claims about inverses from the last lecture, and defined set cardinality relationships in terms of 'jectivity.

- Reading: MCS 4.5, 8.1
- Last semester's notes
- File:Lec08-board.pdf

## Contents

# Inverses and 'jectivity

At the end of the last lecture, we made several claims about the relationship between inverses and 'jectivity:

- injections have left inverses, and functions with left inverses are injective
- surjections have right inverses, and functions with right inverses are surjective
- bijections have two-sided inverses, and functions with two-sided inverses are bijective

In this lecture we prove one direction of these claims; the other directions are left for homework.

## Function equality

Recall that the definition of left inverse states that two functions are equal:

Therefore, in order to prove that functions are left inverses of each other, we must have a definition of function equality:

**Equality (functions)**

## Proof outlines

We now proof that injections have left inverses and surjections have right inverses. The idea behind these proofs is that we do the best we can to construct an inverse.

## Injections have left inverses

We want to construct an inverse for ; obviously such a function must map to 1 and to 2. We must also define (so that is a function, i.e. total). So we'll just arbitrarily choose a value to map it to (say, 2).

Then we plug left inverse and we see that and , so that is indeed a left inverse.

into the definition ofNote that this wouldn't work if injective. For example,

was notthen the ambiguous and thus not a function. If we chose one of the two (say ), then would give the wrong answer on the other ( would be , not ).

we constructed would need to map to both and ; if we did both then would beHere is the general proof:

Choose an arbitrary , , and an injection . We want to show that there exists a left inverse of .

Let element of (we know that such an element exists because ).

be anLet be given by

well defined, because if and then (since is injective). Thus the output of is unambiguous.

isTo see that left inverse of , choose an arbitrary ; we have

is a

so

, which is the definition of a left inverse.## Surjections have right inverses

To demonstrate the proof, we start with an example.

We want to construct an inverse for ; obviously such a function must map to a, but we have a choice of where to map . We can't map it to both and (because then would be ambiguous), but we can just pick one of them (say ).

Then we plug right inverse and we see that and , so that is indeed a right inverse.

into the definition ofNote that this wouldn't work if surjective, (for example, if had no pre-image) we wouldn't have any output for (so that wouldn't be total).

was notHere is the general proof:

Define on input as follows: we know that there exists at least one with , since is surjective. Choose one of them and call it .

Note: it is not clear that there is an unambiguous way to do this; the assumption that it is possible is called the axiom of choice.

Now, we must check that is a right inverse of , i.e. that .

Choose an arbitrary . We have by definition of . Therefore

as required.# Cardinality definitions

You may have noticed that in our examples of injections , there are always at least as many elements in as there are in . Similarly, surjections always map to smaller sets, and bijections map to sets of the same size.

This insight lets us use functions to compare the sizes of sets in a way that applies to infinite sets as well as finite sets. We give some definitions here.

The cardinality of a set (written ) is the size of the set. However, for the time being, we will not use this definition by itself. Doing so will encourage you to write proofs about cardinality that don't apply to infinite sets.

Instead, we will only define relationships between the cardinalities of sets; these definitions come from the intuitive relationship between sizes and 'jectivity described above.

**≤**

**≥**

**Equality (cardinality)**

## Cardinality properties

Note that it is dangerous to redefine symbols like ≤ and ≥! People expect that these relations work the same way they do for numbers, but it is not a-priori obvious that they do. For example, you might expect that

- |A| ≤ |A|
- if |A| ≤ |B| and |B| ≤ |C| then |A| ≤ |C|
- if |A| ≤ |B| then |B| ≥ |A|
- if |A| ≤ |B| and |A| ≥ |B| then |A| = |B|
- if A ⊆ B then |A| ≤ |B|

Luckily, these are all true (most will be proved on the homework), but it's
important to note that they need to be proved!

The last of these claims is called the Cantor-Schroeder-Bernstein theorem; the proof is much more difficult than the others.