0% found this document useful (0 votes)
4 views

01_logic

The document introduces propositional logic as a foundational tool for problem-solving in mathematics, emphasizing its importance in engineering and natural sciences. It explains key logical operators such as conjunction (∧), disjunction (∨), negation (¬), implication (⇒), and bi-implication (⇔), along with their truth tables. The document also illustrates these concepts through examples, including a logic problem involving mislabeled jars.

Uploaded by

abhvit8ty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

01_logic

The document introduces propositional logic as a foundational tool for problem-solving in mathematics, emphasizing its importance in engineering and natural sciences. It explains key logical operators such as conjunction (∧), disjunction (∨), negation (¬), implication (⇒), and bi-implication (⇔), along with their truth tables. The document also illustrates these concepts through examples, including a logic problem involving mislabeled jars.

Uploaded by

abhvit8ty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

eNote 1 1

Note 1

Propositional logic

Welcome! In these notes we want to show you various aspects of mathematics. You have all had
mathematics before, but now you started at DTU. Therefore, we will make sure that the
mathematics you already know will become sharper tools in your mind and of course teach you
a lot of new mathematics as well. A very important reason for this is that you all will need
mathematics in one way or another later in your studies. However, another reason is that
mathematics acts as a universal language in the natural sciences and that mathematics will
enable you to interact with other engineers and scientists. We also hope that we will convince
you that mathematics is beautiful. So let us begin!

1.1 Prologue: A logic problem on labels and jars

Mathematics is all about solving problems involving objects like sets, functions, num-
bers, derivatives, integrals, and so on. The goal of this chapter is to train and enhance
your problem solving skills in general, by explaining you some tools from mathemati-
cal logic. To identify and motivate these tools, we consider as an example the following
problem:

Example 1.1

Problem: Given are three jars. You cannot see what is inside the bottles, but they are labelled
with “Apples”, “Both” and “Pears”. The label “Both” simply means that the jar contains both
apples and pears. However, the problem is that someone switched the labels in such a way
that no label is on the right jar anymore. In other words: We know that for any jar, it holds
eNote 1 1.2 GETTING STARTED WITH PROPOSITIONAL LOGIC 2

that its label is “Apples” or “Both” or “Pears”. Also we know that currently all labels are
wrong, which implies that the left jar has true label “Both” or “Pears”, the middle jar has true
label “Apples” or “Pears”, while the right jar has true label “Apples” or “Both”.

To figure out where the labels really should be placed, you can draw fruit from each jar. How
many times would you need to draw from the jars in order to figure out where the labels
were originally?

Apples Both Pears

We will solve this puzzle later, but feel free to think about it already now!

1.2 Getting started with propositional logic

Now the point of the puzzle with the jars and labels is not that it is ground breaking
mathematics, but that thinking about it identifies several key ingredients that are more
generally useful when thinking about a mathematical problem. One uses words like
“and”, “or”, “not”, “if ... then” when attacking problems of this sort. Let us therefore
introduce some notation from what is known as propositional logic. First of all, it is prac-
tical to formulate short statements that can be either true or false. An example of this is:
the label of jar number one is “Apples”. We will call such a statements a logical proposi-
tion. Here are three more examples of such propositions: x = 10, 1 < y, a 6= p. We will
typically use variables like P, Q and so on, to denote such propositions. Saying that a
proposition can be true of false, is more formally stated as: P can take the value T (T for
True), or the value F (F for false). It is also common to use the number 1 instead of T and
0 instead of F, but we will stick to T and F.

Sometimes a proposition can be broken into smaller, simpler ones. For example, the
proposition ‘x = 10 and 1 < y’, consists of the two simpler propositions ‘x = 10’, ‘1 < y’
combined with the word ‘and’. In propositional logic, one writes ( x = 10) ∧ (1 < y).
eNote 1 1.2 GETTING STARTED WITH PROPOSITIONAL LOGIC 3

To be very precise on what ∧ means, let us describe exactly when an expression of the
form P ∧ Q is true. We will do this in the following definition

Definition 1.2
Let P and Q be two propositions. Then P ∧ Q, pronounced as P and Q, is true
precisely if P is true and Q is true. In table form:
P Q P∧Q
T T T
T F F
F T F
F F F

