You are on page 1of 6

MAT1348 D ISCRETE M ATHEMATICS FOR C OMPUTING

1. Propositional Logic

HY ATHEMATICS IS MAZING !
Mathematics is a form of Art. The masterpieces of math are elegant arguments (proofs)
that tell us some fragment of truth.
Unlike other sciences where results are most often obtained from experimental data and
observation, mathematical results are “discovered” when someone is able to prove that
something must be true.
For a proof to be correct, the underlying steps must be a valid logical argument and the
language we use must be well-defined and exact.
It is useful to know when something is true! Many scientific results are based on
underlying mathematical models ! physics, chemistry, biology, engineering...
In this course, we will study D ISCRETE M ATH — the part of mathematics devoted to the
study of “discrete” objects (consisting of distinct “whole” parts or unconnected
elements).
Ex. DNA/RNA sequences fundamental building blocks of living things tRNA)
=

or finite strings made of 4


symbols from the Set { TH ,C , A ,G}
=

RNA e±
-

AGCAUCGCAUCGA
translation
-
.

From DNA tRNA to building proteins from amino acids encoded by 3- letter
"
Words
"

called coda
Logic itself is especially important in Computer Science; the language of computers is
Boolean algebra. Using logic, we are able to translate our intentions so that a machine
made of electrical circuits does our bidding.

T HE R OUGH P LAN FOR MAT1348


• We will begin by studying Propositional Logic.
• We will work our way towards writing and understanding correct Mathematical Proofs.
• We will study the basics of Set Theory, Functions, and Relations (especially Equivalence
Relations).
• We will learn basic methods of Counting, and Proof by Induction — these are
fundamental tools for math and computer science.
• We will end with an introduction to Graph Theory, which is an essential tool for
modelling many discrete structures.
Warnings!
• This course is very fast-paced.
• You will be given many new and precise definitions and techniques to use.
• Having precise (lawyer-like?) language is very important — when we communicate (in
the form of written mathematical proofs, computer programs, and otherwise), we want
to be certain we understand each other exactly.
⇤ These notes are solely for the personal use of students registered in MAT1348.
1
B ASIC B UILDING B LOCKS OF L OGIC

A proposition is a declarative sentence that is either true or false but not both.
If a proposition is true, then its truth value is TRUE, denoted T.
If a proposition is false, then its truth value is FALSE, denoted F.

Example 1.1. For each of the following sentences, determine whether or not it is a proposition.
If it is a proposition, what is its truth value? If it is not a proposition, explain.
(a) Ottawa is the capital of Canada. ← a
proposition @ Its T .

(b) 1 + 2 = 3. ← a
proposition @ Its T .

(c) 2 + 2 = 3. ← a
proposition @ Its F

what xis
(d) 1 + x = 3. ←
proposition
a
not unless we Know .

(e) There exists an integer x such that 1 + x = 3. ← a


proposition @ Its T
.

(f) For all integers x, the equation 1 + x = 3 is true. ← a


proposition @ Its F.

it's not declarative statement


(g) Eat your vegetables. ←
proposition
a
not since a

it's not declarative statement


(h) What time is it? ←
proposition
a
not since a

(i) All books in the library are yellow.


