You are on page 1of 17

By the end of the lecture material you should be familiar with the following terms:

Proposition
Truth value
Propositional calculus/propositional logic
Negation, conjunction, disjunction
Compound proposition
Exclusive or, inclusive or
Implications
Converse, contrapositive, inverse

And be able to:


Translate English sentences into expressions involving propositional variables and logical
connectives

LECTURE 1:

Formal logic

The rules of logic give precise meaning to mathematical statements. The rules are used to
distinguish between valid and invalid mathematical statements. Logic is the basis of all
mathematical reasoning. It has practical application in the design of computing machines, artificial
intelligence, programming languages and many other areas in computer science.

Propositions

Let us begin with the building blocks of logic propositions. A proposition is a statement
that is either true or false, but not both.

Example: The following are propositions:


5 + 5 = 10 true
1+6=2 false
Owen Arthur is the Prime Minister of Barbados true

The following are NOT propositions since their truth value cannot be established:
r+s=t
x+5=7

Letters are used to denote propositions. (eg. p or q). For example the propositions above
could have been written as
p: 5 + 5 = 10
q: 1 + 6 = 2
r: Owen Arthur is the Prime Minister of Barbados

Truth Value

The truth value of a proposition is true, denoted by T, if it is a true proposition, and false
F, if it is a false proposition.

The area of logic which deals with propositions is called propositional calculus or
propositional logic.

IT232: Discrete Mathematics 1|


Page
Sem2, SY 2014-2015
Compound propositions

Compound propositions are formed from existing propositions using logical operators
called connectives. Some of these connective are the conjunction (AND denoted by ), the
disjunction (OR denoted by ), implication (denoted by ), the equivalence (IF AND ONLY IF
denoted by ) and the exclusive-or (denoted by ).

Let p and q be propositions. The proposition p and q denoted by p q, is the proposition


that is true when both p and q are true and is false otherwise. The proposition p q is
called the conjunction of p and q.

Let p and q be propositions. The proposition p or q denoted by p .q, is the proposition that
is false when both p and q are false and is true otherwise. The proposition p q is called
the disjunction of p and q. This is often referred to as the inclusive or.

Example: Let p be the proposition Today is Monday and q the proposition It is the first
Discrete Math class. Find the negation of p, the conjunction of p and q and the
disjunction of p and q as expressed in English?

Solution: ~ p : Today is not Monday


p q : Today is Monday and it is the Discrete Math class
p q : Today is Monday or it is the Discrete Math class

Let p and q be propositions. 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 (when
both p and q are true, or both are false).

LECTURE 2:

By the end of the lecture you should be familiar with the following terms:
Implications
Converse, contrapositive, inverse
Tautology, contradiction, contingency
Logical equivalence

And be able to:


Translate English sentences into expressions involving propositional variables and logical
connectives
Show that two propositions are logically equivalent using truth tables or a series of
logically equivalent statements

Let p and q be propositions. The implication p q is the proposition that is false when p is
true and q is false and is true otherwise. p is called the hypothesis and q is called the
conclusion.

The implications p q can be expressed in a variety of ways. Some of these are:


if p, then q p is sufficient for q
p implies q q whenever p
p only if q q is necessary for p
p q
Example: Let p: I am elected to office
and q: I will lower the amenities fees.

IT232: Discrete Mathematics 2|


Page
Sem2, SY 2014-2015
The implication p q reads: If I am elected to office then I will lower the amenities
fees.

The only case when I would have broken my promise is the case when I am elected
to office and did not lower the amenities fees.

If I am not elected to office (~p) you cannot expect me to lower the amenities fees. I
would not have broken my pledge in such a case.

Note that p q is false only in the case where p is true and q is false.

Truth Table

A truth table displays the relationships between the truth values of propositions.

Conjunction

Equivalence
Disjunction

Implication

Exclusive
Negation

OR
p q ~p p q pq pq pq pq
T T F T T T T F
T F F T F F F T
F T T T F T F T
F F T F F T T F

Note: p q is True when p and q have the same truth values.


p q is True when p or q is true, but not both.

Converse, Contrapositive and Inverse

We can form or build new compound propositions using the connectives we have just seen.

Example: ((p q) (~ r)) where p, q and r are all propositions

We can form additional propositions from this implication:


The proposition q p is called the converse of p q
The proposition (~ q) (~ p) is called the contrapositive of p q
The proposition (~ p) (~ q) is called the inverse of p q

Example: Find the converse, contrapositive and inverse of the implication:


