5.7  Equality

Sections 5.3 to 5.6 gave the four quantifier rules, and with them every logical symbol of the language of Section 5.2 (the connectives, ⊥, the quantifiers, and equality) has rules, except one. So far the equals sign has been treated like a predicate symbol: a=b was an atomic formula like P(a), and no rule looked inside it. Yet almost every calculation in mathematics is a chain of equations, and every use of “the” (the limit, the supremum, the inverse) quietly asserts that something is unique. This section adds the two rules for equality, =I and =E, which say together that equals may be replaced by equals. Section 5.8 applies them to the phrase “there is exactly one”, which is an existential statement together with an equation. This section ends by completing the table of rules, phrases, and Lean tactics that Chapter 1 began.

5.7.1. What the rules so far cannot do with an equation

Here is the first line of a calculation any reader has written:

Since a=b and a+a=2a, we have b+b=2b.

Nothing could be simpler, and nothing in Sections 5.3–5.6 derives it: so far the rules treat = as they treat any two-place predicate symbol, and from R(a,b) and P(a) no rule gives P(b). Reading R(a,b) as a<b and P(x) as x<1 over Z, with a=0 and b=5, both premises are true and P(b) is false.

What makes the step correct is what = means: a and b are names of the same object. Any statement true of the object is true of it whichever name is used. Two things follow, and they are the two rules of this section.

  1. Every term names the same object as itself. Nothing needs to be assumed to write t=t.
  2. If t1 and t2 name the same object, then a statement about t1 may be rewritten as the same statement about t2.

The first rule is unusual: it cites no earlier line at all. Chapter 1 anticipated this when it defined rules (Section 1.2): the definition of a rule schema (Definition 1.2.1) was worded so that a rule of Chapter 5 could have no given lines at all. This is that rule.

5.7.2. The rules for equality

Everything is equal to itself, and equals may be replaced by equals.

Definition 5.7.1 (Rules for Equality)
kt=t=I
it1=t2
jφ[t1/x]
kφ[t2/x]=E i, j

The rule =I (equality introduction, or reflexivity) writes t=t for any term t, at any line, citing nothing. The rule =E (equality elimination, or substitution of equals) cites an equation t1=t2 on line i and a line j of the form φ[t1/x], both available at line k, and writes φ[t2/x] on line k. Here φ is any formula and x any variable, subject to one side condition: both t1 and t2 are free for x in φ (Definition 5.2.6).

In words: =I says that every term equals itself. =E says that when t1=t2 is known, a line that says something about t1 may be rewritten as the same thing said about t2. The formula φ is the “something”: a statement with a hole x, which line j fills with t1 and line k fills with t2.

Mark the holes first. To use =E with t1=t2, write down the line you have and draw a box round each occurrence of t1 you want to replace. The boxes are the holes: φ is the line with a variable in each box, and the new line puts t2 in every box. With a=b: a+a=2⋅a  gives  b+b=2⋅b,a+a=2⋅a  gives  b+a=2⋅a. Occurrences without a box stay as they are.

Read the definition clause by clause.

  1. =I cites nothing.
    • Schema: the left block above, t=t, citing nothing.
    • Reading: every term equals itself, so the line may stand anywhere, even first in a derivation with no premises.
    • Example: “a+b=a+b — =I”, the first line of every chain below.
  2. The equation is read from left to right. The cited equation t1=t2 licenses replacing t1 by t2, and not the other way round. From a=b and P(b), the rule does not give P(a), because P(b) is φ[b/x] for φ=P(x), and the equation would have to be b=a. The reverse direction needs one more step, symmetry, which we derive below.
  3. Some or all occurrences. The choice of φ decides which occurrences of t1 are replaced: exactly those that φ marks with x (the boxes above). Occurrences of t1 that φ writes out are left alone. Choosing φ is the whole art of using the rule.
  4. Free for x. Neither term may have a variable captured by a quantifier of φ, the condition of Definition 5.2.6 that the rules of Sections 5.3 and 5.5 also carry. The nonexample below shows what goes wrong without it.

One line, many readings. Take the equation a=b and the line a+a=2⋅a. The term a occurs three times in the line, and φ may mark any of them. Some of the choices:

φ φ[a/x] (the cited line) φ[b/x] (the new line)
x+a=2⋅a a+a=2⋅a b+a=2⋅a
a+x=2⋅a a+a=2⋅a a+b=2⋅a
a+a=2⋅x a+a=2⋅a a+a=2⋅b
x+x=2⋅x a+a=2⋅a b+b=2⋅b

Each of the three occurrences is marked or not, so there are 23=8 choices in all, and each is a legal step. The fourth row is the step of the opening calculation.

Second readingDegenerate choices

One more row belongs to the table:

φ φ[a/x] (the cited line) φ[b/x] (the new line)
a+a=2⋅a a+a=2⋅a a+a=2⋅a

