Category Archives: Math Lesson

Truth Tables: A Gripe

In one of the courses that I teach, I teach a unit on Symbolic Logic. This is a unit that is often omitted from secondary and even post-secondary (math!) education. Omitted! Lawyers tend to take a course in formal logic and so do students of philosophy. It is somewhat an irony and probably a crime that we have students trudge through over a decade of math education and never expose them to formal logic and how it pertains to mathematics. To further the irony, I won’t do much of it in this article. Rather a purpose of this write-up is about a general gripe I have with how some textbooks decide to construct truth tables.

If you want to just get to the gripe, then jump to it, else read on.

Take for example, this statement:

If it is warm out, then I will go to the beach.

In symbolic logic this would be written as $$p \rightarrow q$$ where \(p\) is “it is warm out” and \(q\) is “I will go to the beach.” and the arrow is the “conditional”. Thus, \(p \rightarrow q\) is read as “If \(p\), then \(q\)”.

One point of logical confusion or perhaps linguistic convention is that, in the given example, if it weren’t warm out, then we tend to conclude that I wouldn’t go to the beach. But this is not how formal logic works even though it may be how we tend to want to speak. And therein is a key point — “tend to want to speak”. In other words, we are not consistent in how we mean “If some condition, then some consequence.”

When we speak, we tend to want to consider the following statements as logically equivalent:

  • If it is warm out, then I will go to the beach.
  • If it is not warm out, then I will not go to the beach.
  • I will only go to the beach, if it is warm out.
  • Only if it is warm out, will I go to the beach.

One way to appreciate the rigidity of conditional statements (if-then) is to understand them as contracts.

If it is warm out, then I will go to the beach.

The contract states what I will do in the case that it is warm out. So, let’s say that it happens to be warm out. According to the contract via the conditional statement, I will go the beach.

Suppose it is warm out, but I don’t go to the beach. What then? This is a broken contract. We’ve violated the rule that was set in place. Something was supposed to happen in the event that it was warm out, but that something (going to the beach) didn’t happen. In other words, I lied!

Now, suppose it isn’t warm out. What then? If I do go to the beach, am I fibbing? Is there a contract violation? What if I don’t go to the beach? Is that necessarily being consistent with the original if-then?

If we view the contract rigidly, we can see that the only rule in place states what to do in the event that it is warm out. Technically, we have no rule for what to do when it is not warm out. Thus, going to the beach or not going to the beach is neither a validation nor an invalidation of the contract if it is not warm out. This is usually where it gets confusing for new students of logic.

Symbolically we have two different statements: \(p \rightarrow q\) and \(\sim p \rightarrow \sim q\), where the symbol \(\sim\) is “negation”. Thus, \(\sim p\) is read as “not \(p\)”. So \(\sim p \rightarrow \sim q\) is read as “if not \(p\), then not \(q\)”. Or back to English: “If it is not warm out, then I will not go to the beach.”

Eventually, through a bevy of examples, students can begin to appreciate the nuanced precision of logical speak. It’s at this point, I want to introduce the idea of a truth table in conjunction (pun! (you’ll get it later, if you’re new to formal logic)) with logical OR and logical AND.

For the remainder of this article, I want to focus on truth tables and won’t go into a full lesson on logical operators.

Truth Tables

As we saw earlier, we can write a simple condition statement (our contract) of the form “If \(p\), then \(q\)” symbolically as \(p \rightarrow q\).

We can also enumerate the four “what if” cases and ask if our contract remains valid in each case. The four cases are

  • It is not warm. I didn’t go to the beach. \(\sim p. \sim q\)
  • It is not warm. I did go to the beach. \(\sim p. q\)
  • It is warm. I did not go to the beach. \(p. \sim q\)
  • It is warm. I did go to the beach. \(p. q\),

Notice that there are no cases involving “maybe”. We are always in a binary state — either it is, or it isn’t. So, if we have our two statements “\(p = \) it is warm out” and “\(q = \) I will go to the beach.”, then we can label what state of \(p\) and / or \(q\) we are in as “True” or “False”. Thus, the above list of statements can be tabulated as follows:
$$
\begin{array}{c c}
p & q \\
\hline
F & F \\
F & T \\
T & F \\
T & T
\end{array}
$$

From here, we can build a truth table for our conditional statement (contract) \(p \rightarrow q\) by asking if in a given scenario the contract remains valid. As I discussed earlier, the only rule we have in place is one that involves \(p\) happening. If \(p\) does not happen (it is not warm out), then no matter what we do (\(q\) or \(\sim q\)), we aren’t violating the contract as we had stated \(p \rightarrow q\). Thus, our truth table should look like this:

$$
\begin{array}{c c | c}
p & q & p \rightarrow q \\
\hline
F & F & T\\
F & T & T\\
\color{red}{T} & \color{red}{F} & \color{red}{F}\\
T & T & T
\end{array}
$$

Notice that it is only the third scenario where we have a contract violation. \(p\) is True (it is warm out), yet \(q\) is False (I didn’t go to the beach) — that violates the conditional “If it is warm out, then I will go to the beach.”

