ICS141: Discrete Mathematics For Computer Science I: Dept. Information & Computer Sci., University of Hawaii
ICS141: Discrete Mathematics For Computer Science I: Dept. Information & Computer Sci., University of Hawaii
ICS141:
Discrete Mathematics for
Computer Science I
Dept. Information & Computer Sci., University of Hawaii
Lecture 2
Chapter 1. The Foundations
1.1 Propositional Logic
p q pq
T T T
The only
T F F False case!
F T T
F F T
p q is false only when p is true but q is not true.
p q does not require that p or q are ever true!
E.g. “(1=0) pigs can fly” is TRUE!
“If this lecture ever ends, then the sun will rise
tomorrow.” True or False? (T T)
“If 1+1=6, then Obama is president.”
True or False? (F T)
“If the moon is made of green cheese, then I am
richer than Bill Gates.” True or False? (F F)
“If Tuesday is a day of the week, then I am a
penguin.” True or False? (T F)
“p implies q” “p only if q”
“if p, then q” “p is sufficient for q”
“if p, q” “q is necessary for p”
“when p, q” “q follows from p”
“whenever p, q” “q is implied by p”
“q if p”
“q when p” We will see some
“q whenever p” equivalent logic
expressions later.
p: Today is Easter
q: Tomorrow is Monday
pq:
If today is Easter then tomorrow is Monday.
Converse: q p
If tomorrow is Monday then today is Easter.
Inverse: ¬p ¬q
If today is not Easter then tomorrow is not Monday.
Contrapositive: ¬q ¬p
If tomorrow is not Monday then today is not Easter.
ICS 141: Discrete Mathematics I – Fall 2011 2-8
The Biconditional Operator
University of Hawaii
p q pq
• p is necessary and
T T T sufficient for q
T F F • If p then q, and
conversely
F T F • p iff q
F F T
p q is equivalent to (p q) (q p).
p q means that p and q have the same truth
value.
p q does not imply that p and q are true.
Note this truth table is the exact opposite of ’s!
Thus, p q means ¬(p q).
ICS 141: Discrete Mathematics I – Fall 2011 2-10
Boolean Operations Summary
University of Hawaii
p q q pq (pq) q
T T F T T
T F T T F
F T F F T
F F T T F
going to town.”
Step 1: Assign propositional variables to component
propositions.
p: It will rain tomorrow
going to town.”
ICS 141: Discrete Mathematics I – Fall 2011 2-16
Topic #2 – Bits
is 1.
What is the length of the above bit string?
Bitwise Operations
University of Hawaii
Example:
01 1011 0110
11 0001 1101
11 1011
11 1011 1111111 Bit-wise OR
01 0001
01 0001 01000100 Bit-wise AND
10 1010
10 1010 10111011 Bit-wise XOR
logical meaning
Atomic vs. compound propositions
Next section:
Propositional equivalences
Equivalence laws