Source and provenance

These are all nine files in the frozen Relations source boundary, shown line by line and copied byte-for-byte for download. The packaged authority ledgers retain the exact line, column, offset, delimiter, expression binding, speech, meaning, and native MathML for all 515 formula occurrences.

content/sets-functions-relations/relations/equivalence-relations.tex

83 lines; SHA-256 0b2167d0a9633938fd173d396f9e92b795826821471ff111483f7c7088a4be46. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: equivalence-relations
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{eqv}
  7. \olsection{Equivalence Relations}
  8. The identity relation on a set is reflexive, symmetric, and
  9. transitive. Relations~$R$ that have all three of these properties are very
  10. common.
  11. \begin{defn}[Equivalence relation]
  12. A relation $R \subseteq A^2$ that is reflexive, symmetric, and
  13. transitive is called an \emph{equivalence relation}. !!^{element}s $x$
  14. and $y$ of~$A$ are said to be \emph{$R$-equivalent} if~$Rxy$.
  15. \end{defn}
  16. Equivalence relations give rise to the notion of an \emph{equivalence
  17. class}. An equivalence relation ``chunks up'' the domain into
  18. different partitions. Within each partition, all the objects are
  19. related to one another; and no objects from different partitions
  20. relate to one another. Sometimes, it's helpful just to talk about
  21. these partitions \emph{directly}. To that end, we introduce a
  22. definition:
  23. \begin{defn}\ollabel{def:equivalenceclass}
  24. Let $R \subseteq A^2$ be an equivalence relation. For each $x \in A$,
  25. the \emph{equivalence class} of $x$ in~$A$ is the set $\equivrep{x}{R}
  26. = \Setabs{y \in A}{Rxy}$. The \emph{quotient} of $A$ under~$R$ is
  27. $\equivclass{A}{R} = \Setabs{\equivrep{x}{R}}{x \in A}$, i.e., the set
  28. of these equivalence classes.
  29. \end{defn}
  30. The next result vindicates the definition of an equivalence class, in
  31. proving that the equivalence classes are indeed the partitions of~$A$:
  32. \begin{prop}
  33. If $R \subseteq A^2$ is an equivalence relation, then $Rxy$ iff
  34. $\equivrep{x}{R} = \equivrep{y}{R}$.
  35. \end{prop}
  36. \begin{proof}
  37. For the left-to-right direction, suppose $Rxy$, and let $z \in
  38. \equivrep{x}{R}$. By definition, then, $Rxz$. Since $R$ is an
  39. equivalence relation, $Ryz$. (Spelling this out: as $Rxy$ and~$R$ is
  40. symmetric we have $Ryx$, and as $Rxz$ and~$R$ is transitive we
  41. have~$Ryz$.) So $z \in \equivrep{y}{R}$. Generalising,
  42. $\equivrep{x}{R} \subseteq \equivrep{y}{R}$. But exactly similarly,
  43. $\equivrep{y}{R} \subseteq \equivrep{x}{R}$. So $\equivrep{x}{R} =
  44. \equivrep{y}{R}$, by extensionality.
  45. For the right-to-left direction, suppose $\equivrep{x}{R} =
  46. \equivrep{y}{R}$. Since $R$ is reflexive, $Ryy$, so $y \in
  47. \equivrep{y}{R}$. Thus also $y \in \equivrep{x}{R}$ by the assumption
  48. that $\equivrep{x}{R} = \equivrep{y}{R}$. So $Rxy$.
  49. \end{proof}
  50. \begin{ex}
  51. A nice example of equivalence relations comes from modular arithmetic.
  52. For any $a$, $b$, and $n \in \PosInt$, say that $a \equiv_n b$ iff
  53. dividing $a$ by~$n$ gives the same remainder as dividing $b$ by~$n$.
  54. (Somewhat more symbolically: $a \equiv_n b$ iff, for some $k \in
  55. \Int$, $a - b = kn$.) Now, $\equiv_n$ is an equivalence relation, for
  56. any~$n$. And there are exactly $n$ distinct equivalence classes
  57. generated by~$\equiv_n$; that is, $\equivclass{\Nat}{\equiv_n}$ has
  58. $n$ !!{element}s. These are: the set of numbers divisible by $n$
  59. without remainder, i.e., $\equivrep{0}{\equiv_n}$; the set of numbers
  60. divisible by $n$ with remainder~$1$, i.e., $\equivrep{1}{\equiv_n}$;
  61. \ldots; and the set of numbers divisible by~$n$ with remainder~$n-1$,
  62. i.e.,~$\equivrep{n-1}{\equiv_n}$.
  63. \end{ex}
  64. \begin{prob}
  65. Show that $\equiv_n$ is an equivalence relation, for any $n \in
  66. \PosInt$, and that $\equivclass{\Nat}{\equiv_n}$ has exactly $n$ members.
  67. \end{prob}
  68. \end{document}

content/sets-functions-relations/relations/graphs.tex