This row is the degenerate choice: φ contains no x, so φ[a/x] and φ[b/x] are both φ, and the rule copies the line unchanged. It is legal and useless, and it shows that “some occurrences” includes “none”. Another degenerate case: the equation may be t=t itself, and then =E again returns the cited line.

Quick check. From the equation x0=3 and the line x0⋅x0>x0, which formula φ makes =E give 3⋅3>x0? Which gives x0⋅3>3?

Solution. For 3⋅3>x0, take φ=(z⋅z>x0), with a variable z that appears nowhere else: φ[x0/z] is the cited line and φ[3/z] is 3⋅3>x0. For x0⋅3>3, take φ=(x0⋅z>z). The hole has to be a variable other than x0, since the occurrences of x0 that stay must be written out in φ.

Quick check. From a=b and the line a⋅a=a+1, which occurrences do you box to get a⋅b=b+1?

Solution. The second and the third a: φ=(a⋅z=z+1), and φ[a/z] is the given line, φ[b/z] the new one.

A nonexample: capture. Take the equation a=y, with y a variable, and the line ∃y(y<a). It is tempting to “substitute y for a” and write ∃y(y<y). With φ=∃y(y<x), the cited line is φ[a/x], and the new line would be φ[y/x]. But y is not free for x in φ: the x sits inside ∃y, and the y put there would be captured. The side condition fails, and rightly. Read over Z, with a and y both naming 0, the premises say “a=y” (true) and “some integer is less than 0” (true), while ∃y(y<y) says that some integer is less than itself (false).

1a=y
2∃y(y<a)
3∃y(y<y)=E 1, 2

Line 3 breaks the side condition of Definition 5.7.1. What the argument meant to say needs a different name for the bound variable: ∃z(z<a), which is the same sentence up to renaming (Section 5.2), becomes ∃z(z<y), which is true when y names 0.

Why these two rules. They are exactly the two facts about “same object” listed above, and nothing else about equality needs to be assumed. Symmetry (s=t gives t=s), transitivity (s=t and t=u give s=u), and “applying the same function to both sides” are all derived below. So the two rules play for = the part that the introduction and elimination rules played for each connective: one builds an equation, one uses it.

Warning. A bound variable is not a place to substitute. From x=0 and ∀x(x=x), the line ∀x(0=x) does not follow: the x’s of ∀x(x=x) are bound, and =E replaces only free occurrences. Over Z, with x naming 0, the premises are true and ∀x(0=x) is false.

Second readingWhy no choice of the hole works

To write ∀x(x=x) as φ[x/z], either z does not occur free in φ, and then φ[0/z] is the unchanged line, or z occurs free in φ (for instance, φ is ∀x(z=x)), and then every free z lies inside ∀x, so x is not free for z in φ and the side condition fails.

5.7.3. Symmetry, transitivity and congruence

Everything we expect of equality now follows from the two rules. Each derivation below is short, and the only thought in each is the choice of φ.

It turns out that the equation in =E may be read in either direction after all, at the cost of two extra lines (an =I and an =E; after the abbreviation (sym) below, just one), and that equations chain:

Proposition 5.7.1 (Equality Is Symmetric and Transitive)

For all terms s, t, u:

  • (a) s=t⊢t=s;
  • (b) s=t,t=u⊢s=u.

Idea. For (a), the goal t=s must be the last line of an =E that uses the premise s=t (it is the only equation available), so it has the form φ[t/x], and the cited line φ[s/x] must already be on a line. Try φ=(x=s): then φ[t/x] is t=s, the goal, and φ[s/x] is s=s, which =I supplies for free. For (b), rewrite the t of the first premise using the second: φ=(s=x).

Proof.

  • (a) With φ:=(x=s), for a variable x that occurs in neither s nor t, the line s=s is φ[s/x] and the goal t=s is φ[t/x]. Both terms are free for x in φ, since φ has no quantifier. So the following is a derivation:
    1s=t
    2s=s=I
    3t=s=E 1, 2
  • (b) With φ:=(s=x), for a variable x that does not occur in s, the first premise s=t is φ[t/x] and the goal s=u is φ[u/x]; again φ has no quantifier. So the following is a derivation:
1s=t
2t=u
3s=u=E 2, 1

Line 3 of (b) cites the equation t=u on line 2 as the rule’s line i, and s=t on line 1 as its line j. This proves (a) and (b).

Notice where the “reflexivity” line went in (a): the equation s=t was not rewritten at all. It was the tool, and the line it rewrote, s=s, was manufactured for the purpose. This is the typical use of =I: it supplies a line for =E to work on.

