Wa0001
Wa0001
Laws of Logic
• Given any statement variables p, q and r,
a tautology t and a contradiction c, the
following logical equivalences hold
• Commutative Laws:
pq qp
pq qp
• Associative Laws:
(p q) r p (q r)
(p q) r p (q r)
2
Laws of Logic
• Distributive Laws:
p (q r) (p q) (p r)
p (q r) (p q) (p r)
• Identitiy Laws:
pt p
pc p
3
Laws of Logic
• Negation Laws:
p~p t
p~p c
• Idempotent Laws:
ppp
ppp
4
Laws of Logic
• DeMorgan´s Laws:
~ (p q) ~ p ~ q
~ (p q) ~ p ~ q
• Absorption Laws:
p (p q) p
p (p q) p
5
Laws of Logic
• Negation of t and c:
~tc
~ct
6
Application of Laws of Logic
• Simplify
p [~(~p q)]
• Solution
p [~(~p q)]
p [~(~p) (~q)] DeMorgan’s Law
p [p(~q)] Double Negative Law
[p p](~q) Associative Law for
p (~q) Indempotent Law
7
Application of Laws of Logic
• Verify logical Equivalence
~ (~ p q) (p q) p
• Solution
~(~p q) (pq)
(~(~p) ~q) (p q) DeMorgan’s Law
(p ~q) (pq) Double Negative Law
p (~q q) Distributive Law in
Reverse
pc Negation Law
p Identity Law
8
Simplifying A Statement
• “You will get an A if you are hardworking
and the sun shines, or you are
hardworking and it rains.”
• Solution:
• Let p = “You are hardworking’
q = “The sun shines”
r = “It rains”
The condition is then (p q) (p r)
9
Simplifying A Statement
Using distributive law in reverse,
(p q) (p r) p (q r)
Putting p (q r) back into English, we
can rephrase the given sentence as
“You will get an A if you are hardworking
and the sun shines or it rains”.
10
Conditional statement
• Let p and q be propositions. The
conditional statement p → q is the
proposition “if p, then q.”
• The conditional statement p → q is false
when p is true and q is false, and true
otherwise.
• In the conditional statement p → q, p is
called the hypothesis (or antecedent or
premise) and q is called the conclusion (or
consequence).
11
Conditional Statement
• "If you earn an A in Math, then I'll buy you a
computer.“
• This statement is made up of two simpler
statements:
p: "You earn an A in Math," and
q: "I will buy you a computer."
The original statement is then saying:
if p is true, then q is true, or, more simply, if p, then q.
We can also phrase this as p implies q, and we write
p q.
12
TRUTH TABLE FOR
pq
p q pq
T T T
T F F
F T T
F F T
13
Conditional Statements
OR
Implications
• If p and q are statement variables, the
conditional of q by p is “If p then q”
or “p implies q” and is denoted p q
• The arrow " " is the conditional
operator
• p is called the hypothesis (or
antecedent)
• q is called the conclusion (or
consequent)
14
Conditional Statement
• “If 1 = 1, then 3 = 3.” TRUE
• “If 1 = 1, then 2 = 3.”
FALSE
• “If 1 = 0, then 3 = 3.” TRUE
• “If 1 = 2, then 2 = 3.” TRUE
• “If 1 = 1, then 1 = 2 and 2 = 3.”
FALSE
• “If 1 = 3 or 1 = 2 then 3 = 3.” TRUE
15
ALTERNATIVE WAYS OF
EXPRESSING IMPLICATIONS
• “if p then q”
• “not p unless q”
• “p implies q”
• “q follows from p”
• “if p, q”
• “q if p”
• “p only if q”
• “q whenever p”
• “q is sufficient for p”
• “q is necessary for p”
16
TRANSLATING ENGLISH
SENTENCES TO SYMBOLS
• Let p and q be propositions:
p = “you get an A in the final exam”
q = “you do every exercise in this book”
r = “you get an A in this class”
17
TRANSLATING ENGLISH
SENTENCES TO SYMBOLS
• You do every exercise in this book; You
get an A in the final, implies, you get an A
in the class
• Solution
pqr
18
TRANSLATING ENGLISH
SENTENCES TO SYMBOLS
• To get an A in this class it is necessary
for you to get an A in the final
SOLUTION
pr
19
TRANSLATING ENGLISH
SENTENCES TO SYMBOLS
• Getting an A in the final and doing every
exercise in this book is sufficient for
getting an A in this class
• Solution
pqr
20
TRANSLATING SYMBOLIC
PROPOSITIONS TO ENGLISH
• Let p, q, and r be the propositions:
21
TRANSLATING SYMBOLIC
PROPOSITIONS TO ENGLISH
• pq
If you have flu, then you will miss the final
exam.
• ~q r
If you don’t miss the final exam, you will
pass the course.
• ~p ~q r
If you neither have flu nor miss the final
exam, then you will pass the course.
22
HIERARCHY OF OPERATIONS
FOR LOGICAL CONNECTIVES
• ~ (negation)
(conjunction), (disjunction)
(conditional)
23
TRUTH TABLE FOR
p~q~p
p q ~q ~p p ~q p~q~p
T T F F T F
T F T F T F
F T F T F T
F F T T T T
24
TRUTH TABLE FOR
(p q)(~ p r)
p q r pq ~p ~pr (pq)(~ p r)
T T T T F T T
T T F T F T T
T F T F F T F
T F F F F T F
F T T T T T T
F T F T T F F
F F T T T T T
F F F T T F F
25
LOGICAL EQUIVALENCE
INVOLVING IMPLICATION
pq ~q ~p
p q ~q ~p pq ~q ~p
T T F F T T
T F T F F F
F T F T T T
F F T T T T
26
IMPLICATION LAW
pq ~pq
p q pq ~p ~pq
T T T F T
T F F F F
F T T T T
F F T T T
27
NEGATION OF A CONDITIONAL
STATEMENT
• Since pq ~pq therefore
~ (p q) ~ (~ p q)
~ (~ p) (~ q)by De Morgan’s
law
p ~ q by the Double
Negative law
• Thus the negation of “if p then q” is logically
equivalent to “p and not q”. Accordingly, the
negation of an if-then statement does not start
with the word if.
28
NEGATION OF A CONDITIONAL
STATEMENT
• Write negations of each of the following statements:
• 1. If Ali lives in Pakistan then he lives in Lahore.
• 2. If my car is in the repair shop, then I cannot get to
class.
• 3. If x is prime then x is odd or x is 2.
• 4. If n is divisible by 6, then n is divisible by 2 and n is
divisible by 3.
• SOLUTIONS:
• 1. Ali lives in Pakistan and he does not live in Lahore.
• 2. My car is in the repair shop and I can get to class.
• 3. x is prime but x is not odd and x is not 2.
• 4. n is divisible by 6 but n is not divisible by 2 or by 3.
29
INVERSE OF A CONDITIONAL
STATEMENT
• The inverse of the conditional statement
p q is ~p ~q
30
TRUTH TABLE OF INVERSE OF
A CONDITIONAL STATEMENT
p q is ~p ~q
p q pq ~p ~q ~p ~q
T T T F F T
T F F F T T
F T T T F F
F F T T T T
31
WRITING INVERSE
1. If today is Friday, then 2 + 3 = 5.
If today is not Friday, then 2 + 3 5.
32
WRITING INVERSE
3. If P is a square, then P is a rectangle.
If P is not a square then P is not a
rectangle.
34
CONVERSE OF A CONDITIONAL
STATEMENT
p q pq qp
T T T T
T F F T
F T T F
F F T T
35
WRITING CONVERSE
1.If today is Friday, then 2 + 3 = 5.
If 2 + 3 = 5, then today is Friday.
2.If it snows today, I will ski tomorrow.
I will ski tomorrow only if it snows today.
3. If P is a square, then P is a rectangle.
If P is a rectangle then P is a square.
4. If my car is in the repair shop, then I cannot
get to class.
If I cannot get to the class, then my car is in the
repair shop.
36
CONTRAPOSITIVE OF A
CONDITIONAL STATEMENT
• The contrapositive of the conditional
statement p q is
~q~p
37
WRITING CONTRAPOSITIVE
1. If today is Friday, then 2 + 3 = 5.
If 2 + 3 5, then today is not Friday.
2. If it snows today, I will ski tomorrow.
I will not ski tomorrow only if it does not snow
today.
3. If P is a square, then P is a rectangle.
If P is not a rectangle then P is not a square.
4. If my car is in the repair shop, then I cannot
get to class.
If I get to the class, then my car is not in the
repair shop.
38
Exercise 1
• Use Logical Equivalence to rewrite each of
the following sentences more simply.
• It is not true that I am tired and you are smart.
• It is not true that I am tired or you are smart.
• I forgot my pen or my bag and I forgot my pen or
my glasses.
• It is raining and I have forgotten my umbrella, or
it is raining and I have forgotten my hat.
39
Solution to Exercise 1
• Use Logical Equivalence to rewrite each of the following
sentences more simply.
1. It is not true that I am tired and you are smart.
{I am not tired or you are not smart.}
2. It is not true that I am tired or you are smart.
{I am not tired and you are not smart.}
3. I forgot my pen or my bag and I forgot my pen or my
glasses.
{I forgot my pen or I forgot my bag and glasses. }
4. It is raining and I have forgotten my umbrella, or it is
raining and I have forgotten my hat.
{It is raining and I have forgotten my umbrella or my hat.}
40
Exercise 2
• Write the following statements in the form “if
p, then q” in English
a) Your guarantee is good only if you bought your
CD less than 90 days ago.
b) To get tenure as a professor, it is sufficient to be
world-famous.
c) That you get the job implies that you have the
best credentials.
d) It is necessary to walk 8 miles to get to the top
of the Peak.
41
Solution to Exercise 2
• a) Your guarantee is good only if you bought your CD less than
90 days ago.
– If your guarantee is good, then you must have bought your CD
player less than 90 days ago.
• c) That you get the job implies that you have the best
credentials.
– If you get the job, then you have the best credentials.
43