77 lines; SHA-256 a538018608ce97d0b371a392912c3d6825d8f3b17719bceca5744a77ace26351. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: graphs
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{grp}
  7. \olsection{Graphs}
  8. A \emph{graph} is a diagram in which points---called ``nodes'' or
  9. ``vertices'' (plural of ``vertex'')---are connected by edges. Graphs
  10. are a ubiquitous tool in discrete mathematics and in computer science.
  11. They are incredibly useful for representing, and visualizing,
  12. relationships and structures, from concrete things like networks of
  13. various kinds to abstract structures such as the possible outcomes of
  14. decisions. There are many different kinds of graphs in the literature
  15. which differ, e.g., according to whether the edges are directed or
  16. not, have labels or not, whether there can be edges from a node to the
  17. same node, multiple edges between the same nodes, etc. \emph{Directed
  18. graphs} have a special connection to relations.
  19. \begin{defn}[Directed graph]
  20. A \emph{directed graph} $G = \tuple{V, E}$ is a set of
  21. \emph{vertices}~$V$ and a set of \emph{edges}~$E \subseteq V^2$.
  22. \end{defn}
  23. \begin{explain}
  24. According to our definition, a graph just is a set together with a
  25. relation on that set. Of course, when talking about graphs, it's only
  26. natural to expect that they are graphically represented: we can draw a
  27. graph by connecting two vertices~$v_1$ and $v_2$ by an arrow iff
  28. $\tuple{v_1, v_2} \in E$. The only difference between a relation by
  29. itself and a graph is that a graph specifies the set of vertices,
  30. i.e., a graph may have isolated vertices. The important point,
  31. however, is that every relation~$R$ on a set~$X$ can be seen as a
  32. directed graph $\tuple{X, R}$, and conversely, a directed
  33. graph~$\tuple{V, E}$ can be seen as a relation $E \subseteq V^2$ with
  34. the set $V$ explicitly specified.
  35. \end{explain}
  36. \begin{ex}
  37. The graph $\tuple{V, E}$ with $V = \{1, 2, 3, 4\}$ and $E =
  38. \{\tuple{1,1}, \allowbreak \tuple{1, 2}, \allowbreak \tuple{1, 3},
  39. \allowbreak \tuple{2, 3}\}$ looks like this:
  40. \begin{align*}
  41. & \begin{tikzpicture}[->,node distance=2cm]
  42. \node[draw,circle] (A) {$1$};
  43. \node[draw,circle] (B) [right of=A] {$2$};
  44. \node[draw,circle] (C) [below of=B] {$3$};
  45. \node[draw,circle] (D) [right of=B] {$4$};
  46. \draw (A) to [loop above] (A);
  47. \draw (A) to (B);
  48. \draw (A) to (C);
  49. \draw (B) to (C);
  50. \end{tikzpicture}
  51. \intertext{This is a different graph than $\tuple{V', E}$ with $V' =
  52. \{1, 2, 3\}$, which looks like this:}
  53. & \begin{tikzpicture}[->,node distance=2cm]
  54. \node[draw,circle] (A) {$1$};
  55. \node[draw,circle] (B) [right of=A] {$2$};
  56. \node[draw,circle] (C) [below of=B] {$3$};
  57. \draw (A) to [loop above] (A);
  58. \draw (A) to (B);
  59. \draw (A) to (C);
  60. \draw (B) to (C);
  61. \end{tikzpicture}
  62. \end{align*}
  63. \end{ex}
  64. \begin{prob}
  65. Consider the less-than-or-equal-to relation~$\le$ on the set $\{1,
  66. 2, 3, 4\}$ as a graph and draw the corresponding diagram.
  67. \end{prob}
  68. \end{document}

content/sets-functions-relations/relations/operations.tex

71 lines; SHA-256 5e6f57e9ddf53e1624955adabd594ea3855ad787c1074ba12421b0025b432372. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: operations
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{ops}
  7. \olsection{Operations on Relations}
  8. It is often useful to modify or combine relations. In
  9. \olref[sfr][rel][ord]{prop:stricttopartial}, we considered the \emph{union}
  10. of relations, which is just the union of two relations considered as
  11. sets of pairs. Similarly, in \olref[sfr][rel][ord]{prop:partialtostrict},
  12. we considered the relative difference of relations. Here are some
  13. other operations we can perform on relations.
  14. \begin{defn}\ollabel{relationoperations}
  15. Let $R$, $S$ be relations, and $A$ be any set.
  16. The \emph{inverse} of $R$ is $R^{-1} = \Setabs{\tuple{y, x}}{\tuple{x,
  17. y} \in R}$.
  18. The \emph{relative product} of $R$ and $S$ is $(R \mid S) =
  19. \{\tuple{x, z} : \exists y(Rxy \land Syz)\}$.
  20. The \emph{restriction} of $R$ to $A$ is $\funrestrictionto{R}{A}= R
  21. \cap A^2$.
  22. The \emph{application} of $R$ to $A$ is $\funimage{R}{A} = \{y :
  23. (\exists x \in A)Rxy\}$
  24. \end{defn}
  25. \begin{ex}
  26. Let $S \subseteq \Int^2$ be the successor relation on~$\Int$, i.e.,
  27. $S = \Setabs{\tuple{x, y} \in \Int^2}{x + 1 = y}$, so that $Sxy$ iff $x + 1 = y$.
  28. $S^{-1}$ is the predecessor relation on $\Int$, i.e.,
  29. $\Setabs{\tuple{x,y}\in\Int^2}{x -1 =y}$.
  30. $S\mid S$ is
  31. $ \Setabs{\tuple{x,y}\in\Int^2}{x + 2 =y}$
  32. $\funrestrictionto{S}{\Nat}$ is the successor relation on~$\Nat$.
  33. $\funimage{S}{\{1,2,3\}}$ is $\{2, 3, 4\}$.
  34. \end{ex}
  35. \begin{defn}[Transitive closure]Let $R \subseteq A^2$ be a binary relation.
  36. The \emph{transitive closure} of~$R$ is $R^+ = \bigcup_{0 < n \in
  37. \Nat} R^n$, where we recursively define $R^1 = R$ and $R^{n+1} = R^n
  38. \mid R$.
  39. The \emph{reflexive transitive closure} of $R$ is $R^* = R^+ \cup
  40. \Id{A}$.
  41. \end{defn}
  42. \begin{ex}
  43. Take the successor relation $S \subseteq \Int^2$. $S^2xy$ iff $x + 2 =
  44. y$, $S^3xy$ iff $x + 3 = y$, etc. So $S^+xy$ iff $x + n = y$ for some
  45. $n \geq 1$. In other words, $S^+xy$ iff $x < y$, and $S^*xy$ iff $x \le
  46. y$.
  47. \end{ex}
  48. \begin{prob}
  49. Show that the transitive closure of $R$ is in fact transitive.
  50. \end{prob}
  51. \end{document}

content/sets-functions-relations/relations/orders.tex

168 lines; SHA-256 c6b7f7f49379f9cac28d844270639eae141152978ef8ad68065d0cfd83ccbd38. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: orders
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{ord}
  7. \olsection{Orders}
  8. \begin{explain}
  9. Many of our comparisons involve describing some objects as being
  10. ``less than'', ``equal to'', or ``greater than'' other objects, in a
  11. certain respect. These involve \emph{order} relations. But there are
  12. different kinds of order relations. For instance, some require that
  13. any two objects be comparable, others don't. Some include identity
  14. (like~$\le$) and some exclude it (like~$<$). It will help us to have a
  15. taxonomy here.
  16. \end{explain}
  17. \begin{defn}[Preorder]
  18. A relation which is both reflexive and transitive is called a
  19. \emph{preorder.}
  20. \end{defn}
  21. \begin{defn}[Partial order]
  22. A preorder which is also anti-symmetric is called a
  23. \emph{partial order}.
  24. \end{defn}
  25. \begin{defn}[Linear order]\ollabel{def:linearorder}
  26. A partial order which is also connected is called a
  27. \emph{total order} or \emph{linear order.}
  28. \end{defn}
  29. \begin{ex}
  30. Every linear order is also a partial order, and every partial order is
  31. also a preorder, but the converses don't hold. The universal relation
  32. on~$A$ is a preorder, since it is reflexive and transitive. But, if
  33. $A$ has more than one !!{element}, the universal relation is not
  34. anti-symmetric, and so not a partial order.
  35. \end{ex}
  36. \begin{ex}
  37. Consider the \emph{no longer than} relation $\preccurlyeq$
  38. on~$\Bin^*$: $x \preccurlyeq y$ iff $\len{x} \le \len{y}$. This is a
  39. preorder (reflexive and transitive), and even connected, but not a
  40. partial order, since it is not anti-symmetric. For instance, $01
  41. \preccurlyeq 10$ and $10 \preccurlyeq 01$, but $01 \neq 10$.
  42. \end{ex}
  43. \begin{ex}
  44. An important partial order is the relation $\subseteq$ on a set of
  45. sets. This is not in general a linear order, since if $a \neq b$ and
  46. we consider $\Pow{\{a, b\}} = \{\emptyset, \{a\}, \{b\}, \{a,b\}\}$,
  47. we see that $\{a\} \nsubseteq \{b\}$ and $\{a\} \neq \{b\}$ and $\{b\}
  48. \nsubseteq \{a\}$.
  49. \end{ex}
  50. \begin{ex}
  51. The relation of \emph{divisibility without remainder} gives us a
  52. partial order which isn't a linear order. For integers $n$ and~$m$, we
  53. write $n \mid m$ to mean $n$ (evenly) divides $m$, i.e., iff there is
  54. some integer~$k$ so that $m = kn$. On~$\Nat$, this is a partial order,
  55. but not a linear order: for instance, $2 \nmid 3$ and also $3 \nmid
  56. 2$. Considered as a relation on $\Int$, divisibility is only a
  57. preorder since it is not anti-symmetric: $1 \mid -1$ and $-1 \mid 1$
  58. but $1 \neq -1$.
  59. \end{ex}
  60. \begin{ex}
  61. The \emph{extension} relation on a set of sequences~$A^*$ is the
  62. following: $s \sqsubseteq s'$ iff $s = \emptyseq$ (the empty
  63. sequence), $s = s'$, or $s = \tuple{s_1, \dots, s_n}$ and $s' =
  64. \tuple{s_1, \dots, s_n, s_{n+1}, \dots, s_m}$. If $s \sqsubseteq s'$
  65. we also say that $s$ is an \emph{initial segment} of~$s'$. The
  66. extension relation on $A^*$ is a partial order but not a linear order,
  67. e.g., if $a \neq b$, then $ab \not\sqsubseteq ba$ and $ba \not\sqsubseteq ab$.
  68. \end{ex}
  69. \begin{defn}[Strict order]
  70. A \emph{strict order} is a relation which is irreflexive, asymmetric,
  71. and transitive.
  72. \end{defn}
  73. \begin{defn}[Strict linear order]\ollabel{def:strictlinearorder}
  74. A strict order which is also connected is called a
  75. \emph{strict total order} or \emph{strict linear order.}
  76. \end{defn}
  77. \begin{ex}
  78. $\le$ is the linear order corresponding to the strict linear
  79. order~$<$. $\subseteq$ is the partial order corresponding to the
  80. strict order~$\subsetneq$.
  81. \end{ex}
  82. Any strict order $R$ on~$A$ can be turned into a partial order by
  83. adding the diagonal $\Id{A}$, i.e., adding all the pairs~$\tuple{x,
  84. x}$. (This is called the \emph{reflexive closure} of~$R$.)
  85. Conversely, starting from a partial order, one can get a strict order
  86. by removing~$\Id{A}$. These next two results make this precise.
  87. \begin{prop}\ollabel{prop:stricttopartial}
  88. If $R$ is a strict order on~$A$, then $R^+ = R \cup \Id{A}$ is a
  89. partial order. Moreover, if $R$ is a strict linear order, then $R^+$ is
  90. a linear order.
  91. \end{prop}
  92. \begin{proof}
  93. Suppose $R$ is a strict order, i.e., $R \subseteq A^2$ and $R$ is
  94. irreflexive, asymmetric, and transitive. Let $R^+ = R \cup \Id{A}$. We
  95. have to show that $R^+$ is reflexive, anti-symmetric, and transitive.
  96. $R^+$ is clearly reflexive, since $\tuple{x, x} \in \Id{A} \subseteq
  97. R^+$ for all $x \in A$.
  98. To show $R^+$ is anti-symmetric, suppose for reductio that $R^+xy$ and
  99. $R^+yx$ but $x \neq y$. Since $\tuple{x,y} \in R \cup \Id{A}$, but
  100. $\tuple{x, y} \notin \Id{A}$, we must have $\tuple{x, y} \in R$, i.e.,
  101. $Rxy$. Similarly,~$Ryx$. But this contradicts the assumption
  102. that $R$ is asymmetric.
  103. To establish transitivity, suppose that $R^+xy$ and $R^+yz$. If both
  104. $\tuple{x, y} \in R$ and $\tuple{y,z} \in R$, then $\tuple{x, z} \in
  105. R$ since $R$~is transitive. Otherwise, either $\tuple{x, y} \in
  106. \Id{A}$, i.e., $x = y$, or $\tuple{y, z} \in \Id{A}$, i.e., $y = z$.
  107. In the first case, we have that $R^+yz$ by assumption, $x = y$, hence
  108. $R^+xz$. Similarly in the second case. In either case, $R^+xz$, thus,
  109. $R^+$ is also transitive.
  110. Concerning the ``moreover'' clause, suppose that $R$ is also connected.
  111. So for all $x \neq y$, either $Rxy$ or~$Ryx$, i.e., either
  112. $\tuple{x, y} \in R$ or $\tuple{y, x} \in R$. Since $R \subseteq R^+$,
  113. this remains true of $R^+$, so $R^+$ is connected as well.
  114. \end{proof}
  115. \begin{prop}\ollabel{prop:partialtostrict}
  116. If $R$ is a partial order on~$A$, then $R^- = R \setminus \Id{A}$ is a
  117. strict order. Moreover, if $R$ is a linear order, then $R^-$ is a strict
  118. linear order.
  119. \end{prop}
  120. \begin{proof}
  121. This is left as an exercise.
  122. \end{proof}
  123. \begin{prob}
  124. Give a proof of \olref[sfr][rel][ord]{prop:partialtostrict}.
  125. \end{prob}
  126. The following simple result establishes that strict linear orders
  127. satisfy an extensionality-like property:
  128. \begin{prop}\ollabel{prop:extensionality-strictlinearorders}
  129. If $<$ is a strict linear order on $A$, then:
  130. \[
  131. (\forall a, b \in A)((\forall x \in A)(x < a \liff x < b) \lif a = b).
  132. \]
  133. \end{prop}
  134. \begin{proof}
  135. Suppose $(\forall x \in A)(x < a \liff x < b)$. If $a < b$, then $a <
  136. a$, contradicting the fact that $<$ is irreflexive; so $a \nless b$.
  137. Exactly similarly, $b \nless a$. So $a = b$, as $<$ is connected.
  138. \end{proof}
  139. \end{document}

