Logic

The tree that closes

To prove a formula, assume it false and take it apart. Every branch ends in a contradiction, or one of them describes exactly how it could have been false — and either way the tree is the answer, drawn.

Worth reading first: A formula is a corner of a cube.

There is a way of proving a formula that consists entirely of taking it apart, and it produces a picture of the proof as a side effect.

A tableau for ((p → q) ∧ (q → r)) → (p → r)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬(((p → q) ∧ (q → r)) → (p → r))(p → q) ∧ (q → r)¬(p → r)p → qq → rp¬r¬p×q¬q×r×assume the formula false, then take it apart: ((p → q) ∧ (q → r)) → (p → r)every branch closes, so the assumption is impossible — the formula is valid
Fig. 1 The transitivity of implication, proved. The root is the negation of the formula, each step is one formula being decomposed, and each branch ends in a contradiction — marked with a cross. Every branch closing means the negation is impossible, which is what proving the formula means.

The method has three moving parts and no more: assume the opposite, decompose until only letters are left, and look for a letter appearing alongside its own negation.

The single idea

A formula is true or it is not. If it is not, there is an assignment making it false, and that assignment can be described.

Take the negation of the thing to be proved, and start writing down what would have to hold for it to be true. Most steps are forced: if ABA ∧ B is true then AA is true and BB is true, with no choice. Some steps are not: if ABA ∨ B is true then one of them is, and the argument has to consider both — which is where the tree branches.

Keep going until every formula on a branch is a letter or a negated letter. Then either the branch contains some letter and its negation, in which case it describes nothing and is closed; or it does not, in which case its letters describe an assignment making the original negation true, and the formula is not a theorem.

That is the whole method. There are no axioms, no rules of inference to memorise, and no ingenuity — every step is forced by the shape of the formula being taken apart, and the only choice is which formula to take apart next, which affects the size of the tree and not the answer.

The ten rules, which are five rules twice

Each connective decomposes one of two ways.

An α step is a formula whose truth forces two things at once, and it produces a single child carrying both. A conjunction is the obvious case: ABA ∧ B gives AA and BB. So is the negation of a disjunction — ¬(AB)¬(A ∨ B) gives ¬A¬A and ¬B¬B — and the negation of an implication, ¬(AB)¬(A → B), which gives AA and ¬B¬B.

A β step is a formula whose truth forces one of two things, and it branches. ABA ∨ B gives a branch for AA and a branch for BB. The negation of a conjunction branches the same way. And an implication, ABA → B, gives ¬A¬A on one side and BB on the other — which is exactly what an implication says.

Double negation is the tenth rule and the dullest: ¬¬A¬¬A gives AA.

The α/β split is worth noticing rather than memorising, because it is the only thing that governs how big a tree gets. Every α step keeps the tree one branch wide; every β step doubles it. A formula whose decomposition is all α steps produces a stick; a formula full of disjunctions produces a bush.

Reading the picture

Take the tree at the top of the page slowly.

The root is ¬(((pq)(qr))(pr))¬(((p → q) ∧ (q → r)) → (p → r)) — the negation of what is to be proved. The negation of an implication is an α step, so the first child carries both ((pq)(qr))((p → q) ∧ (q → r)) and ¬(pr)¬(p → r) with no branching. The conjunction is another α step, giving pqp → q and qrq → r. And ¬(pr)¬(p → r) is a third, giving pp and ¬r¬r.

At that point the branch holds pp, ¬r¬r, and two implications. Implications are β steps, so the tree branches: pqp → q gives ¬p¬p or qq.

On the ¬p¬p side the branch already has pp, so it closes at once — a letter and its negation, which is a description of nothing. On the qq side the branch continues, decomposes qrq → r, and closes on both sides: ¬q¬q against qq, and rr against ¬r¬r.

Every branch closed. So there is no way for the negation to hold, so the formula is a theorem, and the tree is the argument written out.

