L2-Propositional Logic II PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 42

Math211

Discrete Mathematics

Propositional Logic II
SAHAR SELIM
2
Agenda

 Applications of Propositional Logic


 Translating English to logical expressions
 Propositional Equivalences

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


3

1.2 Applications of Propositional Logic

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


4
Translating English to logical
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


5
Example 1

“You can access the internet from campus only 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”
p  ( q v ┐r )

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


6
Example 2

Let p = “It is hot”, and q = “It is sunny”


 It is not hot. ¬p
 It is hot and sunny. p^q
 It is hot or sunny. p˅q
 It is not hot but sunny. ¬p^q
 It is neither hot nor sunny. ¬p^¬q

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


7
Example: 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.
 Example: Express the specification
“The automated reply cannot be sent when the file system is full”

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


8
Example: System specification

1. Let p denote “The automated reply can be sent”


2. Let q denote “The file system is full”
The logical expression for the sentence “The automated reply
cannot be sent when the file system is full” is

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


9
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


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


11

1.3 Propositional Equivalences

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


12
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


13
Proofs of Equivalence

 Show that A ↔ B and ¬(A ⊕ B) are equivalent

• 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


Sahar Selim MATH211 Lecture 2 | Propositional Logic II
14

Tautology and Contradiction

 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
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
15
Example

A ¬A A ˅ ¬A A ^ ¬A
T F T F
F T T F
Tautology Contradiction

Result is always Result is always


true, no matter false, no matter
what A is what A is
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
16
Logical Equivalence

 Two propositions 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


17
Proving Equivalence via Truth Tables

Ex. Prove that p∨q ⇔ ¬(¬p ∧ ¬q).

p q p∨q ¬p ¬q ¬p ∧ ¬q ¬(¬p ∧ ¬q)


F F F T T T F
F T T T F F T
T F T F T F T
T T T F F F T

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


18
Equivalence Laws

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


19
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
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


23
Equivalences with Conditionals and
Biconditionals

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


24
Biconditional operator

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

Try p↔q ⇔ ¬(p⊕q)


Sahar Selim MATH211 Lecture 2 | Propositional Logic II
25
Conditional/Implication operator

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


26
Converse, Inverse, Contrapositive

Some terminology, 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


27

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


28
Truth Table

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


30
Example

p→q q→p ¬p → ¬q ¬q → ¬p
statement converse inverse contrapositive
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.

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


31
Example

p→q q→p ¬p → ¬q ¬q → ¬p
statement converse inverse contrapositive
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
Sahar Selim MATH211 Lecture 2 | Propositional Logic II
32
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


33
Example 1

Show that p→q ⇔ ¬q → ¬p by logic algebra

p→q
¬p ∨ q removing implication
¬p ∨ ¬(¬q) ¬¬x=x
¬(¬ q) ∨ ¬p commutative law
(¬ q) → (¬p) Implication x→y ⇔ ¬x ∨ y

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


34
Example 2

 Show that (p ∧ q) → (p ∨ q) is a tautology.

De Morgan law
Associative and commutative
law for disjunction
Commutative law for disjunction

Domination law

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


35
Example 3 p↔q ⇔ (p→q) ∧ (q→p)
p→q ⇔ ¬p ∨ q

Show that p↔q ⇔ (p ^ q) ∨ (¬p ^ ¬q ) by logic algebra

p↔q = (p→q) ∧ (q→p)

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


36
Problems

 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


37
Long Example

 Check using a symbolic derivation whether p→q ⇔ ¬p ∨ q


(p ∧ ¬q) → (p ⊕ r) ⇔ ¬p ∨ q ∨ ¬r

(p ∧ ¬q) → (p ⊕ r) ⇔
p⊕q ⇔ (p∨q)∧¬(p∧q)
[Expand definition of →] ¬(p ∧ ¬q) ∨ (p ⊕ r) p⊕q ⇔ (p∧¬q)∨(q∧¬p)
[Defn. of ⊕] ⇔ ¬(p ∧ ¬q) ∨ ((p ∨ r) ∧ ¬(p ∧ r))
[DeMorgan’s Law]
¬(p∧q) ⇔ ¬p ∨ ¬q
⇔ (¬p ∨ q) ∨ ((p ∨ r) ∧ ¬(p ∧ r)) ¬(p∨q) ⇔ ¬p ∧ ¬q
⇔ [associative law] cont.

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


38
Long Example Continued...

(¬p ∨ q) ∨ ((p ∨ r) ∧ ¬(p ∧ r)) ⇔ [∨ commutes]


⇔ (q ∨ ¬p) ∨ ((p ∨ r) ∧ ¬(p ∧ r)) [∨ associative]
⇔ q ∨ (¬p ∨ ((p ∨ r) ∧ ¬(p ∧ r))) [distrib. ∨ over ∧]
⇔ q ∨ (((¬p ∨ (p ∨ r)) ∧ (¬p ∨ ¬(p ∧ r)))
⇔ q ∨ (((¬p ∨ p) ∨ r) ∧ (¬p ∨ ¬(p ∧ r))) [assoc.]
[trivial taut.] ⇔ q ∨ ((T ∨ r) ∧ (¬p ∨ ¬(p ∧ r)))
[domination] ⇔ q ∨ (T ∧ (¬p ∨ ¬(p ∧ r)))
[identity] ⇔ q ∨ (¬p ∨ ¬(p ∧ r)) ⇔ cont.

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


39
End of Long Example

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
40
Problems

 Show p ˅ (q ^ r) ≡ (p ˅ q) ^ (p ˅ r) using Truth Table

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


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


42
Equivalence Rules

Sahar Selim MATH211 Lecture 2 | Propositional Logic II


Sahar Selim MATH211 Lecture 2 | Propositional Logic II

You might also like