This commit is contained in:
2025-11-17 14:25:48 +01:00
commit 08b29bb79c
13 changed files with 1390 additions and 0 deletions

60
1.org Normal file
View File

@ -0,0 +1,60 @@
#+title: Assignment 1
#+options: toc:nil
#+latex_header: \usepackage{parskip}
In order to pass this assignment you have to get at least two points.
(Exercises marked with [BN] are based on exercises from a previous version of this course, given by Bengt Nordström.)
* (1 point)
State and give a brief explanation of the Church-Turing thesis.
** Answer
The Church-Turing thesis states that "effective" computation can be carried out by several methods.
In this case, effective means a set of structured finite instructions, that requires no knowledge except for the instructions themselves.
Further, given that the instructions, given that no error occurs, then the result should be completed in finite time.
* (1 point)
Give an example of a function on the natural numbers (from $\mathbb{N}$ to $\mathbb{N}$) that is:
- Injective but not surjective.
- Bijective.
** Answer
$\lambda x. x + 1$ is injective and not surjective. This comes from that each natural number has a successor (injective), but $0$ is not the image of any value (not surjective).
$\lambda x. x$ is bijective, which is trivial, since each input is their own image.
* (1 point)
Is $\mathbb{N} \times \text{Bool}$ countable? Provide a proof. (Bool is a set with two elements, true and false.)
** Answer
$\mathbb{N} \times \text{Bool}$ is countable.
One way to prove this is by isomorphism between $\mathbb{N} \times \text{Bool}$ and $\mathbb{N} + \mathbb{N}$.
To show this isomorphism, we need two functions $f \in \mathbb{N} \times \text{Bool} \rightarrow \mathbb{N} + \mathbb{N}$ and $g \in \mathbb{N} + \mathbb{N} \rightarrow \mathbb{N} \times \text{Bool}$, such that $f \circ g = \text{Id}_{\mathbb{N} + \mathbb{N}}$ and that $g \circ f = \text{Id}_{\mathbb{N} \times \text{Bool}}$.
So, let $f = \lambda (n,b).\ \text{if}\ b\ \text{then}\ \text{Inr}\ n\ \text{else}\ \text{Inl}\ n$ and $g = \lambda (x).\ \text{case}\ x\ \text{of}\ \text{Inl}\ n \rightarrow (n,\text{False});\ \text{Inr}\ n \rightarrow (n,True)$
Now, these are trivially isomorphic, and thus will not be shown.
Since this these functions are isomorphic, they are also injective, which means that if $\mathbb{N} + \mathbb{N}$ is countable, then $\mathbb{N} \times \text{Bool}$ will also be so.
In the literature for this week (namely Enumerable sets and Hilbert's hotel), it is shown that $\mathbb{N} + \mathbb{N}$ is countable, and therefore $\mathbb{N} \times \text{Bool}$.
*** Alternative solution
This can be answered by creating a function $f \in \mathbb{N} \times \text{Bool} \rightarrow \mathbb{N}$ that is injective.
I define it as $f = \lambda (x,b). if b then 2 \cdot x + 1 else 2 \cdot x$.
To show that it is injective, let's do a proof by contradiction.
Assume that $(n_1, b_1) \ne (n_2, b_2)$ and $f (n_1, b_1) = f (n_2, b_2) = c$.
If $c$ is odd, then $b_1$ and $b_2$ have be $\text{True}$, further, then $n_1$ and $n_2$ have to $\frac{c - 1}{2}$, thus creating a contradiction.
If $c$ is even, then $b_1$ and $b_2$ have be $\text{False}$, further, then $n_1$ and $n_2$ have to $\frac{c}{2}$, thus creating a contradiction.
In both cases a contradiction is raised, meaning that the function is injective, and thus $\mathbb{N} \times \text{Bool}$ is countable.
* (1 Point) [BN]
Is $\mathbb{N} \rightarrow \text{Bool}$ countable? Provide a proof.
** Answer
No.
Assume that it is countable.
Then one could enumerate them as $f_0, f_1, \dots$.
Then lets create a function $d = \lambda i. \neg (f_i i)$.
Assume that $d$ is in the set of functions, that is to say that $d = f_k$ for some k.
If that was the case, then $d\ k = \neg (f_k\ k) = \neg (d\ k)$ which is a contradition.
Thus $d$ cannot be in the set of functions, which in of it self creates a contradiction that it is enumerable.