You are on page 1of 16

DISCRETE MATHEMATICS BA202

TOPIC 1 BASIC LOGIC


This topic deals with propositional logic, logical connectives and truth tables and validity.
Predicate logic, universal and existential quantification are discussed

1.1 PROPOSITION LOGIC

Propositions
A proposition is a declarative sentence (a sentence that declares a fact) that is either true
or false, but not both.
Example 1: All the following declarative sentences are propositions.
i. Kuala Lumpur is the capital of Malaysia. (True)
ii. Perak is the biggest state in Malaysia. (False)
iii. 1 + 1 = 2 (True)
iv. 2 + 2 = 3 (False)
Example 2: All the following not declarative sentences are not propositions.
i. What time is it?
ii. Read this carefully.
iii. x + 1 = 2
iv. x+y=z
Letter (p, q, r, s,) are used to denote the propositional variable.
True propositional truth value is True and denoted by T.
False propositional truth value is False and denoted by F.

Compound Propositions
The combination of one or more propositions.
Are formed from existing propositions using logical operators.
The types of compound propositions:-
I. Negation
II. Conjunction
III. Disjunction inclusive or
IV. Disjunction exclusive or
V. Conditional statements
- Converse
- Contrapositive
- Inverse
VI. Biconditional statements

Negation
Let p be a proposition. The negation of p, denoted by p (also denoted by ), read as not
p, is the statement It is not the case that p.
Example 3:

Prepared By Chiang Yoke Yen(2012) Page 1


DISCRETE MATHEMATICS BA202

Proposition (p) Negation of proposition (p)


Today is Friday Today is not Friday
3+57 3+5=7
32 3<2

TABLE 1: The Truth Table for the negation of a proposition:-


p p
T F
F T

Conjunction
Let p and q be a proposition. The conjunction of p and q, denoted by p q, is the
proposition p and q. The conjunction p q is true when both p and q are true and is
false otherwise.
Example 4:
p : It is raining.
q : It is cold.
The proposition It is raining and cold. (p q) is consider as TRUE when it is
raining (p is True) and it is cold (q is True). Otherwise or other situation is FALSE.
In Logic the word but sometimes is used instead of and in a conjunction. For example,
the statement The sun is shining, but it is raining. is another way of saying The sun is
shining and it is raining.
TABLE 2: The Truth Table for the conjunction of two propositions:-
p q pq
T T T
T F F
F T F
F F F

Disjunction inclusive or
Let p and q be a proposition. The disjunction of p and q, denoted by p q, is the
proposition p or q. The disjunction p q is false when both p and q are false and is
true otherwise.
Example 5:
p : It is raining.
q : It is cold.
The proposition It is raining and cold. (p q) is consider as FALSE when it is not
raining (p is False) and it is not cold (q is False). Otherwise or other situation is
TRUE.
TABLE 3: The Truth Table for the disjunction of two propositions:-
p q pq
T T T
T F T
F T T
F F F

Prepared By Chiang Yoke Yen(2012) Page 2


DISCRETE MATHEMATICS BA202

Disjunction exclusive or
Let p and q be a proposition. The exclusive or of p and q, denoted by p q, is the
proposition that is true when exactly one of p and q is true and is false otherwise.
TABLE 4: The Truth Table for the Exclusive Or of two propositions:-
p q pq
T T F
T F T
F T T
F F F