If it is raining, then there are dark clouds in the sky
Solution:
Let p: It is raining.
q: There are dark clouds in the sky.
Converse (q p) : If there are dark clouds in the sky, then it is raining
Contrapositive ((~ q) (~ p): If there are no dark clouds in the sky, then it is not
raining
Inverse (~ p) (~ q): If it is not raining then there are no dark clouds in the sky.

Let p and q be propositions. The biconditional p q is the proposition that is true


when p and q have the same truth values and is false otherwise.

IT232: Discrete Mathematics 3|


Page
Sem2, SY 2014-2015
Some terminology used :
p if and only if q
p I necessary and sufficient for q
if p then q and conversely
p if q

Precedence of logical Operators:


( ) parentheses for grouping
~ negation for Not
conjunction for And
disjunction for Or, exclusive-OR
implication, equivalence

Translating English sentences

Translating sentences into logical expressions removes the ambiguities of the English
language and facilitates their analysis and the application of the rules of inference.

Example: Translate the following English sentence into a logical expressions.


You can access the internet from campus only if you are a Computer
Science major or you are not a freshman.

Solution: Let a: You can access the internet from campus


c: You are a Computer Science major
f: you are a freshman.

Note: only if is one way an implication can be expressed the sentence can be
expressed as

Answer: if you can access the internet from campus then you are a Computer
Science major or you are not a freshman
which gives a(c f )

Propositional Equivalence

Sometime it is necessary, in a mathematical argument to replace one statement with a


statement with the same truth value

A compound proposition that is always true, no matter what the truth values of the
propositions that occur in it, is called a tautology. A compound proposition that is always false
is called a contradiction. Finally, a proposition that is neither a tautology nor a contradiction is
called a contingency.

Example:
p ~p p ~p p ~p
T F T F
F T T F

From the above table we see that


p ~p is a TAUTOLOGY
IT232: Discrete Mathematics 4|
Page
Sem2, SY 2014-2015
p ~p is a CONTRADICTION

Most statements will have some combination of T's and F's in their
truth table final column; they are called contingencies. Some
statements will have nothing but T's; they are called tautologies.
Others will have nothing but F's; they are called contradictions.

Logical Equivalence

Compound propositions that have the same truth values in all possible cases are called
logically equivalent.

The propositions p and q are called logically equivalent if p q is a tautology.

Example: Show that ~(p q) and (~ p) (~ q) are logically equivalent.

Solution: The solution is given using a truth table below. Since the truth values of the
propositions ~(p q) and (~ p) (~ q) are the same in all possible combination of
truth values of p and q, it follows that these propositions are logically equivalent.
p q ~p ~q p q ~(p q) (~ p) (~ q) ~(p q) (~ p) (~
q)
T T F F T F F T
T F F T T F F T
F T T F T F F T
F F T T F T T T

All truth value combinations result to T and it just shows that the above proposition is a
tautolgogy.

IDENTITIES for logically equivalent propositions

EQUIVALENCE NAME
pT p Identity Laws
p F p
pTT Domination Laws
pFF
ppp Idempotent Laws
ppp
~(~p) p Double Negation Law

p q q p Commutative Laws
pq qp

(p q) r p (q r) Associative Laws
(p q) r p (qr)

p (q r) (p q) (p r) Distributive Laws
p (q r) (p q) (p r)

~ (p q) ~p ~q De Morganss Laws
~ (p q) ~p ~q

p~pT Complement Property


IT232: Discrete Mathematics 5|
Page
Sem2, SY 2014-2015
p~pF

(p q) (~ p q) Implication

(p q) (~ q ~ p) Contraposition

We can use a truth table to show that compound propositions are logically
equivalent OR we can use a series of logical equivalences.

IT232: Discrete Mathematics 6|


Page
Sem2, SY 2014-2015
Quiz in IT221:Discrete Mathematics

Name: ________________________ Due date : ------------------------


Course & Section: _______________ Note: Copying of work (indicating excellence) will be
attested on next meetings long quiz. Low quiz
result will invalidate this homework.
I. Break the following compound propositions
into several simple propositions. Use only letters
a, b, c, d, e, f, or g as symbols.

1. I will eat lunch when I fell hungry or when Amy takes over the shift.
2. If Connie gets the highest honor, she must have read all the books or sent the jurors holiday
gifts.
3. Whether it is a sunny or a rainy day, she brings umbrella.
4. The waiter does not get a tip if the food is cold and the drinks are without ice.
5. When you do not get a 1.25 grade then you cannot qualify to take comprehensive exam nor
can proceed with the dissertation.

II. Convert the 5 statements above into symbolic propositional logic sentences using the assigned
symbols (variables) and connectives.

II. Determine whether the following propositions are Tautology, Contradiction, or Contingency
using truth tables.

1. (a (~ b c)) ((~ a b) (~ c))


2. b (~ a b) (a ~c)
3. (a b c) ~(~ a ~ b ~ c)
4. (~ c (a (~ (b c))) (b (~ (~a~c))) (not included)

God bless
chai

IT232: Discrete Mathematics 7|


Page
Sem2, SY 2014-2015
December 4, 2014
======================

Discussion on Quiz

Quiz in IT221: Discrete Mathematics

I. Break the following compound propositions into several simple propositions.


Use only letters a, b, c, d, e, f, or g as symbols.

1. I will eat lunch when I feel hungry or when Amy takes over the shift.
a b c
Ans.: a: I will eat lunch.
b: I feel hungry.
c: Amy takes over the shift.

2. If Connie gets the highest honor, she must have read all the books or sent the jurors
holiday gifts.

Ans.: a: Connie gets the highest honor


b: She must have read all the books.
c: She sent the jurors holiday gifts gifts.

3. Whether it is a sunny or a rainy day, she brings umbrella.

Ans.: a: It is a sunny day ; a: it is sunny.


b: It is a rainy day ; b: It is rainy .
c: She brings umbrella.

4. The waiter does not get a tip if the food is cold and the drinks are without ice.

Ans.: a: The waiter gets a tip


b: The food is cold
c: The drinks are with ice

5. When you do not get a 1.25 grade then you cannot qualify to take comprehensive
exam nor can proceed with the dissertation.

Ans.: a: You get a 1.25 grade


b: You can qualify to take comprehensive exam
c: You can proceed with the dissertation.
=====================

IT232: Discrete Mathematics 8|


Page
Sem2, SY 2014-2015
LECTURE 3b:
By the end of the lecture you should be MORE adept to:
1) Write logical STATEMENTS or propositions in various forms
2) Translate from English expression/sentences to symbols