content/sets-functions-relations/relations/reflections.tex

77 lines; SHA-256 1f94c1032eaedb73b1de69e6f010b8e0c7437fe240ab280583ff358896fa4b27. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: reflections
  4. %
  5. \documentclass[../../../include/open-logic-section]{subfiles}
  6. \begin{document}
  7. \olfileid{sfr}{rel}{ref}
  8. \olsection{Philosophical Reflections}
  9. In \olref[set]{sec}, we defined relations as certain sets. We should
  10. pause and ask a quick philosophical question: what is such a
  11. definition \emph{doing}? It is extremely doubtful that we should want
  12. to say that we have \emph{discovered} some metaphysical identity
  13. facts; that, for example, the order relation on $\Nat$ \emph{turned
  14. out} to be the set $R= \Setabs{\tuple{n,m}}{n, m \in \Nat\text{ and }
  15. n < m}$ that we defined in \olref[set]{sec}. Here are three
  16. reasons why.
  17. First: in \olref[set][pai]{wienerkuratowski}, we defined $\tuple{a, b} =
  18. \{\{a\}, \{a, b\}\}$. Consider instead the definition $\lVert a,
  19. b\rVert = \{\{b\}, \{a, b\}\} = \tuple{b,a}$. When $a \neq b$, we have
  20. that $\tuple{a, b} \neq \lVert a,b\rVert$. But we could equally have
  21. regarded $\lVert a,b\rVert$ as our definition of an ordered pair,
  22. rather than $\tuple{a,b}$. Both definitions would have worked equally
  23. well. So now we have two equally good candidates to ``be'' the order
  24. relation on the natural numbers, namely:
  25. \begin{align*}
  26. R &= \Setabs{\tuple{n,m}}{n, m \in \Nat \text{ and }n < m}\\
  27. S &= \Setabs{\lVert n,m\rVert}{n, m \in \Nat \text{ and }n < m}.
  28. \end{align*}
  29. Since $R \neq S$, by extensionality, it is clear that they cannot
  30. \emph{both} be identical to the order relation on~$\Nat$. But it would
  31. just be arbitrary, and hence a bit embarrassing, to claim that $R$
  32. rather than $S$ (or vice versa) \emph{is} the ordering relation, as a
  33. matter of fact. (This is a very simple instance of an argument against
  34. set-theoretic reductionism which Benacerraf made famous in
  35. \citeyear{Benacerraf1965}. We will revisit it several times.)
  36. Second: if we think that \emph{every} relation should be identified
  37. with a set, then the relation of set-membership itself, $\in$, should
  38. be a particular set. Indeed, it would have to be the set
  39. $\Setabs{\tuple{x,y}}{x \in y}$. But does this set exist? Given
  40. Russell's Paradox, it is a non-trivial claim that such a set exists.
  41. In fact, \oliflabeldef{cumul:::part}{the theory of sets which we develop in
  42. \olref[cumul][][]{part} will \emph{deny} the existence of this
  43. set.\footnote{Skipping ahead, here is why. For reductio, suppose $I =
  44. \Setabs{\tuple{x,y}}{x \in y}$ exists. Then $\bigcup \bigcup I$ is the
  45. universal set, contradicting
  46. \olref[sfr][z][sep]{thm:NoUniversalSet}.}}{it is possible to
  47. develop set theory in a rigorous way as an axiomatic theory, and that
  48. theory will indeed deny the existence of this set.}
  49. So, even if some relations can be treated as sets, the relation of
  50. set-membership will have to be a special case.
  51. Third: when we ``identify'' relations with sets, we said that we would
  52. allow ourselves to write $Rxy$ for $\tuple{x,y} \in R$. This is fine,
  53. provided that the membership relation, ``$\in$'', is treated \emph{as}
  54. a predicate. But if we think that ``$\in$'' stands for a certain kind
  55. of set, then the expression ``$\tuple{x,y} \in R$'' just consists of
  56. three singular terms which stand for sets: ``$\tuple{x,y}$'',
  57. ``$\in$'', and ``$R$''. And such a list of names is no more capable of
  58. expressing a proposition than the nonsense string: ``the cup penholder
  59. the table''. Again, even if some relations can be treated as sets, the
  60. relation of set-membership must be a special case. (This rolls
  61. together a simple version of Frege's concept \emph{horse} paradox, and
  62. a famous objection that Wittgenstein once raised against Russell.)
  63. So where does this leave us? Well, there is nothing \emph{wrong} with
  64. our saying that the relations on the numbers are sets. We just have to
  65. understand the spirit in which that remark is made. We are not stating
  66. a metaphysical identity fact. We are simply noting that, in certain
  67. contexts, we can (and will) \emph{treat} (certain) relations as
  68. certain sets.
  69. \end{document}

