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

2 - Logic (Part 1)

This document provides an introduction to propositional logic. It defines key concepts such as propositions, propositional variables, logical connectives like AND and OR, and truth tables. It discusses well-formed formulas using propositional variables and logical connectives. Implication is introduced along with the converse and contrapositive of a statement. The document aims to lay the foundations for propositional logic.

Uploaded by

Aisha Olamide
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)
45 views

2 - Logic (Part 1)

This document provides an introduction to propositional logic. It defines key concepts such as propositions, propositional variables, logical connectives like AND and OR, and truth tables. It discusses well-formed formulas using propositional variables and logical connectives. Implication is introduced along with the converse and contrapositive of a statement. The document aims to lay the foundations for propositional logic.

Uploaded by

Aisha Olamide
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/ 66

CHAPTER 1

LOGIC
Logic is a very useful topic in computer science. It is applied in proving programs
correct; databases [where you study about relational algebra and relational calculus];
and Artificial Intelligence, which is about reasoning, etc.

LOGIC

PROPOSITIONAL LOGIC
Lec 1-2

PREDICATE LOGIC
Lec 3-4

LOGICAL INFERENCE
Lec 5

RESOLUTION PRINCIPLE
Lec 6

METHODS OF PROOF
Lec 7

NORMAL FORMS
Lec 8

PROVING PROGRAMS CORRECT


Lec 9
PROPOSITIONAL LOGIC
In English language, we talk about sentences, assertions, questions, orders/command,
etc.
Definition:
An assertion is a statement. It is different from asking a question or giving an
order/command.
A proposition is an assertion, which is either true or false but not both. Therefore, you
must be able to associate a truth value with an assertion.
The following are propositions:
(a) 4 is a prime number.
(b) 3 + 3 = 6
(c) The moon is made of cheese
Truth value will be ‘false’ denoted by 0 or ‘true’ denoted by 1 i.e.
False 0
True 1
So, any sentence or assertion, to which you can assign a truth value is a proposition.
EXAMPLE
Proposition Truth Value
a. 4 is a prime number. False
b. 3 + 3 = 6 True
c. The moon is made of cheese False

Non-Propositions
None of the following statements is a proposition:
(a) X + Y > 4
It is true or false depending on the value you assign to the variables X and Y so;
it does not have a unique truth value.

(b) X = 3
You cannot associate a unique truth value to this statement.

(c) Are you leaving?

(d) Buy four books!


(It is an order.)
Exceptions
These are assertions which are not propositions.
Example: “This statement is false” is an assertion but is not a proposition because you
cannot associate a truth value with it: If it is true, it is false; and if it is false then it is true.
Such a statement is called a ‘liar paradox’.
Note: In the same way we have individual (algebraic) variables like 𝑥, 𝑦, 𝑧, we have
propositional variables.

Propositional Variable
A propositional variable such as P, Q, R… denotes an arbitrary proposition with
unspecified truth value. Just as a value, 4 can be assigned to an algebraic variable 𝑥,
you can assign a truth value to the proposition P, Q or R, …
Propositional variables can be connected with logical connectives.
Logical Connectives
These following are logical connectives; AND, OR, NOT.
P and Q
P or Q
Not P
EXAMPLE. Consider the following propositions:
P: John is 6” tall.
Q: There are 4 cows in the barn.
From these, the compound statements follow:
P and Q: John is 6” tall and there are cows in the barn.
[This statement will be true when both P and Q are true i.e., P is true and Q is
true.]
P or Q: John is 6” tall or there are 4 cows in the barn.
[This compound statement is true when either P or Q or both is true. This is
called an Inclusive OR.]
The following are truth tables for the logical connectives:
i. AND denoted by ˄
P Q P˄Q
F F F
F T F
T F F
T T T

P Q P˄Q
0 0 0
0 1 0
1 0 0
1 1 1
This is the truth table for AND

ii. OR denoted by ˅
P Q P˅Q
0 0 0
0 1 1
1 0 1
1 1 1

iii. NOT denoted by ¬


P ¬P
0 1
1 0
¬P: John is NOT 6’ tall.

Propositional Form: is an assertion, which contains at least one propositional variable.


So, when you connect two propositional variables by AND or OR, it is called a form. We
can also use another logical connective, called the Exclusive OR
AND ᴧ Conjunction
OR ˅ Disjunction
Exclusive OR ⊕
iv. Exclusive OR denoted by ⊕
P Q P⊕Q
0 0 0
0 1 1
1 0 1
1 1 0
Exclusive Or is true when only one of the propositions is true and the other false. If both
propositions are true or false, it is false.
When you use “either…or” in an English sentence, it is an exclusive or. On the other
hand, when you just use “…or…”, it is an Inclusive Or.
EXAMPLE
Kayode is home and the rice is cooked.
In the sentence above, both propositions can be true or false.

Whereas...
Kayode is home or Kayode is out.
In this case, only one proposition can be true so, you use an Exclusive Or.
Either Kayode is home or Kayode is out.

Note: you have to be careful because sometimes they are used in an ambiguous
manner. So, when you want to transcribe an English sentence to a logical statement or
vice-versa, you have to be wary of which OR is involved.

Well Formed Formula of a Propositional Logic (WFF)


WFF is any propositional form that connects variables.
So, P˄Q, P˅Q, and P⊕Q are well formed formulae.
Apart from the four logical connectives mentioned so far, there are two more operators
used in logic – They are Implications and Equivalence.

v. Implications denoted as ⇒
P implies Q written as P⇒Q
In some books, it’s written as P ⊃ Q or P→Q
P is called the premise, hypothesis or antecedent.
Q is called the conclusion or consequence.
Truth table for P ⇒ Q is given below:
P Q P⇒Q
0 0 1
0 1 1
1 0 0
1 1 1
This truth table is based on Greek logic; Indian logic does not permit a premise and
conclusion not to be related.
There is a possible confusion about the implication’s truth table that you need to be
clear about: The antecedent and conclusion may not be related.
EXAMPLE: If the moon is made of cheese, then earth is not round.
In the example above, the compound statement is true because it is of the form F ⇒ F.
In the [Greek] truth table, you must give a truth value to the antecedent and conclusion
even though they are not related.
Conditions for an Implication to true:
i. When the premise and conclusion are both false
ii. When the conclusion is true
iii. When the premise and conclusion are both true
Conditions for an implication to be false:
i. When the premise is true and the conclusion is false

P ⇒ Q can be read in several ways:


• If P, then Q
• P only if Q
• P is a sufficient condition for Q
• Q is a necessary condition for P
• Q if P
• Q follows from P
• Q provided P
• Q is a logical consequence of P
• Q whenever P
Converse and Contrapositive Statements
An example of an implication statement is Pythagoras’s theorem, which states that “If
ABC is a right-angled triangle, then the sum of…”. Sometimes, such a theorem is
proven by proving its converse.
For a theorem P ⇒ Q:
• Q ⇒ P is called the converse;
• ¬Q ⇒ ¬P is called the contrapositive.

Suppose Pythagoras’ theorem states that


If ABC is a right angle at B then (AB)2 + (BC)2 = (AC)2
The converse will be as follows:
“If a triangle ABC has (AC)2 = (AB)2 + (BC)2 then the triangle is right-angled at B.”
In this case, it happens that both the theorem and its converse are true but there are
several situations when a theorem is true and the converse is not i.e., “because P ⇒ Q
is true, it doesn’t mean that the converse, Q ⇒ P is true.

Whereas, the contrapositive ¬Q ⇒ ¬P is true whenever P ⇒ Q.

This claim is shown in the truth table below:


P Q P⇒Q ¬P ¬Q ¬Q ⇒ ¬P
0 0 1 1 1 1
0 1 1 1 0 1
1 0 0 0 1 0
1 1 1 0 0 1
You can easily see that P ⇒ Q doesn’t always have same value as its converse Q ⇒ P.

However, P ⇒ Q is same as ¬Q ⇒ ¬P
You will find this contrapositive situation very useful. For instance, …
EXAMPLE (showing a contrapositive statement):
“A prime number is not a perfect number” can be written as
“If 𝑥 is a prime number, then it is not a perfect number.” or
“A perfect number is not a prime number.”

Truth table Hint:


To make a truth table for variables P, Q, R, S…, there will be one column for each
variable and there will be one row for each assignment. Each variable can be assigned
a value of true or false i.e., 0 or 1.
So, when there are four propositional variables, the number of possibilities will be
2 x 2 x 2 x 2 = 16. This is the number of rows in the truth table.
Generally, the truth table associated with n variables has
• n columns
• 2n possible assignment i.e., 2n rows
• 2n rows representing binary numbers from 0 to 2n – 1

vi. Equivalence denoted as ⇔


P Q P⇔Q
0 0 1
0 1 0
1 0 0
1 1 1
P ⇔ Q is read as:
• P is equivalent to Q
• P if and only if Q
• P is a necessary and sufficient condition for Q
P ⇔ Q is true when both P and Q have the same values.
(In Boolean algebra, we study NAND and NOR while in Logic we study Implication and
Equivalence.)
EXAMPLE: Construct truth tables for the following:
i. (Q ˄ ¬P) ⇒ P
ii. [(P ˄ Q) ˅ ¬R] ⇔ P

Solution:
i. (Q ˄ ¬P) ⇒ P

P Q ¬P Q ˄ ¬P (Q ˄ ¬P) ⇒ P
0 0 1 0 1
0 1 1 1 0
1 0 0 0 1
1 1 0 0 1

Consequence Premise
ii. [(P ˄ Q) ˅ ¬R] ⇔ P

