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.
% Part: sets-functions-relations% Chapter: relations% Section: equivalence-relations\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{eqv}\olsection{Equivalence Relations}The identity relation on a set is reflexive, symmetric, andtransitive. Relations~$R$ that have all three of these properties are verycommon.\begin{defn}[Equivalence relation]A relation $R \subseteq A^2$ that is reflexive, symmetric, andtransitive is called an \emph{equivalence relation}. !!^{element}s $x$and $y$ of~$A$ are said to be \emph{$R$-equivalent} if~$Rxy$.\end{defn}Equivalence relations give rise to the notion of an \emph{equivalenceclass}. An equivalence relation ``chunks up'' the domain intodifferent partitions. Within each partition, all the objects arerelated to one another; and no objects from different partitionsrelate to one another. Sometimes, it's helpful just to talk aboutthese partitions \emph{directly}. To that end, we introduce adefinition:\begin{defn}\ollabel{def:equivalenceclass}Let $R \subseteq A^2$ be an equivalence relation. For each $x \in A$,the \emph{equivalence class} of $x$ in~$A$ is the set $\equivrep{x}{R}= \Setabs{y \in A}{Rxy}$. The \emph{quotient} of $A$ under~$R$ is$\equivclass{A}{R} = \Setabs{\equivrep{x}{R}}{x \in A}$, i.e., the setof these equivalence classes.\end{defn}The next result vindicates the definition of an equivalence class, inproving that the equivalence classes are indeed the partitions of~$A$:\begin{prop}If $R \subseteq A^2$ is an equivalence relation, then $Rxy$ iff$\equivrep{x}{R} = \equivrep{y}{R}$.\end{prop}\begin{proof}For the left-to-right direction, suppose $Rxy$, and let $z \in\equivrep{x}{R}$. By definition, then, $Rxz$. Since $R$ is anequivalence relation, $Ryz$. (Spelling this out: as $Rxy$ and~$R$ issymmetric we have $Ryx$, and as $Rxz$ and~$R$ is transitive wehave~$Ryz$.) So $z \in \equivrep{y}{R}$. Generalising,$\equivrep{x}{R} \subseteq \equivrep{y}{R}$. But exactly similarly,$\equivrep{y}{R} \subseteq \equivrep{x}{R}$. So $\equivrep{x}{R} =\equivrep{y}{R}$, by extensionality.For the right-to-left direction, suppose $\equivrep{x}{R} =\equivrep{y}{R}$. Since $R$ is reflexive, $Ryy$, so $y \in\equivrep{y}{R}$. Thus also $y \in \equivrep{x}{R}$ by the assumptionthat $\equivrep{x}{R} = \equivrep{y}{R}$. So $Rxy$.\end{proof}\begin{ex}A nice example of equivalence relations comes from modular arithmetic.For any $a$, $b$, and $n \in \PosInt$, say that $a \equiv_n b$ iffdividing $a$ by~$n$ gives the same remainder as dividing $b$ by~$n$.(Somewhat more symbolically: $a \equiv_n b$ iff, for some $k \in\Int$, $a - b = kn$.) Now, $\equiv_n$ is an equivalence relation, forany~$n$. And there are exactly $n$ distinct equivalence classesgenerated by~$\equiv_n$; that is, $\equivclass{\Nat}{\equiv_n}$ has$n$ !!{element}s. These are: the set of numbers divisible by $n$without remainder, i.e., $\equivrep{0}{\equiv_n}$; the set of numbersdivisible by $n$ with remainder~$1$, i.e., $\equivrep{1}{\equiv_n}$;\ldots; and the set of numbers divisible by~$n$ with remainder~$n-1$,i.e.,~$\equivrep{n-1}{\equiv_n}$.\end{ex}\begin{prob}Show that $\equiv_n$ is an equivalence relation, for any $n \in\PosInt$, and that $\equivclass{\Nat}{\equiv_n}$ has exactly $n$ members.\end{prob}\end{document}
content/sets-functions-relations/relations/graphs.tex
77 lines; SHA-256 a538018608ce97d0b371a392912c3d6825d8f3b17719bceca5744a77ace26351. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: graphs\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{grp}\olsection{Graphs}A \emph{graph} is a diagram in which points---called ``nodes'' or``vertices'' (plural of ``vertex'')---are connected by edges. Graphsare a ubiquitous tool in discrete mathematics and in computer science.They are incredibly useful for representing, and visualizing,relationships and structures, from concrete things like networks ofvarious kinds to abstract structures such as the possible outcomes ofdecisions. There are many different kinds of graphs in the literaturewhich differ, e.g., according to whether the edges are directed ornot, have labels or not, whether there can be edges from a node to thesame node, multiple edges between the same nodes, etc. \emph{Directedgraphs} have a special connection to relations.\begin{defn}[Directed graph]A \emph{directed graph} $G = \tuple{V, E}$ is a set of\emph{vertices}~$V$ and a set of \emph{edges}~$E \subseteq V^2$.\end{defn}\begin{explain}According to our definition, a graph just is a set together with arelation on that set. Of course, when talking about graphs, it's onlynatural to expect that they are graphically represented: we can draw agraph by connecting two vertices~$v_1$ and $v_2$ by an arrow iff$\tuple{v_1, v_2} \in E$. The only difference between a relation byitself and a graph is that a graph specifies the set of vertices,i.e., a graph may have isolated vertices. The important point,however, is that every relation~$R$ on a set~$X$ can be seen as adirected graph $\tuple{X, R}$, and conversely, a directedgraph~$\tuple{V, E}$ can be seen as a relation $E \subseteq V^2$ withthe set $V$ explicitly specified.\end{explain}\begin{ex}The graph $\tuple{V, E}$ with $V = \{1, 2, 3, 4\}$ and $E =\{\tuple{1,1}, \allowbreak \tuple{1, 2}, \allowbreak \tuple{1, 3},\allowbreak \tuple{2, 3}\}$ looks like this:\begin{align*}& \begin{tikzpicture}[->,node distance=2cm]\node[draw,circle] (A) {$1$};\node[draw,circle] (B) [right of=A] {$2$};\node[draw,circle] (C) [below of=B] {$3$};\node[draw,circle] (D) [right of=B] {$4$};\draw (A) to [loop above] (A);\draw (A) to (B);\draw (A) to (C);\draw (B) to (C);\end{tikzpicture}\intertext{This is a different graph than $\tuple{V', E}$ with $V' =\{1, 2, 3\}$, which looks like this:}& \begin{tikzpicture}[->,node distance=2cm]\node[draw,circle] (A) {$1$};\node[draw,circle] (B) [right of=A] {$2$};\node[draw,circle] (C) [below of=B] {$3$};\draw (A) to [loop above] (A);\draw (A) to (B);\draw (A) to (C);\draw (B) to (C);\end{tikzpicture}\end{align*}\end{ex}\begin{prob}Consider the less-than-or-equal-to relation~$\le$ on the set $\{1,2, 3, 4\}$ as a graph and draw the corresponding diagram.\end{prob}\end{document}
content/sets-functions-relations/relations/operations.tex
71 lines; SHA-256 5e6f57e9ddf53e1624955adabd594ea3855ad787c1074ba12421b0025b432372. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: operations\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{ops}\olsection{Operations on Relations}It is often useful to modify or combine relations. In\olref[sfr][rel][ord]{prop:stricttopartial}, we considered the \emph{union}of relations, which is just the union of two relations considered assets of pairs. Similarly, in \olref[sfr][rel][ord]{prop:partialtostrict},we considered the relative difference of relations. Here are someother operations we can perform on relations.\begin{defn}\ollabel{relationoperations}Let $R$, $S$ be relations, and $A$ be any set.The \emph{inverse} of $R$ is $R^{-1} = \Setabs{\tuple{y, x}}{\tuple{x,y} \in R}$.The \emph{relative product} of $R$ and $S$ is $(R \mid S) =\{\tuple{x, z} : \exists y(Rxy \land Syz)\}$.The \emph{restriction} of $R$ to $A$ is $\funrestrictionto{R}{A}= R\cap A^2$.The \emph{application} of $R$ to $A$ is $\funimage{R}{A} = \{y :(\exists x \in A)Rxy\}$\end{defn}\begin{ex}Let $S \subseteq \Int^2$ be the successor relation on~$\Int$, i.e.,$S = \Setabs{\tuple{x, y} \in \Int^2}{x + 1 = y}$, so that $Sxy$ iff $x + 1 = y$.$S^{-1}$ is the predecessor relation on $\Int$, i.e.,$\Setabs{\tuple{x,y}\in\Int^2}{x -1 =y}$.$S\mid S$ is$ \Setabs{\tuple{x,y}\in\Int^2}{x + 2 =y}$$\funrestrictionto{S}{\Nat}$ is the successor relation on~$\Nat$.$\funimage{S}{\{1,2,3\}}$ is $\{2, 3, 4\}$.\end{ex}\begin{defn}[Transitive closure]Let $R \subseteq A^2$ be a binary relation.The \emph{transitive closure} of~$R$ is $R^+ = \bigcup_{0 < n \in\Nat} R^n$, where we recursively define $R^1 = R$ and $R^{n+1} = R^n\mid R$.The \emph{reflexive transitive closure} of $R$ is $R^* = R^+ \cup\Id{A}$.\end{defn}\begin{ex}Take the successor relation $S \subseteq \Int^2$. $S^2xy$ iff $x + 2 =y$, $S^3xy$ iff $x + 3 = y$, etc. So $S^+xy$ iff $x + n = y$ for some$n \geq 1$. In other words, $S^+xy$ iff $x < y$, and $S^*xy$ iff $x \ley$.\end{ex}\begin{prob}Show that the transitive closure of $R$ is in fact transitive.\end{prob}\end{document}
content/sets-functions-relations/relations/orders.tex
168 lines; SHA-256 c6b7f7f49379f9cac28d844270639eae141152978ef8ad68065d0cfd83ccbd38. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: orders\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{ord}\olsection{Orders}\begin{explain}Many of our comparisons involve describing some objects as being``less than'', ``equal to'', or ``greater than'' other objects, in acertain respect. These involve \emph{order} relations. But there aredifferent kinds of order relations. For instance, some require thatany two objects be comparable, others don't. Some include identity(like~$\le$) and some exclude it (like~$<$). It will help us to have ataxonomy here.\end{explain}\begin{defn}[Preorder]A relation which is both reflexive and transitive is called a\emph{preorder.}\end{defn}\begin{defn}[Partial order]A preorder which is also anti-symmetric is called a\emph{partial order}.\end{defn}\begin{defn}[Linear order]\ollabel{def:linearorder}A partial order which is also connected is called a\emph{total order} or \emph{linear order.}\end{defn}\begin{ex}Every linear order is also a partial order, and every partial order isalso a preorder, but the converses don't hold. The universal relationon~$A$ is a preorder, since it is reflexive and transitive. But, if$A$ has more than one !!{element}, the universal relation is notanti-symmetric, and so not a partial order.\end{ex}\begin{ex}Consider the \emph{no longer than} relation $\preccurlyeq$on~$\Bin^*$: $x \preccurlyeq y$ iff $\len{x} \le \len{y}$. This is apreorder (reflexive and transitive), and even connected, but not apartial order, since it is not anti-symmetric. For instance, $01\preccurlyeq 10$ and $10 \preccurlyeq 01$, but $01 \neq 10$.\end{ex}\begin{ex}An important partial order is the relation $\subseteq$ on a set ofsets. This is not in general a linear order, since if $a \neq b$ andwe consider $\Pow{\{a, b\}} = \{\emptyset, \{a\}, \{b\}, \{a,b\}\}$,we see that $\{a\} \nsubseteq \{b\}$ and $\{a\} \neq \{b\}$ and $\{b\}\nsubseteq \{a\}$.\end{ex}\begin{ex}The relation of \emph{divisibility without remainder} gives us apartial order which isn't a linear order. For integers $n$ and~$m$, wewrite $n \mid m$ to mean $n$ (evenly) divides $m$, i.e., iff there issome integer~$k$ so that $m = kn$. On~$\Nat$, this is a partial order,but not a linear order: for instance, $2 \nmid 3$ and also $3 \nmid2$. Considered as a relation on $\Int$, divisibility is only apreorder since it is not anti-symmetric: $1 \mid -1$ and $-1 \mid 1$but $1 \neq -1$.\end{ex}\begin{ex}The \emph{extension} relation on a set of sequences~$A^*$ is thefollowing: $s \sqsubseteq s'$ iff $s = \emptyseq$ (the emptysequence), $s = s'$, or $s = \tuple{s_1, \dots, s_n}$ and $s' =\tuple{s_1, \dots, s_n, s_{n+1}, \dots, s_m}$. If $s \sqsubseteq s'$we also say that $s$ is an \emph{initial segment} of~$s'$. Theextension relation on $A^*$ is a partial order but not a linear order,e.g., if $a \neq b$, then $ab \not\sqsubseteq ba$ and $ba \not\sqsubseteq ab$.\end{ex}\begin{defn}[Strict order]A \emph{strict order} is a relation which is irreflexive, asymmetric,and transitive.\end{defn}\begin{defn}[Strict linear order]\ollabel{def:strictlinearorder}A strict order which is also connected is called a\emph{strict total order} or \emph{strict linear order.}\end{defn}\begin{ex}$\le$ is the linear order corresponding to the strict linearorder~$<$. $\subseteq$ is the partial order corresponding to thestrict order~$\subsetneq$.\end{ex}Any strict order $R$ on~$A$ can be turned into a partial order byadding the diagonal $\Id{A}$, i.e., adding all the pairs~$\tuple{x,x}$. (This is called the \emph{reflexive closure} of~$R$.)Conversely, starting from a partial order, one can get a strict orderby removing~$\Id{A}$. These next two results make this precise.\begin{prop}\ollabel{prop:stricttopartial}If $R$ is a strict order on~$A$, then $R^+ = R \cup \Id{A}$ is apartial order. Moreover, if $R$ is a strict linear order, then $R^+$ isa linear order.\end{prop}\begin{proof}Suppose $R$ is a strict order, i.e., $R \subseteq A^2$ and $R$ isirreflexive, asymmetric, and transitive. Let $R^+ = R \cup \Id{A}$. Wehave to show that $R^+$ is reflexive, anti-symmetric, and transitive.$R^+$ is clearly reflexive, since $\tuple{x, x} \in \Id{A} \subseteqR^+$ for all $x \in A$.To show $R^+$ is anti-symmetric, suppose for reductio that $R^+xy$ and$R^+yx$ but $x \neq y$. Since $\tuple{x,y} \in R \cup \Id{A}$, but$\tuple{x, y} \notin \Id{A}$, we must have $\tuple{x, y} \in R$, i.e.,$Rxy$. Similarly,~$Ryx$. But this contradicts the assumptionthat $R$ is asymmetric.To establish transitivity, suppose that $R^+xy$ and $R^+yz$. If both$\tuple{x, y} \in R$ and $\tuple{y,z} \in R$, then $\tuple{x, z} \inR$ since $R$~is transitive. Otherwise, either $\tuple{x, y} \in\Id{A}$, i.e., $x = y$, or $\tuple{y, z} \in \Id{A}$, i.e., $y = z$.In the first case, we have that $R^+yz$ by assumption, $x = y$, hence$R^+xz$. Similarly in the second case. In either case, $R^+xz$, thus,$R^+$ is also transitive.Concerning the ``moreover'' clause, suppose that $R$ is also connected.So for all $x \neq y$, either $Rxy$ or~$Ryx$, i.e., either$\tuple{x, y} \in R$ or $\tuple{y, x} \in R$. Since $R \subseteq R^+$,this remains true of $R^+$, so $R^+$ is connected as well.\end{proof}\begin{prop}\ollabel{prop:partialtostrict}If $R$ is a partial order on~$A$, then $R^- = R \setminus \Id{A}$ is astrict order. Moreover, if $R$ is a linear order, then $R^-$ is a strictlinear order.\end{prop}\begin{proof}This is left as an exercise.\end{proof}\begin{prob}Give a proof of \olref[sfr][rel][ord]{prop:partialtostrict}.\end{prob}The following simple result establishes that strict linear orderssatisfy an extensionality-like property:\begin{prop}\ollabel{prop:extensionality-strictlinearorders}If $<$ is a strict linear order on $A$, then:\[(\forall a, b \in A)((\forall x \in A)(x < a \liff x < b) \lif a = b).\]\end{prop}\begin{proof}Suppose $(\forall x \in A)(x < a \liff x < b)$. If $a < b$, then $a <a$, contradicting the fact that $<$ is irreflexive; so $a \nless b$.Exactly similarly, $b \nless a$. So $a = b$, as $<$ is connected.\end{proof}\end{document}
content/sets-functions-relations/relations/reflections.tex
77 lines; SHA-256 1f94c1032eaedb73b1de69e6f010b8e0c7437fe240ab280583ff358896fa4b27. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: reflections%\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{ref}\olsection{Philosophical Reflections}In \olref[set]{sec}, we defined relations as certain sets. We shouldpause and ask a quick philosophical question: what is such adefinition \emph{doing}? It is extremely doubtful that we should wantto say that we have \emph{discovered} some metaphysical identityfacts; that, for example, the order relation on $\Nat$ \emph{turnedout} to be the set $R= \Setabs{\tuple{n,m}}{n, m \in \Nat\text{ and }n < m}$ that we defined in \olref[set]{sec}. Here are threereasons why.First: in \olref[set][pai]{wienerkuratowski}, we defined $\tuple{a, b} =\{\{a\}, \{a, b\}\}$. Consider instead the definition $\lVert a,b\rVert = \{\{b\}, \{a, b\}\} = \tuple{b,a}$. When $a \neq b$, we havethat $\tuple{a, b} \neq \lVert a,b\rVert$. But we could equally haveregarded $\lVert a,b\rVert$ as our definition of an ordered pair,rather than $\tuple{a,b}$. Both definitions would have worked equallywell. So now we have two equally good candidates to ``be'' the orderrelation on the natural numbers, namely:\begin{align*}R &= \Setabs{\tuple{n,m}}{n, m \in \Nat \text{ and }n < m}\\S &= \Setabs{\lVert n,m\rVert}{n, m \in \Nat \text{ and }n < m}.\end{align*}Since $R \neq S$, by extensionality, it is clear that they cannot\emph{both} be identical to the order relation on~$\Nat$. But it wouldjust be arbitrary, and hence a bit embarrassing, to claim that $R$rather than $S$ (or vice versa) \emph{is} the ordering relation, as amatter of fact. (This is a very simple instance of an argument againstset-theoretic reductionism which Benacerraf made famous in\citeyear{Benacerraf1965}. We will revisit it several times.)Second: if we think that \emph{every} relation should be identifiedwith a set, then the relation of set-membership itself, $\in$, shouldbe a particular set. Indeed, it would have to be the set$\Setabs{\tuple{x,y}}{x \in y}$. But does this set exist? GivenRussell's Paradox, it is a non-trivial claim that such a set exists.In fact, \oliflabeldef{cumul:::part}{the theory of sets which we develop in\olref[cumul][][]{part} will \emph{deny} the existence of thisset.\footnote{Skipping ahead, here is why. For reductio, suppose $I =\Setabs{\tuple{x,y}}{x \in y}$ exists. Then $\bigcup \bigcup I$ is theuniversal set, contradicting\olref[sfr][z][sep]{thm:NoUniversalSet}.}}{it is possible todevelop set theory in a rigorous way as an axiomatic theory, and thattheory will indeed deny the existence of this set.}So, even if some relations can be treated as sets, the relation ofset-membership will have to be a special case.Third: when we ``identify'' relations with sets, we said that we wouldallow ourselves to write $Rxy$ for $\tuple{x,y} \in R$. This is fine,provided that the membership relation, ``$\in$'', is treated \emph{as}a predicate. But if we think that ``$\in$'' stands for a certain kindof set, then the expression ``$\tuple{x,y} \in R$'' just consists ofthree singular terms which stand for sets: ``$\tuple{x,y}$'',``$\in$'', and ``$R$''. And such a list of names is no more capable ofexpressing a proposition than the nonsense string: ``the cup penholderthe table''. Again, even if some relations can be treated as sets, therelation of set-membership must be a special case. (This rollstogether a simple version of Frege's concept \emph{horse} paradox, anda famous objection that Wittgenstein once raised against Russell.)So where does this leave us? Well, there is nothing \emph{wrong} withour saying that the relations on the numbers are sets. We just have tounderstand the spirit in which that remark is made. We are not statinga metaphysical identity fact. We are simply noting that, in certaincontexts, we can (and will) \emph{treat} (certain) relations ascertain sets.\end{document}
content/sets-functions-relations/relations/relations-as-sets.tex
125 lines; SHA-256 412c6fa44ead94f076dfea7cd23f9e3cd748b08c1882dcb129b15f8efcf5c29c. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: relations-as-sets\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{set}\olsection{Relations as Sets}\begin{explain}In \olref[sfr][set][imp]{sec}, we mentioned some important sets:$\Nat$, $\Int$, $\Rat$, $\Real$. You will no doubt remember someinteresting relations between the !!{element}s of some of these sets.For instance, each of these sets has a completely standard \emph{orderrelation} on it. There is also the relation \emph{is identical with}that every object bears to itself and to no other thing. There aremany more interesting relations that we'll encounter, and even morepossible relations. Before we review them, though, we will start bypointing out that we can look at relations as a special sort of set.For this, recall two things from \olref[sfr][set][pai]{sec}. First,recall the notion of an \emph{ordered pair}: given $a$ and $b$, we canform~$\tuple{a, b}$. Importantly, the order of elements \emph{does}matter here. So if $a \neq b$ then $\tuple{a, b} \neq \tuple{b, a}$.(Contrast this with unordered pairs, i.e., $2$-element sets, where$\{a, b\}=\{b, a\}$.) Second, recall the notion of a \emph{Cartesianproduct}: if $A$ and $B$ are sets, then we can form~$A \times B$, theset of all pairs $\tuple{x, y}$ with $x \in A$ and $y \in B$. Inparticular, $A^{2}= A \times A$ is the set of all ordered pairsfrom~$A$.Now we will consider a particular relation on a set: the $<$-relationon the set~$\Nat$ of natural numbers. Consider the set of all pairs ofnumbers $\tuple{n, m}$ where $n<m$, i.e.,\[R=\Setabs{\tuple{n, m}}{n, m \in \Nat \text{ and } n<m}.\]There is a close connection between $n$ being less than $m$, and thepair $\tuple{n, m}$ being a member of $R$, namely:\[n<m\text{ iff }\tuple{n, m} \in R.\]Indeed, without any loss of information, we can consider the set $R$to \emph{be} the $<$-relation on $\Nat$.In the same way we can construct a subset of $\Nat^{2}$ for anyrelation between numbers. Conversely, given any set of pairs ofnumbers $S \subseteq \Nat^{2}$, there is a corresponding relationbetween numbers, namely, the relationship $n$ bears to $m$ if and onlyif $\tuple{n, m} \in S$. This justifies the following definition:\end{explain}\begin{defn}[Binary relation]A \emph{binary relation} on a set $A$ is a subset of~$A^{2}$. If $R\subseteq A^{2}$ is a binary relation on~$A$ and $x, y \in A$, wesometimes write $Rxy$ (or $xRy$) for $\tuple{x, y} \in R$.\end{defn}\begin{ex}\ollabel{relations}The set $\Nat^{2}$ of pairs of natural numbers can be listed in a2-dimensional matrix like this:\[\begin{array}{ccccc}\mathbf{\tuple{ 0,0 }} & \tuple{ 0,1 } &\tuple{ 0,2 } & \tuple{ 0,3 } & \ldots\\\tuple{ 1,0 } & \mathbf{\tuple{ 1,1 }} &\tuple{ 1,2 } & \tuple{ 1,3 } & \ldots\\\tuple{ 2,0 } & \tuple{ 2,1 } &\mathbf{\tuple{ 2,2 }} & \tuple{ 2,3 } & \ldots\\\tuple{ 3,0 } & \tuple{ 3,1 } & \tuple{ 3,2 } &\mathbf{\tuple{ 3,3 }} & \ldots\\\vdots & \vdots & \vdots & \vdots & \mathbf{\ddots}\end{array}\]We have put the diagonal, here, in bold, since the subset of $\Nat^2$consisting of the pairs lying on the diagonal, i.e.,\[\{\tuple{0,0 }, \tuple{ 1,1 }, \tuple{ 2,2 }, \dots\},\]is the \emph{identity relation on}~$\Nat$. (Since the identityrelation is popular, let's define $\Id{A}=\Setabs{\tuple{ x,x }}{x \inA}$ for any set $A$.) The subset of all pairs lying above thediagonal, i.e.,\[L = \{\tuple{ 0,1 },\tuple{ 0,2 },\ldots,\tuple{ 1,2 },\tuple{ 1,3 }, \dots, \tuple{ 2,3 }, \tuple{ 2,4 },\ldots\},\]is the \emph{less than} relation, i.e., $Lnm$ iff $n<m$. The subset ofpairs below the diagonal, i.e.,\[G=\{ \tuple{ 1,0 },\tuple{ 2,0 },\tuple{2,1 }, \tuple{ 3,0 },\tuple{ 3,1 },\tuple{ 3,2 }, \dots\},\]is the \emph{greater than} relation, i.e., $Gnm$ iff $n>m$. The unionof $L$ with $I$, which we might call $K=L\cup I$, is the \emph{lessthan or equal to} relation: $Knm$ iff $n \le m$. Similarly, $H=G \cupI$ is the \emph{greater than or equal to relation.} These relations$L$, $G$, $K$, and $H$ are special kinds of relations called\emph{orders}. $L$ and $G$ have the property that no number bears $L$or $G$ to itself (i.e., for all $n$, neither $Lnn$ nor $Gnn$).Relations with this property are called \emph{irreflexive}, and, ifthey also happen to be orders, they are called \emph{strict orders.}\end{ex}\begin{explain}Although orders and identity are important and natural relations, itshould be emphasized that according to our definition \emph{any}subset of $A^{2}$ is a relation on~$A$, regardless of how unnatural orcontrived it seems. In particular, $\emptyset$ is a relation on anyset (the \emph{empty relation}, which no pair of elements bears), and$A^{2}$~itself is a relation on~$A$ as well (one which every pairbears), called the \emph{universal relation}. But also something like$E=\Setabs{\tuple{n, m}}{n>5 \text{ or } m \times n \ge 34}$ counts asa relation.\end{explain}\begin{prob}List the !!{element}s of the relation $\subseteq$ on the set$\Pow{\{a, b, c\}}$.\end{prob}\end{document}
content/sets-functions-relations/relations/relations-complete.tex
28 lines; SHA-256 7e1363f3e757004246334478742e4199101dbb2551fac272462454cd40161e23. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations-complete\documentclass[../../../include/open-logic-chapter]{subfiles}\begin{document}\olchapter{sfr}{rel}{Relations}\olimport{relations-as-sets}\olimport{reflections}\olimport{special-properties}\olimport{equivalence-relations}\olimport{orders}\olimport{graphs}\olimport{trees}\olimport{operations}\OLEndChapterHook\end{document}
content/sets-functions-relations/relations/special-properties.tex
85 lines; SHA-256 f9bdfcb4c680ea58fdb209f0347c2f8055de96558caf69a26ec3ce8e1e7ce6a1. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: special-properties\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{prp}\olsection{Special Properties of Relations}\begin{intro}Some kinds of relations turn out to be so common that they have beengiven special names. For instance, $\le$ and~$\subseteq$ both relatetheir respective domains (say, $\Nat$ in the case of~$\le$ and$\Pow{A}$ in the case of~$\subseteq$) in similar ways. To get atexactly how these relations are similar, and how they differ, wecategorize them according to some special properties that relationscan have. It turns out that (combinations of) some of these specialproperties are especially important: orders and equivalence relations.\end{intro}\begin{defn}[Reflexivity]A relation $R \subseteq A^2$ is \emph{reflexive} iff, for every $x \inA$, $Rxx$.\end{defn}\begin{defn}[Transitivity]A relation $R \subseteq A^2$ is \emph{transitive} iff, whenever $Rxy$and $Ryz$, then also $Rxz$.\end{defn}\begin{defn}[Symmetry]A relation~$R \subseteq A^2$ is \emph{symmetric} iff, whenever$Rxy$, then also~$Ryx$.\end{defn}\begin{defn}[Anti-symmetry]A relation~$R \subseteq A^2$ is \emph{anti-sym\-met\-ric} iff, whenever both$Rxy$ and $Ryx$, then $x=y$ (or, in other words: if $x\neq y$ theneither $\lnot Rxy$ or $\lnot Ryx$).\end{defn}\begin{explain}In a symmetric relation, $Rxy$ and $Ryx$ always hold together, orneither holds. In an anti-symmetric relation, the only way for $Rxy$and $Ryx$ to hold together is if $x = y$. Note that this does not\emph{require} that $Rxy$ and $Ryx$ holds when $x = y$, only that itisn't ruled out. So an anti-symmetric relation can be reflexive, butit is not the case that every anti-symmetric relation isreflexive. Also note that being anti-symmetric and merely not beingsymmetric are different conditions. In fact, a relation can be bothsymmetric and anti-symmetric at the same time (e.g., the identityrelation is).\end{explain}\begin{defn}[Connectivity]A relation $R \subseteq A^2$ is \emph{connected} if for all $x,y\inA$, if $x \neq y$, then either $Rxy$ or~$Ryx$.\end{defn}\begin{prob}Give examples of relations that are (a) reflexive and symmetric butnot transitive, (b) reflexive and anti-symmetric, (c) anti-symmetric,transitive, but not reflexive, and (d) reflexive, symmetric, andtransitive. Do not use relations on numbers or sets.\end{prob}\begin{defn}[Irreflexivity]A relation $R \subseteq A^2$ is called \emph{irreflexive} if, for all $x \inA$, not $Rxx$.\end{defn}\begin{defn}[Asymmetry]A relation $R \subseteq A^2$ is called \emph{asymmetric} if for no pair $x,y\inA$ we have both $Rxy$ and~$Ryx$.\end{defn}Note that if $A \neq \emptyset$, then no irreflexive relation on~$A$is reflexive and every asymmetric relation on~$A$ is alsoanti-symmetric. However, there are $R \subseteq A^2$ that are notreflexive and also not irreflexive, and there are anti-symmetricrelations that are not asymmetric.\end{document}
content/sets-functions-relations/relations/trees.tex
130 lines; SHA-256 57cc56ee55506aa19e7be6129d2cad6b8635fd2d6407399d4f774782f2cdd588. Open the preserved source file.
% Part: sets-functions-relations% Chapter: relations% Section: trees\documentclass[../../../include/open-logic-section]{subfiles}\begin{document}\olfileid{sfr}{rel}{tre}\olsection{Trees}A particular kind of partial order which plays an important role inall parts of logic is a \emph{tree}. Finite trees occur in elementaryparts of logic: for example, !!{formula}s can be understood in termsof their decomposition into a syntax tree, while !!{derivation}s inmany !!{derivation} systems also take the form of finite trees.%Infinite trees appear already in the proof of the completenesstheorems for propositional and first-order logic, and are usedthroughout mathematical logic.The set-theoretic concept of a tree is closely related to the notionof a tree in graph theory. Here is a picture of a (finite) tree:\begin{center}\begin{tikzpicture}[nodes={draw, circle}, -]\node{$r$} [grow'=up]child { node {$a$}child { node {$c$} }child { node {$d$} }child { node {$e$} }}child { node {$b$} };\end{tikzpicture}\end{center}The lowermost node~$r$ is the root. Every node other than $r$ hasexactly one parent node immediately below it. We can think of the relationa node~$x$ stands in to a node~$y$ if $y$ can be reached from~$x$ byfollowing edges upwards as $x$ being an \emph{ancestor} of~$y$.The ancestor relation in a tree is a strict partial order. Thismotivates the set-theoretic definition. To state it we need twoconcepts. A \emph{least element} in a set~$A$ partially orderedby~$\le$ is !!a{element} $x \in A$ such that for all $y \in A$ we havethat~$x \le y$. A set is \emph{well-ordered} by~$\le$ if every one ofits non-empty subsets has a least element.\begin{defn}[Tree]A \emph{tree} is a pair $T = \tuple{A, \le}$ such that $A$ is a setand $\le$ is a partial order on~$A$ with a unique least element$r \in A$ (called the \emph{root}) such that for all $x \in A$,the set $\Setabs{y}{y \le x}$ is well-ordered by~$\le$.\end{defn}\begin{defn}[Successors]Suppose $T = \tuple{A, \le}$ is a tree.If $x,y \in A$, $x < y$, and there is no $z \in A$ such that$x < z < y$, then we say that $y$ is a \emph{successor} of~$x$.\end{defn}The successors of $x \in A$ are also called its \emph{children}. If$y$ is a successor of~$x$, then we call $x$ the \emph{predecessor} or\emph{parent} of~$y$.\begin{prop}If $\tuple{A,\le}$ is a tree, then every $x \in A$ other than the roothas at most one predecessor.\end{prop}\begin{proof}Suppose $y_1 < x$ and $y_2 < x$ and $y_1 \neq y_2$. Then $\{y_1,y_2\} \subseteq \Setabs{z}{z<x}$. Since $\Setabs{z}{z<x}$ iswell-ordered by~$\le$, its subset $\{y_1, y_2\}$ has a leastelement, which obviously must be either $y_1$ or~$y_2$. So either$y_1 \le y_2$ or $y_2 \le y_1$. We assumed that $y_1 \neq y_2$, soactually either $y_1 < y_2$ or $y_2 < y_1$. Since we assumed that$y_1 < x$ and $y_2 < x$, we furthermore have that either $y_1 < y_2< x$ or $y_2 < y_1 < x$. So $y_1$ and $y_2$ cannot both bepredecessors of~$x$.\end{proof}\begin{defn}A tree $T = \tuple{A, \le}$ is said to be \emph{infinite} if $A$ is aninfinite set, and \emph{finite} otherwise. If $T$ is such that every$x \in A$ has only finitely many successors, then we say that $T$ is\emph{finitely branching}.\end{defn}\begin{defn}[Branches]Given a tree $T = \tuple{A, \le}$, a \emph{branch} of~$T$ is amaximal chain in~$T$, i.e., a set $B \subseteq A$ such thatfor any $x, y \in B$ either $x \le y$ or $y \le x$, and for any$z \in X \setminus B$ there exists $u \in B$ such that neither$z \le u$ nor $u \le z$.%We use $[T]$ to denote the set of all branches of $T$.\end{defn}\begin{ex}A classic example of a finitely branching tree is the\emph{infinite binary tree} of finite sequences of $0$s and~$1$s,sometimes denoted $\{0,1\}^*$ or~$\Bin^*$, ordered by the extensionrelation $\sqsubseteq$ (e.g., $101 \sqsubseteq 101101$).Since any binary string can always be extended by addinga $0$ or a $1$ on the end, this tree contains infinitelymany elements: every element~$s$ has exactly two successors, $s0$ and~$s1$. Its root is the empty sequence $\emptyseq$.\end{ex}\begin{ex}Slightly more generally, the set of finite sequences of naturalnumbers~$\Nat^*$ with the extension relation~$\sqsubseteq$ is also atree. It is obviously not finitely branching: every $s \in \Nat^*$ hasinfinitely many successors~$sn$, one for every $n \in \Nat$. Every $A\subseteq \Nat^*$ which is closed under~$\sqsubseteq$ is a\emph{subtree} of~$\Nat^*$. (That is, $A$ is such that if $s \in A$and $s' \sqsubseteq s$, then also $s' \in A$.) All finite trees can berepresented as finite subtrees of~$\Nat^*$.\end{ex}\begin{prop}[K\H{o}nig's lemma]If $T = \tuple{A,\le}$ is a finitely branching infinite tree,then $T$ has an infinite branch.\end{prop}A special case of K\H{o}nig's lemma widely used in computabilitytheory, known as \emph{weak K\H{o}nig's lemma}, is the following: anyinfinite subtree of $\{0,1\}^*$ has an infinite branch.\end{document}