\input{decls.tex} \title{Sets} \begin{document} \maketitle Set comprehensions can be written $\{ x | x \in \N \}$ or $\{ x : x \in \N \}$ - '$:$' or '$|$' \\ Sets are defined entirely by the values of $x$ for which $x \in A$ \begin{description} \item[Axiom of Extensionality / Set Equality] $A = B \iff \forall x. (x \in A \iff x \in B)$ \item[$A \subseteq B$] \quad $\forall x \in A. x \in B$ \\ Is transitive, reflexive, antisymmetric \item[$A \subset B$] \quad $(\forall x \in A.~x \in B) \land (\exists x \in B.~x \not\in A)$ \\ Is transitive, antisymmetric \item[$\varnothing$] $\{\}$ \item[$\cup$] Union \item[$\cap$] Intersection \item[$A \setminus B$] \quad $\{ x \in A : x \not\in B \}$ \item[$A^\complement$]\quad $U \setminus A$ \item[$[a, b)$] \quad $\{ x \in \R : a \leq x < b \}$ \end{description} \begin{align*} C \setminus (A \cup B) \equiv & ~ (C \setminus A) \cap (C \setminus B) \\ C \setminus (A \cap B) \equiv & ~ (C \setminus A) \cup (C \setminus B) \\ (A^\complement)^\complement \equiv & ~ A \\ A^\complement \cup B^\complement \equiv & ~ (A \cap B)^\complement \\ A^\complement \cap B^\complement \equiv & ~ (A \cup B)^\complement \end{align*} \section*{Families of Sets} A family of sets indexed by a set $I$ (the indexing set): $A_i ~~\forall~i\in I (\equiv (A_i)_{i\in I})$ \\ $A_i$ is a set for every element $i \in I$ \\ A family of sets indexed by $\N$ is called a sequence of sets. Also written $(B_i)^{\inf}_{i=0}$ or $(B_i)_{i \geq 0}$ \begin{align*} \bigcup_{i \in I}~A_i \equiv \{x | \exists i \in I. x \in A_i \} \\ \bigcap_{i \in I}~A_i \equiv \{x | \forall i \in I. x \in A_i \} & \text{ Exists iff } \exists~i\in I \end{align*} \begin{align*} & \forall i \in I. A_i \subseteq \cup_{j \in I}A_j \\ & \forall i \in I. A_i \subseteq B \implies \cup_{j \in I}A_j \subseteq B \\ & \forall i \in I.\cap_{j \in I}A_j \subseteq A_i \\ & \forall i \in I. B \subseteq A_i \implies B \subseteq \cap_{j \in I}A_j \\ \\ & B \cup \cap_{i \in I}A_i = \cup_{i \in I}(B \cap A_i) \\ & B \cap \cup_{i \in I}A_i = \cap_{i \in I}(B \cup A_i) \\ & B \setminus \cup_{i \in I}A_i = \cap_{i\in I}(B\setminus A_i) \\ & B \setminus \cap_{i \in I}A_i = \cup_{i\in I}(B \setminus A_i) \end{align*} \section*{Cartesian Products} Ordered pairs can be represented as $(x, y) \equiv \{x, \{x, y\}\}$ \\ $X \times Y = \{ (x, y) |~ \forall x, y.~x \in X \land y \in Y\}$ for sets $X$, $Y$ \\ $X^n$ is $X\times X^{n-1}$ for set $X$ and natural $n$ \\ $\card{X\times Y} = \card{X} \times \card{Y}$ (for finite $X$, $Y$) \section*{Functions} For sets $X$, $Y$: \begin{description} \item[A function $F: X \to Y$] $\subseteq X\times Y$ \text { where } \\ $\forall x \in X.~\exists \text{ a unique } F(x) \in Y.~ (x, F(x)) \in F$ \\ There exist $\card{Y}^{\card{X}}$ functions $F: X \to Y$ \item[$\operatorname{dom}(F)$] The domain of $F$, i.e. $X$ \item[$\operatorname{incl}^X_A : A \to X$] $= a \quad \forall A,X. \text{ where } A \subseteq X$ \item[Constant function] $\exists y_0 \in Y.~\forall x \in X.~ f(x) = y_0$ \item[Characteristic Function of a set $A \subseteq X$: $\chi_A: X \to \{0, 1\}$] \[ \chi_A: X \to \{0, 1\} = \left\{\begin{array}{lr} 0 & \text{ if } x \not\in A \\ 1 & \text{ if } x \in A \end{array} \right. \] \item[Restriction of a function $f: X \to Y$] $\restr{f}{A}$ is $f$ specialized contravariantly to $A \subseteq X$ \item[$f(A)$: Image of $A$ under $f$] $f$ mapped over $A$ \quad for function $f: X \to Y$, $A \subseteq X$ \item[$\operatorname{ran}(f)$ / image of $f$ / range of $f$] $\{ f(x) | x \in X \}$, $f(X)$, i.e. all possible values of $f(x)$ \item[Preimage of $B$ under $f$] $\{ x \in X ~|~ f(x) \in B \}$ \\ written $f^{-1}(B)$, but is \emph{not} the inverse of f \end{description} For $f: X \to Y$, $A \subseteq A' \subseteq X$, $B \subseteq B' \subseteq Y$: \begin{align*} f(A) \subseteq~ & f(A') \\ f^{-1}(B) \subseteq ~ & f^{-1}(B') \\ f^{-1}(f(A)) \supseteq ~ & A \\ f(f^{-1}(B)) \subseteq ~ & B \end{align*} For set families $(A_i \subseteq X)_{i \in I}, (B_j \subseteq Y)_{j \in J}$: \begin{align*} f(\cup_{i \in I} A_i) = ~ & \cup_{i \in I}f(A_i) \\ f(\cap_{i \in I} A_i) \subseteq ~ & \cap_{i \in I}f(A_i) \\ f^{-1}(\cup_{j \in J} B_j) = ~ & \cup_{j \in J} f^{-1}(B_j) \\ f^{-1}(\cap_{j \in J} B_j) = ~ & \cap_{j \in J} f^{-1}(B_j) \end{align*} \section*{Function Composition} For functions $f: X \to Y$, $g: Y \to Z$: \begin{align*} & (g \circ f): X \to Z \\ & (g\circ f)(x) = g(f(x)) & \forall x \in X \\ \\ \end{align*} \section*{Surjection and Injection} For $f: X \to Y$, $f$ is \begin{description} \item[surjective] iff $f(X) = Y$, i.e. $\forall y \in Y.~ \exists x \in X.~ f(x) = y$ \\ Range is codomain, 'onto' \item[injective] iff $\forall x, x' \in X. ~ f(x) = f(x') \implies x = x'$ \item[bijective] iff $f$ is injective and $f$ is surjective \\ one-to-one \end{description} Given $f: X \to Y$, $g: Y \to Z$: \\ \quad If f and g are injective, so is $g\circ f$ \\ \quad If f and g are surjective, so is $g \circ f$ \\ \quad If $g \circ f$ is injective, so is $f$ \\ \quad If $g \circ f$ is surjective, so is $g$ \section*{Inverse Functions} The inverse function $f^{-1}$ of $f: X \to Y$ exists iff $f$ is bijective, and is defined by \[f^{-1}(y) = x \text{ where } \exists! x \in X. f(x) = y \qquad \forall y \in Y\] \begin{align*} (f \circ f^{-1}) = \operatorname{Id} \\ (f^{-1} \circ f) = \operatorname{Id} \end{align*} \section*{Power Sets} Powerset of S: $\powerset{S}$ has $2^{\card{S}}$ elements is the set of all subsets of $S$ \\ $Fun(X, \{0, 1\})$ is the set of functions $X \to \{0, 1\}$ \\ $\Phi: Fun(X, \{0, 1\}) \to \powerset{X}$ \\ $\Phi(f) = \{ x \in X | f(x) = 1 \}$ \\ $\Phi$ is bijective. \section*{Binary Operators} A binary operator is $X^2 \to X$ \\ Union is $\powerset{X}^2 \to \powerset{X}$ \\ $\square$ is the unknown or indeterminate binop sigil \\ Unital: $\forall x \in X. \exists u \in X. u \square x = x \square u = x$ \section*{Construction of the Natural Numbers} \begin{align*} x^{+} & = x \cup \{x\} & \text{successor of $x$} \end{align*} A set $X$ is \emph{inductive} if $\varnothing \in X \land (a \in X \implies a^+ \in X)$ \\ Axiom: There exists an inductive set. \\ Definition: A natural number is a set that is an element of all inductive sets. \\ Theorem: There exists a set whose elements are the natural numbers. \\ \begin{align*} & \text{Given an inductive set $A$} \\ & \omega = \{ x \in A | x \text{ is a natural number}\} \\ & \text{any natural number is in $A$ (since $A$ is inductive), and therefore in $\omega$} \\ & \omega \text{ is the natural numbers} \end{align*} \\ Define: \begin{align*} 0 & = \varnothing \\ 1 & = 0^+ \\ 2 & = 1^+ \\ \ldots \end{align*} $\in$ is an ordering over $\omega$, as is $\subseteq$ \\ $\omega$ is an inductive set. Proof: \\ $\varnothing$ is a natural number. $x \in \omega$ implies $x^+ \in \omega$, as $x$ is natural and is therefore in every inductive set, and so $x^+$ is in every inductive set and is therefore a natural number. \subsection*{Principle of Induction} If $A \subseteq \omega$ and $A$ is inductive, $A = \omega$. Since $A$ is inductive, it contains every natural number, so $\omega \subseteq A$. \\ Since $A \subseteq \omega \land \omega \subseteq A$, $A = \omega$ \section*{Recursion on $\omega$} \subsection*{Principle of Recursion} For a set $X$, $x_0 \in X$, $h: X \to X$, there exists a unique function $f: \omega \to X$ where $f(0) = x_0$, $f(n^+) = h(f(n))$. \section*{Relations} Total order: $(X, \prec)$, requires $\forall x, y, z \in X$: \\ \begin{align*} & x \prec y \land y \prec z \implies x \prec z \\ & x = y \oplus x \prec y \oplus y \prec x & \text{ (where $\oplus$ denotes XOR) } \end{align*} Lexicographic order $x <_L y$ on $\N\times\N = x_0 < y_0 \lor (x_0 = y_0 \land x_1 < y_1)$ \\ For a non-empty subset $A$ of $X$ given a total order $(X, \prec)$, a minimum/least element $a_0 \in A$ exists where $\forall a \in A.~a_0 \preceq a$. \section*{Ordering on $\omega$} $(\omega, \in)$ and $(\omega, \subset)$ are both total orderings on $\omega$, such that $\varnothing$ is the minimum and $\forall x \in \omega.~x < x^+$ \section*{Strong Induction} Every non-empty subset of $\N$ has a minimum. \\ \\ Let $\phi(x)$ be a predicate over $\N$ where $\forall n\in \N.~ (\forall m \in \N.~ m < n \implies \phi(m)) \implies \phi(n)$. \\ Then $\phi(0)$ holds, as $\neg\exists n \in \N.~n<0$, $\phi(1)$ holds as $\phi(0)$ holds, etc. \begin{align*} & \neg\exists x \in \N.~\neg\phi(x) \\ & \text{Let } A \text{ be a subset of }N\text{ such that }\phi(n)\text{ is false }\forall n \in A \\ & \text{If not, $\exists a_0 \in A$} \\ & \forall n \in N.~n < a_0 \implies n \not\in A \implies \phi(n) \\ & \text{Then $\phi(n)$ holds $\forall n < a_0$, so $\phi(a_0)$, then $a_0 \not\in A$, which is a contradiction, so $A = \varnothing$} \end{align*} \section*{Fibonacci} Fibonacci Sequence: $F_n$ \\ Roots of $x^2 - x - 1$ are $\phi = \frac{1 + \sqrt{5}}{2}$ and $\psi = \frac{1 - \sqrt{5}}{2}$ \\ $F_n = \frac{\phi^{n+1} - \psi^{n+1}}{\sqrt{5}}$ \\ For $n=0$: $F_0 = 1 = \frac{\frac{1 + \sqrt{5}}{2} - \frac{1-\sqrt{5}}{2}} = \frac{2\sqrt{5}}{2} = 1$ \\ For $n=1$: \\ $F_1 = 1 = \frac{\paren{\frac{1 + \sqrt{5}}{2}}^2 - \paren{\frac{1 - \sqrt{5}}{2}}^2}{\sqrt{5}} = \frac{\phi + 1 - \psi - 1}{\sqrt{5}}$ \\ For $n\geq 2$: \begin{align*} & F_n = F_{n-1} + F_{n-2} = \frac{\phi^n - \psi^n}{\sqrt{5}} + \frac{\phi^{n-1} - \psi^{n-1}}{\sqrt{5}} \\ & = \frac{\phi^{n-1}\paren{\phi + 1} - \psi^{n-1}\paren{\psi + 1}}{\sqrt{5}} \\ & = \frac{\phi^{n-1}\phi^2 - \psi^{n-1}\psi^2}{\sqrt{5}} \\ & = \frac{\phi^{n+1} - \psi^{n+1}}{\sqrt{5}} & \text{as required} \end{align*} \subsection*{Zeckendorff's Theorem} Every natural number can be written as a sum of non-adjacent Fibonacci numbers in a unique way (excluding $F_0$). \\ A finite subset $I$ of $\N^+$ is \emph{Zeckendorff} if it contains no adjacent elements ($\forall x \in I.~x^+ \not\in I$) \\ Define $\mathcal{Z}$ as the set of all Zeckendorff sets, and $\sigma: \mathcal{Z} \to \N^+$ by $\sigma(I) = \sum_{i \in I}F_i$. The theorem claims $\sigma$ is bijective. \\ \\ For nonempty $I \in \mathcal{Z}$ with largest element $k$: \begin{align*} &\text{Let } J = I \setminus \{k\} \\ &\sigma(I) = F_k + \sigma(J) \geq F_k \\ &\text{If } J = \varnothing\text{, } \sigma(I) = F_k \leq F_{k + 1} \\ &\text{Otherwise, we must show } \sigma(I) < F_{k + 1} \\ &\equiv F_k + \sigma(J) < F_{k + 1} \\ &\equiv \sigma(J) < F_{k + 1} - F_k = F_{k-1} \\ &\text{But if $k' = \operatorname{max}(J)$, } \\ &\sigma(J) < F_{k' + 1} \land k' < k - 2 \text{ (since $I$ is \emph{Zeckendorff})} \\ & \sigma(J) < F_{k - 1} \text{ as required.} \end{align*} Proof of theorem: $\forall n \in N.~ \sigma$ is bijective. \begin{align*} n = 0: \quad& I = \varnothing \\ n > 0: \quad& \text{Let } F_k \leq n < F_{k + 1},~ m = n - F_k \\ & m = \sigma(J) \text{ for some } J \\ & \text{If } J = \varnothing, I = \{k\}. \\ & \text{Otherwise, } k' = \operatorname{max}(J). \\ & \text{If } k' \leq k - 2, I = J \cup \{k\} \\ \end{align*} \section*{Equivalence Relations} Reflexive, Symmetric, Transitive \\ Equivalence relations are usually called $\sim$ \\ In a set $X$, \[ [x] = \{ y \in X | x \sim y \} \] \[ [x] = [y] \equiv x \sim y \] Any two equivalence classes of $X$ are either disjoint or equal. \\ \subsection*{Quotient Sets} $X/\sim~ = \{[x] | x \in X \} \subset \powerset{X}$ \\ A complete set of representatives is a subset $A$ of $X$ where $\forall x \in X. \exists! a \in A. a \in [x].$ \\ I.E. a complete set of representatives contains exactly one element from each element of $X/\sim$ \\ $f: A \to X/\sim$ defined by $f(a) = [a]$ \\\\\\ A function $f: X \to Y$ is \emph{compatible} iff $x \sim y \implies f(x) = f(y)~\forall x, y \in X$ \\ For a \emph{compatible} function, $\Bar{f}: X/\sim~\to Y$ exists and is defined by $\Bar{f}([x]) = f(x)$ \section*{Integers modulo $k$} Fix some $k \in \N^+$ \\ Define $\sim$ on $\Z$ by $n \sim m \iff n - m$ is a multiple of $k$ \\ $\sim$ is an equivalence relation \\ $[0, k)\cap\N$ is a complete set of representatives for $\sim$ \\ $Z/k$ is the set of integers modulo $k$, $n \equiv m~(\operatorname{mod} k) \iff n \sim m$ \\ $+$ and $\times$ on $\Z/k$: \begin{align*} [n] + [m] = [n + m] \\ [n][m] = [nm] \end{align*} \end{document}