The table in this definition is called a truth table for the logical proposition P ∧ Q. Since
P ∧ Q contains two variables P and Q and both can take the value T and F indepen-
dently, the truth table of P ∧ Q should handle four cases, one in each row. Each row
describes what happens if P and Q take specific values. Other logical propositions can
also have a truth table. Here is one more example:

Example 1.3

Let P, Q, R be three logical propositions. Now consider the logical proposition P ∧ ( Q ∧ R).
We have put parentheses around Q ∧ R to clarify that we consider P combined with Q ∧ R
using ∧. The logical proposition ( P ∧ Q) ∧ R may look similar, but is strictly speaking not the
same as P ∧ ( Q ∧ R)!

To determine when P ∧ ( Q ∧ R) is true and when it is false, we use Definition 1.2 and compute
its truth table. Since we have three variables now, the truth table will contain eight rows: one
row for each possible value taken by P, Q, and R. Therefore the table starts like this:

P Q R
T T T
T T F
T F T
T F F
F T T
F T F
F F T
F F F
eNote 1 1.2 GETTING STARTED WITH PROPOSITIONAL LOGIC 4

Since P ∧ ( Q ∧ R) consists of P and Q ∧ R, it is convenient to first add a column concerning


Q ∧ R. Using Definition 1.2, we then obtain:

P Q R Q∧R
T T T T
T T F F
T F T F
T F F F
F T T T
F T F F
F F T F
F F F F

Indeed, even though in Definition 1.2 the logical propositions were called P and Q, we can
also apply it for the logical proposition Q and R. Next we add a column for P ∧ ( Q ∧ R).
Suppose for example that P, Q, R take the values F, T, T. In that case, we see from the column
that we have just computed, that Q ∧ R takes the value T. But then applying Definition 1.2
for the logical proposition P and Q ∧ R, we see that P ∧ ( Q ∧ R) takes the value F. Continuing
like this, we can compute the final column for P ∧ ( Q ∧ R) and complete the truth table:

P Q R Q ∧ R P ∧ ( Q ∧ R)
T T T T T
T T F F F
T F T F F
T F F F F
F T T T F
F T F F F
F F T F F
F F F F F

We can think of ∧ as a logical operator: given two logical propositions P and Q, no


matter how complicated P and Q already are, it produces a new propositions P ∧ Q. In
this light ∧ is sometimes called the conjunction and P ∧ Q called the conjunction of P and
Q. Let us now introduce more logical operators. In Example 1.1, we knew that all labels
were wrong initially. Hence, the first jar on the left does not have label “Apples”. This
means that it has label “Both” or “Pears”. This is formalized in the next definition:
eNote 1 1.2 GETTING STARTED WITH PROPOSITIONAL LOGIC 5

Definition 1.4
Let P and Q be two propositions. Then P ∨ Q, pronounced as P or Q, is defined by
the following truth table:
P Q P∨Q
T T T
T F T
F T T
F F F

The operator ∨ is called disjunction and P ∨ Q the disjunction of P and Q. A further log-
ical operator is the negation of a logical proposition. We have already used this as well
in Example 1.1. There we said that the labels were wrong. In particular we know that
the true label of the middle jar was not “Both”. Also a proposition like x 6= 0 is simply
the negation of the proposition x = 0. We now formally define the negation operator.

Definition 1.5
Let P be a proposition. Then ¬ P, pronounced as not P, is defined by the following
truth table:
P ¬P
T F
F T

As operator, ¬ is called the negation, and ¬ P is therefore also called the negation of P.
We now already have enough ingredients to create various logical propositions. Let us
consider an example.
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 6

Example 1.6

Consider the logical proposition P ∨ ( Q ∧ ¬ P). We determine its truth table. Having only
two variables P and Q, it is enough to consider four rows. Further P ∨ ( Q ∧ ¬ P) contains
the simpler proposition Q ∧ ¬ P, which in turn contains the proposition ¬ P. Therefore, when
computing the truth table of P ∨ ( Q ∧ ¬ P), it makes sense to add a column for ¬ P and one
for Q ∧ ¬ P. Then the result is the following:

P Q ¬ P Q ∧ ¬ P P ∨ ( Q ∧ ¬ P)
T T F F T
T F F F T
F T T T T
F F T F F