Conditional statements
Let p and q be a proposition. The conditional statement (or implication) p q is the
proposition if p, then q. The conditional statement p q is false when p is true and q
is false and true otherwise.
In the conditional statement p q, p is called the hypothesis (or antecedent or premise)
and q is called the conclusion (or consequence).
The following common ways to express the conditional statement p q:
if p, then q p implies q
if p, q p only if q
p is sufficient for q a sufficient condition for q is p
q if p q whenever p
q when p q is necessary for p
a necessary condition for p is q q follows from p
q unless p
Example 6:
p : Maria learns Discrete Mathematics.
q : Maria will find a good job..
There are many ways to represent this conditional statement in English:
If Maria learns Discrete Mathematics, then she will find a good job.
Maria will find a good job when she learns Discrete Mathematics.
A sufficient condition for Maria to find a good job is learns Discrete Mathematics.
Maria will find a good job unless she does not learn Discrete Mathematics.
The conditional statement If Maria learns Discrete Mathematics, then she will find a
good job. (p q) is consider as FALSE when Maria learns Discrete Mathematics (p
is True) but she does not get a good job (q is False). Otherwise or other situation is
TRUE.
TABLE 5: The Truth Table for the conditional statement p q:
p q pq
T T T
T F F
F T T
F F T
q p is called the converse of p q.
q p is called the contrapositive of p q.
p q is called the inverse of p q.

Prepared By Chiang Yoke Yen(2012) Page 3


DISCRETE MATHEMATICS BA202

Example 7: What are the converse, the contrapositive and the inverse of the conditional
statement The home team wins whenever it is raining.?
Because q whenever p is one of the ways to express the conditional statement, thus
p : It is raining.
q : The home team wins.
The converse is If the home team wins, then it is raining.
The contrapositive is If the home team does not win, then it is not raining.
The inverse is If it is not raining, then the home team does not win.
Only the contrapositive is equivalent to the original statement.

Biconditional Statements
Let p and q be propositions. The biconditional statement (or bi-implications) p q is the
proposition p if and only if q. The biconditional statement p q is true when p and q
have the same truth values, and is false otherwise.
There are some other common ways to express p q:
p is necessary and sufficient for q
if p then q, and conversely
p iff q
p q has exactly the same truth value as (p q) (q p).
Example 8:
p : You can take the flight.
q : You buy a ticket.
The statement You can take the flight if and only if you buy a ticket (p q) is
consider as TRUE if p and q are either both true or both false, that is
- If you buy a ticket (q is True) and you can take a flight (p is True).
- If you do not buy a ticket (q is False) and you cannot take the flight (p is False).
The statement You can take the flight if and only if you buy a ticket (p q) is
consider as FALSE if p and q have opposite truth values, that is
- When you do not buy a ticket (q is False) but you can take the flight (p is True).
- When you buy a ticket (q is True) but you cannot take the flight (p is False).
TABLE 6: The Truth Table for the biconditional statement p q:
p q pq
T T T
T F F
F T F
F F T

Prepared By Chiang Yoke Yen(2012) Page 4


DISCRETE MATHEMATICS BA202

Truth Tables of Compound Propositions


We can construct a truth table of the compound proposition by using the precedence of
logical operator:
Operator Precedence
1
2
3
4
5
Example 9: Construct the truth table of the compound proposition (p q) (p q).
p q q p q pq (p q) (p q)
T T F T T T
T F T T F F
F T F F F T
F F T T F F
Example 10: Construct the truth table of the compound proposition (p q) (r).
p q r p q (p q) r (p q) (r)
T T T T F F F
T T F T F T T
T F T F T F T
T F F F T T T
F T T F T F T
F T F F T T T
F F T F T F T
F F F F T T T

Propositional Equivalences
A tautology is the compound proposition that is always true.
A contradiction is the compound proposition that is always false.
A contingent statement is one that is neither a tautology nor a contradiction.
Example 11: Show that p q q p is tautology.
p q p q pq q p p q q p
T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
Because all the truth values are True, thus p q q p is tautology.

Prepared By Chiang Yoke Yen(2012) Page 5


DISCRETE MATHEMATICS BA202

TUTORIAL EXERCISE 1.1

1. Which of these sentences are propositions? What are the truth values of those that are
proposition?
a) Malaysia is the biggest century in Asia.
b) 2 + 3 = 5.
c) Do not pass go.
d) 5 + 7 < 10
e) 4 + x = 5.
f) Polytechnic Ungku Omar is the Polytechnic Premier.

