27.7 KB · commit a9602da
An important type of step used in a mathematical argument is the replacement of a statement with another statement with the same truth value. Because of this, methods that produce propositions with the same truth value as a given compound proposition are used extensively in the construction of mathematical arguments. Note that we will use the term "compound proposition" to refer to an expression formed from propositional variables using logical operators, such as p∧q.
We begin our discussion with a classification of compound propositions according to their possible truth values.
Tautologies and contradictions are often important in mathematical reasoning. Example 1 illustrates these types of compound propositions.
We can construct examples of tautologies and contradictions using just one propositional variable. Consider the truth tables of p∨¬p and p∧¬p, shown in Table 1. Because p∨¬p is always true, it is a tautology. Because p∧¬p is always false, it is a contradiction. ◀
| p | ¬p | p∨¬p | p∧¬p |
|---|---|---|---|
| T | F | T | F |
| F | T | T | F |
Compound propositions that have the same truth values in all possible cases are called logically equivalent. We can also define this notion as follows.
One way to determine whether two compound propositions are equivalent is to use a truth table. In particular, the compound propositions p and q are equivalent if and only if the columns giving their truth values agree. Example 2 illustrates this method to establish an extremely important and useful logical equivalence, namely, that of ¬(p∨q) with ¬p∧¬q. This logical equivalence is one of the two De Morgan laws, shown in Table 2, named after the English mathematician Augustus De Morgan, of the mid-nineteenth century.
¬(p∧q)≡¬p∨¬q ¬(p∨q)≡¬p∧¬q
Show that ¬(p∨q) and ¬p∧¬q are logically equivalent.
Solution: The truth tables for these compound propositions are displayed in Table 3. Because the truth values of the compound propositions ¬(p∨q) and ¬p∧¬q agree for all possible combinations of the truth values of p and q, it follows that ¬(p∨q)↔(¬p∧¬q) is a tautology and that these compound propositions are logically equivalent. ◀
| p | q | p∨q | ¬(p∨q) | ¬p | ¬q | ¬p∧¬q |
|---|---|---|---|---|---|---|
| T | T | T | F | F | F | F |
| T | F | T | F | F | T | F |
| F | T | T | F | T | F | F |
| F | F | F | T | T | T | T |
Show that p→q and ¬p∨q are logically equivalent.
Solution: We construct the truth table for these compound propositions in Table 4. Because the truth values of ¬p∨q and p→q agree, they are logically equivalent. ◀
| p | q | ¬p | ¬p∨q | p→q |
|---|---|---|---|---|
| T | T | F | T | T |
| T | F | F | F | F |
| F | T | T | T | T |
| F | F | T | T | T |
We will now establish a logical equivalence of two compound propositions involving three different propositional variables p, q, and r. To use a truth table to establish such a logical equivalence, we need eight rows, one for each possible combination of truth values of these three variables. We symbolically represent these combinations by listing the truth values of p, q, and r, respectively. These eight combinations of truth values are TTT, TTF, TFT, TFF, FTT, FTF, FFT, and FFF; we use this order when we display the rows of the truth table. Note that we need to double the number of rows in the truth tables we use to show that compound propositions are equivalent for each additional propositional variable, so that 16 rows are needed to establish the logical equivalence of two compound propositions involving four propositional variables, and so on. In general, 2n rows are required if a compound proposition involves n propositional variables.
| p | q | r | q∧r | p∨(q∧r) | p∨q | p∨r | (p∨q)∧(p∨r) |
|---|---|---|---|---|---|---|---|
| T | T | T | T | T | T | T | T |
| T | T | F | F | T | T | T | T |
| T | F | T | F | T | T | T | T |
| T | F | F | F | T | T | T | T |
| F | T | T | T | T | T | T | T |
| F | T | F | F | F | T | F | F |
| F | F | T | F | F | F | T | F |
| F | F | F | F | F | F | F | F |
Show that p∨(q∧r) and (p∨q)∧(p∨r) are logically equivalent. This is the distributive law of disjunction over conjunction.
Solution: We construct the truth table for these compound propositions in Table 5. Because the truth values of p∨(q∧r) and (p∨q)∧(p∨r) agree, these compound propositions are logically equivalent. ◀
Table 6 contains some important equivalences. In these equivalences, T denotes the compound proposition that is always true and F denotes the compound proposition that is always false. We also display some useful equivalences for compound propositions involving conditional statements and biconditional statements in Tables 7 and 8, respectively. The reader is asked to verify the equivalences in Tables 6–8 in the exercises.
| Equivalence | Name |
|---|---|
| p∧T≡p p∨F≡p | Identity laws |
| p∨T≡T p∧F≡F | Domination laws |
| p∨p≡p p∧p≡p | Idempotent laws |
| ¬(¬p)≡p | Double negation law |
| p∨q≡q∨p p∧q≡q∧p | Commutative laws |
| (p∨q)∨r≡p∨(q∨r) (p∧q)∧r≡p∧(q∧r) | Associative laws |
| p∨(q∧r)≡(p∨q)∧(p∨r) p∧(q∨r)≡(p∧q)∨(p∧r) | Distributive laws |
| ¬(p∧q)≡¬p∨¬q ¬(p∨q)≡¬p∧¬q | De Morgan's laws |
| p∨(p∧q)≡p p∧(p∨q)≡p | Absorption laws |
| p∨¬p≡T p∧¬p≡F | Negation laws |
| TABLE 7 Logical Equivalences Involving Conditional Statements. |
|---|
| p→q≡¬p∨q |
| p→q≡¬q→¬p |
| p∨q≡¬p→q |
| p∧q≡¬(p→¬q) |
| ¬(p→q)≡p∧¬q |
| (p→q)∧(p→r)≡p→(q∧r) |
| (p→r)∧(q→r)≡(p∨q)→r |
| (p→q)∨(p→r)≡p→(q∨r) |
| (p→r)∨(q→r)≡(p∧q)→r |
| TABLE 8 Logical Equivalences Involving Biconditional Statements. |
|---|
| p↔q≡(p→q)∧(q→p) |
| p↔q≡¬p↔¬q |
| p↔q≡(p∧q)∨(¬p∧¬q) |
| ¬(p↔q)≡p↔¬q |
The associative law for disjunction shows that the expression p∨q∨r is well defined, in the sense that it does not matter whether we first take the disjunction of p with q and then the disjunction of p∨q with r, or if we first take the disjunction of q and r and then take the disjunction of p with q∨r. Similarly, the expression p∧q∧r is well defined. By extending this reasoning, it follows that p1∨p2∨⋯∨pn and p1∧p2∧⋯∧pn are well defined whenever p1,p2,…,pn are propositions.
Furthermore, note that De Morgan's laws extend to ¬(p1∨p2∨⋯∨pn)≡(¬p1∧¬p2∧⋯∧¬pn) and ¬(p1∧p2∧⋯∧pn)≡(¬p1∨¬p2∨⋯∨¬pn).
We will sometimes use the notation ⋁j=1npj for p1∨p2∨⋯∨pn and ⋀j=1npj for p1∧p2∧⋯∧pn. Using this notation, the extended version of De Morgan's laws can be written concisely as ¬(j=1⋁npj)≡j=1⋀n¬pjand¬(j=1⋀npj)≡j=1⋁n¬pj. (Methods for proving these identities will be given in Section 5.1.)
The two logical equivalences known as De Morgan's laws are particularly important. They tell us how to negate conjunctions and how to negate disjunctions. In particular, the equivalence ¬(p∨q)≡¬p∧¬q tells us that the negation of a disjunction is formed by taking the conjunction of the negations of the component propositions. Similarly, the equivalence ¬(p∧q)≡¬p∨¬q tells us that the negation of a conjunction is formed by taking the disjunction of the negations of the component propositions. Example 5 illustrates the use of De Morgan's laws.
Use De Morgan's laws to express the negations of "Miguel has a cellphone and he has a laptop computer" and "Heather will go to the concert or Steve will go to the concert."
Solution: Let p be "Miguel has a cellphone" and q be "Miguel has a laptop computer." Then "Miguel has a cellphone and he has a laptop computer" can be represented by p∧q. By the first of De Morgan's laws, ¬(p∧q) is equivalent to ¬p∨¬q. Consequently, we can express the negation of our original statement as "Miguel does not have a cellphone or he does not have a laptop computer."
Let r be "Heather will go to the concert" and s be "Steve will go to the concert." Then "Heather will go to the concert or Steve will go to the concert" can be represented by r∨s. By the second of De Morgan's laws, ¬(r∨s) is equivalent to ¬r∧¬s. Consequently, we can express the negation of our original statement as "Heather will not go to the concert and Steve will not go to the concert." ◀
The logical equivalences in Table 6, as well as any others that have been established (such as those shown in Tables 7 and 8), can be used to construct additional logical equivalences. The reason for this is that a proposition in a compound proposition can be replaced by a compound proposition that is logically equivalent to it without changing the truth value of the original compound proposition. This technique is illustrated in Examples 6–8, where we also use the fact that if p and q are logically equivalent and q and r are logically equivalent, then p and r are logically equivalent (see Exercise 56).
Show that ¬(p→q) and p∧¬q are logically equivalent.
Solution: We could use a truth table to show that these compound propositions are equivalent (similar to what we did in Example 4). Indeed, it would not be hard to do so. However, we want to illustrate how to use logical identities that we already know to establish new logical identities, something that is of practical importance for establishing equivalences of compound propositions with a large number of variables. So, we will establish this equivalence by developing a series of logical equivalences, using one of the equivalences in Table 6 at a time, starting with ¬(p→q) and ending with p∧¬q. We have the following equivalences.
¬(p→q)≡¬(¬p∨q)≡¬(¬p)∧¬q≡p∧¬qby Example 3by the second De Morgan lawby the double negation law◀
Show that ¬(p∨(¬p∧q)) and ¬p∧¬q are logically equivalent by developing a series of logical equivalences.
Solution: We will use one of the equivalences in Table 6 at a time, starting with ¬(p∨(¬p∧q)) and ending with ¬p∧¬q. (Note: we could also easily establish this equivalence using a truth table.) We have the following equivalences.
¬(p∨(¬p∧q))≡¬p∧¬(¬p∧q)≡¬p∧[¬(¬p)∨¬q]≡¬p∧(p∨¬q)≡(¬p∧p)∨(¬p∧¬q)≡F∨(¬p∧¬q)≡(¬p∧¬q)∨F≡¬p∧¬qby the second De Morgan lawby the first De Morgan lawby the double negation lawby the second distributive lawbecause ¬p∧p≡Fby the commutative law for disjunctionby the identity law for FConsequently ¬(p∨(¬p∧q)) and ¬p∧¬q are logically equivalent. ◀
Show that (p∧q)→(p∨q) is a tautology.
Solution: To show that this statement is a tautology, we will use logical equivalences to demonstrate that it is logically equivalent to T. (Note: This could also be done using a truth table.)
(p∧q)→(p∨q)≡¬(p∧q)∨(p∨q)≡(¬p∨¬q)∨(p∨q)≡(¬p∨p)∨(¬q∨q)≡T∨T≡Tby Example 3by the first De Morgan lawby the associative and commutative laws for disjunctionby Example 1 and the commutative law for disjunctionby the domination law◀
A compound proposition is satisfiable if there is an assignment of truth values to its variables that makes it true. When no such assignments exists, that is, when the compound proposition is false for all assignments of truth values to its variables, the compound proposition is unsatisfiable.
Note that a compound proposition is unsatisfiable if and only if its negation is true for all assignments of truth values to the variables, that is, if and only if its negation is a tautology.
When we find a particular assignment of truth values that makes a compound proposition true, we have shown that it is satisfiable; such an assignment is called a solution of this particular satisfiability problem. However, to show that a compound proposition is unsatisfiable, we need to show that every assignment of truth values to its variables makes it false. Although we can always use a truth table to determine whether a compound proposition is satisfiable, it is often more efficient not to, as Example 9 demonstrates.
Determine whether each of the compound propositions (p∨¬q)∧(q∨¬r)∧(r∨¬p), (p∨q∨r)∧(¬p∨¬q∨¬r), and (p∨¬q)∧(q∨¬r)∧(r∨¬p)∧(p∨q∨r)∧(¬p∨¬q∨¬r) is satisfiable.
Solution: Instead of using truth table to solve this problem, we will reason about truth values. Note that (p∨¬q)∧(q∨¬r)∧(r∨¬p) is true when the three variable p, q, and r have the same truth value (see Exercise 40 of Section 1.1). Hence, it is satisfiable as there is at least one assignment of truth values for p, q, and r that makes it true. Similarly, note that (p∨q∨r)∧(¬p∨¬q∨¬r) is true when at least one of p, q, and r is true and at least one is false (see Exercise 41 of Section 1.1). Hence, (p∨q∨r)∧(¬p∨¬q∨¬r) is satisfiable, as there is at least one assignment of truth values for p, q, and r that makes it true.
Finally, note that for (p∨¬q)∧(q∨¬r)∧(r∨¬p)∧(p∨q∨r)∧(¬p∨¬q∨¬r) to be true, (p∨¬q)∧(q∨¬r)∧(r∨¬p) and (p∨q∨r)∧(¬p∨¬q∨¬r) must both be true. For the first to be true, the three variables must have the same truth values, and for the second to be true, at least one of three variables must be true and at least one must be false. However, these conditions are contradictory. From these observations we conclude that no assignment of truth values to p, q, and r makes (p∨¬q)∧(q∨¬r)∧(r∨¬p)∧(p∨q∨r)∧(¬p∨¬q∨¬r) true. Hence, it is unsatisfiable. ◀
Many problems, in diverse areas such as robotics, software testing, computer-aided design, machine vision, integrated circuit design, computer networking, and genetics, can be modeled in terms of propositional satisfiability. Although most of these applications are beyond the scope of this book, we will study one application here. In particular, we will show how to use propositional satisfiability to model Sudoku puzzles.
A Sudoku puzzle is represented by a 9×9 grid made up of nine 3×3 subgrids, known as blocks, as shown in Figure 1. For each puzzle, some of the 81 cells, called givens, are assigned one of the numbers 1,2,…,9, and the other cells are blank. The puzzle is solved by assigning a number to each blank cell so that every row, every column, and every one of the nine 3×3 blocks contains each of the nine possible numbers. Note that instead of using a 9×9 grid, Sudoku puzzles can be based on n2×n2 grids, for any positive integer n, with the n2×n2 grid made up of n2 n×n subgrids.
FIGURE 1 A 9×9 Sudoku puzzle.
The popularity of Sudoku dates back to the 1980s when it was introduced in Japan. It took 20 years for Sudoku to spread to rest of the world, but by 2005, Sudoku puzzles were a worldwide craze. The name Sudoku is short for the Japanese suuji wa dokushin ni kagiru, which means "the digits must remain single." The modern game of Sudoku was apparently designed in the late 1970s by an American puzzle designer. The basic ideas of Sudoku date back even further; puzzles printed in French newspapers in the 1890s were quite similar, but not identical, to modern Sudoku.
Sudoku puzzles designed for entertainment have two additional important properties. First, they have exactly one solution. Second, they can be solved using reasoning alone, that is, without resorting to searching all possible assignments of numbers to the cells. As a Sudoku puzzle is solved, entries in blank cells are successively determined by already known values. For instance, in the grid in Figure 1, the number 4 must appear in exactly one cell in the second row. How can we determine which of the seven blank cells it must appear? First, we observe that 4 cannot appear in one of the first three cells or in one of the last three cells of this row, because it already appears in another cell in the block each of these cells is in. We can also see that 4 cannot appear in the fifth cell in this row, as it already appears in the fifth column in the fourth row. This means that 4 must appear in the sixth cell of the second row.
Many strategies based on logic and mathematics have been devised for solving Sudoku puzzles (see [Da10], for example). Here, we discuss one of the ways that have been developed for solving Sudoku puzzles with the aid of a computer, which depends on modeling the puzzle as a propositional satisfiability problem. Using the model we describe, particular Sudoku puzzles can be solved using software developed to solve satisfiability problems. Currently, Sudoku puzzles can be solved in less than 10 milliseconds this way. It should be noted that there are many other approaches for solving Sudoku puzzles via computers using other techniques.
To encode a Sudoku puzzle, let p(i,j,n) denote the proposition that is true when the number n is in the cell in the ith row and jth column. There are 9×9×9=729 such propositions, as i, j, and n all range from 1 to 9. For example, for the puzzle in Figure 1, the number 6 is given as the value in the fifth row and first column. Hence, we see that p(5,1,6) is true, but p(5,j,6) is false for j=2,3,…,9.
Given a particular Sudoku puzzle, we begin by encoding each of the given values. Then, we construct compound propositions that assert that every row contains every number, every column contains every number, every 3×3 block contains every number, and each cell contains no more than one number. It follows, as the reader should verify, that the Sudoku puzzle is solved by finding an assignment of truth values to the 729 propositions p(i,j,n) with i, j, and n each ranging from 1 to 9 that makes the conjunction of all these compound propositions true. After listing these assertions, we will explain how to construct the assertion that every row contains every integer from 1 to 9. We will leave the construction of the other assertions that every column contains every number and each of the nine 3×3 blocks contains every number to the exercises.
We now explain how to construct the assertion that every row contains every number.
First, to assert that row i contains the number n, we form ⋁j=19p(i,j,n). To assert that row i contains all n numbers, we form the conjunction of these disjunctions over all nine possible values of n, giving us ⋀n=19⋁j=19p(i,j,n). Finally, to assert that every row contains every number, we take the conjunction of ⋀n=19⋁j=19p(i,j,n) over all nine rows. This gives us ⋀i=19⋀n=19⋁j=19p(i,j,n). (Exercises 65 and 66 ask for explanations of the assertions that every column contains every number and that each of the nine 3×3 blocks contains every number.)
Given a particular Sudoku puzzle, to solve this puzzle we can find a solution to the satisfiability problems that asks for a set of truth values for the 729 variables p(i,j,n) that makes the conjunction of all the listed assertions true.
A truth table can be used to determine whether a compound proposition is satisfiable, or equivalently, whether its negation is a tautology (see Exercise 60). This can be done by hand for a compound proposition with a small number of variables, but when the number of variables grows, this becomes impractical. For instance, there are 220=1,048,576 rows in the truth table for a compound proposition with 20 variables. Clearly, you need a computer to help you determine, in this way, whether a compound proposition in 20 variables is satisfiable.
When many applications are modeled, questions concerning the satisfiability of compound propositions with hundreds, thousands, or millions of variables arise. Note, for example, that when there are 1000 variables, checking every one of the 21000 (a number with more than 300 decimal digits) possible combinations of truth values of the variables in a compound proposition cannot be done by a computer in even trillions of years. No procedure is known that a computer can follow to determine in a reasonable amount of time whether an arbitrary compound proposition in such a large number of variables is satisfiable. However, progress has been made developing methods for solving the satisfiability problem for the particular types of compound propositions that arise in practical applications, such as for the solution of Sudoku puzzles. Many computer programs have been developed for solving satisfiability problems which have practical use. In our discussion of the subject of algorithms in Chapter 3, we will discuss this question further. In particular, we will explain the important role the propositional satisfiability problem plays in the study of the complexity of algorithms.