Note that the truth table of P ∨ Q from Definition 1.4 is identical to that of P ∨ ( Q ∧ ¬ P). To be
more precise, if we take the three columns of the truth table we just computed corresponding
to P, Q and P ∨ ( Q ∧ ¬ P), then we get precisely the same table as the truth tabel from Def-
inition 1.4. Apparently, two different looking logical propositions, can have the same truth
tables.

1.3 Logical consequence and equivalence

The logical operators we introduced so far, ¬, ∧, and ∨ allow us to write down many
statements in a precise way. However, we have not discussed logical reasoning yet. We
would like to be able to say something like, if P is true, then we may conclude that Q
also is true. For example, if x > 0, then also x > −1. To formalize this, we use the
logical symbol ⇒, called an implication, and write P ⇒ Q.

We define it by giving its truth table.

Definition 1.7
The logical proposition P ⇒ Q is defined by the following truth table:
P Q P⇒Q
T T T
T F F .
F T T
F F T
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 7

In language one often pronounces P ⇒ Q as “P implies Q” or “if P then Q”. It is


sometimes convenient to write the logical proposition P ⇒ Q as Q ⇐ P.

There are two special types of logical propositions that are simply denoted by T and
F. The logical proposition T simply stands for a statement that is always true, like
for example the statement 5 = 5. Such a logical proposition is called a tautology. By
contrast, the logical proposition F, stands for a statement that is always false, like for
example 5 6= 5. This is called a contradiction. Going back to implications, saying that
P ⇒ Q is always true, really means that we claim that P ⇒ Q is a tautology. In other
words, if P ⇒ Q is a tautology, then necessarily, P is true implies that Q is true as well.

If P ⇒ Q is a tautology, then one says that Q is a logical consequence of P, or alternatively


that Q is implied by P. This explains why the symbol ⇒ is called an implication.

Stronger than an implication is what is known as a bi-implication, denoted by ⇔ and


defined as:

Definition 1.8
The logical proposition P ⇔ Q, pronounced as “P if and only if Q”, is defined by
the following truth table:
P Q P⇔Q
T T T
T F F .
F T F
F F T

The phrase “P if and only if Q” for the logical proposition P ⇔ Q can be broken up in
two parts “P if Q” and “P only if Q”. The first part, “P if Q” is just a way of saying
that P ⇐ Q, while “P only if Q” boils down to the statement P ⇒ Q. This explains
that name bi-implication for the symbol ⇔: it in fact combines two implications in one
symbol. We will see later in Theorem 1.15, equation (1-22) in a more formal way that a
bi-implication can indeed in this way be expressed as two implications.

Example 1.9

In Example 1.6 we noted that the truth tables of P ∨ Q is identical to that of P ∨ ( Q ∧ ¬ P).
What does this mean for the truth table of the logical proposition ( P ∨ Q) ⇔ ( P ∨ ( Q ∧ ¬ P))?
Using Definition 1.4 and Example 1.6, we see that the following table is correct:
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 8

P Q P ∨ Q P ∨ ( Q ∧ ¬ P)
T T T T
T F T T
F T T T
F F F F

Now let us add a column to this table for the logical proposition ( P ∨ Q) ⇔ ( P ∨ ( Q ∧ ¬ P))
and use Definition 1.8. We obtain:

P Q P ∨ Q P ∨ ( Q ∧ ¬ P) ( P ∨ Q) ⇔ ( P ∨ ( Q ∧ ¬ P))
T T T T T
T F T T T
F T T T T
F F F F T

Since the rightmost column only contains T, we can conclude that ( P ∨ Q) ⇔ ( P ∨ ( Q ∧ ¬ P))
is a tautology.

The point now is that if R ⇔ S is a tautology for some, possibly complicated, logical
propositions R and S, then the truth tables of R and S are the same. In other words: if
R is true, then S is true as well, but also the converse holds: if S is true, then R is true as
well. Therefore, if R ⇔ S is a tautology, one says that the logical propositions R and S
are logically equivalent. From Example 1.9, we can conclude that the logical propositions
P ∨ Q and P ∨ ( Q ∧ ¬ P) are logically equivalent. The point of this example is that it
shows that sometimes one can rewrite a logical statement in a simpler form. There
are several convenient tautologies that can be used to rewrite logical propositions in a
simpler form. We start by giving some involving conjunction, disjunction and negation.
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 9

Theorem 1.10
Let P, Q and R be logical propositions. Then all the following expressions are tau-
tologies.