2. What is the negation of each of these propositions?


a) I will go to find you later.
b) There is no population in New York.
c) 2 + 1 = 3.
d) The summer in Taipei is hot and sunny.

3. Let p and q be the propositions


p : Mei has saving ten thousand dollar in bank.
q : Mei will has a trip to Hawaii.
Express each of these propositions as English sentence.
a) p
b) p q
c) p q
d) p q
e) p q
f) p (p q)

4. Let p and q be the propositions


p : It is a sunny day.
q : We will go to the beach
Write these propositions using p and q and logically connectives.
a) It is a sunny day and we will go to the beach.
b) It is a sunny day but we do not go to the beach.
c) It is not a sunny day or we go to the beach.
d) We will go to the beach when it is a sunny day.
e) It is a sunny day if and only if we will go to the beach.

5. Determine whether each of these statements is true or false.


a) 1 + 1 = 3 if and only if monkey can fly.
b) 0 > 1 if and only if 2 > 1.
c) 2 + 2 = 4 if and only if 1 + 1 = 2.
d) If 1 + 1 = 2, then 1 is a integer number.
e) If monkey can fly, then 1 + 1 = 2.
f) If 1 + 1 = 2, then monkey can fly.
g) If 8 5 = 2, then 5 + 2 = 8.

Prepared By Chiang Yoke Yen(2012) Page 6


DISCRETE MATHEMATICS BA202

6. Write each of these propositions in the form if p, then q in English.


a) It is necessary to wash the bosss car to get promoted.
b) John gets caught whenever he cheats.
c) Mary will go swimming unless the water is too cold.
d) I will remember to send you the address only if you send me an e-mail message.

7. Write each of these propositions in the form p if and only if q in English.


a) If you read the newspaper every day, you will be informed, and conversely.
b) The trains run late on exactly those days when I take it.
c) If it is hot outside you drink an ice tea, and if you drink an ice tea it is hot outside.
d) For you to win the contest it is necessary and sufficient that you have the only
winning ticket.

8. State the converse, contrapositive, and inverse of each of these conditional statements.
a) If it raining tonight, then I will stay at home.
b) I come to class whenever there is going to be a quiz.

9. Construct a truth table for each of these compound propositions and determine whether
these compound propositions are a tautology.
a) (p q) (q p)
b) (p q) (p q)
c) (p q) (p r)
d) (p q) p
e) [(p q) (q r)] (p r)

Prepared By Chiang Yoke Yen(2012) Page 7


DISCRETE MATHEMATICS BA202

1.2 RULES OF INFERENCE

Valid Arguments in Propositional Logic


An argument is a sequence of propositions which contains premises and a conclusion.
P1
P2
Premises (Hypotheses)
P3
.
.
._____________
Conclusion
Consider the following argument involving propositions:
If you have the password, then you can log onto the network.
You have the password.
Therefore, You can log onto the network.
The argument has the form
pq
p
_____________

We would like to determine whether this is a valid argument.


An argument is valid when all its premises are true implies that the conclusion is true.
We can always use a truth table to show that an argument form is valid.
Example 12: Is the argument above is valid?
Premises Conclusion
p q pq p q
T T
T
T
T Thus, that argument is valid.
T F F T F
F T T F T
F F T F F

Example 13: So, is this argument a valid argument?


pq
q
_____________

Premises Conclusion
p q pq q p
T T T T T
T F F F T
F T

T
T
F This is not a valid argument because
the premises are true but the conclusion
F F T F F
is false.
Another way, the argument form with premises P1, P2, , Pn and conclusion q is valid
when (P1 P2 Pn) q is a tautology.

Prepared By Chiang Yoke Yen(2012) Page 8


DISCRETE MATHEMATICS BA202

Example 14: show that the argument below is valid with using tautology.
p (q r)
r

The argument is valid when (p (q r)) (r) (p q) is a tautology.


