Propositional Calculus
CS 30 : Discrete Mathematics for Computer Science
First Semester, AY 2012-2013
https://sites.google.com/a/dcs.upd.edu.ph/nhsh_classes/cs 30
sablay-logo
Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University of the Philippines, Diliman nshernandez@dcs.upd.edu.ph updilseal
Day 1
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Mathematical Logic
sablay-logo
1
Propositional Calculus Introduction Statements and Connectives
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
"Contrariwise," continued Tweedledee, "if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic." Lewis Carroll, Through the Looking-Glass, Chapter 4
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
Logic is the technique by which we add conviction to truth.
sablay-logo
Jean De La Bruyere
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
sablay-logo
Logic is logic. That's all I say. Oliver Wendell Holmes, The One-Hoss Shay
http://www.ibiblio.org/eldritch/owh/shay.html
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
All men are mortal. Socrates was mortal. Therefore, all men are Socrates. Woody Allen
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
All men are mortal. Socrates was mortal. Therefore, all men are Socrates. Woody Allen To love is to su er. To avoid su ering one must not love, but then one su ers from not loving. Therefore, to love is to su er, not to love is to su er, to su er is to su er. To be happy is to love, to be happy then is to su er but su ering makes one unhappy, therefore to be unhappy one must love or love to su er or su er from too much happiness. I hope you're getting this down... Diane Keaton
sablay-logo
Love and Death updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
What is LOGIC ???
sablay-logo
Grammar is the logic of speech, even as logic is the grammar of reason.
updilseal
Richard Chenevix Trench
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage?
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage? A language in which we describe another language is called a metalanguage.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage? A language in which we describe another language is called a metalanguage. For almost all of mathematics, the metalanguage is English with some extra notation.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage? A language in which we describe another language is called a metalanguage. For almost all of mathematics, the metalanguage is English with some extra notation. In computing we need to de ne, and use, languages and formal notation so it is essential that we have a clear and precise metalanguage.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage? A language in which we describe another language is called a metalanguage. For almost all of mathematics, the metalanguage is English with some extra notation. In computing we need to de ne, and use, languages and formal notation so it is essential that we have a clear and precise metalanguage. We begin
sablay-logo
by looking at some English expressions which we could use in computing.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Language? Metalanguage? A language in which we describe another language is called a metalanguage. For almost all of mathematics, the metalanguage is English with some extra notation. In computing we need to de ne, and use, languages and formal notation so it is essential that we have a clear and precise metalanguage. We begin
sablay-logo
by looking at some English expressions which we could use in computing.
If it is raining and I go outside then I get wet.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition)
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2?
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
3
This sentence is false.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
3
This sentence is false. NO!
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
3
This sentence is false. NO!
4
Today is Monday.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
3
This sentence is false. NO!
4
Today is Monday. YES!
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Statement (also, Proposition) A proposition (or, statement) is a declarative sentence that is either true or false, but not both. Example 1
What is 2+2? NO!
2
Evaluate the sum 2+2. NO!
3
This sentence is false. NO!
4
Today is Monday. YES!
sablay-logo
We use letters to denote propositional variables (or statement variables). The truth value of a proposition is true, denoted by T, if it is a true proposition; and false, denoted by F, if it is a false proposition. The area of logic that deals with propositions is called the propositional calculus or propositional logic. Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Many mathematical statements are constructed by combining one or
sablay-logo
more propositions.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Many mathematical statements are constructed by combining one or
sablay-logo
more propositions. New propositions, called compound propositions, are formed from existing propositions using logical operators (or, connectives).
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Negation,
ÂŹ
or
âˆź
The negation of a statement is false when the statement is true and is true if the statement is false.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Negation,
ÂŹ
or
âˆź
The negation of a statement is false when the statement is true and is true if the statement is false.
sablay-logo
Example Statement: All computer scientists are men.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Negation,
ÂŹ
or
âˆź
The negation of a statement is false when the statement is true and is true if the statement is false.
sablay-logo
Example Statement: All computer scientists are men. Negation of statement?
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Negation,
ÂŹ
or
âˆź
The negation of a statement is false when the statement is true and is true if the statement is false.
sablay-logo
Example Statement: All computer scientists are men. Negation of statement? No computer scientists are men.
Some computer scientists are men.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Negation,
¬
or
∼
The negation of a statement is false when the statement is true and is true if the statement is false.
sablay-logo
Example Statement: All computer scientists are men. Negation of statement? No computer scientists are men. Some computer scientists are men.
p ∼p T F F T Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
and
q
∧
are statements, then
p∧q
is read as
p
and
q
.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green. q: It is an apple.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. :
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. : It is green and it is an apple.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. : It is green and it is an apple.
p q p∧q T T T
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. : It is green and it is an apple.
p q p∧q T T T T F F
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. : It is green and it is an apple.
p T T F
q p∧q T T F F T F
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conjunction, If
p
q
and
∧
are statements, then
p∧q
is read as
Example
p
and
q
.
sablay-logo
p: It is green.
p∧q
q: It is an apple. : It is green and it is an apple.
p T T F F
q p∧q T T F F T F F F
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
and
q
∨
are statements, then
p∨q
is read as
p q or
.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher. q: I am a student.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. :
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. : I am a teacher or I am a student.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. : I am a teacher or I am a student.
p q p∨q T T T
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. : I am a teacher or I am a student.
p q p∨q T T T T F T
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. : I am a teacher or I am a student.
p T T F
q p∨q T T F T T T
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Disjunction, If
p
q
and
∨
are statements, then
p∨q
is read as
Example
p q or
.
sablay-logo
p: I am a teacher.
p∨q
q: I am a student. : I am a teacher or I am a student.
p T T F F
q p∨q T T F T T T F F
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Exclusive OR, Let also
p q p 6≡ q and
⊕
or
6≡
be statements. The
exclusive p of
and
q
true and is false otherwise.
p
, denoted by
, is the proposition that is true when exactly one of
p⊕q q
and
is
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Exclusive OR, Let also
p q p 6≡ q and
⊕
or
6≡
be statements. The
exclusive p of
and
q
true and is false otherwise.
p T T F F
q p 6≡ q T F F T T T F F
p
, denoted by
, is the proposition that is true when exactly one of
p⊕q q
and
is
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
if
p p
and
then
q q
.
conditional statement p =⇒ q
is read as
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
if
p p
and
then
q q p .
is called the
conditional statement p =⇒ q hypothesis antecendent premise
is read as
(or
or
)
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
q
if
p p
and
then
q conditional statement p =⇒ q q p hypothesis antecendent premise conclusion consequence .
is called the
is called the
(or
is read as
(or
or
) and
).
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
q
if
p p
and
then
q conditional statement p =⇒ q q p hypothesis antecendent premise conclusion consequence .
is called the
is called the
(or
is read as
(or
or
) and
).
sablay-logo
Example p: You got a nal grade of 93. q: You got a 1.0.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
q
if
p p
and
then
q conditional statement p =⇒ q q p hypothesis antecendent premise conclusion consequence .
is called the
is called the
(or
is read as
(or
or
) and
).
sablay-logo
Example p: You got a nal grade of 93.
p =⇒ q
q: You got a 1.0. :
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
q
if
p p
and
then
q conditional statement p =⇒ q q p hypothesis antecendent premise conclusion consequence .
is called the
is called the
(or
is read as
(or
or
) and
).
sablay-logo
Example p: You got a nal grade of 93.
p =⇒ q
q: You got a 1.0. : If you got a nal grade of 93, then you got a 1.0.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Conditional,
=⇒
Let
be statements. The
q
if
p p
and
then
q conditional statement p =⇒ q q p hypothesis antecendent premise conclusion consequence .
is read as
is called the
is called the
(or
(or
or
) and
).
sablay-logo
Example p: You got a nal grade of 93.
p =⇒ q
q: You got a 1.0. : If you got a nal grade of 93, then you got a 1.0.
p T T F F
q p =⇒ q T T F F T T F T
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Terminology : if p, then q p implies q q if p p only if q q when p p is su cient for q a necessary condition for p is q a su cient condition for q is p q whenever p q is necessary for p q follows from p q unless ÂŹp
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Consider these ...
If the sun shines today we will have a barbecue.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Consider these ...
If the sun shines today we will have a barbecue.
If the sun shines today 19 is prime.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Consider these ...
If the sun shines today we will have a barbecue.
If the sun shines today 19 is prime.
sablay-logo
If the sun shines today 8 is prime.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
converse
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
contrapositive
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
contrapositive
sablay-logo
¬ =⇒ ¬
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
contrapositive
sablay-logo
¬ =⇒ ¬ inverse
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
p
q
contrapositive
sablay-logo
¬ =⇒ ¬ inverse
¬ =⇒ ¬
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
p
q
contrapositive
sablay-logo
¬ =⇒ ¬ inverse
¬ =⇒ ¬
When two compound propositions always have the same truth value we call them equivalent. updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
p
q
contrapositive
sablay-logo
¬ =⇒ ¬ inverse
¬ =⇒ ¬
When two compound propositions always have the same truth value we call them equivalent. That is, a conditional statement and its contrapositive are equivalent.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Forming new conditional statements starting with a conditional statement
Introduction Statements and Connectives
p =⇒ q
q =⇒ p
converse
q
p
p
q
contrapositive
sablay-logo
¬ =⇒ ¬ inverse
¬ =⇒ ¬
When two compound propositions always have the same truth value we call them equivalent. That is, a conditional statement and its contrapositive are equivalent.
updilseal
Also, the converse and inverse of a conditional statement are equivalent. dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Biconditional, Let as
p p
and
q
�⇒
su cient for
q
p q
be statements. The
q
if and only if .
or
i
biconditional statement p �⇒ q p
. It is also read as
is read
is necessary and
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Biconditional, Let as
p p
and
q
�⇒
su cient for
q
p q
be statements. The
q
if and only if .
or
i
biconditional statement p �⇒ q p
. It is also read as
is read
is necessary and
sablay-logo
Example p: You are enrolled in CS 30. q: You have passed Math 17.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Biconditional, Let as
p p
and
q
�⇒
su cient for
q
p q
be statements. The
q
if and only if .
or
i
biconditional statement p �⇒ q p
. It is also read as
is read
is necessary and
sablay-logo
Example p: You are enrolled in CS 30.
p �⇒ q
q: You have passed Math 17. :
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Biconditional, Let as
p p
and
q
�⇒
su cient for
q
p q
be statements. The
q
if and only if .
or
i
biconditional statement p �⇒ q p
. It is also read as
is read
is necessary and
sablay-logo
Example p: You are enrolled in CS 30.
p �⇒ q
q: You have passed Math 17. : You are enrolled in CS 30 if and only if you have passed
Math17.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Connectives ? Symbolic Notations?
Biconditional, Let as
p p
and
q
�⇒
su cient for
q
p q
be statements. The
q
if and only if .
or
i
biconditional statement p �⇒ q p
. It is also read as
is read
is necessary and
sablay-logo
Example p: You are enrolled in CS 30.
p �⇒ q
q: You have passed Math 17. : You are enrolled in CS 30 if and only if you have passed
Math17.
p T T F F
q p �⇒ q T T F F T F F T
Discrete Mathematics for Computer Science
CS 30
updilseal
dcs-logo
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Precedence of Logical Operators In logical expressions involving more than one operation, the order of operations must be understood.
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Precedence of Logical Operators In logical expressions involving more than one operation, the order of operations must be understood. The order of precedence of the basic operations listed from highest to lowest is
¬
sablay-logo
∧ ∨ =⇒ ⇐⇒
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Precedence of Logical Operators In logical expressions involving more than one operation, the order of operations must be understood. The order of precedence of the basic operations listed from highest to lowest is
¬
sablay-logo
∧ ∨ =⇒ ⇐⇒ Note: In programming languages such as C/C++, as
p q r
( ∧ )∨
, where
∧
is denoted
&&
and
p&&q||r ∨
would be interpreted
is denoted
||.
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
Precedence of Logical Operators In logical expressions involving more than one operation, the order of operations must be understood. The order of precedence of the basic operations listed from highest to lowest is
¬
sablay-logo
∧ ∨ =⇒ ⇐⇒ Note: In programming languages such as C/C++, as
p q r
( ∧ )∨
, where
∧
is denoted
p∧q∨r
&&
and
p&&q||r ∨
would be interpreted
is denoted
||.
updilseal
However, in applications such as Microsoft Excel, it is impossible to enter
p q r p ∧ (q ∨ r )
an expression of the form
( ∧ )∨
or
.
Discrete Mathematics for Computer Science
without explicitly entering it either as
CS 30
dcs-logo
acl-logo
Propositional Calculus
Truth Table of
p∧q∨r
Introduction Statements and Connectives
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
p∧q∨r p q r p ∧ q (p ∧ q ) ∨ r T T T T F F F F
Introduction Statements and Connectives
Truth Table of
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
p∧q∨r q r p ∧ q (p ∧ q) ∨ r T T F F T T F F
Introduction Statements and Connectives
Truth Table of
p T T T T F F F F
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
p∧q∨r r p ∧ q (p ∧ q) ∨ r T F T F T F T F
Introduction Statements and Connectives
Truth Table of
p T T T T F F F F
q T T F F T T F F
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
p∧q∨r r p ∧ q (p ∧ q) ∨ r T T F T T F F F T F F F T F F F
Introduction Statements and Connectives
Truth Table of
p T T T T F F F F
q T T F F T T F F
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
p∧q∨r r p ∧ q (p ∧ q) ∨ r T T T F T T T F T F F F T F T F F F T F T F F F
Introduction Statements and Connectives
Truth Table of
p T T T T F F F F
q T T F F T T F F
sablay-logo
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
Introduction Statements and Connectives
A Logic Puzzle
Knights and Knaves The logician Raymond Smullyan describes an island containing two types
knights who always tell the truth and knaves who always lie.
of people:
You visit the island and are approached by two natives who speak to you as follows: A says: B says:
sablay-logo
B is a knight. A and I are of opposite type.
What are A and B ?
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo
Propositional Calculus
sablay-logo
Questions? See you next meeting!
updilseal
dcs-logo
Discrete Mathematics for Computer Science
CS 30
acl-logo