From now on, symmetry and transitivity may be used as one line, with the justifications “(sym)” and “(trans)”: each abbreviates the three-line derivation above with the given terms in place of s, t, u. This is the license of Definition 2.3.1, extended from statement letters to terms. The extension is harmless for the same reason: the derivations above used nothing about s, t, u except that they are terms, so they can be pasted in with any terms.

The next derivation is the rule behind “apply f to both sides”. Let f be a one-place function symbol, and a, b constants.

1a=b
2f(a)=f(a)=I
3f(a)=f(b)=E 1, 2

Here φ=(f(a)=f(x)): it keeps the first a and marks the second. With φ=(f(x)=f(x)) instead, the same two lines would give f(b)=f(b), which is true and useless. Nothing is special about f: the same three lines give a2=b2 from a=b, or a+c=b+c, or |a|=|b|. Every “do the same thing to both sides of an equation” is this derivation.

The last result of this group has no premises. It says that equals share every property, and it is called Leibniz’s Law.

Proposition 5.7.2 (Leibniz’s Law)

For every one-place predicate symbol P, ⊢∀x∀y(x=y→(P(x)→P(y))).

In words: whatever is true of x is true of anything equal to it. The rule =E is this law for every formula at once; the seven-line derivation is in the fold below.

Second readingLeibniz’s Law, derived

Proof. Finding it. The goal is ∀x, so the search method of Section 3.1, with the step of Section 5.4, opens a flagged box for x0; the new goal ∀y(…) opens a second flagged box, for y0. The goal x0=y0→(P(x0)→P(y0)) is an implication, so a box opens with x0=y0, and the new goal P(x0)→P(y0) opens another, with P(x0). Now the goal is P(y0), the resources are x0=y0 and P(x0), and one =E with φ=P(x) finishes. Every line but one was written by a goal-directed step.

1x0y0x0=y0asm, for →I
2P(x0)asm, for →I
3P(y0)=E 1, 2
4P(x0)→P(y0)→I 2–3
5x0=y0→(P(x0)→P(y0))→I 1–4
6∀y(x0=y→(P(x0)→P(y)))∀I 1–5
7∀x∀y(x=y→(P(x)→P(y)))∀I 1–6

The two ∀I lines cite the flagged boxes as 1–5 and 1–6: each flagged box immediately contains another box, so its range starts at that box’s first line (the convention of Section 5.4). At line 6 the name y0 appears in no premise (there are none), in no open assumption (the boxes on lines 1 and 2 have closed), and not in the conclusion; at line 7 the same holds for x0. The derivation has 7 lines.

The claim is one of the classical “axioms of equality”, often taken as a starting point in place of =E. Here it is a consequence. Conversely, with the claim as a premise, ∀E twice and →E twice would do the work of =E for the formula P(x); the rule does it for every formula at once.

Warning. Words about knowledge are not formulas. =E rewrites formulas of the language, and “it is obvious that …”, “the pupil checked that …”, “it is known that …” are not among its connectives. A pupil checked that 7⋅13=91, and indeed 7⋅13=91. Replacing 7⋅13 by 91 inside the report gives “the pupil checked that 91=91”, a different claim about what the pupil did. Inside a formula every free occurrence of a term may be rewritten, subject to the side condition of Definition 5.7.1; inside words about what someone knows or checked, none may.

Equal sets have the same elements

Example (Equal Sets Have the Same Elements)

Read the domain as consisting of sets, with ∈ a two-place predicate symbol written between its terms (shorthand rule 1 of Section 5.2). Show that ⊢∀x∀y(x=y→∀z(z∈x↔z∈y)).

Solution.

1x0y0x0=y0asm, for →I
2z0z0∈x0asm, for ↔I
3z0∈x0asm, for ↔I
4z0∈x0↔z0∈x0↔I 2–2, 3–3
5z0∈x0↔z0∈y0=E 1, 4
6∀z(z∈x0↔z∈y0)∀I 2–5
7x0=y0→∀z(z∈x0↔z∈y0)→I 1–6
8∀y(x0=y→∀z(z∈x0↔z∈y))∀I 1–7
9∀x∀y(x=y→∀z(z∈x↔z∈y))∀I 1–8

The two boxes of line 4 are one-line boxes, as P→P is shown, and each flagged box immediately contains another box and is cited from its first line. Line 5 is =E with φ=(z0∈x0↔z0∈w): line 4 is φ[x0/w], and the equation of line 1 refills the hole with y0; as in the proof of symmetry, ↔I manufactured a line for =E to rewrite.

The converse, ∀z(z∈x↔z∈y)→x=y, breaks. Here is a counter-reading to it: two dots a and b, with nothing an element of anything. With x naming a and y naming b, both sides of z∈x↔z∈y are false for every z, so the hypothesis is true; and a=b is false. For sets, the converse is taken as an axiom, the axiom of extensionality: a set is determined by its elements.

5.7.4. Calculations are chains of substitutions

