George Boole and the Language of Logic, Part 1

Logic takes care of itself;
all we have to do is to look
and see how it does it.

~Ludwig Wittgenstein

Contrariwise,
if it was so, it might be;
and if it were so, it would be;
but as it isn’t, it ain’t.
That’s logic.

~Lewis Carroll

George Boole in binary ascii
Without the work of George Boole, we wouldn’t have binary logic and we would be unable to teach modern computers anything. (Original image from Wikipedia. Modifications with jp2a and gimp script-fu.)

This is the first post in a multi-part series explaining how computers work. At its heart, a computer is a logical-thinking machine. It’s very good at starting with several assumptions and deducing a conclusion from those assumptions.

Of course, a computer can’t do any of that on its own. We need to teach it how to think first. And to teach it how to think, we need a language of logical thought. Fortunately, logic has a language we can use, first proposed by George Boole (pictured above) in his 1854 treatise An Investigation of the Laws of Thought. In his honor, this language is called Boolean Logic or Boolean Algebra.

Since the very construction of computers is based on this language of logic, our very first post will be on Boole’s laws of thought.

True and False. One and Zero.

George Boole was a mathematician who wanted his language to be as precise as mathematical law. He did away with fuzzy ideas like “kind of” and “maybe.” In Logic, Boole argued, every statement is either true or false. Something can’t be “kind of true,” “maybe true,” or “probably true.”

Suppose that I flip a coin without looking and say, “Maybe it landed on heads and maybe it landed on tails.” That statement may be technically true, but it’s too vague to communicate anything of value. The most correct—and true—statement, Boole would argue, is “the coin landed on heads or the coin landed on tails.” When talking about events like that, there’s no room for “maybe.”

Nowadays, we often use the number 1 to symbolize true and 0 to symbolize false. (Hence the name “binary logic.”) For reasons we will see, this is very convenient, especially in computers. But for now, as we introduce the topic, we’ll use T for true and F for false.

Note that I will be using the words “true” and “false” and the letters “A” and “B” a lot below. To make them stand out and make my paragraphs easier to read, I will be bolding important words and symbols. I’m not yelling at you or emphasizing those specific words. I’ll italicize for emphasis.

Tabulating The Truth

Intuitively, we know that if a statement is not true, it’s false. However, a computer doesn’t know that. It has no idea what words like “and,” “or,” or “not” mean… or what any words mean, for that matter. But we can teach it by defining things called truth tables. This will be easiest to explain by example, so let’s look at the truth table for and:

Truth table for "and"
The truth table for the word “and.”

Each column describes the value for a different statement. Statements A and B in the first two columns could be anything. Statement A might be “I have a dog” and statement B might be “I have a cat.” The third column is the statement A and B. So in our case, “I have a dog and I have a cat.”

Each row tells us the truth value of the statement in question. So, for example, if we look at the second row, if A is true and B is false, the statement A and B is false. To continue our pet example: The second row describes a situation in which I have a dog but not a cat. Note that, in order for the statement A and B (“I have a dog and I have a cat”) to be true, both statement A (“I have a dog”) and statement B (“I have a cat”) need to be true—it’s not enough to have only one or the other.

Let’s look at another truth table…this time for the word “or:”

or truth table
The truth table for the word “or.”

Unlike A and B, fulfilling A or B only requires one statement to be true. But note that if both statements are true, then the statement A or B is also true. We usually think of the word “or” as exclusive—something has to be either, not both. In Boolean logic, however,  the only way that “I have a dog or I have a cat” is false is if I have neither pet.

The truth table for the word “not” (below) is very simple, since we only negate one statement, rather than combining two statements. If A (“I have a dog”) is true, then not A (“I don’t have a dog”) is false. The converse is also correct: If A is false, then not A is true.

not table
The truth table for the word “not.”

We can even encode the notion of causality into our truth tables. Let’s try making a truth table for the idea of “if A, then B“—for example, “If I am blogging, then I am using a computer.” Here’s the table:

A implies B
The truth table for the statement “If A, then B.”

So statement A is “I am blogging” and statement B is “I am using a computer.” The first row says that, if I’m both blogging and I’m using a computer, then the statement “If I’m blogging, then I’m using a computer” isn’t disproved and is therefore true in this scenario. The second row says that, if I’m somehow blogging without using a computer, this means that if A, then B is false because it makes a wrong assumption: that the only possible way to blog is to use a computer. The third and fourth rows are fail-safes against logical fallacy. Even if I use a computer for activities other than blogging, that has nothing to do with whether or not I blog on a computer. Thus, the third row tells me that, if I’m not blogging but I am using a computer, the statement “If I’m blogging, then I’m using a computer” is still true. Similarly, the fourth row tells me that, if I’m neither blogging nor using a computer at the moment, the statement “If I’m blogging I’m using a computer” is still true.

Resist the urge to object, “But we can’t come to any conclusion about the relationship between blogging and computer use unless you’re blogging!” Unlike in real life, there is no “maybe” or “it depends” or “I don’t know” option in Boolean logic. That’s because the only thing we’re examining when we look at if A, then B is the idea that B must happen if A happens. Therefore, the only way to get a false is to disprove that assumption by showing that A can happen without B happening. If that assumption isn’t tested, our evaluation stays at its “default” value of true.

The third and fourth rows of this truth table are interesting for another reason. They open the door to what logicians call a vacuously true statement, which is an if A, then B statement whose A is never true. Since A is never true, then the truth table tells me that the statement if A, then B is always true. For example, if I said “if there is a tree on the moon, then that tree is purple,” then Boole would tell me that my statement is completely true. The reason is that, of course, there are no trees on the moon.

This sort of reasoning is wildly unintuitive to people not used to thinking in terms of Boolean logic. It doesn’t seem logical at all! However, if we want to be consistent, we are forced to think in this way.

Next time, I’ll continue the story of Boolean logic by telling you how to build up complex statements like you might encounter in real life.

Related Reading

  • Boolean logic is the topic of many first-year college computer science and mathematics courses around the world. If you’re interested in learning it at a deeper level, here’s an online course you can take.
  • A good place to start is Wikipedia’s page on Boolean logic.
  • Some math bloggers have attempted to describe Boolean logic with more depth. I particularly like professional math tutor John M.’s article. You can find it here.

You May Also Enjoy

If you liked this post, you might enjoy my other posts on mathematics:

15 thoughts on “George Boole and the Language of Logic, Part 1

Comments are closed.