Lecture from: 23.10.2024 | Video: Videos ETHZ

Functions and Relations

Injective (One-to-one): A function f is injective if every element in its codomain is mapped to by at most one element in its domain. Formally, or it’s contrapositive .

Surjective (Onto): A function f is surjective if every element in its codomain is mapped to by at least one element in its domain. Formally, for every in the codomain, there exists an in the domain such that .

Bijective (One-to-one and onto): A function f is bijective if it is both injective and surjective. A bijection establishes a one-to-one correspondence between the elements of its domain and codomain.

Composition of Injective Functions

If f and g are injective functions, then their composition is also injective.

Proof (Lecture)

To show that is injective, we start with two distinct elements, and , from the domain of (and hence, the domain of ).

  1. f is injective: Since is injective, we know that if , then .
  2. g is injective: Because g is injective, if , then .
  3. Composition: By the definition of function composition, and .
  4. Putting it Together: Combining these steps, we conclude that if , then . This is the definition of injectivity for the composition, so is injective.

Proof (Contrapositive)

To show that is injective, we’ll prove the contrapositive statement: if , then . This is equivalent to showing that if , then .

  1. Assume Inequality: Let for some .
  2. f Injective: Since f is injective, implies .
  3. g Injective: Since g is injective, implies .
  4. Composition: By definition of composition, and .
  5. Conclusion: Combining these steps, we have shown that if , then . This proves the contrapositive statement, so is injective.

Composition of Surjective Functions

If f and g are surjective functions, then their composition is also surjective.

Proof (Contrapositive)

To prove the contrapositive, we’ll show that if is not surjective, then either f or g is not surjective.

  1. Assume Not Surjective: Suppose is not surjective. This means there exists an element in the codomain of (which is the codomain of g) that is not mapped to by any element in the domain of (which is the domain of f).
  2. No Preimage: There is no in the domain of such that . This means there is no a such that .
  3. g Not Surjective or f Not Surjective:
    • If g is not surjective: Then there is no element in the domain of g such that . Since f maps to the domain of g, there cannot be an a in the domain of f such that that would lead to . So, in this case, g is not surjective.
    • If g is surjective: Since g is surjective, there exists some b in the domain of g such that . But because there’s no a in the domain of f such that , this means there’s no a such that . So, in this case, f is not surjective.
  4. Conclusion: We’ve shown that if is not surjective, then either g or f must not be surjective. This proves the contrapositive, so the composition of two surjective functions is surjective.

Composition of Bijective Functions

If f and g are bijective functions, then their composition is also bijective.

Proof: We can prove this directly using the previous lemmas for injective and surjective compositions.

  1. Injective: Since f and g are bijective (and hence injective), we know from the previous lemma that is also injective.
  2. Surjective: Since f and g are bijective (and hence surjective), we know from the previous lemma that is also surjective.
  3. Conclusion: Because is both injective and surjective, it is bijective.

Cardinality: Comparing the Sizes of Sets

This section introduces the concept of cardinality, which allows us to compare the sizes of sets even if they contain infinitely many elements.

Definitions

  1. Equal Cardinality: Two sets, A and B, have equal cardinality, denoted by , if there exists a bijection between them. A bijection is a function that is both injective (one-to-one) and surjective (onto). This implies that there is a perfect pairing of elements between the two sets.

  2. Preorder (Less Than or Equal to in Cardinality): Set A has cardinality less than or equal to set B, denoted by , if there exists an injection from A to B. An injection is a one-to-one function, meaning each element in A is mapped to a unique element in B. This implies that B has at least as many elements as A.

  3. Strict Smaller: We say that A has strictly smaller cardinality than B, denoted by , if and . In other words, there’s an injection from A to B, but there’s no bijection.

Properties of Cardinality Relations (Lemma 3.15)

This lemma establishes key properties of the cardinality relations we’ve defined: equal cardinality () and preorder ().

  1. Equal Cardinality is an Equivalence Relation:
    • Reflexive: A set A is trivially equivalent to itself () because the identity function on A is a bijection. The identity function maps each element of A to itself, establishing a one-to-one correspondence.
    • Symmetric: If , then there exists a bijection f from A to B. Since f is a bijection, its inverse, denoted by , is also a bijection. The inverse function maps each element in B back to its unique preimage in A. Therefore, .
    • Transitive: If and , then there exist bijections and . The composition is also a bijection (as we proved earlier). Therefore, .
  2. Preorder is Transitive:
    • Proof: If and , then there exist injections and . The composition is an injection (as we proved earlier). Therefore, .
  3. Subset Implies Preorder: If , then .
    • Proof: The identity function restricted to A, denoted by , is an injection. Since , we can consider as a function from A to B, and it remains an injection. Therefore, .
  • Equal Cardinality () is an equivalence relation, which means it partitions sets into equivalence classes where sets within the same class have the same cardinality.
  • Preorder () is a transitive relation, meaning if A has cardinality less than or equal to B and B has cardinality less than or equal to C, then A has cardinality less than or equal to C.
  • Subset Implication: If A is a subset of B, then A has cardinality less than or equal to B.