1) Review on Negation
~p is called the negation of p
~p is read not p
not p is also the same as It is not the case that p

Review on Conjunction
p q is called the conjunction of p and q
p q is read p and q
p but q also means p and q
neither p nor q means not p and not q; ~p and ~q ; ~p ~q

Example: Write the following sentences symbolically, letting h: It is hot and s: It is


sunny
X : It is not hot but it is sunny. X= ~h s
Answer
Y: It is neither hot nor sunny. Y= ~h ~s

Review on Disjunction

p q is called the disjunction of p and q


p q is read p or q
p or q also means either p or q ; whether p or q

Example: Write the ff. sentences symbolically, letting a: It is raining. and b: The air is
cold.
W: It is raining or the air is cold. W= a s
Answer
X: Either it is raining or the air is cold. X= a s

Review on Implication (conditional statement)

p q is called the implication of p and q


p q is also called the conditional of p and q
p q is read p implies q
p q also means if p then q
p is the hypothesis and q is the conclusion
If 18 is divisible by 9, then 18 is divisible by 3.
hypothesis Conclusion
if p then q can be written as p. Therefore q.
18 is divisible by 9. Therefore 18 is divisible by 3.
hypothesis Conclusion
if p then q can be written as q when p or when p,then q
if p then q can also simply written as if p, q; if can also be written as
when
if p then q can also be written as when p then q

Example: Write the ff. sentences symbolically, letting a: Logic is easy. and b: I will study
hard.
c: I will get 1.0 in this course.

IT232: Discrete Mathematics 9|


Page
Sem2, SY 2014-2015
W: If logic is easy or I will study hard,
then I will get 1.0 in this course. W= (a b) c
Answer X= ~a b
X: Logic is not easy. Therefore I will study hard.
================

IT232: Discrete Mathematics 10 |


Page
Sem2, SY 2014-2015
Continuation on the Discussion of Quiz

II. Convert the 5 statements above (Part I) into symbolic propositional logic expressions using the assigned
symbols (variables) and connectives.

1. I will eat lunch when I feel hungry or when Amy takes over the shift.
a b c
Ans.: (b c) a
2. If Connie gets the highest honor, she must have read all the books or sent the jurors
holiday gifts.
Ans.: a ( b c)
3. (if) Whether it is a sunny or a rainy day, (then) she brings umbrella.
Ans.: ( a b) c
4. The waiter does not get a tip if the food is cold and the drinks are without ice.

Ans.: (b ~c) ~a
5. When you do not get a 1.25 grade then you cannot qualify to take comprehensive exam nor
can proceed with the dissertation.