A calculation in a proof looks like this:

a+b=2⋅b+b=2⋅3+3=9,

written under the premises a=2⋅b and b=3. The chain is a single statement to the eye, but logically it is several equations, each obtained from the last. Here is the derivation it abbreviates, with one line of arithmetic, justified “arith” as in Section 5.3.

A chain as a derivation. From b=3 and a=2⋅b, derive a+b=9.

1b=3
2a=2⋅b
3a+b=a+b=I
4a+b=2⋅b+b=E 2, 3
5a+b=2⋅3+3=E 1, 4
62⋅3+3=9arith
7a+b=9=E 6, 5

The choices of φ, with z a variable not occurring in the terms:

  • line 4: φ=(a+b=z+b), rewriting the a on the right of line 3 and keeping the one on the left;
  • line 5: φ=(a+b=2⋅z+z), rewriting both remaining b’s on the right at once;
  • line 7: φ=(a+b=z), rewriting the whole right-hand side by the equation of line 6.

The pattern is general. A chain t1=t2=⋯=tn starts with t1=t1 by =I, keeps t1 fixed on the left, and rewrites the right-hand side once per link, each time by =E with the equation that justifies the link. Each link is either a premise, as on lines 4 and 5, or an arithmetic fact, as on line 7. The last line is t1=tn. Transitivity (Proposition 5.7.1 (b)) is the same move made once; a chain makes it n−1 times.

A mixed chain, such as a2+1=10≤10+b2 with a=3, is not made of =E alone. Its = links are =E steps as above, and a ≤ link needs a fact about ≤: here that b2≥0, so that adding b2 does not decrease a number. The = link before it then carries over by one more =E, with φ=(z≤10+b2) and the equation a2+1=10 turned round by symmetry (Proposition 5.7.1 (a)); transitivity of ≤ is needed only where two ≤ links meet, as in x≤y≤z. Those are facts about order, not about equality. They enter derivations as “arith” lines, one per link.

Quick check. Line 5 of the chain rewrites both b’s on the right of line 4 at once. Which φ would rewrite only the b inside 2⋅b, and what line would it give? How would the chain then reach line 5?

Solution. Take φ=(a+b=2⋅z+b). Then line 4 is φ[b/z], and =E 1, 4 gives φ[3/z], the line a+b=2⋅3+b. One more =E with the same equation b=3 and φ=(a+b=2⋅3+z) then gives a+b=2⋅3+3, which is line 5. Marking both occurrences at once saves that line.

Quick check. Under the premise a=2, the chain a+1=2+1=3≤4 has three links. Which is an =E step, and which are “arith” lines?

Solution. The first link is =E: from a+1=a+1 (=I) and a=2, with φ=(a+1=z+1), it writes a+1=2+1. The links 2+1=3 and 3≤4 are facts of school arithmetic, written as “arith” lines, and each is then carried into the chain by one more =E (with φ=(a+1=z), then with φ=(z≤4) and the equation turned round); the last link is about order, not equality.

5.7.5. What equality sounds like in a proof

In a written proof, =E is the word “substituting”, or no word at all: the chain a+b=2b+b=9 is read as a sequence of substitutions, and the reader supplies the φ of each link. “By symmetry” or “rewriting the equation as t=s” is Proposition 5.7.1 (a). “Applying f to both sides”, “squaring both sides”, “adding c to both sides” are the congruence derivation above. And =I is almost never written, because t=t goes without saying; it is visible only in the first line of a formal chain, and in a proof assistant, where rfl proves t=t.

Here is a proof from school algebra, read link by link.

Claim. If a+b=0 and a+c=0, then b=c.

Proof. b=b+0=b+(a+c)=(b+a)+c=(a+b)+c=0+c=c.

The first link is the fact y+0=y for every y, applied at y=b (an instance by ∀E) and read from right to left: the chain needs b=b+0, which is the instance b+0=b turned round by symmetry. The second link rewrites the 0 by the premise a+c=0, again turned round, since the chain needs 0 to become a+c. The third and fourth are instances of associativity and commutativity. The fifth rewrites a+b by the premise a+b=0 in the direction written. The last is the instance 0+c=c. So the claim says that a number has at most one additive inverse; the facts it uses are the field axioms, here school algebra.

5.7.6. The search method: one more step

Each of Sections 5.3 to 5.6 added a step to the search method of Section 3.1. Equality adds one.

  • An equation. When an equation t1=t2 is available and the goal differs from an available line only in some occurrences of t1 and t2, look for the φ that makes one =E turn the line into the goal: mark with x exactly the places where they differ. If the equation points the wrong way, turn it round first (sym). If no available line will do, make one with =I, as the proof of Proposition 5.7.1 did.

In the Givens/Goal table, =E turns a Given into a new Given with some holes refilled, and =I adds t=t to the Givens at no cost.