p q r q r p (q r) r (p (q r)) (r) p q (p (q r)) (r) (p q)
T T T T T F F T T
T T F T T T T T T
T F T T T F F T T
T F F F T T T T T
F T T T T F F T T
F T F T T T T T T
F F T T T F F F T
F F F F F T F F T
It is a tautology. Therefore, the argument is valid.

Rules of Inference for Propositional Logic


Rules of inference are the validity of some relatively simple argument forms which do
not have to resort to truth table. Table of the rules of inference:
Rules of Tautology Name Example 15
Inference
pq [(p q) p] q Modus If it is a raining day, then I will stay at
p Ponens home. It is a raining day. Therefore, I will
stay at home.
pq [(p q) q] p Modus If it is a raining day, then I will stay at
q Tollens home. I will not stay at home. Thus, it is
not a raining day.
pq [(pq)(qr)](pr) Hypothetical If it is a raining day, then I will stay at
qr Syllogism home. If I stay at home, then I will cook
pr dinner for you. Therefore, if it is a raining
day, then I will cook dinner for you.
pq [(p q) p] q Disjunctive It is either a raining day or I will stay at
p Syllogism home. It is not a raining day. Therefore, I
q will stay at home.
p p (p q) Addition It is a raining day. Therefore, it is either a
pq raining day or I will stay at home.

Let p : It is a raining day.


q : I will stay at home.
r : I will cook dinner for you.

Prepared By Chiang Yoke Yen(2012) Page 9


DISCRETE MATHEMATICS BA202

Using Rules of Inference to Build Valid Argument


When there are many premises, several rules of inference are often needed to show that
an argument is valid.
There are two steps to build valid argument by using rules of inference:-
First step:
- List out all the premises and the conclusion which denoted by letter such as p, q, r, s,
t, and so on and build the valid argument
Second step:
- Show that the hypotheses lead to conclusion by using the rules of inference and state
what kind of rules are using.
Example 16: Show that the hypothesis If you send me an e-mail message, then
I will finish writing the report, If you do not send me an e-mail message, then I will go
to sleep early, and If I go to sleep early, then I will wake up early lead to the
conclusion If I do not finish writing the report, then I will wake up early.
Step 1:
Let p : You send me an e-mail message.
q : I will finish writing the report.
r : I will go to sleep early.
s : I will wake up early.
So, the premises are p q, p r, r s and the conclusion is q s.
The argument form is
pq
p r
rs
q s

Step 2:
Steps Reasons
1) p q Hypothesis / Premise
2) q p Use step (1) and Contrapositive
3) p r Hypothesis / Premise
4) q r Use step (2), (3), and Hypothetical Syllogism
5) r s Hypothesis / Premise
6) q s Use step (4), (5), and Hypothetical Syllogism

This argument form shows that the hypotheses lead to the desired conclusion.

TUTORIAL EXERCISE 1.2

Prepared By Chiang Yoke Yen(2012) Page 10


DISCRETE MATHEMATICS BA202

1. What rules of inference is used in each of these arguments?


a) Linda is a Mathematics major. Therefore, Linda is either a Mathematics major or a
Information Technology major.
b) John is either likes reading or drawing. John dislikes reading. Therefore, John likes
drawing.
c) If tomorrow is a sunny day, then we will go swimming. Tomorrow is a sunny day.
Therefore, we will go swimming.
d) If I go swimming, then I will not go shopping. If I do not go shopping, then you help
me buy the New Times magazine. Therefore, if I go swimming, then you help me buy
the New Times magazine.
e) If I finish the report today, then I will send the report for you tomorrow. I do not send
the report for you tomorrow. Therefore I do not finish the report today.