We have just formally defined how the conditional (\(\rightarrow\)) operates. Now we can consider another simple conditional statement and determine it’s truth table. Let’s take the statement that we sometimes want to believe is equivalent to \(p \rightarrow q\) — namely, let’s construct the truth table for \(\sim p \rightarrow \sim q\) (If it is not warm out, then I will not go to the beach.) If \(p \rightarrow q\) and \(\sim p \rightarrow \sim q\) are indeed logically equivalent, then their truth tables should be identical. For “clarity”, I’ve added some extra columns to show how the truth table for \(\sim p \rightarrow \sim q\) can be constructed.

$$
\begin{array}{c c c c | c}
p & q & \sim p & \sim q & \sim p \rightarrow \sim q \\
\hline
F & F & T & T & T\\
\color{red}{F} & \color{red}{T} & \color{red}{T} & \color{red}{F} & \color{red}{F}\\
T & F & F & T & T\\
T & T & F & F & T
\end{array}
$$

Notice now that we have violated our contract in the second scenario because that is when \(\sim p\) is True and \(\sim q\) is False (the contract explicitly states \(\sim p \rightarrow \sim q\)). Thus, if we put our two conditional statements side by side on the same truth table we can see that there is not equality.

$$
\begin{array}{c c | c | c}
p & q & p \rightarrow q & \sim p \rightarrow \sim q \\
\hline
F & F & T & T\\
\color{red}{F} & \color{red}{T} & \color{red}{T} & \color{red}{F}\\
\color{red}{T} & \color{red}{F} & \color{red}{F} & \color{red}{T}\\
T & T & T & T
\end{array}
$$

This begins to expose what we often want to say when we say “If \(p\), then \(q\)” but don’t typically get right. And we can save this conversation for a later day.

The title of this article is “Truth Tables: A Gripe” and I am finally getting to it.

Constructing Truth Tables: A Gripe

Let’s take a look at this truth table:
$$
\begin{array}{c c | c}
p & q & p \rightarrow q \\
\hline
F & F & T\\
F & T & T\\
T & F & F\\
T & T & T
\end{array}
$$

Notice that I began the \(p\) and \(q\) columns with a False for each column and use a progression in the order of “FF, FT, TF, TT”. Why did I do it this way and not, say “TT, TF, FT, FF”? or “TF, FT, FF, TT”? or another one of the twenty-four possible permutations?

Technically, we can use any ordering we want so long as we enumerate all the cases exactly once. But some orderings are better than others. And here is why I prefer the ordering of “FF, FT, TF, TT” for setting up truth tables.

\(“\)We also have, perhaps a psychological, theological, sociological bias for the value of “truth” and “falsehood”.

In digital logic, a digital component is either on or off. The off state is typically given the value of 0 and the on state is given the value of 1. In programming languages like C++, the variable that is of type boolean can take on one of two states, “true” or “false”, where “false” equates to zero and “true” to one (and if you want to get lost on stackexchange then by all means). We also have, perhaps a psychological, theological, sociological bias for the value of “truth” and “falsehood”. Whereby we would want to naturally give something true a value of unity and something false a value representing nothingness. Hence 1 for true, 0 for false.

Why does this matter? Well, if we were to count in a base-2 system (binary), we would count as follows,
$$\begin{array}{c}0,\\ 1,\\ 10,\\ 11,\\ 100,\\ 101,\\ 110,\\ 111,\\ \vdots\end{array}$$ If we wanted to write these numbers with enough placeholders (say three) then we would write them in order as
$$\begin{array}{c}000,\\ 001,\\ 010,\\ 011,\\ 100,\\ 101,\\ 110,\\ 111\end{array}$$

Now, if we substitute F for 0 and T for 1, then in a three state system we have
$$\begin{array}{c}FFF,\\FFT,\\FTF,\\ FTT,\\ TFF,\\ TFT,\\ TTF,\\ TTT\end{array}$$

And this way of organizing a truth table is more natural, I would argue, than what I see in some textbooks, which is to give a countdown starting at all states set to True. In other words, in a two-state system like with our \(p\) and \(q\), a “more” organized way of setting up the truth table would be

$$
\begin{array}{c c }
p & q \\
\hline
F & F \\
F & T \\
T & F \\
T & T
\end{array}
$$

rather than
$$
\begin{array}{c c }
p & q \\
\hline
T & T \\
T & F \\
F & T \\
F & F
\end{array}
$$

The former, I feel, is more aligned at a broad level with other disciplines (Computer Science, Electrical Engineering) that would routinely work with logical systems. (Admittedly, electrical engineering students will have a slightly different enumeration system when designing digital circuitry via Karnaugh maps, but that is a different construction for a different purpose.)

So when I teach the logic unit, I try to get my students to count in base 2 as a related excursion. I remain puzzled as to why some math texts prefer a countdown; it seems unnatural and inconsistent with other subject matters that have a fairly large overlap with mathematics.