P Q R P ˄ Q ¬R [(P ˄ Q) ˅ ¬R [(P ˄ Q) ˅ ¬R] ⇔ P


0 0 0 0 1 1 0
0 0 1 0 0 0 1
0 1 0 0 1 1 0
0 1 1 0 0 0 1
1 0 0 0 1 1 1
1 0 1 0 0 0 0
1 1 0 1 1 1 1
1 1 1 1 0 1 1

Tautology
A tautology is a propositional form whose truth value is true for all possible values of its
propositional variables.
EXAMPLE: P ˅ ¬P
This statement is always true. If P is false, ¬P will true, which makes the whole
expression true. Likewise, if P is false, ¬P will be true hence, the whole expression is
true [by disjunction]. Such a statement is called a tautology.

Contradiction and Absurdity


This is a propositional form which is always false.
EXAMPLE: P ˄ ¬P is a contradiction.

Contingency
This is a propositional form, which is neither a tautology nor a contradiction.
EXAMPLE: The truth table for these statements
[(P ˄ Q) ˅ ¬R] ⇔ P
(Q ˄ ¬P) ⇒ P
Shows that each proposition is a possibility or a condition because in some cases, they
are true and in some other, they are false.

How to Check for A Tautology or Contradiction


Given a propositional form, you can find out if it is a tautology of contradiction by
drawing the truth table. If the last column is:
• always true i.e., all 1’s, then it is a tautology;
• always false, i.e., all 0’s, then it is a contradiction;
• alternates between true and false i.e., 0 1 0 1, it is a contingency.

Logical Identities
P ⇔P˅P Idempotence of ˅
P ⇔P˄P Idempotence of ˄
(P ˅ Q) ⇔ (Q ˅ P) Commutativity of ˅
(P ˄ Q) ⇔ (Q ˄ P) Commutativity of ˄
[(P ˅ Q) ˅ R] ⇔ [P ˅ (Q ˅ R)] Associativity of ˅
[(P ˄ Q) ˄ R] ⇔ [P ˄ (Q ˄ R)] Associativity of ˄
¬(P ˅ Q) ⇔ (¬P ˄ ¬Q) De Morgan’s law
¬(P ˄ Q) ⇔ (¬P ˅ ¬Q) De Morgan’s law
[P ˄ (Q ˅ R)] ⇔ [(P ˄ Q) ˅ (P ˄ R)] Distribution of ˄ over ˅
[P ˅ (Q ˄ R)] ⇔ [(P ˅ Q) ˄ (P ˅ R)] Distribution of ˅ over ˄

(P ˅ 1) ⇔ 1
(P ˄ 1) ⇔ P
(P ˅ 0) ⇔ P
(P ˄ 0) ⇔ 0
(P ˅ ¬P) ⇔ 1 Tautology
(P ˄ ¬P) ⇔ 0 Absurdity
P ⇔ ¬(¬P) Double negation

(P ⇒ Q) ⇔ (¬P ˅ Q) Implication
(P ⇔ Q) ⇔ [(P ⇒ Q) ˄ [(Q ⇒ P)] Equivalence
[(P ˄ Q) ⇒ R] ⇔ [(P ⇒ (Q ⇒ R)] Exportation
(P ⇒ Q) ⇔ (¬Q ⇒ ¬P) Contrapositive

These logical identities are used to simplify logical expressions.


Note:
• ¬ has a higher order [or priority] than ˄, followed by ˅.
• ⇒ is not associative.
• For De Morgan’s law, when you bring ¬ into the bracket, the logical connector,
˄ or ˅, within the bracket is reversed.

LECTURE 2
Recap
We considered the following and their associated truth tables:
• propositions P and Q
• logical operations P ˄ Q and P ˅ Q
• unary operation ¬P
• exclusive operator P ⊕ Q
• implication P ⇒ Q
• equivalence P ⇔ Q
• converse of P ⇒ Q is Q ⇒ P

Note:
Is not always necessary to have 2k rows for the truth table. For example: to show that a
propositional form is a contingency, it is enough to show on one row that the resultant
expression takes a value of 1; and on another row that the resultant expression takes a
value of 0. Without writing all the 2k rows, this sufficiently shows that the statement is a
contingency because some assignments take the value of 1 and the others, 0.

In the next example we shall consider a simplified truth table.

EXAMPLE: Using a simplified truth table, show that (P ˄ Q) ⇒ P


Solution:
P Q P ˄Q (P ˄ Q) ⇒ P
1 1 1 1
This is a tautology so if we write out all the four rows, we will see that the column
will be all 1’s. So, writing only one row for this implication is enough because (P ˄ Q) will
always be true when P is true and Q is true. The implication will only be false when (P ˄
Q) is true and P is false, which is not the case. Recall that and implication is only false
when the premise is true and the conclusion is false.

Logical Identities (revisited)


˄ and ˅ are associative so, without ambiguity, you can write
P ˄ Q ˄ R,
P ˅ Q ˅ R.
But when you are in doubt, you can use parenthesis.
However, P ⇒ Q ⇒ R is ambiguous because it might mean
(P ⇒ Q) ⇒ R or
P ⇒ (Q ⇒ R)
which are not the same. Since implication is not associative, you have to use
parenthesis to represent the intended idea.

EXAMPLE: In order to show that implication is not associative, consider the truth table
for (P ⇒ Q) ⇒ R and P ⇒ (Q ⇒ R).
Solution:
P Q R P ⇒ Q Q⇒R (P ⇒ Q) ⇒ R P ⇒ (Q ⇒ R)
0 0 0 1 1 0 1
0 0 1 1 1 1 1
0 1 0 1 0 0 1
0 1 1 1 1 1 1
1 0 0 0 1 1 1
1 0 1 0 1 1 1
1 1 0 1 0 0 0
1 1 1 1 1 1 1

These columns are not the same, which shows


that implication is not associative.

EXAMPLE: Show on a truth table that this implication (P ⇒ Q) ⇔ (¬P ˅ Q) is true. Tell
what it is.
P Q P⇒Q ¬P ¬P ˅ Q (P ⇒ Q) ⇔ (¬P ˅ Q)
0 0 1 1 1 1
0 1 1 1 1 1
1 0 0 0 0 1
1 1 1 0 1 1

Premise and Conclusion


are equivalent or the same.
So, an expression P ⇒ Q can be replaced with ¬P ˅ Q. This [contrapositive] statement
is a tautology.

EXAMPLE: Show on a truth table that the propositions below are equivalent.
(P ⇔ Q) ⇔ [(P ⇒ Q) ˄ (Q ⇒ P)]
Solution:
P Q P⇔Q P⇒Q Q⇒P (P ⇔ Q) ⇔ [(P ⇒ Q) ˄ (Q ⇒ P)]
0 0 1 1 1 1
0 1 1 1 1 1
1 0 0 0 0 1
1 1 1 0 1 1

Premise and conclusion


are equivalent or identical

EXAMPLE: Show on a truth table that the exportation, below, is true.


[(P ˄ Q) ⇒ R] ⇔ [P ⇒ (Q ⇒ R)]
Solution:
P Q R P ˄ Q (P ˄ Q) ⇒ R Q⇒R P ⇒ (Q ⇒ R)
0 0 0 0 1 1 1
0 0 1 0 1 1 1
0 1 0 0 1 0 1
0 1 1 0 1 1 1
1 0 0 0 1 1 1
1 0 1 0 1 1 1
1 1 0 1 0 0 0
1 1 1 1 1 1 1

Premise and Conclusion


are equivalent or identical

EXAMPLE: Show on a truth table that the expression below is a contrapositive.


(P ⇒ Q) ⇔ (¬Q ⇒ ¬P)

Solution:
P Q P⇒Q ¬Q ¬P ¬Q ⇒ ¬P
0 0 1 1 1 1
0 1 1 0 1 1
1 0 0 1 0 0
1 1 1 0 0 1

Premise and Conclusion


are equivalent or identical
EXAMPLE: The statements below are contrapositive:

“If I fall into the lake, I will get wet.”

“If I don’t get wet, then I have not fallen into the lake.”

These rules or logical identities can be used to simplify logical expressions or well-
formed formulae of propositional logic.
We will use the aforementioned logical identities or rules to simplify expressions in the
following examples.

EXAMPLE: Simplify [(A ⇒ B) ˅ (A ⇒D)] ⇒ (B ˅ D)


Solution:
A, B, C and D are propositional variables.
First of all, we shall convert ⇒ to ˅

Recall: (A ⇒ B) is same as (¬A ˅ B) by


contraposition
(A ⇒ D) is same as (¬A ˅ D) by
contraposition
So, we have:
(¬A ˅ B) ˅ (¬A ˅ D) ⇒ (B ˅ D)
Factorizing ¬A out:
[¬A ˅ (B ˅ D)] ⇒ (B ˅ D)
Using the identity (P ⇒ Q) ⇔ (¬P ˅ Q): by
contraposition
¬[¬A ˅ (B ˅ D)] ˅ (B ˅ D)
Using De Morgan’s laws:
[A ˄ ¬(B ˅ D)] ˅ (B ˅ D)
Using Distributive law:
[A ˅ (B ˅ D)] ˄ [¬(B ˅ D) ˅ (B ˅ D)]
Recall that (¬P ˅ P) = 1 tautology:
[A ˅ (B ˅ D)] ˄ 1
[A ˅ (B ˅ D)]

Because of the associativity of ˅:


A˅B˅D

EXAMPLE: Convert the following English sentences into logical notations.


P: It is snowing
Q: I will go to town
R: I have time
Using logical connectives, write a proposition which symbolizes the following sentences:

(a) If it is not snowing and I have time, then I will go to town.


Solution:
(¬P ˄ R) ⇒ Q
(b) I will go to town only if I have time.
Solution:
Q⇒R
(c) It is not snowing.
Solution:
¬P
(d) It is snowing and I will not go to town.
Solution:
P ˄ ¬Q

EXAMPLE: Transcribe the following propositions to English sentences.

(a) Q ⇔ (R ˄ ¬P)
Solution:
I will go to town if and only if I have time and it is not snowing.

(b) R ˄ Q
Solution:
I have time and I will go to town.

(c) (Q ⇒R) ˄ (R ⇒ Q)
Solution:
I will go to town only if I have time and if I have time I will go to town.

Alternative Solution: Since [(Q ⇒ R) ˄ (R ⇒ Q)] is same as (Q ⇔R)


I will go to town if and only if I have time.
(d) ¬ (R ˅ Q)
Solution:
It is not true that I have time or I will go to town.

Let’s consider more logical identities.

Rules of Inference: Logical Implications that are tautologies


P ⇒ (P ˅ Q) Addition
(P ˄ Q) ⇒ P Simplification
[P ˄ (P ⇒ Q)] ⇒ Q Modus ponens
[(P ⇒ Q) ˄ ¬Q] ⇒ ¬P Modus tollens

[¬P ˄ (P ˅ Q)] ⇒ Q Disjunctive syllogism


[(P ⇒ Q) ˄ (Q ⇒ R)] ⇒ (P ⇒ R) Equivalence
[(P ⇒ Q) ˄ (R ⇒ S)] ⇒ [(P ˄ R) ⇒ (Q ˄ S)] Equivalence
[(P ⇔ Q) ˄ (Q ⇔R)] ⇒ (P ⇔ R)

There are tautologies that involve implications – these are called rules of inference. We
shall consider them later.

Explanation of the Rules of Inference


For Addition P ⇒ (P ˅ Q)
When you have P, its value is not altered if you add something to it. This rule of
inference tells you that from P, you can draw a conclusion on (P ˅ Q).

For Simplification (P ˄ Q) ⇒ P
From (P ˄ Q), you can conclude P because (P ˄ Q) will be true only when P is
true and Q is true.

For Modus ponens [P ˄ (P ⇒ Q)] ⇒ Q


Let’s draw the truth table for this rule.

P Q P⇒Q P ˄ (P ⇒ Q)] [P ˄ (P ⇒ Q)] ⇒ Q


0 0 1 0 1
0 1 1 0 1
1 0 0 0 1
1 1 1 1 1
Considering this table for Modus ponens, we have four possible assignments for
P and Q, which is indicated by four rows; and we have written down the possible
values. The last column, which is the compound statement is true only when the
antecedent is false or the consequence is true.
Looking at the last column, you will see that the statement is a tautology because
all the values are 1.
This is called Modus ponens and as a law of inference, it is written as
P
P⇒Q Modus ponens
 Q conclusion

For Modus tollens [(P⇒ Q) ˄ ¬Q] ⇒ ¬P


As a rule of inference, this Modus tollens is written as
P⇒Q
¬Q ….
 ¬P

EXERCISE 1
A certain country is inhabited only by people who either always tell the truth or always
tell lies and who will respond to questions only with a “yes” or a “no”. A tourist comes to
a fork in the road, where one branch leads to the capital and the other does not. There
is no sign indicating which branch to take, but there is an inhabitant, Mr Zee, standing at
the fork. What single yes/no question should the tourist ask him in order to determine
which branch to take?
Solution:

Left Right

Inhabi
tant
The tourist has to ask a single yes/no question such that if the inhabitant answers yes,
he must go left; ‘no’, he must go right.
But the tourist does not know if Mr Zee, the inhabitant is a truth teller or a liar. So, there
are four possibilities: The left road may lead to the capital or the right road may lead to
the capital; and the inhabitant may be a truth teller or a liar. These possibilities are
represented below:

Left Right
Truth Teller (TT) Yes Yes
Liar No No

If the answer is ‘yes’, the tourist will take the left road.
If the answer is ‘no’, the tourist will take the right road.
But the liar always lies.
So, the correct answer the tourist should expect from a truth teller and liar is
respectively given below:

Left Right
Truthful Yes No
Liar No Yes

From the table above, the correct question is given below:

“Is it true that you are a truth teller and the left road leads to the
capital or you are a liar and the right road leads to a capital?”

That is a combination of two expectations using the logical operator, OR.


However, that question is not a unique – it can be asked in other forms:

“If I ask you whether the left road leads to the capital, you will say
‘yes’, won’t you?”

“If I ask the other kind of person whether the left road leads to the
capital, he will say ‘yes’, won’t he?”
EXERCISE 2
Five persons A, B, C, D, E, are in a compartment in a train. A, C and E are men and B
and D are women. The train passes through a tunnel and when it emerges, it is found
that E is murdered. An emergency enquiry is held where A, B, C and D make the
following statements:
A: I am an innocent; B was talking to E when the train was passing through
the tunnel.
B: I am innocent; I was not talking to E when the train was passing through
the tunnel.
C: I am innocent; D committed the murder.
D: I am innocent; one of the men committed the murder.
Four of these eight statements are true and four are false. Assuming only one person
committed the murder, who did it?
Hint:
• Remember that A and C are men while B and D are women
• Each person has made two statements
• Four of the statement are true while the other four are false
• Assume four statements to be true and four false
• Assuming only one person committed the murder, who did?
• From the eight statements, how do you know who committed the murder?
• A, B, C and D say “I am innocent”.

But only one person committed the murder so out of A, B, C and D, three persons must
be saying the truth and one person must be lying
So, there are eight statements and each person makes statement 1 and statement 2 –
represented below:
A: 1 2
B: 1 2
C: 1 2
D: 1 2
3–T 3–F
1–F 1–T

Out of the remaining four statements, 3 will be false and 1 must be true.
Examining the second statements of A and B
A: B was talking to E when the train was passing through the tunnel
B: B was not talking to E when the train was passing through the tunnel.
It can be observed that one statement is a negation of the other.
So, either of them may be false and the other true.
A 2 T
One of them is true and the other false
B 2 F

Therefore, the second statements of C and D are definitely false


C 2 F
Both of them are false
D 2 F

C says D committed the murder so we can see that


D did not commit the murder
D says one of the men committed the murder, which means that
A and C did not commit the murder.
So,

B committed the murder.

In that case,
A 1, C 1, D 1, B 2 are true while the remaining (4)
statements are false. This satisfies the condition.

EXERCISE 3
You are in the catacombs, there are two guards by a fork in the tunnel and you have
been told that one always lies and the other never does. What question would you ask
any of them in order to get the right direction?
Solution:
The question you can ask is:
“Which way would the other guard tell me to go?”

LECTURE 3
EXERCISE 4
A tourist is enjoying an afternoon refreshment in a local pub in England when the
bartender says to him: “Do you see those three men over there? One is Mr. X, who
always tells the truth, another is Mr. Y, who always lies, and the third is Mr Z, who
sometimes tells the truth and sometimes lies. (That is, Mr. Z answers ‘yes’ or ‘no’ at
random without regard to the question.) You may ask them three yes or no questions,
always indicating which man should answer. If, after asking these three questions, you
correctly identify Mr. X, Mr. Y, and Mr. Z, they will buy you a drink.” What yes/no
questions should the thirsty tourist ask?

Hint:

Waiter points out to 3 X Y Z


Tourist people, X, Y, Z, standing
in a row

The waiter then introduces the three men to the tourist and tells him that one is Mr X…
X Truth Teller
Y Liar
Z Unpredictable (Sometimes tells lies or truth )
The tourist should ask three questions that indicate who will answer. Also, the questions
should be asked in such a way that the next question is determined by the answer to
the preceding question.
If the yes/no question is correct,
X will answer ‘yes’;
Y will answer ‘no’;
Z will randomly say ‘yes’ or ‘no’, without any consideration.
The first question is important – it should be asked in such a way that Mr Z is eliminated
because it is easier to deal with a person that always tells the truth or always tells lies
than someone that is unpredictable. Therefore, you have to discover who Mr Z is and
eliminate him.
After eliminating Mr Z, the second and the third questions can be asked.
Alternatively
This puzzle is similar to Exercise 3 except for the addition of the random option.
The best you can do is to spend two questions working out who Mr Z is, then ask one
question, like the ones in Exercise 3, in order to identify the truth teller and the liar. i.e.
Figuring out who is Mr Z the unpredictable:
I ask X: “I give you two statements – is exactly one of them true? The
statements are
1. Do you always speak the truth?
2. Does Y tell truth and lie randomly?”
If Mr X answers YES it can have three possible cases.
a) X tells the truth always – that is the only true statement so
Mr Y is a liar
b) X answers my question randomly.
c) X is a liar so both statements are false therefore, Mr Y is not
a random person.
Here, the common thing is that Y is not a random / unpredictable
person.
Similarly, if Mr X answers NO, there are three possible cases:
(a) X lies always – that is the only truth statement so Mr Y is
the liar.
(b) X answers the question randomly.
(c) X tells the truth always so both statements are false
therefore Mr Y is not random
So, with one question exhausted, we can identify Mr Z as a
random person while Mr Y is not random.
Next thing is to go to that person, Mr Y, who is not random and ask him a
truism, which is a universal truth like “Does Sunday come before
Monday?” A YES or NO will confirm that Mr Y is a truth teller or a liar
respectively.
Suppose we ascertain the fact that Mr Y is a truth teller, we then go on to
ask him “Does Mr X always lie?”
So, we immediately know the status of X and Z based on the
answer.
The same analysis can be done in any case and the tourist will recognize X, Y and Z
and enjoy his drink.

