0% found this document useful (0 votes)
24 views24 pages

2.2 Conditional Statements

Uploaded by

ly1997.sy
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)
24 views24 pages

2.2 Conditional Statements

Uploaded by

ly1997.sy
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/ 24

2.

2 Conditional Statements

1
Implication (if - then)
Truth Table of →
p q p→q
true true true
true false false
false true true
false false true

p→q is false only when p is true & q is false.


2
Module #1 - Logic

Examples of Implications
• “If this lecture ever ends, then the sun will
rise tomorrow.” True or False?
• “If Tuesday is a day of the week, then I am
superman.” True or False?
• “If 1+1=6, then I am the president.”
True or False?
• “If the moon is made of green cheese, then I
am richer than Bill Gates.” True or False?
Module #1 - Logic

English Phrases Meaning p → q


• “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” We will see some equivalent
logic expressions later.
• “q when p”
• “q whenever p”
Converse, Inverse, Contrapositive
For an implication p → q
Its converse is: q → p.

Its inverse is: p → q.


Its contrapositive: q → p.
One of these three has the same meaning
(same truth table) as p → q.
Can you figure out which?
5
p → q is equivalent to q → p.

Logical Proof

p → q is false if and only if


p is true and q is false

which is equivalent to
q is true and p is false.
which is equivalent to
q → p is false.
6
Example
What are the contrapositive, the converse,
and the inverse of the conditional statement
“The home team wins whenever it is raining?”
Solution
“q whenever p” is one of the ways to express
the conditional statement p → q,
The original statement can be rewritten as
“If it is raining, then the home team wins.”
Contrapositive:
“If the home team does not win, then it is not
raining.” 7
The converse is
“If the home team wins, then it is raining.”

The inverse is
“If it is not raining, then the home team does
not win.”

Only the contrapositive is equivalent to the


original statement.

8
Writing the Contrapositive
Example
Write each of the following statements in its equivalent
contrapositive form:
a. If Howard can swim across the lake, then Howard
can swim to the island.
b. b. If today is Easter, then tomorrow is Monday
Solution
a. If Howard cannot swim to the island, then Howard
cannot swim across the lake.
b. b. If tomorrow is not Monday, then today is not
Easter.
9
Converting Only If to If-Then
Example
Rewrite the following statement in if-then form in two
ways, one of which is the contrapositive of the other.
John will break the world’s record for the mile run
only if he runs the mile in under four minutes.
Solution
If John breaks the world’s record, then he will have
run the mile in under four minutes.
If John does not run the mile in under four minutes,
then he will not break the world’s record.

10
Converting a Sufficient Condition to If-Then Form
Example
Rewrite the following statement in the form
“If A then B”:
Pia’s birth on U.S. soil is a sufficient condition for her
to be a U.S. citizen
Solution
If Pia was born on U.S. soil, then she is a U.S. citizen.

11
Converting a Necessary Condition to If-Then Form
Example
Rewrite the following statement in if-then form and
its contrapositive.
George’s attaining age 35 is a necessary condition for
his being president of the US.
Solution
If George can be president of the United States, then
he has attained the age of 35.

If George has not attained the age of 35, then he


cannot be president of the United States.
12
Example:
Show that the propositions P → Q and P  Q are
logically equivalent.

P Q P P  Q P→Q
T T F T T
T F F F F
F T T T T
F F T T T

13
Example:
Use the logically equivalence P → Q  P  Q to
rewrite the following statement in if-then form:
Either you get to work on time or you are fired.

Solution
P → Q is logically equivalent to P  Q.
Let P be the proposition: you get to work on time.
And let Q be: you are fired.
Then the given statement becomes: P  Q
which is logically equivalent to P → Q, which reads
If you don’t get to work on time, then you are fired.
14
The Negation of a Conditional Statement
Since P → Q  P  Q, then
(P → Q)  (P  Q)  P  Q

Therefore, (P → Q)  P  Q

15
Example:
Write negations for each of the following statements:
a. If my car is in the repair shop, then I cannot get to
class.
b. If Sara lives in Athens, then she lives in Greece.
Solution
a. My car is in the repair shop and I can get to class.

b. Sara lives in Athens and she does not live in Greece.

16
Example: Show that
(p  q) → (p  q) is a tautology.
Solution (p  q) → (p  q)

 (p  q)  (p  q)

De Morgan’s law ( p   q)  (p  q)

( p  p)  ( q  q)

tt
Domination law 
t
17
The Biconditional
The biconditional of p and q is “p if, and only if, q”
and is denoted p  q.

It is true if both p and q have the same truth values


and is false if p and q have opposite truth values.

The words if and only if are sometimes abbreviated iff.

p  q is equivalent to (p → q)  (q → p)

18
Biconditional (if and only if)

Truth Table of 
p q pq
true true true
true false false
false true false
false false true

p  q is true if & only if p & q have the same


truth value. 19
Example: If and Only If
Rewrite the following statement as a conjunction of
two if-then statements:
This computer program is correct if, and only if, it
produces correct answers for all possible sets of input
data.
Solution
p  q is equivalent to (p → q)  (q → p)
If this program is correct, then it produces the correct
answers for all possible sets of input data;
and if this program produces the correct answers for
all possible sets of input data, then it is correct.

20
Use the equivalence p → q  p  q to show that
the following propositions are logically equivalent:
(p  q) → r  (p → r)  (q → r)
Solution
(p  q) → r  (p  q)  r p → q  p  q

 (p  q)  r De Morgan’s Law

 (p  r)  (q  r) Distributivity Law

 (p → r)  (q → r) p → q  p  q

21
Use the equivalence p → q  p  q to show that
the following propositions are logically equivalent:
p → (q  r)  (p  q) → r
Solution
p → (q  r)  p  (q  r) p → q  p  q

 (p  q)  r Associativity Law

 (p  q)  r De Morgan’s Law

 (p  q) → r p → q  p  q

22
Use the equivalence p → q  p  q to show that
the following propositions are logically equivalent:
p → (q  r)  (p  r) → q
Solution
p → (q  r)  p  (q  r) p → q  p  q

 p  (r  q) Commutativity Law

 (p  r)  q Associativity Law

 (p  r)  q De Morgan’s Law

 (p  r) → q p → q  p  q
23
Use the equivalence p → q  p  q to show that
the following propositions are logically equivalent:
p → (q → r)  (p  q) → r
Solution
p → (q → r)  p  (q → r) p → q  p  q

 p  (q  r) p → q  p  q

 (p  q)  r Associativity Law


 (p  q)  r De Morgan’s Law

 (p  q) → r p → q  p  q
24

You might also like