1 Formal Logic
1 Formal Logic
Discrete Structures
Discrete Structures
L1
First Semester
Propositional Logic
• Propositional logic is the study of propositions
(true or false statements) and
Propositional Logic
In this algebra,
❑ the variables stand for unknown propositions
(instead of unknown real numbers) and
❑ the operators are and, or, not, implies, and if
and only if (rather than plus, minus, negative,
times, and divided by).
❑Just as middle/high school students learn the
notation of algebra and how to manipulate it
properly, we want to learn the notation of
propositional logic and how to manipulate it
properly.
4
Discrete Structures
Propositional Logic
A proposition is a declarative statement that’s either true
(T) or false (F), but not both
Propositions
▪ Every cow has 4 legs
▪ Riyadh is the capital of Saudi Arabia
▪ 1+1=2
▪ 2+2=3
Not Propositions
▪ What time is it?
▪ X+1=2
▪ Answer this question
5
Discrete Structures
Propositional Logic
New propositions, called compound propositions are
formed from existing propositions using logical
Operators
6
Discrete Structures
Propositional Logic
negation
Suppose p is a proposition
The negation of p is written as p and
has meaning:
“It is not the case that p.”
The proposition p is read “not P”
Propositional Logic
negation
“ today is Friday”
“ it is not the case that today is Friday” or
“today is not Friday”
“it is not Friday today”
8
Discrete Structures
Propositional Logic
conjunction
Suppose p and q are propositions
The conjunction of p and q is written as pq
Propositional Logic
conjunction
p is the proposition “Today is Friday”
q is the proposition “It is raining today”
This proposition
Is true on rainy Fridays
Is false on any day that is not a Friday
on Fridays when it does not rain
10
Discrete Structures
Propositional Logic
disjunction
▪ Inclusive Or
Suppose p and q are propositions
The disjunction of p and q is written as pq
Propositional Logic
disjunction
p is the proposition “Today is Friday”
q is the proposition “It is raining today”
This proposition
Is true on any day that is either a Friday
or a rainy day(including rainy Fridays)
Is false on days that are not Fridays when
it also does not rain
12
Discrete Structures
Propositional Logic
disjunction
▪ Exclusive Or
Suppose p and q are propositions
The Exclusive Or of p and q is written as pq
Propositional Logic
implication
Suppose p and q are propositions
The conditional statement (implication) p→q
The proposition p→q is read “ if p, then q”
P hypothesis – antecedent – premise
q conclusion -consequence
p q p→q
Truth table for the F F T
Implication F T T
p→q T F F
T T T
14
Discrete Structures
Propositional Logic
implication
Terminology used to express p→q
“if p, then q”
“p is sufficient for q”
“q if p” “q when p”
“a necessary condition for p is q”
“q unless p“
“p implies q”
“p only if q”
“a sufficient condition for q is p”
“q whenever p”
“q is necessary for p”
“q follows from p”
“if p, q”
15
Discrete Structures
Propositional Logic
implication
p is the proposition “Ahmed learns discrete structures”
q is the proposition “Ahmed will find a good job”
The p→q is proposition
“ if Ahmed learns discrete mathematics, then he will find a
good job”
This proposition
Is false when p is true and q is false
Otherwise it is true
16
Discrete Structures
Propositional Logic
implication
p is the proposition “today is Friday”
q is the proposition “2+3=5”
The p→q is proposition
“ if today is Friday, then 2+3=5”
Propositional Logic
implication
The conditional statement (implication) p→q
“if it is raining, then the home team wins”
Propositional Logic
bi-implication
Suppose p and q are propositions
The biconditional statement (bi-implication) pq
The proposition p q is read “ p if and only if q”
p q is true if both p→q q→p are true
p→q pq -------→ pq
p q pq
Truth table for the F F T
bi-implication F T F
pq T F F
(p q ) ( p q ) T T T
19
Discrete Structures
Propositional Logic
bi-implication
The proposition p q has the same truth value as p→q
q→p
Propositional Logic
bi-implication
The p q is proposition
“You can take the flight if and only if You buy a ticket”
This proposition
Is true if p and q are either both true or both false”
21
Discrete Structures
Exercise
1- Find the negation of the proposition
“Michael’s PC runs Linux”
and express this in simple English.
4- Prove that the proposition p q has the same truth value as p→q q→p
22
Discrete Structures
Propositional Logic
Truth table of compound propositions
▪ Precedence of logical operators
→
Construct the Truth table of compound propositions
(p q) → (p q)
23
Discrete Structures
Propositional Logic
▪ Translating English sentence into a logical
expression
“You can access the internet from campus only if
you are a computer science major or you are not a
freshman”
a: “You can access the internet from campus”
b: “you are a computer science major”
c: “you are a freshman”
Where a,b,c are propositional variables
a → (b c)
24
Discrete Structures
Propositional Equivalences
Logical equivalences
compound propositions that have the same
truth values in all possible cases are called
Logically equivalent
Compound propositions p and q are Logically
equivalent if pq is a tautology.
logical equivalence
Note and are not logical
operators(connectives). Rather they indicate
a kind of logical equality.
25
Discrete Structures
p p p p p p
T F T F
F T T F
9/29/2021
26
Discrete Structures
p q p→q p q p q p
T T T T T F T
T F F T F F F
F T T F T T T
F F T F F T T
9/29/2021
27
Discrete Structures
pq
(pq) p q
p: “Ahmed has not a mobile”
q: “Ahmed has not a laptop”
“Ahmed has not a mobile or he has not a laptop”
30
Discrete Structures
(p q) q p q
p (q q) Associativity
p q Idempotent
9/29/2021
31
Discrete Structures
[p (p → q)] → q
[p (p q)] → q substitution for →
[(p p) (p q)] → q distributive
[ F (p q)] → q uniqueness
(p q ) → q identity
(p q) q substitution for →
(p q) q DeMorgan’s
p (q q ) associative
p T excluded middle
T domination
9/29/2021
32
Discrete Structures
Exercise