Skip to content
AI360Xpert
Beta

Truth Tables

A truth table lists every true-false combination of the pieces, so a compound claim is settled by checking rows instead of arguing.

Four rows exhaust P and Q, and implies is false only in the true-premise false-conclusion row, true everywhere else
Four rows exhaust P and Q, and implies is false only in the true-premise false-conclusion row, true everywhere else

Why Does This Exist?

Arguments about logic go in circles because each side pictures different cases. Truth tables end that by writing all cases down: two propositions mean four rows, three mean eight, and every row gets a verdict. A claim is valid when the conclusion holds in each row where the premises hold. No rhetoric, just rows.

For ML work they are the reference behind every boolean expression: filter predicates, masking logic, assertion conditions, and the gate semantics inside circuits and decision rules. When a compound condition misbehaves, the table shows which row was forgotten. Connectives are defined in propositional logic.

The one idea you need first

With nn true-or-false propositions there are exactly 2n2^n combinations, and a truth table lists all of them, one per row. Each column computes one sub-expression per row. Exhaustion is the method: because every possibility appears, checking all rows settles the claim completely.

Think of It Like This

A referee checking every replay angle

A disputed play gets settled by watching every camera angle, not by debating the loudest one. Each angle is a row: what the rule says from that view. If the call stands from all four angles, it stands; one angle overturning it is enough to reverse.

Truth tables referee claims the same way. The "angles" are the T/F combinations, and validity means the conclusion's light stays green in every row where the premises are green. The analogy stops at scale: four cameras are watchable, but ten propositions need 1024 rows, which is why real systems compress tables into formulas and tests.

How It Actually Works

Build the table for P→QP \to Q (PP implies QQ) column by column:

PPQQP→QP \to Q
TTT
TFF
FTT
FFT

In plain words: list the four T/F pairs for PP and QQ; the implies column is false only in row 2, where a true premise meets a false conclusion (the broken promise), and true elsewhere. Rows 3 and 4 are vacuously true: with PP false the promise was never activated. Two formulas are equivalent when their columns match on every row; P→QP \to Q matches ¬P∨Q\lnot P \lor Q exactly, which is why code often writes implications as not P or Q.

Validity reads off the table: an argument is valid when every row with all premises true also has the conclusion true. Modus ponens passes because row 2 (the only threat) has P→QP \to Q false there.

Worked example

Test the claim "from P→QP \to Q and PP, conclude QQ" against all four rows:

  • Row 1 (T, T): both premises true, conclusion QQ true. Holds.
  • Row 2 (T, F): P→QP \to Q is false, so premises are not all true. Row excuses itself.
  • Rows 3-4 (P false): PP premise fails. Both rows excuse themselves.

Only row 1 has all premises true, and the conclusion holds there: valid. Now test affirming the consequent (QQ plus P→QP \to Q concluding PP): row 3 has QQ true and P→QP \to Q true but PP false. Counterexample found in the open, claim refuted.

Watch Out For

Treating vacuous truth as real evidence

Rows where the premise is false mark the implication true without saying anything about the world: "if this model trains then pigs fly" is logically true of a model that never trains. Readers mistake the T for support and cite implications whose premises never held.

Check premise truth separately before leaning on an implication. A true implication with a false premise licenses no conclusion at all.

Stopping the table early

With three conditions there are eight rows, and the bug always hides in row 7: the combination nobody pictured (all flags on, or the one-off pattern). Hand-checking "the main cases" is how edge-case outages are born.

Enumerate all 2n2^n mechanically for small nn instead of cherry-picking. If nn is large, test the boundaries (all true, all false, exactly one true) rather than the "typical" middle.

The Quick Version

  • A truth table lists all 2n2^n true-false combinations, one claim settled per row.
  • P→QP \to Q is false only for true PP with false QQ; false premises make it vacuously true.
  • P→QP \to Q matches ¬P∨Q\lnot P \lor Q on every row: they are equivalent.
  • Validity means the conclusion holds in each row where all premises hold.
  • Row 3 (false PP, true QQ) refutes affirming the consequent by counterexample.
  • Enumerate fully for small nn; never cherry-pick "the main cases."