EXERCISE 5
Brown, Jones and Smith are suspected of income tax evasion. They testify under oath
as follows:
Brown: Jones is guilty and Smith is innocent
Jones: If Brown is guilty, then so is Smith.
Smith: I am innocent but at least one of the others is guilty.
(a) Assuming everybody told the truth, who is/are innocent or guilty?
(b) Assuming the innocent told the truth and the guilty lied, who is/are
innocent/guilty?
Hint:
We have to translate these statements into logical notations before solving the problem.
The first part is easy…
Solution
(a) Assuming everybody told the truth…
From the first statement, we can infer that
• Jones is guilty and Smith is Innocent. JG ˄ SI
• If Brown is guilty, then so is Smith. BG ⇒ SG
The contrapositive is ‘If Smith is not guilty, Brown is not guilty.
¬SG ⇒ ¬BG

Therefore, we can conclude that:


Brown is innocent, Jones is guilty and Smith is innocent.

(b) Assuming the innocent told the truth and the guilty lied…
From the statements, the logical interpretations follow
• Brown: JG ˄ SI
• Jones: BG ⇒ SG or ¬SG ⇒ ¬BG
• Smith: SI ˄ (JG ⊕ BG) or SI ˄ (JI ⊕ BI)
If Jones lies, the implication ¬SG ⇒ BG holds so, we can conclude that:
Brown is guilty, Jones is guilty and Smith is innocent.

First, let us consider Brown – From Smith’s statement, there are two possibilities:
Brown is innocent or guilty – If he is innocent, he must be telling the truth
Brown
Innocent Guilty
B I B G G G G
J G J I I G G
S I S I G I G
  ✓  

This possibility is ruled out because B says J is


guilty and considering Jones’ original statement
BG ⇒ SG, it tallies with what Brown is saying but
this should not be the case because J is guilty.

Considering the first guilty possibility G-I-I from the table, Jones is innocent so he is
telling the truth. Recall his statement BG ⇒ SG or ¬SG ⇒ ¬BG. This makes this
possibility to be ruled out.
The next possibility G-I-G looks correct based on Jones’ statement and his innocent
status.
Considering the possibility G-G-I
If Brown is guilty, his statement (JG ˄ SI) should be incorrect. So, the negation
¬ (JG ˄ SI) = (JI ˄ SG) should be the truth
Also, considering the possibility GGG
In this case Jones says that BG ⇒ SG This corresponds to his actual statement
but it is not supposed to be so since Jones is guilty and cannot tell the truth.
Therefore, the correct answer is
Brown is guilty, Jones is innocent and Smith is guilty.
¬B ˄ J ˄ ¬S or BG ˄ JI ˄ SG

RECAP
We have discussed propositions, the logical connectors ˄, ˅, ⇒, and ⇔; unary operators
¬; identities of logical connectors; identities of logical expressions; simplification of
logical expressions; tautology, contradictions and contingency; and how to use logic to
solve problems.
PREDICATES AND QUANTIFIERS
Earlier, we have seen that a statement like 𝑥 > 3, 𝑥 + 𝑦 = 7 are assertions and not
propositions because the truth value of the statements will depend on the value
assigned to the individual variables 𝑥 and 𝑦.
In English language, we have statements like the following:
She is tall and fair.
X was born in city Y in the year Z.
He was born in city Y in the year Z.
Here, we do not know who the pronouns she / he refers to. Such statements are called
predicates. The value assigned to them determines the truth value of the statement.
Predicates are usually expressed in the form of P(x, y, z).

EXAMPLE: The predicate 𝑥 + 𝑦 = 𝑧 is represented as


𝑆𝑢𝑚(𝑥, 𝑦, 𝑧).

EXAMPLE: M(x, y) stands for x is married to y.

In programs, you usually come across statements like


IF 𝑥 > 3
THEN y = 5
ELSE y = 7
Here, 𝑥 > 3 is the predicate and when the control comes to such statement, it evaluates
it and determines if it is true or false. If this first statement / predicate is true, the control
will execute the second statement, which is the THEN portion but if it is false, the control
will execute the ELSE portion.

Forms of Predicates
The table below shows the general forms of predicates.
Predicate form Description
P(x) Unary predicate has an individual variable
Q(x, y) Binary predicate
P(x1, x2,…,xn) n-ary predicate or n-place predicate
The values of the variables are chosen from the Universe of Set also known as
Underlying Universe or Universe of Discourse. In the previous example, M(x, y) – the
value of x and y are gotten from the set of human beings. Also, for Sum(x, y, z) and the
programming example, 𝑥, y and z can take values from the set of real numbers, integers
or non-negative integers – In such cases, you have to specify the underlying universe
because a statement which is true for real numbers may not always be true for integers.
Similarly, for the predicate “𝑥 was born in y in the year z”:
𝑥 takes values from the set of human beings;
y takes values from the set of years; and
z takes values from the set of cities.

Predicate Constants and Predicate Variables


𝑆𝑢𝑚(𝑥, 𝑦, 𝑧) is a predicate constant which represents the sum of x and y = z.
Whereas P(x1, x2,…,xn) is a predicate variable, to which you can assign any n-place
predicate. When you assign particular values c1, c2,…, cn to x1, x2,…, xn, the predicate
P(x1, x2,…,xn) becomes a proposition P(c1, c2,…, cn), which takes a truth value – true or
false.

EXAMPLE: 𝑥 + 𝑦 = 𝑧 where 𝑥 = 2, 𝑦 = 3 and 𝑧 = 5.


It becomes a proposition
2+3=5

Valid, Satisfiable and Unsatisfiable Predicates


