You are on page 1of 45

Chapter 2

Propositional Logic
Dr. Abdelaziz Said

1
Chapter 2

Propositional Logic
Dr. Abdelaziz Said

2
Contents

1 PL

2 Logical Properties and Relationships

3 PL’

4 PL’’

3
Propositional logic (PL)

➢Proposition is a declarative sentence that is either true or


false
➢The following are propositional statements:
•It is raining
•5 is a prime number
•2+2 = 5

➢The following are not propositional statements:


•Are you hungry?
•Shut the door!
•X>8

4
Propositional logic (PL)

➢PL is a logical model which is designed to represent


propositional sentences as well as the logical relationships
of combining or altering sentences.
➢PL also known as sentential logic

PL

Syntax Semantic

5
Propositional logic (PL)

➢ Logical operator: is any word or phrase used to either to


modify one statement or join multiple statements to form
more complicated one.
Ex: Words such as 'and', 'or', 'not', 'if … then ….' In English.

➢ Truth-functional logical operator: logical operator is said


to be truth-functional if the truth-values of the statements
that used the operator depend on the truth or falsity of the
statements from which they are constructed.

6
Propositional logic (PL)

➢ Truth-functional propositional logic: is that branch of


propositional logic limited to study Truth-functional logical
operator.

➢ Classical Truth-functional propositional logic: is the


branch of Truth-functional propositional logic in which every
statement is either true or false not both.

7
PL Syntax

Simple Statement Letter

Sentence
Simple
Compound
Connectives

❖ Statement letter
▪ A statement letter is any lower case letter written with
or without a numerical subscript
▪ According to this definition: ‘p', ‘q', ‘p2', ‘p_2', and
‘p14' are examples of statement letters

8
PL Syntax

❖ connective
▪ A connective or operator of PL is any of the signs:
Symbol Purpose
'¬' not
'&'
'v'
and
or
5 SIGNS
'→' Implication (If then)
'↔' Equivalence (If and only if)

❖ Note
▪ Some textbooks use:
‘~ ‘ instead of '¬‘
‘^’ instead of ‘&’
9
PL Syntax

❖ PL syntax rules:
1. Any statement letter is a well-formed formula.
2. If α is a well-formed formula, then so is (α).
3. If α is a well-formed formula, then so is ¬α.
4. If α and β are well-formed formulas, then:
α&β
αvβ
α→β
α↔β
are well formed formulas.
5. Nothing that cannot be constructed by successive steps
of (1)-(4) is a well-formed formula
10
PL Syntax

Check the syntax for the sentence: ¬p ∧ (q → s) using PL


syntax rules.

1. The statement letters p, q, s are wffs (by rule 1)


2. Since p is a wff, then ¬p is a wff (by rule 3)
3. Since q and s are wffs, then q → s is a wff (by rule 4)
4. Since q → s are wffs, then (q → s) is a wff (by rule 2)
5. Since ¬p is a wff and (q → s) is a wff, then ¬p ∧ (q → s) is a
wff (by rule 4)

11
PL Syntax

Check the syntax for the following sentences

Sentence PL_Check

p &¬p wff
pqr not wff
¬p ∨ not wff
¬p ∨ ¬p wff
¬(q ∨ r) ¬q → ¬¬p not Wff
(p & q) ∨ (p ¬& q) not Wff

12
PL Syntax

Formalize the following sentences into PL:

➢ If a person is cool or funny, then he is popular


c∨f →p

➢ person is popular if and only if he is either cool or funny.


p↔c∨f

➢ There is no one who is both cool and funny

¬(c & f)

13
PL Semantic

❖ Conjunction:
▪ The conjunction of two statements α and β, written in
PL as (α & β), is true if both α and β are true, and is
false otherwise.

α β (α & β)
T T T
T F F
F T F
F F F

14
PL Semantic

❖ Disjunction :
▪ The disjunction of two statements α and β, written in PL
as (α v β), is false if both α and β are false and is true
otherwise.

α β (α v β)
T T T
T F T
F T T
F F F

15
PL Semantic

❖ Implication :
▪ This truth-function is represented in language PL with
the sign '→'. A statement of the form (α → β), is false if
α is true and β is false, and is true otherwise.

16
PL Semantic

