DiscreteMath Chap1 Logic
DiscreteMath Chap1 Logic
MATH210
Course contents
Logic
Relations
Graphs
Trees
Course contents
Logic
Relations
Graphs
Trees
Logic foundations
Use of logic
In mathematics:
to prove theorems
In computer science:
Definition of a proposition:
A proposition (usually denoted by p, q, r, …) is a declarative statement
that is either True (T) or False (F), but not both or somewhere “in
between!”.
p q r pq (p q) r
F F F F F
F F T F T
F T F T T
F T T T T
T F F T T
T F T T T
T T F T T
T T T T T
The Exclusive Or Operator
The binary exclusive-or operator “” (XOR) combines two propositions to form
their logical “exclusive or” (exjunction?).
p q pq
F F F
F T T xor(p,q) = r
T F T
T T F
This operation is called exclusive or, because it excludes the possibility that
both p and q are true.
Assume p = “It rained last night”, q = “The sprinklers came on last night” ,
r = “The grass was wet this morning”.
Translate each of the following into English:
¬p = It did not rain last night
r ¬p = The grass was wet this morning and it did not rain last night
¬rpq = Either the grass wasn’t wet this morning, or it rained last
night, or the sprinklers came on last night
Nested Propositional Expressions
Note that
(f g) s would mean something different from f g s
“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 a penguin.” True or False?
“If 1 + 1 = 6, then Trump is now the president of USA.” True or False?
Equivalent symbols for implication
¬ p q is logically equivalent to p q
p q ¬p q pq
F F T T
F T T T
T F F F
T T T T
In English:
p q pq
“p if and only if q "
F F T
"If p, then q, and conversely"
F T F
“p is sufficient and necessary for q " T F F
Written p q T T T
Translation English Sentences into
Logical Expressions
If you are a computer science major or you are not a freshman,
then you can access the internet from campus :
is translated to:
(c f ) a
Logic and Bit Operations
Find the bitwise AND, bitwise OR, and bitwise XOR of the bit strings
0110110110 and 1100011101.
e.g. p q , p q
Tautology
Example: p p q
p q pq ppq
F F F T
F T T T
T F T T
T T T T
Equivalence Laws
De Morgan’s:
(p q) p q
(p q) p q
Absorption:
p (p q) p
p (p q) p
Trivial tautology/contradiction:
p p T , p p F
Implications / Biconditional Rules
p q ¬p q
¬ (p q) ¬ (¬p q) p ¬ q
p q ¬ q ¬ p (contrapositive)
p q (p q) (q p)
¬ (p q) p q
Proving Equivalence via Truth Tables
( (P Q) Q) Equivalence
( ( P Q) Q) De Morgan
( (P Q) Q) Equivalence
( (P Q) Q) De Morgan
( P Q Q) Trivial Tautology
( P T) Domination
(T) Contradiction
F
Predicates and Quantifiers
x P(x, 2):
P(1,2) P(2, 2) P(3, 2)
y P(3, y):
P(3,1) P(3,2) P(3,3)
Negations
x P(x) ≡ x P(x)
x Q(x) ≡ x Q(x)