2. Explain the rules of inference used to show that the hypotheses lead to the desired
conclusion.
a) Cindy works hard. If Cindy works hard, then she is a hardworking girl. If Cindy
is a hardworking girl, then she will get the job. Therefore, Cindy will get the job.
b) I am either lucky or clever. I am not lucky. If I am clever, then I will get a good
result in SPM. I will get a good result in SPM.
c) If Mary has free times, then she will go shopping. Mary buys a new skirt if she
goes shopping. Mary does not buy a new skirt. Therefore, Mary does not have
free times.

1.3 PREDICATE LOGIC

Prepared By Chiang Yoke Yen(2012) Page 11


DISCRETE MATHEMATICS BA202

The proposition logic is not powerful enough to represent all types of assertions that are
used in computer science and mathematics.
Predicate logic is a more powerful type of logic to express the meaning of a wide range of
statements in mathematics and computer science in ways to reason and explore
relationships between objects.

Predicate Logic
Statement involving variables, such as:-
x > 3
x = y +3
x + y = z
computer x is functioning properly.
are often found in mathematical assertions, in computer programs, and in system
specifications.
These statements are neither true nor false when the values of the variables are not
specified.
The statement x is greater than 3 has two part:-
First part the variable x, is the subject of the statement.
Second part the predicate, is greater than 3
The statement x is greater than 3 denote by P(x), where P denotes the predicate is
greater than 3 and x is the variable.
Example 17: Let P(x) denote the statement x > 3. What are the truth values of P(4) and
P(2)?
For P(4), the x = 4, thus the truth value is T since 4 > 3 is a true statement.
For P(2), the x = 2, thus the truth value is F since 2 > 3 is a false statement.
Example 18: Let Q(x, y) denote the statement x = y +3. What are truth values of the
propositions Q(1, 2) and Q(3, 0)?
For Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence the truth value is F
since 1 = 2 + 3 is a false statement.
For Q(3, 0), set x = 3 and y = 0 in the statement Q(x, y). Hence the truth value is T
since 3 = 0 + 3 is a true statement.

Quantifiers
Quantification is another important way to create a proposition from a propositional
function.
Quantification expresses the extent to which a predicate is true over a range of elements.
In English, the words all, some, many, none, and few are used in quantification.
Two types of quantification:-
a) Universal Quantifier (a predicate is true for every element under consideration.)
b) Existential Quantifier (there is one or more element under consideration for which
predicate is true.)

Universal Quantifier

Prepared By Chiang Yoke Yen(2012) Page 12


DISCRETE MATHEMATICS BA202

The universal quantifier of P(x) is the statement P(x) for all values of x in the domain,
denoted by , which read as for all x P(x) or for every x P(x)and called the
universal quantifier.
An element for which P(x) is false is called a counterexample of .
is same as conjunction.
Example 19: Let P(x) be the statement x + 1 > x. What is the truth value of the
quantification , where the domain consists of all real numbers?
The quantification is true since P(x) is true for all real numbers x.
Example 20: Let Q(x) be the statement x < 2.What is the truth value of the
quantification , where the domain consists of all real numbers?
Q(x) is not true for every real number x, because, for instance Q(3) is false. That is,
x = 3 is a counterexample for the statement . Thus is false.

Existential Quantifier
The existential quantifier of P(x) is the proposition There exist an element x in the
domain such that P(x), denoted by , which read as there is an x such that P(x) ,
there is at least one x such that P(x) or for some x P(x). is called the existential
quantifier.
is false if and only if P(x) is false for every element of the P(x).
is same as disjunction.
Example 21: Let P(x) denote the statement x > 3. What is the truth value of the
quantification , where the domain consists of all real numbers?
Because x > 3 is sometimes true for instance, when x = 4, thus is true.
Let Q(x) denote the statement x = x + 1. What is the truth value of the quantification
, where the domain consists of all real numbers?
Because Q(x) is false for every real number x, the existential quantifier of Q(x), which
is , is false.

The truth value of and summarized as:


is true when there is all x for P(x) is true and it is false when P(x) is false for
either x.
is true when there is an x for which P(x) is true and it is false when P(x) is false
for every x.