Example (Instances of =E)

In each row the hole is z; the cited line fills it with the left side of the equation, the new line with the right side.

Equation t1=t2 φ Cited line φ[t1/z] New line φ[t2/z]
f(c)=g(c)+1 P(z)∧R(f(c),c) P(f(c))∧R(f(c),c) P(g(c)+1)∧R(f(c),c)
ε/2=δ |x−a|<z→|h(x)−h(a)|<ε |x−a|<ε/2→|h(x)−h(a)|<ε |x−a|<δ→|h(x)−h(a)|<ε
a+b=b+a ∀y(z⋅y=y⋅(a+b)) ∀y((a+b)⋅y=y⋅(a+b)) ∀y((b+a)⋅y=y⋅(a+b))

In the first row the f(c) inside R(f(c),c) is written out in φ and stays; in the third the hole sits under ∀y, and both terms are free for z because neither contains y.

Not an instance. From 2=1+1 and the line 25=32, the line (1+1)5=3(1+1), which treats the digit 2 of 32 as an occurrence of the term 2, is not written by =E: the numeral 32 is one constant, with no occurrence of the term 2 inside it; φ=(z5=32) gives only (1+1)5=32.

5.7.7. The rule, phrase and Lean table, completed

Chapter 1 began a table that pairs each rule with the sentence that performs it in a written proof and, for readers who use a proof assistant, with the Lean code that does the same (Sections 1.2–1.6), and Chapter 2 added the rows for negation, the biconditional, and the classical rules (Sections 2.1–2.5). Sections 5.3–5.6 added a row for each quantifier rule, and this section adds the two rows for equality. Here is the whole table for the calculus of this volume.

Rule Shape You write
∧I φ, ψ ⟹ φ∧ψ “We show P, and we show Q.”
∧E φ∧ψ ⟹ φ (or ψ) “In particular, P.”
→E φ→ψ, φ ⟹ ψ “Since P implies Q, and P holds, Q.”
→I box φ … ψ ⟹ φ→ψ “Assume P. … Hence Q.”
R φ (available) ⟹ φ, copied “As shown above, P.”
∨I φ ⟹ φ∨ψ (or ψ∨φ) “So P or Q holds.”
∨E φ∨ψ, box φ … χ, box ψ … χ ⟹ χ “Case 1: P. … so R. Case 2: Q. … so R. In either case, R.”
¬E φ, ¬φ ⟹ ⊥ “…, which contradicts …”
⊥E ⊥ ⟹ any φ “This case cannot occur.” “So there is nothing to prove.”
¬I box φ … ⊥ ⟹ ¬φ “Suppose φ. … This is a contradiction. Hence not φ.”
↔I box φ … ψ, box ψ … φ ⟹ φ↔ψ “(⇒) Suppose P. … so Q. (⇐) Suppose Q. … so P.”
↔E φ↔ψ, φ ⟹ ψ (or with ψ, φ) “Since P holds if and only if Q does, and P holds, so does Q.”
RAA box ¬φ … ⊥ ⟹ φ “Suppose, for a contradiction, that φ fails. … This is impossible. Hence φ.”
∀E ∀xφ ⟹ φ[t/x] “In particular, for x=t, …”; “applying the hypothesis to t, …”
∀I box [x0] … φ[x0/x] ⟹ ∀xφ “Let x be arbitrary. … Since x was arbitrary, …”
∃I φ[t/x] ⟹ ∃xφ “Take x=t. Then …”
∃E ∃xφ, box [x0] φ[x0/x] … χ ⟹ χ “Choose x with … . Then …”
=I nothing ⟹ t=t (usually unwritten) “t=t.”
=E t1=t2, φ[t1/x] ⟹ φ[t2/x] “Substituting t2 for t1, …”; a chain t1=t2=⋯=tn

Remark (For Lean users). ∧I constructor; ∧E h.1, h.2; →E exact h hp; →I intro hp; R exact hp; ∨I left, right (or Or.inl hp); ∨E Or.elim h (or cases h); ¬E exact hn hp (goal False); ⊥E exfalso; ¬I intro hp (goal False); ↔︎I constructor; ↔︎E h.mp hp, h.mpr hq; RAA by_contra h; ∀E h t (or specialize h t); ∀I intro x; ∃I use t (or Exists.intro t h); ∃E obtain (or Exists.elim h); =I rfl; =E rw [h], chains calc. Nothing later depends on these.

Of the derived rules of Chapter 2, MT, CP and DS have their rows in Section 2.3, and ¬¬E and LEM in Section 2.5; the derived sequents that searches use most are collected in Section 3.1. With the two equality rows, every rule of the calculus has its phrase.

