4.4  Valuations and Truth Tables

Sections 4.1 and 4.3 made formulas into objects: every formula is built from atoms and ⊥ by the connectives in exactly one way, and so a function on formulas can be defined one clause per connective. So far a formula is only a string of symbols. It says nothing, and it is neither true nor false. This section gives formulas a meaning. We say what it takes to fix the truth or falsity of every atom, and then compute the truth value of every formula from the values of its atoms, one connective at a time. The result is the truth table, the second way of looking at a formula that Chapters 1 and 2 kept promising.

Throughout, formulas are those of Definition 4.1.1, with atoms p,q,r,p1,p2,…, and we use Chapter 1’s shorthand for them (outer parentheses dropped, the usual precedence, → grouped to the right), as Section 4.1 allows.

4.4.1. Reading a table off the rules

Before any definition, a question. Suppose we want to call each statement true or false, and we want the rules of Chapters 1 and 2 to be safe: whenever the lines a rule cites are true, the line it writes is true. How must “true” behave for each connective? The rules answer almost completely. This subsection is motivation only; nothing later rests on it, and Section 4.8 makes it exact.

Conjunction. Take statements φ and ψ. If both are true, ∧I writes φ∧ψ from them, so φ∧ψ must be true. If φ∧ψ is true, ∧E writes φ and writes ψ, so both must be true; turned around, if either of them is false, then φ∧ψ must be false. All four combinations of values are settled: φψφ∧ψTTTTFFFTFFFF Here T stands for “true” and F for “false”.

Contradiction. The rule ⊥E writes any statement from ⊥. If ⊥ were ever true, ⊥E would lead from a true line to every statement, false ones included. So ⊥ must be false, always.

Negation. The rule ¬E writes ⊥ from φ and ¬φ. Since ⊥ is false, φ and ¬φ are never both true: if φ is true, ¬φ is false. And Proposition 2.5.3 derives φ∨¬φ from no premises at all, so at least one of the two is true: if φ is false, ¬φ is true. Negation flips the value.

Implication. The rule →E writes ψ from φ→ψ and φ. So in the combination “φ true, ψ false”, the implication cannot be true: that is the one row where φ→ψ is false. The other three rows are forced by derivations. Proposition 2.1.2 derives P→Q from ¬P, so whenever P is false (and ¬P therefore true), P→Q must be true, whatever Q is. And P→Q is derivable from Q alone (Exercise (B2: An assumption that is not used) (a) of Section 1.4):

1Q
2Pasm, for →I
3QR 1
4P→Q→I 2–3

so whenever Q is true, P→Q must be true. That settles the rows with P false (by the first derivation) and the row with both true (by the second).

The vacuous rows of →, “if P is false, then P→Q is true”, are often presented as a convention to be swallowed. Here they are forced by ⊥E, the rule that closes an impossible case, exactly as Section 2.1 said they would be. The rows of ∨ and ↔ can be read off their rules in the same way, and Exercise C3 of Section 4.5 asks for a sharper version of the argument for →. We now turn the answers into a definition.

Second readingA pair of rules with no table

The rules of Chapters 1 and 2 determine their tables almost completely. Not every pair of rules does. Invent a connective ⋄ with an introduction rule “from φ, infer φ⋄ψ” and an elimination rule “from φ⋄ψ, infer ψ”, and read a table off them as above. The first rule needs φ⋄ψ true whenever φ is; the second needs ψ true whenever φ⋄ψ is. In a row with φ true and ψ false the two demands clash, so no table makes both rules safe. Worse, the two rules together derive anything from anything: from p, the first gives p⋄q, and the second then gives q. (Logicians call this connective tonk.) A pair of rules does not give a connective a meaning just by being written down. Section 4.8 shows that the rules of Chapters 1 and 2 do, row by row.

4.4.2. Valuations

A formula such as p∧¬q cannot be true or false on its own, because p and q are atoms: letters with no content. What decides its value is a choice of which atoms are true. We need a word for one such choice.

A valuation is one possible situation, described by saying which atoms are true and which are false.

Definition 4.4.1 (Valuation)

A valuation v assigns to every atom p exactly one of the two truth values T and F. We write v(p) for the value it assigns to p, and say that p is true under v if v(p)=T, false under v if v(p)=F.

In words: a valuation answers, for each atom separately, the question “true or false?”, and it answers every such question. Two valuations are equal when they give every atom the same value. Nothing links the values of different atoms: v(p) and v(q) may be chosen freely, and that freedom is the whole point.

We let a valuation decide every atom so that one valuation gives a value to every formula at once. In practice only the few atoms a formula contains matter, and the Coincidence Lemma below says so.

Some valuations, simplest first.

  • The all-T valuation gives every atom the value T; the all-F valuation gives every atom F. They are the two extreme cases, and both will return as tests.
  • The valuation with v(p)=T, v(q)=F and v(r)=F for every other atom r. This is the typical way to describe a valuation: give the values of the few atoms we care about, and fix the rest once and for all.

4.4.3. The value of a formula

A valuation fixes the atoms. The value of every other formula should then follow, computed from the values of its parts by the tables of the first subsection. Since formulas are built by the clauses of Definition 4.1.1, this is a definition by recursion.

The value of a formula is computed from the bottom of its parse tree upwards, one connective at a time.

Definition 4.4.2 (Truth Value of a Formula)

