Agenda
1.2 Applicationsof 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
3.
1.2 Applications ofPropositional Logic
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
3
4.
Translating English tological
expressions
Why?
English is often ambiguous and translating sentences into
compound propositions removes the ambiguity
Using logical expressions, we can analyze them and determine
their truth values
We can use rules of inferences to reason about them
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
4
5.
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
6.
Example 2
“You canaccess 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
7.
System specification
Translatingsentences 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
8.
“The automated replycannot be sent when the 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
9.
Determine whether thesesystem 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
10.
Compound Propositions
Example:
p∨ q ∧ r : Could be interpreted as (p ∨ q) ∧ r or p ∨ (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
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 or laws.
How to prove equivalences using symbolic derivations.
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
12
13.
Proofs of Equivalence
Show that A ↔ B and ¬(A ⊕ B) are equivalent
≡
≡
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
13
• Truth tables can be used to
show the equivalence of two
logical expressions
• The last two columns have the
same values -- so the
expressions are equivalent
14.
Some Terminology
P ¬PP ˅ ¬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
15.
A tautologyis 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
16.
Logical Equivalence
Twopropositions P and Q are logically equivalent
if P ↔ Q is a tautology.
We write: P ⇔ Q or P ≡ 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
17.
Proving Equivalence viaTruth 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
18.
Prove that p∨q⇔ ¬(¬p ∧ ¬q).
Proving Equivalence via Truth Tables
p q p
p∨
∨q
q ¬
¬p
p ¬
¬q
q ¬
¬p
p ∧
∧ ¬
¬q
q ¬
¬(
(¬
¬p
p ∧
∧ ¬
¬q
q)
)
F F
F T
T F
T T
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
Domination:p∨T ⇔ T p∧F ⇔ F
Idempotent: p∨p ⇔ p p∧p ⇔ p
Double negation: ¬¬p ⇔ p
Associative: (p∨q)∨ r ⇔ p∨(q∨r)
(p∧q)∧ r ⇔ p∧(q∧r)
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
20
Grouping
21.
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
22.
Defining Operators viaEquivalences
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
23.
Defining Operators viaEquivalences
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
24.
Equivalences with Conditionalsand
Biconditionals
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
27
Important for
removing
implication
25.
Converse, Inverse, Contrapositive
Someterminology, for an implication p → q:
Its converse is: q → p
Its inverse is: ¬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
Statement ≡ Contrapositive
•The Statement If x=2, then x2 =4 is true.
• Its Contrapositive If x2 ǂ4, then x ǂ2 so is true.
Converse ≡ inverse
• Its Converse If x2 =4, then x=2 is not true (x could be equal to -2).
• Its inverse If x ǂ2, then x2 ǂ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
29.
Ex.2
• Statement :If x is positive and x2 =4, then x=2.
• Contrapositive : If x ǂ2 , then x is not positive or x2 ǂ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
30.
Manipulating Propositions
Compoundpropositions 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
31.
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 → ¬p by logic algebra
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
35
p↔q ⇔ (p→q) ∧ (q→p)
p→q ⇔ ¬p ∨ q
32.
Example 2
Showthat (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
33.
Example 3
Show thatp↔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
Problem 1
Showthat ¬(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
36.
Problem 2
Showp ˅ (q ^ r) ≡ (p ˅ q) ^ (p ˅ r) using Truth Table
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
40
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)
41.
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
42.
Supplementary Material
KimberlyBrehm Channel
Discrete Math 1.2.1 - Translating Propositional Logic Statements
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
48