P∧P ⇔ P (1-1)
P∨P ⇔ P (1-2)
P∨Q ⇔ Q∨P (1-3)
P∧Q ⇔ Q∧P (1-4)
P ∨ ( Q ∨ R) ⇔ ( P ∨ Q) ∨ R (1-5)
P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R (1-6)
P ∧ ( Q ∨ R) ⇔ ( P ∧ Q) ∨ ( P ∧ R) (1-7)
P ∨ ( Q ∧ R) ⇔ ( P ∨ Q) ∧ ( P ∨ R) (1-8)

Proof. To prove that one of the mentioned logical proposition is a tautology, we compute
a truth table for it. Doing this for all of them would fill quite a few pages, but let us
consider one of them, namely (1-6). We need to show that P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R is
a tautology. In Example 1.3, we already computed the truth table of P ∧ ( Q ∧ R), so we
do not have to redo that here. What we will need to do is to compute the truth table of
( P ∧ Q) ∧ R, in a way similar to what we did for P ∧ ( Q ∧ R) in Example 1.3, and then
in the last step compute the truth table of P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R using Definition
1.8. The result is the following:

P Q R P ∧ ( Q ∧ R) P ∧ Q ( P ∧ Q) ∧ R P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R
T T T T T T T
T T F F T F T
T F T F F F T
T F F F F F T
F T T F F F T
F T F F F F T
F F T F F F T
F F F F F F T

We see that P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R only takes the value T, no matter what values


P, Q and R take. Hence we can conclude that P ∧ ( Q ∧ R) ⇔ ( P ∧ Q) ∧ R is a tautology.

All the other items in the theorem can be shown similarly, but we will not do so here.
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 10

Readers are encouraged to prove at least one other item themselves.

Equation (1-5) really says that when taking the disjunction of three logical propositions,
it does not matter how you place the parentheses. Therefore, it is common to write
P ∨ Q ∨ R and leave the parentheses out completely. Similarly Equation (1-6) says that
for the conjunction of three logical propositions, you can place the parentheses as you
want. Therefore, on can write P ∧ Q ∧ R without any ambiguity. This situation changes
if both conjunction and disjunction occur in the same expression. Then parentheses do
matter. We consider an example.

Example 1.11

Consider the logical propositions ( P ∧ Q) ∨ R and P ∧ ( Q ∨ R). We claim that these are not
logically equivalent. To show this, we could compute their truth tables, but in fact to show
that two logical propositions are not logically equivalent, all we need to do is to find values
for P, Q and R such that ( P ∧ Q) ∨ R and P ∧ ( Q ∨ R) are not both true. Let us for example
find out when ( P ∧ Q) ∨ R is false. This happens precisely if P ∧ Q is false and R is false.
Hence ( P ∧ Q) ∨ R is false precisely if P and Q are not both true and R is false. However,
P ∧ ( Q ∨ R) will be false whenever P is false. Hence if ( P, Q, R) take the values (F, T, T), then
( P ∧ Q) ∨ R is true, but P ∧ ( Q ∨ R) is false. This means that in the truth table of the two
expressions, there is a row looking as follows:

P Q R . . . ( P ∧ Q) ∨ R P ∧ ( Q ∨ R)
..
.
F T T ... T F
..
.

Hence the logical propositions ( P ∧ Q) ∨ R and P ∧ ( Q ∨ R) are not logically equivalent.


Indeed, if they would be, the logical proposition ( P ∧ Q) ∨ R ⇔ P ∧ ( Q ∨ R) would be a
tautology and hence only take the value T, but its truth table actually contains the following
row:

P Q R . . . ( P ∧ Q) ∨ R P ∧ ( Q ∨ R) ( P ∧ Q) ∨ R ⇔ P ∧ ( Q ∨ R)
..
.
F T T ... T F F
..
.

There are a few more tautologies that are useful when dealing with logical propositions.
Apart from the conjunction ∧ and disjunction ∨, these also involve the negation ¬. We
leave the proofs to the reader.
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 11

Theorem 1.12
Let P, Q and R be logical propositions. Then all the following expressions are tau-
tologies.

