Math211
Discrete Mathematics
Propositional Logic II
SAHAR SELIM
Agenda
1.2 Applications of Propositional Logic
Translating English to logical expressions
1.3 Propositional Equivalences
Discrete Mathematics and Its Applications
Kenneth H. Rosen
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
2
1.2 Applications of Propositional Logic
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
3
Translating English to logical
expressions
Why?
Englishisoftenambiguousandtranslatingsentencesinto
compoundpropositionsremovestheambiguity
Usinglogicalexpressions,wecananalyzethemanddetermine
theirtruthvalues
Wecanuserulesofinferencestoreasonaboutthem
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
4
Example 1
Let p = “It is hot”, and q = “It is sunny”
It is not hot.
It is hot and sunny.
It is hot or sunny.
It is not hot but sunny.
It is neither hot nor sunny.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
5
¬ p
p ^ q
p ˅q
¬ p ^ q
¬ p ^ ¬ q
Example 2
“You can access the internet from campus
if you are a computer science major or you are not a freshman. ”
p : “You can access the internet from campus”
q : “You are a computer science major”
r : “You are freshmen”
( q v ┐r ) p
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
6
Hypothesis
Conclusion
H C
System specification
Translating sentences in natural language into logical
expressions is an essential part of specifying both hardware and
software systems.
Consistency of system specification.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
7
“The automated reply cannotbe sent whenthe file system is full”
1.Let p denote “The automated reply can be sent”
2.Let q denote “The file system is full”
The logical expression is
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
8
Example: System specification
Determine whether these system specifications are consistent:
1.The diagnostic message is stored in the buffer or it is retransmitted.
2.The diagnostic message is not stored in the buffer.
3.If the diagnostic message is stored in the buffer, then it is
retransmitted.
Let p denote “The diagnostic message is stored in the buffer”
Let q denote “The diagnostic message is retransmitted”
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
9
Example: System specification
Compound Propositions
Example:
p ∨q∧r : Could be interpreted as(p ∨q)∧r orp ∨(q ∧r)
Precedence order: ¬∧∨⊕ → ↔(IMP!) (Overruled by brackets)
We use this order to compute truth values of compound
propositions.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
10
1.3 Propositional Equivalences
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
11
Propositional Equivalence
Two syntactically(i.e., textually) different compound propositions
may be the semantically identical (i.e., have the same
meaning). We call them equivalent .
Learn:
Various equivalence rules orlaws.
How to proveequivalences using symbolic derivations.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
12
Proofs of Equivalence
Show that A ↔ B and ¬(A ⊕B) are equivalent
≡≡
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
13
•Truthtablescanbeusedto
showtheequivalenceoftwo
logicalexpressions
•Thelasttwocolumnshavethe
same values--sothe
expressionsareequivalent
Some Terminology
P ¬P P ˅¬P P ^ ¬P
T F T F
F T T F
Result is always
true, no matter
what P is
Result is always
false, no matter
what P is
Tautology Contradiction
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
14
Result is neither
tautology nor
contradiction
Contingency
A tautology is a proposition which is always true
Classic Example: P ∨¬P
A contradiction is a proposition which is always false
Classic Example: P ∧¬P
A contingency is a proposition which neither a tautology nor a
contradiction.
Example:(P ∨Q) →¬R
Some Terminology
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
15
Logical Equivalence
Two propositions P and Q are logically equivalent
if P ↔Q is a tautology.
We write: P ⇔ Q orP ≡Q
i.e. p and q contain the same truth values as each other in all rows of their truth
tables.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
16
Proving Equivalence via Truth Tables
p→q⇔¬p ∨q
p q (p→q) ¬p ¬p ∨q
F F T T T
F T T T T
T F F F F
T T T F T
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
17
Important for
removing
implication
Prove that p ∨q⇔¬(¬p ∧¬q).
Proving Equivalence via Truth Tables
pqpp∨∨qq¬¬pp¬¬qq¬¬pp ∧∧ ¬¬qq¬¬((¬¬pp ∧∧ ¬¬qq))
FF
FT
TF
TT
F
T
T
T
T
T
T
T
T
T
F
F
F
F
F
F
F
F
T
T
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
18
Equivalence Laws
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
19
order
More Equivalence Laws
Distributive: p∨(q∧r) ⇔(p∨q)∧(p∨r)
p∧(q∨r) ⇔(p∧q)∨(p∧r)
De Morgan’s:
¬(p∧q) ⇔¬p ∨¬q
¬(p∨q) ⇔¬p ∧¬q
Trivial tautology/contradiction:
p∨¬p⇔T p∧¬p⇔F
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
21
Defining Operators via Equivalences
Using equivalences, we can define operators in terms of
other operators.
(a^b^c) ˅ (a^¬b^c) ˅ (a^¬b^c)
≡
(a^c) ˅ (a^b)
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
22
Defining Operators via Equivalences
Exclusive Or
p⊕q⇔(p∨q)∧¬(p∧q)
p⊕q⇔(p∧¬q)∨(q∧¬p)
Implies
p→q ⇔¬p ∨q
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
26
Equivalences with Conditionals and
Biconditionals
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
27
Important for
removing
implication
Converse, Inverse, Contrapositive
Some terminology, for an implication p →q:
Its converseis: q →p
Its inverseis: ¬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?
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
28
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
29
Truth Table
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
30
Statement ≡Contrapositive
•The Statement If x=2, then x
2
=4 is true.
•Its Contrapositive If x
2
ǂ4, then x ǂ 2 so is true.
Converse ≡inverse
•Its Converse If x
2
=4, then x=2 is not true (x could be equal to - 2).
•Its inverse If x ǂ2, then x
2
ǂ4 so is not true (x could be equal to - 2).
p →q q →p ¬p →¬q ¬q →¬p
statement converse inverse contrapositive
Example
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
32
Ex.2
•Statement : If x is positive and x
2
=4, then x=2.
•Contrapositive : If x ǂ2 , then x is not positive or x
2
ǂ4.
Ex.3
•Statement: If the sun is shining then I go to store.
•Contrapositive: If I don’t go to store then the sun is not shining.
•Converse: If I go to store then the sun is shining.
•Inverse: If the sun is not shining then I don’t go to store
p →q q →p ¬p →¬q ¬q →¬p
statement converse inverse contrapositive
Example
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
33
Manipulating Propositions
Compound propositions can be simplified by using
simple rules.
Some are obvious, e.g. Identity, Domination,
Idempotence, double negation, commutativity,
associativity
Less obvious: Distributive, De Morgan’s laws
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
34
Example 1
p→q
¬p ∨q removing implication
¬p ∨¬(¬q) ¬¬x = x (double negation of q)
¬(¬q) ∨¬p commutative law
(¬q) →(¬p) Implication x→y⇔¬x ∨y
Show that p→q⇔¬q→¬pby logic algebra
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
35
p↔q⇔(p→q)∧(q→p)
p→q⇔¬p ∨q
Example 2
Show that (p ∧q) → (p ∨q) is a tautology using logical algebra
De Morgan law
Associative and commutative
law for disjunction
Commutative law for disjunction
Domination law
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
36
Example 3
Show that p↔q⇔(p ^ q) ∨(¬p ^¬q)by logic algebra
p↔q= (p→q)∧(q→p)
p↔q⇔(p→q)∧(q→p)
p→q⇔¬p ∨q
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
37
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
38
Problem 1
Show that ¬(p ∨(¬p ∧q)) and ¬p ∧¬q are logically
equivalent by developing a series of logical equivalences.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
39
Problem 2
Show p ˅(q ^ r) ≡(p ˅q) ^(p ˅r) using Truth Table
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
40
Problem 3
Check using a symbolic derivation whether
(p ∧¬q) →(p⊕r)⇔¬p ∨q∨¬r
(p ∧¬q) →(p⊕r)⇔
[Expand definition of →] ¬(p ∧¬q) ∨(p⊕r)
[Defn. of ⊕] ⇔ ¬(p ∧¬q) ∨((p∨r) ∧¬(p∧r))
[DeMorgan’sLaw]
⇔(¬p∨q)∨((p∨r) ∧¬(p∧r))
⇔[associative law] cont.
p→q⇔¬p ∨q
p⊕q⇔(p∨q)∧¬(p∧q)
p⊕q⇔(p∧¬q)∨(q∧¬p)
¬(p∧q) ⇔¬p ∨¬q
¬(p∨q) ⇔¬p ∧¬q
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
41
Problem 3 Continued...
q∨(¬p∨¬(p∧r))
[DeMorgan’s] ⇔q∨(¬p∨(¬p∨¬r))
[Assoc.] ⇔ q∨((¬p∨¬p) ∨¬r)
[Idempotent] ⇔ q∨(¬p∨¬r)
[Assoc.] ⇔ (q∨¬p) ∨¬r
[Commut.] ⇔ ¬p ∨q∨¬r
(Which was to be shown.)
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
43
Problem 4: Biconditionaloperator
p↔q⇔(p→q)∧(q→p)
p q p ↔ q (p→q) (q→p)(p→q)∧(q→p)
F F T T T T
F T F T F F
T F F F T F
T T T T T T
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
44
Try p↔q ⇔¬(p⊕q)
Summary of Lecture: Propositional Logic
Atomic propositions: p, q, r, …
Boolean operators:¬∧∨⊕→↔
Compound propositions: s:≡(p∧¬q) ∨r
Equivalences:p∧¬q ⇔¬(p →q)
Proving equivalences using:
Truth tables
Symbolic derivations. p⇔q ⇔r …
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
46
Supplementary Material
Kimberly BrehmChannel
Discrete Math 1.2.1 -Translating Propositional Logic Statements
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
48
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
49