Let v be a valuation. The truth value v(φ) of a formula φ under v is defined by recursion on φ:

  • (V1) for an atom p, v(p) is the value the valuation assigns to p; and v(⊥):=F;
  • (V2) v(¬φ):=T if v(φ)=F, and v(¬φ):=F if v(φ)=T;
  • (V3) v(φ∧ψ):=T if v(φ)=T and v(ψ)=T; otherwise F;
  • (V4) v(φ∨ψ):=T if v(φ)=T or v(ψ)=T (or both); otherwise F;
  • (V5) v(φ→ψ):=F if v(φ)=T and v(ψ)=F; otherwise T;
  • (V6) v(φ↔ψ):=T if v(φ)=v(ψ); otherwise F.

We say φ is true under v, or v makes φ true, if v(φ)=T; otherwise φ is false under v.

Clauses (V2)–(V6) say that the value of a compound formula depends only on the values of its immediate parts, and they are summed up in the tables of the five connectives: φ¬φTFFTφψφ∧ψφ∨ψφ→ψφ↔ψTTTTTTTFFTFFFTFTTFFFFFTT

Read them clause by clause. (V1): an atom has the value the valuation gives it, and ⊥ is false under every valuation. (V2): negation flips. (V3): a conjunction needs both parts. (V4): a disjunction needs at least one part; “or” is inclusive, as the rule ∨I of Section 1.5 already said, so the row with both parts true gives T. (V5): an implication is false in exactly one case, a true hypothesis with a false conclusion. (V6): a biconditional says the two sides agree.

The columns for ¬, ∧ and →, and the value of ⊥, are the ones the first subsection read off the rules. Section 4.8 proves that every row of every table is, in a precise sense, a derivable sequent.

Well defined. Clause (V1) gives a value to every atom and to ⊥, and each of (V2)–(V6) gives a rule computing the value of a compound formula from the values of its immediate parts. By Theorem 4.3.4, such clauses define exactly one function on all formulas. This is what Section 4.3 was for. Section 4.3 showed the danger with the string p∧q∨r, whose two readings take different values when p and q are false and r is true. A formula of Definition 4.1.1 carries its parentheses, and has one value.

Example (Computing a value)

Let v be a valuation with v(p)=F, v(q)=T and v(r)=F. Compute v(φ) for φ=(p∨¬q)→(q∧r).

Solution. Work from the leaves of the parse tree up to its root, one node at a time, each time using one clause of Definition 4.4.2. List the subformulas so that each comes after its immediate parts:

Subformula Clause Value
p, q, r (V1) F, T, F
¬q (V2): v(q)=T F
p∨¬q (V4): both parts F F
q∧r (V3): v(r)=F F
(p∨¬q)→(q∧r) (V5): the hypothesis is F T

So v(φ)=T. The last step did not need the value of q∧r: a false hypothesis makes an implication true whatever its conclusion is. Computing by hand, one may stop a branch as soon as its value is decided.

Second readingEdge cases

Nonexample. “p is true” and “p is false” together do not describe a valuation: the definition asks for exactly one value per atom. And a list that gives p the value T and says nothing about the other atoms is not a valuation either, since it fails “every atom”. We never need more than such a partial list, but we complete it (by F, say) so that the definition applies.

Nonexample. The rule “every formula gets the value T” agrees with the all-T valuation on every atom, but it is not the truth value of Definition 4.4.2 under any valuation. It breaks (V1) at ⊥, and it breaks (V2) at ¬p, where p and ¬p would both be T. The truth value under the all-T valuation is the function that (V1)–(V6) produce from it, and it makes ¬p false.

Warning. Values do not distribute over connectives the way symbols seem to. The value of ¬(p∧q) is not computed by negating p and q and keeping the ∧: under a valuation with v(p)=T and v(q)=F, the formula ¬(p∧q) is T (since p∧q is F), while ¬p∧¬q is F (since ¬p is F). Always follow the parse tree: the main connective is applied last.

Quick check. Let v(p)=F, v(q)=T, v(r)=T. What is v((p∨q)→¬r)?

Solution. F. Bottom up: p∨q is T, by (V4), since q is T; ¬r is F, by (V2); and an implication with a true hypothesis and a false conclusion is F, by (V5).

Quick check. Let v(p)=T and v(q)=F. What is v(¬p∨(q↔⊥))?

Solution. T. ¬p is F by (V2). q↔⊥ is T by (V6), since both sides are F (⊥ by (V1)). So the disjunction is T by (V4).

A game for the clauses. Clauses (V2)–(V4) can be acted out. Two players argue about a formula built from atoms by ¬, ∧ and ∨, under a valuation v. The verifier claims that the formula is true under v, the falsifier that it is false. Play starts at the whole formula and moves down its parse tree. At φ∧ψ the falsifier chooses a conjunct to dispute, and play goes on there; at φ∨ψ the verifier chooses a disjunct to defend. At ¬φ the two players swap roles, and play goes on at φ. At an atom p the game ends: the verifier wins if v(p)=T, the falsifier if v(p)=F. Run it once on ¬(p∧q), with v(p)=T and v(q)=F. At the ¬ the players swap, so the verifier of ¬(p∧q) now disputes p∧q. At the ∧ the choice is hers: she picks q, and she wins. A formula is true under v exactly when the verifier can always win, whatever the falsifier does; Exercise C3 proves it, and nothing later rests on the game.

4.4.4. Only the atoms of a formula matter

A valuation fixes infinitely many values, but a formula contains only finitely many atoms. We expect the value of a formula to depend only on the values of its own atoms. That is the fact that makes truth tables finite, and it is our first proof by structural induction about meaning.

