Professional Documents
Culture Documents
Topic 3
Logic & Proof
Outline
• Introduction to Logic
• Truth Tables
• Implication
• Logical Implication and Equivalence
• Valid Argument
• Predicate Calculus
Word Symbol
and ^
or V
not ~
if, then
BMATH2305 Discrete Structure 9
Example Compound Statement
with ^
p ~p
T F
F T
Note: T means TRUE and F means FALSE.
The statement form ~ p has the opposite truth
value as the statement form p.
BMATH2305 Discrete Structure 20
Example Truth Table of Conjunction
(^)
p q p^q
T T T
T F F
F T F
F F F
The statement form p ^ q is TRUE if and only if
both statement forms p and q are TRUE.
BMATH2305 Discrete Structure 21
Example Truth Table of Disjunction
(v)
p q p vq
T T T
T F T
F T T
F F F
The statement form p V q is FALSE if and only if
both statement forms p and q are FALSE.
BMATH2305 Discrete Structure 22
Truth Table for More Than One
Connective
p q ( p v q) ^ ~ (p^q)
T T T F F T
T F T T T F
F T T T T F
F F F F T F
1 2 3 6 5 4
p q pvq
T T F
T F T
F T T
F F F
BMATH2305 Discrete Structure 25
Example More Than Two Variables
p q r ( p v q ) ^ (( p v r ) ^ ~ q )
T T T F F T F F
T T F F F T F F
T F T T T T T T
T F F T T T T T
F T T T F T F F
F T F T F F F F
F F T F F T T T
F F F F F F F T
1 2 3 4 8 5 7 6
BMATH2305 Discrete Structure 27
Tree
•Another method of describing a For example:
statement form is by using a
tree. The statement form is (p^~q)r
written at the top of the tree.
The statement is then separated
along the branches into its
operands until only simple
( p ^ ~ q) r
statements are at the end of the
branches.
p ~q
F
BMATH2305 Discrete Structure 29
Logic and Computer Languages
Calculator
Logic symbol
Function
AND ^
OR V
NOT ~
XOR v
BMATH2305 Discrete Structure 30
Example Excel
•Use an Excel spreadsheet to find the truth value
of
(p^~q)vr
if p is TRUE and q and r are both FALSE.
p q (pq) ^ (qp)
T T T T T
T F F F T
F T T F F
F F T T T
1 2 3 5 4
•b) A = -2, B = 3:
•IF (A*B + 6 > 10):
•A*B + 6 > 10 is (-2)(3) + 6 > 10.
•The above statement is FALSE.
•ELSE LET C = 10:
•The computer sets C to 10.
p q pq pq
T T T T
T F F F
F T F T
F F T T
T T F T T F F F
T F F T T F F T
F T F T T T F F
F F T F T T T T
1 2 4 3 8 5 7 6
Distributive laws:
( p v ( q ^ r )) (( p v q ) ^ ( p v r ))
( p ^ ( q v r )) (( p ^ q ) v ( p ^ r ))
Idempotent laws:
( p v p) p
( p ^ p) p
Identity laws:
(pvc)p
(pvt)t
BMATH2305 Discrete Structure 63
Other Equivalences (3)
(p^c)c
(p^t)p
( p v ~p) t
( p ^ ~p) c
Contrapositive:
( p q) ( ~q ~p )
Implication:
( p q) ( ~p v q )
( p q) ~ ( p ^ ~ q )
BMATH2305 Discrete Structure 64
Other Equivalences (4)
Equivalence:
( p q ) (( p q ) ^ ( q p ))
Reductio ad absurdum:
( p q ) (( p ^ ~ q ) c )
(p q) ^ (q v r)
(~ p v q) ^ (q v r) Implication
(q v ~p) ^ (q v r) Commutative law
q v ( ~p ^ r) Distributive law
q v ( ~p ^ ~ ~ r) Double negative
q v ~ ( p v ~ r) De Morgan’s law.
Modus ponens:
( p ^ (p q)) q
Modus tollens:
(( p q) ^ ~ q) ~ p
Disjunctive syllogism:
(( p v q) ^ ~q ) p
Hypothetical syllogism:
(( p q) ^ ( q r)) ( p r)
Constructive dilemmas:
(( p q) ^ ( r s)) (( p v r) ( q v s))
(( p q) ^ ( r s)) (( p ^ r) ( q ^ s))
•Verify ( p ^ (p q)) q.
p q ( p ^ (p q)) q
T T T T T
T F F F T
F T F T T
F F F T T
1 2 4 3 5
There are many logical equivalences. Among these are the commutative,
associative, distributive, and De Morgan’s laws:
Commutative: ( p v q) (q v p); ( p ^ q ) ( q ^ p )
Associative: ( p v q ) v r ) p v ( q v r );
(p^q)^r) p^(q^r)
Distributive: p v ( q ^ r ) ( p v q ) ^ ( p v r );
p^(qvr)(p^q)v(p^r)
De Morgan’s: ~ (p v q) ~ p ^ ~ q) ;
~ (p ^ q) ~ p v ~ q.
BMATH2305 Discrete Structure 76
Outline
• Introduction to Logic √
• Truth Tables √
• Implication √
• Logical Implication and Equivalence √
• Valid Argument
• Predicate Calculus
• Logic Circuits