Corollary:
i. If P(𝑥1 , 𝑥2 ,…, 𝑥n ) is true for all values c1 , c2 ,…, cn from the universe 𝐔, you say
that P(𝑥1 , 𝑥2 ,…, 𝑥n ) is valid in 𝐔.
ii. If P(𝑥1 , 𝑥2 ,…, 𝑥n ) is not true for all values c1 , c2 ,…, cn from 𝐔, you say that P is
satisfiable in 𝑼.
iii. If P is not true for any set of values c1 , c2 ,…, cn from 𝐔, P is said to be
unsatisfiable in 𝐔.
So, we have valid, satisfiable and unsatisfiable predicates.
Converting Predicates to Propositions
A predicate P(𝑥, 𝑦) can be converted to a proposition by assigning values to the
variables 𝑥 and 𝑦 - This is known as binding variables.
When you use a quantifier on a predicate, you are binding.
Similarly, when you bind the predicate of a u-nary predicate, it becomes a proposition.
To convert a binary predicate [which has two variables x and y] to a proposition, you
have to bind both variables.
Two ways of converting a predicate to a proposition:
• By assigning values to the variables
• By using quantifiers such as
o Universal quantifiers, x
o Existential quantifiers, x
o Unique existential quantifiers, !x

Using Quantifiers to Bind Variables


Another way of binding variables is by using quantifiers.
I. Universal Quantifiers, 𝒙
You can bind the predicate P(x) with the use of x, which results in
𝑥P(𝑥)
x is read as:
For all of 𝑥
For every 𝑥
For each 𝑥
For arbitrary 𝑥
When you use a quantifier, the predicate is automatically bound.
EXAMPLE: (Using universal quantifiers to bind predicates)
Let 𝐔 be the set of integers. Consider these predicates:
𝑥 < 𝑥 + 3
𝑥 = 3 and
𝑥 = 𝑥 + 1
Converting each of them to a proposition:
𝑥 [𝑥 < 𝑥 + 1] true
𝑥 [𝑥 = 3] false
𝑥 [𝑥 = x + 1] false
II. Existential Quantifiers, 𝒙
𝑥P(𝑥) is read as
There exists 𝑥 such that P(𝑥) is true.
For some 𝑥, P(𝑥) is true.

EXAMPLE: Applying Existential Quantifiers


Let 𝑈 be the set of integers. Apply the existential quantifier to the following predicates.
𝑥 < 𝑥 + 1
𝑥 = 3
𝑥 = 𝑥 + 1
Solution:
Proposition Value
𝑥[𝑥 < 𝑥 + 1] True
𝑥[𝑥 = 3] True
𝑥[𝑥 = 𝑥 + 1] False

III. Unique Existential Quantifiers, !𝒙


!𝑥P(𝑥) is read as
There exists a unique 𝑥 such that P(𝑥) is true;
There is one and only one 𝑥 such that P(𝑥) is true.
This uniqueness quantification, !𝑥 is not frequently used because it can be
expressed in terms of 𝑥 and 𝑥.

EXAMPLE: Uniqueness quantification


! 𝑥[𝑥 < 𝑥 + 1] false
! 𝑥[𝑥 = 3] true
! 𝑥[𝑥 = 𝑥 + 1] false

Expressing !𝒙P(𝒙) in terms of 𝒙 and 𝒙


‘There exists at most one 𝑥’ can be expressed as any of the following:

(a) 𝑥[P(𝑥) ˄ 𝑦{P(𝑦) ⇒ 𝑥 = 𝑦}] This is quite lengthy. Alternatively:


(b) 𝑥𝑥{P(𝑦) ⇒ 𝑥 = 𝑦}
Using Quantifiers with Variables
Consider the predicate
𝑥P(𝑥, 𝑦, 𝑧).

Here, 𝑥 is bound while y and z are free variables so, it is a binary predicate. These free
variables can still be bound using quantifiers or by assigning values to them. For
instance, if
𝑦 = 2, we will have
𝑥P(𝑥, 2, 𝑧). This is now a u-nary predicate.

Furthermore,
𝑧𝑥P(𝑥, 𝑦, 𝑧) is now a proposition, which takes true or false
values when the underlying universe is specified.

EXAMPLE: Consider the statement


Sum 𝑥 + 𝑦 = 𝑧 denoted as
Sum(𝑥, 𝑦, 𝑧)
In the predicate ySum(𝑥, 𝑦, 𝑧), y is bound while 𝑥 and 𝑧 are free.
Now, if the underlying universe is specified as U = N, the set of non-negative integers,
the variables 𝑥, 𝑦, 𝑧 will take values from N.
ySum(𝑥, 𝑦, 𝑧) is read as
‘There exists 𝑦 such that the sum of 𝑥 and 𝑦 is equal to 𝑧 if all 𝑥, 𝑦, 𝑧 are
non-negative integers.’
This implies that x ≤ z
So, the proposition ySum(𝑥, 𝑦, 𝑧) actually stands for predicate
P(𝑥, 𝑧)
𝑥 ≤ 𝑧
EXAMPLE: If U = {1, 2, 3} then
𝑥P(𝑥) represents P(1) ˄ P(2) ˄ P(3)

𝑥P(𝑥) represents P(1) ˅ P(2) ˅ P(3)

!𝑥P(𝑥) represents (P(1) ˄ ¬P(2) ˄ ¬P(3)) ˅ (¬P(1) ˄ P(2) ˄ ¬P(3)) ˅ (¬P(1) ˄

¬P(2) ˄ P(3))
Now, if U = N = {0, 1, 2, 3, … }
𝑥P(𝑥) P(0) ˄ P(2) ˄ P(3) ˄ … Infinite conjunction
𝑥P(𝑥) P(0) ˅ P(1) ˅ P(2) ˅… Infinite disjunction
Note:
Be mindful of the scope of the quantifiers: Take note of the variable it is meant to bind.
I.e.
If in addition to the individual variables 𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n of a predicate P(𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n ),
there is an additional variable y and you make the following statement:
yP(𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n ), such that y ≠ 𝑥1 , 𝑥n , 𝑥3 ,… or 𝑥n
Binding with 𝑦 will not affect P(𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n ) because the scope
of the predicate does not involve 𝑦.
In the same vein,
𝑦P(𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n ) is equivalent to P(𝑥1 , 𝑥n , 𝑥3 ,… 𝑥n )

EXAMPLE: Consider the following statements:


(a) 𝑥𝑦P(𝑥, 𝑦)
It is read as “For all values of 𝑥 and for all values of 𝑦, P of 𝑥, 𝑦 is true.”
Here, P is a binary predicate with variables 𝑥 and 𝑦.

(b) 𝑥𝑦P(𝑥, 𝑦)
It is read as “There exists 𝑥 such that for all values of 𝑦, P(𝑥, 𝑦) is true.”
Here, the variable 𝑥 is bound by the existential quantifier while 𝑦 is bound
by the universal quantifier.
Also, the value of 𝑥 is fixed and independent of the value of 𝑦.

(c) 𝑦𝑥P(𝑥, 𝑦)
“For any 𝑦, there exists 𝑥 such that P(𝑥, 𝑦) is true.
Here, the value of 𝑥 depends on the value of 𝑦.

Therefore, 𝑥𝑦P(𝑥, 𝑦) ⇎ 𝑦𝑥P(𝑥, 𝑦).


You cannot exchange the position of two different types of quantifiers otherwise, the
meaning of the statement will be altered.
However, you can exchange the positions of the same type of quantifiers that
respectively bind different variables. i.e.
𝑥 𝑦 ⇔ 𝑦𝑥
𝑥 𝑦 ⇔ 𝑦𝑥

EXAMPLE: To show how changing the order of quantifiers affects the meaning of a
statement.
(a) 𝑥𝑦[𝑥 is married to 𝑦]. This is true because it asserts that for any x, there is a
person 𝑦 to whom 𝑥 is married to". However,
(b) 𝑦𝑥[𝑥 is married to 𝑦]. This is false because it asserts that there is some
person in the universe who is married to everyone.

Let the universe of discourse be integers 𝐙 = {… , −2, −1, 0, 1, 2, … }. The


assertion:

(c) 𝑥𝑦[𝑥 + 𝑦 = 0] “For all 𝑥, there exists a y such that 𝑥 + 𝑦 = 0” is true because
for any value of 𝑥, there is a value y such that y = -𝑥, which makes the
proposition 𝑥 + 𝑦 = 0 true.

(d) 𝑦𝑥[𝑥 + 𝑦 = 0] states that “There exists a y such that for all 𝑥, 𝑥 + 𝑦 = 0”.
This assertion means that the value of y can be chosen independently of the
value of 𝑥. Since no 𝑦 exists, which yields zero when added to an arbitrary
integer, this proposition is false. (To make this statement true, you have
to interchange the quantifiers.)

(e) 𝑥𝑦!𝑧[𝑥 + 𝑦 = 𝑧] asserts that for every pair of integers 𝑥 and 𝑦, there is a
unique integer 𝑧, which equals their sum. This assertion is true.
(Interchanging the last two quantifiers results in the next proposition:)

(f) 𝑥!𝑧𝑦[𝑥 + 𝑦 = 𝑧] asserts that for every 𝑥, a unique 𝑧 can be chosen such
that no matter what y is added to 𝑥, 𝑥 + 𝑦 = 𝑧. This proposition is false.

(g) ! 𝑥[𝑥. 6 = 0] is true since the equation 𝑥. 6 = 0 is true if and only if 𝑥 = 0.

(h) 𝑥y[𝑥. y = 0] is true but if you reverse the order as below

(i) 𝑦! 𝑥[𝑥. 𝑦 = 0] is false because at 𝑦 = 0, any value of 𝑥 will yield zero whereas
the statement implies that it should be a unique value of 𝑥.
Similarly,

(j) 𝑦! 𝑥[𝑥 + 𝑦 < 0] is false because for any value of 𝑦, there are many values of 𝑥
for which the sum of 𝑥 and 𝑦 is negative.

EXAMPLE: To show that interchanging the position of the same type of quantifiers does
not alter the meaning of a statement.
Consider the set of natural numbers as the underlying universe i.e.
𝐔=𝐍
𝑥𝑦P(𝑥, 𝑦) can be expanded as
[𝑦P(0, 𝑦)] ˄ [𝑦P(1, 𝑦)] ˄ [𝑦P(2, 𝑦)] ˄… which can be represented as
[P(0, 0) ˄ P(0, 1) ˄ P(0, 2),…]
˄ [P(1, 0) ˄ P(1, 1) ˄ P(1, 2),…]
˄ [P(2, 0) ˄ P(2, 1) ˄ P(2, 2),…]
˄…
Recall that the operator, ˄, is commutative and associative so, the order in which P(0,
0), P(0, 1),… occur can be interchanged in a conjunction.
Interchanging the order results in;
[P(0, 0) ˄ P(1, 0) ˄ P(2, 0),…]
˄ [P(0, 1) ˄ P(1, 1) ˄ P(2, 1),…]
˄ [P(0, 2) ˄ P(1, 2) ˄ P(2, 2),…]
˄…
Which represents
[𝑥P(𝑥, 0)] ˄ [𝑥P(𝑥, 1)] ˄ [𝑥P(𝑥, 2)] ˄ …
Grouping this altogether results in:
𝑥𝑦P(𝑥, 𝑦)
QED

The same argument can be used for the quantifier, , except that disjunction, ˅ will be
used in this case. ˅ is commutative and associative so,
𝑥𝑦 ⇔ 𝑦𝑥

Using Quantifiers to Convert English Sentences into Logical Notations

EXAMPLE: Quantifiers and Predicates


Let the universe of discourse be the integers and let
N(𝑥) denote “𝑥 is a negative integer”;
E(𝑥) denote “𝑥 is even”;
O(𝑥) denote “𝑥 is odd”; and
P(𝑥) denote “𝑥 is a prime integer”.
The following examples illustrate the transcription of assertions into logical notations:
(a) There exists an even integer.
𝑥E(𝑥)
(b) Every integer is even or odd.
𝑥[E(𝑥) ˅ O(𝑥)]

(c) All prime integers are non-negative.


𝑥[P(𝑥) ⇒ N(𝑥)]

(d) The only even prime is two.