P ∨ ¬P ⇔ T (1-9)
P ∧ ¬P ⇔ F (1-10)
P ⇔ ¬(¬ P) (1-11)
¬( P ∨ Q) ⇔ ¬P ∧ ¬Q (1-12)
¬( P ∧ Q) ⇔ ¬P ∨ ¬Q (1-13)
¬T ⇔ F (1-14)
¬F ⇔ T (1-15)

Identities (1-12) and (1-13) are called the De Morgan’s laws. Finally, there are a few tau-
tologies describing how ∧ and ∨ interact with tautologies and contradictions. Again,
we leave the proofs of these to the reader.

Theorem 1.13
Let P, Q and R be logical propositions. Then all the following expressions are tau-
tologies.

P∨F ⇔ P (1-16)
P∧T ⇔ P (1-17)
P∧F ⇔ F (1-18)
P∨T ⇔ T (1-19)

Using the list of tautologies in Theorems 1.10, 1.12 and 1.13 one can rewrite logical
proposition in a logically equivalent form. Let us consider an example.

Example 1.14

As in Examples 1.6 and 1.9, consider the logical proposition P ∨ ( Q ∧ ¬ P). We have already
seen that it is logically equivalent to P ∨ Q, but let us now show this using Theorem 1.10 and
eNote 1 1.3 LOGICAL CONSEQUENCE AND EQUIVALENCE 12

not by computing truth tables. First of all, using (1-8), we see that

P ∨ ( Q ∧ ¬ P ) ⇔ ( P ∨ Q ) ∧ ( P ∨ ¬ P ).

Using (1-9), we conclude that

P ∨ ( Q ∧ ¬ P) ⇔ ( P ∨ Q) ∧ T,

which by (1-17) can be simplified to

P ∨ ( Q ∧ ¬ P) ⇔ P ∨ Q.

In other words, using Theorem 1.10, one can prove logical equivalences without having to
compute truth tables. Of course when proving this theorem, one needs to compute several
truth tables, but this only needs to be done once. Generally speaking in mathematics, the
point of a theorem is that it contains one or several useful results with a proof. Once the
proof is given, one can use the result in the theorem whenever needed without having to
prove the theorem again.

The tautologies in Theorem 1.10 only involve negation, conjunction and disjunction.
Here are three very useful ones that involve implication and bi-implication as well.

Theorem 1.15
Let P and Q be logical propositions. Then all the following expressions are tautolo-
gies.

( P ⇒ Q) ⇔ (¬ P ∨ Q) (1-20)
( P ⇒ Q) ⇔ (¬ Q ⇒ ¬ P) (1-21)
( P ⇔ Q) ⇔ ( P ⇒ Q) ∧ ( Q ⇒ P) (1-22)
P ⇔ (¬ P ⇒ F) (1-23)

Proof. As in Theorem 1.10, these items can be shown by computing truth tables for each
of them. We will do this for the second item and leave the others to the reader:
eNote 1 1.4 USE OF LOGIC IN MATHEMATICS 13

P Q P ⇒ Q ¬ P ¬ Q ¬ Q ⇒ ¬ P ( P ⇒ Q) ⇔ (¬ Q ⇒ ¬ P)
T T T F F T T
T F F F T F T
F T T T F T T
F F T T T T T

Since the right column only contains T, we conclude that ( P ⇒ Q) ⇔ (¬ Q ⇒ ¬ P)


indeed is a tautology.

Equation (1-20) means that in principle, an implication can be expressed using negation
and disjunction. Equation (1-21) is called contraposition. It means that if one wants to
prove that Q is a logical consequence of P, it is also fine to show that ¬ P is a logical
consequence of ¬ Q. Equation (1-22) says that two logical propositions are logically
equivalent precisely if they are logical consequences of each other. Finally, equation
1-23 is sometimes used to prove logical statements: instead of showing that P is true,
one assumes that P is false and then tries to obtain a contradiction. If one does obtain
a contradiction, one can conclude that ¬ P ⇒ F is true. But then by equation 1-23, P is
also true. This method is called a proof by contradiction.

1.4 Use of logic in mathematics

Logic can help to solve mathematical problems and to clarify the mathematical reason-
ing. In this section, we give a number of examples of this.

Example 1.16

Question: Determine all real numbers x such that − x ≤ 0 ≤ x − 1.

Answer: − x ≤ 0 ≤ x − 1 is really shorthand for the logical proposition

−x ≤ 0 ∧ 0 ≤ x − 1.

