4. Creating a Truth Table
To begin our construction of a truth table, we need to determine how many rows and columns the table must have.
Rows
The number of rows in a truth table is determined by first looking at the number of distinct atomic sentences are found in the logical statement being evaluated. Since the purpose of a truth table is to evaluate all combinations of TRUEs and FALSEs assigned to each distinct atomic sentence, and since each atomic sentence can only be either true or false, the total number of rows needed in the table to evaluate all combinations in the logical statement is determined by the following expression:
(Possible states for any given atomic sentence) ^ (Number of distinct atomic sentences)
Since, for our purposes, the total number of possible states for any given atomic sentence is always 2, we can easily replace the first part of the expression:
2 ^ (Number of distinct atomic sentences)
A truth table with 1 distinct atomic sentence would have 2^1 rows, or 2 rows; a table with 2 distinct atomic sentences would have 2^2 rows, or 4 rows; a table with 3 distinct atomic sentences would have 2^3 rows, or 8 rows; and so forth. A very complicated logical statement might involve 14 distinct atomic sentences, and so the resulting truth table would have to be 2^14 rows in length, or 16384 rows! In order to preserve the sanity of students and instructors alike, truth tables in this text will not be longer than 2^4, or 16 rows. Put differently, the most complicated logical statements that we will be evaluating over the course of this chapter involve no more than 4 distinct atomic sentences.
What do we mean by distinct atomic sentences? It is entirely possible for any given logical statement to involve multiple instances of an atomic sentence. The function of a truth table is to determine what happens to a logical statement as a whole when each unique idea is assigned a truth value. Since our focus is on evaluating what happens when we assign truth values to the atomic sentences themselves, we do not concern ourselves with how many times a particular atomic sentence might show up in a given logical statement.
(P & Q) -> (P v ~P)
For this logical statement, the atomic sentence P shows up multiple times. However, while there are 4 atomic sentences found in the statement, there are only 2 distinct atomic sentences present. Therefore, we would need to construct a truth table of 4 rows in length to evaluate this logical statement.
Header Row:
The header ‘row’ of the truth table is simply an extra row at the top of the truth table that is used to mark out which column represents which atomic sentence or operator.
Columns:
The number of columns that a truth table may have is determined in a more practical way. Evaluating a truth table means, practically, determining what happens when all possible combinations of truth values for the atomic sentences are inputted into the given logical statement. So, each atomic sentence and logical operator found in the logical statement needs to have its own column, and each distinct atomic sentence needs to have its own column.
Number of columns = number of distinct atomic sentences + number of atomic sentences and logical operators.
The columns of a truth table are divided into two main sections: the first set of columns is always reserved for the distinct atomic sentences found in the logical statement; the second set is comprised of columns for each atomic sentence and logical operator found in the logical statement itself (including any repeated elements). Note that for the first set of columns, the distinct atomic sentences are always presented in alphabetical order, despite however they appear in the logical statement itself.
Example
Now, let us combine these elements to construct the truth table for the following logical statement:
(P & Q) -> P
We should first note the number of distinct atomic sentences found in the statement: in this case, the statement has 2 distinct atomic sentences – P and Q. So, we now know that, excluding the header, the total number of rows required for the truth table is 4. We also know that the first set of columns are reserved for the distinct atomic sentences P and Q, and the second set of columns is reserved for all of the atomic sentences and operators found in the statement. The number of columns for this table, then, is equal to 2 (number of distinct atomic sentences) + 5 (number of atomic sentences and operators found in the given logical statement), or 7. (Parentheses do not count towards the total column count, as they are not atomic sentences nor logical operators in the proper sense. Parentheses go in the column for the closest atomic sentence.)
So, including the header row, we will need construct a table that is 5 rows in length and has 7 columns, where the first row is the header for the table.
We have finished constructing the truth table required to begin evaluating the logical statement: the first set of columns are reserved for the distinct atomic sentences, the second set of columns is comprised of the total number of atomic sentences and operators found in the given statement, the number of rows has been determined by the formula above (which will be revisited in the next section), and the header row marks out which column represents which element of the table.
The most practical approach to constructing a truth table:
- Determine the number of distinct atomic sentences found in the given logical statement.
- Determine the number of rows required for the truth table (excluding the header row). Add one more row for the header.
- Drawing on (1) and (2), construct the first set of columns for the distinct atomic sentences.
- Complete the header row for the truth table, where each atomic sentence and operator is given a column.
- Mark out the space for the second set of columns.
Example: (P v R) & (R -> Q)
Following (1), the number of distinct atomic sentences is 3.
Following (2), the number of rows required for the table is 8. So, including the header row, our table needs to have 9 rows.
Following (3), we get:
Following (4), we get:
Following (5), we get:
Finished!