Cardinal Preorder Both Ways Implies Equivalence (Theorem)

If and , then .

This theorem, known as the Cantor-Bernstein-Schroeder Theorem, is a fundamental result in set theory. It states that if there are injections from A to B and from B to A, then there must also be a bijection between A and B. This implies that the two sets have the same cardinality.

The proof of this theorem is non-trivial and involves constructing a bijection from a series of injections. However, the theorem itself provides a powerful tool for comparing the sizes of sets.

Countability (Theorem 3.17)

A set A is countable if and only if A is finite or A has the same cardinality as the natural numbers ().

Proof:

  • (): If A is finite or , then A is countable by definition. In the finite case, the identity function on A suffices. In the infinite case, the bijection between A and provides the required mapping.
  • (): If A is countable and infinite, there exists a surjection from to A. Using the well-ordering principle (explained below), we can construct an injection from A to . Since we have a surjection from to A and an injection from A to , by the Cantor-Bernstein-Schroeder theorem, we have .

The Well-Ordering Principle

The well-ordering principle states that every non-empty subset of the natural numbers has a least element. This principle is crucial for proving the countability theorem and other results.

Hilberts Hotel:

Examples of Countable Sets

Example 1: Finite Bitstrings

The set of all finite bitstrings, denoted , is countable.

Proof:

Although each bitstring corresponds to a natural number via binary representation, this doesn’t directly establish countability because different bitstrings can represent the same number (e.g., “010” and “0010” both represent 2).

To address this issue, we construct an injection from to . Consider the function , which prepends a ‘1’ to the bitstring a before converting it to a decimal number. This ensures that each bitstring maps to a unique natural number. Since we have an injection from to , and is well-ordered, we can construct a bijection using the well-ordering principle, establishing that .

Example 2:

The Cartesian product is countable. We can demonstrate this using bitstrings.

Proof:

We aim to show . A naive concatenation of bitstrings, like , is insufficient because it is not unique and therefore not injective. A computer science perspective on this is whether the resulting bitstring can be uniquely parsed back into its original components. Simple concatenation lacks this property.

Instead, we can use a different encoding: where is the length of bitstring a. This encoding is injective, meaning each pair of bitstrings maps to a unique single bitstring. Since finite bitstrings are countable, this establishes that .

Theorems on Countability

Cartesian Product of Countable Sets (Corollary 3.20)

The Cartesian product of two countable sets and is countable, i.e., .

Proof:

We first prove by exhibiting an injection , namely . That is an injection can be proved as follows:

The first implication follows from the definition of pairs, the second implication from the fact that and are injections, and the last implication from the definition of pairs again.

Using (just proved) and now gives because is transitive.

Countability of Cartesian Products and Finite Sequences (Theorem 3.22)

This section explores the countability of sets constructed from countable sets using Cartesian products and the (Kleene) star operation.

Let and , for , be countable sets. The following holds:

(i) Finite Cartesian Powers: For any , the set (the set of all -tuples of elements from ) is countable. (ii) Countable Union of Countable Sets: The union of a countable list of countable sets is countable. (iii) Kleene Star: The set (the set of all finite sequences of elements from ) is countable.

Proof of (i) - Finite Cartesian Powers

Proof (by induction on n):

  • Base Case (n = 1): , which is countable by assumption.
  • Inductive Hypothesis: Assume is countable for some .
  • Inductive Step: We need to show that is countable. We know . Since and are countable (by the inductive hypothesis and the initial assumption, respectively), their Cartesian product is countable by Corollary 3.20.
  • Conclusion: By induction, is countable for all finite .

Proof of (ii) - Countable Union of Countable Sets (not part of script)

I suggest you look at proof of (iii) since that automatically shows how you’d prove (ii) elegantly. Otherwise check out the proof below.

Proof:

Since each is countable, there exists a surjection . Let’s construct a function as follows:

This means that the -th element of maps to the -th element of . This mapping is surjective because for any element , there is some for which , and because is a surjection, there exists some for which . Therefore, .