The first inequality is logically equivalent to the inequality x ≥ 0, while the second one is
equivalent to x ≥ 1. Hence a real number x is a solution if and only if

x≥0 ∧ x ≥ 1.

The answer is therefore all real numbers x such that x ≥ 1.


eNote 1 1.4 USE OF LOGIC IN MATHEMATICS 14

Example 1.17

Question: determine all real numbers x such that 2| x | = 2x + 1. Here | x | denotes the absolute
value of x.

Answer: if x < 0, then | x | = − x, while if x ≥ 0, then | x | = x. Hence it is convenient


to consider the cases x < 0 and x ≥ 0 separately. More formally, we have the following
sequence of logically equivalent statements:

2| x | = 2x + 1

2| x | = 2x + 1 ∧ (x < 0 ∨ x ≥ 0)

(2| x | = 2x + 1 ∧ x < 0) ∨ (2| x | = 2x + 1 ∧ x ≥ 0)

(−2x = 2x + 1 ∧ x < 0) ∨ (2x = 2x + 1 ∧ x ≥ 0)

(−4x = 1 ∧ x < 0) ∨ (0 = 1 ∧ x ≥ 0)

( x = −1/4 ∧ x < 0) ∨ (F ∧ x ≥ 0)

x = −1/4 ∨ F

x = −1/4

Hence the only solution to the equation 2| x | = 2x + 1 is x = −1/4.

Example 1.18


Question: Determine all nonnegative real numbers such that x = − x.

Observation: It is tempting to take the square on both sides, one then obtains x = x2 , and

then to conclude that x = 0 and x = 1 are the solutions
√ to the equation x = − x. However,
x = 0 is indeed a solution, but x = 1 is not, since 1 6= −1. What went wrong?

Answer: The reasoning actually shows that if x satisfies the equation x = − x, then x = x2 ,
which in turn implies that x = 0 or x = 1. Hence the following statement is completely
correct: √
( x = − x ) ⇒ ( x = 0 ∨ x = 1).

In that sense, nothing went wrong and any solution to the equation x = − x must indeed
be either x = 0 or x = 1. What may cause confusion is that this does not at all mean that
eNote 1 1.5 EPILOGUE: THE LOGIC PROBLEM ON LABELS AND JARS 15


x = 0 and x = 1 both are solutions to the equation x = − x. This would namely amount to
the statement √
( x = 0 ∨ x = 1) ⇒ ( x = − x ),
which is different from what we have shown and actually is not true. To solve the question,
all we need to do it to check if the potential solutions x = 0 and x = 1 really are solutions.
We then obtain that x = 0 is the only solution.

1.5 Epilogue: the logic problem on labels and jars

Let us return to the problem of jars and labels from the first section.

Example 1.19

Let us denote by P1 ( A) the statement that the left jar has true label “Apples”. Similarly,
let us write P1 ( B), respectively P1 ( P), for the statement that the left jar has true label “Both”,
respectively “Pears”. We then know that P1 ( B) ∨ P1 ( P) is always true, since the left jar cannot
have label “Apples”. Similarly for the middle jar, we can introduce P2 ( A), P2 ( B), and P2 ( P)
for the statements that the middle jar has true label “Apples”, “Both”, “Pears” and conclude
that P2 ( A) ∨ P2 ( P) is a tautology. Similarly for the right jar, we obtain that P3 ( A) ∨ P3 ( B) is a
tautology. In conclusion,

( P1 ( B) ∨ P1 ( P)) ∧ ( P2 ( A) ∨ P2 ( P)) ∧ ( P3 ( A) ∨ P3 ( B)) (1-24)

is a tautology. Using De Morgan’s laws repeatedly, we can rewrite this to the logically equiv-
alent statement

( P1 ( B) ∧ P2 ( A) ∧ P3 ( A)) ∨ ( P1 ( B) ∧ P2 ( A) ∧ P3 ( B)) ∨
( P1 ( B) ∧ P2 ( P) ∧ P3 ( A)) ∨ ( P1 ( B) ∧ P2 ( P) ∧ P3 ( B)) ∨
( P1 ( P) ∧ P2 ( A) ∧ P3 ( A)) ∨ ( P1 ( P) ∧ P2 ( A) ∧ P3 ( B)) ∨
( P1 ( P) ∧ P2 ( P) ∧ P3 ( A)) ∨ ( P1 ( P) ∧ P2 ( P) ∧ P3 ( B)).

