Open Study Commons

Sheet 05 of 22

Truth tables

Needs sheet 04 for the connectives.

A truth table lists every way the atomic statements could be true or false, then works out the formula for each. It is a finite, complete survey of the possible situations, and it turns the imagination work of sheet 02 into arithmetic.

05.1 The five definitions

The connectives are defined by their tables. These are the definitions, and the conditional has its own page, sheet 06, because its table is the one people dispute.

Negation flips the value
P¬P
TF
FT

Open in the truth-table tool

The four two-place connectives
PQP ∧ QP ∨ QP → QP ↔ Q
TTTTTT
TFFTFF
FTFTTF
FFFFTT

With n atomic letters there are 2ⁿ rows, since each letter doubles the count. This site lists rows the common way: T before F, with the rightmost letter changing fastest. Any order works so long as no row goes missing.

05.2 Building one

Work from the inside outward, giving each subformula a column. Here is ¬(P ∧ Q), one step at a time.

Start with the inner part and negate it
PQP ∧ Q¬(P ∧ Q)
TTTF
TFFT
FTFT
FFFT

Open in the truth-table tool

For anything longer, write the steps down. The tool has a “show every step” option for this reason. The answer matters less than the habit of knowing which part you are computing.

05.3 Three kinds of formula

Definition

Tautology. A formula true in every row. Also called logically true.

Definition

Contradiction. A formula false in every row.

Definition

Contingent formula. A formula true in some rows and false in others.

Example

P ∨ ¬P is a tautology, and P ∧ ¬P is a contradiction. A tautology gives no information about the world, because it rules no possibility out. “Either it will rain tomorrow or it will not” cannot be wrong, and it is no use for planning a picnic.

One column of T, one column of F
PP ∨ ¬PP ∧ ¬P
TTF
FTF

Open in the truth-table tool

Counterexample

People say “that’s a tautology” about a sentence like “boys will be boys”. As a piece of logic, B → B would be a tautology, but the speaker means something contingent and quite substantive about how boys behave. A sentence’s look is no guide to its logical form.

05.4 Equivalence

Definition

Logically equivalent. Two formulas are equivalent when they have the same truth value in every row.

Equivalent formulas say the same thing, as far as truth goes, and may replace each other anywhere. The most useful pair of equivalences are named after the nineteenth-century logician Augustus De Morgan.

De Morgan's first law: the two columns match row for row
PQ¬(P ∧ Q)¬P ∨ ¬Q
TTFF
TFTT
FTTT
FFTT

Open in the truth-table tool

De Morgan's second law
PQ¬(P ∨ Q)¬P ∧ ¬Q
TTFF
TFFF
FTFF
FFTT

Open in the truth-table tool

Read in English: to deny a conjunction is to assert that at least one part fails. To deny a disjunction is to assert that both fail. Programmers use these daily, as sheet 22 shows, and they are behind the “not both” and “neither” rows on sheet 04.

Here is a pair that looks equivalent and is not.

A conditional and its converse disagree in two rows
PQP → QQ → P
TTTT
TFFT
FTTF
FFTT

Open in the truth-table tool

05.5 Testing an argument

Now the payoff. Put each premise and the conclusion in its own column. Hunt for a row where all the premises are true and the conclusion is false. Such a row is a possible situation that breaks the argument, which is what sheet 02 said a counterexample must be. No such row means the argument is valid. The survey covers every case, so nothing has been overlooked.

A chain of conditionals
PQRP → QQ → RP → RNote
TTTTTT
TTFTFF
TFTFTT
TFFFTF
FTTTTT
FTFTFT
FFTTTT
FFFTTT

Valid: no row has every premise true and the conclusion false. Open in the truth-table tool

A tempting pattern for "or"
PQP ∨ QP¬QNote
TTTTFcounterexample
TFTTT
FTTFF
FFFFT

Invalid: one row has every premise true and the conclusion false. Open in the truth-table tool

The second is invalid under inclusive or: the row where both are true has the premises true and the conclusion false. A shaded row is more than a verdict. It tells you exactly what the counterexample is. Here it reads: let P and Q both be true.

There is a tidy connection between these ideas, and it is worth noting once:

Rule

An argument with premises A, B and conclusion C is valid exactly when the single formula (A ∧ B) → C is a tautology. Checking validity and checking for tautology are one job in two outfits.

05.6 The short way

Sixteen rows are tedious and sixty-four are worse. Often you can work backwards. To test (P → Q) → (¬Q → ¬P), suppose it is false and try to make that work. A conditional is false only with a true antecedent and a false consequent, so P → Q is true and ¬Q → ¬P is false. That second fact needs ¬Q true and ¬P false, so Q is false and P is true. But then P → Q is false, against what we required. The supposition collapses, so the formula cannot be false: it is a tautology. That is the same reasoning as a full table, skipping the rows that could not matter.

05.7 Where the method stops

Tables work for all of propositional logic. That is a strong result: the subject is decidable, meaning a fixed procedure always gives a right answer. There are two limits.

First, size. Thirty letters give over a billion rows, and the count doubles with every letter added. Whether something fundamentally faster exists is a famous open question, tied to the P versus NP problem that sheet 22 mentions.

Second, expressive power. Tables cannot see inside atomic statements, and this argument defeats them:

  1. All humans are mortal.
  2. Socrates is a human.

Therefore: Socrates is mortal.

Valid, but a truth table cannot show it

In propositional terms that is A, B, so C: three unrelated letters. A table finds a counterexample, and the counterexample is an artefact of a poor translation. The validity depends on the internal structure of those sentences, which is why sheet 10 exists. So a table’s “valid” can be trusted absolutely. Its “invalid” means only “invalid as far as propositional form goes”.

The method itself came together slowly. Emil Post and Ludwig Wittgenstein both published it in 1921, and earlier traces exist in the work of Charles Sanders Peirce.

Try to break this

Find a formula with three letters that is true in exactly one row. Now one that is true in exactly seven. Can you find a recipe that produces a formula for any pattern of T and F you care to write in the last column? (There is one. It is the reason a computer can be built out of a few kinds of gate. See sheet 22.)

05.8 Exercises

  1. How many rows does a table for (P ∧ Q) → (R ∨ S) need? Is the formula a tautology?

    Answer

    Four letters, so 16 rows. It is not a tautology: let P and Q be true and R and S be false. Then the antecedent is true and the consequent false.

  2. Classify (P → Q) ∨ (Q → P), and say whether that surprises you.

    Answer

    It is a tautology. If Q is true the first disjunct is true, and if Q is false the second is. It surprises most people, since it says that of any two statements at all, one implies the other. sheet 06 explains why the conditional allows this.

  3. Are P → (Q → R) and (P ∧ Q) → R equivalent?

    Answer

    Yes. Each is false in exactly one row: P and Q true and R false. The equivalence is called exportation.

  4. Are P → (Q → R) and (P → Q) → R equivalent?

    Answer

    No. Let P, Q and R all be false. The first is true, since its antecedent is false. The second has antecedent P → Q, which is true, and consequent R, which is false, so it is false. Bracket placement matters.

  5. Use a table, or the tool, to test: P → Q, ¬Q → R, so P → R.

    Answer

    Invalid. Take P true, Q true, R false. Then P → Q is true, and ¬Q → R is true because ¬Q is false, while P → R is false.

  6. Use the short way to show that P ∧ ¬P → Q is a tautology.

    Answer

    Suppose it is false. Then the antecedent P ∧ ¬P must be true, which needs P and ¬P both true. That cannot be, so the formula cannot be false.