Ans.: ~a ((~b ~c)

II. Determine whether the following propositions are Tautology, Contradiction, or Contingency using
truth tables.

1. (a (~ b c)) ((~ a b) (~ c))


Ans:
a b c ~a ~b ~c ~ab ~bc a (~ b c) (~ a b) (a (~ b c))
(~ c) ((~ a b) (~ c))
F F F T T T F F T T T
F F T T T F F T T T T
F T F T F T T T T T T
F T T T F F T T T F F
T F F F T T F F F T T
T F T F T F F T T T T
T T F F F T F T T T T
T T T F F F F T T T T
Therefore, contingency.
2. b (~ a b) (a ~c)
Ans:
a b c ~a ~c ~ab a~c (~ a b) (a ~c) b (~ a b) (a ~c)
F F F T T F T F F

F F T T F F T F F
F T F T T T F F T
F T T T F T T T T
T F F F T F T F F
T F T F F F F F F
T T F F T F T F T
T T T F F F F F T
Therefore, contingency.
IT232: Discrete Mathematics 11 |
Page
Sem2, SY 2014-2015
3. (a b c) ~(~ a ~ b ~ c)
Ans:
a b c ~a ~b ~c (abc) (~ a ~ b ~ (~ a ~ b ~ c) (abc) ~ (~ a ~ b ~ c)
~ c)
F F F T T T F T F F
F F T T T F T T F F
F T F T F T T T F F
F T T T F F T T F F
T F F F T T T T F F
T F T F T F T T F F
T T F F F T T T F F
T T T F F F T F T T
Therefore, contingency.

4. (~ c (a (~ (b c)))) (b (~ (~a~c)))
Ans:
a b c ~ ~ (b ~ (b a (~ (b ~c ~a ~(~a (b (~ (~ c (a
(~ (b
c) c) (~a~c)))
a c c) (a (~ (b ~c) ~c) c)))) (b
c))) (~
(~a~c)))

F F F T T F T T T T F F F
F F T T F T T T T F T T T
F T F T T T T T T T F T T
F T T T F T T T T F T T T
T F F F T T T T T T F F F
T F T F F T T T T T F F F
T T F F T T T T T T F T T
T T T F F T F F T T F T T
Therefore, contingency.

IT232: Discrete Mathematics 12 |


Page
Sem2, SY 2014-2015
LECTURE 4:

By the end of the lecture you should be familiar with the following terms:
Inequalities
The Exclusive-OR
Inequalities

Notations for inequalities are and & or ( )


Ex. If x, a, and b are real numbers, then
x a means x<a or x=a
a xb means a x and x b
Suppose x is a real number.
Given: p: 0 < x
q: x<3
r: x=3
A: x < 3 or x=3
Problem: 1) A: x 3 Solution 1) A: q r

2) B: 0 < x < 3 Solution 2) B: 0 < x and x<3


B: p q

3) C: 0 < x 3 C: 0 < x and ( x<3 or x=3)


Solution 3)
p ( q 12,
C: February r) 2014(Wed., 2-5pm)

February 24, 2014(Fri., 2-5pm)


======================

LECTURE 5: The Exclusive-OR

Let p & q are statement variables


p q is read as p XOR q
p q means p OR q but not both
p q also means p OR q AND NOT both
p OR q AND NOT both is equal to (p q) ~( p q)

p OR q AND NOT both

(p q) ~(pq)

So, p q = (p q) ~( p q)
Showing XOR Truth Table:
P Q
S: p q (p q) ((pq) ~(pq))
p q pq (pq) (pq) ~(pq) (pq) ~(pq)
EQUAL

F F F F F T F
?

F T T T F T T
IT232: Discrete Mathematics 13 |
Page
Sem2, SY 2014-2015
T F T T F T T
T T F T T F F
Just the same or logically equivalent

Example:
m: You may have a milk shake. both means and
b: You may have a beer. m and b , m b
but also means and
m b : You may have a milk shake or you may have a beer, but not both.
m b ~ (m b)
mb Same w/ (m b) ~ (m b)

LECTURE 6: Review on IMPLICATION ( p q , pq)

p implies q is p q p q
p only if q is pq CONVERSE Form : q p
p if q is q p CONTRAPOSITIVE Form : ~q ~p

LECTURE 7: EQUIVALENCE ( p q , pq, pq )

p is equivalent to q is p q
p if and only if q
is called biconditional
p iff q
p is a sufficient condition for q
q is a necessary condition for p
p is necessary and sufficient condition for q

p q is TRUE if and only if p and q have the same truth value.

Example:
f: You get a pass in the foundation. both means and
m: You get a pass in the management. m and b , m b
but also means and