This statement is still a tautology, since it is logically equivalent to the tautology from Equa-
tion 1-24. Since we know that in the correct labelling each label has to be used exactly once,
a statement like P1 ( B) ∧ P2 ( A) ∧ P3 ( A) where the same label occurs twice, cannot be correct,
that is to say that it is a contradiction. Using that disjunction absorbs contradictions, see
Equation (1-16), we therefore conclude that

( P1 ( B) ∧ P2 ( P) ∧ P3 ( A)) ∨ ( P1 ( P) ∧ P2 ( A) ∧ P3 ( B)) (1-25)

is a tautology.
eNote 1 1.5 EPILOGUE: THE LOGIC PROBLEM ON LABELS AND JARS 16

What this shows is that there are only two possible correct ways to label the jars. This is
already very helpful, since we did not even draw any fruit yet! Now let us investigate what
the effect of drawing from a jar is. If we draw from the left jar, we do not learn much about the
label of that jar. Indeed, since the true label is “Both” or “Pears”, if we draw an apple from
it, we know the true label cannot be “Pears”, but if we draw a pear from it, the true label
could still be “Both” or “Pears”. Similarly drawing from the right jar, may not determine its
true label. The situation is different for the middle jar. Since the true label of the middle jar is
“Apples” or “Pears”, if we draw an apple from it, its true label cannot be “Pears”. Apparently,
it must be “Apples” in that case. Similarly, if we draw a pear from the middle jar, its true label
is “Pears”. We arrive at the following solution for the problem:

Solution:

Step 1: Draw from the middle jar. Since we know all labels are wrong, the middle jar, that
has label “Both”, contains either only apples, or only pears. If we draw an apple from the
middle jar, then we can conclude the correct label should have been “Apples,” while if we
draw a pear from the middle jar, then we can conclude that that correct label should have
been “Pears”.

Step 2: We know that the logical proposition in Equation 1-25 is a tautology. This implies
that if we found in Step 1 that the correct label for the middle jar is “Apples”, then P1 ( P) ∧
P2 ( A) ∧ P3 ( B) is true, while if the correct label of the middle jar was identified as “Pears” in
Step 1, then P1 ( B) ∧ P2 ( P) ∧ P3 ( A) is true.

Conclusion: We only need to draw once! After that we can identify all three labels correctly.
Moreover, we have actually found a simple step-by-step procedure to determine the correct
labelling. This is an example of what we later will call an algorithm. To make it look more
like a computer algorithm, we give it as follows:

Algorithm 1 Label Identifier


1: Draw from the jar labelled “Both” and denote the result by R.
2: if R = apple then
3: Identify the labels of the jars as “Pears”,“Apples”,“Both”,
4: else
5: Identify the labels of the jars as “Both”,“Pears”,“Apples”.

There are many puzzles of this type. Here is another one. Feel free to try to solve it
yourself before reading the solution.
eNote 1 1.5 EPILOGUE: THE LOGIC PROBLEM ON LABELS AND JARS 17

Example 1.20

A police officer is investigating a burglary and was able to narrow the number of suspects
down to three. He is absolutely sure that one of these three committed the crime. His ques-
tioning of the three suspects yields him the following statements:

Suspect1: “Suspect2 did it”;


“I wasn’t there”;
“I am innocent”
Suspect2: “Suspect3 is innocent”;
“everything Suspect 1 said is a lie”;
“I didn’t do it”
Suspect3: “I didn’t do it”;
“Suspect1 is lying if he said that he wasn’t there”;
“Suspect2 is lying if he said that everything that Suspect1 said is a lie”

Confused, the police officer goes to his boss, the police commissioner. The police commis-
sioner says: “I know these suspects quite well and every single one of them always lies at
least once in their statements.” Can you help the police officer to figure out which suspect is
guilty of the burglary?

Solution Let us introduce some logical proposition to analyze the situation. First of all, P1 is
the statement “Suspect1 did it” and similarly P2 stands for “Suspect2 did it”, P3 for “Suspect3
did it”. With this notation in place, we know that

P1 ∨ P2 ∨ P3

is a tautology, since the police officer is absolutely sure that one of the three suspects commit-
ted the burglary.