Recall from Section 4.3 that atoms(φ), the set of atoms occurring in φ, is defined by recursion: atoms(p)={p} for an atom p, atoms(⊥) is empty, atoms(¬φ)=atoms(φ), and the atoms of φ∘ψ, for each binary connective ∘, are those of φ together with those of ψ. Two valuations v and w agree on a set of atoms if v(p)=w(p) for every atom p in it.

Lemma 4.4.1 (Coincidence Lemma)

Let φ be a formula, and let v and w be valuations that agree on atoms(φ). Then v(φ)=w(φ).

Idea. Structural induction on φ, with the property “for all valuations v, w that agree on the atoms of φ, v(φ)=w(φ)”. At an atom, the two valuations agree by hypothesis. At a compound formula, both values are computed by the same clause from the values of the immediate parts, and every atom of a part is an atom of the whole, so the two valuations agree on the atoms of each part and the hypothesis for the parts applies.

Proof. We apply Theorem 4.3.1 to the property C(φ): for all valuations v and w that agree on atoms(φ), v(φ)=w(φ).

Atoms. Let p be an atom and let v, w agree on atoms(p)={p}. Then v(p)=w(p), which is C(p).

⊥. By (V1), v(⊥)=F=w(⊥) for all valuations v, w. So C(⊥) holds.

Negation. Assume C(φ), and let v, w agree on atoms(¬φ). Since atoms(¬φ)=atoms(φ), they agree on atoms(φ), so v(φ)=w(φ) by C(φ). By (V2), v(¬φ) is determined by v(φ) and w(¬φ) by w(φ) through the same rule, so v(¬φ)=w(¬φ). This proves C(¬φ).

Conjunction. Assume C(φ) and C(ψ), and let v, w agree on atoms(φ∧ψ). Every atom of φ is an atom of φ∧ψ, so v and w agree on atoms(φ), and v(φ)=w(φ) by C(φ). In the same way v(ψ)=w(ψ) by C(ψ). By (V3), v(φ∧ψ)=T exactly when v(φ)=v(ψ)=T, that is, exactly when w(φ)=w(ψ)=T, that is, exactly when w(φ∧ψ)=T. Hence v(φ∧ψ)=w(φ∧ψ), which is C(φ∧ψ).

Disjunction, implication, biconditional. Assume C(φ) and C(ψ), and let v, w agree on the atoms of φ∘ψ. As in the conjunction case, v(φ)=w(φ) and v(ψ)=w(ψ). One clause of Definition 4.4.2 then turns these equal inputs into equal outputs:

∘ Clause Why v(φ∘ψ)=w(φ∘ψ)
∨ (V4) T exactly when one of the two parts is T, and the parts have the same values under v and under w
→ (V5) F exactly when the first part is T and the second F, and the parts have the same values under v and under w
↔ (V6) T exactly when the two parts have equal values, and the parts have the same values under v and under w

Every clause of Definition 4.1.1 has been covered, so by Theorem 4.3.1, C(φ) holds for every formula φ. This proves the lemma.

The table’s three cases are the conjunction case again, with another clause. The fold writes each one out in words.

Second readingThe three remaining cases, written out

Disjunction. Assume C(φ) and C(ψ), and let v, w agree on atoms(φ∨ψ). As in the previous case, v(φ)=w(φ) and v(ψ)=w(ψ). By (V4), v(φ∨ψ)=T exactly when one of v(φ), v(ψ) is T, that is, when one of w(φ), w(ψ) is T, that is, when w(φ∨ψ)=T. So C(φ∨ψ).

Implication. Assume C(φ) and C(ψ), and let v, w agree on atoms(φ→ψ). Again v(φ)=w(φ) and v(ψ)=w(ψ). By (V5), v(φ→ψ)=F exactly when v(φ)=T and v(ψ)=F, that is, when w(φ)=T and w(ψ)=F, that is, when w(φ→ψ)=F. So C(φ→ψ).

Biconditional. Assume C(φ) and C(ψ), and let v, w agree on atoms(φ↔ψ). Again v(φ)=w(φ) and v(ψ)=w(ψ). By (V6), v(φ↔ψ)=T exactly when v(φ)=v(ψ), that is, when w(φ)=w(ψ), that is, when w(φ↔ψ)=T. So C(φ↔ψ).

Two consequences. First, to know v(φ) we need only the values of v on the finitely many atoms of φ: if φ has n atoms, it has exactly 2n different “situations”, one for each way of giving its atoms the values T and F. (Each atom has two choices, and the choices are independent, so the number of ways doubles with each new atom: 2,4,8,…,2n. This count is itself a small induction on n, by Axiom 4.2.1.) Second, the extra atoms a valuation happens to fix are irrelevant: two valuations that differ only on atoms not in φ give φ the same value.

Quick check. Let φ=p→(q∨p). Two valuations v and w agree on p and q but disagree on r and on every pn. What does Lemma 4.4.1 say about v(φ) and w(φ)? Does it say anything about v(φ∧r) and w(φ∧r)?

Solution. atoms(φ)={p,q}, and v, w agree there, so v(φ)=w(φ). For φ∧r the atoms are p, q, r, and the valuations disagree on r, so the lemma does not apply. Indeed the values can differ: φ is true under every valuation (if p is true, so is q∨p), so v(φ∧r)=v(r) and w(φ∧r)=w(r), which differ.