Warning (Not allowed: =E). Each step breaks the clause of the reading of Definition 5.7.1, or the warning, shown.

  • “From c=f(b) and Q(f(b)), write Q(c)”: the equation is read left to right and rewrites c into f(b); turn it round first, by (sym) (clause 2).
  • “From x=0 and ∀x(x≥x), write ∀x(0≥0)”: only free occurrences are replaced, and both x’s of x≥x are bound (the warning “A bound variable is not a place to substitute”).
  • “From b=z+1 and ∀z(z≤b), write ∀z(z≤z+1)”: with φ=∀z(z≤w), the z of z+1 is captured (clause 4).
  • “Rewrite a term inside ‘it is obvious that …’”: that is not a formula (the warning “Words about knowledge are not formulas”).

Remark (Looking ahead). Chapter 8 turns the “You write” column of this table into a full dictionary of proof phrases.

5.7.8. Exercises

A. Check your understanding

Exercise (A1)
  • (a) State =I and =E as schemas, with the side condition of =E.

  • (b) In the derivation below, name for each of lines 4, 5, 6, and 8 the rule, the cited lines, and the formula φ (with a variable z as its hole).

    1a=b+1
    2b=2
    3a⋅a=a⋅a=I
    4a⋅a=(b+1)⋅a=E 1, 3
    5a⋅a=(b+1)⋅(b+1)=E 1, 4
    6a⋅a=(2+1)⋅(2+1)=E 2, 5
    7(2+1)⋅(2+1)=9arith
    8a⋅a=9=E 7, 6
  • (c) In the same derivation, could lines 4 and 5 be replaced by one line? With which φ?

  • (d) True or false, with a reason: from the lines a=b and P(b), one application of =E gives P(a).

  • (e) True or false, with a reason: from a=b and the line ∀x(x=a→P(x)), one application of =E gives ∀x(x=b→P(x)).

Solution. (a) =I: at any line k, write t=t, for any term t, citing nothing. =E: from t1=t2 on line i and φ[t1/x] on line j, both available at line k, write φ[t2/x] on line k; side condition: t1 and t2 are both free for x in φ.

(b) Line 4: =E 1, 3, with φ=(a⋅a=z⋅a), which rewrites the first a on the right. Line 5: =E 1, 4, with φ=(a⋅a=(b+1)⋅z). Line 6: =E 2, 5, with φ=(a⋅a=(z+1)⋅(z+1)), which rewrites both b’s at once. Line 8: =E 7, 6, with φ=(a⋅a=z). In each case the left-hand side a⋅a is written out in φ, so it is kept.

(c) Yes: =E 1, 3 with φ=(a⋅a=z⋅z) gives a⋅a=(b+1)⋅(b+1) in one step, rewriting both a’s on the right and keeping the two on the left.

(d) False. With the equation a=b, =E passes from φ[a/x] to φ[b/x]. The line P(b) is φ[b/x] for φ=P(x), so the rule would need the equation b=a. One application of symmetry first (Proposition 5.7.1 (a)) gives b=a, and then =E gives P(a).

(e) True. Take φ=∀x(x=z→P(x)): the cited line is φ[a/z] and the new line is φ[b/z]. The terms a and b are constants, so both are free for z, although the hole lies under ∀x.

Exercise (A2: Drill)

Each part takes a line or two. The parts run from single steps, through a missing line and a justification column, to judging steps and short derivations. Letters a,b,c,d are constants.

  • (a) What does =I cite?
  • (b) From a=b and P(a,a), box the holes to get P(a,b).
  • (c) From c=d+1 and the line R(c,c⋅c), write the =E line that rewrites only the last c.
  • (d) From x0=2 and x0+x0=4, which φ gives 2+x0=4?
  • (e) Line 6 is f(b)+b=7, justified “=E 2, 5”, and line 2 is a=b. Give two possible lines 5.
  • (f) Justify each line: 1 a=b, premise; 2 ∀x(P(x)→x=c), premise; 3 P(a), premise; 4 P(a)→a=c; 5 a=c; 6 a=a; 7 b=a; 8 b=c.
  • (g) From a=b and P(b), does one =E give P(a)?
  • (h) From a=y and ∃y(y<a), is ∃y(y<y) a legal =E line?
  • (i) From x0=0 and the line ∀y(x0≤y), is ∀y(0≤y) a legal =E line? From y=0 and the same line, is ∀y(x0≤0)?
  • (j) Derive a=b⊢f(b)=f(a).
  • (k) Derive a=b, b=c⊢a=c in one step.
  • (l) Derive ∀xR(x,x)⊢∀x∀y(x=y→R(x,y)).