𝑥[(E(𝑥) ˄ P(𝑥)) ⇒ 𝑥 = 2]

(e) There is one and only one even prime.


!𝑥[(E(𝑥) ˄ P(𝑥)]

(f) Not all integers are odd.


¬𝑥O(𝑥) OR 𝑥¬O(𝑥)

(g) Not all primes are odd.


¬𝑥[P(x) ⇒ O(𝑥)] OR 𝑥[P(𝑥) ˄ ¬O(𝑥)]

(h) If an integer is not odd, then it is even.


𝑥[¬O(𝑥) ⇒ E(𝑥)] Expanding with the rule P ⇒ Q ⇔ ¬P ˅ Q
𝑥[O(𝑥) ˅ E(𝑥)]

Note:
In algebra, when we write
𝑥 + 𝑦 = 𝑦 + 𝑥 and
𝑥 + (𝑦 + 𝑧) = (𝑥 + 𝑦) + 𝑧
we implicitly are writing
𝑥𝑦[𝑥 + 𝑦 = 𝑦 + 𝑥] and
𝑥𝑦𝑧[𝑥 + (𝑦 + 𝑧) = (𝑥 + 𝑦) + 𝑧] respectively.

The statement 𝑥𝑦 = 𝑧, which is denoted by P(𝑥, 𝑦, 𝑧), which is a predicate.


It is important to use parenthesis appropriately in order to specify the scope of
quantifiers and thus, remove ambiguity.

Let’s continue with more examples.


(i) If 𝑥𝑦 = 𝑥 for all 𝑦 then 𝑥 = 0.
𝑥[𝑦P(𝑥, 𝑦, 𝑥) ⇒ 𝑥 = 0]

Scope of 𝑦

Scope of 𝑥

However 𝑥𝑦P(𝑥, 𝑦, 𝑥) ⇒ 𝑥 = 0 is an incorrect logical notation because


at 𝑥 = 1 and 𝑦 = 1, the condition 𝑥𝑦 = 𝑥 is still satisfied.
Here, the scope of 𝑥 and 𝑦 is P(𝑥, 𝑦, 𝑥)
Likewise, 𝑥𝑦[P(𝑥, 𝑦, 𝑥) ⇒ 𝑥 = 0] is incorrect.
(j) If 𝑥𝑦 ≠ 𝑥 for some 𝑦 then 𝑥 ≠ 0.
𝑥[𝑦¬P(𝑥, 𝑦, 𝑧) ⇒ 𝑥 ≠ 0]
¬(𝑥 = 0)

Things to Note When Specifying the Scope of A Quantifier


1. You cannot distribute 𝒙 in a parenthesis – it changes the scope.
Consider these two propositions
𝑥(P(𝑥) ⇒ Q(𝑥))
𝑥P(𝑥) ⇒ 𝑥Q(𝑥)
They are not equivalency but implications i.e. one part, P(𝑥) is not equivalent to
the other, Q(𝑥) but one implies the other.

2. When you bring ¬ inside an expression, 𝒙 changes to 𝒙.


EXAMPLE: ¬𝑥P(𝑥) means that it is not true that for all 𝑥, P(𝑥) is true.
Therefore, it means that there is a value of 𝑥 for which P(𝑥) is not true. Hence
¬𝑥P(𝑥) ⇔ 𝑥¬P(𝑥)

3. Conversely, when you bring ¬ inside an expression 𝒙 becomes 𝒙


EXAMPLE: ¬𝑥P(𝑥) means that it is not true that there is a value of 𝑥 for which
P(𝑥) is true. This means that for all values of 𝑥, P(𝑥) is false. Hence
¬𝑥P(𝑥) ⇔ 𝑥¬P(𝑥)
Negation of a statement:
The negation of 𝑥𝑦𝑧P(𝑥, 𝑦, 𝑧) is
¬𝑥𝑦𝑧P(𝑥, 𝑦, 𝑧), which is equivalent to
𝑥¬𝑦𝑧P(𝑥, 𝑦, 𝑧), which is equivalent to
𝑥y¬𝑧P(𝑥, 𝑦, 𝑧), which is equivalent to
𝑥𝑦𝑧¬P(𝑥, 𝑦, 𝑧).

EXAMPLE: Consider the statement 𝑥+𝑧=𝑦 which actually means


𝑥𝑦𝑧(𝑥 + 𝑧 = 𝑦)
If 𝐔 = 𝐙,
this proposition, above, which asserts that “for any value of 𝑥 and for any value
of 𝑦, you can find a value of 𝑧 such that 𝑥 + 𝑦 = 𝑧” is true.
However, if 𝐔 = 𝐍,
the proposition ceases to be true. It is only true when 𝑦 > 𝑥. Therefore a valid
statement in this case is
¬𝑥𝑦𝑧(𝑥 + 𝑧 = 𝑦). Bring ¬ inside, it can be written as:
𝑥𝑦𝑧(𝑥 + 𝑧 ≠ 𝑦) OR 𝑥𝑦𝑧¬ (𝑥 + 𝑧 = 𝑦)

4. 𝒙 distributes over ˄ but does not distribute over ˅


EXAMPLE: Are the two statements below equivalent?
𝑥P(𝑥) ˄ 𝑥Q(𝑥)
𝑥(P(𝑥) ˄ Q(𝑥))
Answer: Yes, they are. For instance, if 𝐔 = 𝐍, 𝑥P(𝑥) ˄ 𝑥Q(𝑥) can written as
P(0) ˄ P(1) ˄ P(2)… ˄ Q(0) ˄ Q(1) ˄ Q(2) ˄ …
By commutation and association, the elements of expression can be grouped as

P(0) P(1) P(2)


( )˄( )˄( ) ˄…
Q(0) Q(1) Q(2)

So, they are equivalent.


EXAMPLE: Are these two statements equivalent?
𝑥P(𝑥) ˅ 𝑥Q(𝑥)
𝑥(P(𝑥) ˅ Q(𝑥))
Answer: No, they are not equivalent because the first expression asserts that “for
all of 𝑥, P(𝑥) is true or for all of 𝑥, Q(𝑥) is true.” While the second
expression asserts that “for every value of 𝑥, P(𝑥) or Q(𝑥) is true.”
In practical terms, if P(𝑥) denotes “𝑥 is an even integer” and
Q(𝑥) denotes “𝑥 is odd integer”,
𝑥(E(𝑥) ˅ O(𝑥)) means that “every integer is either even or odd” ✓
But 𝑥E(x) ˅ 𝑥O(𝑥) means that “every integer is even or every integer is odd" 

5. Conversely, 𝒙 distributes ˅ over but does not distribute over ˄.


By a similar argument, you can show that
𝑥P(𝑥) ˅ 𝑥Q(𝑥) is equivalent to
𝑥(P(𝑥) ˅ Q(𝑥))
but
𝑥P(𝑥) ˄ 𝑥Q(𝑥) is NOT equivalent to
𝑥(P(𝑥) ˄ Q(𝑥)).

6. 𝒙 does not distribute over ⇒

EXAMPLE: Are these two statements equivalent:


𝑥P(𝑥) ⇒ 𝑥Q(𝑥)
𝑥(P(𝑥) ⇒ Q(𝑥)) ?

Answer: No, they are not equivalent. The second statement


𝑥(P(𝑥) ⇒ Q(𝑥)) can be written as
𝑥(¬P(𝑥) ˅ Q(𝑥))
Since x distributes over ˅:
𝑥¬P(𝑥) ˅ 𝑥Q(𝑥)
Taking ¬ outside:
¬𝑥P(𝑥) ˅ 𝑥Q(𝑥) which can be written as
𝑥P(𝑥) ⇒ 𝑥Q(𝑥) equivalent to 𝑥P(𝑥) ⇒ Q(𝑥))
Therefore, 𝑥P(𝑥) ⇒ 𝑥Q(𝑥)is not equivalent to 𝑥P(𝑥) ⇒ Q(𝑥)).
The truth table for this is shown below:

𝑥P(𝑥) 𝑥P(𝑥) 𝑥Q(𝑥) 𝑥(P(𝑥) ⇒ xQ(x) 𝑥P(𝑥) ⇒ 𝑥Q(𝑥)


0 0 0 1 1
0 0 1 1 1
0 1 0 1 0
0 1 1 1 1
1 0 0 n.a n.a
1 0 1 n.a n.a
1 1 0 0 0
1 1 1 1 1

The rows with “n.a” are not applicable because when xP(x) is true, 𝑥P(𝑥)cannot be
false.
The columns for 𝑥P(𝑥) ⇒ 𝑥Q(𝑥) and 𝑥P(𝑥) ⇒ 𝑥Q(𝑥)) are not identical but one
implies the other.
For an implication, the antecedent can be false wand the consequence true so,
𝑥P(𝑥) ⇒ 𝑥Q(𝑥) implies 𝑥P(𝑥) ⇒ 𝑥Q(𝑥).

Logical Relationships Involving Quantifiers


1. 𝑥P(𝑥) ⇒ P(c), where c is an arbitrary element of the universe.

2. P(c) ⇒ 𝑥P(𝑥), where c is an arbitrary element of the universe.

3. 𝑥¬P(𝑥) ⇔ ¬𝑥P(𝑥)

4. 𝑥P(𝑥) ⇒ P(𝑥)

5. 𝑥¬P(𝑥) ⇔ ¬𝑥P(𝑥)

6. [𝑥P(𝑥) ˄ Q] ⇔ 𝑥[P(𝑥) ˄ Q]
This means that if Q does not involve 𝑥, whether 𝑥 is inside or outside
the bracket is immaterial.

7. [𝑥P(𝑥) ˅ Q] ⇔ 𝑥[P(𝑥) ˅ Q]
If Q does not involve 𝑥, whether 𝑥 is inside or outside the bracket is
immaterial.

8. [𝑥P(𝑥) ˄ 𝑥Q(𝑥)] ⇔ x[P(𝑥) ˄ Q(𝑥)]


Recall: 𝑥 distributes over ˄.
9. [𝑥P(x) ˅ 𝑥Q(𝑥)] ⇒ 𝑥[P(𝑥) ˅ Q(𝑥)]
Recall: 𝑥 distributes over ˅.

10. [𝑥P(𝑥) ˄ Q] ⇔ 𝑥[P(𝑥) ˄ Q]


If Q does not involve 𝑥, whether 𝑥 is in the parenthesis is immaterial.

11. [𝑥P(𝑥) ˅ Q] ⇔ x[P(𝑥) ˅ Q]

12. 𝑥[P(𝑥) ˄ Q(𝑥)] ⇒ [𝑥P(𝑥) ˄ 𝑥Q(𝑥)]


Recall: The distribution of 𝑥 in a parenthesis is not an equivalence but an
implication. In other words, 𝑥 does NOT distribute over ˄.

13. 𝑥[P(𝑥) ˅ Q(𝑥)] ⇔ [𝑥P(𝑥) ˅ 𝑥Q(𝑥)]

Generally, you may have statements like


𝑥(x > 3 ⇒ P(𝑥)) which can be written as
𝑥x > 3 P(𝑥)
This asserts that for all values of 𝑥 > 3, P(𝑥) is true.

EXAMPLE: The limit of a function, f(𝑥), as x approaches c is k. This is written as


lim(𝑓(𝑥) = 𝑘)
𝑥→𝑐
Note:
Iff for every ∈ > 0, there exists δ > 0 such that for all x,
if |𝑥 – 𝑐| < 𝛿 then |𝑓(𝑥) − 𝑘| < 𝑐 iff denotes “if and
only if”

This means that if you have a function

c
near c