content/sets-functions-relations/relations/relations-as-sets.tex

125 lines; SHA-256 412c6fa44ead94f076dfea7cd23f9e3cd748b08c1882dcb129b15f8efcf5c29c. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: relations-as-sets
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{set}
  7. \olsection{Relations as Sets}
  8. \begin{explain}
  9. In \olref[sfr][set][imp]{sec}, we mentioned some important sets:
  10. $\Nat$, $\Int$, $\Rat$, $\Real$. You will no doubt remember some
  11. interesting relations between the !!{element}s of some of these sets.
  12. For instance, each of these sets has a completely standard \emph{order
  13. relation} on it. There is also the relation \emph{is identical with}
  14. that every object bears to itself and to no other thing. There are
  15. many more interesting relations that we'll encounter, and even more
  16. possible relations. Before we review them, though, we will start by
  17. pointing out that we can look at relations as a special sort of set.
  18. For this, recall two things from \olref[sfr][set][pai]{sec}. First,
  19. recall the notion of an \emph{ordered pair}: given $a$ and $b$, we can
  20. form~$\tuple{a, b}$. Importantly, the order of elements \emph{does}
  21. matter here. So if $a \neq b$ then $\tuple{a, b} \neq \tuple{b, a}$.
  22. (Contrast this with unordered pairs, i.e., $2$-element sets, where
  23. $\{a, b\}=\{b, a\}$.) Second, recall the notion of a \emph{Cartesian
  24. product}: if $A$ and $B$ are sets, then we can form~$A \times B$, the
  25. set of all pairs $\tuple{x, y}$ with $x \in A$ and $y \in B$. In
  26. particular, $A^{2}= A \times A$ is the set of all ordered pairs
  27. from~$A$.
  28. Now we will consider a particular relation on a set: the $<$-relation
  29. on the set~$\Nat$ of natural numbers. Consider the set of all pairs of
  30. numbers $\tuple{n, m}$ where $n<m$, i.e.,
  31. \[
  32. R=\Setabs{\tuple{n, m}}{n, m \in \Nat \text{ and } n<m}.
  33. \]
  34. There is a close connection between $n$ being less than $m$, and the
  35. pair $\tuple{n, m}$ being a member of $R$, namely:
  36. \[
  37. n<m\text{ iff }\tuple{n, m} \in R.
  38. \]
  39. Indeed, without any loss of information, we can consider the set $R$
  40. to \emph{be} the $<$-relation on $\Nat$.
  41. In the same way we can construct a subset of $\Nat^{2}$ for any
  42. relation between numbers. Conversely, given any set of pairs of
  43. numbers $S \subseteq \Nat^{2}$, there is a corresponding relation
  44. between numbers, namely, the relationship $n$ bears to $m$ if and only
  45. if $\tuple{n, m} \in S$. This justifies the following definition:
  46. \end{explain}
  47. \begin{defn}[Binary relation]
  48. A \emph{binary relation} on a set $A$ is a subset of~$A^{2}$. If $R
  49. \subseteq A^{2}$ is a binary relation on~$A$ and $x, y \in A$, we
  50. sometimes write $Rxy$ (or $xRy$) for $\tuple{x, y} \in R$.
  51. \end{defn}
  52. \begin{ex}
  53. \ollabel{relations}
  54. The set $\Nat^{2}$ of pairs of natural numbers can be listed in a
  55. 2-dimensional matrix like this:
  56. \[
  57. \begin{array}{ccccc}
  58. \mathbf{\tuple{ 0,0 }} & \tuple{ 0,1 } &
  59. \tuple{ 0,2 } & \tuple{ 0,3 } & \ldots\\
  60. \tuple{ 1,0 } & \mathbf{\tuple{ 1,1 }} &
  61. \tuple{ 1,2 } & \tuple{ 1,3 } & \ldots\\
  62. \tuple{ 2,0 } & \tuple{ 2,1 } &
  63. \mathbf{\tuple{ 2,2 }} & \tuple{ 2,3 } & \ldots\\
  64. \tuple{ 3,0 } & \tuple{ 3,1 } & \tuple{ 3,2 } &
  65. \mathbf{\tuple{ 3,3 }} & \ldots\\
  66. \vdots & \vdots & \vdots & \vdots & \mathbf{\ddots}
  67. \end{array}
  68. \]
  69. We have put the diagonal, here, in bold, since the subset of $\Nat^2$
  70. consisting of the pairs lying on the diagonal, i.e.,
  71. \[
  72. \{\tuple{0,0 }, \tuple{ 1,1 }, \tuple{ 2,2 }, \dots\},
  73. \]
  74. is the \emph{identity relation on}~$\Nat$. (Since the identity
  75. relation is popular, let's define $\Id{A}=\Setabs{\tuple{ x,x }}{x \in
  76. A}$ for any set $A$.) The subset of all pairs lying above the
  77. diagonal, i.e.,
  78. \[
  79. L = \{\tuple{ 0,1 },\tuple{ 0,2 },\ldots,\tuple{ 1,2 },
  80. \tuple{ 1,3 }, \dots, \tuple{ 2,3 }, \tuple{ 2,4 },\ldots\},
  81. \]
  82. is the \emph{less than} relation, i.e., $Lnm$ iff $n<m$. The subset of
  83. pairs below the diagonal, i.e.,
  84. \[
  85. G=\{ \tuple{ 1,0 },\tuple{ 2,0 },\tuple{
  86. 2,1 }, \tuple{ 3,0 },\tuple{ 3,1 },\tuple{ 3,2 }, \dots\},
  87. \]
  88. is the \emph{greater than} relation, i.e., $Gnm$ iff $n>m$. The union
  89. of $L$ with $I$, which we might call $K=L\cup I$, is the \emph{less
  90. than or equal to} relation: $Knm$ iff $n \le m$. Similarly, $H=G \cup
  91. I$ is the \emph{greater than or equal to relation.} These relations
  92. $L$, $G$, $K$, and $H$ are special kinds of relations called
  93. \emph{orders}. $L$ and $G$ have the property that no number bears $L$
  94. or $G$ to itself (i.e., for all $n$, neither $Lnn$ nor $Gnn$).
  95. Relations with this property are called \emph{irreflexive}, and, if
  96. they also happen to be orders, they are called \emph{strict orders.}
  97. \end{ex}
  98. \begin{explain}
  99. Although orders and identity are important and natural relations, it
  100. should be emphasized that according to our definition \emph{any}
  101. subset of $A^{2}$ is a relation on~$A$, regardless of how unnatural or
  102. contrived it seems. In particular, $\emptyset$ is a relation on any
  103. set (the \emph{empty relation}, which no pair of elements bears), and
  104. $A^{2}$~itself is a relation on~$A$ as well (one which every pair
  105. bears), called the \emph{universal relation}. But also something like
  106. $E=\Setabs{\tuple{n, m}}{n>5 \text{ or } m \times n \ge 34}$ counts as
  107. a relation.
  108. \end{explain}
  109. \begin{prob}
  110. List the !!{element}s of the relation $\subseteq$ on the set
  111. $\Pow{\{a, b, c\}}$.
  112. \end{prob}
  113. \end{document}