What an open branch is worth

A tableau for (p → q) → (q → p)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬((p → q) → (q → p))p → q¬(q → p)¬pq¬pqq¬passume the formula false, then take it apart: (p → q) → (q → p)a branch stays open, and its literals are a counterexample — the formula is not valid
Fig. 2 An attempt to prove that implication is symmetric. The branches do not close, and their literals are exactly the assignment that refutes the formula — pp false, qq true.

This is where the method earns its reputation, because a failed proof is not merely a failure.

The open branch’s letters are ¬p¬p and qq. That is not a hint or a direction to look in; it is the counterexample. Set pp false and qq true: then pqp → q is true, qpq → p is false, and the whole implication is false. The method that failed to find a proof handed over the reason there is none.

The truth table of (p → q) → (q → p)A grid with one row per assignment of truth values, and the value of the formula beside it.pq(p → q) → (q → p)FFTFTFTFTTTT(p → q) → (q → p) — 4 assignments, 3 of them satisfyingfalse in 1 row, so it is neither valid nor contradictory
Fig. 3 The same formula’s table, with the false row picked out. There is one, at pp false and qq true — which is the assignment the open branch spelled out. Two methods with nothing in common, agreeing about which row is the problem.

Compare that with an axiomatic proof system, where failing to find a proof establishes only that none has been found yet. A tableau either closes or produces a counterexample, and there is no third outcome — which makes it a decision procedure rather than a search.

A tableau for ¬(p ∧ q) ↔ (¬p ∨ ¬q)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬(¬(p ∧ q) ↔ (¬p ∨ ¬q))¬(p ∧ q)¬(¬p ∨ ¬q)¬p¬¬p¬¬qp׬q¬¬p¬¬qpq׬¬(p ∧ q)¬p ∨ ¬qp ∧ q¬ppq׬qpq×assume the formula false, then take it apart: ¬(p ∧ q) ↔ (¬p ∨ ¬q)every branch closes, so the assumption is impossible — the formula is valid
Fig. 4 De Morgan’s law, proved. The equivalence is a β step at the root, so the tree opens into two halves at once and each closes on its own literals.

Two verdicts computed two ways

A proof method is only worth trusting if something independent agrees with it, and this is exactly the situation where a figure can cheat without anyone noticing: a drawing of a tree with crosses on it looks like a proof whether or not the crosses are in the right places.

So every tableau on this page is checked against the truth table. The tableau is built by decomposition and closes or does not; the truth table is computed by walking the parsed formula over all assignments; and the two verdicts are asserted to agree before the figure is drawn. If a tableau closed on a formula that has a false row, or stayed open on a tautology, the build would stop.

Those are the two halves of a proof system’s respectability, and it is worth naming them.

Soundness: everything the tableau proves is true. If the tree closes, the formula is a tautology.

Completeness: everything true is provable. If the formula is a tautology, the tree closes.

Both are theorems, and both are being instanced by every figure here rather than assumed. A cross-check on one formula is not a proof of either theorem; a cross-check on every formula this collection draws is evidence of exactly the kind this site prefers — a claim given a test it could fail.

Satisfiability, which is the same machine

A tableau for ((p ∨ q) ∧ ¬p) ∧ ¬qA branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.((p ∨ q) ∧ ¬p) ∧ ¬q(p ∨ q) ∧ ¬p¬qp ∨ q¬pp×q×assume the formula true, then take it apart: ((p ∨ q) ∧ ¬p) ∧ ¬qevery branch closes, so the assumption is impossible — the formula is unsatisfiable
Fig. 5 The same procedure asking a different question: is this formula satisfiable? Start from the formula itself rather than its negation, and every branch closing now means the formula cannot be true at all.

Feed the tableau a formula rather than its negation and the question changes. All branches closing now means the formula is unsatisfiable; an open branch is an assignment satisfying it.