Now let us analyze the statements from the suspects:

Statements from Suspect1:


“Suspect2 did it”; this is just P2
“I wasn’t there”; we call this R1
“I am innocent”; this amounts to ¬ P1

Now let us consider the insight from the police commissioner. He says that any of the three
suspects has lied at least once in their statements. In particular, Suspect1 is lying, which
means that ¬ P2 ∨ ¬ R1 ∨ ¬(¬ P1 ) is a tautology. Using Equation (1-11), we conclude that

¬ P2 ∨ ¬ R1 ∨ P1
eNote 1 1.5 EPILOGUE: THE LOGIC PROBLEM ON LABELS AND JARS 18

is a tautology.

Statements from Suspect2:


“Suspect3 is innocent”; this is ¬ P3
“everything Suspect 1 said is a lie”; this amount to ¬ P2 ∧ ¬ R1 ∧ P1
“I didn’t do it”; this is ¬ P2

Now let us again consider the insight from the police commissioner. For Suspect 2 we ob-
tain that P3 ∨ ¬(¬ P2 ∧ ¬ R1 ∧ P1 ) ∨ P2 is a tautology. One can simplify this expression us-
ing Theorem 1.10. First of all, using Equation (1-13), the proposition ¬(¬ P2 ∧ ¬ R1 ∧ P1 )
is logically equivalent to ¬(¬ P2 ) ∨ ¬(¬ R1 ) ∨ ¬ P1 ), which in turn is logically equivalent to
P2 ∨ R1 ∨ ¬ P1 using Equation (1-11). Substituting this in the original tautology, we see that
P3 ∨ ( P2 ∨ R1 ∨ ¬ P1 ) ∨ P2 is a tautology. Simplifying P2 ∨ P2 to P2 using Equation (1-2), we
obtain that
P3 ∨ P2 ∨ R1 ∨ ¬ P1
is a tautology.

The statements of Suspect3 are a bit involved, so before putting them in a table, let us consider
the last two statements. The second statement of Suspect3 is that “Suspect1 is lying if he
said that he wasn’t there”. In other words: “Suspect1 wasn’t there” ⇒ “Suspect1 is lying”.
However, the police commissioner already told us that the statement “Suspect1 is lying”
always is true. This means that the implication, “Suspect1 wasn’t there” ⇒ “Suspect1 is
lying”, is a tautology. Similarly, the third statement from Suspect3, “Suspect2 is lying if he
said that everything that Suspect1 said is a lie”, is a tautology. Hence the second and third
statements from Suspect3 do not give us any information that we did not already know.

Statements from Suspect3:


“I didn’t do it”; this is ¬ P3
“Suspect1 is lying if he said that he wasn’t there”; this is a tautology T
“Suspect2 is lying if he said that everything that Suspect1 said is a lie; this is a tautology T

Now let us for the third time consider the insight from the police commissioner. Suspect3
lied and hence P3 ∨ ¬T ∨ ¬T is a tautology. Since ¬T is logically equivalent to F by Equation
1-14, Equation (1-16) implies that P3 is a tautology.

Collecting everything together, we have obtained the following tautologies: P1 ∨ P2 ∨ P3 ,


¬ P2 ∨ ¬ R1 ∨ P1 , P3 ∨ P2 ∨ R1 ∨ ¬ P1 , P3 . The fact that P3 is a tautology immediately implies that
the only possibility is that Suspect3 has committed the burglary and that as a consequence
Suspect1 and Suspect2 are innocent. However, we still need to check that in this case all the
other tautologies are indeed true. If not, this would mean that no solution exists and that the
police officer or the police commissioner is wrong. First of all, if P3 takes the value T, then
eNote 1 1.5 EPILOGUE: THE LOGIC PROBLEM ON LABELS AND JARS 19

P1 ∨ P2 ∨ P3 and P3 ∨ P2 ∨ R1 ∨ ¬ P1 will be tautologies, since T ∨ S is logically equivalent to T


for any logical proposition S. This leaves ¬ P2 ∨ ¬ R1 ∨ P1 . Since Suspect2 is innocent, P2 takes
the value F and as a consequence, ¬ P2 takes the value T. Hence indeed ¬ P2 ∨ ¬ R1 ∨ P1 is a
tautology. This means that there is nothing contradictory. The police should arrest Suspect3!

You might also like