The Samson-Mills-Quine theorem Intermediate Logic The dnf simplification procedure can greatly simplify the complexity of truth-functional formulas, but it does not always turn up a simplest possible Boolean equivalent of a formula. The formula, (p q) ( p q) (q r) ( q r) is an illustrative example. It cannot be further simplified by applying any of the four transformations of the dnf simplification procedure, yet the dnf formula (p q) (q r) ( p r) is truth-functionally equivalent to it and simpler. This note describes a method for finding, for any truth functional formula, a simplest Boolean equivalent. The method is a modification, due to the American logician W. V. O. Quine, of a procedure for electrical circuit minimization discovered by E. W. Samson and B. E. Mills. The proof that the method works is essentially Quine s. It is evident from the above example why the dnf simplification procedure fails to generate the a simplest possible equivalent. That procedure allows one only ever to erase literals or clauses of a pre-recorded formula, while the second formula above contains a clause (the third) that is not a sub-formula of any of the first formula s clauses. One might reasonably wonder where that clause came from, and how one might discover it. To address that wonder, it is helpful to reflect a bit on some basic properties of dnf formulas. Every disjunct of a disjunction implies the whole disjunction. This fact is evident from the definition of disjunction. In particular, then, every clause of a dnf formula implies the whole formula. Inspired by this observation, let us define successively 1
1. a conjunction block to be a formula that is a conjunction of literals, in which no literal occurs twice 2. an implicant of a formula to be a conjunction block that implies that formula 3. two conjunction blocks are opposed in a sentence letter if that sentence letter appears as a conjunct of one and its negation appears as a conjunct of the other 4. one conjunction block subsumes another if they are opposed in no sentence letter, and every conjunct of the second is also a conjunct of the first 5. a prime implicant of a formula φ to be an implicant of φ that subsumes no other implicant of φ. It is immediately clear that any simplest dnf equivalent of a formula φ will be a disjunction of prime implicants of φ, for if one disjunct of a dnf formula failed to be prime, then the fourth transformation of the dnf simplification procedure would be applicable, in effect replacing that disjunct with one that it subsumes (i.e., a shorter one). Thus, the dnf simplification procedure can be seen as a way of reducing any dnf formula to an equivalent dnf formula that is a disjunction of some of its prime implicants. It fails to reliably generate a simplest possible dnf equivalent because there may be other prime implicants which, if appended to the formula as additional disjuncts, would allow a greater number of clauses to be erased. The above example illustrates this general phenomenon. Since (p q) ( p q) (q r) ( q r) cannot be further simplified by the dnf simplification procedure, all of its clauses must be prime implicants. But one can verify that the formulas p r and p r are also prime implicants, so that the formula (p q) ( p q) (q r) ( q r) (p r) ( p r) is equivalent to the original formula. Clearly, the fifth and sixth clauses of this new formula could now be erased by successive applications of rule three (each implies the original four clause formula, and thus the fifth implies 2
the result of deleting itself from the new six clause formula, and the sixth similarly implies the result of deleting itself from the resulting five clause formula.) But applying rule three differently allows one instead to preserve the sixth clause and erase the second, fourth and fifth, resulting in (p q) (q r) ( p r). Exercise: The last formula is indeed a simplest possible equivalent of the original one. There is another equally simple equivalent. Find it by choosing a different sequence of applications of rule three. Now, a satisfiable formula φ is equivalent to the disjunction of all its prime implicants (an unsatisfiable formula has no prime implicants, and gets obliterated by the dnf simplification procedure anyway.) For φ is implied by each of its prime implicants, so it is implied by their disjunction. And conversely, every interpretation that satisfies φ satisfies some conjunction block that implies φ and thus also some prime implicant of φ. Therefore every interpretation that satisfies φ satisfies also the disjunction of its prime implicants. Thus, to find a simplest dnf equivalent of a formula, is suffices to find all of its prime implicants. Is this a coherent task? One might wonder whether every truth functional formula has prime implicants and whether, assuming that a formula φ does have prime implicants, whether it might have infinitely many such. But these wonders subside when we observe, first, that the truth table of a satisfiable formula indicates some of its implicants (in each row of the table where φ is true, the list of T s and F s in the reference columns describe how to build an implicant of φ: conjoin all the sentence letters interpreted as T with the negation of all sentence letters interpreted as F if these implicants aren t prime, then some sub-formulas of them are), and second, that prime implicants can contain neither two occurrences of the same sentence letter nor any sentence letter that doesn t appear in φ (if a conjunction block contains both p and p, then it is unsatisfiable and therefore does not qualify as an implicant any dnf formula with such a block as one of its clauses is equivalent to the formula that results when that clause is erased). The method of Samson and Mills is an algorithm for finding all of the prime implicants of a dnf formula. To describe it, we need one more definition: 3
6 If two conjunction blocks φ and ψ are opposed in exactly one sentence letter, then their consensus is the result of deleting the two opposed literals and all repeated literals from φ ψ Notice that the consensus of two conjunction blocks is another conjunction block. Our algorithm has only two transformation rules: i Erase any clause of φ that subsumes another. ii Adjoin to φ as an additional clause the consensus of any two clauses whose consensus doesn t subsume a clause that s already present. Observe that these two transformations, applied to a dnf formula φ, preserve the property of being in dnf and also preserve equivalence. The Samson-Mills-Quine theorem says that successive applications of these two rules will inevitably result in a formula that is the disjunction of all the prime implicants of φ. Proof: The theorem is a consequence of three lemmas. Lemma 1: A dnf formula φ remains susceptible to transformation (ii) so long as some prime implicant of it is not among its clauses. Lemma 2: A dnf formula φ remains susceptible either to transformation (i) or to transformation (ii) or to both so long as some clause of it is not one of its prime implicants. Lemma 3: It is not possible to apply transformations (i) and (ii) indefinitely. Thus, no matter how one applies the transformations (i) and (ii) to a formula φ, eventually one will reach a point where it is not possible to do anything more, and at that point, all and only prime implicants of φ will appear as clauses of the dnf equivalent of φ that one has produced. To prove the first lemma, let χ be a prime implicant of φ not appearing as a clause of φ. (Notice that, for there to be such, φ cannot be valid.) Since χ is prime, it subsumes no clause of φ. Therefore there is at least one conjunction block with these three properties: 4
a it subsumes X b it subsumes no clause of φ c it contains no letter not in φ (After all, χ itself is such a formula.) Let ψ be a longest such conjunction block. (Should one think that, for any conjunction block with these three properties, there is another that is larger still, observe that there are only finitely many sentence letters in φ, and that no implicant of φ can contain a sentence letter other than one of these and still be prime.) Notice that ψ does not contain every sentence letter in φ for if it did, then by (b), it would oppose every clause of φ in at least one letter and thus not imply φ, contradicting (a). Let p be a sentence letter contained by φ but not by ψ. Since ψ was a longest formula with properties (a), (b), and (c), the formulas p ψ and p ψ cannot satisfy all three properties. But both these formulas clearly satisfy (a) and (c), so they must both fail (b). Thus there are clauses C 1 and C 2 of φ subsumed respectively by p ψ and p ψ, although ψ subsumes neither. So C 1 must contain p; C 2, p. Since all their other literals are in ψ, C 1 and C 2 cannot be opposed in any letter other than p, though they must each contain letters other than p in order that φ not be valid. i.e., C 1 and C 2 have a consensus. Call it ω. Observe that ω subsumes no clause of φ, for ψ subsumes ω and ψ doesn t (by (b)). φ is therefore susceptible to transformation (ii). To prove lemma 2, let C be the clause of φ that is not one of its prime implicants. Becase φ in in dnf, C is one of its implicants. But C is not itself prime, so C subsumes some prime implicant χ of φ. Is χ already a clause of φ? If so, then it is possible to apply transformation (i) to φ by erasing C. If not, then not all of φ s prime implicants appear as clauses of φ, and therefore φ is susceptible to transformation (ii), by lemma 1. Lemma 3 is proved with two observations. First, only a finite number of clauses can ever be appended with applications of transformation (ii), and no one of these can ever be appended twice. The number of append-able clauses is finite, because any such clause will have to be built up from sentence letters appearing in the original φ. No clause can be twice appended because, at any time one considers appending 5
a clause for the second time, either it will already appear in the formula or, if it doesn t, it will have once appeared but since been erased. In the latter case, some clause still in the current formula will necessarily be subsumed by the clause. In neither case is transformation (ii) applicable. Second, the subtractive nature of transformation (i) delimits the number of times it can be applied. For after one has applied transformation (ii) for the last time, which time one must reach eventually in light of the last observation, one can apply transformation (i) at most as many times as there are clauses in the current formula. This completes the proof of the Samson-Mills-Quine theorem. Notice how unhelpful the proof is: It sheds no light on how one might best go about applying the transformations in order to attain prime implicants and obliterate other clauses expeditiously. In fact, it is not at all clear from the proof why it is that prime implicants turn up as the algorithm runs. The consensus of two clauses might be prime, but more often it will not be it will generally even be longer than both of the clauses it is the consensus of. The theorem seems almost miraculous, and, for this reason, I allege that the proof is worth some philosophical attention. Indeed, a ballistic application of the transformation rules might be very inefficient. They are not set-up for efficiency, but to make the proof as transparent as possible. However, one can approach the task of finding all of a formula s prime implicants prudently, by conjoining the second transformation rule with the original rules from the dnf simplification procedure. More precisely, if one simplifies a dnf formula as much as possible with the old procedure, then one will be left with a disjunction, each clause of which is a prime implicant. To find the remaining implicants, a relatively small number of consensus taking measures need to be done. Indeed, this is how the fifth and sixth clauses ( p r and p r ) in the above example were generated. In the formula: (p q) ( p q) (q r) ( q r), p r is the consensus of the first and third clauses, and p r is the consensus of the second and fourth. After these two clauses are appended to yield (p q) ( p q) (q r) ( q r) (p r) ( p r), consensuses of new pairs of clauses (the second and fifth, as well as the third and sixth) can be taken, but further application of transformation (ii) is 6
nevertheless impossible because these consensuses already appear as clauses (as the third and second). Thus we can be assured that the last formula is a disjunction of all its own prime implicants. This whole enterprise of consensus taking appears to be overly complex and unnecessary when one observes a more easily describable way to generate a list of all a formula s prime implicants. Any prime implicant of φ must be built out of sentence letters appearing in φ, and there are only finitely many conjunction blocks built out of these sentence letters. One could simply write down all the possible conjunction blocks, test each to see if it is an implicant, and then pare down the list of implicants by checking for pairwise subsumption. The problem with this procedure is that the number of conjunction blocks to consider is super-exponential in the number of sentence letters that appear in the formula. More precisely, for a formula with n sentence letters, one must check n i=0 ( n i) (2 i ) conjunction blocks. Thus, for example, with seven sentence letters, one must check 2186 conjunction blocks. An efficient use of the consensus method would turn up those prime implicants in much less computation time than would the brute force checking method. On the other hand, it is conceivable that a method might be discovered for finding simplest dnf equivalents that bypasses any need to find all prime implicants. The sheer number of a formula s prime implicants can itself be exponential in the number of the formula s sentence letters (according to an analysis of a seven switch Boolean circuit by Fridshal, as many as 1698 different formulas could be prime implicants of a seven letter formula). A direct simplification method that bypasses any need to consider exponentially more data than a given formula contains would be a discovery of great practical and theoretical interest. 7