at the value c with the vertical value k, within a short interval near c, the function can
only tale values which are nearer to k. The graphical representation of this limit is
represented above.
i. In logical notation, this limit is written as
∈∈>0 δ x[|x - c| < δ ⇒ |f(x) – k| < ∈]

On the other hand, to represent lim(𝑓(𝑥) ≠ 𝑘) in logical notation, you have to


𝑥→𝑐
negate the expression for lim(𝑓(𝑥) = 𝑘). That is
𝑥→𝑐
¬∈∈>0 δ x[|x - c| < δ ⇒ |f(x) – k| < ∈] taking¬ inside:
∈∈>0 δ x¬[|x - c| < δ ⇒ |f(x) – k| < ∈] applying P⇒Q ⇔¬P ˅Q:
∈∈>0 δ x¬[¬|x - c| < δ ˅ |f(x) – k| < ∈] using De Morgan’s law:
∈∈>0 δ x[|x - c| < δ ˄ ¬|f(x) – k| < ∈]

This expression asserts that


lim(𝑓(𝑥) = 𝑘) iff there is an ∈ > 0 such that for every δ > 0, there is some x such
𝑥→𝑐
that |x – c| < δ and yet |f(x) – k| ≥ ∈.
Graphically:
f(x)

c
This means that if you take some interval near c, the difference between f(x) and k will
be more than ∈.

EXAMPLE: Let the universe consist of all integers and let


P(𝑥): 𝑥 is a prime;
Q(𝑥): 𝑥 is positive;
E(𝑥): 𝑥 is even;
N(𝑥): 𝑥 is divisible by 9;
S(𝑥): 𝑥 is a perfect square; and
G(𝑥): 𝑥 is greater than 2.
Now, express each of the following in logical notation:
(a) 𝑥 is even or 𝑥 is a perfect square.
(b) 𝑥 is a prime and 𝑥 is divisible by 9.
(c) 𝑥 is a prime and 𝑥 is greater than 2.
(d) If 𝑥 is a prime, then 𝑥 is greater than 2.
(e) If 𝑥 is a prime, then 𝑥 is positive and not even.
Solution:
(a) E(𝑥) ˅ S(𝑥)
(b) P(𝑥) ˄ N(𝑥)
(c) P(𝑥) ˄ G(𝑥)
(d) P(𝑥) ⇒ G(𝑥)
(e) P(𝑥) ⇒ ¬P(𝑥) ˄ ¬E(𝑥)

EXAMPLE: Translate each of the following sentences into logical notations, firstly,
using no existential symbols and secondly, using no universal quantifier.
1. Not all cars have carburetors.
2. No dogs are intelligent
3. Some numbers are not real
Solution:
1. Not all cars have carburetors
Let Car(𝑥): 𝑥 is a car
Carbu(𝑥): 𝑥 has carburetor
(a) ¬𝑥(Car(𝑥) ⇒ Carbu(𝑥))

(b) 𝑥¬(Car(𝑥) ⇒ Carbu(𝑥)) applying P⇒Q ⇔¬P ˅Q:


𝑥¬(¬Car(𝑥) ˅ Carbu(𝑥)) using De Morgan’s law
𝑥(Car(𝑥) ˄¬Carbu(𝑥))

2. No dogs are intelligent.


Let dog(𝑥): 𝑥 is a dog
intel(𝑥): 𝑥 is intelligent
(a) 𝑥(dog(𝑥) ⇒ ¬intel(𝑥))

(b) 𝑥(dog(𝑥) ⇒ ¬intel(𝑥)) Applying P⇒Q ⇔¬P ˅Q:


𝑥(¬dog(𝑥) ˅ intel(𝑥)) Introducing a double negation:
𝑥¬¬(¬dog(𝑥) ˅ intel(𝑥)) Taking one negation outside:
¬𝑥¬(¬dog(𝑥) ˅ intel(𝑥)) Using De Morgan’s law:
¬𝑥(dog(x) ˄ intel(𝑥))
There is no 𝑥 which is a dog and is intelligent.
3. Some numbers are not real.
Let num(𝑥): 𝑥 is a number
real(𝑥): 𝑥 is a real

(a) 𝑥(num(𝑥) ˄ ¬real(𝑥)) Introducing a double negation:


𝑥¬¬(num(𝑥) ˄ ¬real(𝑥)) Taking one negation outside:
¬𝑥¬(num(𝑥) ˄ ¬real(𝑥)) Using De Morgan’s law:
¬𝑥(¬num(𝑥) ˅ real(𝑥)) By implication, P⇒Q ⇔¬P ˅Q:
¬𝑥(num(𝑥) ⇒ real(𝑥))

(b) 𝑥(num(𝑥) ˄ ¬real(𝑥))

Hint:
Generally, 𝑥 goes with ⇒ in the bracket while x goes with ˄ in the bracket.

Some Notes on Well-Formed-Formula (WFF)


• WFF of First Order Predicate Logic/Calculus is an expression that involves
quantifiers and predicate variables such as x and P, Q, respectively.

• WFF of predicate logic is valid if it is true for all universes and all interpretations
of predicate variables. For instance, the expression
𝑥P(𝑥) ⇒ 𝑥P(𝑥) is always true. It is a valid statement.

• If some WFF is true for some universe and some interpretation, it is said to be
satisfiable.

• If the WFF is not true for any universe or any interpretation, it is daid to be
unsatisfiable.
Valid corresponds to tautology in propositional logic.
Satisfiable corresponds to contingency…
Unsatisfiable corresponds to contradiction…

LOGICAL INFERENCE
There are several systems such as arithmetic systems where U = I. Also, there are
rules and axioms. Example of axioms are commutative law, associative law, etc. You
can use these axioms and rules of inference to deduce the truth statement about a
system.
In other words, for any system, there are axioms and rules of inferences – combining
these two in use, you derive truth statements, called theorems.
Theorems are derived from axioms by making use of rules of inference.

Axiom

Rules of inference

arrive at

Conclusion
Known as

Theorem

Starting with wrong axioms or applying rules of inference in a wrong manner can result
in a wrong proof.
Proof is the derivation of theorem from axioms with the use of rules of inference.
Deduction Rules - Rules of Inference Related to the Language Propositions

Rule of Inference Tautological Form Name

P . P ⇒ (P ˅ Q) Addition
P ˅ Q

P˄Q (P ˄ Q) ⇒ (P) Simplification


P

P [P ˄ (P ⇒ Q)] ⇒ Q Modus ponens


P⇒Q
Q

¬Q [¬Q ˄ (P ⇒ Q)] ⇒ ¬P Modus tollens


P⇒Q
¬P

P˅Q [(P ˅ Q) ˄¬P] ⇒ Q Disjunctive syllogism


¬P .
Q

P⇒Q [(P ⇒ Q) ˄ (Q ⇒ R)] ⇒ (P⇒ R) Hypothetical syllogism


Q⇒R
P⇒ R

P (P ˄ Q) ⇒ (P ˄ Q) Conjunction
.Q .
P ˄ Q

(P ⇒ Q) ˄ (R ⇒ S) [(P ⇒ Q) ˄ (R ⇒ S)] ⇒ (P ˅ R) Constructive dilemma


P˅R
Q ˅ S

(P ⇒ Q) ˄ (R ⇒ S) [(P ⇒ Q) ˄ (R ⇒ S)] Destructive dilemma


¬Q ˅ ¬S ˄ (¬Q ˅ ¬S) ⇒ (¬P ˅ ¬R)
¬P ˅ ¬R

Mostly, we will be using Modus ponens and Modus tollens in our arguments.
Proving the Correctness of an Argument
EXAMPLE: (This argument below may look silly. However, given the premises and
conclusion, is the argument correct?)
• If horses fly or cows eat grass, then the mosquito is the national bird. If the
mosquito is the national bird, then peanut butter tastes good on hot dogs. But
peanut butter tastes terrible on hot dogs. Therefore, cows don’t eat grass.
Solution:
Horses fly: H
Cows eat grass: G
Mosquito is a national bird: M
Peanut butter tastes good on hot dogs: P

If horses fly or cows eat grass, the mosquito is the national bird:
(H ˅ G) ⇒ M

If the mosquito is the national bird, then peanut butter tastes good on hot dogs;
M⇒P

But peanut butter tastes terrible on hot dogs:


¬P

Therefore, cows don’t eat grass:


¬G

In summary, the logical notation is represented in three premises and a conclusion:

1. (H ˅ G) ⇒ M
2. M ⇒ P
3. ¬P .
¬G
EXAMPLE: Using the correct logical inferences, does this conclusion ¬G arrive from
the three premises?

Proof:
Using hypothetical syllogism on 1 and 2 i.e.
1 & 2 Hypothetical syllogism 4 (H ˅ G) ⇒ P

4 & 3 Modus tollens 5 ¬ (H ˅ G)


5 De Morgan’s law 6 (¬H ˄ ¬G)

6 Simplification ¬G

Therefore, the argument is valid.


QED

ALTERNATIVE SOLUTION: Proof Using the Truth Table


Hint: If we get at least a row that has truth values to be all true for the premises
and conclusion, then the statement is valid (H ˅ G) ⇒ M
1. M ⇒ P
2. ¬P .
¬G

The truth table for this is shown below:


H G M P (H ˅ G) (H ˅ G) M⇒P ¬P ¬G
⇒M
0 0 0 0 0 1 1 1 1
0 0 0 1 0 1 1 0 1
0 0 1 0 0 1 0 1 1
0 1 0 0 1 0 1 1 0
1 0 0 0 1 0 1 1 1
0 0 1 1 0 1 1 0 1
0 1 0 1 1 0 1 0 0
0 1 1 0 1 1 0 1 0
1 1 0 0 1 0 1 1 0
1 0 1 0 1 1 0 1 1
1 0 0 1 1 0 1 0 1
0 1 1 1 1 1 1 0 0
1 1 1 0 1 1 0 1 0
1 1 0 1 1 0 1 0 0
1 0 1 1 1 1 1 0 1
1 1 1 1 1 1 1 0 0

From the first row we can see that the truth value for all the premises and conclusion
are true, therefore, the argument is valid.
QED
EXAMPLE: Prove that the statement below is a valid argument.
• It is not the case that IBM or Xerox will take over the copier market. If RCA
returns to the computer market, then IBM will take over the copier market hence
RCA will not return to the computer market.
Solution:
IBM will take over the copier market: I
Xerox will take over the copier market: X
RCA will return to the computer market: R
It is not the case that IBM or Xerox will take over the copier market:
¬ (I ˅ X)

If RCA returns to the computer market, then IBM will take over the copier market:
R⇒I
hence RCA will not return to the computer market:
¬R

1. ¬ (I ˅ X)
2. R ⇒ I
¬R
Assuming these two premises are correct can you derive the conclusion from them?
Proof:
1 De Morgan’s law 3 (¬I ˄ ¬X)
3 Simplification 4 ¬I
2 & 4 Modus tollens 5 ¬R

Therefore, it is a valid argument.


QED

ALTERNATIVE SOLUTION: Proof Using the Truth Table


Hint: If we get at least a row that has truth values to be all true for the premises
and conclusion, then the statement is valid

1. ¬ (I ˅ X)
2. R ⇒ I
¬R
I X R (I ˅ X) ¬(I ˅ X) R⇒I ¬R

0 0 0 0 1 1 1
0 0 1 0 1 0 0
0 1 0 1 0 1 1
1 0 0 1 0 1 1
0 1 1 1 0 0 0
1 0 1 1 0 1 0
1 1 0 1 0 1 1
1 1 1 1 0 1 0

From the first row we can see that the truth value for all the premises and conclusion
are true, therefore, the argument is valid.
QED

EXAMPLE: Prove that the statement, below, is valid.