4.4.5. Truth tables

Lemma 4.4.1 says that a formula’s value is decided by finitely many choices, and so it can be tabulated once and for all.

A truth table lists the value of a formula in every possible situation, one row per way of giving its atoms values.

Definition 4.4.3 (Truth Table)

Let φ be a formula and let p1,…,pn be a list of distinct atoms that includes every atom of φ. A row is an assignment of a truth value to each of p1,…,pn. The truth table of φ (on p1,…,pn) lists, for each of the 2n rows, the value v(φ) for a valuation v that agrees with the row on p1,…,pn. We say φ is true (or false) in the row.

Well defined. Two things must be checked. Existence: every row comes from a valuation, for instance the one that gives p1,…,pn the row’s values and every other atom F. Independence of the choice: two valuations that agree with the same row agree on p1,…,pn, hence on atoms(φ), so by Lemma 4.4.1 they give φ the same value. Without the lemma, “the value in a row” would not make sense, since a row says nothing about the infinitely many other atoms.

The list p1,…,pn is allowed to contain atoms that do not occur in φ; then pairs of rows that differ only there show the same value. This freedom lets us compare several formulas in one table, over the atoms of all of them, and Section 4.5 does that constantly. When φ has no atoms at all, as ¬⊥ or ⊥→⊥ do, the list may be empty, and the table has 20=1 row: such a formula has the same value under every valuation.

Conventions. The atom columns come first. The rows are listed with T before F, the last atom alternating fastest: for two atoms, TT, TF, FT, FF. In practice we add a column for each subformula, building up to φ in the order of the parse tree, as in Example (Computing a value), but now for every row at once.

Example (The truth table of modus ponens)

Make the truth table of ((p→q)∧p)→q on p,q, and read off from it what →E does.

Solution. Columns for the two atoms, then for each subformula in turn: pqp→q(p→q)∧p((p→q)∧p)→qTTTTTTFFFTFTTFTFFTFT The third column is (V5): F only in the row TF. The fourth is (V3) applied to the third column and the p column: T only in the first row. The last is (V5) again, with the fourth column as hypothesis and q as conclusion: the hypothesis is false in rows 2–4, so those rows are T, and in row 1 the conclusion q is T.

So the formula is true in every row. Read as a statement about →E: the only row in which both given lines p→q and p are true is row 1, and in that row the line the rule writes, q, is true as well. The rule never leads from true lines to a false one, at least when φ and ψ are the atoms p and q. Section 4.7 proves this for every rule and every formula.

Now a table built column by column for a biconditional, whose two sides Chapter 2 related by derivations.

Example (An implication and its contrapositive)

Make the truth table of (p→q)↔(¬q→¬p).

Solution. pqp→q¬q¬p¬q→¬p(p→q)↔(¬q→¬p)TTTFFTTTFFTFFTFTTFTTTFFTTTTT The columns p→q and ¬q→¬p are identical: each is F only in row 2. For ¬q→¬p that is the row where the hypothesis ¬q is T and the conclusion ¬p is F, that is, q false and p true, which is the same row TF. So the biconditional is T in every row.

Compare Chapter 2. There Proposition 2.3.2 derived ¬Q→¬P from P→Q with the rules for implication and negation, and Proposition 2.5.2 derived the way back with a derivation that uses RAA. The table sees no difference between the two directions; it only sees that the two columns agree. What a table can and cannot tell about derivations is the subject of Sections 4.7 and 4.8.

A table with n atoms has 2n rows, so three atoms give 8 and five give 32. Often we do not need all of them.

Example (Working backwards from F)

Find every row in which φ=(p→q)→(p→(q∧r)) is false: first with the full table on p,q,r, then without it.

Solution. The full table. pqrp→qq∧rp→(q∧r)(p→q)→(p→(q∧r))TTTTTTTTTFTFFFTFTFFFTTFFFFFTFTTTTTTFTFTFTTFFTTFTTFFFTFTT The formula is false in exactly one row, row 2: p and q true, r false.

Backwards from F. An implication is false in exactly one way, by (V5): hypothesis true, conclusion false. Apply that to the main connective of φ, and then to whatever it forces.

  1. φ is F exactly when p→q is T and p→(q∧r) is F.
  2. p→(q∧r) is F exactly when p is T and q∧r is F.
  3. With p true, p→q is T exactly when q is T.
  4. With q true, q∧r is F exactly when r is F.

Each step was forced, so there is exactly one row making φ false: p=T, q=T, r=F. Four short steps replace eight rows.

The second method has a name in this book: working backwards from F. Assume the formula is false, and ask what each part is forced to be, starting from the main connective. Implications and disjunctions are false in only one way, and conjunctions are true in only one way, so they force values; a false conjunction, a true disjunction, or a true implication leaves a choice, and then we split into cases. If every case ends in a contradiction (some atom would need both values), the formula is false in no row. A case that ends in a consistent assignment, completed in every way on the atoms it leaves unset, gives rows making the formula false, and together these cases give all such rows.

4.4.6. Truth-functional connectives

Each of the clauses (V2)–(V6) computes the value of a compound formula from the values of its immediate parts alone. Nothing else about the parts enters: not what they say, not how long they are. The general form of such a rule has a name.

Definition 4.4.4 (Truth Function)

Let n≥1. A truth function f with n inputs assigns to each list (a1,…,an) of truth values (each ai is T or F) a truth value f(a1,…,an). A formula φ expresses f if v(φ)=f(v(p1),…,v(pn))for every valuation v.