Since is countable, there exists a bijection . Composing with , we get a surjection . Therefore, is countable by Theorem 3.17.

Proof of (iii) - Kleene Star

Proof:

  1. Injection from to Bitstrings: Since is countable (), there exists an injection from to . Because finite bitstrings () are countable and in bijection with the natural numbers, we can represent each element of as a unique finite bitstring via a suitable injection .

  2. Injection from to Bitstrings: We now construct an injection . Given a finite sequence , we encode it as a bitstring using the injection f from step 1 and a cleverly chosen separator: where each is the unique bitstring representation of (e.g. and , and “11” serves as a delimiter between elements of the sequence.

  3. Uniqueness of Decoding: This encoding is injective. Given the encoded bitstring, we can uniquely decompose it back to the original sequence because the delimiter “11” allows us to distinguish where one element ends and the next begins. The individual are unique from the first injection, and since we can parse the overall sequence we can uniquely reconstruct it.

  4. Countability: Since we have an injection from to and is countable, we conclude that , which means is countable.

Example: Let . Suppose we have the injection defined as , , and . Then the sequence would be encoded as the bitstring .

Theorem 3.22 demonstrates that countability is preserved under finite Cartesian products and the Kleene star operation. This allows us to reason about the countability of complex structures built from countable sets.

The Uncountability of Infinite Binary Sequences (Cantor’s Diagonalization Argument)

Theorem: The set of all infinite binary sequences, denoted as , is uncountable.

Proof

This proof employs proof by contradiction. We begin by assuming that the set of all infinite binary sequences is countable. This assumption will lead to a logical contradiction, proving that our initial assumption must be false.

1. Assume Countability: Assume that there exists a bijection . A bijection means that each natural number n maps to a unique infinite binary sequence, and conversely, each infinite binary sequence is mapped to by a unique natural number.

2. Representation: We can represent each infinite binary sequence as an infinite list of bits: where is the -th bit in the -th sequence. For convenience, we begin numbering the bits starting from .

3. Construct a New Sequence: Let denote the complement of a bit (if , then , and if , then ). Now, define a new infinite binary sequence as follows: 4. Contradiction:

  • Existence: Clearly, is an infinite binary sequence and therefore belongs to the set .
  • Uniqueness: However, there cannot exist any natural number such that . This is because is constructed to differ from in at least one bit (actually the -th bit) for every natural number .

5. Conclusion:

The existence of , which does not correspond to any natural number under the supposed bijection f, contradicts our initial assumption that f is a bijection. This contradiction forces us to reject our initial assumption that the set of infinite binary sequences is countable. Therefore, must be uncountable.

Relationship to Programs and Functions

This result has profound implications for the relationship between computer programs and mathematical functions.

  • Finite Programs: Computer programs are fundamentally finite sequences of instructions. They can be represented as finite strings of symbols (like bitstrings). Therefore, the set of all possible computer programs is countable (similar to the set of finite bitstrings ).

  • Infinite Functions: The set of all possible functions, even just from to , is uncountable (as shown by the diagonalization argument above). This is because the space of infinite sequences is a representation of all such functions. For example, consider the function that maps each natural number n to its -th bit in the binary representation of the number . This is a function from to , and there is no way to represent it with a finite program.

  • Uncomputable Functions: Since the set of all possible functions is uncountable, but the set of all possible computer programs is countable, there must exist functions that cannot be computed by any finite program. These functions are known as uncomputable functions.

Example: The Halting Problem is a classic example of an uncomputable function. The Halting Problem asks if, given a program P and its input I, whether the program P will eventually halt when run with input I. It has been proven that no finite computer program can solve the Halting Problem for all possible programs and inputs.

Uncountability of Real Numbers

The same diagonalization technique can be used to show that the interval (and hence the set of real numbers itself (see [[10 Posets, Hasse Diagrams, Lexicographical Ordering, Special Elements, Functions, Countability, Infinities#example-01-sim-mathbbr|Example ]])) is uncountable. This is achieved by interpreting the elements of as the binary expansion of a real number in the interval . This establishes a one-to-one correspondence between infinite binary sequences and real numbers in . Since the set of infinite binary sequences is uncountable, the interval must also be uncountable.

Key Takeaway

The uncountability of infinite bitstrings (and by extension, the set of all functions) highlights the fundamental limitations of finite computational systems. It demonstrates that there are inherently uncomputable functions, meaning there are mathematical problems that cannot be solved by any finite program.

Continue here: 12 Cardinality, Number Theory, Rings, Euclidian Rings, Ideal, Congruence, Modular Arithmetic, Diophantine Equations