Reading preferences

Optional display controls need JavaScript. All reading content and navigation work without it.

How to use Read

Read follows the source chapter in ordinary reading order. Mathematics remains native MathML so a compatible screen reader or braille system can navigate its internal structure. Each small source link returns to the exact source line.

Relations as Sets

Definition: Binary relation

A binary relation on a set Asource 56 is a subset of A2source 56. If RA2source 56 is a binary relation on Asource 57 and x,yAsource 57, we sometimes write Rxysource 58 (or xRysource 58) for x,yRsource 58.

source 55

Example: Relations on the natural numbers

The set N2source 63 of pairs of natural numbers can be listed in a 2-dimensional matrix like this: 0,00,10,20,31,01,11,21,32,02,12,22,33,03,13,23,3source 65 We have put the diagonal, here, in bold, since the subset of N2source 78 consisting of the pairs lying on the diagonal, i.e., {0,0,1,1,2,2,},source 80 is the identity relation on Nsource 83. (Since the identity relation is popular, let's define IdA={x,x:xA}source 84 for any set Asource 85.) The subset of all pairs lying above the diagonal, i.e., L={0,1,0,2,,1,2,1,3,,2,3,2,4,},source 87 is the less than relation, i.e., Lnmsource 91 iff n<msource 91. The subset of pairs below the diagonal, i.e., G={1,0,2,0,2,1,3,0,3,1,3,2,},source 93 is the greater than relation, i.e., Gnmsource 97 iff n>msource 97. The union of Lsource 98 with Isource 98, which we might call K=LIsource 98, is the less than or equal to relation: Knmsource 99 iff nmsource 99. Similarly, H=GIsource 99 is the greater than or equal to relation. These relations Lsource 101, Gsource 101, Ksource 101, and Hsource 101 are special kinds of relations called orders. Lsource 102 and Gsource 102 have the property that no number bears Lsource 102 or Gsource 103 to itself (i.e., for all nsource 103, neither Lnnsource 103 nor Gnnsource 103). Relations with this property are called irreflexive, and, if they also happen to be orders, they are called strict orders.

source 61

Exercise: List the subset relation on a power set

List the elements of the relation source 121 on the set ({a,b,c})source 122.

source 120

Philosophical Reflections

In the Relations as Sets section, we defined relations as certain sets. We should pause and ask a quick philosophical question: what is such a definition doing? It is extremely doubtful that we should want to say that we have discovered some metaphysical identity facts; that, for example, the order relation on Nsource 16 turned out to be the set R={n,m:n,mN and n<m}source 17 that we defined in the Relations as Sets section. Here are three reasons why.

First: in the ordered-pair definition, we defined a,b={{a},{a,b}}source 21. Consider instead the definition a,b={{b},{a,b}}=b,asource 22. When absource 23, we have that a,ba,bsource 24. But we could equally have regarded a,bsource 25 as our definition of an ordered pair, rather than a,bsource 26. Both definitions would have worked equally well. So now we have two equally good candidates to “be” the order relation on the natural numbers, namely: R={n,m:n,mN and n<m}S={n,m:n,mN and n<m}.source 29 Since RSsource 33, by extensionality, it is clear that they cannot both be identical to the order relation on Nsource 34. But it would just be arbitrary, and hence a bit embarrassing, to claim that Rsource 35 rather than Ssource 36 (or vice versa) is the ordering relation, as a matter of fact. (This is a very simple instance of an argument against set-theoretic reductionism which Benacerraf made famous in 1965. We will revisit it several times.)

Second: if we think that every relation should be identified with a set, then the relation of set-membership itself, source 42, should be a particular set. Indeed, it would have to be the set {x,y:xy}source 44. But does this set exist? Given Russell's Paradox, it is a non-trivial claim that such a set exists. In fact, it is possible to develop set theory in a rigorous way as an axiomatic theory, and that theory will indeed deny the existence of this set. So, even if some relations can be treated as sets, the relation of set-membership will have to be a special case.

Third: when we “identify” relations with sets, we said that we would allow ourselves to write Rxysource 58 for x,yRsource 58. This is fine, provided that the membership relation, “source 59”, is treated as a predicate. But if we think that “source 60” stands for a certain kind of set, then the expression “x,yRsource 61” just consists of three singular terms which stand for sets: “x,ysource 62”, “source 63”, and “Rsource 63”. And such a list of names is no more capable of expressing a proposition than the nonsense string: “the cup penholder the table”. Again, even if some relations can be treated as sets, the relation of set-membership must be a special case. (This rolls together a simple version of Frege's concept horse paradox, and a famous objection that Wittgenstein once raised against Russell.)

So where does this leave us? Well, there is nothing wrong with our saying that the relations on the numbers are sets. We just have to understand the spirit in which that remark is made. We are not stating a metaphysical identity fact. We are simply noting that, in certain contexts, we can (and will) treat (certain) relations as certain sets.

Special Properties of Relations

Definition: Reflexivity

A relation RA2source 24 is reflexive iff, for every xAsource 24, Rxxsource 25.

source 23

Definition: Transitivity

A relation RA2source 29 is transitive iff, whenever Rxysource 29 and Ryzsource 30, then also Rxzsource 30.

source 28

Definition: Symmetry

A relation RA2source 34 is symmetric iff, whenever Rxysource 35, then also Ryxsource 35.

source 33

Definition: Anti-symmetry

A relation RA2source 39 is anti-symmetric iff, whenever both Rxysource 40 and Ryxsource 40, then x=ysource 40 (or, in other words: if xysource 40 then either ¬Rxysource 41 or ¬Ryxsource 41).

source 38

Definition: Connectivity

A relation RA2source 58 is connected if for all x,yAsource 58, if xysource 59, then either Rxysource 59 or Ryxsource 59.

source 57

Exercise: Compare special properties of relations

Give examples of relations that are (a) reflexive and symmetric but not transitive, (b) reflexive and anti-symmetric, (c) anti-symmetric, transitive, but not reflexive, and (d) reflexive, symmetric, and transitive. Do not use relations on numbers or sets.

source 62

Definition: Irreflexivity

A relation RA2source 70 is called irreflexive if, for all xAsource 70, not Rxxsource 71.

source 69

Definition: Asymmetry

A relation RA2source 75 is called asymmetric if for no pair x,yAsource 75 we have both Rxysource 76 and Ryxsource 76.

source 74

Note that if Asource 79, then no irreflexive relation on Asource 79 is reflexive and every asymmetric relation on Asource 80 is also anti-symmetric. However, there are RA2source 81 that are not reflexive and also not irreflexive, and there are anti-symmetric relations that are not asymmetric.

Equivalence Relations

The identity relation on a set is reflexive, symmetric, and transitive. Relations Rsource 14 that have all three of these properties are very common.

Definition: Equivalence relation

A relation RA2source 18 that is reflexive, symmetric, and transitive is called an equivalence relation. elements xsource 19 and ysource 20 of Asource 20 are said to be Rsource 20-equivalent if Rxysource 20.

source 17

Equivalence relations give rise to the notion of an equivalence class. An equivalence relation “chunks up” the domain into different partitions. Within each partition, all the objects are related to one another; and no objects from different partitions relate to one another. Sometimes, it's helpful just to talk about these partitions directly. To that end, we introduce a definition:

Definition: Equivalence classes and quotient

Let RA2source 32 be an equivalence relation. For each xAsource 32, the equivalence class of xsource 33 in Asource 33 is the set [x]R={yA:Rxy}source 33. The quotient of Asource 34 under Rsource 34 is A/R={[x]R:xA}source 35, i.e., the set of these equivalence classes.

source 31

The next result vindicates the definition of an equivalence class, in proving that the equivalence classes are indeed the partitions of Asource 40:

Proposition: Equality of equivalence classes

If RA2source 43 is an equivalence relation, then Rxysource 43 iff [x]R=[y]Rsource 44.

source 42

Proof

For the left-to-right direction, suppose Rxysource 48, and let z[x]Rsource 48. By definition, then, Rxzsource 49. Since Rsource 49 is an equivalence relation, Ryzsource 50. (Spelling this out: as Rxysource 50 and Rsource 50 is symmetric we have Ryxsource 51, and as Rxzsource 51 and Rsource 51 is transitive we have Ryzsource 52.) So z[y]Rsource 52. Generalising, [x]R[y]Rsource 53. But exactly similarly, [y]R[x]Rsource 54. So [x]R=[y]Rsource 54, by extensionality.

For the right-to-left direction, suppose [x]R=[y]Rsource 57. Since Rsource 58 is reflexive, Ryysource 58, so y[y]Rsource 58. Thus also y[x]Rsource 59 by the assumption that [x]R=[y]Rsource 60. So Rxysource 60.

End of proof.

Example: Congruence modulo n

A nice example of equivalence relations comes from modular arithmetic. For any asource 65, bsource 65, and nZ+source 65, say that anbsource 65 iff dividing asource 66 by nsource 66 gives the same remainder as dividing bsource 66 by nsource 66. (Somewhat more symbolically: anbsource 67 iff, for some kZsource 67, ab=knsource 68.) Now, nsource 68 is an equivalence relation, for any nsource 69. And there are exactly nsource 69 distinct equivalence classes generated by nsource 70; that is, N/nsource 70 has nsource 71 elements. These are: the set of numbers divisible by nsource 71 without remainder, i.e., [0]nsource 72; the set of numbers divisible by nsource 73 with remainder 1source 73, i.e., [1]nsource 73; …; and the set of numbers divisible by nsource 74 with remainder n1source 74, i.e., [n1]nsource 75.

source 63

Exercise: Congruence modulo n

Show that nsource 79 is an equivalence relation, for any nZ+source 79, and that N/nsource 80 has exactly nsource 80 members.

source 78

Orders

Definition: Preorder

A relation which is both reflexive and transitive is called a preorder.

source 22

Definition: Partial order

A preorder which is also anti-symmetric is called a partial order.

source 27

Definition: Linear order

A partial order which is also connected is called a total order or linear order.

source 32

Example: Hierarchy of order types

Every linear order is also a partial order, and every partial order is also a preorder, but the converses don't hold. The universal relation on Asource 40 is a preorder, since it is reflexive and transitive. But, if Asource 41 has more than one element, the universal relation is not anti-symmetric, and so not a partial order.

source 37

Example: No-longer-than preorder

Consider the no longer than relation source 46 on Bsource 47: xysource 47 iff len(x)len(y)source 47. This is a preorder (reflexive and transitive), and even connected, but not a partial order, since it is not anti-symmetric. For instance, 0110source 49 and 1001source 50, but 0110source 50.

source 45

Example: Subset partial order

An important partial order is the relation source 54 on a set of sets. This is not in general a linear order, since if absource 55 and we consider ({a,b})={,{a},{b},{a,b}}source 56, we see that {a}{b}source 57 and {a}{b}source 57 and {b}{a}source 57.

source 53

Example: Divisibility as an order

The relation of divisibility without remainder gives us a partial order which isn't a linear order. For integers nsource 63 and msource 63, we write nmsource 64 to mean nsource 64 (evenly) divides msource 64, i.e., iff there is some integer ksource 65 so that m=knsource 65. On Nsource 65, this is a partial order, but not a linear order: for instance, 23source 66 and also 32source 66. Considered as a relation on Zsource 67, divisibility is only a preorder since it is not anti-symmetric: 11source 68 and 11source 68 but 11source 69.

source 61

Example: Extension order on finite sequences

The extension relation on a set of sequences Asource 73 is the following: sssource 74 iff s=Λsource 74 (the empty sequence), s=ssource 75, or s=s1,,snsource 75 and s=s1,,sn,sn+1,,smsource 75. If sssource 76 we also say that ssource 77 is an initial segment of ssource 77. The extension relation on Asource 78 is a partial order but not a linear order, e.g., if absource 79, then abbasource 79 and baabsource 79.

source 72

Definition: Strict order

A strict order is a relation which is irreflexive, asymmetric, and transitive.

source 82

Definition: Strict linear order

A strict order which is also connected is called a strict total order or strict linear order.

source 87

Example: Strict and non-strict orders

source 93 is the linear order corresponding to the strict linear order <source 94. source 94 is the partial order corresponding to the strict order source 95.

source 92

Any strict order Rsource 98 on Asource 98 can be turned into a partial order by adding the diagonal IdAsource 99, i.e., adding all the pairs x,xsource 99. (This is called the reflexive closure of Rsource 100.) Conversely, starting from a partial order, one can get a strict order by removing IdAsource 102. These next two results make this precise.

Proposition: Add identity to a strict order

If Rsource 105 is a strict order on Asource 105, then R+=RIdAsource 105 is a partial order. Moreover, if Rsource 106 is a strict linear order, then R+source 106 is a linear order.

source 104

Proof

Suppose Rsource 111 is a strict order, i.e., RA2source 111 and Rsource 111 is irreflexive, asymmetric, and transitive. Let R+=RIdAsource 112. We have to show that R+source 113 is reflexive, anti-symmetric, and transitive.

R+source 115 is clearly reflexive, since x,xIdAR+source 115 for all xAsource 116.

To show R+source 118 is anti-symmetric, suppose for reductio that R+xysource 118 and R+yxsource 119 but xysource 119. Since x,yRIdAsource 119, but x,yIdAsource 120, we must have x,yRsource 120, i.e., Rxysource 121. Similarly, Ryxsource 121. But this contradicts the assumption that Rsource 122 is asymmetric.

To establish transitivity, suppose that R+xysource 124 and R+yzsource 124. If both x,yRsource 125 and y,zRsource 125, then x,zRsource 125 since Rsource 126 is transitive. Otherwise, either x,yIdAsource 126, i.e., x=ysource 127, or y,zIdAsource 127, i.e., y=zsource 127. In the first case, we have that R+yzsource 128 by assumption, x=ysource 128, hence R+xzsource 129. Similarly in the second case. In either case, R+xzsource 129, thus, R+source 130 is also transitive.

Concerning the “moreover” clause, suppose that Rsource 132 is also connected. So for all xysource 133, either Rxysource 133 or Ryxsource 133, i.e., either x,yRsource 134 or y,xRsource 134. Since RR+source 134, this remains true of R+source 135, so R+source 135 is connected as well.

End of proof.

Proposition: Remove identity from a partial order

If Rsource 139 is a partial order on Asource 139, then R=RIdAsource 139 is a strict order. Moreover, if Rsource 140 is a linear order, then Rsource 140 is a strict linear order.

source 138

Proof

This is left as an exercise.

End of proof.

Exercise: Removing identity from a partial order

Give a proof of the proposition turning a partial order into a strict order.

source 148

The following simple result establishes that strict linear orders satisfy an extensionality-like property:

Proposition: Strict orders determined by predecessors

If <source 156 is a strict linear order on Asource 156, then: (a,bA)((xA)(x<ax<b)a=b).source 157

source 155

Proof

Suppose (xA)(x<ax<b)source 163. If a<bsource 163, then a<asource 163, contradicting the fact that <source 164 is irreflexive; so absource 164. Exactly similarly, basource 165. So a=bsource 165, as <source 165 is connected.

End of proof.

Graphs

A graph is a diagram in which points—called “nodes” or “vertices” (plural of “vertex”)—are connected by edges. Graphs are 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 of various kinds to abstract structures such as the possible outcomes of decisions. There are many different kinds of graphs in the literature which differ, e.g., according to whether the edges are directed or not, have labels or not, whether there can be edges from a node to the same node, multiple edges between the same nodes, etc. Directed graphs have a special connection to relations.

Definition: Directed graph

A directed graph G=V,Esource 25 is a set of vertices Vsource 26 and a set of edges EV2source 26.

source 24

Example: Directed graphs differing by an isolated vertex

The graph V,Esource 44 with V={1,2,3,4}source 44 and E={1,1,1,2,1,3,2,3}source 44 looks like this:

two directed graphs. The first has vertices one, two, three, and four, with edges from one to one, from one to two, from one to three, and from two to three; vertex four is isolated. This is a different graph from the ordered pair capital V prime, capital E, where capital V prime equals the set containing one, two, and three. The second graph has vertices one, two, and three, with the same four directed edges.source 47
Directed graph on vertices 1, 2, 3, and 4

A directed graph with edges from 1 to itself, from 1 to 2, from 1 to 3, and from 2 to 3. Vertex 4 is isolated.

Directed graph on vertices 1, 2, 3, and 4 A directed graph with edges from 1 to itself, from 1 to 2, from 1 to 3, and from 2 to 3. Vertex 4 is isolated. 1 2 34
Vertices
1, 2, 3, 4
Directed edges
1 to 1; 1 to 2; 1 to 3; 2 to 3
Isolated vertex
4

source 48

Directed graph on vertices 1, 2, and 3

A directed graph with edges from 1 to itself, from 1 to 2, from 1 to 3, and from 2 to 3.

Directed graph on vertices 1, 2, and 3 A directed graph with edges from 1 to itself, from 1 to 2, from 1 to 3, and from 2 to 3. 1 2 3
Vertices
1, 2, 3
Directed edges
1 to 1; 1 to 2; 1 to 3; 2 to 3
Isolated vertices
None.

source 60

source 43

Exercise: Draw the less-than-or-equal graph

Consider the less-than-or-equal-to relation source 73 on the set {1,2,3,4}source 73 as a graph and draw the corresponding diagram.

source 72

Trees

A particular kind of partial order which plays an important role in all parts of logic is a tree. Finite trees occur in elementary parts of logic: for example, formulas can be understood in terms of their decomposition into a syntax tree, while derivations in many derivation systems also take the form of finite trees.

Infinite trees appear already in the proof of the completeness theorems for propositional and first-order logic, and are used throughout mathematical logic.

The set-theoretic concept of a tree is closely related to the notion of a tree in graph theory. Here is a picture of a (finite) tree:

Finite rooted tree with root r

The lowermost root r has children a and b. Node a has children c, d, and e. Nodes b, c, d, and e are leaves.

Finite rooted tree with root r The lowermost root r has children a and b. Node a has children c, d, and e. Nodes b, c, d, and e are leaves. rabcde

Edges: r to a; r to b; a to c; a to d; a to e.

source 26

The lowermost node rsource 37 is the root. Every node other than rsource 37 has exactly one parent node immediately below it. We can think of the relation a node xsource 39 stands in to a node ysource 39 if ysource 39 can be reached from xsource 39 by following edges upwards as xsource 40 being an ancestor of ysource 40.

The ancestor relation in a tree is a strict partial order. This motivates the set-theoretic definition. To state it we need two concepts. A least element in a set Asource 44 partially ordered by source 45 is an element xAsource 45 such that for all yAsource 45 we have that xysource 46. A set is well-ordered by source 46 if every one of its non-empty subsets has a least element.

Definition: Tree

A tree is a pair T=A,source 50 such that Asource 50 is a set and source 51 is a partial order on Asource 51 with a unique least element rAsource 52 (called the root) such that for all xAsource 52, the set {y:yx}source 53 is well-ordered by source 53.

source 49

Definition: Successors

Suppose T=A,source 57 is a tree. If x,yAsource 58, x<ysource 58, and there is no zAsource 58 such that x<z<ysource 59, then we say that ysource 59 is a successor of xsource 59.

source 56

The successors of xAsource 62 are also called its children. If ysource 63 is a successor of xsource 63, then we call xsource 63 the predecessor or parent of ysource 64.

Proposition: A tree node has at most one predecessor

If A,source 67 is a tree, then every xAsource 67 other than the root has at most one predecessor.

source 66

Proof

Suppose y1<xsource 72 and y2<xsource 72 and y1y2source 72. Then {y1,y2}{z:z<x}source 72. Since {z:z<x}source 73 is well-ordered by source 74, its subset {y1,y2}source 74 has a least element, which obviously must be either y1source 75 or y2source 75. So either y1y2source 76 or y2y1source 76. We assumed that y1y2source 76, so actually either y1<y2source 77 or y2<y1source 77. Since we assumed that y1<xsource 78 and y2<xsource 78, we furthermore have that either y1<y2<xsource 78 or y2<y1<xsource 79. So y1source 79 and y2source 79 cannot both be predecessors of xsource 80.

End of proof.

Definition: Finite and finitely branching trees

A tree T=A,source 84 is said to be infinite if Asource 84 is an infinite set, and finite otherwise. If Tsource 85 is such that every xAsource 86 has only finitely many successors, then we say that Tsource 86 is finitely branching.

source 83

Definition: Branches

Given a tree T=A,source 91, a branch of Tsource 91 is a maximal chain in Tsource 92, i.e., a set BAsource 92 such that for any x,yBsource 93 either xysource 93 or yxsource 93, and for any zXBsource 94 there exists uBsource 94 such that neither zusource 95 nor uzsource 95.

We use [T]source 97 to denote the set of all branches of Tsource 97.

source 90

Example: Infinite binary tree

A classic example of a finitely branching tree is the infinite binary tree of finite sequences of 0source 102s and 1source 102s, sometimes denoted {0,1}source 103 or Bsource 103, ordered by the extension relation source 104 (e.g., 101101101source 104). Since any binary string can always be extended by adding a 0source 106 or a 1source 106 on the end, this tree contains infinitely many elements: every element ssource 107 has exactly two successors, s0source 107 and s1source 107. Its root is the empty sequence Λsource 107.

source 100

Example: Tree of finite natural-number sequences

Slightly more generally, the set of finite sequences of natural numbers Nsource 112 with the extension relation source 112 is also a tree. It is obviously not finitely branching: every sNsource 113 has infinitely many successors snsource 114, one for every nNsource 114. Every ANsource 114 which is closed under source 115 is a subtree of Nsource 116. (That is, Asource 116 is such that if sAsource 116 and sssource 117, then also sAsource 117.) All finite trees can be represented as finite subtrees of Nsource 118.

source 110

Proposition: König's lemma

If T=A,source 122 is a finitely branching infinite tree, then Tsource 123 has an infinite branch.

source 121

A special case of König's lemma widely used in computability theory, known as weak König's lemma, is the following: any infinite subtree of {0,1}source 128 has an infinite branch.

Operations on Relations

It is often useful to modify or combine relations. In the proposition turning a strict order into a partial order, we considered the union of relations, which is just the union of two relations considered as sets of pairs. Similarly, in the proposition turning a partial order into a strict order, we considered the relative difference of relations. Here are some other operations we can perform on relations.

Definition: Inverse, product, restriction, and application

Let Rsource 20, Ssource 20 be relations, and Asource 20 be any set.

The inverse of Rsource 22 is R1={y,x:x,yR}source 22.

The relative product of Rsource 25 and Ssource 25 is (RS)={x,z:y(RxySyz)}source 25.

The restriction of Rsource 28 to Asource 28 is RA=RA2source 28.

The application of Rsource 31 to Asource 31 is R[A]={y:(xA)Rxy}source 31

source 19

Example: Operations on the integer successor relation

Let SZ2source 36 be the successor relation on Zsource 36, i.e., S={x,yZ2:x+1=y}source 37, so that Sxysource 37 iff x+1=ysource 37.

S1source 39 is the predecessor relation on Zsource 39, i.e., {x,yZ2:x1=y}source 40.

SSsource 42 is {x,yZ2:x+2=y}source 43

SNsource 45 is the successor relation on Nsource 45.

S[{1,2,3}]source 47 is {2,3,4}source 47.

source 35

Definition: Transitive closure

Let RA2source 50 be a binary relation.

The transitive closure of Rsource 52 is R+=0<nNRnsource 52, where we recursively define R1=Rsource 53 and Rn+1=RnRsource 53.

The reflexive transitive closure of Rsource 56 is R=R+IdAsource 56.

source 50

Example: Closure of the integer successor relation

Take the successor relation SZ2source 61. S2xysource 61 iff x+2=ysource 61, S3xysource 62 iff x+3=ysource 62, etc. So S+xysource 62 iff x+n=ysource 62 for some n1source 63. In other words, S+xysource 63 iff x<ysource 63, and Sxysource 63 iff xysource 63.

source 60

Exercise: Transitivity of the transitive closure

Show that the transitive closure of Rsource 68 is in fact transitive.

source 67