content/sets-functions-relations/relations/relations-complete.tex

28 lines; SHA-256 7e1363f3e757004246334478742e4199101dbb2551fac272462454cd40161e23. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations-complete
  3. \documentclass[../../../include/open-logic-chapter]{subfiles}
  4. \begin{document}
  5. \olchapter{sfr}{rel}{Relations}
  6. \olimport{relations-as-sets}
  7. \olimport{reflections}
  8. \olimport{special-properties}
  9. \olimport{equivalence-relations}
  10. \olimport{orders}
  11. \olimport{graphs}
  12. \olimport{trees}
  13. \olimport{operations}
  14. \OLEndChapterHook
  15. \end{document}

content/sets-functions-relations/relations/special-properties.tex

85 lines; SHA-256 f9bdfcb4c680ea58fdb209f0347c2f8055de96558caf69a26ec3ce8e1e7ce6a1. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: special-properties
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{prp}
  7. \olsection{Special Properties of Relations}
  8. \begin{intro}
  9. Some kinds of relations turn out to be so common that they have been
  10. given special names. For instance, $\le$ and~$\subseteq$ both relate
  11. their respective domains (say, $\Nat$ in the case of~$\le$ and
  12. $\Pow{A}$ in the case of~$\subseteq$) in similar ways. To get at
  13. exactly how these relations are similar, and how they differ, we
  14. categorize them according to some special properties that relations
  15. can have. It turns out that (combinations of) some of these special
  16. properties are especially important: orders and equivalence relations.
  17. \end{intro}
  18. \begin{defn}[Reflexivity]
  19. A relation $R \subseteq A^2$ is \emph{reflexive} iff, for every $x \in
  20. A$, $Rxx$.
  21. \end{defn}
  22. \begin{defn}[Transitivity]
  23. A relation $R \subseteq A^2$ is \emph{transitive} iff, whenever $Rxy$
  24. and $Ryz$, then also $Rxz$.
  25. \end{defn}
  26. \begin{defn}[Symmetry]
  27. A relation~$R \subseteq A^2$ is \emph{symmetric} iff, whenever
  28. $Rxy$, then also~$Ryx$.
  29. \end{defn}
  30. \begin{defn}[Anti-symmetry]
  31. A relation~$R \subseteq A^2$ is \emph{anti-sym\-met\-ric} iff, whenever both
  32. $Rxy$ and $Ryx$, then $x=y$ (or, in other words: if $x\neq y$ then
  33. either $\lnot Rxy$ or $\lnot Ryx$).
  34. \end{defn}
  35. \begin{explain}
  36. In a symmetric relation, $Rxy$ and $Ryx$ always hold together, or
  37. neither holds. In an anti-symmetric relation, the only way for $Rxy$
  38. and $Ryx$ to hold together is if $x = y$. Note that this does not
  39. \emph{require} that $Rxy$ and $Ryx$ holds when $x = y$, only that it
  40. isn't ruled out. So an anti-symmetric relation can be reflexive, but
  41. it is not the case that every anti-symmetric relation is
  42. reflexive. Also note that being anti-symmetric and merely not being
  43. symmetric are different conditions. In fact, a relation can be both
  44. symmetric and anti-symmetric at the same time (e.g., the identity
  45. relation is).
  46. \end{explain}
  47. \begin{defn}[Connectivity]
  48. A relation $R \subseteq A^2$ is \emph{connected} if for all $x,y\in
  49. A$, if $x \neq y$, then either $Rxy$ or~$Ryx$.
  50. \end{defn}
  51. \begin{prob}
  52. Give examples of relations that are (a) reflexive and symmetric but
  53. not transitive, (b) reflexive and anti-symmetric, (c) anti-symmetric,
  54. transitive, but not reflexive, and (d) reflexive, symmetric, and
  55. transitive. Do not use relations on numbers or sets.
  56. \end{prob}
  57. \begin{defn}[Irreflexivity]
  58. A relation $R \subseteq A^2$ is called \emph{irreflexive} if, for all $x \in
  59. A$, not $Rxx$.
  60. \end{defn}
  61. \begin{defn}[Asymmetry]
  62. A relation $R \subseteq A^2$ is called \emph{asymmetric} if for no pair $x,y\in
  63. A$ we have both $Rxy$ and~$Ryx$.
  64. \end{defn}
  65. Note that if $A \neq \emptyset$, then no irreflexive relation on~$A$
  66. is reflexive and every asymmetric relation on~$A$ is also
  67. anti-symmetric. However, there are $R \subseteq A^2$ that are not
  68. reflexive and also not irreflexive, and there are anti-symmetric
  69. relations that are not asymmetric.
  70. \end{document}