Translating English Sentences into Logical Expressions


Translating English into logical expression becomes more complex when quantifiers are
needed.
There can be many ways to translate a particular sentence.
Example 22: Express the statement Every student in this class has studied calculus
using predicates and quantifiers.

Prepared By Chiang Yoke Yen(2012) Page 13


DISCRETE MATHEMATICS BA202

First step: Rewrite the statement so that can identify the appropriate quantifiers to use.
For every student in this class, that student has studied calculus.
Second step: Introduce a variable x so that the statement becomes
For every student x in this class, x has studied calculus.
Third step: Introduce C(x), which is the statement x has studied calculus. If the
domain for x consists of the students in the class, then the statement translate as
.
Example 23: Express the statements Some student in this class has visited Malacca
using predicates and quantifiers.
First step: Rewrite the statement so that can identify the appropriate quantifiers to use.
There is a student in this class, that the student has visited Malacca.
Second step: Introduce a variable x so that the statement becomes
There is a student in x this class, that x has visited Malacca.
Third step: Introduce M(x), which is the statement x has visited Malacca. If the
domain for x consists of the students in the class, then the statement translate as
.
Example 24: Let C(x, y) be the predicate x clever than y and let the universe of
discourse be the set of all students. Use quantifiers to express the statement Not
everyone is not clever than someone.
First step: Rewrite the statement so that can identify the appropriate quantifiers to use.
Not every students is not clever than some students.
Second step: Introduce a variable x so that the statement becomes
Not every x is not clever than some y.
Third step: Hence, the statement translate as .
Example 25: Let P(x, y) be the predicate x loves y and let the universe of discourse be
the set of all people in Malaysia. Express the quantification in sentences.
express to someone in Malaysia.
express to everyone in Malaysia.
Because P(x, y) is the predicate x loves y, thus express to x not love y
Combine all the sentences and will become Someone in Malaysia not love everyone
in Malaysia.

Tutorial Exercise 1.3

Prepared By Chiang Yoke Yen(2012) Page 14


DISCRETE MATHEMATICS BA202

1. Let P(x) be the statement the word x contains the letter a. What are the truth values?
a) P(Discrete)
b) P(Mathematics)
c) P(True)
d) P(False)

2. Let Q(x, y) denote the statement x2 > y. What are the truth values?
a) Q(1, 2)
b) Q(-3, 8)
c) Q( , 3)

3. Let P(x) be the statement x likes subject mathematics, where the domain for x consists
of all students. Express each of these quantifications in English.
a)
b)
c)
d)

4. Let Q(x) denote the statement x + 1 = 2x. If the universe of discourse is all integers,
what are these truth values?
a) Q(0)
b) Q(-1)
c) Q(1)
d)
e)
f)
g)

5. Let C(x, y) be the statement x is a friend of y, where the domain for x and y consists of
all people. Use quantifications to express each of the following statements.
a) Everyone is a friend of everyone.
b) Not everyone is a friend of someone.
c) Someone is not a friend of someone.
d) There is a friend of John.
e) Mary is not a friend of everyone.

6. Let P(x, y) be the statement x dislike y, where the domain for x is all students and the
domain for y consists of all subjects. Express each of these quantifications in English.
a) xy P(x, y)
b) xy P(x, y)
c) xy P(x, y)
d) x P(x, Mathematics)

Prepared By Chiang Yoke Yen(2012) Page 15


DISCRETE MATHEMATICS BA202

e) y P(Maria, y)

7. Let H(x) be the statement x is hardworking, N(x) be the statement x is naughty and
C(x) be the statement x is clever, where the domain for x consists of all students. Use
quantifications to express each of the following statements.
a) Some students are clever but naughty.
b) Not all students are clever and hardworking.
c) Some students are clever, hardworking and not naughty.
d) All students are clever, or hardworking or naughty.

Prepared By Chiang Yoke Yen(2012) Page 16