Propositional Logic
Rashidah Kasauli
Department of Networks
Block A, Level 3,Room 301
COCIS
Based on Rosen 1.1 - 1.3
Rashidah Kasauli BSE 1107 1 / 47
Overview
1 Propositions
2 Logical Connectives
3 Logical Equivalence
4 Deductive and Hypothetical Reasoning
Rashidah Kasauli BSE 1107 2 / 47
Propositions
Propositions
A proposition is a declarative sentence that can be either true or false
“Tom has an Apple laptop.”
“Tom is a professor.”
“4 = 2 + 2”
“4 = 2 + 1”
Not propositions:
“Are you John?”
“y = 8”
“I am thin.”
Rashidah Kasauli BSE 1107 3 / 47
Propositions
Propositions
Which of the following are propositions?
Your place or mine?
x + y = y + x for all x, y ∈ r
If the world is flat, then 2 + 2 = 4.
Go directly to jail.
x −y =y −x
Rashidah Kasauli BSE 1107 4 / 47
Propositions
Propositional variables
We use propositional variables to refer to propositions
Usually are lower case letters starting with p (i.e. p, q, r , s, etc.)
A propositional variable can have one of two values: true (T) or false
(F)
A proposition can be. . .
A single variable: p - atomic proposition
An operation of multiple variables: p ∧ (q ∨ ¬r ) - composite
proposition
Rashidah Kasauli BSE 1107 5 / 47
Logical Connectives
Introduction to logical operators
About a dozen logical operators
Similar to algebraic operators + ∗ −/
Consider the following propositions for example:
p = “Today is Friday”
q = “Today is my birthday”
Rashidah Kasauli BSE 1107 6 / 47
Logical Connectives
Logical operators - NOT
A “not” operation switches (negates) the truth value
Symbol: ¬ or ∼
¬p = “Today is not Friday”
Rashidah Kasauli BSE 1107 7 / 47
Logical Connectives
Logical operators - NOT
A “not” operation switches (negates) the truth value
Symbol: ¬ or ∼
¬p = “Today is not Friday”
p ¬p
T F
F T
Rashidah Kasauli BSE 1107 8 / 47
Logical Connectives
Logical Operators: AND
An “and” operation is true if both operands are true
Symbol: ∧
It’s like the ‘A’ in And
p ∧ q = “Today is Friday and today is my birthday”
Rashidah Kasauli BSE 1107 9 / 47
Logical Connectives
Logical Operators: AND
An “and” operation is true if both operands are true
Symbol: ∧
It’s like the ‘A’ in And
p ∧ q = “Today is Friday and today is my birthday”
p q p∧q
T T T
T F F
F T F
F F F
Rashidah Kasauli BSE 1107 10 / 47
Logical Connectives
Logical Operators: OR
An “or” operation is true if either operands are true
Symbol: ∨
p ∨ q = “Today is Friday or today is my birthday (or possibly both)”
Rashidah Kasauli BSE 1107 11 / 47
Logical Connectives
Logical Operators: OR
An “or” operation is true if either operands are true
Symbol: ∨
p ∨ q = “Today is Friday or today is my birthday (or possibly both)”
p q p∨q
T T T
T F T
F T T
F F F
Rashidah Kasauli BSE 1107 12 / 47
Logical Connectives
Exclusive Or (XOR)
Symbol: ⊕
p q p⊕q
T T F
T F T
F T T
F F F
Rashidah Kasauli BSE 1107 13 / 47
Logical Connectives
Logical Operators: Conditional
The conditional statement p → q is the proposition “if p then q”
Symbol: →
p is called the hypothesis and q the conclusion.
The conditional implication p → q means that the truth of p implies
the truth of q i.e if p is true, then q must be true.
Therefore this implication will only fail if p is true while q is false.
Rashidah Kasauli BSE 1107 14 / 47
Logical Connectives
Logical Operators: Conditional
p → q = “If today is Friday, then today is my birthday”
p q p→q
T T T
T F F
F T T
F F T
Rashidah Kasauli BSE 1107 15 / 47
Logical Connectives
Logical Operators: Conditional
Example
Let p = “I am elected” and q = “I will lower taxes”
p → q = “If I am elected, then I will lower taxes”
Consider all possibilities
Note that if p is false, then the conditional is true regardless of
whether q is true or false
Rashidah Kasauli BSE 1107 16 / 47
Logical Connectives
Conditional Implication
Different ways to express a conditional statement
“if p, then q”
“p implies q”
“if p, q”
“p only if q”
“p is sufficient for q”
“a sufficient condition for q is p”
“q if p”
“q whenever p”
“q when p”
“q is necessary for p”
“a necessary condition for p is q”
“q follows from p”
Rashidah Kasauli BSE 1107 17 / 47
Logical Connectives
Translating English Sentences
Example 1:
p = “It is below freezing”
q = “It is snowing”
1 It is below freezing and it is snowing p ∧ q
2 It is below freezing but not snowing p ∧ ¬q
3 It is not below freezing and it is not snowing ¬p ∧ ¬q
4 It is either snowing or below freezing (or both) p ∨ q
5 If it is below freezing, it is also snowing p ∧ ¬q
Rashidah Kasauli BSE 1107 18 / 47
Logical Connectives
Translating to English...
Example 2:
Let p,q,r be the following propositions:
P =“it is raining”,
q =“the sun is shining”,
r =“there are clouds in the sky.”
Translate the following into logical notation , using p,q,r and the logical
connectives.
It is raining and the sun is shining.
If it is raining then there are clouds in the sky.
If it is not raining, then the sun is not shining and there are clouds in
the sky.
If there are no clouds in the sky, then the sun is shining.
Rashidah Kasauli BSE 1107 19 / 47
Logical Connectives
Logical operators: Try out
1. Translate the following into English statements
a. (p ∧ q) → r
b. (p → r ) → q
c. ¬(p ∨ q) ∧ r
d. Give the truth values of the propositions for (a) and (b).
2. State which of the following are propositions and give the truth values
x2 = x ∀x ∈ r
x2 = x ∃x ∈ r
Rashidah Kasauli BSE 1107 20 / 47
Logical Connectives
Precedence of Operators
Just as in algebra, operators have precedence
4 + 3 ∗ 2 = 4 + (3 ∗ 2), not (4 + 3) ∗ 2
Precedence order (from highest to lowest):
¬ ∧ ∨ → ↔
The first three are the most important
This means that p ∨ q ∧ ¬r → s ↔ t yields:
(p ∨ (q ∧ (¬r )) → s) ↔ (t)
Not is always performed before any other operation
Rashidah Kasauli BSE 1107 21 / 47
Logical Connectives
Special results in a truth table
Tautological proposition (Tautology)
A tautology is a proposition that’s always TRUE.
Contradictory proposition (contradiction)
A contradiction is a proposition that’s always FALSE.
Logical equivalence of two propositions
Two statements are logically equivalent if they will be true in exactly
the same cases and false in exactly the same cases
Symbol ≡ and sometimes ⇔
Rashidah Kasauli BSE 1107 22 / 47
Logical Connectives
Tautologies and Contradictions
Examples
Tautology: p ∨ ¬p
¬(p ∧ q) ↔ (¬p) ∨ (¬q)
Contradiction: p ∧ ¬p
¬(¬(p ∧ q) ↔ (¬p) ∨ (¬q))
p ¬p p ∨ ¬p p ∧ ¬p
T F T F
F T T F
Rashidah Kasauli BSE 1107 23 / 47
Logical Connectives
Necessary AND Sufficient Condition
↔ ::= IFF
p q p↔q
T T T
T F F
F T F
F F T
Rashidah Kasauli BSE 1107 24 / 47
Logical Connectives
Necessary AND Sufficient Condition
↔ ::= IFF
p q p↔q
T T T
T F F
F T F
F F T
Note: P ↔ Q is equivalent to (P → Q) ∧ (Q → P)
Rashidah Kasauli BSE 1107 25 / 47
Logical Connectives
Necessary AND Sufficient Condition
↔ ::= IFF
p q p↔q
T T T
T F F
F T F
F F T
Note: P ↔ Q is equivalent to (P → Q) ∧ (Q → P)
Note: P ↔ Q is equivalent to (P → Q) ∧ (Q → P)
Rashidah Kasauli BSE 1107 26 / 47
Logical Connectives
Necessary AND Sufficient Condition
↔ ::= IFF
p q p↔q
T T T
T F F
F T F
F F T
Note: P ↔ Q is equivalent to (P → Q) ∧ (Q → P)
Note: P ↔ Q is equivalent to (P → Q) ∧ (Q → P)
Is the statement “x is an even number if and only if x 2 is an even
number” true?
Rashidah Kasauli BSE 1107 27 / 47
Logical Equivalence
Conditional statements: Converse , Contrapositive and
Inverse
For conditional statement p → q
Converse: q → p
Contrapositive: ¬q → ¬p
Inverse: ¬p → ¬q
Contrapositive and conditional statements are equivalent
Also, converse and inverse statements are equivalent
Rashidah Kasauli BSE 1107 28 / 47
Logical Equivalence
Contrapositive
The contrapositive of ”if p then q” is ”if ¬q. then ¬p”.
Statement: If you are a BSE year 1 student, then you are taking BSE 1107.
Contrapositive: If you are not taking MTH 3105, then you are not a BSE
year 2 student.
Statement: If x 2 is an even number, the x is an even number.
Contrapositive: If x is not an even number, then x 2 is not an even number.
A conditional statement is logically equivalent to its contrapositive.
Rashidah Kasauli BSE 1107 29 / 47
Logical Equivalence
Proofs
Statement: If P, then Q.
Contrapositive: If ¬Q, then ¬P.
P Q P→Q ¬Q ¬P ¬Q → ¬P
T T T F F T
T F F T F F
F T T F T T
F F T T T T
P → Q ≡ ¬P ∨ Q ≡ Q ∨ ¬P ≡ ¬Q → ¬P
Rashidah Kasauli BSE 1107 30 / 47
Logical Equivalence
Logical Equivalences
Double negation law:
¬(¬p) ≡ p
Commutative laws:
p ∨ q ≡ q ∨ p and p ∧ q ≡ q ∧ p
Associative laws:
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r ) and (p ∨ q) ∨ r ≡ p ∨ (q ∨ r )
Distributive laws:
p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r ) and p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )
Absorption laws:
p ∨ (p ∧ q) ≡ p and p ∧ (p ∨ q) ≡ p
Rashidah Kasauli BSE 1107 31 / 47
Logical Equivalence
Logical Equivalences....
Idempotent:
p ∧ p ≡ p and p ∨ p ∨ p
Identity:
p ∧ T ≡ p and p ∨ F ≡ p
Negation:
p ∨ ¬p ≡ T and p ∧ ¬p ≡ F
Universal bound:
p ∧ F ≡ F and p ∨ T ≡ T
Negations of T and F:
¬T ≡ F and ¬F ≡ T
Rashidah Kasauli BSE 1107 32 / 47
Logical Equivalence
DeMorgan’s Laws
¬(p ∨ q) ≡ ¬p ∧ ¬q
Example in English: It is not the case that Pete or Quincy went to
the store. ≡ Pete did not go to the store and Quincy did not go to
the store.
¬(p ∧ q) ≡ ¬p ∨ ¬q
Example in English: It is not the case that both Pete and Quincy
went to the store. ≡ Pete did not go to the store or Quincy did not
go to the store.
Rashidah Kasauli BSE 1107 33 / 47
Logical Equivalence
Proof by laws
Example
Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧ ¬q are logically equivalent by
developing a series of logical equivalences.
Rashidah Kasauli BSE 1107 34 / 47
Logical Equivalence
Proof by laws
Example
Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧ ¬q are logically equivalent by
developing a series of logical equivalences.
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q) by the second DeMorgan law
≡ ¬p ∧ [¬(¬p) ∨ ¬q] by the first DeMorgan law
≡ ¬p ∧ (p ∨ ¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q) by the second distributive law
≡ F ∨ (¬p ∧ ¬q) because ¬p ∧ p ≡ F
≡ (¬p ∧ ¬q) ∨ F by the commutative law for disjunction
≡ ¬p ∧ ¬q by the identity law for F
Rashidah Kasauli BSE 1107 35 / 47
Logical Equivalence
If then as Or
P → Q ≡?
Idea 1: Look at the truth rows and take the ”and”
(P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q)
p q p→q ≡ (P ∧ Q) ∨ [¬P ∧ (Q ∨ ¬Q)]
T T T ≡ (P ∧ Q) ∨ [¬P ∧ T ]
T F F ≡ (P ∧ Q) ∨ ¬P
F T T
≡ (P ∨ ¬P) ∧ (Q ∨ ¬P)
F F T
≡ T ∧ (Q ∨ ¬P)
≡ Q ∨ ¬P
Rashidah Kasauli BSE 1107 36 / 47
Logical Equivalence
If then as Or
P → Q ≡?
Idea 2: Look at the false rows, take the ”and” and negate
¬(P ∧ ¬Q)
p q p→q ≡ ¬P ∨ Q
T T T
If you don’t give me all your
T F F money, then I will kill you.
F T T
Either you give me all your
F F T
money or I will kill you (or
both).
Rashidah Kasauli BSE 1107 37 / 47
Logical Equivalence
Negation of If-Then
¬(p → q) ≡?
¬(p → q) ≡ ¬(¬P ∨ Q)
≡ P ∧ ¬Q)
If my computer is not working, then I cannot finish my homework.
My computer is not working but I can finish my homework.
If your GPA is 4.0, then you don’t need to pay tuition fee.
Your term GPA is 4.0 and you still need to pay tuition fee.
Rashidah Kasauli BSE 1107 38 / 47
Logical Equivalence
Maths Vs English
Parent = If you don’t clean your room, then you can’t watch the DVD.
Let C = clean your room, D = watch a DVD
This sentence says ¬C → ¬D
In real life it also means C → D
So C ↔ D
Mathematician: if a number x greater than 2 is not an odd number, then
x is not a prime number.
This sentence says ¬O → ¬P
But ofcourse it doesnot mean O → P
Rashidah Kasauli BSE 1107 39 / 47
Deductive and Hypothetical Reasoning
Arguments
An argument is a sequence of statements.
All statements but the final one are called assumptions or hypothesis
or premises.
The final statement is called the conclusion.
An argument is valid if:
whenever all the assumptions are true, the conclusion is also true
Rashidah Kasauli BSE 1107 40 / 47
Deductive and Hypothetical Reasoning
Valid Argument?
(P → Q), (Q → R), (R → P)
Is it valid?
P ∧Q ∧R
P Q R P→Q Q→R R→P P ∧Q ∧R OK?
T T T T T T T yes
T T F T F T F yes
T F T F T T F yes
T F F F T T F yes
F T T T T F F yes
F T F T F T F yes
F F T T T F F yes
F F F T T T F no
To prove an argument is not valid, we just need to find a counterexample.
Rashidah Kasauli BSE 1107 41 / 47
Deductive and Hypothetical Reasoning
Modus Ponens
If p then q If rain, then class cancelled.
p Rain.
∴ q ∴ Class cancelled.
p q p→q p q
T T T T T
T F F T F
F T T F T
F F T F F
Assumptions
Modus Ponens is latin meaning method of affirming.
Rashidah Kasauli BSE 1107 42 / 47
Deductive and Hypothetical Reasoning
Modus Tollens
If p then q If rain, then class cancelled.
¬q Class not cancelled.
∴ ¬p ∴ No rain.
p q p→q ¬q ¬p
T T T F F
T F F T F
F T T F T
F F T T T
Assumptions
Modus Tollens is latin meaning method of denying.
Rashidah Kasauli BSE 1107 43 / 47
Deductive and Hypothetical Reasoning
Rules of inference
Rule of inference Tautology Name
p
p→q
(p ∧ (p → q)) → q Modus ponens
∴q
¬q
p→q
(¬q ∧ (p → q)) → ¬p Modus tollens
∴ ¬p
p→q
q→r
((p → q) ∧ (q → r )) → (p → r ) Hypothetical syllogism
∴p→r
p∨q
¬p
((p ∨ q) ∧ ¬p) → q Disjunctive syllogism
∴q
Rashidah Kasauli BSE 1107 44 / 47
Deductive and Hypothetical Reasoning
Rules of inference....
p
p → (p ∨ q) Addition
∴p∨q
p∧q
(p ∧ q) → p Simplification
∴p
p
q
((p) ∧ (q)) → (p ∧ q) Conjunction
∴p∧q
p∨q
¬p ∨ r
((p ∨ q) ∧ (¬p ∨ r )) → (q ∨ r ) Resolution
∴q∨r
Rashidah Kasauli BSE 1107 45 / 47
Deductive and Hypothetical Reasoning
Exercise
1 For these collections of premises, what relevant conclusion or
conclusions can be drawn? Explain the rules of inference used to
obtain each conclusion from the premises.
“If I take the day off, it either rains or snows.”
“I took Tuesday off or I took Thursday off.”
“It was sunny on Tuesday.”
“It did not snow on Thursday.”
2 Show that the premises
“It is not sunny this afternoon and it is colder than yesterday,”
“We will go swimming only if it is sunny,”
“If we do not go swimming, then we will take a canoe trip,”
“If we take a canoe trip, then we will be home by sunset”
lead to the conclusion
“We will be home by sunset.”
Rashidah Kasauli BSE 1107 46 / 47
Deductive and Hypothetical Reasoning
The End
Rashidah Kasauli BSE 1107 47 / 47