In words: a truth function is a truth table with n input columns and one output column, with no formula attached. Each of our connectives is a truth function. Negation is the one-input function T↦F, F↦T; conjunction is the two-input function that is T only at (T,T); disjunction, implication and the biconditional are the two-input functions read off the tables of (V4), (V5) and (V6). A way of joining statements whose value is fixed by the values of its parts is called truth-functional, and (V2)–(V6) say that all five connectives are.

Not every way of joining two statements is. Take “φ because ψ”:

φ ψ φ because ψ
T T ?
T F F
F T F
F F F

A “because” claim with a false part is false, so three rows are settled. The first is not. “6 is even because 6 is a multiple of 3” and “6 is even because 6 is a multiple of 2” both have two true parts. The first is false, since being a multiple of 3 does not make a number even; the second is true. The values of the parts do not decide the value of the whole.

The same happens with “it was proved before 1900 that φ”:

φ it was proved before 1900 that φ
T ?
F F

A statement that was proved is true, so the second row is F. But “2 is irrational” and “for no n≥3 does xn+yn=zn have a solution in positive integers” are both true, and only the first was proved before 1900. So “because” and “it was proved before 1900 that” are not connectives of our language, and no truth table can stand for them.

Quick check. Is “neither φ nor ψ” truth-functional? Give its table and a formula that expresses it.

Solution. Yes. It is T when both parts are F, and F in the other three rows, whatever the parts say. The formula ¬p1∧¬p2 expresses it.

Warning. A truth table sees only the connectives. Everything inside an atom is invisible to it. Fix a real number x. The statement “if x>2, then x2>4” is true, but its propositional form, with the atoms p: “x>2” and q: “x2>4”, is p→q, which is false in the row with p true and q false. That row cannot happen for any real x, and the reason lies in algebra, not in the connectives. The quantified statement “for every real x, if x>2, then x2>4” is, like “for every ε>0 there is an N such that …”, a single atom for a truth table, with two rows and nothing to compute.

Quick check. Why does Definition 4.4.3 need Lemma 4.4.1? What would go wrong in a table for p∨q if the value of p∨q could depend on the atom r?

Solution. A row gives values to the listed atoms only, and many valuations agree with it, differing on the other atoms. The table records “the” value of the formula in the row, so all those valuations must give the same value; Lemma 4.4.1 guarantees it. If v(p∨q) could depend on r, the row p=F, q=F would contain valuations giving different values, and there would be no single entry to write.

Remark (Looking ahead). Chapter 5 looks inside atoms.

4.4.7. Exercises

A. Check your understanding

Exercise (A1)
  • (a) Make the truth tables of ¬(p∧¬q) and of (p∨q)→p.
  • (b) Make the truth table of p↔¬p. Is it true in any row?
  • (c) Compute the value of (p→⊥)∨(⊥→p) under the all-F valuation, and under the all-T valuation.
  • (d) How many rows has the truth table of a formula on the atoms p,q,r,s?
  • (e) True or false, with a reason: if v(p)≠w(p), then v(p→(q→p))≠w(p→(q→p)).

Solution.

  • (a) pq¬qp∧¬q¬(p∧¬q)TTFFTTFTTFFTFFTFFTFTpqp∨q(p∨q)→pTTTTTFTTFTTFFFFT The first formula has the same column as p→q: false only in row TF.

(b) In the row p=T, ¬p is F, and in the row p=F, ¬p is T; the two sides always differ, so by (V6) the formula is F in both rows. It is true in no row. p¬pp↔¬pTFFFTF

(c) The disjunct ⊥→p has a false hypothesis, since v(⊥)=F under every valuation (V1), so it is T by (V5), and the disjunction is T by (V4). This holds under both valuations (and under every other).

(d) 24=16.

(e) False. The formula p→(q→p) is true under every valuation: if v(p)=F, the hypothesis is false; if v(p)=T, the conclusion q→p has a true conclusion. So v and w give it the value T however they differ. Lemma 4.4.1 says that agreement on the atoms forces agreement on the formula; it says nothing in the other direction.

Exercise (A2: Drill)

The parts run from computing one value, through partial information and backward computation, to the game and the truth-functional connectives.

  • (a) Let v(p)=T and v(q)=F. What is v(p→q)?
  • (b) Same v: what is v(¬p→q)?
  • (c) Same v: what is v(⊥↔q)?
  • (d) How many rows has a table on p,q,r,s,t?
  • (e) Only v(p)=T is known. Which of p∨q, p∧q, q→p, ¬p→r already have a value, and which value?
  • (f) Give a row making (p∨q)→(p∧q) false.
  • (g) Is there a row making p→¬p true?
  • (h) Work backwards from F: in which rows is p→(q→r) false?
  • (i) Find every row in which (p∨q)∧¬r is true, forcing what you can first.
  • (j) Valuations v,w agree on p and differ on q. Must v((p→p)∨q)=w((p→p)∨q)?
  • (k) In the game at ¬(p∧q), with v(p)=F and v(q)=T: who chooses at the ∧, what should be chosen, and who wins?
  • (l) Is “not both φ and ψ” truth-functional? If so, give a formula that expresses it.

