BACK Mascot image.

MA0 1

Introduction to University Mathematics (Proofs)

Every lesson so far, in one document · 10 chapters

back to the contents

Lesson 1

Introduction to Logic

Taught

Symbols, Logic and Language

Logic is the language of mathematics. It deals with statements that are either true or false, and it fixes the meaning of expressions that are ambiguous in ordinary language, such as “if … then,” “or,” and “and.”

Early Greek philosophers, notably Aristotle and Chrysippus, laid the initial formal foundations but did not make its semantics precise. It was not until the work of modern mathematicians such as Leibniz (1666), Boole (1847) and De Morgan (1847) that propositional logic was formalised.

This work introduced formal languages, variables, operators, axioms, logical inference and proof in the form used today.

Syntax and Semantics

Because logic is the formal language of mathematics, it has two aspects. The rules for how symbols may be combined are its syntax, while the meaning behind a particular arrangement of those symbols is its semantics.

In mathematics, we refer to objects by giving them names. A variable is a symbol that stands in for an object that has not yet been specified. We assign a name to a particular object using the assignment operator =def\defeq. For example, writing x=def5x \defeq 5 assigns the value 55 to the variable xx. We can similarly define the golden ratio as

ϕ=def1+52.\phi \defeq \frac{1+\sqrt{5}}{2}.

The objects and variables within an expression are its terms. For instance, 55, x+2x + 2, and b2−4ac\sqrt{b^2 - 4ac} are all distinct terms.

Remark (On Notation).

Variables are typically denoted using single Latin or Greek letters. Common choices include:

  • Lowercase: a,b,c,i,j,k,m,n,p,q,x,y,za, b, c, i, j, k, m, n, p, q, x, y, z
  • Uppercase: A,B,C,D,M,N,P,Q,R,X,Y,ZA, B, C, D, M, N, P, Q, R, X, Y, Z
  • Greek: α,β,γ,δ,ϵ,θ,λ,μ,π,σ,τ,ϕ,ω\alpha, \beta, \gamma, \delta, \epsilon, \theta, \lambda, \mu, \pi, \sigma, \tau, \phi, \omega

Propositions and Truth Values

Mathematics, in its most basic form, is the practice of assigning truth to well-defined statements; it differs from other sciences in that its results are proven rigorously, as opposed to being hypothesized and then “confirmed” via experiements.

For these notes, most of our work amounts to taking a collection of statements which we already know to be true and using them to establish newer, more complex ones, or formulating statements whose truth or falsity we wish to determine. If we were to encounter a falsity, we would have to demonstrate that it is indeed false; so, we begin with the logic that connects what we know to what we wish to know.

The statements mathematicians study are called logical or mathematical statements or propositions, which we define as follows:

Definition 1.1 (Proposition).

A proposition is a grammatically correct declarative sentence that has a definite truth value.

By “grammatically correct,” we just mean that the words and symbols follow the rules of English (or any language you speak), and make sense.

Definition 1.2 (Truth Value).

The truth value of a proposition indicates whether the proposition is true or false. We abstract away the specific content of a statement to focus solely on its logical status, denoting ‘true’ with the symbol ⊤\top (read “top”) and ‘false’ with the symbol ⊥\bot (read “bot” or “bottom”).

The foundation of classical logic rests on the principle of bivalence, which states that every proposition is either true or false, but not both.

Example 1.3.

Some basic examples include:

  1. 2+3=52 + 3 = 5. (Truth value: ⊤\top)
  2. The integer 7 is even. (Truth value: ⊥\bot)
  3. For any real number xx, x2≥0x^2 \geq 0. (Truth value: ⊤\top)
  4. Every even integer greater than 2 can be written as the sum of two prime numbers. (Truth value: unknown)
  5. The Earth is round. (Truth value: ⊤\top)

Example 4 is something to note: by the principle of bivalence, a sentence need not have a known truth value to qualify as a proposition; all that matters is that it makes logical sense to assign one; in fact, although the truth value of many propositions remains unknown, they are still valid propositions.

Remark.

Propositions like Example 4 are called conjectures, with Example 4 being known as the Goldbach Conjecture; in general, a conjecture is a claim believed to be true but which has not yet been proved or disproved.

By the principle of bivalence, we also see that many mathematical expressions and sentences are not propositions because they lack a definite truth value — imperative sentences (commands) and interrogative sentences (questions), for example, are naturally excluded.

Example 1.4.

The following are not propositions:

  1. x2−9x^2 - 9. (This is a term. Its value depends on xx, but it is not a complete sentence capable of carrying a truth value.)
  2. Solve the equation x2−9=0x^2 - 9 = 0. (An imperative command.)
  3. Is π\pi a rational number? (An interrogative question.)
  4. x>5x > 5. (This is something called an open sentence, but its truth value depends on the unspecified variable xx. It is a predicate, which will be addressed in later sections.)

Problem 1.1.

Suppose we say “Every even number greater than 2 can be written as the sum of two primes.” Is this a proposition?

Semantically Void and Self-Contradictory Sentences

Consider the following sentence: “The theory of relativity eats breakfast loudly.” Although it possesses a subject, verb, and adverb, the problem is that a scientific theory is an abstract concept which cannot eat; thus, because it describes a nonsensical scenario, there is no sensible way to assign a truth value to it — assigning ⊤\top is absurd, while assigning ⊥\bot would require that “The theory of relativity does not eat breakfast loudly” is a true statement, which is equally bizarre.

A more subtle challenge arises from paradoxes: sentences that are semantically meaningful but inherently are self-contradictory. Consider a page containing only the following sentence:

“The only proposition on this page is false.”

Attempting to assign a truth value to this sentence, denoted by PP, yields a contradiction:

  1. If PP is ⊤\top: Then the sentence asserts that PP is false; since it is the only proposition present, PP must evaluate to ⊥\bot, contradicting our initial assumption that PP is true.
  2. If PP is ⊥\bot: Then the sentence’s assertion that the only proposition on the page is false must itself be false. Since PP is the only proposition on the page, PP must therefore evaluate to ⊤\top, contradicting our initial assumption that PP is false.

Hence, as the sentence cannot be assigned a truth value, it is not a proposition.

Problem 1.2.

What happens if we do allow sentences like this to count as proper mathematical statements? What if we abandon the requirement that every statement we care about must be either true or false — is something fundamentally wrong, or have we simply entered a different logical universe?

In general, self-referential sentences like the one above, are quite bizarre and can produce some paradoxes that we want to disallow. By narrowing our scope strictly to propositions, we guarantee that our logical framework remains consistent, and most importantly suitable for automated reasoning and algorithmic verification (yes this is about Lean).

Problem 1.3.

Construct an example of a true proposition, a false proposition, a proposition whose truth value you do not currently know, a paradox, and a mathematical statement that is not a proposition.

Atomic Statements and the Structure of Mathematical Truth

To analyse complex (or compound) statements, we decompose them into their foundational components.

Definition 1.5 (Atomic Statement).

A statement is called atomic (or an atomic proposition) if it cannot be broken down into simpler constituent propositions.

For example, “5 is a prime number” is an atomic statement. Conversely, “5 is a prime number and 4 is an even number” is a complex statement built from two atomic components.

Remark.

We traditionally express these base components using propositional variables, denoted by lowercase letters such as p,q,r,sp, q, r, s.

By combining atomic statements into more complex structures, we can construct arguments in which some statements support another. Such an argument is a proof.

Definition 1.6 (Proof).

A proof of a proposition is a verified logical argument demonstrating its truth. It must begin from known or assumed truths, proceed via agreed-upon valid logical steps, and be entirely verifiable by a knowledgeable reader.

The results we prove are labelled by their role:

  • Proposition: In addition to its logical meaning above, “proposition” is also commonly used as a label for a proved result, usually one of lesser or supporting importance than a theorem.
  • Theorem: A significant mathematical result.
  • Corollary: A result that follows as an immediate logical consequence of a theorem or proposition.

Logical Connectives

Thus far, we have mostly been working with atomic propositions; the next step is to combine statements into new statements using logical operators or connectives, where the truth value of the combined statement is based solely on the truth values of the original statements and on the type of logical operator facilitating the combination. These rules should make sense to you based on your understanding of the English language as a whole, but we also define them using a truth table (a table whose columns correspond to mathematical statements and their respective truth values), which lists the output truth value for every possible combination of truth values assigned to the input propositional variables.

Negation

The simplest logical operator is the negation operator, which produces the “opposite” of the original statement in the logical sense. It is actually a so-called unary operator, i.e., it does not combine statements but is merely applied to one statement. If pp is a statement, its negation, written ¬p\neg p, is the statement with the exact opposite truth value, usually produced by placing a “not” in the grammatically appropriate spot. For example, if pp is the statement “Jack is a boy,” then ¬p\neg p is the statement “Jack is not a boy,” or for another example if pp is the statement “31 is a prime number” (⊤\top), then ¬p\neg p is the statement “31 is not a prime number” or, equivalently, “31 is composite” (⊥\bot).

p¬p⊤⊥⊥⊤\begin{array}{c|c} p & \neg p \\ \hline \top & \bot \\ \bot & \top \end{array}

Problem 1.4.

We negated “31 is prime” to “31 is composite.” Does swapping “not prime” for “composite” work for every natural number, or did 31 get lucky?

Compound Sentences

Having seen how a unary operator acts on a single statement, we now proceed to binary logical operators, i.e., logical operators combining precisely two statements. Given two statements pp and qq, we can join them with an “and” or an “or” to build a complex statement whose truth value depends, in the way you would expect, on the truth values of pp and qq.

The conjunction of pp and qq, read ”pp and qq” and written p∧qp \land q, is true precisely when both pieces are true, and false otherwise.

pqp∧q⊤⊤⊤⊤⊥⊥⊥⊤⊥⊥⊥⊥\begin{array}{cc|c} p & q & p \land q \\ \hline \top & \top & \top\\ \top & \bot & \bot\\ \bot & \top & \bot\\ \bot & \bot & \bot \end{array}

Example 1.7.

Let pp be the proposition “2+3=5,” ss be the proposition “There exists a prime number greater than 1010010^{100},” and qq the statement “the sky is red.” Thus, because both are true, their conjunction p∧sp \land s is true. Pairing pp with qq instead gives ”2+3=52 + 3 = 5 and the sky is red.” Here the first piece is true and the second is false, so p∧qp \land q is false.

Remark.

In English, conjunctions are frequently expressed using words such as “but,” “yet,” “while,” or “moreover.” The statement “A square has four sides, but a triangle has three vertices” serves the exact same logical function as a formal “and” statement.

The disjunction of pp and qq, read ”pp or qq” and written p∨qp \lor q, is true if at least one of the component propositions is true, and evaluates to false only when both pp and qq are false.

pqp∨q⊤⊤⊤⊤⊥⊤⊥⊤⊤⊥⊥⊥\begin{array}{c|c|c} p & q & p \lor q\\\hline \top & \top & \top\\ \top & \bot & \top\\ \bot & \top & \top\\ \bot & \bot & \bot \end{array}

Since both may hold at once, our “or” is what computer scientists call an inclusive or. The exclusive or, also known as XOR, on the other hand, denoted p⊕qp \oplus q, evaluates to ⊤\top if exactly one of pp or qq is ⊤\top.

pqp⊕q⊤⊤⊥⊤⊥⊤⊥⊤⊤⊥⊥⊥\begin{array}{c|c|c} p & q & p \oplus q\\\hline \top & \top & \bot\\ \top & \bot & \top\\ \bot & \top & \top\\ \bot & \bot & \bot \end{array}

Example 1.8.

Reusing our definitions of p,q,sp, q, s in the example block above, p∨qp \lor q is true, p∨sp\lor s is true, but p⊕sp \oplus s is false.

Remark (On Ambiguity).

In everyday English, “or” is heavily context-dependent. The statement “Candidates must have a degree in mathematics or computer science” implies an inclusive or, as possessing both degrees is entirely acceptable. However, being offered “soup or a salad” with a meal implies an exclusive or, where choosing both is not an option. In mathematics, “or” strictly denotes the inclusive disjunction ∨\lor unless specified otherwise.

Problem 1.5.

Suppose p∨qp \lor q is ⊤\top while p∧qp \land q is ⊥\bot. What do you know about pp and qq?

As you will have noted in the stated examples, logical operators can combine statements even when their meanings do not seem directly connected. While this might seem strange, adding restrictions based on content is neither needed nor helpful, because statements that appear unrelated can later become relevant within the same context. The same point applies to implications and equivalences, where the connection may initially seem even less intuitive.

”If-Then” Statements

Most statements we meet in these notes arrive as “If pp, then qq.” These are the conditional statements (or implications), written p→qp \to q (or q←pq \leftarrow p) and read ”pp implies qq”; within one, pp is called the hypothesis (or premise) and qq the conclusion. The logic of the implication is usually a little bit counter-intuitive to beginners so to be extra careful we can think of the statement p→qp \to q to mean the same thing as “whenever pp is true, qq is also true”; i.e., p→qp \to q evaluates to ⊥\bot in only one scenario: when pp is ⊤\top but qq is ⊥\bot.

Remark.

The key word here is “whenever”: p→qp\to q claims that every situation in which pp is true is also one in which qq is true, so a situation where pp is false cannot violate the implication, regardless of the truth value of qq.

Example 1.9.

Consider the statement: “If the employee finishes the project by Friday (pp), then they will receive a bonus (qq)”:

  1. If pp is ⊤\top, qq is ⊤\top: The employee finishes on time and gets the bonus.
  2. If pp is ⊤\top, qq is ⊥\bot: The employee finishes on time, but does not receive the bonus. This contradicts the promise, so the statement is ⊥\bot.
  3. If pp is ⊥\bot, qq is ⊤\top: The employee misses the deadline but receives a bonus anyway (perhaps for previous good work). The original statement only specified what happens if the project is finished on time; it did not prohibit a bonus otherwise. The statement remains true.
  4. If pp is ⊥\bot, qq is ⊥\bot: The employee misses the deadline and receives no bonus. The statement remains true.

Cases 3 and 4 illustrate what is known as a vacuous truth: whenever the hypothesis is ⊥\bot, the implication places no restriction on the conclusion and therefore evaluates to ⊤\top automatically.

pqp→q⊤⊤⊤⊤⊥⊥⊥⊤⊤⊥⊥⊤\begin{array}{cc|c} p & q & p \to q \\ \hline \top & \top & \top \\ \top & \bot & \bot \\ \bot & \top & \top \\ \bot & \bot & \top \end{array}

Problem 1.6.

“If 2+2=52 + 2 = 5, then 7 is prime” — true or false? What about “If 2+2=52 + 2 = 5, then 7 is composite”?

Problem 1.7.

I promise: “if it rains, I bring an umbrella.” You catch me carrying one under a cloudless sky. May you call me a liar?

Problem 1.8.

Show using a truth table that ¬p\neg p and p→⊥p \to \bot have the same truth values for every possible truth value of pp.

Another bit of confusion with these kind of statements comes from the word “implies,” as some use the word to convey some kind of causality. Take, for example the statement ”1+1=21+1=2 implies 1+2=31+2=3,” which is a true statement; many implications seem to follow this pattern, where the truth of the hypothesis seems to lead us to the truth on the conclusion, but this isnt the case in general!

Another example, “the sky being blue implies 2+2=42+2=4,” is a true statement, despite the color of the sky having nothing to do with 2+22+2 equaling 4; thus, the truth of p→qp\to q, depends only on the truth values of pp and qq, regardless of if we can deduce the conclusion directly from the hypothesis (or if any meaningful connection between either even exist).

Granted, the implication p→qp\to q is not really useful in situations, where the truth values of both pp and qq are already known; that is in a typical application, one tries to establish the truth of pp to prove the truth of qq (a strategy that will fail if pp happens to be false); it is important to keep in mind, that this is a consequence of the strategy not an undelying part of how conditional statements are defined.

Example 1.10.

Suppose we know that a particular bottle is stored in a wine rack. Let pp be the statement “The bottle contains red wine,” and let qq be the statement “There is at least one bottle of red wine in the rack.” A priori, we might not know whether the bottle contains red or white wine, but if we establish pp, then we can also establish qq. If instead we discover that the bottle contains white wine, then pp is false and the implication p→qp\to q tells us nothing about whether qq is true or false, since there may still be some other bottle of red wine in the rack.

Finally, like conjuction, there are a plethora of ways to express implication in english; consider the implication p→qp \to q, where pp is “It is raining” and qq is “The ground is wet,” assuming the implication evaluates to ⊤\top, one may also say:

  • If it rains, then the ground is wet.
  • The ground being wet is a consequence of it raining.
  • From “it is raining,” one may infer “the ground is wet.”
  • It raining is sufficient for the ground to be wet.
  • The ground being wet is necessary for it to rain.
  • It rains only if the ground is wet.

Problem 1.9.

The connectives introduced above are the standard primitives of propositional logic, but classical logic requires even fewer primitives than just these; in fact, every logical connective can be expressed using only negation and disjunction. Using this fact, express p∧qp\land q, and p→qp\to q, only with ¬\neg and ∨\lor, and verify each expression using a truth table. Can you find more than one expression for any of them?

Operator Precedence

Finally, before concluding this section, to preserve clarity and avoid an unreadable accumulation of parentheses in complex expressions, logical connectives adhere to a strict order of precedence. Operations are evaluated in the following hierarchy:

  1. Negation,
  2. Conjunction,
  3. Disjunction,
  4. Implication,

Under these rules, compound propositions are implicitly bracketed. For example, logical equivalence allows us to interpret expressions unambiguously without superfluous parentheses; ¬p∨q\neg p \lor q is the same as (¬p)∨q(\neg p) \lor q; likewise, p→q∨¬rp \to q \lor \neg r means p→(q∨(¬r))p \to (q \lor (\neg r)).

Remark.

The exclusive or lacks a universally standardised precedence level within this hierarchy; consequently, parentheses must always be explicitly written when incorporating it into compound statements.

Problem 1.10.

Consider the unparenthesised propositional formula ¬p∨q→r∧p\neg p \lor q \to r \land p. First, rewrite this formula with all implicit parentheses explicitly shown, adhering strictly to the operator precedence hierarchy. Second, determine the final truth value of the formula given the assignment where pp is ⊤\top, qq is ⊥\bot, and rr is ⊥\bot.

The Structure of Proof Systems

Although truth tables answer individual questions, they have several problems, one being that brute-force enumeration of every possible assignment scales poorly: a formula with nn atomic variables needs 2n2^n rows (quite obvious to see). Another, more fundamental, problem is that a truth table tells us that something is true without revealing why it is true, or how its truth connects to anything else. To patch this, we build what is called a proof system.

Formally, a proof system — pioneered by Gottlob Frege in 1879 — is a mechanism that uses axioms (assumed truths) and inference rules to mechanically derive new valid statements from existing ones. To achieve this, the system operates on two fundamental objects: statements (finite symbol strings expressing propositions) and proofs (the formal sequences justifying them). The relationship between these objects is governed by two rules:

  1. Semantics (Truth): A rule determining whether a given statement is true or false (the previous section used truth tables).
  2. Verification (Syntax): A procedure that decides if a specific string constitutes a valid proof for a given statement. This verification must be efficiently computable; a proof whose validity cannot be checked in reasonable time is useless.

A proof system should make the provable statements and the true statements coincide, which is expressed by two properties: Soundness: If a statement has a valid proof, it is true (no false statement possesses a valid proof) and Completeness: If a statement is true, a valid proof for it exists.

Remark (On Computational Efficiency).

In contrast to truth tables, verifying a formal proof requires only line-by-line pattern matching against inference rules, taking time proportional to the length of the proof itself. Verifying a proof is cheap even when finding one is hard, and this asymmetry is central to computational complexity theory.

Example 1.11 (Primality).

Consider statements of the form “The integer nn is composite.”

  • Semantics: The statement is true if nn has a divisor dd such that 1<d<n1 < d < n.
  • Proof: A valid proof could simply be the divisor dd itself.
  • Verification: Divide nn by dd and check whether the remainder is zero.

The verification step is computationally cheap, even when finding the divisor dd is extraordinarily difficult.

Satisfiability

Before constructing proofs, we must classify propositions by the range of truth values they can assume. Not all compound propositions behave alike: some are always true, some are always false, and some depend on the assignment.

Definition 1.12 (Tautology).

A compound proposition is a tautology if it evaluates to ⊤\top under every possible assignment of truth values to its atomic variables.

Definition 1.13 (Contradiction).

A compound proposition is a contradiction if it evaluates to ⊥\bot under every possible assignment of truth values to its atomic variables.

Definition 1.14 (Contingency).

A compound proposition is a contingency if it is neither a tautology nor a contradiction; its truth value depends on the specific assignment.

A proposition is satisfiable if there exists at least one assignment under which it evaluates to ⊤\top. Every tautology and every contingency is satisfiable. A contradiction is unsatisfiable.

Example 1.15.

The proposition p∨¬pp \lor \neg p is a tautology (by the principle of bivalence, one of pp or ¬p\neg p must hold). The proposition p∧¬pp \land \neg p is a contradiction. The bare variable pp is a contingency.

To establish that a proposition is satisfiable, a single witness assignment suffices. To establish that it is unsatisfiable, one must check every assignment, which is the expensive enumeration that the algebraic approach below avoids.

Problem 1.11.

Determine the satisfiability of (p∨q∨r)∧(¬p∨¬q∨¬r)(p \lor q \lor r) \land (\neg p \lor \neg q \lor \neg r). If satisfiable, provide a witness assignment. If unsatisfiable, justify your answer.

Logical Equivalence and Nonequivalence

Next, we need a way to decide when two statements are actually “the same,” at least in terms of their truth values. In particular, we may be able to prove that two statements have the same truth value for every possible assignment of the variables they contain.

From the logical operations and negation we can assemble statements of considerable complexity. Consider the formula ¬(p∧q)∨¬(p∧r)∨¬(q∧r).\neg(p \land q) \lor \neg(p \land r) \lor \neg(q \land r).

This is a disjunction of three terms; by the associativity of ∨\lor (which we will prove shortly), the parentheses around the disjunction are irrelevant, and thus the formula is true exactly when at least one of the negated conjunctions is true. Now compare it with the much simpler expression ¬(p∧q∧r)\neg(p \land q \land r). Even a quick glance suggests they both express “at least one of p,q,rp,q,r is false.” Their truth tables confirm this equivalence in a single combined table:

pqr¬(p∧q)∨¬(p∧r)∨¬(q∧r)¬(p∧q∧r)⊤⊤⊤⊥⊥⊤⊤⊥⊤⊤⊤⊥⊤⊤⊤⊤⊥⊥⊤⊤⊥⊤⊤⊤⊤⊥⊤⊥⊤⊤⊥⊥⊤⊤⊤⊥⊥⊥⊤⊤\begin{array}{c|c|c|c|c} p & q & r & \neg(p \land q) \lor \neg(p \land r) \lor \neg(q \land r) & \neg(p \land q \land r)\\\hline \top & \top & \top & \bot & \bot\\ \top & \top & \bot & \top & \top\\ \top & \bot & \top & \top & \top\\ \top & \bot & \bot & \top & \top\\ \bot & \top & \top & \top & \top\\ \bot & \top & \bot & \top & \top\\ \bot & \bot & \top & \top & \top\\ \bot & \bot & \bot & \top & \top \end{array}

The two formulas agree on every row.

Definition 1.16 (Logical Equivalence).

Let pp and qq be statements built from the same simpler statements using ¬\neg, ∧\land and ∨\lor. They are logically equivalent, written p≡qp \equiv q, if every assignment of truth values to those simpler statements gives pp and qq the same value.

We can express this “same truth value” agreement directly in the language with a single connective.

Biconditional

Let pp and qq be statements, the biconditional, p↔qp \leftrightarrow q (read ”pp if and only if qq,” frequently abbreviated as “iff”) describes a relationship where two propositions strictly share the same truth value. For example, “A polygon is a triangle (pp) if and only if it has exactly three sides (qq).” If one is true, the other must be true; if one is false, the other must be false. Also note that when dealing with a biconditional p↔qp \leftrightarrow q, the proposition pp is said to be “necessary and sufficient” for qq.

pqp↔q⊤⊤⊤⊤⊥⊥⊥⊤⊥⊥⊥⊤\begin{array}{cc|c} p & q & p \leftrightarrow q \\ \hline \top & \top & \top \\ \top & \bot & \bot \\ \bot & \top & \bot \\ \bot & \bot & \top \end{array}

Equivalently, p↔qp \leftrightarrow q asserts both [(p→q)∧(q→p)(p \to q) \land (q \to p)]. If pp is true, then p→qp \to q forces qq to be true; if pp is false, then q→pq \to p forces qq to be false. Thus, in either case, pp and qq have the same truth value.

Problem 1.12.

Show using a truth table that p↔qp \leftrightarrow q and [(p→q)∧(q→p)(p \to q) \land (q \to p)] have the same truth values for every possible truth.

The biconditional gives us a convenient way to characterize logical equivalence. For any particular assignment, p↔qp \leftrightarrow q tells us whether pp and qq agree under that assignment. If they agree under every assignment, then the biconditional is always true.

Remark (Equivalence via Biconditional).

Equivalence can also be expressed in terms of a tautology: p≡qif and only if(p↔q) is a tautology.p \equiv q \quad\text{if and only if}\quad (p \leftrightarrow q) \text{ is a tautology.} This will be especially useful when we work algebraically, because it allows us to replace p≡qp \equiv q by the statement that p↔qp \leftrightarrow q reduces to ⊤\top.

The opposite situation is equally important.

Definition 1.17 (Logical Nonequivalence).

Two statements pp and qq are not logically equivalent, written p≢qp \not\equiv q, if there exists at least one assignment of truth values to their variables for which their resulting truth values differ. Such an assignment is termed a counterexample.

And thus finally, we now have all the tools to build a proof system.

Equivalence Proofs

We now introduce the axiomatic foundation that allows us to reason about propositional equivalences without enumerating truth tables. The axioms of classical propositional logic specify the algebraic behaviour of the connectives ∧\land, ∨\lor, and ¬\neg. Each axiom is a logical equivalence, asserting that two expressions are interchangeable in all contexts. The first five axiom pairs define a structure known as a Boolean algebra.

AxiomConjunctive FormDisjunctive FormIdentity⊤∧p≡p⊥∨p≡pComplement¬p∧p≡⊥¬p∨p≡⊤Commutativityp∧q≡q∧pp∨q≡q∨pAssociativityp∧(q∧r)≡(p∧q)∧rp∨(q∨r)≡(p∨q)∨rDistributivityp∧(q∨r)≡(p∧q)∨(p∧r)p∨(q∧r)≡(p∨q)∧(p∨r)\begin{array}{lll} \textbf{Axiom} & \textbf{Conjunctive Form} & \textbf{Disjunctive Form} \\ \hline \text{Identity} & \top \land p \equiv p & \bot \lor p \equiv p \\ \text{Complement} & \neg p \land p \equiv \bot & \neg p \lor p \equiv \top \\ \text{Commutativity} & p \land q \equiv q \land p & p \lor q \equiv q \lor p \\ \text{Associativity} & p \land (q \land r) \equiv (p \land q) \land r & p \lor (q \lor r) \equiv (p \lor q) \lor r \\ \text{Distributivity} & p \land (q \lor r) \equiv (p \land q) \lor (p \land r) & p \lor (q \land r) \equiv (p \lor q) \land (p \lor r) \end{array}

The axioms govern only ¬\neg, ∧\land, and ∨\lor. To bring →\to and ↔\leftrightarrow within their reach we use the defining equivalences of the two conditional connectives, which rewrite them in terms of the core trio:

Conditional:p→q≡¬p∨qBiconditional:p↔q≡(p→q)∧(q→p)≡(¬p∨q)∧(¬q∨p)\begin{aligned} \textbf{Conditional:} \quad & p \to q \equiv \neg p \lor q \\ \textbf{Biconditional:} \quad & p \leftrightarrow q \equiv (p \to q) \land (q \to p) \equiv (\neg p \lor q) \land (\neg q \lor p) \end{aligned}

Problem 1.13.

Feel free to pick any three axioms and prove them using a truth table.

From these axioms, we derive theorems. Recall Definition 1.6 : a proof begins from known truths and proceeds via valid logical steps. An equivalence proof is a chain of equivalences, each justified by an axiom, a definition, or a previously established theorem:

p≡p1,p1≡p2,…,pn≡q→p≡q.p \equiv p_1, \quad p_1 \equiv p_2, \quad \ldots, \quad p_n \equiv q \quad \to \quad p \equiv q.

The astute might ask: what logically permits us to stitch individual equivalences together into a single chain? Well this method relies on the principle of transitivity; we first show by truth table the closely related transitivity of implication, and then verify the transitivity of equivalence.

Let p,q,p, q, and rr be any propositions. We show that the transitivity of implication, ((p→q)∧(q→r))→(p→r)\bigl((p \to q) \land (q \to r)\bigr) \to (p \to r), is a tautology.

pqrp→qq→r(p→q)∧(q→r)p→r((p→q)∧(q→r))→(p→r)⊤⊤⊤⊤⊤⊤⊤⊤⊤⊤⊥⊤⊥⊥⊥⊤⊤⊥⊤⊥⊤⊥⊤⊤⊤⊥⊥⊥⊤⊥⊥⊤⊥⊤⊤⊤⊤⊤⊤⊤⊥⊤⊥⊤⊥⊥⊤⊤⊥⊥⊤⊤⊤⊤⊤⊤⊥⊥⊥⊤⊤⊤⊤⊤\begin{array}{ccc|cc|c|c|c} p & q & r & p \to q & q \to r & (p \to q) \land (q \to r) & p \to r & \bigl((p \to q) \land (q \to r)\bigr) \to (p \to r) \\ \hline \top & \top & \top & \top & \top & \top & \top & \top \\ \top & \top & \bot & \top & \bot & \bot & \bot & \top \\ \top & \bot & \top & \bot & \top & \bot & \top & \top \\ \top & \bot & \bot & \bot & \top & \bot & \bot & \top \\ \bot & \top & \top & \top & \top & \top & \top & \top \\ \bot & \top & \bot & \top & \bot & \bot & \top & \top \\ \bot & \bot & \top & \top & \top & \top & \top & \top \\ \bot & \bot & \bot & \top & \top & \top & \top & \top \end{array}

The final column is ⊤\top in every row, so the formula is a tautology. Similarly, for any propositions p,q,p, q, and rr, we show that the transitivity of equivalence, ((p↔q)∧(q↔r))→(p↔r)\bigl((p \leftrightarrow q) \land (q \leftrightarrow r)\bigr) \to (p \leftrightarrow r), is also a tautology.

pqrp↔qq↔r(p↔q)∧(q↔r)p↔r((p↔q)∧(q↔r))→(p↔r)⊤⊤⊤⊤⊤⊤⊤⊤⊤⊤⊥⊤⊥⊥⊥⊤⊤⊥⊤⊥⊥⊥⊤⊤⊤⊥⊥⊥⊤⊥⊥⊤⊥⊤⊤⊥⊤⊥⊥⊤⊥⊤⊥⊥⊥⊥⊤⊤⊥⊥⊤⊤⊥⊥⊥⊤⊥⊥⊥⊤⊤⊤⊤⊤\begin{array}{ccc|cc|c|c|c} p & q & r & p \leftrightarrow q & q \leftrightarrow r & (p \leftrightarrow q) \land (q \leftrightarrow r) & p \leftrightarrow r & \bigl((p \leftrightarrow q) \land (q \leftrightarrow r)\bigr) \to (p \leftrightarrow r) \\ \hline \top & \top & \top & \top & \top & \top & \top & \top \\ \top & \top & \bot & \top & \bot & \bot & \bot & \top \\ \top & \bot & \top & \bot & \bot & \bot & \top & \top \\ \top & \bot & \bot & \bot & \top & \bot & \bot & \top \\ \bot & \top & \top & \bot & \top & \bot & \bot & \top \\ \bot & \top & \bot & \bot & \bot & \bot & \top & \top \\ \bot & \bot & \top & \top & \bot & \bot & \bot & \top \\ \bot & \bot & \bot & \top & \top & \top & \top & \top \end{array}

By the truth table, the transitivity of equivalence is likewise a tautology, fully justifying the chain-of-equivalences method. For complex formulas this is much shorter than a truth table (as we see below), though it needs some ingenuity rather than mechanical enumeration.

Fundamental Theorems

Theorem 1.18 (Uniqueness of Complements).

For any propositions pp and qq, if p∧q≡⊥p \land q \equiv \bot and p∨q≡⊤p \lor q \equiv \top, then ¬p≡q\neg p \equiv q.

Discussion.

The statement is a conditional whose hypothesis is a pair of equivalences and whose conclusion is a third, so we assume both hypotheses and show that ¬p\neg p and qq both reduce to ¬p∧q\neg p \land q. Each hypothesis is an equivalence with ⊤\top or ⊥\bot on one side, so it can be used only after a ⊤\top or a ⊥\bot has been introduced: Identity introduces the ⊤\top, Complement the ⊥\bot, and Distributivity combines pp and qq so that the hypotheses apply. Transitivity of equivalence then gives ¬p≡q\neg p \equiv q.

Proof.

Let pp and qq be arbitrary propositions satisfying p∧q≡⊥p \land q \equiv \bot and p∨q≡⊤p \lor q \equiv \top. We show that both ¬p\neg p and qq reduce to the same expression. First:

¬p≡⊤∧¬pby Identity≡(¬p)∧⊤by Commutativity≡(¬p)∧(p∨q)by assumption, p∨q≡⊤≡(¬p∧p)∨(¬p∧q)by Distributivity≡⊥∨(¬p∧q)by Complement≡¬p∧qby Identity\begin{aligned} \neg p &\equiv \top \land \neg p && \text{by Identity} \\ &\equiv (\neg p) \land \top && \text{by Commutativity} \\ &\equiv (\neg p) \land (p \lor q) && \text{by assumption, } p \lor q \equiv \top \\ &\equiv (\neg p \land p) \lor (\neg p \land q) && \text{by Distributivity} \\ &\equiv \bot \lor (\neg p \land q) && \text{by Complement} \\ &\equiv \neg p \land q && \text{by Identity} \end{aligned}

Similarly:

q≡⊤∧qby Identity≡q∧⊤by Commutativity≡q∧(p∨¬p)by Complement≡(q∧p)∨(q∧¬p)by Distributivity≡(p∧q)∨(¬p∧q)by Commutativity≡⊥∨(¬p∧q)by assumption, p∧q≡⊥≡¬p∧qby Identity\begin{aligned} q &\equiv \top \land q && \text{by Identity} \\ &\equiv q \land \top && \text{by Commutativity} \\ &\equiv q \land (p \lor \neg p) && \text{by Complement} \\ &\equiv (q \land p) \lor (q \land \neg p) && \text{by Distributivity} \\ &\equiv (p \land q) \lor (\neg p \land q) && \text{by Commutativity} \\ &\equiv \bot \lor (\neg p \land q) && \text{by assumption, } p \land q \equiv \bot \\ &\equiv \neg p \land q && \text{by Identity} \end{aligned}

Both ¬p\neg p and qq equal ¬p∧q\neg p \land q, hence ¬p≡q\neg p \equiv q.

Remark.

The symbol ■\blacksquare at the end of a proof is a modern substitute for the traditional Q.E.D., an initialism for the Latin phrase quod erat demonstrandum, meaning “what was to be shown.”

The theorem says that anything that behaves like a complement, giving ⊥\bot under ∧\land and ⊤\top under ∨\lor, is the complement. Most of the derivations below use it.

Corollary 1.19.

⊤≡¬⊥\top \equiv \neg \bot and ⊥≡¬⊤\bot \equiv \neg \top.

Proof.

By Identity, ⊥∧⊤≡⊥\bot \land \top \equiv \bot. By Commutativity and Identity, ⊥∨⊤≡⊤\bot \lor \top \equiv \top. The premises of Theorem 1.18 are satisfied with p=def⊥p \defeq \bot and q=def⊤q \defeq \top, yielding ⊤≡¬⊥\top \equiv \neg \bot. The second statement follows identically with p=def⊤p \defeq \top, q=def⊥q \defeq \bot.

Corollary 1.20 (Negative Equivalence).

For any propositions pp and qq, if p≡qp \equiv q, then ¬p≡¬q\neg p \equiv \neg q.

Proof.

Let p≡qp \equiv q. Then: q∧¬p≡p∧¬p≡⊥(by assumption, then Complement),q \land \neg p \equiv p \land \neg p \equiv \bot \quad \text{(by assumption, then Complement),} and q∨¬p≡p∨¬p≡⊤(by assumption, then Complement).q \lor \neg p \equiv p \lor \neg p \equiv \top \quad \text{(by assumption, then Complement).}

By Theorem 1.18 (with qq playing the role of pp and ¬p\neg p playing the role of qq), we conclude ¬q≡¬p\neg q \equiv \neg p.

Corollary 1.21.

For any propositions p,q,r,sp, q, r, s such that p≡qp \equiv q and r≡sr \equiv s:

  1. p∧r≡q∧sp \land r \equiv q \land s
  2. p∨r≡q∨sp \lor r \equiv q \lor s
  3. p→r≡q→sp \to r \equiv q \to s
  4. p↔r≡q↔sp \leftrightarrow r \equiv q \leftrightarrow s

Proof.

Two propositions are equivalent exactly when they take the same truth value under every assignment. Fix such an assignment. The hypothesis p≡qp \equiv q says pp and qq take the same value there, and r≡sr \equiv s says the same of rr and ss. Each connective is a function of the truth values of its arguments and of nothing else, so p∧rp \land r and q∧sq \land s are the same function applied to the same pair of values, and therefore agree; likewise for ∨\lor, for →\to and for ↔\leftrightarrow. Since the assignment was arbitrary, the four equivalences hold.

With Theorem 1.18 and its corollaries established, we can now derive the classical theorems of propositional logic.

Theorem 1.22 (Double Negation).

For any proposition pp, p≡¬¬pp \equiv \neg \neg p.

Discussion.

The claim is that pp is the complement of ¬p\neg p, so we use uniqueness of complements: we check that ¬p∧p≡⊥\neg p \land p \equiv \bot and ¬p∨p≡⊤\neg p \lor p \equiv \top, and the theorem gives the result. Both conditions are the Complement axiom with its two sides commuted.

Proof.

By Complement (and Commutativity): ¬p∧p≡p∧¬p≡⊥\neg p \land p \equiv p \land \neg p \equiv \bot and ¬p∨p≡p∨¬p≡⊤\neg p \lor p \equiv p \lor \neg p \equiv \top. The premises of Theorem 1.18 are met with ¬p\neg p in the role of pp and pp in the role of qq. Therefore p≡¬(¬p)p \equiv \neg(\neg p).

Theorem 1.23 (Idempotence).

For any proposition pp, p∧p≡pp \land p \equiv p and p∨p≡pp \lor p \equiv p.

Discussion.

Each equivalence is proved by a chain of rewritings from the left side down to pp. Since p∧pp \land p cannot be simplified directly, the chain begins by adjoining a ⊥\bot or a ⊤\top by Identity. Complement turns that constant into p∧¬pp \land \neg p or p∨¬pp \lor \neg p, Distributivity factors out the repeated pp, and Complement and Identity remove the rest. The second case is the first with ∧\land and ∨\lor exchanged throughout, which the duality of the axioms permits.

Proof.

For the conjunctive case:

p∧p≡(p∧p)∨⊥by Identity≡(p∧p)∨(p∧¬p)by Complement≡p∧(p∨¬p)by Distributivity≡p∧⊤by Complement≡pby Identity\begin{aligned} p \land p &\equiv (p \land p) \lor \bot && \text{by Identity} \\ &\equiv (p \land p) \lor (p \land \neg p) && \text{by Complement} \\ &\equiv p \land (p \lor \neg p) && \text{by Distributivity} \\ &\equiv p \land \top && \text{by Complement} \\ &\equiv p && \text{by Identity} \end{aligned}

The disjunctive case follows analogously:

p∨p≡(p∨p)∧⊤by Identity≡(p∨p)∧(p∨¬p)by Complement≡p∨(p∧¬p)by Distributivity≡p∨⊥by Complement≡pby Identity\begin{aligned} p \lor p &\equiv (p \lor p) \land \top && \text{by Identity} \\ &\equiv (p \lor p) \land (p \lor \neg p) && \text{by Complement} \\ &\equiv p \lor (p \land \neg p) && \text{by Distributivity} \\ &\equiv p \lor \bot && \text{by Complement} \\ &\equiv p && \text{by Identity} \end{aligned}

Theorem 1.24 (Domination).

For any proposition pp, ⊤∨p≡⊤\top \lor p \equiv \top and ⊥∧p≡⊥\bot \land p \equiv \bot.

Discussion.

Again two dual equivalences, each proved by a chain. Complement rewrites ⊤\top as ¬p∨p\neg p \lor p, with the same pp that already appears, so that Associativity brings the two copies of pp together. Idempotence, just proved, merges them, and Complement gives ⊤\top again. The proof uses the previous theorem.

Proof.

For the disjunctive fragment:

⊤∨p≡(¬p∨p)∨pby Complement≡¬p∨(p∨p)by Associativity≡¬p∨pby Idempotence (Theorem 3)≡⊤by Complement\begin{aligned} \top \lor p &\equiv (\neg p \lor p) \lor p && \text{by Complement} \\ &\equiv \neg p \lor (p \lor p) && \text{by Associativity} \\ &\equiv \neg p \lor p && \text{by Idempotence (Theorem 3)} \\ &\equiv \top && \text{by Complement} \end{aligned}

The conjunctive fragment:

⊥∧p≡(¬p∧p)∧pby Complement≡¬p∧(p∧p)by Associativity≡¬p∧pby Idempotence (Theorem 3)≡⊥by Complement\begin{aligned} \bot \land p &\equiv (\neg p \land p) \land p && \text{by Complement} \\ &\equiv \neg p \land (p \land p) && \text{by Associativity} \\ &\equiv \neg p \land p && \text{by Idempotence (Theorem 3)} \\ &\equiv \bot && \text{by Complement} \end{aligned}

Theorem 1.25 (Absorption).

For any propositions pp and qq, p∨(p∧q)≡pp \lor (p \land q) \equiv p and p∧(p∨q)≡pp \land (p \lor q) \equiv p.

Discussion.

In both statements qq disappears, so we isolate qq in a bracket that Domination removes. Identity supplies a ⊤\top next to the first pp, Distributivity factors pp out and leaves ⊤∨q\top \lor q, and Domination reduces that to ⊤\top. The conjunctive case is the dual, with ⊥\bot in place of ⊤\top.

Proof.

For the disjunctive case:

p∨(p∧q)≡(p∧⊤)∨(p∧q)by Identity≡p∧(⊤∨q)by Distributivity≡p∧⊤by Domination (Theorem 4)≡pby Identity\begin{aligned} p \lor (p \land q) &\equiv (p \land \top) \lor (p \land q) && \text{by Identity} \\ &\equiv p \land (\top \lor q) && \text{by Distributivity} \\ &\equiv p \land \top && \text{by Domination (Theorem 4)} \\ &\equiv p && \text{by Identity} \end{aligned}

The conjunctive case:

p∧(p∨q)≡(p∨⊥)∧(p∨q)by Identity≡p∨(⊥∧q)by Distributivity≡p∨⊥by Domination (Theorem 4)≡pby Identity\begin{aligned} p \land (p \lor q) &\equiv (p \lor \bot) \land (p \lor q) && \text{by Identity} \\ &\equiv p \lor (\bot \land q) && \text{by Distributivity} \\ &\equiv p \lor \bot && \text{by Domination (Theorem 4)} \\ &\equiv p && \text{by Identity} \end{aligned}

Theorem 1.26 (De Morgan's Laws).

For any propositions pp and qq, ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q and ¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q.

Discussion.

Each statement asserts that a particular compound is the complement of another, so we use uniqueness of complements again and verify that p∧qp \land q and ¬p∨¬q\neg p \lor \neg q give ⊥\bot under ∧\land and ⊤\top under ∨\lor. The first of these uses Distributivity twice, so that qq meets ¬q\neg q and pp meets ¬p\neg p; each pair collapses by Complement, and Domination removes what is left. The second law is the first with the two connectives exchanged, and the second condition is the dual of the first.

Proof.

We prove ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q by applying Theorem 1.18 . We must show (p∧q)∧(¬p∨¬q)≡⊥(p \land q) \land (\neg p \lor \neg q) \equiv \bot and (p∧q)∨(¬p∨¬q)≡⊤(p \land q) \lor (\neg p \lor \neg q) \equiv \top.

The conjunctive branch:

(p∧q)∧(¬p∨¬q)≡p∧(q∧(¬p∨¬q))by Associativity≡p∧((q∧¬p)∨(q∧¬q))by Distributivity≡p∧((q∧¬p)∨⊥)by Complement≡p∧(q∧¬p)by Identity≡p∧(¬p∧q)by Commutativity≡(p∧¬p)∧qby Associativity≡⊥∧qby Complement≡⊥by Domination (Theorem 4)\begin{aligned} (p \land q) \land (\neg p \lor \neg q) &\equiv p \land (q \land (\neg p \lor \neg q)) && \text{by Associativity} \\ &\equiv p \land ((q \land \neg p) \lor (q \land \neg q)) && \text{by Distributivity} \\ &\equiv p \land ((q \land \neg p) \lor \bot) && \text{by Complement} \\ &\equiv p \land (q \land \neg p) && \text{by Identity} \\ &\equiv p \land (\neg p \land q) && \text{by Commutativity} \\ &\equiv (p \land \neg p) \land q && \text{by Associativity} \\ &\equiv \bot \land q && \text{by Complement} \\ &\equiv \bot && \text{by Domination (Theorem 4)} \end{aligned}

By Theorem 1.18 , ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q. The proof of ¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q is analogous.

Problem 1.14.

Prove by equivalence proof that ¬(p∨q)≡¬p∧¬q\neg(p \lor q) \equiv \neg p \land \neg q (the second De Morgan’s Law).

De Morgan’s Laws are an instance of a general symmetry between conjunction and disjunction, called duality.

Definition 1.27 (Logical Duality).

Two binary logical connectives are dual when negating a compound expression built from one connective yields a formula that is logically equivalent to the compound expression built from the other connective, but with the inputs themselves negated.

Remark (Principle of Duality).

More generally, for any equivalence involving only ∧\land, ∨\lor, and ¬\neg, swapping every ∧\land with ∨\lor (and every ⊤\top with ⊥\bot) produces another valid equivalence. This is the Principle of Duality for Boolean algebra.

Conjunction and disjunction are the fundamental dual pair of classical logic. The two De Morgan’s Laws ¬(p∧q)≡¬p∨¬q,¬(p∨q)≡¬p∧¬q \neg(p \land q) \equiv \neg p \lor \neg q, \neg(p \lor q) \equiv \neg p \land \neg q show exactly that ∧\land and ∨\lor are dual to each other: negating an AND gives an OR of the negated parts, and negating an OR gives an AND of the negated parts.

Using this we extend the De Morgan’s Laws extend naturally to any finite number of propositions.

Corollary 1.28.

For any propositions p1,p2,…,pnp_1,p_2,\ldots,p_n, ¬(p1∧p2∧⋯∧pn)≡¬p1∨¬p2∨⋯∨¬pn,\neg(p_1 \land p_2 \land \cdots \land p_n) \equiv \neg p_1 \lor \neg p_2 \lor \cdots \lor \neg p_n, and ¬(p1∨p2∨⋯∨pn)≡¬p1∧¬p2∧⋯∧¬pn.\neg(p_1 \lor p_2 \lor \cdots \lor p_n) \equiv \neg p_1 \land \neg p_2 \land \cdots \land \neg p_n.

Proof.

Since ∧\land and ∨\lor are dual, negating a conjunction exchanges ∧\land for ∨\lor while negating each of its components; hence ¬(p1∧⋯∧pn)≡¬p1∨⋯∨¬pn.\neg(p_1 \land \cdots \land p_n) \equiv \neg p_1 \lor \cdots \lor \neg p_n. By the same duality, negating a disjunction exchanges ∨\lor for ∧\land, giving ¬(p1∨⋯∨pn)≡¬p1∧⋯∧¬pn.\neg(p_1 \lor \cdots \lor p_n) \equiv \neg p_1 \land \cdots \land \neg p_n.

Problem 1.15.

Show that p∧(p→q)p \land (p \to q) is a tautology, without using a truth table.

Equivalences Involving Conditionals

The defining equivalences of →\to and ↔\leftrightarrow allow us to derive every conditional equivalence by reducing implications to ¬,∧,∨\neg, \land, \lor and applying the theorems above:

p→q≡¬p∨qp→q≡¬q→¬p(Contrapositive)p∨q≡¬p→qp∧q≡¬(p→¬q)¬(p→q)≡p∧¬q\begin{aligned} p \to q &\equiv \neg p \lor q \\ p \to q &\equiv \neg q \to \neg p \quad \text{(Contrapositive)} \\ p \lor q &\equiv \neg p \to q \\ p \land q &\equiv \neg(p \to \neg q) \\ \neg(p \to q) &\equiv p \land \neg q \end{aligned} (p→q)∧(p→r)≡p→(q∧r)(p→r)∧(q→r)≡(p∨q)→r(p→q)∨(p→r)≡p→(q∨r)(p→r)∨(q→r)≡(p∧q)→r\begin{aligned} (p \to q) \land (p \to r) &\equiv p \to (q \land r) \\ (p \to r) \land (q \to r) &\equiv (p \lor q) \to r \\ (p \to q) \lor (p \to r) &\equiv p \to (q \lor r) \\ (p \to r) \lor (q \to r) &\equiv (p \land q) \to r \end{aligned} p↔q≡(p→q)∧(q→p)p↔q≡¬p↔¬qp↔q≡(p∧q)∨(¬p∧¬q)¬(p↔q)≡p↔¬q\begin{aligned} p \leftrightarrow q &\equiv (p \to q) \land (q \to p) \\ p \leftrightarrow q &\equiv \neg p \leftrightarrow \neg q \\ p \leftrightarrow q &\equiv (p \land q) \lor (\neg p \land \neg q) \\ \neg(p \leftrightarrow q) &\equiv p \leftrightarrow \neg q \end{aligned}

Notice the pattern in the implication equivalences: when implications share the same premise, the conclusions combine with the same connective (∧\land or ∨\lor). When they share the same conclusion, the premises combine with the opposite connective. This “flip” from ∧\land to ∨\lor (and vice versa) comes from the negation in the definition of →\to: the antecedent of an implication sits behind a ¬\neg, so De Morgan’s Laws invert the connective when premises are merged.

Contrapositive, Converse, and Inverse

Let pp and qq be mathematical statements. From an implication p→qp \to q, three related conditionals arise:

  • The contrapositive ¬q→¬p\neg q \to \neg p.
  • The converse q→pq \to p.
  • The inverse ¬p→¬q\neg p \to \neg q.

Something hinted at so far is that the direction of an implication matters: in general, reversing an implication does not preserve its truth. That is, even if p→qp \to q is true, its converse q→pq \to p need not be true.

Problem 1.16.

Using an equivalence proof, show that (p→q)≡(¬q→¬p)(p \to q) \equiv (\neg q \to \neg p) and (q→p)≡(¬p→¬q).(q \to p) \equiv (\neg p \to \neg q).

The first equivalence is particularly important. Since p→q≡¬q→¬p,p \to q \equiv \neg q \to \neg p, if we wish to prove p→qp \to q, we may instead show ¬q→¬p;\neg q \to \neg p; and this technique is one of the most useful methods of proof in mathematics (we see more of it later). However, because the converse is not determined by the truth value of the original implication whenever a mathematician proves a statement of the form p→qp \to q, a natural follow-up question is whether the converse also happens to hold. This distinction is also the source of a common logical fallacy: Suppose we have established that p→qp \to q; someone might object that qq does not necessarily imply pp, and therefore claim that the original argument is wrong, however, this objection confuses an implication with its converse.

Negating Conditional Statements

For the end of this specific section we ask: what does it mean for an implication itself to be false?

Recall that p→qp \to q fails in exactly one situation: when pp is true and qq is false; expressing this algebraically using the conditional equivalence:

Theorem 1.29 (Negation of a Conditional).

For any propositions pp and qq, ¬(p→q)≡p∧¬q.\neg(p \to q) \equiv p \land \neg q.

Discussion.

The proof is three rewritings. The conditional is an abbreviation, so first expand it into ¬p∨q\neg p \lor q; De Morgan’s laws then move the negation inside the disjunction; and Double Negation removes the ¬¬\neg\neg on pp.

Proof.

¬(p→q)≡¬(¬p∨q)by Conditional≡¬¬p∧¬qby De Morgan’s≡p∧¬qby Double Negation.\begin{aligned} \neg(p \to q) &\equiv \neg(\neg p \lor q) && \text{by Conditional} \\ &\equiv \neg\neg p \land \neg q && \text{by De Morgan's} \\ &\equiv p \land \neg q && \text{by Double Negation}. \end{aligned}

This has a useful interpretation: to show that an implication p→qp \to q is false, one must exhibit a case in which the hypothesis pp holds but the conclusion qq fails. In other words, a counterexample to an implication is precisely a witness to p∧¬qp \land \neg q. It is worth distinguishing this from several superficially similar statements: neither ¬p→q\neg p \to q nor p→¬qp\to \neg q is the negation of p→qp \to q. Anyway, we can negatate the biconditional similarly.

Theorem 1.30 (Negation of a Biconditional).

For any propositions pp and qq, ¬(p↔q)≡(p∧¬q)∨(q∧¬p).\neg(p \leftrightarrow q)\equiv(p \land \neg q) \lor (q \land \neg p).

Discussion.

The proof follows the previous one: expand the biconditional into the conjunction of its two conditionals, expand each conditional into a disjunction, and move the negation inside with De Morgan’s laws. This gives a conjunction of two disjunctions, which Distributivity expands into four terms, two of which vanish by Complement. The proof is left as the problem below.

Problem 1.17.

Prove the above theorem.

Thus, a biconditional is false exactly when pp and qq have different truth values; this is precisely the exclusive-or, relationship.

Equivalence Proofs in Practice

The following examples use the method, with Python as a check.

Example 1.31.

Show that ¬(p∨(¬p∧q))≡¬p∧¬q\neg(p \lor (\neg p \land q)) \equiv \neg p \land \neg q.

¬(p∨(¬p∧q))≡¬p∧¬(¬p∧q)by De Morgan≡¬p∧(p∨¬q)by De Morgan & Double Negation≡(¬p∧p)∨(¬p∧¬q)by Distributivity≡⊥∨(¬p∧¬q)by Complement≡¬p∧¬qby Identity\begin{aligned} \neg(p \lor (\neg p \land q)) &\equiv \neg p \land \neg(\neg p \land q) && \text{by De Morgan} \\ &\equiv \neg p \land (p \lor \neg q) && \text{by De Morgan \& Double Negation} \\ &\equiv (\neg p \land p) \lor (\neg p \land \neg q) && \text{by Distributivity} \\ &\equiv \bot \lor (\neg p \land \neg q) && \text{by Complement} \\ &\equiv \neg p \land \neg q && \text{by Identity} \end{aligned}

Example 1.32.

Show that (p∧q)→(p∨q)(p \land q) \to (p \lor q) is a tautology.

(p∧q)→(p∨q)≡¬(p∧q)∨(p∨q)by definition of →≡(¬p∨¬q)∨(p∨q)by De Morgan (Theorem 6)≡(¬p∨p)∨(¬q∨q)by Associativity and Commutativity≡⊤∨⊤by Complement≡⊤by Domination (Theorem 4)\begin{aligned} (p \land q) \to (p \lor q) &\equiv \neg(p \land q) \lor (p \lor q) && \text{by definition of $\to$} \\ &\equiv (\neg p \lor \neg q) \lor (p \lor q) && \text{by De Morgan (Theorem 6)} \\ &\equiv (\neg p \lor p) \lor (\neg q \lor q) && \text{by Associativity and Commutativity} \\ &\equiv \top \lor \top && \text{by Complement} \\ &\equiv \top && \text{by Domination (Theorem 4)} \end{aligned}

The formula reduces to ⊤\top with no surviving variables, confirming it is a tautology regardless of assignment.

Example 1.33.

Show that (p→r)∧(q→r)≡(p∨q)→r(p \to r) \land (q \to r) \equiv (p \lor q) \to r.

Problem 1.18.

Prove the above result.

This is the usual proof strategy for a disjunction: to show that a disjunction implies something, it suffices to show that each disjunct separately implies it.

Example 1.34 (Negation of an Implication).

The negation of “If I think, then I am” (p→qp \to q) is: ¬(p→q)≡¬(¬p∨q)≡p∧¬q\neg(p \to q) \equiv \neg(\neg p \lor q) \equiv p \land \neg q by the definition of →\to and De Morgan (Theorem 1.26 ). So the negation is “I think and I am not.”

Example 1.35 (XOR Distributivity).

Is ⊕\oplus distributive over ∧\land and ∨\lor?

The claim p∧(q⊕r)≡(p∧q)⊕(p∧r)p \land (q \oplus r) \equiv (p \land q) \oplus (p \land r) holds. Expanding both sides via the definition a⊕b≡(a∧¬b)∨(¬a∧b)a \oplus b \equiv (a \land \neg b) \lor (\neg a \land b):

Left side:

p∧(q⊕r)≡p∧((q∧¬r)∨(¬q∧r))≡(p∧q∧¬r)∨(p∧¬q∧r)p \land (q \oplus r) \equiv p \land ((q \land \neg r) \lor (\neg q \land r)) \equiv (p \land q \land \neg r) \lor (p \land \neg q \land r)

Right side:

(p∧q)⊕(p∧r)≡((p∧q)∧¬(p∧r))∨(¬(p∧q)∧(p∧r))≡((p∧q)∧(¬p∨¬r))∨((¬p∨¬q)∧(p∧r))≡(p∧q∧¬p)∨(p∧q∧¬r)∨(¬p∧p∧r)∨(¬q∧p∧r)≡⊥∨(p∧q∧¬r)∨⊥∨(p∧¬q∧r)≡(p∧q∧¬r)∨(p∧¬q∧r)\begin{aligned} (p \land q) \oplus (p \land r) &\equiv ((p \land q) \land \neg(p \land r)) \lor (\neg(p \land q) \land (p \land r)) \\ &\equiv ((p \land q) \land (\neg p \lor \neg r)) \lor ((\neg p \lor \neg q) \land (p \land r)) \\ &\equiv (p \land q \land \neg p) \lor (p \land q \land \neg r) \lor (\neg p \land p \land r) \lor (\neg q \land p \land r) \\ &\equiv \bot \lor (p \land q \land \neg r) \lor \bot \lor (p \land \neg q \land r) \\ &\equiv (p \land q \land \neg r) \lor (p \land \neg q \land r) \end{aligned}

Both sides reduce to the same expression. However, p∨(q⊕r)≡(p∨q)⊕(p∨r)p \lor (q \oplus r) \equiv (p \lor q) \oplus (p \lor r) fails.

A single counterexample suffices: set p≡⊤p \equiv \top, q≡⊤q \equiv \top, r≡⊤r \equiv \top.

⊤∨(⊤⊕⊤)≡⊤∨⊥≡⊤\top \lor (\top \oplus \top) \equiv \top \lor \bot \equiv \top(⊤∨⊤)⊕(⊤∨⊤)≡⊤⊕⊤≡⊥(\top \lor \top) \oplus (\top \lor \top) \equiv \top \oplus \top \equiv \bot

Problem 1.19.

Using equivalence proofs (not truth tables), show that p→q≡¬q→¬pp \to q \equiv \neg q \to \neg p. This establishes the contrapositive equivalence from first principles.

Problem 1.20.

Show, using an equivalence proof, that (p→q)∨(p→r)≡p→(q∨r)(p \to q) \lor (p \to r) \equiv p \to (q \lor r). Identify precisely where the “flip” from ∨\lor to the structure of the result occurs, and which axiom is responsible.

Problem 1.21.

The negation of “Candidates must have a degree in mathematics or computer science” is not “Candidates must have a degree in mathematics and computer science.” Using the propositions pp = “The candidate has a degree in mathematics” and qq = “The candidate has a degree in computer science,” express the original statement formally as an implication and compute its negation. Identify the De Morgan’s Law involved.

Normal Forms

We Finish off this chapter with Normal forms.

The equivalence proofs developed demonstrate that any compound proposition can be transformed into an equivalent expression using only the core connectives ¬\neg, ∧\land, and ∨\lor. But this raises a question: given two arbitrary propositions, how do we determine whether they are equivalent without the algebraic ingenuity required for an equivalence proof? (excluding truth tables of course).

A normal form solves this by being a fixed structural template for propositional formulas: If two propositions are equivalent, their normal forms will be identical (after simplification). This converts the semantic question “do these formulas always agree?” into the syntactic question “do these strings match?” But before defining the two principal normal forms, we need some terminology.

Definition 1.36 (Literal).

A literal is a propositional variable or its negation. If pp is a propositional variable, then both pp and ¬p\neg p are literals.

Definition 1.37 (Clause).

A clause is a disjunction or conjunction of literals. A disjunctive clause (or simply a clause in the context of CNF) is a disjunction of literals. A conjunctive clause (or term) is a conjunction of literals.

Disjunctive Normal Form

Definition 1.38 (Disjunctive Normal Form).

A propositional formula is in Disjunctive Normal Form (DNF) if it consists of a disjunction of one or more terms, where each term is a conjunction of literals. That is, DNF has the shape:

(l1,1∧l1,2∧⋯ )∨(l2,1∧l2,2∧⋯ )∨⋯(l_{1,1} \land l_{1,2} \land \cdots) \lor (l_{2,1} \land l_{2,2} \land \cdots) \lor \cdots

where each li,jl_{i,j} is a literal.

The structure is: OR of ANDs. Each conjunctive term describes one specific scenario under which the formula holds; the overall disjunction asserts that at least one of these scenarios is realised.

Example 1.39.

The following formulas are in DNF:

  1. (p∧¬q)∨(¬p∧q)(p \land \neg q) \lor (\neg p \land q). Two terms, each a conjunction of two literals.
  2. p∨(¬p∧q)p \lor (\neg p \land q). A single literal is a degenerate term (a conjunction of one literal).
  3. (p∧¬q∧¬r)∨(¬p∧q∧r)(p \land \neg q \land \neg r) \lor (\neg p \land q \land r).

The following formulas are not in DNF:

  1. (p∧¬q)∨¬(¬p∧q)(p \land \neg q) \lor \neg(\neg p \land q). The negation ¬(¬p∧q)\neg(\neg p \land q) is not a literal.
  2. (p∨q)∧(¬p∧q)(p \lor q) \land (\neg p \land q).
  3. ¬(¬p∨q)\neg(\neg p \lor q).

Constructing DNF from Truth Tables

Every compound proposition can be mechanically converted to DNF via its truth table via the procedure:

  1. Construct the truth table for the proposition.
  2. Identify every row where the proposition evaluates to ⊤\top.
  3. For each such row, form a conjunctive term: include the variable pp if it is assigned ⊤\top in that row, or ¬p\neg p if it is assigned ⊥\bot.
  4. Take the disjunction of all such terms.

Each term encodes exactly one satisfying assignment, and the disjunction collects them all.

Example 1.40.

Find the DNF of (p∨q)→¬r(p \lor q) \to \neg r.

We construct the truth table:

pqr(p∨q)→¬r⊤⊤⊤⊥⊤⊤⊥⊤⊤⊥⊤⊥⊤⊥⊥⊤⊥⊤⊤⊥⊥⊤⊥⊤⊥⊥⊤⊤⊥⊥⊥⊤\begin{array}{ccc|c} p & q & r & (p \lor q) \to \neg r \\ \hline \top & \top & \top & \bot \\ \top & \top & \bot & \top \\ \top & \bot & \top & \bot \\ \top & \bot & \bot & \top \\ \bot & \top & \top & \bot \\ \bot & \top & \bot & \top \\ \bot & \bot & \top & \top \\ \bot & \bot & \bot & \top \end{array}

Rows 2, 4, 6, 7, 8 evaluate to ⊤\top. Reading off each row:

(p∧q∧¬r)∨(p∧¬q∧¬r)∨(¬p∧q∧¬r)∨(¬p∧¬q∧r)∨(¬p∧¬q∧¬r)(p \land q \land \neg r) \lor (p \land \neg q \land \neg r) \lor (\neg p \land q \land \neg r) \lor (\neg p \land \neg q \land r) \lor (\neg p \land \neg q \land \neg r)

This is the full DNF. It can be simplified using the equivalence (p∧q)∨(p∧¬q)≡p(p \land q) \lor (p \land \neg q) \equiv p (which follows from Distributivity and Complement). Group the first two terms:

(p∧q∧¬r)∨(p∧¬q∧¬r)≡p∧¬r(p \land q \land \neg r) \lor (p \land \neg q \land \neg r) \equiv p \land \neg r

For the last three terms, observe that we may use Idempotence (Theorem 1.23 ) to duplicate the fifth term (¬p∧¬q∧¬r\neg p \land \neg q \land \neg r) without altering the formula. This allows two independent groupings:

(¬p∧q∧¬r)∨(¬p∧¬q∧¬r)≡¬p∧¬r(\neg p \land q \land \neg r) \lor (\neg p \land \neg q \land \neg r) \equiv \neg p \land \neg r(¬p∧¬q∧r)∨(¬p∧¬q∧¬r)≡¬p∧¬q(\neg p \land \neg q \land r) \lor (\neg p \land \neg q \land \neg r) \equiv \neg p \land \neg q

Combining:

(p∧¬r)∨(¬p∧¬r)∨(¬p∧¬q)≡¬r∨(¬p∧¬q)(p \land \neg r) \lor (\neg p \land \neg r) \lor (\neg p \land \neg q) \equiv \neg r \lor (\neg p \land \neg q)

Applying the definition of →\to and De Morgan (Theorem 1.26 ) in reverse: ¬r∨(¬p∧¬q)≡¬r∨¬(p∨q)≡(p∨q)→¬r\neg r \lor (\neg p \land \neg q) \equiv \neg r \lor \neg(p \lor q) \equiv (p \lor q) \to \neg r. The simplified DNF recovers the original formula, confirming equivalence.

Conjunctive Normal Form

Definition 1.41 (Conjunctive Normal Form).

A propositional formula is in Conjunctive Normal Form (CNF) if it consists of a conjunction of one or more clauses, where each clause is a disjunction of literals. That is, CNF has the shape:

(l1,1∨l1,2∨⋯ )∧(l2,1∨l2,2∨⋯ )∧⋯(l_{1,1} \lor l_{1,2} \lor \cdots) \land (l_{2,1} \lor l_{2,2} \lor \cdots) \land \cdots

where each li,jl_{i,j} is a literal.

The structure is: AND of ORs, the dual of DNF. Each disjunctive clause represents a constraint that must be satisfied; the conjunction demands that every constraint holds simultaneously.

Example 1.42.

The following formulas are in CNF:

  1. (p∨q)∧(¬p∨q)(p \lor q) \land (\neg p \lor q).
  2. (p∨q∨¬r)∧(¬p∨¬q∨¬r)(p \lor q \lor \neg r) \land (\neg p \lor \neg q \lor \neg r).

The following formulas are not in CNF:

  1. (p∧¬q)∨(¬p∧q)(p \land \neg q) \lor (\neg p \land q).
  2. ¬(¬p∨q)\neg(\neg p \lor q).

Constructing CNF

There are two systematic methods for obtaining CNF.

Method 1: Algebraic manipulation. Eliminate all implications using the defining equivalences of →\to and ↔\leftrightarrow. Push negations inward using De Morgan’s Laws (Theorem 1.26 ) and Double Negation (Theorem 1.22 ). Then distribute ∨\lor over ∧\land using the equivalence p∨(q∧r)≡(p∨q)∧(p∨r)p \lor (q \land r) \equiv (p \lor q) \land (p \lor r) (the disjunctive form of Distributivity) until every clause is a disjunction of literals.

Method 2: Truth table (via negation of DNF). Observe that by Double Negation (Theorem 1.22 ), any proposition ϕ\phi satisfies ϕ≡¬(¬ϕ)\phi \equiv \neg(\neg \phi). Construct the DNF of ¬ϕ\neg \phi by reading off the rows where ϕ\phi evaluates to ⊥\bot (equivalently, where ¬ϕ\neg \phi evaluates to ⊤\top). Then negate the resulting DNF. By De Morgan’s Laws (Theorem 1.26 ), negating a disjunction of conjunctions produces a conjunction of disjunctions: precisely CNF.

Example 1.43.

Find the CNF of ¬(p→q)∨(r→p)\neg(p \to q) \lor (r \to p).

Method 1 (Algebraic):

¬(p→q)∨(r→p)≡¬(¬p∨q)∨(¬r∨p)by definition of →≡(p∧¬q)∨(¬r∨p)by De Morgan and Double Negation≡(p∨¬r∨p)∧(¬q∨¬r∨p)by Distributivity≡(p∨¬r)∧(p∨¬q∨¬r)by Idempotence\begin{aligned} \neg(p \to q) \lor (r \to p) &\equiv \neg(\neg p \lor q) \lor (\neg r \lor p) && \text{by definition of $\to$} \\ &\equiv (p \land \neg q) \lor (\neg r \lor p) && \text{by De Morgan and Double Negation} \\ &\equiv (p \lor \neg r \lor p) \land (\neg q \lor \neg r \lor p) && \text{by Distributivity} \\ &\equiv (p \lor \neg r) \land (p \lor \neg q \lor \neg r) && \text{by Idempotence} \end{aligned}

Method 2 (Truth table):

pqr¬(p→q)∨(r→p)⊤⊤⊤⊤⊤⊤⊥⊤⊤⊥⊤⊤⊤⊥⊥⊤⊥⊤⊤⊥⊥⊤⊥⊤⊥⊥⊤⊥⊥⊥⊥⊤\begin{array}{ccc|c} p & q & r & \neg(p \to q) \lor (r \to p) \\ \hline \top & \top & \top & \top \\ \top & \top & \bot & \top \\ \top & \bot & \top & \top \\ \top & \bot & \bot & \top \\ \bot & \top & \top & \bot \\ \bot & \top & \bot & \top \\ \bot & \bot & \top & \bot \\ \bot & \bot & \bot & \top \end{array}

The formula evaluates to ⊥\bot in rows 5 and 7. Form the DNF of the negation by reading these rows: (¬p∧q∧r)∨(¬p∧¬q∧r),(\neg p \land q \land r) \lor (\neg p \land \neg q \land r), and simplify, thus giving (¬p∧q∧r)∨(¬p∧¬q∧r)≡¬p∧r(\neg p \land q \land r) \lor (\neg p \land \neg q \land r) \equiv \neg p \land r. Now negate: ¬(¬p∧r)≡p∨¬r\neg(\neg p \land r) \equiv p \lor \neg r by De Morgan (Theorem 1.26 ) and Double Negation (Theorem 1.22 ). This is already in CNF.

Remark.

Method 2 produced (p∨¬r)(p \lor \neg r), while Method 1 produced (p∨¬r)∧(p∨¬q∨¬r)(p \lor \neg r) \land (p \lor \neg q \lor \neg r). These are equivalent: the second clause in Method 1’s result is absorbed by the first via Absorption (Theorem 1.25 ), since any assignment satisfying (p∨¬r)(p \lor \neg r) automatically satisfies (p∨¬q∨¬r)(p \lor \neg q \lor \neg r).

The Cost of Canonicality

Converting between normal forms can cause an exponential blowup in the number of clauses.

Consider a formula already in DNF with nn terms:

(p1∧q1)∨(p2∧q2)∨⋯∨(pn∧qn)(p_1 \land q_1) \lor (p_2 \land q_2) \lor \cdots \lor (p_n \land q_n)

To convert this to CNF, we must distribute ∨\lor over ∧\land repeatedly. Each application of Distributivity doubles the number of clauses. Starting with (p1∧q1)∨(p2∧q2)(p_1 \land q_1) \lor (p_2 \land q_2):

(p1∧q1)∨(p2∧q2)≡(p1∨p2)∧(p1∨q2)∧(q1∨p2)∧(q1∨q2)(p_1 \land q_1) \lor (p_2 \land q_2) \equiv (p_1 \lor p_2) \land (p_1 \lor q_2) \land (q_1 \lor p_2) \land (q_1 \lor q_2)

Two terms in DNF produce four clauses in CNF. Adjoining a third term (p3∧q3)(p_3 \land q_3) via disjunction and distributing again doubles to eight clauses. After nn terms, the CNF may contain up to 2n2^n clauses. The symmetric explosion occurs when converting CNF to DNF.

The blowup comes from the normal forms themselves, not from the method of conversion. It is also the reason why the satisfiability of CNF formulas (the SAT problem) occupies a central position in complexity theory: determining whether a CNF formula has a satisfying assignment is the canonical NP-complete problem, meaning that no known algorithm solves it efficiently in all cases.

Problem 1.22.

Find the DNF of p→(q∧r)p \to (q \land r) using the truth table method. Simplify the result.

Problem 1.23.

Convert (p∨q)∧(¬p∨r)(p \lor q) \land (\neg p \lor r) into DNF using algebraic manipulation (Distributivity, not truth tables). Verify your result computationally.

Problem 1.24.

Find the CNF of (p∧q)∨(¬p∧r)(p \land q) \lor (\neg p \land r) using both methods (algebraic and truth table). Confirm that both methods yield equivalent results.

Application: Knights and Knaves

Logic puzzles can be solved with these methods.

On an island, every inhabitant is either a knight (who always tells the truth) or a knave (who always lies). You encounter two inhabitants, AA and BB.

  • AA says: “B is a knight.”
  • BB says: “The two of us are of opposite types.”

Let pp denote ”AA is a knight” and qq denote ”BB is a knight.” We translate the scenario into propositional logic.

  • If AA is a knight (pp is ⊤\top): then AA‘s statement is true, so qq is ⊤\top. If AA is a knave (pp is ⊥\bot), then AA‘s statement is false, so qq is ⊥\bot. In both cases, AA‘s declaration encodes p↔qp \leftrightarrow q.
  • BB’s statement asserts that AA and BB are of opposite types, which means exactly one of p,qp, q is ⊤\top: this is p⊕qp \oplus q. If BB is a knight (qq is ⊤\top), then p⊕qp \oplus q must be ⊤\top. If BB is a knave (qq is ⊥\bot), then p⊕qp \oplus q must be ⊥\bot. So BB‘s declaration encodes q↔(p⊕q)q \leftrightarrow (p \oplus q).

The full constraint is thus (p↔q)∧(q↔(p⊕q)).(p \leftrightarrow q) \land (q \leftrightarrow (p \oplus q)).

  • Case 1: Assume pp is ⊤\top. From p↔qp \leftrightarrow q, we get qq is ⊤\top. Then p⊕q≡⊤⊕⊤≡⊥p \oplus q \equiv \top \oplus \top \equiv \bot. But q↔(p⊕q)≡⊤↔⊥≡⊥q \leftrightarrow (p \oplus q) \equiv \top \leftrightarrow \bot \equiv \bot. The conjunction evaluates to ⊥\bot. Contradiction.

  • Case 2: Assume pp is ⊥\bot. From p↔qp \leftrightarrow q, we get qq is ⊥\bot. Then p⊕q≡⊥⊕⊥≡⊥p \oplus q \equiv \bot \oplus \bot \equiv \bot. And q↔(p⊕q)≡⊥↔⊥≡⊤q \leftrightarrow (p \oplus q) \equiv \bot \leftrightarrow \bot \equiv \top. The conjunction evaluates to ⊤\top.

Therefore both AA and BB are knaves.

Problem 1.25.

On the same island, you meet three inhabitants AA, BB, and CC. AA says: “All of us are knaves.” BB says: “Exactly one of us is a knight.” Using propositional variables pp, qq, rr for AA, BB, CC respectively, determine the types of all three inhabitants. Verify your solution computationally.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 1.1.

For each implication below, which of the four statements is its converse?

If it is raining, then the ground is wet.

answer one of these

If nn is divisible by 4, then nn is even.

answer one of these

If a function is differentiable, then it is continuous.

answer one of these

Exercise 1.2.

Construct a compound proposition in pp, qq and uu that is true exactly when:

pp is true, qq is false and uu is false.

answer formula

exactly one of pp, qq, uu is true.

answer formula

at least two of pp, qq, uu are true.

answer formula

Exercise 1.3.

The exclusive or does not distribute over conjunction: p⊕(q∧u)≢(p⊕q)∧(p⊕u)p \oplus (q \land u) \not\equiv (p \oplus q) \land (p \oplus u). Give an assignment at which the two sides differ.

answer assignment
p q u

Exercise 1.4.

Write each of the following with the connectives named and no others.

¬p↔q\neg p \leftrightarrow q, in ⊕\oplus.

answer formula

p↔¬qp \leftrightarrow \neg q, in ⊕\oplus.

answer formula

p↔qp \leftrightarrow q, in ⊕\oplus and ¬\neg.

answer formula

Exercise 1.5.

Find the disjunctive normal form of (p→q)∧(q→r)(p \to q) \land (q \to r), simplified as far as it will go.

answer formula

Exercise 1.6.

Find the conjunctive normal form of p→(q⊕r)p \to (q \oplus r), simplified as far as it will go.

answer formula

Exercise 1.7.

The compound proposition ((¬p∧q)→(r⊕q))∨(¬s↔p)((\neg p \land q) \to (r \oplus q)) \lor (\neg s \leftrightarrow p) involves four propositional variables. Settle it without constructing the sixteen-row truth table.

An assignment at which it is true.

answer assignment
p q r s

An assignment at which it is false.

answer assignment
p q r s

The proposition is therefore:

answer one of these

Exercise 1.8.

On an island, knights always tell the truth and knaves always lie. Person AA says: “If I am a knight, then BB is a knight.” Determine what AA and BB are.

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

Everything above this point was checked by hand. Lean is a language in which a statement and its proof are written so that a machine can check them instead, and it is what the rest of these notes will be verified in. This sheet is where we learn to write in it.

Each box below holds one statement. The grey lines are given and cannot be edited; the lines under them are ours to write, one tactic to a line. Underneath the box sits the info view, which shows what is left to prove and follows the cursor: put the caret between two lines of a proof and it reports the state at that point, which is the only way to see what a tactic has actually done.

Statements and proofs

p : Prop reads ”pp is a statement”, something that is either true or false. hp : p reads “hp is a proof of pp”, and assuming pp amounts to the same thing, since a hypothesis is a proof we were handed rather than one we made.

A goal is shown as a list of hypotheses, a turnstile, and then the statement to be proved. What stands above the ⊢ we may use; what stands after it we must reach. A proof is finished when no goals are left.

Implication

Three tactics prove everything in this part.

intro

To prove p→qp \to q we may assume pp and prove qq from it. So if the goal is ⊢ p → q, then intro hp takes that assumption, names it hp, and leaves the goal ⊢ q. Several may be taken at once: intro hp hq.

exact

If a hypothesis is exactly the statement we are trying to prove, exact hp closes the goal. Note that exact p does not: p is the statement and hp is a proof of it, and it is proofs that close goals.

Example.

Three assumptions, one of which is what we want.

lean worked
1example (p q r : Prop) (hp : p) (hq : q) (hr : r) : p := by
verified
goalGoals accomplished.

apply

apply argues backwards. If the goal is qq and we hold h : p → q, then it is enough to prove pp, so apply h replaces the goal ⊢ q with ⊢ p. It works only when the conclusion of h is the goal.

Implications also apply forwards, and read left to right: with h : p → q and hp : p, the term h hp is a proof of qq. So exact h hp closes in one line what apply h and then exact hp closes in two.

Example.

The goal is an arrow, so we may assume its left side. What we assume is never used again.

lean worked
1example (p q : Prop) (hq : q) : p → q := by
verified
goalGoals accomplished.

Example.

Backwards, in two steps. Putting exact h hp in place of both lines does the same work forwards.

lean worked
1example (p q : Prop) (h : p → q) (hp : p) : q := by
verified
goalGoals accomplished.

An arrow chain groups to the right: p → q → r is p → (q → r), so to reach rr we must supply both a pp and a qq. If h : p → q → r and the goal is ⊢ r, then apply h leaves two goals rather than one, and a tactic acts only on the first of them.

Exercise 1.9.

Every statement implies itself.

lean proof
1example (p : Prop) : p → p := by
goalp : Prop ⊢ p → p

Exercise 1.10.

A statement that holds goes on holding under a further assumption.

lean proof
1example (p q : Prop) : p → q → p := by
goalp q : Prop ⊢ p → q → p

Exercise 1.11.

From pp, together with p→qp \to q, reach qq.

lean proof
1example (p q : Prop) : p → (p → q) → q := by
goalp q : Prop ⊢ p → (p → q) → q

Exercise 1.12.

Implication is transitive.

lean proof
1example (p q r : Prop) : (p → q) → (q → r) → (p → r) := by
goalp q r : Prop ⊢ (p → q) → (q → r) → p → r

Exercise 1.13.

If rr follows from pp and qq together, and qq follows from pp, then rr follows from pp alone.

lean proof
1example (p q r : Prop) : (p → q → r) → (p → q) → (p → r) := by
goalp q r : Prop ⊢ (p → q → r) → (p → q) → p → r

True and False

True is Lean’s ⊤\top and False is its ⊥\bot. Each is a statement like any other, and each has a tactic of its own.

trivial

trivial closes the goal ⊢ True, which asks for nothing.

Example.

The hypothesis plays no part. Nothing is needed to prove ⊤\top.

lean worked
1example (p : Prop) (hp : p) : True := by
verified
goalGoals accomplished.

exfalso

Since ⊥\bot implies everything, a proof of ⊥\bot is a proof of anything, and exfalso replaces the goal, whatever it was, with ⊢ False. It is the move to make when the hypotheses already contradict each other, because nothing else is needed.

Example.

Nothing is known about qq, and nothing needs to be.

lean worked
1example (q : Prop) (h : False) : q := by
verified
goalGoals accomplished.

Exercise 1.14.

The true statement holds.

lean proof
1example : True := by
goal⊢ True

Exercise 1.15.

Anything at all implies the true statement.

lean proof
1example : False → True := by
goal⊢ False → True

Exercise 1.16.

The true statement does not imply the false one.

lean proof
1example : (True → False) → False := by
goal⊢ (True → False) → False

Exercise 1.17.

And anything follows from the claim that it does.

lean proof
1example (p : Prop) : (True → False) → p := by
goalp : Prop ⊢ (True → False) → p

Exercise 1.18.

From pp and a refutation of pp, any qq follows.

lean proof
1example (p q : Prop) : (p → False) → p → q := by
goalp q : Prop ⊢ (p → False) → p → q

Negation

In Lean ¬p is not a connective of its own. It is defined to be p → False, so the two are one statement and either may be given where the other is asked for. A proof of ¬p is therefore a thing that turns a proof of pp into a contradiction: intro opens a goal ⊢ ¬p exactly as it opens an arrow, and if hnp : ¬p and hp : p then hnp hp is a proof of False.

Example.

The negation is applied to the proof it refutes.

lean worked
1example (p : Prop) (hp : p) (hnp : ¬p) : False := by
verified
goalGoals accomplished.

by_contra

To prove pp by contradiction we assume ¬p\neg p and derive ⊥\bot. Where the goal is ⊢ p, by_contra hp adds hp : ¬p and changes the goal to ⊢ False. This is the one classical step available here: it is the law of excluded middle in the form of a tactic, and the exercises that need it are the ones that cannot be done without it.

Exercise 1.19.

The two readings of ¬p\neg p are one statement.

lean proof
1example (p : Prop) : ¬p → (p → False) := by
goalp : Prop ⊢ ¬p → p → False

Exercise 1.20.

The false statement can be refuted.

lean proof
1example : ¬False := by
goal⊢ ¬False

Exercise 1.21.

A statement implies its double negation.

lean proof
1example (p : Prop) : p → ¬¬p := by
goalp : Prop ⊢ p → ¬¬p

Exercise 1.22.

An implication yields its contrapositive.

lean proof
1example (p q : Prop) : (p → q) → (¬q → ¬p) := by
goalp q : Prop ⊢ (p → q) → ¬q → ¬p

Exercise 1.23.

And the contrapositive yields the implication back.

lean proof
1example (p q : Prop) : (¬q → ¬p) → (p → q) := by
goalp q : Prop ⊢ (¬q → ¬p) → p → q
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 2

Predicates, Quantifiers, and Proofs

Taught

Predicates

There is a problem: So far, what we’ve built (propositional logic) has no way to express the classic (correct) argument “All men are mortal. Socrates is a man. Therefore Socrates is mortal,” because propositional logic treats each proposition as an indivisible whole. It therefore has no way to look inside a statement and relate the object (Socrates), the property (being a man), and the consequence (being mortal); without that internal structure, we cannot formally justify the conclusion.

What is missing is the ability to distinguish the object of our speech from the description we make about it, so we introduce predicate logic, which allows us to reason about objects and their properties.

Variables and Predicates

Recall that a term is a symbol that denotes an object: constants such as the natural number 55 or π\pi are terms denoting specific objects, while an unquantified variable such as xx is a term whose value has not yet been specified. We can then form expressions describing the object denoted by a variable, such as man⁡(x)\operatorname{man}(x) to say ”xx is a man,” or x>3x>3 to say ”xx is greater than 33.” We call these expressions predicates (also known as variable propositions), since they make a claim that depends on one or more variables.

Definition 2.1 (Predicate).

Let x1,…,xnx_1, \ldots, x_n be variable symbols. We say φ(x1,…,xn)\varphi(x_1, \ldots, x_n) is an nn-ary predicate if its truth value is determined once values are assigned to each of the variables x1,x2,…,xnx_1, x_2, \ldots, x_n (or equivalently, replacing each variable by a term denoting a specific object produces a proposition).

  • A 11-ary (monadic) predicate describes a property, e.g., IsPrime(x)\text{IsPrime}(x).
  • A 22-ary (dyadic) predicate describes a relation between two terms, e.g., IsGreaterThan(x,y)\text{IsGreaterThan}(x, y).
  • An nn-ary predicate describes a relation among nn terms.

Note that we would usually write such a declaration as: let P(x)P(x) be the statement ”x2−1=0x^2-1=0.”

Remark.

A term by itself is not a complete sentence, so it has no truth value; likewise, as hinted earlier the resulting expressions above (x>3x>3) are still not propositions because their truth value depends on the actual value of xx.

Applying a predicate to the appropriate number of terms gives an atomic formula, the simplest kind of formula in first-order logic; for example, if PP is the predicate “is prime,” then P(x)P(x) and P(7)P(7) are atomic formulas. If all the terms in an atomic formula denote specific objects, then the formula has a definite truth value and is a proposition.

Example 2.2.

Let R(x,y,z)R(x, y, z) denote x+y=zx + y = z, where the variables range over the integers. Then R(2,−1,5)R(2, -1, 5) is ⊥\bot since 2+(−1)≠52 + (-1) \neq 5; R(3,4,7)R(3, 4, 7) is ⊤\top since 3+4=73 + 4 = 7; and R(x,3,z)R(x, 3, z) is still a predicate, since x+3=zx + 3 = z can be ⊤\top or ⊥\bot depending on the values of xx and zz.

Remark.

It is common to use capital letters such as P,Q,RP, Q, R to denote predicates.

A predicate’s variables take values in a domain UU, called the universe of discourse (in the previous example, UU is the integers). Once values from UU are substituted, the predicate becomes a proposition with truth value ⊤\top or ⊥\bot; hence we can now apply the logical connectives introduced earlier.

Example 2.3.

Let P(x)P(x) denote x>0x > 0. Then the following are true: P(3)∨P(−1),P(3) \lor P(-1), P(3)→¬P(−1);P(3) \to \neg P(-1); and the following are false: P(3)∧P(−1),P(3) \land P(-1), P(3)→P(−1)P(3) \to P(-1).

More generally, we can build new predicates out of old ones using connectives. Expressions constructed from predicates and logical connectives whose truth value still depends on one or more variables are called propositional functions.

Example 2.4.

Using P(x)P(x) as above, the following are propositional functions:

R(x,y)=defP(x)→P(y),S(y)=defP(3)∧P(y)R(x, y) \defeq P(x) \to P(y), \qquad S(y) \defeq P(3) \land P(y)

R(x,y)R(x, y) is a predicate in two variables; S(y)S(y) is a predicate in one variable (since P(3)P(3) is already a proposition).

Problem 2.1.

Consider the expressions man(x)\text{man}(x), x>3x > 3, and 2+3=52 + 3 = 5. Which of these are propositions and which are predicates? For each predicate, give one substitution that makes it ⊤\top and one that makes it ⊥\bot.

Remark (History and Significance of Predicate Logic).

Aristotle developed a limited form of predicate logic through his theory of syllogisms. The modern version was independently developed by Frege and Peirce between the 19th and 20th centuries, roughly 2000 years later, mirroring the timeline of propositional logic itself. Predicate logic (also called first-order logic) is now the standard language for mathematical statements and is equally fundamental in computer science, appearing in database queries, logic programming (Prolog), automated theorem proving, software verification, and symbolic AI. Some mathematicians, notably Hilbert, hoped it would be a complete system for all of mathematics, but Gödel’s incompleteness theorem showed otherwise: no fixed collection of axioms can prove all true mathematical statements.

Introduction to Sets

We take a quick detour to study sets. Sets are probably the most important structure in mathematics right now; a precise answer as to why they are so important would fill an entire course, but for our purposes it might suffice as a rather crude approximation to say that sets are the building blocks of all mathematics.

Being so important, we introduce them now and will study them in greater detail later. For the moment, the following informal definition will suffice.

Definition 2.5 (Set (to be revised)).

A set is nothing more than a collection of objects. The objects in the collection are called its elements or members. We usually denote sets by uppercase letters A,B,S,…A,B,S,\dots, and elements by lowercase letters a,b,x,…a,b,x,\dots. If SS is a set, then x∈Sx \in S means ”xx is an element of SS;” sometimes we also write S∋xS \ni x for x∈Sx \in S and say ”SS contains xx.” Also worth talking about, is it’s negation: x∉Sx \notin S or ¬(x∈S)\neg(x \in S), means ”xx is not an element of SS,” or ”xx does not belong to SS;” when needed (not often), some write S∌xS \not\ni x which stands for ”SS does not contain xx.”

Example 2.6.

Let S={2,3,5}S = \{2,3,5\}. Then 3∈S3 \in S, but 4∉S4 \notin S.

Remark.

Membership is a relation between an element and a set. That said, a set can itself be an element of another set. For example, {2,3}∈{{2,3},5},\{2,3\} \in \{\{2,3\},5\}, because the collection on the right has two elements: the set {2,3}\{2,3\} and the number 55; The problem arises when this is confused with the case where only the original objects are elements: {2,3}∉{2,3,5}.\{2,3\} \notin \{2,3,5\}. So a∈Aa \in A asks whether aa is literally a member of the collection AA, not merely whether its contents appear among the elements of AA.

Problem 2.2.

Let S={2,3,5}.S = \{2,3,5\}. Which of the following are true?

(a) 3∈S3 \in S

(b) 4∉S4 \notin S

(c) 5∈S5 \in S

(d) 1∈S1 \in S

There is one refinement we will need: Not every collection is useful in mathematics, for example, “a collection of all beautiful paintings” doesn’t make sense because whether a painting belongs to it depends on the judge; with a different panel of judges we might get a different result, “beauty is in the eye of the beholder” afterall.

Either way, to combat this we normally restrict ourselves to what is called a well-defined set. Informally, a well-defined set is a set such that, for every object, there is a specific objective rule that allows us to determine whether the object belongs to the set or not; one or the other must happen, but not both. Well aside from being a mouthfull, this definition runs into the same exact problems we introduced earlier; our current model cannot describe this so we finally introduce one which can.

Quantifiers

Next we make claims about all values in a domain, or assert that at least one satisfying value exists. These are the universal and existential quantifiers.

The Universal Quantifier

Definition 2.7 (Universal Quantifier).

Let φ(x)\varphi(x) be a predicate with variable xx ranging over a universe of discourse UU. The universal quantification of xx in φ\varphi, written ∀x (φ(x))\forall x\,(\varphi(x)), is the proposition asserting that φ(a)\varphi(a) is ⊤\top for every element a∈Ua \in U. It is read “for all xx, φ(x)\varphi(x).”

Determining the truth of ∀x (φ(x))\forall x\,(\varphi(x)) amounts to exhaustive verification: examine every object in the universe, and if even one makes φ\varphi false, the entire statement is false. If every object passes, the statement is true; a value aa for which φ(a)=⊥\varphi(a) = \bot is called a counterexample.

If the universe is the collection U={a1,a2,…,an}U = \{a_1, a_2, \ldots, a_n\}, the universal quantifier reduces to a conjunction:

∀x (φ(x))≡φ(a1)∧φ(a2)∧⋯∧φ(an)\forall x\,(\varphi(x)) \equiv \varphi(a_1) \land \varphi(a_2) \land \cdots \land \varphi(a_n)

Remark (Indexed Conjunction and Disjunction).

When a conjunction or disjunction extends over a collection of terms, we write

⋀i=1nφ(ai)  =def  φ(a1)∧φ(a2)∧⋯∧φ(an),⋁i=1nφ(ai)  =def  φ(a1)∨φ(a2)∨⋯∨φ(an)\bigwedge_{i=1}^{n} \varphi(a_i) \;\defeq\; \varphi(a_1) \land \varphi(a_2) \land \cdots \land \varphi(a_n), \qquad \bigvee_{i=1}^{n} \varphi(a_i) \;\defeq\; \varphi(a_1) \lor \varphi(a_2) \lor \cdots \lor \varphi(a_n)

More generally, for any index set SS the notations ⋀a∈Sφ(a)\bigwedge_{a \in S} \varphi(a) and ⋁a∈Sφ(a)\bigvee_{a \in S} \varphi(a) denote the conjunction and disjunction, respectively, of φ(a)\varphi(a) over every aa in SS. In this notation, the finite-universe equivalences above become ∀x (φ(x))≡⋀a∈Uφ(a)\forall x\,(\varphi(x)) \equiv \bigwedge_{a \in U} \varphi(a) and, as we shall see shortly, ∃x (φ(x))≡⋁a∈Uφ(a)\exists x\,(\varphi(x)) \equiv \bigvee_{a \in U} \varphi(a).

Specifying the Quantification Set

Earlier our description of a quantification states that it “ranges over a universe of discourse,” take for example the sentence

∀x (x2⩾0)\forall x\, (x^2 \geqslant 0)

which may look true, but as it stands it is meaningless. What is xx? “For every xx” from where? If xx ranges over colours, or over sentences, then x2⩾0x^2 \geqslant 0 is not false, it is not even grammatical. We need to know where the object xx comes from before we can ask whether the claim about it is true.

If we amend the sentence so that xx ranges over the real numbers, we get a well-formed statement, and a true one. If instead we let xx range over the complex numbers, we get an equally well-formed statement that is now false: the imaginary unit ii is a complex number with i2=−1i^2 = -1, and −1⩾0-1 \geqslant 0 fails. (We will make little real use of the complex numbers in these notes, but they are a convenient source of counterexamples.)

Example 2.8.

Let P(x)P(x) denote ”x>0x > 0.”

If the universe is the integers, then ∀x (P(x))\forall x\,(P(x)) is ⊥\bot: the value x=0x = 0 is a counterexample, since P(0)P(0) is false. If UU is the positive integers (the natural numbers greater than 0), then ∀x (P(x))\forall x\,(P(x)) is ⊤\top. The truth value of a universally quantified statement depends on the choice of universe.

The Existential Quantifier

Definition 2.9 (Existential Quantifier).

Let φ(x)\varphi(x) be a predicate with variable xx ranging over a universe UU. The existential quantification of xx in φ\varphi, written ∃x (φ(x))\exists x\,(\varphi(x)), is the proposition asserting that there is at least one element a∈Ua \in U for which φ(a)\varphi(a) is ⊤\top. It is read “there exists an xx such that φ(x)\varphi(x).”

Where the universal quantifier demands exhaustive verification, the existential quantifier demands a search: examine objects in the universe until one satisfies φ\varphi. If such an object is found, it is called a witness and the statement is true. If the entire universe is exhausted without finding a witness, the statement is false.

If the universe is the collection U={a1,a2,…,an}U = \{a_1, a_2, \ldots, a_n\}, the existential quantifier reduces to a disjunction:

∃x (φ(x))≡φ(a1)∨φ(a2)∨⋯∨φ(an)\exists x\,(\varphi(x)) \equiv \varphi(a_1) \lor \varphi(a_2) \lor \cdots \lor \varphi(a_n)

If ∀x (φ(x))\forall x\,(\varphi(x)) is true and UU is non-empty, then ∃x (φ(x))\exists x\,(\varphi(x)) must also be true: if every element satisfies φ\varphi, at least one does.

Example 2.10.

Let P(x)P(x) denote ”x>0x > 0.”

∃x (P(x))\exists x\,(P(x)) is ⊤\top when the universe is the integers (witness: x=1x = 1), ⊤\top when UU is the positive integers, and ⊥\bot when UU is the negative integers.

The following table summarises the two quantifiers:

StatementTrue whenFalse when
∀x (P(x))\forall x\,(P(x))P(x)P(x) is ⊤\top for every x∈Ux \in UThere exists a counterexample: some aa with P(a)=⊥P(a) = \bot
∃x (P(x))\exists x\,(P(x))There exists a witness: some aa with P(a)=⊤P(a) = \topP(x)P(x) is ⊥\bot for every x∈Ux \in U

Remark (Quantifiers and Finite Domains).

If the domain is finite, quantifiers are technically unnecessary: ∀x (P(x))\forall x\,(P(x)) is a conjunction and ∃x (P(x))\exists x\,(P(x)) is a disjunction, both expressible in propositional logic. Quantifiers are needed for infinite domains, where no finite conjunction or disjunction suffices.

Scope and Variable Binding

Definition 2.11 (Scope, Bound Variables, and Free Variables).

The scope of a quantifier is the portion of the formula to which it applies, typically delimited by parentheses. A variable that falls within the scope of a quantifier is bound to that quantifier. A variable not bound by any quantifier is free. A formula with free variables is a predicate, and becomes a proposition only when all free variables are either substituted by terms or bound by quantifiers.

This is why we bracket the body of a quantifier. Quantifiers bind more tightly than all propositional connectives, so an unbracketed formula is read as narrowly as possible:

∀x P(x)∨Q(x)means(∀x (P(x)))∨Q(x)\forall x\, P(x) \lor Q(x) \quad \text{means} \quad \bigl(\forall x\,(P(x))\bigr) \lor Q(x)

This expression has a free variable xx in Q(x)Q(x) and is therefore a predicate. The two xx‘s are in fact independent: the expression could equivalently be written (∀y (P(y)))∨Q(x)\bigl(\forall y\,(P(y))\bigr) \lor Q(x). By contrast, ∀x (P(x)∨Q(x))\forall x\,(P(x) \lor Q(x)) has both occurrences of xx inside the brackets, so both are bound, and the result is a proposition.

Earlier it was shown that a quantifier always comes with a set attached, either named outright or fixed in advance as the universe of discourse. Writing that set into the quantifier itself is common, and has its own notation.

Definition 2.12 (Bounded Quantifiers).

Let AA be a set and let P(x)P(x) be a predicate. The bounded quantifiers are defined by

∀x∈A (P(x))  =def  ∀x (x∈A→P(x)),∃x∈A (P(x))  =def  ∃x (x∈A∧P(x))\forall x \in A\,(P(x)) \;\defeq\; \forall x\,(x \in A \to P(x)), \qquad \exists x \in A\,(P(x)) \;\defeq\; \exists x\,(x \in A \land P(x))

read “for every xx in AA, P(x)P(x)” and “there is an xx in AA with P(x)P(x).” When several variables share a set we abbreviate further, writing ∀x,y∈A (P(x,y))\forall x, y \in A\,(P(x,y)) for ∀x∈A ∀y∈A (P(x,y))\forall x \in A\, \forall y \in A\,(P(x,y)), and likewise ∃x,y∈A (P(x,y))\exists x, y \in A\,(P(x,y)) for ∃x∈A ∃y∈A (P(x,y))\exists x \in A\, \exists y \in A\,(P(x,y)).

The restriction enters the universal quantifier through an implication and the existential one through a conjunction, and the pairing cannot be swapped. The statement ∃x (x∈A→P(x))\exists x\,(x \in A \to P(x)) is made true by any object outside AA whatsoever, since a false antecedent makes the implication true, so it says nothing about the elements of AA at all.

The Unique Existential Quantifier

It is often useful to assert that exactly one object satisfies a predicate.

Definition 2.13 (Unique Existential Quantifier).

The unique existential quantification ∃! x (φ(x))\exists!\, x\,(\varphi(x)) asserts that exactly one element of UU satisfies φ\varphi. It is defined in terms of the other quantifiers:

∃! x (φ(x))  ≡  ∃x (φ(x)∧∀y (φ(y)→y=x))\exists!\, x\,(\varphi(x)) \;\equiv\; \exists x\,\bigl(\varphi(x) \land \forall y\,(\varphi(y) \to y = x)\bigr)

This reads: “there exists an xx such that φ(x)\varphi(x), and any yy satisfying φ(y)\varphi(y) must equal xx.” It takes a bounded form like the other two: for a set AA,

∃! x∈A (P(x))  =def  ∃! x (x∈A∧P(x))\exists!\, x \in A\,(P(x)) \;\defeq\; \exists!\, x\,(x \in A \land P(x))

Example 2.14.

Let UU be the integers and let P(x)P(x) denote ”x+1=0x + 1 = 0.” Then ∃! x∈U (P(x))\exists!\, x \in U\,(P(x)) is ⊤\top: the unique witness is x=−1x = -1. If instead P(x)P(x) denotes ”x>0x > 0,” then ∃! x∈U (P(x))\exists!\, x \in U\,(P(x)) is ⊥\bot, since every positive integer satisfies PP and there are infinitely many of them.

Formalising Arguments

We can now symbolise the prime-number argument that propositional logic could not handle. Let UU be the integers, let P(x)P(x) denote ”xx is a prime number greater than 22,” and let O(x)O(x) denote ”xx is odd.”

  1. “Every prime number greater than 22 is odd” becomes ∀x∈U (P(x)→O(x))\forall x \in U\,(P(x) \to O(x)).
  2. “The number 77 is a prime number greater than 22” becomes P(7)P(7).
  3. By substituting x=7x = 7 into (1) we obtain P(7)→O(7)P(7) \to O(7). Since P(7)P(7) is true by (2) and the conditional P(7)→O(7)P(7) \to O(7) is true, bivalence forces O(7)O(7) to be true: ”77 is odd.”

More broadly, the four classical categorical propositions of Aristotelian logic can be expressed in first-order form. Given predicates S(x)S(x) and R(x)R(x) over a universe UU:

TypeStatementFirst-order form
AAll SS are RR∀x∈U (S(x)→R(x))\forall x \in U\,(S(x) \to R(x))
ENo SS is RR∀x∈U (S(x)→¬R(x))\forall x \in U\,(S(x) \to \neg R(x))
ISome SS is RR∃x∈U (S(x)∧R(x))\exists x \in U\,(S(x) \land R(x))
OSome SS is not RR∃x∈U (S(x)∧¬R(x))\exists x \in U\,(S(x) \land \neg R(x))

Remark (The Connective Trap).

A common error is to write ∀x∈U (S(x)∧R(x))\forall x \in U\,(S(x) \land R(x)), which makes the much stronger claim that everything in the universe is both SS and RR. Equally, ∃x∈U (S(x)→R(x))\exists x \in U\,(S(x) \to R(x)) is almost always vacuously true: any element that is not SS makes the implication true and serves as a witness.

Example 2.15 (Translating Natural Language).

Let UU be all people, let S(x)S(x) denote ”xx is a student in this class,” and let P(x)P(x) denote ”xx has written a programme in Python.”

“Every student in this class has written a programme in Python” is formalised as ∀x∈U (S(x)→P(x))\forall x \in U\,(S(x) \to P(x)).

“Some student in this class has written a programme in Python” is formalised as ∃x∈U (S(x)∧P(x))\exists x \in U\,(S(x) \land P(x)).

Quantifier Negation

The universal and existential quantifiers are duals, connected by negation in a manner analogous to De Morgan’s laws for conjunction and disjunction.

Theorem 2.16 (Quantifier Negation).

For any predicate φ(x)\varphi(x) with universe UU:

(1) ¬(∀x (φ(x)))≡∃x (¬φ(x))\neg\bigl(\forall x\,(\varphi(x))\bigr) \equiv \exists x\,(\neg\varphi(x))

(2) ¬(∃x (φ(x)))≡∀x (¬φ(x))\neg\bigl(\exists x\,(\varphi(x))\bigr) \equiv \forall x\,(\neg\varphi(x))

Discussion.

The propositional laws of the last chapter say nothing about quantifiers, so we read each quantifier as what it abbreviates: a universal statement is a conjunction over the whole universe, an existential one a disjunction. Written that way, each claim is an instance of the generalised De Morgan law (the negation of a long conjunction is the long disjunction of the negations, and conversely), and the last step reads the answer back as a quantifier. The second part is the first with the two connectives exchanged.

Proof.

The two quantifiers expand into an indexed conjunction and an indexed disjunction over UU:

∀x (φ(x))≡⋀a∈Uφ(a),∃x (φ(x))≡⋁a∈Uφ(a)\forall x\,(\varphi(x)) \equiv \bigwedge_{a \in U} \varphi(a), \qquad \exists x\,(\varphi(x)) \equiv \bigvee_{a \in U} \varphi(a)

(1)

¬(∀x (φ(x)))≡¬(⋀a∈Uφ(a))by the expansion of ∀≡⋁a∈U¬φ(a)by generalised De Morgan≡∃x (¬φ(x))by the expansion of ∃\begin{aligned} \neg\bigl(\forall x\,(\varphi(x))\bigr) &\equiv \neg\Bigl(\bigwedge_{a \in U} \varphi(a)\Bigr) && \text{by the expansion of } \forall \\ &\equiv \bigvee_{a \in U} \neg\varphi(a) && \text{by generalised De Morgan} \\ &\equiv \exists x\,(\neg\varphi(x)) && \text{by the expansion of } \exists \end{aligned}

(2)

¬(∃x (φ(x)))≡¬(⋁a∈Uφ(a))by the expansion of ∃≡⋀a∈U¬φ(a)by generalised De Morgan≡∀x (¬φ(x))by the expansion of ∀\begin{aligned} \neg\bigl(\exists x\,(\varphi(x))\bigr) &\equiv \neg\Bigl(\bigvee_{a \in U} \varphi(a)\Bigr) && \text{by the expansion of } \exists \\ &\equiv \bigwedge_{a \in U} \neg\varphi(a) && \text{by generalised De Morgan} \\ &\equiv \forall x\,(\neg\varphi(x)) && \text{by the expansion of } \forall \end{aligned}

Remark (De Morgan over a Universe).

The generalised De Morgan’s laws were stated for nn propositions, and the proof above applies them to a conjunction indexed by UU, which need not be finite (we explore this in a second). When U={a1,…,an}U = \{a_1, \ldots, a_n\}, the step is the corollary verbatim:

¬(φ(a1)∧⋯∧φ(an))≡¬φ(a1)∨⋯∨¬φ(an)\neg\bigl(\varphi(a_1) \land \cdots \land \varphi(a_n)\bigr) \equiv \neg\varphi(a_1) \lor \cdots \lor \neg\varphi(a_n)

Which has an immediate consequences: ∀x (φ(x))≡¬(∃x (¬φ(x)))\forall x\,(\varphi(x)) \equiv \neg\bigl(\exists x\,(\neg\varphi(x))\bigr) and ∃x (φ(x))≡¬(∀x (¬φ(x)))\exists x\,(\varphi(x)) \equiv \neg\bigl(\forall x\,(\neg\varphi(x))\bigr).

Example 2.17 (Negating in English).

Let UU be the real numbers.

  1. “There is a real number xx with x2=−1x^2 = -1,” in symbols ∃x∈U (x2=−1)\exists x \in U\,(x^2 = -1), is ⊥\bot. Its negation is the universal statement “for every real number xx, x2≠−1x^2 \neq -1,” which is ⊤\top.
  2. “Every real number is positive or negative,” in symbols ∀x∈U (x>0∨x<0)\forall x \in U\,(x > 0 \lor x < 0), is ⊥\bot: the counterexample is x=0x = 0. Its negation is ∃x∈U ¬(x>0∨x<0)\exists x \in U\,\neg(x > 0 \lor x < 0), and De Morgan’s laws turn the negated disjunction into a conjunction, giving ∃x∈U (x⩽0∧x⩾0)\exists x \in U\,(x \leqslant 0 \land x \geqslant 0): “there is a real number that is neither positive nor negative.” It is ⊤\top, with x=0x = 0 doing the existing.

Negation and Bounded Quantifiers

The bounded notation of Definition 2.12 is coherent with negation. Applying the theorem to a set SS:

¬(∀x∈S (P(x)))≡∃x∈S (¬P(x))and¬(∃x∈S (P(x)))≡∀x∈S (¬P(x))\neg\bigl(\forall x \in S\,(P(x))\bigr) \equiv \exists x \in S\,(\neg P(x)) \quad \text{and} \quad \neg\bigl(\exists x \in S\,(P(x))\bigr) \equiv \forall x \in S\,(\neg P(x))

The restricted domain is preserved under negation: only the predicate is negated, not the domain condition. Unfolding the first one confirms this. Writing the bounded quantifier out in full, negating, and using the negation of a conditional:

¬(∀x (x∈S→P(x)))≡∃x ¬(x∈S→P(x))≡∃x (x∈S∧¬P(x))\neg\bigl(\forall x\,(x \in S \to P(x))\bigr) \equiv \exists x\,\neg(x \in S \to P(x)) \equiv \exists x\,(x \in S \land \neg P(x))

which is the bounded existential ∃x∈S (¬P(x))\exists x \in S\,(\neg P(x)).

Problem 2.3.

Show the negation of the existential claim to be true.

Distribution of Quantifiers over Connectives

The universal quantifier distributes over conjunction, and the existential quantifier distributes over disjunction:

∀x (P(x)∧Q(x))≡∀x (P(x))∧∀x (Q(x))\forall x\,(P(x) \land Q(x)) \equiv \forall x\,(P(x)) \land \forall x\,(Q(x)) ∃x (P(x)∨Q(x))≡∃x (P(x))∨∃x (Q(x))\exists x\,(P(x) \lor Q(x)) \equiv \exists x\,(P(x)) \lor \exists x\,(Q(x))

However, the reverse pairings do not hold in general:

∃x (P(x)∧Q(x))  ≢  ∃x (P(x))∧∃x (Q(x))\exists x\,(P(x) \land Q(x)) \;\not\equiv\; \exists x\,(P(x)) \land \exists x\,(Q(x)) ∀x (P(x)∨Q(x))  ≢  ∀x (P(x))∨∀x (Q(x))\forall x\,(P(x) \lor Q(x)) \;\not\equiv\; \forall x\,(P(x)) \lor \forall x\,(Q(x))

For both non-equivalences, a single counterexample suffices: Let U={a,b}U = \{a, b\}, with P(x)P(x) true exactly of aa and Q(x)Q(x) true exactly of bb. Then ∃x,P(x)∧∃x,Q(x)\exists x,P(x) \land \exists x,Q(x) is ⊤\top (witnesses aa and bb), but ∃x,(P(x)∧Q(x))\exists x,(P(x) \land Q(x)) is ⊥\bot, since P(a)∧Q(a)P(a) \land Q(a) fails on the second conjunct and P(b)∧Q(b)P(b) \land Q(b) on the first. Likewise ∀x,(P(x)∨Q(x))\forall x,(P(x) \lor Q(x)) is ⊤\top (it holds at aa via PP and at bb via QQ), while ∀x,P(x)∨∀x,Q(x)\forall x,P(x) \lor \forall x,Q(x) is ⊥\bot, since P(b)P(b) and Q(a)Q(a) both fail.

Problem 2.4.

Come up with your own example as to why this fails, what situation does it not fail?

Validity and Satisfiability in Predicate Logic

Just as in propositional logic, a quantified statement with all variables bound can be classified by its truth behaviour across all possible interpretations. A statement is valid if it is true for every domain and every choice of predicates (the analogue of a tautology), satisfiable if there exists at least one domain and choice of predicates making it true, and unsatisfiable if no such choice exists.

Example 2.18.

The statement ∀x (¬S(x))↔¬∃x (S(x))\forall x\,(\neg S(x)) \leftrightarrow \neg\exists x\,(S(x)) is valid: it is an instance of Theorem 2.16 and holds for any predicate SS and any domain.

The statement ∀x (F(x)↔T(x))\forall x\,(F(x) \leftrightarrow T(x)) is satisfiable: taking F≡TF \equiv T makes it true, while taking the domain to be the integers with F(x)≡(x>0)F(x) \equiv (x > 0) and T(x)≡(x<0)T(x) \equiv (x < 0) makes it false.

The statement ∀x (F(x)∧¬F(x))\forall x\,(F(x) \land \neg F(x)) is unsatisfiable: it asserts that every element simultaneously satisfies and fails to satisfy FF, contradicting the principle of bivalence.

Problem 2.5.

Let PP be a predicate over an arbitrary universe UU. Determine whether each of the following statements is valid, satisfiable, or unsatisfiable, and justify your answer.

(a) ∃! x∈U (P(x))→∃x∈U (P(x))\exists!\, x \in U\,(P(x)) \to \exists x \in U\,(P(x))

(b) ∀x∈U (P(x))→∃! x∈U (P(x))\forall x \in U\,(P(x)) \to \exists!\, x \in U\,(P(x))

(c) ∃! x∈U (¬P(x))→¬∀x∈U (P(x))\exists!\, x \in U\,(\neg P(x)) \to \neg\forall x \in U\,(P(x))

Problem 2.6.

Let UU be all English texts, and let P(x)P(x), Q(x)Q(x) and R(x)R(x) denote ”xx is a clear explanation”, ”xx is satisfactory”, and ”xx is an excuse” respectively. Formalise the following in predicate logic:

(a) All clear explanations are satisfactory.

(b) Some excuses are unsatisfactory.

(c) Some excuses are not clear explanations.

Problem 2.7.

Let ZZ be the integers and let RR be the real numbers. Using Theorem 2.16 , negate each of the following statements and simplify. State whether the original or its negation is true.

(a) ∀x∈Z (x2⩾0)\forall x \in Z\,(x^2 \geqslant 0)

(b) ∃x∈R (x2<0)\exists x \in R\,(x^2 < 0)

(c) ∀x∈R ∃y∈R (x+y=0)\forall x \in R\,\exists y \in R\,(x + y = 0)

Nested Quantifiers

The statements encountered so far have involved a single quantifier binding a single variable. Many mathematical claims, however, involve multiple variables and require several quantifiers applied in sequence. A nested quantifier is a quantifier that falls within the scope of another quantifier.

Example 2.19 (Additive Inverse).

The statement “every real number has an additive inverse” involves two variables: the number itself and its inverse. Letting UU be the real numbers, the formalisation is:

∀x∈U ∃y∈U (x+y=0)\forall x \in U\, \exists y \in U\,(x + y = 0)

The outer quantifier ∀x∈U\forall x \in U asserts that the claim holds for every real xx. The inner quantifier ∃y∈U\exists y \in U asserts that, for each such xx, a suitable yy exists. The two quantifiers are nested: ∃y∈U\exists y \in U lies within the scope of ∀x∈U\forall x \in U.

A nested quantified statement can be decomposed by treating each inner quantification as a propositional function. For instance, ∀x∈U ∃y∈U (x+y=0)\forall x \in U\, \exists y \in U\,(x + y = 0) can be read as ∀x∈U (Q(x))\forall x \in U\,(Q(x)), where Q(x)=def∃y∈U (P(x,y))Q(x) \defeq \exists y \in U\,(P(x, y)) and P(x,y)=def(x+y=0)P(x, y) \defeq (x + y = 0). Note that Q(x)Q(x) is itself a predicate: the existential quantifier binds yy, but xx remains free until the outer ∀x∈U\forall x \in U binds it.

Order of Quantifiers

The order in which quantifiers appear is critical. Consider the same predicate P(x,y)=def(x+y=0)P(x, y) \defeq (x + y = 0), with UU still the real numbers.

∀x∈U ∃y∈U (P(x,y))\forall x \in U\, \exists y \in U\,(P(x, y)) asserts: “for every real xx, there exists a real yy such that x+y=0x + y = 0.” This is ⊤\top: for any given xx, the witness y=−xy = -x works. Crucially, the witness may differ for each xx.

∃y∈U ∀x∈U (P(x,y))\exists y \in U\, \forall x \in U\,(P(x, y)) asserts: “there exists a single real yy such that x+y=0x + y = 0 for every real xx.” This is ⊥\bot: no single number is the additive inverse of every real number.

The difference shows up in how one would search for the answer. In the first statement, we walk through the values of xx one at a time and look for a fresh yy at each step. In the second, we pick a candidate yy first and then test it against every xx. The quantifier order dictates which variable is chosen first, and therefore which one the other is allowed to depend on.

Example 2.20 (Order Changes the Meaning).

Let UU be the real numbers and let p(m,n)p(m, n) denote ”m>nm > n.” Then ∀n∈U ∃m∈U (p(m,n))\forall n \in U\, \exists m \in U\,(p(m, n)) says “for every number there is a larger one,” which is ⊤\top; the witness m=n+1m = n + 1 works for each nn. Flipping the two quantifiers, ∃m∈U ∀n∈U (p(m,n))\exists m \in U\, \forall n \in U\,(p(m, n)) says “there is a number larger than every number,” which is ⊥\bot; among other embarrassments, such an mm would have to satisfy m>mm > m (this will be important in a second).

Example 2.21 (Captains).

Let XX be the professional footballers, let YY be the clubs, and let p(x,y)p(x, y) denote ”xx is the captain of yy.” Four formally similar statements have four very different meanings:

  1. ∀x∈X ∃y∈Y (p(x,y))\forall x \in X\, \exists y \in Y\,(p(x, y)): every footballer is some club’s captain. ⊥\bot.
  2. ∃y∈Y ∀x∈X (p(x,y))\exists y \in Y\, \forall x \in X\,(p(x, y)): there is one club whose captain is every footballer at once. ⊥\bot, and its dressing room does not bear thinking about.
  3. ∀y∈Y ∃x∈X (p(x,y))\forall y \in Y\, \exists x \in X\,(p(x, y)): every club has a captain. ⊤\top.
  4. ∃x∈X ∀y∈Y (p(x,y))\exists x \in X\, \forall y \in Y\,(p(x, y)): there is one footballer who captains every club. ⊥\bot.

Only the quantifier order and the choice of which set each variable is drawn from separate these.

Problem 2.8.

Negate statement (3) of the example above, “every club has a captain,” pushing the negation all the way inside. Then say the result in football English.

However, quantifiers of the same type may be freely reordered:

∀x∈U ∀y∈U (P(x,y))≡∀y∈U ∀x∈U (P(x,y))\forall x \in U\, \forall y \in U\,(P(x, y)) \equiv \forall y \in U\, \forall x \in U\,(P(x, y)) ∃x∈U ∃y∈U (P(x,y))≡∃y∈U ∃x∈U (P(x,y))\exists x \in U\, \exists y \in U\,(P(x, y)) \equiv \exists y \in U\, \exists x \in U\,(P(x, y))

Both nested universal quantifiers demand that PP hold for every pair, and both nested existential quantifiers demand that at least one pair satisfies PP. In neither case does the order in which pairs are examined affect the outcome.

Quantification Fixes a Variable

Let XX be the even integers greater than or equal to 44, let PP be the prime numbers, and for n∈Xn \in X and a,b∈Pa, b \in P let Q(n,a,b)Q(n, a, b) denote ”a+b=na + b = n.” Consider

∀n∈X ∃a,b∈P (Q(n,a,b))\forall n \in X\, \exists a, b \in P\,(Q(n, a, b))

The initial quantification ∀n∈X\forall n \in X serves to fix a value of nn, which is then used for the rest of the statement. The assertion that follows, that there are primes aa and bb with a+b=na + b = n, is made about that fixed but arbitrary value. Read as a whole, the statement says that no matter which nn is chosen from XX, we can find aa and bb satisfying QQ. The order of quantification is what tells us those values may depend on the chosen nn.

Take a particular value. We know 8∈X8 \in X, since 88 is even and 8⩾48 \geqslant 4. Can we find a,b∈Pa, b \in P with a+b=8a + b = 8? We can take a=3a = 3 and b=5b = 5. Now take n=14n = 14; our choices have to be different from before, and a=3a = 3, b=11b = 11 will do (as will a=b=7a = b = 7). This is what we mean when we say that aa and bb depend on nn.

Problem 2.9.

What is the difference between the statement above and the following one?

∃n∈X ∃a,b∈P (Q(n,a,b))\exists n \in X\, \exists a, b \in P\,(Q(n, a, b))

Is it ⊤\top or ⊥\bot? Why?

Remark.

The universal statement ∀n∈X ∃a,b∈P (Q(n,a,b))\forall n \in X\, \exists a, b \in P\,(Q(n, a, b)) is the Goldbach Conjecture, met as a proposition of unknown truth value in the previous chapter. Checking n=8n = 8 and n=14n = 14 settles two instances; it does not settle the statement, because a universal quantifier over an infinite set is not exhausted by any number of instances; but a single nn for which no such aa and bb exist would settle it the other way.

Example 2.22 (Translating from Mathematics).

The statement “the sum of two positive integers is always positive” contains implicit quantifiers and a hidden domain. Making these explicit step by step:

  1. Rewrite with explicit quantifiers: “for every two integers, if both are positive, then their sum is positive.”
  2. Introduce variables: “for all integers xx and yy, if x>0x > 0 and y>0y > 0, then x+y>0x + y > 0.”
  3. Formalise, taking UU to be the integers:
∀x,y∈U (x>0∧y>0→x+y>0)\forall x, y \in U\,(x > 0 \land y > 0 \to x + y > 0)

Example 2.23 (Carrying Restrictions Along).

The Archimedean principle says that if bb and ss are positive numbers, there is a natural number nn with ns>bns > b. This holds however large bb is and however small ss is.

Let UU be the real numbers, let NN be the natural numbers, and let p(b,s,n)p(b, s, n) denote ”ns>bns > b.” If we agree in advance that bb and ss range over the positive reals and nn over the natural numbers, the principle encodes compactly. If instead all three variables range over UU, we have to carry the restrictions ourselves:

∀b,s∈U ((b>0∧s>0)→∃n (n∈N∧p(b,s,n)))\forall b, s \in U\,\Bigl((b > 0 \land s > 0) \to \exists n\,\bigl(n \in N \land p(b, s, n)\bigr)\Bigr)

read “for every bb and ss, if both are positive, then there is a natural number nn satisfying ns>bns > b.” Writing LL for the positive real numbers, the bounded quantifiers of Definition 2.12 package the same statement as

∀b,s∈L ∃n∈N (p(b,s,n))\forall b, s \in L\, \exists n \in N\,(p(b, s, n))

The two say the same thing, and the second is shorter.

Example 2.24 (Translating Natural Language).

Let UU be all people and let L(x,y)L(x, y) denote ”xx loves yy.”

Everybody loves somebody.∀x∈U ∃y∈U (L(x,y))There is someone who is loved by everyone.∃x∈U ∀y∈U (L(y,x))There is someone who loves someone.∃x,y∈U (L(x,y))Everyone loves themselves.∀x∈U (L(x,x))\begin{array}{ll} \text{Everybody loves somebody.} & \forall x \in U\, \exists y \in U\,(L(x, y)) \\[4pt] \text{There is someone who is loved by everyone.} & \exists x \in U\, \forall y \in U\,(L(y, x)) \\[4pt] \text{There is someone who loves someone.} & \exists x, y \in U\,(L(x, y)) \\[4pt] \text{Everyone loves themselves.} & \forall x \in U\,(L(x, x)) \end{array}

Observe how the English phrasing obscures the quantifier order; “Everybody loves somebody” places the universal quantifier first: each person has their own someone. “There is someone who is loved by everyone” places the existential first: a single person is loved by all. Despite their superficial similarity, the two statements are logically independent.

Problem 2.10.

Let UU be all students in a class and let F(x,y)F(x, y) denote ”xx and yy are friends.” Formalise the following in predicate logic, stating the set each variable is drawn from:

(a) Everyone has a friend.

(b) There is someone who is friends with everyone.

(c) No one is friends with everyone.

(d) There exists a pair of students who are not friends with each other.

Example 2.25 (Truth Values of Nested Statements).

Let UU be the real numbers. Determine the truth value of each statement:

(a) ∀x∈U ∃y∈U (x2=y)\forall x \in U\, \exists y \in U\,(x^2 = y) is ⊤\top: for any xx, choose y=x2y = x^2.

(b) ∀x∈U ∃y∈U (x=y2)\forall x \in U\, \exists y \in U\,(x = y^2) is ⊥\bot: taking x=−1x = -1, there is no real yy with y2=−1y^2 = -1.

(c) ∃x∈U ∀y∈U (xy=0)\exists x \in U\, \forall y \in U\,(xy = 0) is ⊤\top: choose x=0x = 0.

(d) ∃x,y∈U (x+y≠y+x)\exists x, y \in U\,(x + y \neq y + x) is ⊥\bot: addition of real numbers is commutative, so x+y=y+xx + y = y + x for all x,y∈Ux, y \in U. This is the negation of ∀x,y∈U (x+y=y+x)\forall x, y \in U\,(x + y = y + x), which is ⊤\top.

Problem 2.11.

Let UU be the integers. Determine the truth value of each statement, and justify your answer.

(a) ∀x∈U ∃y∈U (x⋅y=1)\forall x \in U\, \exists y \in U\,(x \cdot y = 1)

(b) ∃x∈U ∀y∈U (x+y=y)\exists x \in U\, \forall y \in U\,(x + y = y)

(c) ∀x,y∈U ∃z∈U (x+z=y)\forall x, y \in U\, \exists z \in U\,(x + z = y)

Negating Nested Quantifiers

Theorem 2.16 extends to nested quantifiers by repeated application. Each quantifier flips (∀↔∃\forall \leftrightarrow \exists) and the negation pushes inward:

¬(∀x ∃y (P(x,y)))≡∃x ¬(∃y (P(x,y)))≡∃x ∀y (¬P(x,y))\neg\bigl(\forall x\, \exists y\,(P(x, y))\bigr) \equiv \exists x\, \neg\bigl(\exists y\,(P(x, y))\bigr) \equiv \exists x\, \forall y\,(\neg P(x, y))

At each step, one quantifier is negated. The process terminates when the negation reaches the predicate.

Example 2.26.

Let UU be the real numbers and negate the statement ∀x∈U ∃y∈U (x+y=0)\forall x \in U\, \exists y \in U\,(x + y = 0), “every real number has an additive inverse.”

Applying the negation rules from outside in:

¬(∀x∈U ∃y∈U (x+y=0))≡∃x∈U ∀y∈U (x+y≠0)\neg\bigl(\forall x \in U\, \exists y \in U\,(x + y = 0)\bigr) \equiv \exists x \in U\, \forall y \in U\,(x + y \neq 0)

In English: “there is a real number with no additive inverse.” This is ⊥\bot, confirming that the original statement is ⊤\top.

Problem 2.12.

Let UU be the real numbers. Negate each of the following statements and simplify. State whether the original or its negation is true.

(a) ∀x,y∈U (x+y=y+x)\forall x, y \in U\,(x + y = y + x)

(b) ∃x∈U ∀y∈U (xy=0)\exists x \in U\, \forall y \in U\,(xy = 0)

(c) ∀x∈U ∃y,z∈U (y2+z2=x)\forall x \in U\, \exists y, z \in U\,(y^2 + z^2 = x)

Remark (Prenex Normal Form).

A formula is in Prenex Normal Form (PNF) if all quantifiers appear at the front, followed by a quantifier-free predicate:

Q1x1 Q2x2 ⋯ Qkxk (ψ(x1,x2,…,xk))Q_1 x_1\, Q_2 x_2\, \cdots\, Q_k x_k\,\bigl(\psi(x_1, x_2, \ldots, x_k)\bigr)

where each QiQ_i is either ∀\forall or ∃\exists, each variable ranges over the universe fixed in advance, and ψ\psi contains no quantifiers. For example, the statement ∃x (P(x))→∃x (Q(x))\exists x\,(P(x)) \to \exists x\,(Q(x)) is not in PNF because quantifiers appear on both sides of →\to. Rewriting using the defining equivalence of the conditional and renaming variables for clarity:

¬(∃x (P(x)))∨∃y (Q(y))≡∀x (¬P(x))∨∃y (Q(y))≡∀x ∃y (¬P(x)∨Q(y))\neg\bigl(\exists x\,(P(x))\bigr) \lor \exists y\,(Q(y)) \equiv \forall x\,(\neg P(x)) \lor \exists y\,(Q(y)) \equiv \forall x\, \exists y\,(\neg P(x) \lor Q(y))

The last expression is in PNF. Every statement in predicate logic can be converted to PNF using quantifier negation, variable renaming, and the distribution rules established earlier.

Problem 2.13.

Let PP and QQ be predicates over a universe UU. Convert the following to Prenex Normal Form:

(a) ∀x (P(x))→∃x (Q(x))\forall x\,(P(x)) \to \exists x\,(Q(x))

(b) ¬(∀x ∃y (P(x,y)))∨∀z (Q(z))\neg\bigl(\forall x\, \exists y\,(P(x, y))\bigr) \lor \forall z\,(Q(z))

Proofs

Valid Arguments and Inference Rules

We can use all of this to do what a mathematician (or an AI) was meant to do in the first place: write proofs. In the first chapter of the notes we built a proof system for propositional equivalences, but equivalence proofs are symmetric (carrying identical truth values under every assignment), but much of mathematics proceeds asymmetrically (we know certain facts and wish to derive new ones, in one direction only). If p→qp \to q is known and pp is true, we may conclude qq, but not the reverse. The tools for this one-way reasoning are called inference rules, and a proof is a structured chain of such inferences leading from premises to a conclusion.

Arguments and Validity

Definition 2.27 (Argument).

An argument in propositional logic is a finite sequence of propositions p1,p2,…,pn,qp_1, p_2, \ldots, p_n, q. The propositions p1,…,pnp_1, \ldots, p_n are the premises and qq is the conclusion. The argument is valid if the truth of all premises guarantees the truth of the conclusion: (p1∧p2∧⋯∧pn)→q(p_1 \land p_2 \land \cdots \land p_n) \to q is a tautology. An argument that is not valid is invalid.

We write a valid argument with the premises above a horizontal line and the conclusion below:

p1p2⋯pnq\frac{p_1 \quad p_2 \quad \cdots \quad p_n}{q}

An inference rule is an argument form that remains valid regardless of which particular propositions are substituted for its variables: just as the axioms of earlier notes gave us equivalences that hold universally, inference rules give us one-directional deductions that hold universally.

Remark (The Turnstile).

The notation p1,p2,…,pn⊢qp_1, p_2, \ldots, p_n \vdash q (read ”p1,…,pnp_1, \ldots, p_n entail qq”) means that qq can be derived from the premises p1,…,pnp_1, \ldots, p_n using axioms, inference rules, and previously established theorems. When no premises are needed, we write ⊢q\vdash q, meaning qq is derivable from the axioms alone.

We start off with the most famous.

Modus Ponens

The basic rule of deduction is Modus Ponens (from the Latin modus ponendo ponens, “the method of affirming by affirming”):

p→qpq\frac{p \to q \quad p}{q}

If we know p→qp \to q and pp, we may conclude qq. Its validity rests on the tautology

((p→q)∧p)→q((p \to q) \land p) \to q

To see why this is a tautology, suppose both p→qp \to q and pp are true: by the truth table of the conditional, the only circumstance under which p→qp \to q is true and pp is true is when qq is also true. Hence qq must hold.

Example 2.28.

Earlier established the universal statement “every prime greater than 22 is odd.” Let pp denote “7 is prime and greater than 2” and qq denote “7 is odd.” The universal claim gives p→qp \to q, and we can verify pp directly (7 is prime, and 7>27 > 2); modus Ponens yields qq: the integer 7 is odd.

Problem 2.14.

Let pp denote “it is snowing” and qq denote “the lecture is cancelled.” Suppose we know p→qp \to q and pp. State the conclusion and identify the inference rule. Now suppose instead we know p→qp \to q and qq. Can we conclude pp? Justify your answer using the truth table of the conditional.

Modus Tollens

Theorem 2.29 (Modus Tollens).

For any propositions pp and qq,

p→q¬q¬p\frac{p \to q \quad \neg q}{\neg p}

Discussion.

The claim is that a rule of inference is valid: granted the two premises, the conclusion follows. We already have one such rule, Modus Ponens, so rather than argue from truth values we rewrite the premises until that rule applies. The premise p→qp \to q is equivalent to its contrapositive ¬q→¬p\neg q \to \neg p, and the second premise ¬q\neg q is precisely the antecedent of that conditional; Modus Ponens then delivers ¬p\neg p. So the proof is the contrapositive equivalence followed by one application of Modus Ponens.

Proof.

Assume p→qp \to q and ¬q\neg q. By the Contrapositive equivalence, p→q≡¬q→¬pp \to q \equiv \neg q \to \neg p. Since ¬q\neg q is true, Modus Ponens applied to ¬q→¬p\neg q \to \neg p and ¬q\neg q yields ¬p\neg p.

The Latin name modus tollendo tollens (“the method of denying by denying”) captures the reasoning: if the consequence of an implication fails, its premise must also fail.

Example 2.30.

If nn is even, then n2n^2 is even. We observe that 4949 is not even and by Modus Tollens, 7 is not even.

Hypothetical Syllogism

Theorem 2.31 (Hypothetical Syllogism).

For any propositions pp, qq, rr,

p→qq→rp→r\frac{p \to q \quad q \to r}{p \to r}

Discussion.

Again a rule of inference, but the conclusion is itself a conditional, and a conditional is established by assuming its antecedent and deriving its consequent. So there are three assumptions in play: the two premises, and pp taken on for the sake of the argument. From pp and the first premise Modus Ponens gives qq; from qq and the second premise it gives rr. Having derived rr from pp, we discharge the assumption and conclude p→rp \to r. Modus Ponens is used twice, and nothing else.

Proof.

Assume p→qp \to q and q→rq \to r. We wish to show p→rp \to r. Assume pp. From pp and p→qp \to q, Modus Ponens gives qq. From qq and q→rq \to r, a second application of Modus Ponens gives rr. Since assuming pp led to rr, we conclude p→rp \to r.

This inference is also called the chain rule or the transitivity of implication. A multi-step deduction is a chain of hypothetical syllogisms. For instance, suppose we know “if nn is divisible by 44, then nn is even” and “if nn is even, then n2n^2 is even.” Hypothetical Syllogism yields: “if nn is divisible by 44, then n2n^2 is even.”

Implication Elimination

Theorem 2.32 (Implication Elimination).

For any propositions pp and qq, (p→q)⊢(p⊢q)(p \to q) \vdash (p \vdash q).

Discussion.

The statement relates the two arrows: the connective →\to, which lives inside a proposition, and the turnstile ⊢\vdash, which lives between propositions and asserts derivability. It says that from p→qp \to q we may derive qq from pp. So we assume p→qp \to q and must show p⊢qp \vdash q, that is, derive qq from the assumption pp; Modus Ponens applied to the assumption and the hypothesis does this. The converse direction is the discharge step used in the previous theorem.

Proof.

Assume p→qp \to q. We must show p⊢qp \vdash q. Assume pp. From p→qp \to q and pp, Modus Ponens yields qq. Thus p⊢qp \vdash q.

This gives one direction of the link between a conditional and a derivation: if p→qp \to q is known, then from the assumption pp one may derive qq. The reverse direction will appear later in Direct Proof, where we show that if assuming pp leads to qq, then the conditional p→qp \to q is established. Together, the two directions show how the turnstile and the conditional correspond: p⊢qp \vdash q if and only if ⊢p→q\vdash p \to q.

Further Propositional Inference Rules

Several additional inference rules arise from tautologies:

Conjunction. From two established truths, their conjunction follows.

pqp∧q\frac{p \quad q}{p \land q}

The tautological justification is immediate, but Conjunction can also be derived from Modus Ponens alone via reductio.

Proof.

Assume pp and qq. Suppose for contradiction that ¬(p∧q)\neg(p \land q). By De Morgan’s Law (Theorem 6, 1), ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q. By the Conditional axiom, ¬p∨¬q≡p→¬q\neg p \lor \neg q \equiv p \to \neg q. Since pp holds, Modus Ponens yields ¬q\neg q. But qq is assumed, a contradiction. Therefore p∧qp \land q.

Simplification. From a conjunction, either conjunct may be extracted.

p∧qp\frac{p \land q}{p}

Addition. A known truth may be weakened to a disjunction.

pp∨q\frac{p}{p \lor q}

Disjunctive Syllogism. If one disjunct is eliminated, the other must hold.

p∨q¬pq\frac{p \lor q \quad \neg p}{q}

Resolution. Two clauses sharing a complementary literal may be combined, eliminating the shared variable.

¬p∨rp∨qq∨r\frac{\neg p \lor r \quad p \lor q}{q \lor r}

Constructive Dilemma. Two conditionals with a disjunction of their antecedents yield the disjunction of their consequents.

(α→γ)(β→δ)(α∨β)γ∨δ\frac{(\alpha \to \gamma) \quad (\beta \to \delta) \quad (\alpha \lor \beta)}{\gamma \lor \delta}

Problem 2.15.

Prove that all of these are tautologies.

Notice the relationships among these rules. Disjunctive Syllogism is a special case of Resolution (set r=⊥r = \bot and apply the Identity axiom). Addition is dual to Conjunction, and Simplification is a special case of Modus Ponens (since (p∧q)→p(p \land q) \to p is a tautology).

Remark (Resolution Subsumes Other Rules).

Resolution can recover other rules. It gives Hypothetical Syllogism: rewrite p→qp \to q as ¬p∨q\neg p \lor q and q→rq \to r as ¬q∨r\neg q \lor r (by the Conditional axiom), then a single resolution step on qq yields ¬p∨r\neg p \lor r, which is p→rp \to r. It can also recover Modus Ponens: express pp as p∨⊥p \lor \bot and p→qp \to q as ¬p∨q\neg p \lor q, and resolution gives q∨⊥≡qq \lor \bot \equiv q by the Identity axiom. For this reason Resolution is the basis of automated theorem proving in computer science.

The following table collects the propositional inference rules for reference.

NameRuleTautologyModus Ponensp,  p→q  ⊢  q((p→q)∧p)→qModus Tollens¬q,  p→q  ⊢  ¬p((p→q)∧¬q)→¬pHyp. Syllogismp→q,  q→r  ⊢  p→r((p→q)∧(q→r))→(p→r)Conjunctionp,  q  ⊢  p∧q(p∧q)→(p∧q)Simplificationp∧q  ⊢  p(p∧q)→pAdditionp  ⊢  p∨qp→(p∨q)Disj. Syllogismp∨q,  ¬p  ⊢  q((p∨q)∧¬p)→qResolution¬p∨r,  p∨q  ⊢  q∨r((¬p∨r)∧(p∨q))→(q∨r)Constr. Dilemma(α→γ),  (β→δ),  α∨β  ⊢  γ∨δ((α→γ)∧(β→δ)∧(α∨β))→(γ∨δ)Disj. Elimination(p→r),  (q→r),  p∨q  ⊢  r((p→r)∧(q→r)∧(p∨q))→rEx Falsop,  ¬p  ⊢  q(p∧¬p)→q\small \begin{array}{lll} \textbf{Name} & \textbf{Rule} & \textbf{Tautology} \\ \hline \text{Modus Ponens} & p,\; p \to q \;\vdash\; q & ((p \to q) \land p) \to q \\ \text{Modus Tollens} & \neg q,\; p \to q \;\vdash\; \neg p & ((p \to q) \land \neg q) \to \neg p \\ \text{Hyp.\ Syllogism} & p \to q,\; q \to r \;\vdash\; p \to r & ((p \to q) \land (q \to r)) \to (p \to r) \\ \text{Conjunction} & p,\; q \;\vdash\; p \land q & (p \land q) \to (p \land q) \\ \text{Simplification} & p \land q \;\vdash\; p & (p \land q) \to p \\ \text{Addition} & p \;\vdash\; p \lor q & p \to (p \lor q) \\ \text{Disj.\ Syllogism} & p \lor q,\; \neg p \;\vdash\; q & ((p \lor q) \land \neg p) \to q \\ \text{Resolution} & \neg p \lor r,\; p \lor q \;\vdash\; q \lor r & ((\neg p \lor r) \land (p \lor q)) \to (q \lor r) \\ \text{Constr.\ Dilemma} & (\alpha \to \gamma),\; (\beta \to \delta),\; \alpha \lor \beta \;\vdash\; \gamma \lor \delta & ((\alpha \to \gamma) \land (\beta \to \delta) \land (\alpha \lor \beta)) \to (\gamma \lor \delta) \\ \text{Disj.\ Elimination} & (p \to r),\; (q \to r),\; p \lor q \;\vdash\; r & ((p \to r) \land (q \to r) \land (p \lor q)) \to r \\ \text{Ex Falso} & p,\; \neg p \;\vdash\; q & (p \land \neg p) \to q \end{array}

Problem 2.16.

Identify the inference rule applied in each step of the following argument. Premises: (i) p→qp \to q, (ii) ¬q∨r\neg q \lor r, (iii) ¬r\neg r.

  1. From (ii) and (iii), conclude ¬q\neg q.
  2. From (i) and step 1, conclude ¬p\neg p.

Building Complex Arguments

Inference rules are used in chains. A valid argument is a sequence of steps in which each step is either a premise or follows from earlier steps by a single inference rule.

Example 2.33.

We show the following argument is valid. Premises: (1) p∧(p→q)p \land (p \to q), (2) q→rq \to r. Conclusion: rr.

1.p∧(p→q)Premise2.q→rPremise3.pSimplification from 14.p→qSimplification from 15.qModus Ponens from 3, 46.rModus Ponens from 5, 2\begin{array}{rll} 1. & p \land (p \to q) & \text{Premise} \\ 2. & q \to r & \text{Premise} \\ 3. & p & \text{Simplification from 1} \\ 4. & p \to q & \text{Simplification from 1} \\ 5. & q & \text{Modus Ponens from 3, 4} \\ 6. & r & \text{Modus Ponens from 5, 2} \end{array}

Problem 2.17.

Show that the following argument is valid by listing each step and the inference rule used. Premises: (1) p→qp \to q, (2) q→(r∧s)q \to (r \land s), (3) ¬r∨u\neg r \lor u, (4) pp. Conclusion: uu.

Inference Rules for Quantified Statements

The rules above govern propositional logic. When predicates and quantifiers enter the picture, additional rules are needed to bridge the gap between universal or existential claims and their specific instances.

Universal Instantiation (UI). If a predicate holds for every element of the universe, it holds for any particular element cc:

∀x P(x)P(c)for any c in the universe\frac{\forall x\, P(x)}{P(c)} \quad \text{for any } c \text{ in the universe}

Universal Generalisation (UG). If P(c)P(c) can be established for an arbitrary element cc (one about which no special assumptions are made), then ∀x P(x)\forall x\, P(x) follows:

P(c) for arbitrary c∀x P(x)\frac{P(c) \text{ for arbitrary } c}{\forall x\, P(x)}

The word “arbitrary” is critical. If the proof of P(c)P(c) exploits any property peculiar to cc, the generalisation is invalid.

Existential Instantiation (EI). If at least one element satisfies PP, we may introduce a name cc for such an element:

∃x P(x)P(c) for some c\frac{\exists x\, P(x)}{P(c) \text{ for some } c}

The name cc must be fresh: not previously used in the argument.

Existential Generalisation (EG). If a particular element cc satisfies PP, then at least one element does:

P(c)∃x P(x)\frac{P(c)}{\exists x\, P(x)}

Universal Modus Ponens (UMP). Combining Universal Instantiation with Modus Ponens gives the quantifier rule used most often:

∀x (P(x)→Q(x))P(c)Q(c)\frac{\forall x\,(P(x) \to Q(x)) \quad P(c)}{Q(c)}

Example 2.34.

Write RR for the real numbers, and suppose we know ∀x (x>0→x∈R)\forall x\,(x > 0 \to \sqrt{x} \in R), the universe being RR, and that 9>09 > 0. Universal Modus Ponens yields 9∈R\sqrt{9} \in R.

Problem 2.18.

Identify the quantifier inference rule used in each step. The universe is the positive integers.

  1. “Every multiple of 66 is a multiple of 33.” (Premise)
  2. ”18=6⋅318 = 6 \cdot 3, so 1818 is a multiple of 66.” (Premise)
  3. “Therefore, 1818 is a multiple of 33.”
  4. “Therefore, there exists a positive integer that is a multiple of 33.”

Example 2.35 (Combining Quantifier Rules).

We show that “a student in this class has not read the book” and “every student in this class passed the first exam” together imply “someone who passed the first exam has not read the book.”

Let C(x)C(x) denote ”xx is in this class,” B(x)B(x) denote ”xx has read the book,” and E(x)E(x) denote ”xx passed the exam.” The premises are ∃x (C(x)∧¬B(x))\exists x\,(C(x) \land \neg B(x)) and ∀x (C(x)→E(x))\forall x\,(C(x) \to E(x)). We derive ∃x (E(x)∧¬B(x))\exists x\,(E(x) \land \neg B(x)).

1.∃x (C(x)∧¬B(x))Premise2.∀x (C(x)→E(x))Premise3.C(a)∧¬B(a) for some aEI from 14.C(a)→E(a)UI from 25.C(a)Simplification from 36.E(a)Modus Ponens from 4, 57.¬B(a)Simplification from 38.E(a)∧¬B(a)Conjunction from 6, 79.∃x (E(x)∧¬B(x))EG from 8\begin{array}{rll} 1. & \exists x\,(C(x) \land \neg B(x)) & \text{Premise} \\ 2. & \forall x\,(C(x) \to E(x)) & \text{Premise} \\ 3. & C(a) \land \neg B(a) \text{ for some } a & \text{EI from 1} \\ 4. & C(a) \to E(a) & \text{UI from 2} \\ 5. & C(a) & \text{Simplification from 3} \\ 6. & E(a) & \text{Modus Ponens from 4, 5} \\ 7. & \neg B(a) & \text{Simplification from 3} \\ 8. & E(a) \land \neg B(a) & \text{Conjunction from 6, 7} \\ 9. & \exists x\,(E(x) \land \neg B(x)) & \text{EG from 8} \end{array}

Fallacies

Definition 2.36 (Fallacy).

A fallacy is an argument form that appears valid but is not: the premises do not logically guarantee the conclusion, even though the reasoning may seem persuasive.

Two fallacies are especially common. Both arise from misapplying the conditional.

Affirming the Consequent. The argument ”p→qp \to q; qq; therefore pp” is invalid. A counterexample: let p=⊥p = \bot and q=⊤q = \top. Then p→qp \to q is ⊤\top and qq is ⊤\top, but pp is ⊥\bot.

Denying the Antecedent. The argument ”p→qp \to q; ¬p\neg p; therefore ¬q\neg q” is equally invalid. With p=⊥p = \bot and q=⊤q = \top, both premises are satisfied but ¬q\neg q is ⊥\bot.

Both fallacies confuse an implication with its converse or its inverse: p→qp \to q does not entail q→pq \to p, nor does it entail ¬p→¬q\neg p \to \neg q.

Example 2.37.

“If it rained, the pitch is wet. The pitch is wet. Therefore it rained.” This affirms the consequent. The pitch might be wet because the sprinklers were on. The converse “if the pitch is wet, then it rained” does not follow from the original implication.

Problem 2.19.

Identify the fallacy in each argument and provide a counterexample (an assignment under which the premises are true but the conclusion is false).

  1. “If x>2x > 2, then x>1x > 1. The number 32\tfrac{3}{2} satisfies x>1x > 1. Therefore 32>2\tfrac{3}{2} > 2.”
  2. “If x>0x > 0, then x2>0x^2 > 0. The number −1-1 does not satisfy x>0x > 0. Therefore (−1)2⩽0(-1)^2 \leqslant 0.”

Proof Techniques

With inference rules in hand, we turn to the practical matter of constructing proofs. A proof is a finite sequence of statements, each of which is an axiom, a premise, or a consequence of earlier statements by an inference rule. What dictates the strategy is the shape of the claim: whether it asserts a conditional, a biconditional, a conjunction, a disjunction, or a quantification. Each shape comes with a direct method that builds the claim up from its parts, and an indirect method that assumes the negation and derives a contradiction.

Since these notes are about writing proofs, not merely admiring them, we will not simply state a result and prove it. Each proof comes with a Discussion, where we plan the argument and air the thought process, followed by the Proof itself, written in full English sentences with proper syntax and grammar. The two are kept apart on purpose. A discussion names the form of the statement, says which pieces have to be proved and by what method, and points to the definition or rule each piece will use; the proof then carries that plan out.

We have not built the numbers yet (although we have been using them), and doing so is where this course is headed. But until then we help ourselves to the arithmetic and order rules of school algebra, and we name our objects in words: a whole number is one of …,−2,−1,0,1,2,…\ldots, -2, -1, 0, 1, 2, \ldots, and a real number is any point of the number line. Every rule borrowed along the way is proved from the ground up once we have the objects to prove it about, and where a proof below leans on a borrowed rule we say which one (we will collect on any debt as we continue).

Two properties of whole numbers come up often enough in the examples to be worth fixing now.

Definition 2.38 (Even and Odd).

A whole number nn is even if it can be written as n=2kn = 2k for some whole number kk, and odd if it can be written as n=2k+1n = 2k + 1 for some whole number kk. Every whole number is one or the other and never both.

Definition 2.39 (Prime and Composite).

A whole number greater than 11 is composite if it is a product of two whole numbers each at least 22, and prime otherwise.

Proving Conditional Claims

Recall that p→qp \to q asserts that whenever pp holds, qq necessarily holds. The conditional is already true in every case where pp fails, so no proof need consider those cases: it is enough to suppose pp and deduce qq.

The strategies are collected below. The justification column speaks about our proofs rather than inside them, and it uses   ⟹  \implies for that outer step, keeping it apart from the connective →\to that lives in the statements themselves;   ⟸  \impliedby is the same arrow read right to left.

StrategyApproachJustificationTrivial proofShow q is trueq true  ⟹  p→q trueVacuous proofShow p is falsep false  ⟹  p→q trueDirect proofAssume p, derive qp⊢q    ⟹    ⊢p→qContrapositiveAssume ¬q, derive ¬pp→q≡¬q→¬pContradictionAssume p∧¬q, derive r∧¬r(p∧¬q)→⊥    ⟹    p→q\small \begin{array}{lll} \textbf{Strategy} & \textbf{Approach} & \textbf{Justification} \\ \hline \text{Trivial proof} & \text{Show } q \text{ is true} & q \text{ true} \implies p \to q \text{ true} \\ \text{Vacuous proof} & \text{Show } p \text{ is false} & p \text{ false} \implies p \to q \text{ true} \\ \text{Direct proof} & \text{Assume } p,\text{ derive } q & p \vdash q \;\implies\; \vdash p \to q \\ \text{Contrapositive} & \text{Assume } \neg q,\text{ derive } \neg p & p \to q \equiv \neg q \to \neg p \\ \text{Contradiction} & \text{Assume } p \land \neg q,\text{ derive } r \land \neg r & (p \land \neg q) \to \bot \;\implies\; p \to q \end{array}

The last two are called indirect proofs, since they establish the conditional without constructing a chain from pp to qq.

The first two are degenerate, and they are worth naming only so that they are recognised when they occur. A trivial proof ignores the hypothesis altogether: “if x>5x > 5, then x⋅0=0x \cdot 0 = 0” holds because the conclusion holds for every xx. A vacuous proof shows instead that the hypothesis is never met: “for every real number xx, if x<xx < x, then x=7x = 7” holds because no xx satisfies x<xx < x.

Definition 2.40 (Direct Proof).

A direct proof of a conditional statement p→qp \to q proceeds by assuming pp and deriving qq through a sequence of valid inferences. The assumption of pp is not asserted as fact; it is a hypothesis under which the argument operates.

This strategy reflects the Deduction Rule, a meta-logical principle: if assuming pp allows us to derive qq using valid inferences, then the conditional p→qp \to q is established. The Deduction Rule connects the turnstile (⊢\vdash) and the conditional (→\to): the statement p⊢qp \vdash q (a syntactic derivation) becomes p→qp \to q (a logical truth).

Strategy (Direct proof of a conditional).

Claim: p→qp \to q

  1. Suppose pp holds.
  2. Prove that qq holds.

Proposition 2.41.

If x>1x > 1, then x2>1x^2 > 1.

Discussion.

We will assume x>1x > 1 and show x2>1x^2 > 1. Our tool is the well-known algebraic rule (which we prove later on) that if a>ba > b and c>dc > d with all four numbers positive, then ac>bdac > bd.

Proof.

Assume x>1x > 1. Since x>1>0x > 1 > 0, both xx and 11 are positive, so multiplying the inequality x>1x > 1 by itself yields x2>1⋅1=1x^2 > 1 \cdot 1 = 1. Thus x2>1x^2 > 1.

Our statements will grow considerably more complicated than this, but the shape stays the same. With the proof done, we may now say with full mathematical confidence that whenever a number xx satisfies x>1x > 1, it automatically satisfies x2>1x^2 > 1.

As we know the contrapositive ¬q→¬p\neg q \to \neg p is logically equivalent to p→qp \to q, so proving either one proves the other. The swap is worth making when pp or qq carries a negation inside it, since negating it turns the assumption into a positive assertion we can compute with.

Strategy (Contrapositive proof of a conditional).

Claim: p→qp \to q

  1. Suppose ¬q\neg q holds.
  2. Prove that ¬p\neg p holds.

This is the direct strategy applied to ¬q→¬p\neg q \to \neg p.

Proposition 2.42.

If x3<0x^3 < 0, then x<0x < 0.

Discussion.

Here pp is "x3<0x^3 < 0" and qq is "x<0x < 0". Proving this directly is awkward, since we would begin knowing a fact about x3x^3 and have to dig our way down to a fact about xx. The contrapositive reverses this. Since ¬q\neg q is "x⩾0x \geqslant 0" and ¬p\neg p is "x3⩾0x^3 \geqslant 0", the contrapositive ¬q→¬p\neg q \to \neg p reads “if x⩾0x \geqslant 0, then x3⩾0x^3 \geqslant 0”, where we start from xx and build up to x3x^3; that direction is straightforward. So we will assume x⩾0x \geqslant 0 and show x3⩾0x^3 \geqslant 0, announcing at the outset that we are proving the contrapositive.

Proof.

We prove the contrapositive: if x⩾0x \geqslant 0, then x3⩾0x^3 \geqslant 0. Assume x⩾0x \geqslant 0. Since all terms are non-negative, multiplying x⩾0x \geqslant 0 by itself thrice gives x⋅x⋅x⩾0⋅0⋅0x \cdot x \cdot x \geqslant 0 \cdot 0 \cdot 0, that is, x3⩾0x^3 \geqslant 0. The contrapositive holds, so the original statement “if x3<0x^3 < 0, then x<0x < 0” holds as well.

Indirect proofs

Every indirect method below uses proof by contradiction.

Definition 2.43 (Proof by Contradiction).

A proof by contradiction (Latin: reductio ad absurdum) establishes a proposition pp by assuming ¬p\neg p and deriving a contradiction, that is, a statement of the form q∧¬qq \land \neg q for some proposition qq. Since a sound proof system cannot derive a false conclusion from true premises, the assumption ¬p\neg p must be false, so pp is true.

The opening move of such a proof is written so often that i abbreviate it to AFSOC standing for “assume for the sake of contradiction.” What we assume is the logical negation of the claim, so each indirect strategy below is really the negation rules of earlier read as instructions.

So in the case of the direct proof, the indirect method rests on the negation of a conditional, ¬(p→q)≡p∧¬q\neg(p \to q) \equiv p \land \neg q. Assuming the negation therefore means granting ourselves the hypothesis and the failure of the conclusion at once, which is one more fact to work with than a direct proof has.

Strategy (Indirect proof of a conditional).

Claim: p→qp \to q

  1. AFSOC that pp holds and qq fails.
  2. Find a contradiction.

Proposition 2.44.

For all real numbers xx and yy, if x+y>2x + y > 2, then x>1x > 1 or y>1y > 1.

Discussion.

Our statement is the conditional p→qp \to q, where pp is "x+y>2x + y > 2" and qq is the disjunction ”x>1x > 1 or y>1y > 1”. A direct proof would have to settle which half of qq to aim at, and the hypothesis does not decide that for us, so we go indirectly. The negation of the whole statement is p∧¬qp \land \neg q, and De Morgan turns ¬q\neg q into ”x⩽1x \leqslant 1 and y⩽1y \leqslant 1”. That leaves us with three inequalities: we add the two coming from ¬q\neg q and set the result against pp.

Proof.

AFSOC that x+y>2x + y > 2 and that the conclusion fails, so that x⩽1x \leqslant 1 and y⩽1y \leqslant 1. Adding these two inequalities gives x+y⩽2x + y \leqslant 2. But we assumed x+y>2x + y > 2, and no number is both greater than 22 and at most 22. Therefore, whenever x+y>2x + y > 2, at least one of x>1x > 1, y>1y > 1 holds.

Remark (Contradiction Against Contrapositive).

The two indirect routes are easy to confuse. A proof by contradiction assumes the negation of the entire statement, p∧¬qp \land \neg q, and derives an absurdity from it. A contrapositive proof assumes only ¬q\neg q and derives ¬p\neg p, which is a direct proof of an equivalent statement and never mentions absurdity at all. In practice both are often labelled “proof by contradiction,” but the contrapositive route is usually the cleaner of the two, and it is the one to reach for first.

Problem 2.20.

Prove that if 0<x<10 < x < 1, then x2<xx^2 < x.

Problem 2.21.

Prove that for all whole numbers nn, if 3n+23n + 2 is odd, then nn is odd.

Problem 2.22.

Prove that for all real numbers xx, if x5<0x^5 < 0, then x<0x < 0.

Proving Biconditional Claims

The connective ↔\leftrightarrow is defined entirely in terms of →\to: asserting p↔qp \leftrightarrow q is asserting the conjunction (p→q)∧(q→p)(p \to q) \land (q \to p). That gives the obvious strategy, prove one conditional and then the other, and it exposes the most common mistake we see, which is proving one of them and stopping. The two directions are labelled (  ⟹  \implies) and (  ⟸  \impliedby), and each may be proved by whichever of the conditional methods suits it; there is no requirement that both use the same one.

Strategy (Direct proof of a biconditional).

Claim: p↔qp \leftrightarrow q

  1. Prove that p→qp \to q, by any of the conditional methods.
  2. Prove that q→pq \to p, by any of the conditional methods.

Consider ”nn is even if and only if n2n^2 is even”. Before the proof, recall the two forms an even and an odd whole number take, n=2kn = 2k and n=2k+1n = 2k + 1.

Proposition 2.45.

nn is even if and only if n2n^2 is even.

Discussion.

The two conditionals are p→qp \to q, “if nn is even, then n2n^2 is even”, and q→pq \to p, “if n2n^2 is even, then nn is even”. The first is straightforward: write n=2kn = 2k and show that n2=2(whole number)n^2 = 2(\text{whole number}). The second is trickier, since its hypothesis tells us about n2n^2 when we want a conclusion about nn; so we take its contrapositive ¬p→¬q\neg p \to \neg q, “if nn is odd, then n2n^2 is odd”, assume n=2k+1n = 2k + 1, and show that n2=2(whole number)+1n^2 = 2(\text{whole number}) + 1.

Proof.

(  ⟹  \implies) First, suppose nn is even, so n=2kn = 2k for some whole number kk. Then n2=(2k)2=4k2=2(2k2)n^2 = (2k)^2 = 4k^2 = 2(2k^2), and since 2k22k^2 is a whole number, n2n^2 is even.

(  ⟸  \impliedby) The remaining conditional is “if n2n^2 is even, then nn is even”, and we prove its contrapositive: if nn is odd, then n2n^2 is odd. Suppose n=2k+1n = 2k + 1 for some whole number kk. Squaring, n2=(2k+1)2=4k2+4k+1=2(2k2+2k)+1,n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1, and since 2k2+2k2k^2 + 2k is a whole number, n2n^2 is odd. The contrapositive holds, so the second conditional does too. Both conditionals are proven, and with them the biconditional.

Strategy (Indirect proof of a biconditional).

Claim: p↔qp \leftrightarrow q

  1. AFSOC that ¬(p→q)∨¬(q→p)\neg(p \to q) \lor \neg(q \to p).
  2. In the first case, p∧¬qp \land \neg q holds. Find a contradiction.
  3. In the second case, q∧¬pq \land \neg p holds. Find a contradiction.

Whether this route is worth taking depends entirely on what pp and qq are, and the direct one usually wins; but it helps when both directions are hard to prove directly: the negations p∧¬qp \land \neg q and q∧¬pq \land \neg p each give two facts to work with, where the direct proof has one.

Proposition 2.46.

Let xx be a real number. Then x=0x = 0 if and only if no real number yy satisfies xy=1xy = 1.

Discussion.

Our statement is the biconditional p↔qp \leftrightarrow q, where pp is "x=0x = 0" and qq is “no real number yy satisfies xy=1xy = 1”. Both directions are hard to prove directly for the same reason, which is that qq is itself a denial: proving it outright would mean ruling out every candidate yy one at a time, thus negating gets round both problems. In the first case we hold pp along with ¬q\neg q, and ¬q\neg q produces an actual yy with xy=1xy = 1, into which we may substitute x=0x = 0. In the second we hold qq along with ¬p\neg p, and x≠0x \neq 0 is exactly the condition under which we may divide by xx, which gives a yy that qq says does not exist.

Proof.

AFSOC that one of the two conditionals fails.

Suppose first that pp holds and qq fails, so that x=0x = 0 and some real number yy satisfies xy=1xy = 1. Then 1=xy=0⋅y=01 = xy = 0 \cdot y = 0, and 1≠01 \neq 0.

Suppose instead that qq holds and pp fails, so that no real number yy satisfies xy=1xy = 1, and x≠0x \neq 0. Since x≠0x \neq 0 we may divide by it, and y=1xy = \frac{1}{x} is then a real number with xy=1xy = 1, which qq denies.

Neither case can stand, so both conditionals hold and the biconditional with them.

A third route is neither direct nor indirect. Rather than linking pp and qq to each other, we find an intermediary statement rr and prove p↔rp \leftrightarrow r and r↔qr \leftrightarrow q; the chain then forces pp and qq to share a truth value. The acronym TFAE, “the following are equivalent,” names the theorems built this way: a list of conditions, all asserted to imply one another, proved by running a cycle of implications through the list.

Strategy (Intermediary proof of a biconditional).

Claim: p↔qp \leftrightarrow q

  1. Find a statement rr.
  2. Prove that p↔rp \leftrightarrow r, by any of the methods above.
  3. Prove that r↔qr \leftrightarrow q, by any of the methods above.

Proposition 2.47.

For a real number xx, the following are equivalent: x2=xx^2 = x; the product x(x−1)x(x - 1) is zero; x=0x = 0 or x=1x = 1.

Discussion.

Our statement puts three conditions on a real number xx and asserts that any one of them forces the other two, so we take rr to be "x(x−1)=0x(x-1) = 0" and prove the two biconditionals x2=x↔rx^2 = x \leftrightarrow r and r↔r \leftrightarrow ”x=0x = 0 or x=1x = 1”, each of them directly. The first is a rearrangement, and it runs in both directions because subtracting xx from both sides is undone by adding it back. The second is the zero product rule, which we borrow here and prove below.

Proof.

Take rr to be the statement "x(x−1)=0x(x - 1) = 0".

(x2=x↔rx^2 = x \leftrightarrow r) Subtracting xx from both sides of x2=xx^2 = x gives x2−x=0x^2 - x = 0, and x2−x=x(x−1)x^2 - x = x(x - 1), so rr holds. Adding xx to both sides of x(x−1)=0x(x-1) = 0 reverses the step, so the two conditions imply one another.

(r↔x=0r \leftrightarrow x = 0 or x=1x = 1) We borrow the zero product rule: a product of two real numbers is zero exactly when one of the factors is zero. (It is proved below, in the section on disjunctions.) So x(x−1)=0x(x - 1) = 0 holds exactly when x=0x = 0 or x−1=0x - 1 = 0, and the latter says x=1x = 1. The chain of equivalences carries the truth value from the first condition to the third, so the three are either all true or all false.

Remark (Always Check the Converse).

A common error is to prove one direction of a biconditional and assume the other follows. Consider the equation x−3+x+4=7\sqrt{x - 3} + \sqrt{x + 4} = 7. Squaring both sides and simplifying produces x=12x = 12 as the sole candidate. Squaring can introduce extraneous solutions, so we must substitute back: 9+16=3+4=7\sqrt{9} + \sqrt{16} = 3 + 4 = 7, and here the candidate is genuine. Contrast this with x+x=0x + \sqrt{x} = 0: squaring leads to candidates x=0x = 0 and x=1x = 1, but 1+1=2≠01 + \sqrt{1} = 2 \neq 0, so only x=0x = 0 is a true solution.

Problem 2.23.

Prove that a whole number nn is even if and only if n+1n + 1 is odd. Then prove it a second time by the indirect method.

Problem 2.24.

Prove that a real number xx satisfies x3=xx^3 = x if and only if x=0x = 0, x=1x = 1, or x=−1x = -1.

Proving Conjunctions

A conjunction asks for two proofs; The only thing worth saying about the direct method is that both halves must actually appear.

Strategy (Direct proof of a conjunction).

Claim: p∧qp \land q

  1. Prove that pp holds.
  2. Prove that qq holds.

Proposition 2.48.

If x>1x > 1, then x2>xx^2 > x and x3>x2x^3 > x^2.

Discussion.

Let pp be "x2>xx^2 > x" and qq be "x3>x2x^3 > x^2", with the hypothesis x>1x > 1 available to both. For pp we borrow a second rule of order, that if a>ba > b and c>0c > 0, then ac>bcac > bc; since x>1>0x > 1 > 0, multiplying x>1x > 1 by xx gives x2>xx^2 > x. For qq we multiply x>1x > 1 by x2x^2 instead, which the same rule permits once we know x2x^2 is positive, and pp has just told us that x2>x>1x^2 > x > 1.

Proof.

Assume x>1x > 1. Since x>1>0x > 1 > 0, the number xx is positive, so multiplying both sides of x>1x > 1 by xx gives x2>xx^2 > x, which is the first half.

For the second half, note that x2>x>1>0x^2 > x > 1 > 0, so x2x^2 is positive as well. Multiplying both sides of x>1x > 1 by x2x^2 gives x3>x2x^3 > x^2. Both halves hold, so their conjunction does.

By De Morgan’s law the negation of p∧qp \land q is a disjunction, so the indirect method splits into two cases, each of which must be run to an absurdity.

Strategy (Indirect proof of a conjunction).

Claim: p∧qp \land q

  1. AFSOC that ¬p∨¬q\neg p \lor \neg q holds.
  2. In the first case, ¬p\neg p holds. Find a contradiction.
  3. In the second case, ¬q\neg q holds. Find a contradiction.

Problem 2.25.

Prove the proposition above a second time by the indirect method, assuming that x>1x > 1 and that x2⩽xx^2 \leqslant x or x3⩽x2x^3 \leqslant x^2. Compare the two proofs and say which you would rather read.

Proving Disjunctions

A disjunction asserts that at least one of two statements holds. If we can tell in advance which one it is, there is nothing to discuss: prove that one and ignore the other. That is the direct method.

Strategy (Direct proof of a disjunction).

Claim: p∨qp \lor q

  1. Prove that pp holds, or else prove that qq holds.

The interesting case is when neither half holds on its own, because pp and qq are predicates and which of them is true varies with the object. Rather than sort out exactly which objects satisfy which, we argue that if pp holds the claim is already proved and qq need not be looked at, which leaves only the cases where pp fails, and there we must guarantee qq. Since p∨q≡q∨pp \lor q \equiv q \lor p, the roles may be swapped, and we assume whichever negation is more useful.

Strategy (Proof of a disjunction by otherwise).

Claim: p∨qp \lor q

  1. Suppose ¬p\neg p holds.
  2. Prove that qq holds.

Proposition 2.49.

For every real number xx, either x⩽1x \leqslant 1 or x2>xx^2 > x.

Discussion.

Our statement is the disjunction p∨qp \lor q, where pp is "x⩽1x \leqslant 1" and qq is "x2>xx^2 > x", and neither half holds for every xx: the number 12\tfrac{1}{2} satisfies pp and fails qq, while 22 does the reverse. Thus, we take the “otherwise” route: here ¬p\neg p reads x>1x > 1, and multiplying that inequality by the positive number xx gives qq.

Proof.

Suppose x⩽1x \leqslant 1 fails, so x>1x > 1. Then xx is positive, and multiplying both sides of x>1x > 1 by xx gives x2>xx^2 > x. Hence in every case at least one of the two holds.

The negation of a disjunction is a conjunction of negations, so the indirect method grants us both failures at once.

Strategy (Indirect proof of a disjunction).

Claim: p∨qp \lor q

  1. AFSOC that ¬p∧¬q\neg p \land \neg q holds.
  2. Find a contradiction.

Proposition 2.50.

For all real numbers xx and yy, if xy=0xy = 0, then x=0x = 0 or y=0y = 0.

Discussion.

This is the zero product rule we borrowed for the three equivalent conditions above: the conclusion is a disjunction, so we assume the hypothesis xy=0xy = 0 and negate the conclusion, which by gives us x≠0x \neq 0 and y≠0y \neq 0 together. A non-zero real number may be divided by, so we divide xy=0xy = 0 through by xx and read off a statement about yy that the second half of the negation denies.

Proof.

Assume xy=0xy = 0, and AFSOC that both halves of the conclusion fail, so that x≠0x \neq 0 and y≠0y \neq 0. Since x≠0x \neq 0 we may divide both sides of xy=0xy = 0 by xx, which gives y=0y = 0. But we assumed y≠0y \neq 0, and no number is both zero and non-zero. Therefore at least one of x=0x = 0, y=0y = 0 holds.

Problem 2.26.

Prove that for every real number xx, either x=0x = 0 or x2>0x^2 > 0.

Problem 2.27.

Prove the proposition about x⩽1x \leqslant 1 and x2>xx^2 > x a second time, by the indirect method.

Proving Universal Claims

To prove ∀x∈S, p(x)\forall x \in S,\, p(x) we take an arbitrary element of SS and show that pp holds of it. Nothing may be assumed about that element beyond its membership in SS, and Universal Generalisation then gives the claim for every element of SS.

Strategy (Direct proof of a universal claim).

Claim: ∀x∈S,  p(x)\forall x \in S,\; p(x)

  1. Let y∈Sy \in S be arbitrary and fixed.
  2. Prove that p(y)p(y) holds.

Proposition 2.51.

For all whole numbers n⩾3n \geqslant 3, the number n2−1n^2 - 1 is composite.

Discussion.

Our statement is universally quantified over all integers n≥3n \geq 3. To prove that n2−1n^2 - 1 is composite, we must, by definition, produce two integers each strictly greater than 11 whose product is n2−1n^2 - 1. The identity n2−1=(n+1)(n−1)n^2 - 1 = (n+1)(n-1) gives us exactly such a factorisation. The only possible concern is whether the smaller factor, n−1n-1, is at least 22. The hypothesis n≥3n \geq 3 settles this: subtracting 11 from both sides of n≥3n \geq 3 yields n−1≥2n - 1 \geq 2, which is precisely the lower bound we need. (Had we allowed n=2n = 2, the factorisation would read 3⋅13 \cdot 1, which is prime and therefore would fail.)

Proof.

Let n⩾3n \geqslant 3 be any whole number. Notice that n2−1=(n+1)(n−1)n^2 - 1 = (n + 1)(n - 1), a product of two whole numbers. Since n⩾3n \geqslant 3, the smaller factor satisfies n−1⩾2n - 1 \geqslant 2, so n2−1n^2 - 1 is a product of two whole numbers each at least 22. Thus n2−1n^2 - 1 is composite.

Remark (Arbitrary Is Not Specific).

Consider the statement “for every whole number nn, n2⩾0n^2 \geqslant 0”. The following is not a valid proof: “let nn be an arbitrary whole number, say n=17n = 17. Then 172=289⩾017^2 = 289 \geqslant 0.” The writer has chosen a specific value, not an arbitrary one, and what has been proved is the existential claim, that some whole number has a non-negative square. A correct proof never names nn, and every step in it must hold for all the values nn might have taken.

The negation of a universal claim is an existential one, and the work is to show that no such object can exist. This is the route to take when the claim says that something does not happen, since “there is no object with this property” is a universal claim under a negation; it says that every object fails to have the property.

Strategy (Indirect proof of a universal claim).

Claim: ∀x∈S,  p(x)\forall x \in S,\; p(x)

  1. AFSOC that there is some y∈Sy \in S for which ¬p(y)\neg p(y) holds.
  2. Find a contradiction.

Proposition 2.52.

There is no least positive real number. That is, no positive real number aa satisfies a⩽ba \leqslant b for every positive real number bb.

Discussion.

The statement says that every positive real number fails to be least, which is a universal claim although the negation in front of it hides the fact. Its negation is existential and supplies a positive aa with a⩽ba \leqslant b for every positive bb, so we assume such an aa and look for a positive number smaller than it. Halving serves: a2\tfrac{a}{2} is positive whenever aa is, and it is smaller than aa, so it both must and cannot satisfy the inequality aa was assumed to satisfy.

Proof.

AFSOC that a least positive real number aa exists, so that a>0a > 0 and a⩽ba \leqslant b for every positive real number bb. Consider a2\tfrac{a}{2}. Since a>0a > 0 we have a2>0\tfrac{a}{2} > 0, so a2\tfrac{a}{2} is itself a positive real number, and being one it must satisfy a⩽a2a \leqslant \tfrac{a}{2}. But a2<a\tfrac{a}{2} < a, and no number is both smaller than aa and at least aa. Therefore no least positive real number exists.

Problem 2.28.

Prove that for every real number xx there is a real number yy with y>xy > x.

Problem 2.29.

Let xx be a real number with x⩾0x \geqslant 0, and suppose x⩽yx \leqslant y for every positive real number yy. Prove that x=0x = 0.

Proving Existential Claims

An existential claim is a claim of existence: it asserts that some object belongs to a set and has a certain property. To prove one we exhibit such an object and verify, for our reader, both halves of the assertion, that the object is an element of the correct set and that it has the correct property. Existential Generalisation then yields the claim. A proof of this kind is called constructive, since the witness is produced.

Strategy (Direct proof of an existential claim).

Claim: ∃x∈S,  p(x)\exists x \in S,\; p(x)

  1. Define a specific object yy.
  2. Prove that y∈Sy \in S.
  3. Prove that p(y)p(y) holds.

Proposition 2.53.

Fix real numbers a,b,c,d,e,fa, b, c, d, e, f with ad−bc≠0ad - bc \neq 0. Then there are real numbers xx and yy satisfying both

ax+by=eandcx+dy=f.ax + by = e \qquad \text{and} \qquad cx + dy = f.

Discussion.

The claim is existential, so the proof must produce a specific pair xx, yy and check that it satisfies both equations, which means we have to find the pair before we can write anything down. Multiplying the first equation by dd and the second by −b-b makes the two yy terms cancel when we add:

adx+bdy=de−bcx−bdy=−bf(ad−bc)x=de−bf\begin{aligned} adx + bdy &= de \\ -bcx - bdy &= -bf \\ \hline (ad - bc)x &= de - bf \end{aligned}

so x=de−bfad−bcx = \frac{de - bf}{ad - bc}, which is a real number precisely because ad−bc≠0ad - bc \neq 0. Cancelling the xx terms the same way, by multiplying the first equation by cc and the second by −a-a, gives (bc−ad)y=ce−af(bc - ad)y = ce - af and so y=af−cead−bcy = \frac{af - ce}{ad - bc}.

None of this scratch work belongs in the proof. A reader does not care how we came upon the pair; they care what the pair is and why it works, and the proof is shorter and easier to check for leaving the search out.

Proof.

Since ad−bc≠0ad - bc \neq 0, we may define

x=de−bfad−bcandy=af−cead−bc,x = \frac{de - bf}{ad - bc} \qquad \text{and} \qquad y = \frac{af - ce}{ad - bc},

and both are real numbers. Substituting them into the two equations,

ax+by=(ade−abf)+(abf−bce)ad−bc=ade−bcead−bc=e(ad−bc)ad−bc=e,cx+dy=(cde−bcf)+(adf−cde)ad−bc=adf−bcfad−bc=f(ad−bc)ad−bc=f.\begin{aligned} ax + by &= \frac{(ade - abf) + (abf - bce)}{ad - bc} = \frac{ade - bce}{ad - bc} = \frac{e(ad - bc)}{ad - bc} = e, \\ cx + dy &= \frac{(cde - bcf) + (adf - cde)}{ad - bc} = \frac{adf - bcf}{ad - bc} = \frac{f(ad - bc)}{ad - bc} = f. \end{aligned}

So the pair x,yx, y satisfies both equations, and such a pair exists.

In a non-constructive existence proof we establish that a witness must exist without identifying it. The indirect method is of this kind: it never produces the object; it only shows that its absence leads to a contradiction.

Strategy (Indirect proof of an existential claim).

Claim: ∃x∈S,  p(x)\exists x \in S,\; p(x)

  1. AFSOC that for every y∈Sy \in S, ¬p(y)\neg p(y) holds.
  2. Find a contradiction.

Proposition 2.54.

Let aa, bb, cc be real numbers. Then two of them have a non-negative product.

Discussion.

The claim is again existential, but this time there is no pair we could name in advance, since which two work depends on the signs of aa, bb, cc and the statement gives us no signs. So we prove it indirectly. The negation says that every pair fails, and it hands us the three inequalities ab<0ab < 0, bc<0bc < 0 and ac<0ac < 0 at once. Multiplying all three together produces (abc)2(abc)^2, and a square cannot be negative.

Proof.

AFSOC that no two of aa, bb, cc have a non-negative product, so that ab<0ab < 0, bc<0bc < 0, and ac<0ac < 0. Multiplying the first two of these negative numbers gives a positive one, and multiplying that by the third gives a negative one, so

(ab)(bc)(ac)<0.(ab)(bc)(ac) < 0.

But (ab)(bc)(ac)=a2b2c2=(abc)2(ab)(bc)(ac) = a^2b^2c^2 = (abc)^2, and we borrow the rule that the square of a real number is never negative. (It is proved below, in the section on disproving claims.) So (abc)2(abc)^2 is both negative and non-negative, which is impossible. Therefore some two of aa, bb, cc have a non-negative product.

Notice what the proof does not tell us: which pair it is. It shows only that every pair cannot fail at once, which is what makes the argument non-constructive.

Unique existence asks for a second step. We find the object that works, then show it is the only one, which we do by assuming that xx and yy both work and concluding that x=yx = y.

Strategy (Proof of a unique existential claim).

Claim: ∃! x∈S,  p(x)\exists!\, x \in S,\; p(x)

  1. Prove ∃x∈S,  p(x)\exists x \in S,\; p(x), by either method above.
  2. Suppose p(x)p(x) and p(y)p(y) both hold, and prove that x=yx = y.

Proposition 2.55.

There exists a unique real number xx such that 3x−1=03x - 1 = 0.

Discussion.

Unique existence is two claims, so the proof comes in two halves. Existence asks for one real number satisfying 3x−1=03x - 1 = 0, and we verify x=13x = \tfrac{1}{3} by substitution rather than display the rearrangement that found it. Uniqueness is the half that is often forgotten: producing a solution says nothing about whether there is a second one, so we suppose that xx and yy both satisfy the equation and show that the supposition forces x=yx = y.

Proof.

Consider x=13x = \tfrac{1}{3}: then 3⋅13−1=1−1=03 \cdot \tfrac{1}{3} - 1 = 1 - 1 = 0, so at least one real number works. For uniqueness, suppose xx and yy both satisfy the equation. Then 3x−1=0=3y−13x - 1 = 0 = 3y - 1, so 3x=3y3x = 3y, and dividing by 33 gives x=yx = y. Thus exactly one real number satisfies 3x−1=03x - 1 = 0.

Problem 2.30.

Fix a real number aa. Prove that the equation x2+2ax+a2=0x^2 + 2ax + a^2 = 0 has exactly one real solution.

Problem 2.31.

Fix a real number aa. Prove that there is a real number xx satisfying x3+(1−a2)x−a=0x^3 + (1 - a^2)x - a = 0.

Disproving Claims

To disprove a statement is to show that its truth value is ⊥\bot, and by the definition of negation that is the same as showing its negation is ⊤\top. So there is nothing new to learn: write down the logical negation, then prove that statement by whichever of the strategies above fits its shape. The negation rules are what turn the disproof into a proof, and they say which shape we end up with.

Disproving a universal claim therefore means proving an existential one, and the object we produce is the counterexample we met when the quantifier was introduced. Exhibiting a single one settles the matter, however many objects satisfy the claim.

Example 2.56 (A Universal Claim).

Disprove: for all prime numbers nn, the number nn is odd.

Discussion.

Disproving a universal claim means proving its negation, which here is the existential claim that some prime fails to be odd, so one prime is all we have to produce. An even number has the form 2k2k, and any k⩾2k \geqslant 2 makes 2k2k a product of two whole numbers each at least 22, hence composite; that leaves k=1k = 1 as the only candidate, and it works.

Disproof.

The number 22 is prime, and 22 is even. Thus it is not true that all primes are odd.

Disproving an existential claim is the harder direction, since its negation is universal: every single object must fail, and there is no shortcut through exhibiting one of them.

Example 2.57 (An Existential Claim).

Disprove: there exists a real number xx such that x2<0x^2 < 0.

Discussion.

Disproving an existential claim means proving its negation, and that negation is universal: every real number must satisfy x2⩾0x^2 \geqslant 0, so no single well-chosen xx will settle it and the argument has to cover all of them at once. What stands in the way is the sign of xx, which we are not told and which decides how the inequality behaves under multiplication, so we split on it and run the two cases separately.

Disproof.

We show that for all real numbers xx, x2⩾0x^2 \geqslant 0. Every real number falls into one of two cases, x⩾0x \geqslant 0 or x<0x < 0. If x⩾0x \geqslant 0, multiplying the inequality by itself preserves the sign, so x⋅x⩾0⋅0x \cdot x \geqslant 0 \cdot 0, that is, x2⩾0x^2 \geqslant 0. If x<0x < 0, multiplying through by −1-1 flips the inequality to −x>0-x > 0; multiplying −x>0-x > 0 by itself then gives (−x)(−x)>0⋅0(-x)(-x) > 0 \cdot 0, so x2>0x^2 > 0 and in particular x2⩾0x^2 \geqslant 0. Either way x2⩾0x^2 \geqslant 0, so the claim is false.

Problem 2.32.

Disprove: for every real number xx, x2>xx^2 > x.

Problem 2.33.

Disprove: there is a real number xx with x2+x+1=0x^2 + x + 1 = 0.

The Law of Excluded Middle

Theorem 2.58 (Law of Excluded Middle).

For any proposition pp, p∨¬pp \lor \neg p is a tautology.

Discussion.

To call something a tautology is to say it is equivalent to ⊤\top, so the claim is the single equivalence p∨¬p≡⊤p \lor \neg p \equiv \top. The Complement axiom asserts almost exactly that, but with the disjunction written in the other order, so the statement follows from the axiom by Commutativity. In this system the law of excluded middle is an axiom with its arguments swapped.

Proof.

By the Complement axiom, ¬p∨p≡⊤\neg p \lor p \equiv \top. By the Commutativity axiom, ¬p∨p≡p∨¬p\neg p \lor p \equiv p \lor \neg p. Therefore p∨¬p≡⊤p \lor \neg p \equiv \top.

The Law of Excluded Middle (LEM) asserts that every proposition is either true or false; no third possibility exists. In proofs, LEM is what allows us to split into the exhaustive cases pp and ¬p\neg p without knowing which of them actually holds, and a conclusion reached in both cases is established without our ever finding out.

Proposition 2.59.

Let mm and nn be whole numbers. If mnmn is even, then mm is even or nn is even.

Discussion.

Our statement is the conditional whose hypothesis is ”mnmn is even” and whose conclusion is the disjunction ”mm is even or nn is even”. The hypothesis says nothing about mm on its own and no computation extracts it, so we appeal to LEM and split on whether mm is even. One case gives the conclusion immediately. In the other mm is odd, and we show that an odd nn would make mnmn odd against the hypothesis, which leaves nn even.

Proof.

Suppose mnmn is even. By LEM, either mm is even or mm is odd.

Case 1. If mm is even, the conclusion holds immediately.

Case 2. Suppose mm is odd, so m=2j+1m = 2j + 1 for some whole number jj. If nn were also odd, say n=2k+1n = 2k + 1, then mn=(2j+1)(2k+1)=4jk+2j+2k+1=2(2jk+j+k)+1,mn = (2j + 1)(2k + 1) = 4jk + 2j + 2k + 1 = 2(2jk + j + k) + 1, so mnmn would be odd, contradicting the hypothesis that mnmn is even. Therefore nn is even.

In both cases at least one of mm, nn is even.

Problem 2.34.

Using the Law of Excluded Middle, prove that for all whole numbers nn, the number n(n+1)n(n + 1) is even.

Problem 2.35.

Look again at the proof above. Where was the Law of Excluded Middle used, where was contradiction used, and what was the contradiction? Prove the same result twice more: once using contradiction without LEM, and once using LEM without contradiction.

Ex Falso Quodlibet

The principle ex falso sequitur quodlibet (“from falsity follows whatever you like”) states that from a contradiction, any proposition may be derived:

p¬pqfor every q\frac{p \quad \neg p}{q} \quad \text{for every } q

Its validity rests on the tautology (p∧¬p)→q(p \land \neg p) \to q: since p∧¬pp \land \neg p is identically false, the conditional holds for every qq by vacuous truth.

Example 2.60 (Consequences of a Contradiction).

Suppose we accept the false premise −1=1-1 = 1. Adding 11 to both sides gives 0=20 = 2, a false consequence. Squaring both sides gives 1=11 = 1, a true consequence. From a single contradiction, both true and false statements follow. Once a contradiction enters, the proof system can no longer distinguish truth from falsehood, and every proposition becomes derivable.

We rarely invoke Ex Falso directly, but every indirect proof above rests on it: if assuming the negation of our claim produces a contradiction with our true premises, then that negation cannot coexist with those premises, and the claim must hold.

Using Assumptions in Proofs

When we state a theorem it usually has hypotheses and a conclusion, and those hypotheses are ours to use: we add them to our toolkit for the duration of the proof, along with whatever facts we develop along the way.

A disjunction means cases. Suppose that at some point we have assumed or deduced p∨qp \lor q. Knowing the disjunction holds means at least one of pp, qq holds, so we may consider each separately and argue as follows.

Strategy (Using a disjunction).

Because p∨qp \lor q, we have two cases.

Case 1. Suppose pp holds. Then …

Case 2. Suppose qq holds. Then …

As long as the goal is reached in both cases, the deduction stands; this is the disjunction elimination rule. There is no need for a third case in which both hold, since it might not arise at all, and reaching the goal from one or the other on its own shows that assuming both was never necessary.

Remark (Without Loss of Generality).

It sometimes happens that two cases are identical up to a relabelling of variables. We then handle one case and dismiss the other with the phrase “without loss of generality” (abbreviated WLOG). For instance, to prove by contrapositive that “if xx and yy are whole numbers and both xyxy and x+yx + y are even, then xx and yy are both even,” we must show that if xx or yy is odd then xyxy or x+yx + y is odd. Since the hypotheses are symmetric in xx and yy, we may assume WLOG that xx is odd; the remaining case follows by swapping xx and yy.

“There exists” is not “let such an xx be given”. Writing ∃x∈S, p(x)\exists x \in S,\, p(x) in the middle of a proof asserts only that the line is true: that some element of SS with the property is out there. It does not introduce one. If we go on to refer to xx afterwards, the step is not valid, since nothing has been named; several such elements might exist, and a reader cannot be left to guess whether we mean all of them or one in particular. To bring one into play, say so: let such an xx be given. Thereafter xx names an element with that property and may be used like any other object. Several at once are introduced the same way: “and so we deduce that there exist whole numbers xx, yy, zz such that p(x,y,z)p(x, y, z) holds. Let such xx, yy, zz be given.”

"p→qp \to q" is not ”pp, therefore qq”. Writing p→qp \to q on the page asserts that the implication holds; it does not assert qq. To deduce qq we must make it clear that we also have pp, and that we are using Modus Ponens on the two.

Strategy (Using a conditional).

p→qp \to q because …

Also, pp holds because …

Therefore qq holds.

Remark (Mistakes in Proofs).

A chain of equalities is valid only if every step is. Consider the “proof” that −1=1-1 = 1:

−1=(−1)1=(−1)2/2=((−1)2)1/2=11/2=1\begin{aligned} -1 &= (-1)^1 \\ &= (-1)^{2/2} \\ &= \bigl((-1)^2\bigr)^{1/2} \\ &= 1^{1/2} \\ &= 1 \end{aligned}

The error is in the third step: the law (xa)b=xab(x^a)^b = x^{ab} requires x⩾0x \geqslant 0. Each step in a proof must be a valid inference rather than a plausible manipulation.

Finally, Quantifiers can also conceal errors. The formula (p→q)∨(q→p)(p \to q) \lor (q \to p) is a propositional tautology (verify this by truth table). Substituting predicates p(n)p(n) = ”nn is odd” and q(n)q(n) = ”nn is prime,” one might reason: “for every nn, either oddness implies primality or primality implies oddness.” Yet neither ∀n (p(n)→q(n))\forall n\,(p(n) \to q(n)) nor ∀n (q(n)→p(n))\forall n\,(q(n) \to p(n)) is true. The resolution is that ∀n [(p(n)→q(n))∨(q(n)→p(n))]\forall n\,[(p(n) \to q(n)) \lor (q(n) \to p(n))] is not the same as [∀n (p(n)→q(n))]∨[∀n (q(n)→p(n))][\forall n\,(p(n) \to q(n))] \lor [\forall n\,(q(n) \to p(n))]. The universal quantifier does not distribute over disjunction. The first formula is indeed true (for each fixed nn, one of the two conditionals holds), but the second is false.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 2.1.

Each expression below is built from predicates over a fixed universe. Say what it is.

∀x (P(x))∨Q(x)\forall x\,(P(x)) \lor Q(x)

answer one of these

∀x (P(x)∨Q(x))\forall x\,(P(x) \lor Q(x))

answer one of these

∃y (x+y=0)\exists y\,(x + y = 0)

answer one of these

∃z (P(x)→Q(y,z))\exists z\,(P(x) \to Q(y, z))

answer one of these

Exercise 2.2.

Membership and the bounded quantifiers.

Let T={1,{1}}T = \{1, \{1\}\}. Which holds?

answer one of these

Some object cc lies outside AA. Which of these is then true, whatever PP is?

answer one of these

Exercise 2.3.

Negate each statement, leaving no negation in front of a quantifier and no “it is not the case that” anywhere.

Every multiple of 88 is even.

answer one of these

There is a real number xx such that x2=2x^2 = 2 and x<0x < 0.

answer one of these

If nn is prime, then nn is odd.

answer one of these

Exercise 2.4.

Take the conditional “if nn is a multiple of 1212, then nn is a multiple of 33”, with nn ranging over the whole numbers.

The converse and the inverse are:

answer one of these

The contrapositive is:

answer one of these

Whatever conditional we had started from, at most how many distinct truth values can the four statements carry between them?

answer one of these

Exercise 2.5.

Let UU be the whole numbers and let P(x,y)P(x, y) denote ”x+yx + y is even”.

∀x∈U ∀y∈U (P(x,y))\forall x \in U\, \forall y \in U\,(P(x, y))

answer one of these

∀x∈U ∃y∈U (P(x,y))\forall x \in U\, \exists y \in U\,(P(x, y))

answer one of these

∃y∈U ∀x∈U (P(x,y))\exists y \in U\, \forall x \in U\,(P(x, y))

answer one of these

For ∀x∈U ∃y∈U (P(x,y))\forall x \in U\, \exists y \in U\,(P(x, y)), which witness works?

answer one of these

Exercise 2.6.

Let PP and QQ be predicates over an arbitrary universe. Classify each statement.

∀x (P(x)∨¬P(x))\forall x\,(P(x) \lor \neg P(x))

answer one of these

∃x (P(x))∨∀x (¬P(x))\exists x\,(P(x)) \lor \forall x\,(\neg P(x))

answer one of these

∃x (P(x))→∀x (P(x))\exists x\,(P(x)) \to \forall x\,(P(x))

answer one of these

∀x (P(x)→Q(x))∧∃x (P(x)∧¬Q(x))\forall x\,(P(x) \to Q(x)) \land \exists x\,(P(x) \land \neg Q(x))

answer one of these

Exercise 2.7.

Each argument form below is invalid. Give an assignment at which every premise holds and the conclusion fails.

p∨q,  p  ⊢  ¬qp \lor q,\; p \;\vdash\; \neg q

answer assignment
p q

p→q,  q→r  ⊢  r→pp \to q,\; q \to r \;\vdash\; r \to p

answer assignment
p q r

p→(q∨r),  ¬q  ⊢  ¬pp \to (q \lor r),\; \neg q \;\vdash\; \neg p

answer assignment
p q r

Exercise 2.8.

Push each negation inward until it stands in front of the predicate alone.

¬(∀x∈S (p(x)→q(x)))\neg\bigl(\forall x \in S\,(p(x) \to q(x))\bigr)

answer one of these

¬(∃x ∀y (P(x,y)→Q(y)))\neg\bigl(\exists x\, \forall y\,(P(x, y) \to Q(y))\bigr)

answer one of these

Exercise 2.9.

The shape of a claim decides the shape of its proof.

Take the claim: for every real number xx, if x4<1x^4 < 1 then x<1x < 1. A proof of it by contrapositive opens by assuming:

answer one of these

A proof of the same claim by contradiction opens by assuming:

answer one of these

A proof of ∃! x∈S (p(x))\exists!\, x \in S\,(p(x)) that produces a witness and stops there has established:

answer one of these

To disprove ∃x∈S (p(x))\exists x \in S\,(p(x)):

answer one of these

Exercise 2.10.

Counterexamples, over the whole numbers in the first part and the real numbers in the second. Two whole numbers are said to have the same parity if they are both even or both odd.

If m+nm + n is even, then mnmn is even.

answer one of these

If x2>xx^2 > x, then x>1x > 1.

answer one of these

For whole numbers mm and nn, the sum m+nm + n is even exactly when:

answer one of these

Exercise 2.11.

Let mm and bb be real numbers and consider the equation mx+b=0mx + b = 0.

Suppose m≠0m \neq 0, so that the equation has exactly one real solution. Which step of the uniqueness half of that proof is the one that uses m≠0m \neq 0?

answer one of these

If m=0m = 0:

answer one of these

Exercise 2.12.

A whole number is a difference of two squares if it can be written as a2−b2a^2 - b^2 for whole numbers aa and bb.

Which pair of squares has difference 2k+12k + 1?

answer one of these

Which whole numbers are a difference of two squares?

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave us three tactics, intro, exact and apply, and with them the implication, ⊤\top, ⊥\bot and negation. What is missing is the rest of the connectives. Each of ∧\land, ∨\lor and ↔\leftrightarrow comes with two questions: how to prove one, and what to do with one we have been handed. The quantifiers wait for the next sheet.

Conjunction

constructor

A conjunction is proved by proving both halves. If the goal is ⊢ p ∧ q, then constructor replaces it with the two goals ⊢ p and ⊢ q. A tactic acts on the first goal only, so from here on we write each goal’s proof under a focus dot ·, indented; the dot takes the first goal and the block under it must finish that goal off.

Example.

Put the caret on the constructor line and then on the line below it to watch one goal become two.

lean worked
1example (p q : Prop) (hp : p) (hq : q) : p ∧ q := by
verified
goalGoals accomplished.

A conjunction may also be built in one term: ⟨hp, hq⟩ is the proof of p ∧ q made from a proof of each half. Type \< for ⟨ and \> for ⟩.

Taking one apart

If h : p ∧ q then h.1 is a proof of p and h.2 is a proof of q; they may also be written h.left and h.right.

Example.

The projection is a term, so it goes where any other proof would.

lean worked
1example (p q : Prop) (h : p ∧ q) : q := by
verified
goalGoals accomplished.

obtain

Where both halves are wanted, it reads better to take the hypothesis apart once and for all. obtain ⟨hp, hq⟩ := h replaces h : p ∧ q with hp : p and hq : q.

Example.

The same brackets take a conjunction apart on the left and build one on the right.

lean worked
1example (p q r : Prop) (h : p ∧ q) (hr : r) : r ∧ p := by
verified
goalGoals accomplished.

Exercise 2.13.

Two assumptions make their conjunction.

lean proof
1example (p q : Prop) : p → q → p ∧ q := by
goalp q : Prop ⊢ p → q → p ∧ q

Exercise 2.14.

The order of a conjunction carries no information.

lean proof
1example (p q : Prop) : p ∧ q → q ∧ p := by
goalp q : Prop ⊢ p ∧ q → q ∧ p

Exercise 2.15.

Nor does the bracketing.

lean proof
1example (p q r : Prop) : (p ∧ q) ∧ r → p ∧ (q ∧ r) := by
goalp q r : Prop ⊢ (p ∧ q) ∧ r → p ∧ q ∧ r

Exercise 2.16.

Two hypotheses taken in turn, against the two taken together.

lean proof
1example (p q r : Prop) : (p → q → r) → (p ∧ q → r) := by
goalp q r : Prop ⊢ (p → q → r) → p ∧ q → r

Exercise 2.17.

No statement holds alongside its own negation.

lean proof
1example (p : Prop) : ¬(p ∧ ¬p) := by
goalp : Prop ⊢ ¬(p ∧ ¬p)

Disjunction

left and right

A disjunction is proved by proving one half and saying which. With the goal ⊢ p ∨ q, left changes it to ⊢ p and right changes it to ⊢ q. The choice is ours to make and cannot be deferred, so making the wrong one leaves a goal that cannot be closed. In term form the two are Or.inl and Or.inr, each applied to a proof of the half it names.

Example.

Nothing is known about pp, so the right half is the one to go for.

lean worked
1example (p q : Prop) (hq : q) : p ∨ q := by
verified
goalGoals accomplished.

rcases

A disjunction we have been handed is weaker than a conjunction: it says that one of the two holds without saying which, so anything we conclude from it has to be concluded twice. rcases h with hp | hq splits h : p ∨ q into two goals, the first with hp : p and the second with hq : q, and the bar is what marks the split.

Example.

The goal is the same in both branches; only the hypothesis differs.

lean worked
1example (p q r : Prop) (h : p ∨ q) (hpr : p → r) (hqr : q → r) : r := by
verified
goalGoals accomplished.

Exercise 2.18.

The order of a disjunction carries no information either, but here we must first find out which half we were handed.

lean proof
1example (p q : Prop) : p ∨ q → q ∨ p := by
goalp q : Prop ⊢ p ∨ q → q ∨ p

Exercise 2.19.

Nor does the bracketing of a disjunction.

lean proof
1example (p q r : Prop) : (p ∨ q) ∨ r → p ∨ (q ∨ r) := by
goalp q r : Prop ⊢ (p ∨ q) ∨ r → p ∨ q ∨ r

Exercise 2.20.

Conjunction distributes over disjunction.

lean proof
1example (p q r : Prop) : p ∧ (q ∨ r) → (p ∧ q) ∨ (p ∧ r) := by
goalp q r : Prop ⊢ p ∧ (q ∨ r) → p ∧ q ∨ p ∧ r

Exercise 2.21.

One of De Morgan’s laws.

lean proof
1example (p q : Prop) : ¬(p ∨ q) → ¬p ∧ ¬q := by
goalp q : Prop ⊢ ¬(p ∨ q) → ¬p ∧ ¬q

Exercise 2.22.

Half of the defining equivalence of the conditional.

lean proof
1example (p q : Prop) : ¬p ∨ q → (p → q) := by
goalp q : Prop ⊢ ¬p ∨ q → p → q

Exercise 2.23.

And the other half.

lean proof
1example (p q : Prop) : (p → q) → ¬p ∨ q := by
goalp q : Prop ⊢ (p → q) → ¬p ∨ q

Equivalence

Both directions

p ↔ q is the conjunction of p → q and q → p, and it behaves like one. On a goal ⊢ p ↔ q, constructor leaves the two implications as separate goals; ⟨h, k⟩ builds the equivalence from a proof of each direction.

Example.

The two goals arrive in the order the equivalence is written.

lean worked
1example (p q : Prop) (h : p → q) (k : q → p) : p ↔ q := by
verified
goalGoals accomplished.

If h : p ↔ q then h.mp is the forward implication and h.mpr the backward one, so h.mp hp is a proof of q and h.mpr hq a proof of p. obtain ⟨f, g⟩ := h takes the two apart as it does for a conjunction.

Example.

An equivalence is used in whichever direction the goal asks for.

lean worked
1example (p q : Prop) (h : p ↔ q) (hq : q) : p := by
verified
goalGoals accomplished.

Exercise 2.24.

An equivalence may be read from either end.

lean proof
1example (p q : Prop) : (p ↔ q) → (q ↔ p) := by
goalp q : Prop ⊢ (p ↔ q) → (q ↔ p)

Exercise 2.25.

Equivalence is transitive.

lean proof
1example (p q r : Prop) : (p ↔ q) → (q ↔ r) → (p ↔ r) := by
goalp q r : Prop ⊢ (p ↔ q) → (q ↔ r) → (p ↔ r)

Exercise 2.26.

A statement conjoined with itself says no more than the statement.

lean proof
1example (p : Prop) : p ∧ p ↔ p := by
goalp : Prop ⊢ p ∧ p ↔ p

Exercise 2.27.

Equivalent statements may be swapped for one another inside a disjunction.

lean proof
1example (p q r : Prop) : (p ↔ q) → (p ∨ r ↔ q ∨ r) := by
goalp q r : Prop ⊢ (p ↔ q) → (p ∨ r ↔ q ∨ r)

Exercise 2.28.

No statement is equivalent to its own negation.

lean proof
1example (p : Prop) : ¬(p ↔ ¬p) := by
goalp : Prop ⊢ ¬(p ↔ ¬p)
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 3

Naive Sets

Taught

Sets

In the last chapter, we introduced predicates, quantifiers, and (most importantly) sets, attempting to characterise our mathematical discourse around them as well-defined; although we now possess the necessary tools to work with them directly, we will still set out a formal framework: a system of axioms for sets, just as we established for logic in Chapter 1. The result will be a somewhat overcomplete collection of axioms (a style not typically used when teaching set theory); some of these axioms can be used to deduce others.

Axioms

The previous definition of the set as nothing more than a collection of objects, although circular as collection is merely a set under a different name, is useful and intuitive enough that to form a collection of object is to abstract from the intrinsic nature of the items themselves.

The logicians have in any case turned this into a method by asking where an object sits rather than what it is. A set, in this picture, is a “primary” box holding other “secondary” boxes, its elements, which may contain further boxes in their turn, and so on as far down as one cares to follow; the composition of the box never matters, only the arrangement of which box lies within which, so that two boxes with the same contents are the same box. The picture asks two things of us:

Axiom 3.1 (Existence).

There exists a set with no elements, ∃X ∀x (x∉X)\exists X\,\forall x\,(x \notin X): called the empty or null set, written as {}\{\} or ∅\emptyset.

Axiom 3.2 (Sets are objects).

If AA is a set, then AA is also an object. In particular, a box AA is itself an object and an object may go inside a box BB, and therefore it is meaningful to ask whether AA is also an element of BB.

Remark.

Georg Cantor built set theory on that move somewhere between 1870 and 1890, taking the totality of objects sharing a given property to be one new object. The subject so founded divides into two: a first-order study of the sets themselves, and a higher-order study that turns upon the first to ask how far such knowledge can reach, where it shades into metamathematics, (we wont study this far). Many of his contemporaries objected, since such an object might be infinite.

Using our picture, we summarise the two relations used to build up set theory. The first, introduced last chapter, is the membership relation x∈Xx \in X: if xx is an object and XX is a set, then x∈Xx \in X is either true or false (it is well defined, which we come to in a second); note that if XX is not a set then x∈Xx \in X does not make sense, like saying π∈3\pi \in 3. The second is the equality relation x=yx = y: xx and yy name the same object, and its negation is written ¬(x=y)\lnot(x=y) or x≠yx \neq y. The equality relation obeys the three laws one expects: reflexivity, x=xx = x; symmetry, if x=yx = y then y=xy = x; and transitivity, if x=yx = y and y=zy = z then x=zx = z. The two relations, ∈\in and ==, obey axioms we will state as we need them; when the objects named are sets, the axiom of extension below tells us how to recognise that sameness.

Remark (Substitution).

Given any two objects xx and yy with x=yx = y, the statements P(x)P(x) and P(y)P(y) are equivalent for every property PP depending on xx. This is customarily taken as the axiom of substitution, but we are not assuming anything new: a predicate had its truth value fixed by the objects assigned to its variables rather than by the terms naming them, and x=yx = y says those two terms name one object, so P(x)P(x) and P(y)P(y) are the same assignment twice over.

Axiom 3.3 (Extensionality).

If two sets AA and BB have the same elements, then they are equal, ∀A ∀B (∀x (x∈A  ⟺  x∈B)  ⟹  A=B).\forall A\,\forall B\,\bigl(\forall x\,(x \in A \iff x \in B) \implies A = B\bigr).

From the axiom we know that sets are unordered, as the biconditional shows, and that repetition does not count, as the box picture makes plain. There is no point in dropping two secondary boxes AA and BB into XX when, opened all the way down, they hold the same contents; they are not distinct objects, however distinct they may look.

Example 3.4.

The sets {2,2,3,4,π,∅}\{2, 2, 3, 4, \pi, \emptyset\} and {4,π,∅,2,3}\{4, \pi, \emptyset, 2, 3\} are equal.

From these axioms, we prove that the notion of equality for sets given by extensionality obeys them as well.

Remark.

From here on there are two natural styles for writing such a proof. The first chases the element through in prose, spelling out what each membership means as it goes; the second works directly on the predicates, transforming "x∈Ax \in A" into "x∈Bx \in B" by the laws tabulated in the first chapter. Both are correct, and tastes differ; I prefer the logical style, but I will give both throughout for completeness, and you should be able to read each.

Theorem 3.5 (Equality of sets is an equivalence relation).

Let AA, BB and CC be sets. Then A=AA = A; if A=BA = B then B=AB = A; and if A=BA = B and B=CB = C then A=CA = C.

Since A=BA = B is the statement ∀x ((x∈A)  ⟺  (x∈B))\forall x\,((x \in A) \iff (x \in B)), we prove it just as proving universal claims taught us to prove any universally quantified biconditional: take an arbitrary xx, and show that x∈Ax \in A and x∈Bx \in B stand or fall together.

Discussion.

Every one of the three claims has the same form once extensionality is applied: We first note that the biconditional splits into its two constituents, (x∈A  ⟹  x∈B)∧(x∈B  ⟹  x∈A)(x \in A \implies x \in B) \land (x \in B \implies x \in A), so each law fixes an arbitrary object xx, proves two implications about its membership. For reflexivity, A=AA = A, or (x∈A  ⟹  x∈A)∧(x∈A  ⟹  x∈A)(x \in A \implies x \in A) \land (x \in A \implies x \in A); there is no hypothesis to argue from, so we read the implication through the defining equivalence of the conditional as ¬(x∈A)∨(x∈A)\neg(x \in A) \lor (x \in A), which Complement makes ⊤\top, and a conjunction of two such is ⊤\top again. For symmetry we assume A=BA = B, or, (x∈A  ⟹  x∈B)∧(x∈B  ⟹  x∈A)(x \in A \implies x \in B) \land (x \in B \implies x \in A); by Commutativity of ∧\land, gives us (x∈B  ⟹  x∈A)∧(x∈A  ⟹  x∈B)(x \in B \implies x \in A) \land (x \in A \implies x \in B) which is B=AB=A. For transitivity we assume A=BA = B and B=CB = C, which give four implications between three memberships: x∈A  ⟹  x∈Cx \in A \implies x \in C is the chain of x∈A  ⟹  x∈Bx \in A \implies x \in B with x∈B  ⟹  x∈Cx \in B \implies x \in C by hypothetical syllogism, and x∈C  ⟹  x∈Ax \in C \implies x \in A is the chain of the other two the same way.

Proof (element style).

Let xx be an object.

For reflexivity, we must show that xx lies in AA exactly when it lies in AA. If x∈Ax \in A then x∈Ax \in A, and if x∉Ax \notin A then x∉Ax \notin A, so the two memberships stand or fall together whichever way xx falls. As xx was arbitrary, Axiom 3.3 gives A=AA = A.

For symmetry, suppose A=BA = B. Then x∈A  ⟺  x∈Bx \in A \iff x \in B by substitution. If x∈Bx \in B then that biconditional puts xx in AA, and if x∈Ax \in A it puts xx in BB, so x∈B  ⟺  x∈Ax \in B \iff x \in A. As xx was arbitrary, Axiom 3.3 gives B=AB = A.

For transitivity, suppose A=BA = B and B=CB = C. Then x∈A  ⟺  x∈Bx \in A \iff x \in B and x∈B  ⟺  x∈Cx \in B \iff x \in C by substitution. If x∈Ax \in A, the first carries it into BB and the second into CC; if x∈Cx \in C, the second carries it back into BB and the first into AA. So x∈A  ⟺  x∈Cx \in A \iff x \in C, and as xx was arbitrary, Axiom 3.3 gives A=CA = C.

The axiom of extensionality also tells us that the empty set is unique.

Proposition 3.6 (Uniqueness of the empty set).

There is exactly one set with no elements.

Discussion.

By Axiom 3.1 , we know there is at least one set with no elements, so uniqueness is the claim that any two such sets are equal. Suppose ∅′\emptyset' is a different set that doesnt have any elements. By definition ∅\emptyset must equal ∅′\emptyset', which by Axiom 3.3 , ∅=∅′\emptyset = \emptyset' is the statement ∀x (x∈∅  ⟺  x∈∅′)\forall x\,(x \in \emptyset \iff x \in \emptyset'), for an arbitrary object xx. Neither set ∅\emptyset, and ∅′\emptyset' has elements, so both of its sides are ⊥\bot, and ⊥  ⟺  ⊥\bot \iff \bot is ⊤\top by biconditional.

Proof.

Let ∅\emptyset and ∅′\emptyset' both be sets with no elements, and let xx be an object. Since ∅\emptyset has no elements, x∉∅x \notin \emptyset, and since ∅′\emptyset' has no elements, x∉∅′x \notin \emptyset'; both x∈∅x \in \emptyset and x∈∅′x \in \emptyset' are therefore ⊥\bot. By the biconditional, ⊥  ⟺  ⊥\bot \iff \bot is ⊤\top, so x∈∅  ⟺  x∈∅′x \in \emptyset \iff x \in \emptyset'. As xx was arbitrary, Axiom 3.3 gives ∅=∅′\emptyset = \emptyset'. Any two sets with no elements are equal, so there is only one, and we are entitled to speak of the empty set.

If a set is not equal to the empty set we call it non-empty. The following is a small statement, but one we will lean on often.

Proposition 3.7 (Single choice).

Let AA be a non-empty set. Then there exists an object xx such that x∈Ax \in A.

Discussion.

The statement is existential, and proving existential claims asks for a witness, which the hypothesis A≠∅A \neq \emptyset does not name. We prove it by contradiction: denying the conclusion makes x∈Ax \in A false for every object xx, and x∈∅x \in \emptyset is false by Axiom 3.1 , so x∈A  ⟺  x∈∅x \in A \iff x \in \emptyset is ⊤\top by the biconditional and Axiom 3.3 gives A=∅A = \emptyset, against the hypothesis.

Proof.

Suppose, for contradiction, that no object xx satisfies x∈Ax \in A. Let xx be an object. Then x∉Ax \notin A, and by the axiom of existence x∉∅x \notin \emptyset. Both memberships are false, and as xx was arbitrary, ∅=A\emptyset = A (by Axiom 3.3 as x∈A  ⟺  x∈∅x \in A \iff x \in \emptyset is true), contradicting AA being non-empty, so some object xx satisfies x∈Ax \in A.

Remark.

Firstly The emptyset is not the same thing as the number 0. One is a set; and the other a number. Secondly Proposition 3.7 is what licenses the word “choose”: given a non-empty AA we may pick out an element of it and give that element a name, and it is the hypothesis A≠∅A \neq \emptyset that earns us the right to do so. Taking one element from each of finitely many non-empty sets A1,…,AnA_1, \ldots, A_n at once is a further step, and we will take it when we need it. Taking one from each of infinitely many is a different matter again: nothing we have assumed so far reaches that far, and it takes an axiom of its own, the axiom of choice, which we will keep running into.

Problem 3.1.

Let AA and BB be sets. Show that A≠BA \neq B if and only if there is an object belonging to one of them and not to the other.

Set-Builder Notation

We go back to last chapter, where we combined sets with predicates. To describe a set by a defining characteristic, or by carving a condition into a larger set, we use set-builder notation; a set so described takes the form

S={x∣P(x)}S = \{x \mid P(x)\}

read ”SS is the set of all xx such that P(x)P(x) is true”, with "∣\mid" meaning such that (note that some people use "::" over ”|”) and P(x)P(x) a predicate.

This right now sounds like the well-defined set we spoke of earlier, but it isnt. As written the notation is unrestricted, and Russell’s paradox is what that costs us. Define

R={x∣x∉x}R = \{x \mid x \notin x\}

We can ask a few questions, like what the elements of RR are. Any of the sets we have discussed so far would be one: the empty set contains no elements, so it certainly does not have itself as an element, and ∅∈R\emptyset \in R. But what about RR itself?

  1. Suppose R∈RR \in R. The defining property of RR tells us that each of its elements is a set which does not have itself as an element, so R∉RR \notin R.
  2. Suppose R∉RR \notin R. Then RR is a set which does not have itself as an element, and that is the defining property, so R∈RR \in R.

Each assumption gives us its own negation, so R∈R  ⟺  R∉RR \in R \iff R \notin R. No statement is equivalent to its own negation, so the fault is with the notation that produced RR: we let the predicate range over everything at once.

Problem 3.2.

Is {x∣x≠x}\{x \mid x \neq x\} a paradoxical set? Say why or why not; (b) does it have any elements?

So currently written our set-builder notation isnt safe. The axiom below is what makes it safe, and it carves into a set we already have.

Axiom 3.8 (Comprehension).

For every set AA and every predicate P(x)P(x) there exists a set whose elements are exactly the elements of AA for which P(x)P(x) holds, ∀A ∃B ∀x (x∈B  ⟺  x∈A∧P(x))\forall A\,\exists B\,\forall x\,(x \in B \iff x \in A \land P(x)).

The predicate no longer ranges over everything; it ranges over the elements of a set we are holding already, so Russell’s RR is never formed. What we may write down instead is {x∈A∣x∉x}\{x \in A \mid x \notin x\}, which is a perfectly ordinary set, and asking whether it belongs to itself gets an ordinary answer.

Proposition 3.9 (The carved set is unique).

Let AA be a set and P(x)P(x) a predicate. There is exactly one set BB such that x∈Bx \in B if and only if x∈Ax \in A and P(x)P(x).

Discussion.

Axiom 3.8 supplies at least one such BB, so uniqueness is the claim that any two are equal. We prove this directly: We assume there is a second set B′B' satisfying the same membership condition. By Axiom 3.3 , B=B′B = B' is the statement ∀x (x∈B  ⟺  x∈B′)\forall x\,(x \in B \iff x \in B'), and the work is that one biconditional at an arbitrary object xx. Both sets carry the same membership criterion, so each side of it is equivalent to x∈A∧P(x)x \in A \land P(x), and the two sides are joined through that.

Proof.

Let BB and B′B' both satisfy the criterion, and let xx be an object. Then x∈B′  ⟺  x∈A∧P(x)x \in B' \iff x \in A \land P(x) and x∈A∧P(x)  ⟺  x∈Bx \in A \land P(x) \iff x \in B, so x∈B′  ⟺  x∈Bx \in B' \iff x \in B by the transitivity of equivalence. As xx was arbitrary, Axiom 3.3 gives B=B′B = B'.

Since there is only one such set, we may name it.

Definition 3.10 (Set-builder notation).

Let AA be a set and P(x)P(x) a predicate. The unique set BB such that x∈Bx \in B if and only if x∈Ax \in A and P(x)P(x) is written {x∈A∣P(x)}\{x \in A \mid P(x)\}.

The criterion settles membership one object at a time: given any object xx, whether x∈{x∈A∣P(x)}x \in \{x \in A \mid P(x)\} holds is decided by whether x∈Ax \in A and P(x)P(x) do, and both of those have a truth value already.

Definition 3.11 (Well-defined set).

A set XX is well defined when x∈Xx \in X has a truth value for every object xx.

We note that every set Axiom 3.8 builds is well defined, since PP is a predicate and a predicate has a truth value once its variable is assigned.

Problem 3.3.

Let AA and BB be sets. Show that the set of objects lying in AA and not in BB exists.

We said at the outset that our collection of axioms would be somewhat overcomplete, and here is one instance of it: Axiom 3.1 asks for a set with no elements, but comprehension will produce one from any set at all.

Proposition 3.12 (Existence from comprehension).

Suppose some set exists. Then there is a set with no elements.

Discussion.

The hypothesis names a set but says nothing about its elements, so we can neither point at an object in it nor rule one out. What Axiom 3.8 lets us do is carve that set by any predicate we please, so we pick one no object can satisfy: x≠xx \neq x fails for every object by the reflexivity of equality, and the set it carves out is then empty whatever we started from.

Proof.

Let AA be a set. By Axiom 3.8 , B={x∈A∣x≠x}B = \{x \in A \mid x \neq x\} is a set, and x∈B  ⟺  x∈A∧x≠xx \in B \iff x \in A \land x \neq x for every object xx. Since x=xx = x for every object, x≠xx \neq x is ⊥\bot, and x∉Bx \notin B. As xx was arbitrary, BB has no elements.

Restricting the notation avoids the paradox. The cost is that there is no set of everything.

Proposition 3.13 (No set of all sets).

There is no set VV such that every set is an element of VV, that is, ¬∃V ∀X (X∈V)\neg\exists V\,\forall X\,(X \in V), with XX ranging over sets.

Discussion.

The claim is a negative existence statement, so we prove it by contradiction: we assume such a VV exists and use it to build a set that cannot exist. Axiom 3.8 applied to VV and the predicate ”xx is not an element of itself” produces R={x∈V∣x∉x}R = \{x \in V \mid x \notin x\}, which is where Russell’s argument runs again, this time inside the axiom rather than outside it. The question is whether R∈RR \in R, and the membership criterion is a biconditional, x∈R  ⟺  x∈V∧x∉xx \in R \iff x \in V \land x \notin x, so either answer forces the other.

Proof.

Suppose VV is a set containing every set. By Axiom 3.8 , R={x∈V∣x∉x}R = \{x \in V \mid x \notin x\} is a set, and since VV contains every set, R∈VR \in V. If R∈RR \in R, then by the membership criterion RR satisfies the defining predicate, so R∉RR \notin R; if R∉RR \notin R, then R∈VR \in V and R∉RR \notin R both hold, which is the criterion, so R∈RR \in R. Each alternative gives its own negation, so no such VV exists.

Pairs

Were these the only axioms we had, set theory would be a paper thin subject: Axiom 3.1 gives us the empty set, and Axiom 3.8 only ever carves into a set we are already holding, so every set we could name would be empty. The axioms below build new sets.

Axiom 3.14 (Pairing).

For any two objects there is a set containing exactly those two, ∀x ∀y ∃z ∀w (w∈z  ⟺  (w=x∨w=y))\forall x\,\forall y\,\exists z\,\forall w\,(w \in z \iff (w = x \lor w = y)).

Definition 3.15 (Pair and singleton).

Let xx and yy be objects. The set given by pairing them is written {x,y}\{x, y\}, and we write {x}\{x\} for {x,x}\{x, x\}, the singleton of xx.

Remark.

The axiom asserts that such a set exists; that there is only one comes from Axiom 3.3 , by the argument of Proposition 3.9 . Two sets answering to the same membership criterion agree on every object, so they are equal; the same holds for every set we name from here on.

Since {x}\{x\} is an abbreviation rather than a further axiom, no separate axiom for singletons is needed: pairing an object with itself produces one.

Proposition 3.16 (Pairs are unordered and absorb repetition).

Let xx and yy be objects. Then {x,y}={y,x}\{x, y\} = \{y, x\}, and w∈{x}w \in \{x\} if and only if w=xw = x, for every object ww.

Discussion.

The first claim is an equality of sets, so by Axiom 3.3 it is a biconditional at an arbitrary object ww, and the membership criterion of Axiom 3.14 rewrites each side as a disjunction: w=x∨w=yw = x \lor w = y on the one side and w=y∨w=xw = y \lor w = x on the other, which the axiom of Commutativity exchanges. The second claim is not an equality of sets, since {x}\{x\} is by Definition 3.15 another name for {x,x}\{x, x\}; what has to be shown is that the pair criterion collapses, w=x∨w=xw = x \lor w = x reducing to w=xw = x by Idempotence, so that the singleton holds the one object and nothing else.

Proof (element style).

Let ww be an object and suppose w∈{x,y}w \in \{x, y\}. By Axiom 3.14 , w=xw = x or w=yw = y. In the first case ww is the second of the two objects paired to form {y,x}\{y, x\}, and in the second case it is the first, so w∈{y,x}w \in \{y, x\} either way. Interchanging xx and yy throughout carries an element of {y,x}\{y, x\} back to {x,y}\{x, y\}. As ww was arbitrary, Axiom 3.3 gives {x,y}={y,x}\{x, y\} = \{y, x\}. For the singleton, {x}\{x\} is {x,x}\{x, x\}. If w∈{x}w \in \{x\}, then by Axiom 3.14 w=xw = x or w=xw = x, and both alternatives say the same thing, so w=xw = x. Conversely, if w=xw = x then the first alternative holds, so w∈{x,x}w \in \{x, x\}, which is w∈{x}w \in \{x\}.

Proof (logical style).

Let ww be an object.

w∈{x,y}≡(w=x∨w=y)by Pairing≡(w=y∨w=x)by Commutativity≡w∈{y,x}by Pairing\begin{aligned} w \in \{x, y\} &\equiv (w = x \lor w = y) && \text{by Pairing} \\ &\equiv (w = y \lor w = x) && \text{by Commutativity} \\ &\equiv w \in \{y, x\} && \text{by Pairing} \end{aligned}

As ww was arbitrary, Axiom 3.3 gives {x,y}={y,x}\{x, y\} = \{y, x\}. For the singleton:

w∈{x}≡w∈{x,x}by the singleton notation≡(w=x∨w=x)by Pairing≡w=xby Idempotence\begin{aligned} w \in \{x\} &\equiv w \in \{x, x\} && \text{by the singleton notation} \\ &\equiv (w = x \lor w = x) && \text{by Pairing} \\ &\equiv w = x && \text{by Idempotence} \end{aligned}

Example 3.17.

The empty set is a set, hence an object by Axiom 3.2 , so pairing it with itself gives the singleton {∅}\{\emptyset\}. That in turn is an object, so we may form {{∅}}\{\{\emptyset\}\}, and pairing the first two gives {∅,{∅}}\{\emptyset, \{\emptyset\}\}.

Problem 3.4.

Show that ∅\emptyset, {∅}\{\emptyset\}, {{∅}}\{\{\emptyset\}\} and {∅,{∅}}\{\emptyset, \{\emptyset\}\} are four different sets.

Every set we can build so far holds at most two elements; to grow them we take a set whose members are themselves sets and pool everything they contain.

Axiom 3.18 (Union).

Given any set of sets, there is a set containing precisely those objects which are members of some set in the collection, ∀x ∃y ∀z (z∈y  ⟺  ∃w (z∈w∧w∈x))\forall x\,\exists y\,\forall z\,(z \in y \iff \exists w\,(z \in w \land w \in x)).

Definition 3.19 (Union of a system of sets).

Let SS be a set. The unique set UU such that x∈Ux \in U if and only if x∈Ax \in A for some A∈SA \in S is written ⋃S\bigcup S.

Definition 3.20 (Union of two sets).

Let AA and BB be sets. Then A∪BA \cup B denotes the set ⋃{A,B}\bigcup \{A, B\}.

Two axioms are at work in that second definition: pairing gathers AA and BB into one collection, and union pools what they hold. Membership in the result reads as a disjunction.

Proposition 3.21 (Membership in a union).

Let AA and BB be sets. For every object xx, x∈A∪B  ⟺  (x∈A∨x∈B)x \in A \cup B \iff (x \in A \lor x \in B).

Discussion.

A∪BA \cup B is ⋃{A,B}\bigcup \{A, B\}, so Axiom 3.18 reads its membership as ∃w (x∈w∧w∈{A,B})\exists w\,(x \in w \land w \in \{A, B\}), an existential claim about which member of the collection holds xx. The collection has only two members, since Axiom 3.14 gives w∈{A,B}  ⟺  (w=A∨w=B)w \in \{A, B\} \iff (w = A \lor w = B), so the witness ww can only be AA or BB and the existential claim collapses into the disjunction of those two cases.

Proof (element style).

Let xx be an object and suppose x∈A∪Bx \in A \cup B, which is to say x∈⋃{A,B}x \in \bigcup \{A, B\}. By Axiom 3.18 some set ww has x∈wx \in w and w∈{A,B}w \in \{A, B\}, and by Axiom 3.14 that ww is either AA or BB. In the first case x∈Ax \in A and in the second x∈Bx \in B, so x∈Ax \in A or x∈Bx \in B.

Conversely, suppose x∈Ax \in A or x∈Bx \in B. If x∈Ax \in A, take ww to be AA: then x∈wx \in w, and w∈{A,B}w \in \{A, B\} by Axiom 3.14 , so ww is a witness and x∈⋃{A,B}x \in \bigcup \{A, B\}. If instead x∈Bx \in B, take ww to be BB and argue the same way. Either way x∈A∪Bx \in A \cup B.

Proof (logical style).

Let xx be an object.

x∈A∪B≡x∈⋃{A,B}by the definition of A∪B≡∃w (x∈w∧w∈{A,B})by Union≡∃w (x∈w∧(w=A∨w=B))by Pairing≡∃w ((x∈w∧w=A)∨(x∈w∧w=B))by Distributivity≡∃w (x∈w∧w=A)∨∃w (x∈w∧w=B)by ∃-distribution≡(x∈A∨x∈B)by substitution\begin{aligned} x \in A \cup B &\equiv x \in \textstyle\bigcup \{A, B\} && \text{by the definition of } A \cup B \\ &\equiv \exists w\,(x \in w \land w \in \{A, B\}) && \text{by Union} \\ &\equiv \exists w\,\bigl(x \in w \land (w = A \lor w = B)\bigr) && \text{by Pairing} \\ &\equiv \exists w\,\bigl((x \in w \land w = A) \\ &\qquad\qquad {}\lor (x \in w \land w = B)\bigr) && \text{by Distributivity} \\ &\equiv \exists w\,(x \in w \land w = A) \\ &\qquad {}\lor \exists w\,(x \in w \land w = B) && \text{by }\exists\text{-distribution} \\ &\equiv (x \in A \lor x \in B) && \text{by substitution} \end{aligned}

The fifth step is the distribution of an existential over a disjunction from the last chapter, and the last discharges each witness by substitution, since a ww with w=Aw = A may be replaced by AA throughout.

The “or” is the disjunction of the first chapter, inclusive as always, so an object lying in both sets lies in the union too.

Proposition 3.22 (Union is well defined).

Let AA, A′A' and BB be sets with A=A′A = A'. Then A∪B=A′∪BA \cup B = A' \cup B.

Discussion.

An operation on sets should not depend on how we happened to name its arguments, and the criterion of Proposition 3.21 ensures this here: membership in A∪BA \cup B is decided by membership in AA and in BB, and A=A′A = A' makes membership in AA and in A′A' the same question. So the two unions meet the same criterion at every object, and Axiom 3.3 gives the equality.

Proof (element style).

Let xx be an object and suppose x∈A∪Bx \in A \cup B. By Proposition 3.21 , x∈Ax \in A or x∈Bx \in B. If x∈Ax \in A, then x∈A′x \in A' by substitution, since A=A′A = A'; if x∈Bx \in B, there is nothing to change. Either way x∈A′x \in A' or x∈Bx \in B, so x∈A′∪Bx \in A' \cup B by Proposition 3.21 .

For the converse, A′=AA' = A by the symmetry of equality established in Theorem 3.5 , so the same argument run with A′A' in place of AA carries an element of A′∪BA' \cup B into A∪BA \cup B. As xx was arbitrary, Axiom 3.3 gives A∪B=A′∪BA \cup B = A' \cup B.

Proof (logical style).

Let xx be an object.

x∈A∪B≡(x∈A∨x∈B)by membership in a union≡(x∈A′∨x∈B)since A=A′≡x∈A′∪Bby membership in a union\begin{aligned} x \in A \cup B &\equiv (x \in A \lor x \in B) && \text{by membership in a union} \\ &\equiv (x \in A' \lor x \in B) && \text{since } A = A' \\ &\equiv x \in A' \cup B && \text{by membership in a union} \end{aligned}

As xx was arbitrary, Axiom 3.3 gives A∪B=A′∪BA \cup B = A' \cup B.

With membership in a union settled, the basic properties of the operation follow from the corresponding properties of ∨\lor.

Proposition 3.23 (Basic properties of unions).

Let aa and bb be objects and let AA, BB and CC be sets. Then

  1. {a,b}={a}∪{b}\{a, b\} = \{a\} \cup \{b\};
  2. A∪B=B∪AA \cup B = B \cup A;
  3. (A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C);
  4. A∪A=A∪∅=∅∪A=AA \cup A = A \cup \emptyset = \emptyset \cup A = A.

Discussion.

Every claim is an equality of sets, so by Axiom 3.3 each is a biconditional at an arbitrary object xx, and Proposition 3.21 turns each side into a disjunction of memberships. What is left is a propositional identity in each case: Commutativity of ∨\lor for the second claim, Associativity for the third, and for the fourth, Idempotence for A∪AA \cup A together with the axiom of Identity for the two involving ∅\emptyset, since x∈∅x \in \emptyset is ⊥\bot by Axiom 3.1 . The first claim uses earlier results: Axiom 3.14 gives x=a∨x=bx = a \lor x = b on the left, and Proposition 3.16 reads each singleton on the right as a single equation, so the two sides meet at the same disjunction.

Proof (element style).

Let xx be an object.

For the first claim, suppose x∈{a,b}x \in \{a, b\}. By Axiom 3.14 , x=ax = a or x=bx = b. In the first case x∈{a}x \in \{a\} by Proposition 3.16 , and in the second x∈{b}x \in \{b\}, so either way x∈{a}∪{b}x \in \{a\} \cup \{b\} by Proposition 3.21 . Conversely, if x∈{a}∪{b}x \in \{a\} \cup \{b\} then x∈{a}x \in \{a\} or x∈{b}x \in \{b\}, so x=ax = a or x=bx = b, and x∈{a,b}x \in \{a, b\}.

For the second, suppose x∈A∪Bx \in A \cup B. Then x∈Ax \in A or x∈Bx \in B, which is to say x∈Bx \in B or x∈Ax \in A, so x∈B∪Ax \in B \cup A. The same argument with AA and BB interchanged gives the reverse.

For the third, suppose x∈(A∪B)∪Cx \in (A \cup B) \cup C. Then x∈A∪Bx \in A \cup B or x∈Cx \in C. If x∈Cx \in C, then x∈B∪Cx \in B \cup C, and so x∈A∪(B∪C)x \in A \cup (B \cup C). If instead x∈A∪Bx \in A \cup B, then x∈Ax \in A or x∈Bx \in B; in the first case x∈A∪(B∪C)x \in A \cup (B \cup C) at once, and in the second x∈B∪Cx \in B \cup C and hence x∈A∪(B∪C)x \in A \cup (B \cup C). So every element of (A∪B)∪C(A \cup B) \cup C lies in A∪(B∪C)A \cup (B \cup C), and a similar argument gives the reverse.

For the fourth, x∈A∪Ax \in A \cup A says x∈Ax \in A or x∈Ax \in A, which says x∈Ax \in A. And x∈A∪∅x \in A \cup \emptyset says x∈Ax \in A or x∈∅x \in \emptyset, where the second alternative is impossible by Axiom 3.1 , so it says x∈Ax \in A; the same holds for ∅∪A\emptyset \cup A.

In each case xx was arbitrary, so Axiom 3.3 gives the four equalities.

Proof (logical style).

Let xx be an object, and write pp, qq, rr for the propositions x∈Ax \in A, x∈Bx \in B, x∈Cx \in C.

x∈{a,b}≡(x=a∨x=b)by Pairing≡(x∈{a}∨x∈{b})by the singleton criterion≡x∈{a}∪{b}by membership in a union\begin{aligned} x \in \{a, b\} &\equiv (x = a \lor x = b) && \text{by Pairing} \\ &\equiv (x \in \{a\} \lor x \in \{b\}) && \text{by the singleton criterion} \\ &\equiv x \in \{a\} \cup \{b\} && \text{by membership in a union} \end{aligned}x∈A∪B≡p∨q≡q∨p≡x∈B∪Aby Commutativityx∈(A∪B)∪C≡(p∨q)∨r≡p∨(q∨r)≡x∈A∪(B∪C)by Associativityx∈A∪A≡p∨p≡x∈Aby Idempotencex∈A∪∅≡p∨⊥≡x∈Aby Identity\begin{aligned} x \in A \cup B &\equiv p \lor q \equiv q \lor p \equiv x \in B \cup A && \text{by Commutativity} \\ x \in (A \cup B) \cup C &\equiv (p \lor q) \lor r \\ &\equiv p \lor (q \lor r) \equiv x \in A \cup (B \cup C) && \text{by Associativity} \\ x \in A \cup A &\equiv p \lor p \equiv x \in A && \text{by Idempotence} \\ x \in A \cup \emptyset &\equiv p \lor \bot \equiv x \in A && \text{by Identity} \end{aligned}

We note that ∅∪A\emptyset \cup A goes the same way after Commutativity. In each case xx was arbitrary, so Axiom 3.3 gives the equalities.

Because of associativity, we do not need to use the brackets: A∪B∪CA \cup B \cup C names one set regardless of how we group it (A∪(B∪C)A \cup (B \cup C) or (A∪B)∪C(A \cup B) \cup C, both mean the same thing), and likewise for A∪B∪C∪DA \cup B \cup C \cup D and longer strings.

Definition 3.24 (Triples and longer).

Let aa, bb, cc be objects. We write {a,b,c}\{a, b, c\} for {a}∪{b}∪{c}\{a\} \cup \{b\} \cup \{c\}, and {a,b,c,d}\{a, b, c, d\} for {a}∪{b}∪{c}∪{d}\{a\} \cup \{b\} \cup \{c\} \cup \{d\}, and so on for any string of objects written out in full.

Example 3.25.

The set {1,2}∪{2,3}\{1, 2\} \cup \{2, 3\} holds those objects lying in {1,2}\{1,2\}, or in {2,3}\{2,3\}, or in both, which are 11, 22 and 33. So {1,2}∪{2,3}={1,2,3}\{1, 2\} \cup \{2, 3\} = \{1, 2, 3\}.

The phrase “and so on” cannot yet be justified. Writing a set of nn objects for an unspecified nn means iterating the construction nn times, and we have not said what iterating a construction a given number of times amounts to; a set of infinitely many objects is further out of reach still. Later axioms will build sets that large.

Problem 3.5.

Let AA be a set. Show that ⋃{A}=A\bigcup \{A\} = A.

Subset

Comparing sets, we can see that some sit inside others, and we say the smaller one is a subset of the bigger. We write ⊂\subset for this throughout, whether or not the two sets happen to be equal.

Definition 3.26 (Subset).

Let AA and SS be sets. We say AA is a subset of SS, written A⊂SA \subset S, if every element of AA is an element of SS. If moreover A≠SA \neq S, we call AA a proper subset of SS and write A⊊SA \subsetneq S.

In logical language this is a universally quantified implication between predicates,

A⊂Smeans∀x ((x∈A)  ⟹  (x∈S)),A \subset S \quad\text{means}\quad \forall x\,\bigl((x \in A) \implies (x \in S)\bigr),

and this reading will drive every subset proof we write: to prove A⊂SA \subset S we take an arbitrary xx, assume x∈Ax \in A, and reach x∈Sx \in S.

Example 3.27.

The empty set is a subset of every set SS. The implication (x∈∅)  ⟹  (x∈S)(x \in \emptyset) \implies (x \in S) has a hypothesis no object can satisfy, and an implication with a false hypothesis holds automatically; a promise never invoked is never broken. So ∅⊂S\emptyset \subset S, vacuously.

The definition uses nothing but ∈\in and ==, and both obey substitution, so the subset relation does too: if A⊂BA \subset B and A=A′A = A', then A′⊂BA' \subset B.

Proposition 3.28 (Subsets are transitive).

Let AA, BB and CC be sets. If A⊂BA \subset B and B⊂CB \subset C, then A⊂CA \subset C.

Discussion.

The conclusion A⊂CA \subset C is itself a universally quantified implication, so we assume x∈Ax \in A for an arbitrary object xx and must reach x∈Cx \in C. The definition of subset is the only tool needed: A⊂BA \subset B trades membership in AA for membership in BB, and B⊂CB \subset C trades membership in BB for membership in CC, so xx is carried into BB and then into CC.

Proof (element style).

Let x∈Ax \in A. By the definition of subset, A⊂BA \subset B gives x∈Bx \in B, and B⊂CB \subset C gives x∈Cx \in C. As xx was arbitrary, A⊂CA \subset C.

Proof (logical style).

For any object xx,

x∈A  ⟹  x∈Bsince A⊂B  ⟹  x∈Csince B⊂C,\begin{aligned} x \in A &\implies x \in B && \text{since } A \subset B \\ &\implies x \in C && \text{since } B \subset C, \end{aligned}

so (x∈A)  ⟹  (x∈C)(x \in A) \implies (x \in C) holds for every xx, which is A⊂CA \subset C.

Mutual inclusion is the other way of saying two sets are equal, which is what we should expect: the obvious way to define equality of sets is to say they contain exactly the same elements, and that is two implications rather than one.

Proposition 3.29 (Mutual inclusion is equality).

Let AA and BB be sets. If A⊂BA \subset B and B⊂AB \subset A, then A=BA = B.

Discussion.

By Axiom 3.3 the conclusion is a biconditional at an arbitrary object xx, and by the defining equivalence of the biconditional that biconditional is the conjunction of two implications. Those two implications are exactly what the two inclusions say, so the hypotheses give the conclusion once both sides are unfolded into their logical form.

Proof.

Let xx be an object. By the definition of subset, A⊂BA \subset B gives x∈A  ⟹  x∈Bx \in A \implies x \in B, and B⊂AB \subset A gives x∈B  ⟹  x∈Ax \in B \implies x \in A. The two together say that xx lies in AA exactly when it lies in BB, so x∈A  ⟺  x∈Bx \in A \iff x \in B. As xx was arbitrary, Axiom 3.3 gives A=BA = B.

Proposition 3.30 (Proper subsets are transitive).

Let AA, BB and CC be sets. If A⊊BA \subsetneq B and B⊊CB \subsetneq C, then A⊊CA \subsetneq C.

Discussion.

A proper inclusion is two claims, so the conclusion is two claims. The inclusion A⊂CA \subset C is Proposition 3.28 applied to the two inclusions we are given, which leaves A≠CA \neq C. For that we need an object separating them, and B⊊CB \subsetneq C supplies one: were every element of CC in BB we would have C⊂BC \subset B, and with B⊂CB \subset C that makes B=CB = C by Proposition 3.29 , against B≠CB \neq C. That object lies in CC but not in BB, so it cannot lie in AA either.

Proof.

From A⊂BA \subset B and B⊂CB \subset C we get A⊂CA \subset C by Proposition 3.28 , so it remains to show A≠CA \neq C. Since B≠CB \neq C, some object cc lies in CC but not in BB: otherwise every element of CC would be an element of BB, giving C⊂BC \subset B, and with B⊂CB \subset C that would make B=CB = C by Proposition 3.29 . Now suppose A=CA = C. Then c∈Ac \in A by substitution, and A⊂BA \subset B gives c∈Bc \in B, contradicting c∉Bc \notin B. So A≠CA \neq C, and with A⊂CA \subset C this is A⊊CA \subsetneq C.

Problem 3.6.

Is S⊂SS \subset S for every set SS?

Problem 3.7.

Let S={1,2}S = \{1, 2\}. Which of 1∈S1 \in S, {1}∈S\{1\} \in S and {1}⊂S\{1\} \subset S are true?

More Set Operations

Swapping the “or” for an “and” gives the intersection, whose members must belong to both sets at once.

Definition 3.31 (Intersection).

Let SS and TT be sets. The intersection S∩TS \cap T is the set {x∈S∣x∈T}\{x \in S \mid x \in T\}, so that for every object xx,

(x∈S∩T)≡(x∈S)∧(x∈T).(x \in S \cap T) \equiv (x \in S) \land (x \in T).

The intersection needs no new axiom: Axiom 3.8 carves it out of SS, a set we are already holding. And since it is defined from ∈\in and ∧\land alone, both of which obey substitution, so does the intersection. The same remark applies to the definitions that follow, and we will not mention it again.

Proposition 3.32 (Inclusions for union and intersection).

Let SS and TT be sets. Then S∩T⊂SS \cap T \subset S and S∩T⊂TS \cap T \subset T, while S⊂S∪TS \subset S \cup T and T⊂S∪TT \subset S \cup T.

Discussion.

Each of the four is a universally quantified implication, so each takes an arbitrary xx, assumes the left membership and reaches the right. The two for the intersection unfold into a conjunction on the left, and Simplification extracts either conjunct. The two for the union unfold into a disjunction on the right, and Addition weakens a known truth to a disjunction.

Proof.

Let xx be an object. If x∈S∩Tx \in S \cap T, then x∈Sx \in S and x∈Tx \in T; Simplification gives x∈Sx \in S from that conjunction, and equally x∈Tx \in T. As xx was arbitrary, S∩T⊂SS \cap T \subset S and S∩T⊂TS \cap T \subset T.

If instead x∈Sx \in S, then Addition gives x∈Sx \in S or x∈Tx \in T, which is x∈S∪Tx \in S \cup T by Proposition 3.21 . As xx was arbitrary, S⊂S∪TS \subset S \cup T, and the argument for TT is the same.

Just as ⋃S\bigcup S pooled a whole collection of sets, we can meet a whole collection; here the union supplies the set to carve from, so no further axiom is needed.

Definition 3.33 (Intersection of a system of sets).

Let AA be a set. The intersection of the sets in AA is

⋂A  =def  {X∈⋃A  ∣  ∀C∈A (X∈C)},\bigcap A \;\defeq\; \Bigl\{X \in \textstyle\bigcup A \;\Big|\; \forall C \in A\,(X \in C)\Bigr\},

the set of those objects lying in every member of AA.

The definition carves out of ⋃A\bigcup A, which makes it legitimate: an object lying in every member of AA lies in some member, so it was in ⋃A\bigcup A to begin with. It also settles the case A=∅A = \emptyset. Every object vacuously lies in every member of ∅\emptyset, so “the objects lying in every member of ∅\emptyset” would be everything there is, which Proposition 3.13 forbids; carving out of ⋃∅=∅\bigcup \emptyset = \emptyset gives ⋂∅=∅\bigcap \emptyset = \emptyset instead.

Problem 3.8.

Prove that last sentence.

Proposition 3.34 (Meeting a pair).

Let SS and TT be sets. Then ⋂{S,T}=S∩T\bigcap \{S, T\} = S \cap T.

Discussion.

This is the counterpart of ⋃{S,T}=S∪T\bigcup \{S, T\} = S \cup T: Axiom 3.3 makes it a biconditional at an arbitrary xx, and Axiom 3.14 says the only members of {S,T}\{S, T\} are SS and TT. So the bounded universal claim ∀C∈{S,T} (x∈C)\forall C \in \{S, T\}\,(x \in C) has just two instances, and a universal quantifier over two cases is the conjunction of them, which is the criterion for S∩TS \cap T. The membership in ⋃{S,T}\bigcup \{S, T\} that the definition also demands is automatic, since anything in both sets is in one of them.

Proof (element style).

Let xx be an object and suppose x∈⋂{S,T}x \in \bigcap \{S, T\}. Then x∈Cx \in C for every C∈{S,T}C \in \{S, T\}; taking CC to be SS and then TT, both of which lie in {S,T}\{S, T\} by Axiom 3.14 , gives x∈Sx \in S and x∈Tx \in T, so x∈S∩Tx \in S \cap T.

Conversely, suppose x∈S∩Tx \in S \cap T, so x∈Sx \in S and x∈Tx \in T. Any C∈{S,T}C \in \{S, T\} is SS or TT by Axiom 3.14 , and xx lies in both, so x∈Cx \in C by substitution. Since x∈Sx \in S we also have x∈S∪T=⋃{S,T}x \in S \cup T = \bigcup \{S, T\} by Proposition 3.21 , which is the set being carved, so x∈⋂{S,T}x \in \bigcap \{S, T\}. As xx was arbitrary, Axiom 3.3 gives the equality.

Remark.

Honestly for this proposition, this is one of those ones where the logical explanation makes way more sense.

Proof (logical style).

Let xx be an object.

x∈⋂{S,T}≡∀C∈{S,T} (x∈C)by the definition≡∀C (C∈{S,T}  ⟹  x∈C)by the bounded quantifier≡∀C ((C=S∨C=T)  ⟹  x∈C)by Pairing≡∀C (¬(C=S∨C=T)∨x∈C)by Def of Implication≡∀C ((¬(C=S)∧¬(C=T))∨x∈C)by De Morgan≡∀C ((¬(C=S)∨(x∈C))∧(¬(C=T)∨x∈C)by De Morgan≡∀C ((C=S  ⟹  x∈C)∧(C=T  ⟹  x∈C))by Def of Implication≡∀C (C=S  ⟹  x∈C)∧∀C (C=T  ⟹  x∈C)by ∀-distribution≡(x∈S)∧(x∈T)by substitution≡x∈S∩Tby the intersection\begin{aligned} x \in \textstyle\bigcap \{S, T\} &\equiv \forall C \in \{S, T\}\,(x \in C) && \text{by the definition} \\ &\equiv \forall C\,(C \in \{S, T\} \implies x \in C) && \text{by the bounded quantifier} \\ &\equiv \forall C\,\bigl((C = S \lor C = T) \implies x \in C\bigr) && \text{by Pairing} \\ &\equiv \forall C\,\bigl(\neg(C = S \lor C = T) \lor x \in C\bigr) && \text{by Def of Implication} \\ &\equiv \forall C\,\bigl((\neg(C = S) \land \neg(C = T)) \lor x \in C\bigr) && \text{by De Morgan} \\ &\equiv \forall C\,\bigl((\neg(C = S) \lor (x \in C)) \land (\neg(C = T) \lor x \in C\bigr) && \text{by De Morgan} \\ &\equiv \forall C\,\bigl((C = S \implies x \in C) \\ &\qquad\qquad {}\land (C = T \implies x \in C)\bigr) && \text{by Def of Implication} \\ &\equiv \forall C\,(C = S \implies x \in C) \\ &\qquad {}\land \forall C\,(C = T \implies x \in C) && \text{by }\forall\text{-distribution} \\ &\equiv (x \in S) \land (x \in T) && \text{by substitution} \\ &\equiv x \in S \cap T && \text{by the intersection} \end{aligned}

As xx was arbitrary, Axiom 3.3 gives the equality.

Problem 3.9.

Let AA be a non-empty set and let B∈AB \in A. Show that ⋂A⊂B⊂⋃A\bigcap A \subset B \subset \bigcup A.

Definition 3.35 (Disjoint).

Two sets AA and BB are disjoint if A∩B=∅A \cap B = \emptyset.

Remark.

Being disjoint is not the same as being distinct. The sets {1,2,3}\{1, 2, 3\} and {2,3,4}\{2, 3, 4\} are distinct, since each holds an element the other does not, but they are not disjoint, since their intersection holds 22 and 33. Meanwhile ∅\emptyset and ∅\emptyset are disjoint but not distinct.

Problem 3.10.

Let SS be a set. What is S∩∅S \cap \emptyset?

Theorem 3.36 (Characterising the empty set).

Let LL be a set. The following are equivalent.

  1. L⊂ML \subset M for every set MM;
  2. M∩L=LM \cap L = L for every set MM;
  3. LL has no elements;
  4. M∪L=MM \cup L = M for every set MM.

Discussion.

Four statements would ordinarily need twelve implications, but a loop is enough: we prove the chain 1  ⟹  2  ⟹  3  ⟹  4  ⟹  11 \implies 2 \implies 3 \implies 4 \implies 1, and every statement then reaches every other by going round. Step 1  ⟹  21 \implies 2 is an equality of sets, so it is two inclusions, one of which we already have from Proposition 3.32 . Step 2  ⟹  32 \implies 3 has no object to point at, so it goes by contradiction, using the case M=∅M = \emptyset. Step 3  ⟹  43 \implies 4 is again two inclusions, and the work is splitting the “or” in x∈M∪Lx \in M \cup L, where the second alternative is ruled out by the hypothesis. Step 4  ⟹  14 \implies 1 is a single inclusion, read off Proposition 3.32 and the hypothesis.

Proof.

1  ⟹  21 \implies 2. Assume L⊂ML \subset M. We have M∩L⊂LM \cap L \subset L by Proposition 3.32 . For the reverse inclusion take x∈Lx \in L; then x∈Mx \in M since L⊂ML \subset M, so x∈Mx \in M and x∈Lx \in L, which is x∈M∩Lx \in M \cap L. Hence L⊂M∩LL \subset M \cap L, and Proposition 3.29 gives M∩L=LM \cap L = L.

2  ⟹  32 \implies 3. Suppose, to the contrary, that LL has an element xx. Taking M=∅M = \emptyset in the second statement gives ∅∩L=L\emptyset \cap L = L. But nothing belongs to ∅∩L\emptyset \cap L, since anything in it would lie in ∅\emptyset and Axiom 3.1 forbids that, so ∅∩L\emptyset \cap L has no elements and LL has none either. This contradicts x∈Lx \in L.

3  ⟹  43 \implies 4. Assume LL has no elements. We have M⊂M∪LM \subset M \cup L by Proposition 3.32 . For the reverse inclusion take x∈M∪Lx \in M \cup L; by Proposition 3.21 either x∈Mx \in M or x∈Lx \in L, and the second is impossible, so x∈Mx \in M. Hence M∪L⊂MM \cup L \subset M, and Proposition 3.29 gives M∪L=MM \cup L = M.

4  ⟹  14 \implies 1. Let MM be a set. We have L⊂M∪LL \subset M \cup L by Proposition 3.32 , and M∪L=MM \cup L = M by the fourth statement, so L⊂ML \subset M by substitution.

Complements of Sets

If A⊂SA \subset S, the complement of AA in SS is the set of all elements of SS that are not in AA.

Definition 3.37 (Complement).

Let A⊂SA \subset S. The complement of AA in SS is the set

A‾  =def  {x∈S∣x∉A},\overline{A} \;\defeq\; \{x \in S \mid x \notin A\},

so that for xx ranging over SS, (x∈A‾)≡¬(x∈A)(x \in \overline{A}) \equiv \neg(x \in A).

Other texts write AcA^{c}, but we will stick with A‾\overline{A}. Notice that a complement means nothing until the ambient set SS is understood.

The complement removes one set from another only when the first lies inside the second. Dropping that assumption gives the difference of two arbitrary sets.

Definition 3.38 (Set difference).

For sets AA and BB, the difference A∖BA \setminus B is the set of elements of AA that are not in BB,

A∖B  =def  {x∈A∣x∉B},A \setminus B \;\defeq\; \{x \in A \mid x \notin B\},

with membership (x∈A∖B)≡(x∈A)∧¬(x∈B)(x \in A \setminus B) \equiv (x \in A) \land \neg(x \in B). The complement A‾\overline{A} is the difference S∖AS \setminus A in the case A⊂SA \subset S.

Example 3.39.

{1,2,3,4}∖{2,4,6}={1,3}\{1, 2, 3, 4\} \setminus \{2, 4, 6\} = \{1, 3\}. The set being removed need not sit inside the set it is removed from; the elements the two do not share are simply ignored.

Problem 3.11.

With complements taken in SS, what are S‾\overline{S}, ∅‾\overline{\emptyset} and A‾‾\overline{\overline{A}}? Name the logic law behind the last one.

Complements produce negative statements like x∉Ax \notin A, and the standard tool for proving those is proof by contradiction: to show a statement true, assume its negation and derive a contradiction; the contradiction cannot stand, so the assumption was false and the statement we wanted holds.

Proposition 3.40 (Complements reverse inclusion).

Let A,B⊂SA, B \subset S. If A⊂BA \subset B, then B‾⊂A‾\overline{B} \subset \overline{A}.

Discussion.

The conclusion is a universally quantified implication, so we take x∈B‾x \in \overline{B} and must reach x∈A‾x \in \overline{A}. Both memberships are negative statements by the definition of the complement, so what has to be shown is x∉Ax \notin A from x∉Bx \notin B, and that is the contrapositive of the implication A⊂BA \subset B hands us. Elementwise the same step is a contradiction: assume x∈Ax \in A, push it through A⊂BA \subset B to x∈Bx \in B, which contradicts x∉Bx \notin B.

Proof (element style).

Let x∈B‾x \in \overline{B}, so x∈Sx \in S and x∉Bx \notin B. Suppose x∈Ax \in A. Then A⊂BA \subset B gives x∈Bx \in B, contradicting x∉Bx \notin B, so x∉Ax \notin A. Since x∈Sx \in S, this is x∈A‾x \in \overline{A}. As xx was arbitrary, B‾⊂A‾\overline{B} \subset \overline{A}.

Proof (logical style).

For any xx in SS,

x∈B‾≡¬(x∈B)by the complement  ⟹  ¬(x∈A)by contraposition, since A⊂B≡x∈A‾by the complement\begin{aligned} x \in \overline{B} &\equiv \neg(x \in B) && \text{by the complement} \\ &\implies \neg(x \in A) && \text{by contraposition, since } A \subset B \\ &\equiv x \in \overline{A} && \text{by the complement} \end{aligned}

so (x∈B‾)  ⟹  (x∈A‾)(x \in \overline{B}) \implies (x \in \overline{A}) for every xx in SS, which is B‾⊂A‾\overline{B} \subset \overline{A}.

Problem 3.12.

Let A⊂SA \subset S, with complements taken in SS. Prove that A∩A‾=∅A \cap \overline{A} = \emptyset and A∪A‾=SA \cup \overline{A} = S.

Remark (The dictionary).

By now a dictionary has emerged: complement is ¬\neg, intersection is ∧\land, union is ∨\lor, subset is   ⟹  \implies, and equality is   ⟺  \iff. Any equivalence built from ¬\neg, ∧\land and ∨\lor alone translates through it into an identity of sets, so the table of laws in the first chapter doubles as a table of set identities.

Before taking complements of combinations we should check they may be taken at all. If SS and TT are subsets of XX, then so are S∪TS \cup T and S∩TS \cap T: an element of S∪TS \cup T lies in SS or in TT and so in XX either way, and S∩T⊂S⊂XS \cap T \subset S \subset X by Proposition 3.32 and Proposition 3.28 . Complements of both are therefore defined in XX.

Translating De Morgan’s laws through the dictionary gives their form for sets: the complement of a union is the intersection of the complements, and the complement of an intersection is the union of the complements.

Theorem 3.41 (De Morgan's laws for sets).

Let SS and TT be subsets of an ambient set. Then

S∪T‾=S‾∩T‾andS∩T‾=S‾∪T‾.\overline{S \cup T} = \overline{S} \cap \overline{T} \qquad\text{and}\qquad \overline{S \cap T} = \overline{S} \cup \overline{T}.

Discussion.

We prove the first; the second is identical work with the roles exchanged. Equality of sets is two inclusions by Proposition 3.29 , and both read the same way through the dictionary. For xx in the ambient set, membership in S∪T‾\overline{S \cup T} is the negation of the disjunction (x∈S)∨(x∈T)(x \in S) \lor (x \in T); the disjunctive De Morgan law rewrites that negation as the conjunction ¬(x∈S)∧¬(x∈T)\neg(x \in S) \land \neg(x \in T), which by the definitions of complement and intersection is membership in S‾∩T‾\overline{S} \cap \overline{T}. Each inclusion is one half of this biconditional, and the logical proof writes the whole equivalence down at once.

Proof (element style).

For the first inclusion, assume x∈S∪T‾x \in \overline{S \cup T}, so x∉S∪Tx \notin S \cup T by the definition of the complement: it is not true that x∈Sx \in S or x∈Tx \in T. By De Morgan’s laws this means x∉Sx \notin S and x∉Tx \notin T, that is, x∈S‾x \in \overline{S} and x∈T‾x \in \overline{T}. Belonging to both, xx belongs to their intersection, so x∈S‾∩T‾x \in \overline{S} \cap \overline{T} and S∪T‾⊂S‾∩T‾\overline{S \cup T} \subset \overline{S} \cap \overline{T}.

For the second inclusion, assume x∈S‾∩T‾x \in \overline{S} \cap \overline{T}, so x∈S‾x \in \overline{S} and x∈T‾x \in \overline{T}, meaning x∉Sx \notin S and x∉Tx \notin T. By De Morgan’s laws again, ”x∈Sx \in S or x∈Tx \in T” is false, so x∉S∪Tx \notin S \cup T by Proposition 3.21 , and hence x∈S∪T‾x \in \overline{S \cup T}. Thus S‾∩T‾⊂S∪T‾\overline{S} \cap \overline{T} \subset \overline{S \cup T}, and the two inclusions give the equality.

Proof (logical style).

For any xx in the ambient set,

x∈S∪T‾≡¬(x∈S∪T)by the complement≡¬((x∈S)∨(x∈T))by the union≡¬(x∈S)∧¬(x∈T)by De Morgan’s laws≡(x∈S‾)∧(x∈T‾)by the complement≡x∈S‾∩T‾by the intersection\begin{aligned} x \in \overline{S \cup T} &\equiv \neg(x \in S \cup T) && \text{by the complement} \\ &\equiv \neg\bigl((x \in S) \lor (x \in T)\bigr) && \text{by the union} \\ &\equiv \neg(x \in S) \land \neg(x \in T) && \text{by De Morgan's laws} \\ &\equiv (x \in \overline{S}) \land (x \in \overline{T}) && \text{by the complement} \\ &\equiv x \in \overline{S} \cap \overline{T} && \text{by the intersection} \end{aligned}

The biconditional holds for every xx, so Axiom 3.3 gives S∪T‾=S‾∩T‾\overline{S \cup T} = \overline{S} \cap \overline{T}.

The set law is the logic law translated through the dictionary, and the logical proof is that translation.

The Distributive Laws

Union and intersection also distribute over each other. For numbers, multiplication distributes over addition but not the other way round; for sets each operation distributes over the other.

Theorem 3.42 (Distributive laws for sets).

Let SS, TT and RR be sets. Then

S∪(T∩R)=(S∪T)∩(S∪R)andS∩(T∪R)=(S∩T)∪(S∩R).S \cup (T \cap R) = (S \cup T) \cap (S \cup R) \qquad\text{and}\qquad S \cap (T \cup R) = (S \cap T) \cup (S \cap R).

Discussion.

We prove the first. It is an equality of sets, so two inclusions. For S∪(T∩R)⊂(S∪T)∩(S∪R)S \cup (T \cap R) \subset (S \cup T) \cap (S \cup R) we assume x∈S∪(T∩R)x \in S \cup (T \cap R); a union assumption is an “or”, so we split into the cases x∈Sx \in S and x∈T∩Rx \in T \cap R, and in each we must put xx in both S∪TS \cup T and S∪RS \cup R. For the reverse inclusion we assume x∈(S∪T)∩(S∪R)x \in (S \cup T) \cap (S \cup R), which hands us two “or” statements at once; we split on whether x∈Sx \in S, since if not, each “or” is forced to its other option. The logical proof needs only the axiom of Distributivity applied to the membership predicates.

Proof (element style).

For the first inclusion, assume x∈S∪(T∩R)x \in S \cup (T \cap R), so x∈Sx \in S or x∈T∩Rx \in T \cap R. If x∈Sx \in S, then x∈S∪Tx \in S \cup T and x∈S∪Rx \in S \cup R, so xx lies in their intersection. If instead x∈T∩Rx \in T \cap R, then x∈Tx \in T and x∈Rx \in R; the first puts xx in S∪TS \cup T, the second puts xx in S∪RS \cup R, and again xx lies in the intersection. Either case gives x∈(S∪T)∩(S∪R)x \in (S \cup T) \cap (S \cup R), so S∪(T∩R)⊂(S∪T)∩(S∪R)S \cup (T \cap R) \subset (S \cup T) \cap (S \cup R).

For the second inclusion, assume x∈(S∪T)∩(S∪R)x \in (S \cup T) \cap (S \cup R), so x∈S∪Tx \in S \cup T and x∈S∪Rx \in S \cup R; that is, x∈Sx \in S or x∈Tx \in T, and at the same time x∈Sx \in S or x∈Rx \in R. If x∈Sx \in S, then x∈S∪(T∩R)x \in S \cup (T \cap R) and we are done. If x∉Sx \notin S, then the first “or” forces x∈Tx \in T and the second forces x∈Rx \in R, so x∈T∩Rx \in T \cap R and again x∈S∪(T∩R)x \in S \cup (T \cap R). Either way (S∪T)∩(S∪R)⊂S∪(T∩R)(S \cup T) \cap (S \cup R) \subset S \cup (T \cap R), and with both inclusions the sets are equal.

Proof (logical style).

Let xx be an object and write ss, tt, rr for the propositions x∈Sx \in S, x∈Tx \in T, x∈Rx \in R.

x∈S∪(T∩R)≡s∨(t∧r)by the definitions≡(s∨t)∧(s∨r)by Distributivity≡(x∈S∪T)∧(x∈S∪R)by the union≡x∈(S∪T)∩(S∪R)by the intersection\begin{aligned} x \in S \cup (T \cap R) &\equiv s \lor (t \land r) && \text{by the definitions} \\ &\equiv (s \lor t) \land (s \lor r) && \text{by Distributivity} \\ &\equiv (x \in S \cup T) \land (x \in S \cup R) && \text{by the union} \\ &\equiv x \in (S \cup T) \cap (S \cup R) && \text{by the intersection} \end{aligned}

By Axiom 3.3 we have the equality.

The elementwise proof of the second inclusion needed an idea, splitting on whether x∈Sx \in S, while the logical proof used only the table.

Theorem 3.43 (The algebra of intersection).

Let AA, BB and CC be sets. Then

  1. A∩A=AA \cap A = A;
  2. A∩B=B∩AA \cap B = B \cap A;
  3. (A∩B)∩C=A∩(B∩C)(A \cap B) \cap C = A \cap (B \cap C);
  4. A∩(A∪B)=AA \cap (A \cup B) = A and A∪(A∩B)=AA \cup (A \cap B) = A;
  5. A⊂BA \subset B if and only if A∩B=AA \cap B = A if and only if A∪B=BA \cup B = B.

Discussion.

The union halves of the first three are Proposition 3.23 , and these are the same rows of the table read with ∧\land in place of ∨\lor: idempotence, commutativity and associativity are the logic laws of those names, and each is one chain of equivalences. The fourth mixes the two operations, and is absorption. The fifth is different in kind, since it is not an identity but a comparison: the equivalences x∈A∩B  ⟺  x∈Ax \in A \cap B \iff x \in A and x∈A∪B  ⟺  x∈Bx \in A \cup B \iff x \in B each say exactly that x∈Ax \in A implies x∈Bx \in B, so we check it elementwise, with two inclusions inside each of the two biconditionals.

Proof (logical style).

Let xx be an object and write aa, bb, cc for the propositions x∈Ax \in A, x∈Bx \in B, x∈Cx \in C.

x∈A∩A≡a∧a≡x∈Aby Idempotencex∈A∩B≡a∧b≡b∧a≡x∈B∩Aby Commutativityx∈(A∩B)∩C≡(a∧b)∧c≡a∧(b∧c)≡x∈A∩(B∩C)by Associativityx∈A∩(A∪B)≡a∧(a∨b)≡x∈Aby Absorptionx∈A∪(A∩B)≡a∨(a∧b)≡x∈Aby Absorption\begin{aligned} x \in A \cap A &\equiv a \land a \equiv x \in A && \text{by Idempotence} \\ x \in A \cap B &\equiv a \land b \equiv b \land a \equiv x \in B \cap A && \text{by Commutativity} \\ x \in (A \cap B) \cap C &\equiv (a \land b) \land c \\ &\equiv a \land (b \land c) \equiv x \in A \cap (B \cap C) && \text{by Associativity} \\ x \in A \cap (A \cup B) &\equiv a \land (a \lor b) \equiv x \in A && \text{by Absorption} \\ x \in A \cup (A \cap B) &\equiv a \lor (a \land b) \equiv x \in A && \text{by Absorption} \end{aligned}

Each chain is a biconditional for every xx, so Axiom 3.3 gives the corresponding equalities.

Proof (element style).

For the fifth part, suppose first that A∩B=AA \cap B = A. Since A∩B⊂BA \cap B \subset B by Proposition 3.32 , we get A⊂BA \subset B. Conversely, suppose A⊂BA \subset B. We have A∩B⊂AA \cap B \subset A by Proposition 3.32 , and if x∈Ax \in A then x∈Bx \in B, so x∈A∩Bx \in A \cap B; hence A⊂A∩BA \subset A \cap B, and Proposition 3.29 gives A∩B=AA \cap B = A.

For the other equivalence, suppose A∪B=BA \cup B = B. Then A⊂A∪B=BA \subset A \cup B = B by Proposition 3.32 and substitution. Conversely, suppose A⊂BA \subset B. We have B⊂A∪BB \subset A \cup B by Proposition 3.32 , and if x∈A∪Bx \in A \cup B then x∈Ax \in A or x∈Bx \in B, and in either case x∈Bx \in B; hence A∪B⊂BA \cup B \subset B, and Proposition 3.29 gives A∪B=BA \cup B = B. Both equivalences hold, so the three statements are equivalent.

Remark.

These identities, together with the complement laws, are what it means to say that the subsets of a fixed ambient set form a boolean algebra: the same structure the connectives ¬\neg, ∧\land and ∨\lor were shown to have in the first chapter, met a second time with sets in place of propositions.

Power Sets

Sets collect objects, and nothing forbids those objects from being sets themselves: here we collect all the subsets of one set into a single set.

Collecting the subsets of AA is not a case of comprehension, since it does not carve out of a set already in hand: the subsets of AA are not among the elements of AA, and there is no larger set on the table to cut them from. So the set has to be supplied.

Axiom 3.44 (Power set).

For every set SS there exists a set whose elements are exactly the subsets of SS: for all sets XX, ∀S ∃P ∀X (X∈P  ⟺  X⊂S)\forall S\,\exists P\,\forall X\,(X \in P \iff X \subset S).

Definition 3.45 (Power set).

Let AA be a set. The power set of AA, written P(A)\mathcal{P}(A), is the unique set whose elements are exactly the subsets of AA: for every set XX, X∈P(A)  ⟺  X⊂AX \in \mathcal{P}(A) \iff X \subset A. We also write it {X∣X⊂A}\{X \mid X \subset A\}.

Remark.

That last notation is the unrestricted form we rejected earlier, and it is safe here only because the axiom has already produced the set. The braces are naming a set we hold; writing {X∣X⊂A}\{X \mid X \subset A\} with no axiom behind it would lead us back to Russell.

Example 3.46.

Let A={a,b}A = \{a, b\} with a≠ba \neq b. Then P(A)={∅,{a},{b},A}\mathcal{P}(A) = \bigl\{\emptyset, \{a\}, \{b\}, A\bigr\}. The elements of P(A)\mathcal{P}(A) are sets, so we write {a}∈P(A)\{a\} \in \mathcal{P}(A) because {a}⊂A\{a\} \subset A, while a∈P(A)a \in \mathcal{P}(A) is simply false.

Proposition 3.47 (Power set of the empty set).

P(∅)={∅}\mathcal{P}(\emptyset) = \{\emptyset\}.

Discussion.

The claim is an equality of sets, so Proposition 3.29 lets us prove the two inclusions. For {∅}⊂P(∅)\{\emptyset\} \subset \mathcal{P}(\emptyset) it is enough to check that ∅\emptyset is a member of the power set, which Definition 3.38 reduces to ∅⊂∅\emptyset \subset \emptyset. For the reverse inclusion we take an arbitrary X∈P(∅)X \in \mathcal{P}(\emptyset); the same definition converts that membership into X⊂∅X \subset \emptyset, and since the empty set is a subset of every set we have ∅⊂X\emptyset \subset X as well, so mutual inclusion forces X=∅X = \emptyset. The logical proof collapses the same chain into biconditionals: membership in the power set is the subset relation, which against ∅\emptyset is equality with ∅\emptyset, which is membership in {∅}\{\emptyset\}.

Proof (element style).

(  ⟹  \implies) Since ∅⊂∅\emptyset \subset \emptyset, Definition 3.38 gives ∅∈P(∅)\emptyset \in \mathcal{P}(\emptyset), and hence {∅}⊂P(∅)\{\emptyset\} \subset \mathcal{P}(\emptyset).

(  ⟸  \impliedby) Conversely, let X∈P(∅)X \in \mathcal{P}(\emptyset). Then X⊂∅X \subset \emptyset, and since ∅⊂X\emptyset \subset X as well, Proposition 3.29 gives X=∅X = \emptyset, so X∈{∅}X \in \{\emptyset\}. Thus P(∅)⊂{∅}\mathcal{P}(\emptyset) \subset \{\emptyset\}, and the two inclusions give the equality.

Proof (logical style).

For every set XX,

X∈P(∅)≡X⊂∅by the power set≡X=∅since ∅⊂X≡X∈{∅}by the singleton criterion\begin{aligned} X \in \mathcal{P}(\emptyset) &\equiv X \subset \emptyset && \text{by the power set} \\ &\equiv X = \emptyset && \text{since } \emptyset \subset X \\ &\equiv X \in \{\emptyset\} && \text{by the singleton criterion} \end{aligned}

The biconditional holds for every XX, so Axiom 3.3 gives P(∅)={∅}\mathcal{P}(\emptyset) = \{\emptyset\}.

Theorem 3.48 (Power-set laws).

Let AA and BB be sets. Then

  1. {∅,A}⊂P(A)\{\emptyset, A\} \subset \mathcal{P}(A);
  2. A⊂BA \subset B if and only if P(A)⊂P(B)\mathcal{P}(A) \subset \mathcal{P}(B);
  3. P(A)∪P(B)⊂P(A∪B)\mathcal{P}(A) \cup \mathcal{P}(B) \subset \mathcal{P}(A \cup B);
  4. P(A)∩P(B)=P(A∩B)\mathcal{P}(A) \cap \mathcal{P}(B) = \mathcal{P}(A \cap B).

Discussion.

Every claim reduces to Definition 3.38 : a set belongs to a power set exactly when it is a subset of the set in question. The first is immediate from ∅⊂A\emptyset \subset A and A⊂AA \subset A. The second is a biconditional, so it splits: forwards, an X∈P(A)X \in \mathcal{P}(A) has X⊂AX \subset A and A⊂BA \subset B, and Proposition 3.28 chains them; backwards, the first part puts AA itself into P(A)\mathcal{P}(A), so an inclusion of power sets hands us A∈P(B)A \in \mathcal{P}(B), which is A⊂BA \subset B read back through the definition. The third is one inclusion only, since a subset of AA or of BB is a subset of A∪BA \cup B either way, and the reverse fails in general, as the example after the proof shows. The fourth is an equality, so both inclusions, and it holds because being a subset of both AA and BB is the same thing as being a subset of A∩BA \cap B.

Proof.

For the first claim, ∅⊂A\emptyset \subset A and A⊂AA \subset A, so ∅∈P(A)\emptyset \in \mathcal{P}(A) and A∈P(A)A \in \mathcal{P}(A) by Definition 3.38 , and therefore {∅,A}⊂P(A)\{\emptyset, A\} \subset \mathcal{P}(A).

For the second, suppose A⊂BA \subset B and take X∈P(A)X \in \mathcal{P}(A). Then X⊂AX \subset A, and with A⊂BA \subset B this gives X⊂BX \subset B by Proposition 3.28 , so X∈P(B)X \in \mathcal{P}(B). Hence P(A)⊂P(B)\mathcal{P}(A) \subset \mathcal{P}(B). Conversely, suppose P(A)⊂P(B)\mathcal{P}(A) \subset \mathcal{P}(B). The first claim gives A∈P(A)A \in \mathcal{P}(A), so A∈P(B)A \in \mathcal{P}(B) and therefore A⊂BA \subset B.

For the third, let X∈P(A)∪P(B)X \in \mathcal{P}(A) \cup \mathcal{P}(B), so X∈P(A)X \in \mathcal{P}(A) or X∈P(B)X \in \mathcal{P}(B) by Proposition 3.21 . If X∈P(A)X \in \mathcal{P}(A) then X⊂AX \subset A, and every element of XX then lies in AA and so in A∪BA \cup B; if X∈P(B)X \in \mathcal{P}(B) the same argument runs through BB. Either case gives X⊂A∪BX \subset A \cup B, that is, X∈P(A∪B)X \in \mathcal{P}(A \cup B).

For the fourth, let X∈P(A)∩P(B)X \in \mathcal{P}(A) \cap \mathcal{P}(B). Then X⊂AX \subset A and X⊂BX \subset B, so every element of XX lies in AA and in BB, hence in A∩BA \cap B. Thus X⊂A∩BX \subset A \cap B and X∈P(A∩B)X \in \mathcal{P}(A \cap B). Conversely, let X∈P(A∩B)X \in \mathcal{P}(A \cap B). Every element of XX lies in A∩BA \cap B and so lies in AA, and equally in BB, giving X⊂AX \subset A and X⊂BX \subset B. Hence XX belongs to both P(A)\mathcal{P}(A) and P(B)\mathcal{P}(B), and therefore to their intersection.

Example 3.49.

The inclusion in the third claim really can be strict. Let A={a}A = \{a\} and B={b}B = \{b\} with a≠ba \neq b. Then {a,b}⊂A∪B\{a, b\} \subset A \cup B, so {a,b}∈P(A∪B)\{a, b\} \in \mathcal{P}(A \cup B), but {a,b}\{a, b\} is a subset of neither AA nor BB and so lies in neither P(A)\mathcal{P}(A) nor P(B)\mathcal{P}(B).

Problem 3.13.

Let AA be a set and let xx be an object with x∉Ax \notin A. Describe P(A∪{x})\mathcal{P}(A \cup \{x\}) in terms of P(A)\mathcal{P}(A).

Problem 3.14.

Can P(A)∖P(B)\mathcal{P}(A) \setminus \mathcal{P}(B) ever be the power set of some set? Prove your answer.

Problem 3.15.

Find a necessary and sufficient condition on AA and BB for P(A∖B)=P(A)\mathcal{P}(A \setminus B) = \mathcal{P}(A), and prove that your condition works in both directions.

Replacement

Everything we have built so far either cuts a set down or pools sets together. Nothing we have assumed lets us take a set and change what is in it. Suppose we hold {3,5,9}\{3, 5, 9\} and want the set holding one more than each of those, {4,6,10}\{4, 6, 10\}: comprehension carves out of a set we are holding, and none of 44, 66, 1010 lies in {3,5,9}\{3, 5, 9\}, so there is nothing to carve them from. The axiom below closes that gap by letting a statement pair each element with its replacement.

Axiom 3.50 (Replacement).

Let AA be a set, and let P(x,y)P(x, y) be a statement about an object x∈Ax \in A and an object yy such that for each x∈Ax \in A there is at most one yy making P(x,y)P(x, y) true. Then there exists a set BB whose elements are exactly those partners: for any object zz,

z∈B  ⟺  P(x,z) for some x∈A.z \in B \iff P(x, z) \text{ for some } x \in A.

The condition that each xx have at most one partner is needed: if one xx could have many partners, the axiom could produce arbitrarily large collections and we would be back with the unrestricted notation and its paradox. With at most one partner each, every object in the new set is the partner of an element of AA.

Example 3.51.

Take A={3,5,9}A = \{3, 5, 9\} and let P(x,y)P(x, y) be the statement y=x+1y = x + 1. Each xx in AA has exactly one partner, so the axiom applies, and the set it hands back is {4,6,10}\{4, 6, 10\}.

Example 3.52.

Take A={3,5,9}A = \{3, 5, 9\} again, and let P(x,y)P(x, y) be the statement y=1y = 1. Each xx in AA still has exactly one partner, but it is the same partner every time, so the set produced is {1}\{1\}. The axiom may return something smaller than what we started with, since nothing forces distinct elements to have distinct partners.

Axiom 3.3 makes that BB unique, so we may name it, and we write it {y:P(x,y) for some x∈A}\{y : P(x, y) \text{ for some } x \in A\}. As with the power set, those braces carry no carving set and are safe for the same reason: the axiom produced the set before the notation named it. When the partner of xx is written f(x)f(x) we abbreviate further, to {f(x):x∈A}\{f(x) : x \in A\} or {f(x)∣x∈A}\{f(x) \mid x \in A\}.

We promised at the outset that our axioms would be overcomplete.

Proposition 3.53 (Comprehension from replacement).

Let AA be a set and QQ a predicate. Then replacement alone produces a set whose elements are exactly the elements of AA for which QQ holds.

Discussion.

Replacement builds a set by transforming elements, while comprehension builds one by selecting them, so we use a transformation to do the selecting. We transform each element into itself, and only when QQ holds of it: the statement P(x,y)P(x, y) saying ”x=yx = y and Q(x)Q(x)” pairs an element satisfying QQ with itself and leaves an element failing QQ with no partner at all. The at-most-one condition holds because each element has one partner or none, and the set of partners is exactly the set of elements we wanted to keep.

Proof.

Let P(x,y)P(x, y) be the statement ”x=yx = y and Q(x)Q(x)”, and let x∈Ax \in A. If Q(x)Q(x) holds, the only yy with P(x,y)P(x, y) is xx itself; if Q(x)Q(x) fails, no yy satisfies P(x,y)P(x, y). Either way there is at most one such yy, so Axiom 3.50 applies and produces a set BB with z∈Bz \in B exactly when P(x,z)P(x, z) holds for some x∈Ax \in A.

Suppose z∈Bz \in B. Then some x∈Ax \in A has x=zx = z and Q(x)Q(x), so z∈Az \in A by substitution, and Q(z)Q(z) likewise. Conversely, if z∈Az \in A and Q(z)Q(z), then x=zx = z is itself a witness, so z∈Bz \in B. Hence z∈B  ⟺  (z∈A∧Q(z))z \in B \iff (z \in A \land Q(z)) for every object zz, which is the criterion of {x∈A∣Q(x)}\{x \in A \mid Q(x)\}.

So Axiom 3.8 could have been left out. We keep it anyway, by choice: the discussion of Russell’s paradox turned on carving into a set we already hold, and it is the axiom we reach for constantly. The two also combine, so to build {f(x):x∈A, P(x)}\{f(x) : x \in A,\ P(x)\} we first form {x∈A∣P(x)}\{x \in A \mid P(x)\} by comprehension and then apply replacement to it.

Remark.

Replacement is a schema, as comprehension is: one axiom for each statement PP, not a single statement quantifying over all of them.

Regularity (Optional)

Our set-builder notation was rejected for producing a set that could not exist. Unrestricted, the notation also gives the collection of every object at once, and since sets are objects by Axiom 3.2 , such a collection would contain itself. The box picture has no place for a box that holds itself.

The intuition that keeps this from happening is that objects come in stages. At the bottom sit the objects that are not sets at all, such as the number 3737. Above them sit the sets built only from those, like {3,4,7}\{3, 4, 7\} and ∅\emptyset. Above those sit the sets built from everything so far, like {3,4,7,{3,4,7}}\{3, 4, 7, \{3, 4, 7\}\}, and so on upward. A box at any stage holds only boxes opened at earlier stages, so no box ever ends up inside itself.

Writing that hierarchy down properly is a good deal of work, and we will not do it. We take instead the one consequence of it we need.

Axiom 3.54 (Regularity).

If AA is a non-empty set, then at least one element of AA is either not a set, or is disjoint from AA.

Read against the hierarchy, the axiom says that some element of AA sits low enough to hold none of the others. It asks this of one element only, not of all of them.

Example 3.55.

Let A={{3,4}, {3,4,{3,4}}}A = \bigl\{\{3, 4\},\ \{3, 4, \{3, 4\}\}\bigr\}. Its first element {3,4}\{3, 4\} holds neither of the elements of AA, since neither 33 nor 44 lies in AA, so it is disjoint from AA and the axiom is satisfied. The second element sits a stage higher and does hold an element of AA, namely {3,4}\{3, 4\}, which the axiom permits.

Problem 3.16.

Show that the unrestricted notation of the set-builder section, had we assumed it rather than rejected it, would imply Axiom 3.8 , Axiom 3.14 , Axiom 3.18 , Axiom 3.44 and Axiom 3.50 , and would therefore have spared us most of this chapter.

Problem 3.17.

Use regularity, together with Axiom 3.14 , to show that A∉AA \notin A for every set AA. Show further that for any two sets AA and BB, either A∉BA \notin B or B∉AB \notin A, or both.

Problem 3.18.

Show, assuming the other axioms, that the unrestricted notation is equivalent to postulating a set Ω\Omega containing every object: if the notation is permitted then such an Ω\Omega exists, and if such an Ω\Omega exists then the notation is legitimate.

Problem 3.17 is worth a second look once it is done. It says that for any set AA there is always an object outside AA, namely AA itself, so we may always add one more element and form the larger set A∪{A}A \cup \{A\}. It also gives a second route to Proposition 3.13 , since a set Ω\Omega holding every object would hold itself, which regularity forbids. We proved that proposition from comprehension alone, so the two arguments use different axioms.

(REALLY OPTIONAL). Taking a further look into AA to A∪{A}A \cup \{A\}: if we start from the empty set and apply it over and over we get

∅,{∅},{∅,{∅}},{∅,{∅},{∅,{∅}}},…\emptyset, \quad \{\emptyset\}, \quad \bigl\{\emptyset, \{\emptyset\}\bigr\}, \quad \Bigl\{\emptyset, \{\emptyset\}, \bigl\{\emptyset, \{\emptyset\}\bigr\}\Bigr\}, \quad \ldots

each set holding exactly those before it, with no two of them equal, since each holds an object the previous ones do not. Of course every one of these is a set our axioms produce (by pairing and union), and a good use for them is to attach a semblance of counting: ∅\emptyset is 00 because it doesnt contain anything, the next is 11 because it contains one thing (the empty set), and so on. However, what our axioms do not yet produce is a single set holding all of them at once: the list is generated by a construction repeated an unspecified number of times, and we have already noted, when writing {a,b,c}\{a, b, c\} and longer, that we cannot yet say what repeating a construction that way amounts to. This is the same gap seen from the other side, and closing it takes an axiom asserting that some set is closed under the step (we see that soon).

Remark.

One may fairly ask whether we need this axiom, since it is less intuitive than the others. For analysis we do not: the sets we meet are all low in the hierarchy, sets of ordinary objects or sets of those, and nothing later in these notes depends on regularity. It matters for set theory pursued for its own sake, and we state it here so the list is complete.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 3.1.

Each construction below is licensed by exactly one axiom. Name it.

From two objects xx and yy, the set {x,y}\{x, y\}.

answer one of these

From a set AA and a predicate PP, the set of those elements of AA satisfying PP.

answer one of these

That {2,3}\{2, 3\} and {3,2,2}\{3, 2, 2\} are one and the same set.

answer one of these

From a set SS whose elements are sets, the set of every object belonging to one of them.

answer one of these

Exercise 3.2.

Set-builder notation, and the restriction that makes it safe.

The statement y∈{x∈A∣P(x)}y \in \{x \in A \mid P(x)\} says exactly:

answer one of these

The set {x∈A∣x=x}\{x \in A \mid x = x\} is:

answer one of these

Let AA be any set and put R={x∈A∣x∉x}R = \{x \in A \mid x \notin x\}, which comprehension makes a set. Running Russell’s argument on RR now establishes:

answer one of these

Exercise 3.3.

Let S={1,2,3}S = \{1, 2, 3\} and T={3,4}T = \{3, 4\}, with complements taken in X={1,2,3,4,5}X = \{1, 2, 3, 4, 5\}.

S∖TS \setminus T is:

answer one of these

S∪T‾\overline{S \cup T} is:

answer one of these

⋃{S,T}\bigcup \{S, T\} is:

answer one of these

Exercise 3.4.

Write ss, tt and rr for the statements x∈Sx \in S, x∈Tx \in T and x∈Rx \in R, with xx ranging over an ambient set containing all three. Give the membership condition of each set below.

S∩T‾\overline{S \cap T}

answer formula

S∖(T∪R)S \setminus (T \cup R)

answer formula

(S∖T)∪(T∖S)(S \setminus T) \cup (T \setminus S), written with ⊕\oplus and nothing else.

answer formula

Exercise 3.5.

An identity of sets fails as soon as one object falls on different sides of it, so a counterexample is a choice of which of the sets that object lies in. Write aa, bb, cc for x∈Ax \in A, x∈Bx \in B, x∈Cx \in C, and place one xx in each case.

(A∖B)∖C(A \setminus B) \setminus C against A∖(B∖C)A \setminus (B \setminus C).

answer assignment
a b c

A∪(B∩C)A \cup (B \cap C) against (A∪B)∩C(A \cup B) \cap C.

answer assignment
a b c

Exercise 3.6.

Power sets, counted.

For distinct aa, bb, cc, the set P({a,b,c})\mathcal{P}(\{a, b, c\}) has how many elements?

answer one of these

P({∅})\mathcal{P}(\{\emptyset\}) is:

answer one of these

And P(P(P(∅)))\mathcal{P}\bigl(\mathcal{P}(\mathcal{P}(\emptyset))\bigr) has how many elements?

answer one of these

Exercise 3.7.

Replacement, and the condition it imposes.

Take A={1,2,3}A = \{1, 2, 3\} and let P(x,y)P(x, y) be the statement y={x}y = \{x\}. The set replacement returns is:

answer one of these

Which of these statements does replacement refuse?

answer one of these

Exercise 3.8.

For sets AA and BB, the symmetric difference is

A⊕B  =def  (A∖B)∪(B∖A),A \oplus B \;\defeq\; (A \setminus B) \cup (B \setminus A),

the set of objects belonging to exactly one of the two.

An object lies in (A⊕B)⊕C(A \oplus B) \oplus C exactly when it belongs to:

answer one of these

Write that condition in aa, bb, cc. Spelling the four cases out with ∧\land, ∨\lor and ¬\neg counts, and so does the short answer, which uses ⊕\oplus and one pair of brackets and nothing else. Then try the other bracketing of that short answer, and say what the two verdicts together tell you about A⊕(B⊕C)A \oplus (B \oplus C).

answer formula

Exercise 3.9.

Each condition below holds for some pairs of sets and not others. Say for which.

A∪B=∅A \cup B = \emptyset:

answer one of these

A∖B=AA \setminus B = A:

answer one of these

A∪B=A∩BA \cup B = A \cap B:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last two sheets were about statements. This one is about objects, and about the sets that hold them.

The editor has one type, Obj, and its terms are the objects of this chapter. Sets are objects too by Axiom 3.2 , so a set and its elements are terms of that same type, and x ∈ A is a statement about any two of them. Nothing marks off the objects that are sets from those that are not, and every exercise below is about sets.

The notation is typed with the backslash abbreviations: \in for ∈, \nin for ∉, \sub for ⊆, \cup for ∪, \cap for ∩, \emptyset for ∅ and \powerset for 𝒫. The difference A \ B is a plain backslash.

Inclusion

An inclusion is not a new kind of statement. A ⊆ B is ∀ x, x ∈ A → x ∈ B written short, so it is proved the way an implication is, by intro, and used the way an implication is, by applying it: with h : A ⊆ B and hx : x ∈ A, the term h x hx proves x ∈ B. A goal ∀ x, p x behaves the same way, intro x fixing an arbitrary x and leaving p x.

Example.

An inclusion applied to an object and to a proof that the object lies in the smaller set.

lean worked
1example (A B : Obj) (h : A ⊆ B) (x : Obj) (hx : x ∈ A) : x ∈ B := by
verified
goalGoals accomplished.

The operations are nothing more than their membership criteria. x ∈ A ∪ B is the disjunction x ∈ A ∨ x ∈ B, not merely equivalent to it, so left, right and rcases work on a membership in a union as they do on any disjunction. x ∈ A ∩ B is the conjunction x ∈ A ∧ x ∈ B, so ⟨_, _⟩ builds one and .left and .right take one apart.

Example.

The first intro fixes the object, the second assumes it lies in AA.

lean worked
1example (A B : Obj) : A ⊆ A ∪ B := by
verified
goalGoals accomplished.

Example.

Half of a conjunction, reached through the criterion for the intersection.

lean worked
1example (A B : Obj) : A ∩ B ⊆ A := by
verified
goalGoals accomplished.

Exercise 3.10.

Both criteria at once: take the conjunction apart, then choose a side of the disjunction.

lean proof
1example (A B : Obj) : A ∩ B ⊆ A ∪ B := by
goalA B : Obj ⊢ A ∩ B ⊆ A ∪ B

Exercise 3.11.

Subsets are transitive.

lean proof
1example (A B C : Obj) : A ⊆ B → B ⊆ C → A ⊆ C := by
goalA B C : Obj ⊢ A ⊆ B → B ⊆ C → A ⊆ C

Exercise 3.12.

A set containing both AA and BB contains their union.

lean proof
1example (A B C : Obj) : A ⊆ C → B ⊆ C → A ∪ B ⊆ C := by
goalA B C : Obj ⊢ A ⊆ C → B ⊆ C → A ∪ B ⊆ C

Exercise 3.13.

And a set contained in both is contained in their intersection.

lean proof
1example (A B C : Obj) : C ⊆ A → C ⊆ B → C ⊆ A ∩ B := by
goalA B C : Obj ⊢ C ⊆ A → C ⊆ B → C ⊆ A ∩ B

Equality

Two sets are equal when they have the same elements, and Set.ext is that axiom: handed ∀ x, x ∈ A ↔ x ∈ B it returns A = B. So apply Set.ext turns a goal A = B into that biconditional, intro x fixes the object, and constructor splits the biconditional into its two directions.

Example.

Idempotence of the intersection, which is idempotence of ∧\land underneath.

lean worked
1example (A : Obj) : A ∩ A = A := by
verified
goalGoals accomplished.

Mutual inclusion says the same thing, and Set.subset_antisymm is Proposition 3.29 . Applying it leaves the two inclusions as separate goals, which is often the shorter road, since neither of them mentions the biconditional.

Example.

Absorption. The harder inclusion splits on the union; the other one is a line.

lean worked
1example (A B : Obj) : A ∪ (A ∩ B) = A := by
verified
goalGoals accomplished.

have

A proof that needs a step of its own records it with have. Writing have h : p := … adds h : p to the context, and what follows := is either a term or by with a block indented under it.

Example.

The intermediate membership is named, and then taken apart.

lean worked
1example (A B C : Obj) (h : A ⊆ B ∩ C) (x : Obj) (hx : x ∈ A) : x ∈ C := by
verified
goalGoals accomplished.

Exercise 3.14.

The order of a union carries no information.

lean proof
1example (A B : Obj) : A ∪ B = B ∪ A := by
goalA B : Obj ⊢ A ∪ B = B ∪ A

Exercise 3.15.

The distributive law left unproved in Theorem 3.42 .

lean proof
1example (A B C : Obj) : A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) := by
goalA B C : Obj ⊢ A ∩ (B ∪ C) = A ∩ B ∪ A ∩ C

Difference

x ∈ A \ B is x ∈ A ∧ ¬(x ∈ B), a conjunction whose right half is a negation, which is to say a function into False.

Example.

The negative half, taken out of the conjunction.

lean worked
1example (A B x : Obj) (h : x ∈ A \ B) : x ∉ B := by
verified
goalGoals accomplished.

And x ∈ ∅ is False itself. There is nothing to do with such a hypothesis but close the branch, which h.elim does, proving whatever the goal happens to be.

Example.

Nothing lies in the empty set, so this branch never arises.

lean worked
1example (A x : Obj) (h : x ∈ ∅) : x ∈ A := by
verified
goalGoals accomplished.

Exercise 3.16.

Taking AA out of BB first costs the union nothing.

lean proof
1example (A B : Obj) : A ∪ (B \ A) = A ∪ B := by
goalA B : Obj ⊢ A ∪ B \ A = A ∪ B

Exercise 3.17.

De Morgan’s second law, with the complement written as a difference.

lean proof
1example (A B C : Obj) : A \ (B ∩ C) = (A \ B) ∪ (A \ C) := by
goalA B C : Obj ⊢ A \ (B ∩ C) = A \ B ∪ A \ C

Exercise 3.18.

Its companion.

lean proof
1example (A B C : Obj) : A \ (B ∪ C) = (A \ B) ∩ (A \ C) := by
goalA B C : Obj ⊢ A \ (B ∪ C) = (A \ B) ∩ (A \ C)

Symmetric difference

For sets AA and BB, the symmetric difference A⊕BA \oplus B is (A∖B)∪(B∖A)(A \setminus B) \cup (B \setminus A), the set of objects belonging to exactly one of the two. The editor has no notation for it, so the statements below carry it written out.

An equation between sets is used with rw: from h : A = B, rw [h] replaces AA by BB in the goal, and rw [h] at k does it inside the hypothesis k.

Example.

Substitution, which is what an equation is for.

lean worked
1example (A B x : Obj) (h : A = B) (hx : x ∈ A) : x ∈ B := by
verified
goalGoals accomplished.

Exercise 3.19.

A⊕A=∅A \oplus A = \emptyset.

lean proof
1example (A : Obj) : (A \ A) ∪ (A \ A) = ∅ := by
goalA : Obj ⊢ A \ A ∪ A \ A = ∅

Exercise 3.20.

A⊕∅=AA \oplus \emptyset = A.

lean proof
1example (A : Obj) : (A \ ∅) ∪ (∅ \ A) = A := by
goalA : Obj ⊢ A \ ∅ ∪ ∅ \ A = A

Exercise 3.21.

(A⊕B)∖(A∖B)=B∖A(A \oplus B) \setminus (A \setminus B) = B \setminus A.

lean proof
1example (A B : Obj) : ((A \ B) ∪ (B \ A)) \ (A \ B) = B \ A := by
goalA B : Obj ⊢ (A \ B ∪ B \ A) \ (A \ B) = B \ A

Exercise 3.22.

If A⊕BA \oplus B is empty then AA and BB are the same set.

lean proof
1example (A B : Obj) : (A \ B) ∪ (B \ A) = ∅ → A = B := by
goalA B : Obj ⊢ A \ B ∪ B \ A = ∅ → A = B

Power sets

X ∈ 𝒫 A is X ⊆ A, which is a ∀ again, so a membership in a power set opens with intro like any other inclusion.

Example.

Every set is a subset of itself, and so an element of its own power set.

lean worked
1example (A : Obj) : A ∈ 𝒫 A := by
verified
goalGoals accomplished.

Exercise 3.23.

Half of Theorem 3.48 , part two.

lean proof
1example (A B : Obj) : A ⊆ B → 𝒫 A ⊆ 𝒫 B := by
goalA B : Obj ⊢ A ⊆ B → 𝒫 A ⊆ 𝒫 B

Exercise 3.24.

And part four of it.

lean proof
1example (A B : Obj) : 𝒫 (A ∩ B) = 𝒫 A ∩ 𝒫 B := by
goalA B : Obj ⊢ 𝒫 (A ∩ B) = 𝒫 A ∩ 𝒫 B

Exercise 3.25.

Since P(∅)\mathcal{P}(\emptyset) is {∅}\{\emptyset\}, this is the inclusion P(A∖B)⊂(P(A)∖P(B))∪{∅}\mathcal{P}(A \setminus B) \subset \bigl(\mathcal{P}(A) \setminus \mathcal{P}(B)\bigr) \cup \{\emptyset\}.

lean proof
1example (A B : Obj) : 𝒫 (A \ B) ⊆ (𝒫 A \ 𝒫 B) ∪ 𝒫 ∅ := by
goalA B : Obj ⊢ 𝒫 (A \ B) ⊆ 𝒫 A \ 𝒫 B ∪ 𝒫 ∅
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 4

Functions

Taught

More Sets

Once the axioms of set theory are in place, we can review some elementary albeit very useful constructions that these axioms enable.

Ordered Pairs

We often need to pair two elements while retaining their positions, and an ordinary two-element set cannot do this, since {a,b}={b,a}\{a, b\} = \{b, a\}; something more is needed if one element is to be marked as coming before the other. We could simply declare that the notation (a,b)(a, b) is ordered, but what does ordered mean in terms of sets?

Before choosing a set to represent (a,b)(a, b), we state the property any such choice must have: whenever (a,b)(a, b) and (c,d)(c, d) are ordered pairs,

(a,b)=(c,d)  ⟺  (a=c)∧(b=d).(∗)(a, b) = (c, d) \iff (a = c) \land (b = d). \tag{$*$}

In particular, the two coordinates must be recoverable from the pair.

Definition 4.1 (Ordered pair).

Let aa and bb be objects. The ordered pair (a,b)(a, b) is the set

(a,b)  =def  {{a},{a,b}},(a, b) \;\defeq\; \bigl\{\{a\}, \{a, b\}\bigr\},

where aa is its first coordinate and bb its second coordinate.

The sets used to encode the pair, {a}\{a\} and {a,b}\{a, b\}, are supplied by the pairing axiom of the last chapter, and the set on the right exists by that same axiom applied once more, to those two. The construction is due to Kuratowski. Does it satisfy (∗)(*)?

Proposition 4.2 (Equality of ordered pairs).

For objects aa, bb, cc and dd, (a,b)=(c,d)(a, b) = (c, d) if and only if a=ca = c and b=db = d.

Discussion.

Our statement is a biconditional. The reverse implication, a=ca = c and b=db = d implies (a,b)=(c,d)(a, b) = (c, d), is a direct substitution into the definition of the ordered pair. For the forward implication we assume {{a},{a,b}}={{c},{c,d}}\bigl\{\{a\}, \{a, b\}\bigr\} = \bigl\{\{c\}, \{c, d\}\bigr\} and must recover the coordinates from the set; the argument splits into the cases a=ba = b and a≠ba \neq b, because in the first case the pair collapses to the singleton {{a}}\bigl\{\{a\}\bigr\} while in the second its two elements are distinct and can be chased through the equality one at a time. The logical proof avoids the split: it expands each ordered pair, rewrites set equality as the two inclusions by mutual inclusion, and lets the distributive and absorption laws of the first chapter reduce the resulting disjunctions to the conjunction a=c∧b=da = c \land b = d.

Proof (element style).

Let aa, bb, cc and dd be arbitrary objects. For the reverse implication, suppose a=ca = c and b=db = d. Then {a}={c}\{a\} = \{c\} and {a,b}={c,d}\{a, b\} = \{c, d\}; hence (a,b)={{a},{a,b}}={{c},{c,d}}=(c,d)(a, b) = \bigl\{\{a\}, \{a, b\}\bigr\} = \bigl\{\{c\}, \{c, d\}\bigr\} = (c, d).

For the forward implication, suppose (a,b)=(c,d)(a, b) = (c, d). By the definition of set equality, every element of either ordered pair belongs to the other; we divide the argument into two cases, a=ba = b and a≠ba \neq b.

If a=ba = b, then (a,b)={{a},{a,a}}={{a}}(a, b) = \bigl\{\{a\}, \{a, a\}\bigr\} = \bigl\{\{a\}\bigr\}. Both {c}\{c\} and {c,d}\{c, d\} belong to (c,d)=(a,b)={{a}}(c, d) = (a, b) = \bigl\{\{a\}\bigr\}, so each must equal {a}\{a\}; hence c=ac = a and d=ad = a. Since b=ab = a as well, we obtain a=ca = c and b=db = d.

If a≠ba \neq b, then {a}≠{a,b}\{a\} \neq \{a, b\}; consequently (a,b)(a, b) has two distinct elements. Since {a}∈(a,b)=(c,d)\{a\} \in (a, b) = (c, d), either {a}={c}\{a\} = \{c\} or {a}={c,d}\{a\} = \{c, d\}. The latter equality would give c=d=ac = d = a, so (c,d)={{a}}(c, d) = \bigl\{\{a\}\bigr\} would have only one element; this contradicts (a,b)=(c,d)(a, b) = (c, d), since (a,b)(a, b) has two. Therefore {a}={c}\{a\} = \{c\}, and hence a=ca = c.

Similarly, since {a,b}∈(a,b)=(c,d)\{a, b\} \in (a, b) = (c, d), either {a,b}={c}\{a, b\} = \{c\} or {a,b}={c,d}\{a, b\} = \{c, d\}. The former equality would give a=b=ca = b = c, contradicting a≠ba \neq b; therefore {a,b}={c,d}\{a, b\} = \{c, d\}. It follows that b=cb = c or b=db = d; but c=a≠bc = a \neq b, so b≠cb \neq c and hence b=db = d. Thus a=ca = c and b=db = d.

Remark.

This logical proof is dumb and covoluted lol but why not.

Proof (logical style).

Let aa, bb, cc and dd be arbitrary objects. By the definition of set equality,

(a,b)=(c,d)≡({{a},{a,b}}⊂{{c},{c,d}})∧({{c},{c,d}}⊂{{a},{a,b}})≡(({a}={c}∨{a}={c,d})∧({a,b}={c}∨{a,b}={c,d}))∧(({c}={a,b}∨{c}={a})∧({c,d}={a}∨{c,d}={a,b}))≡(({a}={c}∨{a}={c,d})∧({c}={a,b}∨{c}={a}))∧(({a,b}={c}∨{a,b}={c,d})∧({c,d}={a}∨{c,d}={a,b}))≡({a}={c}∨({a}={c,d}∧{a,b}={c}))∧({a,b}={c,d}∨({a,b}={c}∧{c,d}={a}))≡({a}={c,d}∧{a,b}={c})∨({a}={c}∧{a,b}={c,d})≡((a=c∧a=d)∧(a=c∧b=c))∨(a=c∧((a=c∧b=d)∨(a=d∧b=c)))≡(a=c∧a=d∧b=c)∨(a=c∧b=d)∨(a=c∧a=d∧b=c)≡(a=c∧a=d∧b=c)∨(a=c∧b=d)≡(a=c∧a=d∧b=c∧b=d)∨(a=c∧b=d)≡a=c∧b=d.\begin{aligned} (a, b) = (c, d) &\equiv \Bigl(\bigl\{\{a\}, \{a, b\}\bigr\} \subset \bigl\{\{c\}, \{c, d\}\bigr\}\Bigr) \\ &\qquad {}\land \Bigl(\bigl\{\{c\}, \{c, d\}\bigr\} \subset \bigl\{\{a\}, \{a, b\}\bigr\}\Bigr) \\[2pt] &\equiv \Bigl(\bigl(\{a\} = \{c\} \lor \{a\} = \{c, d\}\bigr) \\ &\qquad\quad {}\land \bigl(\{a, b\} = \{c\} \lor \{a, b\} = \{c, d\}\bigr)\Bigr) \\ &\qquad {}\land \Bigl(\bigl(\{c\} = \{a, b\} \lor \{c\} = \{a\}\bigr) \\ &\qquad\qquad {}\land \bigl(\{c, d\} = \{a\} \lor \{c, d\} = \{a, b\}\bigr)\Bigr) \\[2pt] &\equiv \Bigl(\bigl(\{a\} = \{c\} \lor \{a\} = \{c, d\}\bigr) \\ &\qquad\quad {}\land \bigl(\{c\} = \{a, b\} \lor \{c\} = \{a\}\bigr)\Bigr) \\ &\qquad {}\land \Bigl(\bigl(\{a, b\} = \{c\} \lor \{a, b\} = \{c, d\}\bigr) \\ &\qquad\qquad {}\land \bigl(\{c, d\} = \{a\} \lor \{c, d\} = \{a, b\}\bigr)\Bigr) \\[2pt] &\equiv \Bigl(\{a\} = \{c\} \lor \bigl(\{a\} = \{c, d\} \land \{a, b\} = \{c\}\bigr)\Bigr) \\ &\qquad {}\land \Bigl(\{a, b\} = \{c, d\} \lor \bigl(\{a, b\} = \{c\} \land \{c, d\} = \{a\}\bigr)\Bigr) \\[2pt] &\equiv \bigl(\{a\} = \{c, d\} \land \{a, b\} = \{c\}\bigr) \\ &\qquad {}\lor \bigl(\{a\} = \{c\} \land \{a, b\} = \{c, d\}\bigr) \\[2pt] &\equiv \Bigl(\bigl(a = c \land a = d\bigr) \land \bigl(a = c \land b = c\bigr)\Bigr) \\ &\qquad {}\lor \Bigl(a = c \land \bigl((a = c \land b = d) \lor (a = d \land b = c)\bigr)\Bigr) \\[2pt] &\equiv (a = c \land a = d \land b = c) \lor (a = c \land b = d) \\ &\qquad {}\lor (a = c \land a = d \land b = c) \\[2pt] &\equiv (a = c \land a = d \land b = c) \lor (a = c \land b = d) \\[2pt] &\equiv (a = c \land a = d \land b = c \land b = d) \lor (a = c \land b = d) \\[2pt] &\equiv a = c \land b = d. \end{aligned}

Corollary 4.3 (Swapping coordinates).

For objects aa and bb, (a,b)=(b,a)(a, b) = (b, a) if and only if a=ba = b.

Proof.

If (a,b)=(b,a)(a, b) = (b, a), then Proposition 4.2 gives a=ba = b by comparing first coordinates. Conversely, if a=ba = b, then (a,b)=(a,a)=(b,a)(a, b) = (a, a) = (b, a).

Kuratowski’s is not the only possible choice, and the next problem looks at a shorter one.

Problem 4.1.

Some authors define the ordered pair by the shorter set

⟨a,b⟩  =def  {a,{a,b}}.\langle a, b \rangle \;\defeq\; \bigl\{a, \{a, b\}\bigr\}.
  1. Prove that this also satisfies (∗)(*), so that ⟨a,b⟩=⟨c,d⟩\langle a, b \rangle = \langle c, d \rangle if and only if a=ca = c and b=db = d. You may use the axiom of regularity from the last chapter, and in particular the conclusion of its second problem.
  2. Show that regularity is genuinely needed, by identifying the step of your argument that fails without it, and say why the same step does not arise for Definition 4.1 .

Nesting ordered pairs builds longer ordered tuples.

Definition 4.4 (Ordered triples and longer).

Let aa, bb, cc and dd be objects. The ordered triple and ordered quadruple are

(a,b,c)  =def  ((a,b),c),(a,b,c,d)  =def  ((a,b,c),d),(a, b, c) \;\defeq\; \bigl((a, b), c\bigr), \qquad (a, b, c, d) \;\defeq\; \bigl((a, b, c), d\bigr),

and further tuples are assembled the same way.

Remark.

We have now overloaded the parenthesis symbols ( )(\ ) once again: they are used not only to group operators and arguments, but also to enclose ordered pairs. This is usually not a problem in practice, as one can still determine from context which usage is intended.

Cartesian Products

With ordered pairs in hand we can collect all of them at once. The collection has to come from somewhere, and the power set supplies it.

Proposition 4.5 (Where ordered pairs live).

Let AA and BB be sets, let a∈Aa \in A and b∈Bb \in B. Then (a,b)∈P(P(A∪B))(a, b) \in \mathcal{P}\bigl(\mathcal{P}(A \cup B)\bigr).

Discussion.

An ordered pair is a set of two sets, so it sits two power sets up from whatever holds its coordinates, and the set holding both coordinates is A∪BA \cup B. We go up one power set at a time: show each of {a}\{a\} and {a,b}\{a, b\} is a subset of A∪BA \cup B, which puts both in P(A∪B)\mathcal{P}(A \cup B), and then that having both as elements makes (a,b)(a, b) a subset of P(A∪B)\mathcal{P}(A \cup B), which is what membership in the next power set asks for.

Proof.

Since a∈Aa \in A we have a∈A∪Ba \in A \cup B, and since b∈Bb \in B we have b∈A∪Bb \in A \cup B. Every element of {a}\{a\} is aa, and every element of {a,b}\{a, b\} is aa or bb, so both {a}⊂A∪B\{a\} \subset A \cup B and {a,b}⊂A∪B\{a, b\} \subset A \cup B, that is, both belong to P(A∪B)\mathcal{P}(A \cup B).

The elements of (a,b)={{a},{a,b}}(a, b) = \bigl\{\{a\}, \{a, b\}\bigr\} are exactly those two sets, so (a,b)⊂P(A∪B)(a, b) \subset \mathcal{P}(A \cup B), which is (a,b)∈P(P(A∪B))(a, b) \in \mathcal{P}\bigl(\mathcal{P}(A \cup B)\bigr).

Definition 4.6 (Cartesian product).

Let AA and BB be sets. The Cartesian product A×BA \times B is the set of all ordered pairs with first coordinate in AA and second in BB,

A×B  =def  {p∈P(P(A∪B))  ∣  ∃a∈A ∃b∈B (p=(a,b))},A \times B \;\defeq\; \Bigl\{p \in \mathcal{P}\bigl(\mathcal{P}(A \cup B)\bigr) \;\Big|\; \exists a \in A\ \exists b \in B\,\bigl(p = (a, b)\bigr)\Bigr\},

so that for every object pp, p∈A×Bp \in A \times B exactly when p=(a,b)p = (a, b) for some a∈Aa \in A and some b∈Bb \in B.

The product needs no axiom of its own. The proposition above puts every candidate pair inside P(P(A∪B))\mathcal{P}(\mathcal{P}(A \cup B)), a set we are already holding, and comprehension carves the product out of it.

Example 4.7.

Let A={1,2}A = \{1, 2\} and B={r,s}B = \{r, s\}. Then A×B={(1,r),(1,s),(2,r),(2,s)}A \times B = \bigl\{(1, r), (1, s), (2, r), (2, s)\bigr\}. Order matters here in a way it did not for unordered pairs: (1,r)∈A×B(1, r) \in A \times B while (r,1)∈B×A(r, 1) \in B \times A, and the two products are different sets.

Problem 4.2.

Let AA and BB be sets. Show that A×B=∅A \times B = \emptyset if and only if A=∅A = \emptyset or B=∅B = \emptyset.

Membership in a product is a conjunction, which adds another line to the dictionary:

((s,t)∈S×T)≡(s∈S)∧(t∈T).\bigl((s, t) \in S \times T\bigr) \equiv (s \in S) \land (t \in T).

Example 4.8.

Order matters, and in general S×T≠T×SS \times T \neq T \times S. With S={1,2}S = \{1, 2\} and T={a,b,c}T = \{a, b, c\} we have T×S={(a,1),(a,2),(b,1),(b,2),(c,1),(c,2)}T \times S = \{(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)\}, which is not the earlier set: the element (1,a)(1, a) lies in S×TS \times T but not in T×ST \times S, since 1∉T1 \notin T.

Example 4.9.

For any set SS, both S×∅S \times \emptyset and ∅×S\emptyset \times S are empty. A pair in S×∅S \times \emptyset would need its second coordinate from ∅\emptyset, which has nothing to give; through the dictionary, ((s,t)∈S×∅)≡(s∈S)∧⊥≡⊥\bigl((s, t) \in S \times \emptyset\bigr) \equiv (s \in S) \land \bot \equiv \bot.

Products of three or more sets work the same way, S×T×RS \times T \times R collecting the triples (s,t,r)(s, t, r) with s∈Ss \in S, t∈Tt \in T and r∈Rr \in R, and so on upwards. There is a subtlety here.

Remark (Order of operations).

The definition takes two sets at a time, so for three sets there are two readings, and they are not the same set. Applying it twice, the elements of A×(B×C)A \times (B \times C) are the pairs (x,(y,z))\bigl(x, (y, z)\bigr), which unfold to

{{x}, {x,{{y},{y,z}}}},\bigl\{\{x\},\ \bigl\{x, \{\{y\}, \{y, z\}\}\bigr\}\bigr\},

while the elements of (A×B)×C(A \times B) \times C are the pairs ((x,y),z)\bigl((x, y), z\bigr), which unfold to

{{{{x},{x,y}}}, {{{x},{x,y}},z}}.\Bigl\{\bigl\{\{\{x\}, \{x, y\}\}\bigr\},\ \bigl\{\{\{x\}, \{x, y\}\}, z\bigr\}\Bigr\}.

Both should intuitively be the set of all triples (x,y,z)(x, y, z), and they do describe the same object once we identify them. Using a term we introduce below, the identification amounts to checking that

(x,(y,z))⟼((x,y),z)\bigl(x, (y, z)\bigr) \longmapsto \bigl((x, y), z\bigr)

is a bijection from the first set onto the second, so the product is associative up to that correspondence. Once bijections are in hand this is a short piece of work, and the problems below ask you to do it; from then on we drop the brackets and write A×B×CA \times B \times C.

Problem 4.3.

We said that S×T≠T×SS \times T \neq T \times S in general. Find every case in which they are equal.

Indexed Families

It is often convenient to give each set in a collection a label.

Definition 4.10 (Indexed family).

Let II be a set. An indexed family consists of one object xix_i for each i∈Ii \in I, and is written {xi}i∈I\{x_i\}_{i \in I}. The set II is the index set and ii is an index. Different indices may label the same object.

Example 4.11.

Let AA, CC and DD be sets, take I={1,2,3,4}I = \{1, 2, 3, 4\}, and declare B1=defAB_1 \defeq A, B2=defCB_2 \defeq C, B3=defAB_3 \defeq A and B4=defDB_4 \defeq D. The family {Bi}i∈I\{B_i\}_{i \in I} has four entries, and the equality B1=B3B_1 = B_3 removes neither of them: the labels 11 and 33 are different even though the sets they label are equal. The braces in the notation are a convention, since what we are holding is an assignment of an object to each index, and that assignment records more than the plain set of members {A,C,D}\{A, C, D\}, which does not record that AA occurs twice.

Definition 4.12 (Indexed unions and intersections).

Let {Ai}i∈I\{A_i\}_{i \in I} be an indexed family of sets with II non-empty. Its union and intersection are

⋃i∈IAi=def⋃{Ai:i∈I},⋂i∈IAi=def{x∈⋃i∈IAi  ∣  ∀i∈I (x∈Ai)},\bigcup_{i \in I} A_i \defeq \bigcup \{A_i : i \in I\}, \qquad \bigcap_{i \in I} A_i \defeq \Bigl\{x \in \bigcup_{i \in I} A_i \;\Big|\; \forall i \in I\,(x \in A_i)\Bigr\},

so that x∈⋃i∈IAix \in \bigcup_{i \in I} A_i exactly when x∈Aix \in A_i for some i∈Ii \in I, and x∈⋂i∈IAix \in \bigcap_{i \in I} A_i exactly when x∈Aix \in A_i for every i∈Ii \in I.

Neither needs an axiom beyond those we have. Replacement turns the index set into the set {Ai:i∈I}\{A_i : i \in I\} of members, since each ii has exactly one partner AiA_i, and the union axiom pools what those members hold. The intersection is then carved out of that union by comprehension, exactly as the intersection of a system of sets was in the last chapter, and for the same reason: an object lying in every member lies in some member, so nothing is lost by looking only inside the union.

By the bounded quantifier convention of the last chapter, the two membership tests unabbreviate to ∃i ((i∈I)∧(x∈Ai))\exists i\,\bigl((i \in I) \land (x \in A_i)\bigr) for the union and ∀i ((i∈I)  ⟹  (x∈Ai))\forall i\,\bigl((i \in I) \implies (x \in A_i)\bigr) for the intersection.

For I={1,2}I = \{1, 2\} the new symbols hand back the old ones, ⋃i∈IAi=A1∪A2\bigcup_{i \in I} A_i = A_1 \cup A_2 and ⋂i∈IAi=A1∩A2\bigcap_{i \in I} A_i = A_1 \cap A_2. With quantifiers doing the work, the negation rules settle what it takes not to belong:

x∉⋂i∈IAi  ⟺  ∃i∈I (x∉Ai),x∉⋃i∈IAi  ⟺  ∀i∈I (x∉Ai).x \notin \bigcap_{i \in I} A_i \iff \exists i \in I\,(x \notin A_i), \qquad x \notin \bigcup_{i \in I} A_i \iff \forall i \in I\,(x \notin A_i).

So xx is outside the intersection if it misses a single AiA_i, but outside the union only if it misses every AiA_i.

Problem 4.4 (Informal).

Let I={1,2,3,4}I = \{1, 2, 3, 4\} and let AiA_i be the set of whole numbers mm with i⩽m⩽2ii \leqslant m \leqslant 2i. Determine ⋃i∈IAi\bigcup_{i \in I} A_i and ⋂i∈IAi\bigcap_{i \in I} A_i.

Problem 4.5.

Let II be a non-empty set, let PP be a statement not involving ii, and let Q(i)Q(i) be a predicate on II. Prove the two exchange laws

P∧∃i∈I Q(i)≡∃i∈I (P∧Q(i)),P∧∀i∈I Q(i)≡∀i∈I (P∧Q(i)).P \land \exists i \in I\,Q(i) \equiv \exists i \in I\,\bigl(P \land Q(i)\bigr), \qquad P \land \forall i \in I\,Q(i) \equiv \forall i \in I\,\bigl(P \land Q(i)\bigr).

Where does the non-emptiness of II enter? Show that if I=∅I = \emptyset one of the two equivalences survives and the other fails.

Proposition 4.13 (Set difference over indexed families).

Let AA be a set and let {Bi}i∈I\{B_i\}_{i \in I} be an indexed family of sets with II non-empty. Then

  1. A∖⋂i∈IBi=⋃i∈I(A∖Bi)A \setminus \bigcap_{i \in I} B_i = \bigcup_{i \in I} (A \setminus B_i);
  2. A∖⋃i∈IBi=⋂i∈I(A∖Bi)A \setminus \bigcup_{i \in I} B_i = \bigcap_{i \in I} (A \setminus B_i).

Discussion.

Both are equalities of sets, so we compare membership on the two sides, and each comparison admits two readings. Elementwise, an element of A∖⋂i∈IBiA \setminus \bigcap_{i \in I} B_i sits in AA and misses some BjB_j, so it sits in A∖BjA \setminus B_j and hence in the union of the differences; conversely, belonging to one difference A∖BjA \setminus B_j already keeps the element out of the intersection. The second identity is the same argument with “some” replaced by “every”. The logical route says this through the dictionary: the definition turns membership in the intersection into a universal quantifier and membership in the union into an existential one, the negation rules swap ∀\forall for ∃\exists and back, and the exchange laws of the problem above push the fixed condition x∈Ax \in A through the quantifier.

Proof (element style).

For the first, suppose x∈A∖⋂i∈IBix \in A \setminus \bigcap_{i \in I} B_i. Then x∈Ax \in A, but xx does not belong to every BiB_i, so x∉Bjx \notin B_j for some j∈Ij \in I. Hence x∈A∖Bjx \in A \setminus B_j, and therefore x∈⋃i∈I(A∖Bi)x \in \bigcup_{i \in I} (A \setminus B_i). Conversely, suppose xx belongs to that union. Then for some j∈Ij \in I we have x∈A∖Bjx \in A \setminus B_j, so x∈Ax \in A and x∉Bjx \notin B_j. It follows that x∉⋂i∈IBix \notin \bigcap_{i \in I} B_i, whence x∈A∖⋂i∈IBix \in A \setminus \bigcap_{i \in I} B_i.

For the second, suppose x∈A∖⋃i∈IBix \in A \setminus \bigcup_{i \in I} B_i. Then x∈Ax \in A and x∉Bix \notin B_i for every i∈Ii \in I, so x∈A∖Bix \in A \setminus B_i for every i∈Ii \in I, that is, x∈⋂i∈I(A∖Bi)x \in \bigcap_{i \in I} (A \setminus B_i). Conversely, membership in that intersection gives x∈A∖Bix \in A \setminus B_i for every i∈Ii \in I, so x∈Ax \in A and no BiB_i holds xx, which puts xx in A∖⋃i∈IBiA \setminus \bigcup_{i \in I} B_i.

Proof (logical style).

For any xx,

x∈A∖⋂i∈IBi≡(x∈A)∧¬ ∀i∈I (x∈Bi)by the definitions≡(x∈A)∧∃i∈I (x∉Bi)by quantifier negation≡∃i∈I ((x∈A)∧(x∉Bi))by the exchange law≡x∈⋃i∈I(A∖Bi)by the definitions\begin{aligned} x \in A \setminus \bigcap_{i \in I} B_i &\equiv (x \in A) \land \neg\,\forall i \in I\,(x \in B_i) && \text{by the definitions} \\ &\equiv (x \in A) \land \exists i \in I\,(x \notin B_i) && \text{by quantifier negation} \\ &\equiv \exists i \in I\,\bigl((x \in A) \land (x \notin B_i)\bigr) && \text{by the exchange law} \\ &\equiv x \in \bigcup_{i \in I} (A \setminus B_i) && \text{by the definitions} \end{aligned}

and likewise

x∈A∖⋃i∈IBi≡(x∈A)∧¬ ∃i∈I (x∈Bi)by the definitions≡(x∈A)∧∀i∈I (x∉Bi)by quantifier negation≡∀i∈I ((x∈A)∧(x∉Bi))by the exchange law≡x∈⋂i∈I(A∖Bi)by the definitions.\begin{aligned} x \in A \setminus \bigcup_{i \in I} B_i &\equiv (x \in A) \land \neg\,\exists i \in I\,(x \in B_i) && \text{by the definitions} \\ &\equiv (x \in A) \land \forall i \in I\,(x \notin B_i) && \text{by quantifier negation} \\ &\equiv \forall i \in I\,\bigl((x \in A) \land (x \notin B_i)\bigr) && \text{by the exchange law} \\ &\equiv x \in \bigcap_{i \in I} (A \setminus B_i) && \text{by the definitions.} \end{aligned}

Corollary 4.14 (De Morgan's laws for indexed families).

Let {Bi}i∈I\{B_i\}_{i \in I} be an indexed family of subsets of an ambient set UU, with II non-empty. With every complement taken in UU,

⋂i∈IBi‾=⋃i∈IBi‾,⋃i∈IBi‾=⋂i∈IBi‾.\overline{\bigcap_{i \in I} B_i} = \bigcup_{i \in I} \overline{B_i}, \qquad \overline{\bigcup_{i \in I} B_i} = \bigcap_{i \in I} \overline{B_i}.

Proof.

Take A=UA = U in the two parts of the proposition. Each difference U∖BiU \setminus B_i is the complement Bi‾\overline{B_i}, and the identities follow.

Problem 4.6.

Let AA be a set and {Bi}i∈I\{B_i\}_{i \in I} an indexed family of sets with II non-empty. Prove that A⊂⋂i∈IBiA \subset \bigcap_{i \in I} B_i if and only if A⊂BiA \subset B_i for every i∈Ii \in I, and that ⋃i∈IBi⊂A\bigcup_{i \in I} B_i \subset A if and only if Bi⊂AB_i \subset A for every i∈Ii \in I.

Problem 4.7.

Let {Ai,j}(i,j)∈I×J\{A_{i,j}\}_{(i,j) \in I \times J} be an indexed family of sets with II and JJ non-empty. Decide which inclusion between

⋃i∈I⋂j∈JAi,jand⋂j∈J⋃i∈IAi,j\bigcup_{i \in I} \bigcap_{j \in J} A_{i,j} \qquad\text{and}\qquad \bigcap_{j \in J} \bigcup_{i \in I} A_{i,j}

holds for every such family, and whether equality is forced. (Harder.)

Functions

In order to do analysis it is not particularly useful to have only the notion of a set; we also need the notion of a function from one set to another. Informally, a function f:X→Yf : X \to Y is an operation which assigns to each element, or input, xx in XX a single element, or output, f(x)f(x) in YY. Formulas, rules and graphs are convenient ways to describe the pairing of inputs with outputs, but the set of pairs itself is the function.

Definition 4.15 (Function).

Let XX and YY be sets. A function from XX to YY is a subset f⊂X×Yf \subset X \times Y such that for every x∈Xx \in X there is exactly one y∈Yy \in Y with (x,y)∈f(x, y) \in f. We write f:X→Yf : X \to Y, call XX the domain of ff, written dom⁡f\operatorname{dom} f, and YY the codomain, and write f(x)f(x) for the unique yy paired with xx, so that for any x∈Xx \in X and y∈Yy \in Y,

y=f(x)  ⟺  (x,y)∈f.y = f(x) \iff (x, y) \in f.

The condition on ff is sometimes called the vertical line test: exactly one pair of ff stands above each point of the domain. It is two demands at once, existence and uniqueness, and either can fail on its own.

We also write x↦f(x)x \mapsto f(x) for the pairing. The object f(x)f(x) is the image of xx, and xx is a preimage of f(x)f(x), one of possibly several. Functions are also called maps, mappings or transformations, depending on the context.

Remark.

A function is often handed to us as a property rather than a set of pairs. Let P(x,y)P(x, y) pertain to x∈Xx \in X and y∈Yy \in Y, and suppose that for every x∈Xx \in X there is exactly one y∈Yy \in Y making P(x,y)P(x, y) true. Then

f  =def  {p∈X×Y  ∣  ∃x∈X ∃y∈Y (p=(x,y)∧P(x,y))}f \;\defeq\; \bigl\{p \in X \times Y \;\big|\; \exists x \in X\ \exists y \in Y\,\bigl(p = (x, y) \land P(x, y)\bigr)\bigr\}

is a set by comprehension, and the hypothesis on PP is exactly the vertical line test, so ff is a function from XX to YY with y=f(x)y = f(x) precisely when P(x,y)P(x, y) holds. No further axiom is needed to turn a property into a function; the ones we already have build the set of pairs for us.

Example 4.16 (Informal).

Assuming you know what the real numbers are, take both domain and codomain to be them. The declaration g(x)=1/xg(x) = 1/x assigns nothing at x=0x = 0, so existence fails there and gg is not a function on that domain. The condition h(x)2=x2h(x)^2 = x^2 offers two candidates whenever x≠0x \neq 0, namely xx and −x-x, so uniqueness fails and hh is not a function either.

Remark (Informal examples).

Several examples below assume you know the real numbers and the whole numbers, which we have not built yet. In those we write RR for the real numbers and WW for the whole numbers, and we borrow the rules of school algebra openly. Nothing in the theory rests on them; they are there because familiar objects make the definitions easier to read.

A rule that meets both requirements, assigning a unique value in the codomain to every element of the domain, is said to be well defined. One common way to present a function is to specify its domain, its codomain, and how the output f(x)f(x) is generated from each input; this is an explicit definition.

Remark.

Functions obey substitution: if x=x′x = x' then f(x)=f(x′)f(x) = f(x'), since f(x)f(x) was defined as the unique yy paired with xx, and xx and x′x' name the same object. Equal inputs give equal outputs. Unequal inputs need not give unequal outputs, as a constant map shows.

Three functions occur often enough to deserve names.

Definition 4.17 (Inclusion, identity and constant maps).

Let S⊂TS \subset T. The inclusion map ι:S→T\iota : S \to T is defined by ι(x)=defx\iota(x) \defeq x. When S=TS = T this is the identity map on SS, written idS\mathrm{id}_S. For sets AA and BB and a fixed b0∈Bb_0 \in B, the constant map with value b0b_0 is c:A→Bc : A \to B given by c(a)=defb0c(a) \defeq b_0 for every a∈Aa \in A.

Example 4.18.

There is a function from ∅\emptyset to any set BB, namely the empty set of pairs. Neither requirement can find an element of ∅\emptyset on which to fail, so both hold vacuously. We shall see below that it is the only one from ∅\emptyset to BB.

When the domain and codomain are sets of real numbers we can plot the pairs of f⊂A×Bf \subset A \times B in the Cartesian plane to draw its graph; for q(x)=x2q(x) = x^2 this yields the familiar parabola. An arbitrary domain might admit no geometric picture, but the underlying set of pairs remains. Drawn this way, the identity on SS is the diagonal, since it pairs each xx with itself, and a constant map is a horizontal line.

Proposition 4.19 (Equality of functions).

Functions ff and gg are equal if and only if they have the same domain and f(x)=g(x)f(x) = g(x) for every xx in it.

Discussion.

We prove the two implications of the biconditional. Suppose first that f=gf = g. Equality of the sets of ordered pairs gives equality of their first coordinates, hence equality of the domains; for an arbitrary element of the common domain the pair (x,f(x))(x, f(x)) belongs to gg, and the uniqueness clause of Definition 4.15 gives f(x)=g(x)f(x) = g(x). Conversely, assume the domains agree and the two functions have the same value at every point of the common domain. By mutual inclusion it is enough to prove the two inclusions. An arbitrary (x,y)∈f(x, y) \in f has xx in the domain and y=f(x)y = f(x), so the hypotheses put (x,y)(x, y) in gg; the reverse inclusion follows symmetrically.

Proof (element style).

Suppose first that f=gf = g. The domain of a function consists of the first coordinates of its elements, so ff and gg have the same domain. For any xx in it the pair (x,f(x))(x, f(x)) belongs to ff, and since f=gf = g we have (x,f(x))∈g(x, f(x)) \in g, which gives f(x)=g(x)f(x) = g(x) by the uniqueness of images in gg.

Conversely, assume the domains agree and f(x)=g(x)f(x) = g(x) for every xx in the common domain. If (x,y)∈f(x, y) \in f, then xx lies in that domain and y=f(x)y = f(x); since f(x)=g(x)f(x) = g(x) we have y=g(x)y = g(x), so (x,y)∈g(x, y) \in g. Hence f⊂gf \subset g. A symmetric argument gives g⊂fg \subset f, so f=gf = g.

Proof (logical style).

If f=gf = g, then for every xx,

x∈dom⁡f≡∃y ((x,y)∈f)≡∃y ((x,y)∈g)≡x∈dom⁡g,\begin{aligned} x \in \operatorname{dom} f &\equiv \exists y\,\bigl((x, y) \in f\bigr) \\ &\equiv \exists y\,\bigl((x, y) \in g\bigr) \equiv x \in \operatorname{dom} g, \end{aligned}

and for xx in this common domain (x,f(x))∈f=g(x, f(x)) \in f = g, so uniqueness gives f(x)=g(x)f(x) = g(x). Conversely, for every ordered pair (x,y)(x, y),

(x,y)∈f≡(x∈dom⁡f)∧(y=f(x))≡(x∈dom⁡g)∧(y=g(x))≡(x,y)∈g.\begin{aligned} (x, y) \in f &\equiv (x \in \operatorname{dom} f) \land \bigl(y = f(x)\bigr) \\ &\equiv (x \in \operatorname{dom} g) \land \bigl(y = g(x)\bigr) \equiv (x, y) \in g. \end{aligned}

Remark.

The codomain does not enter the criterion, because under Definition 4.15 a function is simply its set of ordered pairs. Consequently the set {(x,x)∣x∈S}\{(x, x) \mid x \in S\} defines the identity map idS:S→S\mathrm{id}_S : S \to S, but for any TT with S⊂TS \subset T it equally defines the inclusion map ι:S→T\iota : S \to T. The set of pairs is identical; the declared codomain matters when we ask whether every element of the target is reached.

Example 4.20.

There is only one function from ∅\emptyset to a given set XX. Any two have the same domain, namely ∅\emptyset, and agree at every point of it, since there are none, so the proposition makes them equal.

Definition 4.21 (Restriction and extension).

Let g:B→Cg : B \to C be a function and let A⊂BA \subset B. The restriction of gg to AA is the function g∣A:A→Cg|_A : A \to C given by g∣A(x)=defg(x)g|_A(x) \defeq g(x). The function gg is called an extension of g∣Ag|_A to BB.

Example 4.22 (Informal).

Consider

f:W→R,f(x)=defx2−1,g:R→R,g(x)=defx2−1,h:R→R,h(x)=def(x−1)(x+1).\begin{aligned} f &: W \to R, & f(x) &\defeq x^2 - 1, \\ g &: R \to R, & g(x) &\defeq x^2 - 1, \\ h &: R \to R, & h(x) &\defeq (x - 1)(x + 1). \end{aligned}

By the proposition, g=hg = h: the domains agree, and the rules of school algebra give (x−1)(x+1)=x2−1(x-1)(x+1) = x^2 - 1 for every real number. The function ff is a different object entirely. Its domain is WW, so it cannot equal gg or hh, even though its values agree with theirs at every whole number. It is their common restriction, f=g∣W=h∣Wf = g|_W = h|_W. Equality of functions depends on domains, not on formulas.

Remark.

Definition 4.15 builds a function as a set of pairs, and the domain and codomain are read off the notation f:X→Yf : X \to Y rather than carried by the set. A tidier alternative is to package all three, taking a function to be the ordered triple (X,Y,G)(X, Y, G) of a domain, a codomain and a set G⊂X×YG \subset X \times Y obeying the vertical line test. Nothing in what follows depends on the choice, and the problems below ask you to check that the two accounts agree.

Problem 4.8.

Let A={1,2,3}A = \{1, 2, 3\} and B={r,s}B = \{r, s\}. Which of the following are functions from AA to BB? Justify each answer.

  1. {(1,r),(2,s),(3,r)}\{(1, r), (2, s), (3, r)\};
  2. {(1,r),(2,s)}\{(1, r), (2, s)\};
  3. {(1,r),(1,s),(2,r),(3,s)}\{(1, r), (1, s), (2, r), (3, s)\}.

Problem 4.9.

Give sets AA and BB for which f={(3,2),(1,1),(8,5),(9,−4),(π,1)}f = \{(3, 2), (1, 1), (8, 5), (9, -4), (\pi, 1)\} is a function from AA to BB. What is f(8)f(8), and what are the preimages of 11? Is your choice of AA and BB the only one?

Problem 4.10.

Let XX and YY be non-empty sets. Prove that X×YX \times Y is a function from XX to YY if and only if YY has exactly one element.

Problem 4.11.

Let f:X→Yf : X \to Y be a function and define its graph to be the subset {(x,f(x))∣x∈X}\{(x, f(x)) \mid x \in X\} of X×YX \times Y.

  1. Show that two functions f,f~:X→Yf, \tilde{f} : X \to Y are equal if and only if they have the same graph.
  2. Conversely, let G⊂X×YG \subset X \times Y be such that for each x∈Xx \in X the set {y∈Y∣(x,y)∈G}\{y \in Y \mid (x, y) \in G\} has exactly one element. Show that there is exactly one function f:X→Yf : X \to Y whose graph is GG.
  3. Suppose we define a function instead to be an ordered triple (X,Y,G)(X, Y, G) with G⊂X×YG \subset X \times Y obeying the vertical line test, taking the domain to be XX, the codomain YY, and f(x)f(x) the unique yy with (x,y)∈G(x, y) \in G. Show that this definition agrees with Definition 4.15 , in the sense that every choice of domain, codomain and property obeying the vertical line test produces a function in this sense with all the properties the earlier definition requires.

Images and Preimages

Definition 4.23 (Image of a set).

Let f:A→Bf : A \to B be a function and let S⊂AS \subset A. The image of SS under ff is f(S)=def{f(x)∣x∈S}f(S) \defeq \{f(x) \mid x \in S\}. The image of the whole domain is the range of ff, written im⁡f=deff(A)\operatorname{im} f \defeq f(A).

The range is a subset of the codomain, and it may be a proper one. In terms of the ordered pairs of Definition 4.15 ,

im⁡f={y∈B  ∣  ∃x∈A ((x,y)∈f)}={y∈B  ∣  ∃x∈A (f(x)=y)}.\begin{aligned} \operatorname{im} f &= \bigl\{y \in B \;\big|\; \exists x \in A\,\bigl((x, y) \in f\bigr)\bigr\} \\ &= \bigl\{y \in B \;\big|\; \exists x \in A\,\bigl(f(x) = y\bigr)\bigr\}. \end{aligned}

Definition 4.24 (Preimage of a set).

Let f:A→Bf : A \to B be a function and let U⊂BU \subset B. The preimage of UU under ff is f−1(U)=def{x∈A∣f(x)∈U}f^{-1}(U) \defeq \{x \in A \mid f(x) \in U\}. In particular f−1({y})={x∈A∣f(x)=y}f^{-1}(\{y\}) = \{x \in A \mid f(x) = y\} is the set of all preimages of y∈By \in B.

The notation f−1(U)f^{-1}(U) does not assume that ff has an inverse function; the definition applies to every function. The set f−1({y})f^{-1}(\{y\}) may be empty, may hold one element, or may hold several.

Example 4.25.

Let A={1,2,3,4}A = \{1, 2, 3, 4\} and B={r,s,t,u}B = \{r, s, t, u\}, and define f:A→Bf : A \to B by f(1)=defrf(1) \defeq r, f(2)=defsf(2) \defeq s, f(3)=defsf(3) \defeq s, f(4)=deftf(4) \defeq t. Then f({1,3})={r,s}f(\{1, 3\}) = \{r, s\}, f({2,3,4})={s,t}f(\{2, 3, 4\}) = \{s, t\} and im⁡f={r,s,t}\operatorname{im} f = \{r, s, t\}. The element uu belongs to the codomain but not to the range, and its point preimage is empty. In general f−1({y})f^{-1}(\{y\}) is non-empty exactly when y∈im⁡fy \in \operatorname{im} f, and how many elements it holds records how many inputs are sent to yy. Here f−1({s})={2,3}f^{-1}(\{s\}) = \{2, 3\}, f−1({r,t})={1,4}f^{-1}(\{r, t\}) = \{1, 4\} and f−1({u})=∅f^{-1}(\{u\}) = \emptyset.

Example 4.26 (Informal).

Take g:R→Rg : R \to R with g(x)=defx+1g(x) \defeq x + 1, and let SS be the set of real numbers xx with 0⩽x⩽20 \leqslant x \leqslant 2. Then g(S)g(S) is the set of real numbers yy with 1⩽y⩽31 \leqslant y \leqslant 3: on the one hand 0⩽x⩽20 \leqslant x \leqslant 2 gives 1⩽x+1⩽31 \leqslant x + 1 \leqslant 3, which proves one inclusion, and on the other, any such yy has y−1y - 1 in SS with g(y−1)=yg(y - 1) = y, which proves the reverse. The same calculation read backwards gives g−1(g(S))=Sg^{-1}\bigl(g(S)\bigr) = S.

Proposition 4.27 (Set laws for preimages).

Let f:A→Bf : A \to B be a function and let U,V⊂BU, V \subset B. Then

  1. f−1(B∖U)=A∖f−1(U)f^{-1}(B \setminus U) = A \setminus f^{-1}(U);
  2. f−1(U∪V)=f−1(U)∪f−1(V)f^{-1}(U \cup V) = f^{-1}(U) \cup f^{-1}(V);
  3. f−1(U∩V)=f−1(U)∩f−1(V)f^{-1}(U \cap V) = f^{-1}(U) \cap f^{-1}(V).

Discussion.

We prove each equality by comparing membership at an arbitrary xx. By the definition of the preimage, membership says that x∈Ax \in A and that its image has the required property. So f(x)∈B∖Uf(x) \in B \setminus U says precisely that f(x)∉Uf(x) \notin U; membership in U∪VU \cup V means membership in at least one of UU and VV; and membership in U∩VU \cap V means membership in both. Translating those three conditions back through the same definition yields the complement, the union and the intersection we want.

Proof (element style).

If x∈f−1(B∖U)x \in f^{-1}(B \setminus U), then x∈Ax \in A and f(x)∉Uf(x) \notin U, so x∈A∖f−1(U)x \in A \setminus f^{-1}(U). Conversely, if x∈A∖f−1(U)x \in A \setminus f^{-1}(U), then f(x)∉Uf(x) \notin U; since f(x)∈Bf(x) \in B this puts f(x)∈B∖Uf(x) \in B \setminus U, whence x∈f−1(B∖U)x \in f^{-1}(B \setminus U).

If x∈f−1(U∪V)x \in f^{-1}(U \cup V), then f(x)f(x) belongs to UU or to VV, so xx belongs to f−1(U)∪f−1(V)f^{-1}(U) \cup f^{-1}(V). Conversely, membership in that union puts xx in one of the two preimages, so f(x)∈U∪Vf(x) \in U \cup V and x∈f−1(U∪V)x \in f^{-1}(U \cup V).

Finally x∈f−1(U∩V)x \in f^{-1}(U \cap V) gives both f(x)∈Uf(x) \in U and f(x)∈Vf(x) \in V, so x∈f−1(U)∩f−1(V)x \in f^{-1}(U) \cap f^{-1}(V); and membership in both preimages gives f(x)∈U∩Vf(x) \in U \cap V, which is the reverse inclusion.

Proof (logical style).

For every xx,

x∈f−1(B∖U)≡(x∈A)∧(f(x)∉U)≡x∈A∖f−1(U),x∈f−1(U∪V)≡(x∈A)∧((f(x)∈U)∨(f(x)∈V))≡(x∈f−1(U))∨(x∈f−1(V))≡x∈f−1(U)∪f−1(V),x∈f−1(U∩V)≡(x∈A)∧((f(x)∈U)∧(f(x)∈V))≡(x∈f−1(U))∧(x∈f−1(V))≡x∈f−1(U)∩f−1(V).\begin{aligned} x \in f^{-1}(B \setminus U) &\equiv (x \in A) \land \bigl(f(x) \notin U\bigr) \equiv x \in A \setminus f^{-1}(U), \\[2pt] x \in f^{-1}(U \cup V) &\equiv (x \in A) \land \bigl((f(x) \in U) \lor (f(x) \in V)\bigr) \\ &\equiv \bigl(x \in f^{-1}(U)\bigr) \lor \bigl(x \in f^{-1}(V)\bigr) \equiv x \in f^{-1}(U) \cup f^{-1}(V), \\[2pt] x \in f^{-1}(U \cap V) &\equiv (x \in A) \land \bigl((f(x) \in U) \land (f(x) \in V)\bigr) \\ &\equiv \bigl(x \in f^{-1}(U)\bigr) \land \bigl(x \in f^{-1}(V)\bigr) \equiv x \in f^{-1}(U) \cap f^{-1}(V). \end{aligned}

The middle steps distribute the conjunct x∈Ax \in A across the disjunction and the conjunction, which is Distributivity and, for the third line, Idempotence. The membership conditions agree in each pair, so the corresponding sets are equal.

Preimages preserve complements, unions and intersections. Images preserve unions, but need not preserve intersections, as the problems below ask you to show.

Read as the assignments S↦f(S)S \mapsto f(S) and U↦f−1(U)U \mapsto f^{-1}(U), a function f:A→Bf : A \to B induces two maps between power sets, one from P(A)\mathcal{P}(A) to P(B)\mathcal{P}(B) and one from P(B)\mathcal{P}(B) to P(A)\mathcal{P}(A), written ff and f−1f^{-1} again. The two behave differently, and the proposition is the reason: the preimage map preserves all three operations, while the image map preserves only unions.

Remark.

This asymmetry is why continuity is later stated in terms of preimages rather than images: a function is continuous exactly when the preimage of every open set is open.

Problem 4.12.

For the finite function above, determine f(∅)f(\emptyset), f({1,4})f(\{1, 4\}), f−1({r,s})f^{-1}(\{r, s\}) and f−1({s,u})f^{-1}(\{s, u\}).

Problem 4.13.

Let f:A→Bf : A \to B be a function and let S,T⊂AS, T \subset A. Prove that f(S∪T)=f(S)∪f(T)f(S \cup T) = f(S) \cup f(T). Must f(S∩T)=f(S)∩f(T)f(S \cap T) = f(S) \cap f(T) always hold?

Surjections, Injections, Bijections

Definition 4.28 (Surjection).

A function f:A→Bf : A \to B is surjective, or onto BB, if f(A)=Bf(A) = B; equivalently, if for every y∈By \in B there is some x∈Ax \in A with f(x)=yf(x) = y.

Every function is surjective onto its range.

Example 4.29 (Informal).

The successor map s:W→Ws : W \to W given by s(n)=defn+1s(n) \defeq n + 1 is not surjective, since 00 has no preimage among the whole numbers. The same ordered pairs define a surjection onto W∖{0}W \setminus \{0\}. So surjectivity depends on the declared codomain, not on the pairs alone.

Definition 4.30 (Injection).

A function f:A→Bf : A \to B is injective, or one-to-one, if for all x1,x2∈Ax_1, x_2 \in A, f(x1)=f(x2)  ⟹  x1=x2f(x_1) = f(x_2) \implies x_1 = x_2.

The contrapositive of that implication says distinct inputs have distinct images. To show a function is not injective it is enough to give two distinct inputs with the same image; to show it is not surjective it is enough to give an element of the codomain with no preimage.

Proposition 4.31 (Point preimages).

Let f:A→Bf : A \to B be a function.

  1. ff is injective if and only if f−1({y})f^{-1}(\{y\}) holds at most one element for every y∈By \in B;
  2. ff is surjective if and only if f−1({y})f^{-1}(\{y\}) is non-empty for every y∈By \in B.

Discussion.

For the first part we compare the definition of injectivity with the assertion that two members of f−1({y})f^{-1}(\{y\}) coincide. In one direction two such members have equal images; in the other, equal images make the two inputs members of one point preimage. For the second part, the definition of the preimage says f−1({y})f^{-1}(\{y\}) is non-empty exactly when some x∈Ax \in A satisfies f(x)=yf(x) = y, which is what surjectivity asks.

Proof.

Suppose ff is injective. If x1,x2∈f−1({y})x_1, x_2 \in f^{-1}(\{y\}), then f(x1)=y=f(x2)f(x_1) = y = f(x_2), so x1=x2x_1 = x_2. Conversely, suppose every point preimage holds at most one element. Whenever f(x1)=f(x2)=yf(x_1) = f(x_2) = y, both x1x_1 and x2x_2 belong to f−1({y})f^{-1}(\{y\}), and hence they are equal. This proves the first part.

The second is the surjectivity condition rewritten: f−1({y})f^{-1}(\{y\}) is non-empty exactly when some x∈Ax \in A satisfies f(x)=yf(x) = y.

Example 4.32 (Informal).

For a real number cc, the translation τc:R→R\tau_c : R \to R given by τc(x)=defx+c\tau_c(x) \defeq x + c is injective and surjective. If τc(x1)=τc(x2)\tau_c(x_1) = \tau_c(x_2), then x1+c=x2+cx_1 + c = x_2 + c, and adding −c-c to both sides gives x1=x2x_1 = x_2. For surjectivity, take any yy and put x=y−cx = y - c; then τc(x)=(y−c)+c=y\tau_c(x) = (y - c) + c = y, so every element of the codomain has a preimage.

Example 4.33 (Informal).

The squaring map q:R→Rq : R \to R with q(x)=defx2q(x) \defeq x^2 is neither injective nor surjective: q(−1)=q(1)q(-1) = q(1), and −1-1 lies outside its range because every square is non-negative.

Example 4.34 (Informal).

The product map m:W×W→Wm : W \times W \to W with m(a,b)=defabm(a, b) \defeq ab is surjective, since m(n,1)=nm(n, 1) = n for every whole number nn. It is not injective, since m(1,6)=m(2,3)m(1, 6) = m(2, 3) while (1,6)≠(2,3)(1, 6) \neq (2, 3) by Proposition 4.2 .

Problem 4.14.

For the finite function of the previous section, decide whether it is injective and whether it is surjective, justifying each answer from the definitions.

Problem 4.15.

Let AA be non-empty and let BB have exactly two elements. How many functions from AA to BB are not surjective?

Problem 4.16.

A function f:A→Bf : A \to B is a set of ordered pairs, so its pairs may be reversed to form the set ρ(f)=def{(y,x)∈B×A∣(x,y)∈f}\rho(f) \defeq \{(y, x) \in B \times A \mid (x, y) \in f\}. Call the set of first coordinates of a set of pairs its domain.

  1. Determine ρ\rho of the set {(1,r),(2,s),(3,r)}\{(1, r), (2, s), (3, r)\} of Problem 4.8 and of the function ff of Problem 4.9 , and say which of the two is a function.
  2. Prove that if ff is not injective, then ρ(f)\rho(f) is not a function.
  3. Prove that if ff is injective but not surjective, then ρ(f)\rho(f) is a function whose domain DD satisfies D⊊BD \subsetneq B.

Bijections

Definition 4.35 (Bijection).

A function f:A→Bf : A \to B is bijective, or a bijection, if it is both injective and surjective. A bijection from AA to BB is also called a one-to-one correspondence between them.

Surjectivity asks for at least one preimage of each point of the codomain and injectivity permits at most one, so a bijection has exactly one.

Proposition 4.36 (Unique preimages).

A function f:A→Bf : A \to B is bijective if and only if for every y∈By \in B there is a unique x∈Ax \in A with f(x)=yf(x) = y.

Discussion.

We use the two parts of Proposition 4.31 . If ff is bijective, surjectivity gives a preimage of each y∈By \in B and injectivity shows no second preimage is possible. Conversely, existence of a preimage for every yy gives surjectivity, and its uniqueness gives injectivity. The same criterion is what will let us reverse the ordered pairs of a bijection later.

Proof.

Suppose first that ff is bijective. Surjectivity supplies, for each y∈By \in B, an x∈Ax \in A with f(x)=yf(x) = y. If x1x_1 and x2x_2 both have this property, then f(x1)=f(x2)f(x_1) = f(x_2), so injectivity gives x1=x2x_1 = x_2.

Conversely, suppose every y∈By \in B has exactly one preimage. Existence makes ff surjective. If f(x1)=f(x2)f(x_1) = f(x_2), both x1x_1 and x2x_2 are preimages of the same element of BB, so uniqueness gives x1=x2x_1 = x_2 and ff is injective as well.

For finite sets, an injection from AA to BB needs at least as many elements in BB as in AA, and a surjection needs at least as many in AA as in BB; a bijection therefore forces the two to have the same number of elements. Comparing sets by functions rather than by counting is what will extend this to infinite sets, where counting is no longer available.

Example 4.37.

With A={1,2,3,4}A = \{1, 2, 3, 4\} and B={r,s,t,u}B = \{r, s, t, u\} as above, take β=def{(1,s),(2,u),(3,r),(4,t)}\beta \defeq \{(1, s), (2, u), (3, r), (4, t)\}. Each member of AA appears once as a first coordinate and each member of BB once as a second, so β:A→B\beta : A \to B is a bijection. The function ff of the previous section is neither injective nor surjective: ss is hit twice and uu is not hit at all.

Proposition 4.38 (An injection onto its range).

If f:A→Bf : A \to B is injective, then the function from AA to f(A)f(A) with the same ordered pairs is bijective.

Discussion.

The new function has the same ordered pairs as ff, so injectivity carries over unchanged, the definition mentioning only inputs and their images. For surjectivity, take yy in the new codomain f(A)f(A); the definition of the image provides an x∈Ax \in A with f(x)=yf(x) = y, which is the preimage required.

Proof.

Changing the codomain from BB to f(A)f(A) does not alter the ordered pairs, and injectivity is a condition on those alone, so the new function is injective. Every y∈f(A)y \in f(A) is f(x)f(x) for some x∈Ax \in A by the definition of the image, so it is also surjective.

Every translation is a bijection, by the example above, and so is the identity map idA\mathrm{id}_A, since each y∈Ay \in A is its own unique preimage. The squaring map and the product map are not, each having already failed one of the two conditions.

Problem 4.17.

Let f:A→Bf : A \to B be bijective and let S⊂AS \subset A. Prove that the restriction f∣S:S→f(S)f|_S : S \to f(S) is bijective.

Problem 4.18.

For each of the following, exhibit sets AA and BB, a subset C⊂AC \subset A and a function f:A→Bf : A \to B meeting the condition, or show that none exists.

  1. ff is surjective and f∣Cf|_C is surjective.
  2. ff is surjective and f∣Cf|_C is not.
  3. ff is injective and f∣Cf|_C is injective.
  4. ff is injective and f∣Cf|_C is not.

Problem 4.19.

Let f:A→Bf : A \to B be injective and let S,T⊂AS, T \subset A. Prove that f(S∩T)=f(S)∩f(T)f(S \cap T) = f(S) \cap f(T).

Problem 4.20.

Let AA, BB and CC be sets. Prove that

(x,(y,z))⟼((x,y),z)\bigl(x, (y, z)\bigr) \longmapsto \bigl((x, y), z\bigr)

is a bijection from A×(B×C)A \times (B \times C) onto (A×B)×C(A \times B) \times C, so that the two readings of a triple product agree up to that correspondence. Show also that the two sets are not in general equal, by exhibiting an element of one which is not an element of the other.

Composition

Definition 4.39 (Composition).

Let f:A→Bf : A \to B and g:B→Cg : B \to C be functions. Their composition is the function g∘f:A→Cg \circ f : A \to C given by (g∘f)(x)=defg(f(x))(g \circ f)(x) \defeq g(f(x)).

The notation is read from right to left: ff acts first and gg second. The codomain of ff must be the domain of gg, so that every value of ff can serve as an input of gg.

Example 4.40 (Informal).

For the squaring map qq and the translation τ1\tau_1 above, (q∘τ1)(x)=(x+1)2(q \circ \tau_1)(x) = (x + 1)^2 while (τ1∘q)(x)=x2+1(\tau_1 \circ q)(x) = x^2 + 1. At x=1x = 1 these take the values 44 and 22, so q∘τ1≠τ1∘qq \circ \tau_1 \neq \tau_1 \circ q by Proposition 4.19 . Composition is not commutative.

Theorem 4.41 (Associativity of composition).

Let f:A→Bf : A \to B, g:B→Cg : B \to C and h:C→Dh : C \to D be functions. Then h∘(g∘f)=(h∘g)∘fh \circ (g \circ f) = (h \circ g) \circ f.

Discussion.

By Proposition 4.19 we must check that the two functions have the same domain and agree at every input. Both are functions from AA to DD, so only the values are in question, and at an arbitrary x∈Ax \in A the definition of composition evaluates either side by applying ff, then gg, then hh.

Proof.

Both sides have domain AA. For every x∈Ax \in A, (h∘(g∘f))(x)=h(g(f(x)))=((h∘g)∘f)(x),\bigl(h \circ (g \circ f)\bigr)(x) = h\bigl(g(f(x))\bigr) = \bigl((h \circ g) \circ f\bigr)(x), so Proposition 4.19 gives the equality.

Associativity lets us write h∘g∘fh \circ g \circ f without brackets. The identity maps satisfy the identity laws one expects.

Proposition 4.42 (Identity laws).

If f:A→Bf : A \to B, then idB∘f=f\mathrm{id}_B \circ f = f and f∘idA=ff \circ \mathrm{id}_A = f.

Discussion.

Again Proposition 4.19 reduces each identity to a comparison of domains and values. Both sides of each have domain AA, and at an arbitrary x∈Ax \in A the definitions of composition and of the identity map reduce both composites to f(x)f(x).

Proof.

For every x∈Ax \in A we have (idB∘f)(x)=idB(f(x))=f(x)(\mathrm{id}_B \circ f)(x) = \mathrm{id}_B(f(x)) = f(x) and (f∘idA)(x)=f(idA(x))=f(x)(f \circ \mathrm{id}_A)(x) = f(\mathrm{id}_A(x)) = f(x). Each pair of functions has the same domain, so Proposition 4.19 applies.

Theorem 4.43 (Composition and bijections).

Let f:A→Bf : A \to B and g:B→Cg : B \to C be functions.

  1. If ff and gg are injective, then g∘fg \circ f is injective;
  2. If ff and gg are surjective, then g∘fg \circ f is surjective;
  3. If ff and gg are bijective, then g∘fg \circ f is bijective.

Discussion.

For the first part the definition of injectivity asks us to start from an equality of composite values; expanding the composition, injectivity of gg gives equality of the ff-values, and injectivity of ff then gives equality of the inputs. For the second, take an arbitrary z∈Cz \in C, choose y∈By \in B with g(y)=zg(y) = z, then choose x∈Ax \in A with f(x)=yf(x) = y, and evaluate the composite at xx. The third is the first two together with the definition of a bijection.

Proof.

Suppose (g∘f)(x1)=(g∘f)(x2)(g \circ f)(x_1) = (g \circ f)(x_2), that is, g(f(x1))=g(f(x2))g(f(x_1)) = g(f(x_2)). Injectivity of gg gives f(x1)=f(x2)f(x_1) = f(x_2), and injectivity of ff then gives x1=x2x_1 = x_2, which is the first part.

For the second, take z∈Cz \in C. Since gg is surjective, some y∈By \in B has g(y)=zg(y) = z; since ff is surjective, some x∈Ax \in A has f(x)=yf(x) = y. Then (g∘f)(x)=g(f(x))=g(y)=z(g \circ f)(x) = g(f(x)) = g(y) = z. The third part follows from the other two.

Problem 4.21.

Let f:A→Bf : A \to B and g:B→Cg : B \to C. Prove that if g∘fg \circ f is injective then ff is injective, and that if g∘fg \circ f is surjective then gg is surjective.

Problem 4.22.

Construct finite sets AA, BB, CC and functions f:A→Bf : A \to B, g:B→Cg : B \to C for which g∘fg \circ f is bijective although ff is not surjective and gg is not injective.

Inverse Functions

Definition 4.44 (Inverse function).

Let f:A→Bf : A \to B and g:B→Ag : B \to A be functions. The function gg is an inverse of ff if g∘f=idAg \circ f = \mathrm{id}_A and f∘g=idBf \circ g = \mathrm{id}_B. A function which has an inverse is called invertible.

The first equation returns each element of AA after applying ff and then gg; the second does the same for BB. The problems below examine what each equation achieves on its own.

Theorem 4.45 (Invertibility and bijections).

A function is invertible if and only if it is bijective, and when an inverse exists it is unique.

Discussion.

Suppose first that gg is an inverse of ff. To get injectivity, apply gg to an equality f(x1)=f(x2)f(x_1) = f(x_2) and use g∘f=idAg \circ f = \mathrm{id}_A; to get surjectivity, use g(y)g(y) as a preimage of an arbitrary y∈By \in B and use f∘g=idBf \circ g = \mathrm{id}_B. Conversely, Proposition 4.36 gives exactly one reversed pair (y,x)(y, x) for each y∈By \in B, so the set of reversed pairs passes the vertical line test and is a function from BB to AA; the two inverse identities are then those pairs read in the two directions. For uniqueness, two inverses are compared by sandwiching ff between them, where associativity and the identity laws collapse the composite in two ways.

Proof.

Let f:A→Bf : A \to B have an inverse g:B→Ag : B \to A. If f(x1)=f(x2)f(x_1) = f(x_2), then x1=g(f(x1))=g(f(x2))=x2x_1 = g(f(x_1)) = g(f(x_2)) = x_2, so ff is injective. Given y∈By \in B, put x=g(y)x = g(y); the second identity gives f(x)=f(g(y))=yf(x) = f(g(y)) = y, so ff is surjective.

Conversely, suppose ff is bijective and set g=def{(y,x)∈B×A∣(x,y)∈f}g \defeq \{(y, x) \in B \times A \mid (x, y) \in f\}. For each y∈By \in B, Proposition 4.36 gives a unique x∈Ax \in A with f(x)=yf(x) = y, so gg is a function from BB to AA. Reading the pairs in each direction gives g(f(x))=xg(f(x)) = x for x∈Ax \in A and f(g(y))=yf(g(y)) = y for y∈By \in B, that is, g∘f=idAg \circ f = \mathrm{id}_A and f∘g=idBf \circ g = \mathrm{id}_B.

For uniqueness, let gg and hh both be inverses of ff. Associativity and the identity laws give

g=idA∘g=(h∘f)∘g=h∘(f∘g)=h∘idB=h.g = \mathrm{id}_A \circ g = (h \circ f) \circ g = h \circ (f \circ g) = h \circ \mathrm{id}_B = h.

The unique inverse of a bijection ff is written f−1f^{-1}. The construction in the proof gives

f−1={(y,x)∈B×A∣(x,y)∈f},sof−1(y)=x  ⟺  f(x)=y.f^{-1} = \{(y, x) \in B \times A \mid (x, y) \in f\}, \qquad\text{so}\qquad f^{-1}(y) = x \iff f(x) = y.

Remark.

The symbol f−1f^{-1} also denotes the preimage of a set. The two uses are distinct: f−1(y)f^{-1}(y) is an element of AA produced by the inverse function, and exists only for a bijection, while f−1(U)f^{-1}(U) is a subset of AA and is defined for every function. For a bijection they are related by f−1({y})={f−1(y)}f^{-1}(\{y\}) = \{f^{-1}(y)\}, the preimage of a point being the singleton of its inverse image.

Example 4.46.

Reversing the pairs of the bijection β={(1,s),(2,u),(3,r),(4,t)}\beta = \{(1, s), (2, u), (3, r), (4, t)\} gives β−1={(s,1),(u,2),(r,3),(t,4)}\beta^{-1} = \{(s, 1), (u, 2), (r, 3), (t, 4)\}. Also idA−1=idA\mathrm{id}_A^{-1} = \mathrm{id}_A for any set AA.

Example 4.47 (Informal).

The translations invert one another: τc−1=τ−c\tau_c^{-1} = \tau_{-c}, since τ−c(τc(x))=x=τc(τ−c(x))\tau_{-c}(\tau_c(x)) = x = \tau_c(\tau_{-c}(x)) for every real number xx.

Proposition 4.48 (The inverse is a bijection).

If f:A→Bf : A \to B is bijective, then f−1:B→Af^{-1} : B \to A is bijective and (f−1)−1=f(f^{-1})^{-1} = f.

Discussion.

The two equations defining an inverse are symmetric in ff and f−1f^{-1}, so they say equally that ff is an inverse of f−1f^{-1}. That makes f−1f^{-1} invertible, and the theorem above turns invertibility into bijectivity; its uniqueness clause then names ff as the inverse of f−1f^{-1}.

Proof.

The identities f−1∘f=idAf^{-1} \circ f = \mathrm{id}_A and f∘f−1=idBf \circ f^{-1} = \mathrm{id}_B also say that ff is an inverse of f−1f^{-1}. So f−1f^{-1} is invertible and hence bijective by Theorem 4.45 , and uniqueness of its inverse gives (f−1)−1=f(f^{-1})^{-1} = f.

Theorem 4.49 (Inverse of a composition).

If f:A→Bf : A \to B and g:B→Cg : B \to C are bijections, then (g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1}.

Discussion.

Put k=deff−1∘g−1k \defeq f^{-1} \circ g^{-1}. Rather than compute (g∘f)−1(g \circ f)^{-1} we show directly that kk meets the definition of an inverse of g∘fg \circ f: evaluate k∘(g∘f)k \circ (g \circ f) at an arbitrary x∈Ax \in A and (g∘f)∘k(g \circ f) \circ k at an arbitrary z∈Cz \in C, where associativity and the inverse identities cancel the adjacent pairs. Since g∘fg \circ f is bijective, uniqueness of inverses then identifies kk as the one.

Proof.

Put k=deff−1∘g−1:C→Ak \defeq f^{-1} \circ g^{-1} : C \to A. For x∈Ax \in A and z∈Cz \in C,

(k∘(g∘f))(x)=f−1(g−1(g(f(x))))=x,((g∘f)∘k)(z)=g(f(f−1(g−1(z))))=z.\bigl(k \circ (g \circ f)\bigr)(x) = f^{-1}\bigl(g^{-1}(g(f(x)))\bigr) = x, \qquad \bigl((g \circ f) \circ k\bigr)(z) = g\bigl(f(f^{-1}(g^{-1}(z)))\bigr) = z.

So kk is an inverse of g∘fg \circ f, which is bijective by Theorem 4.43 , and uniqueness in Theorem 4.45 gives the formula.

Corollary 4.50 (Cancellation by a bijection).

Let f:B→Cf : B \to C be bijective and let g,h:A→Bg, h : A \to B. Then f∘g=f∘hf \circ g = f \circ h implies g=hg = h. Likewise, if f:A→Bf : A \to B is bijective and r,s:B→Cr, s : B \to C, then r∘f=s∘fr \circ f = s \circ f implies r=sr = s.

Proof.

For the first, compose on the left with f−1f^{-1} and use associativity:

g=(f−1∘f)∘g=f−1∘(f∘g)=f−1∘(f∘h)=(f−1∘f)∘h=h.\begin{aligned} g &= (f^{-1} \circ f) \circ g = f^{-1} \circ (f \circ g) \\ &= f^{-1} \circ (f \circ h) = (f^{-1} \circ f) \circ h = h. \end{aligned}

For the second, compose on the right with f−1f^{-1}:

r=r∘(f∘f−1)=(r∘f)∘f−1=(s∘f)∘f−1=s∘(f∘f−1)=s.\begin{aligned} r &= r \circ (f \circ f^{-1}) = (r \circ f) \circ f^{-1} \\ &= (s \circ f) \circ f^{-1} = s \circ (f \circ f^{-1}) = s. \end{aligned}

Problem 4.23 (Informal).

Let aa and bb be real numbers with a≠0a \neq 0. Prove that F:R→RF : R \to R given by F(x)=defax+bF(x) \defeq ax + b is bijective, and determine F−1F^{-1}.

Problem 4.24.

Let f:A→Bf : A \to B be bijective and let S⊂AS \subset A. Determine the inverse of f∣S:S→f(S)f|_S : S \to f(S).

Problem 4.25.

Let f:A→Bf : A \to B and g:B→Ag : B \to A. Prove that g∘f=idAg \circ f = \mathrm{id}_A forces ff to be injective and gg to be surjective, while f∘g=idBf \circ g = \mathrm{id}_B forces ff to be surjective and gg to be injective.

Left and Right Inverses

Definition 4.51 (Left and right inverses).

Let f:A→Bf : A \to B and g:B→Ag : B \to A be functions. The function gg is a left inverse of ff if g∘f=idAg \circ f = \mathrm{id}_A, and a right inverse of ff if f∘g=idBf \circ g = \mathrm{id}_B. When it is both, it is an inverse in the earlier sense.

The names record the side on which gg sits in the composite. The last problem above gave two implications: a left inverse makes ff injective, and a right inverse makes ff surjective. The next theorem combines them.

Theorem 4.52 (Bijections via one-sided inverses).

Let f:A→Bf : A \to B be a function. Then ff is bijective if and only if it has both a left inverse and a right inverse; when both exist they coincide, and their common value is f−1f^{-1}.

Discussion.

One direction is immediate: a bijection has f−1f^{-1}, which is a left and a right inverse by definition. For the other, the left inverse gives injectivity and the right inverse gives surjectivity, so ff is bijective and f−1f^{-1} exists. To identify the one-sided inverses with each other we evaluate the triple composite gl∘f∘grg_l \circ f \circ g_r in its two groupings: associativity and the identity laws collapse the middle pair either way, leaving gl=grg_l = g_r. The same calculation with f−1f^{-1} in place of either names their common value.

Proof.

Suppose ff has a left inverse glg_l and a right inverse grg_r. If f(x1)=f(x2)f(x_1) = f(x_2), then x1=gl(f(x1))=gl(f(x2))=x2x_1 = g_l(f(x_1)) = g_l(f(x_2)) = x_2, so ff is injective. For y∈By \in B, the element gr(y)∈Ag_r(y) \in A satisfies f(gr(y))=yf(g_r(y)) = y, so ff is surjective. Hence ff is bijective and f−1f^{-1} exists by Theorem 4.45 . Associativity and the identity laws give

gl=gl∘idB=gl∘(f∘gr)=(gl∘f)∘gr=idA∘gr=gr,\begin{aligned} g_l &= g_l \circ \mathrm{id}_B = g_l \circ (f \circ g_r) \\ &= (g_l \circ f) \circ g_r = \mathrm{id}_A \circ g_r = g_r, \end{aligned}

so the two agree; and since f−1f^{-1} is itself both a left and a right inverse of ff, the same computation identifies their common value with f−1f^{-1}.

Conversely, if ff is bijective then f−1f^{-1} is a left and a right inverse by definition.

Theorem 4.53 (Injections and left inverses).

Let AA be non-empty. A function f:A→Bf : A \to B is injective if and only if it has a left inverse.

Discussion.

If a left inverse exists, injectivity is the implication already noted. For the converse, an injective ff is a bijection onto its range by Proposition 4.38 , so it has an inverse there. On the range a left inverse is forced to be that one, since g(f(x))=xg(f(x)) = x determines gg at every point of f(A)f(A); on the rest of BB we are free, and non-emptiness of AA lets us send all of B∖f(A)B \setminus f(A) to one fixed element. That freedom is why left inverses are rarely unique. The hypothesis on AA cannot be dropped: the function from ∅\emptyset to BB is injective, but a function from BB to ∅\emptyset exists only when BB is empty.

Proof.

Suppose first that g∘f=idAg \circ f = \mathrm{id}_A. If f(x1)=f(x2)f(x_1) = f(x_2), then x1=g(f(x1))=g(f(x2))=x2x_1 = g(f(x_1)) = g(f(x_2)) = x_2, so ff is injective.

Conversely, assume ff is injective. By Proposition 4.38 the function from AA to f(A)f(A) with the same pairs is bijective; let h:f(A)→Ah : f(A) \to A be its inverse, which exists by Theorem 4.45 . Fix x0∈Ax_0 \in A, which we may do since AA is non-empty, and define g:B→Ag : B \to A by g(y)=defh(y)g(y) \defeq h(y) for y∈f(A)y \in f(A) and g(y)=defx0g(y) \defeq x_0 for y∈B∖f(A)y \in B \setminus f(A). For every x∈Ax \in A the point f(x)f(x) lies in f(A)f(A) and h(f(x))=xh(f(x)) = x, so g(f(x))=xg(f(x)) = x and g∘f=idAg \circ f = \mathrm{id}_A.

For surjections the situation is different. A right inverse forces surjectivity, as we have seen; the converse, that every surjection has a right inverse, is a claim of a different kind. A right inverse must choose, for every y∈By \in B at once, one element of f−1({y})f^{-1}(\{y\}), and when BB is infinite nothing among our axioms says such a simultaneous choice can be made. That is what the axiom of choice provides.

Problem 4.26.

Let AA be non-empty and f:A→Bf : A \to B injective. Show that any two left inverses of ff agree on f(A)f(A). For the inclusion map from {1,2}\{1, 2\} to {1,2,3}\{1, 2, 3\}, exhibit two left inverses and say where they differ.

General Cartesian Products

With functions in hand we can take the product of an arbitrary collection of sets, not just two. First, the informal indexed family of the earlier section can now be said properly.

Remark.

An indexed family {Aα}α∈I\{A_\alpha\}_{\alpha \in I} of subsets of a set AA is formally a function φ:I→P(A)\varphi : I \to \mathcal{P}(A), with Aα=defφ(α)A_\alpha \defeq \varphi(\alpha). It is the function itself, not its range: the range is the plain set of members, which forgets the labels, as in the earlier example, while φ\varphi remembers which member sits at which index. Since φ\varphi is a subset of I×P(A)I \times \mathcal{P}(A), it is a set by the axioms of the last chapter, and that is why we ask that all the AαA_\alpha be subsets of one set AA.

Definition 4.54 (General Cartesian product).

Let II be a set and let {Aα}α∈I\{A_\alpha\}_{\alpha \in I} be an indexed family of sets, all of them subsets of a given set. The Cartesian product of the family is

∏α∈IAα=def{f∈P(I×⋃α∈IAα)  ∣  f is a function, dom⁡f=I, ∀α∈I (f(α)∈Aα)}.\prod_{\alpha \in I} A_\alpha \defeq \Bigl\{ f \in \mathcal{P}\Bigl(I \times \bigcup_{\alpha \in I} A_\alpha\Bigr) \;\Big|\; f \text{ is a function},\ \operatorname{dom} f = I,\ \forall \alpha \in I\,\bigl(f(\alpha) \in A_\alpha\bigr) \Bigr\}.

The notation is easier to read once we recall that a function from II to ⋃α∈IAα\bigcup_{\alpha \in I} A_\alpha is by Definition 4.15 a subset of I×⋃α∈IAαI \times \bigcup_{\alpha \in I} A_\alpha. So every candidate lies in the power set displayed above, a set we are already holding, and comprehension carves the product out of it. An element of the product picks one member from each AαA_\alpha, all at once.

Example 4.55.

The definition subsumes the earlier one. A function ff defined on the two-element set {0,1}\{0, 1\} is determined by the pair of values (f(0),f(1))\bigl(f(0), f(1)\bigr), so the functions with f(0)∈Af(0) \in A and f(1)∈Bf(1) \in B correspond to the pairs (a,b)(a, b) with a∈Aa \in A and b∈Bb \in B. This identifies A×BA \times B with the general product for I={0,1}I = \{0, 1\}, A0=AA_0 = A and A1=BA_1 = B, and we will not distinguish between the two readings from here on.

Definition 4.56 (Cartesian power).

Let II and AA be sets. The Cartesian power AIA^I is the product of the constant family,

AI=def∏α∈IA={f∈P(I×A)∣f is a function with dom⁡f=I}.A^I \defeq \prod_{\alpha \in I} A = \{f \in \mathcal{P}(I \times A) \mid f \text{ is a function with } \operatorname{dom} f = I\}.

Problem 4.27.

Let AA, BB and CC be sets, with BAB^A the Cartesian power of Definition 4.56 .

  1. Prove that if A⊂BA \subset B, then AC⊂BCA^C \subset B^C.
  2. Prove that ∅A=∅\emptyset^A = \emptyset for every non-empty AA, and that B∅={∅}B^{\emptyset} = \{\emptyset\} for every BB.
  3. Prove that AB∩AC=∅A^B \cap A^C = \emptyset whenever B≠CB \neq C, and deduce that {1,2}{1,2}\{1, 2\}^{\{1,2\}} and {1,2}{1,2,3}\{1, 2\}^{\{1,2,3\}} are disjoint.

Problem 4.28.

Let SS be a set. For each A⊂SA \subset S, the characteristic function of AA is the function χA:S→{0,1}\chi_A : S \to \{0, 1\} with χA(x)=def1\chi_A(x) \defeq 1 for x∈Ax \in A and χA(x)=def0\chi_A(x) \defeq 0 for x∉Ax \notin A; so χA(1)=χA(2)=χA(4)=1\chi_A(1) = \chi_A(2) = \chi_A(4) = 1 and χA(3)=0\chi_A(3) = 0 when S={1,2,3,4}S = \{1, 2, 3, 4\} and A={1,2,4}A = \{1, 2, 4\}.

  1. Give the formulas for χ∅\chi_{\emptyset} and χS\chi_S.
  2. Express χA‾\chi_{\overline{A}} in terms of χA\chi_A, where A‾\overline{A} is the complement of AA in SS.
  3. Prove that A=BA = B if and only if χA=χB\chi_A = \chi_B, for all A,B⊂SA, B \subset S.
  4. Prove that χA∩B(x)=χA(x) χB(x)\chi_{A \cap B}(x) = \chi_A(x)\,\chi_B(x) and χA∪B(x)=χA(x)+χB(x)−χA(x) χB(x)\chi_{A \cup B}(x) = \chi_A(x) + \chi_B(x) - \chi_A(x)\,\chi_B(x) for every x∈Sx \in S.

Problem 4.29.

Keep the characteristic functions of the previous problem.

  1. Prove that every function u:S→{0,1}u : S \to \{0, 1\} is χA\chi_A for exactly one A⊂SA \subset S.
  2. Suppose SS has nn elements. Determine the number of elements of {0,1}S\{0, 1\}^S, and use the first part to count P(S)\mathcal{P}(S).

Problem 4.30.

Let SS be a set.

  1. Prove that no function g:S→P(S)g : S \to \mathcal{P}(S) is surjective.
  2. Deduce that there is no bijection from SS to P(S)\mathcal{P}(S), and decide whether there can be a surjection from P(S)\mathcal{P}(S) to SS.

The product of two non-empty sets is non-empty, witnessed by any pair (x,y)(x, y) with x∈Ax \in A and y∈By \in B, and the same argument covers three sets, four, and any collection we can write out in full. Once II is infinite the argument fails for the reason we met in the last chapter: we have no way to string an unspecified number of such choices together. Closing that gap takes another axiom.

The Axiom of Choice

Axiom 4.57 (Choice).

Let II be a non-empty set and let {Aα}α∈I\{A_\alpha\}_{\alpha \in I} be an indexed family of sets with Aα≠∅A_\alpha \neq \emptyset for every α∈I\alpha \in I. Then there exists a function f:I→⋃α∈IAαf : I \to \bigcup_{\alpha \in I} A_\alpha with dom⁡f=I\operatorname{dom} f = I and f(α)∈Aαf(\alpha) \in A_\alpha for every α∈I\alpha \in I. Equivalently, a non-empty family of non-empty sets has non-empty product.

Such an ff is a choice function for the family. The point is the order of the quantifiers: the hypothesis grants each set an element of its own, while the conclusion assembles one selection from every set into a single function.

Remark.

The axiom is independent of the others, in the sense that neither it nor its negation follows from them. In sets carrying some structure a distinguished element can often be picked out constructively, and no axiom is needed; the axiom supplies one in full generality, where no rule for choosing is available. Mathematicians find it rather less comfortable than the rest, so it is good practice, which we will follow, to say plainly whenever it is used.

Theorem 4.58 (Every surjection has a right inverse).

Let f:A→Bf : A \to B be surjective. Then ff has a right inverse g:B→Ag : B \to A.

Discussion.

Surjectivity says, through Proposition 4.31 , that every point preimage f−1({y})f^{-1}(\{y\}) is non-empty. That is exactly the hypothesis of the axiom of choice applied to the family of point preimages indexed by BB, and what the axiom returns is a function φ\varphi picking one element out of each. The union of the point preimages is AA, and φ(y)∈f−1({y})\varphi(y) \in f^{-1}(\{y\}) says precisely that f(φ(y))=yf(\varphi(y)) = y, which is the right-inverse identity. The axiom is needed here: each preimage alone has an element, and the theorem needs one choice per preimage assembled into a single map.

Proof.

If BB is empty then so is AA, since every element of AA would have an image in BB, and the empty function is a right inverse; so assume BB is non-empty. For every y∈By \in B the set f−1({y})f^{-1}(\{y\}) is non-empty by Proposition 4.31 . Applying the axiom of choice to the family {f−1({y})}y∈B\{f^{-1}(\{y\})\}_{y \in B} gives a function φ\varphi from BB to ⋃y∈Bf−1({y})\bigcup_{y \in B} f^{-1}(\{y\}) with φ(y)∈f−1({y})\varphi(y) \in f^{-1}(\{y\}) for every y∈By \in B. Each point preimage is a subset of AA, so that union is AA and φ:B→A\varphi : B \to A. Finally φ(y)∈f−1({y})\varphi(y) \in f^{-1}(\{y\}) is equivalent to f(φ(y))=yf(\varphi(y)) = y, so f∘φ=idBf \circ \varphi = \mathrm{id}_B and φ\varphi is a right inverse of ff.

Corollary 4.59 (Surjections and right inverses).

A function f:A→Bf : A \to B is surjective if and only if it has a right inverse.

Proof.

One direction is the theorem. For the other, a right inverse gg gives f(g(y))=yf(g(y)) = y for every y∈By \in B, so g(y)g(y) is a preimage of yy and ff is surjective.

Problem 4.31.

Let I={1,2,3}I = \{1, 2, 3\} and let {Mi}i∈I\{M_i\}_{i \in I} be a family of non-empty sets. Show that ∏i∈IMi\prod_{i \in I} M_i is non-empty without appealing to the axiom of choice. Where would the argument break down for an index set that cannot be written out in full?

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 4.1.

Let S={0,1}S = \{0, 1\} and T={1,2}T = \{1, 2\}.

The only pair belonging to both S×TS \times T and T×ST \times S is:

answer one of these

(S∩T)×(S∪T)(S \cap T) \times (S \cup T) is:

answer one of these

Exercise 4.2.

Write aa and bb for the statements x∈Ax \in A and x∈Bx \in B, and cc and dd for y∈Cy \in C and y∈Dy \in D. Give the condition on the pair (x,y)(x, y) for membership in each set below.

(A∪B)×(C∪D)(A \cup B) \times (C \cup D)

answer formula

(A×C)∪(B×D)(A \times C) \cup (B \times D)

answer formula

The two sets are different. Place one pair (x,y)(x, y) that separates them.

answer assignment
a b c d

Which two products does the second set leave out?

answer one of these

Now the condition of the first part again, written as a disjunction of conjunctions.

answer formula

Exercise 4.3.

Let A1={1,2,3,4}A_1 = \{1, 2, 3, 4\}, A2={0,1,2}A_2 = \{0, 1, 2\} and A3={−1,0,1}A_3 = \{-1, 0, 1\}, with I={1,2,3}I = \{1, 2, 3\}, and take U={−1,0,1,2,3,4,5}U = \{-1, 0, 1, 2, 3, 4, 5\} as the ambient set.

⋃i∈IAi‾\bigcup_{i \in I} \overline{A_i} is:

answer one of these

⋂i∈IAi‾\bigcap_{i \in I} \overline{A_i} is:

answer one of these

Exercise 4.4.

Let nn be a positive whole number, let I={1,2,…,n}I = \{1, 2, \ldots, n\}, and let {Ai}i∈I\{A_i\}_{i \in I} be a family with Ai⊂AjA_i \subset A_j whenever i⩽ji \leqslant j.

⋃i∈IAi\bigcup_{i \in I} A_i and ⋂i∈IAi\bigcap_{i \in I} A_i are:

answer one of these

Exercise 4.5.

A family {Ai}i∈I\{A_i\}_{i \in I} is disjoint if ⋂i∈IAi=∅\bigcap_{i \in I} A_i = \emptyset, and pairwise disjoint if Ai∩Aj=∅A_i \cap A_j = \emptyset whenever i≠ji \neq j.

The family A1={1,2,3,4}A_1 = \{1, 2, 3, 4\}, A2={3,4,5,6}A_2 = \{3, 4, 5, 6\}, A3={1,6,7}A_3 = \{1, 6, 7\} is:

answer one of these

For families {B1,B2,B3}\{B_1, B_2, B_3\} of three sets:

answer one of these

Exercise 4.6.

Counting.

SS and TT each have three elements. The number of functions from SS to TT is:

answer one of these

SS has three elements and TT has two. The number of injections from SS to TT is:

answer one of these

And the number of surjections from SS to TT is:

answer one of these

With those same SS and TT, the number of injections from TT to SS is:

answer one of these

Exercise 4.7.

Cartesian powers.

The number of elements of {1,2}{1,2}\{1, 2\}^{\{1, 2\}} is:

answer one of these

For every non-empty set AA, the power ∅A\emptyset^A is:

answer one of these

For every set BB, the power B∅B^{\emptyset} is:

answer one of these

Exercise 4.8.

Take the real numbers on trust and let q:R→Rq : R \to R be given by q(x)=defx2q(x) \defeq x^2.

q({−2,−1,0,1})q(\{-2, -1, 0, 1\}) is:

answer one of these

q−1({1,4})q^{-1}(\{1, 4\}) is:

answer one of these

q−1(q({0,1}))q^{-1}\bigl(q(\{0, 1\})\bigr) is:

answer one of these

A function f:A→Bf : A \to B satisfies f−1(f(S))=Sf^{-1}(f(S)) = S for every S⊂AS \subset A exactly when it is:

answer one of these

And f(f−1(U))=Uf(f^{-1}(U)) = U holds for every U⊂BU \subset B exactly when ff is:

answer one of these

Exercise 4.9.

Injective, surjective, both or neither.

g:{1,2,3}→{−2,5,6}g : \{1, 2, 3\} \to \{-2, 5, 6\} given by g=def{(1,5),(2,−2),(3,6)}g \defeq \{(1, 5), (2, -2), (3, 6)\} is:

answer one of these

h:{1,2,3}→{−2,5,6}h : \{1, 2, 3\} \to \{-2, 5, 6\} given by h=def{(3,5),(2,−2),(1,5)}h \defeq \{(3, 5), (2, -2), (1, 5)\} is:

answer one of these

The inclusion map ι:S→T\iota : S \to T of a set SS with S⊊TS \subsetneq T is:

answer one of these

A constant map c:A→Bc : A \to B, where AA and BB both have at least two elements, is:

answer one of these

The function from ∅\emptyset to a non-empty BB is:

answer one of these

Exercise 4.10.

Keeping the real numbers, let qq, τ\tau and NN be the maps R→RR \to R given by q(x)=defx2q(x) \defeq x^2, τ(x)=defx+1\tau(x) \defeq x + 1 and N(x)=def∣x∣N(x) \defeq |x|, where ∣x∣|x| is xx when x⩾0x \geqslant 0 and −x-x otherwise.

The function x↦∣x+1∣x \mapsto |x + 1| is:

answer one of these

The composites N∘qN \circ q and q∘Nq \circ N are:

answer one of these

The function x↦((x+1)2+1)2x \mapsto \bigl((x + 1)^2 + 1\bigr)^2 is:

answer one of these

Exercise 4.11.

Inverses, one-sided and two-sided.

Let f:A→Bf : A \to B and g:B→Cg : B \to C be bijections. The composite g−1∘f−1g^{-1} \circ f^{-1} is defined:

answer one of these

A function with a left inverse but no right inverse is:

answer one of these

The statement that cannot be proved without the axiom of choice is:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker a universe of objects and the algebra of sets. This one adds the constructions of this chapter: the ordered pair, the product, the indexed family and the map.

A pair is typed as it is written, (a, b), and longer tuples nest to the left exactly as Definition 4.4 says, so (a, b, c) is ((a, b), c). The product is ×, typed \x, and it binds like ∩. A map is written f : Obj → Obj and applied by juxtaposition, f x; the domain and codomain of Definition 4.15 are carried by the statement being proved rather than by the arrow.

One piece of the last chapter is written out here for the first time as well: a set listed by its members, {x} and {x, y}. Its membership criterion is the equation the pairing axiom gives, so y ∈ {x} is y = x, and the later exercises use it to name a set with a single point in it.

Ordered pairs

The pair itself is opaque: the checker knows nothing about {{a},{a,b}}\bigl\{\{a\}, \{a, b\}\bigr\}, only what Proposition 4.2 established about it. That proposition is Set.pair_eq, a biconditional, so .mp reads coordinates off an equality of pairs and .mpr builds one.

Example.

The forward direction turns the equality into a conjunction; the first half of it is the first coordinate.

lean worked
1example (a b c d : Obj) (h : (a, b) = (c, d)) : a = c := by
verified
goalGoals accomplished.

Exercise 4.12.

Corollary 4.3 , in one direction.

lean proof
1example (a b : Obj) : (a, b) = (b, a) → a = b := by
goala b : Obj ⊢ (a, b) = (b, a) → a = b

Exercise 4.13.

Coordinates read off one pair and put back into another.

lean proof
1example (a b c d : Obj) : (a, b) = (c, d) → (b, a) = (d, c) := by
goala b c d : Obj ⊢ (a, b) = (c, d) → (b, a) = (d, c)

Exercise 4.14.

A triple is a pair of a pair, so its middle coordinate takes two steps to reach.

lean proof
1example (a b c x y z : Obj) : (a, b, c) = (x, y, z) → b = y := by
goala b c x y z : Obj ⊢ ((a, b), c) = ((x, y), z) → b = y

Products

Membership in a product is the dictionary line of the chapter: (x, y) ∈ A × B is x ∈ A ∧ y ∈ B, in the way that x ∈ A ∩ B was a conjunction on the last sheet, so ⟨_, _⟩ builds one and .left and .right take one apart.

Example.

Two memberships, one pair.

lean worked
1example (A B x y : Obj) (hx : x ∈ A) (hy : y ∈ B) : (x, y) ∈ A × B := by
verified
goalGoals accomplished.

An arbitrary object is not written as a pair, and for it the criterion says the rest of Definition 4.6 : p ∈ A × B is

∃ a, ∃ b, p = (a, b) ∧ a ∈ A ∧ b ∈ B

so a membership hypothesis about an unknown pp hands over two coordinates, an equation and two memberships. obtain takes all five at once, and the equation is what rw then uses to turn pp into a pair everywhere it is needed.

Example.

Once pp has been rewritten, the goal is about a pair and the criterion applies to it.

lean worked
1example (A B C p : Obj) (h : p ∈ A × B) (hbc : B ⊆ C) : p ∈ A × C := by
verified
goalGoals accomplished.

Exercise 4.15.

The coordinates change places and so do the factors.

lean proof
1example (A B x y : Obj) : (x, y) ∈ A × B → (y, x) ∈ B × A := by
goalA B x y : Obj ⊢ (x, y) ∈ A × B → (y, x) ∈ B × A

Exercise 4.16.

Nothing can serve as a second coordinate.

lean proof
1example (A : Obj) : A × ∅ = ∅ := by
goalA : Obj ⊢ A × ∅ = ∅

Exercise 4.17.

The product respects inclusion in each factor.

lean proof
1example (A B C D : Obj) : A ⊆ B → C ⊆ D → A × C ⊆ B × D := by
goalA B C D : Obj ⊢ A ⊆ B → C ⊆ D → A × C ⊆ B × D

Exercise 4.18.

Products distribute over intersections.

lean proof
1example (A B C : Obj) : A × (B ∩ C) = (A × B) ∩ (A × C) := by
goalA B C : Obj ⊢ A × (B ∩ C) = (A × B) ∩ (A × C)

Exercise 4.19.

And over unions.

lean proof
1example (A B C : Obj) : A × (B ∪ C) = (A × B) ∪ (A × C) := by
goalA B C : Obj ⊢ A × (B ∪ C) = A × B ∪ A × C

Exercise 4.20.

An intersection of products is a product of intersections.

lean proof
1example (A B C D : Obj) : (A × B) ∩ (C × D) = (A ∩ C) × (B ∩ D) := by
goalA B C D : Obj ⊢ (A × B) ∩ (C × D) = (A ∩ C) × (B ∩ D)

Exercise 4.21.

The inclusion that never fails.

lean proof
1example (A B C D : Obj) : (A × C) ∪ (B × D) ⊆ (A ∪ B) × (C ∪ D) := by
goalA B C D : Obj ⊢ A × C ∪ B × D ⊆ (A ∪ B) × (C ∪ D)

Exercise 4.22.

The equality the last exercise fell short of, with the two mixed products restored.

lean proof
1example (A B C D : Obj) :2    (A ∪ B) × (C ∪ D) = ((A × C) ∪ (A × D)) ∪ ((B × C) ∪ (B × D)) := by
goalA B C D : Obj ⊢ (A ∪ B) × (C ∪ D) = (A × C ∪ A × D) ∪ (B × C ∪ B × D)

Indexed families

A family {Bi}i∈I\{B_i\}_{i \in I} is a map from indices to sets, written B : Obj → Obj, and its union and intersection are ⋃ i ∈ I, B i and ⋂ i ∈ I, B i, typed \bigcup and \bigcap. Their criteria are the two the chapter gave: membership in the union is ∃ i, i ∈ I ∧ x ∈ B i, and membership in the intersection is ∀ i, i ∈ I → x ∈ B i. So an intersection is used by applying it to an index and a proof that the index belongs to II, and a union is built with use.

Example.

The intersection applied at one index.

lean worked
1example (I k : Obj) (B : Obj → Obj) (hk : k ∈ I) : (⋂ i ∈ I, B i) ⊆ B k := by
verified
goalGoals accomplished.

Example.

use supplies the index; what remains is that the index is one of ours and that xx lies in its set.

lean worked
1example (I k : Obj) (B : Obj → Obj) (hk : k ∈ I) : B k ⊆ ⋃ i ∈ I, B i := by
verified
goalGoals accomplished.

An object outside an intersection misses some set, but we are not given its index: all we hold is that no index can be a witness. Getting the index out is the classical step, and by_contra twice is what does it.

Example.

The first by_contra denies the index we want; the second turns that denial into membership at every index, which contradicts the hypothesis.

lean worked
1example (I x : Obj) (B : Obj → Obj) (h : x ∉ ⋂ i ∈ I, B i) :2    ∃ i : Obj, i ∈ I ∧ x ∉ B i := by
verified
goalGoals accomplished.

Exercise 4.23.

A set lies inside the intersection exactly when it lies inside every member.

lean proof
1example (I A : Obj) (B : Obj → Obj) :2    A ⊆ (⋂ i ∈ I, B i) ↔ ∀ i : Obj, i ∈ I → A ⊆ B i := by
goalI A : Obj B : Obj → Obj ⊢ A ⊆ (⋂ i ∈ I, B i) ↔ (∀ (i : Obj), i ∈ I → A ⊆ B i)

Exercise 4.24.

And the union lies inside a set exactly when every member does.

lean proof
1example (I A : Obj) (B : Obj → Obj) :2    (⋃ i ∈ I, B i) ⊆ A ↔ ∀ i : Obj, i ∈ I → B i ⊆ A := by
goalI A : Obj B : Obj → Obj ⊢ (⋃ i ∈ I, B i) ⊆ A ↔ (∀ (i : Obj), i ∈ I → B i ⊆ A)

Exercise 4.25.

The first part of Proposition 4.13 .

lean proof
1example (I A : Obj) (B : Obj → Obj) :2    A \ (⋂ i ∈ I, B i) = ⋃ i ∈ I, (A \ B i) := by
goalI A : Obj B : Obj → Obj ⊢ A \ (⋂ i ∈ I, B i) = (⋃ i ∈ I, A \ B i)

Exercise 4.26.

The second part. The hypothesis hj is the non-emptiness of II, and one of the two inclusions cannot be had without it.

lean proof
1example (I A j : Obj) (B : Obj → Obj) (hj : j ∈ I) :2    A \ (⋃ i ∈ I, B i) = ⋂ i ∈ I, (A \ B i) := by
goalI A j : Obj B : Obj → Obj hj : j ∈ I ⊢ A \ (⋃ i ∈ I, B i) = (⋂ i ∈ I, A \ B i)

Exercise 4.27.

The inclusion between the two mixed families, in the direction that holds.

lean proof
1example (I J : Obj) (A : Obj → Obj → Obj) :2    (⋃ i ∈ I, ⋂ j ∈ J, A i j) ⊆ (⋂ j ∈ J, ⋃ i ∈ I, A i j) := by
goalI J : Obj A : Obj → Obj → Obj ⊢ (⋃ i ∈ I, ⋂ j ∈ J, A i j) ⊆ (⋂ j ∈ J, ⋃ i ∈ I, A i j)

Maps

For a map f : Obj → Obj, the image and preimage of a set are f '' S and f ⁻¹' U, typed as two apostrophes and as \preimage. Their criteria are those of Definition 4.23 and Definition 4.24 : y ∈ f '' S is ∃ x, x ∈ S ∧ f x = y, and x ∈ f ⁻¹' U is f x ∈ U. Composition is g ∘ f, typed \o, and (g ∘ f) x is g (f x). Finally Injective f and Surjective f are the two conditions of Definition 4.30 and Definition 4.28 , ∀ x y, f x = f y → x = y and ∀ y, ∃ x, f x = y, so both are opened with intro.

Example.

The witness is the point itself, and the equation it has to satisfy is an identity.

lean worked
1example (f : Obj → Obj) (S x : Obj) (hx : x ∈ S) : f x ∈ f '' S := by
verified
goalGoals accomplished.

The preimage passes membership straight through to fxf x, which is why it preserves the operations: both sides of each law are the same statement about fxf x.

Example.

Part three of Proposition 4.27 , which follows from the criterion.

lean worked
1example (f : Obj → Obj) (U V : Obj) : f ⁻¹' (U ∩ V) = f ⁻¹' U ∩ f ⁻¹' V := by
verified
goalGoals accomplished.

Exercise 4.28.

Images preserve unions.

lean proof
1example (f : Obj → Obj) (S T : Obj) : f '' (S ∪ T) = f '' S ∪ f '' T := by
goalf : Obj → Obj S T : Obj ⊢ f '' (S ∪ T) = f '' S ∪ f '' T

Exercise 4.29.

Every point of SS is sent into the image of SS.

lean proof
1example (f : Obj → Obj) (S : Obj) : S ⊆ f ⁻¹' (f '' S) := by
goalf : Obj → Obj S : Obj ⊢ S ⊆ f ⁻¹' (f '' S)

Exercise 4.30.

And the image of a preimage is no bigger than the set it came from.

lean proof
1example (f : Obj → Obj) (U : Obj) : f '' (f ⁻¹' U) ⊆ U := by
goalf : Obj → Obj U : Obj ⊢ f '' (f ⁻¹' U) ⊆ U

Exercise 4.31.

The first part of Theorem 4.43 .

lean proof
1example (f g : Obj → Obj) :2    Injective f → Injective g → Injective (g ∘ f) := by
goalf g : Obj → Obj ⊢ Injective f → Injective g → Injective (g ∘ f)

Exercise 4.32.

Its second part.

lean proof
1example (f g : Obj → Obj) :2    Surjective f → Surjective g → Surjective (g ∘ f) := by
goalf g : Obj → Obj ⊢ Surjective f → Surjective g → Surjective (g ∘ f)

Exercise 4.33.

Only the first map need be injective for the composite to be.

lean proof
1example (f g : Obj → Obj) : Injective (g ∘ f) → Injective f := by
goalf g : Obj → Obj ⊢ Injective (g ∘ f) → Injective f

Exercise 4.34.

And only the second need be surjective.

lean proof
1example (f g : Obj → Obj) : Surjective (g ∘ f) → Surjective g := by
goalf g : Obj → Obj ⊢ Surjective (g ∘ f) → Surjective g

Exercise 4.35.

A left inverse, written out pointwise, makes ff injective.

lean proof
1example (f g : Obj → Obj) : (∀ x : Obj, g (f x) = x) → Injective f := by
goalf g : Obj → Obj ⊢ (∀ (x : Obj), g (f x) = x) → Injective f

Exercise 4.36.

A right inverse makes it surjective.

lean proof
1example (f g : Obj → Obj) : (∀ y : Obj, f (g y) = y) → Surjective f := by
goalf g : Obj → Obj ⊢ (∀ (y : Obj), f (g y) = y) → Surjective f

Exercise 4.37.

Images preserve intersections exactly when the map is injective.

lean proof
1example (f : Obj → Obj) (S T : Obj) :2    Injective f → f '' (S ∩ T) = f '' S ∩ f '' T := by
goalf : Obj → Obj S T : Obj ⊢ Injective f → f '' (S ∩ T) = f '' S ∩ f '' T

Exercise 4.38.

The inclusion two exercises above becomes an equality for an injective map.

lean proof
1example (f : Obj → Obj) (S : Obj) : Injective f → f ⁻¹' (f '' S) = S := by
goalf : Obj → Obj S : Obj ⊢ Injective f → f ⁻¹' (f '' S) = S

Exercise 4.39.

And the other inclusion becomes an equality for a surjective one.

lean proof
1example (f : Obj → Obj) (U : Obj) : Surjective f → f '' (f ⁻¹' U) = U := by
goalf : Obj → Obj U : Obj ⊢ Surjective f → f '' (f ⁻¹' U) = U

Exercise 4.40.

An image loses no more than the part removed.

lean proof
1example (f : Obj → Obj) (A S : Obj) : f '' A \ f '' S ⊆ f '' (A \ S) := by
goalf : Obj → Obj A S : Obj ⊢ f '' A \ f '' S ⊆ f '' (A \ S)

Exercise 4.41.

Injectivity closes the gap.

lean proof
1example (f : Obj → Obj) (A S : Obj) :2    Injective f → f '' (A \ S) = f '' A \ f '' S := by
goalf : Obj → Obj A S : Obj ⊢ Injective f → f '' (A \ S) = f '' A \ f '' S

Exercise 4.42.

The converse of the exercise three above: only an injection returns every set unchanged.

lean proof
1example (f : Obj → Obj) : (∀ S : Obj, f ⁻¹' (f '' S) = S) → Injective f := by
goalf : Obj → Obj ⊢ (∀ (S : Obj), f ⁻¹' (f '' S) = S) → Injective f

Exercise 4.43.

And nothing but a surjection.

lean proof
1example (f : Obj → Obj) : (∀ U : Obj, f '' (f ⁻¹' U) = U) → Surjective f := by
goalf : Obj → Obj ⊢ (∀ (U : Obj), f '' (f ⁻¹' U) = U) → Surjective f

A map f:A→Bf : A \to B carries two maps between the power sets with it, F:P(A)→P(B)F : \mathcal{P}(A) \to \mathcal{P}(B) sending SS to f(S)f(S) and G:P(B)→P(A)G : \mathcal{P}(B) \to \mathcal{P}(A) sending UU to f−1(U)f^{-1}(U). The checker has no power set to quantify over, so each of the four statements below says what injectivity or surjectivity of FF or of GG amounts to at the level of the sets themselves.

Exercise 4.44.

ff is injective exactly when FF is.

lean proof
1example (f : Obj → Obj) : Injective f ↔ ∀ S T : Obj, f '' S = f '' T → S = T := by
goalf : Obj → Obj ⊢ Injective f ↔ (∀ (S : Obj), ∀ (T : Obj), f '' S = f '' T → S = T)

Exercise 4.45.

And surjective exactly when FF is.

lean proof
1example (f : Obj → Obj) : Surjective f ↔ ∀ U : Obj, ∃ S : Obj, f '' S = U := by
goalf : Obj → Obj ⊢ Surjective f ↔ (∀ (U : Obj), ∃ S : Obj, f '' S = U)

Exercise 4.46.

The other pairing: ff is injective exactly when GG is surjective.

lean proof
1example (f : Obj → Obj) : Injective f ↔ ∀ S : Obj, ∃ U : Obj, f ⁻¹' U = S := by
goalf : Obj → Obj ⊢ Injective f ↔ (∀ (S : Obj), ∃ U : Obj, f ⁻¹' U = S)

Exercise 4.47.

And surjective exactly when GG is injective.

lean proof
1example (f : Obj → Obj) :2    Surjective f ↔ ∀ U V : Obj, f ⁻¹' U = f ⁻¹' V → U = V := by
goalf : Obj → Obj ⊢ Surjective f ↔ (∀ (U : Obj), ∀ (V : Obj), f ⁻¹' U = f ⁻¹' V → U = V)
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 5

Natural Numbers

Taught

Natural Numbers

The Set of Natural Numbers

The starting point of our journey shall be the counting numbers, 1,2,31, 2, 3 and so on. We are all convinced that such a collection exists, and yet a little reflection leads quickly to thoughtfulness. Do not some cosmological theories hold that our universe is finite? If so, and if every elementary particle occupies a non-vanishing, indivisible volume, must not the number of particles be finite? Where then is room for this obviously infinite set? Or, much more primitively, how does one so much as name

10(10(1010))?10^{\left(10^{\left(10^{10}\right)}\right)} \quad ?

Following preliminary work by Dedekind, it was Peano who in 1889 codified our notion of the counting numbers as a successive progression from an origin. Rather than say what a number is, he left the first number and the successor rule undefined, and asked instead which conditions would force the resulting system to hold exactly the objects we want. We follow him, taking the distinguished first element to be 00.

The Axiom of Infinity

At the close of the last chapter we watched the passage from AA to A∪{A}A \cup \{A\} generate

∅,{∅},{∅,{∅}},{∅,{∅},{∅,{∅}}},…\emptyset, \quad \{\emptyset\}, \quad \bigl\{\emptyset, \{\emptyset\}\bigr\}, \quad \Bigl\{\emptyset, \{\emptyset\}, \bigl\{\emptyset, \{\emptyset\}\bigr\}\Bigr\}, \quad \ldots

and noted that our axioms build each of these but no set holding all of them at once. To close the gap we name the property such a set would have. Throughout we write s(x)=defx∪{x}s(x) \defeq x \cup \{x\} and call it the successor of xx.

Definition 5.1 (Inductive set).

A set II is inductive if ∅∈I\emptyset \in I and s(x)∈Is(x) \in I for every x∈Ix \in I.

Axiom 5.2 (Infinity).

An inductive set exists: ∃I (∅∈I∧∀x (x∈I  ⟹  x∪{x}∈I))\exists I\,\bigl(\emptyset \in I \land \forall x\,(x \in I \implies x \cup \{x\} \in I)\bigr).

The notation x∪{x}x \cup \{x\} is meaningful by the pairing and union axioms. Note that what it asserts is also new: every earlier axiom builds a set from sets already held, and none guarantees the existence of a set with infinitely many members. An inductive set may be far larger than the chain above, holding all manner of things besides; in our case we want the chain, so we take the smallest inductive set there is.

Definition 5.3 (The natural numbers).

Let II be an inductive set. We write N0\mathbb{N}_0 for the intersection of all inductive subsets of II,

N0=def⋂{J∈P(I)  ∣  J is inductive},\mathbb{N}_0 \defeq \bigcap \bigl\{J \in \mathcal{P}(I) \;\big|\; J \text{ is inductive}\bigr\},

and N=defN0∖{∅}\mathbb{N} \defeq \mathbb{N}_0 \setminus \{\emptyset\}. The elements of N\mathbb{N} are the natural numbers.

The collection being intersected is a set by comprehension applied to P(I)\mathcal{P}(I), and it is non-empty, since II is one of its members, so its intersection is defined. Writing 0=def∅0 \defeq \emptyset, 1=defs(0)1 \defeq s(0), 2=defs(1)2 \defeq s(1) and so on, we have

N0=N∪{0}={0,1,2,…},N={1,2,3,…}.\mathbb{N}_0 = \mathbb{N} \cup \{0\} = \{0, 1, 2, \ldots\}, \qquad \mathbb{N} = \{1, 2, 3, \ldots\}.

Remark (Where to start).

Whether 00 counts as a natural number is a matter of convention rather than of mathematics, and both choices are in use. We keep 11 as the first natural number, which is the older habit and the one that makes “natural number” mean “counting number”, and carry the zero explicitly when we need it. Peano’s system needs a distinguished element with no predecessor, so it is N0\mathbb{N}_0 rather than N\mathbb{N} that the axioms below describe.

Proposition 5.4 (Zero belongs to N0\mathbb{N}_0).

0∈N00 \in \mathbb{N}_0.

Discussion.

Membership in N0\mathbb{N}_0 is membership in every inductive subset of II, so we take an arbitrary such subset and check what being inductive says about it. The first clause of that definition puts ∅\emptyset in it, and since the subset was arbitrary the conclusion follows for the intersection.

Proof.

Let JJ be an arbitrary inductive subset of II. Then ∅∈J\emptyset \in J by the definition of an inductive set. Since JJ was arbitrary, ∅\emptyset belongs to every inductive subset of II, and so 0=∅∈N00 = \emptyset \in \mathbb{N}_0.

Proposition 5.5 (Closure under successors).

If n∈N0n \in \mathbb{N}_0, then s(n)∈N0s(n) \in \mathbb{N}_0.

Discussion.

The same argument, now for the successor. Assuming n∈N0n \in \mathbb{N}_0 and taking an arbitrary inductive subset JJ of II, the definition of the intersection puts nn in JJ, and the second clause of inductiveness carries it to s(n)∈Js(n) \in J. As JJ was arbitrary, s(n)s(n) lies in every inductive subset, which is membership in N0\mathbb{N}_0.

Proof.

Suppose n∈N0n \in \mathbb{N}_0 and let JJ be an arbitrary inductive subset of II. Then n∈Jn \in J, and so s(n)∈Js(n) \in J by the definition of an inductive set. Since JJ was arbitrary, s(n)s(n) belongs to every inductive subset of II, hence s(n)∈N0s(n) \in \mathbb{N}_0.

The two propositions together say that N0\mathbb{N}_0 is itself inductive, and by its very definition it lies inside every inductive subset of II. So N0\mathbb{N}_0 is the smallest inductive subset of II.

Theorem 5.6 (Induction for sets).

Let S⊂N0S \subset \mathbb{N}_0 with 0∈S0 \in S and s(n)∈Ss(n) \in S whenever n∈Sn \in S. Then S=N0S = \mathbb{N}_0.

Discussion.

We prove the equality by two inclusions, and one of them is the hypothesis. The two conditions on SS are word for word the definition of an inductive set, so SS is one of the subsets being intersected, and the intersection is contained in each of them; that gives N0⊂S\mathbb{N}_0 \subset S and finishes it.

Proof.

The two hypotheses say precisely that SS is inductive, and S⊂N0⊂IS \subset \mathbb{N}_0 \subset I, so SS is an inductive subset of II. The intersection defining N0\mathbb{N}_0 is contained in each set intersected, so N0⊂S\mathbb{N}_0 \subset S. With S⊂N0S \subset \mathbb{N}_0 from the hypothesis, mutual inclusion gives S=N0S = \mathbb{N}_0.

The theorem speaks about a subset, but an induction proof usually begins with a predicate. The two describe the same problem: membership in a fixed set is a predicate, and conversely a predicate PP determines the subset {n∈N0∣P(n)}\{n \in \mathbb{N}_0 \mid P(n)\}, so proving PP of every natural number is proving that this subset is everything.

Theorem 5.7 (Induction for predicates).

Let PP be a predicate on N0\mathbb{N}_0 with P(0)P(0) true and P(n)  ⟹  P(s(n))P(n) \implies P(s(n)) for every n∈N0n \in \mathbb{N}_0. Then P(n)P(n) holds for every n∈N0n \in \mathbb{N}_0.

Discussion.

We pass from the predicate to the set it cuts out and apply the previous theorem. Put S=def{n∈N0∣P(n)}S \defeq \{n \in \mathbb{N}_0 \mid P(n)\}, a set by comprehension. The first hypothesis is 0∈S0 \in S and the second is closure of SS under ss, which are the two conditions the previous theorem asks for, so S=N0S = \mathbb{N}_0; and that says PP holds everywhere.

Proof.

Let S=def{n∈N0∣P(n)}S \defeq \{n \in \mathbb{N}_0 \mid P(n)\}. By the first hypothesis 0∈S0 \in S. If n∈Sn \in S, then P(n)P(n) holds, so P(s(n))P(s(n)) holds by the second hypothesis and s(n)∈Ss(n) \in S. The previous theorem forces S=N0S = \mathbb{N}_0, which says that P(n)P(n) holds for every n∈N0n \in \mathbb{N}_0.

Problem 5.1.

Let II and JJ be inductive sets.

  1. Show that I∩JI \cap J is inductive.
  2. Would your argument work for three inductive sets? For a thousand? For a family {Iα}α∈A\{I_\alpha\}_{\alpha \in A} indexed by an arbitrary non-empty set?

The definition of N0\mathbb{N}_0 began by choosing an inductive set II, and nothing so far says the answer does not depend on that choice. It does not, because N0\mathbb{N}_0 is contained in every inductive set, not only in the inductive subsets of II.

Proposition 5.8 (The least inductive set).

N0\mathbb{N}_0 is inductive, and N0⊂K\mathbb{N}_0 \subset K for every inductive set KK.

Discussion.

That N0\mathbb{N}_0 is inductive is the two propositions above read together, one supplying ∅\emptyset and the other closure under ss. The second claim is harder, since an arbitrary inductive KK need not be a subset of II and so is not among the sets we intersected. The problem above gets around this: I∩KI \cap K is inductive, and it is a subset of II, so it is one of the sets intersected and therefore holds N0\mathbb{N}_0. Being inside I∩KI \cap K puts N0\mathbb{N}_0 inside KK.

Proof.

The propositions above give ∅∈N0\emptyset \in \mathbb{N}_0 and closure under ss, which is what it means for N0\mathbb{N}_0 to be inductive.

Now let KK be any inductive set. By the problem above I∩KI \cap K is inductive, and I∩K⊂II \cap K \subset I, so I∩KI \cap K is an inductive subset of II and hence one of the sets whose intersection defines N0\mathbb{N}_0. An intersection is contained in each set intersected, so N0⊂I∩K⊂K\mathbb{N}_0 \subset I \cap K \subset K.

Corollary 5.9 (The construction does not depend on the choice).

Let II and I′I' be inductive sets, and let N0\mathbb{N}_0 and N0′\mathbb{N}_0' be built from them as above. Then N0=N0′\mathbb{N}_0 = \mathbb{N}_0'.

Proof.

Both are inductive by the proposition, and both are contained in every inductive set, so N0⊂N0′\mathbb{N}_0 \subset \mathbb{N}_0' and N0′⊂N0\mathbb{N}_0' \subset \mathbb{N}_0. Mutual inclusion gives the equality.

One more fact about the successor: nothing lies strictly between xx and s(x)s(x).

Proposition 5.10 (The successor is the next set up).

For every set xx we have x⊂s(x)x \subset s(x), and there is no set zz with x⊊z⊊s(x)x \subsetneq z \subsetneq s(x).

Discussion.

The inclusion is immediate, since s(x)s(x) is a union with xx as one of its parts. For the second claim we take any zz with x⊂z⊂s(x)x \subset z \subset s(x) and show it must be one of the two ends, which is the same thing as saying nothing sits strictly between them. Either zz adds nothing to xx, in which case the two inclusions make z=xz = x; or it holds something outside xx, and that element must be xx itself, since the only element of s(x)s(x) outside xx is xx. Then x∈zx \in z, and with x⊂zx \subset z already in hand every element of s(x)s(x) lies in zz.

Proof.

Since s(x)=x∪{x}s(x) = x \cup \{x\}, every element of xx lies in s(x)s(x), so x⊂s(x)x \subset s(x).

Now let zz satisfy x⊂z⊂s(x)x \subset z \subset s(x). If z⊂xz \subset x, then with x⊂zx \subset z we get z=xz = x. Otherwise some y∈zy \in z has y∉xy \notin x; since y∈z⊂x∪{x}y \in z \subset x \cup \{x\}, this forces y=xy = x, so x∈zx \in z. Together with x⊂zx \subset z this puts every element of x∪{x}x \cup \{x\} in zz, that is, s(x)⊂zs(x) \subset z, and so z=s(x)z = s(x). Hence zz is xx or s(x)s(x), and no zz satisfies x⊊z⊊s(x)x \subsetneq z \subsetneq s(x).

Peano Systems

Definition 5.11 (Peano system).

A Peano system is a set XX together with a distinguished element 00 and a map ss, called the successor, satisfying

  1. 0∈X0 \in X;
  2. s(x)∈Xs(x) \in X whenever x∈Xx \in X;
  3. if s(x)=s(y)s(x) = s(y), then x=yx = y;
  4. s(x)≠0s(x) \neq 0 for every x∈Xx \in X;
  5. if Y⊂XY \subset X, 0∈Y0 \in Y, and s(y)∈Ys(y) \in Y whenever y∈Yy \in Y, then Y=XY = X.

We write it (X,0,s)(X, 0, s).

The first two conditions are what it means for ss to be a function from XX to XX with 00 a member of the domain; the third says ss is injective, and the fourth that 00 lies outside its range.

In any Peano system we write 1=defs(0)1 \defeq s(0), 2=defs(1)2 \defeq s(1), 3=defs(2)3 \defeq s(2), and so on, the symbols recording positions in the successor chain and nothing more.

The first two conditions let us start at 00 and keep taking successors, producing 00, s(0)s(0), s(s(0))s(s(0)), and so on. The last two prevent repetitions among what is produced: were two of them equal, repeated use of the third condition would strip successors from both sides until the fourth was contradicted. So XX holds infinitely many distinct elements. What we do not yet know is whether it holds anything else.

Example 5.12.

Reading the construction back gives the familiar symbols as sets:

0=∅,1=s(0)=∅∪{∅}={∅},2=s(1)={∅}∪{{∅}}={∅,{∅}},\begin{aligned} 0 &= \emptyset, \\ 1 &= s(0) = \emptyset \cup \{\emptyset\} = \{\emptyset\}, \\ 2 &= s(1) = \{\emptyset\} \cup \bigl\{\{\emptyset\}\bigr\} = \bigl\{\emptyset, \{\emptyset\}\bigr\}, \end{aligned}

and so on, each of these sets holding exactly its predecessors.

Example 5.13 (Informal).

The fifth condition cannot be dropped. Take XX to be the real numbers xx with x⩾0x \geqslant 0, with the usual 00 and s(x)=defx+1s(x) \defeq x + 1. The first four conditions all hold, yet 12\tfrac{1}{2} lies in XX and is reached by no finite string of successors from 00. It is the fifth that fails: the subset YY consisting of 00 and the counting numbers holds 00, and holds y+1y + 1 whenever it holds yy, yet Y≠XY \neq X.

The fifth condition is the principle of induction, and Peano made it one of the axioms for the numbers, rather than a proof technique applied to them from outside. Its predicate form follows in any Peano system as it did above, by passing from a predicate to the subset it defines.

Theorem 5.14 (The natural numbers form a Peano system).

(N0,0,s)(\mathbb{N}_0, 0, s) is a Peano system.

Discussion.

Four of the five conditions are already in hand. The first two are the two propositions above, and the fifth is induction for sets. What is left is the third and fourth, and neither follows from minimality alone: they are claims about the particular successor x∪{x}x \cup \{x\}, not about smallness. The fourth is quick, since s(x)s(x) always holds xx and so is never empty. The third asks that x∪{x}=y∪{y}x \cup \{x\} = y \cup \{y\} force x=yx = y, and the proof goes through the fact that every element of N0\mathbb{N}_0 is also a subset of it, which is itself proved by induction. Both are left to the problems below.

Proof.

The first condition is the proposition that 0∈N00 \in \mathbb{N}_0, the second is closure under successors, and the fifth is induction for sets. The third and fourth are the two problems below.

Problem 5.2.

Show that s(x)≠∅s(x) \neq \emptyset for every set xx, which is the fourth condition for (N0,0,s)(\mathbb{N}_0, 0, s).

Problem 5.3.

Call a set tt transitive if every element of tt is also a subset of tt.

  1. Prove by induction that every element of N0\mathbb{N}_0 is transitive.
  2. Deduce that if s(m)=s(n)s(m) = s(n) for m,n∈N0m, n \in \mathbb{N}_0, then m=nm = n, which is the third condition.

Problem 5.4.

Let A={0,1,2,3}A = \{0, 1, 2, 3\} with 00 distinguished, and define s(0)=def1s(0) \defeq 1, s(1)=def2s(1) \defeq 2, s(2)=def3s(2) \defeq 3 and s(3)=def0s(3) \defeq 0. Which of the five conditions does this system satisfy? For each one that fails, exhibit the failure.

The numerals are nothing but names for positions in the chain, so even the most obvious facts about them have to be proved from the five conditions.

Proposition 5.15 (Three is a natural number).

3∈X3 \in X.

Discussion.

We walk along the chain. The first condition puts 00 in XX, and the second carries membership from any element to its successor, so we apply it three times, at 00, at 11 and at 22.

Proof.

By the first condition 0∈X0 \in X. By the second, s(0)=1∈Xs(0) = 1 \in X. By the second again, s(1)=2∈Xs(1) = 2 \in X, and once more, s(2)=3∈Xs(2) = 3 \in X.

Proposition 5.16 (Four is not zero).

4≠04 \neq 0.

Discussion.

Do not laugh. Because of the way 44 has been defined, as the successor of the successor of the successor of the successor of 00, it is not true a priori that it differs from 00, however obvious that looks; a system in which the chain closes back on itself would have 4=04 = 0, and the problems below give one. What rules it out here is the fourth condition, which says no element of XX has 00 as its successor. To apply it we need 33 to be an element of XX, which is the previous proposition.

Proof.

By definition 4=s(3)4 = s(3), and 3∈X3 \in X by the previous proposition. The fourth condition gives s(3)≠0s(3) \neq 0, that is, 4≠04 \neq 0.

Proposition 5.17 (Six is not two).

6≠26 \neq 2.

Discussion.

Here the fourth condition does not apply directly, since neither number is 00. Instead we work backwards down the chain with the third condition, which strips a successor from both sides of an equation: assuming 6=26 = 2 gives s(5)=s(1)s(5) = s(1), hence 5=15 = 1, hence s(4)=s(0)s(4) = s(0), hence 4=04 = 0. That is what the previous proposition forbids, so the assumption cannot stand. This is the argument sketched after the definition: repeated use of the third condition reduces any equality to a contradiction with the fourth.

Proof.

Suppose, for contradiction, that 6=26 = 2. Then s(5)=s(1)s(5) = s(1), so the third condition gives 5=15 = 1. Then s(4)=s(0)s(4) = s(0), so the third condition gives 4=04 = 0, contradicting the previous proposition. Hence 6≠26 \neq 2.

Predecessors

Theorem 5.18 (Predecessors).

In a Peano system, s(X)=X∖{0}s(X) = X \setminus \{0\}. Consequently every element other than 00 is the successor of exactly one element.

Discussion.

We prove the equality by two inclusions. The fourth condition gives s(X)⊂X∖{0}s(X) \subset X \setminus \{0\} at once, since no successor is 00. For the reverse inclusion we cannot chase an element directly, since being non-zero says nothing about where an element came from; instead we put Y=def{0}∪s(X)Y \defeq \{0\} \cup s(X) and use induction. This YY holds 00 by construction and is closed under ss because every s(y)s(y) lies in s(X)s(X), so the fifth condition forces Y=XY = X, and every non-zero element is therefore a successor. The uniqueness of the predecessor is then the third condition.

Proof.

Let Y=def{0}∪s(X)Y \defeq \{0\} \cup s(X). Then 0∈Y0 \in Y, and if y∈Yy \in Y then s(y)∈s(X)⊂Ys(y) \in s(X) \subset Y, so Y=XY = X by the fifth condition. Thus every x≠0x \neq 0 lies in s(X)s(X), while 00 does not by the fourth, and so s(X)=X∖{0}s(X) = X \setminus \{0\}.

If s(m)=x=s(n)s(m) = x = s(n), then m=nm = n by the third condition, so the element producing xx is unique.

So ss can be inverted. Regarded as a map onto X∖{0}X \setminus \{0\}, the successor is surjective by the theorem and injective by the third condition, so it is a bijection, and invertibility supplies an inverse

s−1:X∖{0}→X,s^{-1} : X \setminus \{0\} \to X,

the predecessor map, satisfying s−1∘s=id⁡Xs^{-1} \circ s = \operatorname{id}_X and s∘s−1=id⁡X∖{0}s \circ s^{-1} = \operatorname{id}_{X \setminus \{0\}}. This shortens the axiom list: in place of the second, third and fourth conditions we may simply demand that s:X→X∖{0}s : X \to X \setminus \{0\} be a bijection.

Corollary 5.19 (No element is its own successor).

In a Peano system, s(x)≠xs(x) \neq x for every x∈Xx \in X.

Proof.

Let Y=def{x∈X∣s(x)≠x}Y \defeq \{x \in X \mid s(x) \neq x\}. By the fourth condition s(0)≠0s(0) \neq 0, so 0∈Y0 \in Y. Suppose x∈Yx \in Y. If s(s(x))=s(x)s(s(x)) = s(x), then s(x)=xs(x) = x by the third condition, contradicting x∈Yx \in Y; hence s(x)∈Ys(x) \in Y. By the fifth condition, Y=XY = X.

Induction Without Order

In the counting numbers we expect every non-empty subset to have a least element, but least is an order notion and a Peano system carries no order. The property can still be stated without an order: a non-empty subset should hold an element that is not the successor of any of its elements.

Theorem 5.20 (Induction without order).

Let XX be a set with an element 00 and let s:X→X∖{0}s : X \to X \setminus \{0\} be a bijection. Then the following are equivalent.

  1. The only subset of XX holding 00 and closed under ss is XX itself.
  2. Every non-empty subset M⊂XM \subset X holds an element mm with m∉s(M)m \notin s(M).

Discussion.

We prove both implications by contradiction, since each hypothesis is a statement about all subsets and gives us nothing to construct from. Suppose the first holds and the second fails. Then some non-empty MM satisfies M⊂s(M)M \subset s(M), and we pass to the complement Y=defX∖MY \defeq X \setminus M: the codomain of ss excludes 00, which puts 00 in YY, and injectivity shows YY is closed under ss, so the first condition makes Y=XY = X and MM empty. Conversely, suppose the second holds and some proper YY holds 00 and is closed under ss. The complement MM is non-empty, so it has a starting element mm, which is not 00 and is therefore s(n)s(n) for some nn by surjectivity. Whether nn lies in MM or in YY, we get a contradiction.

Proof.

Suppose the second statement fails for the non-empty set M⊂XM \subset X, so M⊂s(M)M \subset s(M), and put Y=defX∖MY \defeq X \setminus M. If 0∈M0 \in M, then 0∈s(M)⊂s(X)0 \in s(M) \subset s(X), which is impossible since the codomain of ss is X∖{0}X \setminus \{0\}; hence 0∈Y0 \in Y. Let y∈Yy \in Y and suppose s(y)∉Ys(y) \notin Y. Then s(y)∈M⊂s(M)s(y) \in M \subset s(M), so s(y)=s(m)s(y) = s(m) for some m∈Mm \in M, and injectivity gives y=m∈My = m \in M, contradicting y∈Yy \in Y. Thus YY holds 00 and is closed under ss, so Y=XY = X by the first statement and M=∅M = \emptyset, a contradiction.

Conversely, let Y⊂XY \subset X hold 00 and be closed under ss, and suppose Y≠XY \neq X. Then M=defX∖YM \defeq X \setminus Y is non-empty, and the second statement provides m∈Mm \in M with m∉s(M)m \notin s(M). Since 0∈Y0 \in Y we have m≠0m \neq 0, so surjectivity gives m=s(n)m = s(n) for some n∈Xn \in X. If n∈Mn \in M, then m∈s(M)m \in s(M), against the choice of mm; if n∈Yn \in Y, then m=s(n)∈Ym = s(n) \in Y by closure, against m∈Mm \in M. Neither is possible, so no such YY exists.

Problem 5.5 (Informal).

Note that

1=1,1−4=−(1+2),1−4+9=1+2+3,1−4+9−16=−(1+2+3+4).\begin{aligned} 1 &= 1, \\ 1 - 4 &= -(1 + 2), \\ 1 - 4 + 9 &= 1 + 2 + 3, \\ 1 - 4 + 9 - 16 &= -(1 + 2 + 3 + 4). \end{aligned}

Guess the general law suggested here and prove it by induction.

Problem 5.6 (Informal).

Note that 1+1/2=2−1/21 + 1/2 = 2 - 1/2, that 1+1/2+1/4=2−1/41 + 1/2 + 1/4 = 2 - 1/4, and that 1+1/2+1/4+1/8=2−1/81 + 1/2 + 1/4 + 1/8 = 2 - 1/8. Guess the general law suggested here and prove it by induction.

Problem 5.7 (Informal).

Note that 1−1/2=1/21 - 1/2 = 1/2, that (1−1/2)(1−1/3)=1/3(1 - 1/2)(1 - 1/3) = 1/3, and that (1−1/2)(1−1/3)(1−1/4)=1/4(1 - 1/2)(1 - 1/3)(1 - 1/4) = 1/4. Guess the general law suggested here and prove it by induction.

Problem 5.8.

For every n∈Nn \in \mathbb{N} with n⩾2n \geqslant 2, guess a general law which simplifies the product

(1−14)(1−19)(1−116)⋯(1−1n2),\left(1 - \frac{1}{4}\right)\left(1 - \frac{1}{9}\right)\left(1 - \frac{1}{16}\right) \cdots \left(1 - \frac{1}{n^2}\right),

and prove it by induction.

Recursion

In what sense are the natural numbers unique? The elements of two Peano systems may look completely different, but the conditions determine everything except the names. Any two are linked by a relabelling that respects the only structure present, the zero and the successor:

0⟼s(0)⟼s(s(0))⟼⋯↓↓↓0′⟼s′(0′)⟼s′(s′(0′))⟼⋯\begin{array}{ccccccc} 0 & \longmapsto & s(0) & \longmapsto & s(s(0)) & \longmapsto & \cdots \\ \big\downarrow & & \big\downarrow & & \big\downarrow & & \\ 0' & \longmapsto & s'(0') & \longmapsto & s'(s'(0')) & \longmapsto & \cdots \end{array}

Whatever the relabelling is, it must send 00 to 0′0', hence s(0)s(0) to s′(0′)s'(0'), and so on down the ladder. What the picture does not show is that the instruction “start at 0′0' and keep applying s′s'” defines a map on all of XX. Turning such an instruction into a function is called recursion, or inductive definition.

One piece of language first. Given maps α:A→B\alpha : A \to B, β:B→D\beta : B \to D, γ:A→C\gamma : A \to C and δ:C→D\delta : C \to D, we draw

A→  α  B↓γ↓βC→  δ  D\begin{array}{ccc} A & \xrightarrow{\ \ \alpha\ \ } & B \\ \big\downarrow{\scriptstyle \gamma} & & \big\downarrow{\scriptstyle \beta} \\ C & \xrightarrow{\ \ \delta\ \ } & D \end{array}

and call the square commutative if β∘α=δ∘γ\beta \circ \alpha = \delta \circ \gamma, that is, if the two routes from AA to DD agree. A larger diagram, like the ladder above, is commutative when every square inside it is.

Theorem 5.21 (Recursion theorem).

Let (X,0,s)(X, 0, s) be a Peano system, let AA be a set with an element a∈Aa \in A, and let g:A→Ag : A \to A. Then there is exactly one map α:X→A\alpha : X \to A with α(0)=a\alpha(0) = a and α∘s=g∘α\alpha \circ s = g \circ \alpha; that is, exactly one α\alpha sending 00 to aa and making the square

X→  s  X↓α↓αA→  g  A\begin{array}{ccc} X & \xrightarrow{\ \ s\ \ } & X \\ \big\downarrow{\scriptstyle \alpha} & & \big\downarrow{\scriptstyle \alpha} \\ A & \xrightarrow{\ \ g\ \ } & A \end{array}

commute.

Discussion.

Pointwise the commuting square says α(s(n))=g(α(n))\alpha(s(n)) = g(\alpha(n)), so the map is prescribed at 00 and prescribed one step at a time thereafter. We must prove both uniqueness and existence, and they need different tools. Uniqueness is induction: for two candidates, the set where they agree holds 00 and is closed under ss, so the fifth condition makes it all of XX. Existence cannot be induction, since there is no map yet to induct on; instead we build the map as a set of pairs. Call C⊂X×AC \subset X \times A admissible when it holds (0,a)(0, a) and sends each (n,c)∈C(n, c) \in C to (s(n),g(c))∈C(s(n), g(c)) \in C, and let Γ\Gamma be the intersection of all admissible subsets, which is admissible in its turn and sits inside every one of them. By the definition of a function it remains to show that each n∈Xn \in X occurs in exactly one pair of Γ\Gamma, and both halves of that are inductions. The second half uses a deletion argument: a pair not forced by the closure rule can be removed, leaving a smaller admissible set, which contradicts the minimality of Γ\Gamma; the fourth and third conditions justify the two deletions.

Proof.

For uniqueness, let α\alpha and β\beta both satisfy the two requirements and put Y=def{n∈X∣α(n)=β(n)}Y \defeq \{n \in X \mid \alpha(n) = \beta(n)\}. Since α(0)=a=β(0)\alpha(0) = a = \beta(0) we have 0∈Y0 \in Y, and if n∈Yn \in Y then α(s(n))=g(α(n))=g(β(n))=β(s(n))\alpha(s(n)) = g(\alpha(n)) = g(\beta(n)) = \beta(s(n)), so s(n)∈Ys(n) \in Y. By the fifth condition Y=XY = X, that is, α=β\alpha = \beta.

For existence, call C⊂X×AC \subset X \times A admissible if (0,a)∈C(0, a) \in C and (s(n),g(c))∈C(s(n), g(c)) \in C whenever (n,c)∈C(n, c) \in C. The whole of X×AX \times A is admissible, so the admissible sets form a non-empty collection, carved from P(X×A)\mathcal{P}(X \times A) by comprehension; let Γ\Gamma be its intersection, which is admissible in turn and lies inside every admissible set. We claim each n∈Xn \in X appears in exactly one pair of Γ\Gamma; by the definition of a function the claim makes Γ\Gamma a function α:X→A\alpha : X \to A, and admissibility then reads α(0)=a\alpha(0) = a and α(s(n))=g(α(n))\alpha(s(n)) = g(\alpha(n)).

That each nn appears in some pair is an induction on Y=def{n∈X∣(n,c)∈Γ for some c∈A}Y \defeq \{n \in X \mid (n, c) \in \Gamma \text{ for some } c \in A\}: admissibility puts (0,a)∈Γ(0, a) \in \Gamma, so 0∈Y0 \in Y, and if (n,c)∈Γ(n, c) \in \Gamma then (s(n),g(c))∈Γ(s(n), g(c)) \in \Gamma, so YY is closed under ss.

That no nn appears twice is an induction on Z=def{n∈X∣n appears in exactly one pair of Γ}Z \defeq \{n \in X \mid n \text{ appears in exactly one pair of } \Gamma\}. In both steps, a pair not forced by the closure rule may be deleted from Γ\Gamma, leaving a set which is still admissible yet strictly smaller than the smallest admissible set, a contradiction.

For the base step, suppose (0,c)∈Γ(0, c) \in \Gamma with c≠ac \neq a, and delete it. The set Γ∖{(0,c)}\Gamma \setminus \{(0, c)\} still holds (0,a)(0, a), and it is still closed, since every pair the rule produces has first coordinate s(n)s(n), which is never 00 by the fourth condition. Hence no such cc exists and 0∈Z0 \in Z.

For the inductive step, let nn appear only in the pair (n,c)(n, c), suppose (s(n),d)∈Γ(s(n), d) \in \Gamma with d≠g(c)d \neq g(c), and delete it. Again (0,a)(0, a) survives, by the fourth condition. For closure, take a surviving pair (p,e)(p, e); the rule demands (s(p),g(e))(s(p), g(e)), and this survived too: if s(p)≠s(n)s(p) \neq s(n) it is not the deleted pair, while if s(p)=s(n)s(p) = s(n) then p=np = n by the third condition, so e=ce = c by the choice of nn and g(e)=g(c)≠dg(e) = g(c) \neq d. The same contradiction forbids dd, so s(n)s(n) appears only in (s(n),g(c))(s(n), g(c)) and s(n)∈Zs(n) \in Z. By the fifth condition, Z=XZ = X.

Theorem 5.22 (Uniqueness of Peano systems).

Let (X,0,s)(X, 0, s) and (X′,0′,s′)(X', 0', s') be Peano systems. Then there is exactly one bijection α:X→X′\alpha : X \to X' with α(0)=0′\alpha(0) = 0' making the square

X→  s  X↓α↓αX′→  s′  X′\begin{array}{ccc} X & \xrightarrow{\ \ s\ \ } & X \\ \big\downarrow{\scriptstyle \alpha} & & \big\downarrow{\scriptstyle \alpha} \\ X' & \xrightarrow{\ \ s'\ \ } & X' \end{array}

commute.

Discussion.

Apply the recursion theorem with A=X′A = X', a=0′a = 0' and g=s′g = s'. It gives a unique map α\alpha with α(0)=0′\alpha(0) = 0' and α∘s=s′∘α\alpha \circ s = s' \circ \alpha, and any bijection meeting the requirements must be that map, so only bijectivity is left to prove. We get it by producing an inverse rather than by checking injectivity and surjectivity separately. Applying the theorem again with the two systems exchanged gives α′:X′→X\alpha' : X' \to X, and the composite α′∘α\alpha' \circ \alpha sends 00 to 00 and commutes with ss, so it solves the same recursion problem on XX as the identity does; uniqueness identifies the two. The same argument on the other side finishes it.

Proof.

Applying the recursion theorem with A=X′A = X', a=0′a = 0' and g=s′g = s' gives exactly one map α:X→X′\alpha : X \to X' with α(0)=0′\alpha(0) = 0' and α∘s=s′∘α\alpha \circ s = s' \circ \alpha; it remains to prove α\alpha bijective. Exchanging the systems gives likewise a unique α′:X′→X\alpha' : X' \to X with α′(0′)=0\alpha'(0') = 0 and α′∘s′=s∘α′\alpha' \circ s' = s \circ \alpha'.

Put ι=defα′∘α:X→X\iota \defeq \alpha' \circ \alpha : X \to X. Then ι(0)=α′(0′)=0\iota(0) = \alpha'(0') = 0, and associativity of composition lets us compute without brackets:

ι∘s=α′∘α∘s=α′∘s′∘α=s∘α′∘α=s∘ι.\iota \circ s = \alpha' \circ \alpha \circ s = \alpha' \circ s' \circ \alpha = s \circ \alpha' \circ \alpha = s \circ \iota.

So ι\iota solves the recursion problem on XX with a=0a = 0 and g=sg = s; so does id⁡X\operatorname{id}_X; and by the uniqueness clause ι=id⁡X\iota = \operatorname{id}_X. The same argument with the systems exchanged gives α∘α′=id⁡X′\alpha \circ \alpha' = \operatorname{id}_{X'}. Hence α′\alpha' is an inverse of α\alpha, and α\alpha is bijective by invertibility.

The condition α(0)=0′\alpha(0) = 0' is in fact automatic: any bijection β:X→X′\beta : X \to X' with β∘s=s′∘β\beta \circ s = s' \circ \beta already sends 00 to 0′0'. Otherwise surjectivity would provide some n≠0n \neq 0 with β(n)=0′\beta(n) = 0', the theorem on predecessors would write n=s(m)n = s(m), and then 0′=β(s(m))=s′(β(m))0' = \beta(s(m)) = s'(\beta(m)) would exhibit 0′0' as a successor in X′X', against the fourth condition.

So there is, up to relabelling, only one system of natural numbers. Whether we take the Hindu-Arabic symbols 0,1,2,3,…0, 1, 2, 3, \ldots, the Roman ones augmented with a zero, or the nested empty sets of the example above, the arithmetic that follows is the same.

Arithmetic

The recursion theorem lets us define arithmetic inside any Peano system, with no arithmetic assumed from outside.

Any addition should satisfy m+1=s(m)m + 1 = s(m), should be associative, and should have 00 as an identity. These requirements determine it, since the first two give

m+s(n)=m+(n+1)=(m+n)+1=s(m+n),m + s(n) = m + (n + 1) = (m + n) + 1 = s(m + n),

which determines m+nm + n for every nn once m+0=mm + 0 = m is fixed. That some operation satisfies them is a separate question, settled by the recursion theorem.

Definition 5.23 (Addition).

Let (X,0,s)(X, 0, s) be a Peano system and let m∈Xm \in X. The recursion theorem applied with A=XA = X, a=ma = m and g=sg = s yields exactly one map σm:X→X\sigma_m : X \to X with σm(0)=m\sigma_m(0) = m and σm∘s=s∘σm\sigma_m \circ s = s \circ \sigma_m. We write m+n=defσm(n)m + n \defeq \sigma_m(n), so that

m+0=mandm+s(n)=s(m+n).m + 0 = m \qquad\text{and}\qquad m + s(n) = s(m + n).

In particular m+1=m+s(0)=s(m+0)=s(m)m + 1 = m + s(0) = s(m + 0) = s(m). The defining clauses deal with a 00 or an ss on the right of a sum; for the laws of addition we also need them on the left.

Proposition 5.24 (Addition from the left).

For all m,n∈Xm, n \in X, we have 0+n=n0 + n = n and s(m)+n=s(m+n)s(m) + n = s(m + n).

Discussion.

We induct on the right-hand variable nn in both, since that is the position the defining clauses are about. For the first, the base case is the clause m+0=mm + 0 = m read at m=0m = 0, and the step uses the other clause: 0+s(n)=s(0+n)=s(n)0 + s(n) = s(0 + n) = s(n). For the second, fix mm and take the statement s(m)+n=s(m+n)s(m) + n = s(m + n). Its base case reduces both sides by the first clause. For the step, apply the successor clause on the left, replace s(m)+ns(m) + n by s(m+n)s(m + n) using the hypothesis, and apply the clause once more. As mm was arbitrary throughout, the result holds for all mm and nn.

Proof.

Let Y=def{n∈X∣0+n=n}Y \defeq \{n \in X \mid 0 + n = n\}. Since 0+0=00 + 0 = 0 we have 0∈Y0 \in Y, and if n∈Yn \in Y then 0+s(n)=s(0+n)=s(n)0 + s(n) = s(0 + n) = s(n), so s(n)∈Ys(n) \in Y. By the fifth condition Y=XY = X.

Now fix m∈Xm \in X and let Z=def{n∈X∣s(m)+n=s(m+n)}Z \defeq \{n \in X \mid s(m) + n = s(m + n)\}. Since s(m)+0=s(m)=s(m+0)s(m) + 0 = s(m) = s(m + 0) we have 0∈Z0 \in Z. If n∈Zn \in Z, then

s(m)+s(n)=s(s(m)+n)=s(s(m+n))=s(m+s(n)),s(m) + s(n) = s\bigl(s(m) + n\bigr) = s\bigl(s(m + n)\bigr) = s\bigl(m + s(n)\bigr),

so s(n)∈Zs(n) \in Z. By the fifth condition Z=XZ = X, and since mm was arbitrary the identity holds throughout.

Theorem 5.25 (Laws of addition).

For all m,n,p∈Xm, n, p \in X, we have (m+n)+p=m+(n+p)(m + n) + p = m + (n + p) and m+n=n+mm + n = n + m.

Discussion.

Both are inductions on the variable sitting in the right-hand position of a sum, where the definition applies. For associativity, fix mm and nn and take the statement (m+n)+p=m+(n+p)(m + n) + p = m + (n + p); its base case reduces both sides by r+0=rr + 0 = r, and its step rewrites the left as s((m+n)+p)s((m+n)+p), applies the hypothesis, and uses the successor clause twice to arrive at m+(n+s(p))m + (n + s(p)). For commutativity, fix mm and take m+n=n+mm + n = n + m; the base case is m+0=m=0+mm + 0 = m = 0 + m, which needs the first identity of the preceding proposition, and the step turns m+s(n)m + s(n) into s(m+n)s(m + n), applies the hypothesis, and then uses the second identity to reach s(n)+ms(n) + m. Neither induction would close without that proposition, since both steps have to move a successor across to the left of a sum.

Proof.

Fix m,n∈Xm, n \in X and let Y=def{p∈X∣(m+n)+p=m+(n+p)}Y \defeq \{p \in X \mid (m + n) + p = m + (n + p)\}. Both (m+n)+0(m + n) + 0 and m+(n+0)m + (n + 0) equal m+nm + n, so 0∈Y0 \in Y. If p∈Yp \in Y, then

(m+n)+s(p)=s((m+n)+p)=s(m+(n+p))=m+s(n+p)=m+(n+s(p)),(m + n) + s(p) = s\bigl((m + n) + p\bigr) = s\bigl(m + (n + p)\bigr) = m + s(n + p) = m + \bigl(n + s(p)\bigr),

so s(p)∈Ys(p) \in Y, and Y=XY = X by the fifth condition.

Next fix m∈Xm \in X and let Z=def{n∈X∣m+n=n+m}Z \defeq \{n \in X \mid m + n = n + m\}. The preceding proposition gives 0+m=m=m+00 + m = m = m + 0, so 0∈Z0 \in Z. If n∈Zn \in Z, then

m+s(n)=s(m+n)=s(n+m)=s(n)+m,m + s(n) = s(m + n) = s(n + m) = s(n) + m,

using that proposition again at the last step, so s(n)∈Zs(n) \in Z. By the fifth condition Z=XZ = X, and since mm was arbitrary the identity holds throughout.

Definition 5.26 (Positive elements).

An element nn of a Peano system is positive if n≠0n \neq 0.

Proposition 5.27 (Positivity is absorbing).

If aa is positive and b∈Xb \in X, then a+ba + b is positive.

Discussion.

We induct on bb, since the defining clauses of addition are about the right-hand variable. The base case is a+0=aa + 0 = a, which is positive by hypothesis. For the step, the successor clause turns a+s(b)a + s(b) into s(a+b)s(a + b), and the fourth condition says no successor is 00, so the conclusion needs nothing from the inductive hypothesis at all.

Proof.

Let Y=def{b∈X∣a+b is positive}Y \defeq \{b \in X \mid a + b \text{ is positive}\}. Since a+0=aa + 0 = a and aa is positive, 0∈Y0 \in Y. If b∈Yb \in Y, then a+s(b)=s(a+b)a + s(b) = s(a + b), which is not 00 by the fourth condition, so s(b)∈Ys(b) \in Y. By the fifth condition Y=XY = X.

Corollary 5.28 (A sum is zero only when both parts are).

If a,b∈Xa, b \in X satisfy a+b=0a + b = 0, then a=0a = 0 and b=0b = 0.

Proof.

Suppose a≠0a \neq 0. Then aa is positive, so a+ba + b is positive by the proposition, contradicting a+b=0a + b = 0. Hence a=0a = 0, and by commutativity the same argument gives b=0b = 0.

Problem 5.9.

Define multiplication in a Peano system by the clauses m⋅0=def0m \cdot 0 \defeq 0 and m⋅s(n)=defm⋅n+mm \cdot s(n) \defeq m \cdot n + m. Show that these clauses do define a map from X×XX \times X to XX.

Problem 5.10.

Using the previous problem, prove that for all m,n,p∈Xm, n, p \in X:

  1. m⋅(n+p)=m⋅n+m⋅pm \cdot (n + p) = m \cdot n + m \cdot p;
  2. m⋅n=n⋅mm \cdot n = n \cdot m;
  3. 1⋅m=m⋅1=m1 \cdot m = m \cdot 1 = m;
  4. 0⋅m=m⋅0=00 \cdot m = m \cdot 0 = 0;
  5. (m⋅n)⋅p=m⋅(n⋅p)(m \cdot n) \cdot p = m \cdot (n \cdot p).

Proposition 5.29 (Positive elements are closed under addition and multiplication).

Let aa and bb be positive elements of a Peano system, with multiplication as in the two problems above. Then a+ba + b and a⋅ba \cdot b are positive.

Discussion.

The sum is Proposition 5.27 read at a positive bb, which puts no condition on bb. The product needs one more step. Being positive, bb is not 00, so the theorem on predecessors writes it as s(c)s(c) for a unique cc, and the second clause of the multiplication problem turns a⋅s(c)a \cdot s(c) into a⋅c+aa \cdot c + a. That is a sum whose left part we know nothing about and whose right part is positive, which is the case Proposition 5.27 covers, once commutativity puts the positive part in front. No induction is needed, since writing bb as a successor lets us apply the second clause once.

Proof.

That a+ba + b is positive is Proposition 5.27 , since aa is positive.

For the product, b≠0b \neq 0, so the theorem on predecessors gives b=s(c)b = s(c) for some c∈Xc \in X. Then a⋅b=a⋅s(c)=a⋅c+aa \cdot b = a \cdot s(c) = a \cdot c + a by the second clause of the multiplication problem, and a⋅c+a=a+a⋅ca \cdot c + a = a + a \cdot c by commutativity of addition. Since aa is positive, Proposition 5.27 makes a+a⋅ca + a \cdot c positive, so a⋅ba \cdot b is positive.

Problem 5.11.

Write N\mathbb{N} for the positive elements of a Peano system, and recall 1=s(0)1 = s(0). Show that every n∈Nn \in \mathbb{N} with n≠1n \neq 1 is s(m)s(m) for some m∈Nm \in \mathbb{N}. Why does the argument need n≠1n \neq 1, and not merely n≠0n \neq 0?

Problem 5.12.

Let a∈Xa \in X. Use the recursion theorem, with a starting element and a map g:X→Xg : X \to X of your choosing, to produce a unique map exp⁡a:X→X\exp_a : X \to X satisfying

exp⁡a(0)=1andexp⁡a(s(n))=exp⁡a(n)⋅a,\exp_a(0) = 1 \qquad\text{and}\qquad \exp_a(s(n)) = \exp_a(n) \cdot a,

written ana^n for exp⁡a(n)\exp_a(n). Prove directly from the clauses that as(0)=aa^{s(0)} = a, and, writing 2=defs(1)2 \defeq s(1), compute 1+11 + 1, 2⋅22 \cdot 2 and 222^2 from the definitions alone.

Problem 5.13.

Let α:X→X\alpha : X \to X satisfy α∘s=s∘α\alpha \circ s = s \circ \alpha. Prove that α(n)=α(0)+n\alpha(n) = \alpha(0) + n for every n∈Xn \in X. No commutativity is needed.

Problem 5.14.

Let x,y,z∈Xx, y, z \in X.

  1. Prove that if x≠yx \neq y, then x+z≠y+zx + z \neq y + z.
  2. Deduce that x+z=y+zx + z = y + z implies x=yx = y.
  3. Show that if n=m+bn = m + b with bb positive, then n≠mn \neq m.

Problem 5.15.

Prove that (am)n=am⋅n(a^m)^n = a^{m \cdot n} for all a,m,n∈Xa, m, n \in X, and that the map sending nn to ana^n is the unique one with φ(0)=1\varphi(0) = 1, φ(1)=a\varphi(1) = a and φ(m+n)=φ(m)⋅φ(n)\varphi(m + n) = \varphi(m) \cdot \varphi(n) for all m,n∈Xm, n \in X.

Sums

Some recursive definitions do not fit the recursion theorem as it stands.

Imagine defining the running totals σn\sigma_n, the sum of everything up to nn. Once σn\sigma_n is found, the next total should be σs(n)=σn+s(n)\sigma_{s(n)} = \sigma_n + s(n): the old total is kept and the next term added. That update needs both the previous value and the index, whereas the recursion theorem applies a fixed map to the previous value alone and never sees where it is. The fix is to carry the index along.

Proposition 5.30 (Parametrised recursion).

Let (X,0,s)(X, 0, s) be a Peano system, let AA be a set with an element a∈Aa \in A, and let G:X×A→AG : X \times A \to A. Then there is exactly one map α:X→A\alpha : X \to A with

α(0)=aandα(s(n))=G(n,α(n))for every n∈X.\alpha(0) = a \qquad\text{and}\qquad \alpha(s(n)) = G\bigl(n, \alpha(n)\bigr) \quad\text{for every } n \in X.

Discussion.

In the recursion theorem the next value is computed from the previous value alone, while GG also needs the index. So we make the previous value carry its own index: apply the theorem on X×AX \times A rather than on AA, starting at (0,a)(0, a) and stepping by (n,c)↦(s(n),G(n,c))(n, c) \mapsto \bigl(s(n), G(n, c)\bigr). That gives a map β:X→X×A\beta : X \to X \times A, and an induction shows its first coordinate at nn is always nn itself, so the second coordinate is the α\alpha we want. Uniqueness goes the same way in reverse: any rival α′\alpha' can be paired with its index to give a rival β′\beta', which solves the same recursion problem on X×AX \times A and is therefore β\beta by the uniqueness already proved.

Proof.

Apply the recursion theorem with target set X×AX \times A, initial element (0,a)(0, a), and the map sending (n,c)(n, c) to (s(n),G(n,c))\bigl(s(n), G(n, c)\bigr). It gives a unique β:X→X×A\beta : X \to X \times A with β(0)=(0,a)\beta(0) = (0, a) and β(s(n))=(s(n),G(n,c))\beta(s(n)) = \bigl(s(n), G(n, c)\bigr) whenever β(n)=(n,c)\beta(n) = (n, c).

Let YY be the set of n∈Xn \in X for which β(n)=(n,c)\beta(n) = (n, c) for some c∈Ac \in A. Since β(0)=(0,a)\beta(0) = (0, a) we have 0∈Y0 \in Y; and if n∈Yn \in Y with β(n)=(n,c)\beta(n) = (n, c), the displayed equation gives β(s(n))=(s(n),G(n,c))\beta(s(n)) = \bigl(s(n), G(n, c)\bigr), so s(n)∈Ys(n) \in Y. By the fifth condition Y=XY = X.

For each n∈Xn \in X write β(n)=(n,α(n))\beta(n) = \bigl(n, \alpha(n)\bigr). Then α(0)=a\alpha(0) = a, and the defining equation for β\beta reads α(s(n))=G(n,α(n))\alpha(s(n)) = G\bigl(n, \alpha(n)\bigr).

If α′\alpha' is another map with these two properties, let β′(n)=def(n,α′(n))\beta'(n) \defeq \bigl(n, \alpha'(n)\bigr). Then β′(0)=(0,a)\beta'(0) = (0, a) and β′(s(n))=(s(n),G(n,α′(n)))\beta'(s(n)) = \bigl(s(n), G(n, \alpha'(n))\bigr), so β′\beta' solves the same recursion problem as β\beta; the uniqueness clause of the recursion theorem gives β′=β\beta' = \beta, and comparing second coordinates gives α′=α\alpha' = \alpha.

Before using sums we should say what the dots are doing. In

a1+a2+⋯+ana_1 + a_2 + \cdots + a_n

they leave the middle terms to the pattern made visible by the terms around them. This is a convention for readers, not a definition: a1+a7+⋯+a41a_1 + a_7 + \cdots + a_{41} determines nothing without further context. We replace the convention by a recursion, so that the expression has a meaning whether or not the pattern is visible.

Proposition 5.31 (The summation symbol).

Let (X,0,s)(X, 0, s) be a Peano system with addition, and let a:X→Xa : X \to X be a map, written aia_i for a(i)a(i). Then there is exactly one map Σ:X→X\Sigma : X \to X with

Σ(0)=0andΣ(s(n))=Σ(n)+as(n)for every n∈X.\Sigma(0) = 0 \qquad\text{and}\qquad \Sigma(s(n)) = \Sigma(n) + a_{s(n)} \quad\text{for every } n \in X.

We write ∑i=1nai\displaystyle\sum_{i=1}^{n} a_i for Σ(n)\Sigma(n), so that the two clauses read

∑i=10ai=0and∑i=1s(n)ai=(∑i=1nai)+as(n).\sum_{i=1}^{0} a_i = 0 \qquad\text{and}\qquad \sum_{i=1}^{s(n)} a_i = \left(\sum_{i=1}^{n} a_i\right) + a_{s(n)}.

Discussion.

The update needs the index as well as the running total, since it is the index that says which term comes next, so this is parametrised recursion rather than the plain kind. We take A=XA = X, initial element 00, and G(n,c)=defc+as(n)G(n, c) \defeq c + a_{s(n)}, which is a map from X×XX \times X to XX because addition is. The two clauses of the proposition are then exactly the two the previous result delivers, and its uniqueness clause gives ours.

Proof.

Apply parametrised recursion with A=XA = X, initial element 00, and G:X×X→XG : X \times X \to X given by G(n,c)=defc+as(n)G(n, c) \defeq c + a_{s(n)}. It supplies exactly one map Σ:X→X\Sigma : X \to X with Σ(0)=0\Sigma(0) = 0 and Σ(s(n))=G(n,Σ(n))=Σ(n)+as(n)\Sigma(s(n)) = G\bigl(n, \Sigma(n)\bigr) = \Sigma(n) + a_{s(n)}, which are the two clauses asserted.

The limits carry no order with them: nothing here says that ii runs through the elements between 11 and nn, only that the recursion starts at 00 and steps by ss. Once an order is available the notation will mean what it looks like it means.

The index is bound by the symbol and may be renamed at will, so that

∑i=1nai=∑j=1naj,\sum_{i=1}^{n} a_i = \sum_{j=1}^{n} a_j,

while nn may not be renamed, since the value depends on it. The value ∑i=10ai=0\sum_{i=1}^{0} a_i = 0 is the empty sum, worth keeping both because it starts the recursion and because it spares us a separate case whenever a sum is allowed to run out of terms. Notice too that the clauses fix one reading of a1+⋯+ana_1 + \cdots + a_n, the one that brackets from the left; that any other bracketing gives the same element is a consequence of the laws of addition, and we leave it to a problem.

Problem 5.16.

Show that there is exactly one map Π:X→X\Pi : X \to X with Π(0)=1\Pi(0) = 1 and Π(s(n))=Π(n)⋅as(n)\Pi(s(n)) = \Pi(n) \cdot a_{s(n)} for every n∈Xn \in X, where multiplication is as defined in the problems above, and write ∏i=1nai\displaystyle\prod_{i=1}^{n} a_i for Π(n)\Pi(n). Which clause takes the place of the empty sum, and why is that the right choice?

Problem 5.17.

Argue from the defining clauses alone.

  1. Let ai=def1a_i \defeq 1 for every ii. Prove that ∑i=1nai=n\displaystyle\sum_{i=1}^{n} a_i = n and ∏i=1nai=1\displaystyle\prod_{i=1}^{n} a_i = 1 for every n∈Xn \in X.
  2. Let ai=defia_i \defeq i for every ii, so that the sum is the running total of everything up to nn. Prove that
∑i=1ni  +  ∑i=1ni  =  n⋅s(n).\sum_{i=1}^{n} i \;+\; \sum_{i=1}^{n} i \;=\; n \cdot s(n).

Problem 5.18.

Prove that

∑i=1m+nai=∑i=1mai  +  ∑i=1nam+i,\sum_{i=1}^{m+n} a_i = \sum_{i=1}^{m} a_i \;+\; \sum_{i=1}^{n} a_{m+i},

stating carefully what the second sum on the right means as a recursion in its own right. Where do the laws of addition enter?

Problem 5.19.

Let (X,0,s)(X, 0, s) and (X′,0′,s′)(X', 0', s') be Peano systems, each carrying the addition of Definition 5.23 and the multiplication of Problem 5.9 , and let α:X→X′\alpha : X \to X' be the bijection of Theorem 5.22 . Prove that α(m+n)=α(m)+α(n)\alpha(m + n) = \alpha(m) + \alpha(n) and α(m⋅n)=α(m)⋅α(n)\alpha(m \cdot n) = \alpha(m) \cdot \alpha(n) for all m,n∈Xm, n \in X.

Problem 5.20.

Let (X,0,s)(X, 0, s) be a Peano system with multiplication.

  1. Produce a map F:X→XF : X \to X with F(0)=1F(0) = 1 and F(s(n))=s(n)⋅F(n)F(s(n)) = s(n) \cdot F(n) for every n∈Xn \in X.
  2. Show that there is no g:X→Xg : X \to X with F(s(n))=g(F(n))F(s(n)) = g\bigl(F(n)\bigr) for every n∈Xn \in X, and deduce that Theorem 5.21 taken with A=XA = X cannot produce FF.

Problem 5.21.

Let SS be a non-empty set and let H:S→SH : S \to S. Taking for AA the set SSS^S of all maps from SS to itself, use Theorem 5.21 to produce the iterates HnH^n of HH, characterised by H0=id⁡SH^0 = \operatorname{id}_S and Hs(n)=H∘HnH^{s(n)} = H \circ H^n for every n∈N0n \in \mathbb{N}_0.

  1. Suppose H(H(y))=yH\bigl(H(y)\bigr) = y for some y∈Sy \in S. Determine H80(y)H^{80}(y) and H81(y)H^{81}(y), with proof.
  2. Suppose instead that H(H(y))=H(y)H\bigl(H(y)\bigr) = H(y). Determine H80(y)H^{80}(y), with proof.
  3. Find a map H:N0→N0H : \mathbb{N}_0 \to \mathbb{N}_0 with H∘H=HH \circ H = H, H(1)=36H(1) = 36, H(2)=5H(2) = 5 and H(13)=47H(13) = 47.
  4. Decide whether there is a map H:N0→N0H : \mathbb{N}_0 \to \mathbb{N}_0 with H∘H=HH \circ H = H, H(1)=7H(1) = 7 and H(7)=18H(7) = 18.

Problem 5.22.

Let a,b:X→Xa, b : X \to X be maps, written aia_i for a(i)a(i) and bib_i for b(i)b(i), and let c∈Xc \in X. Prove that for every n∈Xn \in X:

  1. ∑i=1n(ai+bi)=∑i=1nai+∑i=1nbi\displaystyle\sum_{i=1}^{n} (a_i + b_i) = \sum_{i=1}^{n} a_i + \sum_{i=1}^{n} b_i;
  2. ∑i=1nc⋅ai=c⋅∑i=1nai\displaystyle\sum_{i=1}^{n} c \cdot a_i = c \cdot \sum_{i=1}^{n} a_i;
  3. if as(i)=ai+bs(i)a_{s(i)} = a_i + b_{s(i)} for every i∈Xi \in X, then a0+∑i=1nbi=an\displaystyle a_0 + \sum_{i=1}^{n} b_i = a_n.

Problem 5.23.

Let A(n)A(n) denote the statement 8⋅∑i=1ni=(2n+1)28 \cdot \displaystyle\sum_{i=1}^{n} i = (2n + 1)^2.

  1. Prove that if A(k)A(k) holds for some k∈Nk \in \mathbb{N}, then A(s(k))A(s(k)) holds.
  2. Criticise the statement: “by induction it follows that A(n)A(n) holds for every n∈Nn \in \mathbb{N}”.
  3. Determine which n∈Nn \in \mathbb{N}, if any, satisfy A(n)A(n).

Problem 5.24.

Work in a Peano system with addition, multiplication and the powers of Problem 5.12 .

  1. Prove that 4⋅∑i=1ni3=n2⋅s(n)24 \cdot \displaystyle\sum_{i=1}^{n} i^3 = n^2 \cdot s(n)^2 for every n∈Nn \in \mathbb{N}.
  2. Deduce that ∑i=1ni3=(∑i=1ni)2\displaystyle\sum_{i=1}^{n} i^3 = \left(\sum_{i=1}^{n} i\right)^2.

Problem 5.25.

The Fibonacci numbers are 1,1,2,3,5,8,13,21,34,55,…1, 1, 2, 3, 5, 8, 13, 21, 34, 55, \ldots, each after the second being the sum of the two before it.

  1. Produce exactly one map a:X→Xa : X \to X with a0=as(0)=1a_0 = a_{s(0)} = 1 and as(s(n))=as(n)+ana_{s(s(n))} = a_{s(n)} + a_n for every n∈Xn \in X, writing ana_n for a(n)a(n).
  2. Prove that for every n∈Xn \in X exactly one of
an⋅as(s(n))=s(as(n)⋅as(n))andas(n)⋅as(n)=s(an⋅as(s(n)))a_n \cdot a_{s(s(n))} = s\bigl(a_{s(n)} \cdot a_{s(n)}\bigr) \qquad\text{and}\qquad a_{s(n)} \cdot a_{s(n)} = s\bigl(a_n \cdot a_{s(s(n))}\bigr)

holds, and that which of the two holds changes at every step.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 5.1.

The numerals, read back as the sets they were built from.

The set 33 is:

answer one of these

The number of elements of the set 44 is:

answer one of these

Of the two statements 2∈32 \in 3 and 2⊂32 \subset 3:

answer one of these

Exercise 5.2.

Inductive sets.

The set N\mathbb{N} of natural numbers proper is:

answer one of these

And P(N0)\mathcal{P}(\mathbb{N}_0) is:

answer one of these

Let KK be any inductive set. Then N0∩K\mathbb{N}_0 \cap K is:

answer one of these

Exercise 5.3.

Each line below alters (N0,0,s)(\mathbb{N}_0, 0, s) in one place. Say which of the five conditions the result fails.

The successor is replaced by s∘ss \circ s.

answer one of these

The carrier is cut down to N\mathbb{N}, keeping ss, with 11 distinguished in place of 00.

answer one of these

The successor is left alone except at 00, where s(0)=def0s(0) \defeq 0.

answer one of these

Exercise 5.4.

Starting elements. Work in an arbitrary Peano system (X,0,s)(X, 0, s).

The elements that are not successors are:

answer one of these

Induction without order gives every non-empty M⊂XM \subset X an element mm with m∉s(M)m \notin s(M). For M=X∖{0}M = X \setminus \{0\} that element is:

answer one of these

And for M=XM = X:

answer one of these

Exercise 5.5.

What the recursion theorem produces. Take A=XA = X throughout, with the addition and multiplication of the chapter.

With a=0a = 0 and g=defs∘sg \defeq s \circ s, the map α\alpha is:

answer one of these

With a=1a = 1 and g(c)=defc+cg(c) \defeq c + c, it is:

answer one of these

Exercise 5.6.

Relabelling. Let (X,0,s)(X, 0, s) and (X′,0′,s′)(X', 0', s') be Peano systems.

Let α:X→X′\alpha : X \to X' satisfy α(0)=0′\alpha(0) = 0' and α∘s=s′∘α\alpha \circ s = s' \circ \alpha. Then α(3)\alpha(3) is:

answer one of these

Drop the condition at 00. The number of maps β:X→X′\beta : X \to X' with β∘s=s′∘β\beta \circ s = s' \circ \beta is then:

answer one of these

And the number of those that are bijections is:

answer one of these

Exercise 5.7.

Arithmetic in a Peano system.

The product s(m)⋅s(n)s(m) \cdot s(n) is:

answer one of these

Suppose a⋅b=0a \cdot b = 0 with aa positive. Then:

answer one of these

Exercise 5.8.

Sums.

The result that defines ∑i=1nai\sum_{i=1}^{n} a_i is:

answer one of these

With ai=defia_i \defeq i, the element ∑i=13ai\sum_{i=1}^{3} a_i is:

answer one of these

In the expression ∑i=1nai\sum_{i=1}^{n} a_i:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker pairs, products, maps, and the sets the pairing axiom lists. This one adds a Peano system to compute in.

The successor

A listed set is typed as it is written, {x} and {x, y}, and its membership criterion is the one the axiom gives: y ∈ {x} is y = x, in the way that x ∈ A ∩ B was a conjunction on an earlier sheet. So the successor needs no notation of its own; it is x ∪ {x}.

Example.

The membership and the equation are one statement, so nothing has to be done to pass between them.

lean worked
1example (x y : Obj) (h : y ∈ {x}) : y = x := by
verified
goalGoals accomplished.

Example.

A union is a disjunction, and its right half is an equation that holds of itself.

lean worked
1example (x : Obj) : x ∈ x ∪ {x} := by
verified
goalGoals accomplished.

Exercise 5.9.

The first half of Proposition 5.10 .

lean proof
1example (x : Obj) : x ⊆ x ∪ {x} := by
goalx : Obj ⊢ x ⊆ x ∪ {x}

Exercise 5.10.

The fourth Peano condition for (N0,0,s)(\mathbb{N}_0, 0, s).

lean proof
1example (x : Obj) : x ∪ {x} ≠ ∅ := by
goalx : Obj ⊢ ¬x ∪ {x} = ∅

Exercise 5.11.

Two inductive sets, and their intersection.

lean proof
1example (I J : Obj) (hI : ∅ ∈ I ∧ ∀ x : Obj, x ∈ I → x ∪ {x} ∈ I)2    (hJ : ∅ ∈ J ∧ ∀ x : Obj, x ∈ J → x ∪ {x} ∈ J) :3    ∅ ∈ I ∩ J ∧ ∀ x : Obj, x ∈ I ∩ J → x ∪ {x} ∈ I ∩ J := by
goalI J : Obj hI : ∅ ∈ I ∧ (∀ (x : Obj), x ∈ I → x ∪ {x} ∈ I) hJ : ∅ ∈ J ∧ (∀ (x : Obj), x ∈ J → x ∪ {x} ∈ J) ⊢ ∅ ∈ I ∩ J ∧ (∀ (x : Obj), x ∈ I ∩ J → x ∪ {x} ∈ I ∩ J)

Exercise 5.12.

Transitivity passes to the successor, which is the step of the induction that makes every element of N0\mathbb{N}_0 transitive.

lean proof
1example (t : Obj) (h : ∀ y : Obj, y ∈ t → y ⊆ t) :2    ∀ y : Obj, y ∈ t ∪ {t} → y ⊆ t ∪ {t} := by
goalt : Obj h : ∀ (y : Obj), y ∈ t → y ⊆ t ⊢ ∀ (y : Obj), y ∈ t ∪ {t} → y ⊆ t ∪ {t}

Exercise 5.13.

The second half of Proposition 5.10 : a set between xx and its successor which reaches outside xx is the successor.

lean proof
1example (x z y : Obj) (h1 : x ⊆ z) (h2 : z ⊆ x ∪ {x}) (hy : y ∈ z) (hyx : y ∉ x) :2    z = x ∪ {x} := by
goalx z y : Obj h1 : x ⊆ z h2 : z ⊆ x ∪ {x} hy : y ∈ z hyx : ¬y ∈ x ⊢ z = x ∪ {x}

Exercise 5.14.

And the third Peano condition, which transitivity was proved for.

lean proof
1example (m n : Obj) (hm : ∀ y : Obj, y ∈ m → y ⊆ m) (hn : ∀ y : Obj, y ∈ n → y ⊆ n)2    (h : m ∪ {m} = n ∪ {n}) : m = n := by
goalm n : Obj hm : ∀ (y : Obj), y ∈ m → y ⊆ m hn : ∀ (y : Obj), y ∈ n → y ⊆ n h : m ∪ {m} = n ∪ {n} ⊢ m = n

A Peano system

ℕ is now read as the carrier XX, with 0 its distinguished element and succ its successor. Nothing about the sets 0=∅0 = \emptyset and 1={∅}1 = \{\emptyset\} survives the change: what a proof may use is the five conditions and nothing else. Two of them have names, Nat.succ_inj for the third and Nat.succ_ne_zero for the fourth. The fifth is a tactic.

induction

induction n with k ih is the fifth condition applied to the set of nn at which the goal holds. It leaves two goals: the goal at 0, and the goal at succ k with ih recording it at k. Prove them under focus dots, as with any pair of goals.

Addition and multiplication arrive as their defining clauses, Nat.add_zero and Nat.add_succ, Nat.mul_zero and Nat.mul_succ. A clause may be cited bare: rw [Nat.add_succ] finds the first ?m + succ ?n in the goal and reads the two off it, and rw [Nat.add_succ m n] names them.

Example.

Two clauses, in the order the sum is peeled: the successor first, then the zero underneath it. rw closes what is left when both sides come out the same.

lean worked
1example (m : ℕ) : m + succ 0 = succ m := by
verified
goalGoals accomplished.

Example.

The first half of Proposition 5.24 . It is listed below as Nat.zero_add, along with the rest of what the lecture proved, so the exercises may lean on it.

lean worked
1example (n : ℕ) : 0 + n = n := by
verified
goalGoals accomplished.

Exercise 5.15.

One is not zero.

lean proof
1example : succ 0 ≠ 0 := by
goal⊢ ¬succ 0 = 0

Exercise 5.16.

A successor may be moved from one side of a sum to the other.

lean proof
1example (m n : ℕ) : m + succ n = succ m + n := by
goalm n : ℕ ⊢ m + succ n = succ m + n

Exercise 5.17.

Corollary 5.19 .

lean proof
1example (n : ℕ) : succ n ≠ n := by
goaln : ℕ ⊢ ¬succ n = n

Exercise 5.18.

Addition cancels.

lean proof
1example (x y z : ℕ) : x + z = y + z → x = y := by
goalx y z : ℕ ⊢ x + z = y + z → x = y

Exercise 5.19.

Corollary 5.28 .

lean proof
1example (m n : ℕ) : m + n = 0 → m = 0 ∧ n = 0 := by
goalm n : ℕ ⊢ m + n = 0 → m = 0 ∧ n = 0

Exercise 5.20.

Nothing but zero can be added without moving.

lean proof
1example (m b : ℕ) : b ≠ 0 → m + b ≠ m := by
goalm b : ℕ ⊢ ¬b = 0 → ¬m + b = m

Exercise 5.21.

A map commuting with the successor is a translation. No commutativity is needed.

lean proof
1example (a : ℕ → ℕ) (h : ∀ n : ℕ, a (succ n) = succ (a n)) (n : ℕ) :2    a n = a 0 + n := by
goala : ℕ → ℕ h : ∀ (n : ℕ), a (succ n) = succ (a n) n : ℕ ⊢ a n = a 0 + n

Exercise 5.22.

Multiplication from the left, at zero.

lean proof
1example (m : ℕ) : 0 * m = 0 := by
goalm : ℕ ⊢ 0 * m = 0

Exercise 5.23.

And one is an identity on the right.

lean proof
1example (m : ℕ) : m * succ 0 = m := by
goalm : ℕ ⊢ m * succ 0 = m

Exercise 5.24.

Multiplication from the left, at a successor. The two clauses only ever act on the right, so this one takes more work.

lean proof
1example (m n : ℕ) : succ m * n = m * n + n := by
goalm n : ℕ ⊢ succ m * n = m * n + n

Exercise 5.25.

Multiplication distributes over addition.

lean proof
1example (m n p : ℕ) : m * (n + p) = m * n + m * p := by
goalm n p : ℕ ⊢ m * (n + p) = m * n + m * p

Exercise 5.26.

And it commutes, once both sides can be peeled.

lean proof
1example (m n : ℕ) : m * n = n * m := by
goalm n : ℕ ⊢ m * n = n * m
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 6

Relations and Order

Taught

Relations and Order

People classify: we decide which things belong together, and mathematics does this on every page. This chapter covers relations in general, then the two most important kinds, orders and equivalences, and finally the way an equivalence cuts a set into pieces.

Relations

A relation records, for each pair of elements, whether the two stand in a given relationship. Since a pair with an order to it is an ordered pair, and the set of all of them is a Cartesian product, no new definitions are needed.

Definition 6.1 (Binary relation).

A relation RR on a set SS is a set of ordered pairs of elements of SS, that is, a subset R⊂S×SR \subset S \times S. We abbreviate (x,y)∈R(x, y) \in R to xRyx \mathbin{R} y, and say xx is related to yy by RR; if (x,y)∉R(x, y) \notin R we write xR̸yx \not\mathbin{R} y.

Putting the symbol between the two elements is infix notation; writing R(x,y)R(x, y) instead is prefix notation. For equivalence relations we usually take a symbol such as ≡\equiv or ∼\sim, and for strict orders the symbol <<.

Two relations are distinguished exactly by the pairs belonging to one and not the other, since a relation is its set of pairs. At the two extremes, S×SS \times S is the universal relation on SS and ∅\emptyset is the empty relation. Neither is of much interest: if everything is related to everything then being related is no mark of distinction, and if nothing is related to anything there is nothing to say.

Definition 6.2 (Reflexive, symmetric, transitive).

Let RR be a relation on a set SS. Then RR is

  1. reflexive if xRxx \mathbin{R} x for every x∈Sx \in S;
  2. symmetric if xRy  ⟹  yRxx \mathbin{R} y \implies y \mathbin{R} x for all x,y∈Sx, y \in S;
  3. transitive if (xRy∧yRz)  ⟹  xRz(x \mathbin{R} y \land y \mathbin{R} z) \implies x \mathbin{R} z for all x,y,z∈Sx, y, z \in S.

Example 6.3.

From a familiar children’s game, let S={rock,scissors,paper}S = \{\text{rock}, \text{scissors}, \text{paper}\} and let BB, read “beats”, be

B={(rock,scissors),(scissors,paper),(paper,rock)}.B = \bigl\{(\text{rock}, \text{scissors}), (\text{scissors}, \text{paper}), (\text{paper}, \text{rock})\bigr\}.

This BB is none of the three: rock does not beat itself, rock beats scissors while scissors does not beat rock, and rock beats scissors and scissors beats paper while rock does not beat paper.

Definition 6.4 (Equivalence relation).

A relation is an equivalence relation if it is reflexive, symmetric and transitive. When ∼\sim is an equivalence relation and x∼yx \sim y, we say xx and yy are equivalent with respect to ∼\sim.

Example 6.5.

On S={1,2,3,4}S = \{1, 2, 3, 4\} the relation R={(1,2),(2,1),(1,1),(2,2)}R = \{(1,2), (2,1), (1,1), (2,2)\} is symmetric and transitive but not reflexive, since 3R̸33 \not\mathbin{R} 3. Adjoining exactly what is missing gives R1=defR∪{(3,3),(4,4)}R_1 \defeq R \cup \{(3,3), (4,4)\}, which is reflexive, inherits symmetry and transitivity, and is therefore an equivalence relation. We call R1R_1 the reflexive closure of RR: it adds to RR only the pairs that reflexivity requires.

Example 6.6.

Transitivity is the condition that most often fails. Let SS be the partially exposed stones in a stream you wish to cross, and for x,y∈Sx, y \in S let x∼yx \sim y mean that you can step directly from xx to yy without getting wet. This is reflexive, since once on a stone you can hop on the spot, and symmetric, since a step you can take one way you can take back. It is not generally transitive: that you can reach yy from xx and zz from yy says nothing about reaching zz from xx in one step.

Problem 6.1.

Check that the relation R={(1,2),(2,1),(1,1),(2,2)}R = \{(1,2), (2,1), (1,1), (2,2)\} above is symmetric and transitive, working from the definitions rather than from the picture.

Problem 6.2.

Let AA and BB be sets. Many texts call a subset R⊂A×BR \subset A \times B a relation from AA to BB. Show that every such RR is a relation on A∪BA \cup B in the sense of Definition 6.1 .

Problem 6.3.

Let RR be a symmetric and transitive relation on a set SS, and put T=def{x∈S∣xRx}T \defeq \{x \in S \mid x \mathbin{R} x\}. Show that xRyx \mathbin{R} y implies x,y∈Tx, y \in T, and that RR is an equivalence relation on TT.

Order Relations

Orders are the second of the two kinds of relation we shall need. We isolate the properties an order has, so that when we later build one on the natural numbers out of addition alone we know exactly what has to be checked.

Definition 6.7 (Strict linear order).

A strict linear order on a set SS is a relation, commonly written <<, satisfying

  1. the transitivity law: for all x,y,z∈Sx, y, z \in S, if x<yx < y and y<zy < z then x<zx < z;
  2. the trichotomy law: for all x,y∈Sx, y \in S, exactly one of x<yx < y, x=yx = y, y<xy < x holds.

When x<yx < y holds we say xx is strictly less than yy. Strict linear orders are also called strict total orders, in contrast with the partial orders of the next section. The word exactly in the trichotomy law says two things: any two elements can be compared, and no two of the alternatives hold at once. Proofs use the second far more often than the first, so we isolate it.

Proposition 6.8 (Anti-reflexivity).

Let << be a strict linear order on a set SS. Then ¬(x<x)\neg(x < x) for every x∈Sx \in S.

Discussion.

The statement is a universally quantified negation, so we fix an arbitrary xx and rule out x<xx < x. Only the trichotomy law says anything about a single pair, so we apply it to the pair xx and xx. It offers three alternatives, x<xx < x, x=xx = x and x<xx < x, and exactly one of them holds. The middle one holds, since equality is reflexive, which rules out the other two; and each of those is the statement we wish to deny.

Proof.

Let x∈Sx \in S. Trichotomy applied to xx and xx says that exactly one of x<xx < x, x=xx = x, x<xx < x holds. Since x=xx = x holds, neither occurrence of x<xx < x can, so ¬(x<x)\neg(x < x).

Trichotomy can be traded for the weaker demand that at least one alternative hold, provided we also assume anti-reflexivity.

Proposition 6.9 (Characterising strict linear orders).

Let << be a relation on a set SS such that

  1. for all x,y,z∈Sx, y, z \in S, if x<yx < y and y<zy < z then x<zx < z;
  2. for all x,y∈Sx, y \in S, (x<y)∨(x=y)∨(y<x)(x < y) \lor (x = y) \lor (y < x);
  3. for all x∈Sx \in S, ¬(x<x)\neg(x < x).

Then << is a strict linear order on SS.

Discussion.

The definition asks for two laws, and the first is the first hypothesis verbatim, so only trichotomy needs proof. It splits in two: that at least one alternative holds is the second hypothesis, again verbatim, and it remains to show that no two hold together. There are three possible pairs, the two strict comparisons together or either strict comparison alongside x=yx = y, and we take them in turn. Two opposite strict comparisons feed into transitivity and produce x<xx < x; a strict comparison alongside an equality lets us substitute one letter for the other and produce x<xx < x again. Each case gives x<xx < x, which the third hypothesis forbids.

Proof.

The first hypothesis is the transitivity law. For trichotomy, let x,y∈Sx, y \in S. The second hypothesis gives at least one of x<yx < y, x=yx = y, y<xy < x.

If both x<yx < y and y<xy < x held, transitivity would give x<xx < x, against the third hypothesis. If x<yx < y and x=yx = y held, substitution gives x<xx < x; and y<xy < x with x=yx = y gives x<xx < x likewise. So no two of the alternatives hold together, exactly one holds, and that is the trichotomy law.

A strict order says which of two elements comes first. For bounds, minima and induction it is more convenient to use the relation that also allows equality.

Definition 6.10 (Associated non-strict order).

Let << be a strict linear order on a set SS. The associated non-strict order ⩽\leqslant is defined by: x⩽yx \leqslant y holds if and only if (x<y)∨(x=y)(x < y) \lor (x = y) holds. When x⩽yx \leqslant y we say xx is less than or equal to yy.

Proposition 6.11 (Laws of the associated order).

Let << be a strict linear order on SS with associated ⩽\leqslant. For all x,y∈Sx, y \in S:

  1. (x⩽y)∨(y⩽x)(x \leqslant y) \lor (y \leqslant x);
  2. if x⩽yx \leqslant y and y⩽xy \leqslant x then x=yx = y;
  3. ¬(x⩽y)\neg(x \leqslant y) if and only if y<xy < x;
  4. ¬(x<y)\neg(x < y) if and only if y⩽xy \leqslant x.

Discussion.

All four come from the list of three alternatives in trichotomy, so in each we go through the list and see which entries remain. The first is a disjunction and every entry produces one of its halves: x<yx < y gives x⩽yx \leqslant y, y<xy < x gives y⩽xy \leqslant x, and x=yx = y gives both. The second is a conditional whose conclusion is an equality, so we suppose x≠yx \neq y and derive a contradiction: the definition turns both hypotheses into strict comparisons, transitivity gives x<xx < x, and anti-reflexivity forbids it. The last two are biconditionals, proved by crossing entries off the list. Denying x⩽yx \leqslant y deletes the first two entries and leaves y<xy < x; conversely y<xy < x deletes those same two, since trichotomy allows only one. Denying x<yx < y deletes just the first entry, leaving x=yx = y or y<xy < x, and that pair is what y⩽xy \leqslant x abbreviates.

Proof.

For the first, trichotomy gives x<yx < y, x=yx = y or y<xy < x, and in each case the definition gives x⩽yx \leqslant y or y⩽xy \leqslant x.

For the second, suppose x⩽yx \leqslant y and y⩽xy \leqslant x, and suppose x≠yx \neq y. Then the definition gives x<yx < y and y<xy < x, so transitivity gives x<xx < x, contradicting anti-reflexivity. Hence x=yx = y.

For the third, if ¬(x⩽y)\neg(x \leqslant y) then neither x<yx < y nor x=yx = y holds, so trichotomy leaves y<xy < x. Conversely y<xy < x excludes both x<yx < y and x=yx = y, so ¬(x⩽y)\neg(x \leqslant y).

For the fourth, trichotomy says ¬(x<y)\neg(x < y) holds precisely when x=yx = y or y<xy < x, which by the definition is precisely y⩽xy \leqslant x.

From transitivity of << we get two further transitivity laws, one for each way of mixing the two relations.

Proposition 6.12 (Mixed transitivity).

Let << be a strict linear order on SS with associated ⩽\leqslant, and let x,y,z∈Sx, y, z \in S. Then

  1. if x<yx < y and y⩽zy \leqslant z then x<zx < z;
  2. if x⩽yx \leqslant y and y<zy < z then x<zx < z.

Discussion.

Each part has one strict hypothesis and one non-strict one, and the definition of ⩽\leqslant splits the non-strict hypothesis into two cases, so each part has two cases. In the equality case no order reasoning is needed at all: the conclusion is the strict hypothesis with one letter renamed. In the strict case both hypotheses are strict, so the transitivity law applies.

Proof.

For the first, if y=zy = z then x<zx < z is the hypothesis x<yx < y with zz written for yy; and if y<zy < z then transitivity gives x<zx < z.

For the second, if x=yx = y then x<zx < z is the hypothesis y<zy < z with xx written for yy; and if x<yx < y then transitivity again gives x<zx < z.

Corollary 6.13 (Transitivity of the non-strict order).

Let << be a strict linear order on SS with associated ⩽\leqslant. If x⩽yx \leqslant y and y⩽zy \leqslant z then x⩽zx \leqslant z.

Proof.

If x=yx = y and y=zy = z then x=zx = z. If x=yx = y and y<zy < z then x<zx < z; if x<yx < y and y=zy = z then x<zx < z; and if x<yx < y and y<zy < z then mixed transitivity gives x<zx < z. In every case the definition of ⩽\leqslant gives x⩽zx \leqslant z.

Definition 6.14 (Reverse orders).

Let << be a strict linear order on SS. We write x>yx > y to mean y<xy < x, and say xx is strictly greater than yy; and x⩾yx \geqslant y to mean (x>y)∨(x=y)(x > y) \lor (x = y), and say xx is greater than or equal to yy.

Since << and ⩽\leqslant are transitive, so are >> and ⩾\geqslant.

Definition 6.15 (Chains).

The notation a<b<ca < b < c abbreviates (a<b)∧(b<c)(a < b) \land (b < c), and similarly for >>, ⩽\leqslant and ⩾\geqslant, for more than three terms, and for mixtures: a⩽b<c<da \leqslant b < c < d abbreviates (a⩽b)∧(b<c)∧(c<d)(a \leqslant b) \land (b < c) \land (c < d).

By transitivity, a<b<ca < b < c gives a<ca < c.

Problem 6.4.

What is the difference between the trichotomy law and the weak trichotomy law? Which of the two implies the other?

Problem 6.5.

Show that a strict linear order is not symmetric on any set with at least two elements, and decide whether the associated ⩽\leqslant can ever be symmetric.

Partial Orders and Extrema

The order relations of the previous section were strict and linear: transitive and trichotomous, with the non-strict ⩽\leqslant built afterwards. There is a second tradition, equally common, which takes the non-strict relation as primitive and weakens trichotomy so that incomparable pairs are allowed. That is the language of partial orders, and it is what one wants for inclusion of sets.

Definition 6.16 (Partial order).

A relation RR on a set MM is a partial order, and MM is then ordered by RR, if RR is

  1. reflexive: aRaa \mathbin{R} a for every a∈Ma \in M;
  2. antisymmetric: aRba \mathbin{R} b and bRab \mathbin{R} a imply a=ba = b;
  3. transitive: aRba \mathbin{R} b and bRcb \mathbin{R} c imply aRca \mathbin{R} c.

We usually write a⩽ba \leqslant b for aRba \mathbin{R} b, and then a<ba < b for (a⩽b)∧(a≠b)(a \leqslant b) \land (a \neq b), with b⩾ab \geqslant a and b>ab > a as before.

Definition 6.17 (Comparable elements and total orders).

Let MM be partially ordered. Elements a,b∈Ma, b \in M are comparable if a⩽ba \leqslant b or b⩽ab \leqslant a. The order is a total order, or linear order, if every two elements are comparable.

Example 6.18.

The power set P(M)\mathcal{P}(M) is partially ordered by ⊂\subset, and also by the reverse inclusion. It is not totally ordered as soon as MM has two elements aa and bb, since {a}\{a\} and {b}\{b\} are incomparable: neither contains the other. The natural numbers will turn out to be totally ordered, once we put an order on them below.

Remark (Partial versus strict).

The two languages agree on total orders. If << is a strict linear order and ⩽\leqslant is the associated relation, then ⩽\leqslant is a total order in the present sense: reflexivity is immediate, antisymmetry is one of the laws proved above, and transitivity is its corollary. Conversely, from a total order ⩽\leqslant the relation a<b  ⟺  (a⩽b)∧(a≠b)a < b \iff (a \leqslant b) \land (a \neq b) is a strict linear order. What partial orders add is the possibility that some pairs are incomparable.

Definition 6.19 (Minimal and maximal elements).

Let MM be partially ordered and A⊂MA \subset M non-empty. An element a0∈Aa_0 \in A is minimal in AA if no element of AA is strictly smaller, that is, {a∈A∣a<a0}=∅\{a \in A \mid a < a_0\} = \emptyset; and a1∈Aa_1 \in A is maximal in AA if no element of AA is strictly larger.

A bound of a set need not lie in the set; a minimum or maximum must.

Definition 6.20 (Bounds, minima, maxima).

Let SS be a subset of a partially ordered set UU.

  1. An element b∈Ub \in U is a lower bound of SS if b⩽xb \leqslant x for every x∈Sx \in S, and B∈UB \in U is an upper bound if x⩽Bx \leqslant B for every x∈Sx \in S.
  2. An element m∈Sm \in S is a minimum, or least element, of SS if m⩽xm \leqslant x for every x∈Sx \in S; and M∈SM \in S is a maximum, or greatest element, if x⩽Mx \leqslant M for every x∈Sx \in S.

The difference is membership: a minimum is a lower bound that happens to lie in SS. Not every subset has either, as the natural numbers will shortly illustrate: they have a least element and no greatest one.

Proposition 6.21 (A bound inside the set is an extremum).

Let SS be a subset of a partially ordered set. If bb is a lower bound of SS and b∈Sb \in S, then bb is a minimum of SS; and if BB is an upper bound of SS with B∈SB \in S, then BB is a maximum.

Discussion.

The two halves are dual, so it is enough to plan the first and reverse the inequalities for the second. What we are given is a lower bound of SS that also lies in SS. The bound hypothesis is b⩽xb \leqslant x for every x∈Sx \in S, which is the inequality a minimum must satisfy, and the membership is precisely the extra clause the definition of a minimum asks for. Together these are the claim; the two definitions differ only by that clause.

Proof.

If bb is a lower bound of SS then b⩽xb \leqslant x for every x∈Sx \in S, and b∈Sb \in S by hypothesis; those two together are the definition of a minimum. The argument for maxima is the same with the inequalities reversed.

Existence may fail, but uniqueness does not.

Proposition 6.22 (Uniqueness of extrema).

Let SS be a subset of a partially ordered set. The minimum of SS, if it exists, is unique, and likewise the maximum.

Discussion.

Suppose two elements are both minima. Each, being a minimum, is below every element of SS, and each, being a minimum, lies in SS; so applying the defining property of the first to the second and of the second to the first gives the two inequalities antisymmetry needs. The argument for maxima is identical with the inequalities reversed. The proposition does not say that a minimum exists, only that there cannot be two. Bounds outside SS are under no such restriction, since a set may have many lower bounds.

Proof.

Let m1m_1 and m2m_2 both be minima of SS. Then m1⩽m2m_1 \leqslant m_2, since m1m_1 is a minimum and m2∈Sm_2 \in S; and m2⩽m1m_2 \leqslant m_1 for the same reason with the roles exchanged. Antisymmetry gives m1=m2m_1 = m_2. The argument for maxima is identical.

Problem 6.6.

For P(M)\mathcal{P}(M) ordered by inclusion, identify the minimum and the maximum. In P(M)∖{∅}\mathcal{P}(M) \setminus \{\emptyset\}, show that every singleton is minimal, and decide whether there is a minimum.

Problem 6.7.

Let AA and BB be totally ordered sets and let f:A→Bf : A \to B be a bijection with f(a)<f(b)f(a) < f(b) whenever a<ba < b. Show that a<ba < b whenever f(a)<f(b)f(a) < f(b), and deduce that f−1f^{-1} has the same property.

Partitions

Consider a three-piece jigsaw. How many states of assembly are there, counting two states as different when one has two pieces interlocked that the other does not? The answer is five. Representing each cluster of interlocked pieces by the set of its numbers, each state becomes a family of such sets:

ΠA={{1,2,3}},ΠB={{1,2},{3}},ΠC={{2,3},{1}},ΠD={{1,3},{2}},ΠE={{1},{2},{3}}.\begin{aligned} \Pi_A &= \bigl\{\{1,2,3\}\bigr\}, & \Pi_B &= \bigl\{\{1,2\}, \{3\}\bigr\}, & \Pi_C &= \bigl\{\{2,3\}, \{1\}\bigr\}, \\ \Pi_D &= \bigl\{\{1,3\}, \{2\}\bigr\}, & \Pi_E &= \bigl\{\{1\}, \{2\}, \{3\}\bigr\}. \end{aligned}

Each is a family of non-empty sets whose union is {1,2,3}\{1,2,3\}, no two of which share an element.

Definition 6.23 (Partition).

Let SS be a non-empty set. A partition Π\Pi of SS is an indexed family Π=def{Ai}i∈I\Pi \defeq \{A_i\}_{i \in I} of non-empty subsets of SS with

⋃i∈IAi=S,Ai∩Aj=∅  whenever i≠j.\bigcup_{i \in I} A_i = S, \qquad A_i \cap A_j = \emptyset \ \text{ whenever } i \neq j.

The AiA_i are the blocks of the partition.

Example 6.24.

The set S={1,2,3,4}S = \{1,2,3,4\} has {{1,2,3,4}}\bigl\{\{1,2,3,4\}\bigr\} as its only one-block partition, and seven with two blocks:

{{1},{2,3,4}},{{2},{1,3,4}},{{3},{1,2,4}},{{4},{1,2,3}},{{1,2},{3,4}},{{1,3},{2,4}},{{1,4},{2,3}}.\begin{aligned} &\bigl\{\{1\}, \{2,3,4\}\bigr\}, \quad \bigl\{\{2\}, \{1,3,4\}\bigr\}, \quad \bigl\{\{3\}, \{1,2,4\}\bigr\}, \quad \bigl\{\{4\}, \{1,2,3\}\bigr\}, \\ &\bigl\{\{1,2\}, \{3,4\}\bigr\}, \quad \bigl\{\{1,3\}, \{2,4\}\bigr\}, \quad \bigl\{\{1,4\}, \{2,3\}\bigr\}. \end{aligned}

It has six with three blocks, and its only four-block partition is {{1},{2},{3},{4}}\bigl\{\{1\},\{2\},\{3\},\{4\}\bigr\}.

A partition is how we get a handle on a large set: cut it into blocks, deal with the blocks one at a time, and put the pieces back together. The blocks are usually chosen by a shared feature.

Example 6.25 (Informal).

Assuming you know the real numbers, let SS be a set of them and suppose a calculation requires that we treat numbers differently according to sign. Take the three blocks

A1=def{x∈S∣x>0},A2=def{x∈S∣x<0},A3=def{0}.A_1 \defeq \{x \in S \mid x > 0\}, \qquad A_2 \defeq \{x \in S \mid x < 0\}, \qquad A_3 \defeq \{0\}.

This is a partition only if SS holds a positive number, a negative number and zero, since blocks are required to be non-empty. Without that requirement every family of conditions would partition every set.

Problem 6.8.

List the six three-block partitions of {1,2,3,4}\{1,2,3,4\}.

Equivalence Classes

Fix an equivalence relation ∼\sim on a set SS. We cut SS into pieces by grouping together everything related to a given element.

Definition 6.26 (Equivalence class).

Let ∼\sim be an equivalence relation on a set SS and let x∈Sx \in S. The equivalence class of xx is

[x]=def{s∈S∣s∼x},[x] \defeq \{s \in S \mid s \sim x\},

and the set of all equivalence classes is

S/∼=def{[x]∣x∈S}⊂P(S),S/{\sim} \defeq \bigl\{[x] \mid x \in S\bigr\} \subset \mathcal{P}(S),

called SS modulo ∼\sim, or the quotient of SS by ∼\sim.

Example 6.27.

On S={1,2,3,4}S = \{1,2,3,4\} with the equivalence relation R1R_1 above, [1]=[2]={1,2}[1] = [2] = \{1,2\}, [3]={3}[3] = \{3\} and [4]={4}[4] = \{4\}. Distinct classes here do not meet, and the next proposition shows this always happens.

Proposition 6.28 (Characterising equivalence classes).

Let ∼\sim be an equivalence relation on a set SS and let a,b∈Sa, b \in S. The following are equivalent.

  1. a∼ba \sim b;
  2. [a]∩[b]≠∅[a] \cap [b] \neq \emptyset;
  3. [a]=[b][a] = [b].

Discussion.

Three statements would ordinarily need six implications, but a cycle is enough: we prove 1  ⟹  3  ⟹  2  ⟹  11 \implies 3 \implies 2 \implies 1 and let each statement reach every other by going round. For 1  ⟹  31 \implies 3 we assume a∼ba \sim b and aim at an equality of sets, so we chase an element: c∈[a]c \in [a] means c∼ac \sim a, and the chain c∼a∼bc \sim a \sim b closes by transitivity, with symmetry supplying whichever direction the chain needs; the reverse inclusion is the same argument with aa and bb exchanged. For 3  ⟹  23 \implies 2 reflexivity puts aa in [a][a], so if the classes agree then aa itself witnesses that they meet. For 2  ⟹  12 \implies 1 a shared element cc gives c∼ac \sim a and c∼bc \sim b, and symmetry with transitivity gives a∼ba \sim b. Only the three defining properties are used.

Proof.

1  ⟹  31 \implies 3. Suppose a∼ba \sim b and let c∈[a]c \in [a], so c∼ac \sim a. With a∼ba \sim b transitivity gives c∼bc \sim b, that is c∈[b]c \in [b]; hence [a]⊂[b][a] \subset [b]. Symmetry gives b∼ab \sim a, and the same argument with aa and bb exchanged gives [b]⊂[a][b] \subset [a]. So [a]=[b][a] = [b].

3  ⟹  23 \implies 2. Reflexivity gives a∼aa \sim a, so a∈[a]a \in [a]. If [a]=[b][a] = [b] then a∈[a]∩[b]a \in [a] \cap [b], which is therefore non-empty.

2  ⟹  12 \implies 1. Let c∈[a]∩[b]c \in [a] \cap [b]. Then c∼ac \sim a and c∼bc \sim b. Symmetry gives a∼ca \sim c, and transitivity with c∼bc \sim b gives a∼ba \sim b.

Remark (Disjoint decomposition).

It follows that SS is the union of the classes and that distinct classes are disjoint:

S=⋃A∈S/∼A,A1∩A2=∅  whenever A1≠A2 in S/∼.S = \bigcup_{A \in S/\sim} A, \qquad A_1 \cap A_2 = \emptyset \ \text{ whenever } A_1 \neq A_2 \text{ in } S/{\sim}.

An equivalence relation therefore breaks SS into pairwise disjoint non-empty pieces. Some authors write S=⨆A∈S/∼AS = \bigsqcup_{A \in S/\sim} A for a union whose parts are known to be disjoint.

Problem 6.9.

Let ∼\sim be an equivalence relation on SS. Show that x∈[x]x \in [x] for every x∈Sx \in S, and that if y∈[x]y \in [x] then [y]=[x][y] = [x].

Problem 6.10 (Informal).

Assuming you know the real numbers and the whole numbers, let x∼yx \sim y mean that x−yx - y is a whole number. Check that ∼\sim is an equivalence relation on the real numbers, and describe [0][0] and [12]\bigl[\tfrac{1}{2}\bigr].

Problem 6.11.

Let f:S→Tf : S \to T be a map and declare x∼yx \sim y on SS when f(x)=f(y)f(x) = f(y). Show that ∼\sim is an equivalence relation, and that S/∼S/{\sim} is in bijection with the image f(S)f(S).

From Equivalence Relations to Partitions

An equivalence relation gives a partition, and a partition gives an equivalence relation. We prove each direction in turn.

Theorem 6.29 (Equivalence relations induce partitions).

Let ∼\sim be an equivalence relation on a non-empty set SS. Then the family of its equivalence classes is a partition of SS, called the partition induced by ∼\sim.

Discussion.

We check the three conditions in the definition of a partition: blocks non-empty, blocks pairwise disjoint, blocks covering SS. Non-emptiness is immediate, since reflexivity puts xx in [x][x]. Disjointness is the previous proposition read contrapositively: if two classes meet they are equal, so distinct classes cannot meet. For the cover, the same reflexivity observation puts every ss in the block [s][s], while the reverse inclusion is automatic because every class is a subset of SS. One class may have many labels, since [x]=[y][x] = [y] whenever x∼yx \sim y, so we index the family by the distinct classes and do not count one block twice.

Proof.

Write the distinct classes as an indexed family {Ci}i∈I\{C_i\}_{i \in I}.

Each CiC_i is non-empty: if Ci=[x]C_i = [x] then x∈[x]x \in [x] by reflexivity. If i≠ji \neq j then Ci≠CjC_i \neq C_j, so Ci∩Cj=∅C_i \cap C_j = \emptyset by the previous proposition. Every CiC_i is a subset of SS, so the union of the CiC_i is contained in SS; and if s∈Ss \in S then s∈[s]s \in [s] by reflexivity, and [s][s] is one of the CiC_i, so ss lies in the union. Hence the union is SS, and the family is a partition.

Example 6.30.

The relation R1R_1 on {1,2,3,4}\{1,2,3,4\} induces the partition {{1,2},{3},{4}}\bigl\{\{1,2\}, \{3\}, \{4\}\bigr\}, which is the list of classes computed above.

Theorem 6.31 (Partitions induce equivalence relations).

Let Π\Pi be a partition of a set SS, and for x,y∈Sx, y \in S declare x∼yx \sim y to mean that xx and yy lie in the same block of Π\Pi. Then ∼\sim is an equivalence relation on SS, and the partition it induces is Π\Pi itself.

Discussion.

There are two claims. For the first, the three properties come from the three conditions on a partition. Reflexivity uses the cover, since every xx lies in some block. Symmetry is immediate, since “same block” does not depend on which element is named first. Transitivity uses disjointness: if xx and yy share a block and yy and zz share a block, then yy lies in both, so the two blocks meet and are therefore the same block, which then holds xx and zz. For the second claim, fix xx and let AA be the block holding it. Then y∈[x]y \in [x] exactly when yy shares a block with xx, which is exactly when y∈Ay \in A; so the class [x][x] is the block AA, and the family of classes is Π\Pi.

Proof.

Write Π={Ai}i∈I\Pi = \{A_i\}_{i \in I}, so the AiA_i are non-empty, pairwise disjoint, and their union is SS.

For reflexivity, an x∈Sx \in S lies in some AiA_i by the cover, so x∼xx \sim x. For symmetry, if x∼yx \sim y then both lie in some AiA_i, so both lie in it in the other order and y∼xy \sim x. For transitivity, if x∼yx \sim y and y∼zy \sim z then x,y∈Aix, y \in A_i and y,z∈Ajy, z \in A_j for some i,ji, j; then y∈Ai∩Ajy \in A_i \cap A_j, so i=ji = j since distinct blocks are disjoint, and x,z∈Aix, z \in A_i gives x∼zx \sim z. So ∼\sim is an equivalence relation.

For the second claim, let x∈Sx \in S and let AA be the block holding xx, unique because distinct blocks are disjoint. Then y∈[x]y \in [x] if and only if y∼xy \sim x, which holds if and only if y∈Ay \in A. So [x]=A[x] = A, and the family of classes is exactly Π\Pi.

Problem 6.12.

Take the partition {{1,2},{3},{4}}\bigl\{\{1,2\}, \{3\}, \{4\}\bigr\} of {1,2,3,4}\{1,2,3,4\} and write down every pair in the equivalence relation it induces. Check that you recover R1R_1.

Problem 6.13.

How many equivalence relations are there on a set with three elements? Count the partitions, then appeal to the two theorems.

The Order on the Natural Numbers

We now define the order on the natural numbers from addition. Throughout this section we work in N0\mathbb{N}_0, which is a Peano system under ss, so all five conditions and the recursion theorem apply. Addition already suggests the order: nn lies beyond mm when it is reached from mm by adding something positive.

Definition 6.32 (Order on the natural numbers).

For m,n∈N0m, n \in \mathbb{N}_0 we define m<nm < n to hold if and only if there is a b∈Nb \in \mathbb{N} with n=m+bn = m + b; in symbols,

m<n  ⟺  ∃b∈N (n=m+b).m < n \iff \exists b \in \mathbb{N}\,(n = m + b).

Since 0∉N0 \notin \mathbb{N}, the difference bb is required to be positive. Admitting b=0b = 0 would make every number less than itself and break trichotomy.

Corollary 6.33 (Adding a positive element moves you up).

If x∈N0x \in \mathbb{N}_0 and y∈Ny \in \mathbb{N} then x<x+yx < x + y. In particular m<s(m)m < s(m) for every m∈N0m \in \mathbb{N}_0.

Proof.

Take n=x+yn = x + y in the definition. For the second claim take y=1y = 1, which lies in N\mathbb{N}, and recall m+1=s(m)m + 1 = s(m).

The definition is stated in terms of differences, so we first show that a difference is unique.

Proposition 6.34 (Uniqueness of differences).

Let a,b∈N0a, b \in \mathbb{N}_0. Then a+x=ba + x = b has at most one solution x∈N0x \in \mathbb{N}_0.

Discussion.

Uniqueness statements are proved by assuming two solutions and forcing them to agree, so we let A(a)A(a) be the statement that any two solutions for that aa coincide, and induct on aa. The base case is immediate, since 0+x=b0 + x = b reads x=bx = b by addition from the left. For the step we take s(a)+x1=b=s(a)+x2s(a) + x_1 = b = s(a) + x_2; both sides are successors, of a+x1a + x_1 and of a+x2a + x_2, and the third Peano condition strips a successor from an equation, leaving an equation the inductive hypothesis handles.

Proof.

We induct on aa. For a=0a = 0, the equation 0+x=b0 + x = b gives x=bx = b by addition from the left, so there is at most one solution.

Suppose the claim holds for aa and that s(a)+x1=b=s(a)+x2s(a) + x_1 = b = s(a) + x_2. By addition from the left, s(a)+xi=s(a+xi)s(a) + x_i = s(a + x_i), so s(a+x1)=s(a+x2)s(a + x_1) = s(a + x_2); the third Peano condition gives a+x1=a+x2a + x_1 = a + x_2, and the inductive hypothesis gives x1=x2x_1 = x_2. Induction completes the proof.

To decide whether m⩽nm \leqslant n we do not need the case split in the definition of the associated order: one difference is enough, provided we now allow it to be 00.

Proposition 6.35 (The associated order on the natural numbers).

For m,n∈N0m, n \in \mathbb{N}_0 we have m⩽nm \leqslant n if and only if n=m+bn = m + b for some b∈N0b \in \mathbb{N}_0.

Discussion.

The statement is a biconditional, so there are two conditionals. Going forwards, the definition of ⩽\leqslant unfolds m⩽nm \leqslant n into the two cases m<nm < n and m=nm = n, and we must produce a difference in each: the first hands us one directly, and in the second b=0b = 0 works. Going backwards we are given a difference and must decide which half of ⩽\leqslant holds, so we split on whether bb is 00; if it is then m=nm = n, and if it is not then b∈Nb \in \mathbb{N} and the definition of << applies. Either way m⩽nm \leqslant n.

Proof.

Suppose m⩽nm \leqslant n. Then m<nm < n or m=nm = n. In the first case the definition of << supplies b∈Nb \in \mathbb{N} with n=m+bn = m + b; in the second, b=0b = 0 serves, since m+0=m=nm + 0 = m = n. Either way b∈N0b \in \mathbb{N}_0.

Conversely suppose n=m+bn = m + b with b∈N0b \in \mathbb{N}_0. If b=0b = 0 then m=nm = n, so m⩽nm \leqslant n. If b≠0b \neq 0 then b∈Nb \in \mathbb{N}, so m<nm < n and again m⩽nm \leqslant n.

When m⩽nm \leqslant n the bb with m+b=nm + b = n is unique, by the proposition on differences, and we write it n−mn - m. So subtraction is defined exactly when the answer lies in N0\mathbb{N}_0.

Proposition 6.36 (Positive means greater than zero).

Let n∈N0n \in \mathbb{N}_0. Then n>0n > 0 if and only if n∈Nn \in \mathbb{N}. Consequently 0⩽n0 \leqslant n for every n∈N0n \in \mathbb{N}_0.

Discussion.

Both directions run through the one equation n=0+bn = 0 + b. Going forwards we must produce a difference witnessing 0<n0 < n, and b=nb = n satisfies the equation, lying in N\mathbb{N} because that is the hypothesis. Going backwards the definition hands us a b∈Nb \in \mathbb{N} with n=0+bn = 0 + b, so nn and bb are the same element and the hypothesis transfers. The consequence follows: an element of N0\mathbb{N}_0 is either 00, where equality serves, or lies in N\mathbb{N}, where the biconditional gives 0<n0 < n.

Proof.

Suppose n∈Nn \in \mathbb{N}. Then n=0+nn = 0 + n by addition from the left, and n∈Nn \in \mathbb{N}, so 0<n0 < n by the definition of <<.

Conversely suppose 0<n0 < n. The definition gives b∈Nb \in \mathbb{N} with n=0+bn = 0 + b, so n=b∈Nn = b \in \mathbb{N}.

Finally, an n∈N0n \in \mathbb{N}_0 is either 00 or a member of N\mathbb{N}; in the first case 0=n0 = n and in the second 0<n0 < n, so 0⩽n0 \leqslant n in both.

The proof that << is an order splits N0\mathbb{N}_0 at a chosen element, and we use the same splitting later for the induction variants and for well-ordering, so we give it a name.

Definition 6.37 (Cuts).

For a∈N0a \in \mathbb{N}_0 we write

La=def{x∈N0∣x<a},Ra=def{x∈N0∣x⩾a}.L_a \defeq \{x \in \mathbb{N}_0 \mid x < a\}, \qquad R_a \defeq \{x \in \mathbb{N}_0 \mid x \geqslant a\}.

Theorem 6.38 (The natural numbers are strictly ordered).

The relation of the definition above is a strict linear order on N0\mathbb{N}_0.

Discussion.

The definition of a strict linear order wants transitivity and trichotomy, and the characterisation proved earlier lets us replace the second by weak trichotomy and anti-reflexivity, so there are three things to prove. Transitivity is a calculation: two positive differences add up to a single one, which is positive by closure. Anti-reflexivity follows from uniqueness of differences, since a<aa < a would exhibit aa as a+xa + x with xx positive while a=a+0a = a + 0 exhibits it with difference 00, and only one difference is permitted. Weak trichotomy is the main part; in terms of the cuts it is the set equation La∪Ra=N0L_a \cup R_a = \mathbb{N}_0, which we prove by induction on aa. The base case is the proposition just proved, since every element is at least 00, so R0R_0 is everything. For the step we take an arbitrary xx, use the hypothesis to place it on one side of aa, and then place it relative to s(a)s(a): an xx below aa stays below s(a)s(a), an xx equal to aa falls below s(a)s(a), and for an xx above aa the positive difference has a predecessor, which gives s(a)⩽xs(a) \leqslant x.

Proof.

For transitivity, suppose a+x=ba + x = b and b+y=cb + y = c with x,y∈Nx, y \in \mathbb{N}. Then a+(x+y)=(a+x)+y=b+y=ca + (x + y) = (a + x) + y = b + y = c by the laws of addition, and x+y∈Nx + y \in \mathbb{N} by closure; hence a<ca < c.

For anti-reflexivity, a<aa < a would give a+x=a=a+0a + x = a = a + 0 with x∈Nx \in \mathbb{N}, and uniqueness of differences forces x=0x = 0, contradicting x∈Nx \in \mathbb{N}.

For weak trichotomy, fix aa and consider the cuts. We show La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 by induction on aa. For a=0a = 0, every element satisfies 0⩽x0 \leqslant x by the proposition above, so R0=N0R_0 = \mathbb{N}_0.

Suppose La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 and let x∈N0x \in \mathbb{N}_0. If x∈Lax \in L_a then x<a<s(a)x < a < s(a) by the corollary above, so x∈Ls(a)x \in L_{s(a)} by transitivity. If x∈Rax \in R_a there are two cases. If x=ax = a then x<s(a)x < s(a), so x∈Ls(a)x \in L_{s(a)}. If a<xa < x then x=a+bx = a + b with b∈Nb \in \mathbb{N}, and bb has a predecessor by the theorem on predecessors, say b=s(c)=c+1b = s(c) = c + 1; then x=a+(1+c)=s(a)+cx = a + (1 + c) = s(a) + c, so s(a)⩽xs(a) \leqslant x and x∈Rs(a)x \in R_{s(a)}. Induction gives La∪Ra=N0L_a \cup R_a = \mathbb{N}_0 for every aa, which is weak trichotomy.

The characterisation of strict linear orders now applies.

Nothing lies strictly between nn and its successor. This looks obvious, but it has to be proved from the definition.

Proposition 6.39 (Nothing between n and its successor).

Let n∈N0n \in \mathbb{N}_0. There is no x∈N0x \in \mathbb{N}_0 with n<x<s(n)n < x < s(n).

Discussion.

This is a non-existence claim, so we suppose such an xx exists and derive a contradiction. The two strict inequalities give two positive differences, x=n+bx = n + b and s(n)=x+cs(n) = x + c, and we eliminate nn between them. Since bb is positive it has a predecessor, so b=1+db = 1 + d, so the s(n)s(n) of the second equation appears inside the first. Substituting turns xx into x+(c+d)x + (c + d), so xx carries the two differences 00 and c+dc + d; uniqueness forces c+d=0c + d = 0, and a sum is zero only when both parts are, so c=0c = 0, contradicting the choice of cc as positive.

Proof.

Suppose n<xn < x and x<s(n)x < s(n). The first gives b∈Nb \in \mathbb{N} with x=n+bx = n + b, the second gives c∈Nc \in \mathbb{N} with s(n)=x+cs(n) = x + c. Since b≠0b \neq 0 it has a predecessor, so b=1+db = 1 + d for some d∈N0d \in \mathbb{N}_0. Then

x=n+b=n+(1+d)=(n+1)+d=s(n)+d=(x+c)+d=x+(c+d).x = n + b = n + (1 + d) = (n + 1) + d = s(n) + d = (x + c) + d = x + (c + d).

So x+0=x+(c+d)x + 0 = x + (c + d), and uniqueness of differences gives c+d=0c + d = 0; hence c=0c = 0, contradicting c∈Nc \in \mathbb{N}.

Problem 6.14.

Show that the only x∈N0x \in \mathbb{N}_0 with x<2x < 2 are x=0x = 0 and x=1x = 1.

Problem 6.15.

Prove that m<nm < n if and only if s(m)⩽ns(m) \leqslant n, for all m,n∈N0m, n \in \mathbb{N}_0.

Problem 6.16.

Let x,y,z∈N0x, y, z \in \mathbb{N}_0, with multiplication as in the problems of the last chapter.

  1. If x⩽yx \leqslant y then x+z⩽y+zx + z \leqslant y + z, and x<yx < y if and only if x+z<y+zx + z < y + z.
  2. If x⩽yx \leqslant y then x⋅z⩽y⋅zx \cdot z \leqslant y \cdot z; and if moreover z>0z > 0 and x<yx < y, then x⋅z<y⋅zx \cdot z < y \cdot z.
  3. If x⋅z<y⋅zx \cdot z < y \cdot z then x<yx < y.
  4. If x⋅z=y⋅zx \cdot z = y \cdot z and z≠0z \neq 0, then x=yx = y.

Problem 6.17.

Suppose m1<m2m_1 < m_2 and n1<n2n_1 < n_2 in N0\mathbb{N}_0. Show that m1+n1<m2+n2m_1 + n_1 < m_2 + n_2.

Problem 6.18.

Show that n−n=0n - n = 0 and n−0=nn - 0 = n for every n∈N0n \in \mathbb{N}_0, and that n−m=0n - m = 0 implies n=mn = m for all m,n∈N0m, n \in \mathbb{N}_0 with m⩽nm \leqslant n.

Problem 6.19.

Let x,y,z,c∈N0x, y, z, c \in \mathbb{N}_0.

  1. If y⩽xy \leqslant x and z⩽xz \leqslant x, then x−y=zx - y = z if and only if x−z=yx - z = y.
  2. If z⩽yz \leqslant y then (x+y)−z=x+(y−z)(x + y) - z = x + (y - z).
  3. If y⩽xy \leqslant x then x−y=(x+c)−(y+c)x - y = (x + c) - (y + c).

Problem 6.20.

State the hypotheses on a,b,c∈N0a, b, c \in \mathbb{N}_0 under which each of

a+(b−a)=b,(b−a)+(c−b)=c−a,c(b−a)=cb−caa + (b - a) = b, \qquad (b - a) + (c - b) = c - a, \qquad c(b - a) = cb - ca

is defined, and prove all three.

Problem 6.21.

  1. Determine all x,y,z∈N0x, y, z \in \mathbb{N}_0 for which (x−y)−z(x - y) - z and x−(y−z)x - (y - z) are both defined, and decide whether the two agree whenever both are.
  2. Decide whether x−(y+z)=(x−y)−zx - (y + z) = (x - y) - z whenever the left-hand side is defined.

Well-Ordering and Induction Variants

With the order we can prove the form of induction that starts at an arbitrary natural number.

Theorem 6.40 (Induction from an arbitrary starting point).

Let n0∈N0n_0 \in \mathbb{N}_0 and let AA be a predicate on N0\mathbb{N}_0. If A(n0)A(n_0) holds, and if A(n)  ⟹  A(s(n))A(n) \implies A(s(n)) for every n⩾n0n \geqslant n_0, then A(n)A(n) holds for every n⩾n0n \geqslant n_0.

Discussion.

Ordinary induction starts at 00, and the hypotheses say nothing below n0n_0, so we enlarge the set where AA holds until the fifth Peano condition applies. Let MM be that set and put M′=defM∪Ln0M' \defeq M \cup L_{n_0}, adding everything strictly below the starting point. We may assume n0>0n_0 > 0, since at n0=0n_0 = 0 ordinary induction already applies, and then 0∈Ln0⊂M′0 \in L_{n_0} \subset M' settles the base case without appealing to AA at all. For the step we take n∈M′n \in M' and compare s(n)s(n) with n0n_0, which trichotomy resolves into three cases: below n0n_0 it lies in the padding, equal to n0n_0 it lies in MM by the base hypothesis, and above n0n_0 it forces nn itself to be at or above n0n_0, so nn lies in MM and the given step applies. Induction then gives M′=N0M' = \mathbb{N}_0; since the two cuts are disjoint and exhaust everything, the added part Ln0L_{n_0} has nothing at or above n0n_0, and Rn0⊂MR_{n_0} \subset M is what remains.

Proof.

Let M=def{n∈N0∣A(n)}M \defeq \{n \in \mathbb{N}_0 \mid A(n)\} and put M′=defM∪Ln0M' \defeq M \cup L_{n_0}. It is enough to prove M′=N0M' = \mathbb{N}_0, for then Ln0∪Rn0=N0L_{n_0} \cup R_{n_0} = \mathbb{N}_0 and Ln0∩Rn0=∅L_{n_0} \cap R_{n_0} = \emptyset give Rn0⊂MR_{n_0} \subset M, which is the assertion.

We may assume n0>0n_0 > 0, since n0=0n_0 = 0 is ordinary induction. Then 0∈Ln0⊂M′0 \in L_{n_0} \subset M'. Let n∈M′n \in M' and compare s(n)s(n) with n0n_0.

If s(n)<n0s(n) < n_0 then s(n)∈Ln0⊂M′s(n) \in L_{n_0} \subset M'. If s(n)=n0s(n) = n_0 then s(n)∈Ms(n) \in M by the base hypothesis. If s(n)>n0s(n) > n_0 then n⩾n0n \geqslant n_0, since n<n0n < n_0 would put n0n_0 strictly between nn and s(n)s(n); hence n∉Ln0n \notin L_{n_0}, so n∈Mn \in M, and the induction hypothesis gives s(n)∈Ms(n) \in M.

In every case s(n)∈M′s(n) \in M', so the fifth Peano condition gives M′=N0M' = \mathbb{N}_0.

Theorem 6.41 (Well-ordering of the natural numbers).

Every non-empty subset M⊂N0M \subset \mathbb{N}_0 has a smallest element: there is m0∈Mm_0 \in M with m0⩽mm_0 \leqslant m for every m∈Mm \in M. We write m0=min⁡Mm_0 = \min M.

Discussion.

A non-empty MM may be unbounded, so we first cut it down to a bounded piece. Choose any a∈Ma \in M and put M′=defLs(a)∩MM' \defeq L_{s(a)} \cap M, which holds aa and so is non-empty. A smallest element of M′M' is already smallest in MM, since everything in MM outside Ls(a)L_{s(a)} is at least s(a)s(a) and therefore above it. So we may assume M⊂Ls(a)M \subset L_{s(a)} and induct on aa, taking for A(a)A(a) the statement that every non-empty subset of Ls(a)L_{s(a)} has a smallest element. The base case can be checked directly: L1L_1 is {0}\{0\}, so the only non-empty subset is {0}\{0\}. For the step, take a non-empty subset of Ls(s(a))L_{s(s(a))} and intersect it with Ls(a)L_{s(a)}; if the intersection is empty then nothing between s(a)s(a) and its successor leaves only {s(a)}\{s(a)\}, and otherwise the hypothesis supplies a smallest element of the intersection, which by the cutting-down argument is smallest in the whole set.

Proof.

Choose a∈Ma \in M and put M′=defLs(a)∩MM' \defeq L_{s(a)} \cap M; since a<s(a)a < s(a) we have a∈M′a \in M', so M′M' is non-empty. If m0m_0 is smallest in M′M' then m0⩽am_0 \leqslant a, while every member of M∖M′M \setminus M' is at least s(a)s(a) and hence above m0m_0; so m0m_0 is smallest in MM. It therefore suffices to show, by induction on aa, that every non-empty subset of Ls(a)L_{s(a)} has a smallest element.

For a=0a = 0, the cut L1L_1 is {0}\{0\}: an x<1x < 1 cannot be positive, since 0<x<10 < x < 1 would put xx strictly between 00 and its successor. So the only non-empty subset of L1L_1 is {0}\{0\}, whose smallest element is 00.

Suppose every non-empty subset of Ls(a)L_{s(a)} has a smallest element, and let N≠∅N \neq \emptyset be contained in Ls(s(a))L_{s(s(a))}. If N∩Ls(a)=∅N \cap L_{s(a)} = \emptyset then every element of NN is at least s(a)s(a) and below s(s(a))s(s(a)), so N={s(a)}N = \{s(a)\} and s(a)s(a) is its smallest element. Otherwise N∩Ls(a)N \cap L_{s(a)} has a smallest element m0m_0, and the argument of the first paragraph shows m0m_0 is smallest in NN. Induction completes the proof.

Corollary 6.42 (Method of infinite descent).

No non-empty subset M⊂N0M \subset \mathbb{N}_0 has the property that every a∈Ma \in M admits an a′∈Ma' \in M with a′<aa' < a.

Proof.

If such an MM existed, well-ordering would give it a smallest element a0a_0, and the hypothesis would supply a0′∈Ma_0' \in M with a0′<a0a_0' < a_0, contradicting minimality.

One cannot descend for ever through a non-empty set of natural numbers. The Greeks already used this as a proof technique, and we shall use it when we come to the numbers that are not fractions.

Theorem 6.43 (Strong induction).

Let AA be a predicate on N0\mathbb{N}_0 with A(0)A(0) true, and suppose that for every n∈N0n \in \mathbb{N}_0 the truth of A(m)A(m) for all m⩽nm \leqslant n implies A(s(n))A(s(n)). Then A(n)A(n) holds for every n∈N0n \in \mathbb{N}_0.

Discussion.

In ordinary induction the step uses only the previous case; here it may use all earlier cases at once, and we prove this from well-ordering. Instead of building up the set where AA holds we look at the set where it fails: assume it non-empty and let n0n_0 be its smallest element. The base hypothesis rules out n0=0n_0 = 0, so n0n_0 has a predecessor pp. Minimality says A(m)A(m) holds for every m<n0m < n_0, and since nothing lies strictly between pp and n0n_0, those mm are precisely the m⩽pm \leqslant p, which is what the step needs at pp. The step therefore yields A(s(p))A(s(p)), that is A(n0)A(n_0), and n0n_0 was chosen to make AA fail.

Proof.

Let M=def{n∈N0∣A(n) fails}M \defeq \{n \in \mathbb{N}_0 \mid A(n) \text{ fails}\} and suppose M≠∅M \neq \emptyset. Well-ordering gives it a smallest element n0n_0, so A(n0)A(n_0) fails while A(n)A(n) holds for every n<n0n < n_0.

Since A(0)A(0) holds, n0≠0n_0 \neq 0, so the theorem on predecessors gives n0=s(p)n_0 = s(p) for some pp. Every m⩽pm \leqslant p satisfies m<n0m < n_0, since p<s(p)=n0p < s(p) = n_0 and nothing lies strictly between; hence A(m)A(m) holds for every such mm. The hypothesis then gives A(s(p))A(s(p)), that is A(n0)A(n_0), a contradiction. So M=∅M = \emptyset.

Problem 6.22.

Deduce the fifth Peano condition from strong induction, so that the two induction principles are equivalent.

Problem 6.23.

Show that strong induction can be proved without well-ordering, by applying ordinary induction to the set B=def{n∈N0∣A(m) holds for every m⩽n}B \defeq \{n \in \mathbb{N}_0 \mid A(m) \text{ holds for every } m \leqslant n\}.

Problem 6.24.

Let f:N0→N0f : \mathbb{N}_0 \to \mathbb{N}_0.

  1. Show that f(s(n))<f(n)f(s(n)) < f(n) cannot hold for every n∈N0n \in \mathbb{N}_0.
  2. Show that if f(s(n))⩽f(n)f(s(n)) \leqslant f(n) for every n∈N0n \in \mathbb{N}_0, then there is an NN with f(n)=f(N)f(n) = f(N) for every n⩾Nn \geqslant N.

Problem 6.25.

Let n∈N0n \in \mathbb{N}_0. Show that there is exactly one m∈N0m \in \mathbb{N}_0 with m⋅m⩽n<s(m)⋅s(m)m \cdot m \leqslant n < s(m) \cdot s(m).

Division with Remainder

A first use of well-ordering: dividing one natural number by another leaves a quotient and a remainder, both determined by the two numbers.

Theorem 6.44 (Division with remainder).

Let n∈N0n \in \mathbb{N}_0 and m∈Nm \in \mathbb{N}. Then there is exactly one pair q,r∈N0q, r \in \mathbb{N}_0 with

n=q⋅m+r,r<m.n = q \cdot m + r, \qquad r < m.

Discussion.

An “exactly one” claim asks for existence and uniqueness, and the two need different arguments. For existence we look for the remainder rather than the quotient: the set of numbers of the form n−q⋅mn - q \cdot m that remain in N0\mathbb{N}_0 is non-empty, since q=0q = 0 leaves nn itself, so well-ordering gives us its least member rr, and minimality forces r<mr < m: were rr at least mm we could subtract one more mm and get something smaller still. For uniqueness we assume two decompositions and show that a certain multiple of mm must be 00. Subtracting gives a multiple of mm equal to a difference of two remainders, and that difference is below mm because each remainder is; but a non-zero multiple of mm is at least mm, so the multiple is 00, the quotients agree, and the remainders follow.

Proof.

For existence, let R=def{r∈N0∣n=q⋅m+r for some q∈N0}R \defeq \{r \in \mathbb{N}_0 \mid n = q \cdot m + r \text{ for some } q \in \mathbb{N}_0\}. Taking q=0q = 0 gives n∈Rn \in R, so RR is non-empty and well-ordering supplies r=defmin⁡Rr \defeq \min R, with n=q⋅m+rn = q \cdot m + r for some qq.

Suppose r⩾mr \geqslant m. Then r=m+r′r = m + r' for some r′∈N0r' \in \mathbb{N}_0, so n=q⋅m+m+r′=s(q)⋅m+r′n = q \cdot m + m + r' = s(q) \cdot m + r', putting r′∈Rr' \in R; and r′<rr' < r, since mm is positive. That contradicts minimality, so r<mr < m.

For uniqueness, suppose q1⋅m+r1=q2⋅m+r2q_1 \cdot m + r_1 = q_2 \cdot m + r_2 with r1,r2<mr_1, r_2 < m, and take q1⩾q2q_1 \geqslant q_2 without loss. Then q1=q2+dq_1 = q_2 + d for some d∈N0d \in \mathbb{N}_0, and cancelling gives d⋅m+r1=r2d \cdot m + r_1 = r_2, so d⋅m⩽r2<md \cdot m \leqslant r_2 < m. If dd were positive then d⩾1d \geqslant 1 and d⋅m⩾md \cdot m \geqslant m, a contradiction; so d=0d = 0, whence q1=q2q_1 = q_2 and then r1=r2r_1 = r_2.

Corollary 6.45 (Remainder classes).

Let m∈Nm \in \mathbb{N}. Every n∈N0n \in \mathbb{N}_0 has exactly one of the mm forms k⋅mk \cdot m, k⋅m+1k \cdot m + 1, …, k⋅m+(m−1)k \cdot m + (m-1) with k∈N0k \in \mathbb{N}_0.

Proof.

The theorem gives exactly one pair k,rk, r with n=k⋅m+rn = k \cdot m + r and r<mr < m, and the values available to rr are precisely 0,1,…,m−10, 1, \ldots, m-1.

Taking m=2m = 2 splits N0\mathbb{N}_0 into the even numbers, those of the form 2k2k, and the odd ones, those of the form 2k+12k + 1; the corollary says every natural number is one or the other and none is both.

Problem 6.26.

Let n,m∈N0n, m \in \mathbb{N}_0 with mm positive. Show that mm divides nn, in the sense that n=k⋅mn = k \cdot m for some k∈N0k \in \mathbb{N}_0, exactly when the remainder of the theorem is 00.

Problem 6.27.

Show that divisibility orders N\mathbb{N} as a partial order in the sense of Definition 6.16 , and find the minimum and the maximum, if they exist, of {n∈N∣n divides 12}\{n \in \mathbb{N} \mid n \text{ divides } 12\} in that order.

Descent in Action

Here is an application of infinite descent.

Proposition 6.46 (Odd squares are odd).

Let n∈N0n \in \mathbb{N}_0. If n⋅nn \cdot n is even then nn is even.

Discussion.

We prove the contrapositive, which is the easier direction to compute with: an odd nn is 2k+12k+1 by the remainder classes, and squaring it and collecting terms exhibits the result as twice something plus one. Only the laws of addition and multiplication are needed; the remainder classes turn “not even” into the usable form 2k+12k + 1.

Proof.

Suppose nn is odd, so n=2k+1n = 2k + 1 for some k∈N0k \in \mathbb{N}_0 by the remainder classes. Then

n⋅n=(2k+1)(2k+1)=2(2⋅k⋅k+k+k)+1,n \cdot n = (2k + 1)(2k + 1) = 2\bigl(2 \cdot k \cdot k + k + k\bigr) + 1,

which is odd. So an even n⋅nn \cdot n forces nn to be even.

Theorem 6.47 (Two is not a ratio of squares).

There are no d,a∈Nd, a \in \mathbb{N} with d⋅d=2⋅(a⋅a)d \cdot d = 2 \cdot (a \cdot a).

Discussion.

We argue by contradiction, using infinite descent, so we build a non-empty set in which every member has a smaller member. Suppose some pair works and let MM be the set of all a∈Na \in \mathbb{N} admitting a partner dd; the supposition puts something in MM. The descent comes from using parity twice. From d⋅d=2(a⋅a)d \cdot d = 2(a \cdot a) the square d⋅dd \cdot d is even, so dd is even by the proposition above; writing d=2d′d = 2d' and substituting makes a⋅aa \cdot a even, hence aa even too, say a=2a′a = 2a'. Cancelling a factor of four leaves d′⋅d′=2(a′⋅a′)d' \cdot d' = 2(a' \cdot a'), which puts a′a' in MM as well, and a′<aa' < a because halving a positive number decreases it. Infinite descent forbids this.

In terms of fractions, which we have not built yet, this says that no fraction squares to two.

Proof.

Suppose such a pair exists and let M=def{a∈N∣d⋅d=2⋅(a⋅a) for some d∈N}M \defeq \{a \in \mathbb{N} \mid d \cdot d = 2 \cdot (a \cdot a) \text{ for some } d \in \mathbb{N}\}, which is then non-empty.

Let a∈Ma \in M with partner dd. Then d⋅dd \cdot d is even, so d=2d′d = 2d' by the proposition above. Substituting gives 4(d′⋅d′)=2(a⋅a)4(d' \cdot d') = 2(a \cdot a), so a⋅a=2(d′⋅d′)a \cdot a = 2(d' \cdot d'); hence a⋅aa \cdot a is even and a=2a′a = 2a' for some a′a'. Substituting again gives 4(d′⋅d′)=2⋅4(a′⋅a′)4(d' \cdot d') = 2 \cdot 4 (a' \cdot a'), so d′⋅d′=2(a′⋅a′)d' \cdot d' = 2(a' \cdot a'), putting a′∈Ma' \in M. Since a=2a′=a′+a′a = 2a' = a' + a' with a′a' positive, we have a′<aa' < a.

So every member of MM has a smaller member, which infinite descent forbids. Hence no such pair exists.

Problem 6.28.

Show that there are no d,a∈Nd, a \in \mathbb{N} with d⋅d=3⋅(a⋅a)d \cdot d = 3 \cdot (a \cdot a), and decide whether the same argument rules out d⋅d=4⋅(a⋅a)d \cdot d = 4 \cdot (a \cdot a).

Expansions in a Base

Writing a number in base gg is repeated division with remainder, and the digits are the remainders.

Theorem 6.48 (Expansion in a base).

Let g∈Ng \in \mathbb{N} with g⩾2g \geqslant 2. For every n∈Nn \in \mathbb{N} there are uniquely determined r∈N0r \in \mathbb{N}_0 and a0,…,ar∈N0a_0, \ldots, a_r \in \mathbb{N}_0 with ar≠0a_r \neq 0 and aρ<ga_\rho < g for each ρ\rho, such that

n=a0+a1g+a2g2+⋯+argr=∑ρ=0raρgρ.n = a_0 + a_1 g + a_2 g^2 + \cdots + a_r g^r = \sum_{\rho = 0}^{r} a_\rho g^\rho.

Discussion.

The digits come from dividing repeatedly: set q0=nq_0 = n, divide by gg to leave the lowest digit a0a_0 and a quotient q1q_1, divide that to leave a1a_1, and so on. Two things must be checked. It stops because g⩾2g \geqslant 2 makes each non-terminal quotient strictly smaller than the number it came from, and a scheme that never halted would descend for ever through N0\mathbb{N}_0, which descent forbids. The digits add back to nn because each equation expresses one quotient in terms of the next, so substituting upwards leaves the displayed sum. Uniqueness runs the same divisions in reverse: division with remainder determines a0a_0 and q1q_1 from nn, then a1a_1 and q2q_2 from q1q_1, and so on, fixing the leading digit and the final index along with the rest.

Proof.

Put q0=defnq_0 \defeq n and apply division with remainder repeatedly:

q0=q1g+a0,a0<g,q1=q2g+a1,a1<g,  ⋮qr−1=qrg+ar−1,ar−1<g,qr=ar,0<ar<g.\begin{aligned} q_0 &= q_1 g + a_0, & a_0 &< g, \\ q_1 &= q_2 g + a_1, & a_1 &< g, \\ &\ \,\vdots \\ q_{r-1} &= q_r g + a_{r-1}, & a_{r-1} &< g, \\ q_r &= a_r, & 0 < a_r &< g. \end{aligned}

Each line is division with remainder applied to qρq_\rho and gg. Since g⩾2g \geqslant 2, a non-zero quotient satisfies qρ+1<qρq_{\rho+1} < q_\rho, so the scheme cannot run for ever without contradicting infinite descent; it therefore halts at some rr with qr<gq_r < g.

Substituting each line into the one above it gives n=a0+a1g+⋯+argrn = a_0 + a_1 g + \cdots + a_r g^r. Uniqueness of the quotient and remainder at each step gives uniqueness of the list of digits, and of rr.

We write n=(ar…a0)gn = (a_r \ldots a_0)_g, and call the cases g=2g = 2 and g=10g = 10 the binary and decimal expansions. The value can be recovered by a recursion which never computes a power separately:

n=(⋯((arg+ar−1)g+ar−2)g+⋯+a1)g+a0.n = \Bigl(\cdots\bigl((a_r g + a_{r-1})g + a_{r-2}\bigr)g + \cdots + a_1\Bigr)g + a_0.

This is Horner’s scheme for base gg. It uses one multiplication by gg at each stage, rr in all, where computing every power first and then forming every term uses up to twice as many.

Problem 6.29.

Write 10001000 in base 77, and write (110 1101)2(110\,1101)_2 in base 1010.

Problem 6.30.

Let n∈Nn \in \mathbb{N} and let rr be as in the theorem. Show that gr⩽n<gs(r)g^r \leqslant n < g^{s(r)}.

The Maximum Principle

Well-ordering says every non-empty subset of N0\mathbb{N}_0 has a minimum. The dual statement is false as it stands, since N0\mathbb{N}_0 itself has no maximum, but it becomes true once an upper bound is present.

Theorem 6.49 (Maximum principle).

Let W⊂N0W \subset \mathbb{N}_0 be non-empty with an upper bound in N0\mathbb{N}_0. Then WW has a maximum.

Discussion.

We cannot induct on WW, which is an arbitrary set, so we induct on the bound instead: let TT be the set of those BB such that every non-empty subset bounded above by BB has a maximum, and aim at T=N0T = \mathbb{N}_0; once that is known, any upper bound of the given WW lies in TT and gives WW a maximum. The base case can be checked directly, since a set bounded above by 00 can only be {0}\{0\}, every element being at least 00. For the step we take a non-empty SS bounded above by s(n)s(n) and split on whether s(n)s(n) belongs to SS: if it does, it is a bound lying in the set and the previous proposition finishes at once; if it does not, then nn is itself an upper bound, because an element strictly above nn and at or below s(n)s(n) but different from it would sit strictly between nn and its successor, which nothing does.

Proof.

Let TT be the set of B∈N0B \in \mathbb{N}_0 such that every non-empty S⊂N0S \subset \mathbb{N}_0 with upper bound BB has a maximum.

For 0∈T0 \in T: let SS be non-empty with upper bound 00, and take k∈Sk \in S. Then k⩽0k \leqslant 0, while 0⩽k0 \leqslant k, so k=0k = 0 by antisymmetry. Hence S={0}S = \{0\}, and 00 is a bound lying in SS, so it is the maximum.

Suppose n∈Tn \in T and let SS be non-empty with upper bound s(n)s(n). If s(n)∈Ss(n) \in S then s(n)s(n) is an upper bound lying in SS, hence the maximum. If s(n)∉Ss(n) \notin S, we claim nn bounds SS: an element k∈Sk \in S with n<kn < k satisfies k⩽s(n)k \leqslant s(n) and k≠s(n)k \neq s(n), so n<k<s(n)n < k < s(n), which nothing does. So nn is an upper bound of SS, and n∈Tn \in T supplies a maximum. Hence s(n)∈Ts(n) \in T.

By induction T=N0T = \mathbb{N}_0. Given WW non-empty with upper bound BB, we have B∈TB \in T, so WW has a maximum.

A partially ordered set in which every non-empty subset has a minimum is called well-ordered. By the theorem above N0\mathbb{N}_0 is well-ordered, and so is N\mathbb{N}, whose non-empty subsets are non-empty subsets of N0\mathbb{N}_0. N0\mathbb{N}_0 has two further order properties: every element beyond the minimum has an immediate predecessor, and there is no greatest element. Together with well-ordering these determine the order completely.

Theorem 6.50 (Characterisation of the natural numbers).

Let MM be a non-empty well-ordered set in which every element other than min⁡M\min M has an immediate predecessor, meaning an element p<ap < a with nothing of MM strictly between, and which has no greatest element. Then there is an order-preserving bijection from N0\mathbb{N}_0 to MM.

Discussion.

The conclusion asks for the order of N0\mathbb{N}_0 inside MM, so the plan is to build a successor map on MM from the three hypotheses and then check that it reaches everything. In N0\mathbb{N}_0 the successor of nn is the least element above nn, and that phrase makes sense in MM: the absence of a greatest element keeps the set of elements above aa non-empty, and well-ordering gives it a minimum, which we call ν(a)\nu(a). The predecessor hypothesis makes ν\nu behave like a successor map, since nothing is reached from below except through an immediate predecessor, so min⁡M\min M is never a value of ν\nu and two elements cannot share one. With ν\nu in hand the recursion theorem builds the candidate: start at min⁡M\min M and keep applying ν\nu. As ν(a)>a\nu(a) > a, the values climb, which already gives order-preservation and injectivity; the main work is surjectivity, where we take the least element never reached, which cannot exist because its immediate predecessor is reached and ν\nu carries that to it.

Proof.

Write m0=defmin⁡Mm_0 \defeq \min M and for a∈Ma \in M put ν(a)=defmin⁡{m∈M∣a<m}\nu(a) \defeq \min\{m \in M \mid a < m\}, which exists because MM has no greatest element and is well-ordered. By construction ν(a)>a\nu(a) > a and nothing of MM lies strictly between aa and ν(a)\nu(a).

An element c≠m0c \neq m_0 has exactly one immediate predecessor: two of them, say p<qp < q, would put qq strictly between pp and cc. Hence ν\nu is injective, since ν(a)=ν(b)=c\nu(a) = \nu(b) = c makes aa and bb both immediate predecessors of cc; and m0m_0 is not a value of ν\nu, since ν(a)>a⩾m0\nu(a) > a \geqslant m_0.

The recursion theorem, applied with a=m0a = m_0 and g=νg = \nu, gives exactly one f:N0→Mf : \mathbb{N}_0 \to M with f(0)=m0f(0) = m_0 and f(s(n))=ν(f(n))f(s(n)) = \nu(f(n)). Since ν(x)>x\nu(x) > x for every xx, induction gives f(a)<f(b)f(a) < f(b) whenever a<ba < b; in particular ff is injective.

For surjectivity, let AA be the range of ff. Then m0∈Am_0 \in A, and AA is closed under ν\nu, since ν(f(n))=f(s(n))\nu(f(n)) = f(s(n)). Suppose M∖AM \setminus A is non-empty and let cc be its least element. Since m0∈Am_0 \in A we have c≠m0c \neq m_0, so cc has an immediate predecessor pp; by minimality of cc we have p∈Ap \in A, and c=ν(p)c = \nu(p) because nothing lies strictly between. Closure of AA under ν\nu gives c∈Ac \in A, a contradiction. Hence ff is a bijection.

Remark.

The proof never carries out an induction inside MM: surjectivity uses well-ordering through a least counterexample, and ff itself comes from the recursion theorem on N0\mathbb{N}_0. One may therefore take well-ordering, the predecessor property and the absence of a greatest element as axioms in place of Peano’s; the theorem says the two systems describe the same ordered set.

Problem 6.31.

Let S⊂N0S \subset \mathbb{N}_0 be non-empty. Prove that SS has a minimum by applying the maximum principle to the set of lower bounds of SS, rather than by appealing to well-ordering.

Problem 6.32.

State and prove the maximum principle for non-empty subsets of N\mathbb{N} bounded above in N\mathbb{N}, starting the induction at 11.

Problem 6.33.

Let MM be an ordered set in which every two-element subset has a minimum. Show that the order is total, and deduce that every well-ordered set is totally ordered.

Problem 6.34.

Let S⊂N0S \subset \mathbb{N}_0 be such that for every c∈N0c \in \mathbb{N}_0 there is an s∈Ss \in S with s>cs > c. Prove that there is exactly one bijection f:N0→Sf : \mathbb{N}_0 \to S with f(m)<f(n)f(m) < f(n) whenever m<nm < n.

Problem 6.35.

Order N0×N0\mathbb{N}_0 \times \mathbb{N}_0 by declaring (a,b)<(c,d)(a, b) < (c, d) when a<ca < c, or when a=ca = c and b<db < d. Show that this is a strict linear order in which every non-empty subset has a least element.

Problem 6.36.

Theorem 6.50 asks three things of MM. Exhibit a well-ordered set with no greatest element in which some element other than the minimum has no immediate predecessor, and a well-ordered set in which every element other than the minimum has an immediate predecessor but a greatest element exists. For the first, name the element that has no immediate predecessor.

Problem 6.37.

  1. Exhibit a totally ordered set LL with no greatest element in which every element has an immediate predecessor, and which is not well-ordered.
  2. Show that there is no bijection f:N0→Lf : \mathbb{N}_0 \to L with f(m)<f(n)f(m) < f(n) whenever m<nm < n, and say where the proof of Theorem 6.50 uses the hypothesis that LL fails.
  3. Order L×N0L \times \mathbb{N}_0 as in Problem 6.35 . Show that the result is totally ordered but not well-ordered.

Sequences

A list is a function whose inputs are positions. The cuts defined for the natural numbers give us the positions, so nothing new is needed.

Definition 6.51 (Sequence).

Let AA be a set. A finite sequence in AA of length nn is a function from LnL_n to AA, written (ai)i<n(a_i)_{i < n} or (a0,a1,…)(a_0, a_1, \ldots), in the notation already used for tuples; the unique sequence of length 00 is the empty function, written ( )(\,). An infinite sequence in AA is a function from N0\mathbb{N}_0 to AA. We write

Seq⁡(A)=def⋃n∈N0ALn\operatorname{Seq}(A) \defeq \bigcup_{n \in \mathbb{N}_0} A^{L_n}

for the set of all finite sequences in AA, using the Cartesian power of the last chapter but one.

That Seq⁡(A)\operatorname{Seq}(A) is a set takes a moment. Each ALnA^{L_n} consists of functions from LnL_n to AA, hence of subsets of N0×A\mathbb{N}_0 \times A, so all of them lie inside P(N0×A)\mathcal{P}(\mathbb{N}_0 \times A); comprehension collects them and the union axiom pools them.

Remark.

Some texts say instead that a finite sequence is a function whose domain is a natural number. That is the same definition read through the construction of the last chapter, where nn was built as the set holding exactly its predecessors, so that n=Lnn = L_n. We use the cut, which says the same thing without leaning on which sets the numerals happen to be.

Restriction gives the initial pieces of a sequence: for ff defined on N0\mathbb{N}_0 and n∈N0n \in \mathbb{N}_0, the restriction f∣Lnf|_{L_n} is the finite sequence (f0,…)(f_0, \ldots) of length nn, recording everything before position nn and nothing else.

The General Recursion Theorem

The recursion theorem of the last chapter lets the next value depend on the previous one, and its parametrised form lets it depend on the index as well. Neither is enough when the next value depends on all the earlier ones at once. With sequences we can state such a rule, and with the order we can prove that it defines a function.

Theorem 6.52 (General recursion).

Let SS be a set and let g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S. Then there is exactly one f:N0→Sf : \mathbb{N}_0 \to S with

f(n)=g(f∣Ln)for every n∈N0.f(n) = g\bigl(f|_{L_n}\bigr) \quad\text{for every } n \in \mathbb{N}_0.

Discussion.

The rule wants the whole history at each step, so we recurse on histories rather than on values: instead of building ff directly we build the sequence of its initial pieces. Let GG send a pair (t,n)(t, n) to tt extended by the value g(t)g(t) at position nn, whenever tt has length nn, and to the empty sequence otherwise; that second clause is bookkeeping only, since the case never arises. Parametrised recursion then gives a map FF on N0\mathbb{N}_0 with F(0)F(0) the empty sequence and F(s(n))=G(F(n),n)F(s(n)) = G(F(n), n), and an induction shows F(n)F(n) has length exactly nn, so the bookkeeping clause is never reached. Each F(n)F(n) extends its predecessors, so their union is a single function ff on N0\mathbb{N}_0 whose restriction to LnL_n is F(n)F(n), and reading the construction back gives the required identity. Uniqueness uses strong induction: two solutions agreeing everywhere below nn have the same restriction to LnL_n, so gg returns the same value at nn, and ordinary induction would not deliver that hypothesis.

Proof.

Define G:Seq⁡(S)×N0→Seq⁡(S)G : \operatorname{Seq}(S) \times \mathbb{N}_0 \to \operatorname{Seq}(S) by

G(t,n)=def{t∪{(n,g(t))}if t has length n,( )otherwise.G(t, n) \defeq \begin{cases} t \cup \bigl\{(n, g(t))\bigr\} & \text{if } t \text{ has length } n, \\ (\,) & \text{otherwise.} \end{cases}

By parametrised recursion there is a unique F:N0→Seq⁡(S)F : \mathbb{N}_0 \to \operatorname{Seq}(S) with F(0)=( )F(0) = (\,) and F(s(n))=G(F(n),n)F(s(n)) = G(F(n), n).

We claim F(n)F(n) has length nn. This holds at 00. If F(n)F(n) has length nn, then F(s(n))=F(n)∪{(n,g(F(n)))}F(s(n)) = F(n) \cup \{(n, g(F(n)))\}, whose domain is Ln∪{n}L_n \cup \{n\}; and Ln∪{n}=Ls(n)L_n \cup \{n\} = L_{s(n)}, since x<s(n)x < s(n) holds exactly when x<nx < n or x=nx = n, nothing lying strictly between nn and s(n)s(n). So F(s(n))F(s(n)) has length s(n)s(n), and induction gives the claim.

Each F(n)F(n) is therefore a function extending all the earlier ones, so their union f=def⋃n∈N0F(n)f \defeq \bigcup_{n \in \mathbb{N}_0} F(n) is a function on N0\mathbb{N}_0 with f∣Ln=F(n)f|_{L_n} = F(n) for every nn. Then

f(n)=F(s(n))(n)=g(F(n))=g(f∣Ln),f(n) = F(s(n))(n) = g\bigl(F(n)\bigr) = g\bigl(f|_{L_n}\bigr),

which is the required identity.

For uniqueness, let hh also satisfy the identity, and suppose f(m)=h(m)f(m) = h(m) for every m<nm < n. Then f∣Ln=h∣Lnf|_{L_n} = h|_{L_n}, so f(n)=g(f∣Ln)=g(h∣Ln)=h(n)f(n) = g(f|_{L_n}) = g(h|_{L_n}) = h(n). Strong induction gives f=hf = h.

Problem 6.38.

Show that the recursion theorem of the last chapter is a special case of this one: given a∈Sa \in S and γ:S→S\gamma : S \to S, exhibit a g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S whose solution is the map with f(0)=af(0) = a and f(s(n))=γ(f(n))f(s(n)) = \gamma(f(n)).

Problem 6.39.

Let SS be a set and g:Seq⁡(S)→Sg : \operatorname{Seq}(S) \to S. Show that the finite sequences F(n)F(n) built in the proof satisfy F(m)⊂F(n)F(m) \subset F(n) whenever m<nm < n, and explain where that is used.

General Associativity

We can now prove something used without proof earlier. Addition was defined for two arguments and proved associative and commutative for two and three; the notation a1+⋯+ana_1 + \cdots + a_n assumes more, namely that the brackets and the order may be chosen freely. With finite sequences and induction in hand we can say what that means and prove it.

Fix a left-associated reading once and for all: for a finite sequence aa of length nn in a Peano system with addition, define

p(a)=def{0if n=0,p(a∣Lk)+akif n=s(k).p(a) \defeq \begin{cases} 0 & \text{if } n = 0, \\ p\bigl(a|_{L_{k}}\bigr) + a_{k} & \text{if } n = s(k). \end{cases}

So pp of the sequence (a0,a1,a2)(a_0, a_1, a_2) is (0+a0+a1)+a2(0 + a_0 + a_1) + a_2, brackets to the left. A full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1} is either the single term, when n=1n = 1, or a sum L+RL + R in which LL is a full bracketing of an initial piece and RR is a full bracketing of the rest.

Theorem 6.53 (General associativity and neighbour swaps).

Let aa be a finite sequence of length nn in a Peano system with addition.

  1. Every full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1} equals p(a)p(a).
  2. If bb is obtained from aa by exchanging two neighbouring entries, then p(b)=p(a)p(b) = p(a).

Discussion.

The first part is an induction on nn, but a bracketing may split the sum anywhere, so the step needs one auxiliary fact: the left-associated sum of the whole is the left-associated sum of the first kk entries added to that of the rest. That splitting identity is itself a short induction on the length of the second block, using nothing but binary associativity, and with it the step applies the hypothesis to the two halves of the bracketing and adds the results.

Once every bracketing is identified with pp, the second part may ignore brackets altogether. Exchanging neighbours rearranges a two-term middle and nothing else, so binary commutativity sorts that middle and the splitting identity puts the rest of the list back around it.

Proof.

We first record the splitting identity: for k<nk < n,

p(a)=p(a∣Lk)+p((ak,…,an−1)).p(a) = p\bigl(a|_{L_k}\bigr) + p\bigl((a_k, \ldots, a_{n-1})\bigr).

Fix kk and induct on the length mm of the second block. If m=1m = 1 this is the defining clause of pp. If it holds at mm, then appending one more entry gives

p(a)=p(a∣Ln−1)+an−1=(p(a∣Lk)+p((ak,…,an−2)))+an−1,p(a) = p\bigl(a|_{L_{n-1}}\bigr) + a_{n-1} = \Bigl(p\bigl(a|_{L_k}\bigr) + p\bigl((a_k, \ldots, a_{n-2})\bigr)\Bigr) + a_{n-1},

and associativity of addition regroups this as p(a∣Lk)+p((ak,…,an−1))p(a|_{L_k}) + p((a_k, \ldots, a_{n-1})), which is the identity at m+1m + 1.

For the first part, induct on nn. The case n=1n = 1 is immediate. Let PP be a full bracketing of a0+⋯+an−1a_0 + \cdots + a_{n-1}, so P=L+RP = L + R where LL brackets the first kk entries and RR the rest. The inductive hypothesis gives L=p(a∣Lk)L = p(a|_{L_k}) and R=p((ak,…,an−1))R = p((a_k, \ldots, a_{n-1})), so P=p(a)P = p(a) by the splitting identity.

For the second part, let bb exchange the entries at positions kk and s(k)s(k). The two-term identity ak+as(k)=as(k)+aka_k + a_{s(k)} = a_{s(k)} + a_k is commutativity. If the exchanged pair is the whole sequence we are done; otherwise two applications of the splitting identity write p(a)p(a) as a sum in which that pair appears as a single middle block, and the same decomposition of p(b)p(b) differs only in that block, which commutativity identifies with it.

Brackets therefore no longer matter, and neighbouring summands may be exchanged at will. Any rearrangement of a finite list can be reached by a string of neighbour exchanges, moving each entry past its neighbours until it sits where it should, so the value of a finite sum depends on neither the bracketing nor the order of its terms.

Problem 6.40.

Carry out the same argument for multiplication: define the left-associated product π\pi by the clauses π(( ))=def1\pi((\,)) \defeq 1 and π(a)=defπ(a∣Lk)⋅ak\pi(a) \defeq \pi(a|_{L_k}) \cdot a_k when aa has length s(k)s(k), and prove both parts of the theorem for it. Which laws replace associativity and commutativity of addition at each step?

Problem 6.41.

Show that any rearrangement of a finite sequence is a string of neighbour exchanges, so that the last sentence above is a theorem rather than an appeal to intuition. (Harder.)

Zorn’s Lemma

Finally, two statements equivalent to the axiom of choice, and the reason some mathematicians do not accept it.

Definition 6.54 (Chains and inductively ordered sets).

Let MM be a partially ordered set. A subset A⊂MA \subset M is a chain if the order MM induces on AA is a total order, that is, if any two elements of AA are comparable. The set MM is inductively ordered if every chain in MM has an upper bound in MM.

Remark.

An inductively ordered set is never empty. The empty subset is a chain, vacuously, so it too must have an upper bound, and an upper bound is an element of MM.

Theorem 6.55 (Zorn's lemma).

Every inductively ordered set has at least one maximal element.

Discussion.

We state this without proof. It is not a theorem of the axioms we have listed: on the basis of the rest, Zorn’s lemma is equivalent to the axiom of choice, so proving it would amount to deriving one from the other, and the derivation is long enough to belong to a course in set theory rather than here. Note the form of the statement. The hypothesis is about chains, which are the totally ordered pieces of MM, and the conclusion is about a maximal element, which need not be a maximum: nothing says the element found is comparable with everything, only that nothing strictly exceeds it. In a partial order a maximal element need not be a maximum, which is why the conclusion is stated this way.

Remark.

The result is due to Kuratowski, though it carries Zorn’s name; Zorn proved the equivalence with choice and was the first to put the statement to work on algebraic questions.

Theorem 6.56 (Well-ordering theorem).

Every non-empty set can be ordered so that every non-empty subset has a least element.

Discussion.

Again we state without proof, for the same reason: on the basis of the other axioms the well-ordering theorem, Zorn’s lemma and the axiom of choice are all equivalent to one another. Of the three it is the hardest to believe. Well-ordering of N0\mathbb{N}_0 was a theorem we proved, resting on the successor structure; here the claim is that any set whatever admits such an order, however little structure it carries and however unlike the natural numbers it looks.

Remark (Informal).

Assuming you know the real numbers, they are not well-ordered by their usual order: the set of those greater than 00 has no least element, since any candidate is beaten by something smaller still above 00. The well-ordering theorem nevertheless asserts that some other order on them is a well-order. No such order has ever been exhibited, and none can be described explicitly; the theorem asserts that one exists and offers no way to find it.

That gap between existence and construction is what leads some mathematicians to reject the axiom of choice. Our position is to accept it, and to say plainly when we use it.

Problem 6.42.

Show that a maximal element need not be a maximum, by exhibiting a partially ordered set with two maximal elements. Show also that in a total order the two notions coincide.

Problem 6.43.

Let MM be a set and consider P(M)∖{M}\mathcal{P}(M) \setminus \{M\} ordered by inclusion. Show that it is inductively ordered when MM is non-empty, and identify its maximal elements.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 6.1.

Let S={1,2,3}S = \{1, 2, 3\}. Which of the three properties of Definition 6.2 does each relation on SS have?

R1=def{(1,1),(2,2),(3,3)}R_1 \defeq \{(1,1), (2,2), (3,3)\}.

answer one of these

R2=def{(1,2),(2,3)}R_2 \defeq \{(1,2), (2,3)\}.

answer one of these

R3=def{(1,2),(2,1)}R_3 \defeq \{(1,2), (2,1)\}.

answer one of these

R4=def(S×S)∖{(1,1)}R_4 \defeq (S \times S) \setminus \{(1,1)\}.

answer one of these

R5=def∅R_5 \defeq \emptyset.

answer one of these

Exercise 6.2.

Keep S={1,2,3}S = \{1,2,3\} and write RR for the relation R2R_2 above. In each line, the smallest relation on SS containing RR and having the stated property is:

Transitive.

answer one of these

Symmetric.

answer one of these

Reflexive. Its number of pairs is:

answer one of these

An equivalence relation.

answer one of these

Exercise 6.3.

Each line below is a relation on N0\mathbb{N}_0. Decide which are equivalence relations and which are strict linear orders.

m⩽nm \leqslant n.

answer one of these

m<nm < n.

answer one of these

m⋅m=n⋅nm \cdot m = n \cdot n.

answer one of these

mm and nn leave the same remainder on division by 33.

answer one of these

Exercise 6.4.

Let ∼\sim be an equivalence relation on {1,2,3}\{1, 2, 3\}.

Suppose ∼\sim has exactly three ordered pairs. Then ∼\sim is:

answer one of these

Can ∼\sim have exactly four ordered pairs?

answer one of these

The largest number of ordered pairs ∼\sim can have is:

answer one of these

For that ∼\sim, the induced partition is:

answer one of these

Exercise 6.5.

On {1,2,3,4}\{1,2,3,4\} take R=def{(1,1),(2,2),(3,3),(4,4),(1,3),(3,1),(2,4),(4,2)}R \defeq \{(1,1), (2,2), (3,3), (4,4), (1,3), (3,1), (2,4), (4,2)\}, which is an equivalence relation.

The class [1][1] is:

answer one of these

The quotient {1,2,3,4}/R\{1,2,3,4\}/R is:

answer one of these

Exercise 6.6.

Which of these are equivalence relations?

On the set of human beings, x∼yx \sim y when xx and yy weigh within one pound of each other.

answer one of these

On N\mathbb{N}, m∼nm \sim n when mm divides nn.

answer one of these

On N0\mathbb{N}_0, m∼nm \sim n when m⋅nm \cdot n is even.

answer one of these

On N0×N0\mathbb{N}_0 \times \mathbb{N}_0, (a,b)∼(c,d)(a, b) \sim (c, d) when b=db = d. This is an equivalence relation, and its blocks are:

answer one of these

On the set CC of solid-colour cars, x∼yx \sim y when xx and yy have the same colour. This is:

answer one of these

Exercise 6.7.

The order of Definition 6.32 and the cuts of Definition 6.37 .

The cut L0L_0 is:

answer one of these

The number of elements of L5L_5 is:

answer one of these

For a∈N0a \in \mathbb{N}_0, the set La∩RaL_a \cap R_a is:

answer one of these

The difference 3−73 - 7:

answer one of these

Exercise 6.8.

For each subset of N0\mathbb{N}_0 below, the minimum and the maximum, in the sense of Definition 6.20 , are:

{3,5,7}\{3, 5, 7\}.

answer one of these

The set of even numbers.

answer one of these

The set of odd numbers.

answer one of these

{n∈N0∣n⩾17}\{n \in \mathbb{N}_0 \mid n \geqslant 17\}.

answer one of these

{n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\}.

answer one of these

The set of multiples of 55.

answer one of these

Exercise 6.9.

Keep {3,5,7}\{3, 5, 7\} and {n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\} from the last exercise, with all bounds taken in N0\mathbb{N}_0.

The lower bounds of {3,5,7}\{3, 5, 7\} are:

answer one of these

Its upper bounds are:

answer one of these

The lower bounds of {n∈N0∣n⩽100}\{n \in \mathbb{N}_0 \mid n \leqslant 100\} are:

answer one of these

And its upper bounds are:

answer one of these

Exercise 6.10.

Let A=def{2,3,4,6,12}A \defeq \{2, 3, 4, 6, 12\}, ordered by divisibility, so that a⩽ba \leqslant b means that aa divides bb.

The minimal elements of AA are:

answer one of these

The maximal elements are:

answer one of these

As for a minimum and a maximum:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker a Peano system to compute in. This chapter needs two more things of it, and only one of them is new. A relation is a set of ordered pairs, and pairs, products and sets are all already there; the order on N0\mathbb{N}_0 is not, and arrives as notation below.

Relations

A relation on SS is a subset of S×SS \times S, so xRyx \mathbin{R} y is typed as the membership it abbreviates, (x, y) ∈ R. The three properties of Definition 6.2 are not names the checker knows; they are written out as the statements they are, so symmetry of RR enters a problem as the hypothesis

hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R

and is used by applying it to two objects and a membership, left to right: hs x y h.

One piece of notation is new. The separation axiom carves a subset out of a set by a criterion, and it is written {x ∈ A | p x}, with the membership criterion the axiom gives: y ∈ {x ∈ A | p x} is y ∈ A ∧ p y, in the way that x ∈ A ∩ B was a conjunction on an earlier sheet. So ⟨_, _⟩ builds a membership and .left and .right take one apart. This is what lets an equivalence class be written down: [a][a] of Definition 6.26 is {s ∈ S | (s, a) ∈ R}.

Example.

The universal relation on SS is reflexive. Membership in a product is a conjunction, and here both halves are the same hypothesis.

lean worked
1example (S x : Obj) (h : x ∈ S) : (x, x) ∈ S × S := by
verified
goalGoals accomplished.

Example.

Reflexivity puts aa in its own class. The two halves of the criterion are the two things the class asks of aa.

lean worked
1example (S R a : Obj) (hr : ∀ x : Obj, x ∈ S → (x, x) ∈ R) (ha : a ∈ S) :2    a ∈ {s ∈ S | (s, a) ∈ R} := by
verified
goalGoals accomplished.

Exercise 6.11.

The empty relation is symmetric and transitive.

lean proof
1example (x y z : Obj) :2    ((x, y) ∈ ∅ → (y, x) ∈ ∅) ∧ ((x, y) ∈ ∅ → (y, z) ∈ ∅ → (x, z) ∈ ∅) := by
goalx y z : Obj ⊢ ((x, y) ∈ ∅ → (y, x) ∈ ∅) ∧ ((x, y) ∈ ∅ → (y, z) ∈ ∅ → (x, z) ∈ ∅)

Exercise 6.12.

And the universal relation is transitive.

lean proof
1example (S x y z : Obj) (h1 : (x, y) ∈ S × S) (h2 : (y, z) ∈ S × S) : (x, z) ∈ S × S := by
goalS x y z : Obj h1 : (x, y) ∈ S × S h2 : (y, z) ∈ S × S ⊢ (x, z) ∈ S × S

Exercise 6.13.

Symmetry and transitivity give reflexivity, but only at the elements the relation already reaches.

lean proof
1example (R x y : Obj)2    (hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (ht : ∀ a b c : Obj, (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R)4    (h : (x, y) ∈ R) : (x, x) ∈ R ∧ (y, y) ∈ R := by
goalR x y : Obj hs : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R ht : ∀ (a : Obj), ∀ (b : Obj), ∀ (c : Obj), (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R h : (x, y) ∈ R ⊢ (x, x) ∈ R ∧ (y, y) ∈ R

Exercise 6.14.

The first half of Problem 6.3 , with TT written out.

lean proof
1example (S R x y : Obj)2    (hs : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (ht : ∀ a b c : Obj, (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R)4    (hx : x ∈ S) (h : (x, y) ∈ R) : x ∈ {t ∈ S | (t, t) ∈ R} := by
goalS R x y : Obj hs : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R ht : ∀ (a : Obj), ∀ (b : Obj), ∀ (c : Obj), (a, b) ∈ R → (b, c) ∈ R → (a, c) ∈ R hx : x ∈ S h : (x, y) ∈ R ⊢ x ∈ {t ∈ S | (t, t) ∈ R}

Exercise 6.15.

Symmetry survives intersection.

lean proof
1example (R Q x y : Obj)2    (hR : ∀ a b : Obj, (a, b) ∈ R → (b, a) ∈ R)3    (hQ : ∀ a b : Obj, (a, b) ∈ Q → (b, a) ∈ Q)4    (h : (x, y) ∈ R ∩ Q) : (y, x) ∈ R ∩ Q := by
goalR Q x y : Obj hR : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ R → (b, a) ∈ R hQ : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ Q → (b, a) ∈ Q h : (x, y) ∈ R ∩ Q ⊢ (y, x) ∈ R ∩ Q

Exercise 6.16.

Proposition 6.22 , with the order written as a relation LL and antisymmetry as a hypothesis.

lean proof
1example (S L m n : Obj)2    (hanti : ∀ a b : Obj, (a, b) ∈ L → (b, a) ∈ L → a = b)3    (hm : m ∈ S ∧ ∀ x : Obj, x ∈ S → (m, x) ∈ L)4    (hn : n ∈ S ∧ ∀ x : Obj, x ∈ S → (n, x) ∈ L) : m = n := by
goalS L m n : Obj hanti : ∀ (a : Obj), ∀ (b : Obj), (a, b) ∈ L → (b, a) ∈ L → a = b hm : m ∈ S ∧ (∀ (x : Obj), x ∈ S → (m, x) ∈ L) hn : n ∈ S ∧ (∀ (x : Obj), x ∈ S → (n, x) ∈ L) ⊢ m = n

Exercise 6.17.

The step 2  ⟹  12 \implies 1 of Proposition 6.28 : classes that meet come from related elements.

lean proof
1example (S R a b c : Obj)2    (hs : ∀ x y : Obj, (x, y) ∈ R → (y, x) ∈ R)3    (ht : ∀ x y z : Obj, (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R)4    (h : c ∈ {s ∈ S | (s, a) ∈ R} ∩ {s ∈ S | (s, b) ∈ R}) : (a, b) ∈ R := by
goalS R a b c : Obj hs : ∀ (x : Obj), ∀ (y : Obj), (x, y) ∈ R → (y, x) ∈ R ht : ∀ (x : Obj), ∀ (y : Obj), ∀ (z : Obj), (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R h : c ∈ {s ∈ S | (s, a) ∈ R} ∩ {s ∈ S | (s, b) ∈ R} ⊢ (a, b) ∈ R

Exercise 6.18.

And the step 1  ⟹  31 \implies 3, which is an equality of sets.

lean proof
1example (S R a b : Obj)2    (hs : ∀ x y : Obj, (x, y) ∈ R → (y, x) ∈ R)3    (ht : ∀ x y z : Obj, (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R)4    (h : (a, b) ∈ R) : {s ∈ S | (s, a) ∈ R} = {s ∈ S | (s, b) ∈ R} := by
goalS R a b : Obj hs : ∀ (x : Obj), ∀ (y : Obj), (x, y) ∈ R → (y, x) ∈ R ht : ∀ (x : Obj), ∀ (y : Obj), ∀ (z : Obj), (x, y) ∈ R → (y, z) ∈ R → (x, z) ∈ R h : (a, b) ∈ R ⊢ {s ∈ S | (s, a) ∈ R} = {s ∈ S | (s, b) ∈ R}

The order on the natural numbers

ℕ is the carrier of the last sheet, and the order is written ≤ and <, typed \le and <. Neither is a name in the library: they are the definitions of Definition 6.32 and Proposition 6.35 outright, so

m ≤ n   is   ∃ b : ℕ, n = m + b
m < n   is   ∃ b : ℕ, b ≠ 0 ∧ n = m + b

and every tactic for an existential acts on them unchanged: use supplies the difference, obtain ⟨b, hb, he⟩ takes a strict inequality apart into a positive bb and the equation it satisfies, and obtain ⟨b, he⟩ does the same for a non-strict one. The reverse orders > and ≥ are these two read backwards, as Definition 6.14 has them. Numerals are still spelled as the last sheet spelled them, so 11 is succ 0.

Example.

The difference that makes an element reach itself is 00, and the first clause of addition checks it.

lean worked
1example (n : ℕ) : n ≤ n := by
verified
goalGoals accomplished.

Example.

Corollary 6.33 . Once the difference is named, one half is the hypothesis and the other holds of itself.

lean worked
1example (x y : ℕ) (h : y ≠ 0) : x < x + y := by
verified
goalGoals accomplished.

Exercise 6.19.

The second half of Proposition 6.36 .

lean proof
1example (n : ℕ) : 0 ≤ n := by
goaln : ℕ ⊢ 0 ≤ n

Exercise 6.20.

Every element is below its successor.

lean proof
1example (n : ℕ) : n < succ n := by
goaln : ℕ ⊢ n < succ n

Exercise 6.21.

A positive difference is a difference.

lean proof
1example (m n : ℕ) : m < n → m ≤ n := by
goalm n : ℕ ⊢ m < n → m ≤ n

Exercise 6.22.

Proposition 6.8 , proved here from uniqueness of differences rather than from trichotomy.

lean proof
1example (n : ℕ) : ¬(n < n) := by
goaln : ℕ ⊢ ¬n < n

Exercise 6.23.

Transitivity: two positive differences compose into one.

lean proof
1example (m n p : ℕ) : m < n → n < p → m < p := by
goalm n p : ℕ ⊢ m < n → n < p → m < p

Exercise 6.24.

Antisymmetry, which is the second law of Proposition 6.11 .

lean proof
1example (m n : ℕ) : m ≤ n → n ≤ m → m = n := by
goalm n : ℕ ⊢ m ≤ n → n ≤ m → m = n

Exercise 6.25.

No comparison points both ways.

lean proof
1example (m n : ℕ) : m < n → ¬(n < m) := by
goalm n : ℕ ⊢ m < n → ¬n < m

Exercise 6.26.

The first part of Problem 6.16 .

lean proof
1example (x y z : ℕ) : x ≤ y → x + z ≤ y + z := by
goalx y z : ℕ ⊢ x ≤ y → x + z ≤ y + z

Exercise 6.27.

And the second, with the factor on the left so that distributivity applies as it stands.

lean proof
1example (x y z : ℕ) : x ≤ y → z * x ≤ z * y := by
goalx y z : ℕ ⊢ x ≤ y → z * x ≤ z * y

Exercise 6.28.

Problem 6.15 . Both directions move a successor between the two sides of a sum.

lean proof
1example (m n : ℕ) : m < n ↔ succ m ≤ n := by
goalm n : ℕ ⊢ m < n ↔ succ m ≤ n

Exercise 6.29.

Problem 6.17 .

lean proof
1example (m n p q : ℕ) : m < n → p < q → m + p < n + q := by
goalm n p q : ℕ ⊢ m < n → p < q → m + p < n + q

Exercise 6.30.

Proposition 6.39 . (Harder.)

lean proof
1example (n x : ℕ) : n < x → ¬(x < succ n) := by
goaln x : ℕ ⊢ n < x → ¬x < succ n
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 7

Infinite Sets

Taught

Finite Sets

To count a herd is to pair its animals off against 0,1,20, 1, 2 and so on, and to report the number we stopped at. Nothing in that procedure asks what the counting numbers are; it asks for a bijection between the herd and an opening stretch of them. Both are now built, so we can count, and the notion of the same size that counting rests on still makes sense for sets far too large to count.

Comparing Sets by Functions

Definition 7.1 (Equinumerous sets).

Sets AA and BB are equinumerous, written A≈BA \approx B, if there is a bijection f:A→Bf : A \to B. We also say that AA and BB have the same size.

The definition asks for one bijection and says nothing about how many there are; two sets of three elements are matched up in six different ways, and the definition is satisfied by any of them. It also does not mention counting, so it still makes sense for sets we cannot count.

Proposition 7.2 (Equinumerosity is reflexive, symmetric and transitive).

Let AA, BB and CC be sets.

  1. A≈AA \approx A.
  2. If A≈BA \approx B then B≈AB \approx A.
  3. If A≈BA \approx B and B≈CB \approx C then A≈CA \approx C.

Discussion.

Each part is an existence claim about bijections, so each is proved by producing one, and in every case the bijection we need has already been built. For the first, the identity map on AA is its own inverse, and a map with an inverse is a bijection by the theorem on invertibility. The second and third are conditionals, so we start from the bijections the hypothesis gives: from one bijection, the theorem that the inverse is a bijection; from two, the theorem that bijections compose. No part uses anything about the elements of the sets.

Proof.

For the first, idA∘idA=idA\mathrm{id}_A \circ \mathrm{id}_A = \mathrm{id}_A, so idA\mathrm{id}_A is invertible and hence a bijection from AA to AA.

For the second, let f:A→Bf : A \to B be a bijection. Its inverse f−1:B→Af^{-1} : B \to A is a bijection, so B≈AB \approx A.

For the third, let f:A→Bf : A \to B and g:B→Cg : B \to C be bijections. Then g∘f:A→Cg \circ f : A \to C is a bijection, so A≈CA \approx C.

Remark.

Those are the three properties of an equivalence relation, and yet ≈\approx is not one, because it is not a relation at all in our sense: a relation on SS is a subset of S×SS \times S, and there is no set of all sets for SS to be. Fix a set XX, however, and ≈\approx restricted to P(X)\mathcal{P}(X) is an honest equivalence relation on an honest set, so it partitions P(X)\mathcal{P}(X) into classes of subsets of the same size. That is how the notion is used in practice, and the general statement is a convenience of language rather than a claim about a set of pairs.

Example 7.3.

Write LnL_n for the cut {x∈N0∣x<n}\{x \in \mathbb{N}_0 \mid x < n\}, so that L3={0,1,2}L_3 = \{0, 1, 2\}. If aa, bb and cc are distinct then {a,b,c}≈L3\{a, b, c\} \approx L_3, witnessed by a↦0a \mapsto 0, b↦1b \mapsto 1, c↦2c \mapsto 2. Any other listing of the three letters gives another bijection, and the definition does not prefer one.

Problem 7.1.

Show that A×B≈B×AA \times B \approx B \times A for all sets AA and BB, and that (A×B)×C≈A×(B×C)(A \times B) \times C \approx A \times (B \times C).

Problem 7.2.

Show that A≈BA \approx B implies P(A)≈P(B)\mathcal{P}(A) \approx \mathcal{P}(B). Which of the theorems on images and preimages does your bijection rest on?

Counting

The cuts are the sets we count against: LnL_n collects the nn numbers below nn. First we record how they grow, which every induction below uses.

Proposition 7.4 (The cuts grow by one point).

L0=∅L_0 = \emptyset, and for every n∈N0n \in \mathbb{N}_0,

Ls(n)=Ln∪{n},n∉Ln.L_{s(n)} = L_n \cup \{n\}, \qquad n \notin L_n.

Discussion.

There are three assertions and each is a statement about which elements a cut holds, so each unfolds to a comparison with nn. That L0L_0 is empty is a negative claim, ruled out by the proposition that every natural number is at least zero together with trichotomy, which forbids x<0x < 0 once 0⩽x0 \leqslant x is known. The equation is an equality of sets, so it splits into two inclusions, and both come from asking where xx sits relative to nn: to the left, x<s(n)x < s(n) leaves the alternatives x<nx < n and x=nx = n once the proposition that nothing lies strictly between nn and s(n)s(n) has removed the third; to the right, x<nx < n or x=nx = n gives x<s(n)x < s(n) because n<s(n)n < s(n) and << is transitive. The last assertion is anti-reflexivity read off the definition of the cut.

Proof.

An x∈N0x \in \mathbb{N}_0 satisfies 0⩽x0 \leqslant x, so x<0x < 0 would violate trichotomy; hence L0=∅L_0 = \emptyset.

Let x<s(n)x < s(n). Trichotomy gives x<nx < n, x=nx = n or n<xn < x, and the last would place xx strictly between nn and s(n)s(n), which nothing does. So x∈Ln∪{n}x \in L_n \cup \{n\}. Conversely n<s(n)n < s(n) by the corollary that adding a positive element moves you up, so x=nx = n gives x<s(n)x < s(n), and x<nx < n gives x<s(n)x < s(n) by transitivity. Hence Ls(n)=Ln∪{n}L_{s(n)} = L_n \cup \{n\}.

Finally ¬(n<n)\neg(n < n), so n∉Lnn \notin L_n.

Definition 7.5 (Finite and infinite sets).

A set AA is finite if A≈LnA \approx L_n for some n∈N0n \in \mathbb{N}_0, and infinite otherwise.

So ∅\emptyset is finite, since L0=∅L_0 = \emptyset, and each LnL_n is finite by way of its identity map. The definition offers some nn, and to speak of the number of elements we must know that no two cuts are matched by a bijection. The next few results prove this. The main tool is the simplest rearrangement: a map exchanging two points and leaving the rest alone.

Definition 7.6 (Transposition).

Let SS be a set and let a,b∈Sa, b \in S. The transposition τa,b:S→S\tau_{a,b} : S \to S is the function given by

τa,b(a)=defb,τa,b(b)=defa,τa,b(x)=defx  for every other x∈S.\tau_{a,b}(a) \defeq b, \qquad \tau_{a,b}(b) \defeq a, \qquad \tau_{a,b}(x) \defeq x \ \text{ for every other } x \in S.

When a=ba = b the three clauses agree and τa,b\tau_{a,b} is the identity map on SS.

Proposition 7.7 (A transposition is its own inverse).

Let SS be a set and let a,b∈Sa, b \in S. Then τa,b∘τa,b=idS\tau_{a,b} \circ \tau_{a,b} = \mathrm{id}_S, and τa,b\tau_{a,b} is a bijection.

Discussion.

Two assertions, the second following from the first. The first is an equality of functions, so by equality of functions we compare values at an arbitrary point of SS, and the definition splits the points into three cases, each settled by reading the definition twice. The second is then the theorem on invertibility, which makes a map with a two-sided inverse a bijection; the first assertion offers τa,b\tau_{a,b} itself as that inverse, so nothing further need be built.

Proof.

Write τ=defτa,b\tau \defeq \tau_{a,b} and let x∈Sx \in S. If x=ax = a then τ(τ(a))=τ(b)=a\tau(\tau(a)) = \tau(b) = a; if x=bx = b then τ(τ(b))=τ(a)=b\tau(\tau(b)) = \tau(a) = b; and otherwise τ(τ(x))=τ(x)=x\tau(\tau(x)) = \tau(x) = x. So τ∘τ=idS\tau \circ \tau = \mathrm{id}_S, and τ\tau is invertible, hence a bijection from SS to SS.

Proposition 7.8 (Bijections remove points).

Let f:A→Bf : A \to B be a bijection and let a∈Aa \in A. Then A∖{a}≈B∖{f(a)}A \setminus \{a\} \approx B \setminus \{f(a)\}.

Discussion.

We need a bijection between the two smaller sets, and the only map we have is ff, so we restrict it and check the two halves of bijectivity. Injectivity is inherited, since a restriction of an injective map is injective. For the values, injectivity is again what we use: a point other than aa cannot be sent to f(a)f(a), so the restriction does land in B∖{f(a)}B \setminus \{f(a)\}; and surjectivity of ff supplies, for each yy in that set, a preimage, which cannot be aa because y≠f(a)y \neq f(a).

Proof.

Let gg be the restriction of ff to A∖{a}A \setminus \{a\}. If x≠ax \neq a then f(x)≠f(a)f(x) \neq f(a) by injectivity, so gg takes its values in B∖{f(a)}B \setminus \{f(a)\}, and gg is injective because ff is.

Let y∈B∖{f(a)}y \in B \setminus \{f(a)\}. By surjectivity y=f(x)y = f(x) for some x∈Ax \in A, and x≠ax \neq a since y≠f(a)y \neq f(a). So y=g(x)y = g(x), and gg is a bijection onto B∖{f(a)}B \setminus \{f(a)\}.

Proposition 7.9 (Removing a point from a cut).

Let n∈N0n \in \mathbb{N}_0 and let k∈Ls(n)k \in L_{s(n)}. Then Ls(n)∖{k}≈LnL_{s(n)} \setminus \{k\} \approx L_n.

Discussion.

The previous proposition removes a point and its image under a bijection, so the plan is to build a bijection of Ls(n)L_{s(n)} with itself that carries kk to nn and then remove nn, where the result is the cut LnL_n by the proposition on how cuts grow. The transposition of kk and nn does exactly that, and it is a bijection by the proposition just proved, so nothing needs checking. The case k=nk = n is the growth proposition on its own, the transposition there being the identity.

Proof.

If k=nk = n then Ls(n)∖{n}=LnL_{s(n)} \setminus \{n\} = L_n by the proposition on how cuts grow, and a set is equinumerous with itself.

Suppose k≠nk \neq n and let τ=defτk,n\tau \defeq \tau_{k,n} be the transposition of kk and nn on Ls(n)L_{s(n)}, which is a bijection by the proposition above. Since τ(k)=n\tau(k) = n, the proposition on removing points gives

Ls(n)∖{k}≈Ls(n)∖{n}=Ln.L_{s(n)} \setminus \{k\} \approx L_{s(n)} \setminus \{n\} = L_n.

Theorem 7.10 (No cut injects into a shorter one).

For every n∈N0n \in \mathbb{N}_0 there is no injection f:Ls(n)→Lnf : L_{s(n)} \to L_n.

Discussion.

The claim is a universally quantified non-existence statement, so we induct on nn and argue each case by contradiction. At n=0n = 0 the target is empty while the source is not, and a function must name a value at every point of its domain, so there is no such function. For the step we assume no injection Ls(n)→LnL_{s(n)} \to L_n and suppose one is given from Ls(s(n))L_{s(s(n))} to Ls(n)L_{s(n)}. The extra point of the source is s(n)s(n), and by injectivity no other point is sent to its value cc, so removing both leaves an injection from Ls(n)L_{s(n)} into Ls(n)∖{c}L_{s(n)} \setminus \{c\}. The previous proposition says that set is a copy of LnL_n, and composing with a bijection onto LnL_n gives an injection the inductive hypothesis forbids.

Proof.

We induct on nn. For n=0n = 0 the cut L1L_1 is {0}\{0\} and L0L_0 is empty, so a function L1→L0L_1 \to L_0 would have to give a value f(0)∈∅f(0) \in \emptyset. There is none.

Suppose there is no injection Ls(n)→LnL_{s(n)} \to L_n, and let f:Ls(s(n))→Ls(n)f : L_{s(s(n))} \to L_{s(n)} be injective. Since s(n)<s(s(n))s(n) < s(s(n)), the value c=deff(s(n))c \defeq f(s(n)) is defined. If x<s(n)x < s(n) then x≠s(n)x \neq s(n), so f(x)≠cf(x) \neq c by injectivity; hence the restriction of ff to Ls(n)L_{s(n)} is an injection taking its values in Ls(n)∖{c}L_{s(n)} \setminus \{c\}. Composing it with a bijection from Ls(n)∖{c}L_{s(n)} \setminus \{c\} onto LnL_n, which the previous proposition supplies, yields an injection Ls(n)→LnL_{s(n)} \to L_n, contrary to the hypothesis. So no such ff exists, and induction completes the proof.

Corollary 7.11 (Cuts of different length are not equinumerous).

If Lm≈LnL_m \approx L_n then m=nm = n.

Proof.

Suppose m<nm < n. Then Lm⊂LnL_m \subset L_n by transitivity, and m∈Lnm \in L_n, so Ls(m)=Lm∪{m}⊂LnL_{s(m)} = L_m \cup \{m\} \subset L_n. A bijection Ln→LmL_n \to L_m restricted to Ls(m)L_{s(m)} is then an injection Ls(m)→LmL_{s(m)} \to L_m, which the theorem forbids. The same argument with mm and nn exchanged rules out n<mn < m, so trichotomy leaves m=nm = n.

Definition 7.12 (Cardinality of a finite set).

Let AA be finite. The unique n∈N0n \in \mathbb{N}_0 with A≈LnA \approx L_n is the cardinality of AA, written #A\#A, and we say AA has nn elements.

Uniqueness is the corollary, and without it the notation would not be well defined. Some authors write ∣A∣|A| for the same number.

Corollary 7.13 (Cardinality classifies finite sets).

Let AA and BB be finite. Then A≈BA \approx B if and only if #A=#B\#A = \#B.

Proof.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B, so A≈LmA \approx L_m and B≈LnB \approx L_n. If A≈BA \approx B then Lm≈A≈B≈LnL_m \approx A \approx B \approx L_n by symmetry and transitivity, so m=nm = n by the previous corollary. Conversely if m=nm = n then A≈Lm=Ln≈BA \approx L_m = L_n \approx B.

Example 7.14.

#∅=0\#\emptyset = 0 and #Ln=n\#L_n = n. A finite set has cardinality 00 exactly when it is empty, since a bijection onto L0=∅L_0 = \emptyset from a non-empty set would have to name an element of ∅\emptyset. If a≠ba \neq b then #{a}=1\#\{a\} = 1 and #{a,b}=2\#\{a, b\} = 2, since L1={0}L_1 = \{0\} and L2={0,1}L_2 = \{0, 1\}.

Proposition 7.15 (Adjoining a point).

Let AA be finite and let b∉Ab \notin A. Then A∪{b}A \cup \{b\} is finite and #(A∪{b})=s(#A)\#(A \cup \{b\}) = s(\#A).

Discussion.

Both assertions come from one bijection, which we build and check. We hold a bijection gg from AA onto LnL_n, and the set to be counted has exactly one extra point, while the cut Ls(n)L_{s(n)} has exactly one point more than LnL_n, namely nn itself. So we extend gg by sending bb to nn. That the extension is a function uses b∉Ab \notin A, which stops the two clauses from disagreeing anywhere; that it is injective uses n∉Lnn \notin L_n, which stops the new value from repeating an old one; and that it is surjective is the growth proposition, which says Ls(n)L_{s(n)} holds nothing beyond LnL_n and nn.

Proof.

Put n=def#An \defeq \#A and let g:A→Lng : A \to L_n be a bijection. Define g′:A∪{b}→Ls(n)g' : A \cup \{b\} \to L_{s(n)} by g′(x)=defg(x)g'(x) \defeq g(x) for x∈Ax \in A and g′(b)=defng'(b) \defeq n. Since b∉Ab \notin A, every point of the domain falls under exactly one clause, so g′g' is a function, and its values lie in Ls(n)=Ln∪{n}L_{s(n)} = L_n \cup \{n\}.

For injectivity, two points of AA are separated by gg, and a point of AA is separated from bb because g(x)∈Lng(x) \in L_n while n∉Lnn \notin L_n. For surjectivity, an element of Ls(n)L_{s(n)} is either nn, which is g′(b)g'(b), or an element of LnL_n, which is g(x)g(x) for some x∈Ax \in A by surjectivity of gg. So A∪{b}≈Ls(n)A \cup \{b\} \approx L_{s(n)}.

Corollary 7.16 (Removing a point).

Let AA be finite and non-empty and let a∈Aa \in A. Then A∖{a}A \setminus \{a\} is finite and #A=s(#(A∖{a}))\#A = s\bigl(\#(A \setminus \{a\})\bigr).

Proof.

Let f:A→Lnf : A \to L_n be a bijection, where n=def#An \defeq \#A. Since AA is non-empty, n≠0n \neq 0, so the theorem on predecessors gives n=s(k)n = s(k) for some kk. The proposition on removing points from bijections gives A∖{a}≈Ls(k)∖{f(a)}A \setminus \{a\} \approx L_{s(k)} \setminus \{f(a)\}, and the proposition on removing a point from a cut gives Ls(k)∖{f(a)}≈LkL_{s(k)} \setminus \{f(a)\} \approx L_k. So A∖{a}A \setminus \{a\} is finite with cardinality kk, and #A=s(k)\#A = s(k).

Subsets and Images

Theorem 7.17 (Subsets of a finite set).

Let AA be finite and let B⊂AB \subset A. Then BB is finite and #B⩽#A\#B \leqslant \#A. If moreover B⊊AB \subsetneq A then #B<#A\#B < \#A.

Discussion.

The first sentence quantifies over all subsets of all finite sets, so we induct on the cardinality, taking for the predicate at nn the statement that every subset of every set with nn elements is finite with cardinality at most nn. At n=0n = 0 the ambient set is empty and so is the subset. For the step we peel off a point aa of the ambient set, leaving a set the hypothesis governs, and split on whether aa belongs to the subset: if not, the subset is already inside the smaller set; if so, we apply the hypothesis to the subset with aa removed and put aa back, which raises both cardinalities by one successor.

The second sentence uses properness. A point aa of AA outside BB can be adjoined to BB without leaving AA, so the first sentence applies to B∪{a}B \cup \{a\} and yields s(#B)⩽#As(\#B) \leqslant \#A; and s(m)⩽ns(m) \leqslant n forces m<nm < n, since s(m)+b=m+s(b)s(m) + b = m + s(b) and s(b)s(b) is positive.

Proof.

We first record two small facts about successors, both read off the clauses for addition. If m⩽nm \leqslant n then n=m+bn = m + b for some b∈N0b \in \mathbb{N}_0, so s(n)=s(m+b)=s(m)+bs(n) = s(m + b) = s(m) + b by addition from the left, and hence s(m)⩽s(n)s(m) \leqslant s(n). If s(m)⩽ns(m) \leqslant n then n=s(m)+b=s(m+b)=m+s(b)n = s(m) + b = s(m + b) = m + s(b), and s(b)s(b) is positive, so m<nm < n.

For the first assertion we induct on nn, proving that every subset of every set of cardinality nn is finite with cardinality at most nn. If n=0n = 0 then the ambient set is empty, so B=∅B = \emptyset and #B=0\#B = 0.

Suppose the claim holds at nn, let #A=s(n)\#A = s(n) and let B⊂AB \subset A. Since s(n)≠0s(n) \neq 0, the set AA is non-empty; choose a∈Aa \in A and put A′=defA∖{a}A' \defeq A \setminus \{a\}, which has cardinality nn by the corollary on removing a point. If a∉Ba \notin B then B⊂A′B \subset A', so the hypothesis makes BB finite with #B⩽n⩽s(n)\#B \leqslant n \leqslant s(n). If a∈Ba \in B then B∖{a}⊂A′B \setminus \{a\} \subset A', so B∖{a}B \setminus \{a\} is finite with cardinality m⩽nm \leqslant n; adjoining aa makes BB finite with #B=s(m)⩽s(n)\#B = s(m) \leqslant s(n).

For the second assertion, let B⊊AB \subsetneq A and choose a∈A∖Ba \in A \setminus B. Then B∪{a}⊂AB \cup \{a\} \subset A, so the first assertion gives s(#B)=#(B∪{a})⩽#As(\#B) = \#(B \cup \{a\}) \leqslant \#A, and therefore #B<#A\#B < \#A.

Corollary 7.18 (No finite set is equinumerous with a proper subset).

Let AA be finite and B⊊AB \subsetneq A. Then A≉BA \not\approx B.

Proof.

The theorem gives #B<#A\#B < \#A, so #B≠#A\#B \neq \#A by anti-reflexivity, and finite sets of different cardinality are not equinumerous.

Proposition 7.19 (Images of a finite set).

Let AA be finite and let f:A→Bf : A \to B be a function. Then the image f(A)f(A) is finite with #f(A)⩽#A\#f(A) \leqslant \#A, and #f(A)=#A\#f(A) = \#A if and only if ff is injective.

Discussion.

The inequality is proved by induction on #A\#A: remove a point aa from AA, apply the hypothesis to what remains, and observe that the image gains at most the single value f(a)f(a), so it grows by at most one successor.

The biconditional needs no second induction, because each direction is already available. If ff is injective it is a bijection onto its range, so the two cardinalities agree. If ff is not injective, two distinct points share a value, so deleting one of them changes nothing about the image; the inequality applied to the smaller set then gives a strict drop, since a proper subset of a finite set is strictly smaller. Those two together are the biconditional, the second read contrapositively.

Proof.

For the inequality we induct on n=#An = \#A. If n=0n = 0 then A=∅A = \emptyset and f(A)=∅f(A) = \emptyset.

Suppose the claim holds for sets of cardinality nn and let #A=s(n)\#A = s(n). Choose a∈Aa \in A and put A′=defA∖{a}A' \defeq A \setminus \{a\}, of cardinality nn. Since A=A′∪{a}A = A' \cup \{a\} we have f(A)=f(A′)∪{f(a)}f(A) = f(A') \cup \{f(a)\}, and f(A′)f(A') is finite with #f(A′)⩽n\#f(A') \leqslant n by hypothesis. If f(a)∈f(A′)f(a) \in f(A') then f(A)=f(A′)f(A) = f(A') and #f(A)⩽n⩽s(n)\#f(A) \leqslant n \leqslant s(n). Otherwise adjoining the point gives #f(A)=s(#f(A′))⩽s(n)\#f(A) = s(\#f(A')) \leqslant s(n).

If ff is injective then ff is a bijection from AA onto f(A)f(A), so #f(A)=#A\#f(A) = \#A. If ff is not injective, choose x≠yx \neq y in AA with f(x)=f(y)f(x) = f(y). Every value of ff is then already taken on A∖{x}A \setminus \{x\}, since f(x)=f(y)f(x) = f(y) and y≠xy \neq x, so f(A)=f(A∖{x})f(A) = f(A \setminus \{x\}) and

#f(A)⩽#(A∖{x})<#A,\#f(A) \leqslant \#(A \setminus \{x\}) < \#A,

the second inequality because A∖{x}A \setminus \{x\} is a proper subset. So equality holds exactly when ff is injective.

The Pigeonhole Principle

Theorem 7.20 (Injections, surjections and size).

Let AA and BB be finite.

  1. If there is an injection f:A→Bf : A \to B then #A⩽#B\#A \leqslant \#B.
  2. If there is a surjection f:A→Bf : A \to B then #B⩽#A\#B \leqslant \#A.

Discussion.

Both parts turn the given function into a statement about the image, and then apply the two results just proved. An injection is a bijection onto its range, so AA and f(A)f(A) have the same cardinality, and f(A)f(A) is a subset of BB, which the theorem on subsets bounds by #B\#B. A surjection has range all of BB, so #B\#B is the cardinality of an image, which the proposition on images bounds by #A\#A. Notice that no choice of preimages is made anywhere, so neither part appeals to the axiom of choice.

Proof.

For the first, ff is a bijection from AA onto f(A)f(A), so #A=#f(A)\#A = \#f(A); and f(A)⊂Bf(A) \subset B, so #f(A)⩽#B\#f(A) \leqslant \#B by the theorem on subsets.

For the second, surjectivity gives f(A)=Bf(A) = B, so #B=#f(A)⩽#A\#B = \#f(A) \leqslant \#A by the proposition on images.

Corollary 7.21 (Pigeonhole principle).

Let AA and BB be finite with #B<#A\#B < \#A. Then no function A→BA \to B is injective, and no function B→AB \to A is surjective.

Proof.

An injection A→BA \to B would give #A⩽#B\#A \leqslant \#B, and a surjection B→AB \to A would give #A⩽#B\#A \leqslant \#B as well; either contradicts #B<#A\#B < \#A by trichotomy.

Example 7.22.

Among thirteen people, two were born in the same month: the map sending each person to the month of their birth goes from a set of thirteen elements to one of twelve, so it cannot be injective, and two people share a value. The principle says the pair exists but gives no way to find it.

Theorem 7.23 (Injective, surjective and bijective agree on a finite set).

Let AA be finite and let f:A→Af : A \to A. Then ff is injective if and only if it is surjective, and either condition makes ff a bijection.

Discussion.

The statement is a biconditional between two conditions on the same map, so we prove each direction, and the last clause follows: a bijection is by definition an injection that is also a surjection, so once the two conditions are equivalent, each one gives both.

Going forwards, injectivity makes the image as large as the whole, and a subset of a finite set with the full cardinality cannot be proper, so the image is everything. Going backwards we argue by contradiction, because failure of injectivity is what we can compute with: a repeated value lets us delete a point without shrinking the image, so the image of a proper subset would have to be all of AA, and the proposition on images bounds it by something strictly smaller.

Proof.

Suppose ff is injective. Then #f(A)=#A\#f(A) = \#A by the proposition on images, and f(A)⊂Af(A) \subset A, so f(A)=Af(A) = A by the theorem on subsets, since a proper subset would have strictly smaller cardinality. Hence ff is surjective.

Suppose ff is surjective and not injective, so f(x)=f(y)f(x) = f(y) for some x≠yx \neq y. Then f(A)=f(A∖{x})f(A) = f(A \setminus \{x\}), and surjectivity makes this all of AA, so

#A=#f(A∖{x})⩽#(A∖{x})<#A,\#A = \#f(A \setminus \{x\}) \leqslant \#(A \setminus \{x\}) < \#A,

which anti-reflexivity forbids. So ff is injective.

In either case ff is both injective and surjective, hence a bijection.

Remark.

Finiteness is needed. The successor map s:N0→N0s : \mathbb{N}_0 \to \mathbb{N}_0 is injective by the third Peano condition and is not surjective, since 00 is not a successor. So on N0\mathbb{N}_0 the two conditions come apart, and the theorem cannot be extended by weakening its hypothesis.

Problem 7.3.

Let AA and BB be finite with #A=#B\#A = \#B and let f:A→Bf : A \to B be injective. Show that ff is a bijection.

Problem 7.4.

Let AA be finite and let f:A→Af : A \to A satisfy f∘f=ff \circ f = f. Show that f=idAf = \mathrm{id}_A if ff is injective, and describe what ff can be otherwise.

Sums and Products

Counting a union means laying one cut after another, so we first say how a cut breaks into an opening piece and a shifted one.

Proposition 7.24 (Splitting a cut).

Let m,n∈N0m, n \in \mathbb{N}_0 and put S=def{m+i∣i∈Ln}S \defeq \{m + i \mid i \in L_n\}. Then

Lm+n=Lm∪S,Lm∩S=∅,L_{m+n} = L_m \cup S, \qquad L_m \cap S = \emptyset,

and i↦m+ii \mapsto m + i is a bijection from LnL_n onto SS.

Discussion.

Three assertions, each about the position of a number relative to mm. The equality is a set equality, hence two inclusions. From left to right, trichotomy puts xx either below mm, which is the first part, or at or above it, in which case x=m+ix = m + i for a difference ii, and the difference is below nn because subtracting mm from both sides of x<m+nx < m + n leaves i<ni < n. From right to left, both parts are checked against m+nm + n directly, using that adding a positive element moves you up. Disjointness is trichotomy once more, since the members of SS are at least mm and the members of LmL_m are strictly below it. The last assertion is uniqueness of differences, which says m+i=m+i′m + i = m + i' can happen only for i=i′i = i'; surjectivity holds because SS was defined as the set of such values.

Proof.

Let x<m+nx < m + n. If x<mx < m then x∈Lmx \in L_m. Otherwise m⩽xm \leqslant x, so x=m+ix = m + i for some i∈N0i \in \mathbb{N}_0 by the description of the associated order. From m+i<m+nm + i < m + n we get m+n=(m+i)+b=m+(i+b)m + n = (m + i) + b = m + (i + b) for some positive bb, by the laws of addition, so n=i+bn = i + b by uniqueness of differences and hence i<ni < n. Thus x∈Sx \in S.

Conversely, m⩽m+nm \leqslant m + n, so x<mx < m gives x<m+nx < m + n by mixed transitivity. And if i<ni < n then n=i+bn = i + b with bb positive, so m+n=(m+i)+bm + n = (m + i) + b and m+i<m+nm + i < m + n.

If x∈Lm∩Sx \in L_m \cap S then x<mx < m and m⩽xm \leqslant x, which trichotomy forbids, so the intersection is empty.

Finally, i↦m+ii \mapsto m + i is injective by uniqueness of differences and surjective onto SS by the definition of SS.

Theorem 7.25 (Cardinality of a disjoint union).

Let AA and BB be finite and disjoint. Then A∪BA \cup B is finite and

#(A∪B)=#A+#B.\#(A \cup B) = \#A + \#B.

Discussion.

We must exhibit a bijection from A∪BA \cup B onto the cut Lm+nL_{m+n}, and the splitting proposition cuts that target into the two pieces we need. So we define the map in two clauses, counting the points of AA by their own bijection and the points of BB by theirs, shifted up by mm so as to land in the second piece. Disjointness of AA and BB means each point falls under exactly one clause, so we have a function. Injectivity then has three cases, two inside a piece, which the two bijections handle, and one across the pieces, which the disjointness of the split handles. Surjectivity is the other half of the split.

Proof.

Put m=def#Am \defeq \#A and n=def#Bn \defeq \#B, and let g:A→Lmg : A \to L_m and h:B→Lnh : B \to L_n be bijections. Define

k:A∪B→Lm+n,k(x)=def{g(x)if x∈A,m+h(x)if x∈B.k : A \cup B \to L_{m+n}, \qquad k(x) \defeq \begin{cases} g(x) & \text{if } x \in A, \\ m + h(x) & \text{if } x \in B. \end{cases}

Since A∩B=∅A \cap B = \emptyset, each point of the domain falls under exactly one clause, so kk is a function, and its values lie in Lm+nL_{m+n} by the splitting proposition.

For injectivity, two points of AA are separated by gg; two points of BB are separated by hh together with the injectivity of i↦m+ii \mapsto m + i; and a point of AA cannot collide with a point of BB, since their values lie in the two disjoint pieces of the split. For surjectivity, an element of Lm+nL_{m+n} lies either in LmL_m, hence is g(x)g(x) for some x∈Ax \in A, or is m+im + i with i∈Lni \in L_n, hence is m+h(y)=k(y)m + h(y) = k(y) for some y∈By \in B.

So A∪B≈Lm+nA \cup B \approx L_{m+n}, which is the assertion.

Corollary 7.26 (Cardinality of a union).

Let AA and BB be finite. Then A∪BA \cup B is finite and

#(A∪B)+#(A∩B)=#A+#B.\#(A \cup B) + \#(A \cap B) = \#A + \#B.

Proof.

The sets B∖AB \setminus A and A∩BA \cap B are subsets of BB, hence finite. Now A∪B=A∪(B∖A)A \cup B = A \cup (B \setminus A) with the two parts disjoint, so #(A∪B)=#A+#(B∖A)\#(A \cup B) = \#A + \#(B \setminus A); and B=(B∖A)∪(A∩B)B = (B \setminus A) \cup (A \cap B) with the two parts disjoint, so #B=#(B∖A)+#(A∩B)\#B = \#(B \setminus A) + \#(A \cap B). Adding #(A∩B)\#(A \cap B) to the first equation and substituting the second gives

#(A∪B)+#(A∩B)=#A+#(B∖A)+#(A∩B)=#A+#B,\#(A \cup B) + \#(A \cap B) = \#A + \#(B \setminus A) + \#(A \cap B) = \#A + \#B,

by the laws of addition.

Remark.

The familiar form of that identity subtracts the overlap, and we have written it with everything on the right instead. Subtraction is available to us only when the answer stays in N0\mathbb{N}_0, which it does here, but stating the law as an equation between sums spares us from checking that each time.

Problem 7.5.

Let AA, BB and CC be finite. Show that

#(A∪B∪C)+#(A∩B)+#(A∩C)+#(B∩C)=#A+#B+#C+#(A∩B∩C).\#(A \cup B \cup C) + \#(A \cap B) + \#(A \cap C) + \#(B \cap C) = \#A + \#B + \#C + \#(A \cap B \cap C).

Theorem 7.27 (Cardinality of a product).

Let AA and BB be finite. Then A×BA \times B is finite and #(A×B)=#A⋅#B\#(A \times B) = \#A \cdot \#B, with multiplication as the problems of the natural-numbers chapter defined it.

Discussion.

Multiplication was defined by recursion on its second argument, with the clauses x⋅0=0x \cdot 0 = 0 and x⋅s(n)=x⋅n+xx \cdot s(n) = x \cdot n + x, so we induct on #B\#B following them. At 00 the set BB is empty and so is the product, since a pair needs a second coordinate. For the step we split BB into a smaller set and a single extra point bb, which splits A×BA \times B into two disjoint pieces, one governed by the inductive hypothesis and one a copy of AA. The theorem on disjoint unions adds the two cardinalities, and the resulting sum is the right-hand side of the second clause of the multiplication recursion.

Proof.

We induct on n=def#Bn \defeq \#B. If n=0n = 0 then B=∅B = \emptyset, so A×B=∅A \times B = \emptyset and #(A×B)=0=#A⋅0\#(A \times B) = 0 = \#A \cdot 0.

Suppose the claim holds for every BB of cardinality nn, and let #B=s(n)\#B = s(n). Choose b∈Bb \in B and put B′=defB∖{b}B' \defeq B \setminus \{b\}, of cardinality nn. A pair (x,y)(x, y) with y∈By \in B has either y∈B′y \in B' or y=by = b, and not both, so

A×B=(A×B′)∪(A×{b}),(A×B′)∩(A×{b})=∅,A \times B = (A \times B') \cup (A \times \{b\}), \qquad (A \times B') \cap (A \times \{b\}) = \emptyset,

using equality of ordered pairs to read off the second coordinate. The map x↦(x,b)x \mapsto (x, b) is a bijection from AA onto A×{b}A \times \{b\}, again by equality of ordered pairs, so that piece has cardinality #A\#A; and A×B′A \times B' has cardinality #A⋅n\#A \cdot n by hypothesis. The theorem on disjoint unions gives

#(A×B)=#A⋅n+#A=#A⋅s(n),\#(A \times B) = \#A \cdot n + \#A = \#A \cdot s(n),

the last step being the second clause of the definition of multiplication.

Problem 7.6.

Show that a union of finitely many finite sets is finite. State the claim carefully first: it is an assertion about an indexed family whose index set is a cut.

Problem 7.7.

Let AA be finite with #A=n\#A = n. Show that #P(A)=2n\#\mathcal{P}(A) = 2^n, with powers as the problems of the natural-numbers chapter defined them.

Problem 7.8.

Let AA and BB be finite. Show that the Cartesian power ABA^B, the set of functions from BB to AA, is finite with #(AB)=(#A)#B\#(A^B) = (\#A)^{\#B}.

Extrema of Finite Sets

Proposition 7.28 (Finite subsets of an ordered set have extrema).

Let MM be a totally ordered set and let S⊂MS \subset M be finite and non-empty. Then SS has a minimum and a maximum.

Discussion.

The hypothesis is about an arbitrary finite non-empty set, so the induction runs on the cardinality and starts at 11 rather than 00, which is allowed by induction from an arbitrary starting point. A set of cardinality 11 has a single element, which is both extrema by reflexivity of the order. For the step we remove a point aa, apply the hypothesis to what remains, which is still non-empty, and then compare aa with the maximum found there: the two are comparable because the order is total, and whichever of the two is the larger is the maximum of the whole. Minima are the same argument with the inequalities reversed, so we write only one of them out.

Proof.

We induct on n=#Sn = \#S, beginning at n=1n = 1. Then S≈L1={0}S \approx L_1 = \{0\}, so S={a}S = \{a\} for a single aa, and a⩽aa \leqslant a makes it both the minimum and the maximum.

Suppose every subset of cardinality n⩾1n \geqslant 1 has both extrema, and let #S=s(n)\#S = s(n). Choose a∈Sa \in S and put S′=defS∖{a}S' \defeq S \setminus \{a\}, which has cardinality n⩾1n \geqslant 1 and so is non-empty. Let M′M' be its maximum. Since MM is totally ordered, aa and M′M' are comparable. If a⩽M′a \leqslant M' then M′M' is an upper bound of SS lying in SS, hence its maximum; if M′⩽aM' \leqslant a then aa is such a bound, hence the maximum. The argument for the minimum reverses the inequalities.

Corollary 7.29 (The natural numbers are infinite).

N0\mathbb{N}_0 and N\mathbb{N} are infinite.

Proof.

The order on N0\mathbb{N}_0 is strict and linear, so the associated ⩽\leqslant is a total order. Were N0\mathbb{N}_0 finite, it would be non-empty and so would have a maximum MM; but s(M)∈N0s(M) \in \mathbb{N}_0 and M<s(M)M < s(M), contradicting that MM is an upper bound. The same argument applies to N\mathbb{N}, whose element s(M)s(M) is positive because it is a successor.

Problem 7.9.

Show that a set with an infinite subset is infinite, and that the image of a finite set under any function is finite.

Comparing Sets

For an infinite set there is no n∈N0n \in \mathbb{N}_0 counting it, so we cannot compare numbers. Injections and bijections still make sense, though, and for finite sets the next theorem matches each inequality with a condition on functions.

Comparing Finite Sets

Theorem 7.30 (Comparing finite sets).

Let AA and BB be finite sets. Then

  1. #A⩽#B\#A \leqslant \#B if and only if there is an injection A→BA \to B;
  2. #A=#B\#A = \#B if and only if A≈BA \approx B;
  3. #A<#B\#A < \#B if and only if there is an injection A→BA \to B but no bijection A→BA \to B.

Discussion.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B and fix bijections f:Lm→Af : L_m \to A and g:Ln→Bg : L_n \to B; every part is then a matter of conjugating a map between the cuts into a map between the sets, or the other way about.

For the first part, one direction is already the theorem on injections and size. The other builds the injection: m⩽nm \leqslant n gives Lm⊂LnL_m \subset L_n, whose inclusion map is injective, and g∘ι∘f−1g \circ \iota \circ f^{-1} is then an injection A→BA \to B, being a composite of injections. The second part is the corollary that cardinality classifies finite sets, read in both directions.

The third is the first two put together. If m<nm < n then the first part supplies an injection, and a bijection would force m=nm = n by the second, which trichotomy forbids. Conversely an injection gives m⩽nm \leqslant n and the absence of a bijection gives m≠nm \neq n, and those two are what m<nm < n abbreviates.

Proof.

Write m=def#Am \defeq \#A and n=def#Bn \defeq \#B, and fix bijections f:Lm→Af : L_m \to A and g:Ln→Bg : L_n \to B.

For the first part, suppose m⩽nm \leqslant n. Then Lm⊂LnL_m \subset L_n, since x<m⩽nx < m \leqslant n gives x<nx < n, and the inclusion ι:Lm→Ln\iota : L_m \to L_n is injective. So g∘ι∘f−1:A→Bg \circ \iota \circ f^{-1} : A \to B is an injection. Conversely an injection A→BA \to B gives #A⩽#B\#A \leqslant \#B by the theorem on injections and size.

The second part is the corollary that cardinality classifies finite sets.

For the third, let m<nm < n. The first part gives an injection A→BA \to B, and a bijection would give m=nm = n by the second part, contradicting trichotomy. Conversely, an injection gives m⩽nm \leqslant n by the first part and the absence of a bijection gives m≠nm \neq n by the second, so m<nm < n.

The three right-hand sides make sense whether or not the sets are finite, so they may be taken as definitions in general. By the theorem, the new definitions agree with the old ones for finite sets.

Definition 7.31 (Comparing sizes).

Let AA and BB be sets, finite or not. We write

  1. #A⩽#B\#A \leqslant \#B if there is an injection A→BA \to B;
  2. #A=#B\#A = \#B if A≈BA \approx B;
  3. #A<#B\#A < \#B if there is an injection A→BA \to B but no bijection A→BA \to B.

For finite sets these agree with the numerical readings, by the theorem. The symbol #A\#A still names a natural number only when AA is finite; in general the three displays above are single assertions about functions, and it is the assertion, not the symbol #A\#A standing alone, that has been defined. What #A\#A may be taken to name in general is settled at the end of the chapter.

Read informally, #A<#B\#A < \#B says that BB is roomy enough to hold an injective copy of AA and still has something left over, in the strong sense that every injection misses something.

Proposition 7.32 (Reflexivity and transitivity).

For all sets AA, BB, CC:

  1. #A⩽#A\#A \leqslant \#A;
  2. if #A⩽#B\#A \leqslant \#B and #B⩽#C\#B \leqslant \#C then #A⩽#C\#A \leqslant \#C.

Discussion.

Both parts unfold to claims about injections, and both follow from basic facts about injections. Reflexivity needs an injection A→AA \to A, and the identity map is one. Transitivity needs an injection A→CA \to C out of injections A→BA \to B and B→CB \to C, and their composite is injective: if the composite identifies two points, the outer map identifies their images and the inner map identifies them.

Proof.

The identity idA\mathrm{id}_A is injective, so #A⩽#A\#A \leqslant \#A.

Let f:A→Bf : A \to B and g:B→Cg : B \to C be injections. If g(f(x))=g(f(y))g(f(x)) = g(f(y)) then f(x)=f(y)f(x) = f(y) by injectivity of gg, and x=yx = y by injectivity of ff. So g∘fg \circ f is an injection A→CA \to C and #A⩽#C\#A \leqslant \#C.

Problem 7.10.

Prove or refute each of the following, for arbitrary sets AA, BB and CC.

  1. If #A⩽#B\#A \leqslant \#B then #(A×C)⩽#(B×C)\#(A \times C) \leqslant \#(B \times C).
  2. #(A∖B)⩽#B\#(A \setminus B) \leqslant \#B.

Problem 7.11.

Let BB be non-empty. Show that #A⩽#(A×B)\#A \leqslant \#(A \times B) for every set AA.

The Schröder–Bernstein Theorem

The last proposition does not give antisymmetry. For finite sets it is immediate, since m⩽n⩽mm \leqslant n \leqslant m forces m=nm = n; in general it is a harder theorem.

Theorem 7.33 (Schröder–Bernstein).

Let AA and BB be sets with #A⩽#B\#A \leqslant \#B and #B⩽#A\#B \leqslant \#A. Then A≈BA \approx B.

Discussion.

We are given injections f:A→Bf : A \to B and g:B→Ag : B \to A and must build a bijection out of them. Neither alone will do: ff may miss part of BB and gg may miss part of AA. The idea is to use ff on some of AA and the inverse of gg on the rest, and the problem is to decide where the boundary falls. The points where we have no choice are those of A∖g(B)A \setminus g(B), which have no gg-preimage at all, so ff must be used there; and then ff must be used at g(f(x))g(f(x)) for each such xx, since otherwise that point would be sent back to f(x)f(x), which is already taken. Iterating gives a family A0,A1,A2,…A_0, A_1, A_2, \ldots built by the recursion theorem, and their union CC is the region where ff is used.

With the boundary fixed, three checks remain. The map is defined everywhere, because a point outside CC is in particular outside A0A_0, hence has a gg-preimage, unique by injectivity. It is injective on each of the two regions separately, and the two cannot collide, because a collision would carry a point of CC one step further along the chain and so put an element of CC outside CC. It is surjective by chasing a given bb backwards: if g(b)g(b) lies outside CC it is where bb comes from, and if it lies inside CC it lies in some AnA_n with nn a successor, which exhibits bb as a value of ff.

Proof.

Let f:A→Bf : A \to B and g:B→Ag : B \to A be injections. The recursion theorem, applied in P(A)\mathcal{P}(A) with the map X↦g(f(X))X \mapsto g(f(X)), gives exactly one family {An}n∈N0\{A_n\}_{n \in \mathbb{N}_0} with

A0=defA∖g(B),As(n)=defg(f(An)),A_0 \defeq A \setminus g(B), \qquad A_{s(n)} \defeq g\bigl(f(A_n)\bigr),

and we put C=def⋃n∈N0AnC \defeq \bigcup_{n \in \mathbb{N}_0} A_n. The two injections run the pieces alternately into one another,

A:A0A1A2⋯↓f↗g↓f↗g↓fB:f(A0)f(A1)f(A2)⋯\begin{array}{ccccccc} A: & A_0 & & A_1 & & A_2 & \cdots \\ & \big\downarrow {\scriptstyle f} & \nearrow {\scriptstyle g} & \big\downarrow {\scriptstyle f} & \nearrow {\scriptstyle g} & \big\downarrow {\scriptstyle f} & \\ B: & f(A_0) & & f(A_1) & & f(A_2) & \cdots \end{array}

and CC is the whole of the top row. On it the bijection will follow the downward arrows; off it every point has a gg-preimage, and the bijection will run back up them. Define

h:A→B,h(x)=def{f(x)if x∈C,the unique b with g(b)=xif x∉C.h : A \to B, \qquad h(x) \defeq \begin{cases} f(x) & \text{if } x \in C, \\ \text{the unique } b \text{ with } g(b) = x & \text{if } x \notin C. \end{cases}

The second clause makes sense: x∉Cx \notin C gives x∉A0x \notin A_0, so x∈g(B)x \in g(B), and the preimage is unique because gg is injective. So hh is a function.

For injectivity, suppose h(x)=h(y)h(x) = h(y). If both points lie in CC then f(x)=f(y)f(x) = f(y) gives x=yx = y; if neither does then applying gg to both sides gives x=yx = y. Suppose then x∈Cx \in C and y∉Cy \notin C, so f(x)=h(y)f(x) = h(y) and hence y=g(f(x))y = g(f(x)). Since x∈Cx \in C we have x∈Anx \in A_n for some nn, so y∈g(f(An))=As(n)⊂Cy \in g(f(A_n)) = A_{s(n)} \subset C, contradicting y∉Cy \notin C.

For surjectivity, let b∈Bb \in B and put x=defg(b)x \defeq g(b). If x∉Cx \notin C then h(x)=bh(x) = b by the second clause. If x∈Cx \in C then x∈Anx \in A_n for some nn, and n≠0n \neq 0 because x∈g(B)x \in g(B); so n=s(k)n = s(k) by the theorem on predecessors, and x∈g(f(Ak))x \in g(f(A_k)) gives x=g(f(z))x = g(f(z)) for some z∈Akz \in A_k. Injectivity of gg gives b=f(z)b = f(z), and z∈Cz \in C, so b=h(z)b = h(z).

Hence hh is a bijection and A≈BA \approx B.

The proof gives the bijection in two pieces, one for the chained points and one for the rest, rather than as a single formula. What the applications use is only that it exists.

Example 7.34 (Informal).

Assuming you know the real numbers, write RR for them and consider the closed interval [0,1][0,1] and the open interval (0,1)(0,1). The inclusion of (0,1)(0,1) in [0,1][0,1] is an injection one way. In the other direction x↦x2+14x \mapsto \tfrac{x}{2} + \tfrac{1}{4} is injective and carries [0,1][0,1] into (0,1)(0,1), since 00 goes to 14\tfrac14 and 11 to 34\tfrac34. Schröder–Bernstein therefore supplies a bijection between the two intervals, although neither of the injections we wrote is surjective.

Problem 7.12.

Schröder–Bernstein is sometimes read as saying that injections f:A→Bf : A \to B and g:B→Ag : B \to A are each bijections. Exhibit sets AA and BB with injections both ways, neither of which is surjective.

Theorem 7.35 (Transitivity for strict comparison).

Let AA, BB and CC be sets.

  1. If #A<#B\#A < \#B and #B<#C\#B < \#C then #A<#C\#A < \#C.
  2. If #A<#B\#A < \#B and #B⩽#C\#B \leqslant \#C then #A<#C\#A < \#C.
  3. If #A⩽#B\#A \leqslant \#B and #B<#C\#B < \#C then #A<#C\#A < \#C.

Discussion.

Each part asserts the existence of an injection and the non-existence of a bijection, so each splits in two, and the first half is the previous proposition in every case, since a strict comparison contains a weak one. The second half is where Schröder–Bernstein is needed, and it is used contrapositively: a bijection A→CA \to C would let us pull an injection B→CB \to C back to an injection B→AB \to A, and with the injection A→BA \to B already in hand the theorem would return A≈BA \approx B, which the strict hypothesis forbids. We write out the first part and leave the other two, which run the same way, to the problems.

Proof.

For the first part, the two hypotheses supply injections A→BA \to B and B→CB \to C, so #A⩽#C\#A \leqslant \#C by the previous proposition.

Suppose A≈CA \approx C and let φ:C→A\varphi : C \to A be a bijection. Composing φ\varphi with an injection B→CB \to C gives an injection B→AB \to A, so #B⩽#A\#B \leqslant \#A. Since #A<#B\#A < \#B gives #A⩽#B\#A \leqslant \#B, Schröder–Bernstein yields A≈BA \approx B, contradicting #A<#B\#A < \#B. So no bijection A→CA \to C exists and #A<#C\#A < \#C.

Comparability

Reflexive, transitive, antisymmetric: the comparison behaves like an order. What an order on the natural numbers also had was trichotomy, and for sizes that is a separate matter, since nothing so far rules out two sets neither of which injects into the other.

Theorem 7.36 (Comparability).

Let AA and BB be sets. Then #A⩽#B\#A \leqslant \#B or #B⩽#A\#B \leqslant \#A.

Discussion.

An injection defined on all of AA is what we want and cannot build directly, so we build the largest injection defined on part of AA and show that largest one leaves nothing out. The candidates are the injective functions whose domain is a subset of AA and whose values lie in BB; each is a subset of A×BA \times B, so comprehension collects them into a set, which inclusion orders.

To apply Zorn’s lemma we must show every chain has an upper bound, and we take the union of the chain: it is a function because two pairs with the same first coordinate lie in a common member of the chain, since members of a chain are comparable, and it is injective for the same reason with the coordinates exchanged. The empty chain is covered by the empty function. Zorn then supplies a maximal element pp, and maximality is used contrapositively: if pp missed a point of AA and also missed a point of BB, the pair of them could be added to pp, giving a strictly larger candidate. So one of the two is not missed, and the two cases give the two halves of the conclusion, the second by inverting pp.

Proof.

Let MM be the set of p∈P(A×B)p \in \mathcal{P}(A \times B) that are injective functions whose domain is a subset of AA, ordered by inclusion. The empty function belongs to MM, and inclusion is a partial order.

Let K⊂MK \subset M be a chain and put q=def⋃Kq \defeq \bigcup K, a subset of A×BA \times B. If (x,b)(x, b) and (x,b′)(x, b') lie in qq, they lie in members pp and p′p' of KK, which are comparable, so both pairs lie in the larger one; that member is a function, so b=b′b = b'. Hence qq is a function, with domain the union of the domains. The same argument with the coordinates exchanged shows qq is injective. So q∈Mq \in M and qq is an upper bound of KK, and MM is inductively ordered.

Zorn’s lemma gives a maximal p∈Mp \in M. Suppose dom⁡p≠A\operatorname{dom} p \neq A and im⁡p≠B\operatorname{im} p \neq B, and choose a∈A∖dom⁡pa \in A \setminus \operatorname{dom} p and b∈B∖im⁡pb \in B \setminus \operatorname{im} p. Then p∪{(a,b)}p \cup \{(a, b)\} is again an injective function with domain inside AA, and it properly contains pp, contradicting maximality.

So dom⁡p=A\operatorname{dom} p = A, in which case pp is an injection A→BA \to B; or im⁡p=B\operatorname{im} p = B, in which case the inverse of pp on its range is an injection B→AB \to A.

Corollary 7.37 (Trichotomy for sizes).

For any sets AA and BB, exactly one of #A<#B\#A < \#B, #A=#B\#A = \#B, #B<#A\#B < \#A holds.

Proof.

Comparability gives #A⩽#B\#A \leqslant \#B or #B⩽#A\#B \leqslant \#A. If both hold then A≈BA \approx B by Schröder–Bernstein; if only the first holds then #A<#B\#A < \#B, and if only the second then #B<#A\#B < \#A. So at least one of the three holds. No two hold together: A≈BA \approx B makes both strict comparisons fail by definition, and #A<#B\#A < \#B together with #B<#A\#B < \#A would give A≈BA \approx B by Schröder–Bernstein, contradicting either.

Remark.

Comparability was proved from Zorn’s lemma, and it is in fact equivalent to the axiom of choice, so it is not a free consequence of the other axioms. Schröder–Bernstein, by contrast, used nothing but the recursion theorem. So comparability needs the axiom of choice, while Schröder–Bernstein does not.

Cantor’s Theorem

Theorem 7.38 (Cantor's theorem).

For every set SS we have #S<#P(S)\#S < \#\mathcal{P}(S).

Discussion.

By the definition the claim splits in two: an injection S→P(S)S \to \mathcal{P}(S), and no bijection. The injection is the map sending a point to the set holding just that point, and it is injective because a singleton determines its element.

For the second half we take an arbitrary f:S→P(S)f : S \to \mathcal{P}(S) and produce a subset that is not one of its values, which denies surjectivity and so denies bijectivity. A set differs from f(x)f(x) as soon as it disagrees with it at one element, and the element we use is xx itself, so we build the subset that disagrees with f(x)f(x) at xx for every xx at once: take those xx that are outside their own value. Comprehension makes that a set and it is a subset of SS, so it is eligible to be a value. Supposing it is the value at aa, the question whether aa belongs to it has a membership criterion that turns each answer into the other, which is Russell’s argument again.

Proof.

The map x↦{x}x \mapsto \{x\} sends SS into P(S)\mathcal{P}(S), and {x}={y}\{x\} = \{y\} gives x=yx = y, so it is injective and #S⩽#P(S)\#S \leqslant \#\mathcal{P}(S).

Let f:S→P(S)f : S \to \mathcal{P}(S) be any function and put

D=def{x∈S∣x∉f(x)},D \defeq \{x \in S \mid x \notin f(x)\},

a set by comprehension and a subset of SS, so D∈P(S)D \in \mathcal{P}(S). Suppose D=f(a)D = f(a) for some a∈Sa \in S. If a∈Da \in D then the criterion gives a∉f(a)=Da \notin f(a) = D. If a∉Da \notin D then, aa being an element of SS, the criterion gives a∈f(a)=Da \in f(a) = D. Both are contradictions, so DD is not a value of ff and ff is not surjective.

In particular no bijection S→P(S)S \to \mathcal{P}(S) exists, so #S<#P(S)\#S < \#\mathcal{P}(S).

Remark.

The diagonal set is the construction that showed there is no set of all sets, used for a different purpose. There it produced a contradiction from an assumption we then dropped; here it produces one from the assumption that DD is a value, and what we drop is surjectivity. Nothing about SS was used, so the theorem applies to every set: iterating it gives

#S<#P(S)<#P(P(S))<⋯ ,\#S < \#\mathcal{P}(S) < \#\mathcal{P}(\mathcal{P}(S)) < \cdots,

a strictly increasing chain with no top, by transitivity for strict comparison.

Problem 7.13.

Show that if #A⩽#B\#A \leqslant \#B and A≈A′A \approx A' and B≈B′B \approx B', then #A′⩽#B′\#A' \leqslant \#B'. Transport the injection along the two bijections.

Problem 7.14.

Prove parts 2 and 3 of the theorem on transitivity for strict comparison.

Problem 7.15.

Use Schröder–Bernstein, rather than an explicit pairing, to show that #N0=#(N0×N0)\#\mathbb{N}_0 = \#(\mathbb{N}_0 \times \mathbb{N}_0) once you have an injection each way.

Problem 7.16.

Show that #A⩽#B\#A \leqslant \#B implies #P(A)⩽#P(B)\#\mathcal{P}(A) \leqslant \#\mathcal{P}(B).

Problem 7.17.

Deduce from Cantor’s theorem that n<2nn < 2^n for every n∈N0n \in \mathbb{N}_0.

Infinite Sets

A set is infinite when it is not finite, which is a purely negative description: no cut matches it. Cantor found that infinite sets come in different sizes, and Cantor’s theorem above already gives a strictly increasing chain of them. We start with the smallest.

Countable Sets

Definition 7.39 (Countable and uncountable).

A set AA is countably infinite if A≈N0A \approx \mathbb{N}_0, countable if it is finite or countably infinite, and uncountable otherwise.

A bijection f:N0→Af : \mathbb{N}_0 \to A is an infinite sequence in AA, so a countably infinite set is one whose elements can be written as a list

(a0,a1,a2,…)(a_0, a_1, a_2, \ldots)

in which every element appears exactly once. Such an ff is an enumeration of AA. The list is not part of the set, and a set usually admits many.

That the two cases of countability do not overlap is the corollary that N0\mathbb{N}_0 is infinite, since otherwise a finite set could be equinumerous with N0\mathbb{N}_0.

Proposition 7.40 (Dropping zero).

N≈N0\mathbb{N} \approx \mathbb{N}_0, so N\mathbb{N} is countably infinite.

Discussion.

We must produce a bijection, and we use the successor map, checking three things against the Peano conditions. Its values are positive, since a successor is never 00, so it does map into N\mathbb{N}. It is injective, which is the third condition verbatim. It is surjective onto N\mathbb{N}, which is the theorem on predecessors: every element other than 00 is a successor.

Proof.

Consider s:N0→Ns : \mathbb{N}_0 \to \mathbb{N}. Its values lie in N\mathbb{N}, since s(n)≠0s(n) \neq 0 by the fourth Peano condition. It is injective by the third. It is surjective, since an element of N\mathbb{N} is not 00 and is therefore s(n)s(n) for some nn by the theorem on predecessors. So ss is a bijection and N0≈N\mathbb{N}_0 \approx \mathbb{N}.

Remark.

Since N⊊N0\mathbb{N} \subsetneq \mathbb{N}_0, an infinite set can be equinumerous with a proper subset of itself, which the corollary of the last chapter shows no finite set can do. Dedekind turned the observation round and took it as the definition of infinite, and we prove below that his definition agrees with ours.

Subsets of the Natural Numbers

Theorem 7.41 (Infinite subsets of the natural numbers).

Every infinite subset M⊂N0M \subset \mathbb{N}_0 is countably infinite.

Discussion.

We must produce an enumeration of MM, and there is an obvious rule for one: list the smallest element first, then the smallest of those left, and so on. Two things must be checked before this is a definition. The rule at stage nn refers to everything listed before nn, not merely to the previous entry, so it is the general recursion theorem rather than the plain one that builds the function, taking for its rule the map sending a finite list to the least element of MM not on it. And that least element must exist: the elements listed so far form the image of a cut, hence a finite set, so they cannot exhaust the infinite MM, and well-ordering then supplies the minimum.

What remains is to check that the enumeration works. It is strictly increasing, because each entry is chosen from a smaller pool than the one before and differs from the entry just removed, and a strictly increasing map is injective by trichotomy. Surjectivity is a least-counterexample argument: if some m∈Mm \in M never appears, look at the first stage whose entry overshoots mm. Everything listed before that stage is below mm, so mm was still in the pool at that stage, and the minimum chosen there cannot have exceeded it.

Proof.

For a finite sequence tt in N0\mathbb{N}_0, the range im⁡t\operatorname{im} t is finite, being the image of a cut. So M∖im⁡tM \setminus \operatorname{im} t is non-empty: otherwise M⊂im⁡tM \subset \operatorname{im} t would make MM finite. Define

g:Seq⁡(N0)→N0,g(t)=defmin⁡(M∖im⁡t),g : \operatorname{Seq}(\mathbb{N}_0) \to \mathbb{N}_0, \qquad g(t) \defeq \min\bigl(M \setminus \operatorname{im} t\bigr),

which exists by well-ordering. The general recursion theorem gives exactly one f:N0→N0f : \mathbb{N}_0 \to \mathbb{N}_0 with f(n)=g(f∣Ln)f(n) = g(f|_{L_n}) for every nn, that is,

f(n)=min⁡(M∖{f(i)∣i<n}).f(n) = \min\bigl(M \setminus \{f(i) \mid i < n\}\bigr).

Every value of ff lies in MM. The map is strictly increasing: the set from which f(s(n))f(s(n)) is chosen is contained in the set from which f(n)f(n) is chosen, so f(n)⩽f(s(n))f(n) \leqslant f(s(n)) by minimality, and f(s(n))≠f(n)f(s(n)) \neq f(n) because f(n)f(n) was removed at the later stage. Induction then gives f(m)<f(n)f(m) < f(n) whenever m<nm < n, and trichotomy makes ff injective.

Induction also gives n⩽f(n)n \leqslant f(n): this holds at 00, and if n⩽f(n)n \leqslant f(n) then n<f(s(n))n < f(s(n)), so f(s(n))<s(n)f(s(n)) < s(n) would place f(s(n))f(s(n)) strictly between nn and s(n)s(n), which nothing does; hence s(n)⩽f(s(n))s(n) \leqslant f(s(n)).

Suppose some m∈Mm \in M is not a value of ff. Since m<s(m)⩽f(s(m))m < s(m) \leqslant f(s(m)), the set of nn with m<f(n)m < f(n) is non-empty, so well-ordering gives a least such kk. Every i<ki < k has f(i)⩽mf(i) \leqslant m and f(i)≠mf(i) \neq m, so f(i)<mf(i) < m; hence mm belongs to M∖{f(i)∣i<k}M \setminus \{f(i) \mid i < k\}, and minimality of f(k)f(k) in that set gives f(k)⩽mf(k) \leqslant m, contradicting m<f(k)m < f(k).

So ff is a bijection from N0\mathbb{N}_0 onto MM.

Characterising At Most Countable Sets

Theorem 7.42 (Characterising countable sets).

Let MM be a non-empty set. The following are equivalent.

  1. MM is countable.
  2. There is an injection M→N0M \to \mathbb{N}_0.
  3. There is a surjection N0→M\mathbb{N}_0 \to M.

Discussion.

We prove the three conditions equivalent by a cycle of implications.

From the first to the third: a countably infinite MM has a bijection from N0\mathbb{N}_0, which is a surjection; a finite non-empty MM has a bijection from a cut, which we extend to all of N0\mathbb{N}_0 by parking every later index on one fixed point, and parking spoils nothing because surjectivity asks only that every point be hit.

From the third to the second: a surjection has an injective right inverse, and here we can name one without appealing to choice. Each point of MM has a non-empty set of preimages inside N0\mathbb{N}_0, so well-ordering picks out its least preimage, and a right inverse is injective because applying the surjection recovers the point.

From the second to the first: an injection makes MM equinumerous with its image, a subset of N0\mathbb{N}_0, and a subset of N0\mathbb{N}_0 is finite or infinite; in the first case MM is finite, and in the second the theorem just proved makes it countably infinite.

Proof.

Suppose MM is countable. If M≈N0M \approx \mathbb{N}_0, a bijection is a surjection. If MM is finite and non-empty, let f:Ln→Mf : L_n \to M be a bijection with n≠0n \neq 0, and define β:N0→M\beta : \mathbb{N}_0 \to M by β(k)=deff(k)\beta(k) \defeq f(k) for k<nk < n and β(k)=deff(0)\beta(k) \defeq f(0) for k⩾nk \geqslant n. Every point of MM is f(k)f(k) for some k<nk < n, so β\beta is surjective.

Suppose β:N0→M\beta : \mathbb{N}_0 \to M is surjective. For x∈Mx \in M the preimage β−1({x})\beta^{-1}(\{x\}) is a non-empty subset of N0\mathbb{N}_0, so it has a least element; let α(x)\alpha(x) be that element. Then β(α(x))=x\beta(\alpha(x)) = x for every xx, so α(x)=α(y)\alpha(x) = \alpha(y) gives x=yx = y, and α:M→N0\alpha : M \to \mathbb{N}_0 is injective.

Suppose α:M→N0\alpha : M \to \mathbb{N}_0 is injective. Then M≈α(M)⊂N0M \approx \alpha(M) \subset \mathbb{N}_0. If α(M)\alpha(M) is finite then so is MM. If α(M)\alpha(M) is infinite then α(M)≈N0\alpha(M) \approx \mathbb{N}_0 by the theorem on infinite subsets, so M≈N0M \approx \mathbb{N}_0 by transitivity. Either way MM is countable.

Corollary 7.43 (Subsets of countable sets).

Every subset of a countable set is countable.

Proof.

Let B⊂AB \subset A with AA countable. If BB is empty it is finite. Otherwise AA is non-empty, so there is an injection A→N0A \to \mathbb{N}_0 by the theorem, and its restriction to BB is injective, so BB is countable by the theorem again.

Products and Unions

Theorem 7.44 (Pairs of natural numbers).

N0×N0\mathbb{N}_0 \times \mathbb{N}_0 is countably infinite.

Discussion.

By the characterisation it is enough to find one injection into N0\mathbb{N}_0, and then to observe that the set is not finite. For the injection we enumerate the pairs in diagonals: all pairs with m+n=0m + n = 0, then those with m+n=1m + n = 1, and so on. The kkth diagonal has s(k)s(k) entries, so a pair (m,n)(m, n) on the diagonal k=m+nk = m + n should be given the position

j(m,n)=defT(k)+m,T(k)=def∑i=1ki,j(m, n) \defeq T(k) + m, \qquad T(k) \defeq \sum_{i=1}^{k} i,

where the summation symbol is the one built by recursion in the last chapter but one. Injectivity then rests on the diagonals not overlapping, which is the inequality T(k)+m<T(k′)T(k) + m < T(k') whenever k<k′k < k' and m⩽km \leqslant k; it follows from the recursion clause T(s(k))=T(k)+s(k)T(s(k)) = T(k) + s(k). Once the diagonal is known, mm and then nn are determined by uniqueness of differences. Infinitude is easy: the pairs (n,0)(n, 0) form a copy of N0\mathbb{N}_0 inside, and a set with an infinite subset is infinite.

Proof.

Write T(k)=def∑i=1kiT(k) \defeq \sum_{i=1}^{k} i, so that T(0)=0T(0) = 0 and T(s(k))=T(k)+s(k)T(s(k)) = T(k) + s(k).

We first record that TT is non-decreasing: if k⩽lk \leqslant l then l=k+bl = k + b, and induction on bb gives the claim, since T(k+s(b))=T(s(k+b))=T(k+b)+s(k+b)T(k + s(b)) = T(s(k+b)) = T(k+b) + s(k+b) is at least T(k+b)T(k + b), which is at least T(k)T(k) by the inductive hypothesis.

Define j(m,n)=defT(m+n)+mj(m, n) \defeq T(m + n) + m. Laid out with mm down the side and nn across, the values run

0123⋯00136⋯124725839⋮⋮⋱\begin{array}{c|ccccc} & 0 & 1 & 2 & 3 & \cdots \\ \hline 0 & 0 & 1 & 3 & \boxed{6} & \cdots \\ 1 & 2 & 4 & \boxed{7} & & \\ 2 & 5 & \boxed{8} & & & \\ 3 & \boxed{9} & & & & \\ \vdots & \vdots & & & & \ddots \end{array}

The boxed entries are the pairs with m+n=3m + n = 3, and they fill the consecutive block from T(3)=6T(3) = 6 to T(3)+3=9T(3) + 3 = 9. What follows is that observation for a general diagonal.

Suppose j(m,n)=j(m′,n′)j(m, n) = j(m', n') and put k=defm+nk \defeq m + n, k′=defm′+n′k' \defeq m' + n'. If k<k′k < k' then k′=k+s(c)k' = k + s(c) for some cc, so

T(k′)=T(s(k+c))=T(k+c)+k′⩾T(k)+k′.T(k') = T(s(k + c)) = T(k + c) + k' \geqslant T(k) + k'.

Also m⩽k<k′m \leqslant k < k', so k′=m+bk' = m + b for a positive bb and T(k)+k′=(T(k)+m)+bT(k) + k' = (T(k) + m) + b, giving T(k)+m<T(k)+k′⩽T(k′)T(k) + m < T(k) + k' \leqslant T(k'); and T(k′)⩽T(k′)+m′T(k') \leqslant T(k') + m'. Together these give j(m,n)<j(m′,n′)j(m, n) < j(m', n'), against the supposition. The same argument rules out k′<kk' < k, so k=k′k = k' by trichotomy. Then T(k)+m=T(k)+m′T(k) + m = T(k) + m' gives m=m′m = m' by uniqueness of differences, and m+n=m+n′m + n = m + n' gives n=n′n = n' likewise. So jj is injective and N0×N0\mathbb{N}_0 \times \mathbb{N}_0 is countable.

Finally n↦(n,0)n \mapsto (n, 0) is injective, so N0×N0\mathbb{N}_0 \times \mathbb{N}_0 has an infinite subset and is therefore infinite.

Corollary 7.45 (Products of countable sets).

If AA and BB are countable then so is A×BA \times B.

Proof.

If either set is empty the product is empty. Otherwise let u:A→N0u : A \to \mathbb{N}_0 and v:B→N0v : B \to \mathbb{N}_0 be injections. Then (x,y)↦(u(x),v(y))(x, y) \mapsto (u(x), v(y)) is injective, by equality of ordered pairs, and composing it with the injection jj of the theorem gives an injection A×B→N0A \times B \to \mathbb{N}_0.

Theorem 7.46 (Countable unions of countable sets).

Let II be countable and let {Ai}i∈I\{A_i\}_{i \in I} be an indexed family of countable sets. Then ⋃i∈IAi\bigcup_{i \in I} A_i is countable.

Discussion.

The characterisation lets us argue with surjections rather than injections, and a surjection onto the union is easy to describe: run over the indices with one surjection and over each set with another, so that the pair (m,n)(m, n) names the nnth element of the mmth set. Two points need care. Countability of AiA_i says only that a surjection onto it exists, and we need one for every ii at once, and this needs the axiom of choice. And the domain of the resulting map is N0×N0\mathbb{N}_0 \times \mathbb{N}_0 rather than N0\mathbb{N}_0, which the previous theorem fixes, since a countably infinite set admits a bijection from N0\mathbb{N}_0. Composing the two gives a surjection from N0\mathbb{N}_0 onto the union, which is then countable by the characterisation.

Proof.

Discard the indices with Ai=∅A_i = \emptyset; the union is unchanged and the smaller index set is still countable. If nothing is left the union is empty, hence countable, so suppose I≠∅I \neq \emptyset and every Ai≠∅A_i \neq \emptyset.

By the characterisation there is a surjection γ:N0→I\gamma : \mathbb{N}_0 \to I. For each ii the set SiS_i of surjections N0→Ai\mathbb{N}_0 \to A_i is a non-empty subset of P(N0×Ai)\mathcal{P}(\mathbb{N}_0 \times A_i), again by the characterisation, so the axiom of choice applied to {Si}i∈I\{S_i\}_{i \in I} gives a function i↦βii \mapsto \beta_i with βi∈Si\beta_i \in S_i for every ii.

The map (m,n)↦βγ(m)(n)(m, n) \mapsto \beta_{\gamma(m)}(n) is a surjection from N0×N0\mathbb{N}_0 \times \mathbb{N}_0 onto ⋃i∈IAi\bigcup_{i \in I} A_i: a point xx of the union lies in some AiA_i, and i=γ(m)i = \gamma(m) for some mm while x=βi(n)x = \beta_i(n) for some nn. Composing with a bijection N0→N0×N0\mathbb{N}_0 \to \mathbb{N}_0 \times \mathbb{N}_0, which the previous theorem supplies, gives a surjection from N0\mathbb{N}_0 onto the union, which is therefore countable.

Remark (Hilbert's hotel).

A hotel with a room for every natural number, all of them occupied, can still take in a new guest: move the occupant of room nn to room s(n)s(n) and give the newcomer room 00. It can take in countably many new guests at once: move the occupant of room nn to room 2⋅n2 \cdot n and use the odd rooms, which the remainder classes say are exactly the rooms left free. It can even take in countably many coaches each carrying countably many guests, by the theorem on countable unions. Infinite sizes do not behave like finite ones, and here we have to rely on the propositions above rather than on intuition.

Remark (Informal).

Assuming you know the whole numbers and the fractions: the whole numbers are the union of the natural numbers, their negatives and zero, so the theorem on countable unions makes them countable. Every fraction is determined by a pair of whole numbers, so the corollary on products makes the fractions countable as well. Both arguments go through as soon as those systems are built.

Problem 7.18.

Let A1,…,AnA_1, \ldots, A_n be countable. Show that A1×⋯×AnA_1 \times \cdots \times A_n is countable, by induction on nn.

Problem 7.19.

Let AA be countable. Show that the set Seq⁡(A)\operatorname{Seq}(A) of finite sequences in AA is countable, and that the set of finite subsets of AA is countable.

Problem 7.20.

Show that the map jj of the theorem on pairs is a bijection onto N0\mathbb{N}_0, not merely an injection. Well-ordering applied to the set of kk with x<T(s(k))x < T(s(k)) will locate the diagonal on which xx sits.

Problem 7.21.

Let AA be countably infinite and let BB be finite and non-empty. Show that A∪BA \cup B and A×BA \times B are countably infinite.

Problem 7.22.

Write N0×N0\mathbb{N}_0 \times \mathbb{N}_0 as the union of a countably infinite family of pairwise disjoint countably infinite sets.

Finite and Infinite

One question is still open. We defined infinite negatively, as the failure of finiteness, and observed that N0\mathbb{N}_0 has a proper subset of its own size. Whether every infinite set does is still open, and the answer needs the axiom of choice.

Theorem 7.47 (Every infinite set has a countably infinite subset).

Let AA be infinite. Then some subset E⊂AE \subset A is countably infinite.

Discussion.

The plan copies the enumeration of an infinite subset of N0\mathbb{N}_0: pick an element, then an element not yet picked, and so on. Two things we had there are missing here. There is no order on AA, so nothing selects an element for us, and the axiom of choice gives a rule that selects one from every non-empty subset at once. And the rule at each stage refers to all the earlier picks, so it is the general recursion theorem that turns the rule into a function. The recursion never stalls, because the elements picked so far form a finite set and AA is infinite, so something is always left. Injectivity is immediate from the construction, since each value is chosen outside the earlier ones, and an injective map from N0\mathbb{N}_0 has range a countably infinite subset.

Proof.

Since AA is infinite it is non-empty. Apply the axiom of choice to the family of non-empty subsets of AA, indexed by itself, to obtain a function cc with c(X)∈Xc(X) \in X for every non-empty X⊂AX \subset A.

For a finite sequence tt in AA the range im⁡t\operatorname{im} t is finite, so A∖im⁡tA \setminus \operatorname{im} t is non-empty, since otherwise AA would be a subset of a finite set. Define

g:Seq⁡(A)→A,g(t)=defc(A∖im⁡t),g : \operatorname{Seq}(A) \to A, \qquad g(t) \defeq c\bigl(A \setminus \operatorname{im} t\bigr),

and let f:N0→Af : \mathbb{N}_0 \to A be the map the general recursion theorem produces, so that

f(n)=c(A∖{f(i)∣i<n})f(n) = c\bigl(A \setminus \{f(i) \mid i < n\}\bigr)

for every nn. If m<nm < n then f(m)f(m) is one of the elements excluded at stage nn, so f(n)≠f(m)f(n) \neq f(m); with trichotomy this makes ff injective. Hence E=defim⁡fE \defeq \operatorname{im} f satisfies N0≈E\mathbb{N}_0 \approx E and E⊂AE \subset A.

Theorem 7.48 (Characterising finite sets).

Let MM be a non-empty set. The following are equivalent.

  1. MM is finite.
  2. There is a surjection Ln→ML_n \to M for some n∈Nn \in \mathbb{N}.
  3. There is an injection M→LnM \to L_n for some n∈Nn \in \mathbb{N}.
  4. There is no injection N0→M\mathbb{N}_0 \to M.

When they hold, #M\#M is the least nn of the second kind and equally the least nn of the third.

Discussion.

We run a cycle again. From the first to the second, a counting of MM is itself a surjection from a cut. From the second to the third, a surjection has an injective right inverse, obtained as before by sending each point to its least preimage, which well-ordering supplies inside the cut. From the third to the fourth, an injection N0→M\mathbb{N}_0 \to M followed by an injection M→LnM \to L_n would inject N0\mathbb{N}_0 into LnL_n, and restricting to Ls(n)L_{s(n)} would inject a cut into a shorter one. The last step is the theorem just proved, read contrapositively: an infinite MM carries a copy of N0\mathbb{N}_0, hence an injection N0→M\mathbb{N}_0 \to M.

The minimality clause is the two size theorems. A surjection Ln→ML_n \to M gives #M⩽n\#M \leqslant n by the proposition on images, an injection M→LnM \to L_n gives #M⩽n\#M \leqslant n by the theorem on injections and size, and n=#Mn = \#M is achieved in both cases by a counting of MM and its inverse.

Proof.

Suppose MM is finite. Being non-empty, #M=n\#M = n for some n∈Nn \in \mathbb{N}, and a bijection Ln→ML_n \to M is a surjection.

Suppose σ:Ln→M\sigma : L_n \to M is surjective. For x∈Mx \in M the preimage σ−1({x})\sigma^{-1}(\{x\}) is a non-empty subset of N0\mathbb{N}_0, so it has a least element; sending xx to it defines ι:M→Ln\iota : M \to L_n with σ∘ι=idM\sigma \circ \iota = \mathrm{id}_M, and ι\iota is injective.

Suppose ι:M→Ln\iota : M \to L_n is injective and let γ:N0→M\gamma : \mathbb{N}_0 \to M be injective. Then ι∘γ:N0→Ln\iota \circ \gamma : \mathbb{N}_0 \to L_n is injective, and its restriction to Ls(n)L_{s(n)} is an injection Ls(n)→LnL_{s(n)} \to L_n, which no cut admits. So no such γ\gamma exists.

Suppose finally that MM is not finite. The previous theorem gives a subset E⊂ME \subset M equinumerous with N0\mathbb{N}_0, hence a bijection N0→E\mathbb{N}_0 \to E, which composed with the inclusion of EE in MM is an injection N0→M\mathbb{N}_0 \to M. That is the fourth condition denied, which completes the cycle.

For the last claim, a surjection Ln→ML_n \to M gives #M=#σ(Ln)⩽#Ln=n\#M = \#\sigma(L_n) \leqslant \#L_n = n, and an injection M→LnM \to L_n gives #M⩽n\#M \leqslant n; both bounds are attained by a counting of MM, which is a surjection L#M→ML_{\#M} \to M, and by its inverse.

Theorem 7.49 (Dedekind's characterisation of finiteness).

A set is finite if and only if it is not equinumerous with any proper subset of itself.

Discussion.

One direction is much easier than the other. One of them is the corollary of the first chapter, which said that a finite set is strictly larger than each of its proper subsets, so no bijection is available.

The other is best proved contrapositively: given an infinite AA, we produce a proper subset equinumerous with it. The theorem above puts a copy of N0\mathbb{N}_0 inside AA, and inside it we can shift along successors, as in N0\mathbb{N}_0. So we shift inside the copy and do nothing outside it: the points of AA off the copy are left where they are, and the nnth point of the copy is sent to the s(n)s(n)th. The result misses the initial point of the copy and nothing else, which is the proper subset we wanted.

Proof.

If AA is finite and B⊊AB \subsetneq A then A≉BA \not\approx B, by the corollary on proper subsets.

Suppose AA is infinite. The theorem on countably infinite subsets gives an injection f:N0→Af : \mathbb{N}_0 \to A; write E=defim⁡fE \defeq \operatorname{im} f and define

h:A→A∖{f(0)},h(x)=def{f(s(n))if x=f(n),xif x∉E.h : A \to A \setminus \{f(0)\}, \qquad h(x) \defeq \begin{cases} f(s(n)) & \text{if } x = f(n), \\ x & \text{if } x \notin E. \end{cases}

Each x∈Ex \in E is f(n)f(n) for exactly one nn, since ff is injective, so hh is a function; and its values avoid f(0)f(0), since f(s(n))≠f(0)f(s(n)) \neq f(0) by injectivity and x∉Ex \notin E gives x≠f(0)x \neq f(0).

For injectivity, two points of EE are separated because ff and ss are injective, two points outside EE are unchanged, and a point of EE cannot collide with one outside EE because its value lies in EE. For surjectivity, a point x∈A∖{f(0)}x \in A \setminus \{f(0)\} outside EE is h(x)h(x); and a point f(m)f(m) with m≠0m \neq 0 is f(s(k))f(s(k)) for the predecessor kk of mm, hence h(f(k))h(f(k)).

So A≈A∖{f(0)}A \approx A \setminus \{f(0)\}, a proper subset of AA.

Corollary 7.50 (Finiteness by self-maps).

A set MM is finite if and only if every injection M→MM \to M is surjective, and if and only if every surjection M→MM \to M is injective.

Proof.

If MM is finite, the theorem on finite self-maps gives both conditions. If MM is infinite, the map hh built in the last proof is an injection M→MM \to M whose range omits f(0)f(0), so it is injective and not surjective; and its inverse on that range, extended by sending f(0)f(0) to itself, is a surjection M→MM \to M that is not injective.

Remark.

Only the second direction of the theorem used the axiom of choice, and used it twice, once to select elements and once through the recursion that strung the selections together. Dedekind took the property in the theorem as his definition of infinite, and without choice his definition and ours are not known to agree: there is no contradiction in a set that is infinite in our sense and yet admits no bijection with a proper subset. We accept choice, so for us the two notions are one.

Problem 7.23.

Show that a set AA is infinite if and only if for every n∈N0n \in \mathbb{N}_0 there is an injection Ln→AL_n \to A.

Problem 7.24.

Let AA be infinite and BB countable. Show that A∪B≈AA \cup B \approx A.

Uncountable Sets

Every infinite set met so far has turned out to be countable, and the closure properties above keep it that way: subsets, products and countable unions of countable sets are all countable. Cantor’s theorem already gives sets that are not, and the same diagonal argument gives an explicit one.

Theorem 7.51 (Cantor's diagonal argument).

Let AA be a set with at least two elements. Then the Cartesian power AN0A^{\mathbb{N}_0}, the set of infinite sequences in AA, is uncountable.

Discussion.

Uncountable means neither finite nor countably infinite, and the characterisation of countable sets turns that into one statement: no surjection N0→AN0\mathbb{N}_0 \to A^{\mathbb{N}_0} exists. So we assume a surjection, write a(j)a^{(j)} for the sequence it puts at jj, and build a sequence it has missed.

The sequences are laid out as an infinite array whose jjth row is a(j)a^{(j)}, and a sequence differs from the jjth row as soon as it differs from it in one place. The place we can always name is the jjth, on the diagonal of the array, so we build α\alpha by walking down the diagonal and disagreeing at every step. Disagreement is possible because AA has a second element, and we fix two elements of AA once and for all rather than choosing at each step, so the axiom of choice is not needed. Then α\alpha differs from every row, so it is not a value of the surjection.

Proof.

Fix p,q∈Ap, q \in A with p≠qp \neq q, and suppose β:N0→AN0\beta : \mathbb{N}_0 \to A^{\mathbb{N}_0} is a surjection. Write a(j)=defβ(j)a^{(j)} \defeq \beta(j) and ai(j)=defa(j)(i)a^{(j)}_i \defeq a^{(j)}(i), so the values are laid out as

012⋯a(0)a0(0)a1(0)a2(0)⋯a(1)a0(1)a1(1)a2(1)⋯a(2)a0(2)a1(2)a2(2)⋯⋮⋮⋮⋮⋱\begin{array}{c|cccc} & 0 & 1 & 2 & \cdots \\ \hline a^{(0)} & \boxed{a^{(0)}_0} & a^{(0)}_1 & a^{(0)}_2 & \cdots \\ a^{(1)} & a^{(1)}_0 & \boxed{a^{(1)}_1} & a^{(1)}_2 & \cdots \\ a^{(2)} & a^{(2)}_0 & a^{(2)}_1 & \boxed{a^{(2)}_2} & \cdots \\ \vdots & \vdots & \vdots & \vdots & \ddots \end{array}

Define α:N0→A\alpha : \mathbb{N}_0 \to A by α(j)=defp\alpha(j) \defeq p if aj(j)≠pa^{(j)}_j \neq p, and α(j)=defq\alpha(j) \defeq q otherwise. Then α(j)≠aj(j)\alpha(j) \neq a^{(j)}_j for every jj, since in the second case aj(j)=p≠qa^{(j)}_j = p \neq q.

Now α∈AN0\alpha \in A^{\mathbb{N}_0}, so surjectivity gives α=a(j)\alpha = a^{(j)} for some jj, and reading both sides at jj gives α(j)=aj(j)\alpha(j) = a^{(j)}_j, which is false. So no surjection exists, and AN0A^{\mathbb{N}_0} is neither finite nor countably infinite by the characterisation of countable sets.

The same diagonal argument works for an arbitrary index set.

Theorem 7.52 (A set is smaller than its sequences).

Let MM be non-empty and let AA have at least two elements. Then #M<#(AM)\#M < \#(A^M).

Discussion.

The claim splits into an injection M→AMM \to A^M and the absence of a bijection. For the injection we must attach to each point of MM a function on MM, and we use the point itself: send mm to the function that takes one fixed value at mm and the other everywhere else. Two distinct points give functions that disagree at either of them, so the assignment is injective.

For the second half the diagonal argument runs verbatim, with MM in place of N0\mathbb{N}_0: given f:M→AMf : M \to A^M, the function that disagrees with f(m)f(m) at mm, for every mm, cannot be a value of ff. Nothing in that used the order or the countability of the index set, so only the two fixed elements of AA are needed.

Proof.

Fix p,q∈Ap, q \in A with p≠qp \neq q. For m∈Mm \in M let χm:M→A\chi_m : M \to A take the value pp at mm and qq elsewhere. If m1≠m2m_1 \neq m_2 then χm1(m1)=p\chi_{m_1}(m_1) = p while χm2(m1)=q\chi_{m_2}(m_1) = q, so χm1≠χm2\chi_{m_1} \neq \chi_{m_2}; hence m↦χmm \mapsto \chi_m is an injection M→AMM \to A^M and #M⩽#(AM)\#M \leqslant \#(A^M).

Let f:M→AMf : M \to A^M be any function and define φ:M→A\varphi : M \to A by φ(m)=defp\varphi(m) \defeq p if f(m)(m)≠pf(m)(m) \neq p, and φ(m)=defq\varphi(m) \defeq q otherwise, so that φ(m)≠f(m)(m)\varphi(m) \neq f(m)(m) for every mm. If φ=f(m)\varphi = f(m) for some mm, reading both sides at mm gives φ(m)=f(m)(m)\varphi(m) = f(m)(m), which is false. So φ\varphi is not a value of ff, no ff is surjective, and no bijection exists.

Corollary 7.53 (Power sets as sequences).

For every set MM we have P(M)≈L2 M\mathcal{P}(M) \approx L_2^{\,M}.

Proof.

Send S⊂MS \subset M to its characteristic function χS:M→L2\chi_S : M \to L_2, taking the value 11 on SS and 00 off it. Distinct subsets differ at some point, where their characteristic functions differ, so the map is injective; and any φ:M→L2\varphi : M \to L_2 is the characteristic function of {x∈M∣φ(x)=1}\{x \in M \mid \varphi(x) = 1\}, so it is surjective.

So Cantor’s theorem is the previous theorem read at A=L2A = L_2, and the diagonal argument that rules out surjections onto L2 ML_2^{\,M} is the one that rules out surjections onto P(M)\mathcal{P}(M).

Corollary 7.54 (An uncountable set).

P(N0)\mathcal{P}(\mathbb{N}_0) is uncountable, and so is L2 N0L_2^{\,\mathbb{N}_0}.

Proof.

L2L_2 has two elements, so L2 N0L_2^{\,\mathbb{N}_0} is uncountable by the diagonal argument, and P(N0)\mathcal{P}(\mathbb{N}_0) is equinumerous with it by the corollary above; a set equinumerous with an uncountable set is uncountable, since countability is defined by the existence of a bijection.

Remark (Informal).

Assuming you know the real numbers, the same argument shows there are uncountably many. List candidate decimal expansions of the numbers between 00 and 11 and build a new expansion differing from the jjth in its jjth digit, avoiding the digit 99 so as not to fall foul of the two expansions some numbers have; the number it names is missing from the list. Since the fractions are countable, the numbers that are not fractions must be uncountable, for otherwise the reals would be a union of two countable sets.

The same counting argument shows something less expected. The polynomials with fractional coefficients are countable, being determined by finite lists of fractions, and each has finitely many roots, so the numbers that are roots of such a polynomial form a countable set. Uncountably many real numbers are therefore roots of no such polynomial at all, although exhibiting even one takes real work.

Problem 7.25.

Let AA be uncountable and let B⊂AB \subset A be countable. Show that A∖BA \setminus B is uncountable.

Problem 7.26.

Deduce from Cantor’s theorem that there is no surjection M→P(M)M \to \mathcal{P}(M), for any set MM.

Cardinal Numbers

We have been writing #A⩽#B\#A \leqslant \#B for arbitrary sets without saying what #A\#A names when AA is infinite, and so far we have not needed to: the three relations were defined as statements about functions, and the symbol never occurred alone. It can be given a meaning, using the equivalence classes from the remark of the first section.

Definition 7.55 (Cardinal number).

Fix a set XX. The cardinal number of a subset A⊂XA \subset X is its equivalence class #A∈P(X)/≈\#A \in \mathcal{P}(X)/{\approx} under equinumerosity. Two subsets of XX have the same cardinal number exactly when they are equinumerous.

Remark.

The restriction to a fixed XX is needed, since the sets equinumerous with a given one do not form a set. For finite AA nothing is lost by reading #A\#A as the natural number counting it, because the cardinal numbers of finite subsets of XX correspond to the cuts, one class for each nn with Ln⊂XL_n \subset X. A definition free of the ambient XX needs the ordinal numbers, which we have not built.

The order has the properties the notation suggests. Reflexivity and transitivity were proved directly, Schröder–Bernstein gives antisymmetry, since two subsets each injecting into the other are equinumerous and so name one class, and comparability makes any two classes comparable. So on P(X)/≈\mathcal{P}(X)/{\approx} the relation ⩽\leqslant is a total order, with the strict comparison as its strict part.

Definition 7.56 (Arithmetic of cardinal numbers).

For sets AA and BB define

#A+#B=def#((A×{0})∪(B×{1})),#A⋅#B=def#(A×B),\#A + \#B \defeq \#\bigl((A \times \{0\}) \cup (B \times \{1\})\bigr), \qquad \#A \cdot \#B \defeq \#(A \times B),(#A)#B=def#(AB).(\#A)^{\#B} \defeq \#(A^B).

The tagged copies in the sum are there because AA and BB may share elements, and tagging makes disjoint copies of both without disturbing their sizes. That the three operations depend only on the classes and not on the sets chosen to represent them is the transport problem set above. On finite sets they agree with the arithmetic of the first chapter, by the theorems on disjoint unions and products and by the problem on ABA^B.

Since P(M)≈L2 M\mathcal{P}(M) \approx L_2^{\,M} and #L2=2\#L_2 = 2, the power set records an exponential:

2#M=#P(M),2^{\#M} = \#\mathcal{P}(M),

and Cantor’s theorem reads #M<2#M\#M < 2^{\#M}. Writing ℵ0=def#N0\aleph_0 \defeq \#\mathbb{N}_0 for the smallest infinite cardinal number, the chain

ℵ0<2ℵ0<22ℵ0<⋯\aleph_0 < 2^{\aleph_0} < 2^{2^{\aleph_0}} < \cdots

climbs for ever, so there is no largest size.

Remark (The continuum hypothesis).

Nothing proved here says whether anything sits between two consecutive terms of that chain. The continuum hypothesis asserts that nothing sits between the first two: there is no set MM with ℵ0<#M<2ℵ0\aleph_0 < \#M < 2^{\aleph_0}. Gödel showed in 1938 that it cannot be refuted from the axioms we have listed, choice included, and Cohen showed in 1963 that it cannot be proved from them either, so long as those axioms are consistent at all. It is independent, in the sense the axiom of choice was said to be independent, and one may add it or its negation without introducing a contradiction that was not already there.

Remark.

Cantor’s theorem also settles again a question from the naive chapter. Were there a set M\mathfrak{M} holding every set, then P(M)\mathcal{P}(\mathfrak{M}) would be one of its subsets, so

#P(M)⩽#M<#P(M),\#\mathcal{P}(\mathfrak{M}) \leqslant \#\mathfrak{M} < \#\mathcal{P}(\mathfrak{M}),

which trichotomy forbids. That is Cantor’s own argument, and it reaches the conclusion of the proposition on no set of all sets by counting rather than by self-membership.

Problem 7.27.

Show that cardinal addition and multiplication are commutative and associative, and that #A⋅(#B+#C)=#A⋅#B+#A⋅#C\#A \cdot (\#B + \#C) = \#A \cdot \#B + \#A \cdot \#C. Each identity is a bijection between the sets involved.

Problem 7.28.

Show that ℵ0+ℵ0=ℵ0\aleph_0 + \aleph_0 = \aleph_0 and ℵ0⋅ℵ0=ℵ0\aleph_0 \cdot \aleph_0 = \aleph_0, and explain which theorems of this chapter each one is.

Problem 7.29.

Show that A≈BA \approx B and C≈DC \approx D imply AC≈BDA^C \approx B^D.

Problem 7.30.

Show that (A×B)C≈AC×BC(A \times B)^C \approx A^C \times B^C for all sets AA, BB and CC.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 7.1.

Let A=def{1,2,3,4}A \defeq \{1, 2, 3, 4\} and B=def{3,4,5}B \defeq \{3, 4, 5\}.

#(A∪B)\#(A \cup B) is:

answer one of these

#(A∖B)\#(A \setminus B) is:

answer one of these

#(A×B)\#(A \times B) is:

answer one of these

#P(B)\#\mathcal{P}(B) is:

answer one of these

The sum #A+#B\#A + \#B equals:

answer one of these

Exercise 7.2.

Each part asks for a bijection between two subsets of N0\mathbb{N}_0.

A bijection from N0\mathbb{N}_0 onto {m∈N0∣m=5⋅k+2 for some k∈N0}\{m \in \mathbb{N}_0 \mid m = 5 \cdot k + 2 \text{ for some } k \in \mathbb{N}_0\} is:

answer one of these

Its inverse is:

answer one of these

A bijection from N0\mathbb{N}_0 onto the even elements of N0\mathbb{N}_0 is:

answer one of these

A bijection from N0\mathbb{N}_0 onto N0∖{0,1}\mathbb{N}_0 \setminus \{0, 1\} is:

answer one of these

Exercise 7.3.

There are seven days in a week.

Among any fifteen people, the largest number that must share a day of the week is:

answer one of these

Among any twenty-two people, that number is:

answer one of these

The least nn for which any nn people must include three born on the same day of the week is:

answer one of these

For a function from a set of m⋅n+1m \cdot n + 1 elements to a set of mm elements, some value is taken at least this many times:

answer one of these

Of the functions L4→L3L_4 \to L_3, the injective ones are:

answer one of these

Exercise 7.4.

A study of 115115 breakfast eaters finds that 8585 also eat lunch, 5858 floss regularly and 2727 take a morning paper. Among the lunch eaters, 5252 floss and 1515 take the paper, and 1010 do both. Four flossers neither eat lunch nor take the paper.

The number who floss and take the paper is:

answer one of these

The number who take the paper but neither floss nor eat lunch is:

answer one of these

The number who do none of the three is:

answer one of these

Exercise 7.5.

Classify each set as finite, countably infinite or uncountable.

P(L3)\mathcal{P}(L_3).

answer one of these

The multiples of 33 in N0\mathbb{N}_0.

answer one of these

N0×N0×N0\mathbb{N}_0 \times \mathbb{N}_0 \times \mathbb{N}_0.

answer one of these

L2 N0L_2^{\,\mathbb{N}_0}.

answer one of these

The finite subsets of N0\mathbb{N}_0.

answer one of these

The subsets of N0\mathbb{N}_0 that are infinite.

answer one of these

Exercise 7.6.

On the comparison of sizes.

Someone reads Schröder–Bernstein as saying that injections f:A→Bf : A \to B and g:B→Ag : B \to A are each bijections. Is that right?

answer one of these

Comparability of any two sets was proved from:

answer one of these

Schröder–Bernstein was proved from:

answer one of these

Suppose there is an injection A→BA \to B and no injection B→AB \to A. Then:

answer one of these

Exercise 7.7.

The pairing j(m,n)=T(m+n)+mj(m, n) = T(m + n) + m of the theorem on pairs of natural numbers, where T(k)=∑i=1kiT(k) = \sum_{i=1}^{k} i.

j(1,3)j(1, 3) is:

answer one of these

j(0,4)j(0, 4) is:

answer one of these

The pair sent to 1212 is:

answer one of these

The number of pairs (m,n)(m, n) with m+n=km + n = k is:

answer one of these

Exercise 7.8.

Finiteness by self-maps and by proper subsets.

A set MM is finite exactly when every injection M→MM \to M is:

answer one of these

The sets equinumerous with a proper subset of themselves are:

answer one of these

The successor s:N0→N0s : \mathbb{N}_0 \to \mathbb{N}_0 is injective and not surjective. That shows:

answer one of these

The theorem that every infinite set has a countably infinite subset rests on:

answer one of these

Exercise 7.9.

Cardinal numbers.

The cardinal 2ℵ02^{\aleph_0} names:

answer one of these

Is there a largest cardinal number?

answer one of these

The continuum hypothesis is:

answer one of these

Why is the cardinal number of AA defined only for subsets of a fixed set XX?

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

The last sheet gave the checker the order on the carrier and the sets separation carves out. This chapter counts, and counting needs two things the checker has not had: a map read between two sets rather than across the whole universe, and the natural numbers as objects of that universe, so that the cuts have something to hold.

Maps between two sets

A map has so far been an arrow f : Obj → Obj on everything at once, and Injective f and Surjective f asked their conditions everywhere. A map of this chapter has a domain and a codomain, so the same conditions are written on the sets they are asserted of, and each is the statement the definitions of a surjection and an injection make it:

MapsTo f A B   is   ∀ x, x ∈ A → f x ∈ B
InjOn f A      is   ∀ x y, x ∈ A → y ∈ A → f x = f y → x = y
SurjOn f A B   is   ∀ y, y ∈ B → ∃ x, x ∈ A ∧ f x = y
BijOn f A B    is   MapsTo f A B ∧ InjOn f A ∧ SurjOn f A B

Being those statements and not merely equivalent to them, they are opened with intro and used by applying them, in the way A ⊆ B has been since the sets sheet. A BijOn splits three ways at once, so obtain ⟨hm, hi, hs⟩ takes one apart and refine ⟨?_, ?_, ?_⟩ puts one together.

Example.

A map injective everywhere is injective on any set. The converse fails, which is why the two conditions are kept apart.

lean worked
1example (f : Obj → Obj) (A : Obj) (h : Injective f) : InjOn f A := by
verified
goalGoals accomplished.

Example.

The values of ff on AA lie in BB, which is where gg is known to do its work.

lean worked
1example (f g : Obj → Obj) (A B C : Obj) (hf : MapsTo f A B) (hg : MapsTo g B C) :2    MapsTo (g ∘ f) A C := by
verified
goalGoals accomplished.

Exercise 7.10.

A restriction of an injection is an injection.

lean proof
1example (f : Obj → Obj) (A B : Obj) (h : InjOn f A) (hb : B ⊆ A) : InjOn f B := by
goalf : Obj → Obj A B : Obj h : InjOn f A hb : B ⊆ A ⊢ InjOn f B

Exercise 7.11.

The codomain may be enlarged freely.

lean proof
1example (f : Obj → Obj) (A B C : Obj) (h : MapsTo f A B) (hbc : B ⊆ C) : MapsTo f A C := by
goalf : Obj → Obj A B C : Obj h : MapsTo f A B hbc : B ⊆ C ⊢ MapsTo f A C

Exercise 7.12.

The first part of the theorem that bijections compose, read on two sets.

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : MapsTo f A B) (hfi : InjOn f A)2    (hgi : InjOn g B) : InjOn (g ∘ f) A := by
goalf g : Obj → Obj A B : Obj hf : MapsTo f A B hfi : InjOn f A hgi : InjOn g B ⊢ InjOn (g ∘ f) A

Exercise 7.13.

Its second part.

lean proof
1example (f g : Obj → Obj) (A B C : Obj) (hfs : SurjOn f A B) (hgs : SurjOn g B C) :2    SurjOn (g ∘ f) A C := by
goalf g : Obj → Obj A B C : Obj hfs : SurjOn f A B hgs : SurjOn g B C ⊢ SurjOn (g ∘ f) A C

Exercise 7.14.

Only the first map need be injective for the composite to be.

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : MapsTo f A B) (h : InjOn (g ∘ f) A) :2    InjOn f A := by
goalf g : Obj → Obj A B : Obj hf : MapsTo f A B h : InjOn (g ∘ f) A ⊢ InjOn f A

Exercise 7.15.

The inverse of a bijection is a bijection. The checker cannot choose preimages, so the inverse arrives as a hypothesis rather than being built; what is left is the second part of Proposition 7.2 .

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : BijOn f A B) (hg : MapsTo g B A)2    (h : ∀ y : Obj, y ∈ B → f (g y) = y) : BijOn g B A := by
goalf g : Obj → Obj A B : Obj hf : BijOn f A B hg : MapsTo g B A h : ∀ (y : Obj), y ∈ B → f (g y) = y ⊢ BijOn g B A

Comparing sizes

Two sets are compared by the functions running between them, which is what Definition 7.1 and Definition 7.31 say, so the two comparisons are typed as the existence statements they are:

A ≈ B   is   ∃ f : Obj → Obj, BijOn f A B
A ≼ B   is   ∃ f : Obj → Obj, MapsTo f A B ∧ InjOn f A

typed \approx and \preceq. The second is #A⩽#B\#A \leqslant \#B; the strict comparison is not notation of its own, being the second together with the denial of the first. A witness is supplied by use or as the first component of refine ⟨_, ?_, ?_⟩, and it is written as a function, fun x => x for the identity.

Example.

The first part of Proposition 7.2 . Each of the three conditions is read at a point, and the identity satisfies all three without any work.

lean worked
1example (A : Obj) : A ≈ A := by
verified
goalGoals accomplished.

Exercise 7.16.

The empty function.

lean proof
1example (A : Obj) : ∅ ≼ A := by
goalA : Obj ⊢ ∅ ≼ A

Exercise 7.17.

A subset is no larger than the set it sits in.

lean proof
1example (A B : Obj) (h : A ⊆ B) : A ≼ B := by
goalA B : Obj h : A ⊆ B ⊢ A ≼ B

Exercise 7.18.

A bijection is in particular an injection.

lean proof
1example (A B : Obj) (h : A ≈ B) : A ≼ B := by
goalA B : Obj h : A ≈ B ⊢ A ≼ B

Exercise 7.19.

The second part of Proposition 7.32 .

lean proof
1example (A B C : Obj) (hab : A ≼ B) (hbc : B ≼ C) : A ≼ C := by
goalA B C : Obj hab : A ≼ B hbc : B ≼ C ⊢ A ≼ C

Exercise 7.20.

The third part of Proposition 7.2 .

lean proof
1example (A B C : Obj) (hab : A ≈ B) (hbc : B ≈ C) : A ≈ C := by
goalA B C : Obj hab : A ≈ B hbc : B ≈ C ⊢ A ≈ C

Exercise 7.21.

Problem 7.13 : a comparison transported along two bijections.

lean proof
1example (A A' B B' : Obj) (h1 : A' ≈ A) (h2 : A ≼ B) (h3 : B ≈ B') : A' ≼ B' := by
goalA A' B B' : Obj h1 : A' ≈ A h2 : A ≼ B h3 : B ≈ B' ⊢ A' ≼ B'

Exercise 7.22.

Proposition 7.8 .

lean proof
1example (f : Obj → Obj) (A B a : Obj) (hf : BijOn f A B) (ha : a ∈ A) :2    A \ {a} ≈ B \ {f a} := by
goalf : Obj → Obj A B a : Obj hf : BijOn f A B ha : a ∈ A ⊢ A \ {a} ≈ B \ {f a}

Exercise 7.23.

Problem 7.16 . The map sends a subset of AA to its image. (Harder.)

lean proof
1example (A B : Obj) (h : A ≼ B) : 𝒫 A ≼ 𝒫 B := by
goalA B : Obj h : A ≼ B ⊢ 𝒫 A ≼ 𝒫 B

Cantor’s theorem

Exercise 7.24.

The first half of Cantor’s theorem.

lean proof
1example (S : Obj) : S ≼ 𝒫 S := by
goalS : Obj ⊢ S ≼ 𝒫 S

Exercise 7.25.

And the second, which is Problem 7.26 . The diagonal set is {x ∈ S | x ∉ f x}, and it is a subset of SS before it is anything else.

lean proof
1example (f : Obj → Obj) (S : Obj) : ¬SurjOn f S (𝒫 S) := by
goalf : Obj → Obj S : Obj ⊢ ¬SurjOn f S (𝒫 S)

The natural numbers as objects

The carrier ℕ of the Peano sheet is a type of its own, and the cuts are sets, so the two have to be brought together before a cut can be written down. ↑n, typed \up, is the object the number n names; ω is the set of all of them, which is N0\mathbb{N}_0; and L n is the cut. Their criteria are the definitions:

x ∈ ω     is   ∃ k : ℕ, x = ↑k
x ∈ L n   is   ∃ k : ℕ, k < n ∧ x = ↑k

so a membership is built with use or ⟨_, _, _⟩ and taken apart with obtain ⟨k, hk, he⟩. That distinct numbers name distinct objects is Num.inj, and Finite A is ∃ n : ℕ, A ≈ L n, which is Definition 7.5 verbatim.

Example.

The witness is the number itself, and the equation it has to satisfy is an identity.

lean worked
1example (m n : ℕ) (h : m < n) : ↑m ∈ L n := by
verified
goalGoals accomplished.

Example.

A strict inequality is a positive difference, and no positive difference reaches 00. It is listed below as Nat.not_lt_zero, so the exercises may lean on it.

lean worked
1example (n : ℕ) : ¬(n < 0) := by
verified
goalGoals accomplished.

Exercise 7.26.

The first part of Proposition 7.4 .

lean proof
1example : L 0 = ∅ := by
goal⊢ L 0 = ∅

Exercise 7.27.

Its last part.

lean proof
1example (n : ℕ) : ↑n ∉ L n := by
goaln : ℕ ⊢ ¬↑n ∈ L n

Exercise 7.28.

Every cut sits inside N0\mathbb{N}_0.

lean proof
1example (n : ℕ) : L n ⊆ ω := by
goaln : ℕ ⊢ L n ⊆ ω

Exercise 7.29.

And the cuts grow with their index.

lean proof
1example (m n : ℕ) (h : m < n) : L m ⊆ L n := by
goalm n : ℕ h : m < n ⊢ L m ⊆ L n

Exercise 7.30.

The middle part of Proposition 7.4 , which every induction of this chapter turns on.

lean proof
1example (n : ℕ) : L (succ n) = L n ∪ {↑n} := by
goaln : ℕ ⊢ L (succ n) = L n ∪ {↑n}

Exercise 7.31.

A cut counts itself.

lean proof
1example (n : ℕ) : Finite (L n) := by
goaln : ℕ ⊢ Finite (L n)

Exercise 7.32.

And the empty set is counted by the cut that holds nothing.

lean proof
1example : Finite ∅ := by
goal⊢ Finite ∅

Exercise 7.33.

A set with one point in it. (Harder.)

lean proof
1example (a : Obj) : Finite {a} := by
goala : Obj ⊢ Finite {a}

Exercise 7.34.

A finite set injects into N0\mathbb{N}_0, which is the easy half of the characterisation of countability.

lean proof
1example (A : Obj) (h : Finite A) : A ≼ ω := by
goalA : Obj h : Finite A ⊢ A ≼ ω
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered
Nat.lt_irrefl ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet
Nat.lt_trans ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet
Nat.lt_succ_self ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet
Nat.not_lt_zero ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero
Nat.lt_succ_iff ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n
Num.inj ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 8

Permutations

Taught

Permutations

A bijection from a set to itself maps the set onto itself and may rearrange its elements. Counting was the first thing we did with finite sets, and the second is this: fix the set and ask in how many ways its points can be rearranged among themselves. The rearranging functions can be composed, and this chapter studies that composition.

Two-Row Notation

Definition 8.1 (Permutation).

Let AA be a set. A permutation of AA is a bijection σ:A→A\sigma : A \to A.

When AA is finite and non-empty a permutation is settled by naming the value it takes at each point, and there are only finitely many points to name. So the whole function fits in a table of two rows: the points along the top, their values underneath.

Definition 8.2 (Blocks and nn-sets).

For n∈N0n \in \mathbb{N}_0 write

⟨n⟩=def{x∈N∣x⩽n}={1,2,…,n},\langle n \rangle \defeq \{x \in \mathbb{N} \mid x \leqslant n\} = \{1, 2, \ldots, n\},

so that ⟨0⟩=∅\langle 0 \rangle = \emptyset. A finite set AA with cardinality #A=n\#A = n is an nn-set, and a subset of a set that is itself a kk-set is a kk-subset of it.

The block ⟨n⟩\langle n \rangle counts as the cut LnL_n does: i↦i+1i \mapsto i + 1 is a bijection from LnL_n onto ⟨n⟩\langle n \rangle, injective by uniqueness of differences and surjective because every positive number is a successor. So #⟨n⟩=n\#\langle n \rangle = n, and an nn-set is exactly a set equinumerous with ⟨n⟩\langle n \rangle. We take the block rather than the cut as the standing domain here only because it makes the tables below read as they do everywhere else, starting at one.

Definition 8.3 (Two-row notation).

Let AA be an nn-set with n∈Nn \in \mathbb{N}, let a1,…,ana_1, \ldots, a_n be a listing of its elements, and let σ\sigma be a permutation of AA. Write

σ=(a1a2⋯anσ(a1)σ(a2)⋯σ(an))\sigma = \begin{pmatrix} a_1 & a_2 & \cdots & a_n \\ \sigma(a_1) & \sigma(a_2) & \cdots & \sigma(a_n) \end{pmatrix}

for the permutation sending each aia_i to σ(ai)\sigma(a_i). The columns may be reordered at will: any listing of the domain along the top, with the matching values underneath, denotes the same function.

The last sentence is equality of functions and nothing more. A table names a function by naming its value at each point, and the order in which the points are named is no part of the function.

Example 8.4 (A permutation of four points).

On A={1,2,3,4}A = \{1, 2, 3, 4\} the rule σ(1)=4\sigma(1) = 4, σ(2)=1\sigma(2) = 1, σ(3)=3\sigma(3) = 3, σ(4)=2\sigma(4) = 2 is the permutation

σ=(12344132)=(31423421),\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 4 & 1 & 3 & 2 \end{pmatrix} = \begin{pmatrix} 3 & 1 & 4 & 2 \\ 3 & 4 & 2 & 1 \end{pmatrix},

the second table being the first with its columns shuffled. A two-row table fails to describe a permutation exactly when its bottom row is not a rearrangement of its top: a repeated value breaks injectivity, and a missing one breaks surjectivity.

Definition 8.5 (The symmetric group).

The set of all permutations of a set AA is written SAS_A and called the symmetric group on AA. When A=⟨n⟩A = \langle n \rangle one writes SnS_n rather than S⟨n⟩S_{\langle n \rangle}.

The word group is traditional and we use it as a name only. What stands behind it is that SAS_A carries a multiplication and is closed under composition and inverses: composition sends bijections to bijections, the identity map is a bijection since it is its own inverse, and the inverse of a bijection is a bijection. No abstract definition of a group is needed below; we use only the set SAS_A and its composition.

Working in SnS_n rather than in SAS_A for an arbitrary nn-set loses nothing. A listing of AA is a bijection h:⟨n⟩→Ah : \langle n \rangle \to A, and σ↦h−1∘σ∘h\sigma \mapsto h^{-1} \circ \sigma \circ h carries permutations of AA to permutations of ⟨n⟩\langle n \rangle, reversibly. That is what two-row notation already does silently when it writes the points in a row.

Definition 8.6 (Product of permutations).

Let σ,λ∈SA\sigma, \lambda \in S_A. The product σλ\sigma\lambda is the composite σ∘λ\sigma \circ \lambda, so that

(σλ)(x)=σ(λ(x))for every x∈A.(\sigma\lambda)(x) = \sigma\bigl(\lambda(x)\bigr) \qquad \text{for every } x \in A.

One applies λ\lambda first and σ\sigma second. The permutations σ\sigma and λ\lambda are the factors of the product.

Example 8.7 (Multiplying in S4S_4).

Take

σ=(12343142),λ=(12344132)\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 3 & 1 & 4 & 2 \end{pmatrix}, \qquad \lambda = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 4 & 1 & 3 & 2 \end{pmatrix}

in S4S_4. To compute σλ\sigma\lambda, follow each point through λ\lambda and then through σ\sigma:

1⟼λ4⟼σ2,2⟼λ1⟼σ3,3⟼λ3⟼σ4,4⟼λ2⟼σ1,\begin{aligned} 1 &\overset{\lambda}{\longmapsto} 4 \overset{\sigma}{\longmapsto} 2, \\ 2 &\overset{\lambda}{\longmapsto} 1 \overset{\sigma}{\longmapsto} 3, \\ 3 &\overset{\lambda}{\longmapsto} 3 \overset{\sigma}{\longmapsto} 4, \\ 4 &\overset{\lambda}{\longmapsto} 2 \overset{\sigma}{\longmapsto} 1, \end{aligned}

so that

σλ=(12342341),λσ=(12343421),\sigma\lambda = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 2 & 3 & 4 & 1 \end{pmatrix}, \qquad \lambda\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 3 & 4 & 2 & 1 \end{pmatrix},

the second computed the same way in the other order. So σλ≠λσ\sigma\lambda \neq \lambda\sigma: the multiplication is not commutative, though particular pairs may commute.

Remark (Authors who read left to right).

Some texts write the value of a function to the right of its argument, (x)σ(x)\sigma in place of σ(x)\sigma(x), and then read a product left to right. We keep the order fixed for composition, so σλ\sigma\lambda always means ”λ\lambda first, then σ\sigma”. When reading another source, work one product out by hand before trusting its convention.

The bottom row of a two-row table for an element of SnS_n is a rearrangement of 1,…,n1, \ldots, n, and conversely each rearrangement of 1,…,n1, \ldots, n is the bottom row of exactly one element of SnS_n, the one whose top row runs in ascending order. So SnS_n is matched point for point with the orderings of ⟨n⟩\langle n \rangle, which is why permutations are so often described as arrangements rather than as functions.

Permutations describe any situation in which nn objects trade nn places, one object to a place. Number the places 11 through nn; a process that carries whatever sits in place ii to place jj is recorded by the permutation σ\sigma with σ(i)=j\sigma(i) = j, and performing two such processes in turn is recorded by the product.

Every set has two permutations we already know. One is the identity, a bijection because it is its own inverse. The other is the transposition τa,b\tau_{a,b} of the counting chapter, which exchanges aa and bb and fixes every other point; it is its own inverse, hence a permutation of whatever set it is defined on. So SAS_A is never empty, and holds more than one element as soon as AA holds two distinct points.

Problem 8.1.

Write out every element of S2S_2 and of S3S_3 in two-row notation, with the top row ascending, and check that you have two and six of them respectively.

Problem 8.2.

With σ\sigma and λ\lambda as in the example of multiplication in S4S_4, compute σσ\sigma\sigma and λλ\lambda\lambda, and decide whether either is the identity. Compute τ1,2 σ\tau_{1,2}\,\sigma and σ τ1,2\sigma\,\tau_{1,2} and observe that they differ.

Problem 8.3.

Let AA be a set and let h:⟨n⟩→Ah : \langle n \rangle \to A be a bijection. Show that σ↦h−1∘σ∘h\sigma \mapsto h^{-1} \circ \sigma \circ h is a bijection from SAS_A onto SnS_n, and that it carries products to products.

Counting Permutations

The theorem on cardinality of a product already suggests how many bijections run between two nn-sets: nn values are available for the first point, then n−1n - 1 for the second once the first is used, and so on down. The shorthand for that descending product is the factorial.

Definition 8.8 (Factorial).

Define n!n! for n∈N0n \in \mathbb{N}_0 by the recursion

0!=def1,s(n)!=defs(n)⋅n!,0! \defeq 1, \qquad s(n)! \defeq s(n) \cdot n!,

so that n!=n(n−1)⋯2⋅1n! = n(n-1)\cdots 2 \cdot 1 for n∈Nn \in \mathbb{N}. The number n!n! is the factorial of nn.

That the recursion defines exactly one function is the recursion theorem, applied as it was for addition. The value 0!=10! = 1 is the empty product, chosen for the same reason the empty sum is 00: it starts the recursion, and it spares us a separate case in every count below.

Theorem 8.9 (Number of bijections between nn-sets).

Let AA and BB be nn-sets for some n∈N0n \in \mathbb{N}_0. Then there are exactly n!n! bijections from AA to BB. In particular #Sn=n!\#S_n = n!, and the empty set has exactly one permutation, in agreement with 0!=10! = 1.

Discussion.

The claim is a counting statement about a set we have not yet named: writing JJ for the set of bijections A→BA \to B, we must show #J=n!\#J = n!. The factorial was defined by a recursion on nn, so the proof is an induction on nn whose step must produce the factor s(n)s(n). At n=0n = 0 both sets are empty and the empty function is the only function between them, so there is one, which is 0!0!. For the step we split JJ according to where a chosen point aa of AA goes: there are s(n)s(n) possible values, the pieces of the split are pairwise disjoint and cover JJ, and each piece is matched with the bijections between two nn-sets by restricting to what is left of AA. By the inductive hypothesis each piece has n!n! elements, and the cardinality of a product gives the total s(n)⋅n!s(n) \cdot n!, which is the recursion clause for the factorial.

Proof.

We induct on nn. If n=0n = 0 then A=B=∅A = B = \emptyset, and the empty function is the only function ∅→∅\emptyset \to \emptyset; it is a bijection, so there is 1=0!1 = 0! of them.

Suppose the claim holds for all pairs of nn-sets, and let #A=#B=s(n)\#A = \#B = s(n). Fix a∈Aa \in A and, for each b∈Bb \in B, let JbJ_b be the set of bijections σ:A→B\sigma : A \to B with σ(a)=b\sigma(a) = b. Every bijection A→BA \to B lies in exactly one JbJ_b, namely the one indexed by its value at aa, so the JbJ_b are pairwise disjoint and their union is JJ.

Fix bb. Restriction to A∖{a}A \setminus \{a\} carries a member of JbJ_b to a bijection A∖{a}→B∖{b}A \setminus \{a\} \to B \setminus \{b\}, by the proposition that bijections remove points; and every such bijection extends to exactly one member of JbJ_b, by sending aa to bb. So JbJ_b is matched with the set of bijections between two nn-sets, which the inductive hypothesis counts as n!n!, and #Jb=n!\#J_b = n!.

The index set BB is an s(n)s(n)-set, so JJ is a union of s(n)s(n) pairwise disjoint sets each of cardinality n!n!; matching it with B×⟨n!⟩B \times \langle n! \rangle and applying the cardinality of a product gives

#J=s(n)⋅n!=s(n)!,\#J = s(n) \cdot n! = s(n)!,

which is the claim at s(n)s(n). Taking A=B=⟨n⟩A = B = \langle n \rangle gives #Sn=n!\#S_n = n!.

Example 8.10 (The sets S1S_1, S2S_2 and S3S_3).

S1S_1 holds only the identity on {1}\{1\}. S2S_2 holds the two elements

(1212),(1221),\begin{pmatrix} 1 & 2 \\ 1 & 2 \end{pmatrix}, \qquad \begin{pmatrix} 1 & 2 \\ 2 & 1 \end{pmatrix},

and S3S_3 holds 3!=63! = 6:

(123123),(123213),(123321),(123132),(123231),(123312).\begin{aligned} &\begin{pmatrix} 1 & 2 & 3 \\ 1 & 2 & 3 \end{pmatrix}, &&\begin{pmatrix} 1 & 2 & 3 \\ 2 & 1 & 3 \end{pmatrix}, &&\begin{pmatrix} 1 & 2 & 3 \\ 3 & 2 & 1 \end{pmatrix}, \\[1ex] &\begin{pmatrix} 1 & 2 & 3 \\ 1 & 3 & 2 \end{pmatrix}, &&\begin{pmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix}, &&\begin{pmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \end{pmatrix}. \end{aligned}

Without the theorem one would need care to be sure such a list is complete; with it, six is enough.

Example 8.11 (Selections and orderings).

A competition offers five water events, six running events, four cycling events and seven self-defence events. One event may be chosen from each category in 5⋅6⋅4⋅7=8405 \cdot 6 \cdot 4 \cdot 7 = 840 ways, by the cardinality of a product applied three times. If a competitor also fixes the order in which to attempt the four chosen events, each selection admits 4!=244! = 24 orders, so there are 840⋅24=20,160840 \cdot 24 = 20{,}160 full programmes.

Example 8.12 (Non-attacking rooks).

Eight rooks stand on a chessboard with no two attacking, which means no two share a row or a column, since a rook commands both. Each row holds at most one rook and there are eight rooks for eight rows, so every row holds exactly one; the same count puts exactly one in each column. Let σ(i)\sigma(i) be the column of the rook in row ii. The column condition says precisely that σ\sigma is injective, hence a permutation of ⟨8⟩\langle 8 \rangle by the theorem that injective and bijective agree on a finite set; and conversely each σ∈S8\sigma \in S_8 places one rook in each row, in the columns σ(1),…,σ(8)\sigma(1), \ldots, \sigma(8), no two equal. So the acceptable positions are matched with S8S_8, and there are 8!=40,3208! = 40{,}320 of them.

If the rooks are told apart, say by eight colours, choose the squares first in 8!8! ways and then distribute the colours over them in 8!8! ways, for (8!)2=1,625,702,400(8!)^2 = 1{,}625{,}702{,}400 arrangements.

Example 8.13 (Necklaces).

Seven beads of distinct colours are strung on a cord whose ends are then tied, and two necklaces count as the same when one can be turned or flipped into the other. Before the knot the beads lie in a row, and there are 7!=50407! = 5040 rows. Fix one necklace and ask how many rows display it: choose which bead is to sit at the left end, then which of that bead’s two neighbours follows it, and the rest of the row is forced, so 7⋅2=147 \cdot 2 = 14 rows, all different because the colours are. Every row displays exactly one necklace, so fourteen times the number of necklaces is 50405040, and there are 360360 necklaces.

Said the other way, call two rows equivalent when one is a rotation of the other or of its reversal; that is an equivalence relation, its classes are the necklaces, and each class holds fourteen rows.

Problem 8.4.

Show that s(n)!=n!+n⋅n!s(n)! = n! + n \cdot n! for every n∈N0n \in \mathbb{N}_0, and that n!⩾nn! \geqslant n for every nn, with equality only at n=1n = 1 and n=2n = 2.

Problem 8.5.

Give a second proof of the theorem on the number of bijections that does not partition JJ, but instead builds a bijection one value at a time and appeals to the product of cardinalities directly. Which of the two proofs makes the appearance of n!n! more transparent?

Problem 8.6.

Let AA be an nn-set. Show that the permutations of AA fixing a chosen point of AA number (n−1)!(n-1)!, and that those moving every point of AA number fewer than n!n! as soon as n⩾1n \geqslant 1.

Symmetries of Regular Polygons

Permutations record how nn labelled places trade their occupants. The symmetries of a regular polygon are an example: each rigid motion carrying the polygon onto itself shuffles the corners, and the motion is settled by the shuffle.

Remark (What is borrowed from geometry).

The plane, the length of a segment and the measure of an angle are borrowed here in the same spirit as the rules of school algebra were borrowed earlier: openly, and without being built. Two geometric facts are used and not proved: that a symmetry of a polygon carries corners to corners, and that a symmetry is settled by what it does to the corners. Everything else in this section is a statement about permutations, and is proved.

Definition 8.14 (Symmetry of a figure).

A figure is a subset FF of the plane. A symmetry of FF is a bijection ss of the plane onto itself such that s(F)=Fs(F) = F and such that the distance from s(x)s(x) to s(y)s(y) equals the distance from xx to yy, for all points xx and yy. Briefly: a rigid motion of the plane carrying FF onto itself.

Definition 8.15 (Polygon).

A polygon with nn corners, where n⩾3n \geqslant 3, is a figure consisting of points v1,…,vnv_1, \ldots, v_n, the corners, together with the segments joining viv_i to vi+1v_{i+1} for i∈⟨n⟩i \in \langle n \rangle, where vn+1v_{n+1} means v1v_1; those segments are the edges. A polygon with nn corners is an nn-gon, and it is regular if all its edges have the same length and all its interior angles the same measure.

Label the corner positions of an nn-gon by 1,…,n1, \ldots, n. A symmetry ss then determines a permutation σ∈Sn\sigma \in S_n: let σ(i)\sigma(i) be the label of the position to which ss carries the corner that started at position ii. Distinct symmetries determine distinct permutations, since a symmetry is settled by what it does to the corners, so the map s↦σs \mapsto \sigma is injective and an nn-gon has at most #Sn=n!\#S_n = n! symmetries. Composing symmetries multiplies the permutations: if s1s_1 and s2s_2 answer to σ1\sigma_1 and σ2\sigma_2, then s2∘s1s_2 \circ s_1 answers to σ2σ1\sigma_2\sigma_1, because both sides send a corner to the same place. Questions of the form “what happens if these motions are performed in turn?” therefore become products in SnS_n.

Example 8.16 (Symmetries of an equilateral triangle).

Let PP be an equilateral triangle with its corner positions labelled 1,2,31, 2, 3, and let ℓi\ell_i be the line through position ii and the midpoint of the opposite edge. Writing s1,…,s6s_1, \ldots, s_6 for the six symmetries of PP and σ1,…,σ6\sigma_1, \ldots, \sigma_6 for the permutations they determine, the dictionary is

σ1=(123123)identity,σ2=(123132)reflection in ℓ1,σ3=(123321)reflection in ℓ2,σ4=(123213)reflection in ℓ3,σ5=(123231)turn by a third,σ6=(123312)turn by two thirds.\begin{aligned} \sigma_1 &= \begin{pmatrix} 1 & 2 & 3 \\ 1 & 2 & 3 \end{pmatrix} && \text{identity}, \\ \sigma_2 &= \begin{pmatrix} 1 & 2 & 3 \\ 1 & 3 & 2 \end{pmatrix} && \text{reflection in } \ell_1, \\ \sigma_3 &= \begin{pmatrix} 1 & 2 & 3 \\ 3 & 2 & 1 \end{pmatrix} && \text{reflection in } \ell_2, \\ \sigma_4 &= \begin{pmatrix} 1 & 2 & 3 \\ 2 & 1 & 3 \end{pmatrix} && \text{reflection in } \ell_3, \\ \sigma_5 &= \begin{pmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix} && \text{turn by a third}, \\ \sigma_6 &= \begin{pmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \end{pmatrix} && \text{turn by two thirds}. \end{aligned}

The six permutations listed are distinct and #S3=6\#S_3 = 6, so the list is complete in two senses at once: the triangle has no further symmetries, and every element of S3S_3 comes from one.

For the triangle every permutation of the corners comes from a symmetry. For larger polygons this fails. For a square with corners labelled 1,2,3,41, 2, 3, 4 in order round the boundary, the permutation

(12341324)\begin{pmatrix} 1 & 2 & 3 & 4 \\ 1 & 3 & 2 & 4 \end{pmatrix}

holds position 11 still while exchanging the two positions next to it, and no motion preserving distance can do that, since the two exchanged corners are at different distances from the first. For a regular nn-gon the count is exactly 2n2n.

Proposition 8.17 (Number of symmetries of a regular nn-gon).

A regular nn-gon has exactly 2n2n symmetries. Equivalently, the permutations in SnS_n determined by those symmetries form a 2n2n-subset of SnS_n.

Discussion.

The claim is a count, and the object counted is the set of symmetries, which we have already matched injectively with a subset of SnS_n; so it is enough to count the permutations that arise. A symmetry is settled by what it does to the corners, and in fact by what it does to two neighbouring corners, so the count is a product of two choices in the manner of the cardinality of a product. The first corner may go to any of the nn positions, which is the first factor. Its neighbour is one edge away from it, and a motion preserving distance must leave it one edge away from wherever the first corner went, so only the two positions adjacent to that one are available, which is the second factor. That those two choices determine the rest is the geometric fact we have assumed: the remaining corners are reached by stepping round the boundary, and each step is forced once the direction and the starting position are fixed.

Proof.

Label the corner positions 1,…,n1, \ldots, n in order round the boundary and let σ∈Sn\sigma \in S_n come from a symmetry ss.

There are nn possible values for σ(1)\sigma(1). The corners at positions 11 and 22 are joined by an edge, so ss carries them to corners joined by an edge, and hence σ(2)\sigma(2) is one of the two positions adjacent to σ(1)\sigma(1): two possible values. Once σ(1)\sigma(1) and σ(2)\sigma(2) are fixed, so is the direction in which ss runs round the boundary, and every further corner is reached from the previous one by one edge in that direction; so σ(3),…,σ(n)\sigma(3), \ldots, \sigma(n) are determined.

Each of the n⋅2n \cdot 2 pairs of choices is realised, by a turn when the direction is preserved and by a reflection when it is reversed, and distinct pairs give distinct permutations, hence distinct symmetries. So there are exactly 2n2n symmetries.

Remark.

The same 2n2n can be counted a second way, by kind rather than by choice: there are nn turns, through none, one, …, n−1n-1 steps round the boundary, and nn reflections. When nn is odd every reflection has its line through one corner and the midpoint of the opposite edge; when nn is even, half of the lines pass through two opposite corners and half through the midpoints of two opposite edges. Either way the total is 2n2n.

Definition 8.18 (Dihedral group).

The set of permutations in SnS_n determined by the symmetries of a regular nn-gon is written DnD_n and called the dihedral group of degree nn. By the proposition, #Dn=2n\#D_n = 2n and Dn⊂SnD_n \subset S_n.

Working with the motions of a regular nn-gon is therefore the same as computing inside DnD_n, since composing motions is multiplying permutations. The triangle gives D3=S3D_3 = S_3, as the example showed; for n⩾4n \geqslant 4 the inclusion is proper, since 2n<n!2n < n!.

Example 8.19 (A regular nine-gon).

A regular nine-gon has 2⋅9=182 \cdot 9 = 18 symmetries. With the positions labelled 11 through 99 round the boundary, the two symmetries carrying position 11 to position 55 are

(123456789567891234)and(123456789543219876),\begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ 5 & 6 & 7 & 8 & 9 & 1 & 2 & 3 & 4 \end{pmatrix} \quad \text{and} \quad \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ 5 & 4 & 3 & 2 & 1 & 9 & 8 & 7 & 6 \end{pmatrix},

a turn through four steps and a reflection in the line through position 33 and the centre. The reflection is recognisable from its table without any picture: it fixes 33 and pairs off the remaining positions, which is what an involution with one fixed point looks like.

Example 8.20 (Composing motions by multiplying).

Take the six symmetries s1,…,s6s_1, \ldots, s_6 of the equilateral triangle and their permutations σ1,…,σ6\sigma_1, \ldots, \sigma_6 as listed above. The composite s4∘s6∘s2∘s5∘s3s_4 \circ s_6 \circ s_2 \circ s_5 \circ s_3 answers to the product

σ4σ6σ2σ5σ3=(123213)(123312)(123132)(123231)(123321).\sigma_4 \sigma_6 \sigma_2 \sigma_5 \sigma_3 = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 1 & 3 \end{pmatrix} \begin{pmatrix} 1 & 2 & 3 \\ 3 & 1 & 2 \end{pmatrix} \begin{pmatrix} 1 & 2 & 3 \\ 1 & 3 & 2 \end{pmatrix} \begin{pmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix} \begin{pmatrix} 1 & 2 & 3 \\ 3 & 2 & 1 \end{pmatrix}.

Following 11, 22 and 33 through the five factors from the right gives 1↦31 \mapsto 3, 2↦22 \mapsto 2 and 3↦13 \mapsto 1, so the product is σ3\sigma_3 and the composite motion is the reflection s3s_3. Once the dictionary between motions and permutations is fixed, the computation needs no picture.

Problem 8.7.

For the square with corners labelled 1,2,3,41, 2, 3, 4 round the boundary, list the eight elements of D4D_4 in two-row notation, and name an element of S4S_4 that is not one of them.

Problem 8.8.

With the triangle dictionary above, compute σ5σ5\sigma_5\sigma_5 and σ5σ5σ5\sigma_5\sigma_5\sigma_5 and read the answers as repeated turns.

Problem 8.9.

Show that DnD_n is closed under products and under inverses. Argue geometrically, from the fact that a composite of rigid motions carrying the polygon onto itself is one, and that the inverse of such a motion is one.

Cycles and Parity

Two-row notation is complete but bulky: it names nn values to describe a function that may move only two points. Cycle notation is shorter. It records a permutation by its orbits, and the order and the parity of a permutation can both be read off the same decomposition.

Throughout, n∈Nn \in \mathbb{N} is fixed unless said otherwise, and id\mathrm{id} is the identity permutation of ⟨n⟩\langle n \rangle.

Inverses, Powers and Order

A permutation is a bijection, so it has an inverse, and that inverse is again a bijection of the same set: σ∈Sn\sigma \in S_n gives σ−1∈Sn\sigma^{-1} \in S_n, with σ−1\sigma^{-1} sending each σ(i)\sigma(i) back to ii. In two-row notation this is easy: exchange the rows, then reorder the columns so that the top row ascends again.

Example 8.21 (Computing an inverse).

If

σ=(12343142),\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 3 & 1 & 4 & 2 \end{pmatrix},

then exchanging the rows gives

(31421234)=(12342413)=σ−1.\begin{pmatrix} 3 & 1 & 4 & 2 \\ 1 & 2 & 3 & 4 \end{pmatrix} = \begin{pmatrix} 1 & 2 & 3 & 4 \\ 2 & 4 & 1 & 3 \end{pmatrix} = \sigma^{-1}.

In practice one writes a blank table and, under each jj along the top, records the unique ii with σ(i)=j\sigma(i) = j; it is unique because σ\sigma is a bijection.

Definition 8.22 (Powers of a permutation).

Let σ∈Sn\sigma \in S_n. Define σt\sigma^t for t∈N0t \in \mathbb{N}_0 by the recursion

σ0=defid,σs(t)=defσtσ,\sigma^0 \defeq \mathrm{id}, \qquad \sigma^{s(t)} \defeq \sigma^t \sigma,

so that σ1=σ\sigma^1 = \sigma and σt\sigma^t is the tt-fold product σσ⋯σ\sigma\sigma\cdots\sigma. Write also

σ−t=def(σ−1)t\sigma^{-t} \defeq (\sigma^{-1})^t

for t∈Nt \in \mathbb{N}, so that σ−1\sigma^{-1} has its usual meaning.

Example 8.23 (Powers both ways).

If

σ=(1234535124),\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 3 & 5 & 1 & 2 & 4 \end{pmatrix},

then

σ2=(1234514352),σ−1=(1234534152),σ−2=(1234515324).\sigma^2 = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 1 & 4 & 3 & 5 & 2 \end{pmatrix}, \qquad \sigma^{-1} = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 3 & 4 & 1 & 5 & 2 \end{pmatrix}, \qquad \sigma^{-2} = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 1 & 5 & 3 & 2 & 4 \end{pmatrix}.

Comparing the first and last tables shows σ−2\sigma^{-2} to be the inverse of σ2\sigma^2, which the theorem below predicts.

Theorem 8.24 (Laws of exponents).

Let σ∈Sn\sigma \in S_n and let s,t∈N0s, t \in \mathbb{N}_0. Then

  1. σsσt=σs+t\sigma^s \sigma^t = \sigma^{s+t};
  2. (σs)t=σst(\sigma^s)^t = \sigma^{st};
  3. (σs)−1=(σ−1)s(\sigma^s)^{-1} = (\sigma^{-1})^s, that is, (σs)−1=σ−s(\sigma^s)^{-1} = \sigma^{-s} when ss is positive.

Discussion.

Three identities between permutations, each of them an equality of functions on ⟨n⟩\langle n \rangle. The powers were defined by a recursion on the exponent, so each part is an induction on one exponent with the other held fixed, and each inductive step is the recursion clause together with associativity of composition. For the first we fix ss and induct on tt; the base is the identity law σsid=σs\sigma^s \mathrm{id} = \sigma^s, and the step moves one factor across the bracket. The second is the same induction on tt, now using the first part at each step to add exponents. For the third, to say that a permutation is the inverse of σs\sigma^s is to say that it composes with σs\sigma^s to the identity on both sides, and (σ−1)sσs(\sigma^{-1})^s \sigma^s cancels from the inside out. We induct on ss for that too.

Proof.

For the first, fix ss and induct on tt. At t=0t = 0 we have σsσ0=σsid=σs=σs+0\sigma^s \sigma^0 = \sigma^s \mathrm{id} = \sigma^s = \sigma^{s+0}, by the identity laws. Suppose σsσt=σs+t\sigma^s \sigma^t = \sigma^{s+t}. Then

σsσs(t)=σs(σtσ)=(σsσt)σ=σs+tσ=σs(s+t)=σs+s(t),\sigma^s \sigma^{s(t)} = \sigma^s (\sigma^t \sigma) = (\sigma^s \sigma^t) \sigma = \sigma^{s+t} \sigma = \sigma^{s(s+t)} = \sigma^{s + s(t)},

the second step by associativity of composition, the fourth and fifth by the recursion clauses for powers and for addition.

For the second, fix ss and induct on tt. At t=0t = 0 both sides are id\mathrm{id}, since s⋅0=0s \cdot 0 = 0. Suppose (σs)t=σst(\sigma^s)^t = \sigma^{st}. Then

(σs)s(t)=(σs)tσs=σstσs=σst+s=σs⋅s(t),(\sigma^s)^{s(t)} = (\sigma^s)^t \sigma^s = \sigma^{st} \sigma^s = \sigma^{st + s} = \sigma^{s \cdot s(t)},

using the first part and the recursion clause for multiplication.

For the third, induct on ss. At s=0s = 0 both sides are id\mathrm{id}. Suppose (σ−1)sσs=id=σs(σ−1)s(\sigma^{-1})^s \sigma^s = \mathrm{id} = \sigma^s (\sigma^{-1})^s. The first part gives σs(s)=σ1+s=σσs\sigma^{s(s)} = \sigma^{1 + s} = \sigma \sigma^s, so

(σ−1)s(s)σs(s)=((σ−1)sσ−1)(σσs)=(σ−1)s(σ−1σ)σs=(σ−1)sσs=id,(\sigma^{-1})^{s(s)} \sigma^{s(s)} = \bigl((\sigma^{-1})^s \sigma^{-1}\bigr)\bigl(\sigma \sigma^s\bigr) = (\sigma^{-1})^s \bigl(\sigma^{-1} \sigma\bigr) \sigma^s = (\sigma^{-1})^s \sigma^s = \mathrm{id},

the second step by associativity, the third because σ−1σ=id\sigma^{-1}\sigma = \mathrm{id}, and the last by the inductive hypothesis. In the other order, the first part applied to σ−1\sigma^{-1} gives (σ−1)s(s)=σ−1(σ−1)s(\sigma^{-1})^{s(s)} = \sigma^{-1} (\sigma^{-1})^s, and

σs(s)(σ−1)s(s)=(σsσ)(σ−1(σ−1)s)=σs(σσ−1)(σ−1)s=σs(σ−1)s=id.\sigma^{s(s)} (\sigma^{-1})^{s(s)} = \bigl(\sigma^s \sigma\bigr)\bigl(\sigma^{-1} (\sigma^{-1})^s\bigr) = \sigma^s \bigl(\sigma \sigma^{-1}\bigr) (\sigma^{-1})^s = \sigma^s (\sigma^{-1})^s = \mathrm{id}.

So (σ−1)s(\sigma^{-1})^s is a two-sided inverse of σs\sigma^s, and inverses are unique.

Remark.

With the third part in hand the notation σ−t\sigma^{-t} is consistent: it does not matter whether one inverts and then takes the power or takes the power and then inverts. All three laws then hold for exponents of either sign, once the statements are read with the convention σ−t=(σ−1)t\sigma^{-t} = (\sigma^{-1})^t; we have written them for N0\mathbb{N}_0 because that is where we have arithmetic, and a negative exponent is here an abbreviation rather than a number.

Definition 8.25 (Order of a permutation).

Let σ∈Sn\sigma \in S_n. The order of σ\sigma, written ord σ\mathrm{ord}\,\sigma, is the least k∈Nk \in \mathbb{N} with σk=id\sigma^k = \mathrm{id}, if there is one.

Proposition 8.26 (Every permutation has an order).

Let σ∈Sn\sigma \in S_n. Then σk=id\sigma^k = \mathrm{id} for some k∈Nk \in \mathbb{N}, so ord σ\mathrm{ord}\,\sigma is defined and lies in N\mathbb{N}.

Discussion.

The claim is an existence statement, and since all we know is that SnS_n is finite, we use the pigeonhole principle. We have infinitely many powers σ0,σ1,σ2,…\sigma^0, \sigma^1, \sigma^2, \ldots and only n!n! permutations for them to be, so two of the powers coincide. Cancelling the smaller from the larger (multiplying by an inverse, using the laws of exponents) leaves a positive power equal to the identity. Once the set of positive kk with σk=id\sigma^k = \mathrm{id} is known to be non-empty, well-ordering supplies its least member, which is what the definition asks for.

Proof.

The map t↦σtt \mapsto \sigma^t from ⟨s(n!)⟩\langle s(n!) \rangle to SnS_n has a domain of s(n!)s(n!) elements and a range inside a set of n!n! elements, so it is not injective by the pigeonhole principle: there are i<ji < j in that block with σi=σj\sigma^i = \sigma^j. Write j=i+dj = i + d with d∈Nd \in \mathbb{N}. Composing with (σ−1)i(\sigma^{-1})^i on the left and using the laws of exponents,

id=(σ−1)iσi=(σ−1)iσi+d=((σ−1)iσi)σd=σd.\mathrm{id} = (\sigma^{-1})^i \sigma^i = (\sigma^{-1})^i \sigma^{i + d} = \bigl((\sigma^{-1})^i \sigma^i\bigr)\sigma^d = \sigma^d .

So K=def{k∈N∣σk=id}K \defeq \{k \in \mathbb{N} \mid \sigma^k = \mathrm{id}\} is non-empty, and well-ordering gives it a least member, which is ord σ\mathrm{ord}\,\sigma.

Theorem 8.27 (Powers repeat with the order).

Let σ∈Sn\sigma \in S_n with ord σ=k\mathrm{ord}\,\sigma = k. Then σ0,σ1,…,σk−1\sigma^0, \sigma^1, \ldots, \sigma^{k-1} are pairwise distinct, and every power σt\sigma^t with t∈N0t \in \mathbb{N}_0 is one of them.

Discussion.

Two assertions. The second says that the list exhausts the powers, and the tool is division with remainder: writing t=qk+rt = qk + r with r<kr < k, the laws of exponents split σt\sigma^t into (σk)qσr(\sigma^k)^q \sigma^r, and the first factor is the identity by the definition of the order, leaving σr\sigma^r with rr in range. The first assertion is a uniqueness claim and goes by contradiction: two equal powers among the first kk would cancel to give a positive power below kk equal to the identity, and the order was chosen least, so no such power exists.

Proof.

Let t∈N0t \in \mathbb{N}_0. Division with remainder gives q,r∈N0q, r \in \mathbb{N}_0 with t=q⋅k+rt = q \cdot k + r and r<kr < k, so by the laws of exponents

σt=σqk+r=(σk)qσr=idqσr=σr,\sigma^t = \sigma^{qk + r} = (\sigma^k)^q \sigma^r = \mathrm{id}^q \sigma^r = \sigma^r,

and σt\sigma^t is one of σ0,…,σk−1\sigma^0, \ldots, \sigma^{k-1}.

Suppose σi=σj\sigma^i = \sigma^j with i<ji < j and j⩽k−1j \leqslant k - 1. Writing j=i+dj = i + d with d∈Nd \in \mathbb{N} and composing with (σ−1)i(\sigma^{-1})^i as before gives σd=id\sigma^d = \mathrm{id} with d⩽j<kd \leqslant j < k, contradicting the leastness of kk. So the kk powers listed are pairwise distinct.

Problem 8.10.

Let

σ=(1234553421).\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 5 & 3 & 4 & 2 & 1 \end{pmatrix}.

Compute σ2,σ3,…\sigma^2, \sigma^3, \ldots until the identity appears, and state ord σ\mathrm{ord}\,\sigma.

Problem 8.11.

Show that if σm=id\sigma^m = \mathrm{id} for some m∈Nm \in \mathbb{N}, then ord σ\mathrm{ord}\,\sigma divides mm, in the sense that m=q⋅ord σm = q \cdot \mathrm{ord}\,\sigma for some qq. Division with remainder is the whole of the argument.

Problem 8.12.

Show that ord σ=ord σ−1\mathrm{ord}\,\sigma = \mathrm{ord}\,\sigma^{-1} for every σ∈Sn\sigma \in S_n, and that ord σ=1\mathrm{ord}\,\sigma = 1 exactly when σ=id\sigma = \mathrm{id}.

Cycles and Disjoint Decomposition

Draw a point for each i∈⟨n⟩i \in \langle n \rangle and an arrow from ii to σ(i)\sigma(i). Because σ\sigma is a function, exactly one arrow leaves each point; because it is injective, exactly one arrow arrives at each. A picture of that kind can only be a collection of separate closed loops, some of them loops from a point to itself. The notation that matches the picture is the following.

Definition 8.28 (Cycle).

Let r∈Nr \in \mathbb{N} with r⩽nr \leqslant n. A permutation σ∈Sn\sigma \in S_n is an rr-cycle, or a cycle of length rr, if there are distinct a1,…,ar∈⟨n⟩a_1, \ldots, a_r \in \langle n \rangle with

σ(ai)={ai+1if i<r,a1if i=r,\sigma(a_i) = \begin{cases} a_{i+1} & \text{if } i < r, \\ a_1 & \text{if } i = r, \end{cases}

and σ(x)=x\sigma(x) = x for every x∈⟨n⟩∖{a1,…,ar}x \in \langle n \rangle \setminus \{a_1, \ldots, a_r\}. The set {a1,…,ar}\{a_1, \ldots, a_r\} is the orbit of the cycle, written orb σ\mathrm{orb}\,\sigma, and one writes

σ=(a1 a2 ⋯ ar)\sigma = (a_1 \ a_2 \ \cdots \ a_r)

for this permutation. A point xx with σ(x)≠x\sigma(x) \neq x is said to be moved by σ\sigma.

A 11-cycle (a1)(a_1) fixes a1a_1 and fixes everything else, so it is the identity; in a product one leaves such factors out, since they do nothing. For r⩾2r \geqslant 2 the listing inside the brackets may start wherever one likes,

(a1 a2 ⋯ ar)=(a2 ⋯ ar a1)=⋯=(ar a1 ⋯ ar−1),(a_1 \ a_2 \ \cdots \ a_r) = (a_2 \ \cdots \ a_r \ a_1) = \cdots = (a_r \ a_1 \ \cdots \ a_{r-1}),

since all rr of those tables send each aia_i to the same place; and the inverse of a cycle is the same cycle read backwards,

(a1 a2 ⋯ ar)−1=(ar ar−1 ⋯ a1).(a_1 \ a_2 \ \cdots \ a_r)^{-1} = (a_r \ a_{r-1} \ \cdots \ a_1).

Example 8.29 (A five-cycle).

The permutation

σ=(12345677354162)\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 7 & 3 & 5 & 4 & 1 & 6 & 2 \end{pmatrix}

sends 1↦7↦2↦3↦5↦11 \mapsto 7 \mapsto 2 \mapsto 3 \mapsto 5 \mapsto 1 and fixes 44 and 66, so σ=(1 7 2 3 5)\sigma = (1 \ 7 \ 2 \ 3 \ 5), which is the same cycle as (7 2 3 5 1)(7 \ 2 \ 3 \ 5 \ 1).

Definition 8.30 (Disjoint cycles).

A family of cycles in SnS_n is disjoint if their orbits are pairwise disjoint: no cycle in the family moves a point moved by another.

Example 8.31 (Two disjoint cycles).

In S7S_7 the cycles α=(2 6 4 5)\alpha = (2 \ 6 \ 4 \ 5) and β=(3 7)\beta = (3 \ 7) are disjoint, since {2,6,4,5}∩{3,7}=∅\{2, 6, 4, 5\} \cap \{3, 7\} = \emptyset. In two-row notation,

α=(12345671635247),β=(12345671274563).\alpha = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 1 & 6 & 3 & 5 & 2 & 4 & 7 \end{pmatrix}, \qquad \beta = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ 1 & 2 & 7 & 4 & 5 & 6 & 3 \end{pmatrix}.

Products of permutations do not commute in general, but disjoint cycles do, because each acts inside its own orbit and fixes everything outside it. The argument has nothing to do with cycles, so we state it for arbitrary maps.

Theorem 8.32 (Maps with disjoint supports commute).

Let AA and BB be sets and let f,g:A∪B→A∪Bf, g : A \cup B \to A \cup B satisfy

  1. f(A)⊂Af(A) \subset A, and f(x)=xf(x) = x for every x∈Bx \in B;
  2. g(B)⊂Bg(B) \subset B, and g(x)=xg(x) = x for every x∈Ax \in A.

Then g∘f=f∘gg \circ f = f \circ g.

Discussion.

The claim is an equality of two functions with domain A∪BA \cup B, so by equality of functions we compare values at an arbitrary point, and the domain is a union, so the comparison splits into the two cases x∈Ax \in A and x∈Bx \in B. Each case is the same short argument run with the hypotheses exchanged: one of the two maps fixes xx, so one composite is immediately the other map’s value at xx; and that value stays in the set where the first map fixes everything, so the other composite is the same. Only the two hypotheses are used.

Proof.

Let x∈A∪Bx \in A \cup B.

If x∈Ax \in A then g(x)=xg(x) = x by the second hypothesis, so (f∘g)(x)=f(x)(f \circ g)(x) = f(x); and f(x)∈Af(x) \in A by the first hypothesis, so gg fixes it and (g∘f)(x)=g(f(x))=f(x)(g \circ f)(x) = g(f(x)) = f(x).

If x∈Bx \in B then f(x)=xf(x) = x by the first hypothesis, so (g∘f)(x)=g(x)(g \circ f)(x) = g(x); and g(x)∈Bg(x) \in B by the second, so ff fixes it and (f∘g)(x)=f(g(x))=g(x)(f \circ g)(x) = f(g(x)) = g(x).

In both cases the two composites agree at xx, so they are equal.

Corollary 8.33 (Disjoint cycles commute).

If α\alpha and β\beta are disjoint cycles in SnS_n, then αβ=βα\alpha\beta = \beta\alpha.

Proof.

Put A=deforb αA \defeq \mathrm{orb}\,\alpha and B=def⟨n⟩∖AB \defeq \langle n \rangle \setminus A. Then α(A)=A\alpha(A) = A and α\alpha fixes every point of BB, by the definition of a cycle. Disjointness puts orb β\mathrm{orb}\,\beta inside BB, so β(B)⊂B\beta(B) \subset B, and β\beta fixes every point of AA. The theorem applies with f=αf = \alpha and g=βg = \beta.

Example 8.34 (A product of disjoint cycles).

In S10S_{10},

(3 1 5 7 9)(2 8 6)=(2 8 6)(3 1 5 7 9)=(1234567891058147296310).(3 \ 1 \ 5 \ 7 \ 9)(2 \ 8 \ 6) = (2 \ 8 \ 6)(3 \ 1 \ 5 \ 7 \ 9) = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ 5 & 8 & 1 & 4 & 7 & 2 & 9 & 6 & 3 & 10 \end{pmatrix}.

Neither 44 nor 1010 is moved by either factor, and the table records that by fixing them.

Every permutation is such a product.

Theorem 8.35 (Cycle decomposition).

Every permutation in SnS_n is a product of pairwise disjoint cycles. The identity is the empty product, or equally a product of 11-cycles, which one omits from the written expression.

Discussion.

The proof is a construction together with two checks. The construction follows the arrows of the picture: start at a point, apply σ\sigma repeatedly, and see that the trail must return to its start. That it returns at all is the pigeonhole principle, since ⟨n⟩\langle n \rangle is finite; that it returns to the start rather than to some later point of the trail uses injectivity, and we get it by taking the first repetition and cancelling. The trail is then the orbit of a cycle on which σ\sigma agrees with that cycle. The first check is that a second trail, begun at a point not yet used, is disjoint from the first, which is again cancellation. The second is that the product of all the cycles obtained equals σ\sigma: on each orbit the product acts as the one factor that moves that orbit, by disjointness, and off all of them both sides fix every point. The process stops because each round uses at least one new point of the finite set ⟨n⟩\langle n \rangle.

Proof.

Let σ∈Sn\sigma \in S_n and let b∈⟨n⟩b \in \langle n \rangle. Among the s(n)s(n) values σ0(b),σ1(b),…,σn(b)\sigma^0(b), \sigma^1(b), \ldots, \sigma^n(b), lying in the nn-set ⟨n⟩\langle n \rangle, two coincide by the pigeonhole principle. Let tt be least such that σt(b)=σi(b)\sigma^t(b) = \sigma^i(b) for some i<ti < t. If ii were positive, composing both sides with (σ−1)i(\sigma^{-1})^i would give σt−i(b)=b=σ0(b)\sigma^{t - i}(b) = b = \sigma^0(b) with t−i<tt - i < t, contradicting leastness. So i=0i = 0 and σt(b)=b\sigma^t(b) = b, and the points b,σ(b),…,σt−1(b)b, \sigma(b), \ldots, \sigma^{t-1}(b) are pairwise distinct, again by leastness. Write

γb=def(b  σ(b)  ⋯  σt−1(b)),\gamma_b \defeq \bigl(b \ \ \sigma(b) \ \ \cdots \ \ \sigma^{t-1}(b)\bigr),

a cycle whose orbit is that set and on which σ\sigma agrees with γb\gamma_b.

Now build the decomposition. Put γ1=defγb1\gamma_1 \defeq \gamma_{b_1} for b1=def1b_1 \defeq 1. If every point outside orb γ1\mathrm{orb}\,\gamma_1 is fixed by σ\sigma, then σ=γ1\sigma = \gamma_1 and we are done. Otherwise choose a point b2b_2 moved by σ\sigma and lying outside orb γ1\mathrm{orb}\,\gamma_1, and form γ2=defγb2\gamma_2 \defeq \gamma_{b_2}. The two orbits are disjoint: if σi(b1)=σj(b2)\sigma^i(b_1) = \sigma^j(b_2) then composing with (σ−1)j(\sigma^{-1})^j or (σ−1)i(\sigma^{-1})^i, whichever exponent is the smaller, expresses b2b_2 as a power of σ\sigma applied to b1b_1, and the theorem on powers repeating puts that power inside orb γ1\mathrm{orb}\,\gamma_1, contrary to the choice of b2b_2.

Repeat. Each round adds at least one point to the union of the orbits, and ⟨n⟩\langle n \rangle is finite, so after finitely many rounds every point moved by σ\sigma lies in some orbit. Let γ1,…,γm\gamma_1, \ldots, \gamma_m be the cycles obtained; they are pairwise disjoint by the argument just given, applied to each pair. Their product agrees with σ\sigma at every point: a point in orb γi\mathrm{orb}\,\gamma_i is fixed by every factor but γi\gamma_i, which sends it where σ\sigma does, and a point in no orbit is fixed by every factor and by σ\sigma. So σ=γ1⋯γm\sigma = \gamma_1 \cdots \gamma_m, and the order of the factors is immaterial by the corollary on disjoint cycles.

Remark (Reading off the decomposition).

The proof is an algorithm, and it is the one used in practice. Given σ\sigma in two-row form, begin at any point not yet written down, apply σ\sigma until the starting point returns, close the bracket, and start again elsewhere. Only cycles of length at least two need be written. In the picture of arrows, the cycles are exactly the separate loops.

Remark (Uniqueness).

The decomposition is unique up to the order of the factors and up to where each bracket starts. For suppose σ=γ1⋯γm=λ1⋯λt\sigma = \gamma_1 \cdots \gamma_m = \lambda_1 \cdots \lambda_t are two products of pairwise disjoint cycles of length at least two, and let a∈orb γ1a \in \mathrm{orb}\,\gamma_1. Then σ(a)≠a\sigma(a) \neq a, so aa lies in the orbit of exactly one λj\lambda_j, say λ1\lambda_1 after renumbering. Both γ1\gamma_1 and λ1\lambda_1 agree with σ\sigma on the orbit they contain aa in, so the two orbits are the same set — each is the trail of aa under σ\sigma — and the two cycles agree there and fix everything else, hence γ1=λ1\gamma_1 = \lambda_1. Matching the remaining factors the same way shows the two collections coincide.

Example 8.36 (Three decompositions).

  1. (123456789492517683)=(1 4 5)(2 9 3)(6 7).\displaystyle \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 \\ 4 & 9 & 2 & 5 & 1 & 7 & 6 & 8 & 3 \end{pmatrix} = (1 \ 4 \ 5)(2 \ 9 \ 3)(6 \ 7).

  2. (123456789101112968725413101211)=(1 9 3 8)(2 6 5)(4 7)(11 12).\displaystyle \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ 9 & 6 & 8 & 7 & 2 & 5 & 4 & 1 & 3 & 10 & 12 & 11 \end{pmatrix} = (1 \ 9 \ 3 \ 8)(2 \ 6 \ 5)(4 \ 7)(11 \ 12).

  3. If α=(1 2 3)\alpha = (1 \ 2 \ 3) and β=(2 3 4)\beta = (2 \ 3 \ 4), the product αβ\alpha\beta is not written as a product of disjoint cycles, since the factors share the points 22 and 33. Following each point through β\beta and then α\alpha gives αβ=(1 2)(3 4)\alpha\beta = (1 \ 2)(3 \ 4), which is.

Problem 8.13.

Show that an rr-cycle has order rr.

Problem 8.14.

Write each of the following as a product of disjoint cycles and give its order.

  1. (123456214563)\displaystyle \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 \\ 2 & 1 & 4 & 5 & 6 & 3 \end{pmatrix}
  2. (1 3 5)(2 4 6 1)(1 \ 3 \ 5)(2 \ 4 \ 6 \ 1), as an element of S6S_6.

Problem 8.15.

Let σ\sigma be a product of pairwise disjoint cycles of lengths r1,…,rmr_1, \ldots, r_m. Show that σk=id\sigma^k = \mathrm{id} exactly when every rir_i divides kk, in the sense of the problem on divisibility, and deduce that ord σ\mathrm{ord}\,\sigma is the least such kk. Say where disjointness is used.

Problem 8.16.

Show that σ∈Sn\sigma \in S_n is a transposition if and only if it is a 22-cycle, and that αγα−1=(α(a1) ⋯ α(ar))\alpha\gamma\alpha^{-1} = (\alpha(a_1) \ \cdots \ \alpha(a_r)) for every cycle γ=(a1 ⋯ ar)\gamma = (a_1 \ \cdots \ a_r) and every α∈Sn\alpha \in S_n.

Problem 8.17.

Let n⩾3n \geqslant 3 and let σ∈Sn\sigma \in S_n satisfy σλ=λσ\sigma\lambda = \lambda\sigma for every λ∈Sn\lambda \in S_n. Show that σ=id\sigma = \mathrm{id}. Which elements of S2S_2 have the same property?

Transpositions and the Sign

A 22-cycle (a b)(a \ b) exchanges aa and bb and fixes every other point of ⟨n⟩\langle n \rangle, which is exactly the transposition τa,b\tau_{a,b} written in cycle notation. In particular (a b)2=id(a \ b)^2 = \mathrm{id} and (a b)−1=(a b)(a \ b)^{-1} = (a \ b), which is the proposition that a transposition is its own inverse read in the new notation. Transpositions move as few points as a permutation other than the identity can, and every permutation is a product of them.

Theorem 8.37 (Factorisation into transpositions).

Let n⩾2n \geqslant 2. Then every permutation in SnS_n is a product of transpositions.

Discussion.

The statement is universally quantified over SnS_n, and the cycle decomposition has already reduced any such statement to a statement about a single cycle: if each factor of a disjoint decomposition is a product of transpositions then so is the whole, by substitution. So there are two things to do. The identity is not covered by the decomposition, since its decomposition is empty, and it is handled separately by writing it as a transposition composed with itself. A cycle of length at least two is handled by exhibiting the factorisation outright, and the exhibited product is then checked point by point against the cycle.

Proof.

If σ=id\sigma = \mathrm{id} then σ=(1 2)(1 2)\sigma = (1 \ 2)(1 \ 2), which is available since n⩾2n \geqslant 2.

Otherwise the cycle decomposition writes σ\sigma as a product of cycles of length at least two, so it is enough to factor one such cycle. We claim

(a1 a2 ⋯ ar)=(a1 ar)(a1 ar−1)⋯(a1 a3)(a1 a2).(a_1 \ a_2 \ \cdots \ a_r) = (a_1 \ a_r)(a_1 \ a_{r-1}) \cdots (a_1 \ a_3)(a_1 \ a_2).

Evaluate the right-hand side from the right. The point a1a_1 is sent to a2a_2 by the first factor, and a2a_2 is fixed by all the others, so a1↦a2a_1 \mapsto a_2. For 1<i<r1 < i < r, the point aia_i is fixed by every factor until (a1 ai)(a_1 \ a_i) sends it to a1a_1, and the next factor (a1 ai+1)(a_1 \ a_{i+1}) sends a1a_1 to ai+1a_{i+1}, which the remaining factors fix; so ai↦ai+1a_i \mapsto a_{i+1}. The point ara_r is fixed until the last factor (a1 ar)(a_1 \ a_r) sends it to a1a_1, and nothing follows, so ar↦a1a_r \mapsto a_1. Any point outside the orbit is fixed by every factor. So the two sides agree everywhere.

Substituting these factorisations into the decomposition writes σ\sigma as a product of transpositions.

Remark (Non-uniqueness).

The transposition factors are not disjoint in general, and cannot be: a 33-cycle moves three points, while a product of disjoint transpositions moves an even number. The factorisation is not unique either, since (1 2)(1 2)(1 \ 2)(1 \ 2) may be inserted anywhere, and the order of non-disjoint factors matters, (1 3)(1 2)(1 \ 3)(1 \ 2) and (1 2)(1 3)(1 \ 2)(1 \ 3) being different permutations. What is unique is the evenness or oddness of the number of factors, and we prove this next.

To prove it we count, for a given permutation, the pairs of points whose order it reverses.

Definition 8.38 (Reversals, parity and sign).

Let σ∈Sn\sigma \in S_n and let {i,j}\{i, j\} be a 22-subset of ⟨n⟩\langle n \rangle, written so that i<ji < j. Then σ\sigma reverses {i,j}\{i, j\} if σ(j)<σ(i)\sigma(j) < \sigma(i). Write r(σ)r(\sigma) for the number of 22-subsets of ⟨n⟩\langle n \rangle reversed by σ\sigma.

The permutation σ\sigma is even if r(σ)r(\sigma) is even and odd if r(σ)r(\sigma) is odd; that alternative is the parity of σ\sigma. The sign of σ\sigma is

sgn σ=def{1if σ is even,−1if σ is odd.\mathrm{sgn}\,\sigma \defeq \begin{cases} 1 & \text{if } \sigma \text{ is even}, \\ -1 & \text{if } \sigma \text{ is odd}. \end{cases}

The count r(σ)r(\sigma) exists because the 22-subsets of ⟨n⟩\langle n \rangle form a finite set, and each is reversed or not by the trichotomy of the order. The two values 11 and −1-1 are just labels for the parity, and the only property of the labels we shall use is that multiplying them behaves as adding parities does, with (−1)(−1)=1(-1)(-1) = 1 recording that two odd numbers add to an even one.

Example 8.39 (Counting reversals).

The identity reverses nothing, so r(id)=0r(\mathrm{id}) = 0 and the identity is even. For

σ=(123231)\sigma = \begin{pmatrix} 1 & 2 & 3 \\ 2 & 3 & 1 \end{pmatrix}

the three 22-subsets are {1,2}\{1, 2\}, with 2<32 < 3, not reversed; {1,3}\{1, 3\}, with 1<21 < 2, reversed; and {2,3}\{2, 3\}, with 1<31 < 3, reversed. So r(σ)=2r(\sigma) = 2 and σ\sigma is even.

The proof uses two facts about rr: multiplying by a transposition of neighbours changes it by exactly one, and every permutation is a product of such transpositions. The second was set as a problem in the chapter on sequences, where it justified the claim that rearranging a sum does not change it; here it is proved, and in the language of SnS_n rather than of rearrangements.

Proposition 8.40 (A neighbour swap changes one reversal).

Let σ∈Sn\sigma \in S_n, let k∈⟨n⟩k \in \langle n \rangle with k<nk < n, and put τ=def(k  k+1)\tau \defeq (k \ \ k+1). Then exactly one of

r(στ)=r(σ)+1,r(σ)=r(στ)+1r(\sigma\tau) = r(\sigma) + 1, \qquad r(\sigma) = r(\sigma\tau) + 1

holds. In particular r(στ)r(\sigma\tau) and r(σ)r(\sigma) have different parities.

Discussion.

Both r(σ)r(\sigma) and r(στ)r(\sigma\tau) are counts over the same index set, the 22-subsets of ⟨n⟩\langle n \rangle, so the claim is that the two counts differ by one, and we sort the 22-subsets into three kinds and compare the counts kind by kind. The permutation στ\sigma\tau agrees with σ\sigma except that its values at kk and k+1k+1 are exchanged: a 22-subset avoiding both kk and k+1k+1 sees the same two values in the same positions, so its status is unchanged; a 22-subset meeting exactly one of them is paired with the 22-subset meeting the other, and the two statuses are exchanged between the members of the pair, leaving their total unchanged; and the single 22-subset {k,k+1}\{k, k+1\} has its status reversed, because the two values are exchanged while the two positions are not. Summing the three kinds, the totals agree except for one, and trichotomy makes the two displayed alternatives exclusive. The last sentence is then the remainder classes at m=2m = 2: a number and its successor never have the same parity.

Proof.

Write ρ=defστ\rho \defeq \sigma\tau, so that ρ(k)=σ(k+1)\rho(k) = \sigma(k+1), ρ(k+1)=σ(k)\rho(k+1) = \sigma(k), and ρ(i)=σ(i)\rho(i) = \sigma(i) for every other ii. Sort the 22-subsets of ⟨n⟩\langle n \rangle into three kinds.

Neither point in {k,k+1}\{k, k+1\}. Both values are the same for ρ\rho as for σ\sigma, so the subset is reversed by one exactly when it is reversed by the other.

Exactly one point in {k,k+1}\{k, k+1\}. Such subsets come in pairs {i,k}\{i, k\} and {i,k+1}\{i, k+1\} with i∉{k,k+1}i \notin \{k, k+1\}. Suppose i<ki < k, so that i<k<k+1i < k < k+1 and ii is the smaller point in both subsets. Then ρ\rho reverses {i,k}\{i, k\} exactly when σ(k+1)<σ(i)\sigma(k+1) < \sigma(i), which is exactly when σ\sigma reverses {i,k+1}\{i, k+1\}; and ρ\rho reverses {i,k+1}\{i, k+1\} exactly when σ\sigma reverses {i,k}\{i, k\}. So the two statuses are exchanged within the pair and the number of reversed subsets among the two is the same for ρ\rho as for σ\sigma. The case k+1<ik + 1 < i is the same argument with ii the larger point.

The subset {k,k+1}\{k, k+1\}. Here ρ\rho reverses it exactly when ρ(k+1)<ρ(k)\rho(k+1) < \rho(k), that is when σ(k)<σ(k+1)\sigma(k) < \sigma(k+1), which is exactly when σ\sigma does not reverse it.

Adding the three kinds, the counts agree on the first two and differ by exactly one on the third. So r(ρ)r(\rho) is r(σ)r(\sigma) increased by one or r(σ)r(\sigma) is r(ρ)r(\rho) increased by one, and not both, by trichotomy. A number and its successor fall in different remainder classes for the divisor 22, so the parities differ.

Proposition 8.41 (Neighbour swaps suffice).

Let n⩾2n \geqslant 2. Then every permutation in SnS_n is a product of transpositions of the form (k  k+1)(k \ \ k+1) with k<nk < n.

Discussion.

By the theorem on factorisation into transpositions the claim reduces to a single transposition (a b)(a \ b) with a<ba < b, since substituting a factorisation of each factor factorises the product. We induct on the gap dd between them, where b=a+db = a + d. At d=1d = 1 the transposition is already a neighbour swap. For the step, conjugating a transposition by a neighbour swap moves one of its two points one place along: (a b)(a \ b) is (b−1  b)(a  b−1)(b−1  b)(b-1 \ \ b)(a \ \ b-1)(b-1 \ \ b), whose middle factor has a smaller gap and whose outer factors are neighbour swaps. Checking that identity is a comparison of values at the three points involved, everything else being fixed by all three factors.

Proof.

By the theorem on factorisation into transpositions it is enough to write a single transposition (a b)(a \ b), with a<ba < b, as a product of neighbour swaps. Write b=a+db = a + d with d∈Nd \in \mathbb{N} and induct on dd.

If d=1d = 1 then (a b)(a \ b) is itself a neighbour swap.

Suppose the claim holds for dd, and let b=a+s(d)b = a + s(d), so that b−1=a+db - 1 = a + d and a<b−1<ba < b - 1 < b. Put π=def(b−1  b)\pi \defeq (b-1 \ \ b). We claim (a b)=π(a  b−1)π(a \ b) = \pi (a \ \ b-1) \pi. Evaluating the right-hand side from the right: aa is fixed by π\pi, sent to b−1b-1 by the middle factor, and sent to bb by the last, so a↦ba \mapsto b. The point bb is sent to b−1b-1 by the first factor, then to aa by the middle, and aa is fixed by the last, so b↦ab \mapsto a. The point b−1b-1 is sent to bb by the first factor, fixed by the middle, and returned to b−1b-1 by the last, so b−1↦b−1b - 1 \mapsto b-1. Every other point is fixed by all three factors. So the two sides agree everywhere.

The middle factor (a  b−1)(a \ \ b-1) has gap dd and is a product of neighbour swaps by the inductive hypothesis, and π\pi is a neighbour swap, so (a b)(a \ b) is a product of neighbour swaps.

Theorem 8.42 (Properties of the sign).

Let σ,λ∈Sn\sigma, \lambda \in S_n with n⩾2n \geqslant 2.

  1. sgn(σλ)=(sgn σ)(sgn λ)\mathrm{sgn}(\sigma\lambda) = (\mathrm{sgn}\,\sigma)(\mathrm{sgn}\,\lambda).
  2. Every transposition is odd.
  3. If σ\sigma is a product of mm transpositions, then sgn σ=1\mathrm{sgn}\,\sigma = 1 when mm is even and sgn σ=−1\mathrm{sgn}\,\sigma = -1 when mm is odd.

Discussion.

Three claims about the parity of rr. The first says that the parity of r(σλ)r(\sigma\lambda) is settled by the parities of r(σ)r(\sigma) and r(λ)r(\lambda), and we use the proposition on neighbour swaps together with the proposition that neighbour swaps suffice: writing λ\lambda as a product of mm neighbour swaps and multiplying them onto σ\sigma one at a time flips the parity mm times, so the parity of r(σλ)r(\sigma\lambda) is that of r(σ)r(\sigma) shifted by mm; taking σ\sigma to be the identity, whose count is 00, identifies the parity of mm with the parity of λ\lambda, and the two statements together are the claim. The second is a direct count of reversals for (a b)(a \ b), sorting the 22-subsets by whether they meet {a,b}\{a, b\} and where their other point lies; the answer is one more than an even number. The third is then an induction on mm using the first two.

Proof.

For the first, write λ=π1π2⋯πm\lambda = \pi_1 \pi_2 \cdots \pi_m as a product of neighbour swaps. Then

σλ=(⋯((σπ1)π2)⋯ )πm,\sigma\lambda = \bigl(\cdots((\sigma\pi_1)\pi_2)\cdots\bigr)\pi_m,

by associativity, and each of the mm steps changes the parity of the reversal count, by the proposition on neighbour swaps. So r(σλ)r(\sigma\lambda) has the parity of r(σ)r(\sigma) when mm is even and the opposite parity when mm is odd. Taking σ=id\sigma = \mathrm{id}, where r(id)=0r(\mathrm{id}) = 0 is even, shows that λ\lambda is even exactly when mm is even. Combining the two: σλ\sigma\lambda has the parity of σ\sigma when λ\lambda is even and the opposite when λ\lambda is odd, which in the sign notation is the stated product rule.

For the second, let τ=(a b)\tau = (a \ b) with a<ba < b, and sort the 22-subsets of ⟨n⟩\langle n \rangle. One meeting neither aa nor bb is not reversed, since τ\tau fixes both its points. The subset {a,b}\{a, b\} is reversed, since τ(b)=a<b=τ(a)\tau(b) = a < b = \tau(a). A subset {c,a}\{c, a\} or {c,b}\{c, b\} with c∉{a,b}c \notin \{a, b\} is reversed exactly when cc lies strictly between aa and bb: if c<ac < a or b<cb < c then cc keeps its position relative to both, and if a<c<ba < c < b then {a,c}\{a, c\} is reversed because τ(c)=c\tau(c) = c while τ(a)=b>c\tau(a) = b > c, and {c,b}\{c, b\} is reversed because τ(b)=a<c\tau(b) = a < c. So each such cc contributes two reversals and nothing else contributes, giving

r(τ)=1+2⋅#{c∈⟨n⟩∣a<c<b},r(\tau) = 1 + 2 \cdot \#\{c \in \langle n \rangle \mid a < c < b\},

which is odd.

For the third, induct on mm. At m=1m = 1 the claim is the second part. Suppose it holds for mm and let σ=τ1⋯τs(m)\sigma = \tau_1 \cdots \tau_{s(m)}. Then σ=(τ1⋯τm)τs(m)\sigma = (\tau_1 \cdots \tau_m)\tau_{s(m)}, so by the first two parts

sgn σ=sgn(τ1⋯τm)⋅(−1),\mathrm{sgn}\,\sigma = \mathrm{sgn}(\tau_1 \cdots \tau_m) \cdot (-1),

which changes the value from 11 to −1-1 or from −1-1 to 11 exactly as the parity of mm changes to the parity of s(m)s(m).

Corollary 8.43 (The number of transposition factors has a fixed parity).

If σ=τ1⋯τm=τ1′⋯τm′′\sigma = \tau_1 \cdots \tau_m = \tau'_1 \cdots \tau'_{m'} are two factorisations of the same σ∈Sn\sigma \in S_n into transpositions, then mm and m′m' are both even or both odd.

Proof.

The third part of the theorem computes sgn σ\mathrm{sgn}\,\sigma from each factorisation, giving 11 when the number of factors is even and −1-1 when it is odd. Since sgn σ\mathrm{sgn}\,\sigma is one value, mm and m′m' cannot have different parities.

An rr-cycle is a product of r−1r - 1 transpositions, by the factorisation exhibited above, so

sgn (a1 ⋯ ar)=1 if r is odd,sgn (a1 ⋯ ar)=−1 if r is even.\mathrm{sgn}\,(a_1 \ \cdots \ a_r) = 1 \text{ if } r \text{ is odd}, \qquad \mathrm{sgn}\,(a_1 \ \cdots \ a_r) = -1 \text{ if } r \text{ is even}.

A cycle of odd length is even and a cycle of even length is odd, which reads perversely until one remembers that the length counts points and the sign counts swaps. For a product of cycles of lengths r1,…,rtr_1, \ldots, r_t, disjoint or not, the first part of the theorem multiplies the signs together, so the product is even exactly when an even number of the rir_i are even.

Example 8.44 (Computing the sign).

For

σ=(1234531524)=(1 3 5 4 2),\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 \\ 3 & 1 & 5 & 2 & 4 \end{pmatrix} = (1 \ 3 \ 5 \ 4 \ 2),

a single cycle of length five, the sign is 11 and σ\sigma is even. For

λ=(123456789101112319784652121110)=(1 3 9 2)(4 7 6)(5 8)(10 12),\lambda = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\ 3 & 1 & 9 & 7 & 8 & 4 & 6 & 5 & 2 & 12 & 11 & 10 \end{pmatrix} = (1 \ 3 \ 9 \ 2)(4 \ 7 \ 6)(5 \ 8)(10 \ 12),

three of the four lengths are even, namely 44, 22 and 22, so three of the four factors are odd and sgn λ=−1\mathrm{sgn}\,\lambda = -1.

Remark (Parity as an obstruction).

Any sequence of exchanges of two of nn labelled objects is a product of transpositions in SnS_n. If the rearrangement one is aiming at is odd, then no even number of exchanges reaches it, and if it is even, no odd number does. So parity rules out many proposed sequences of exchanges without examining the intermediate states: one only computes the sign of the target rearrangement.

Problem 8.18.

Write

σ=(1234567891067105821439)\sigma = \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ 6 & 7 & 10 & 5 & 8 & 2 & 1 & 4 & 3 & 9 \end{pmatrix}

as a product of disjoint cycles and then as a product of transpositions, and compute sgn σ\mathrm{sgn}\,\sigma in both ways.

Problem 8.19.

Show that the even permutations in SnS_n are closed under products and under inverses, and that the odd ones are closed under neither.

Problem 8.20.

Let n⩾2n \geqslant 2. Show that the even permutations in SnS_n and the odd ones are equinumerous, by fixing a transposition τ\tau and considering the map σ↦τσ\sigma \mapsto \tau\sigma. Conclude that #Sn\#S_n is twice the number of even permutations.

Problem 8.21.

Let σ∈Sn\sigma \in S_n. Show that σ\sigma is a product of r(σ)r(\sigma) transpositions of the form (k  k+1)(k \ \ k+1) with k<nk < n, and that no product of fewer such transpositions equals σ\sigma.

Problem 8.22.

Let n⩾2n \geqslant 2. Show that every permutation in SnS_n is a product of transpositions of the form (1 k)(1 \ k) with 1<k⩽n1 < k \leqslant n, and that every permutation in SnS_n is a product of factors each equal to (1 2)(1 \ 2) or to (1 2 ⋯ n)(1 \ 2 \ \cdots \ n).

Problem 8.23.

Fifteen tiles numbered 11 to 1515 lie in a 4×44 \times 4 frame with one cell empty, and a move slides into the empty cell a tile from a cell sharing an edge with it. Decide whether a sequence of moves carries the first arrangement below to the second, and prove your answer.

1234567891011121314150015141312111098765432100\begin{array}{|c|c|c|c|} \hline 1 & 2 & 3 & 4 \\ \hline 5 & 6 & 7 & 8 \\ \hline 9 & 10 & 11 & 12 \\ \hline 13 & 14 & 15 & \phantom{00} \\ \hline \end{array} \qquad\qquad \begin{array}{|c|c|c|c|} \hline 15 & 14 & 13 & 12 \\ \hline 11 & 10 & 9 & 8 \\ \hline 7 & 6 & 5 & 4 \\ \hline 3 & 2 & 1 & \phantom{00} \\ \hline \end{array}

Binomial Coefficients

Counting the permutations of an nn-set asked in how many ways its points can be arranged. The remaining question of the chapter asks in how many ways they can be chosen: not how a set may be reordered, but how many subsets of a given size it has. The two questions are linked, because choosing kk points and then arranging them is the same as arranging kk of the nn points, and this gives the count of subsets as a quotient of factorials.

Counting Subsets

Definition 8.45 (Binomial coefficient).

Let n,k∈N0n, k \in \mathbb{N}_0 and let SS be an nn-set. The binomial coefficient (nk)\dbinom{n}{k}, read ”nn choose kk”, is the number of kk-subsets of SS:

(nk)=def#{A⊂S∣#A=k}.\binom{n}{k} \defeq \#\{A \subset S \mid \#A = k\}.

The definition names a set SS and the notation does not, so the first thing to check is that the count does not depend on which nn-set was taken. It does not: two nn-sets are equinumerous, and a bijection f:S→S′f : S \to S' carries kk-subsets to kk-subsets in both directions, since the image of a kk-subset under an injection is a kk-subset and f−1f^{-1} undoes it. The count is also finite, since the kk-subsets form a subset of the finite set P(S)\mathcal{P}(S).

Theorem 8.46 (Basic properties of binomial coefficients).

Let n,k∈N0n, k \in \mathbb{N}_0. Then

  1. (n0)=1\dbinom{n}{0} = 1 and (nn)=1\dbinom{n}{n} = 1;
  2. (nk)=0\dbinom{n}{k} = 0 whenever n<kn < k;
  3. (nk)=(nn−k)\dbinom{n}{k} = \dbinom{n}{n - k} whenever k⩽nk \leqslant n;
  4. (n1)=n\dbinom{n}{1} = n, and (nn−1)=n\dbinom{n}{n-1} = n when n⩾1n \geqslant 1;
  5. ∑k=0n(nk)=2n\displaystyle\sum_{k=0}^{n} \binom{n}{k} = 2^n.

Discussion.

The first four parts follow from the definition, by naming the subsets counted. For the first, the empty set is the one 00-subset of anything and SS is the one nn-subset of itself, both by cardinality classifying finite sets. The second is the theorem on subsets of a finite set, which forbids a subset larger than the whole. The third is an equality of two counts, so it asks for a bijection between the two collections, and complementation is one, being its own inverse. The fourth counts singletons and then applies the third. The fifth is different: it is a statement about a sum, so we partition P(S)\mathcal{P}(S) by cardinality — the classes are pairwise disjoint and cover it, since every subset of a finite set is finite with exactly one cardinality — and add the pieces up with the cardinality of a disjoint union, the total being 2n2^n by the problem on power sets.

Proof.

Fix an nn-set SS.

For the first, a 00-subset is equinumerous with ∅\emptyset and hence empty, so ∅\emptyset is the only one; an nn-subset A⊂SA \subset S has #A=#S\#A = \#S, so A=SA = S by the theorem on subsets of a finite set, which makes a proper subset strictly smaller.

For the second, a kk-subset A⊂SA \subset S would give k=#A⩽#S=nk = \#A \leqslant \#S = n by that theorem, contradicting n<kn < k; so there are none.

For the third, A↦S∖AA \mapsto S \setminus A sends kk-subsets to (n−k)(n-k)-subsets, by the cardinality of a disjoint union applied to S=A∪(S∖A)S = A \cup (S \setminus A), and it is its own inverse, hence a bijection between the two collections. Equinumerous finite sets have equal cardinality.

For the fourth, x↦{x}x \mapsto \{x\} is a bijection from SS onto the collection of 11-subsets, so (n1)=n\dbinom{n}{1} = n; the third part then gives (nn−1)=n\dbinom{n}{n-1} = n.

For the fifth, every subset of SS is finite with exactly one cardinality, and that cardinality is at most nn by the theorem on subsets of a finite set, so the collections of kk-subsets for k=0,1,…,nk = 0, 1, \ldots, n are pairwise disjoint and their union is P(S)\mathcal{P}(S). Adding their cardinalities gives

∑k=0n(nk)=#P(S)=2n,\sum_{k=0}^{n} \binom{n}{k} = \#\mathcal{P}(S) = 2^n,

the last equality being the problem on the cardinality of a power set.

The link between choosing and arranging is made by counting the injections between two finite sets, so we count them first.

Proposition 8.47 (Counting injections).

Let AA be a kk-set and BB an nn-set with k⩽nk \leqslant n. Then the number of injections A→BA \to B is

n(n−1)⋯(n−k+1),n(n-1)\cdots(n-k+1),

the product of the kk numbers running down from nn.

Discussion.

A count again. An injection is built by choosing values one point at a time, and each choice removes one candidate from the target, so we induct on kk, with nn fixed and BB fixed. At k=0k = 0 the domain is empty, the empty function is the only function and it is injective, and the empty product is 11. For the step we split the injections from a s(k)s(k)-set according to the value taken at a chosen point aa: the pieces are pairwise disjoint and cover, there are nn of them, and each is matched by restriction with the injections from a kk-set into a set with one point removed, which the inductive hypothesis counts. Adding nn equal pieces is the cardinality of a product, and the arithmetic gives the next factor down because the removed point shrinks the target from nn to n−1n - 1 and shifts every factor.

Proof.

Induct on kk, the claim being taken for all n⩾kn \geqslant k and all nn-sets BB at once.

If k=0k = 0 then A=∅A = \emptyset, the empty function is the unique function A→BA \to B and is injective, and the empty product is 11.

Suppose the claim holds for kk and let #A=s(k)⩽n\#A = s(k) \leqslant n. Fix a∈Aa \in A and, for b∈Bb \in B, let IbI_b be the set of injections f:A→Bf : A \to B with f(a)=bf(a) = b. Every injection lies in exactly one IbI_b. Restriction to A∖{a}A \setminus \{a\} matches IbI_b with the injections from that kk-set into B∖{b}B \setminus \{b\}, an (n−1)(n-1)-set: an injection cannot take the value bb anywhere else, so the restriction lands there, and every injection A∖{a}→B∖{b}A \setminus \{a\} \to B \setminus \{b\} extends to exactly one member of IbI_b. By the inductive hypothesis,

#Ib=(n−1)(n−2)⋯(n−1−k+1)=(n−1)⋯(n−k).\#I_b = (n-1)(n-2)\cdots(n-1-k+1) = (n-1)\cdots(n-k).

Summing over the nn values of bb, the number of injections A→BA \to B is

n⋅(n−1)⋯(n−k)=n(n−1)⋯(n−s(k)+1),n \cdot (n-1)\cdots(n-k) = n(n-1)\cdots\bigl(n - s(k) + 1\bigr),

which is the claim at s(k)s(k).

Theorem 8.48 (Factorial formula for binomial coefficients).

Let n,k∈N0n, k \in \mathbb{N}_0 with k⩽nk \leqslant n. Then

(nk)⋅k!⋅(n−k)!=n!.\binom{n}{k} \cdot k! \cdot (n-k)! = n!.

Discussion.

The claim is an identity between products of natural numbers, and the method is to count one set in two ways and equate the answers. The set is the collection of injections from a kk-set DD into an nn-set SS. Counted directly, the previous proposition gives the descending product. Counted by what an injection is made of, an injection is an image together with a bijection onto it: the image is a kk-subset of SS, of which there are (nk)\dbinom{n}{k}, and the bijections from DD onto a fixed kk-subset number k!k! by the theorem on the number of bijections. Equating the two answers gives (nk) k!\dbinom{n}{k}\, k! equal to the descending product, and multiplying by (n−k)!(n-k)! completes the descending product to n!n!, which is the displayed identity.

Proof.

Fix an nn-set SS and a kk-set DD, and let II be the set of injections D→SD \to S. By the proposition on counting injections,

#I=n(n−1)⋯(n−k+1).\#I = n(n-1)\cdots(n-k+1).

Count II a second way. Each f∈If \in I determines its image f(D)f(D), a kk-subset of SS, and is a bijection from DD onto that image, by an injection onto its range. Conversely a kk-subset B⊂SB \subset S together with a bijection D→BD \to B determines an f∈If \in I, and different pairs give different injections. There are (nk)\dbinom{n}{k} choices of BB and, for each, exactly k!k! bijections D→BD \to B by the theorem on the number of bijections. So

#I=(nk)⋅k!.\#I = \binom{n}{k} \cdot k!.

Equating and multiplying both sides by (n−k)!(n-k)!,

(nk)⋅k!⋅(n−k)!=n(n−1)⋯(n−k+1)⋅(n−k)!=n!,\binom{n}{k} \cdot k! \cdot (n-k)! = n(n-1)\cdots(n-k+1) \cdot (n-k)! = n!,

the last step because the descending product and (n−k)!(n-k)! between them use each of the factors n,n−1,…,1n, n-1, \ldots, 1 exactly once. When k=0k = 0 both sides are n!n!, so the identity holds there too.

Remark.

The identity is normally written as a quotient,

(nk)=n!k! (n−k)!,\binom{n}{k} = \frac{n!}{k!\,(n-k)!},

and we shall write it that way below. The division is exact by the theorem, and we allow it on the same terms as subtraction: whenever the answer lies in N0\mathbb{N}_0. For computing a single coefficient by hand the descending product is faster,

(nk)=n(n−1)⋯(n−k+1)k!,\binom{n}{k} = \frac{n(n-1)\cdots(n-k+1)}{k!},

while the two-factorial form is the better one to manipulate.

Theorem 8.49 (Pascal's identity).

Let n,k∈Nn, k \in \mathbb{N} with k⩽nk \leqslant n. Then

(nk)=(n−1k)+(n−1k−1).\binom{n}{k} = \binom{n-1}{k} + \binom{n-1}{k-1}.

Discussion.

The claim is that one count equals a sum of two counts, and a sum of counts comes from a partition of the set being counted. So we fix an nn-set SS, single out a point xx of it, and sort the kk-subsets of SS by whether they contain xx: two collections, disjoint and exhaustive. Those avoiding xx are exactly the kk-subsets of the (n−1)(n-1)-set S∖{x}S \setminus \{x\}, which is the first term. Those containing xx are matched with the (k−1)(k-1)-subsets of S∖{x}S \setminus \{x\} by removing xx, a map undone by putting it back, which is the second. The cardinality of a disjoint union adds them.

Proof.

Let SS be an nn-set, fix x∈Sx \in S and put S0=defS∖{x}S_0 \defeq S \setminus \{x\}, an (n−1)(n-1)-set.

A kk-subset of SS either contains xx or does not, and not both. Those that do not are precisely the kk-subsets of S0S_0, and there are (n−1k)\dbinom{n-1}{k} of them.

Those that do are precisely the sets A∪{x}A \cup \{x\} with AA a (k−1)(k-1)-subset of S0S_0: removing xx from such a subset leaves a subset of S0S_0 of cardinality k−1k - 1, by the corollary on removing a point, and adjoining xx to a (k−1)(k-1)-subset of S0S_0 returns it. So there are (n−1k−1)\dbinom{n-1}{k-1} of them.

The two collections are disjoint and their union is the collection of all kk-subsets of SS, so their cardinalities add to (nk)\dbinom{n}{k}.

Pascal’s identity together with the boundary values (n0)=(nn)=1\dbinom{n}{0} = \dbinom{n}{n} = 1 determines every binomial coefficient without any factorials at all, each from two earlier ones. Setting the values out in rows indexed by nn, with kk running left to right, gives Pascal’s triangle:

111121133114641151010511615201561172135352171\begin{array}{cccccccc} 1 & & & & & & & \\ 1 & 1 & & & & & & \\ 1 & 2 & 1 & & & & & \\ 1 & 3 & 3 & 1 & & & & \\ 1 & 4 & 6 & 4 & 1 & & & \\ 1 & 5 & 10 & 10 & 5 & 1 & & \\ 1 & 6 & 15 & 20 & 15 & 6 & 1 & \\ 1 & 7 & 21 & 35 & 35 & 21 & 7 & 1 \end{array}

Each interior entry is the sum of the two entries above it, one directly above and one to the left of that, which is Pascal’s identity. The rows add to 1,2,4,8,…1, 2, 4, 8, \ldots, which is the fifth part of the theorem on basic properties, and each row is a palindrome, which is the third.

Example 8.50 (Two small counts).

The number of 22-subsets of a 1010-set is

(102)=10⋅92=45,\binom{10}{2} = \frac{10 \cdot 9}{2} = 45,

and the number of 33-subsets is

(103)=10⋅9⋅86=120.\binom{10}{3} = \frac{10 \cdot 9 \cdot 8}{6} = 120.

Example 8.51 (Shortest routes).

On a grid of streets mm blocks tall and nn blocks wide, a shortest walk from the bottom left corner to the top right uses m+nm + n blocks, of which mm are walked upwards and nn across. Such a walk is settled by saying which nn of its m+nm + n steps are the ones across, so there are (m+nn)\dbinom{m+n}{n} shortest routes. On a square grid nn blocks each way there are (2nn)\dbinom{2n}{n}.

Problem 8.24.

Compute (123)\dbinom{12}{3}, (129)\dbinom{12}{9} and (120)\dbinom{12}{0} from the factorial formula, and check the first two against the symmetry (nk)=(nn−k)\dbinom{n}{k} = \dbinom{n}{n-k}.

Problem 8.25.

Prove the factorial formula a second time, by induction on nn with Pascal’s identity as the inductive step, treating k=0k = 0 and k=nk = n separately.

Problem 8.26.

How many 55-subsets does a 5252-set have? If the 5252-set is partitioned into four 1313-sets, how many of those 55-subsets lie inside a single part?

Identities and the Binomial Theorem

Theorem 8.52 (Absorption).

Let n,k∈Nn, k \in \mathbb{N} with k⩽nk \leqslant n. Then

k(nk)=n(n−1k−1).k \binom{n}{k} = n \binom{n-1}{k-1}.

Discussion.

An identity between two products, so again we count one set in two ways. The set is the collection of pairs (x,B)(x, B) in which BB is a kk-subset of an nn-set SS and xx is a point of BB — a committee together with its chair, if one likes. Choosing the committee first and then the chair from within it gives (nk)\dbinom{n}{k} followed by kk, which is the left-hand side; choosing the chair first from all of SS and then the rest of the committee from what remains gives nn followed by (n−1k−1)\dbinom{n-1}{k-1}, which is the right. Each count is an application of the cardinality of a product to a partition of the same collection, sorted the two different ways. The factorial formula gives a second proof by cancellation, and we record that as well.

Proof.

Let SS be an nn-set and let PP be the set of pairs (x,B)(x, B) with BB a kk-subset of SS and x∈Bx \in B.

Sorting PP by its second coordinate, each of the (nk)\dbinom{n}{k} possible BB occurs in exactly kk pairs, one for each of its points, so #P=(nk)⋅k\#P = \dbinom{n}{k} \cdot k.

Sorting PP by its first coordinate, each of the nn possible xx occurs in one pair for each kk-subset containing xx; those are the sets A∪{x}A \cup \{x\} with AA a (k−1)(k-1)-subset of S∖{x}S \setminus \{x\}, as in the proof of Pascal’s identity, so there are (n−1k−1)\dbinom{n-1}{k-1} of them. Hence #P=n⋅(n−1k−1)\#P = n \cdot \dbinom{n-1}{k-1}.

Equating the two gives the identity. Alternatively, from the factorial formula,

k(nk)=k⋅n!k! (n−k)!=n⋅(n−1)!(k−1)! (n−k)!=n(n−1k−1).k \binom{n}{k} = \frac{k \cdot n!}{k!\,(n-k)!} = \frac{n \cdot (n-1)!}{(k-1)!\,(n-k)!} = n\binom{n-1}{k-1}.

Theorem 8.53 (The hockey-stick identity).

Let m,n∈N0m, n \in \mathbb{N}_0. Then

∑k=0n(m+kk)=(m+n+1n).\sum_{k=0}^{n} \binom{m+k}{k} = \binom{m+n+1}{n}.

Discussion.

The left-hand side is a sum whose number of terms depends on nn, so the proof is an induction on nn with mm held fixed. At n=0n = 0 both sides are 11, by the first part of the theorem on basic properties. The step adds one term to the sum: the inductive hypothesis replaces everything before it by a single coefficient, and what is left is a sum of two coefficients to which Pascal’s identity applies. So the whole argument is one application of the inductive hypothesis followed by one application of Pascal, and the only care needed is in matching the indices.

Proof.

Fix mm and induct on nn. At n=0n = 0 the sum has the single term (m0)=1\dbinom{m}{0} = 1, and the right-hand side is (m+10)=1\dbinom{m+1}{0} = 1.

Suppose the identity holds at nn. Then

∑k=0n+1(m+kk)=(∑k=0n(m+kk))+(m+n+1n+1)=(m+n+1n)+(m+n+1n+1)=(m+n+2n+1),\begin{aligned} \sum_{k=0}^{n+1} \binom{m+k}{k} &= \left(\sum_{k=0}^{n} \binom{m+k}{k}\right) + \binom{m+n+1}{n+1} \\ &= \binom{m+n+1}{n} + \binom{m+n+1}{n+1} \\ &= \binom{m+n+2}{n+1}, \end{aligned}

the second line by the inductive hypothesis and the third by Pascal’s identity, applied with upper index m+n+2m+n+2 and lower index n+1n+1.

Remark.

The name records the shape the summed entries make in Pascal’s triangle: they run down one diagonal and the answer sits one place off the end, like the blade at the foot of a stick.

A binomial is a sum of two terms, and expanding a power of one produces the binomial coefficients as the coefficients of the resulting terms. That is where the name comes from.

Theorem 8.54 (The binomial theorem).

Let a,b∈N0a, b \in \mathbb{N}_0 and let n∈N0n \in \mathbb{N}_0. Then

(a+b)n=∑k=0n(nk)akbn−k.(a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^k b^{n-k}.

Discussion.

Behind the statement is a count: multiplying out nn copies of a+ba + b produces one term for each way of taking aa from some of the copies and bb from the rest, so akbn−ka^k b^{n-k} appears once for each kk-subset of the copies, which is (nk)\dbinom{n}{k} times. That is the reason the theorem is true, but it is not yet a proof, because “multiplying out” is not among our operations. What we have is the recursion defining powers, so the proof is an induction on nn: multiply the inductive hypothesis by a+ba + b, distribute, and reassemble. Pascal’s identity appears in the reassembly: after shifting the index of one of the two sums so that both run over the same power of aa, the two coefficients standing in front of each term are (nk−1)\dbinom{n}{k-1} and (nk)\dbinom{n}{k}, which Pascal’s identity adds to the coefficient wanted at n+1n+1.

Proof.

Induct on nn. At n=0n = 0 both sides are 11, the left because x0=1x^0 = 1 and the right because the only term is (00)a0b0\dbinom{0}{0}a^0b^0.

Suppose the identity holds at nn. Then, distributing,

(a+b)n+1=(a+b)∑k=0n(nk)akbn−k=∑k=0n(nk)ak+1bn−k+∑k=0n(nk)akbn−k+1.(a+b)^{n+1} = (a + b)\sum_{k=0}^{n} \binom{n}{k} a^k b^{n-k} = \sum_{k=0}^{n} \binom{n}{k} a^{k+1} b^{n-k} + \sum_{k=0}^{n} \binom{n}{k} a^{k} b^{n-k+1}.

In the first sum put j=defk+1j \defeq k + 1, so that jj runs from 11 to n+1n+1:

∑k=0n(nk)ak+1bn−k=∑j=1n+1(nj−1)ajbn+1−j.\sum_{k=0}^{n} \binom{n}{k} a^{k+1} b^{n-k} = \sum_{j=1}^{n+1} \binom{n}{j-1} a^{j} b^{n+1-j}.

Renaming jj as kk and separating the terms an+1a^{n+1} and bn+1b^{n+1}, which occur in only one of the two sums each,

(a+b)n+1=an+1+∑k=1n((nk−1)+(nk))akbn+1−k+bn+1=an+1+∑k=1n(n+1k)akbn+1−k+bn+1=∑k=0n+1(n+1k)akbn+1−k,\begin{aligned} (a+b)^{n+1} &= a^{n+1} + \sum_{k=1}^{n}\left(\binom{n}{k-1} + \binom{n}{k}\right) a^k b^{n+1-k} + b^{n+1} \\ &= a^{n+1} + \sum_{k=1}^{n} \binom{n+1}{k} a^k b^{n+1-k} + b^{n+1} \\ &= \sum_{k=0}^{n+1} \binom{n+1}{k} a^k b^{n+1-k}, \end{aligned}

by Pascal’s identity, and the two separated terms are the cases k=n+1k = n+1 and k=0k = 0 since (n+1n+1)=(n+10)=1\dbinom{n+1}{n+1} = \dbinom{n+1}{0} = 1.

Remark (Where the theorem applies).

The proof uses nothing about aa and bb beyond the commutative, associative and distributive laws and the recursion defining powers. So it holds verbatim wherever those laws hold — for the real numbers of school algebra, and for expressions in an unknown — and that is how it is used in practice. We have stated it in N0\mathbb{N}_0 because that is the arithmetic built so far.

Corollary 8.55 (Sum of the binomial coefficients, again).

For every n∈N0n \in \mathbb{N}_0,

∑k=0n(nk)=2n.\sum_{k=0}^{n} \binom{n}{k} = 2^n.

Proof.

Put a=b=1a = b = 1 in the binomial theorem: every term akbn−ka^k b^{n-k} is 11, and the left-hand side is 2n2^n.

That is the fifth part of the theorem on basic properties, proved a second time and by quite a different route: the first proof partitioned the power set, and this one multiplies out a product. The first proof and the corollary together give a proof that #P(S)=2n\#\mathcal{P}(S) = 2^n, running in the opposite direction to the one the problem asked for.

Example 8.56 (A single coefficient).

Working in school algebra, where the theorem applies by the remark above, the coefficient of x6x^6 in (x−3)11(x - 3)^{11} is the coefficient of x6x^6 in

∑k=011(11k)xk(−3)11−k,\sum_{k=0}^{11} \binom{11}{k} x^k (-3)^{11-k},

namely (116)(−3)5=462⋅(−243)=−112,266\dbinom{11}{6}(-3)^5 = 462 \cdot (-243) = -112{,}266. Only one term of twelve is needed.

Problem 8.27.

Show that for every n∈Nn \in \mathbb{N} the binomial coefficients with even lower index add to the same total as those with odd lower index, and that each total is 2n−12^{n-1}.

Problem 8.28.

Expand (1+x)n(1+x)m(1+x)^n(1+x)^m in two ways and compare the coefficients of xrx^r to obtain Vandermonde’s identity

(n+mr)=∑k=0r(nk)(mr−k),\binom{n+m}{r} = \sum_{k=0}^{r} \binom{n}{k}\binom{m}{r-k},

for n,m∈N0n, m \in \mathbb{N}_0 and r⩽n+mr \leqslant n + m, reading (ab)\dbinom{a}{b} as 00 when a<ba < b. Then prove the same identity by counting the rr-subsets of a set split into an nn-set and an mm-set.

Problem 8.29.

Show that (nk)<(nk+1)\dbinom{n}{k} < \dbinom{n}{k+1} exactly when 2k+1<n2k + 1 < n, and read off from that where a row of Pascal’s triangle attains its largest entry, treating n=2mn = 2m and n=2m+1n = 2m+1 separately. The absorption identity compares consecutive entries of a row.

Problem 8.30.

Show that

n(2n−1n−1)=∑k=1nk(nk)2n\binom{2n-1}{n-1} = \sum_{k=1}^{n} k\binom{n}{k}^2

for every n∈Nn \in \mathbb{N}.

Multinomial Coefficients

A binomial coefficient counts the ways of cutting an nn-set into two labelled pieces of prescribed sizes: a kk-subset and everything else. The same works with more than two pieces.

Definition 8.57 (Multinomial coefficient).

Let n∈N0n \in \mathbb{N}_0, let t∈Nt \in \mathbb{N}, and let r1,…,rt∈N0r_1, \ldots, r_t \in \mathbb{N}_0 with r1+⋯+rt=nr_1 + \cdots + r_t = n. Let SS be an nn-set. The multinomial coefficient

(nr1,r2,…,rt)\binom{n}{r_1, r_2, \ldots, r_t}

is the number of tt-tuples (S1,…,St)(S_1, \ldots, S_t) of pairwise disjoint subsets of SS with S1∪⋯∪St=SS_1 \cup \cdots \cup S_t = S and #Si=ri\#S_i = r_i for each ii. Empty pieces are allowed, when some rir_i is 00.

The pieces are labelled by their position in the tuple, so two tuples listing the same pieces in a different order are different objects; the same convention was already in force for binomial coefficients, where the kk-subset was distinguished from its complement. Equivalently, such a tuple assigns each point of SS to one of tt labelled bins, with bin ii receiving rir_i points.

At t=2t = 2 the definition returns the binomial coefficient, since a pair (S1,S2)(S_1, S_2) of the required kind is settled by S1S_1 alone:

(nk, n−k)=(nk).\binom{n}{k, \, n-k} = \binom{n}{k}.

Theorem 8.58 (Factorial formula for multinomial coefficients).

Let r1+⋯+rt=nr_1 + \cdots + r_t = n with each ri∈N0r_i \in \mathbb{N}_0. Then

(nr1,r2,…,rt)⋅r1! r2!⋯rt!=n!.\binom{n}{r_1, r_2, \ldots, r_t} \cdot r_1!\, r_2! \cdots r_t! = n!.

Discussion.

Once more we count one set two ways, and the set is the collection of listings of an nn-set SS — that is, of bijections ⟨n⟩→S\langle n \rangle \to S. Counted directly there are n!n! of them, by the theorem on the number of bijections. Counted by construction, a listing is assembled from a tuple of the kind the coefficient counts, together with an ordering inside each piece: read the first r1r_1 entries of the listing as the first piece in order, the next r2r_2 as the second, and so on. That correspondence is reversible, so the number of listings is the number of tuples multiplied by r1!r_1! through rt!r_t!, one factor for each piece by the theorem on the number of bijections again. Equating the two counts is the identity.

Proof.

Let SS be an nn-set. The listings of SS, meaning the bijections ⟨n⟩→S\langle n \rangle \to S, number n!n!.

Given a listing hh, cut ⟨n⟩\langle n \rangle into the consecutive blocks of lengths r1,…,rtr_1, \ldots, r_t and let SiS_i be the image of the ii-th block. The blocks are pairwise disjoint and cover ⟨n⟩\langle n \rangle, so the SiS_i are pairwise disjoint and cover SS, and #Si=ri\#S_i = r_i since hh is injective. The listing also determines an ordering of each SiS_i, namely the order in which its points appear.

Conversely a tuple (S1,…,St)(S_1, \ldots, S_t) of the required kind, together with an ordering of each SiS_i, reassembles into exactly one listing, by writing the pieces out one after another. So the listings correspond to such data, and there are (nr1,…,rt)\dbinom{n}{r_1, \ldots, r_t} tuples with ri!r_i! orderings of the ii-th piece for each. Hence

n!=(nr1,…,rt)⋅r1!⋯rt!,n! = \binom{n}{r_1, \ldots, r_t} \cdot r_1! \cdots r_t!,

where a piece with ri=0r_i = 0 contributes the factor 0!=10! = 1.

Remark.

As before we write the identity as a quotient,

(nr1,…,rt)=n!r1! r2!⋯rt!,\binom{n}{r_1, \ldots, r_t} = \frac{n!}{r_1!\,r_2! \cdots r_t!},

the division being exact by the theorem. The multinomial coefficient can also be built from binomial ones by choosing the pieces in turn, which is the content of a problem below.

Example 8.59 (Assigning students to projects).

Nine students are to be assigned to three named projects needing four, two and three students. The assignments number

(94,2,3)=9!4! 2! 3!=1260.\binom{9}{4, 2, 3} = \frac{9!}{4!\,2!\,3!} = 1260.

Had the projects been unnamed and only their sizes fixed, the count would be different, since the pieces would no longer be distinguished by position.

Example 8.60 (A bag of shopping).

A bag is packed with four bananas, five tins of tuna, two boxes of cereal, four lemons, three bottles of cola and six light bulbs, twenty-four items in all, alike within each kind and distinguishable between kinds. The orders in which the bag can be packed number

(244,5,2,4,3,6)=24!4! 5! 2! 4! 3! 6!,\binom{24}{4, 5, 2, 4, 3, 6} = \frac{24!}{4!\,5!\,2!\,4!\,3!\,6!},

since an order is settled by saying which of the twenty-four positions each kind occupies.

Theorem 8.61 (The multinomial theorem).

Let x1,…,xt∈N0x_1, \ldots, x_t \in \mathbb{N}_0 and let n∈N0n \in \mathbb{N}_0. Then

(x1+⋯+xt)n=∑(nr1,…,rt) x1r1⋯xtrt,(x_1 + \cdots + x_t)^n = \sum \binom{n}{r_1, \ldots, r_t}\, x_1^{r_1} \cdots x_t^{r_t},

the sum running over all tt-tuples (r1,…,rt)(r_1, \ldots, r_t) in N0\mathbb{N}_0 with r1+⋯+rt=nr_1 + \cdots + r_t = n.

Discussion.

The statement generalises the binomial theorem from two summands to tt, and it is proved the same way, by induction on nn with the recursion for powers supplying the step. The bookkeeping is heavier because the terms are indexed by tuples rather than by a single number, so we describe the step first: multiplying by x1+⋯+xtx_1 + \cdots + x_t and distributing turns each term indexed by a tuple summing to nn into tt terms, one for each coordinate raised by one, and every tuple summing to n+1n+1 arises this way from exactly the tuples obtained by lowering one of its positive coordinates. Collecting like terms, the coefficient wanted at n+1n+1 is the sum of the coefficients at nn over those predecessors, and that sum identity is Pascal’s identity in its multinomial form, which the factorial formula supplies directly.

Proof.

Write Rn\mathcal{R}_n for the set of tt-tuples in N0\mathbb{N}_0 summing to nn. We first record the identity, for (r1,…,rt)∈Rn+1(r_1, \ldots, r_t) \in \mathcal{R}_{n+1},

(n+1r1,…,rt)=∑i : ri⩾1(nr1,…,ri−1,…,rt),\binom{n+1}{r_1, \ldots, r_t} = \sum_{i \,:\, r_i \geqslant 1} \binom{n}{r_1, \ldots, r_i - 1, \ldots, r_t},

which follows from the factorial formula: the ii-th summand is (n+1r1,…,rt)\dbinom{n+1}{r_1, \ldots, r_t} multiplied by rir_i and divided by n+1n+1, so the whole sum is (n+1r1,…,rt)\dbinom{n+1}{r_1, \ldots, r_t} multiplied by r1+⋯+rt=n+1r_1 + \cdots + r_t = n+1 and divided by n+1n+1.

Now induct on nn. At n=0n = 0 the only tuple is (0,…,0)(0, \ldots, 0) and both sides are 11.

Suppose the identity holds at nn. Multiplying by x1+⋯+xtx_1 + \cdots + x_t and distributing,

(x1+⋯+xt)n+1=∑(r1,…,rt)∈Rn(nr1,…,rt)∑i=1txi x1r1⋯xtrt.(x_1 + \cdots + x_t)^{n+1} = \sum_{(r_1, \ldots, r_t) \in \mathcal{R}_n} \binom{n}{r_1, \ldots, r_t} \sum_{i=1}^{t} x_i \, x_1^{r_1} \cdots x_t^{r_t}.

Each inner term is x1q1⋯xtqtx_1^{q_1} \cdots x_t^{q_t} for the tuple (q1,…,qt)∈Rn+1(q_1, \ldots, q_t) \in \mathcal{R}_{n+1} got from (r1,…,rt)(r_1, \ldots, r_t) by raising the ii-th coordinate by one; and conversely each tuple in Rn+1\mathcal{R}_{n+1} arises exactly once from each tuple got by lowering one of its positive coordinates. Collecting the terms belonging to a fixed (q1,…,qt)(q_1, \ldots, q_t), its coefficient is

∑i : qi⩾1(nq1,…,qi−1,…,qt)=(n+1q1,…,qt)\sum_{i \,:\, q_i \geqslant 1} \binom{n}{q_1, \ldots, q_i - 1, \ldots, q_t} = \binom{n+1}{q_1, \ldots, q_t}

by the recorded identity, which is the claim at n+1n+1.

Remark.

At t=2t = 2 the theorem is the binomial theorem and the recorded identity is Pascal’s, since a tuple (k,n−k)(k, n-k) has two coordinates to lower. The remark about where the binomial theorem applies carries over unchanged: the proof uses only the commutative, associative and distributive laws.

Example 8.62 (A term with no unknown in it).

Working in school algebra, a term of the expansion of

(x+y+z+1xyz)n\left(x + y + z + \frac{1}{xyz}\right)^{n}

has the form

xr1yr2zr3(1xyz)r4=xr1−r4yr2−r4zr3−r4x^{r_1} y^{r_2} z^{r_3} \left(\frac{1}{xyz}\right)^{r_4} = x^{r_1 - r_4} y^{r_2 - r_4} z^{r_3 - r_4}

with r1+r2+r3+r4=nr_1 + r_2 + r_3 + r_4 = n. All three exponents vanish exactly when r1=r2=r3=r4r_1 = r_2 = r_3 = r_4, which forces n=4kn = 4k and each ri=kr_i = k. So the constant term is (4kk,k,k,k)\dbinom{4k}{k, k, k, k} when nn is four times kk, and 00 otherwise.

Problem 8.31.

Show that

(nr1,…,rt)=(nr1)(n−r1r2)⋯(n−r1−⋯−rt−1rt)\binom{n}{r_1, \ldots, r_t} = \binom{n}{r_1}\binom{n - r_1}{r_2} \cdots \binom{n - r_1 - \cdots - r_{t-1}}{r_t}

whenever r1+⋯+rt=nr_1 + \cdots + r_t = n, by choosing the pieces one after another. Then check the identity a second time from the factorial formulas.

Problem 8.32.

How many distinct arrangements are there of the eleven letters of MISSISSIPPI\mathrm{MISSISSIPPI}? State the count as a multinomial coefficient before evaluating it.

Problem 8.33.

Expand (x+y+z)3(x + y + z)^3 by the multinomial theorem, and check the answer by multiplying the three factors out directly. How many terms does the expansion of (x1+⋯+xt)n(x_1 + \cdots + x_t)^n have, before like terms are collected, and how many after?

Problem 8.34.

Let n∈Nn \in \mathbb{N}. By counting the partitions of a 2n2n-set into 22-subsets, show that (n+1)(n+2)⋯(2n)(n+1)(n+2)\cdots(2n) is divisible by 2n2^n and not by 2n+12^{n+1}.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 8.1.

The coefficient of x6x^6 in (1+3x+x2)5(1 + 3x + x^2)^5 is:

answer one of these

Exercise 8.2.

The largest order of an element of S5S_5 is:

answer one of these

The largest order of an element of S9S_9 is:

answer one of these

An element of S10S_{10} of order 1414 is:

answer one of these

Exercise 8.3.

In S8S_8 let σ=(1 2)(3 4)(5 6 7)\sigma = (1 \ 2)(3 \ 4)(5 \ 6 \ 7) and τ=(2 8)(1 7)(3 4 5)\tau = (2 \ 8)(1 \ 7)(3 \ 4 \ 5).

The number of α∈S8\alpha \in S_8 with ατα−1=σ\alpha\tau\alpha^{-1} = \sigma is:

answer one of these

The number of α∈S8\alpha \in S_8 with ασ=σα\alpha\sigma = \sigma\alpha is:

answer one of these

Exercise 8.4.

For i∈N0i \in \mathbb{N}_0 let did_i be the number of permutations of an ii-set that move every point of it.

For n∈N0n \in \mathbb{N}_0, the sum ∑i=0n(ni)di\sum_{i=0}^{n} \binom{n}{i} d_i equals:

answer one of these

Exercise 8.5.

Let r⩾2r \geqslant 2 and n⩾r+1n \geqslant r + 1. The integers 1,…,r1, \ldots, r are placed in order, clockwise, at rr of nn positions spaced round a circle, so that no two consecutive integers, rr and 11 included, sit in adjacent positions. Arrangements that differ by a rotation of the circle count as the same.

The number of such arrangements is:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

This chapter asks four new things of the checker: the factorial and the binomial coefficient on N0\mathbb{N}_0, the powers of a map, a name for a permutation, and the transposition as a map in its own right. The arithmetic comes first, written the way the Peano sheet wrote addition.

Factorials and binomial coefficients

The factorial of Definition 8.8 is written n !, with a space, since n! is a single name to Lean. Like addition, it is not computed, and its two clauses are equations to rewrite with:

Nat.factorial_zero   0 ! = succ 0
Nat.factorial_succ   (succ n) ! = succ n * n !

The binomial coefficient choose n k of Definition 8.45 is a count of subsets, and the checker has no counts, so it takes instead what Theorem 8.46 and Theorem 8.49 proved about that count:

Nat.choose_zero_right     choose n 0 = succ 0
Nat.choose_eq_zero_of_lt  n < k → choose n k = 0
Nat.choose_succ_succ      choose (succ n) (succ k) = choose n k + choose n (succ k)

The last is Pascal’s identity with both indices moved up by one, so that no subtraction appears.

Example.

1!=11! = 1, from the two clauses and the arithmetic of the Peano sheet.

lean worked
1example : (succ 0) ! = succ 0 := by
verified
goalGoals accomplished.

Example.

A 11-subset of the empty set would be larger than the set it sits in.

lean worked
1example : choose 0 (succ 0) = 0 := by
verified
goalGoals accomplished.

Exercise 8.6.

The first part of Problem 8.4 .

lean proof
1example (n : ℕ) : (succ n) ! = n ! + n * n ! := by
goaln : ℕ ⊢ (succ n) ! = n ! + n * n !

Exercise 8.7.

The second half of the first part of Theorem 8.46 , this time from Pascal’s identity rather than by naming the one nn-subset.

lean proof
1example (n : ℕ) : choose n n = succ 0 := by
goaln : ℕ ⊢ choose n n = succ 0

Exercise 8.8.

The first half of its fourth part.

lean proof
1example (n : ℕ) : choose n (succ 0) = n := by
goaln : ℕ ⊢ choose n (succ 0) = n

Powers

The power σt\sigma^t of Definition 8.22 is written σ^[t], which is Lean’s own notation for a map composed with itself tt times. The recursion is not computed either, and its clauses are

Function.iterate_zero_apply   σ^[0] x = x
Function.iterate_succ_apply   σ^[succ t] x = σ^[t] (σ x)

the second being σs(t)=σtσ\sigma^{s(t)} = \sigma^t \sigma read at a point. The checker cannot form an inverse, so the laws set below are the ones that need none.

Example.

The first part of Theorem 8.24 , by induction on tt. The point xx is left under the quantifier so that the inductive hypothesis can be used at σx\sigma x. The result is listed below as Function.iterate_add_apply.

lean worked
1example (σ : Obj → Obj) (s t : ℕ) : ∀ x : Obj, σ^[s] (σ^[t] x) = σ^[s + t] x := by
verified
goalGoals accomplished.

Exercise 8.9.

The second part.

lean proof
1example (σ : Obj → Obj) (s t : ℕ) : ∀ x : Obj, (σ^[s])^[t] x = σ^[s * t] x := by
goalσ : Obj → Obj s t : ℕ ⊢ ∀ (x : Obj), σ^[s]^[t] x = σ^[s * t] x

Exercise 8.10.

The first half of Theorem 8.27 , with the division already made: kk is any exponent at which σ\sigma is the identity.

lean proof
1example (σ : Obj → Obj) (k q r : ℕ) (hk : ∀ x : Obj, σ^[k] x = x) :2    ∀ x : Obj, σ^[q * k + r] x = σ^[r] x := by
goalσ : Obj → Obj k q r : ℕ hk : ∀ (x : Obj), σ^[k] x = x ⊢ ∀ (x : Obj), σ^[q * k + r] x = σ^[r] x

Permutations and transpositions

Definition 8.1 is the last sheet’s BijOn with the two sets equal, and it is written

Perm σ A   is   BijOn σ A A

so obtain ⟨hm, hi, hs⟩ takes a permutation apart and refine ⟨?_, ?_, ?_⟩ builds one. An equation between two maps on a set is read at each point of the set, as equality of functions reads it.

The transposition (a b)(a \ b) is written swap a b. Its value at xx depends on whether xx is aa, bb or neither, and the checker cannot decide an equation between two objects, so its definition comes as three equations:

swap_apply_left          swap a b a = b
swap_apply_right         swap a b b = a
swap_apply_of_ne_of_ne   x ≠ a → x ≠ b → swap a b x = x

An argument about swap a b x for an unknown x goes by cases, and excluded middle supplies them: rcases Classical.em (x = a) with h | h leaves one goal with h : x = a and one with h : ¬x = a.

Example.

A transposition is its own inverse. It is listed below as swap_swap.

lean worked
1example (a b x : Obj) : swap a b (swap a b x) = x := by
verified
goalGoals accomplished.

Exercise 8.11.

Theorem 8.32 , read at each point of A∪BA \cup B.

lean proof
1example (f g : Obj → Obj) (A B : Obj) (hf : MapsTo f A A) (hfB : ∀ x : Obj, x ∈ B → f x = x)2    (hg : MapsTo g B B) (hgA : ∀ x : Obj, x ∈ A → g x = x) :3    ∀ x : Obj, x ∈ A ∪ B → (g ∘ f) x = (f ∘ g) x := by
goalf g : Obj → Obj A B : Obj hf : MapsTo f A A hfB : ∀ (x : Obj), x ∈ B → f x = x hg : MapsTo g B B hgA : ∀ (x : Obj), x ∈ A → g x = x ⊢ ∀ (x : Obj), x ∈ A ∪ B → (g ∘ f) x = (f ∘ g) x

Exercise 8.12.

A transposition is a permutation of any set that holds its two points.

lean proof
1example (A a b : Obj) (ha : a ∈ A) (hb : b ∈ A) : Perm (swap a b) A := by
goalA a b : Obj ha : a ∈ A hb : b ∈ A ⊢ Perm (swap a b) A

Exercise 8.13.

The second part of Problem 8.16 for a cycle of length two, with β\beta in the place of α−1\alpha^{-1}.

lean proof
1example (α β : Obj → Obj) (a b y : Obj) (h1 : ∀ x : Obj, β (α x) = x)2    (h2 : ∀ x : Obj, α (β x) = x) : α (swap a b (β y)) = swap (α a) (α b) y := by
goalα β : Obj → Obj a b y : Obj h1 : ∀ (x : Obj), β (α x) = x h2 : ∀ (x : Obj), α (β x) = x ⊢ α (swap a b (β y)) = swap (α a) (α b) y

Exercise 8.14.

The identity (a b)=π (a  b−1) π(a \ b) = \pi \, (a \ \ b-1) \, \pi from the proof of Proposition 8.41 , with cc in the place of b−1b - 1.

lean proof
1example (a c b x : Obj) (hac : a ≠ c) (hab : a ≠ b) (hcb : c ≠ b) :2    swap a b x = swap c b (swap a c (swap c b x)) := by
goala c b x : Obj hac : ¬a = c hab : ¬a = b hcb : ¬c = b ⊢ swap a b x = swap c b (swap a c (swap c b x))

Exercise 8.15.

Part of Problem 8.3 : h−1∘σ∘hh^{-1} \circ \sigma \circ h is a permutation of the domain of hh. The checker cannot invert a bijection, so h−1h^{-1} arrives as kk, together with the two equations that make it the inverse.

lean proof
1example (h k σ : Obj → Obj) (A B : Obj) (hh : MapsTo h B A) (hk : MapsTo k A B)2    (hkh : ∀ x : Obj, x ∈ B → k (h x) = x) (hhk : ∀ y : Obj, y ∈ A → h (k y) = y)3    (hσ : Perm σ A) : Perm (k ∘ σ ∘ h) B := by
goalh k σ : Obj → Obj A B : Obj hh : MapsTo h B A hk : MapsTo k A B hkh : ∀ (x : Obj), x ∈ B → k (h x) = x hhk : ∀ (y : Obj), y ∈ A → h (k y) = y hσ : Perm σ A ⊢ Perm (k ∘ (σ ∘ h)) B
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered
Nat.lt_irrefl ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet
Nat.lt_trans ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet
Nat.lt_succ_self ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet
Nat.not_lt_zero ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero
Nat.lt_succ_iff ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n
Num.inj ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω
swap_apply_left ∀ (a b : Obj), swap a b a = b — the transposition sends a to b
swap_apply_right ∀ (a b : Obj), swap a b b = a — and b to a
swap_apply_of_ne_of_ne ∀ {a b x : Obj}, x ≠ a → x ≠ b → swap a b x = x — and fixes every other point
swap_swap ∀ (a b x : Obj), swap a b (swap a b x) = x — a transposition is its own inverse
Function.iterate_zero_apply ∀ (f : Obj → Obj) (x : Obj), f^[0] x = x — the first clause of the powers of a map
Function.iterate_succ_apply ∀ (f : Obj → Obj) (n : ℕ) (x : Obj), f^[succ n] x = f^[n] (f x) — the second clause: f^[succ n] is f^[n] ∘ f
Function.iterate_add_apply ∀ (f : Obj → Obj) (m n : ℕ) (x : Obj), f^[m + n] x = f^[m] (f^[n] x) — the first law of exponents
Nat.factorial_zero 0 ! = succ 0 — the first clause of the factorial
Nat.factorial_succ ∀ (n : ℕ), (succ n) ! = succ n * n ! — the second clause of the factorial
Nat.choose_zero_right ∀ (n : ℕ), choose n 0 = succ 0 — the empty set is the one 0-subset
Nat.choose_eq_zero_of_lt ∀ {n k : ℕ}, n < k → choose n k = 0 — no subset is larger than the whole
Nat.choose_succ_succ ∀ (n k : ℕ), choose (succ n) (succ k) = choose n k + choose n (succ k) — Pascal's identity

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 9

Groups

Taught

Operations and Semigroups

The last chapter produced a set with a multiplication on it. The permutations of a set compose, the composite is again a permutation, the composition is associative, there is an identity, and every element has an inverse. None of those five facts mentions what a permutation is. This chapter keeps the five facts and drops the permutations. Many other sets with an operation satisfy the same five facts, so a result proved from them holds for all of these at once.

Operations

Definition 9.1 (Operation).

Let SS be a non-empty set. An operation on SS is a function

∗ : S×S→S.* \, : \, S \times S \to S.

One writes a∗ba * b for the value of ∗* at the ordered pair (a,b)(a, b). The pair (S,∗)(S, *) is a set equipped with an operation.

Two things are asked for. The first is that a value is named for every ordered pair of elements, which is what makes ∗* a function on all of S×SS \times S. The second is that the value lands back in SS, and one says that SS is closed under ∗*. Writing a∗ba * b instead of ∗((a,b))*\bigl((a,b)\bigr) is only notation; the object underneath is still a function, and two operations are equal exactly when they agree at every pair.

Example 9.2 (Operations already in hand).

  1. (N0,+)(\mathbb{N}_0, +) and (N0,⋅)(\mathbb{N}_0, \cdot), with addition as built in the chapter on the natural numbers and multiplication as defined in its problems. So are (N,+)(\mathbb{N}, +) and (N,⋅)(\mathbb{N}, \cdot), since a sum or product of positive numbers is positive.
  2. For a non-empty set AA, the Cartesian power AAA^A, the set of all functions A→AA \to A, carries composition, (f,g)↦f∘g(f, g) \mapsto f \circ g. Its subset SAS_A of permutations is closed under the same operation, since composition sends bijections to bijections; that closure is what let us write σλ\sigma\lambda at all.
  3. For any set XX, the power set P(X)\mathcal{P}(X) carries both ∪\cup and ∩\cap.
  4. On a totally ordered set MM, the rule sending (a,b)(a, b) to whichever of aa and bb is the larger is an operation, since comparability names one of them and antisymmetry makes the choice unambiguous when they are equal.
  5. On any non-empty SS, the rule a∗b=defaa * b \defeq a (keep the left factor) is an operation.

Example 9.3 (Two failures of closure).

Call n∈Nn \in \mathbb{N} prime if n>1n > 1 and the only k∈Nk \in \mathbb{N} dividing nn are 11 and nn, in the sense of divisibility. The primes are closed under neither addition nor multiplication: 3+5=83 + 5 = 8 and 3⋅5=153 \cdot 5 = 15, and neither is prime. Restricting ++ or ⋅\cdot to the primes therefore does not produce an operation on them, and the restricted function is not a function into the primes at all.

The odd numbers show that the two can differ. They are closed under multiplication, since the remainder classes write two odd numbers as 2j+12j + 1 and 2k+12k + 1, whose product is 2(2jk+j+k)+12(2jk + j + k) + 1; they are not closed under addition, since 1+1=21 + 1 = 2.

Definition 9.4 (Closed subsets).

Let ∗* be an operation on SS and let S′⊂SS' \subset S be non-empty. Then S′S' is closed under ∗* if a∗b∈S′a * b \in S' for all a,b∈S′a, b \in S'. In that case the restriction of ∗* to S′×S′S' \times S' is an operation on S′S', and (S′,∗)(S', *) is a substructure of (S,∗)(S, *).

Closure is all that must be checked. Every named structure below (semigroup, group, subgroup) is this definition with further conditions added, and each further condition is either always inherited or always needs checking.

Example 9.5 (A substructure of the natural numbers).

Fix ℓ∈N\ell \in \mathbb{N} and let ℓN0=def{n∈N0∣n=ℓk for some k∈N0}\ell\mathbb{N}_0 \defeq \{n \in \mathbb{N}_0 \mid n = \ell k \text{ for some } k \in \mathbb{N}_0\} be the multiples of ℓ\ell. If n=ℓkn = \ell k and m=ℓjm = \ell j then n+m=ℓ(k+j)n + m = \ell(k + j) by distributivity and n⋅m=ℓ(k⋅ℓ⋅j)n \cdot m = \ell(k \cdot \ell \cdot j), so ℓN0\ell\mathbb{N}_0 is closed under both operations and is a substructure of (N0,+)(\mathbb{N}_0, +) and of (N0,⋅)(\mathbb{N}_0, \cdot).

Associativity and Commutativity

Definition 9.6 (Associative and commutative operations).

Let ∗* be an operation on SS.

  1. The operation is associative if (a∗b)∗c=a∗(b∗c)(a * b) * c = a * (b * c) for all a,b,c∈Sa, b, c \in S. In that case (S,∗)(S, *) is a semigroup.
  2. The operation is commutative if a∗b=b∗aa * b = b * a for all a,b∈Sa, b \in S. A commutative semigroup is also called abelian.

Both conditions are equalities required to hold identically, so both are inherited by every substructure: a law true of all elements of SS is in particular true of all elements of a subset. We note this once here rather than re-checking it in each example.

Example 9.7 (Which of them associate).

Addition and multiplication on N0\mathbb{N}_0 are associative and commutative by the laws of addition and the corresponding laws of multiplication. Composition on AAA^A is associative by the theorem on associativity of composition, so AAA^A and SAS_A are semigroups under ∘\circ. Union and intersection on P(X)\mathcal{P}(X) are associative and commutative by the basic properties of unions and by the algebra of intersection. Taking the larger of two elements of a totally ordered set is associative and commutative, both sides of each law naming the largest of the elements involved.

Keeping the left factor, a∗b=defaa * b \defeq a, is associative, since both (a∗b)∗c(a * b) * c and a∗(b∗c)a * (b * c) are aa, and is not commutative as soon as SS has two distinct points.

Composition shows that the two conditions are independent. It is associative on every AAA^A, and already in S3S_3 there are permutations with σλ≠λσ\sigma\lambda \neq \lambda\sigma, as the worked product of the last chapter showed in S4S_4. Associativity is the more useful of the two, because of the next theorem.

Products of Many Factors

Definition 9.8 (Left-associated product).

Let (S,∗)(S, *) be a set with an operation and let a1,…,an∈Sa_1, \ldots, a_n \in S with n∈Nn \in \mathbb{N}. The left-associated product is defined by the recursion

p(a1)=defa1,p(a1,…,ak+1)=defp(a1,…,ak)∗ak+1(1⩽k<n).p(a_1) \defeq a_1, \qquad p(a_1, \ldots, a_{k+1}) \defeq p(a_1, \ldots, a_k) * a_{k+1} \quad (1 \leqslant k < n).

A full bracketing of a1∗⋯∗ana_1 * \cdots * a_n is either the single term a1a_1, when n=1n = 1, or an expression L∗RL * R in which LL is a full bracketing of a1∗⋯∗aka_1 * \cdots * a_k and RR is a full bracketing of ak+1∗⋯∗ana_{k+1} * \cdots * a_n, for some 1⩽k<n1 \leqslant k < n.

Theorem 9.9 (General associativity).

Let (S,∗)(S, *) be a semigroup, let n∈Nn \in \mathbb{N} and let a1,…,an∈Sa_1, \ldots, a_n \in S.

  1. For every 1⩽k<n1 \leqslant k < n,
p(a1,…,an)=p(a1,…,ak)∗p(ak+1,…,an).p(a_1, \ldots, a_n) = p(a_1, \ldots, a_k) * p(a_{k+1}, \ldots, a_n).
  1. Every full bracketing of a1∗⋯∗ana_1 * \cdots * a_n equals p(a1,…,an)p(a_1, \ldots, a_n).
  2. If ∗* is commutative and (b1,…,bn)(b_1, \ldots, b_n) is obtained from (a1,…,an)(a_1, \ldots, a_n) by exchanging two neighbouring entries, then p(b1,…,bn)=p(a1,…,an)p(b_1, \ldots, b_n) = p(a_1, \ldots, a_n).

Discussion.

This is the theorem on general associativity and neighbour swaps with ++ replaced by ∗*, and the earlier proof never mentioned N0\mathbb{N}_0: it used the associativity of ++ for the first two parts and its commutativity for the third, and nothing else. So the argument transfers unchanged. We repeat the main step, which is the first part, the splitting identity, which says a left-associated product may be cut anywhere; it is an induction on the length of the second block, with the recursion clause as the base and a single application of associativity in the step. The second part is then an induction on nn in which a bracketing L∗RL * R is split at its own top-level cut and the two halves identified by the inductive hypothesis. The third puts the exchanged pair in the middle by two applications of the first part, exchanges it by commutativity, and reassembles.

Proof.

For the first part, fix kk and induct on the length mm of the second block, so that n=k+mn = k + m. If m=1m = 1 the assertion is p(a1,…,ak+1)=p(a1,…,ak)∗ak+1p(a_1, \ldots, a_{k+1}) = p(a_1, \ldots, a_k) * a_{k+1}, which is the recursion clause. Suppose it holds at mm. Then

p(a1,…,an+1)=p(a1,…,an)∗an+1=(p(a1,…,ak)∗p(ak+1,…,an))∗an+1=p(a1,…,ak)∗(p(ak+1,…,an)∗an+1)=p(a1,…,ak)∗p(ak+1,…,an+1),\begin{aligned} p(a_1, \ldots, a_{n+1}) &= p(a_1, \ldots, a_n) * a_{n+1} \\ &= \bigl(p(a_1, \ldots, a_k) * p(a_{k+1}, \ldots, a_n)\bigr) * a_{n+1} \\ &= p(a_1, \ldots, a_k) * \bigl(p(a_{k+1}, \ldots, a_n) * a_{n+1}\bigr) \\ &= p(a_1, \ldots, a_k) * p(a_{k+1}, \ldots, a_{n+1}), \end{aligned}

by the recursion clause, the inductive hypothesis, associativity, and the recursion clause again.

The second and third parts are the two parts of the earlier theorem, whose proof used only the binary laws just used here; substituting ∗* for ++ throughout gives the argument verbatim, with the first part standing in for the splitting identity recorded there.

The second part allows us to write a1∗a2∗⋯∗ana_1 * a_2 * \cdots * a_n with no brackets at all in a semigroup, and we do so from here on. The third part allows exchanging neighbours when the operation commutes, and neighbours are enough, because the last chapter proved that every rearrangement is a string of neighbour exchanges.

Corollary 9.10 (Rearranging a product).

Let (S,∗)(S, *) be an abelian semigroup, let a1,…,an∈Sa_1, \ldots, a_n \in S and let σ∈Sn\sigma \in S_n. Then

aσ(1)∗aσ(2)∗⋯∗aσ(n)=a1∗a2∗⋯∗an.a_{\sigma(1)} * a_{\sigma(2)} * \cdots * a_{\sigma(n)} = a_1 * a_2 * \cdots * a_n.

Proof.

The proposition that neighbour swaps suffice writes σ\sigma as a product π1π2⋯πm\pi_1 \pi_2 \cdots \pi_m of transpositions of neighbouring points. Applying the third part of the theorem once for each πi\pi_i carries the list (aσ(1),…,aσ(n))(a_{\sigma(1)}, \ldots, a_{\sigma(n)}) to (a1,…,an)(a_1, \ldots, a_n) without changing the left-associated product, and the second part identifies that product with the bracket-free expression on either side.

Remark.

The corollary uses results from three chapters. The bracketing was settled for sums in the chapter on sequences, the reduction of an arbitrary rearrangement to neighbour exchanges was set as a problem there and proved in the chapter on permutations, and the assembly is one line. Nothing about N0\mathbb{N}_0 was used, so the statement holds for unions, for intersections, for the larger-of-two operation, and for every abelian semigroup yet to be met.

Problem 9.1.

On S={a,b,c}S = \{a, b, c\} define an operation by the table

∗abcaabcbbcaccab\begin{array}{c|ccc} * & a & b & c \\ \hline a & a & b & c \\ b & b & c & a \\ c & c & a & b \end{array}

the entry in row xx and column yy being x∗yx * y. Decide whether ∗* is associative and whether it is commutative.

Problem 9.2.

Let SS be non-empty and define a∗b=defba * b \defeq b, keeping the right factor. Decide whether ∗* is associative and whether it is commutative, and compare with the left-factor rule.

Problem 9.3.

Let (S,∗)(S, *) be an abelian semigroup and let aj,k∈Sa_{j,k} \in S for j∈⟨m⟩j \in \langle m \rangle and k∈⟨n⟩k \in \langle n \rangle. Show that forming the products along the rows and then combining, and forming them along the columns and then combining, give the same element of SS.

Identity, Inverses and Groups

A semigroup asks one law of its operation. Two further conditions, an identity element and an inverse for each element, give a group. We look at each condition separately first.

The Identity

Definition 9.11 (Identity element).

Let (S,∗)(S, *) be a set with an operation. An element e∈Se \in S is an identity for ∗* if

e∗a=a∗e=afor every a∈S.e * a = a * e = a \qquad \text{for every } a \in S.

A semigroup with an identity is called a monoid.

An operation written additively usually has its identity written 00, and one written multiplicatively usually has it written 11. The choice is only notation. The definition asks for the law on both sides, and the next section shows why one side alone is weaker.

Proposition 9.12 (Uniqueness of the identity).

An operation has at most one identity.

Discussion.

The claim is a uniqueness statement, so we suppose two identities ee and e′e' and derive e=e′e = e'. We evaluate one product in two ways: reading e∗e′e * e' with the left factor as the identity gives e′e', reading it with the right factor as the identity gives ee, so the two are equal. No associativity is needed, which is why the proposition is stated for an operation and not for a semigroup.

Proof.

Let ee and e′e' be identities for ∗*. Since ee is an identity, e∗e′=e′e * e' = e'. Since e′e' is an identity, e∗e′=ee * e' = e. Hence e=e′e = e'.

Example 9.13 (Identities in the running examples).

The identity for ++ on N0\mathbb{N}_0 is 00, and the identity for ⋅\cdot on N0\mathbb{N}_0 and on N\mathbb{N} is 11. Composition on AAA^A has the identity map idA\mathrm{id}_A as its identity, by the identity laws, and the same map serves for SAS_A. On P(X)\mathcal{P}(X) the identity for ∪\cup is ∅\emptyset and the identity for ∩\cap is XX. Taking the larger of two elements of a totally ordered set has an identity exactly when the set has a minimum, which is then the identity.

Two of the examples have none. Keeping the left factor has no identity once SS has two distinct points: an identity ee would satisfy e∗a=ae * a = a for every aa, whereas e∗a=ee * a = e, forcing every aa to equal ee. And (N,+)(\mathbb{N}, +) has no identity, not because no element behaves like one but because the element that would, namely 00, is not in the set.

Inverses

Definition 9.14 (Inverse element).

Let (S,∗)(S, *) be a set with an operation and with identity ee, and let a∈Sa \in S. An element b∈Sb \in S is an inverse of aa if

a∗b=b∗a=e.a * b = b * a = e.

If aa has an inverse, aa is invertible.

Multiplicative notation writes a−1a^{-1} for the inverse and additive notation writes −a-a. The two-sided demand is the same shape as the one made of inverse functions, and for the same reason: a one-sided inverse is weaker unless associativity lets us combine the two sides, as in the next proposition.

Proposition 9.15 (Uniqueness of inverses).

Let (S,∗)(S, *) be a monoid and let a∈Sa \in S be invertible. Then aa has exactly one inverse.

Discussion.

Uniqueness again, so we take two inverses bb and cc of the same aa and show they agree. We form one expression that can be read as either: put aa between them, as b∗a∗cb * a * c, and bracket it the two available ways. Bracketing to the right uses that cc is an inverse and leaves bb; bracketing to the left uses that bb is one and leaves cc. The re-bracketing uses associativity, and without it the argument fails.

Proof.

Let bb and cc be inverses of aa. Then

b=b∗e(e is the identity)=b∗(a∗c)(c is an inverse of a)=(b∗a)∗c(associativity)=e∗c(b is an inverse of a)=c(e is the identity).\begin{aligned} b &= b * e && \text{($e$ is the identity)} \\ &= b * (a * c) && \text{($c$ is an inverse of $a$)} \\ &= (b * a) * c && \text{(associativity)} \\ &= e * c && \text{($b$ is an inverse of $a$)} \\ &= c && \text{($e$ is the identity)}. \end{aligned}

So one may speak of the inverse of an invertible element, and write a−1a^{-1} for it. Two consequences follow at once. First, ee is invertible with e−1=ee^{-1} = e, since e∗e=ee * e = e. Second, (a−1)−1=a(a^{-1})^{-1} = a: the defining equations a∗a−1=a−1∗a=ea * a^{-1} = a^{-1} * a = e are unchanged when aa and a−1a^{-1} are exchanged, so aa is an inverse of a−1a^{-1}, and uniqueness makes it the inverse.

Proposition 9.16 (Inverse of a product).

Let (S,∗)(S, *) be a monoid and let a,b∈Sa, b \in S be invertible. Then a∗ba * b is invertible and

(a∗b)−1=b−1∗a−1.(a * b)^{-1} = b^{-1} * a^{-1}.

Discussion.

There are two assertions, an existence claim and a formula, and one calculation settles both: if the element named on the right multiplies with a∗ba * b to give ee on both sides, then a∗ba * b is invertible and, by the uniqueness just proved, that element is the inverse. The check is a product of four factors, which general associativity lets us write without brackets; cancelling the inner pair a−1∗aa^{-1} * a leaves b−1∗bb^{-1} * b, and cancelling that leaves ee. The order is reversed so that the inner pair is adjacent.

Proof.

Using general associativity to drop brackets,

(b−1∗a−1)∗(a∗b)=b−1∗(a−1∗a)∗b=b−1∗e∗b=b−1∗b=e,(b^{-1} * a^{-1}) * (a * b) = b^{-1} * (a^{-1} * a) * b = b^{-1} * e * b = b^{-1} * b = e,

and in the same way (a∗b)∗(b−1∗a−1)=a∗(b∗b−1)∗a−1=a∗a−1=e(a * b) * (b^{-1} * a^{-1}) = a * (b * b^{-1}) * a^{-1} = a * a^{-1} = e. So b−1∗a−1b^{-1} * a^{-1} is an inverse of a∗ba * b, and by uniqueness it is the inverse.

The reversal is not new. It is the inverse of a composition met for functions, and the rule (σλ)−1=λ−1σ−1(\sigma\lambda)^{-1} = \lambda^{-1}\sigma^{-1} used without comment for permutations. The proof here covers both, and every other monoid as well.

Proposition 9.17 (The invertible elements).

Let (S,∗)(S, *) be a monoid with identity ee and let

G=def{a∈S∣a is invertible}.G \defeq \{a \in S \mid a \text{ is invertible}\}.

Then e∈Ge \in G; if a,b∈Ga, b \in G then a∗b∈Ga * b \in G; and if a∈Ga \in G then a−1∈Ga^{-1} \in G. So (G,∗)(G, *) is a monoid with identity ee, in which every element is invertible.

Discussion.

Three closure claims and then a summary that follows from them. That e∈Ge \in G was noted above, ee being its own inverse. That GG is closed under ∗* is the previous proposition, which not only says a∗ba * b is invertible but names the inverse, so nothing further is needed. That GG is closed under inversion is the remark that (a−1)−1=a(a^{-1})^{-1} = a, which exhibits an inverse for a−1a^{-1}. The summary then needs only that associativity and the identity laws are inherited by a subset, which they are, being laws required of all elements.

Proof.

From e∗e=ee * e = e we get e∈Ge \in G with e−1=ee^{-1} = e. If a,b∈Ga, b \in G then a∗ba * b is invertible by the previous proposition, so a∗b∈Ga * b \in G, and GG is closed under ∗*. If a∈Ga \in G then (a−1)−1=a(a^{-1})^{-1} = a exhibits aa as an inverse of a−1a^{-1}, so a−1∈Ga^{-1} \in G.

Hence GG is a closed subset containing ee, and it inherits associativity and the identity laws from SS. Each of its elements is invertible, and its inverse lies in GG, so (G,∗)(G, *) is a monoid in which every element is invertible.

Example 9.18 (Who is invertible).

In (N0,+)(\mathbb{N}_0, +) only 00 is invertible, since a+b=0a + b = 0 forces a=b=0a = b = 0 by the corollary on sums that vanish. In (N0,⋅)(\mathbb{N}_0, \cdot) only 11 is invertible. In P(X)\mathcal{P}(X) under ∪\cup only ∅\emptyset is invertible, and under ∩\cap only XX.

The main example is composition. In the monoid AAA^A the invertible elements are exactly the bijections A→AA \to A, by the theorem on invertibility and bijections; that is to say, they are exactly the permutations, and the set they form is SAS_A. The previous proposition, applied to AAA^A, is therefore the statement that SAS_A is closed under composition and under inversion. We proved this twice already, once for functions and once for permutations; here it follows from a proposition about monoids.

Problem 9.4.

Let ∗* be an operation on SS with a left identity ℓ\ell, meaning ℓ∗a=a\ell * a = a for every aa, and a right identity rr, meaning a∗r=aa * r = a for every aa. Show that ℓ=r\ell = r, and that it is then an identity. No associativity is needed.

Problem 9.5.

Show that under the left-factor rule a∗b=defaa * b \defeq a every element of SS is a right identity, and that under the right-factor rule a∗b=defba * b \defeq b every element is a left identity. So a one-sided identity need be neither unique nor accompanied by one on the other side, and neither rule has an identity once SS has two distinct points.

Problem 9.6.

Let (S,∗)(S, *) be a monoid and let a,b,c∈Sa, b, c \in S satisfy a∗b=ea * b = e and b∗c=eb * c = e. Show that a=ca = c, so that bb is a two-sided inverse of aa. Which hypothesis fails if SS is only a set with an operation?

Groups

Definition 9.19 (Group).

A group is a monoid in which every element is invertible: a set GG with an associative operation, an identity ee, and an inverse for each of its elements. A group whose operation is commutative is abelian, in the sense already fixed for semigroups.

The proposition on invertible elements now reads: the invertible elements of any monoid form a group. Applied to AAA^A under composition it says that SAS_A is a group, without using anything about permutations.

Example 9.20 (Groups already met).

  1. For any non-empty set AA, the symmetric group SAS_A under composition. For A=⟨n⟩A = \langle n \rangle this is SnS_n, with #Sn=n!\#S_n = n! by the count of bijections.
  2. The dihedral group Dn⊂SnD_n \subset S_n. That it is closed under products and inverses was a problem of the last chapter, and the identity permutation is a symmetry of every polygon, so DnD_n is a group with #Dn=2n\#D_n = 2n.
  3. The even permutations in SnS_n, closed under products and inverses by another problem there. For n⩾2n \geqslant 2 this group is written AnA_n and called the alternating group on nn letters.
  4. The one-element set {e}\{e\} with the only operation available to it. It is a group, called the trivial group, and it is the smallest group, since a group must contain an identity.
  5. S2={id,τ1,2}S_2 = \{\mathrm{id}, \tau_{1,2}\}, the smallest group with more than one element. Its whole multiplication is τ1,2∗τ1,2=id\tau_{1,2} * \tau_{1,2} = \mathrm{id}, which is the proposition that a transposition is its own inverse.

None of (N0,+)(\mathbb{N}_0, +), (N,+)(\mathbb{N}, +) and (N0,⋅)(\mathbb{N}_0, \cdot) is a group. The first is a monoid in which only 00 is invertible; the second has no identity at all; the third is a monoid in which only 11 is invertible.

Remark (The groups not yet available).

The familiar first examples of groups are the integers under addition and the non-zero rationals or reals under multiplication. We do not have them: the integers are the subject of the next chapter, and they are built by adding to (N0,+)(\mathbb{N}_0, +) the inverses it lacks. The examples above are the ones already constructed, and they are enough to prove everything in this chapter; the arithmetic ones become further examples once they are built.

The definition asks for a two-sided identity and two-sided inverses, four conditions in all. The two left-handed ones already imply the others.

Theorem 9.21 (A left identity with left inverses is enough).

Let (G,∗)(G, *) be a semigroup. Suppose there is ℓ∈G\ell \in G with ℓ∗a=a\ell * a = a for every a∈Ga \in G, and suppose that for every a∈Ga \in G there is b∈Gb \in G with b∗a=ℓb * a = \ell. Then ℓ\ell is an identity, every such bb is an inverse of aa, and (G,∗)(G, *) is a group.

Discussion.

The statement is an implication from a shortened list of axioms to the full one, so we assume the two left-handed conditions and must produce the two right-handed ones. We apply the hypotheses repeatedly and re-bracket, in a particular order: the right-inverse law must come first, because the right-identity law is proved from it.

To get a∗b=ℓa * b = \ell, take a left inverse bb of aa and then a left inverse cc of bb. Insert ℓ\ell in front of a∗ba * b using the left identity, replace that ℓ\ell by c∗bc * b, and re-bracket so that b∗ab * a becomes adjacent; that inner pair becomes ℓ\ell, which the left identity removes, leaving c∗b=ℓc * b = \ell. Once a∗b=ℓa * b = \ell is known, a∗ℓa * \ell can be written as a∗(b∗a)a * (b * a), re-bracketed to (a∗b)∗a=ℓ∗a=a(a * b) * a = \ell * a = a, which is the right-identity law. No appeal to uniqueness is needed anywhere; the calculation gives the two-sided laws directly.

Proof.

Fix a∈Ga \in G, choose b∈Gb \in G with b∗a=ℓb * a = \ell, and choose c∈Gc \in G with c∗b=ℓc * b = \ell. Then

a∗b=ℓ∗(a∗b)=(c∗b)∗(a∗b)=c∗((b∗a)∗b)=c∗(ℓ∗b)=c∗b=ℓ,\begin{aligned} a * b &= \ell * (a * b) = (c * b) * (a * b) \\ &= c * \bigl((b * a) * b\bigr) = c * (\ell * b) = c * b = \ell, \end{aligned}

using the left identity, the choice of cc, associativity, the choice of bb, and the left identity again. So bb is a right inverse of aa as well as a left one.

Consequently

a∗ℓ=a∗(b∗a)=(a∗b)∗a=ℓ∗a=a,a * \ell = a * (b * a) = (a * b) * a = \ell * a = a,

so ℓ\ell is a right identity as well as a left one. Hence ℓ\ell is an identity, each aa has the two-sided inverse bb, and (G,∗)(G, *) is a group.

Remark (Right axioms, mixed axioms).

The same argument with left and right exchanged shows that a right identity together with right inverses is equally sufficient. A left identity paired with right inverses is not enough, and a counterexample with two elements exists; producing one is a problem below. So the two halves of the definition may be dropped in matching pairs but not in mismatched ones.

Proposition 9.22 (Cancellation in a group).

Let (G,∗)(G, *) be a group and let a,x1,x2,y1,y2∈Ga, x_1, x_2, y_1, y_2 \in G. If a∗x1=a∗x2a * x_1 = a * x_2 then x1=x2x_1 = x_2; and if y1∗a=y2∗ay_1 * a = y_2 * a then y1=y2y_1 = y_2.

Discussion.

Two implications of the same shape, and the second is the mirror image of the first, so only one need be written out. In each the hypothesis is an equation with a common factor on one side, and the way to remove a factor is to introduce its inverse on that same side and re-bracket: the inverse then meets aa and the pair becomes ee, which the identity law removes. Both the associativity and the existence of a−1a^{-1} are used, and each once.

Proof.

Suppose a∗x1=a∗x2a * x_1 = a * x_2. Then

x1=e∗x1=(a−1∗a)∗x1=a−1∗(a∗x1)=a−1∗(a∗x2)=(a−1∗a)∗x2=e∗x2=x2.\begin{aligned} x_1 &= e * x_1 = (a^{-1} * a) * x_1 = a^{-1} * (a * x_1) \\ &= a^{-1} * (a * x_2) = (a^{-1} * a) * x_2 = e * x_2 = x_2. \end{aligned}

The second implication is the same computation with a−1a^{-1} applied on the right.

Cancellation says exactly that, for each fixed aa, the maps x↦a∗xx \mapsto a * x and y↦y∗ay \mapsto y * a are injective. When GG is finite they are therefore bijective, so each of the equations a∗x=ba * x = b and y∗a=by * a = b has exactly one solution. In fact they are bijective whether or not GG is finite, since x↦a−1∗xx \mapsto a^{-1} * x undoes the first; the finite case is worth noting separately, because it uses nothing about inverses and so applies to semigroups that are not groups.

Definition 9.23 (Regular semigroup).

A monoid in which cancellation holds on both sides (that is, a∗x1=a∗x2a * x_1 = a * x_2 implies x1=x2x_1 = x_2, and y1∗a=y2∗ay_1 * a = y_2 * a implies y1=y2y_1 = y_2) is called regular.

Every group is regular, by the proposition. The converse fails, and our standard examples show it.

Example 9.24 (The natural numbers cancel).

(N0,+)(\mathbb{N}_0, +) is regular, since x+z=y+zx + z = y + z implies x=yx = y by the cancellation problem of the chapter on the natural numbers. It is not a group. Multiplication on N\mathbb{N} is regular too: if a⋅x1=a⋅x2a \cdot x_1 = a \cdot x_2 with aa positive and, say, x1⩽x2x_1 \leqslant x_2, write x2=x1+sx_2 = x_1 + s and cancel to get a⋅s=0a \cdot s = 0, whence s=0s = 0 because a product of positive numbers is positive. It is not a group either.

So regularity is strictly weaker than being a group, and it is the condition we need of a monoid we want to enlarge into a group. That is what the next chapter does to (N0,+)(\mathbb{N}_0, +).

Problem 9.7.

Construct a semigroup with a left identity in which every element has a right inverse, but which is not a group. Two elements suffice.

Problem 9.8.

Let (G,∗)(G, *) be a finite group and write out its multiplication table, the entry in row xx and column yy being x∗yx * y. Show that every element of GG occurs exactly once in each row and exactly once in each column.

Problem 9.9.

Show that (N0,⋅)(\mathbb{N}_0, \cdot) is not regular, and that P(X)\mathcal{P}(X) under ∪\cup is not regular once XX is non-empty.

Problem 9.10.

The symmetric difference A⊕B=def(A∖B)∪(B∖A)A \oplus B \defeq (A \setminus B) \cup (B \setminus A), the set of objects lying in exactly one of AA and BB, was met in the exercises of the chapter on sets. Show that (P(X),⊕)\bigl(\mathcal{P}(X), \oplus\bigr) is an abelian group, and identify its identity and the inverse of each element.

Subgroups

Definition 9.25 (Subgroup).

Let (G,∗)(G, *) be a group with identity ee and let H⊂GH \subset G be non-empty. Then HH is a subgroup of GG if e∈He \in H, if a∗b∈Ha * b \in H for all a,b∈Ha, b \in H, and if a−1∈Ha^{-1} \in H for all a∈Ha \in H. A subgroup other than {e}\{e\} and GG is called proper.

The three conditions say precisely that (H,∗)(H, *) is itself a group under the restricted operation, and nothing extra is assumed. Suppose HH is a closed subset that happens to be a group in its own right, with identity f∈Hf \in H. Then f∗f=ff * f = f holds in GG, and cancelling ff there gives f=ef = e: a subset cannot have an identity of its own. Likewise the inverse of a∈Ha \in H computed inside HH is an inverse of aa inside GG, so uniqueness of inverses makes it a−1a^{-1}. The conditions listed are therefore necessary as well as sufficient, and they may be checked by computing in GG.

Proposition 9.26 (One-step subgroup criterion).

Let (G,∗)(G, *) be a group and let H⊂GH \subset G be non-empty. Then HH is a subgroup of GG if and only if a∗b−1∈Ha * b^{-1} \in H for all a,b∈Ha, b \in H.

Discussion.

A biconditional between the three conditions of the definition and a single one, and one direction is much easier than the other. Forwards is immediate: a subgroup contains b−1b^{-1} and is closed, so it contains a∗b−1a * b^{-1}. Backwards, we get the three conditions from the one by choosing aa and bb suitably. Non-emptiness supplies some a∈Ha \in H to start from; taking b=ab = a produces ee; taking a=ea = e then produces b−1b^{-1} for every b∈Hb \in H; and once inverses are available, the product a∗ba * b is a∗(b−1)−1a * (b^{-1})^{-1}, which the hypothesis covers. Each step uses the hypothesis once, and the steps must come in this order.

Proof.

Suppose HH is a subgroup and let a,b∈Ha, b \in H. Then b−1∈Hb^{-1} \in H, so a∗b−1∈Ha * b^{-1} \in H.

Conversely suppose a∗b−1∈Ha * b^{-1} \in H whenever a,b∈Ha, b \in H. Since HH is non-empty, choose a∈Ha \in H; taking b=ab = a gives e=a∗a−1∈He = a * a^{-1} \in H. Now let b∈Hb \in H; taking the pair (e,b)(e, b) gives b−1=e∗b−1∈Hb^{-1} = e * b^{-1} \in H, so HH is closed under inverses. Finally let a,b∈Ha, b \in H; then b−1∈Hb^{-1} \in H, so taking the pair (a,b−1)(a, b^{-1}) gives a∗(b−1)−1=a∗b∈Ha * (b^{-1})^{-1} = a * b \in H. Hence HH satisfies the three conditions.

Example 9.27 (Subgroups already met).

DnD_n is a subgroup of SnS_n, and for n⩾2n \geqslant 2 the alternating group AnA_n is a subgroup of SnS_n. Inside SAS_A, the permutations fixing a chosen point a∈Aa \in A form a subgroup: the identity fixes aa, a composite of two maps fixing aa fixes aa, and if σ(a)=a\sigma(a) = a then σ−1(a)=a\sigma^{-1}(a) = a. Every group has the two subgroups {e}\{e\} and GG.

For each ℓ∈N\ell \in \mathbb{N} the multiples of ℓ\ell form a subgroup of the integers under addition, an example we can state properly once the integers are built.

Problem 9.11.

Show that a non-empty finite subset HH of a group GG that is closed under the operation is already a subgroup. For fixed a∈Ha \in H the map x↦a∗xx \mapsto a * x sends HH into HH; use finiteness to make it surjective, and read off e∈He \in H and a−1∈Ha^{-1} \in H.

Problem 9.12.

Show that an intersection of subgroups of GG is a subgroup of GG, for any non-empty indexed family of them. Show by example that a union of two subgroups need not be one.

Problem 9.13.

List every subgroup of S3S_3, and check each against the one-step criterion.

Homomorphisms and Quotients

A subgroup cuts a group into pieces of equal size, and sometimes the pieces form a group themselves. The last notion of this chapter is a map that respects the operation.

Cosets

Definition 9.28 (Cosets).

Let HH be a subgroup of a group (G,∗)(G, *) and let b∈Gb \in G. The right coset and the left coset of HH by bb are

H∗b=def{h∗b∣h∈H},b∗H=def{b∗h∣h∈H}.H * b \defeq \{h * b \mid h \in H\}, \qquad b * H \defeq \{b * h \mid h \in H\}.

Proposition 9.29 (The right cosets partition the group).

Let HH be a subgroup of a group (G,∗)(G, *) and define a1∼a2a_1 \sim a_2 to mean a1∗a2−1∈Ha_1 * a_2^{-1} \in H. Then ∼\sim is an equivalence relation on GG whose classes are exactly the right cosets of HH. Moreover #(H∗b)=#H\#(H * b) = \#H for every bb, when HH is finite.

Discussion.

Three assertions. The first asks for the three defining properties of an equivalence relation, and each comes from one of the three subgroup conditions: reflexivity is e∈He \in H, symmetry is closure under inverses applied to a1∗a2−1a_1 * a_2^{-1}, and transitivity is closure under the operation applied to a product that telescopes. The second is an equality of sets, so it is two inclusions, and both come from writing an element of one side in the form the other side demands. The third is a counting claim, and since cardinality classifies finite sets it is enough to produce a bijection H→H∗bH \to H * b; the map h↦h∗bh \mapsto h * b is one, being surjective by the definition of the coset and injective by cancellation.

Proof.

For reflexivity, a∗a−1=e∈Ha * a^{-1} = e \in H, so a∼aa \sim a. For symmetry, if a1∗a2−1∈Ha_1 * a_2^{-1} \in H then its inverse (a1∗a2−1)−1=a2∗a1−1(a_1 * a_2^{-1})^{-1} = a_2 * a_1^{-1} lies in HH, so a2∼a1a_2 \sim a_1. For transitivity, if a1∗a2−1∈Ha_1 * a_2^{-1} \in H and a2∗a3−1∈Ha_2 * a_3^{-1} \in H then their product

(a1∗a2−1)∗(a2∗a3−1)=a1∗a3−1(a_1 * a_2^{-1}) * (a_2 * a_3^{-1}) = a_1 * a_3^{-1}

lies in HH, so a1∼a3a_1 \sim a_3.

For the classes, fix bb. If a∼ba \sim b then h=defa∗b−1∈Hh \defeq a * b^{-1} \in H and a=h∗b∈H∗ba = h * b \in H * b. Conversely if a=h∗ba = h * b with h∈Hh \in H then a∗b−1=h∈Ha * b^{-1} = h \in H, so a∼ba \sim b. Hence [b]=H∗b[b] = H * b.

For the count, the map h↦h∗bh \mapsto h * b from HH to H∗bH * b is surjective by the definition of H∗bH * b and injective by cancellation, hence a bijection, so the two sets have the same cardinality.

Since the classes of an equivalence relation partition the set, the right cosets partition GG into pieces all of the same size as HH. The left cosets do the same, by the mirror argument with a1−1∗a2∈Ha_1^{-1} * a_2 \in H.

Problem 9.14.

Let GG be a finite group and HH a subgroup. Show that #G\#G is the product of #H\#H with the number of right cosets of HH. Deduce that #H\#H divides #G\#G.

Problem 9.15.

Show that the left cosets of HH partition GG as the right cosets do, and that the two partitions have the same number of pieces, by checking that H∗b↦b−1∗HH * b \mapsto b^{-1} * H is a well-defined bijection between them.

Homomorphisms

Definition 9.30 (Homomorphism).

Let (G1,∗)(G_1, *) and (G2,∗)(G_2, *) be groups. A function α:G1→G2\alpha : G_1 \to G_2 is a homomorphism if

α(a∗b)=α(a)∗α(b)for all a,b∈G1.\alpha(a * b) = \alpha(a) * \alpha(b) \qquad \text{for all } a, b \in G_1.

Its kernel is ker⁡α=defα−1({e2})\ker \alpha \defeq \alpha^{-1}(\{e_2\}), the preimage of the identity of G2G_2, and its image is α(G1)\alpha(G_1). A bijective homomorphism is an isomorphism; groups with an isomorphism between them are isomorphic, written G1≅G2G_1 \cong G_2. An isomorphism from a group to itself is an automorphism. Throughout, e1e_1 and e2e_2 are the identities of G1G_1 and of G2G_2.

The same symbol ∗* denotes two different operations, one on each side of the equation, and that is deliberate: the condition says that computing in G1G_1 and then transporting gives the same answer as transporting and then computing in G2G_2.

Proposition 9.31 (Homomorphisms respect the identity and inverses).

Let α:G1→G2\alpha : G_1 \to G_2 be a homomorphism. Then α(e1)=e2\alpha(e_1) = e_2 and α(a−1)=α(a)−1\alpha(a^{-1}) = \alpha(a)^{-1} for every a∈G1a \in G_1.

Discussion.

Neither conclusion is assumed by the definition, which mentions only products, so both must be derived from the product condition. For the first, e1e_1 is characterised inside G1G_1 by e1∗e1=e1e_1 * e_1 = e_1; applying α\alpha turns that into an equation about α(e1)\alpha(e_1) alone, and cancellation in G2G_2 finishes it. For the second, apply α\alpha to the defining equation a∗a−1=e1a * a^{-1} = e_1 and use the first part: the result says α(a−1)\alpha(a^{-1}) is an inverse of α(a)\alpha(a), and inverses are unique.

Proof.

From e1∗e1=e1e_1 * e_1 = e_1 we get α(e1)∗α(e1)=α(e1)=α(e1)∗e2\alpha(e_1) * \alpha(e_1) = \alpha(e_1) = \alpha(e_1) * e_2, and cancelling α(e1)\alpha(e_1) on the left gives α(e1)=e2\alpha(e_1) = e_2.

Then α(a)∗α(a−1)=α(a∗a−1)=α(e1)=e2\alpha(a) * \alpha(a^{-1}) = \alpha(a * a^{-1}) = \alpha(e_1) = e_2, and likewise α(a−1)∗α(a)=e2\alpha(a^{-1}) * \alpha(a) = e_2. So α(a−1)\alpha(a^{-1}) is an inverse of α(a)\alpha(a), hence is α(a)−1\alpha(a)^{-1} by uniqueness.

Proposition 9.32 (Kernel and image).

Let α:G1→G2\alpha : G_1 \to G_2 be a homomorphism.

  1. ker⁡α\ker \alpha is a subgroup of G1G_1 and α(G1)\alpha(G_1) is a subgroup of G2G_2.
  2. α\alpha is injective if and only if ker⁡α={e1}\ker \alpha = \{e_1\}.
  3. If α\alpha is an isomorphism then so is α−1\alpha^{-1}.

Discussion.

Three separate claims. The first two subgroup checks are the one-step criterion, and each is a short computation using the previous proposition to convert α\alpha of an inverse into an inverse of α\alpha; non-emptiness comes from α(e1)=e2\alpha(e_1) = e_2 in both cases. The second claim is a biconditional: forwards, an injective map sends at most one point to e2e_2 and e1e_1 is already one; backwards, the way to turn an equality α(a1)=α(a2)\alpha(a_1) = \alpha(a_2) into a statement about the kernel is to move everything to one side, forming a1∗a2−1a_1 * a_2^{-1}, which the hypothesis then forces to be e1e_1. The third is again a matter of transporting a condition: given a2,b2∈G2a_2, b_2 \in G_2, name their preimages, apply the homomorphism condition to those, and read the resulting equation backwards through α−1\alpha^{-1}; that α−1\alpha^{-1} is bijective is the theorem that the inverse of a bijection is a bijection.

Proof.

For the first, α(e1)=e2\alpha(e_1) = e_2 puts e1∈ker⁡αe_1 \in \ker \alpha and e2∈α(G1)e_2 \in \alpha(G_1), so both are non-empty. If a,b∈ker⁡αa, b \in \ker \alpha then

α(a∗b−1)=α(a)∗α(b)−1=e2∗e2−1=e2,\alpha(a * b^{-1}) = \alpha(a) * \alpha(b)^{-1} = e_2 * e_2^{-1} = e_2,

so a∗b−1∈ker⁡αa * b^{-1} \in \ker\alpha and the one-step criterion applies. If α(a),α(b)∈α(G1)\alpha(a), \alpha(b) \in \alpha(G_1) then α(a)∗α(b)−1=α(a∗b−1)∈α(G1)\alpha(a) * \alpha(b)^{-1} = \alpha(a * b^{-1}) \in \alpha(G_1), and the criterion applies again.

For the second, suppose α\alpha is injective and a∈ker⁡αa \in \ker\alpha. Then α(a)=e2=α(e1)\alpha(a) = e_2 = \alpha(e_1), so a=e1a = e_1. Conversely suppose ker⁡α={e1}\ker\alpha = \{e_1\} and α(a1)=α(a2)\alpha(a_1) = \alpha(a_2). Then

α(a1∗a2−1)=α(a1)∗α(a2)−1=e2,\alpha(a_1 * a_2^{-1}) = \alpha(a_1) * \alpha(a_2)^{-1} = e_2,

so a1∗a2−1=e1a_1 * a_2^{-1} = e_1 and hence a1=a2a_1 = a_2.

For the third, let α\alpha be an isomorphism and let a2,b2∈G2a_2, b_2 \in G_2 have preimages a1,b1a_1, b_1. Then α(a1∗b1)=a2∗b2\alpha(a_1 * b_1) = a_2 * b_2, so α−1(a2∗b2)=a1∗b1=α−1(a2)∗α−1(b2)\alpha^{-1}(a_2 * b_2) = a_1 * b_1 = \alpha^{-1}(a_2) * \alpha^{-1}(b_2). And α−1\alpha^{-1} is a bijection, so it is an isomorphism.

Example 9.33 (The sign is a homomorphism).

The sign of a permutation takes two values, and the group with two elements is S2={id,τ1,2}S_2 = \{\mathrm{id}, \tau_{1,2}\}. Define sg:Sn→S2\mathrm{sg} : S_n \to S_2 by sending an even permutation to id\mathrm{id} and an odd one to τ1,2\tau_{1,2}. The theorem on the properties of the sign says the sign of a product is the product of the signs, which is exactly the statement that sg\mathrm{sg} is a homomorphism: the four cases of “even or odd times even or odd” are the four products in S2S_2.

Its kernel is the set of even permutations, which is AnA_n. So the fact that the alternating group is a subgroup, checked by hand last chapter, now follows from the proposition on kernels. For n⩾2n \geqslant 2 the map is surjective, since a transposition is odd, so its image is all of S2S_2.

Theorem 9.34 (Cayley's theorem).

Every group is isomorphic to a subgroup of a symmetric group. Precisely: if (G,∗)(G, *) is a group then a↦λaa \mapsto \lambda_a, where λa(x)=defa∗x\lambda_a(x) \defeq a * x, is an injective homomorphism G→SGG \to S_G, so GG is isomorphic to a subgroup of SGS_G.

Discussion.

There are three things to check. First, the proposed values must lie where the theorem says: λa\lambda_a must be a permutation of GG, and it is, because λa−1\lambda_{a^{-1}} undoes it on both sides, so it is invertible and hence a bijection. Second, the map must be a homomorphism, and since both sides are functions on GG the check is an equality of functions, settled by evaluating at an arbitrary xx; associativity is the only thing used, and it is used once. Third, injectivity, which by the previous proposition is the triviality of the kernel: if λa\lambda_a is the identity permutation then it fixes ee in particular, and λa(e)=a\lambda_a(e) = a. The isomorphism onto a subgroup is then the image, which the previous proposition already knows to be a subgroup.

Proof.

For each a∈Ga \in G the maps λa\lambda_a and λa−1\lambda_{a^{-1}} satisfy

λa−1(λa(x))=a−1∗(a∗x)=x\lambda_{a^{-1}}\bigl(\lambda_a(x)\bigr) = a^{-1} * (a * x) = x

and likewise in the other order, so λa\lambda_a is invertible and hence a permutation of GG; that is, λa∈SG\lambda_a \in S_G.

Let Λ:G→SG\Lambda : G \to S_G be a↦λaa \mapsto \lambda_a. For a,b∈Ga, b \in G and any x∈Gx \in G,

λa∗b(x)=(a∗b)∗x=a∗(b∗x)=λa(λb(x))=(λaλb)(x),\lambda_{a * b}(x) = (a * b) * x = a * (b * x) = \lambda_a\bigl(\lambda_b(x)\bigr) = (\lambda_a \lambda_b)(x),

so Λ(a∗b)=Λ(a)Λ(b)\Lambda(a * b) = \Lambda(a)\Lambda(b) and Λ\Lambda is a homomorphism.

If a∈ker⁡Λa \in \ker\Lambda then λa=idG\lambda_a = \mathrm{id}_G, so a=a∗e=λa(e)=ea = a * e = \lambda_a(e) = e. Hence ker⁡Λ={e}\ker\Lambda = \{e\} and Λ\Lambda is injective. Its image is a subgroup of SGS_G, and Λ\Lambda restricted to that image is a bijective homomorphism, hence an isomorphism.

Remark.

Cayley’s theorem says that every group is a group of permutations, so in that sense the last chapter already covered all groups. The statement is weak, though: SGS_G has #G !\#G\,! elements when GG is finite, so the copy of GG inside it is a very small part of a very large group, and locating it is no easier than knowing GG already.

Problem 9.16.

Show that sg:Sn→S2\mathrm{sg} : S_n \to S_2 of the example above is the only homomorphism Sn→S2S_n \to S_2 that is not constant, for n⩾2n \geqslant 2. Every transposition must go to the same place; say why.

Problem 9.17.

Show that a homomorphism carries a subgroup of G1G_1 to a subgroup of G2G_2, and that the preimage of a subgroup of G2G_2 is a subgroup of G1G_1.

Problem 9.18.

Show that D3D_3 and S3S_3 are isomorphic, and that D4D_4 and S4S_4 are not.

Normal Subgroups and Quotients

Kernels satisfy a condition that not every subgroup does, and it is exactly the condition needed to make the cosets into a group.

Definition 9.35 (Normal subgroup).

A subgroup HH of a group (G,∗)(G, *) is normal if b−1∗a∗b∈Hb^{-1} * a * b \in H for all a∈Ha \in H and b∈Gb \in G.

In an abelian group b−1∗a∗b=ab^{-1} * a * b = a, so every subgroup is normal, and the condition only matters in the non-commutative case.

Proposition 9.36 (Kernels are normal).

The kernel of a homomorphism α:G1→G2\alpha : G_1 \to G_2 is a normal subgroup of G1G_1.

Discussion.

That the kernel is a subgroup is already proved, so only the normality condition is left, and it is a membership claim: we must show α\alpha sends b−1∗a∗bb^{-1} * a * b to e2e_2. Applying the homomorphism condition twice turns that element into a product of three values of α\alpha, the middle one being e2e_2 because aa lies in the kernel; the outer two are inverse to each other by the proposition on how homomorphisms treat inverses, so the product is e2e_2.

Proof.

Let a∈ker⁡αa \in \ker\alpha and b∈G1b \in G_1. Then

α(b−1∗a∗b)=α(b)−1∗α(a)∗α(b)=α(b)−1∗e2∗α(b)=α(b)−1∗α(b)=e2,\begin{aligned} \alpha(b^{-1} * a * b) &= \alpha(b)^{-1} * \alpha(a) * \alpha(b) \\ &= \alpha(b)^{-1} * e_2 * \alpha(b) = \alpha(b)^{-1} * \alpha(b) = e_2, \end{aligned}

so b−1∗a∗b∈ker⁡αb^{-1} * a * b \in \ker\alpha. With the subgroup property already established, ker⁡α\ker\alpha is normal.

Theorem 9.37 (Normal subgroups are those whose cosets agree).

Let HH be a subgroup of a group (G,∗)(G, *). Then HH is normal if and only if H∗b=b∗HH * b = b * H for every b∈Gb \in G.

Discussion.

A biconditional, and each direction converts one membership statement into another by moving a factor across. Forwards: an element of H∗bH * b is h∗bh * b, and to exhibit it in b∗Hb * H we must write it as bb times something in HH; inserting b∗b−1b * b^{-1} gives b∗(b−1∗h∗b)b * (b^{-1} * h * b), and normality is precisely the statement that the bracketed factor lies in HH. The reverse inclusion is the same move with b−1b^{-1} in place of bb, which normality also covers. Backwards: given the equality of the two cosets, an element b−1∗a∗bb^{-1} * a * b with a∈Ha \in H is a member of b−1∗(H∗b)b^{-1} * (H * b), which the hypothesis rewrites as b−1∗(b∗H)=Hb^{-1} * (b * H) = H.

Proof.

Suppose HH is normal and let b∈Gb \in G. If h∈Hh \in H then h∗b=b∗(b−1∗h∗b)h * b = b * (b^{-1} * h * b) and b−1∗h∗b∈Hb^{-1} * h * b \in H, so H∗b⊂b∗HH * b \subset b * H. If h∈Hh \in H then b∗h=(b∗h∗b−1)∗bb * h = \bigl(b * h * b^{-1}\bigr) * b, and b∗h∗b−1=(b−1)−1∗h∗b−1∈Hb * h * b^{-1} = (b^{-1})^{-1} * h * b^{-1} \in H by normality applied with b−1b^{-1}, so b∗H⊂H∗bb * H \subset H * b. Hence the two cosets are equal.

Conversely suppose H∗b=b∗HH * b = b * H for every bb, and let a∈Ha \in H and b∈Gb \in G. Then a∗b∈H∗b=b∗Ha * b \in H * b = b * H, so a∗b=b∗ha * b = b * h for some h∈Hh \in H, and b−1∗a∗b=h∈Hb^{-1} * a * b = h \in H. So HH is normal.

When HH is normal the two partitions of GG coincide and there is just one collection of cosets, which we write G/HG/H — the quotient of GG by the equivalence relation of the coset proposition.

Theorem 9.38 (The quotient group).

Let HH be a normal subgroup of a group (G,∗)(G, *). Then

(H∗a)∗(H∗b)=defH∗(a∗b)(H * a) * (H * b) \defeq H * (a * b)

is a well-defined operation on G/HG/H, making G/HG/H a group with identity H=H∗eH = H * e and with (H∗a)−1=H∗a−1(H * a)^{-1} = H * a^{-1}. The map q:G→G/Hq : G \to G/H sending aa to H∗aH * a is a surjective homomorphism with ker⁡q=H\ker q = H.

Discussion.

The main difficulty is showing that the operation is well defined. The proposed rule names the answer using aa and bb, but the arguments of the operation are the cosets, and a coset has many names; so we must show that replacing aa by any a′a' with H∗a′=H∗aH * a' = H * a, and bb likewise, leaves H∗(a∗b)H * (a * b) unchanged. Written in terms of the equivalence relation, that means a′∗a−1∈Ha' * a^{-1} \in H and b′∗b−1∈Hb' * b^{-1} \in H should force (a′∗b′)∗(a∗b)−1∈H(a' * b') * (a * b)^{-1} \in H, and this calculation uses normality: the two known members of HH are separated by aa, and normality lets us move it past.

The rest follows from the laws in GG. Associativity, the identity law and the inverse law each reduce, through the definition of the operation, to the corresponding law in GG applied to representatives. That qq is a homomorphism is the definition of the operation read backwards, surjectivity is the definition of G/HG/H, and the kernel is the set of aa with H∗a=HH * a = H, which is HH.

Proof.

For well-definedness, suppose H∗a′=H∗aH * a' = H * a and H∗b′=H∗bH * b' = H * b, so that h=defa′∗a−1h \defeq a' * a^{-1} and k=defb′∗b−1k \defeq b' * b^{-1} lie in HH. Then a′=h∗aa' = h * a and b′=k∗bb' = k * b, so

(a′∗b′)∗(a∗b)−1=h∗a∗k∗b∗b−1∗a−1=h∗(a∗k∗a−1),(a' * b') * (a * b)^{-1} = h * a * k * b * b^{-1} * a^{-1} = h * (a * k * a^{-1}),

and a∗k∗a−1=(a−1)−1∗k∗a−1∈Ha * k * a^{-1} = (a^{-1})^{-1} * k * a^{-1} \in H by normality. So the displayed element is a product of two members of HH and lies in HH, giving H∗(a′∗b′)=H∗(a∗b)H * (a' * b') = H * (a * b). The operation is therefore well defined.

Associativity follows from associativity in GG:

((H∗a)∗(H∗b))∗(H∗c)=H∗((a∗b)∗c)=H∗(a∗(b∗c))=(H∗a)∗((H∗b)∗(H∗c)).\begin{aligned} \bigl((H * a) * (H * b)\bigr) * (H * c) &= H * \bigl((a * b) * c\bigr) \\ &= H * \bigl(a * (b * c)\bigr) \\ &= (H * a) * \bigl((H * b) * (H * c)\bigr). \end{aligned}

Also (H∗e)∗(H∗a)=H∗a=(H∗a)∗(H∗e)(H * e) * (H * a) = H * a = (H * a) * (H * e), so H∗e=HH * e = H is an identity, and (H∗a)∗(H∗a−1)=H∗e=(H∗a−1)∗(H∗a)(H * a) * (H * a^{-1}) = H * e = (H * a^{-1}) * (H * a), so H∗a−1H * a^{-1} is an inverse of H∗aH * a. Hence G/HG/H is a group.

Finally q(a∗b)=H∗(a∗b)=(H∗a)∗(H∗b)=q(a)∗q(b)q(a * b) = H * (a * b) = (H * a) * (H * b) = q(a) * q(b), so qq is a homomorphism; it is surjective because every coset is H∗aH * a for some aa; and q(a)=Hq(a) = H holds exactly when a∗e−1=a∈Ha * e^{-1} = a \in H, so ker⁡q=H\ker q = H.

Remark.

So normal subgroups and kernels are the same thing: every kernel is normal, by the proposition, and every normal subgroup is the kernel of the map qq onto its own quotient. So the question “which subgroups can be quotiented by?” and the question “which subgroups arise as kernels?” have one answer.

Theorem 9.39 (First isomorphism theorem).

Let α:G1→G2\alpha : G_1 \to G_2 be a homomorphism. Then

G1/ker⁡α  ≅  α(G1),G_1/\ker\alpha \;\cong\; \alpha(G_1),

by the isomorphism sending the coset ker⁡α∗a\ker\alpha * a to α(a)\alpha(a).

Discussion.

The statement claims an isomorphism between two groups both of which are already known to exist: the quotient by the previous theorem, since the kernel is normal, and the image by the proposition on kernels and images. So we only need to check four things about the named map. That it is well defined is the same issue as before, since a coset has many names, and it holds because two representatives differ by a member of the kernel, which α\alpha sends to the identity. That it is a homomorphism is the definition of the quotient operation together with the homomorphism property of α\alpha. Surjectivity onto the image is immediate. Injectivity is the triviality of the kernel of the new map, and it comes out as the statement that α(a)=e2\alpha(a) = e_2 puts aa in ker⁡α\ker\alpha, so the coset is the identity of the quotient.

Proof.

Write K=defker⁡αK \defeq \ker\alpha, a normal subgroup by the proposition, so that G1/KG_1/K is a group. Define β(K∗a)=defα(a)\beta(K * a) \defeq \alpha(a).

Well defined. If K∗a′=K∗aK * a' = K * a then a′∗a−1∈Ka' * a^{-1} \in K, so α(a′)∗α(a)−1=α(a′∗a−1)=e2\alpha(a') * \alpha(a)^{-1} = \alpha(a' * a^{-1}) = e_2 and hence α(a′)=α(a)\alpha(a') = \alpha(a).

Homomorphism. β((K∗a)∗(K∗b))=β(K∗(a∗b))=α(a∗b)=α(a)∗α(b)=β(K∗a)∗β(K∗b)\beta\bigl((K * a) * (K * b)\bigr) = \beta\bigl(K * (a * b)\bigr) = \alpha(a * b) = \alpha(a) * \alpha(b) = \beta(K * a) * \beta(K * b).

Surjective onto α(G1)\alpha(G_1). Every element of the image is α(a)=β(K∗a)\alpha(a) = \beta(K * a) for some aa.

Injective. If β(K∗a)=e2\beta(K * a) = e_2 then α(a)=e2\alpha(a) = e_2, so a∈Ka \in K and K∗a=KK * a = K, the identity of G1/KG_1/K. So the kernel of β\beta is trivial and β\beta is injective.

Hence β\beta is a bijective homomorphism from G1/KG_1/K onto α(G1)\alpha(G_1).

Example 9.40 (The sign again).

Take α=sg:Sn→S2\alpha = \mathrm{sg} : S_n \to S_2 with n⩾2n \geqslant 2. Its kernel is AnA_n and its image is all of S2S_2, so the theorem gives

Sn/An  ≅  S2.S_n/A_n \;\cong\; S_2 .

The quotient has two elements, the even permutations and the odd ones, and its multiplication is the arithmetic of parity: even times even is even, even times odd is odd, odd times odd is even. Counting the cosets recovers the problem that #Sn\#S_n is twice the number of even permutations, this time as a consequence rather than a construction.

Problem 9.19.

Show that a subgroup H⊂GH \subset G with exactly two right cosets is normal, without computing anything about HH itself.

Problem 9.20.

Show that {id,τ1,2}\{\mathrm{id}, \tau_{1,2}\} is a subgroup of S3S_3 that is not normal, and that A3A_3 is a normal subgroup of S3S_3. Which of the two has a quotient group, and what is it?

Problem 9.21.

Let α:G1→G2\alpha : G_1 \to G_2 be a homomorphism and let HH be a normal subgroup of G1G_1 contained in ker⁡α\ker\alpha. Show that there is exactly one homomorphism γ:G1/H→G2\gamma : G_1/H \to G_2 with α=γ∘q\alpha = \gamma \circ q, where q:G1→G1/Hq : G_1 \to G_1/H is the quotient map. The first isomorphism theorem is the case H=ker⁡αH = \ker\alpha.

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 9.1.

The symmetries of the square form D4D_4, with #D4=8\#D_4 = 8.

The number of σ∈D4\sigma \in D_4 with σσ=id\sigma\sigma = \mathrm{id} is:

answer one of these

The number of σ∈D4\sigma \in D_4 with σσσ=id\sigma\sigma\sigma = \mathrm{id} is:

answer one of these

Exercise 9.2.

Let (G,∗)(G, *) be a finite group and write ana^n for the product of nn copies of aa.

For a∈Ga \in G, the set {n∈N∣an=e}\{n \in \mathbb{N} \mid a^n = e\} is:

answer one of these

There is a single N∈NN \in \mathbb{N} with aN=ea^N = e for every a∈Ga \in G at once:

answer one of these

Exercise 9.3.

Let (G,∗)(G, *) be a finite group with #G\#G even. The number of a∈Ga \in G with a∗a=ea * a = e is:

answer one of these

Exercise 9.4.

Let K⊂H⊂GK \subset H \subset G, with HH a subgroup of the finite group GG and KK a subgroup of HH. Suppose HH has exactly 33 right cosets in GG, and KK exactly 44 right cosets in HH.

The number of right cosets of KK in GG is:

answer one of these

Exercise 9.5.

Let HH be a subgroup of SnS_n with #H=20\#H = 20.

If HH contains an odd permutation, the number of odd permutations in HH is:

answer one of these

If HH contains no odd permutation, that number is:

answer one of these

Exercise 9.6.

Let GG be an infinite group and let HH and KK be subgroups with exactly 33 and exactly 55 right cosets. The number of right cosets of H∩KH \cap K in GG is:

answer one of these

Exercise 9.7.

Let SS be a non-empty subset of a group (G,∗)(G, *) and suppose the sets b∗Sb * S, for b∈Gb \in G, partition GG. Then SS is:

answer one of these

Exercise 9.8.

For a group (G,∗)(G, *) put Z(G)=def{a∈G∣a∗b=b∗a for every b∈G}Z(G) \defeq \{a \in G \mid a * b = b * a \text{ for every } b \in G\}.

Then Z(G)Z(G) is:

answer one of these

Exercise 9.9.

Let K={e,k}K = \{e, k\} with k≠ek \neq e be a normal subgroup of (G,∗)(G, *). Then:

answer one of these

Exercise 9.10.

Let KK be a normal subgroup of HH and let HH be a normal subgroup of GG.

Then KK:

answer one of these

The smallest symmetric group holding a pair that witnesses this is:

answer one of these

Exercise 9.11.

Let HH be a subgroup of (G,∗)(G, *). The largest normal subgroup of GG contained in HH is:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

Every statement of this chapter is made of one group, so the checker is given one and the sheet works inside it. The objects are its elements, and three new pieces of notation carry the structure:

a ∗ b    the product, typed \ast
e        the identity
a⁻¹      the inverse of a, typed \-1

The operation binds like a product, so a ∗ b ∗ c is (a ∗ b) ∗ c and brackets are written where the other reading is wanted. A subgroup is a set, hence an object like any other, and a ∈ H is the membership of the sets chapter.

Five entries carry Definition 9.19 and nothing else is given away:

mul_assoc        (a ∗ b) ∗ c = a ∗ (b ∗ c)
e_mul            e ∗ a = a
mul_e            a ∗ e = a
inv_mul_cancel   a⁻¹ ∗ a = e
mul_inv_cancel   a ∗ a⁻¹ = e

Everything else in the chapter is a consequence, and the sheet asks for the consequences.

Multiplying an equation through

The axioms are equations, so the work is rewriting. What the paper proofs do in one line (multiply both sides by a−1a^{-1}) the checker needs spelled out, and congrArg says it: from h : x = y it builds f x = f y for any f written out as fun t => …. Once the equation has the factor on it, rw [...] at h cancels.

Example.

The observation that settled the identity of a subgroup, in the discussion after Definition 9.25 . Multiplying by a−1a^{-1} on the left is the whole of it.

lean worked
1example (a : Obj) (h : a ∗ a = a) : a = e := by
verified
goalGoals accomplished.

Example.

The left half of Proposition 9.22 . It is listed below as mul_left_cancel, so the exercises may lean on it.

lean worked
1example (a x y : Obj) (h : a ∗ x = a ∗ y) : x = y := by
verified
goalGoals accomplished.

Example.

Inverting twice returns the element, noted after Proposition 9.15 . It is listed below as inv_inv.

lean worked
1example (a : Obj) : (a⁻¹)⁻¹ = a := by
verified
goalGoals accomplished.

Exercise 9.12.

The identity is its own inverse.

lean proof
1example : e⁻¹ = e := by
goal⊢ e⁻¹ = e

Exercise 9.13.

Proposition 9.12 , with only the left-hand law assumed.

lean proof
1example (f : Obj) (h : ∀ a : Obj, f ∗ a = a) : f = e := by
goalf : Obj h : ∀ (a : Obj), f ∗ a = a ⊢ f = e

Exercise 9.14.

The right half of Proposition 9.22 .

lean proof
1example (a y z : Obj) (h : y ∗ a = z ∗ a) : y = z := by
goala y z : Obj h : y ∗ a = z ∗ a ⊢ y = z

Exercise 9.15.

Proposition 9.15 , in the form Problem 9.6 puts it.

lean proof
1example (a b c : Obj) (hb : b ∗ a = e) (hc : a ∗ c = e) : b = c := by
goala b c : Obj hb : b ∗ a = e hc : a ∗ c = e ⊢ b = c

Exercise 9.16.

The equation a∗x=ba * x = b has no second solution, as the remark after Proposition 9.22 observes.

lean proof
1example (a b x : Obj) (h : a ∗ x = b) : x = a⁻¹ ∗ b := by
goala b x : Obj h : a ∗ x = b ⊢ x = a⁻¹ ∗ b

Exercise 9.17.

Proposition 9.16 . Show first that b−1∗a−1b^{-1} * a^{-1} multiplies with a∗ba * b to give ee.

lean proof
1example (a b : Obj) : (a ∗ b)⁻¹ = b⁻¹ ∗ a⁻¹ := by
goala b : Obj ⊢ (a ∗ b)⁻¹ = b⁻¹ ∗ a⁻¹

Exercise 9.18.

The rearrangement that carries a right coset onto a left one in Theorem 9.37 .

lean proof
1example (x b : Obj) : x ∗ b = b ∗ (b⁻¹ ∗ x ∗ b) := by
goalx b : Obj ⊢ x ∗ b = b ∗ ((b⁻¹ ∗ x) ∗ b)

Exercise 9.19.

The first step of the backward direction of Proposition 9.26 .

lean proof
1example (H x : Obj) (hx : x ∈ H) (h : ∀ a b : Obj, a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H) : e ∈ H := by
goalH x : Obj hx : x ∈ H h : ∀ (a : Obj), ∀ (b : Obj), a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H ⊢ e ∈ H

Exercise 9.20.

Its second step.

lean proof
1example (H b : Obj) (he : e ∈ H) (hb : b ∈ H)2    (h : ∀ a b : Obj, a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H) : b⁻¹ ∈ H := by
goalH b : Obj he : e ∈ H hb : b ∈ H h : ∀ (a : Obj), ∀ (b : Obj), a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H ⊢ b⁻¹ ∈ H

Exercise 9.21.

And its third, which is where inv_inv earns its place.

lean proof
1example (H a b : Obj) (ha : a ∈ H) (hb : b⁻¹ ∈ H)2    (h : ∀ a b : Obj, a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H) : a ∗ b ∈ H := by
goalH a b : Obj ha : a ∈ H hb : b⁻¹ ∈ H h : ∀ (a : Obj), ∀ (b : Obj), a ∈ H → b ∈ H → a ∗ b⁻¹ ∈ H ⊢ a ∗ b ∈ H

Exercise 9.22.

The first half of Proposition 9.31 . A homomorphism is a map with the one property, so it arrives as an arrow together with the equation it satisfies.

lean proof
1example (f : Obj → Obj) (hf : ∀ a b : Obj, f (a ∗ b) = f a ∗ f b) : f e = e := by
goalf : Obj → Obj hf : ∀ (a : Obj), ∀ (b : Obj), f (a ∗ b) = f a ∗ f b ⊢ f e = e

Exercise 9.23.

Its second half, with the first half to hand.

lean proof
1example (f : Obj → Obj) (hf : ∀ a b : Obj, f (a ∗ b) = f a ∗ f b) (hfe : f e = e) (a : Obj) :2    f a⁻¹ = (f a)⁻¹ := by
goalf : Obj → Obj hf : ∀ (a : Obj), ∀ (b : Obj), f (a ∗ b) = f a ∗ f b hfe : f e = e a : Obj ⊢ f a⁻¹ = (f a)⁻¹

Exercise 9.24.

The kernel is closed under the operation, part of Proposition 9.32 . The kernel arrives as a set together with its membership criterion.

lean proof
1example (f : Obj → Obj) (K : Obj) (hf : ∀ a b : Obj, f (a ∗ b) = f a ∗ f b)2    (hK : ∀ x : Obj, x ∈ K ↔ f x = e) (a b : Obj) (ha : a ∈ K) (hb : b ∈ K) : a ∗ b ∈ K := by
goalf : Obj → Obj K : Obj hf : ∀ (a : Obj), ∀ (b : Obj), f (a ∗ b) = f a ∗ f b hK : ∀ (x : Obj), x ∈ K ↔ f x = e a b : Obj ha : a ∈ K hb : b ∈ K ⊢ a ∗ b ∈ K

Exercise 9.25.

Proposition 9.36 : the kernel is normal. (Harder.)

lean proof
1example (f : Obj → Obj) (K : Obj) (hf : ∀ a b : Obj, f (a ∗ b) = f a ∗ f b) (hfe : f e = e)2    (hinv : ∀ a : Obj, f a⁻¹ = (f a)⁻¹) (hK : ∀ x : Obj, x ∈ K ↔ f x = e)3    (a b : Obj) (ha : a ∈ K) : b⁻¹ ∗ a ∗ b ∈ K := by
goalf : Obj → Obj K : Obj hf : ∀ (a : Obj), ∀ (b : Obj), f (a ∗ b) = f a ∗ f b hfe : f e = e hinv : ∀ (a : Obj), f a⁻¹ = (f a)⁻¹ hK : ∀ (x : Obj), x ∈ K ↔ f x = e a b : Obj ha : a ∈ K ⊢ (b⁻¹ ∗ a) ∗ b ∈ K
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered
Nat.lt_irrefl ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet
Nat.lt_trans ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet
Nat.lt_succ_self ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet
Nat.not_lt_zero ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero
Nat.lt_succ_iff ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n
Num.inj ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω
swap_apply_left ∀ (a b : Obj), swap a b a = b — the transposition sends a to b
swap_apply_right ∀ (a b : Obj), swap a b b = a — and b to a
swap_apply_of_ne_of_ne ∀ {a b x : Obj}, x ≠ a → x ≠ b → swap a b x = x — and fixes every other point
swap_swap ∀ (a b x : Obj), swap a b (swap a b x) = x — a transposition is its own inverse
Function.iterate_zero_apply ∀ (f : Obj → Obj) (x : Obj), f^[0] x = x — the first clause of the powers of a map
Function.iterate_succ_apply ∀ (f : Obj → Obj) (n : ℕ) (x : Obj), f^[succ n] x = f^[n] (f x) — the second clause: f^[succ n] is f^[n] ∘ f
Function.iterate_add_apply ∀ (f : Obj → Obj) (m n : ℕ) (x : Obj), f^[m + n] x = f^[m] (f^[n] x) — the first law of exponents
Nat.factorial_zero 0 ! = succ 0 — the first clause of the factorial
Nat.factorial_succ ∀ (n : ℕ), (succ n) ! = succ n * n ! — the second clause of the factorial
Nat.choose_zero_right ∀ (n : ℕ), choose n 0 = succ 0 — the empty set is the one 0-subset
Nat.choose_eq_zero_of_lt ∀ {n k : ℕ}, n < k → choose n k = 0 — no subset is larger than the whole
Nat.choose_succ_succ ∀ (n k : ℕ), choose (succ n) (succ k) = choose n k + choose n (succ k) — Pascal's identity
mul_assoc ∀ (a b c : Obj), (a ∗ b) ∗ c = a ∗ (b ∗ c) — the operation associates
e_mul ∀ (a : Obj), e ∗ a = a — the identity on the left
mul_e ∀ (a : Obj), a ∗ e = a — and on the right
inv_mul_cancel ∀ (a : Obj), a⁻¹ ∗ a = e — the inverse on the left
mul_inv_cancel ∀ (a : Obj), a ∗ a⁻¹ = e — and on the right
inv_inv ∀ (a : Obj), (a⁻¹)⁻¹ = a — worked above: inverting twice gives the element back
mul_left_cancel ∀ {a x y : Obj}, a ∗ x = a ∗ y → x = y — worked above: the left half of prop-9-5

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b

Lesson 10

Integers

Taught

Formal Differences

At the end of the last chapter (N0,+)(\mathbb{N}_0, +) was a monoid in which cancellation holds and in which nothing but 00 has an inverse. It is regular and it is not a group, and this chapter closes the gap between those two facts. We do not add an axiom and we do not assume the integers exist. We build them, out of the natural numbers we already have, by writing down what a difference ought to be and then declaring two of them equal when they ought to be equal.

Pairs and the Sum Criterion

Every integer we want is a difference of two natural numbers. We want 33 to be 5−25 - 2 and −3-3 to be 5−85 - 8, and we want 33 to be 6−36 - 3 and 7−47 - 4 as well: the pair recording the difference is not unique, and any construction must say when two pairs record the same thing.

The condition we want is m−n=m′−n′m - n = m' - n', and as it stands that is not a statement about N0\mathbb{N}_0, since subtraction is available only when the answer stays in N0\mathbb{N}_0. But adding n+n′n + n' to both sides of it turns it into

m+n′=n+m′,m + n' = n + m',

which mentions nothing but addition and is a perfectly good statement about four natural numbers. That equation is the relation we put on pairs, and the rest of the chapter is built on it.

Definition 10.1 (Net-difference equivalence).

On the set N0×N0\mathbb{N}_0 \times \mathbb{N}_0 declare

(m,n)∼(m′,n′)if and only ifm+n′=n+m′.(m, n) \sim (m', n') \qquad \text{if and only if} \qquad m + n' = n + m'.

The relation ∼\sim is called net-difference equivalence, and the displayed equation is the sum criterion.

Read the pair (m,n)(m, n) as a formal stand-in for the difference m−nm - n, one that makes sense whether or not that difference exists in N0\mathbb{N}_0. Two pairs are related exactly when the differences they stand for ought to agree. The symbol ∼\sim is used for equivalence relations throughout mathematics and throughout this book; in this chapter it means only the relation just defined.

Proposition 10.2 (Net-difference equivalence is an equivalence relation).

The relation ∼\sim is an equivalence relation on N0×N0\mathbb{N}_0 \times \mathbb{N}_0.

Discussion.

Three properties to check, and each unfolds the sum criterion into a statement about addition in N0\mathbb{N}_0. Reflexivity asks for m+n=n+mm + n = n + m, which is commutativity. Symmetry asks that m+n′=n+m′m + n' = n + m' give m′+n=n′+mm' + n = n' + m, which is the same equation read backwards with the two sides commuted. Transitivity is the only part that needs work: two sum criteria are given and a third must be produced, and the obstacle is that the middle pair (m′,n′)(m', n') appears in both hypotheses and in neither conclusion. The way to remove it is to add n′′n'' to the first equation so that the second becomes substitutable, and then to strip the surviving n′n' off both sides by cancellation, the property that made (N0,+)(\mathbb{N}_0, +) regular.

Proof.

For reflexivity, m+n=n+mm + n = n + m by the laws of addition, so (m,n)∼(m,n)(m, n) \sim (m, n).

For symmetry, suppose (m,n)∼(m′,n′)(m, n) \sim (m', n'), so m+n′=n+m′m + n' = n + m'. Commuting each side gives m′+n=n′+mm' + n = n' + m, which is the sum criterion for (m′,n′)∼(m,n)(m', n') \sim (m, n).

For transitivity, suppose (m,n)∼(m′,n′)(m, n) \sim (m', n') and (m′,n′)∼(m′′,n′′)(m', n') \sim (m'', n''), so

m+n′=n+m′andm′+n′′=n′+m′′.m + n' = n + m' \qquad \text{and} \qquad m' + n'' = n' + m''.

Adding n′′n'' to the first equation and rearranging by associativity and commutativity gives m+n′+n′′=n+m′+n′′m + n' + n'' = n + m' + n''. The second equation replaces m′+n′′m' + n'' on the right by n′+m′′n' + m'', so

m+n′+n′′=n+n′+m′′.m + n' + n'' = n + n' + m''.

Cancelling n′n' leaves m+n′′=n+m′′m + n'' = n + m'', which is (m,n)∼(m′′,n′′)(m, n) \sim (m'', n'').

The Net Difference

The sum criterion is easy to check but does not describe what a class looks like. A second description of the same relation gives each pair a standard representative: compare the two coordinates using trichotomy and subtract the smaller from the larger.

Definition 10.3 (Net difference).

The net-difference function

Δ:N0×N0→N0×N0\Delta : \mathbb{N}_0 \times \mathbb{N}_0 \to \mathbb{N}_0 \times \mathbb{N}_0

is defined by

Δ(m,n)=def{(m−n, 0)if n<m,(0, n−m)if m<n,(0, 0)if m=n,\Delta(m, n) \defeq \begin{cases} (m - n, \, 0) & \text{if } n < m, \\ (0, \, n - m) & \text{if } m < n, \\ (0, \, 0) & \text{if } m = n, \end{cases}

where m−nm - n is the difference of the order chapter: the unique element with n+(m−n)=mn + (m - n) = m, which exists because n⩽mn \leqslant m.

By trichotomy the three clauses cover every pair exactly once, so Δ\Delta is a function. Informally, (x,0)(x, 0) with x∈Nx \in \mathbb{N} is a positive difference, (0,x)(0, x) a negative one, and (0,0)(0,0) is zero; the next few propositions make that reading precise and tie Δ\Delta back to ∼\sim.

Proposition 10.4 (Coordinates of a net difference).

Let m,n∈N0m, n \in \mathbb{N}_0. Then at least one coordinate of Δ(m,n)\Delta(m, n) is 00, and

  1. if Δ(m,n)=(x,0)\Delta(m, n) = (x, 0) with x∈Nx \in \mathbb{N}, then n<mn < m;
  2. if Δ(m,n)=(0,x)\Delta(m, n) = (0, x) with x∈Nx \in \mathbb{N}, then m<nm < n;
  3. if Δ(m,n)=(0,0)\Delta(m, n) = (0, 0), then m=nm = n.

Discussion.

The opening claim is read straight off the definition, every clause of which puts a 00 in one coordinate. The three numbered parts run the definition backwards, which is legitimate because the three cases are mutually exclusive: given the value of Δ(m,n)\Delta(m, n), we ask which clause could have produced it and find that only one can. For the first two the argument is that the other two clauses put 00 in the coordinate that is here positive. The third is the leftover case and is best argued by contradiction: if m≠nm \neq n then trichotomy puts one of them strictly below the other, and either way one coordinate of Δ(m,n)\Delta(m, n) is a positive natural number, so the value is not (0,0)(0,0).

Proof.

Trichotomy gives exactly one of n<mn < m, m<nm < n, m=nm = n, and each of the three clauses of the definition places 00 in at least one coordinate.

Suppose Δ(m,n)=(x,0)\Delta(m, n) = (x, 0) with x∈Nx \in \mathbb{N}. The second and third clauses put 00 in the first coordinate, so neither produced this value, and the first clause applies; hence n<mn < m. The same argument with the coordinates exchanged gives the second part.

For the third, suppose m≠nm \neq n. Trichotomy gives n<mn < m or m<nm < n. In the first case Δ(m,n)=(m−n,0)\Delta(m, n) = (m - n, 0) and m−nm - n is positive, since m−n=0m - n = 0 would give m=nm = n; in the second case the second coordinate is positive for the same reason. Either way Δ(m,n)≠(0,0)\Delta(m, n) \neq (0, 0).

Proposition 10.5 (Shifting both coordinates).

For all m,n,x∈N0m, n, x \in \mathbb{N}_0,

Δ(m,n)=Δ(m+x, n+x).\Delta(m, n) = \Delta(m + x, \, n + x).

Discussion.

An equality of values of Δ\Delta, so we split on the trichotomy comparison of mm with nn and check the three cases separately. Shifting does not change the comparison: adding a fixed element preserves the order, so if n<mn < m then n+x<m+xn + x < m + x and both sides of the claimed equality are produced by the same clause. Once that is known the two sides are (m−n,0)(m - n, 0) and ((m+x)−(n+x),0)\bigl((m+x) - (n+x), 0\bigr), and what remains is that shifting both arguments leaves the difference alone, which is uniqueness of differences applied to the defining equation. The case m<nm < n is the same with the coordinates exchanged, and m=nm = n is immediate.

Proof.

Suppose n<mn < m. Then n+x<m+xn + x < m + x, so

Δ(m,n)=(m−n, 0),Δ(m+x,n+x)=((m+x)−(n+x), 0).\Delta(m, n) = (m - n, \, 0), \qquad \Delta(m + x, n + x) = \bigl((m + x) - (n + x), \, 0\bigr).

Write d=defm−nd \defeq m - n, so n+d=mn + d = m and hence (n+x)+d=m+x(n + x) + d = m + x by associativity and commutativity. Uniqueness of differences therefore gives (m+x)−(n+x)=d(m + x) - (n + x) = d, and the two values agree.

If m<nm < n the same argument applies with the coordinates exchanged. If m=nm = n then m+x=n+xm + x = n + x, and both sides are (0,0)(0, 0).

Proposition 10.6 (Equal net differences satisfy the sum criterion).

If Δ(m,n)=Δ(m′,n′)\Delta(m, n) = \Delta(m', n'), then m+n′=n+m′m + n' = n + m'.

Discussion.

The hypothesis is an equality of pairs and the conclusion an equality of natural numbers, and we must convert one into the other, and the conversion depends on which of the three shapes the common value has. We therefore split on the comparison of mm with nn, and in each case the previous proposition on coordinates transfers the same comparison to m′m' and n′n'. Once both pairs are known to be of the same shape with the same entry xx, the defining property of the difference rewrites the hypothesis as m=n+xm = n + x and m′=n′+xm' = n' + x, two equations with no subtraction in them, and substituting both into m+n′m + n' produces n+m′n + m' after rearrangement.

Proof.

Suppose first that n<mn < m. Then Δ(m,n)=(x,0)\Delta(m, n) = (x, 0) with x=defm−n∈Nx \defeq m - n \in \mathbb{N}, so Δ(m′,n′)=(x,0)\Delta(m', n') = (x, 0) as well; by the proposition on coordinates n′<m′n' < m', and m′−n′=xm' - n' = x. Hence m=n+xm = n + x and m′=n′+xm' = n' + x, and

m+n′=(n+x)+n′=n+(x+n′)=n+(n′+x)=n+m′,m + n' = (n + x) + n' = n + (x + n') = n + (n' + x) = n + m',

by associativity and commutativity.

The case m<nm < n is the same argument with the coordinates exchanged. If m=nm = n then Δ(m,n)=(0,0)\Delta(m, n) = (0,0), so Δ(m′,n′)=(0,0)\Delta(m', n') = (0,0) and m′=n′m' = n'; then m+n′=n+m′m + n' = n + m' reads m+m′=m+m′m + m' = m + m'.

Proposition 10.7 (The sum criterion yields a common shift).

Let (m,n)(m, n) and (m′,n′)(m', n') satisfy m+n′=n+m′m + n' = n + m' with n⩽n′n \leqslant n'. Then there is x∈N0x \in \mathbb{N}_0 with

n′=n+xandm′=m+x.n' = n + x \qquad \text{and} \qquad m' = m + x.

Discussion.

An existence claim, and the hypothesis n⩽n′n \leqslant n' gives the witness directly: the description of the associated order says that n⩽n′n \leqslant n' is exactly the existence of an xx with n′=n+xn' = n + x. It remains to check that the same xx works in the other coordinate. Substituting n+xn + x for n′n' in the sum criterion and rearranging leaves nn in front on both sides, and cancelling it gives m′=m+xm' = m + x.

Proof.

Since n⩽n′n \leqslant n', there is x∈N0x \in \mathbb{N}_0 with n′=n+xn' = n + x. Then

n+m′=m+n′=m+(n+x)=n+(m+x),n + m' = m + n' = m + (n + x) = n + (m + x),

the first equality being the sum criterion and the last associativity and commutativity. Cancelling nn gives m′=m+xm' = m + x.

Three readings of “the same formal difference” are now available, and they agree.

Theorem 10.8 (Characterisations of net-difference equivalence).

Let (m,n)(m, n) and (m′,n′)(m', n') lie in N0×N0\mathbb{N}_0 \times \mathbb{N}_0. The following are equivalent.

  1. Δ(m,n)=Δ(m′,n′)\Delta(m, n) = \Delta(m', n').
  2. m+n′=n+m′m + n' = n + m'.
  3. Either n′=n+xn' = n + x and m′=m+xm' = m + x for some x∈N0x \in \mathbb{N}_0, or n=n′+xn = n' + x and m=m′+xm = m' + x for some x∈N0x \in \mathbb{N}_0.

Discussion.

Three conditions asserted to be equivalent, so rather than six implications we run a cycle through them, in the manner already used for equivalence classes. The first arrow, from the net difference to the sum criterion, is the proposition just proved. The second, from the sum criterion to the shift, is the other proposition together with a case split: the shift condition offers two alternatives because the previous proposition needed n⩽n′n \leqslant n', and trichotomy guarantees that one of n⩽n′n \leqslant n' and n′⩽nn' \leqslant n holds, each giving one alternative once the roles of the two pairs are exchanged. The third arrow, from the shift back to the net difference, is the proposition on shifting both coordinates, read in one direction for the first alternative and in the other for the second.

Proof.

That the first implies the second is the proposition on equal net differences.

Suppose the second holds. If n⩽n′n \leqslant n', the proposition on common shifts gives xx with n′=n+xn' = n + x and m′=m+xm' = m + x, which is the first alternative of the third condition. Otherwise n′⩽nn' \leqslant n by trichotomy, and the same proposition applied to the pairs in the other order — the sum criterion m′+n=n′+mm' + n = n' + m being the given equation read backwards — gives xx with n=n′+xn = n' + x and m=m′+xm = m' + x, which is the second alternative.

Suppose the third holds. Under the first alternative, the proposition on shifting both coordinates gives

Δ(m,n)=Δ(m+x, n+x)=Δ(m′,n′).\Delta(m, n) = \Delta(m + x, \, n + x) = \Delta(m', n').

Under the second it gives Δ(m′,n′)=Δ(m′+x, n′+x)=Δ(m,n)\Delta(m', n') = \Delta(m' + x, \, n' + x) = \Delta(m, n). Either way the first condition holds, and the cycle is closed.

Remark (Which characterisation to use).

Each of the three is the convenient one somewhere below. The sum criterion is easiest to use in algebra, since it is an equation in N0\mathbb{N}_0 and nothing else, and every well-definedness check in this chapter uses it. The shift criterion says that two pairs agree when one is the other with the same amount added to both coordinates. The net difference gives each class a single named representative, and that is what lets us say what the integers are rather than only when two of them are equal.

Problem 10.1.

Compute Δ(19,15)\Delta(19, 15) and Δ(14,16)\Delta(14, 16).

Problem 10.2.

Show that m−0=mm - 0 = m for every m∈N0m \in \mathbb{N}_0, from the defining property of the difference. Deduce that Δ(m,0)=(m,0)\Delta(m, 0) = (m, 0) and Δ(0,n)=(0,n)\Delta(0, n) = (0, n) for all m,n∈N0m, n \in \mathbb{N}_0, and hence that Δ∘Δ=Δ\Delta \circ \Delta = \Delta.

Problem 10.3.

Prove the proposition that ∼\sim is an equivalence relation a second time, taking the first condition of the theorem as the definition of ∼\sim and checking the three properties directly from properties of Δ\Delta.

The Integers

Integers as Classes

Definition 10.9 (The integers).

The set of integers is the quotient

Z=def(N0×N0)/∼\mathbb{Z} \defeq \bigl(\mathbb{N}_0 \times \mathbb{N}_0\bigr)\big/{\sim}

of N0×N0\mathbb{N}_0 \times \mathbb{N}_0 by net-difference equivalence. We write [(m,n)][(m, n)] for the class of the pair (m,n)(m, n).

No axiom has been added. The set is carved out of a product of two copies of N0\mathbb{N}_0 by a relation already checked to be an equivalence, and both of those operations have been available since the chapters on sets and on relations. What remains is to define the arithmetic.

By the theorem and the proposition on coordinates, every class has exactly one representative among the pairs

(x,0) with x∈N0,(0,x) with x∈N,(x, 0) \text{ with } x \in \mathbb{N}_0, \qquad (0, x) \text{ with } x \in \mathbb{N},

these being the values Δ\Delta takes, and (0,0)(0,0) appearing once in the first list. We call it the normal form of the class. In particular [(m,n)]=[(m−n,0)][(m,n)] = [(m - n, 0)] when n⩽mn \leqslant m, and [(m,n)]=[(0,n−m)][(m, n)] = [(0, n - m)] when m⩽nm \leqslant n.

Proposition 10.10 (Embedding the natural numbers).

The map

ι:N0→Z,ι(n)=def[(n,0)]\iota : \mathbb{N}_0 \to \mathbb{Z}, \qquad \iota(n) \defeq [(n, 0)]

is injective.

Discussion.

Injectivity is the statement that equal values force equal arguments, so we assume ι(n)=ι(n′)\iota(n) = \iota(n') and must reach n=n′n = n'. Equal classes mean related representatives, by the characterisation of equivalence classes, and the sum criterion for those two particular pairs is n+0=0+n′n + 0 = 0 + n', which is the conclusion up to two zeros.

Proof.

Suppose [(n,0)]=[(n′,0)][(n, 0)] = [(n', 0)]. Then (n,0)∼(n′,0)(n, 0) \sim (n', 0), so n+0=0+n′n + 0 = 0 + n' by the sum criterion, and n=n′n = n' by the identity law for addition.

So ι\iota embeds N0\mathbb{N}_0 in Z\mathbb{Z}, and the normal form says every class is either ι(x)\iota(x) for a unique x∈N0x \in \mathbb{N}_0, or [(0,x)][(0, x)] for a unique x∈Nx \in \mathbb{N}. Once addition is in place the second family will turn out to be the additive inverses of the first.

Problem 10.4.

List five distinct pairs in the class [(3,5)][(3, 5)], and give the normal form of that class.

Problem 10.5.

Show that [(m,n)]=[(0,0)][(m, n)] = [(0, 0)] if and only if m=nm = n.

Addition and Negation

The arithmetic must be defined on classes, but the only formulae available are written with pairs. We follow the same pattern three times: define the operation on pairs, prove that equivalent inputs give equivalent outputs, and only then pass to classes. The middle step ensures that the result does not depend on which representatives were picked.

Pretend for a moment that differences already exist. Then −(m−n)=n−m-(m - n) = n - m and

(m−n)+(m′−n′)=(m+m′)−(n+n′),(m - n) + (m' - n') = (m + m') - (n + n'),

and those two identities suggest the definitions on pairs. Nothing below uses this; it only motivates the definitions.

Definition 10.11 (Pre-negation).

The pre-negation of a pair (m,n)∈N0×N0(m, n) \in \mathbb{N}_0 \times \mathbb{N}_0 is the pair (n,m)(n, m).

Proposition 10.12 (Pre-negation respects equivalence).

If (m,n)∼(m′,n′)(m, n) \sim (m', n'), then (n,m)∼(n′,m′)(n, m) \sim (n', m').

Discussion.

Hypothesis and conclusion are both sum criteria, so both unfold into equations in N0\mathbb{N}_0. The hypothesis is m+n′=n+m′m + n' = n + m'. The conclusion, written out for the pairs (n,m)(n, m) and (n′,m′)(n', m'), is n+m′=m+n′n + m' = m + n'. Those are the same equation with the two sides exchanged, so symmetry of equality is the whole proof.

Proof.

The hypothesis is m+n′=n+m′m + n' = n + m'. Reading it backwards gives n+m′=m+n′n + m' = m + n', which is the sum criterion for (n,m)∼(n′,m′)(n, m) \sim (n', m').

Definition 10.13 (Negation).

Define negation on Z\mathbb{Z} by

−[(m,n)]=def[(n,m)].-[(m, n)] \defeq [(n, m)].

By the proposition just proved, the right-hand side depends only on the class of (m,n)(m, n) and not on the representative chosen for it.

Definition 10.14 (Pre-addition).

Define pre-addition on pairs by

(m,n)+(m′,n′)=def(m+m′,  n+n′).(m, n) + (m', n') \defeq (m + m', \; n + n').

Proposition 10.15 (Pre-addition respects equivalence).

If (m,n)∼(a,b)(m, n) \sim (a, b) and (m′,n′)∼(a′,b′)(m', n') \sim (a', b'), then

(m+m′,  n+n′)∼(a+a′,  b+b′).(m + m', \; n + n') \sim (a + a', \; b + b').

Discussion.

Two sum criteria are given and one is wanted, and since all three are equations between sums in N0\mathbb{N}_0 we add the two hypotheses together. What comes out is an equation whose two sides are the four summands in some order, and the general associativity and rearrangement available in any abelian semigroup lets us collect them into the grouping the conclusion asks for. No case split and no cancellation are needed.

Proof.

The hypotheses are m+b=n+am + b = n + a and m′+b′=n′+a′m' + b' = n' + a'. Adding the two equations and rearranging the summands on each side gives

(m+m′)+(b+b′)=(n+n′)+(a+a′),(m + m') + (b + b') = (n + n') + (a + a'),

which is exactly the sum criterion for (m+m′,n+n′)∼(a+a′,b+b′)(m + m', n + n') \sim (a + a', b + b').

Definition 10.16 (Addition and subtraction).

Define addition on Z\mathbb{Z} by

[(m,n)]+[(m′,n′)]=def[(m+m′,  n+n′)],[(m, n)] + [(m', n')] \defeq [(m + m', \; n + n')],

which the previous proposition makes independent of the representatives; and for x,y∈Zx, y \in \mathbb{Z} define x−y=defx+(−y)x - y \defeq x + (-y).

Theorem 10.17 (The integers form an abelian group).

With the addition just defined, (Z,+)(\mathbb{Z}, +) is an abelian group. Its identity is [(0,0)][(0, 0)] and the inverse of [(m,n)][(m, n)] is [(n,m)][(n, m)]. Moreover

ι(m+n)=ι(m)+ι(n)for all m,n∈N0,\iota(m + n) = \iota(m) + \iota(n) \qquad \text{for all } m, n \in \mathbb{N}_0,

and ι(0)=[(0,0)]\iota(0) = [(0, 0)].

Discussion.

The definition of a group asks for four things and the last claim adds a fifth, but every one of them is a law in N0\mathbb{N}_0 applied in each coordinate, so the proof is a sequence of short computations. Associativity and commutativity of the new addition are associativity and commutativity of the old one, used once in each coordinate. The class [(0,0)][(0,0)] is an identity because 00 is one in N0\mathbb{N}_0. The only step that needs thought is the inverse: adding [(m,n)][(m,n)] to [(n,m)][(n,m)] gives the class of (m+n, n+m)(m + n, \, n + m), and this is [(0,0)][(0,0)] not because the two coordinates are zero (they are not) but by the sum criterion, which asks only that (m+n)+0=(n+m)+0(m+n) + 0 = (n+m) + 0. That is commutativity. The claim about ι\iota is the definition of addition read on pairs whose second coordinate is 00.

Proof.

Let x=[(m,n)]x = [(m, n)], y=[(m′,n′)]y = [(m', n')] and z=[(m′′,n′′)]z = [(m'', n'')]. Then

(x+y)+z=[((m+m′)+m′′,  (n+n′)+n′′)]=x+(y+z)(x + y) + z = \bigl[\bigl((m + m') + m'', \; (n + n') + n''\bigr)\bigr] = x + (y + z)

by associativity of addition in N0\mathbb{N}_0 in each coordinate, so the operation is associative; and x+y=y+xx + y = y + x by commutativity in each coordinate. So (Z,+)(\mathbb{Z}, +) is an abelian semigroup.

Next,

x+[(0,0)]=[(m+0,  n+0)]=[(m,n)]=x,x + [(0, 0)] = [(m + 0, \; n + 0)] = [(m, n)] = x,

so [(0,0)][(0,0)] is an identity, and it is the only one by uniqueness of the identity. Finally

x+[(n,m)]=[(m+n,  n+m)]=[(0,0)],x + [(n, m)] = [(m + n, \; n + m)] = [(0, 0)],

the last equality by the sum criterion, which asks for (m+n)+0=(n+m)+0(m + n) + 0 = (n + m) + 0 and gets it from commutativity. So every element is invertible and (Z,+)(\mathbb{Z}, +) is an abelian group.

For the last claim, ι(m)+ι(n)=[(m,0)]+[(n,0)]=[(m+n, 0)]=ι(m+n)\iota(m) + \iota(n) = [(m, 0)] + [(n, 0)] = [(m + n, \, 0)] = \iota(m + n), and ι(0)=[(0,0)]\iota(0) = [(0,0)] by definition.

In particular −ι(n)=−[(n,0)]=[(0,n)]-\iota(n) = -[(n, 0)] = [(0, n)], so the classes with normal form (0,n)(0, n) are precisely the additive inverses of the embedded positive naturals. Every integer is therefore ι(x)\iota(x) for a unique x∈N0x \in \mathbb{N}_0 or −ι(x)-\iota(x) for a unique x∈Nx \in \mathbb{N}, which is the normal form restated using addition. Writing nn for ι(n)\iota(n) and −n-n for −ι(n)-\iota(n), the familiar list …,−2,−1,0,1,2,…\ldots, -2, -1, 0, 1, 2, \ldots names every integer exactly once.

Remark (What was gained).

The chapter on groups observed that (N0,+)(\mathbb{N}_0, +) is regular but not a group, and said that regularity is the condition needed to enlarge a monoid into a group. This theorem does that for (N0,+)(\mathbb{N}_0, +). The regularity was used once, in the proof that ∼\sim is transitive, and without it the relation would not be an equivalence and there would be no quotient.

Problem 10.6.

Compute [(5,2)]+[(1,4)][(5, 2)] + [(1, 4)] and −[(5,2)]-[(5, 2)], and give each answer in normal form.

Problem 10.7.

Prove directly from the definitions that −(x+y)=(−x)+(−y)-(x + y) = (-x) + (-y) and −(−x)=x-(-x) = x for all x,y∈Zx, y \in \mathbb{Z}. Which of the two also follows from a proposition of the chapter on groups, and why does the other not?

Problem 10.8.

Show that ι(m)−ι(n)=[(m,n)]\iota(m) - \iota(n) = [(m, n)] for all m,n∈N0m, n \in \mathbb{N}_0, so that every class really is a difference of two embedded natural numbers.

Multiplication

Pretend again that differences exist. Then

(m−n)(m′−n′)=(mm′+nn′)−(mn′+nm′),(m - n)(m' - n') = (mm' + nn') - (mn' + nm'),

and the rule on pairs is forced.

Definition 10.18 (Pre-multiplication).

Define pre-multiplication on pairs by

(m,n)⋅(m′,n′)=def(mm′+nn′,  mn′+nm′).(m, n) \cdot (m', n') \defeq (mm' + nn', \; mn' + nm').

Proposition 10.19 (Pre-multiplication respects equivalence).

Let (m,n)∼(a,b)(m, n) \sim (a, b). Then for every pair (m′,n′)(m', n'),

(m,n)⋅(m′,n′)∼(a,b)⋅(m′,n′).(m, n) \cdot (m', n') \sim (a, b) \cdot (m', n').

Likewise, if (m′,n′)∼(a′,b′)(m', n') \sim (a', b') then (m,n)⋅(m′,n′)∼(m,n)⋅(a′,b′)(m, n) \cdot (m', n') \sim (m, n) \cdot (a', b') for every (m,n)(m, n).

Discussion.

Two statements, one for each factor, and together they are what a definition on classes needs: changing the representatives one at a time changes them both. Each is again an implication between sum criteria, but unlike the additive case the hypothesis cannot simply be added to something, because the conclusion involves products. So we write down the sum criterion the conclusion asks for, expand both of its sides using distributivity in N0\mathbb{N}_0, and regroup the terms until the hypothesis becomes visible. The left side collects into (m+b)m′+(n+a)n′(m + b)m' + (n + a)n' and the right into (m+b)n′+(n+a)m′(m + b)n' + (n + a)m'; the hypothesis says the two bracketed factors are equal, so the two sides are the same sum written twice. The second statement is the first with the roles of the factors exchanged, which is legitimate because pre-multiplication is symmetric in its two arguments.

Proof.

Assume m+b=n+am + b = n + a. The two pre-products are

(mm′+nn′,  mn′+nm′)and(am′+bn′,  an′+bm′),(mm' + nn', \; mn' + nm') \qquad \text{and} \qquad (am' + bn', \; an' + bm'),

and the sum criterion for their equivalence asks that

(mm′+nn′)+(an′+bm′)=(mn′+nm′)+(am′+bn′).(mm' + nn') + (an' + bm') = (mn' + nm') + (am' + bn').

Regrouping the left side by distributivity, associativity and commutativity gives (m+b)m′+(n+a)n′(m + b)m' + (n + a)n', and the right side gives (m+b)n′+(n+a)m′(m + b)n' + (n + a)m'. Writing kk for the common value of m+bm + b and n+an + a, both sides are km′+kn′km' + kn', so they agree.

For the second statement, pre-multiplication is unchanged when its two arguments are exchanged, since mm′+nn′mm' + nn' and mn′+nm′mn' + nm' are symmetric under exchanging (m,n)(m,n) with (m′,n′)(m',n'); so the first statement applied to the exchanged pairs gives it.

Definition 10.20 (Multiplication).

Define multiplication on Z\mathbb{Z} by

[(m,n)]⋅[(m′,n′)]=def[(mm′+nn′,  mn′+nm′)],[(m, n)] \cdot [(m', n')] \defeq [(mm' + nn', \; mn' + nm')],

which the previous proposition makes independent of both choices of representative.

Theorem 10.21 (Distributivity in the integers).

For all x,y,z∈Zx, y, z \in \mathbb{Z},

x(y+z)=xy+xz.x(y + z) = xy + xz.

Discussion.

An identity between two integers, so we name representatives for the three of them and compute both sides down to a single class each. The left side expands by the definition of addition and then of multiplication, the right side by multiplication twice and then addition, and each expansion is an application of distributivity in N0\mathbb{N}_0 inside a coordinate. The two resulting pairs then have the same four terms in each coordinate, in a different order, so commutativity of addition finishes. We write the computation with the pairs visible, since the identity holds coordinatewise.

Proof.

Let x=[(a,b)]x = [(a, b)], y=[(c,d)]y = [(c, d)] and z=[(e,f)]z = [(e, f)]. Then y+z=[(c+e,  d+f)]y + z = [(c + e, \; d + f)], so

x(y+z)=[(a(c+e)+b(d+f),  a(d+f)+b(c+e))]=[(ac+ae+bd+bf,  ad+af+bc+be)],\begin{aligned} x(y + z) &= \bigl[\bigl(a(c + e) + b(d + f), \; a(d + f) + b(c + e)\bigr)\bigr] \\ &= \bigl[\bigl(ac + ae + bd + bf, \; ad + af + bc + be\bigr)\bigr], \end{aligned}

while

xy+xz=[(ac+bd,  ad+bc)]+[(ae+bf,  af+be)]=[(ac+bd+ae+bf,  ad+bc+af+be)].\begin{aligned} xy + xz &= [(ac + bd, \; ad + bc)] + [(ae + bf, \; af + be)] \\ &= \bigl[\bigl(ac + bd + ae + bf, \; ad + bc + af + be\bigr)\bigr]. \end{aligned}

The two pairs have the same terms in each coordinate, so they are equal by commutativity of addition in N0\mathbb{N}_0, and the two classes agree.

Proposition 10.22 (The embedding preserves multiplication).

For all m,n∈N0m, n \in \mathbb{N}_0 we have ι(mn)=ι(m)⋅ι(n)\iota(mn) = \iota(m) \cdot \iota(n). Moreover [(1,0)][(1, 0)] is an identity for multiplication on all of Z\mathbb{Z}.

Discussion.

Two computations, each one line. For the first, expand ι(m)⋅ι(n)\iota(m) \cdot \iota(n) by the definition: both second coordinates are 00, so three of the four products in the formula vanish and what is left is (mn,0)(mn, 0), which is ι(mn)\iota(mn). The second claim is not the case m=1m = 1 of the first, since that only says ι(1)\iota(1) acts as an identity on the image of ι\iota, and the image is not all of Z\mathbb{Z}; so it needs its own computation, which is the same expansion carried out against a general class. Only one side need be checked, because pre-multiplication is symmetric in its arguments.

Proof.

For the first claim,

ι(m)⋅ι(n)=[(m,0)]⋅[(n,0)]=[(mn+0⋅0,  m⋅0+0⋅n)]=[(mn,0)]=ι(mn).\begin{aligned} \iota(m) \cdot \iota(n) &= [(m, 0)] \cdot [(n, 0)] \\ &= [(mn + 0 \cdot 0, \; m \cdot 0 + 0 \cdot n)] = [(mn, 0)] = \iota(mn). \end{aligned}

For the second, let [(a,b)][(a, b)] be any class. Then

[(1,0)]⋅[(a,b)]=[(1⋅a+0⋅b,  1⋅b+0⋅a)]=[(a,b)],[(1, 0)] \cdot [(a, b)] = [(1 \cdot a + 0 \cdot b, \; 1 \cdot b + 0 \cdot a)] = [(a, b)],

and the other side is the same computation, pre-multiplication being symmetric in its two arguments.

Remark (What is left to check).

The remaining algebra (associativity and commutativity of multiplication, the sign rules (−x)y=x(−y)=−(xy)(-x)y = x(-y) = -(xy) and (−x)(−y)=xy(-x)(-y) = xy, and the absence of zero divisors) follows the pattern of this section without exception: name representatives, expand, and quote the corresponding law in N0\mathbb{N}_0. None of it needs a new idea, so it is set as problems. What is still missing is the order on Z\mathbb{Z}.

Problem 10.9.

Prove that multiplication on Z\mathbb{Z} is commutative and associative.

Problem 10.10.

Prove that (−x)y=x(−y)=−(xy)(-x)y = x(-y) = -(xy) and (−x)(−y)=xy(-x)(-y) = xy for all x,y∈Zx, y \in \mathbb{Z}.

Problem 10.11.

Prove that if x,y∈Zx, y \in \mathbb{Z} and xy=[(0,0)]xy = [(0, 0)], then x=[(0,0)]x = [(0,0)] or y=[(0,0)]y = [(0,0)]. Reduce to normal form first, and then use that a product of positive natural numbers is positive.

Problem 10.12.

Using the problem that ι(m)−ι(n)=[(m,n)]\iota(m) - \iota(n) = [(m, n)], show that [(m,n)]=[(m′,n′)][(m, n)] = [(m', n')] if and only if ι(m)−ι(n)=ι(m′)−ι(n′)\iota(m) - \iota(n) = \iota(m') - \iota(n') in Z\mathbb{Z}.

The Order on the Integers

So far nothing distinguishes [(5,2)][(5,2)] from [(2,5)][(2,5)] except the labels; the arithmetic treats them alike. The order does distinguish them, and we define it from the normal form, which sorts every class into one of three shapes.

Definition 10.23 (Positive integers).

An integer xx is positive if x=ι(n)x = \iota(n) for some n∈Nn \in \mathbb{N}.

Proposition 10.24 (Every integer has exactly one sign).

Let x∈Zx \in \mathbb{Z}. Then exactly one of the following holds: xx is positive; x=ι(0)x = \iota(0); x=−yx = -y for a positive yy.

Discussion.

The claim is that three cases cover Z\mathbb{Z} and no two of them overlap, so there are two halves to it. Coverage is the normal form: every class is [(a,0)][(a, 0)] with a∈N0a \in \mathbb{N}_0 or [(0,a)][(0, a)] with a∈Na \in \mathbb{N}, and the first of those is ι(a)\iota(a), positive when a∈Na \in \mathbb{N} and ι(0)\iota(0) when a=0a = 0, while the second is −ι(a)-\iota(a) by the remark following the group theorem. Exclusivity is the uniqueness half of the normal form, together with the injectivity of ι\iota: two of the cases could only collide if two distinct normal forms named the same class, or if ι\iota identified 00 with something in N\mathbb{N}.

Proof.

Every class has exactly one normal form. If it is (a,0)(a, 0) with a∈Na \in \mathbb{N}, then x=ι(a)x = \iota(a) is positive. If it is (0,0)(0, 0), then x=ι(0)x = \iota(0). If it is (0,a)(0, a) with a∈Na \in \mathbb{N}, then x=−ι(a)x = -\iota(a) with ι(a)\iota(a) positive. So the three cases cover Z\mathbb{Z}.

For exclusivity, suppose xx is positive and also x=ι(0)x = \iota(0). Then ι(n)=ι(0)\iota(n) = \iota(0) for some n∈Nn \in \mathbb{N}, so n=0n = 0 by injectivity of ι\iota, contradicting 0∉N0 \notin \mathbb{N}. Suppose xx is positive and also x=−ι(n′)x = -\iota(n') with n′∈Nn' \in \mathbb{N}. Then xx has normal forms (n,0)(n, 0) and (0,n′)(0, n') with n,n′∈Nn, n' \in \mathbb{N}, and those are different pairs, contradicting uniqueness. The same argument rules out ι(0)=−ι(n′)\iota(0) = -\iota(n').

Proposition 10.25 (Positive integers are closed under the operations).

If xx and yy are positive, then so are x+yx + y and xyxy.

Discussion.

Both claims say that a value built from two positive integers is again of the form ι(n)\iota(n) with n∈Nn \in \mathbb{N}, and the two facts that produce such a form are already proved: ι\iota carries sums to sums and carries products to products. So each claim reduces immediately to the corresponding closure in N\mathbb{N}, which is the proposition that the positive natural numbers are closed under addition and multiplication. Nothing about Z\mathbb{Z} is used beyond the two formulas for ι\iota.

Proof.

Write x=ι(m)x = \iota(m) and y=ι(n)y = \iota(n) with m,n∈Nm, n \in \mathbb{N}. Then x+y=ι(m+n)x + y = \iota(m + n) and xy=ι(mn)xy = \iota(mn), and both m+nm + n and mnmn lie in N\mathbb{N}. So both values are positive.

Definition 10.26 (The order on the integers).

For x,y∈Zx, y \in \mathbb{Z} write

x<yif and only ify−x is positive,x < y \qquad \text{if and only if} \qquad y - x \text{ is positive},

and write x⩽yx \leqslant y for ”x<yx < y or x=yx = y”, as in the associated order of the chapter on relations.

Theorem 10.27 (The integers are strictly ordered).

The relation << is a strict linear order on Z\mathbb{Z}.

Discussion.

Two conditions are asked for. Transitivity is a computation: from y−xy - x and z−yz - y positive we must produce z−xz - x positive, and the way to reach z−xz - x from those two is to add them, since the middle terms cancel in the group (Z,+)(\mathbb{Z}, +); the previous proposition then keeps the sum positive. Trichotomy is the proposition on signs, applied not to xx or yy but to the single integer y−xy - x: its three cases say that y−xy - x is positive, or zero, or the negative of a positive, and those are exactly x<yx < y, x=yx = y and y<xy < x since −(y−x)=x−y-(y - x) = x - y. That last identity is the rule for the inverse of a product read additively, together with −(−x)=x-(-x) = x.

Proof.

For transitivity, suppose x<yx < y and y<zy < z, so y−xy - x and z−yz - y are positive. Their sum is positive by the previous proposition, and

(z−y)+(y−x)=z+((−y)+y)+(−x)=z−x(z - y) + (y - x) = z + \bigl((-y) + y\bigr) + (-x) = z - x

by associativity and the inverse law in (Z,+)(\mathbb{Z}, +). So x<zx < z.

For trichotomy, let x,y∈Zx, y \in \mathbb{Z} and apply the proposition on signs to y−xy - x. If y−xy - x is positive then x<yx < y. If y−x=ι(0)y - x = \iota(0) then, adding xx to both sides, y=xy = x. If y−x=−wy - x = -w with ww positive, then x−y=−(y−x)=wx - y = -(y - x) = w is positive, so y<xy < x. Exactly one of the three cases holds, and they are the three alternatives trichotomy demands.

Proposition 10.28 (The order and the operations).

Let x,y,z∈Zx, y, z \in \mathbb{Z}.

  1. If x<yx < y then x+z<y+zx + z < y + z.
  2. If x<yx < y and zz is positive, then xz<yzxz < yz.
  3. ι(m)<ι(n)\iota(m) < \iota(n) if and only if m<nm < n, for all m,n∈N0m, n \in \mathbb{N}_0.

Discussion.

Each part unfolds the definition of << into a statement about a difference being positive, so each is settled by computing that difference. In the first the difference is (y+z)−(x+z)(y + z) - (x + z), and the two copies of zz cancel in the group, leaving y−xy - x unchanged: so the hypothesis is the conclusion. In the second the difference is yz−xzyz - xz, which factors as (y−x)z(y - x)z by distributivity together with the sign rule (−x)z=−(xz)(-x)z = -(xz), and the previous proposition then multiplies two positives. Both of those facts about multiplication were set as problems above, and we quote them. The third is the definition of << on each side: ι(n)−ι(m)\iota(n) - \iota(m) is ι(n−m)\iota(n - m) when m⩽nm \leqslant n, so positivity of the difference in Z\mathbb{Z} says exactly what m<nm < n says in N0\mathbb{N}_0.

Proof.

For the first, (y+z)−(x+z)=y−x(y + z) - (x + z) = y - x by associativity, commutativity and the inverse law, so one difference is positive exactly when the other is.

For the second, the problems on multiplication give (−x)z=−(xz)(-x)z = -(xz), and distributivity gives

(y−x)z=yz+(−x)z=yz−xz.(y - x)z = yz + (-x)z = yz - xz.

If x<yx < y then y−xy - x is positive, and zz is positive, so the product is positive by the previous proposition; hence xz<yzxz < yz.

For the third, suppose m<nm < n in N0\mathbb{N}_0. Then n=m+bn = m + b with b∈Nb \in \mathbb{N}, so ι(n)−ι(m)=ι(m+b)−ι(m)=ι(b)\iota(n) - \iota(m) = \iota(m + b) - \iota(m) = \iota(b), which is positive; hence ι(m)<ι(n)\iota(m) < \iota(n). Conversely, if ι(m)<ι(n)\iota(m) < \iota(n) then ι(n)−ι(m)=ι(b)\iota(n) - \iota(m) = \iota(b) for some b∈Nb \in \mathbb{N}, so ι(n)=ι(m+b)\iota(n) = \iota(m + b) and n=m+bn = m + b by injectivity, giving m<nm < n.

Corollary 10.29 (One is the least positive integer).

If x∈Zx \in \mathbb{Z} is positive, then ι(1)⩽x\iota(1) \leqslant x.

Proof.

Write x=ι(n)x = \iota(n) with n∈Nn \in \mathbb{N}. Then 1⩽n1 \leqslant n, since nn is positive and N\mathbb{N} has least element 11 among its own members, so ι(1)⩽ι(n)\iota(1) \leqslant \iota(n) by the third part of the proposition.

Remark (Dropping the embedding from the notation).

From here on we write nn for ι(n)\iota(n) and −n-n for −ι(n)-\iota(n), and treat N0\mathbb{N}_0 as a subset of Z\mathbb{Z}. This is harmless, by the proposition on the order: ι\iota carries sums to sums, products to products, and the order to the order, and it is injective, so every statement about N0\mathbb{N}_0 transfers unchanged to its image and back. The positive integers are then exactly N\mathbb{N}, the list

…,  −2,  −1,  0,  1,  2,  …\ldots, \; -2, \; -1, \; 0, \; 1, \; 2, \; \ldots

names every integer exactly once, and 0<10 < 1 by the corollary.

Problem 10.13.

Show that x<yx < y if and only if −y<−x-y < -x, and that xx is positive if and only if −x<0-x < 0.

Problem 10.14.

Show that if x<yx < y and z<0z < 0 then yz<xzyz < xz, and that x2⩾0x^2 \geqslant 0 for every x∈Zx \in \mathbb{Z}, with equality only at x=0x = 0.

Problem 10.15.

Show that no integer lies strictly between nn and n+1n + 1, and deduce that Z\mathbb{Z} has no maximum and no minimum.

Sequences, Sums and Products

Many of our notions are already functions. Addition is a map Z×Z→Z\mathbb{Z} \times \mathbb{Z} \to \mathbb{Z}, iteration is repeated composition, and counting a finite set is a bijection ⟨n⟩→S\langle n \rangle \to S. A sequence is the same idea read in the other direction: a list of values is a function whose domain is a set of indices. That notion is not new: finite and infinite sequences were defined in the chapter on relations, and the summation symbol in the chapter on the natural numbers. What is new is that the indices may now run over an interval of integers rather than an opening stretch of N0\mathbb{N}_0, which makes it easier to write a sum starting at 00 or at −3-3, or to shift one along.

Indexing by an Integer Interval

Definition 10.30 (Integer intervals).

For m,n∈Zm, n \in \mathbb{Z} with m⩽nm \leqslant n, write

{m,…,n}=def{x∈Z∣m⩽x⩽n},\{m, \ldots, n\} \defeq \{x \in \mathbb{Z} \mid m \leqslant x \leqslant n\},

and for n∈Zn \in \mathbb{Z} write

{n,n+1,…}=def{x∈Z∣n⩽x}.\{n, n+1, \ldots\} \defeq \{x \in \mathbb{Z} \mid n \leqslant x\}.

The first is finite and the second is not, as the next paragraph records. When m=1m = 1 and n∈Nn \in \mathbb{N} the interval {1,…,n}\{1, \ldots, n\} is exactly the block ⟨n⟩\langle n \rangle.

Proposition 10.31 (Intervals are finite and are counted by their length).

Let m⩽nm \leqslant n in Z\mathbb{Z}. Then j↦m+jj \mapsto m + j is a bijection from the cut Ln−m+1L_{n - m + 1} onto {m,…,n}\{m, \ldots, n\}, so {m,…,n}\{m, \ldots, n\} is finite with #{m,…,n}=n−m+1\#\{m, \ldots, n\} = n - m + 1. The ray {n,n+1,…}\{n, n+1, \ldots\} is infinite.

Discussion.

The first claim is an existence statement about a bijection, and the map comes from the shape of the interval: an element of {m,…,n}\{m, \ldots, n\} is mm plus something, and the something is bounded by the length. So we only check the two halves of bijectivity, and both come from the order: injectivity is cancellation for addition in Z\mathbb{Z}, and surjectivity is the observation that m⩽x⩽nm \leqslant x \leqslant n makes x−mx - m a natural number below n−m+1n - m + 1. The cardinality is then read off, a cut LkL_k having kk elements. The last claim is a contradiction: a finite subset of a totally ordered set has a maximum, and the ray has none, since x+1x + 1 is always a larger member.

Proof.

Write k=defn−m+1k \defeq n - m + 1, a positive integer since m⩽nm \leqslant n. If j∈Lkj \in L_k then 0⩽j⩽n−m0 \leqslant j \leqslant n - m, so m⩽m+j⩽nm \leqslant m + j \leqslant n and the map lands in the interval. It is injective because m+j=m+j′m + j = m + j' gives j=j′j = j' by cancellation, and surjective because m⩽x⩽nm \leqslant x \leqslant n makes x−mx - m a natural number with x−m⩽n−mx - m \leqslant n - m, so x−m∈Lkx - m \in L_k and x=m+(x−m)x = m + (x - m).

Hence {m,…,n}≈Lk\{m, \ldots, n\} \approx L_k and #{m,…,n}=k\#\{m, \ldots, n\} = k.

Were the ray finite it would be a non-empty finite subset of the totally ordered set Z\mathbb{Z}, hence would have a maximum MM; but M+1M + 1 lies in the ray and M<M+1M < M + 1, which no upper bound permits.

Definition 10.32 (Sequences on an interval).

Let SS be a set. A finite sequence in SS indexed by {m,…,n}\{m, \ldots, n\} is a function c:{m,…,n}→Sc : \{m, \ldots, n\} \to S, and an infinite sequence indexed by {n,n+1,…}\{n, n+1, \ldots\} is a function on that ray. One writes cic_i for c(i)c(i), calls cic_i the ii-th term and ii the index, and calls the domain the index set.

Composing with the bijection of the proposition turns such a sequence into one indexed by a cut, and back again, so this is the notion of the chapter on relations with the indices relabelled and not a second notion. The gain is convenience: one may now write a rule on a generic index, as in ”ci=2i+1c_i = 2i + 1 for i∈{0,…,5}i \in \{0, \ldots, 5\}”, and start wherever the problem starts. The index is a bound variable and may be renamed, so the same sequence is equally cj=2j+1c_j = 2j + 1 for j∈{0,…,5}j \in \{0, \ldots, 5\}.

Remark (Shifts are different functions).

A finite sequence is commonly written (ci)i=m,…,n(c_i)_{i = m, \ldots, n}, or (ci)(c_i) when the index set is understood, and sequences may be built from sequences: (3ai+4)i=m,…,n(3a_i + 4)_{i = m, \ldots, n} is a sequence once (ai)(a_i) is one. But

(bi+k)i=m−k,…,n−kand(bi)i=m,…,n(b_{i+k})_{i = m-k, \ldots, n-k} \qquad \text{and} \qquad (b_i)_{i = m, \ldots, n}

are not equal, even though they list the same values in the same order. Their domains differ, and functions with different domains are different functions. One is a shift of the other, and the theorem on index shifts below is what relates their sums.

Problem 10.16.

Take the values 5,10,17,26,375, 10, 17, 26, 37. Give a finite sequence with exactly those terms, and name its index set. Write a shifted sequence with the same values in the same order, and extend the original to an infinite sequence.

Problem 10.17.

Let (bi)i=m,…,n(b_i)_{i = m, \ldots, n} be a finite sequence and let k∈Zk \in \mathbb{Z}. Show that (bi+k)i=m−k,…,n−k(b_{i+k})_{i = m-k, \ldots, n-k} and (bi)i=m,…,n(b_i)_{i = m, \ldots, n} have the same image, but are equal as functions if and only if k=0k = 0.

Sums over an Interval

Definition 10.33 (Summation over an interval).

Let (bi)(b_i) be a sequence with values in a set UU carrying an operation written ++, and let mm lie in its index set. For every n⩾mn \geqslant m in that index set define

∑i=mmbi=defbm,∑i=mk+1bi=def(∑i=mkbi)+bk+1(k⩾m).\sum_{i=m}^{m} b_i \defeq b_m, \qquad \sum_{i=m}^{k+1} b_i \defeq \left(\sum_{i=m}^{k} b_i\right) + b_{k+1} \quad (k \geqslant m).

That the clauses determine one value at each nn is the recursion theorem, applied after the running length n−mn - m has been shifted into N0\mathbb{N}_0; it is the same argument that produced the summation symbol in the chapter on the natural numbers, and taking m=1m = 1 with values in a Peano system recovers that symbol exactly. What the present definition adds is an arbitrary lower limit and an arbitrary value set: UU needs an operation and nothing else. If every term lies in a subset of UU closed under ++, the sum lies there too, since the recursion never leaves that subset.

Proposition 10.34 (An interval sum is a left-associated sum).

Let (U,+)(U, +) be a set with an operation and let m⩽nm \leqslant n. Then

∑i=mnbi=p(bm,bm+1,…,bn),\sum_{i=m}^{n} b_i = p(b_m, b_{m+1}, \ldots, b_n),

where pp is the left-associated product of the chapter on groups, written additively.

Discussion.

Both sides are defined by a recursion, and the claim is that the two recursions are the same one in different notation. So the proof is an induction on the number of terms in which each step compares the two recursive clauses: the base cases are the single-term clauses, which both give bmb_m, and the step appends bk+1b_{k+1} on the right in both definitions. Nothing about ++ is used. We record it because it lets us quote the results of the chapter on groups here instead of proving them again.

Proof.

Induct on t∈N0t \in \mathbb{N}_0 with n=m+tn = m + t. At t=0t = 0 both sides are bmb_m. If the two agree at tt, then

∑i=mm+t+1bi=(∑i=mm+tbi)+bm+t+1=p(bm,…,bm+t)+bm+t+1=p(bm,…,bm+t+1),\sum_{i=m}^{m+t+1} b_i = \left(\sum_{i=m}^{m+t} b_i\right) + b_{m+t+1} = p(b_m, \ldots, b_{m+t}) + b_{m+t+1} = p(b_m, \ldots, b_{m+t+1}),

the outer equalities being the recursive clauses of the two definitions and the middle one the inductive hypothesis.

Theorem 10.35 (Splitting a sum).

Let (U,+)(U, +) be a semigroup and let ℓ⩽m−1\ell \leqslant m - 1 and m⩽nm \leqslant n in Z\mathbb{Z}, with (bi)(b_i) defined on {ℓ,…,n}\{\ell, \ldots, n\}. Then

∑i=ℓnbi=∑i=ℓm−1bi  +∑i=mnbi.\sum_{i=\ell}^{n} b_i = \sum_{i=\ell}^{m-1} b_i \; + \sum_{i=m}^{n} b_i .

Discussion.

This is the splitting identity of general associativity, which says a left-associated product may be cut anywhere, and the previous proposition has just identified an interval sum with such a product. So we only need to match the two statements: the cut after the (m−1)(m-1)-st term of the interval corresponds to the cut after the (m−ℓ)(m - \ell)-th factor of the list, and the two blocks are the two sub-intervals.

Proof.

Write the list bℓ,bℓ+1,…,bnb_\ell, b_{\ell+1}, \ldots, b_n, of length n−ℓ+1n - \ell + 1, and cut it after position k=defm−ℓk \defeq m - \ell, which satisfies 1⩽k<n−ℓ+11 \leqslant k < n - \ell + 1. The first part of the theorem on general associativity gives

p(bℓ,…,bn)=p(bℓ,…,bm−1)+p(bm,…,bn),p(b_\ell, \ldots, b_n) = p(b_\ell, \ldots, b_{m-1}) + p(b_m, \ldots, b_n),

and the previous proposition rewrites each of the three left-associated sums as the corresponding interval sum.

Remark (Moving parentheses).

Once ++ is associative the outer bracketing of a finite sum is irrelevant, and the theorem is the interval form of that fact. The reading fixed by the definition is the left-associated one, so a1+a2+a3+a4a_1 + a_2 + a_3 + a_4 means ((a1+a2)+a3)+a4\bigl((a_1 + a_2) + a_3\bigr) + a_4, and the theorem equates it with (a1+a2)+(a3+a4)(a_1 + a_2) + (a_3 + a_4) and with a1+(a2+a3+a4)a_1 + (a_2 + a_3 + a_4). It does not reorder the terms. Reordering needs commutativity, which the rearrangement corollary supplies for a list and the last section of this chapter supplies for an unordered index set.

Theorem 10.36 (General distributivity).

Let UU carry operations ++ and ⋅\cdot with c⋅(x+y)=(c⋅x)+(c⋅y)c \cdot (x + y) = (c \cdot x) + (c \cdot y) for all c,x,y∈Uc, x, y \in U. Then for c∈Uc \in U and m⩽nm \leqslant n,

c⋅∑i=mnbi=∑i=mn(c⋅bi).c \cdot \sum_{i=m}^{n} b_i = \sum_{i=m}^{n} (c \cdot b_i).

Discussion.

An identity over an interval whose length is not fixed, so it is an induction on that length, with the upper limit climbing from mm to nn. The base is the single-term clause, where both sides are c⋅bmc \cdot b_m. The step uses the hypothesis on UU once: expand the left side by the recursive clause, apply the binary distributive law to split cc across the two summands, replace the shorter sum by the inductive hypothesis, and reassemble by the recursive clause on the right. Associativity is not needed anywhere, so the theorem is stated for any pair of operations.

Proof.

Induct on t∈{0,…,n−m}t \in \{0, \ldots, n - m\}, writing k=m+tk = m + t. At t=0t = 0 both sides are c⋅bmc \cdot b_m. Suppose the identity holds at tt and t<n−mt < n - m. Then

c⋅∑i=mk+1bi=c⋅((∑i=mkbi)+bk+1)=(c⋅∑i=mkbi)+(c⋅bk+1)=(∑i=mk(c⋅bi))+(c⋅bk+1)=∑i=mk+1(c⋅bi),\begin{aligned} c \cdot \sum_{i=m}^{k+1} b_i &= c \cdot \left(\left(\sum_{i=m}^{k} b_i\right) + b_{k+1}\right) \\ &= \left(c \cdot \sum_{i=m}^{k} b_i\right) + (c \cdot b_{k+1}) \\ &= \left(\sum_{i=m}^{k} (c \cdot b_i)\right) + (c \cdot b_{k+1}) = \sum_{i=m}^{k+1} (c \cdot b_i), \end{aligned}

by the recursive clause, distributivity, the inductive hypothesis, and the recursive clause again. Taking t=n−mt = n - m gives the theorem.

If the multiplication is not commutative the matching right-hand law, (∑bi)⋅c=∑(bi⋅c)\bigl(\sum b_i\bigr) \cdot c = \sum (b_i \cdot c), is proved by the same induction from the right distributive law.

Theorem 10.37 (Termwise sums, zeros and negatives).

Let m⩽nm \leqslant n and let (bi)(b_i) and (ci)(c_i) be defined on {m,…,n}\{m, \ldots, n\}.

  1. If (U,+)(U, +) is an abelian semigroup, then ∑i=mn(bi+ci)=∑i=mnbi+∑i=mnci\displaystyle\sum_{i=m}^{n} (b_i + c_i) = \sum_{i=m}^{n} b_i + \sum_{i=m}^{n} c_i.
  2. If UU has an identity 00 for ++, then ∑i=mn0=0\displaystyle\sum_{i=m}^{n} 0 = 0.
  3. If (U,+)(U, +) is an abelian group, then −∑i=mnbi=∑i=mn(−bi)\displaystyle -\sum_{i=m}^{n} b_i = \sum_{i=m}^{n} (-b_i).

Discussion.

The first two are inductions on the length, of the same shape as the one just done. In the first the step produces a four-term expression on the left and must match a four-term expression on the right, and the matching is a rearrangement, so this uses commutativity as well as associativity. In the second the step adds one more 00 to a running total already equal to 00, and 0+0=00 + 0 = 0. The third needs no induction: by the first two parts the two sums add to 00, so each is the inverse of the other by uniqueness of inverses.

Proof.

For the first, induct on tt with k=m+tk = m + t. At t=0t = 0 both sides are bm+cmb_m + c_m. At the step,

∑i=mk+1(bi+ci)=(∑i=mkbi+∑i=mkci)+(bk+1+ck+1),\sum_{i=m}^{k+1} (b_i + c_i) = \left(\sum_{i=m}^{k} b_i + \sum_{i=m}^{k} c_i\right) + (b_{k+1} + c_{k+1}),

and rearranging the four summands by associativity and commutativity gives (∑i=mk+1bi)+(∑i=mk+1ci)\bigl(\sum_{i=m}^{k+1} b_i\bigr) + \bigl(\sum_{i=m}^{k+1} c_i\bigr).

For the second, induct likewise: the single-term sum is 00, and 0+0=00 + 0 = 0.

For the third, the first two parts give

∑i=mnbi+∑i=mn(−bi)=∑i=mn(bi+(−bi))=∑i=mn0=0,\sum_{i=m}^{n} b_i + \sum_{i=m}^{n} (-b_i) = \sum_{i=m}^{n} \bigl(b_i + (-b_i)\bigr) = \sum_{i=m}^{n} 0 = 0,

and the same computation in the other order, so ∑(−bi)\sum (-b_i) is an inverse of ∑bi\sum b_i and hence is −∑bi-\sum b_i.

Theorem 10.38 (Index shift).

Let (U,+)(U, +) be a set with an operation, let m⩽nm \leqslant n, and let k∈Zk \in \mathbb{Z}. Then

∑i=mnbi=∑i=m+kn+kbi−k.\sum_{i=m}^{n} b_i = \sum_{i=m+k}^{n+k} b_{i-k}.

Discussion.

First, the right-hand sum makes sense, because m+k⩽i⩽n+km + k \leqslant i \leqslant n + k gives m⩽i−k⩽nm \leqslant i - k \leqslant n, so every term named is a term of (bi)(b_i). The identity itself is an induction on the length: at the base both sides are bmb_m, and at each step the term appended on the left is bk′+1b_{k'+1} while the term appended on the right is b(k′+1+k)−kb_{(k'+1+k)-k}, and those are the same element. This is the relation between shifted sequences mentioned earlier: two different functions with the same sum.

Proof.

Induct on t∈{0,…,n−m}t \in \{0, \ldots, n - m\}, writing l=m+tl = m + t. At t=0t = 0 both sides are bmb_m. If the identity holds at tt, then

∑i=ml+1bi=(∑i=mlbi)+bl+1=(∑i=m+kl+kbi−k)+b(l+1+k)−k=∑i=m+k(l+1)+kbi−k,\sum_{i=m}^{l+1} b_i = \left(\sum_{i=m}^{l} b_i\right) + b_{l+1} = \left(\sum_{i=m+k}^{l+k} b_{i-k}\right) + b_{(l+1+k)-k} = \sum_{i=m+k}^{(l+1)+k} b_{i-k},

by the recursive clause, the inductive hypothesis, and the recursive clause again.

Proposition 10.39 (Agreement on an interval).

Let (ai)(a_i) and (bi)(b_i) be sequences in UU whose index sets both contain {m,…,n}\{m, \ldots, n\}, and suppose ai=bia_i = b_i for every ii in that interval. Then their sums over it agree.

Discussion.

We need this because a sequence may be defined on a larger index set than the one being summed over, so the two sequences need not be equal as functions. The sum depends only on the terms named: equal single terms give the base, and the recursive clause appends equal terms at each step, so equality is preserved all the way up.

Proof.

Induct on t∈{0,…,n−m}t \in \{0, \ldots, n - m\}. At t=0t = 0 both sums are am=bma_m = b_m. If the sums to m+tm + t agree and t<n−mt < n - m, the recursive clause appends am+t+1=bm+t+1a_{m+t+1} = b_{m+t+1} to each.

Problem 10.18.

Using only the definition, show that ∑i=11ai=a1\sum_{i=1}^{1} a_i = a_1, that ∑i=12ai=a1+a2\sum_{i=1}^{2} a_i = a_1 + a_2, that ∑i=13ai=(a1+a2)+a3\sum_{i=1}^{3} a_i = (a_1 + a_2) + a_3, and that ∑i=14ai=((a1+a2)+a3)+a4\sum_{i=1}^{4} a_i = \bigl((a_1 + a_2) + a_3\bigr) + a_4.

Problem 10.19.

Show that the binary distributive law in UU is the case m=1m = 1, n=2n = 2 of general distributivity, and that the case ℓ=1\ell = 1, m=2m = 2, n=3n = 3 of the splitting theorem is the ordinary associative law.

Problem 10.20.

Show that ∑i=mnbi\sum_{i=m}^{n} b_i agrees with the summation symbol of the chapter on the natural numbers when m=1m = 1 and the values lie in a Peano system with addition.

Products over an Interval

Definition 10.40 (Products over an interval).

Let (bi)(b_i) have values in a set UU carrying an operation written multiplicatively, and let mm lie in its index set. For n⩾mn \geqslant m define

∏i=mmbi=defbm,∏i=mk+1bi=def(∏i=mkbi)⋅bk+1(k⩾m).\prod_{i=m}^{m} b_i \defeq b_m, \qquad \prod_{i=m}^{k+1} b_i \defeq \left(\prod_{i=m}^{k} b_i\right) \cdot b_{k+1} \quad (k \geqslant m).

Everything proved for sums holds for products, because nothing proved for sums used anything about ++ beyond the recursion and the laws named in each hypothesis. Replacing ++ by ⋅\cdot and 00 by 11 throughout turns each statement above into its multiplicative twin, and each proof into a proof of it: the splitting theorem, general distributivity read the other way, termwise products, the product of ones, the index shift, and agreement on an interval. We use them under those names without restating them, and taking m=1m = 1 recovers the product symbol of the chapter on the natural numbers.

One consequence is used often when taking products apart.

Proposition 10.41 (Splitting off the first factor).

Let UU have a multiplication with identity 11, and let m⩽nm \leqslant n. Then there is b∈Ub \in U with

∏j=mnaj=am⋅b.\prod_{j=m}^{n} a_j = a_m \cdot b.

Discussion.

An existence claim, and there are two cases according to whether the interval has one term or more. If n=mn = m the product is ama_m itself, and b=1b = 1 serves, which is the only place the identity element is needed. If m<nm < n the splitting theorem cuts the product after the first factor, and the second block is the required bb; no computation is involved beyond naming it.

Proof.

If n=mn = m then ∏j=mmaj=am=am⋅1\prod_{j=m}^{m} a_j = a_m = a_m \cdot 1, so b=1b = 1 serves. If m<nm < n then the splitting theorem with the cut after the first factor gives

∏j=mnaj=(∏j=mmaj)⋅(∏j=m+1naj)=am⋅(∏j=m+1naj),\prod_{j=m}^{n} a_j = \left(\prod_{j=m}^{m} a_j\right) \cdot \left(\prod_{j=m+1}^{n} a_j\right) = a_m \cdot \left(\prod_{j=m+1}^{n} a_j\right),

so the second block serves as bb.

Remark (Left association as the default).

An unbracketed a+b+ca + b + c means the sum of the three-term sequence, hence (a+b)+c(a + b) + c, and longer unbracketed sums and products are read the same way. That matches the convention already fixed for the left-associated product and for composition of functions. The factorial may now be written n!=∏k=1nkn! = \prod_{k=1}^{n} k for n∈Nn \in \mathbb{N}, with the empty product 0!=10! = 1 already recorded there.

Problem 10.21.

Using only the definition, expand ∏i=1kai\prod_{i=1}^{k} a_i for k=1,2,3,4k = 1, 2, 3, 4 and check that the reading is left-associated. State the identity obtained from the splitting theorem for products with ℓ=1\ell = 1, m=3m = 3, n=5n = 5.

Sums over an Unordered Index Set

An interval carries an order, so its terms arrive in a fixed sequence. When ++ is commutative as well as associative the order should not matter, and then the index set need not be ordered at all: one wants ∑i∈Ibi\sum_{i \in I} b_i for an arbitrary finite II. Throughout this section (U,+)(U, +) is a commutative monoid (associative, commutative, with an identity 00), and (bi)i∈I(b_i)_{i \in I} means a function b:I→Ub : I \to U.

The plan is to sum along an ordering and then prove the answer independent of it.

Definition 10.42 (Sum along an ordering).

Let II be finite with #I=n\#I = n, let (bi)i∈I(b_i)_{i \in I} have values in UU, and let f:⟨n⟩→If : \langle n \rangle \to I be a bijection, with ⟨0⟩=∅\langle 0 \rangle = \emptyset. Define

∑i∈I(f)bi=def{0if n=0,∑j=1nbf(j)if n⩾1.\sum_{i \in I}^{(f)} b_i \defeq \begin{cases} 0 & \text{if } n = 0, \\ \displaystyle\sum_{j=1}^{n} b_{f(j)} & \text{if } n \geqslant 1. \end{cases}

Proposition 10.43 (Peeling the last index).

Let #I=n⩾1\#I = n \geqslant 1, let f:⟨n⟩→If : \langle n \rangle \to I be a bijection, put x=deff(n)x \defeq f(n), and let f1f_1 be the restriction of ff to a bijection ⟨n−1⟩→I∖{x}\langle n-1 \rangle \to I \setminus \{x\}. Then

∑i∈I(f)bi=(∑i∈I∖{x}(f1)bi)+bx.\sum_{i \in I}^{(f)} b_i = \left(\sum_{i \in I \setminus \{x\}}^{(f_1)} b_i\right) + b_x.

Discussion.

First, the restriction is a bijection onto I∖{x}I \setminus \{x\} because ff is injective and f(n)=xf(n) = x, so nothing below nn is sent to xx. The identity itself splits into two cases. When n=1n = 1 the left side is bxb_x and the right side is 0+bx0 + b_x, so the identity law applies; this is where the convention for the empty sum is used. When n>1n > 1 the recursive clause peels the last term off the interval sum, and what is left is the interval sum of j↦bf(j)j \mapsto b_{f(j)} over ⟨n−1⟩\langle n - 1 \rangle; that agrees with the sum along f1f_1 because the two sequences take equal values there, which is the proposition on agreement.

Proof.

If n=1n = 1 then I={x}I = \{x\}, the left side is bf(1)=bxb_{f(1)} = b_x, and the right side is 0+bx=bx0 + b_x = b_x.

If n>1n > 1 the recursive clause gives

∑j=1nbf(j)=(∑j=1n−1bf(j))+bf(n),\sum_{j=1}^{n} b_{f(j)} = \left(\sum_{j=1}^{n-1} b_{f(j)}\right) + b_{f(n)},

and bf(n)=bxb_{f(n)} = b_x. The sequences j↦bf(j)j \mapsto b_{f(j)} and j↦bf1(j)j \mapsto b_{f_1(j)} agree on ⟨n−1⟩\langle n-1 \rangle, so their sums there agree by the proposition on agreement, and that sum is the sum along f1f_1.

Proposition 10.44 (The ordering does not matter).

Let II be finite with #I=n\#I = n and let f,g:⟨n⟩→If, g : \langle n \rangle \to I be bijections. Then

∑i∈I(f)bi=∑i∈I(g)bi.\sum_{i \in I}^{(f)} b_i = \sum_{i \in I}^{(g)} b_i.

Discussion.

The claim is universal in nn and we use strong induction, since the step will need the hypothesis at n−2n - 2 as well as at n−1n - 1. At n=0n = 0 and n=1n = 1 there is only one bijection available, so there is nothing to compare. For n⩾2n \geqslant 2 we look at where the two orderings put their last element, x=f(n)x = f(n) and y=g(n)y = g(n). If they agree, peeling both by the previous proposition leaves two sums over the same smaller set, which the hypothesis identifies. If they differ, we cannot peel to a common set in one step, so we take two: choose an ordering of I∖{x}I \setminus \{x\} ending at yy and an ordering of I∖{y}I \setminus \{y\} ending at xx (these exist because a transposition rearranges any ordering to end where we like), and peel each side twice. Both sides then reduce to the same sum over I∖{x,y}I \setminus \{x, y\} with bxb_x and byb_y attached, in opposite orders, and commutativity finishes.

Proof.

We first record that for any z∈Iz \in I there is a bijection ⟨n⟩→I\langle n \rangle \to I sending nn to zz: take any bijection hh and compose it with the transposition of h−1(z)h^{-1}(z) and nn in ⟨n⟩\langle n \rangle, which is a bijection.

Now induct strongly on nn. If n⩽1n \leqslant 1 the two bijections coincide, since ⟨0⟩=∅\langle 0 \rangle = \emptyset has one map to ∅\emptyset and ⟨1⟩\langle 1 \rangle has one map to a singleton.

Let n⩾2n \geqslant 2 and assume the claim for all index sets of smaller cardinality. Put x=f(n)x = f(n) and y=g(n)y = g(n), with restrictions f1,g1f_1, g_1 as in the previous proposition.

If x=yx = y, peeling both sides gives sums over I∖{x}I \setminus \{x\} along f1f_1 and along g1g_1, which agree by the inductive hypothesis, so the two sides agree.

If x≠yx \neq y, choose a bijection f2:⟨n−1⟩→I∖{x}f_2 : \langle n-1 \rangle \to I \setminus \{x\} with f2(n−1)=yf_2(n-1) = y and a bijection g2:⟨n−1⟩→I∖{y}g_2 : \langle n-1 \rangle \to I \setminus \{y\} with g2(n−1)=xg_2(n-1) = x, and let f3,g3f_3, g_3 be their restrictions to bijections onto I∖{x,y}I \setminus \{x, y\}. Write TT for the common value of the sums over I∖{x,y}I \setminus \{x,y\} along f3f_3 and along g3g_3, equal by the inductive hypothesis. Peeling twice on each side,

∑i∈I(f)bi=(T+by)+bx,∑i∈I(g)bi=(T+bx)+by,\sum_{i \in I}^{(f)} b_i = (T + b_y) + b_x, \qquad \sum_{i \in I}^{(g)} b_i = (T + b_x) + b_y,

where the inductive hypothesis at n−1n-1 was used to replace f1f_1 by f2f_2 and g1g_1 by g2g_2. Associativity and commutativity make the two right-hand sides equal.

Definition 10.45 (Sum over a finite index set).

Let II be finite and let (bi)i∈I(b_i)_{i \in I} have values in UU. Define

∑i∈Ibi=def∑i∈I(f)bi\sum_{i \in I} b_i \defeq \sum_{i \in I}^{(f)} b_i

for any bijection f:⟨#I⟩→If : \langle \#I \rangle \to I, which the previous proposition makes independent of the choice.

Proposition 10.46 (Agreement with interval sums).

If m⩽nm \leqslant n in Z\mathbb{Z}, then ∑i∈{m,…,n}bi=∑i=mnbi\displaystyle\sum_{i \in \{m, \ldots, n\}} b_i = \sum_{i=m}^{n} b_i.

Discussion.

The two sides are sums of the same terms under two definitions, and to compare them we need a bijection ⟨N⟩→{m,…,n}\langle N \rangle \to \{m, \ldots, n\}, which the proposition on intervals gives: j↦j+(m−1)j \mapsto j + (m-1) is one, with N=n−m+1N = n - m + 1. Summing along it produces an interval sum from 11 to NN of the shifted sequence, and the index-shift theorem carries that back to the sum from mm to nn. So the work is in the index shift.

Proof.

Put N=defn−m+1=#{m,…,n}N \defeq n - m + 1 = \#\{m, \ldots, n\}. The map f:⟨N⟩→{m,…,n}f : \langle N \rangle \to \{m, \ldots, n\} with f(j)=defj+(m−1)f(j) \defeq j + (m-1) is a bijection, with inverse i↦i−m+1i \mapsto i - m + 1. Hence

∑i∈{m,…,n}bi=∑j=1Nbf(j)=∑j=1Nbj+(m−1)=∑i=mnbi,\sum_{i \in \{m, \ldots, n\}} b_i = \sum_{j=1}^{N} b_{f(j)} = \sum_{j=1}^{N} b_{j + (m-1)} = \sum_{i=m}^{n} b_i,

the last step being the index shift with k=m−1k = m - 1.

Theorem 10.47 (Peeling and splitting).

Let II be finite and let (bi)i∈I(b_i)_{i \in I} have values in UU.

  1. If I=∅I = \emptyset then ∑i∈Ibi=0\sum_{i \in I} b_i = 0, and if I={x}I = \{x\} then ∑i∈Ibi=bx\sum_{i \in I} b_i = b_x.
  2. If x∈Ix \in I then ∑i∈Ibi=(∑i∈I∖{x}bi)+bx\displaystyle\sum_{i \in I} b_i = \left(\sum_{i \in I \setminus \{x\}} b_i\right) + b_x.
  3. If I=I1∪I2I = I_1 \cup I_2 with I1∩I2=∅I_1 \cap I_2 = \emptyset, then ∑i∈Ibi=∑i∈I1bi+∑i∈I2bi\displaystyle\sum_{i \in I} b_i = \sum_{i \in I_1} b_i + \sum_{i \in I_2} b_i.

Discussion.

The first part is the definition, read at the two smallest index sets. The second is the proposition on peeling for a chosen element: that proposition peeled whichever element the ordering put last, and since the sum no longer depends on the ordering we may choose one that puts the element we want there, which the transposition trick supplies. The third is the main one and is proved by building an ordering of II out of orderings of the two pieces, laid end to end; it is a bijection because the pieces are disjoint, and the cardinality of a disjoint union says its domain has the right size. Summing along it and cutting after the first block is the splitting theorem, and the second block needs an index shift to be recognised as a sum over I2I_2. The empty cases are handled first, since an ordering of an empty piece is not available to concatenate.

Proof.

The first part is the definition together with the case n=1n = 1 of peeling.

For the second, choose a bijection f:⟨n⟩→If : \langle n \rangle \to I with f(n)=xf(n) = x, as in the proof of the previous proposition, and apply peeling; the two sums are independent of the orderings by that proposition.

For the third, put n1=def#I1n_1 \defeq \#I_1 and n2=def#I2n_2 \defeq \#I_2, so #I=n1+n2\#I = n_1 + n_2. If n1=0n_1 = 0 then I1=∅I_1 = \emptyset and I2=II_2 = I, and the claim reads s=0+ss = 0 + s; the case n2=0n_2 = 0 is the same. Suppose both are positive, choose bijections f1:⟨n1⟩→I1f_1 : \langle n_1 \rangle \to I_1 and f2:⟨n2⟩→I2f_2 : \langle n_2 \rangle \to I_2, and define f:⟨n1+n2⟩→If : \langle n_1 + n_2 \rangle \to I by

f(j)=def{f1(j)if j⩽n1,f2(j−n1)if n1<j.f(j) \defeq \begin{cases} f_1(j) & \text{if } j \leqslant n_1, \\ f_2(j - n_1) & \text{if } n_1 < j. \end{cases}

Disjointness of I1I_1 and I2I_2 makes ff injective, and it is surjective because II is their union. Then

∑i∈Ibi=∑j=1n1+n2bf(j)=∑j=1n1bf(j)+∑j=n1+1n1+n2bf(j)\sum_{i \in I} b_i = \sum_{j=1}^{n_1 + n_2} b_{f(j)} = \sum_{j=1}^{n_1} b_{f(j)} + \sum_{j = n_1 + 1}^{n_1 + n_2} b_{f(j)}

by the splitting theorem. The first block is ∑i∈I1bi\sum_{i \in I_1} b_i. In the second, the index shift by k=−n1k = -n_1 turns it into ∑j=1n2bf(j+n1)=∑j=1n2bf2(j)\sum_{j=1}^{n_2} b_{f(j + n_1)} = \sum_{j=1}^{n_2} b_{f_2(j)}, which is ∑i∈I2bi\sum_{i \in I_2} b_i.

Theorem 10.48 (Reindexing).

Let II and I′I' be finite, let (bi)i∈I(b_i)_{i \in I} have values in UU, and let σ:I′→I\sigma : I' \to I be a bijection. Then

∑i∈I′bσ(i)=∑i∈Ibi.\sum_{i \in I'} b_{\sigma(i)} = \sum_{i \in I} b_i.

Discussion.

Both sides are defined by choosing an ordering, and the sum does not depend on which, so we are free to choose orderings that make the two sides identical term by term. An ordering ff of I′I' produces one of II by composing with σ\sigma, since a composite of bijections is a bijection; and the jj-th term of the left sum along ff is bσ(f(j))b_{\sigma(f(j))}, which is the jj-th term of the right sum along σ∘f\sigma \circ f. So the two interval sums are the same sum.

Proof.

If I=∅I = \emptyset then I′=∅I' = \emptyset and both sides are 00. Otherwise put n=def#I=#I′n \defeq \#I = \#I' and choose a bijection f:⟨n⟩→I′f : \langle n \rangle \to I'. Then σ∘f:⟨n⟩→I\sigma \circ f : \langle n \rangle \to I is a bijection, and

∑i∈I′bσ(i)=∑j=1nbσ(f(j))=∑j=1nb(σ∘f)(j)=∑i∈Ibi,\sum_{i \in I'} b_{\sigma(i)} = \sum_{j=1}^{n} b_{\sigma(f(j))} = \sum_{j=1}^{n} b_{(\sigma \circ f)(j)} = \sum_{i \in I} b_i,

each outer equality being the definition of the sum over an index set.

Corollary 10.49 (Rearranging a sum).

Let II be finite and let σ\sigma be a permutation of II. Then ∑i∈Ibi=∑i∈Ibσ(i)\sum_{i \in I} b_i = \sum_{i \in I} b_{\sigma(i)}.

Proof.

Reindexing with I′=II' = I.

That is the general commutative law for sums, and the rearrangement corollary of the chapter on groups is the case where II is an interval and σ\sigma is written as a permutation of positions. Termwise addition carries over to unordered index sets the same way: choose an ordering and quote the interval statement.

Proposition 10.50 (Termwise sums, unordered).

Let II be finite and let (bi)i∈I(b_i)_{i \in I} and (ci)i∈I(c_i)_{i \in I} have values in UU. Then

∑i∈I(bi+ci)=∑i∈Ibi+∑i∈Ici.\sum_{i \in I} (b_i + c_i) = \sum_{i \in I} b_i + \sum_{i \in I} c_i.

Discussion.

The empty case is the identity law, 0=0+00 = 0 + 0. Otherwise choose any ordering; each of the three sums becomes an interval sum along it, and the interval version of termwise addition applies to the two ordered sequences. The choice of ordering does not matter, by the proposition on independence.

Proof.

If I=∅I = \emptyset both sides are 00. Otherwise let n=#In = \#I and let f:⟨n⟩→If : \langle n \rangle \to I be a bijection. Then

∑i∈I(bi+ci)=∑j=1n(bf(j)+cf(j))=∑j=1nbf(j)+∑j=1ncf(j)=∑i∈Ibi+∑i∈Ici,\begin{aligned} \sum_{i \in I} (b_i + c_i) &= \sum_{j=1}^{n} \bigl(b_{f(j)} + c_{f(j)}\bigr) \\ &= \sum_{j=1}^{n} b_{f(j)} + \sum_{j=1}^{n} c_{f(j)} = \sum_{i \in I} b_i + \sum_{i \in I} c_i, \end{aligned}

by the interval theorem on termwise sums.

Everything in this section holds for products over a commutative monoid written multiplicatively, with 11 in place of 00; the definitions, the independence of the ordering, peeling, splitting, reindexing and the commutative law all carry over under that substitution, and their proofs with them.

Problem 10.22.

State the product analogues of the definition of ∏i∈Ibi\prod_{i \in I} b_i and of the peeling and splitting theorem, and say which line of each proof changes.

Problem 10.23.

Let I={1,2,3}I = \{1, 2, 3\} and let σ\sigma be the permutation 1↦2↦3↦11 \mapsto 2 \mapsto 3 \mapsto 1. Expand both sides of the rearrangement corollary for a general (bi)i∈I(b_i)_{i \in I} in Z\mathbb{Z}.

Problem 10.24.

Let II and JJ be finite and let ai,j∈Ua_{i,j} \in U for i∈Ii \in I and j∈Jj \in J. Show that summing along II first and then along JJ gives the same element as summing along JJ first and then along II.

Divisibility

(Z,+)(\mathbb{Z}, +) is a group and (Z,⋅)(\mathbb{Z}, \cdot) is not, since only 11 and −1-1 have multiplicative inverses. So exact division inside Z\mathbb{Z} is rare. The study of when one integer divides another is number theory, and this section is its beginning.

Divisors

Proposition 10.51 (The only invertible integers).

Let a,b∈Za, b \in \mathbb{Z} with ab=1ab = 1. Then either a=b=1a = b = 1 or a=b=−1a = b = -1.

Discussion.

The hypothesis pins a product to a particular value, and we use the order to get information about the factors. So we work through the signs. Neither factor can be 00, since a product with a zero factor is 00 and 0≠10 \neq 1. They cannot have opposite signs, since a positive times a negative is negative while 11 is positive. That leaves both positive or both negative. If both are positive, each is at least 11 by the corollary on the least positive integer, and if aa were strictly larger than 11 then multiplying that inequality by the positive bb would push abab above bb and so above 11; so a=1a = 1, and then b=1b = 1. The negative case is the positive one applied to −a-a and −b-b, whose product is again 11.

Proof.

Neither factor is 00, since 0⋅b=0≠10 \cdot b = 0 \neq 1. If one is positive and the other negative, their product is negative, while 11 is positive; so both are positive or both are negative.

Suppose both are positive. Then 1⩽a1 \leqslant a and 1⩽b1 \leqslant b. If 1<a1 < a, multiplying by the positive bb gives b<ab=1b < ab = 1, contradicting 1⩽b1 \leqslant b. So a=1a = 1, and b=1⋅b=ab=1b = 1 \cdot b = ab = 1.

If both are negative then −a-a and −b-b are positive and (−a)(−b)=ab=1(-a)(-b) = ab = 1, so −a=−b=1-a = -b = 1 and a=b=−1a = b = -1.

Definition 10.52 (Divisibility).

Let a,b∈Za, b \in \mathbb{Z} with a≠0a \neq 0. Then aa divides bb, written a∣ba \mid b, if b=acb = ac for some c∈Zc \in \mathbb{Z}; in that case aa is a divisor of bb and bb a multiple of aa. When aa does not divide bb we write a∤ba \nmid b.

The condition a≠0a \neq 0 is part of the notation: wherever a∣ba \mid b appears as a hypothesis, a≠0a \neq 0 is part of it. Usage keeps divisor for the general statement and factor for a number appearing in a particular product, so 1,2,3,4,61, 2, 3, 4, 6 and 1212 are the positive divisors of 1212, while 33 and 44 are the factors of 1212 in the expression 12=3⋅412 = 3 \cdot 4. This is the notion the problem on divisibility introduced for natural numbers, now stated where negative multipliers are available.

Definition 10.53 (Prime).

An integer p>1p > 1 whose only positive divisors are 11 and pp is prime.

This makes precise a word we have used informally since the first chapter, and it restates two old results: that nn is even says exactly that 2∣n2 \mid n, and the proposition that odd squares are odd now reads 2∣n2 \mid n if and only if 2∣n22 \mid n^2. The four rules below are the basic arithmetic of divisibility.

Proposition 10.54 (The arithmetic of divisibility).

Let a,b,c,d∈Za, b, c, d \in \mathbb{Z} with the divisors below non-zero.

  1. If a∣ba \mid b and b∣cb \mid c, then a∣ca \mid c.
  2. If a∣ca \mid c and b∣db \mid d, then ab∣cdab \mid cd.
  3. If a∣ba \mid b and a∣ca \mid c, then a∣bx+cya \mid bx + cy for all x,y∈Zx, y \in \mathbb{Z}.
  4. If a∣ba \mid b or a∣ca \mid c, then a∣bca \mid bc.

Discussion.

All four are proved the same way. Each hypothesis a∣ba \mid b unpacks by the definition into an equation b=akb = ak with kk an integer, and each conclusion asks for one integer of the same shape; so in every case the work is to substitute the hypotheses into the expression named in the conclusion, regroup by associativity, commutativity and distributivity until a single factor of the intended divisor stands in front, and observe that what remains in the bracket is an integer because Z\mathbb{Z} is closed under the operations. The first substitutes one equation into the other and takes the product of the two multipliers. The second multiplies the two equations and regroups. The third is the one where the shared divisor matters: both unpackings carry the same aa, so distributivity pulls it out of the combination. The fourth is a disjunction, hence two cases, each of which is the first line of the others. Nothing needs the order, and nothing needs a case split on sign.

Proof.

For the first, write b=ak1b = ak_1 and c=bk2c = bk_2. Then c=(ak1)k2=a(k1k2)c = (ak_1)k_2 = a(k_1k_2), and k1k2∈Zk_1k_2 \in \mathbb{Z}, so a∣ca \mid c.

For the second, write c=ak1c = ak_1 and d=bk2d = bk_2. Then cd=(ak1)(bk2)=(ab)(k1k2)cd = (ak_1)(bk_2) = (ab)(k_1k_2) by associativity and commutativity, so ab∣cdab \mid cd.

For the third, write b=ak1b = ak_1 and c=ak2c = ak_2. For any x,y∈Zx, y \in \mathbb{Z},

bx+cy=(ak1)x+(ak2)y=a(k1x+k2y)bx + cy = (ak_1)x + (ak_2)y = a(k_1x + k_2y)

by distributivity, and k1x+k2y∈Zk_1x + k_2y \in \mathbb{Z}, so a∣bx+cya \mid bx + cy.

For the fourth, suppose a∣ba \mid b, so b=akb = ak. Then bc=(ak)c=a(kc)bc = (ak)c = a(kc) and kc∈Zkc \in \mathbb{Z}, so a∣bca \mid bc. If instead a∣ca \mid c, the same argument applies with bb and cc exchanged.

Corollary 10.55 (Sums and differences).

If a∣ba \mid b and a∣ca \mid c, then a∣b+ca \mid b + c and a∣b−ca \mid b - c.

Proof.

Take x=y=1x = y = 1, and then x=1x = 1, y=−1y = -1, in the third part of the proposition.

Theorem 10.56 (Each factor divides the product).

Let (aj)(a_j) be a sequence in Z\mathbb{Z} defined on {m,…,n}\{m, \ldots, n\} with m⩽nm \leqslant n, and let i∈{m,…,n}i \in \{m, \ldots, n\} with ai≠0a_i \neq 0. Then

ai  ∣  ∏j=mnaj.a_i \; \Bigg| \; \prod_{j=m}^{n} a_j .

Discussion.

The conclusion asks for the product to be written with aia_i standing in front, so we move aia_i there. If ii is the first index, the proposition on splitting off the first factor has already done it. Otherwise cut the product just before ii by the splitting theorem for products; the second block now begins at ii, so splitting off its first factor exposes aia_i, and what is left is the first block times whatever followed. Commutativity and associativity of multiplication in Z\mathbb{Z} then move aia_i to the front of the whole, and the remaining bracket is an integer because a product of integers is one. The hypothesis ai≠0a_i \neq 0 is needed only because the divisibility symbol demands it.

Proof.

If i=mi = m, the proposition on splitting off the first factor gives ∏j=mnaj=am⋅b\prod_{j=m}^{n} a_j = a_m \cdot b for some b∈Zb \in \mathbb{Z}, so ama_m divides the product.

Suppose m<im < i. The splitting theorem for products, cutting before ii, gives

∏j=mnaj=(∏j=mi−1aj)⋅(∏j=inaj),\prod_{j=m}^{n} a_j = \left(\prod_{j=m}^{i-1} a_j\right) \cdot \left(\prod_{j=i}^{n} a_j\right),

and splitting off the first factor of the second block writes it as ai⋅ba_i \cdot b for some b∈Zb \in \mathbb{Z}. Writing AA for the first block,

∏j=mnaj=A⋅(ai⋅b)=ai⋅(b⋅A)\prod_{j=m}^{n} a_j = A \cdot (a_i \cdot b) = a_i \cdot (b \cdot A)

by commutativity and associativity, and b⋅A∈Zb \cdot A \in \mathbb{Z}. So aia_i divides the product.

Division with Remainder

Non-divisibility is harder to use than divisibility, because it gives no equation. Instead we use the remainder, and every integer has exactly one. That was proved for N0\mathbb{N}_0 in the chapter on order; it extends to Z\mathbb{Z} with one extra step.

Theorem 10.57 (Division with remainder in the integers).

Let a∈Za \in \mathbb{Z} and m∈Nm \in \mathbb{N}. Then there is exactly one pair q,r∈Zq, r \in \mathbb{Z} with

a=qm+r,0⩽r<m.a = qm + r, \qquad 0 \leqslant r < m.

Discussion.

An existence-and-uniqueness claim, and the two halves need different arguments, as they did over N0\mathbb{N}_0. For existence we look for the remainder rather than the quotient: the numbers a−qma - qm that land in N0\mathbb{N}_0 form a set to which well-ordering applies, provided it is non-empty. That is the one new step, since a negative aa leaves nothing when q=0q = 0; taking q=aq = a works, because multiplying a negative aa by m⩾1m \geqslant 1 only makes it more negative. Minimality of the least member then forces it below mm, since otherwise one more mm could be subtracted. Uniqueness is the argument from the earlier theorem word for word: two decompositions give a multiple of mm equal to a difference of remainders, which is trapped strictly between −m-m and mm and so is 00.

Proof.

For existence, let R=def{a−qm∣q∈Z}∩N0R \defeq \{a - qm \mid q \in \mathbb{Z}\} \cap \mathbb{N}_0. It is non-empty: if 0⩽a0 \leqslant a then q=0q = 0 gives a∈Ra \in R; and if a<0a < 0 then q=aq = a gives a−am=a(1−m)⩾0a - am = a(1 - m) \geqslant 0, since a<0a < 0 and 1−m⩽01 - m \leqslant 0.

Well-ordering supplies r=defmin⁡Rr \defeq \min R, with a=qm+ra = qm + r for some q∈Zq \in \mathbb{Z} and 0⩽r0 \leqslant r. If m⩽rm \leqslant r then r−m∈N0r - m \in \mathbb{N}_0 and a−(q+1)m=r−ma - (q+1)m = r - m, so r−m∈Rr - m \in R; but r−m<rr - m < r because mm is positive, contradicting minimality. Hence r<mr < m.

For uniqueness, suppose q1m+r1=q2m+r2q_1m + r_1 = q_2m + r_2 with 0⩽r1,r2<m0 \leqslant r_1, r_2 < m. Then (q1−q2)m=r2−r1(q_1 - q_2)m = r_2 - r_1, and −m<r2−r1<m-m < r_2 - r_1 < m. If q1−q2q_1 - q_2 were non-zero its absolute size would be at least 11, so (q1−q2)m(q_1 - q_2)m would be at least mm or at most −m-m, which the bounds forbid. Hence q1=q2q_1 = q_2, and then r1=r2r_1 = r_2.

Corollary 10.58 (Remainder forms).

Let m∈Nm \in \mathbb{N}. Every a∈Za \in \mathbb{Z} has exactly one of the mm forms qmqm, qm+1qm + 1, …, qm+(m−1)qm + (m-1) with q∈Zq \in \mathbb{Z}. In particular m∣am \mid a if and only if the remainder is 00.

Proof.

The theorem gives exactly one pair q,rq, r with a=qm+ra = qm + r and r<mr < m, and the available values of rr are 0,1,…,m−10, 1, \ldots, m-1. If r=0r = 0 then a=qma = qm and m∣am \mid a; conversely a=qma = qm is a decomposition with remainder 00, which uniqueness makes the only one.

So m∤am \nmid a says that aa takes one of the m−1m - 1 forms qm+1,…,qm+(m−1)qm + 1, \ldots, qm + (m-1), and a proof from a non-divisibility hypothesis is a proof by cases with that many cases. Taking m=2m = 2 recovers the familiar reading: 2∤a2 \nmid a says a=2q+1a = 2q + 1. The next proposition is the pattern at m=3m = 3.

Proposition 10.59 (Divisibility by three).

Let a∈Za \in \mathbb{Z}. If 3∤a2−13 \nmid a^2 - 1, then 3∣a3 \mid a.

Discussion.

The statement is a conditional p→qp \to q in which pp is "3∤a2−13 \nmid a^2 - 1" and qq is "3∣a3 \mid a". A direct proof would have to start from a non-divisibility fact about a2−1a^2 - 1, which offers no equation to work with, so we take the contrapositive: if 3∤a3 \nmid a then 3∣a2−13 \mid a^2 - 1. That still opens with a non-divisibility, but now it is a hypothesis rather than a conclusion, and the corollary converts it into two cases, a=3k+1a = 3k + 1 and a=3k+2a = 3k + 2. Each case is then ordinary algebra: expand a2−1a^2 - 1, take a factor of 33 out, and check that what remains in the bracket is an integer.

Proof.

We prove the contrapositive: if 3∤a3 \nmid a, then 3∣a2−13 \mid a^2 - 1. By the corollary, a=3k+1a = 3k + 1 or a=3k+2a = 3k + 2 for some k∈Zk \in \mathbb{Z}.

If a=3k+1a = 3k + 1, then

a2−1=(3k+1)2−1=9k2+6k=3(3k2+2k),a^2 - 1 = (3k+1)^2 - 1 = 9k^2 + 6k = 3(3k^2 + 2k),

and 3k2+2k∈Z3k^2 + 2k \in \mathbb{Z}, so 3∣a2−13 \mid a^2 - 1.

If a=3k+2a = 3k + 2, then

a2−1=(3k+2)2−1=9k2+12k+3=3(3k2+4k+1),a^2 - 1 = (3k+2)^2 - 1 = 9k^2 + 12k + 3 = 3(3k^2 + 4k + 1),

and 3k2+4k+1∈Z3k^2 + 4k + 1 \in \mathbb{Z}, so 3∣a2−13 \mid a^2 - 1.

Remark (Exhibiting a remainder is enough).

The corollary works in both directions. If a=3k+1a = 3k + 1 or a=3k+2a = 3k + 2 for some kk, then 3∤a3 \nmid a, because divisibility would give aa the form 3k′3k' and each integer has exactly one of the three forms. So when the conclusion wanted is itself a non-divisibility, exhibiting a remainder settles it, and the same holds with any mm in place of 33.

Problem 10.25.

Show that 3∤a2+13 \nmid a^2 + 1 for every a∈Za \in \mathbb{Z}.

Problem 10.26.

Show that a∣ba \mid b and b∣ab \mid a together force b=ab = a or b=−ab = -a, and that a∣ba \mid b with b≠0b \neq 0 forces a⩽ba \leqslant b or b⩽ab \leqslant a according to sign — state the inequality carefully before proving it.

Problem 10.27.

Let p1,…,pk∈Zp_1, \ldots, p_k \in \mathbb{Z} be non-zero and let σ∈Sk\sigma \in S_k. Using the theorem on factors and the rearrangement corollary, show that each pip_i divides pσ(1)⋯pσ(k)p_{\sigma(1)} \cdots p_{\sigma(k)} as well as p1⋯pkp_1 \cdots p_k.

Problem 10.28.

Show that the square of an integer leaves remainder 00 or 11 on division by 44, and deduce that no integer of the form 4k+34k + 3 is a sum of two squares.

Rings and Fields

This last section names the structure formed by ++ and ⋅\cdot on Z\mathbb{Z}, and shows that the construction of Z\mathbb{Z} works for any monoid with the right properties.

The Construction Was Not Special

Look back at what the first half of the chapter used. It took (N0,+)(\mathbb{N}_0, +), a commutative monoid in which cancellation holds, and produced a group containing a copy of it. Cancellation entered once, in the proof of transitivity. Commutativity and the identity entered in the routine checks. Nothing else about N0\mathbb{N}_0 was used: not the order, not induction, not the successor.

Theorem 10.60 (Every regular commutative monoid sits inside a group).

Let (H,∗)(H, *) be a commutative regular monoid with identity ff. Then there are a group (G,∗)(G, *) with identity ee and an injective map α:H→G\alpha : H \to G such that

α(f)=e,α(a∗b)=α(a)∗α(b),\alpha(f) = e, \qquad \alpha(a * b) = \alpha(a) * \alpha(b),

and such that every c∈Gc \in G has the form c=α(a)∗α(b)−1c = \alpha(a) * \alpha(b)^{-1} for some a,b∈Ha, b \in H. Moreover the pair (G,α)(G, \alpha) is unique up to a unique isomorphism: if (G′,α′)(G', \alpha') is another such pair, there is exactly one isomorphism β:G→G′\beta : G \to G' with α′=β∘α\alpha' = \beta \circ \alpha.

Discussion.

Two claims, one much harder than the other. The first is an existence claim, and it needs no new work: the construction of Z\mathbb{Z} from N0\mathbb{N}_0 used only the hypotheses now assumed, so repeating it with ∗* in place of ++ builds GG, and the proofs of this chapter become its proofs. We say which pieces correspond.

The second is the one to prove. Uniqueness of β\beta comes first and is immediate: the condition α′=β∘α\alpha' = \beta \circ \alpha fixes β\beta on the image of α\alpha, and since every element of GG is a quotient α(a)∗α(b)−1\alpha(a) * \alpha(b)^{-1}, and a homomorphism must send an inverse to an inverse, β\beta is forced everywhere. That forced formula is then taken as a definition, and since an element of GG may be written as such a quotient in many ways, we check that two writings give the same value, which uses injectivity of α\alpha. That β\beta is a homomorphism is a short computation, and we get bijectivity by building the map the other way and observing that both composites satisfy the defining condition of the identity, which the uniqueness half then identifies them with.

Proof.

For existence, run the construction of the first half of this chapter with HH in place of N0\mathbb{N}_0 and ∗* in place of ++. Declare (a,b)∼(a′,b′)(a, b) \sim (a', b') when a∗b′=a′∗ba * b' = a' * b; this is an equivalence relation, the proof of transitivity using cancellation exactly where it used it for N0\mathbb{N}_0. Let GG be the quotient, with [(a,b)]∗[(a′,b′)]=def[(a∗a′,b∗b′)][(a,b)] * [(a',b')] \defeq [(a * a', b * b')], well defined by the same computation as before. Then (G,∗)(G, *) is an abelian group with identity e=def[(f,f)]e \defeq [(f,f)] and [(a,b)]−1=[(b,a)][(a,b)]^{-1} = [(b,a)], and α(a)=def[(a,f)]\alpha(a) \defeq [(a, f)] is injective with α(f)=e\alpha(f) = e and α(a∗b)=α(a)∗α(b)\alpha(a * b) = \alpha(a) * \alpha(b). Finally

α(a)∗α(b)−1=[(a,f)]∗[(f,b)]=[(a∗f,f∗b)]=[(a,b)],\alpha(a) * \alpha(b)^{-1} = [(a,f)] * [(f,b)] = [(a * f, f * b)] = [(a, b)],

so every element of GG has the required form.

For uniqueness, let (G′,α′)(G', \alpha') be another such pair and suppose β:G→G′\beta : G \to G' is a homomorphism with α′=β∘α\alpha' = \beta \circ \alpha. For c=α(a)∗α(b)−1c = \alpha(a) * \alpha(b)^{-1} we get

β(c)=β(α(a))∗β(α(b)−1)=α′(a)∗α′(b)−1,\beta(c) = \beta(\alpha(a)) * \beta\bigl(\alpha(b)^{-1}\bigr) = \alpha'(a) * \alpha'(b)^{-1},

using that homomorphisms respect inverses. So β\beta is determined, and at most one such map exists.

That formula does define a map. Suppose α(a)∗α(b)−1=α(a′)∗α(b′)−1\alpha(a) * \alpha(b)^{-1} = \alpha(a') * \alpha(b')^{-1}. Multiplying by α(b)∗α(b′)\alpha(b) * \alpha(b') gives α(a)∗α(b′)=α(a′)∗α(b)\alpha(a) * \alpha(b') = \alpha(a') * \alpha(b), that is α(a∗b′)=α(a′∗b)\alpha(a * b') = \alpha(a' * b), so a∗b′=a′∗ba * b' = a' * b by injectivity of α\alpha. Applying α′\alpha' to that equation and reversing the steps gives α′(a)∗α′(b)−1=α′(a′)∗α′(b′)−1\alpha'(a) * \alpha'(b)^{-1} = \alpha'(a') * \alpha'(b')^{-1}, so the value does not depend on the writing.

The map β\beta so defined is a homomorphism, since

(α(a)∗α(b)−1)∗(α(a′)∗α(b′)−1)=α(a∗a′)∗α(b∗b′)−1\bigl(\alpha(a) * \alpha(b)^{-1}\bigr) * \bigl(\alpha(a') * \alpha(b')^{-1}\bigr) = \alpha(a * a') * \alpha(b * b')^{-1}

in GG and the same identity holds in G′G', both by commutativity and the inverse of a product. It satisfies α′=β∘α\alpha' = \beta \circ \alpha, by taking b=fb = f.

Exchanging the roles of GG and G′G' produces a homomorphism β′:G′→G\beta' : G' \to G with α=β′∘α′\alpha = \beta' \circ \alpha'. Then β′∘β\beta' \circ \beta is a homomorphism G→GG \to G with (β′∘β)∘α=α(\beta' \circ \beta) \circ \alpha = \alpha, and so is idG\mathrm{id}_G; the uniqueness just proved, applied with G′=GG' = G and α′=α\alpha' = \alpha, forces β′∘β=idG\beta' \circ \beta = \mathrm{id}_G. Likewise β∘β′=idG′\beta \circ \beta' = \mathrm{id}_{G'}. So β\beta is a bijection, hence an isomorphism.

Remark.

The theorem says the integers are the only possible answer: any group containing a copy of (N0,+)(\mathbb{N}_0,+) in which every element is a difference of two copied elements is isomorphic to Z\mathbb{Z}, by a unique isomorphism respecting the copy. It also saves work later. The same theorem, applied to a multiplicative monoid instead of an additive one, is what will build the rationals out of the integers, and we shall not have to write the pairs down again.

Rings, Integral Domains and Fields

Definition 10.61 (Ring).

A ring is a set RR with two operations ++ and ⋅\cdot such that (R,+)(R, +) is an abelian group, written with identity 00; (R,⋅)(R, \cdot) is a semigroup; and both distributive laws hold,

a(b+c)=ab+ac,(b+c)a=ba+ca.a(b + c) = ab + ac, \qquad (b + c)a = ba + ca .

The ring is commutative if ⋅\cdot is commutative. It is a ring with identity if there is 1∈R1 \in R with 1≠01 \neq 0 and 1⋅a=a⋅1=a1 \cdot a = a \cdot 1 = a for every aa. It is free of zero divisors if ab=0ab = 0 forces a=0a = 0 or b=0b = 0. A commutative ring with identity and free of zero divisors is an integral domain, and an integral domain in which every a≠0a \neq 0 is invertible under ⋅\cdot is a field.

The identity of ++ and the identity of ⋅\cdot are each unique, by uniqueness of the identity applied to the two operations separately, so the notation 00 and 11 names something definite. Nothing yet says how the two operations interact beyond distributivity; the next proposition gives some consequences of distributivity.

Proposition 10.62 (Arithmetic in a ring).

Let RR be a ring and let a,b∈Ra, b \in R. Then

  1. 0⋅a=a⋅0=00 \cdot a = a \cdot 0 = 0;
  2. (−a)b=a(−b)=−(ab)(-a)b = a(-b) = -(ab);
  3. (−a)(−b)=ab(-a)(-b) = ab.

Discussion.

None of these is an axiom, and each has to be derived from distributivity, which is the only link between the two operations. For the first, write 00 as 0+00 + 0 and distribute: the result is an equation saying that 0⋅a0 \cdot a added to itself is itself, and in a group only the identity does that, so cancellation finishes. The second uses the first as its target: ab+(−a)bab + (-a)b becomes, by distributivity, (a+(−a))b=0⋅b=0\bigl(a + (-a)\bigr)b = 0 \cdot b = 0, which says (−a)b(-a)b is an additive inverse of abab, and inverses are unique. The third is the second applied twice, or once with bb replaced by −b-b, together with −(−x)=x-(-x) = x.

Proof.

For the first, 0⋅a=(0+0)⋅a=0⋅a+0⋅a0 \cdot a = (0 + 0) \cdot a = 0 \cdot a + 0 \cdot a by the right distributive law. Cancelling 0⋅a0 \cdot a in the group (R,+)(R, +) gives 0=0⋅a0 = 0 \cdot a. The computation for a⋅0a \cdot 0 is the same with the left law.

For the second, ab+(−a)b=(a+(−a))b=0⋅b=0ab + (-a)b = \bigl(a + (-a)\bigr)b = 0 \cdot b = 0, and likewise (−a)b+ab=0(-a)b + ab = 0, so (−a)b(-a)b is an additive inverse of abab and hence equals −(ab)-(ab). The same argument on the other side gives a(−b)=−(ab)a(-b) = -(ab).

For the third, replacing bb by −b-b in the second part gives (−a)(−b)=−(a(−b))=−(−(ab))=ab(-a)(-b) = -\bigl(a(-b)\bigr) = -\bigl(-(ab)\bigr) = ab.

Theorem 10.63 (The integers are an integral domain).

(Z,+,⋅)(\mathbb{Z}, +, \cdot) is an integral domain, and it is not a field.

Discussion.

Each clause of the definition has already been proved or set as a problem, so the proof mostly collects them: the additive group is the theorem of the second section, the multiplicative semigroup and its commutativity and identity are the problems of the third, and distributivity is its theorem. Two points need a comment. Freedom from zero divisors is the problem on products that vanish. That Z\mathbb{Z} is not a field is the proposition on invertible integers, which leaves only 11 and −1-1 invertible, so 22 has no inverse and 2x=12x = 1 has no solution.

Proof.

(Z,+)(\mathbb{Z}, +) is an abelian group by the theorem of the second section. Multiplication is associative and commutative by the problems there, with identity 11 by the proposition on the embedding, and it distributes over addition by the theorem on distributivity; commutativity turns the one distributive law into both. The problem on vanishing products says xy=0xy = 0 forces x=0x = 0 or y=0y = 0. So Z\mathbb{Z} is an integral domain.

It is not a field: by the proposition on invertible integers, the only invertible elements are 11 and −1-1, so 22 has no multiplicative inverse.

Example 10.64 (The smallest field).

Let F2=def{0,1}\mathbb{F}_2 \defeq \{0, 1\} with 0≠10 \neq 1. The field axioms fix both tables. Multiplication is forced by the previous proposition and the identity law: 0⋅0=0⋅1=1⋅0=00 \cdot 0 = 0 \cdot 1 = 1 \cdot 0 = 0 and 1⋅1=11 \cdot 1 = 1. For addition, only 1+11 + 1 is not yet determined, and 1+1=11 + 1 = 1 would give

1=1+0=1+(1+(−1))=(1+1)+(−1)=1+(−1)=0,1 = 1 + 0 = 1 + \bigl(1 + (-1)\bigr) = (1 + 1) + (-1) = 1 + (-1) = 0,

which is forbidden; so 1+1=01 + 1 = 0. The tables are

+01001110⋅01000101\begin{array}{c|cc} + & 0 & 1 \\ \hline 0 & 0 & 1 \\ 1 & 1 & 0 \end{array} \qquad\qquad \begin{array}{c|cc} \cdot & 0 & 1 \\ \hline 0 & 0 & 0 \\ 1 & 0 & 1 \end{array}

and one checks directly that they satisfy the axioms. A field needs 0≠10 \neq 1, so no smaller field exists.

Corollary 10.65 (The binomial theorem in a commutative ring).

Let RR be a commutative ring with identity, let a,b∈Ra, b \in R and let n∈N0n \in \mathbb{N}_0. Then

(a+b)n=∑k=0n(nk)akbn−k,(a + b)^n = \sum_{k=0}^{n} \binom{n}{k} a^k b^{n-k},

where (nk)x\binom{n}{k} x means the sum of (nk)\binom{n}{k} copies of xx.

Proof.

The proof of the binomial theorem used only the commutative, associative and distributive laws and the recursion defining powers, as the remark following it recorded. Every one of those holds in a commutative ring with identity, so the argument applies word for word, with the coefficient (nk)\binom{n}{k} read as an instruction to add (nk)\binom{n}{k} copies.

Remark.

The coefficient cannot in general be read as an element of RR, since RR need not contain a copy of N0\mathbb{N}_0; what it names is a repeated sum, and repeated sums can be 00. In F2\mathbb{F}_2, for instance, 2x=x+x=02x = x + x = 0 for every xx, so the middle term of (a+b)2(a+b)^2 disappears and (a+b)2=a2+b2(a+b)^2 = a^2 + b^2.

Greatest Common Divisors

The next theorem, proved with division with remainder, is what we need to build fields from the integers.

Theorem 10.66 (Bézout's identity).

Let a,b∈Za, b \in \mathbb{Z} be not both 00, and let

S=def{ax+by∣x,y∈Z}.S \defeq \{ax + by \mid x, y \in \mathbb{Z}\}.

Then SS contains a positive element, its least positive element dd divides both aa and bb, and every common divisor of aa and bb divides dd. In particular d=ax0+by0d = ax_0 + by_0 for some x0,y0∈Zx_0, y_0 \in \mathbb{Z}.

Discussion.

Three assertions, and the first is needed for well-ordering to produce dd: taking x=ax = a and y=by = b gives a2+b2a^2 + b^2, which is positive because a square is never negative and the two are not both 00. The second is the main one, and it uses division with remainder. Divide aa by dd; the remainder is again of the form ax+byax + by, being aa minus a multiple of ax0+by0ax_0 + by_0, and it is strictly below dd; since dd was the least positive member, the remainder cannot be positive, so it is 00 and dd divides aa. The same for bb. The third assertion is the easiest: a common divisor of aa and bb divides every combination ax+byax + by, by the arithmetic of divisibility, and dd is one of those.

Proof.

Taking x=ax = a and y=by = b gives a2+b2∈Sa^2 + b^2 \in S, which is positive since squares are non-negative and aa and bb are not both 00. So the positive members of SS form a non-empty subset of N\mathbb{N}, and well-ordering supplies a least one, d=ax0+by0d = ax_0 + by_0.

Divide: a=qd+ra = qd + r with 0⩽r<d0 \leqslant r < d. Then

r=a−qd=a−q(ax0+by0)=a(1−qx0)+b(−qy0),r = a - qd = a - q(ax_0 + by_0) = a(1 - qx_0) + b(-qy_0),

so r∈Sr \in S. Were rr positive it would be a positive member of SS below dd, contrary to the choice of dd; so r=0r = 0 and d∣ad \mid a. The same argument with bb in place of aa gives d∣bd \mid b.

If cc divides both aa and bb, then cc divides ax0+by0=dax_0 + by_0 = d by the third part of the arithmetic of divisibility.

Definition 10.67 (Greatest common divisor and coprimality).

For a,b∈Za, b \in \mathbb{Z} not both 00, the greatest common divisor gcd⁡(a,b)\gcd(a, b) is the dd of the theorem: the least positive integer of the form ax+byax + by. The integers aa and bb are coprime if gcd⁡(a,b)=1\gcd(a, b) = 1.

The name is justified by the theorem: dd is a common divisor, and every common divisor divides it, hence is at most dd. Coprimality says exactly that 1=ax+by1 = ax + by for some integers xx and yy, and the next section uses that equation.

The Integers Modulo mm

Definition 10.68 (Congruence).

Let m∈Nm \in \mathbb{N} and a,b∈Za, b \in \mathbb{Z}. Then aa is congruent to bb modulo mm, written a≡b(modm)a \equiv b \pmod{m}, if m∣a−bm \mid a - b.

Proposition 10.69 (Congruence is an equivalence relation).

For each m∈Nm \in \mathbb{N}, congruence modulo mm is an equivalence relation on Z\mathbb{Z}, and its classes are in bijection with {0,1,…,m−1}\{0, 1, \ldots, m-1\}.

Discussion.

Each of the three properties follows from the definition. Reflexivity is m∣0m \mid 0, which holds because 0=m⋅00 = m \cdot 0. Symmetry is the observation that b−ab - a is −(a−b)-(a - b), and a divisor of an integer divides its negative. Transitivity is the corollary on sums: mm divides a−ba - b and b−cb - c, hence their sum a−ca - c. For the count, division with remainder attaches to each integer exactly one remainder below mm, and two integers are congruent exactly when their remainders agree, because their difference is then a multiple of mm, and conversely a difference of two numbers both below mm cannot be a non-zero multiple of mm.

Proof.

Reflexivity: a−a=0=m⋅0a - a = 0 = m \cdot 0, so m∣a−am \mid a - a. Symmetry: if a−b=mka - b = mk then b−a=m(−k)b - a = m(-k). Transitivity: if m∣a−bm \mid a - b and m∣b−cm \mid b - c then mm divides (a−b)+(b−c)=a−c(a-b) + (b-c) = a - c by the corollary on sums.

For the count, let r(a)r(a) be the remainder of aa on division by mm. If r(a)=r(b)r(a) = r(b) then a−b=(qa−qb)ma - b = (q_a - q_b)m, so a≡ba \equiv b. Conversely if a≡ba \equiv b then r(a)−r(b)=(a−qam)−(b−qbm)r(a) - r(b) = (a - q_am) - (b - q_bm) is a multiple of mm lying strictly between −m-m and mm, hence 00. So a↦r(a)a \mapsto r(a) induces a bijection from the classes onto {0,…,m−1}\{0, \ldots, m-1\}.

Definition 10.70 (The integers modulo mm).

Write [a][a] for the class of aa and

Z/mZ=defZ/≡(modm)\mathbb{Z}/m\mathbb{Z} \defeq \mathbb{Z}\big/{\equiv} \pmod m

for the quotient, the integers modulo mm, with operations

[a]+[b]=def[a+b],[a]⋅[b]=def[ab].[a] + [b] \defeq [a + b], \qquad [a] \cdot [b] \defeq [ab].

Theorem 10.71 (The integers modulo mm form a ring).

The two operations above are well defined, and Z/mZ\mathbb{Z}/m\mathbb{Z} is a commutative ring with identity [1][1] and zero [0][0], with #(Z/mZ)=m\#(\mathbb{Z}/m\mathbb{Z}) = m when m⩾2m \geqslant 2.

Discussion.

Well-definedness is the only thing that needs care, as in the first half of the chapter: the formulas name representatives, and a class has many. So we suppose a≡a′a \equiv a' and b≡b′b \equiv b' and must show a+b≡a′+b′a + b \equiv a' + b' and ab≡a′b′ab \equiv a'b'. The first is the corollary on sums applied to the two differences. The second needs one step more: ab−a′b′ab - a'b' does not obviously factor, so we insert and remove a′ba'b, splitting it into b(a−a′)b(a - a') and a′(b−b′)a'(b - b'), each divisible by mm by the fourth part of the arithmetic of divisibility, and then add. Every ring axiom afterwards is the corresponding axiom of Z\mathbb{Z} read inside the brackets, and the count is the bijection of the previous proposition.

Proof.

Suppose m∣a−a′m \mid a - a' and m∣b−b′m \mid b - b'. Then mm divides (a−a′)+(b−b′)=(a+b)−(a′+b′)(a - a') + (b - b') = (a + b) - (a' + b'), so the sum is well defined. And

ab−a′b′=b(a−a′)+a′(b−b′),ab - a'b' = b(a - a') + a'(b - b'),

in which mm divides each summand by the fourth part of the arithmetic of divisibility, hence divides the whole by the corollary on sums; so the product is well defined.

Associativity, commutativity and distributivity for the classes follow from the same laws in Z\mathbb{Z} applied to representatives; [0][0] is an additive identity with −[a]=[−a]-[a] = [-a], and [1][1] is a multiplicative identity. When m⩾2m \geqslant 2 the classes [0],…,[m−1][0], \ldots, [m-1] are distinct and exhaust the quotient by the previous proposition, so there are mm of them and [0]≠[1][0] \neq [1].

Theorem 10.72 (A prime modulus gives a field).

Let m⩾2m \geqslant 2. Then Z/mZ\mathbb{Z}/m\mathbb{Z} is a field if and only if mm is prime. When m=pm = p is prime one writes Fp\mathbb{F}_p for it, a field with exactly pp elements.

Discussion.

A biconditional, and the two directions use opposite features of mm. Suppose mm is composite, say m=m1m2m = m_1m_2 with both factors strictly between 11 and mm. Then [m1][m_1] and [m2][m_2] are non-zero while their product is [m]=[0][m] = [0], so the ring has zero divisors; and a zero divisor can never be invertible, since multiplying [m1][m2]=[0][m_1][m_2] = [0] by a hypothetical inverse of [m1][m_1] would give [m2]=[0][m_2] = [0]. So no composite modulus works.

Suppose instead m=pm = p is prime and [a]≠[0][a] \neq [0], that is p∤ap \nmid a. The positive divisors of pp are 11 and pp, and pp is not among the common divisors of aa and pp, so gcd⁡(a,p)=1\gcd(a, p) = 1. Bézout then writes 1=ax+py1 = ax + py, and reading that equation modulo pp leaves [a][x]=[1][a][x] = [1]. Every non-zero class is therefore invertible, which with the previous theorem is the definition of a field.

Proof.

Suppose mm is not prime, so m=m1m2m = m_1m_2 with 1<m1,m2<m1 < m_1, m_2 < m. Then [m1]≠[0][m_1] \neq [0] and [m2]≠[0][m_2] \neq [0], since mm divides neither factor, while [m1][m2]=[m]=[0][m_1][m_2] = [m] = [0]. If [m1][m_1] had an inverse [c][c] then [m2]=[c][m1][m2]=[c][0]=[0][m_2] = [c][m_1][m_2] = [c][0] = [0], a contradiction. So Z/mZ\mathbb{Z}/m\mathbb{Z} is not a field.

Suppose m=pm = p is prime and let [a]≠[0][a] \neq [0], so p∤ap \nmid a. Any positive common divisor of aa and pp divides pp, hence is 11 or pp; it is not pp, since p∤ap \nmid a. So gcd⁡(a,p)=1\gcd(a, p) = 1, and Bézout gives x,y∈Zx, y \in \mathbb{Z} with ax+py=1ax + py = 1. Then ax−1=p(−y)ax - 1 = p(-y), so [a][x]=[ax]=[1][a][x] = [ax] = [1] and [a][a] is invertible. With the previous theorem, Z/pZ\mathbb{Z}/p\mathbb{Z} is a field, and it has pp elements.

Remark.

Taking p=2p = 2 recovers F2\mathbb{F}_2, whose tables were forced by the axioms a few pages ago; now it comes from the construction, which gives one field for every prime. These are not all the finite fields (there is one with pnp^n elements for each prime pp and each n∈Nn \in \mathbb{N}), but the others are not quotients of Z\mathbb{Z}, and we do not build them here.

Problem 10.29.

Show that [a]∈Z/mZ[a] \in \mathbb{Z}/m\mathbb{Z} is invertible if and only if gcd⁡(a,m)=1\gcd(a, m) = 1, and that the invertible classes form an abelian group under multiplication.

Problem 10.30.

Write out the addition and multiplication tables of Z/mZ\mathbb{Z}/m\mathbb{Z} for m=4m = 4 and m=5m = 5, and say which classes are invertible in each.

Problem 10.31.

Show that a subset R0R_0 of a ring RR is itself a ring under the restricted operations if and only if it is non-empty and a−ba - b and abab lie in R0R_0 whenever aa and bb do. Show that 2Z2\mathbb{Z} is such a subset of Z\mathbb{Z} but does not contain the identity of Z\mathbb{Z}.

Problem 10.32.

Show that freedom from zero divisors is equivalent, in a commutative ring with identity, to cancellation: ab=acab = ac with a≠0a \neq 0 forces b=cb = c. Which of the two conditions was easier to check for Z\mathbb{Z}?

Subrings, Homomorphisms and Ideals

The chapter on groups asked, of every structure it defined, which subsets inherit it and which maps respect it. We ask the same two questions of rings. The answers are parallel, except that the kernel of a ring homomorphism has a strictly stronger property than a subring.

Definition 10.73 (Subring).

Let RR be a ring. A non-empty subset R0⊂RR_0 \subset R is a subring if a−b∈R0a - b \in R_0 and ab∈R0ab \in R_0 whenever a,b∈R0a, b \in R_0.

The two conditions say exactly that R0R_0 is a subgroup of (R,+)(R, +), by the one-step criterion, and is closed under multiplication; associativity and distributivity are laws and so are inherited. Freedom from zero divisors is inherited too, being another law. What is not inherited is the identity: 2Z2\mathbb{Z} is a subring of Z\mathbb{Z} containing no multiplicative identity of Z\mathbb{Z}, and a subring of a ring with identity may lack one.

Definition 10.74 (Ring homomorphism).

Let R1R_1 and R2R_2 be rings. A function α:R1→R2\alpha : R_1 \to R_2 is a ring homomorphism if

α(a+b)=α(a)+α(b)andα(ab)=α(a)α(b)\alpha(a + b) = \alpha(a) + \alpha(b) \qquad \text{and} \qquad \alpha(ab) = \alpha(a)\alpha(b)

for all a,b∈R1a, b \in R_1. A bijective ring homomorphism is a ring isomorphism. The kernel is ker⁡α=defα−1({0})\ker\alpha \defeq \alpha^{-1}(\{0\}) and the image is α(R1)\alpha(R_1).

Proposition 10.75 (Kernel and image of a ring homomorphism).

Let α:R1→R2\alpha : R_1 \to R_2 be a ring homomorphism. Then ker⁡α\ker\alpha is a subring of R1R_1 and α(R1)\alpha(R_1) is a subring of R2R_2; and α\alpha is injective if and only if ker⁡α={0}\ker\alpha = \{0\}.

Discussion.

A ring homomorphism is in particular a homomorphism of the additive groups, so everything proved about kernels and images in the chapter on groups is available and settles the additive half of each claim, injectivity included. What remains is closure under multiplication, one line on each side: a product of two elements of the kernel maps to a product of zeros, and a product of two values is the value at a product. Nothing here needs the identity, and neither the kernel nor the image need contain one.

Proof.

Since α\alpha is a homomorphism of (R1,+)(R_1, +) into (R2,+)(R_2, +), the proposition on kernels and images makes ker⁡α\ker\alpha a subgroup of (R1,+)(R_1, +) and α(R1)\alpha(R_1) a subgroup of (R2,+)(R_2, +), and makes α\alpha injective exactly when ker⁡α={0}\ker\alpha = \{0\}.

If a,b∈ker⁡αa, b \in \ker\alpha then α(ab)=α(a)α(b)=0⋅0=0\alpha(ab) = \alpha(a)\alpha(b) = 0 \cdot 0 = 0, so ab∈ker⁡αab \in \ker\alpha. And α(a)α(b)=α(ab)∈α(R1)\alpha(a)\alpha(b) = \alpha(ab) \in \alpha(R_1). So both are closed under multiplication and hence are subrings.

Remark (Neither identities nor freedom from zero divisors survive).

The image of a ring with identity need not contain the identity of the target, and the image of an integral domain need not be free of zero divisors: the map Z→Z/mZ\mathbb{Z} \to \mathbb{Z}/m\mathbb{Z} sending aa to [a][a] is a ring homomorphism, and for composite mm its image is the whole of a ring with zero divisors. The kernel contains the identity only in one case: if 1∈ker⁡α1 \in \ker\alpha then α(a)=α(a⋅1)=α(a)⋅0=0\alpha(a) = \alpha(a \cdot 1) = \alpha(a) \cdot 0 = 0 for every aa, so α\alpha is the zero map.

The kernel has a further property, the analogue of normality.

Proposition 10.76 (Kernels absorb multiplication).

Let α:R1→R2\alpha : R_1 \to R_2 be a ring homomorphism, let a∈ker⁡αa \in \ker\alpha and let b∈R1b \in R_1. Then ab∈ker⁡αab \in \ker\alpha and ba∈ker⁡αba \in \ker\alpha.

Discussion.

A subring need only be closed under products of its own elements, but the kernel contains the product of any of its elements with anything at all, and the reason is the one-line computation that α\alpha sends abab to α(a)α(b)=0⋅α(b)\alpha(a)\alpha(b) = 0 \cdot \alpha(b), which is 00 by the arithmetic of a ring. This property is strictly stronger, and like normality for subgroups it gets its own name.

Proof.

α(ab)=α(a)α(b)=0⋅α(b)=0\alpha(ab) = \alpha(a)\alpha(b) = 0 \cdot \alpha(b) = 0, so ab∈ker⁡αab \in \ker\alpha; and α(ba)=α(b)⋅0=0\alpha(ba) = \alpha(b) \cdot 0 = 0, so ba∈ker⁡αba \in \ker\alpha.

Definition 10.77 (Ideal).

Let RR be a commutative ring. A non-empty subset a⊂R\mathfrak{a} \subset R is an ideal if

  1. a1−a2∈aa_1 - a_2 \in \mathfrak{a} whenever a1,a2∈aa_1, a_2 \in \mathfrak{a};
  2. ba∈aba \in \mathfrak{a} whenever a∈aa \in \mathfrak{a} and b∈Rb \in R.

An ideal other than {0}\{0\} and RR is proper. For a∈Ra \in R the set Ra=def{ba∣b∈R}Ra \defeq \{ba \mid b \in R\} is the principal ideal generated by aa, written (a)(a); more generally (a1,…,an)=def{b1a1+⋯+bnan∣bi∈R}(a_1, \ldots, a_n) \defeq \{b_1a_1 + \cdots + b_na_n \mid b_i \in R\}.

The second clause makes the first look weak, and in a ring with identity it is: from a∈aa \in \mathfrak{a} one gets −a=(−1)a∈a-a = (-1)a \in \mathfrak{a}, so closure under subtraction follows from closure under addition. Every ideal is a subring, and the kernel of every ring homomorphism is an ideal by the proposition above. The converse, that every ideal is a kernel, is proved below.

Example 10.78 (Ideals of the integers).

For m∈Nm \in \mathbb{N} the set mZm\mathbb{Z} of multiples of mm is an ideal of Z\mathbb{Z}, and it is the principal ideal (m)(m). It is the kernel of a↦[a]a \mapsto [a], and congruence modulo mm is exactly the relation a−b∈mZa - b \in m\mathbb{Z}, so the general quotient construction below, applied to this ideal, reproduces the ring Z/mZ\mathbb{Z}/m\mathbb{Z} built by hand earlier, which explains the notation. Bézout’s identity says more: (a,b)=(gcd⁡(a,b))(a, b) = (\gcd(a,b)), so every ideal generated by finitely many integers is principal.

Theorem 10.79 (The quotient ring).

Let RR be a commutative ring and a\mathfrak{a} an ideal. Then a≡ba \equiv b meaning a−b∈aa - b \in \mathfrak{a} is an equivalence relation, and the operations

[a]+[b]=def[a+b],[a]⋅[b]=def[ab][a] + [b] \defeq [a + b], \qquad [a] \cdot [b] \defeq [ab]

are well defined on the quotient R/aR/\mathfrak{a}, making it a commutative ring. The map q:R→R/aq : R \to R/\mathfrak{a} sending aa to [a][a] is a surjective ring homomorphism with ker⁡q=a\ker q = \mathfrak{a}.

Discussion.

That the relation is an equivalence is the first clause of the definition, which makes a\mathfrak{a} a subgroup of (R,+)(R,+): reflexivity is 0∈a0 \in \mathfrak{a}, symmetry is closure under negation, transitivity is closure under addition.

Well-definedness of the sum is the additive statement already proved for quotient groups, an abelian group having every subgroup normal. Well-definedness of the product uses the second clause of the definition: ab−a′b′ab - a'b' does not obviously lie in a\mathfrak{a}, so we insert and remove a′ba'b, splitting the difference into b(a−a′)b(a - a') and a′(b−b′)a'(b - b'), each of which is a ring element times a member of a\mathfrak{a}, which lies in an ideal but need not lie in a subring. The ring axioms then follow from those of RR applied to representatives, and the statement about qq is the definition read backwards.

Proof.

The first clause makes a\mathfrak{a} a subgroup of the abelian group (R,+)(R,+), so a−b∈aa - b \in \mathfrak{a} is an equivalence relation whose classes are the cosets, and the theorem on quotient groups makes [a]+[b]=def[a+b][a] + [b] \defeq [a+b] well defined with (R/a,+)(R/\mathfrak{a}, +) an abelian group.

For the product, suppose a−a′∈aa - a' \in \mathfrak{a} and b−b′∈ab - b' \in \mathfrak{a}. Then

ab−a′b′=b(a−a′)+a′(b−b′),ab - a'b' = b(a - a') + a'(b - b'),

and the second clause puts both summands in a\mathfrak{a}, so their sum lies there and [ab]=[a′b′][ab] = [a'b'].

Associativity, commutativity and distributivity for classes are the corresponding laws in RR applied to representatives. Finally q(a+b)=[a+b]=q(a)+q(b)q(a + b) = [a+b] = q(a) + q(b) and q(ab)=[ab]=q(a)q(b)q(ab) = [ab] = q(a)q(b), so qq is a ring homomorphism; it is surjective by construction; and q(a)=[0]q(a) = [0] holds exactly when a∈aa \in \mathfrak{a}.

Theorem 10.80 (First isomorphism theorem for rings).

Let α:R1→R2\alpha : R_1 \to R_2 be a homomorphism of commutative rings. Then

R1/ker⁡α  ≅  α(R1),R_1/\ker\alpha \;\cong\; \alpha(R_1),

by the ring isomorphism sending [a][a] to α(a)\alpha(a).

Discussion.

Both sides exist already: the quotient because kernels are ideals, the image because it is a subring. So the work is in the named map, and it is the group version with one clause added. Well-definedness, additivity, surjectivity onto the image and injectivity are exactly as they were there, since α\alpha is in particular a homomorphism of additive groups. The one new thing to check is that the map respects multiplication, and that is the definition of the quotient product followed by the multiplicativity of α\alpha.

Proof.

Write k=defker⁡α\mathfrak{k} \defeq \ker\alpha, an ideal by the proposition on kernels, and define β([a])=defα(a)\beta([a]) \defeq \alpha(a).

Everything about the additive structure — that β\beta is well defined, additive, surjective onto α(R1)\alpha(R_1) and injective — is the first isomorphism theorem for groups applied to α\alpha as a homomorphism of (R1,+)(R_1,+) into (R2,+)(R_2,+).

For multiplication, β([a][b])=β([ab])=α(ab)=α(a)α(b)=β([a])β([b])\beta([a][b]) = \beta([ab]) = \alpha(ab) = \alpha(a)\alpha(b) = \beta([a])\beta([b]). So β\beta is a bijective ring homomorphism onto α(R1)\alpha(R_1).

Remark (Fields have no proper ideals).

If K\mathbb{K} is a field and a\mathfrak{a} an ideal containing some a≠0a \neq 0, then 1=a−1a∈a1 = a^{-1}a \in \mathfrak{a}, and then b=b⋅1∈ab = b \cdot 1 \in \mathfrak{a} for every bb, so a=K\mathfrak{a} = \mathbb{K}. A field therefore has only the two trivial ideals, and consequently a ring homomorphism between fields is either the zero map or injective: its kernel, being an ideal not containing 11 unless it is everything, must be {0}\{0\}.

Problem 10.33.

Show that an intersection of ideals of RR is an ideal, and that (a1,…,an)(a_1, \ldots, a_n) is the smallest ideal containing a1,…,ana_1, \ldots, a_n.

Problem 10.34.

Show that a∣ba \mid b in a commutative ring with identity if and only if (b)⊂(a)(b) \subset (a), that uu is a unit if and only if (u)=R(u) = R, and that dd is a greatest common divisor of aa and bb exactly when (a,b)=(d)(a, b) = (d).

Problem 10.35.

Show that every ideal of Z\mathbb{Z} is principal. Use well-ordering on the positive members, as in the proof of Bézout’s identity.

Polynomials

A polynomial is usually written as an expression, and an expression is not an object. We do what we did for ordered pairs and for the integers: say what the object is, in terms of things already built, and then recover the familiar notation as a theorem.

Definition 10.81 (Polynomials and formal power series).

Let RR be a commutative ring with identity. A formal power series over RR is a sequence α:N0→R\alpha : \mathbb{N}_0 \to R, written α=(a0,a1,a2,…)\alpha = (a_0, a_1, a_2, \ldots) with an=defα(n)a_n \defeq \alpha(n). It is a polynomial if an=0a_n = 0 for all but finitely many nn. Define

(α+β)n=defan+bn,(αβ)n=def∑j=0najbn−j.(\alpha + \beta)_n \defeq a_n + b_n, \qquad (\alpha\beta)_n \defeq \sum_{j = 0}^{n} a_j b_{n-j} .

Write R[x]R[x] for the set of polynomials and R[[x]]R[[x]] for the set of all formal power series, with these operations. The degree deg⁡α\deg\alpha of a non-zero polynomial α\alpha is the largest index carrying a non-zero coefficient.

The product is the rule one would get by multiplying out two expressions and collecting the terms of each degree; here it is a definition, and the sum defining it is a finite sum over an interval, so it names an element of RR without any question of convergence. “Formal” means that the series is a sequence of coefficients and nothing more.

Theorem 10.82 (Polynomials form a ring).

Let RR be a commutative ring with identity. Then R[[x]]R[[x]] is a commutative ring with identity under the operations above, and R[x]R[x] is a subring containing that identity. The map sending r∈Rr \in R to (r,0,0,…)(r, 0, 0, \ldots) is an injective ring homomorphism, and writing x=def(0,1,0,0,…)x \defeq (0, 1, 0, 0, \ldots) gives

xn=(0,…,0⏟n,1,0,…),α=∑j=0najxjfor every polynomial α with aj=0 beyond n.x^n = (\underbrace{0, \ldots, 0}_{n}, 1, 0, \ldots), \qquad \alpha = \sum_{j=0}^{n} a_j x^j \quad \text{for every polynomial } \alpha \text{ with } a_j = 0 \text{ beyond } n .

Discussion.

Addition is coordinatewise, so the additive group is immediate. Commutativity of the product is the observation that reversing the order of summation in ∑jajbn−j\sum_j a_j b_{n-j} turns it into ∑jbjan−j\sum_j b_j a_{n-j}, which is reindexing a finite sum. Associativity is the corresponding statement for a double sum: both (αβ)γ(\alpha\beta)\gamma and α(βγ)\alpha(\beta\gamma) have nn-th coefficient the sum of aibjcka_ib_jc_k over all triples with i+j+k=ni + j + k = n, so the two agree once the sums are rearranged, which the results on unordered index sets allow. Distributivity is coordinatewise. That R[x]R[x] is a subring is the observation that a sum or product of two sequences with finitely many non-zero terms has finitely many non-zero terms; for the product, because the nn-th coefficient vanishes once nn exceeds the sum of the two cut-offs. The claims about xx are a computation from the product rule, and the last display is then bookkeeping.

Proof.

Addition is coordinatewise, so (R[[x]],+)(R[[x]], +) is an abelian group with zero (0,0,…)(0,0,\ldots) and (−α)n=−an(-\alpha)_n = -a_n.

For commutativity of the product, the substitution j↦n−jj \mapsto n - j is a bijection of {0,…,n}\{0, \ldots, n\} with itself, so reindexing gives ∑j=0najbn−j=∑j=0nbjan−j\sum_{j=0}^{n} a_jb_{n-j} = \sum_{j=0}^{n} b_j a_{n-j}.

For associativity, both ((αβ)γ)n\bigl((\alpha\beta)\gamma\bigr)_n and (α(βγ))n\bigl(\alpha(\beta\gamma)\bigr)_n equal the sum of aibjcka_ib_jc_k over the finitely many triples (i,j,k)(i,j,k) in N0\mathbb{N}_0 with i+j+k=ni + j + k = n, by splitting each double sum and reindexing. Distributivity is coordinatewise, since the nn-th coefficient of α(β+γ)\alpha(\beta + \gamma) is ∑jaj(bn−j+cn−j)\sum_j a_j(b_{n-j} + c_{n-j}).

The element (1,0,0,…)(1, 0, 0, \ldots) is an identity, since its only non-zero coefficient is at 00 and the product sum collapses to an⋅1a_n \cdot 1.

If an=0a_n = 0 for n>Nn > N and bn=0b_n = 0 for n>Mn > M, then every term of ∑jajbn−j\sum_j a_jb_{n-j} vanishes once n>N+Mn > N + M, so R[x]R[x] is closed under products; it is clearly closed under differences. So R[x]R[x] is a subring, and it contains (1,0,…)(1,0,\ldots).

Finally xnx^n has 11 in position nn and 00 elsewhere, by induction on nn from the product rule, so ajxja_jx^j has aja_j in position jj and 00 elsewhere, and adding those for j⩽nj \leqslant n reproduces α\alpha.

Proposition 10.83 (Degree and zero divisors).

Let RR be an integral domain and let α,β∈R[x]\alpha, \beta \in R[x] be non-zero, of degrees deg⁡α\deg\alpha and deg⁡β\deg\beta. Then αβ≠0\alpha\beta \neq 0 and deg⁡(αβ)=deg⁡α+deg⁡β\deg(\alpha\beta) = \deg\alpha + \deg\beta. Hence R[x]R[x] is an integral domain, and it is never a field.

Discussion.

We look at the top coefficient. Writing NN and MM for the two degrees, the coefficient of αβ\alpha\beta at N+MN + M is a sum in which every term but one has a factor above the cut-off of α\alpha or of β\beta, hence vanishes; the remaining term is the product of the two leading coefficients, which is non-zero because RR has no zero divisors. So the product is non-zero and its degree is exactly N+MN + M. The last claim follows: xx has degree 11, so any γ\gamma with xγ=1x\gamma = 1 would have 1+deg⁡γ=deg⁡1=01 + \deg\gamma = \deg 1 = 0, which the order on N0\mathbb{N}_0 forbids.

Proof.

Put N=defdeg⁡αN \defeq \deg\alpha and M=defdeg⁡βM \defeq \deg\beta. The coefficient of αβ\alpha\beta at N+MN + M is ∑jajbN+M−j\sum_{j} a_j b_{N+M-j}; a term with j>Nj > N has aj=0a_j = 0, and a term with j<Nj < N has N+M−j>MN + M - j > M and so bN+M−j=0b_{N+M-j} = 0. Only j=Nj = N survives, giving aNbMa_N b_M, which is non-zero because RR has no zero divisors. Coefficients above N+MN + M vanish by the same count. So αβ≠0\alpha\beta \neq 0 with degree N+MN + M, and R[x]R[x] is an integral domain.

If xγ=1x\gamma = 1 for some γ≠0\gamma \neq 0, then 1+deg⁡γ=01 + \deg\gamma = 0, impossible in N0\mathbb{N}_0. So xx is not invertible and R[x]R[x] is not a field.

Problem 10.36.

Show that α∈R[[x]]\alpha \in R[[x]] is a unit if and only if a0a_0 is a unit in RR, by solving for the coefficients of the inverse one at a time. Deduce that 1−x1 - x is invertible in R[[x]]R[[x]] and identify its inverse.

Problem 10.37.

Show that evaluation at r∈Rr \in R, sending ∑jajxj\sum_j a_j x^j to ∑jajrj\sum_j a_j r^j, is a ring homomorphism R[x]→RR[x] \to R. Show that its kernel is an ideal containing x−rx - r.

Problem 10.38.

Show that F2[x]\mathbb{F}_2[x] is infinite while the set of functions F2→F2\mathbb{F}_2 \to \mathbb{F}_2 is finite, and conclude that distinct polynomials may define the same function. Give two such polynomials.

Modules and Vector Spaces

The last definition of the chapter describes a ring acting on an abelian group, where the group need not be a ring itself.

Definition 10.84 (Module and vector space).

Let RR be a commutative ring with identity. An RR-module is an abelian group (M,+)(M, +) together with a map R×M→MR \times M \to M, written (c,v)↦cv(c, v) \mapsto cv, such that for all c,c′∈Rc, c' \in R and v,v′∈Mv, v' \in M

(c+c′)v=cv+c′v,c(v+v′)=cv+cv′,(cc′)v=c(c′v),1v=v.(c + c')v = cv + c'v, \qquad c(v + v') = cv + cv', \qquad (cc')v = c(c'v), \qquad 1v = v .

When RR is a field K\mathbb{K}, an RR-module is called a K\mathbb{K}-vector space, and its elements vectors.

Example 10.85 (Modules already met).

Every ring RR is a module over itself, with cvcv the ring product; every ideal of RR is a submodule. Every abelian group is a Z\mathbb{Z}-module, with nvnv the nn-fold sum, which is exactly the map ι\iota construction read with vv in place of 11. For a field K\mathbb{K} and a set XX, the functions X→KX \to \mathbb{K} form a K\mathbb{K}-vector space under pointwise operations, and taking X=⟨n⟩X = \langle n \rangle gives the space Kn\mathbb{K}^n of nn-tuples with coordinatewise addition and scaling. And R[x]R[x] is an RR-module, the scalars acting on the coefficients.

Remark (Where this goes).

A ring that is also a K\mathbb{K}-vector space, with the two structures compatible, is a K\mathbb{K}-algebra; the linear maps of a vector space to itself form one under composition, and choosing a basis identifies it with a ring of matrices. That is linear algebra, and we stop at the definition. Every structure in these chapters (semigroup, group, ring, field, module) was built from the same two things, a set and a function.

Problem 10.39.

Show that 0v=00v = 0 and (−c)v=−(cv)(-c)v = -(cv) in any RR-module, quoting the corresponding argument for rings.

Problem 10.40.

Show that an abelian group admits exactly one structure as a Z\mathbb{Z}-module. Where does the uniqueness come from?

Exercises

 

Answers are checked in your browser, as often as you like. Nothing is sent anywhere and nothing is kept but your own work. A formula may be written with the symbols themselves or with ~ & | -> <-> ^, and \and, \or, \to expand as you type.

Exercise 10.1.

Define F1=defF2=def1F_1 \defeq F_2 \defeq 1 and Fn=defFn−1+Fn−2F_n \defeq F_{n-1} + F_{n-2} for n>2n > 2, which is the sequence of the Fibonacci problem indexed from 11.

F2024F_{2024} is:

answer one of these

And F2024F_{2024} is a multiple of 33:

answer one of these

Exercise 10.2.

Let a,b∈Na, b \in \mathbb{N} be coprime and let N∈ZN \in \mathbb{Z} be a multiple of both. Then:

answer one of these

Exercise 10.3.

Let a,b∈Na, b \in \mathbb{N} and λ,μ∈Z\lambda, \mu \in \mathbb{Z}.

If λa+μb=1\lambda a + \mu b = 1, then gcd⁡(a,b)=1\gcd(a, b) = 1:

answer one of these

If λa+μb=7\lambda a + \mu b = 7, then gcd⁡(a,b)=7\gcd(a, b) = 7:

answer one of these

Exercise 10.4.

A block of 100100 consecutive integers, each greater than 11 and none of them prime:

answer one of these

Exercise 10.5.

Let a,b,c,d∈Na, b, c, d \in \mathbb{N}.

Comparing gcd⁡(a,b)gcd⁡(c,d)\gcd(a,b)\gcd(c,d) with gcd⁡(ac,bd)\gcd(ac, bd):

answer one of these

If gcd⁡(a,b)=gcd⁡(a,c)=1\gcd(a,b) = \gcd(a,c) = 1, then gcd⁡(a,bc)\gcd(a, bc) is:

answer one of these

Exercise 10.6.

Let d∈Nd \in \mathbb{N}.

Integers a>b⩾0a > b \geqslant 0 with d∣10a−10bd \mid 10^a - 10^b:

answer one of these

The least positive multiple of 3535 of that form is:

answer one of these

Exercise 10.7.

Let RR be a ring with identity, let R0R_0 be a subring of RR containing that identity, and let u∈R0u \in R_0.

If uu is invertible in R0R_0, then uu is:

answer one of these

If instead uu is invertible in RR, then uu is:

answer one of these

Exercise 10.8.

A subring of a field containing the identity of that field is:

answer one of these

Exercise 10.9.

Let a<ba < b in N\mathbb{N}. Every block of bb consecutive positive integers holds two distinct members whose product is a multiple of abab:

answer one of these

Exercise 10.10.

Let a,b∈Na, b \in \mathbb{N} be coprime and call m∈N0m \in \mathbb{N}_0 reachable if m=xa+ybm = xa + yb for some x,y∈N0x, y \in \mathbb{N}_0.

The set of unreachable mm is:

answer one of these

For a=3a = 3 and b=5b = 5 the largest unreachable mm is:

answer one of these

Exercise 10.11.

Let SS be the set of positive integers leaving remainder 11 on division by 1010, which the remainder forms show is closed under multiplication. Call s∈Ss \in S with s>1s > 1 prim if it is not a product of two smaller members of SS.

The number of prims among 1111, 2121, 5151, 9191 and 121121 is:

answer one of these

The least member of SS that is a product of prims in two genuinely different ways is:

answer one of these

Exercises in Lean

 

The proofs below are checked in your browser. Nothing is sent anywhere, and nothing is stored but your own work. Type \to for →, \and for ∧, \< and \> for ⟨ ⟩.

An integer of this chapter is a class of pairs of natural numbers, and the sum criterion that decides when two pairs name the same integer mentions nothing but addition on N0\mathbb{N}_0. So the whole construction can be checked in the carrier the pairs are drawn from, and the sheet is written there: a pair is two naturals mm and nn, and (m,n)∼(m′,n′)(m, n) \sim (m', n') is the equation

m + n' = n + m'

with no new notation needed for it. What the chapter proves about ∼\sim becomes an implication between such equations, which is what the exercises ask for.

Two laws of multiplication join the arithmetic already listed, both from the problems of the chapter on the natural numbers:

Nat.mul_assoc   (m * n) * p = m * (n * p)
Nat.add_mul     (m + n) * p = m * p + n * p

and divisibility arrives as the definition the order chapter gave it, written a ∣ b and typed \mid:

Nat.dvd_iff     a ∣ b ↔ ∃ c : ℕ, b = a * c

It is an equivalence rather than a definition the checker unfolds, so it is used through .mp and .mpr.

Rearranging a sum

Every calculation with pairs ends the same way: four naturals added in one order must be shown equal to the same four added in another order. We prove this once.

Example.

Associativity opens the bracketing, commutativity exchanges the middle pair, and associativity closes it again. It is listed below as Nat.add_shuffle.

lean worked
1example (p q r s : ℕ) : (p + q) + (r + s) = (p + r) + (q + s) := by
verified
goalGoals accomplished.

Example.

Symmetry of ∼\sim, which is the sum criterion read backwards with each side commuted.

lean worked
1example (m n m' n' : ℕ) (h : m + n' = n + m') : m' + n = n' + m := by
verified
goalGoals accomplished.

Exercise 10.12.

The exchange that Proposition 10.5 turns on.

lean proof
1example (m n x : ℕ) : m + (n + x) = n + (m + x) := by
goalm n x : ℕ ⊢ m + (n + x) = n + (m + x)

Exercise 10.13.

A common shift satisfies the sum criterion, which is the third condition of Theorem 10.8 implying the second.

lean proof
1example (m n m' n' x : ℕ) (h1 : n' = n + x) (h2 : m' = m + x) : m + n' = n + m' := by
goalm n m' n' x : ℕ h1 : n' = n + x h2 : m' = m + x ⊢ m + n' = n + m'

Exercise 10.14.

Transitivity, and with it Proposition 10.2 . Adding n′′n'' to the first equation is what makes the second substitutable, and cancellation clears what is left.

lean proof
1example (m n m' n' m'' n'' : ℕ) (h1 : m + n' = n + m') (h2 : m' + n'' = n' + m'') :2    m + n'' = n + m'' := by
goalm n m' n' m'' n'' : ℕ h1 : m + n' = n + m' h2 : m' + n'' = n' + m'' ⊢ m + n'' = n + m''

Exercise 10.15.

Proposition 10.15 : pre-addition respects the equivalence. This is what Nat.add_shuffle is for.

lean proof
1example (m n a b m' n' a' b' : ℕ) (h : m + b = n + a) (h' : m' + b' = n' + a') :2    (m + m') + (b + b') = (n + n') + (a + a') := by
goalm n a b m' n' a' b' : ℕ h : m + b = n + a h' : m' + b' = n' + a' ⊢ (m + m') + (b + b') = (n + n') + (a + a')

Exercise 10.16.

Every number divides itself.

lean proof
1example (a : ℕ) : a ∣ a := by
goala : ℕ ⊢ a ∣ a

Exercise 10.17.

The first part of Proposition 10.54 , on the carrier.

lean proof
1example (a b c : ℕ) (hab : a ∣ b) (hbc : b ∣ c) : a ∣ c := by
goala b c : ℕ hab : a ∣ b hbc : b ∣ c ⊢ a ∣ c

Exercise 10.18.

And Corollary 10.55 , whose subtraction half has no reading in N0\mathbb{N}_0.

lean proof
1example (a b c : ℕ) (hb : a ∣ b) (hc : a ∣ c) : a ∣ b + c := by
goala b c : ℕ hb : a ∣ b hc : a ∣ c ⊢ a ∣ b + c

Exercise 10.19.

A divisibility survives multiplying both sides by the same factor.

lean proof
1example (a b c : ℕ) (h : a ∣ b) : a * c ∣ b * c := by
goala b c : ℕ h : a ∣ b ⊢ a * c ∣ b * c

Exercise 10.20.

The third part of Proposition 10.54 , in the form N0\mathbb{N}_0 can state. (Harder.)

lean proof
1example (a b x y : ℕ) (hb : a ∣ b) (hx : a ∣ x) : a ∣ b * y + x := by
goala b x y : ℕ hb : a ∣ b hx : a ∣ x ⊢ a ∣ b * y + x
What the checker understands

Tactics

intro h assume the hypothesis of an implication, naming it h
exact e give the proof outright
apply f reduce the goal to the hypotheses of f
assumption close the goal with a hypothesis already present
trivial close the goal True
exfalso replace the goal with False
by_contra h assume the negation of the goal
constructor split ∧ into both halves, or ↔ into both directions
left / right choose which half of a ∨ to prove
rcases h with a | b argue by cases on a disjunction
obtain ⟨a, b⟩ := h take a conjunction or an existential apart
cases h as above, keeping the name
refine e give the proof with holes left in it
have h : p := … record an intermediate result
show p restate the goal in an equal form
use w give a witness for ∃
specialize h a instantiate a ∀ hypothesis
rw [h] rewrite with an equation, ← to go backwards
rfl both sides compute to the same thing
decide / norm_num settle a closed computation
tauto close a goal that is true by pure logic
induction n with k ih the fifth Peano condition: prove the goal at 0, then at succ k from ih

Results you may cite

Classical.em ∀ (a : Prop), a ∨ ¬a — the law of excluded middle
Classical.byContradiction ∀ {a : Prop}, (¬a → False) → a — proof by contradiction; the tactic by_contra does this for you
Classical.byCases ∀ {a b : Prop}, (a → b) → (¬a → b) → b — split on whether a holds
not_not ∀ {a : Prop}, ¬¬a ↔ a — double negation
not_and_or ∀ {a b : Prop}, ¬(a ∧ b) ↔ ¬a ∨ ¬b — De Morgan
not_or ∀ {a b : Prop}, ¬(a ∨ b) ↔ ¬a ∧ ¬b — De Morgan
not_imp ∀ {a b : Prop}, ¬(a → b) ↔ a ∧ ¬b
and_comm ∀ {a b : Prop}, a ∧ b ↔ b ∧ a
or_comm ∀ {a b : Prop}, a ∨ b ↔ b ∨ a
Set.ext ∀ {A B : Obj}, (∀ x : Obj, x ∈ A ↔ x ∈ B) → A = B — extensionality: sets with the same elements are equal
Set.ext_iff ∀ {A B : Obj}, A = B ↔ (∀ x : Obj, x ∈ A ↔ x ∈ B) — extensionality and substitution, in one biconditional
Set.subset_antisymm ∀ {A B : Obj}, A ⊆ B → B ⊆ A → A = B — mutual inclusion is equality
Set.empty_subset ∀ {A : Obj}, ∅ ⊆ A — the empty set is a subset of every set
Set.pair_eq ∀ {a b c d : Obj}, ((a, b) = (c, d)) ↔ (a = c ∧ b = d) — two ordered pairs are equal exactly when their coordinates are
Nat.succ_inj ∀ {m n : ℕ}, succ m = succ n → m = n — the third Peano condition: the successor is injective
Nat.succ_ne_zero ∀ (n : ℕ), succ n ≠ 0 — the fourth: zero is nobody's successor
Nat.pred ∀ {n : ℕ}, n ≠ 0 → ∃ m : ℕ, n = succ m — predecessors: everything but zero is a successor
Nat.add_zero ∀ (m : ℕ), m + 0 = m — the first clause of addition
Nat.add_succ ∀ (m n : ℕ), m + succ n = succ (m + n) — the second clause of addition
Nat.zero_add ∀ (n : ℕ), 0 + n = n — addition from the left
Nat.succ_add ∀ (m n : ℕ), succ m + n = succ (m + n) — addition from the left, at a successor
Nat.add_assoc ∀ (m n p : ℕ), (m + n) + p = m + (n + p) — addition is associative
Nat.add_comm ∀ (m n : ℕ), m + n = n + m — addition is commutative
Nat.add_ne_zero ∀ {a : ℕ} (b : ℕ), a ≠ 0 → a + b ≠ 0 — positivity is absorbing
Nat.mul_zero ∀ (m : ℕ), m * 0 = 0 — the first clause of multiplication
Nat.mul_succ ∀ (m n : ℕ), m * succ n = m * n + m — the second clause of multiplication
Nat.zero_mul ∀ (m : ℕ), 0 * m = 0 — multiplication from the left
Nat.succ_mul ∀ (m n : ℕ), succ m * n = m * n + n — multiplication from the left, at a successor
Nat.add_right_cancel ∀ {m n k : ℕ}, m + k = n + k → m = n — cancellation, from the last sheet
Nat.add_eq_zero ∀ {m n : ℕ}, m + n = 0 → m = 0 ∧ n = 0 — a sum is zero only when both parts are, from the last sheet
Nat.mul_comm ∀ (m n : ℕ), m * n = n * m — multiplication is commutative, from the last sheet
Nat.mul_add ∀ (m n p : ℕ), m * (n + p) = m * n + m * p — multiplication distributes over addition, from the last sheet
Nat.mul_assoc ∀ (m n p : ℕ), (m * n) * p = m * (n * p) — multiplication associates, from the problems of the last chapter
Nat.add_mul ∀ (m n p : ℕ), (m + n) * p = m * p + n * p — distributivity on the other side
Nat.add_left_cancel ∀ {a m n : ℕ}, a + m = a + n → m = n — uniqueness of differences
Nat.lt_trichotomy ∀ (m n : ℕ), m < n ∨ m = n ∨ n < m — trichotomy, from the theorem that ℕ is strictly ordered
Nat.lt_irrefl ∀ (n : ℕ), ¬(n < n) — anti-reflexivity, from the last sheet
Nat.lt_trans ∀ {m n p : ℕ}, m < n → n < p → m < p — transitivity of the strict order, from the last sheet
Nat.lt_succ_self ∀ (n : ℕ), n < succ n — every number is below its successor, from the last sheet
Nat.not_lt_zero ∀ {n : ℕ}, ¬(n < 0) — nothing lies below zero
Nat.lt_succ_iff ∀ {m n : ℕ}, m < succ n ↔ m < n ∨ m = n — nothing lies strictly between n and succ n
Num.inj ∀ {m n : ℕ}, ↑m = ↑n → m = n — distinct numbers name distinct objects of ω
swap_apply_left ∀ (a b : Obj), swap a b a = b — the transposition sends a to b
swap_apply_right ∀ (a b : Obj), swap a b b = a — and b to a
swap_apply_of_ne_of_ne ∀ {a b x : Obj}, x ≠ a → x ≠ b → swap a b x = x — and fixes every other point
swap_swap ∀ (a b x : Obj), swap a b (swap a b x) = x — a transposition is its own inverse
Function.iterate_zero_apply ∀ (f : Obj → Obj) (x : Obj), f^[0] x = x — the first clause of the powers of a map
Function.iterate_succ_apply ∀ (f : Obj → Obj) (n : ℕ) (x : Obj), f^[succ n] x = f^[n] (f x) — the second clause: f^[succ n] is f^[n] ∘ f
Function.iterate_add_apply ∀ (f : Obj → Obj) (m n : ℕ) (x : Obj), f^[m + n] x = f^[m] (f^[n] x) — the first law of exponents
Nat.factorial_zero 0 ! = succ 0 — the first clause of the factorial
Nat.factorial_succ ∀ (n : ℕ), (succ n) ! = succ n * n ! — the second clause of the factorial
Nat.choose_zero_right ∀ (n : ℕ), choose n 0 = succ 0 — the empty set is the one 0-subset
Nat.choose_eq_zero_of_lt ∀ {n k : ℕ}, n < k → choose n k = 0 — no subset is larger than the whole
Nat.choose_succ_succ ∀ (n k : ℕ), choose (succ n) (succ k) = choose n k + choose n (succ k) — Pascal's identity
mul_assoc ∀ (a b c : Obj), (a ∗ b) ∗ c = a ∗ (b ∗ c) — the operation associates
e_mul ∀ (a : Obj), e ∗ a = a — the identity on the left
mul_e ∀ (a : Obj), a ∗ e = a — and on the right
inv_mul_cancel ∀ (a : Obj), a⁻¹ ∗ a = e — the inverse on the left
mul_inv_cancel ∀ (a : Obj), a ∗ a⁻¹ = e — and on the right
inv_inv ∀ (a : Obj), (a⁻¹)⁻¹ = a — worked above: inverting twice gives the element back
mul_left_cancel ∀ {a x y : Obj}, a ∗ x = a ∗ y → x = y — worked above: the left half of prop-9-5
Nat.add_shuffle ∀ (p q r s : ℕ), (p + q) + (r + s) = (p + r) + (q + s) — worked above: the rearrangement every pair calculation needs
Nat.dvd_iff ∀ {a b : ℕ}, a ∣ b ↔ ∃ c : ℕ, b = a * c — a divides b when b is a multiple of it

From the logical core

And.intro ∀ {a b : Prop}, a → b → a ∧ b
And.left ∀ {a b : Prop}, a ∧ b → a
And.right ∀ {a b : Prop}, a ∧ b → b
And.symm ∀ {a b : Prop}, a ∧ b → b ∧ a
Or.inl ∀ {a b : Prop}, a → a ∨ b
Or.inr ∀ {a b : Prop}, b → a ∨ b
Or.elim ∀ {a b c : Prop}, a ∨ b → (a → c) → (b → c) → c
Or.symm ∀ {a b : Prop}, a ∨ b → b ∨ a
Iff.intro ∀ {a b : Prop}, (a → b) → (b → a) → (a ↔ b)
Iff.mp ∀ {a b : Prop}, (a ↔ b) → a → b
Iff.mpr ∀ {a b : Prop}, (a ↔ b) → b → a
Iff.symm ∀ {a b : Prop}, (a ↔ b) → (b ↔ a)
Iff.rfl ∀ {a : Prop}, a ↔ a
Iff.trans ∀ {a b c : Prop}, (a ↔ b) → (b ↔ c) → (a ↔ c)
True.intro True
False.elim ∀ {a : Prop}, False → a
absurd ∀ {a b : Prop}, a → ¬a → b
id ∀ {a : Prop}, a → a
mt ∀ {a b : Prop}, (a → b) → ¬b → ¬a
Eq.refl ∀ {α : Type} (a : α), a = a
Eq.symm ∀ {α : Type} {a b : α}, a = b → b = a
Eq.trans ∀ {α : Type} {a b c : α}, a = b → b = c → a = c
congrArg ∀ {α : Type} {β : Type} {a b : α} (f : α → β), a = b → f a = f b
Exists.intro ∀ {α : Type} {p : α → Prop} (w : α), p w → ∃ x : α, p x
Exists.elim ∀ {α : Type} {p : α → Prop} {b : Prop}, (∃ x : α, p x) → (∀ y : α, p y → b) → b