Those are the same procedure with different input, and the relationship between the two questions is worth stating: FF is valid exactly when ¬F¬F is unsatisfiable. Everything in this field about proving things and everything about finding models are the same subject seen from two sides, and the tableau is the clearest place to see it because the machine does not change at all.

That equivalence is also why satisfiability, rather than validity, is what practical tools are built around. A solver is asked “is there an assignment”, and a proof is obtained by asking about the negation and being told no.

The order of expansion, which changes the tree and not the answer

There is one degree of freedom in the method and it is worth being explicit about it, because it is where all the practical difference lies.

At any point a branch may hold several undecomposed formulas, and the method does not say which to take next. Every choice leads to a closed tree if the formula is valid, so the answer is not at stake. The size very much is.

The rule of thumb is to do every available α step before any β step. An α step adds two formulas to one branch and might close it immediately; a β step doubles the width and then has to close both halves. Doing the branching last means fewer branches exist when the closing literals arrive, and the saving compounds through the depth of the tree.

The figures here follow a simpler rule — take the first non-literal on the branch — because a figure should show the method rather than a tuned version of it. On these formulas the difference is a node or two. On a formula with a dozen disjunctions it is the difference between a tree that fits on a page and one that does not.

That distinction, between a method’s answer and a method’s cost, runs through everything here. Nothing in this essay’s correctness depends on the order; the whole of its practicality does.

A tableau for (p ⊕ q) → (p ∨ q)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬((p ⊕ q) → (p ∨ q))p ⊕ q¬(p ∨ q)p¬q¬p¬q׬pq¬p¬q×assume the formula false, then take it apart: (p ⊕ q) → (p ∨ q)every branch closes, so the assumption is impossible — the formula is valid
Fig. 6 Exclusive-or implies inclusive-or. The is a β step with two formulas on each branch, which is the shape that makes parity expensive for this method as it does for every other.

Why it always finishes

The method is only a decision procedure because it stops, and it is worth seeing why, because the argument is short and because the place it breaks is the whole of the next level of the subject.

Every rule replaces one formula by formulas that are shorter — strictly fewer connectives — than the one it decomposed. A conjunction of length nn becomes two formulas whose lengths add to less than nn; an implication becomes two branches each carrying something shorter; double negation loses two symbols. Nothing is ever added that was not smaller than what it replaced.

So along any branch the total size of the undecomposed formulas strictly decreases at every step, and a quantity of whole numbers that strictly decreases cannot go on forever. Each branch reaches a state where only literals remain, and there are finitely many branches because each step produces at most two children. The tree is finite, the procedure halts, and the verdict is available.

That is a termination argument by decreasing measure, and it is the same shape as the proofs that Euclid’s algorithm halts and that a Goodstein sequence reaches zero: find a quantity that goes down at every step and cannot go down forever. The three differ only in what the quantity is and how hard it is to see that it decreases. Here it is the length of a formula and the argument is one line; there, the quantity has to be an ordinal and the argument is a theorem.

The reason it matters here is that the argument is exactly what fails one level up. A quantified formula’s rule for does not replace the formula — it keeps it, and adds an instance — because the same universal claim may need to be used again with a term that has not appeared yet. Nothing decreases, the branch can run forever, and the tree that was guaranteed finite is not.

Where a tableau gets big

A tableau for (p ↔ q) ↔ (q ↔ p)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬((p ↔ q) ↔ (q ↔ p))p ↔ q¬(q ↔ p)pqq¬p׬qp׬p¬qq¬p׬qp׬(p ↔ q)q ↔ pp¬qqp׬q¬p׬pqqp׬q¬p×assume the formula false, then take it apart: (p ↔ q) ↔ (q ↔ p)every branch closes, so the assumption is impossible — the formula is valid
Fig. 7 Equivalence is symmetric, proved. Each is a β step producing two branches with two formulas each, so the tree grows in both directions at once — this is a small formula and it is already the widest tree on the page.

The method is complete, mechanical and, in the worst case, hopeless.

Every β step doubles the width. A formula that is a conjunction of nn disjunctions produces up to 2n2^n branches, and there is no reordering that avoids it in general — a good choice of which formula to expand next can help enormously in practice and cannot change the worst case.

That is not a defect of tableaux specifically. Deciding whether a propositional formula is satisfiable is the standard hard problem, and every method known for it is exponential in the worst case. What differs between methods is which cases they are fast on, and modern solvers are built around a different search — clause learning, backtracking with memory of past failures — that is far better in practice and no better in theory.

The comparison worth drawing is with the truth table itself, which is also a decision procedure and always costs exactly 2n2^n rows. The tableau is often much cheaper, because it stops as soon as a branch closes and never enumerates assignments that the structure of the formula has already ruled out. On the transitivity proof at the top of this page the table would have had eight rows; the tree has four leaves and two of them closed early.

A tableau for ((p ∨ q) ∧ (¬p ∨ r)) → (q ∨ r)A branching tree of formulas, each branch ending in a contradiction or in a description of a counterexample.¬(((p ∨ q) ∧ (¬p ∨ r)) → (q ∨ r))(p ∨ q) ∧ (¬p ∨ r)¬(q ∨ r)p ∨ q¬p ∨ r¬q¬rp¬p×r×q×assume the formula false, then take it apart: ((p ∨ q) ∧ (¬p ∨ r)) → (q ∨ r)every branch closes, so the assumption is impossible — the formula is valid
Fig. 8 A resolution-shaped formula, proved. The two disjunctions in the premise are β steps and the negated conclusion is an α step, so the tree branches twice and every leaf closes on a pair the premises forced together.

The formula above is the propositional core of a rule machines actually use. From pqp ∨ q and ¬pr¬p ∨ r it follows that qrq ∨ r — the two clauses are combined by cancelling pp against ¬p¬p. That is resolution, one rule instead of ten, and it is what real provers are built on because a single rule is far easier to search with.

The tableau proves it rather than assuming it, which is the right relationship between the two: resolution is a derived shortcut, and its correctness is exactly the closure of the tree above.

Why this is the proof system this field draws

There are other proof systems and most of them are better for other purposes: natural deduction reads like reasoning, sequent calculus has the cleanest metatheory, resolution is what machines actually run.

Tableaux are here for one reason, and it is a reason peculiar to this collection. The proof is already a picture. Nothing was arranged to make it drawable — the branching is the case analysis, the depth is the decomposition, and the crosses are where the contradiction was found. A natural-deduction proof is a list of lines with justifications and can be laid out as a tree only by a convention imposed on it; a tableau is a tree because the method is a tree.

That makes it the one place in this field where the site’s standing claim is straightforwardly true. A figure that is a proof, rather than a picture of one, is rare — a dissection is the other clean case in this collection — and the tableau qualifies because every mark on it is a step the method took, in the order it took them.

There is one caveat that belongs with the claim. The picture is a proof of a propositional formula, and propositional formulas are the easy case: finite, decidable, and settled by the table anyway. Tableaux extend to quantified logic and the extension is where they stop being finite — a rule for may have to be used again with a new term at any point, and a branch can go on forever without closing and without ever describing anything. What was a decision procedure becomes a semi-decision procedure, which halts when there is a proof and may not when there is not.

That distinction is the one this whole field is built around, and the tableau is where it first becomes concrete. Here, in the propositional case, the tree always finishes. One step up in expressive power, it may not, and the reason it may not is the same reason an infinite tree can have an infinite path.

What links here

Computed from the collection, not written here: the essays that point at this one.

Reads more easily once this is understood

Essays that name this one as worth reading first.

Named objects

A dashed tag is an object no other essay names yet.

BranchingCompletenessDecision procedureLiteralProof systemRefutationSatisfiabilitySoundnessTableau