Contents / Mathematical Logic / Propositional Logic
Chapter 1
Propositional Logic
Propositional calculus, logical connectives, truth tables, tautologies, satisfiability, and normal forms.
Introduction
Propositional logic is the fragment of formal logic in which whole statements are the smallest moving parts. It does not look inside a statement at objects, functions or quantifiers; it fixes a stock of atoms, each of which is simply true or false, and studies how truth flows through the connectives that build compound statements out of them.
That deliberate poverty is what makes the subject sharp. Because a formula's meaning is a finite function of finitely many bits, every semantic question about it — is it always true, is it ever true, does it follow from these assumptions — is decidable by inspection. The mathematics lies in doing that inspection well: in proving that formulas can be read in only one way, that a handful of connectives suffices to express every truth function, that a formula can always be flattened into a normal form, that a single mechanical inference rule is enough to refute anything unsatisfiable, that an infinite set of assumptions is satisfiable as soon as each of its finite parts is, and that a purely syntactic calculus can capture exactly the semantic truths. Those theorems are the content of this chapter.
1.1The Language and Unique Readability
Logic begins with a language, and a language begins with symbols. We must be able to say exactly which strings are formulas before we can ask what they mean, because the whole method of the subject is to define truth by recursion on the way a formula was built. If a formula could be built in two different ways, that recursion would not define anything.
Definition 1.1 (The propositional language). Fix a non-empty set of atoms (also called propositional variables or sentence letters). The alphabet of the language consists of the atoms, the connectives , and the two parentheses.
The set of formulas is the smallest set of finite strings over this alphabet such that
- every atom is a formula, and so are the constants and ;
- if is a formula then so is ;
- if and are formulas then so are , , and .
"Smallest set closed under these rules" is not a phrase to skim. It means is the intersection of all sets satisfying (1)–(3), and that intersection is itself closed under (1)–(3), so it is the least such set. The payoff is immediate and is used on almost every page that follows.
Theorem 1.2 (Structural induction). Let be a property of formulas. Suppose holds of every atom and of and ; that implies ; and that and together imply for each binary connective . Then every formula has property .
Proof. Let . The hypotheses say precisely that satisfies clauses (1)–(3) of the definition. Since is the smallest such set, , and as by construction, .∎
Notation. Writing every pair of parentheses is unbearable, so we adopt the usual conventions: outermost parentheses are dropped, binds most tightly, then , then , then , then ; and associates to the right, so abbreviates . These are conventions about abbreviations, not about the official language. Every proof in this chapter concerns the fully parenthesised strings.
The rest of this section establishes the fact that licenses definition by recursion: a formula wears its construction on its face.
Lemma 1.3 (Parenthesis balance). In every formula the number of left parentheses equals the number of right parentheses, and in every proper non-empty initial segment of a formula the left parentheses strictly outnumber the right.
Proof. By structural induction. For an atom, or , the string has no parentheses and no proper non-empty initial segment at all, so both claims hold.
Suppose the claims hold for and , and consider for a binary connective . Its parenthesis count exceeds the combined counts of and by one of each kind, and those are balanced, so is balanced. A proper non-empty initial segment of has one of these forms: the single symbol ; or followed by a proper non-empty initial segment of ; or followed by all of ; or that together with ; or that followed by a proper non-empty initial segment of . In the first four cases the excess of left over right parentheses is at least , using the induction hypothesis for in the second case and the balance of in the third and fourth. In the last case the excess is plus the excess in an initial segment of , hence at least . The unary case is the same argument with fewer sub-cases.∎
Theorem 1.4 (Unique readability). Every formula is of exactly one of the forms: an atom, , , , or for exactly one binary connective ; and in the last two cases the constituent formulas and are uniquely determined.
Proof. A formula beginning with a symbol other than is an atom, or , and those three cases are visibly disjoint. So suppose the formula begins with . The symbol immediately after it is either — in which case the formula can only have arisen from clause (2) — or the first symbol of a formula, in which case it arose from clause (3). That settles the shape.
For uniqueness of the constituents, suppose and are the same string. If then one is a proper non-empty initial segment of the other, say of . By Lemma Parenthesis balance the left parentheses of then strictly outnumber its right ones — yet is itself a formula and so is balanced. That contradiction forces . Deleting the common prefix leaves and equal as strings, so and then .∎
Intuition. Unique readability is the reason a formula has a parse tree rather than a parse forest. Natural language lacks it — "old men and women" genuinely has two readings — and that ambiguity is exactly what parentheses are bought to prevent. Every later definition in this chapter says "define the value of by cases on the shape of "; without unique readability those cases could overlap and the definition would be incoherent.
Definition 1.5 (Subformula, rank, atoms of a formula). The set of subformulas of is defined by recursion: for atomic ; ; and . The rank is the depth of the parse tree: for atomic formulas, for , and for . We write for the finite set of atoms occurring in .
Example 1.7 (Reading a string back into a tree). Determine the principal connective, the rank, and the immediate subformulas of .
Solution. Strip the outer parentheses and scan for the connective lying at depth inside them, running a counter that increments on and decrements on . The segment opens and closes, returning the counter to , and the next symbol is . So the principal connective is , and by Theorem Unique readability it is the only candidate.
The immediate subformulas are therefore and . Their ranks are and , so the whole formula has rank . It has subformulas in all: itself, , , , and . □□
Example 1.8 (Counting formulas of a given shape). How many formulas of rank exactly can be built from the two atoms and alone, using the five connectives?
Solution. A rank- formula has a principal connective whose immediate constituents all have rank , and the only rank- formulas available are and . For the unary there are choices of constituent, giving and . For each of the four binary connectives there are ordered choices, and is a different string from even when the two mean the same. So the count is
Note carefully what was counted: strings, not meanings. Among these formulas only a handful of distinct truth functions appear, which is the theme of the next section. □□
Pitfall. The abbreviation conventions are the commonest source of silent error. Because associates to the right, is and not ; the two differ, as the assignment , , shows — the first is true, the second false. Likewise abbreviates , never .
1.2Truth Functions and Functional Completeness
Syntax fixed, we give the symbols meaning. The guiding principle is truth-functionality: the truth value of a compound formula depends on nothing but the truth values of its immediate constituents. This is an assumption about the connectives, and a strong one — "Alice believes that " is not truth-functional, since two sentences with the same truth value need not be equally believed. Classical propositional logic is precisely the logic of the truth-functional connectives.
Definition 1.9 (Valuation and its extension). A valuation is a function . By Theorem Unique readability it extends uniquely to satisfying , , for atoms, and
We drop the bar and write throughout.
Lemma 1.10 (Relevance). If two valuations and agree on every atom of , then .
Proof. Structural induction on . The atomic case is the hypothesis, and are constant. If the claim holds for and , then since , the valuations agree on the atoms of each constituent, so they agree on the constituents' values, and the clauses of Definition Valuation and its extension compute the same value from the same inputs.∎
Relevance is what makes a finite truth table an honest device: to know the value of under every one of the infinitely many valuations of the full language, it suffices to tabulate the patterns on the atoms that actually occur in .
Definition 1.11 (Truth function). An -ary truth function is a map . A formula with expresses the truth function if for every valuation .
Proposition 1.12 (How many truth functions there are). There are exactly -ary truth functions. In particular there are unary and binary ones.
Proof. A truth function is a function from the -element set to the -element set , and the number of functions from a set of size to a set of size is . Hence the count is ; substituting and gives and .∎
Only a few of the sixteen binary functions carry names. Four are worth isolating because they will do real work later.
Definition 1.13 (Sheffer stroke, Peirce arrow, exclusive or). Define (NAND, the Sheffer stroke) to be ; (NOR, the Peirce arrow) to be ; and (exclusive or) to be , true exactly when and differ.
Definition 1.14 (Functional completeness). A set of connectives is functionally complete if for every every -ary truth function is expressed by some formula whose connectives all lie in .
Theorem 1.15 (Functional completeness of the standard set). The set is functionally complete.
Proof. Let be an -ary truth function. If is identically , the formula expresses it. Otherwise let , a non-empty finite set. For put
and set . Every connective used is in .
For correctness, fix a valuation and let . By construction if and only if for every , that is, if and only if . Hence iff some equals , iff , iff . So expresses .∎
Corollary 1.16 (Smaller complete sets). Each of , and is functionally complete.
Proof. By Theorem Functional completeness of the standard set it is enough to rewrite every formula over inside the smaller set, which we do by replacing offending subformulas innermost-first. For use ; for use ; for use together with . Each replacement preserves the truth function, as a two-row or four-row check confirms, and each strictly decreases the number of forbidden connectives, so the rewriting terminates.∎
Theorem 1.17 (Sheffer's theorem). is functionally complete on its own, and so is .
Proof. It suffices to express and , by Corollary Smaller complete sets. Since , negation is available. Then
So both and are expressible using alone. The argument for is dual: and , and is complete.∎
Completeness is not cheap, and the next two results say why. Both are proved by exhibiting a property that every formula over the given connectives must have, and which some truth function lacks.
Theorem 1.18 (Monotone connectives are not complete). The set is not functionally complete: no formula built from and alone expresses .
Proof. Call a formula monotone if whenever for every atom . Every atom is monotone, and if are monotone then so are and , because and are non-decreasing in each argument. By Theorem Structural induction every formula over is monotone. But is not: taking gives .∎
Theorem 1.19 (Truth-preserving connectives are not complete). No formula built from alone expresses , or indeed any truth function that returns on the all-ones input.
Proof. Let be the valuation sending every atom to . Each of the four connectives returns when both arguments are : , and and are both . So by structural induction for every formula over that set. Since , negation is not among them.∎
Intuition. The two obstructions are of the same kind: a clone of truth functions closed under composition can miss a function only by failing to escape some invariant. Post's classification makes this exact — there are precisely five maximal clones (the truth-preserving, falsity-preserving, monotone, self-dual and affine functions), and a set of connectives is functionally complete exactly when it is contained in none of them. NAND escapes all five at once, which is why one connective can suffice.
Example 1.20 (Expressing exclusive or three ways). Write using (a) via the construction in Theorem Functional completeness of the standard set, and (b) alone.
Solution. (a) The function is exactly on the rows and , so and the construction gives
(b) Set . Then , which is exactly when and , i.e. exactly on the row ; symmetrically is exactly on . Since is only when both are , the formula is precisely on the rows where neither of , occurs — that is, on and — and on the other two. Hence
five occurrences of the stroke and no other connective. □□
Example 1.21 (A completeness check). Is functionally complete?
Solution. No. Call a binary truth function affine if it can be written as with each , arithmetic modulo . Both and are affine, and substituting affine expressions into an affine expression yields an affine expression, since sums modulo of affine forms are affine. So by structural induction every formula over is affine. But is not affine: an affine function of and satisfies , whereas conjunction gives . Hence is not expressible and the set is incomplete. □□
Pitfall. Functional completeness is a property of a set of connectives, not of a single formula, and it is not preserved by dropping members. is complete; is not, and neither is . Adding connectives never destroys completeness, but adding them to an incomplete set need not repair it — is still incomplete by Theorem Truth-preserving connectives are not complete.
1.3Truth Tables, Tautologies and Equivalence
With semantics in place we can classify formulas by how they behave across all valuations, and define what it means for one statement to follow from others.
Definition 1.22 (Truth table). Let . The truth table of is the list of the values , , of the truth function expresses. By Lemma Relevance this table determines for every valuation of the whole language.
Definition 1.23 (Tautology, contradiction, contingency). A formula is a tautology (written ) if for every valuation ; a contradiction if for every ; and contingent otherwise. Every formula falls into exactly one of the three classes.
Definition 1.24 (Model, semantic entailment). A valuation is a model of a set of formulas if for every ; we write . We say entails , written , if every model of is a model of . For finite we write .
Entailment is the central semantic relation of the subject: it is what "this argument is valid" means. The next proposition ties it to the connective , and it must be read carefully, because conflating the two is the standard beginner's error.
Theorem 1.25 (Semantic deduction theorem). For any set and formulas ,
In particular iff , and iff .
Proof. () Let . If then outright. If then , so by hypothesis and again .
() Let . Then , so by hypothesis; and , so the only way the implication can hold is .∎
Pitfall. is a relation between formulas, living in the metalanguage; is a symbol inside a formula. " " is a claim that happens to be false; " " is a formula that is sometimes true. Theorem Semantic deduction theorem says the two are systematically related, which is exactly why they are easy to confuse — but writing or is a type error, not a shorthand.
Definition 1.26 (Logical equivalence). Formulas and are logically equivalent, written , if for every valuation ; equivalently, if .
Proposition 1.27 (Equivalence is an equivalence relation). is reflexive, symmetric and transitive on , and its classes are in bijection with the truth functions over any fixed finite set of atoms.
Proof. The three properties are inherited pointwise from equality of the values . For the second claim, map each class to the truth function its members express; this is well defined and injective by the definition of , and surjective by Theorem Functional completeness of the standard set. Over atoms there are therefore exactly classes.∎
The following theorem is what makes equivalence usable: it says you may rewrite a part of a formula and keep the whole intact. Without it, the familiar chain of rewritings that converts a formula to normal form would have no justification.
Theorem 1.28 (Substitution of equivalents). Let , and let be a formula with a distinguished occurrence of as a subformula. Let be the result of replacing that occurrence by . Then .
Proof. Induct on the rank of relative to the distinguished occurrence. If the occurrence is all of , then and there is nothing to prove. Otherwise has a principal connective and the occurrence lies inside one immediate constituent. Say with the occurrence inside , and let be the corresponding replacement, so . By the induction hypothesis , so for every valuation we have , and then
where also denotes the truth function of the connective. The unary case is identical with one argument. Hence .∎
Theorem 1.29 (Uniform substitution preserves tautologies). Let be a tautology and let assign to each atom a formula. Let be the result of replacing every occurrence of every atom in by . Then is a tautology.
Proof. Fix a valuation and define a valuation on atoms by . A structural induction on shows : for an atom this is the definition of ; and for a compound formula, substitution commutes with the connective, so both sides are computed by the same truth function from equal arguments. Since is a tautology, , hence . As was arbitrary, is a tautology.∎
This is why the laws below are stated with schematic letters: once is checked on a four-row table with atoms, it holds with any formulas substituted in.
Theorem 1.30 (The basic equivalences). For all formulas :
together with commutativity, associativity, idempotence and absorption for and .
Proof. By Theorem Uniform substitution preserves tautologies it suffices to verify each as a biconditional between atoms, and each such verification is a truth table with at most rows. For instance and are both exactly on the row ; and and are both exactly when or .∎
Definition 1.31 (Dual of a formula). Let be built from atoms, , , , and only. Its dual is obtained by exchanging with and with throughout, leaving atoms and negations untouched.
Theorem 1.32 (Duality principle). For every such with atoms among ,
Consequently, if then ; and is a tautology if and only if is a contradiction.
Proof. Write for the formula with every atom negated, and argue by structural induction that . For an atom : and . For : . For : after one double negation. For ,
by De Morgan from Theorem The basic equivalences, and the case is symmetric.
For the consequences: if then (negating atoms is a uniform substitution, which preserves equality of truth functions by the argument of Theorem Uniform substitution preserves tautologies), so the negations are equivalent and hence so are the duals. And is a tautology iff is — since is a bijection of valuations — iff is a contradiction, iff is.∎
Method 1.33 (The falsification shortcut). To test without writing rows:
- Assume and propagate. A false implication forces its antecedent true and its consequent false; a false disjunction forces both disjuncts false; a true conjunction forces both conjuncts true.
- Continue until either an atom is forced to both values — then no falsifying valuation exists and is a tautology — or every atom is assigned consistently, in which case that assignment is an explicit counterexample.
- If a step offers a genuine choice (a false conjunction, say), branch and treat each branch by the same rules; is a tautology only if every branch closes.
Example 1.34 (Hypothetical syllogism). Show without tabulating all eight rows.
Solution. Assume the formula is false. An implication is false only when its antecedent is true and consequent false, so and . The second forces and . The first forces and . From and we get ; from and we get , contradicting what we just forced. No branch survives, so the formula is a tautology. □□
Example 1.35 (Using duality to halve the work). Given that (absorption), deduce a second law for free.
Solution. Both sides are built from atoms, and only, so Theorem Duality principle applies: equivalent formulas have equivalent duals. Dualising exchanges and throughout, turning the left side into and the right side into . Hence
the other absorption law, obtained without a single new truth-table row. The same trick pairs the two De Morgan laws and the two distributive laws. □□
Example 1.36 (Entailment versus implication). Decide whether , and whether .
Solution. For the first: let be any model of both premises. Then from the second premise. If were then , contradicting the first premise, so and . Every model of the premises is a model of the conclusion, so the entailment holds — this is modus tollens.
For the second, Theorem Semantic deduction theorem applied twice converts the entailment into exactly this implication, so it is a tautology. The two questions are the same question in two notations, which is the content of that theorem. □□
Summary. is a tautology is a contradiction . Entailment and the object-language are linked by the semantic deduction theorem. Equivalence may be applied to subformulas (substitution of equivalents) and tautologies survive uniform substitution; duality halves the catalogue of laws.
1.4Satisfiability, Validity and SAT
The classification of the previous section had three boxes. Recast in terms of existence of a model rather than universality, it has two, and the two are related by negation — which is the single most useful fact in applied logic, because it lets one algorithm answer every question.
Definition 1.37 (Satisfiability). A set of formulas is satisfiable if it has a model, and unsatisfiable otherwise. A single formula is satisfiable if is. The number of models of over is written .
Theorem 1.38 (The duality of validity and satisfiability). For every formula :
- is a tautology if and only if is unsatisfiable;
- is satisfiable if and only if is not a tautology;
- if has elements, is a tautology iff , a contradiction iff , and contingent otherwise.
Proof. (1) iff . So has a model iff has a falsifying valuation, and is a tautology iff no such valuation exists. (2) is (1) applied to together with . (3) By Lemma Relevance only the patterns on matter, and is true on all of them, none of them, or some but not all.∎
Theorem 1.39 (The refutation principle). if and only if is unsatisfiable.
Proof. Suppose and let . Then , so ; but gives , a contradiction, so no such exists. Conversely, suppose is unsatisfiable and let . Then , i.e. . Hence every model of models .∎
Intuition. This is how every automated reasoner on earth is organised. You do not build a machine that searches for proofs of from ; you build a machine that searches for a model, feed it together with the negation of what you hope to prove, and take its failure to find one as the proof. "Prove it" becomes "show this is impossible", and impossibility is what an exhaustive search is good at establishing.
Definition 1.40 (The satisfiability problem). SAT is the decision problem: given a formula (conventionally in conjunctive normal form), is it satisfiable? -SAT is the restriction to inputs in which every clause has at most literals.
Proposition 1.41 (Brute force works, slowly). SAT is decidable: for a formula with atoms, evaluating all valuations decides satisfiability in time .
Proof. By Lemma Relevance it suffices to test valuations of , of which there are . Each evaluation is a single bottom-up pass over the parse tree, linear in the length of . Return "satisfiable" at the first valuation giving , and "unsatisfiable" if all fail.∎
That the exponent is unavoidable in the worst case is the central open problem of the area.
Theorem 1.42 (Cook–Levin). SAT is NP-complete, and remains so when restricted to -SAT.
Proof. Sketch. Membership in NP is immediate: a satisfying valuation is a certificate of size , checkable in linear time by Proposition Brute force works, slowly applied to one valuation. For hardness one shows that every language decided by a nondeterministic Turing machine in time reduces to SAT: introduce atoms meaning "at step , tape cell holds symbol ", together with atoms for head position and state, and write down clauses asserting that the initial configuration is correct, that exactly one symbol occupies each cell at each step, that successive configurations are related by 's transition table, and that some configuration is accepting. The resulting formula is polynomial in and is satisfiable exactly when accepts. Reducing arbitrary clauses to -literal clauses is the Tseitin-style splitting of Theorem Tseitin transformation below. This proof rests on the formal model of nondeterministic computation, which is outside this chapter.∎
Proposition 1.43 (2-SAT is tractable). Satisfiability of a set of clauses each containing at most two literals is decidable in time linear in the size of the input.
Proof. Sketch. Read each two-literal clause as the pair of implications and , and build the directed implication graph whose vertices are the literals and whose edges are these implications. The graph is skew-symmetric: an edge is present exactly when is. One shows the clause set is unsatisfiable if and only if some atom has and in the same strongly connected component, and Tarjan's algorithm finds the components in linear time. The argument that this criterion is correct uses the fact that within a component all literals must take the same value, which rests on graph theory rather than logic.∎
Example 1.44 (Counting models). How many valuations of satisfy ?
Solution. Split on . If , the second clause forces and the first is already satisfied; is free, giving models. If , the second clause is satisfied outright and the first forces , while is free, giving more. The two cases are disjoint, so
out of valuations. Since , part (3) of Theorem The duality of validity and satisfiability says the formula is contingent. □□
Example 1.45 (An unsatisfiable set). Show is unsatisfiable, and say what that tells us about an entailment.
Solution. Suppose models all four. From and we get ; from and we get ; but gives . No model exists.
By Theorem The refutation principle, taking and , the unsatisfiability of is exactly the statement . The refutation we just performed is the proof of the entailment. □□
Example 1.46 (Satisfiable, by witness). Is satisfiable?
Solution. Try . The second clause then needs , and the third needs ; the first clause is satisfied by . So models all three clauses and the set is satisfiable. A single witness settles satisfiability; no other rows need be examined. (Unsatisfiability is the expensive direction — there, every row must be excluded, which is what resolution automates.) □□
Pitfall. "Not a tautology" and "unsatisfiable" are different failures, and Theorem The duality of validity and satisfiability relates them only through a negation. The formula is neither a tautology nor unsatisfiable. A solver reporting "no model" for has proved valid; a solver reporting "no model" for has proved contradictory. Feeding it the wrong one inverts your conclusion.
1.5Conjunctive and Disjunctive Normal Form
Any formula can be flattened into one of two rigidly regimented shapes. The value of doing so is that algorithms can then assume a fixed structure, and that both existence proofs are constructive.
Definition 1.47 (Literal, clause, term, CNF, DNF). A literal is an atom or a negated atom ; the two are complementary. A clause is a disjunction of finitely many literals; a term is a conjunction of finitely many literals. A formula is in conjunctive normal form (CNF) if it is a conjunction of clauses, and in disjunctive normal form (DNF) if it is a disjunction of terms. The empty clause, written , is a disjunction of no literals and is false under every valuation; the empty term is true under every valuation.
Definition 1.48 (Negation normal form). A formula is in negation normal form (NNF) if it is built from literals, and using and only — in particular, negation appears only directly in front of atoms.
Theorem 1.49 (Existence of normal forms). Every formula is logically equivalent to one in CNF and to one in DNF.
Proof. Let have atoms and let be its truth function.
For DNF: if is identically , take the term . Otherwise the formula built in the proof of Theorem Functional completeness of the standard set is a disjunction of terms equivalent to — this is the full DNF, one term per satisfying row.
For CNF, apply the same construction to to get a DNF , so . Pushing the negation inward with De Morgan from Theorem The basic equivalences turns the disjunction of terms into a conjunction of clauses: each term becomes the clause , where is the complement of . The result is a CNF equivalent to with one clause per falsifying row of .∎
Intuition. Read the table twice. A satisfying row says "this exact pattern is allowed": record it as a term, and OR the terms — that is DNF, a list of the permitted worlds. A falsifying row says "this exact pattern is forbidden": record the clause that rules it out, and AND the clauses — that is CNF, a checklist of constraints. DNF answers "is it satisfiable?" at a glance (yes, unless every term is internally contradictory); CNF answers "is it a tautology?" at a glance (yes, unless some clause lacks a complementary pair).
Method 1.50 (Conversion to CNF by rewriting). Rather than build a -row table, rewrite:
- Eliminate using , then using .
- Drive negations inward with De Morgan and until only literals are negated. The formula is now in NNF.
- Distribute over : replace by , and symmetrically on the other side, until no lies below a .
Each step is licensed by Theorem Substitution of equivalents, so the result is equivalent throughout. For DNF, distribute over in step 3 instead.
Theorem 1.51 (The conversion terminates). The rewriting of Recipe Conversion to CNF by rewriting halts on every input, and its output is in CNF.
Proof. Steps 1 and 2 first. Each application of the or rule strictly decreases the number of occurrences of and in the outermost position and introduces none of higher rank, so measuring by the multiset of ranks of remaining and occurrences gives a strictly decreasing well-founded measure; step 1 halts. In step 2, assign to each formula the measure over occurrences of of the rank of the subformula it governs. De Morgan replaces one negation of rank by two of rank , dropping the sum, and removes two negations outright. Since is a natural number and strictly decreases, step 2 halts, and it can only halt when every governs a rank- subformula, i.e. an atom — that is NNF.
For step 3, define for an NNF formula the measure = the number of terminal positions in the distributive expansion, by for a literal, , and . Applying the distributive rule to replaces a subformula of measure by one of measure — equal. So alone does not decrease; instead use the pair ordered lexicographically, where counts occurrences of that lie in the scope of some . The rewrite leaves unchanged and strictly decreases , since the rewritten moves to the top of that subformula and no enters the scope of a new . Hence step 3 halts, and it halts only when no is under a — which for an NNF formula means a conjunction of disjunctions of literals, i.e. CNF.∎
Theorem 1.52 (Normal forms can be exponentially large). For each , the DNF formula
has no equivalent CNF with fewer than clauses.
Proof. Let be a CNF equivalent to . For each define the valuation that sets, in the -th pair, the variable selected by to and the other to — so fails for every and . Hence falsifies some clause of .
We claim must contain, for every , a literal made false by from the -th pair — indeed contains only literals false under , and we claim it mentions all pairs. Suppose it omits pair entirely. Modify to by setting both and to . This changes no literal of , so still falsifies and hence ; but , so , contradicting . So mentions every pair, and the literals it contains from pair are exactly those false under , which identifies . Therefore is injective, and has at least clauses.∎
Theorem 1.53 (Tseitin transformation). For every formula there is a CNF formula , computable in time linear in and of size , such that and are equisatisfiable: is satisfiable if and only if is.
Proof. Introduce a fresh atom for each non-atomic subformula of . For each such with principal connective and immediate constituents , write down the CNF of the biconditional , where is itself if is a literal and otherwise. Each such biconditional involves at most three atoms, so its CNF has at most four clauses of at most three literals — a constant per subformula. Let be the conjunction of all of these together with the unit clause .
If , extend by setting for each subformula; every biconditional then holds by construction and is true, so is satisfiable. Conversely, if , an induction on rank using the biconditionals shows for every subformula ; the clause then gives . Size and time are linear because has at most subformulas and each contributes a bounded number of clauses.∎
Pitfall. Equisatisfiable is weaker than equivalent, and Theorem Normal forms can be exponentially large is why we settle for it. has extra atoms and is not logically equivalent to — it has different models, over a larger vocabulary. Never use a Tseitin encoding to answer a question about equivalence, model counting, or entailment of the original formula without first projecting away the auxiliary atoms.
Example 1.54 (CNF by rewriting). Convert to CNF.
Solution. Eliminate the implication: . Distribute over with , , :
Check against the table: the original is false exactly when and at least one of is ; the CNF fails exactly when and , or and — the same three rows. Note that this CNF has two clauses while the full CNF read off the table by Theorem Existence of normal forms would have three, one per falsifying row. Both are CNFs of the same formula, which is uniqueness failing exactly as advertised: rewriting produces a shorter form than the table does. □□
Example 1.55 (Negated biconditional). Convert to CNF and to DNF.
Solution. DNF first: is true exactly on the rows and , so the full DNF is .
For CNF, apply the recipe to the DNF: distributing over twice gives . The first and last clauses each contain a complementary pair and so are tautologous; dropping them leaves
The reading is exactly right: forbids both-false and forbids both-true, leaving the two rows where they differ. □□
Example 1.56 (Counting the clauses in advance). Without converting, how many clauses does the full CNF of have?
Solution. By the proof of Theorem Existence of normal forms the full CNF has one clause per falsifying row. Three-way exclusive or is true exactly when an odd number of its arguments are true, so it is false on the four rows with an even number of ones: , , , . Hence the full CNF has clauses, each with literals. □□
1.6Resolution and Compactness
Everything so far decides questions by consulting valuations. Resolution replaces that with a single syntactic rule, applied until nothing new appears. It is the engine inside every modern SAT solver, and the theorem that makes it trustworthy is that it can refute every unsatisfiable clause set and only unsatisfiable ones.
Definition 1.57 (Clauses as sets, resolvent). Identify a clause with the finite set of its literals, so that order, repetition and grouping are immaterial and the empty clause is . If and are clauses with and , their resolvent on is
A resolution derivation of from a clause set is a finite sequence of clauses ending in , each of which is in or is a resolvent of two earlier ones. A refutation of is a derivation of .
Theorem 1.58 (Soundness of resolution). If is a resolvent of and , then . Consequently, if has a resolution refutation then is unsatisfiable.
Proof. Let and let be a model of and . Consider . If then falsifies the literal , so to satisfy it must satisfy some literal of . If then falsifies , so to satisfy it must satisfy some literal of . Either way .
Now suppose has a refutation. An induction along the derivation, using the case just proved at each resolution step, shows every clause in it is entailed by . In particular . But is false under every valuation, so has no model.∎
Theorem 1.59 (Refutation completeness). Let be a finite set of clauses over finitely many atoms. If is unsatisfiable then has a resolution refutation.
Proof. Induct on the number of atoms occurring in .
If , the only clause available is itself, and a clause set with no atoms is unsatisfiable only if — a refutation of length one.
Let , pick an atom of , and form two clause sets. Let be obtained by deleting every clause containing and deleting the literal from the clauses that remain; let be obtained symmetrically, deleting clauses containing and removing from the rest. Both are clause sets over the remaining atoms. is exactly the residue of under the assumption , and the residue under ; since is unsatisfiable, neither residue is satisfiable — a model of over the other atoms would extend, by setting to , to a model of , and likewise for with set to .
By the induction hypothesis has a refutation and has a refutation . Reinstate the deleted literals: replaying on the original clauses of yields a derivation from of either — in which case we are done — or the unit clause , since the only literal that could have been dropped along the way is . Symmetrically yields from either or . In the remaining case we have derived both and from , and one further resolution step on produces . Concatenating the two replayed derivations and that final step is a refutation of .∎
Intuition. The induction is a case split done once and for all: "suppose is true — then these clauses survive, and they are already contradictory; suppose is false — likewise". Resolution is the bookkeeping that turns those two sub-refutations into one, and the final step on and is where the two branches are glued. This is precisely the shape of the DPLL algorithm, which is why DPLL runs can be read off as resolution proofs.
Example 1.60 (A refutation). Refute .
Solution. Resolve with on to get . Resolve that with on to get (the two copies of collapse, since a clause is a set). Resolve with on to get . Four input clauses, three resolution steps.
By Theorem Soundness of resolution the existence of this refutation proves unsatisfiable, and by Theorem The refutation principle it also proves — a proof by cases, mechanised. □□
Refutation completeness was stated for finitely many atoms. Extending it to infinite clause sets needs the following theorem, which is the one genuinely infinitary result in propositional logic and the source of its power in applications.
Theorem 1.62 (Compactness). A set of formulas is satisfiable if and only if every finite subset of is satisfiable.
Proof. () A model of models each of its subsets.
() Assume every finite subset of is satisfiable; call such a finitely satisfiable. Suppose first that the language is countable, with atoms , and build a valuation one atom at a time. Set , and having a finitely satisfiable , define
The second branch is legitimate: if both and failed to be finitely satisfiable, there would be finite with and unsatisfiable. Then is a finite subset of , hence has a model ; but is either , making a model of , or , making it a model of . Either way a contradiction. So is finitely satisfiable, and by induction every is.
Let and define if and otherwise. We claim . Let and let be its atoms, with larger than every . The set , where is whichever of was placed into , is a finite subset of and so has a model . Each forces for all , so and agree on , and Lemma Relevance gives .
For an uncountable language the same construction runs, but the atoms cannot be enumerated in order type . One instead applies Zorn's lemma to the family of finitely satisfiable extensions of , ordered by inclusion — the union of a chain of finitely satisfiable sets is finitely satisfiable, since any finite subset of the union already lies in one member — to obtain a maximal finitely satisfiable , and reads the valuation off it exactly as above. That this use of choice is genuinely needed is a result of set theory outside this chapter: compactness for propositional logic is equivalent, over ZF, to the Boolean prime ideal theorem, which is strictly weaker than the axiom of choice.∎
Corollary 1.63 (Compactness for entailment). If then for some finite .
Proof. By Theorem The refutation principle, is unsatisfiable. By Theorem Compactness some finite subset is unsatisfiable. Put , which is finite. Then is unsatisfiable, so by the refutation principle again .∎
Example 1.64 (Compactness at work: colouring an infinite graph). Let be an infinite graph every finite subgraph of which is -colourable. Show is -colourable.
Solution. For each vertex and colour introduce an atom meaning " has colour ". Let contain, for every vertex , the clause and the three clauses for ; and for every edge and colour , the clause . A model of is exactly a proper -colouring of .
Any finite mentions finitely many vertices; the finite subgraph they span is -colourable by hypothesis, and that colouring, extended arbitrarily elsewhere, models . So is finitely satisfiable, and Theorem Compactness gives it a model — a -colouring of all of . □□
Pitfall. Compactness does not say a satisfiable set has a finite model, nor that an infinite set of formulas is equivalent to a finite one. It says only that unsatisfiability is always witnessed by a finite part. Nor does it survive the move to "at most finitely many atoms are true", which is not expressible by any set of propositional formulas — compactness is precisely the obstruction, as the finitely satisfiable set would show.
1.7A Proof Calculus and Its Soundness
Resolution is a refutation system: it shows things impossible. A proof calculus does the complementary job, generating theorems directly from axioms by rules. The classical example is a Hilbert-style system, which buys a tiny set of rules at the cost of long derivations, and whose analysis is correspondingly clean.
Definition 1.65 (The Hilbert calculus ). Work in the language with and only, which is functionally complete by Corollary Smaller complete sets. The axioms of are all formulas of the three schemes
for arbitrary formulas . The single rule is modus ponens: from and infer .
Definition 1.66 (Derivation). A derivation of from is a finite sequence with in which each is an axiom, a member of , or follows from two earlier entries by modus ponens. We write , and when . is consistent if , equivalently if there is no with and .
Theorem 1.67 (Soundness). If then . In particular every theorem of is a tautology, and every satisfiable set is consistent.
Proof. Induct on the length of a derivation of from , showing for each .
If then every model of satisfies it. If is an axiom, it is a tautology: by Theorem Uniform substitution preserves tautologies it is enough to check the three schemes with atoms substituted for . (A1) fails only if and is , which needs — impossible. (A2) fails only if is , is and is ; the last forces , then the second forces , then the first gives true with — impossible. (A3) fails only if is and is ; the latter forces , so and , making false — impossible. A tautology is entailed by anything.
If comes by modus ponens from and with , let . By the induction hypothesis and , and the truth table of forces .
For the last claim. If has a model and , then , which is false.∎
Theorem 1.68 (Deduction theorem). if and only if .
Proof. () Given a derivation of from , append (available as a hypothesis) and then by modus ponens.
() Induct on the length of a derivation from , proving for each .
If is an axiom or lies in , derive it, then take the (A1) instance and apply modus ponens to get . If is itself we need , which is Example Deriving the identity below.
If follows by modus ponens from and , the induction hypothesis supplies and . The (A2) instance
then yields by one modus ponens, and a second modus ponens with gives .∎
Example 1.69 (Deriving the identity). Show in , using no hypotheses.
Solution. Take the (A2) instance with and :
- — (A2).
- — (A1) with .
- — modus ponens on 1 and 2.
- — (A1) with .
- — modus ponens on 3 and 4.
Five lines for the most obvious statement in logic. That is the characteristic trade of a Hilbert system: almost no rules to verify in the soundness proof, and almost no comfort in use. □□
Example 1.70 (The deduction theorem earning its keep). Derive the transitivity of implication, .
Solution. By Theorem Deduction theorem applied three times, it suffices to show
That is two lines: from and , modus ponens gives ; from and , modus ponens gives . Unwinding the deduction theorem mechanically turns those two lines into the required axiomatic derivation. Proving the same formula directly from the three schemes takes well over a dozen lines. □□
Theorem 1.71 (Completeness). If then . Equivalently, every consistent set of formulas is satisfiable.
Proof. Sketch. The two statements are interchangeable via Theorem The refutation principle and Theorem Deduction theorem, so we sketch the second, which is the Henkin–Lindenbaum argument.
Let be consistent. First extend it to a maximal consistent set : enumerate the formulas and add each one if doing so preserves consistency, taking the union at the end; for uncountable languages, Zorn's lemma supplies the maximal element. Maximality gives the key properties, each proved from the axioms: for every , exactly one of lies in ; and iff ( or ).
Now define iff . An induction on rank, using exactly those two properties at the two connectives, shows iff for every formula. Since , models .
What this sketch omits is the derivation, inside , of the lemmas that make the maximal set behave — chiefly and the reductio rule "if is inconsistent then ", both of which need (A3) and several applications of Theorem Deduction theorem.∎
Corollary 1.72 (Compactness, again). If every finite subset of is satisfiable, then is satisfiable.
Proof. Suppose is unsatisfiable. By Theorem Completeness it is inconsistent, so . A derivation is a finite sequence and therefore uses only finitely many members of ; let be that finite set, so . By Theorem Soundness is unsatisfiable, exhibiting an unsatisfiable finite subset.∎
Intuition. Read the corollary's proof again and notice where the work happens: the only property of it uses is that derivations are finite objects. Completeness converts a semantic fact (no model) into a syntactic one (a proof), finiteness of proofs is then free, and soundness converts back. That is the standard shape of a compactness argument throughout logic, and it is why compactness is usually said to be a corollary of completeness even though Theorem Compactness above proves it directly.
Pitfall. and are different relations proved coextensive by two theorems, and each theorem does real work in one direction only. Soundness is what stops the calculus from proving falsehoods; completeness is what stops it from being too weak. Dropping (A3) from Definition The Hilbert calculus leaves a sound system — it is the positive implicational fragment — that is no longer complete, since it cannot prove . Soundness alone never licenses writing where you have only established , or the reverse.
- Reading as causation or relevance. is the truth function that fails only on , . "If then the moon is cheese" is true. Vacuous truth is a feature of the definition, not a paradox to be resolved.
- Confusing with , or with . The first is a connective inside a formula; the others are relations asserted about formulas. Theorem Semantic deduction theorem and Theorem Deduction theorem say how they correspond — which is exactly why they are not the same thing.
- Affirming the consequent and denying the antecedent. From and nothing follows about ; from and nothing follows about . In both cases the valuation satisfies the premises and refutes the proposed conclusion.
- Converse for contrapositive. is equivalent to and not to . The two mistakes look alike on the page and differ on two rows of four.
- Forgetting that is right-associative. means . It is one of the few places where a convention, not a theorem, determines the answer.
- Treating a normal form as unique. Theorem Existence of normal forms gives existence, not uniqueness; , and are all CNFs of the same formula. Only the full CNF or DNF over a fixed atom set, one clause or term per row, is canonical.
- Confusing equisatisfiable with equivalent. A Tseitin encoding preserves satisfiability and nothing else. Model counts, entailments and equivalences must be read off the original formula.
- Stopping a tautology check early. A formula is a tautology only if every row is true and every branch of the falsification shortcut closes. One surviving branch is a counterexample; finding one true row proves only satisfiability.
- Expecting compactness to produce finite models. Theorem Compactness concludes that a model exists, over the same infinite vocabulary. It says nothing about its size, and its real content is that unsatisfiability is always finitely witnessed.