❖ Equivalence :
▪ This truth-function is represented in language PL with the
sign '↔'. A statement of the form (α ↔ β) is regarded as
true if α and β are either both true or both false, and is
regarded as false if they have different truth-values.

α β (α ↔ β)
T T T
T F F
F T F
F F T

17
PL Semantic

❖ Negation :
▪ The negation of statement α, simply written ¬α in
language PL, is regarded as true if α is false, and false
if α is true.

α ¬α
T F
F T

18
PL Semantic

Apply PL precedence's rules for the following sentences

Sentence Precedence

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

19
PL Semantic

Evaluation : the process of determining the truth


values of compound sentences given a truth assignment
for the truth values of proposition constants.

Compute the truth-value for the sentence:


(p ∨ q) ∧ (¬q ∨ r) where p, q and r are T, F, and T
respectively.
(p ∨ q) ∧ (¬ q ∨ r)
(T ∨ F) ∧ (¬ F ∨ T)
T ∧ (¬ F ∨ T)
T ∧ (T ∨ T)
T∧T
T
20
PL Semantic

Satisfaction : Satisfaction is the opposite of evaluation,


we begin with one or more compound sentences and try
to figure out which truth assignments satisfy those
sentences.
Compute the truth-value for the sentence:
(p & q) → ¬r

21
PL Semantic

Compute the truth-value for the sentence:


(p & q) → ¬r
• Truth assignment is the possible
assignment of truth-values T or F to P q r
different statement letters making up a wff T T T
or series of wffs. T T F
T F T
• If a wff has n distinct statement letters the T F F
number of possible assignments is 2n. F T T
F T F
• (p & q) → ¬r has 3 statement letters, ‘p', F F T
‘q' and ‘r', and so there are 8 truth-value F F F
assignments.

22
PL Semantic

(p & q) → ¬r

p q r | p&q ¬r (p & q) → ¬r
T T T T F F
T T F T T T
T F T F F T
T F F F T T
F T T F F T
F T F F T T
F F T F F T
F F F F T T

23
PL Semantic

❖ How to represent Exclusive or in PL ?


❖ PL has no simple sign for 'or' in exclusive sense.
❖ (α ↔ β) could be used to represent exclusive or
logical relation by :

α β α↔β ¬(α↔β)
T T T F
T F F T
F T F T
F F T F

24
Example

❖ Write the following statement symbolically, and then make


a truth table for the statement “If I go to the mall or go to
the movies, then I will not go to the gym.”
Let
p: I go to the mall
q : I go to the movies (p ∨ q) → ¬r
r : I will go to the gym

25
PL Semantic

Use truth table method to proof the following


argument:
Pvq
¬p
q
p q | pvq ¬p (pvq)&¬p ((pvq)&¬p )→q
T T T F F T
T F T F F T
F T T T T T
F F F T F T

26
Truth table method drawbacks

❖ Computational complexity
❖ Over the years, researchers have proposed ways to
improve the performance of truth table checking.
However, the best approach to dealing with large
vocabularies is to use symbolic manipulation (i.e.
logical reasoning and proofs) in place of truth table
checking.

27
Logical Properties and Relationships

1) Tautology (Valid)
A wff is a tautology if and only if it is true for all
possible assignments to the statement letters
making it up.
EX: p¬p

p ¬p p¬p
T F T
F T T

28
Logical Properties and Relationships

2)Self-contradiction (unsatisfiable)
a wff is a self-contradiction if and only if it is false
for all possible truth-value assignments to the
statement letters making it up.
EX: p&¬p

p ¬p p&¬p
T F F
F T F

29
Logical Properties and Relationships

3) Contingent
• a wff is that is neither self-contradictory nor
tautological is called a contingent WFF.
• A contingent statement is true for some
assignments to its statement letters and false for
others.

EX_1 : p & q
EX_2 : (p & q) → ¬r

30
Logical Properties and Relationships

4) Consistent
Two wffs are consistent if and only if there is at least
one possible assignment to the statement letters
making them up that makes both wffs true.
EX: pq and ¬(p ↔ ¬q)

p q pq ¬q p↔¬q ¬(p ↔ ¬q)


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

31
Logical Properties and Relationships

