Lecture # 03
Lecture # 03
Junaid Asghar
BSCS (UET Lahore)
MSCS (UMT Lahore)
Lecturer
Computer Sciences and IT Department
The University of Lahore
LAWS OF LOGIC
Lecture # 03
Applying Laws of Logic
Using laws of logic simplify the statement
form.
p [~(~p q)]
Solution:
p [~(~p) (~q)] DeMorgan’s Law
p [p(~q)] Double Negative
Law
[p p](~q) Associative Law for
p (~q) Indempotent Law
Solution:
Let
p = “You are hardworking’
q = “The sun shines”
r = “It rains”
p q pq
T T T
T F F
F T T
F F T
CONDITIONAL STATEMENTS OR
IMPLICATIONS:
Definition:
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.
It is false when p is true and q is false; otherwise
it is true.
“if p, q” “q if p”
“p only if q” “q whenever p”
~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.
HIERARCHY OF OPERATIONS
FOR LOGICAL CONNECTIVES
~ (negation)
(conjunction)
(disjunction)
(conditional)
Construct a truth table for the statement
form (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
Construct a truth table for the statement
form (p q)(~ p r)
p q r pq ~p ~pr (p q) (~ 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
LOGICAL EQUIVALENCE INVOLVING
IMPLICATION
Use truth table to show p q ~q ~p
p q ~ ~p p q ~q ~p
q
T T F F T T
T F T F F F
F T F T T T
F F T T T T
p q pq ~p ~p
q
T T T F T
T F F F F
F T T T T
F F T T T
NEGATION OF A CONDITIONAL
STATEMENT
Since p q ~p q therefore
~ (p q) ~ (~ p q)
~ (~ p) (~ q) by De Morgan’s
law
p ~ q by the Double Negative law
Note:
Accordingly, the negation of an if-then statement
does not start with the word if.
EXAMPLES
Write negations of each of the following
statements: