0% found this document useful (0 votes)
34 views20 pages

ICS141: Discrete Mathematics For Computer Science I: Dept. Information & Computer Sci., University of Hawaii

The document is a slide presentation for a Discrete Mathematics course at the University of Hawaii. It covers propositional logic, including implication, biconditional, and compound operators. It provides examples and truth tables for logical operators like conjunction, disjunction, negation, implication, and biconditional. It also defines atomic and compound propositions and how to evaluate them using truth tables.
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)
34 views20 pages

ICS141: Discrete Mathematics For Computer Science I: Dept. Information & Computer Sci., University of Hawaii

The document is a slide presentation for a Discrete Mathematics course at the University of Hawaii. It covers propositional logic, including implication, biconditional, and compound operators. It provides examples and truth tables for logical operators like conjunction, disjunction, negation, implication, and biconditional. It also defines atomic and compound propositions and how to evaluate them using truth tables.
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/ 20

University of Hawaii

ICS141:
Discrete Mathematics for
Computer Science I
Dept. Information & Computer Sci., University of Hawaii

Originals slides by Dr. Baek and Dr. Still, adapted by J. Stelovsky


Based on slides Dr. M. P. Frank and Dr. J.L. Gross
Provided by McGraw-Hill

ICS 141: Discrete Mathematics I – Fall 2011 2-1


University of Hawaii

Lecture 2
Chapter 1. The Foundations
1.1 Propositional Logic

ICS 141: Discrete Mathematics I – Fall 2011 2-2


Review: University of Hawaii

The Implication Operator


 The conditional statement (a.k.a. implication)
p  q states that p implies q.
 I.e., If p is true, then q is true; but if p is not true,
then q could be either true or false.
 E.g., let p = “You study hard.”
q = “You will get a good grade.”
p  q = “If you study hard, then you will
get a good grade.” (else, it could go either way)
 p: hypothesis or antecedent or premise
 q: conclusion or consequence

ICS 141: Discrete Mathematics I – Fall 2011 2-3


Review:
Implication Truth Table
University of Hawaii

p q pq
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!

ICS 141: Discrete Mathematics I – Fall 2011 2-4


Examples of Implications
University of Hawaii

 “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)

ICS 141: Discrete Mathematics I – Fall 2011 2-5


English Phrases Meaning p  q
University of Hawaii

 “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.

ICS 141: Discrete Mathematics I – Fall 2011 2-6


University of Hawaii

Converse, Inverse, Contrapositive


 Some terminology, for an implication p  q:
 Its converse is: q  p.
 Its inverse is: ¬p  ¬q.
 Its contrapositive: ¬q  ¬p.
p q pq qp p q q p
T T T T T T
T F F T T F
F T T F F T
F F T T T T

 One of these three has the same meaning


(same truth table) as p  q. Can you figure
out which?
ICS 141: Discrete Mathematics I – Fall 2011 2-7
Examples
University of Hawaii

 p: Today is Easter
q: Tomorrow is Monday

 pq:
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

 The biconditional statement p  q states


that p if and only if (iff) q.
 p = “It is below freezing.”
q = “It is snowing.”
p  q = “It is below freezing if and only if it is
snowing.”
or
= “That it is below freezing is
necessary and sufficient for it to be
snowing”
ICS 141: Discrete Mathematics I – Fall 2011 2-9
Biconditional Truth Table
University of Hawaii

p q pq
• 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

 Conjunction: p  q, (read p and q), “discrete math is a


required course and I am a computer science major”.
 Disjunction: , p  q, (read p or q), “discrete math is a
required course or I am a computer science major”.
 Exclusive or: p  q, “discrete math is a required
course or I am a computer science major but not
both”.
 Implication: p  q, “if discrete math is a required
course then I am a computer science major”.
 Biconditional: p  q, “discrete math is a required
