# Translating Logic Statements

The next few posts will examine aspects of logic, both symbolic logic, and how we talk about theorems in general. We’ll start here with issues in interpreting the wording of logic, and some of the semantic difficulties we face. English isn’t logical. (Well, I suppose humans in general aren’t logical.)

## Which kind of OR?

We’ll start by looking at the difficulties of the word “or”, with this question from 2003:

The Meaning of 'Or' in Logic Statements

This question was recently given on a logic test.  I am still having a hard time understanding why the answer is C.

Assume the statement "James is taking fencing or algebra" is true. Which of the following statements must be false?

A.  James is taking only fencing
B.  James is taking both fencing and algebra.
C.  James is taking neither fencing, nor algebra.
D.  James is taking only algebra.

I think that "James is taking fencing or algebra" implies that he is in only one of the classes, but we don't know which one.  Thus B is the correct answer to me.

English can be ambiguous; in math classes, we tend to assume everyone reads it the way mathematicians do. Steven is reading it the ways humans do …

Doctor Paul answered, starting with an introduction to “and” and “or” as used in mathematical logic:

At issue here is the meaning of the word "or".  Consider these two events:

Event P: James is taking fencing
Event Q: James is taking algebra

When we want to inquire about the truthfulness of a statement such as "P AND Q", it's often easiest to draw a "truth table".

The statement "P AND Q" is true if and only if P is true and Q is true.  If either statement is false, then the statement is false.  So the truth table looks like this:

P  |  Q  |  P AND Q
-------------------
T  |  T  |  T
T  |  F  |  F
F  |  T  |  F
F  |  F  |  F

So when P is True and Q is True, then the statement "P AND Q" is true.  In all other possibilities, the statement "P AND Q" is false.

Now, the statement "P OR Q" is true if and only if either P is true or Q is true.  So the truth table looks like this:

P  |  Q  |  P OR Q
-------------------
T  |  T  |  T
T  |  F  |  T
F  |  T  |  T
F  |  F  |  F

The only way that the statement "P OR Q" can be false is if neither P nor Q is true.  In particular, notice that the statement "P OR Q" is true when both P and Q are true.  So if James is taking both fencing and algebra, then the statement "James is taking fencing or algebra" is true.  This explains why the answer to your original question is "C".

This is called the “inclusive OR“, meaning that “P or Q” means “either P or Q or both“. By this interpretation, if James is taking fencing or algebra, then he might be taking only fencing (A), or he might be taking both (B), or he might be taking only algebra (C). The only possibility that can’t be true is that he is taking neither.

But it doesn't settle the debate about what the word "or" means.  At issue here is the fact that our use of the word "or" in common English language is not consistent with the way we defined "P OR Q" above.

If I write the logic statement "James is taking fencing or algebra", it doesn't mean that James could not be taking both fencing and algebra.  But this is certainly implied when I write it or say it in the English language.  You stated above that you thought that the use of the word "or" in the sentence about James meant that James was only taking one of the classes.  That would be the correct way to interpret the statement in English, but the use of the word "OR" in logic has a different meaning.

I think it’s actually a little more ambiguous in everyday English than this suggests. Under some circumstances, the inclusive meaning is quite natural. For example, if I said, “Everyone who is taking fencing or algebra, get on this bus,” anyone who happens to be taking both would probably get on without a fuss. But in other contexts, such as, “You may take fencing or algebra — you have to choose!” it is clearly exclusive. With no context, it is unclear.

To help eliminate some of the confusion, logic has introduced the "exclusive or" which is written as XOR.  So the event "P XOR Q" is true if and only if either P is true or Q is true and it is also the case that P and Q are not both true.  So the truth table looks like this:

P  |  Q  |  P XOR Q
-------------------
T  |  T  |  F
T  |  F  |  T
F  |  T  |  T
F  |  F  |  F

It is unfortunate that our use of the word "or" in the English language pretty much always refers to the logic XOR.