5) Inconsistent
two wffs are inconsistent if and only if there is no
assignment to the statement letters making them up
that makes them both true.
EX: (p→q)&p and ¬(q ¬p)

p q p→q (p→q)&p
p→q ¬p q¬p ¬(q ¬p)
T T T T F T F
T F F F F F T
F T T F T T F
F F T F T T F

32
Logical Properties and Relationships

6) Logically equivalent
two wffs are logically equivalent if and only if all
possible assignments to the statement letters
making them up make them identical
EX: p → q and ¬pq

p q p→q
p→q ¬p (¬pq)
T T T F T
T F F F F
F T T T T
F F T T T

33
PL’
It is possible to define all operators of PL using the signs
'¬' and '→'
❖AND
▪ The form ¬(α → ¬β) always has the same truth-value as
the corresponding statement of the form (α & β)
(α & β) ≡ ¬(α → ¬β)
α β | α & β ¬β α→¬β ¬(α → ¬β)
T T T F F T
T F F T T F
F T F F T F
F F F T T F

34
PL’

❖OR
▪ The form ¬α → β always has the same truth-value as
the corresponding statement of the form (α v β)
(α v β) ≡ ¬α → β

α β | αvβ ¬α ¬α → β
T T T F T
T F T F T
F T T T T
F F F T F

35
PL’

❖ EQUIVALENT
▪ The form ¬((α → β) → ¬(β → α)) always has the same
truth-value as the corresponding statement of the form
(α↔β)
(α↔β) ≡ ¬((α → β) → ¬(β → α))

α β | α↔β α→β β→α ¬(β→α) (α→β)→¬(β→α) ¬((α → β) → ¬(β → α))


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

36
Other forms of PL’

❖ It is possible to define all operators of PL using


the signs '¬' and 'v'
▪ (α & β) would be defined as ¬(¬α v ¬β),
▪ (α → β) would be defined as ¬α v β,
▪ (α ↔ β) would be defined as ¬(¬(¬α v β) v ¬(¬β v α)).

❖ Similarly, we could use signs '¬' and '&'


▪ (α v β) would be defined as ¬(¬α & ¬β),
▪ (α → β) would be defined as ¬(α & ¬β),
▪ (α ↔ β) would be defined as ¬(α & ¬β) & ¬(β & ¬α).

37
PL’’

❖ Reducing all logical operators down to a single


primitive operator.
❖ The sign '|' is called the “Sheffer stroke”, and is
equivalent to NAND.

α β (α | β)
T T F
T F T
F T T
F F T

38
PL’’

❖ It is possible to define all operators of PL using


the signs '|‘

▪ (¬α) would be defined as (α | α)


▪ (α & β) would be defined as (α | β) | (α | β)
▪ (α v β) would be defined as (α | α) | (β | β)
▪ (α → β) would be defined as α | (β | β)
▪ (α ↔ β) would be defined as ((α | α) | (β | β)) | (α | β)

39
Other forms of PL’’

❖ The sign '↓' is called the “Sheffer dagger”, and is


equivalent to NOR.

α β (α ↓ β)
T T F
T F F
F T F
F F T

40
PL’’

❖ It is possible to define all operators of PL using


the signs ' ↓ ‘

▪ (¬α) would be defined as (α ↓ α)


▪ (α & β) would be defined as (α ↓ α) ↓ (β ↓ β)
▪ (α v β) would be defined as (α ↓ β) ↓ (α ↓ β)
▪ (α → β) would be defined as ((α ↓ α) ↓ β) ↓((α ↓ α) ↓ β)

41
PL’’

➢ The advantages of PL: Conforms better with our ordinary


reasoning and thinking habits.
➢ The advantages of PL' and PL": Simplifies the logical
language which makes the work of the deductive systems
easier.

42
PL, PL’, PL’’

PL '¬', '&','v', '→', and '↔'.

'¬', and '→‘


PL’ '¬' and ‘&‘
'¬' and 'v‘

PL’’ ‘|’
‘↓’
43
Assignment

1)Write a computer program which check the syntax


structure for PL sentences.
[you are free to use any programming language...]

2)Use Truth table method to prove the validity for


logical sentence in pages (36, 37,39).
[you can choose only 3 sentences…]

44
Chapter 2

45

You might also like