[ a proposition @ It's F ( at u Ottawa library)

(j) At least 2 books in the library are yellow.


[ a proposition @ It's T ( at uoltawa library)

Propositional variables (a.k.a atoms) and compound propositions.

For short, we will use variables to represent propositions.


The variables we use to represent propositions are called propositional variables or
“atoms” for short.
Ex. p : “Tigers are furry animals.”
Ex. q : “Elephants are wise.”

A compound proposition is formed by combining one or more atoms using logical


connectives.
2
L OGICAL C ONNECTIVES
Negation. Let p be a proposition.
"

Thenegationofp >
denoted TP ,
read "notP ,

"
Truth table:
the Itisnotlhecasethatp
"
is proposition .

P 7p
T F
• Thetrulhvalueoftipistheoppositofthetrulh
F T
valueofp .

Conjunction. Let p and q be propositions.



, denotedpnq ,

por
Truth table:

porq
proposition
"
read the
"

pandq

PVQ
is
,

"
TT T
Pandq
"

pvqist
dismay
T F

theodora
F

ptqistwhenbothpandqaret
F
; otherwise ,
FT
F F
F

F
Ptqis
pvqistwhenbothpandqaret
porqbutnotboth
Disjunction. Let p and q be propositions.
• The , denoted ,
Truth table:
proposition
"
read the
" "
is "

, q
TT T

; otherwise ,

pqpnq
T F T

pqpotq
PQPVQ
FT
FF T

F
islhelndunsveerieandfor
" " " "
⇒ or
.

Exclusive Or. Let p and q be propositions.

pxorq

,

proposition
"
read the
"
is
,
Truth Table:

theex_uveorofpandq.de#dpotq
potqistwhenexactlyoneofpandqistand " "

TT F
T F T

Ft
FF

T

theolherisf ;
otherwise ,P0qisF .
F

3
Conditional Statement / Implication. Let p and q be propositions.

the_ondhohaaemn.li
"

fpsthenq isdenotedpsq ,

pqp→q
,
" "
read
" "
is the
proposition IFP then
pimpliesq ,
,
q .

gp→q
Pisthepremise Tqisthecondn

•oP→qis Fwhenpistandqist ; otherwise


,p→qisT .

Truth Table:

psoqislikeapromiseorbargain .

Ifpistthen
qispromisedobettheonlywayapromiseisbrokeh TT T

iswhlnpistbutqist .
T F F

F T T
[F→( anything )]isT
Note : F F T
.

[ (anything )→T]isT .

Biconditional Statement. Let p and q be propositions.

PqP→q
_icondhonaatemn
The
pifandonlyifq
• " "

Truth Table:
denoted
is read
pifandonlyifq
" "
Peg , .

T T T

T F F
Peoqistwhenpandqhavethesame

trulhvalue ( bothtorbothft ; otherwise ,


FT
F F
F

T
p<→qisF .

T RUTH TABLES

When making a truth table for a compound proposition consisting of atoms p1 , p2 , . . . , pk , we


will always use the following convention:
• 2k rowsforkatomsp , ,
...
,pq
onecdperatom
-

always

tf
• truth Values Tsandfscnotosts )
"

{ ¥¥
?
T T T F

FEF
• Eachatomhasitsowncolumn
oooforrightmostatom PFAFF
.

£
°

" " : F T T
F

's column We
T

alternate
F

,
...

T ¥
,F,T,F ,
... column .

: ;

fromtoptoboltomof
Movingonecdumntotheleftthehextatom 's

9
alternates teak qq.gg
Column alternates twiaasmanytsandtwice
alternates alternates ,

2k "
TS 4Ts,4Fs ZTS ,2Fs ...

asmanyfsasthecolumnonits
...

immediate right 2k 'Fs


'

4
Example 1.2. Write a truth table for each of the following compound propositions:
a. (p ! q) $ (¬p _ q)
b. (p q) ! ¬q
c. (p ! q) ^ (q ! p)
d. ¬(¬p _ q)
e. (p ^ ¬p) $ (p _ ¬p)
f. q $ (p $ r)

a) Tpvq ( p→q)←Gpvq )
T T T T T

T F F F T

F T T T T

F F T T T

7q ( P0q)→7q
T T F F T

T F T T T

F T T F F

F F F T T

PQPQQ
Pq7P7pVq
P→q )

pqP→q
c ) pq q→p

(p→q)^(q→p
T T T T T

d)
b)
T F F T F
F T T F F
F F T T T

TGPVQ )
T T F T F
T F F F T

F T T T F
F F T T F

e) P 7P PMP Php ( Pnp )←o( Php )


T F F T F
F T F T F

5
ft per ( )
p q r
of a
per
T T T T T

T T F F F
T F T T F
T F F F T

F T T F F
F T F T T

F F T F T

F F F T F

TAUTOLOGIES , C ONTRADICTIONS , AND C ONTINGENCIES

• A compound proposition that is always true (in all rows of its truth table) is called a
tautology.
• A compound proposition that is always false (in all rows if its truth table) is called a
contradiction.
• A compound proposition that is neither a tautology nor a contradiction is called a
contingency.
Example 1.3. For each compound proposition given in Example 1.2, determine whether it is a
tautology, contradiction, or contingency.

g)
tautology
a) ( p
Gpvq ) always T
→ a is :O

b) ( Po
g) →
7q
is sometimes T
,
sometimes F %
contingency

always
c) ( p ) sometimes T sometimes F

of )^(q→p is ,
%
contingency

d) TGPVQ ) is sometimes T
,
sometimes F %
contingency

e) ( Pnp ) ← ( Php ) is F :O contradiction

f) of ←
( par ) is sometimes T
,
sometimes F %
contingency

S TUDY G UIDE

⇧ proposition propositional variable / atom compound proposition


⇧ truth value truth table (how many rows?)
⇧ logical connectives: negation ¬ disjunction (or) _ conjunction (and) ^
implication ! biconditional (if and only if) $ exclusive or (XOR)
⇧ tautology contradiction contingency
Rosen Exercises 1.1 # 1,3,5,11, 31, 33, 35, 37 1.3 # 11, 19
6

You might also like