course if and only if I am a computer science major”.
ICS 141: Discrete Mathematics I – Fall 2011 2-11
Boolean Operations Summary
University of Hawaii

 We have seen 1 unary operator and 5 binary


operators. What are they? Their truth tables are
below.
p q p pq pq pq pq pq
T T F T T F T T
T F F F T T F F
F T T F T T T F
F F T F F F T T
 For an implication p  q
 Its converse is: qp
 Its inverse is: ¬p  ¬q
 Its contrapositive: ¬q  ¬p
ICS 141: Discrete Mathematics I – Fall 2011 2-12
Compound Propositions
University of Hawaii

 A propositional variable is a variable such as p, q, r


(possibly subscripted, e.g. pj) over the Boolean
domain.
 An atomic proposition is either Boolean constant or
a propositional variable: e.g. T, F, p
 A compound proposition is derived from atomic
propositions by application of propositional operators:
e.g. ¬p, p  q, (p  ¬q)  q
 Precedence of logical operators: ¬, , , , 
 Precedence also can be indicated by parentheses.
 e.g. ¬p  q means (¬p)  q, not ¬(p  q)
ICS 141: Discrete Mathematics I – Fall 2011 2-13
An Exercise
University of Hawaii

 Any compound proposition can be evaluated


by a truth table
 (p  ¬q)  q

p q q pq (pq) q
T T F T T
T F T T F
F T F F T
F F T T F

ICS 141: Discrete Mathematics I – Fall 2011 2-14


Translating English Sentences
University of Hawaii

 Let p = “It rained last night”,


q = “The sprinklers came on last night,”
r = “The lawn was wet this morning.”

Translate each of the following into English:

¬p = “It didn’t rain last night.”


r  ¬p = “The lawn was wet this morning,
and it didn’t rain last night.”
¬r  p  q = “The lawn wasn’t wet this
morning, or it rained last night, or
the sprinklers came on last night.”
ICS 141: Discrete Mathematics I – Fall 2011 2-15
Another Example
University of Hawaii

 Find the converse of the following statement.


 “Raining tomorrow is a sufficient condition for my not

going to town.”
 Step 1: Assign propositional variables to component
propositions.
 p: It will rain tomorrow

 q: I will not go to town

 Step 2: Symbolize the assertion: p → q


 Step 3: Symbolize the converse: q → p
 Step 4: Convert the symbols back into words.
 “If I don’t go to town then it will rain tomorrow” or

 “Raining tomorrow is a necessary condition for my not

going to town.”
ICS 141: Discrete Mathematics I – Fall 2011 2-16
Topic #2 – Bits

Logic and Bit Operations


University of Hawaii

 A bit is a binary (base 2) digit: 0 or 1.


 Bits may be used to represent truth values.
 By convention:

0 represents “False”; 1 represents “True”.


 A bit string of length n is an ordered sequence
of n  0 bits.
 By convention, bit strings are (sometimes) written
left to right:
 e.g. the “first” bit of the bit string “1001101010”

is 1.
 What is the length of the above bit string?

ICS 141: Discrete Mathematics I – Fall 2011 2-17


Topic #2 – Bits

Bitwise Operations
University of Hawaii

 Boolean operations can be extended to


operate on bit strings as well as single bits.

 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

ICS 141: Discrete Mathematics I – Fall 2011 2-18


End of 1.1
University of Hawaii

You have learned about:


 Propositions: what they are

 Propositional logic operators’

 symbolic notations, truth tables, English equivalents,

logical meaning
 Atomic vs. compound propositions

 Bits, bit strings, and bit operations

 Next section:
 Propositional equivalences

 Equivalence laws

 Proving propositional equivalences

ICS 141: Discrete Mathematics I – Fall 2011 2-19


Review Exercises
University of Hawaii

Submit your work by next class.


Your submission will not be
accepted without the exercise
handout attached.

ICS 141: Discrete Mathematics I – Fall 2011 2-20

You might also like