Solution.

  • (a) F: a true hypothesis and a false conclusion.

  • (b) T: the hypothesis ¬p is F.

  • (c) T: both sides are F.

  • (d) 25=32.

  • (e) p∨q is T (one true disjunct is enough); q→p is T (true conclusion); ¬p→r is T (false hypothesis). p∧q waits for q.

  • (f) p=T, q=F (or p=F, q=T).

  • (g) Yes, p=F.

  • (h) Only p=q=T, r=F.

  • (i) A true conjunction forces both parts: ¬r true forces r=F. A true p∨q leaves three choices, so the rows are p,q,r = TTF, TFF, FTF.

  • (j) Yes, both are T, since p→p is T under every valuation. But Lemma 4.4.1 does not say so, because v and w differ on the atom q: the lemma gives a sufficient condition, not a necessary one.

  • (k) At the ¬ the players swap, so the original verifier disputes p∧q and chooses at the ∧. She chooses the conjunct p, which is false, and wins: ¬(p∧q) is true.

  • (l) Yes: it is F only when both parts are T. The formula ¬(p1∧p2) expresses it.

B. Practice

Exercise (B1: Backwards from F)

For each formula, work backwards from F to find every row on its atoms in which it is false, or show that there is none.

  • (a) ((p∨q)∧((p→r)∧(q→r)))→r.
  • (b) (p→(q→r))→((p→q)→(p→r)).
  • (c) ((p→r)∨(q→r))→((p∨q)→r).
  • (d) ((p→q)∧(q→r))→(r→p).

Solution. (a) Suppose the formula is F. Then r is F, and the hypothesis is T, so each of p∨q, p→r, q→r is T (V3). With r false, p→r true forces p=F, and q→r true forces q=F. Then p∨q is F, a contradiction. So the formula is false in no row. It is the table’s version of proof by cases: if r follows from each of p and q, and one of them holds, then r holds.

(b) Suppose it is F. Then p→(q→r) is T and (p→q)→(p→r) is F; the latter forces p→q to be T and p→r to be F, and the last forces p=T, r=F. Then p→q true with p true forces q=T. Now p→(q→r) has a true hypothesis and the conclusion q→r, which is F (true q, false r), so it is F, a contradiction. False in no row.

(c) Suppose it is F. Then (p∨q)→r is F: r=F and p∨q is T. And (p→r)∨(q→r) is T: with r false, p→r is T exactly when p=F, and q→r exactly when q=F; so at least one of p, q is F. Together with p∨q true: exactly one of p, q is T. This leaves a choice, so split. The formula is false in exactly two rows: p=T,q=F,r=F and p=F,q=T,r=F. Check the first: q→r is T, so the hypothesis is T; p∨q is T and r is F, so the conclusion is F.

(d) Suppose it is F. Then r→p is F: r=T, p=F. The hypothesis must be T: p→q is T because p is F, and q→r is T because r is T, whatever q is. Nothing forces q. So the formula is false in exactly two rows: p=F, r=T, and q either value.

Exercise (B2: Counting atoms, the last step blank)

Call a formula binary-built if it is built from atoms by the four binary connectives only, so that neither ¬ nor ⊥ occurs in it; the immediate parts of a binary-built formula are again binary-built. Define by recursion (Theorem 4.3.4) the number occ(φ) of atom occurrences and the number bin(φ) of binary connectives: occ(p)=1,occ(φ∘ψ)=occ(φ)+occ(ψ),bin(p)=0,bin(φ∘ψ)=bin(φ)+bin(ψ)+1, for every atom p and every binary connective ∘. (For ⊥ and ¬ give both functions any values; they play no part below.) Here is a proof, by Theorem 4.3.1, that every binary-built formula φ has occ(φ)=bin(φ)+1. The property is C(φ): if φ is binary-built, then occ(φ)=bin(φ)+1.

⊥ and negation. Neither ⊥ nor a formula ¬φ is binary-built, so C holds for them: its “if” is never met.

Atoms. occ(p)=1=0+1=bin(p)+1.

Conjunction. Assume C(φ) and C(ψ), and let φ∧ψ be binary-built. Then φ and ψ are binary-built, so occ(φ∧ψ)=occ(φ)+occ(ψ)=(bin(φ)+1)+(bin(ψ)+1)=(bin(φ)+bin(ψ)+1)+1=bin(φ∧ψ)+1.

Disjunction and biconditional. The computation is the same with ∨, and with ↔, in place of ∧.

Implication. ______

Name the move, then complete it.

Solution. The move is induction on the shape of a formula (Theorem 4.3.1): the case for a compound formula uses the property for its immediate parts, and nothing else.

Implication. Assume C(φ) and C(ψ), and let φ→ψ be binary-built. Its immediate parts φ and ψ are binary-built, so occ(φ)=bin(φ)+1 and occ(ψ)=bin(ψ)+1. Hence occ(φ→ψ)=occ(φ)+occ(ψ)=(bin(φ)+1)+(bin(ψ)+1)=(bin(φ)+bin(ψ)+1)+1=bin(φ→ψ)+1, which is C(φ→ψ). All clauses of Definition 4.1.1 are covered, so Theorem 4.3.1 gives C(φ) for every formula, and in particular the equation for every binary-built formula.

For instance (p→q)∧(p∨r) has four atom occurrences (p counted twice) and three binary connectives.

Exercise (B3: A table for a named pattern)

Make the truth table of ((p∨q)∧¬p)→q, and say which derived rule of Chapter 2 it corresponds to, as Example (The truth table of modus ponens) did for →E.

