cs.thefarshad
intro

Truth Tables

Compute a formula under every assignment to classify it and test logical equivalence.

A truth table lists every possible assignment of true/false to the atomic sentences and computes the formula’s value in each. With nn distinct atoms there are 2n2^n rows — two for one atom, four for two, eight for three.

The tool below builds the full table for any formula and classifies it. Try P¬PP \lor \lnot P, then P¬PP \land \lnot P, then (PQ)(¬PQ)(P \rightarrow Q) \leftrightarrow (\lnot P \lor Q).

Type symbols or ASCII: ~ ! → ¬, & → ∧, | → ∨, -> → →, <-> → ↔.

PQ(P → Q) ↔ (¬P ∨ Q)
TTT
TFT
FTT
FFT
This formula is a tautology — true under every assignment.

Three kinds of formula

Reading the final column tells you which kind of formula you have:

  • A tautology is true in every row — a logical truth, e.g. P¬PP \lor \lnot P.
  • A contradiction is false in every row, e.g. P¬PP \land \lnot P.
  • A contingent formula is true in some rows and false in others — most formulas are contingent.

Logical equivalence

Two formulas are logically equivalent when they have the same truth value in every row. A clean test: XX and YY are equivalent exactly when XYX \leftrightarrow Y is a tautology. The default formula above shows one famous equivalence — PQP \rightarrow Q is equivalent to ¬PQ\lnot P \lor Q, so the biconditional between them comes out true in every row.

Some equivalences worth knowing (each is a tautology when written as a biconditional):

  • Double negation: ¬¬PP\lnot\lnot P \leftrightarrow P
  • De Morgan: ¬(PQ)(¬P¬Q)\lnot(P \land Q) \leftrightarrow (\lnot P \lor \lnot Q) and ¬(PQ)(¬P¬Q)\lnot(P \lor Q) \leftrightarrow (\lnot P \land \lnot Q)
  • Contraposition: (PQ)(¬Q¬P)(P \rightarrow Q) \leftrightarrow (\lnot Q \rightarrow \lnot P)

Check any of these by typing it above — a true-in-every-row column confirms it.

Why this matters

Truth tables are a decision procedure: a mechanical, always-terminating method that answers “is this a logical truth?” and “are these equivalent?” for sentence logic. That is exactly the kind of guarantee that makes a logic formal — no cleverness required, just fill in the table.

Takeaways

  • A formula over nn atoms has a 2n2^n-row truth table.
  • Tautology (always true), contradiction (always false), contingent (mixed).
  • XX and YY are logically equivalent iff XYX \leftrightarrow Y is a tautology.
  • The table is a complete decision procedure for sentence logic.

References

  • Paul Teller, A Modern Formal Logic Primer, Prentice Hall (1989) — free at tellerprimer.ucdavis.edu. Curriculum follows the primer; explanations and examples here are original.