Any compound logical formula you can write down falls into exactly one of three buckets:

The detector below sweeps through four named formulas and classifies each on the spot. You read the truth table, the detector reports the verdict, and after four spins your pattern-recognition for the three bucket shapes is locked in.

Drag through the detector

Detector classifying four named logical formulasA card displays the current formula and its four-row truth table. A draggable slider steps through four formulas: p or not p, p and not p, p implies q, not of p and not p. The verdict above the card names the formula and labels it tautology, contradiction, or contingent. A visual column meter shows which of three verdicts is lit. row 1 row 2 row 3 row 4 (rows exist) result column 0 1 2 3 taut contr contingent taut drag to swap the formula under test tautology = all T, contradiction = all F, contingent = mixed
Detector verdicts for four formulas. The first and fourth are tautologies (every row true). The second is a contradiction (every row false). The third is contingent (mixed $T$ and $F$). The rule that classifies any formula is simply this: **look at the result column.** All $T$'s → tautology. All $F$'s → contradiction. Anything else → contingent.

The three buckets, one paragraph each

Tautology

A tautology is a formula whose result column is T in every row. The canonical example is p \lor \lnot p — the law of the excluded middle. Either p holds or its negation does; nothing else is possible, so the disjunction is true in every world. Another workhorse tautology is the contrapositive equivalence (p \Rightarrow q) \Leftrightarrow (\lnot q \Rightarrow \lnot p). Tautologies are the "theorems of logic itself" — true before any subject-matter facts enter the room.

Contradiction

A contradiction has F in every row. The canonical example is p \land \lnot p — you cannot simultaneously say "it is raining" and "it is not raining." The law of non-contradiction forbids it. Any formula logically equivalent to p \land \lnot p is also a contradiction, and landing on one of these inside a proof is exactly what Proof by Contradiction uses to refute an assumption.

Contingent

A contingent formula has at least one T row and at least one F row. Most formulas you meet are contingent: p \Rightarrow q, p \land q, p \lor q, and every ordinary statement about specific objects ("n is prime", "this triangle is equilateral"). Contingent formulas can be true or false depending on the world.

The one-paragraph algorithm

Why the algorithm works: a formula with n propositional variables has a truth table with 2^n rows — one for every assignment of T/F to the variables. Computing the result column fills in every possible scenario. If it is constant T everywhere, no assignment can falsify the formula (tautology). If constant F, no assignment can satisfy it (contradiction). Otherwise both T and F occur somewhere, which is the definition of contingent.

Algorithm.

  1. List the 2^n truth-value assignments for the n variables.
  2. Compute the final column.
  3. Scan it: all T → tautology; all F → contradiction; mixed → contingent.

For n up to about 4 you can do this by hand. Beyond that, logic software (SAT solvers) takes over — and the classification problem becomes the famous NP-complete problem.

A subtle pattern: the negation pattern

If \varphi is a tautology, then \lnot \varphi is a contradiction, and vice versa.

\varphi \text{ tautology} \quad\Leftrightarrow\quad \lnot \varphi \text{ contradiction}

That is why \lnot(p \land \lnot p) on the detector's fourth card is a tautology — it is the negation of the contradiction on the second card. The two cards are twins through negation.

Contingent formulas, by contrast, stay contingent under negation. If p \Rightarrow q is contingent, so is \lnot(p \Rightarrow q) \equiv p \land \lnot q.

Why this classification matters

Tautologies are what proofs ultimately ride on. Every logical equivalence — De Morgan, contrapositive, double negation — is a tautology of the form \varphi \Leftrightarrow \psi. Whenever you "rewrite one expression into an equivalent form," you are applying a tautology as a substitution rule. Contradictions are the detectors that power Proof by Contradiction: deriving one means your starting assumption was false. Contingent formulas are the ordinary sentences of mathematics, whose truth values your theorems have to determine.

Related: Logic and Propositions · Implication as a Promise · Vacuous Truth — Empty-Box Demo · Proof by Contradiction