Questions such as the one you asked about are confusing--you don't know whether the "or" in the sentence refers to the logic OR or the logic XOR.  If you can ask the instructor for clarification, do so.  If you can't ask for clarification (for instance, if this question appears on a standardized test), you have no choice but to assume that the word "or" in the sentence refers to the logic OR. (I will agree that it is seemingly counterintuitive to think this way--basically I'm telling you that "or" means one thing in your logic class and another thing everywhere else.)  If the sentence wanted you to assume that the word "or" referred to the logic XOR, then the sentence would have read:

"James is taking fencing or algebra but not both."

For more about how the distinction can be made in English, see:

Propositional Logic and English
Exclusive or Inclusive Disjunction?

The latter also discusses some issues of grouping, similar to what we will touch on at the end of this post.

## If, or only if

Another translational challenge comes with conditional statements. Here is a question from 2005:

Translating Logic Statements

In a statement like "Joe will go to the movies only if Sam wins the race", how is it written as a conditional (if...then) statement?

I think it is written as "If Sam wins the race then Joe will go to the movies." However, several textbooks have it as "If Joe goes to the movies then Sam wins the race." I am confused over the switch of ideas from if to then.

We’ve touched on this idea before, in discussing the phrase “if and only if”. Doctor Achilles took this:

Translating "only if" is one of the most difficult things to get from English to symbolic logic.  Your textbooks are correct, the sentence:

"Joe will go to the movies only if Sam wins the race"

Is logically equivalent to:

"If Joe goes to the movies, then Sam wins the race"

First, let's look at the second sentence:

"If Joe goes to the movies, then Sam wins the race"

There are 4 possibilities:

Joe goes to the movies and Sam wins the race
In this case, the sentence is TRUE.

Joe doesn't go to the movies and Sam wins the race
In this case, the sentence is TRUE.

Joe doesn't go to the movies and Sam doesn't win the race
In this case, the sentence is TRUE.

Joe goes to the movies and Sam doesn't win the race
In this case, the sentence is FALSE.

In effect, we have just looked at the four rows of a truth table, to see what the conditional sentence means. If you are unsure about parts of this, see our previous discussion of why it is called true when the condition is false.

Ok, now let's go back to the original sentence:

"Joe will go to the movies only if Sam wins the race"

What this sentence says is that the ONLY situation in which Joe goes to the movies is when Sam wins the race.  So this sentence will be FALSE if Joe goes to the movies and Sam doesn't win the race.

If Sam does win the race, Joe doesn't have to go to the movies, he can or he can stay home.  But he is only ALLOWED to go if Sam wins.

We could also say that if Joe goes, then we know that Sam must have won, because otherwise Joe wouldn’t have gone. So, if Joe goes, Sam wins.

Here's another way of looking at this problem.  Would you agree that:

"Joe will go to the movies only if Sam wins the race"

Is equivalent to:

"If Sam doesn't win the race, then Joe won't go to the movies"?

Notice that the sentence:

"If Sam doesn't win the race, then Joe won't go to the movies"

Is the contrapositive of:

"If Joe goes to the movies, then Sam wins the race"

Contrapositives are logically equivalent--for more on this see:

Truth of the Contrapositive
http://mathforum.org/library/drmath/view/63215.html

So:

"If Joe goes to the movies, then Sam wins the race"

Is equivalent to:

"If Sam doesn't win the race, then Joe won't go to the movies"

And therefore is equivalent to:

"Joe will go to the movies only if Sam wins the race"

We’ll be looking at contrapositives and converses (see below) in a post coming soon.

## Logic and tense

This might be a good place to mention another issue: Examples in a logic class often use misleading tenses, in an attempt to make them seem more realistic than they are. The following 2009 discussion was not archived, but says just what I have in mind:

(NYS Math A Regents Jan. '08 - question 37)
In the spaces provided below, write the converse, the inverse, and the contrapositive of the statement "If I run, then I am tired."
Converse: _____________________________________
Inverse: ______________________________________
Contrapositive: _______________________________

Both my friend and I had written what we felt were acceptable answers. For the converse, for example, I had written "If I am tired, then I run," but my friends had written, "If I am tired, then I ran."  There was a disagreement as to whether it should be left as "run" or changed to "ran."

It was my opinion that it should be "run" as opposed to "ran" in order to keep the message the same relative to the given statement.  However, it was my friend's argument that in order for it to maintain proper English, it should be changed to "ran."  On the other hand, keeping it as "run" would also be proper English.  If they are tired, the result can be wanting to run.  In logic, you're supposed to base your answer solely on the information provided, not on your own judgment.  A scenario of my friend's answer would mean that if they were tired, then they ran.  It would instead state that their fatigue was due to running, whereas in MY scenario, the fatigue encouraged them to run.  This problem also occurred in our responses concerning the inverse and the contrapositive.  The disagreement falls in the choosing of whether to leave it in the present tense as it was given, or to change it as seen fit for English grammar.

I replied:

I agree with you. I think it is proper to keep the wording as much the same as possible, not trying to make grammatical adjustments. This is probably what is intended by the question, though there is a lot more that could be discussed, so it's good you're talking about it!

In logic we live in sort of a timeless world, where one statement doesn't follow another chronologically, but only logically. We are only saying "if this IS true, then that IS true". More than that, in this sort of logic we have to be careful to avoid thinking of our statements as expressing cause and effect: "If this happened, then it will cause that to happen". So your example does not actually say that running CAUSES tiredness or that tiredness IS CAUSED BY running.

The trouble, of course, is that the statement you are analyzing DOES say that, in everyday language! In trying to make logic interesting, I think textbooks tend to fall into the trap of confusing conditional statements with statements of causation or of sequence. And that leads your friends to read it that way, reading into it ideas that are not meant to be there.

Note also that the converse is not logically equivalent to the positive statement, so you can't expect it to have the same meaning, and should not try to make it make sense. It may well not be true though the original statement is.

In actual mathematical usage, we don't have causation per se, just implication. If a number is even, then its square is even. If the square of a number is even, then the number is even. The latter is a converse; both are true in this case, but there is no sense of one condition being the cause and the other the effect.

When logic is applied to science or other reality, it commonly does start to intertwine with causation (or at least leads us to look for possible causation) or with time references. If that were intended in your example, it would say something like, "If I run, then I will be tired the next day". The converse, I suppose, would be "If I am tired, then I ran the day before". Here we are maintaining the indicated time relationship. There is no explicit time reference in the statement you were given, so you shouldn't add it in.

Again, we’ll be covering converses later.

## A complicated condition

Here’s an example of an even trickier conditional sentence, from 2009:

Propositional Logic: Translating "if ... unless ..."

Hi. I have a question regarding an example I read in a math textbook on translating English sentences using propositional logic.  The solution of the problem is also explained in the book, but I fail to understand it.  The problem goes like this:

How can the following English sentence be translated into a logical expression?

You cannot ride the roller coaster
if you are under 4 feet tall
unless you are older than 16 years old.

Solution:
Let q represent "You can ride the roller coaster."
Let r represent "You are under 4 feet tall."
Let s represent "You are older than 16 years old."

Then the sentence can be translated to

(r [conjunction] [negation] s) --> [negation] q.

(Unfortunately I can't use proper mathematical signs, so --> stands for the sign of conditional statement.)

My question is:

The sentence "s" refers to "You are older than 16 years old," which in my reading isn't a negation of anything. Still, in the solution, it is negated.  I fail to understand why "s" has to be negated.  If you could kindly explain it to me, I would be most grateful.

We haven’t used logic symbols so far, in part because they were tricky to type using only keyboard symbols. I started my answer by defining the symbols I would use in place of $$\wedge$$ for conjunction (“and”), $$\vee$$ for disjunction (“or”), $$\lnot$$ or ~ for negation (“not”), and $$\rightarrow$$ for conditional (“if … then”):

I'll do what many people do, and use the caret symbol ^ to represent conjunction, the tilde symbol ~ for negation, and -> for the conditional.  Using those conventions, your textbook's answer looks like this:

(r ^ ~s) -> ~q

(We commonly used “v” for “or”.)

The crux of the problem is the word “unless”, which is not a standard term in logic, but is similar to “only if”. I focused in on that part:

The negation of s lies in the word "unless."

Let's simplify the sentence to

You cannot ride the roller coaster
unless you are older than 16.

This simpler sentence says that you can only ride the roller coaster if you are older than 16.  If you are NOT older than 16, you CAN'T ride.  Think about that a bit, and you'll see that "unless" could be replaced by "if not."

You cannot ride the roller coaster
if you are not older than 16.

Or, changing the order,

If you are not older than 16,
then you cannot ride the roller coaster.

Given that

q = "You can ride the roller coaster"
s = "You are older than 16 years old"

this sentence would translate as

~s -> ~q

Does that help?

I find that sequential rewrites in English, gradually moving toward mathematical symbols, help to keep the focus on the correct meaning.

## Grouping issues

But there was a little more to say. Recall that the statement was, “You cannot ride the roller coaster if you are under 4 feet tall unless you are older than 16 years old,” and the book’s translation was $$(r \wedge \lnot s) \rightarrow \lnot q$$.

Now, technically I disagree with the way the book's answer uses parentheses.  I'd equate the sentence to

If you are under 4 feet tall,
then you cannot ride the roller coaster
if you are not older than 16 years old.

Note that r is the condition for the entire rest of the sentence.  So I'd write it as

r -> (~s -> ~q)

But I can see how they get their answer, by taking both conditions together; the sentence as they see it appears to be

If you are under 4 feet tall
AND you are not older than 16 years old,
you cannot ride the roller coaster.

That is equivalent to my version.

In light of these subtle shades of interpretation, sometimes it's not entirely clear what the "right" answer is, so don't worry too much about such minor differences.  But you were well within your rights to want to understand how "unless" produced a negative!

I generally expect textbook translations to be as direct as possible, to avoid depending on a particular way of thinking. It appears that they were thinking of “unless” as “and not”. That is not unreasonable; but it isn’t obvious!

I will leave it as an exercise to prove that the answers are equivalent.

This site uses Akismet to reduce spam. Learn how your comment data is processed.