f m : You get a pass in the foundation if and only if you get a pass in the
management.

f is a sufficient condition for m


Getting a pass in the foundation is a sufficient condition for getting a pass in the
management.

IT232: Discrete Mathematics 14 |


Page
Sem2, SY 2014-2015
LECTURE 7: Review on identities
EQUIVALENCE () refers
IDENTITIES for logically equivalent propositions to logical equivalence

EQUIVALENCE NAME
(1) pT p Identity Laws aside from the symbol ,
p F p other notations used for
(2) pTT Domination Laws Logical Equivalence are
pFF
(3) ppp Idempotent Laws
ppp Ex. P Q means P and
(4) ~(~p) p Double Negation Law Q are logically equivalent
(5) p q q p Commutative Laws
pq qp
Two statement forms are
logically equivalent
(6) (p q) r p (q r) Associative Laws
if and only if
(p q) r p (qr)
they have identical truth
(7) p (q r) (p q) (p r) Distributive Laws values for each possible
p (q r) (p q) (p r) substitution of statements for
(8) ~ (p q) ~p ~q De Morgans Laws their statement variables
~ (p q) ~p ~q they have logically equivalent
(9) p~pT Complement Property
forms when identical
component statement
p~pF
variables are used to replace
(11) (p q) (~ p q) Implication identical component
(12) (p q) (~ q ~ p) Contraposition statements

Testing whether 2 statement forms P and Q are logically equivalent


Construct a truth table w/ one column for the truth values of P and another column
for the truth values of Q
Ex. (1) Construct a truth table to show that the negation of the negation
(double negation) of a statement is logically equivalent to the statement,
annotating the table with a sentence of explanation.
Solution:
p ~p ~(~p)
F T F
T F T

p and ~(~p) always have


the same truth values, so
p and ~ (~p) are
logically equivalent
Ex. (2) Show that the statement forms ~ (pq) and ~p~q are not logically
equivalent.

Solution 1: by showing truth table


p q ~p ~q p q ~(p q) ~p~q ~(p q) and ~p~q
IT232: Discrete Mathematics
have different15truth
|
Page values, so they are not
Sem2, SY 2014-2015 logically equivalent
F F T T F T T
F T T F F T F
T F F T F T F
T T F F T F F

Solution 2: by using example to show ~(p q) and ~p~q.


Let p: 0<1
q: 5>2

~(p q) ~p~q
~T T F F
F F

Simplify:

1) (p implies q) or (p implies r) implies (q or r)


a) ( (p q) (p r) ) (q r )
b) (~ p q) v (~ p r) (q r ) by implication

c) (~ p q v ~ p r ) (q r ) by associative law

d) (~ p v ~ p q r ) (q r )
e) (~ p v ~ p) q r ) (q r )
f) ~pq r (q r ) by idempotent law

g) ~ p q (r (q r ) ) by associative law

h) ~ p q (~r v qr) by associative law

i) ~ p q ~r v q r

j) ~ p (q v q) (~r r )

j) ~ p ( q) (T) idempotent, complement

k) ~p ( q T) associative
l) ~p T domination
NO IDENTITY LAW CAN BE APPLIED

1) (p implies q) or (p implies r) implies (q or r)


a) ( (p q) (p r) ) (q r )
b) (~ p q) v (~ p r) (q r ) by implication

c) (~ p q v ~ p r ) (q r ) by associative law

d) (~ p v ~ p q r ) (q r )
e) (~ p v ~ p) q r ) (q r )
f) ~pq r (q r ) by idempotent law

g) ~ p q (r (q r ) ) by associative law

h) ~ ( ~ p q ) (~r v q r ) by associative law

IT232: Discrete Mathematics 16 |


Page
Sem2, SY 2014-2015
i)
(~ (~p ) ~ q) (~r v q r ) by De Morgans Law

i) (p ~ q) (~r r v q ) Double Negation Law, Complement

j) (p ~ q) (Tvq)

j) p ~ q Tvq by associative

k) p (~ q v q) T associative, complement

k) p (T T)

l) p T identity law
m) p

( (p q) (p r) ) (q r ) p

MARCH 17, 2014


Quiz: Write the correct compound proposition. (5 points each)

Given: a: You access the internet.


b: The network is down.
c: The power is working.
d: We have a work holiday.

1. a (~b c)
2. b ~c
3. d (b ~a)
4. ~a ~ (b c)

5. Is (p q) r (pr) (qr) ? Justify your answer.

IT232: Discrete Mathematics 17 |


Page
Sem2, SY 2014-2015