Solution.

  • (a) Nothing.

  • (b) Box the second a only: φ=P(a,z).

  • (c) R(c,c⋅(d+1)), with φ=R(c,c⋅z).

  • (d) φ=(z+x0=4).

  • (e) Any two of f(a)+a=7 (φ=(f(z)+z=7)), f(b)+a=7 (φ=(f(b)+z=7)), f(a)+b=7 (φ=(f(z)+b=7)); and the degenerate f(b)+b=7 itself.

  • (f) 4 ∀E 2 (at a); 5 →E 4, 3; 6 =I; 7 =E 1, 6 (φ=(z=a)); 8 =E 5, 7 (φ=(b=z)).

  • (g) No, clause 2: the equation rewrites a into b. Turn it round first (sym), then =E.

  • (h) No, clause 4: the y put in would be captured by ∃y.

  • (i) The first is legal: φ=∀y(z≤y), and 0 is free for z. The second is not: with φ=∀y(x0≤z), the term y of the equation is not free for z in φ (clause 4); the y would be captured.

  • (j) 2 f(a)=f(a), =I; 3 f(b)=f(a), =E 1, 2, with φ=(f(z)=f(a)).

  • (k) 3 a=c, =E 2, 1, with φ=(a=z).

  • (l) A flagged box x0, inside it a flagged box y0: 2 x0=y0, assumption; 3 R(x0,x0), ∀E 1; 4 R(x0,y0), =E 2, 3 (φ=R(x0,z)); 5 x0=y0→R(x0,y0), →I 2–4; 6 ∀y(x0=y→R(x0,y)), ∀I 2–5; 7 ∀x∀y(x=y→R(x,y)), ∀I 2–6. (A reflexive relation contains equality.)

B. Practice

Exercise (B1: The identity is unique)

A set with an operation ⋅ has an identity e if e⋅x=x and x⋅e=x for every x. Derive ∀x(e⋅x=x∧x⋅e=x),∀x(e′⋅x=x∧x⋅e′=x)⊢e=e′, where e and e′ are constants. Which half of “there is exactly one identity” does this prove?

Hint: look at the one element that both premises can say something about.

Solution. The goal is an equation between e and e′, and the only term that both premises can connect to both is the product e⋅e′. Instantiate the first premise at e′ and the second at e (∀E, reading the terms off the goal):

1∀x(e⋅x=x∧x⋅e=x)
2∀x(e′⋅x=x∧x⋅e′=x)
3e⋅e′=e′∧e′⋅e=e′∀E 1
4e⋅e′=e′∧E 3
5e′⋅e=e∧e⋅e′=e∀E 2
6e⋅e′=e∧E 5
7e=e′=E 6, 4

Line 7 uses the equation e⋅e′=e of line 6 to rewrite the left side of line 4, with φ=(z=e′): φ[e⋅e′/z] is line 4, and φ[e/z] is e=e′. In prose: e=e⋅e′=e′, the first equation because e′ is an identity and the second because e is.

This is the “at most one” half: any two identities are equal. It says nothing about whether an identity exists. Section 5.8 shows how such an argument combines with existence.

Exercise (B2: Rewrite, and turn round)

A search for a=b, b=c, P(a)⊢P(c)∧c=a has reached the stage below. Name the move, then complete it, giving for each =E line its holes.

1a=b
2b=c
3P(a)
⋮
9P(c)∧c=a?

Solution. The move is the search step “An equation” of this section: mark the holes, and turn the equation round with an =I line if it points the wrong way.

1a=b
2b=c
3P(a)
4P(b)=E 1, 3
5P(c)=E 2, 4
6a=c=E 2, 1
7a=a=I
8c=a=E 6, 7
9P(c)∧c=a∧I 5, 8

Lines 4 and 5: φ=P(z). Line 6: φ=(a=z), so line 1 is φ[b/z] and the equation b=c refills the hole with c. Line 8: φ=(z=a); line 7 is φ[a/z], and the equation a=c refills the box with c. Lines 7–8 are (sym) written out; with the abbreviation of the text, line 8 is “c=a (sym) 6”.

Exercise (B3: Derive or break)

For each claim, derive it with the rules of Chapters 1–2 and of this chapter, or break it with a counter-reading.

  • (a) f(a)=b, a=c⊢f(c)=b.
  • (b) f(a)=f(b)⊢a=b.
  • (c) ∀x(f(x)=x)⊢f(f(c))=c.
  • (d) ∀x∀y(f(x)=f(y)→x=y), f(a)=f(b)⊢a=b.
  • (e) a≠b, b≠c⊢a≠c.
  • (f) a=b, b≠c⊢a≠c.
  • (g) f(a)=a⊢f(f(a))=a.
  • (h) f(f(a))=a⊢f(a)=a.