Solution. pqp∨q¬p(p∨q)∧¬p((p∨q)∧¬p)→qTTTFFTTFTFFTFTTTTTFFFTFT True in every row. The only row in which both p∨q and ¬p are true is row 3, and there q is true. This is disjunctive syllogism, DS (Proposition 2.3.4): from P∨Q and ¬P, infer Q.

Exercise (B4: Exactly one is true)

An integer n is such that exactly one of these three statements is true.

    • (A) n is even.
    • (B) If n is even, then n is divisible by 4.
    • (C) n is divisible by 4, or n is odd.

With the atom p for “n is even” and the atom q for “n is divisible by 4”, write (A), (B), (C) as formulas, find every row on p,q in which exactly one of them is true, and say what n can be.

Solution.

  • (A) is p, (B) is p→q, and (C) is q∨¬p (“n is odd” is “n is not even”).
p q (A) (B) (C) true
T T T T T three
T F T F F one
F T F T T two
F F F T T two

In the row TF, (B) has a true hypothesis and a false conclusion, and (C) has two false disjuncts. In the rows with p false, (B) has a false hypothesis and (C) the true disjunct ¬p. So only the row p=T, q=F makes exactly one statement true: n is even and not divisible by 4, for instance 2, 6 or −10.

The row FT is impossible for an integer, since a number divisible by 4 is even; it does not matter, as it fails the puzzle anyway. (B) and (C) agree in every row, and Section 4.5 explains why.

Marking scheme. (10 points)

  • 3: the three formulas.
  • 3: the four rows evaluated.
  • 2: the conclusion about n.
  • 2: an example.
Exercise (B5: Which primes divide n?)

Of an integer n we know that all four of these claims hold.

  1. If 2 divides n, then 3 does not.
  2. 3 divides n, or 5 divides n.
  3. If 5 divides n, then 2 does.
  4. 2 and 5 do not both divide n.

With the atoms p, q, r for “2∣n”, “3∣n”, “5∣n”, find every row making all four claims true by working backwards, and give two such integers n. Why may the three atoms be treated as independent here?

Solution. The claims are p→¬q, q∨r, r→p and ¬(p∧r).

If r were T, claim 3 would force p=T (a true implication with a true hypothesis has a true conclusion), and then p∧r would be T, against claim 4. So r=F. Then claim 2 forces q=T, and claim 1 forces p=F: with p true, its conclusion ¬q would be false. Check: the row p=F, q=T, r=F makes all four claims true, and since every step was forced, it is the only such row.

So 3 divides n, and 2 and 5 do not: n=3, 9 or 21, for instance.

Independence: each of the eight rows is the row of some integer. The integers 30,6,10,2,15,3,5,1 give the rows TTT, TTF, TFT, TFF, FTT, FTF, FFT, FFF, in that order. So arithmetic rules out no row in advance, and the table’s answer is the answer about integers.

Marking scheme. (10 points)

  • 2: the four formulas.
  • 4: the forced steps, each with its clause.
  • 2: the check and two values of n.
  • 2: independence.

C. Going deeper

Exercise (C1: A formula built from biconditionals)

Call a formula ↔-built if it is built from atoms by ↔ alone. For a valuation v and a formula φ, let fv(φ) be the number of occurrences of atoms in φ that are false under v, counted with repetition.

  • (a) Prove by structural induction that every ↔-built φ is true under v exactly when fv(φ) is even.
  • (b) Deduce that (p↔q)↔p has the same value as q under every valuation.

Solution (Hint 1). Put “if φ is ↔-built” inside the property, as in Exercise B2.

Solution (Hint 2). In the step, fv(φ↔ψ)=fv(φ)+fv(ψ). When is a sum of two numbers even?

Solution. (a) The property is C(φ): if φ is ↔-built, then for every valuation v: v(φ)=T iff fv(φ) is even. The cases ⊥, ¬ and the other three binary connectives are vacuous, since such formulas are not ↔-built.

Atoms. If v(p)=T, then fv(p)=0, which is even; if v(p)=F, then fv(p)=1, which is odd. Either way, v(p)=T iff fv(p) is even.

Step. Assume C(φ) and C(ψ), and let φ↔ψ be ↔-built. Its parts are ↔-built, so the hypotheses apply to them. By (V6), v(φ↔ψ)=T iff v(φ)=v(ψ), iff fv(φ) and fv(ψ) are both even or both odd (by the hypotheses), iff their sum fv(φ↔ψ) is even.

Every clause of Definition 4.1.1 is covered, so Theorem 4.3.1 gives C(φ) for every formula.

(b) In (p↔q)↔p, the atom p occurs twice and q once. So fv counts 2 if p is false (0 otherwise), plus 1 if q is false (0 otherwise), which is even exactly when q is true. By (a), the formula is true exactly when q is.

Marking scheme. (10 points)

  • 2: the property stated for every formula, with the restriction inside and “for every v”.
  • 1: the vacuous cases named.
  • 2: the atom case, both values.
  • 4: the step, with (V6) and the parity of a sum.
  • 1: (b).

Fatal errors (0 for the step): a step that uses the hypothesis for one part only; fixing v outside the property and then using another valuation.

Exercise (C2: Find the error, used later)

Here is a claim and a “proof”.

Claim. Let vT be the all-T valuation. Every formula built from atoms by ∧, ∨ and → only is true under vT.