• If today is Tuesday, then I have a test in Computer science or a test in Econ. If
my Econ professor is sick, then I will not have a test in Econ. Today is Tuesday
and my Econ professor is sick. Therefore, I have a test in Computer science.
Solution:
Today is Tuesday: T
I have a test I CS: CS
I have a test in Econ: E
Econ professor is sick: S
1. T ⇒ (CS ˅ E)
2. S ⇒ ¬E
3. T ˄ S
CS
Proof:
3 Simplification 4 T
5 S
1 & 4 Modus ponens 6 CS ˅ E
2 & 5 Modus ponens 7 ¬E
6 & 7 Disjunctive syllogism 8 CS

Therefore, the argument is valid.


QED
ALTERNATIVE SOLUTION: Proof Using the Truth Table
Hint: If we get at least a row that has truth values to be all true for the premises
and conclusion, then the statement is valid
1. T ⇒ (CS ˅ E)
2. S ⇒ ¬E
3. T ˄ S
CS

T CS E S ¬E CS ˅ E T ⇒ (CS ˅ E) S ⇒ ¬E T˄S

0 0 0 0 1 0 1 1 0
0 0 0 1 1 0 1 1 0
0 0 1 0 0 1 1 1 0
0 1 0 1 1 1 1 1 0
1 0 0 0 1 0 0 1 0
0 0 1 1 0 1 1 0 0
0 1 0 1 1 1 1 1 0
0 1 1 0 0 1 1 1 0
1 1 0 0 1 1 1 1 0
1 0 1 0 0 1 1 1 0
1 0 0 1 1 0 0 1 1
0 1 1 1 0 1 1 0 0
1 1 1 0 0 1 1 1 0
1 1 0 1 1 1 1 1 1
1 0 1 1 0 1 1 0 1
1 1 1 1 0 1 1 0 1

From the first row we can see that the truth value for all the premises and conclusion
are true, therefore, the argument is valid.
QED

Note:
This is the sort of proof you give, to show that an argument is correct or not.
If an argument is not correct/valid, you must give a counter example. In other words,
with the existing premises and conclusion of an argument, which you want to prove
incorrect, you must give truth values to the assertion involved such that the premises
become true and the conclusion false – This is called a fallacy.
Fallacies

People often make two types of fallacies:

1. The fallacy of affirming the consequence.


2. The fallacy of denying the antecedent.
Fallacy of affirming the consequence
From P⇒Q
Q .
X You cannot conclude anything

For Modus ponens: From P ⇒ Q


P .
Q

For Modus tollens: From P ⇒ Q


¬Q .
¬P

EXAMPLE: “If the bottler committed the murder, he will be very nervous”
OR
“The bottler is nervous, so he committed the murder”
Is this argument correct?
Answer: No, it isn’t because he can be nervous by just seeing the police even
without haven committed the murder.
This is a fallacy of affirming the consequence.

Fallacy of denying the antecedent


From P⇒Q
¬P .
X You cannot conclude anything
EXAMPLE: “The bottlers hands are covered with blood, so he committed the murder.”
OR
“The bottler’s hands are clean therefore he did not commit the murder.”
Is this argument correct?
Answer: No. It is not a correct argument because you are trying to deny the
antecedent – The bottler could have washed his hands after committing the murder. So,
you cannot deny the fact that he committed the murder just because his hands are
clean.
This sort of fallacy may occur in your argument so, you have to wary of such. If you
wrongly apply the laws of inference, the argument will be incorrect.
Rules of Inference Related to Quantifiers
So far, we have used propositional variables and single statement propositions but
cases may arise when we need to use quantifiers in our arguments. Let’s consider
some rules of inference that involve quantifiers.
1. Universal Generalization:
If you have P(c) . for an arbitrary element c of U
𝑥P(𝑥)

2. Universal Instantiation:
From 𝑥P(𝑥)
P(c) c is an arbitrary element of U

3. Existential Generalization:
If you have P(c) . for some c ∈ U, i.e. it is not an arbitrary element
𝑥P(𝑥)

4. Existential Instantiation:
From 𝑥P(𝑥)
P(c) c is a particular element of the universe.

EXAMPLE: Use quantifiers to prove the correctness of the arguments.


All men are mortal
Socrates is a man
 Socrates is mortal.
Solution: Obviously, this is a correct statement so let’s prove it.
man(𝑥): 𝑥 is a man
mortal(𝑥): 𝑥 is mortal.
Transcribing the argument into logical notation:
1 𝑥(man(𝑥) ⇒ mortal(𝑥)):
2 man(Socrates)
mortal(Socrates)
Proof:
1 Universal instantiation 3man(Socrates) ⇒ mortal(Socrates)
From 3 & 2 Modus ponens mortal(Socrates)
QED

Now, let’s consider an example of an incorrect argument.

EXAMPLE: Use quantifiers to prove the correctness of the argument.

Some trigonometric functions are continuous


Some continuous functions are periodic
 Some trigonometric functions are periodic.

Solution: Remember that we are only looking at an existing argument so, we


consider the premises to be true and check whether the conclusion can be derived from
the premises.

In this case all, two statements are actually true but whether the conclusion actually
follows from them is what we want to prove.

Let T(𝑥): 𝑥 is a trigonometric function


C(𝑥): 𝑥 is a continuous function
P(𝑥): 𝑥 is a periodic function