Solution.

  • (a) Derive. One =E, with φ=(f(z)=b):
    1f(a)=b
    2a=c
    3f(c)=b=E 2, 1
  • (b) Break. Counter-reading: the domain {0,1}, f sending both to 0, a naming 0 and b naming 1. Then f(a)=0=f(b), and a=b is false.

  • (c) Derive. Instantiate at the compound term f(c) as well as at c:

    1∀x(f(x)=x)
    2f(f(c))=f(c)∀E 1
    3f(c)=c∀E 1
    4f(f(c))=c=E 3, 2

    Line 4 has φ=(f(f(c))=z).

  • (d) Derive.
    1∀x∀y(f(x)=f(y)→x=y)
    2f(a)=f(b)
    3∀y(f(a)=f(y)→a=y)∀E 1
    4f(a)=f(b)→a=b∀E 3
    5a=b→E 4, 2
  • (e) Break. Counter-reading: the domain {0,1}, a and c naming 0, b naming 1. Then a≠b and b≠c are true, and a≠c is false: two different letters, one object.

  • (f) Derive.

    1a=b
    2b≠c
    3a=casm, for ¬I
    4b=c=E 1, 3
    5⊥¬E 4, 2
    6a≠c¬I 3–5

    Line 4 has φ=(z=c).

  • (g) Derive.
    1f(a)=a
    2f(f(a))=f(f(a))=I
    3f(f(a))=f(a)=E 1, 2
    4f(f(a))=a=E 1, 3

    Line 3 has φ=(f(f(a))=f(z)), and line 4 has φ=(f(f(a))=z).

  • (h) Break. Counter-reading: the domain {0,1}, f exchanging 0 and 1, a naming 0. Then f(f(0))=f(1)=0, so the premise is true, and f(0)=1, so f(a)=a is false.

  • (i) and (d) differ by the premise that f is one-to-one; (e) and (f) look alike, and ≠ is not transitive, since different letters may name one object; (g) and (h) are converses. Worked example types: Proposition 5.7.1; the chain derivation of “Calculations are chains of substitutions”; the congruence derivation.

Marking scheme. (10 points) 1 for each of the eight claims (a derivation with every φ named, or a counter-reading with the domain and every symbol’s value); 2 for the closing comparison, with the point about (e) and (f) stated. Fatal errors (0 for the claim): an =E with the equation read right to left; a counter-reading in which two letters that must differ (by a premise) name one object.

C. Going deeper

Exercise (C1: Two different objects)
  • (a) Derive ∃x∃y(x≠y)⊢∀x∃y(x≠y), and name the line that uses a classical rule.
  • (b) Read both formulas aloud. Derive the converse, or break it.

Solution.

  • (a) Read off the goal and the premise. The premise is an existential (twice), so both ∃E boxes open first, with names x0 and y0. The goal is universal, so a flagged box u0 opens inside them. The new goal ∃y(u0≠y) is postponed, and no available line decides whether u0 is x0, so the search splits by LEM:
    1∃x∃y(x≠y)
    2x0∃y(x0≠y)asm, for ∃E
    3y0x0≠y0asm, for ∃E
    4u0u0=x0∨u0≠x0LEM
    5u0=x0asm, for ∨E
    6u0=y0asm, for ¬I
    7x0=y0=E 5, 6
    8⊥¬E 7, 3
    9u0≠y0¬I 6–8
    10∃y(u0≠y)∃I 9
    11u0≠x0asm, for ∨E
    12∃y(u0≠y)∃I 11
    13∃y(u0≠y)∨E 4, 5–10, 11–12
    14∀x∃y(x≠y)∀I 4–13
    15∀x∃y(x≠y)∃E 2, 3–14
    16∀x∃y(x≠y)∃E 1, 2–15

    Line 7 is =E with φ=(z=y0): line 6 is φ[u0/z], and the equation u0=x0 refills the hole with x0. The classical line is line 4, LEM, a derived rule whose derivation uses RAA (Section 2.5). At line 14, u0 appears in no premise, in neither open assumption (lines 2 and 3) and not in line 14. At lines 15 and 16 the witnesses y0 and x0 appear neither in the last lines, nor in the existentials, nor in the open assumptions.

  • (b) The premise says “there are two different objects”; the conclusion says “every object has one different from it”. The converse derives: 2 ∃y(x≠y), ∀E 1 (at x); 3 ∃x∃y(x≠y), ∃I 2 (witness x). Over a one-element domain both are false; over larger ones both are true.

Marking scheme. (10 points) 2: two ∃E boxes with different names, each aimed at the goal it must reach. 2: a flagged box u0 for the ∀ (inside or outside the ∃E boxes), and the goal postponed. 3: the split on u0=x0, with the first case reaching u0≠y0 by ¬I and =E, and the second giving the witness x0 at once. 1: the classical line named, with the reason. 2: (b), the converse derived, with both readings. An RAA box on ¬∃y(u0≠y) in place of the LEM split earns full marks if correct, its RAA line then named as the classical one. Fatal errors (0 for the step): the flag u0 chosen as x0; an ∃E box closed on a line that mentions its witness.