Proof. By Theorem 4.3.1, with the property “if φ is built from atoms by ∧, ∨, → only, then vT(φ)=T”. The formulas ⊥, ¬φ and φ↔ψ are not built in this way, so the property holds for them. If a formula built in this way is φ∧ψ, φ∨ψ or φ→ψ, then φ and ψ are built in this way too, so the hypothesis applies to them. (1) For an atom p, vT(p)=T by the definition of vT. (2) If vT(φ)=T and vT(ψ)=T, then vT(φ∧ψ)=T by (V3). (3) If vT(φ)=T and vT(ψ)=T, then vT(φ∨ψ)=T by (V4), since at least one part is true. (4) If vT(φ)=T and vT(ψ)=T, then vT(φ→ψ)=T by (V5), because vT(φ)=F and an implication with a false hypothesis is true. This covers every clause, and proves the claim.

  • (a) Is the claim true?
  • (b) Name the line that fails and say exactly what is wrong with it.
  • (c) Give a formula on which the reason given in that line is false.
  • (d) Repair the line.

Solution. (a) Yes. The claim is true, and the repaired proof in (d) proves it. So no formula is a counterexample to the claim; the error is in the argument only.

(b) Line (4). Its hypothesis states vT(φ)=T, and its reason states vT(φ)=F. The reason contradicts the induction hypothesis it is supposed to use: it quotes the vacuous row of (V5), which does not apply here. The conclusion vT(φ→ψ)=T is correct, but not for the reason given.

(c) p→q. Under vT, vT(p)=T, so the stated reason “vT(p)=F” is false, although vT(p→q)=T holds.

(d) (4) If vT(φ)=T and vT(ψ)=T, then vT(φ→ψ)=T by (V5), because the conclusion ψ is true, so we are not in the one row (true hypothesis, false conclusion) where an implication is false. With this line the induction is correct, and the claim follows. Section 4.9 uses this fact to show that ∧, ∨ and → cannot express negation.

Marking scheme. (10 points)

  • 2: the claim is true (with the reason: the repaired proof).
  • 3: names line (4), and says its reason contradicts the hypothesis vT(φ)=T of that very case.
  • 2: a formula, such as p→q, on which the stated reason fails.
  • 3: the repair, citing the row of (V5) that actually applies (conclusion true).

Fatal errors (0 for the step): calling the claim false; locating the error in line (3) (at least one part true is correct) or in the handling of ⊥, ¬, ↔.

Exercise (C3: The game and the clauses)

Fix a valuation v. For formulas built from atoms by ¬, ∧, ∨ alone, define by recursion (Theorem 4.3.4, applied to the pair of truth values of the two statements as one function, since each clause for ¬ calls on the other statement; give ⊥, → and ↔ any values, they play no part) two statements, Ver(φ) (“the verifier can always win at φ”) and Fal(φ) (“the falsifier can always win at φ”):

φ Ver(φ) holds iff Fal(φ) holds iff
an atom p v(p)=T v(p)=F
¬θ Fal(θ) Ver(θ)
θ∧χ Ver(θ) and Ver(χ) Fal(θ) or Fal(χ)
θ∨χ Ver(θ) or Ver(χ) Fal(θ) and Fal(χ)
  • (a) Say in words why each clause matches the rules of the game.
  • (b) Prove by structural induction that for every such formula φ, Ver(φ) holds iff v(φ)=T, and Fal(φ) holds iff v(φ)=F.
  • (c) Why must the two statements of (b) be proved together?

Solution (Hint 1). Put “if φ is built from ¬, ∧, ∨” inside the property.

Solution (Hint 2). The step for ¬ needs the claim about Fal for the part.

Solution. (a) At an atom the game ends, and the value of the atom decides the winner. At ∧ the falsifier chooses, so the verifier wins only if she can win at both parts, whichever he picks, and the falsifier wins if he can win at one of them, by picking it. At ∨ the verifier chooses, so the roles are reversed: she needs one part, he needs both. At ¬ the players swap, so winning as verifier at ¬θ is winning as falsifier at θ, and the other way round.

(b) The property is C(φ): if φ is built from ¬, ∧, ∨, then (Ver(φ) iff v(φ)=T) and (Fal(φ) iff v(φ)=F). For ⊥, → and ↔ it is vacuous. For an atom both halves are the definition.

Negation. Assume C(θ). Then Ver(¬θ) iff Fal(θ) iff v(θ)=F iff v(¬θ)=T, by (V2). Likewise Fal(¬θ) iff Ver(θ) iff v(θ)=T iff v(¬θ)=F.

Conjunction. Assume C(θ) and C(χ). Ver(θ∧χ) iff both Ver(θ) and Ver(χ), iff both parts are true, iff v(θ∧χ)=T, by (V3). Fal(θ∧χ) iff Fal holds of one part, iff one part is false, iff v(θ∧χ)=F.

Disjunction. The same with (V4): Ver iff one part is true, Fal iff both parts are false.

Every clause of Definition 4.1.1 is covered, so Theorem 4.3.1 gives C(φ) for every formula.

(c) The ¬ step for Ver uses the hypothesis about Fal for the part, and the ¬ step for Fal uses the one about Ver. Either half alone does not pass through the step, so the property must carry both: Section 4.2’s move, proving more in order to prove less.

Marking scheme. (10 points)

  • 2: (a).
  • 2: the property, with the restriction and both halves.
  • 1: the vacuous cases and the atoms.
  • 2: the ¬ step.
  • 2: the ∧ and ∨ steps.
  • 1: (c).

Fatal error (0 for the step): proving only the Ver half and using the Fal half in the ¬ step without proof.