In logical notation:
𝑥(T(𝑥) ˄ C(𝑥)
𝑥(C 𝑥) ˄ P(𝑥) .
𝑥(T(𝑥) ˄ P(𝑥)

You can easily see that the conclusion does not follow from the premises, based on the
rules of inference so, it is necessary to give a counter example as given below:

Proof:

T C P
From the nonempty intersections in the Venn diagram, we can see that some trig
functions are continuous and some continuous functions are periodic, respectively.

However, it does not necessarily imply that T and P intersect i.e. the intersection of T
and P can be empty. Therefore, from this argument, you cannot conclude that some
trigonometric functions are periodic. QED

Note:
You can use a Venn diagram to check for the correctness of an argument after which
you give the proper logical argument for it.

EXAMPLE: Use quantifiers to prove the correctness of the arguments.


Babies are illogical
Illogical people are despised
Nobody who can manage a crocodile is despised
 Babies cannot manage crocodiles.

Solution:
Let B(𝑥): 𝑥 is a baby
Il(𝑥): 𝑥 is illogical
D(𝑥): 𝑥 is despised
M(𝑥): 𝑥 can manage a crocodile
Representing these premises on a Venn diagram:

B Il D M
l

From the Venn diagram, we can see that B and M are disjoint therefore, the argument is
correct.

Let’s then prove this argument using logical notations:

1 𝑥(B(𝑥) ⇒ Il(𝑥))
2 𝑥(Il(𝑥) ⇒ D(𝑥))
3 ¬𝑥(M(𝑥) ˄ D(𝑥))
4  𝑥(B(𝑥) ⇒ ¬M(𝑥))

Proof:
Rewriting 3: 3 ¬𝑥(M(𝑥) ˄ D(𝑥))
𝑥¬(M(𝑥) ˄ D(𝑥)) Applying De Morgan’s law:
𝑥(¬M(𝑥) ˅ ¬D(𝑥)) By commutativity of ˅:
𝑥(¬D(𝑥) ˅ ¬M(𝑥)) By implication:
4 𝑥(D(𝑥) ⇒ ¬M(𝑥))

1 Universal instantiation, taking an arbitrary c i B(c) ⇒ Il(c)


2 Universal instantiation, taking an arbitrary c ii Il(c) ⇒ D(c)
4 Universal instantiation… iii D(c) ⇒ ¬M(c)
i and ii Hypothetical syllogism iv B(c) ⇒ D(c)
iii and iv Hypothetical syllogism v B(c) ⇒ ¬M(c)
v Universal generalization 𝑥(B(𝑥) ⇒ ¬M(𝑥))
QED

EXERCISE: (Logical Inference)


Prove or disprove the validity of the following arguments:
(a) Every living thing is a plant or animal.
David’s dog is alive and it is not a plant.
All animals have hearts.
Hence David’s dog has a heart

Solution:
Let L(𝑥): 𝑥 is a living thing
P(𝑥): 𝑥 is a plant
A(𝑥): 𝑥 is an animal
H(𝑥): 𝑥 has a heart
d: David’s dog
Representing these premises / statements in logical notation:
1 𝑥[L(x) ⇒ (P(𝑥) ˅ A(𝑥))]
2 L(d) ˄ ¬P(d)
3 𝑥(A(𝑥) ⇒ H(𝑥))
H(d)
(Note: Here, we can instantiate/replace 𝑥 with any value from the set of living things.
Also, statements 1 and 3 have universal quantifiers while statement 2 has no quantifier.)
Proof:
From 1 Universal instantiation 4 L(d) ⇒ (P(d) ˅ A(d))
2 Simplification 5 L(d)
6 ¬P(d)
3 Universal instantiation 7 A(d) ⇒ H(d)
4&5 Modus ponens 8 P(d) ˅ A(d)
8&6 Disjunctive syllogism 9 A(d)
7&9 Modus ponens H(d)
QED
The argument is valid since we arrived at the conclusion from the premises.
(b) All clear explanations are satisfactory.
Some excuses are unsatisfactory.
Hence, some excuses are not clear explanations.

Solution:
Let C(𝑥): Clear explanation
S(𝑥): Satisfactory explanation
¬S(𝑥): Unsatisfactory explanation
E(𝑥): Excuses

Representing these statements in logical notations:


1 𝑥(C(𝑥) ⇒ S(𝑥))
2 𝑥(E(𝑥) ˄ ¬S(𝑥))
𝑥(E(𝑥) ˄ ¬C(𝑥))

EXERCISE:
The following propositions involve predicate that define sets. Use the properties to
conclude relationships between these sets. Use Venn diagrams to check for the validity
of the arguments.

(a) Some scientists are not engineers. Some astronauts are not engineer. Hence,
some scientists are not astronauts.

(b) All astronauts are scientists. Some astronauts are not engineers. Hence, some
engineers are not scientists.

Solution (a):
If the Venn diagram satisfies the premises and not the conclusion, then the argument
cannot be correct.

S E
Some scientists are not
engineers

Solution (b): S E
A From this we cannot conclude that
some scientists are not astronauts

A E This Venn diagram satisfies the


premises but not the conclusion.

Normal Forms
We have seen how to prove or disprove the correctness of an argument using rules of
inference. Such rules of inference are very useful in the logic programming language,
PROLOG, which uses what is known as a resolution principle.
For this, we have to write a premise in a proper form, which is called a class form. In
order to know what a class form is, we have to see some normal forms of propositional
expression, WFF, or propositional logic.
Two types of normal forms:
(i) Conjunctive normal form, CNF
(ii) Disjunctive normal for, DNF
Definitions:
(a) A variable or negation of a variable is called a literal.
E.g. P, ¬P are literals.

(b) A disjunction of literals is called sum.


E.g. P1 ˅ P2 ˅ P3 ˅ ¬P4

(c) Conjunction of literals is called a product.


E.g. P1 ˄ P2 ˄ P3

(d) A sum of product is called a DNF


E.g. (P1 ˄ P2 ˄ ¬P3) ˅ (¬P4 ˄ P2)

(e) A product of sums is called a CNF


E.g. (P1 ˅ P2) ˄ (P3 ˅ ¬P4 ˅ P5)

Writing Expressions/WFF as DNF and CNF

EXAMPLE: Write the expression below as a DNF.


P ˄ (P ⇒ Q)
Solution:
P ˄ (P ⇒ Q) By implication:
P ˄ (¬P ˅ Q) By distributivity of ˄:
(P ˄ ¬P) ˅ (P ˄ Q)
This a sum of products.

EXAMPLE: Convert the expression P ˄ (P ⇒ Q) to a CNF.


Solution:
P ˄ (P ⇒ Q) By implication:
P ˄ (¬P ˅ Q)

Single sum Sum

Product of sums
CNF and Dare used to write arguments in a different form – This is called Resolution
Principle, which is used in PROLOG, the logic programming language.

Summary:
We have seen what rules of inference are; and how to use the rules to prove the validity
or invalidity of arguments. We’ve also discussed DNF and CNF; and seen how to bring
a WFF of a propositional logic to CNF or DNF. In the next section, we shall see how to
use the Resolution Principle to prove the correctness or incorrectness of an argument.

RESOLUTION PRINCIPLE AND ITS APPLICATION TO PROLOG

Definitions:
A variable or negation of a variable is a literal.
A disjunction of literals is called the sum.
A conjunction of literals is called the product.
A clause is [also] a disjunction of literals.
What is a resolution?
A clause is a disjunction of literals.
For any two clauses C1 and C2, if there is a literal L1 in C1 that is complementary to a
literal L2 in C2, then delete L1 and L2 from C1 and C2, respectively, and construct the
disjunction of the remaining clauses. The constructed clause is a resolvent of C1 and C2.
EXAMPLE: Suppose you have two clauses
P ˅ Q ˅ ¬R and
¬P ˅ ¬S ˅ T ˅ U.
Since you have P in the first clause and ¬P in the second clause; P and ¬P
complement each other so, delete both of them - After this deletion, what is left is the
resolvent of the two clauses:
Q ˅ ¬R ˅ ¬S ˅ T ˅ U

EXAMPLE: Modus ponens means that


P
P⇒Q
Q
which can be written in clause form [by implication] as
P
¬P ˅ Q
Q

EXAMPLE: Modus tollens means that


P⇒Q
¬Q .
¬P
which can be written in clause form as
¬P ˅ Q
¬Q .
¬P

These examples show how the resolvent is connected to the conclusion.

Theorem:
Given the two clauses C1 and C2, a resolvent C of C1 and C2 is a logical consequence
of C1 and C2.
(This theorem is seen in the examples above)
Proof of the Theorem:
There is a clause C1, which has a literal L and the remaining clauses are noted by C’1
i.e. C1 L ˅ C’1
and you have another clause C2 which contains ¬L and the remaining clauses denoted
by C’2
i.e. C’2 L ˅ C’2
So, we have
C1 L ˅ C’1
C2 ¬L ˅ C’2

The resolvent of C1 and C2 is


C’1 ˅ C’2

Now let’s show that C’1 ˅ C’2 is the logical consequence of the original clauses C1 and
C2:
Remember that C’1 and C’2 are sums, having ˅ as the logical connector.
If the premises are true, the conclusion must be true. To shoe this:
C1 L ˅ C’1
C2 ¬L ˅ C’2

Either L is true or
¬L is true, which is equivalent to saying that
L is false
So, L is either true or false.

Suppose L is false in C1, it means C’1 is true.

If L is true in C2, ¬L is definitely false therefore, C’2 must be true for C2 to be true;
Now, if C’2 is true, the whole resolvent clause
C C’1 ˅ C’2
is true because of disjunction.
QED

Resolution Principle
Given a set S of clauses, a (resolution or) deduction of C from S is a finite sequence C1,
C2, … Ck of clauses such that each C is either a clause in S or a resolvent of clauses
preceding C; and Ck = C. A deduction of [ ] from S is called a refutation or a proof of S.
[ ] is an empty class.

EXAMPLE: Give a proof of refutation.


Solution:
Consider the disjunctive syllogism below
P ← literal
¬P ˅ Q ← clause
¬Q ← resolvent or logical consequence

Negating the conclusion:


. Q.
¬Q .
[ ]
The result is an empty set. This the proof of refutation.
EXAMPLE: After finding the resolvent of the literal and clause, find the proof of
refutation.
Solution:
Consider the Modus tollens
P⇒Q
¬Q .
¬P
By resolving we have:
P⇒Q
¬Q .
¬P ←resolvent

Negating the resolvent:


¬P .
P .
[] ← empty clause. This is the refutation or proof.

Hint:
If you want to derive a conclusion from a collection of some set of clauses
S = C1, …,
C2, …,
.
.
.,
try to use the resolution principle to resolve some of them in order to get more clauses.
Finally, consequent upon the resolution, when you are left with the result you want to
conclude, take a negation of that conclusion and arrive at an array of an empty class [ ].
If this works out correctly, the argument is correct otherwise, it is not correct.

Initially, we considered some examples of checking for the validity or invalidity of an


argument. Let’s work out those examples with the use of resolution principle.

Using Resolution Principle to Prove the Validity of Arguments

EXAMPLE: Use the resolution principle to prove the statement below.


• If today is Tuesday, then I have a test in Computer Science or a test in Econ.
If my Econ professor is sick, then I will not have a test in Econ.
Today is Tuesday and my Econ professor is sick.
Therefore, I have a test in Computer Science.

Solution:
Today is Tuesday: T
I have a test in Computer Sc. CS
I have a test in Econ E
My Econ professor is sick S

Representing the statement in logical notation:


T ⇒ (CS ˅ E)
S ⇒ ¬E
T˄S .
 CS

Re-writing this statement in clause form and negating the conclusion:


1 ¬T ˅ (CS ˅ E)
2 ¬S ˅ ¬E
3 T
4 S
5 ¬CS ←To find the proof, negate the conclusion

Resolving the clauses:


1&3 6 CS ˅ E

2&4 7 ¬E

6&7 8 CS
5&8 []
From the proof/refutation, the argument is correct.

Note:
The resolution principle is much easier than deduction principle and it can be
automated. The resolution principle is used in PROLOG.

EXAMPLE: Use the resolution principle to prove the argument below.


• It is not the case that IBM or Xerox will take over the copier market. If RCA
returns to the computer market, then IBM will take over the copier market hence
RCA will not return to the computer market.
Solution:
IBM takes over copier market I
Xerox takes over copier market X
RCA returns to computer market R
Representing the argument in logical notation:
¬(I ˅ X)
R⇒I .
¬R

Rewriting in clause form:


¬I ˄ ¬X ←De Morgan’s law changes it from a clause to a conjunction
¬R ˅ I
¬R

Rewriting the argument, splitting the conjunction and negating the conclusion:
1 ¬I
2 ¬X
3 ¬R ˅ I
4 R

Resolving the clauses:


1&3 5 ¬R
4&5 []
QED
Note: We did not make use of the second clause/literal, ¬X. It is not necessary to use
all the clauses in proving an argument.

PROLOG
PROLOG is used in artificial intelligence.
Rules and Facts
Facts are written as
female(Mary) ← the fact that Mary is a female
likes(Mary, books) ← the fact that Mary likes books
likes(Mary, chocolates) ← the fact that Mary likes chocolates
Actually, you give the system a lot of facts; and you have some rules. With the
combination of these facts and rules / syntax. The illustration below shows how the
system will reply when asked a question:

If you ask
?female(Mary) ←Question: Is Mary a female
Yes ← Answer: yes

?female(John)
No

?likes(Mary, books) ← Does Mary books?


Yes

?likes(Mary, X) ← What does Mary like?


X = books

If you ask same question again, it will show the second answer, depending on
the implementation of the language.

?likes(Mary, X)
X = chocolates

Rules are written as

brother(𝑥, 𝑦): male(𝑥), parent(𝑥, M, F), parent(𝑦, M, F)

This interpreted as
When do you say 𝑥 is the brother of 𝑦? it is when x is a male and also x
and 𝑦 have the same mother and father.

Instantiating the rule:


brother(Tom, Joe): male(Tom), parent(Tom, Sarah, David),
parent(Joe, Sarah, David)

Head

Horn Clause is a distinction of literals where at most, one literal is non-negative. All of
them will be negated except one or at most, one will not be negated
P ˅¬P ˅¬Q ˅¬R ˅¬S

Headed Horn Clause is a horn clause that has one literal that is not negated. For
instance: A single fact, likes(Mary, books) is a headed horn clause, with one literal.
Headless Horn Clause is horn clause with all its literals negated.

Note: In PROLOG, comma, denotes ‘and’.


brother(Tom, Joe) is the head. However, if you derive an answer from a fact,
without a head, it is called a headless clause.
In the programming, the IF portion is male(𝑥), parent(x, M, F), parent (y, M, F)
while the THEN portion is brother(𝑥, 𝑦). Sh, we have a statement like this:
IF{
male(𝑥), parent(𝑥, M, F), parent (𝑦, M, F)
}
THEN{
brother(𝑥, 𝑦)
}

which means
“If 𝑥 is a male and parents of 𝑥 are M and F and parent of 𝑦 are M and F
then 𝑥 is the brother of 𝑦.”

EXAMPLE: We will write the statement below, firstly, in the IF THEN manner and also
in the PROLOG manner and see how both syntaxes correspond with each other.

aunt(𝑥, 𝑦): female(𝑥), sister(𝑥, 𝑧), parent(𝑧, 𝑦)

Solution:

In IF THEN syntax:
IF 𝑥 us a female and s is a sister to 𝑧 and 𝑧 is a parent of 𝑦 THEN 𝑥 is the
aunt of 𝑦.
Rewriting in logical notation:
𝑥𝑦𝑧[((female(𝑥) ˄ sister(𝑥, 𝑧) ˄ parent(𝑧, 𝑦)) ⇒ aunt(𝑥, 𝑦)]

Suppose we have the following rules and facts:


Rules aunt(𝑥, 𝑦): female(𝑥)
sister(𝑥, 𝑧)
parent(𝑧, 𝑦)

Facts female(Mary)
sister(Mary, John)
parent(John, Joseph)
: aunt(Mary Joseph) ←goal

So, if you ask the question


?aunty(Mary, Joseph)
PROLOG will attempt to verify that the goal is satisfied based on the rule and facts.
So, when PROLOG searches for aunty, it finds the rule for aunty, then tries to
instantiate the rule, which involves universal instantiation, existential generalization, etc.
It performs the following instantiation:
aunt(Mary, Joseph): female(Mary), sister(Mary, 𝑧), parent(𝑧, Joseph)
Afterwards, it finds the fact that satisfies 𝑧; finds 𝑧 to be John. Hence
aunt(Mary, Joseph): female(Mary), sister(Mary, John), parent(John, Joseph)

In logical notation:
(female(Mary) ˄ sister(Mary, John) ˄ parent(John, Joseph)) ⇒ aunty(Mary, Joseph)

In clause form
¬(female(Mary) ˄ sister(Mary, John) ˄ parent(John, Joseph)) ˅ aunty(Mary, Joseph)

Applying De Morgan’s law and associativity of ˅:


¬female(Mary) ˅ ¬sister(Mary, John) ˅ ¬parent(John, Joseph) ˅ aunty(Mary, Joseph)

To use refutation to prove the fact, the goal is negated:


female(Mary) ←headed
sister(Mary, John) ←headed
parent(John, Joseph) ←headed
¬aunty(Mary, Joseph) ←headless
[]
QED aunty(Mary, Joseph)

Hint:
You have the general rule, which you instantiate to yield the headed clause. You also
have the fact, which is also a headed horn clause but with a negated goal i.e. the goal
returned is a headless horn clause. At the end you need to have one headless hrn
clause as the goal.
Backward Chaining is starting from the conclusion to verify that it can be derived from
the facts and rules.
Forward Chaining: You start from the axioms and try to use the rules of inference to
derive the conclusion.
In PROLOG, the backward chaining method is used.

You might also like