content/sets-functions-relations/relations/trees.tex

130 lines; SHA-256 57cc56ee55506aa19e7be6129d2cad6b8635fd2d6407399d4f774782f2cdd588. Open the preserved source file.

  1. % Part: sets-functions-relations
  2. % Chapter: relations
  3. % Section: trees
  4. \documentclass[../../../include/open-logic-section]{subfiles}
  5. \begin{document}
  6. \olfileid{sfr}{rel}{tre}
  7. \olsection{Trees}
  8. A particular kind of partial order which plays an important role in
  9. all parts of logic is a \emph{tree}. Finite trees occur in elementary
  10. parts of logic: for example, !!{formula}s can be understood in terms
  11. of their decomposition into a syntax tree, while !!{derivation}s in
  12. many !!{derivation} systems also take the form of finite trees.
  13. %
  14. Infinite trees appear already in the proof of the completeness
  15. theorems for propositional and first-order logic, and are used
  16. throughout mathematical logic.
  17. The set-theoretic concept of a tree is closely related to the notion
  18. of a tree in graph theory. Here is a picture of a (finite) tree:
  19. \begin{center}
  20. \begin{tikzpicture}[nodes={draw, circle}, -]
  21. \node{$r$} [grow'=up]
  22. child { node {$a$}
  23. child { node {$c$} }
  24. child { node {$d$} }
  25. child { node {$e$} }
  26. }
  27. child { node {$b$} };
  28. \end{tikzpicture}
  29. \end{center}
  30. The lowermost node~$r$ is the root. Every node other than $r$ has
  31. exactly one parent node immediately below it. We can think of the relation
  32. a node~$x$ stands in to a node~$y$ if $y$ can be reached from~$x$ by
  33. following edges upwards as $x$ being an \emph{ancestor} of~$y$.
  34. The ancestor relation in a tree is a strict partial order. This
  35. motivates the set-theoretic definition. To state it we need two
  36. concepts. A \emph{least element} in a set~$A$ partially ordered
  37. by~$\le$ is !!a{element} $x \in A$ such that for all $y \in A$ we have
  38. that~$x \le y$. A set is \emph{well-ordered} by~$\le$ if every one of
  39. its non-empty subsets has a least element.
  40. \begin{defn}[Tree]
  41. A \emph{tree} is a pair $T = \tuple{A, \le}$ such that $A$ is a set
  42. and $\le$ is a partial order on~$A$ with a unique least element
  43. $r \in A$ (called the \emph{root}) such that for all $x \in A$,
  44. the set $\Setabs{y}{y \le x}$ is well-ordered by~$\le$.
  45. \end{defn}
  46. \begin{defn}[Successors]
  47. Suppose $T = \tuple{A, \le}$ is a tree.
  48. If $x,y \in A$, $x < y$, and there is no $z \in A$ such that
  49. $x < z < y$, then we say that $y$ is a \emph{successor} of~$x$.
  50. \end{defn}
  51. The successors of $x \in A$ are also called its \emph{children}. If
  52. $y$ is a successor of~$x$, then we call $x$ the \emph{predecessor} or
  53. \emph{parent} of~$y$.
  54. \begin{prop}
  55. If $\tuple{A,\le}$ is a tree, then every $x \in A$ other than the root
  56. has at most one predecessor.
  57. \end{prop}
  58. \begin{proof}
  59. Suppose $y_1 < x$ and $y_2 < x$ and $y_1 \neq y_2$. Then $\{y_1,
  60. y_2\} \subseteq \Setabs{z}{z<x}$. Since $\Setabs{z}{z<x}$ is
  61. well-ordered by~$\le$, its subset $\{y_1, y_2\}$ has a least
  62. element, which obviously must be either $y_1$ or~$y_2$. So either
  63. $y_1 \le y_2$ or $y_2 \le y_1$. We assumed that $y_1 \neq y_2$, so
  64. actually either $y_1 < y_2$ or $y_2 < y_1$. Since we assumed that
  65. $y_1 < x$ and $y_2 < x$, we furthermore have that either $y_1 < y_2
  66. < x$ or $y_2 < y_1 < x$. So $y_1$ and $y_2$ cannot both be
  67. predecessors of~$x$.
  68. \end{proof}
  69. \begin{defn}
  70. A tree $T = \tuple{A, \le}$ is said to be \emph{infinite} if $A$ is an
  71. infinite set, and \emph{finite} otherwise. If $T$ is such that every
  72. $x \in A$ has only finitely many successors, then we say that $T$ is
  73. \emph{finitely branching}.
  74. \end{defn}
  75. \begin{defn}[Branches]
  76. Given a tree $T = \tuple{A, \le}$, a \emph{branch} of~$T$ is a
  77. maximal chain in~$T$, i.e., a set $B \subseteq A$ such that
  78. for any $x, y \in B$ either $x \le y$ or $y \le x$, and for any
  79. $z \in X \setminus B$ there exists $u \in B$ such that neither
  80. $z \le u$ nor $u \le z$.
  81. %
  82. We use $[T]$ to denote the set of all branches of $T$.
  83. \end{defn}
  84. \begin{ex}
  85. A classic example of a finitely branching tree is the
  86. \emph{infinite binary tree} of finite sequences of $0$s and~$1$s,
  87. sometimes denoted $\{0,1\}^*$ or~$\Bin^*$, ordered by the extension
  88. relation $\sqsubseteq$ (e.g., $101 \sqsubseteq 101101$).
  89. Since any binary string can always be extended by adding
  90. a $0$ or a $1$ on the end, this tree contains infinitely
  91. many elements: every element~$s$ has exactly two successors, $s0$ and~$s1$. Its root is the empty sequence $\emptyseq$.
  92. \end{ex}
  93. \begin{ex}
  94. Slightly more generally, the set of finite sequences of natural
  95. numbers~$\Nat^*$ with the extension relation~$\sqsubseteq$ is also a
  96. tree. It is obviously not finitely branching: every $s \in \Nat^*$ has
  97. infinitely many successors~$sn$, one for every $n \in \Nat$. Every $A
  98. \subseteq \Nat^*$ which is closed under~$\sqsubseteq$ is a
  99. \emph{subtree} of~$\Nat^*$. (That is, $A$ is such that if $s \in A$
  100. and $s' \sqsubseteq s$, then also $s' \in A$.) All finite trees can be
  101. represented as finite subtrees of~$\Nat^*$.
  102. \end{ex}
  103. \begin{prop}[K\H{o}nig's lemma]
  104. If $T = \tuple{A,\le}$ is a finitely branching infinite tree,
  105. then $T$ has an infinite branch.
  106. \end{prop}
  107. A special case of K\H{o}nig's lemma widely used in computability
  108. theory, known as \emph{weak K\H{o}nig's lemma}, is the following: any
  109. infinite subtree of $\{0,1\}^*$ has an infinite branch.
  110. \end{document}