SlideShare a Scribd company logo
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prepared by: Sharif Omar Salem – ssalemg@gmail.com
0
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prepositional logic is a formal system of representing
knowledge
Prepositional logic has:
 Syntax – what the allowable expressions are. Structure of the
sentence.
 Semantics – what the expressions mean. Meaning
 Proof theory – how conclusions are drawn from a set of
statements. Reasoning.
1
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Symbols represent facts
 E.g. “Penguins need a cold environment” is a fact
 That could be represented by the symbol P
 Each fact is called an atomic formulas or atoms
 Atomic propositions can be combined using logical connectives –
 Order of precedence: ¬ ∧ ∨ → ↔
2
Preparedby:SharifOmarSalem–ssalemg@gmail.com
These symbols P, Q,………. etc
used to represent propositions, are called
atomic formulas, or simply atoms.
To express more complex propositions such as the
following compound proposition, we use logical
connectives such as → (if-then or imply):
 “if car brake pedal is pressed, then car stops within five
seconds.”
This compound proposition is expressed in propositional
logic as:
 P → Q
3
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 We can combine propositions and logical connectives to form
complicated formulas.
 Well-Formed Formulas: Well-formed formulas in propositional logic
are defined recursively as follows:
 1. An atom is a formula.
 2. If F is a formula, then (¬F) is a formula, where ¬ is the not operator.
 3. If F and G are formulas, then (F ∧ G), (F ∨ G), (F → G),and (F ↔G) are
formulas. (∧ is the and operator, ∨ is the or operator , ↔ stands for if and
only if or iff.)
 4. All formulas are generated using the above rules.
4
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Logic is made up sentences
 P might be a sentence
 P ∧ Q is also a sentence
 If we know the truth values of P and Q, we can work out the truth
value of the sentence.
 If P and Q are both true then P ∧ Q is true, otherwise it is false
 Can use truth tables to ascertain the truth of a sentence
5
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 An interpretation of a propositional formula G is an assignment of
truth values to the atoms A1,... , An in G in which every Ai is
assigned either T or F, but not both.
 The Figure shows the truth table for several simple formulas.
6
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 A literal is an atomic formula or the negation of an atomic formula.
 A clause is a wff express a fact (premises or conclusion).
 A clause set is a group of clause express an argument.
 A formula is in conjunctive normal form (CNF) if it is a conjunction
of disjunction of literals.
 A formula is in disjunctive normal form (DNF) if it is a disjunction of
conjunction of literals.
7
Preparedby:SharifOmarSalem–ssalemg@gmail.com
P - represents the fact “Penguins eat fish”
Q - represents the fact “Penguins like fish”
 P ∧ Q – Penguins eat fish and penguins like fish
 P ∨ Q – Penguins eat fish or penguins like fish
 ¬ Q – Penguins do not like fish
 P → Q
 Penguins eat fish therefore penguins like fish.
 If penguins eat fish then penguins like fish.
 P ↔ Q
 Penguins eat fish therefore penguins like fish
and penguins like fish therefore penguins eat fish.
8
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 If the train arrives late and there is no taxi at the station, then john is
late for this meeting. John is not late for his meeting. The train did
arrive late. Therefore, there were taxis at the station.
9
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 If the train arrives late and there is no taxi at the station, then john is
late for this meeting. John is not late for his meeting. The train did
arrive late. Therefore, there were taxis at the station.
10
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 If the train arrives late and there is no taxi at the station, then john is
late for this meeting. John is not late for his meeting. The train did
arrive late. Therefore, there were taxis at the station.
11
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 If the train arrives late and there is no taxi at the station, then john is
late for this meeting. John is not late for his meeting. The train did
arrive late. Therefore, there were taxis at the station.
12
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Definition of Argument:
 An argument is a sequence of statements in which the conjunctionof
theinitialstatements(calledthepremises/hypotheses) is said to imply the
final statement (called the conclusion).
 An argument can be presented symbolically as
(P1 Λ P2 Λ ... Λ Pn)  Q
where P1, P2, ..., Pn represent the hypotheses and Q represents the
conclusion.
 Deriving a logical conclusion by combining many propositions and
using formal logic: hence, determiningthetruthofarguments.
 This formula representing the whole argument as hypothesis and
conclusion is known as NATURAL DEDUCTION
13
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 What is a valid argument?
 An argument is valid if Q (conclusion) logically follow from P1, P2, ...,
Pn (hypotheses)
 Informal answer: Whenever the truth of hypotheses leads to the
conclusion
 A formula is valid iff it is true under all its interpretations. (Called
Tautology)
 A formula is invalid iff it is not valid.
 A valid argument is intrinsically true, i.e.
(P1 Λ P2 Λ ... Λ Pn)  Q is a tautology.
 Note: We need to focus on the relationship of the conclusion to the
hypotheses and not just any knowledge we might have about the
conclusion Q.
14
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Example:
 P1: Neil Armstrong was the first human to step on the moon.
 P2 : Mars is a red planet
And the conclusion
 Q: No human has ever been to Mars.
 This wff P1 Λ P2  Q is not a tautology ( Not True)
 Truth of Hypothesis doesn’t lead to the conclusion. Mean the
argument is not valid.
15
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Example:
 P1: Tokyo is located in Japan.
 P2 : Japan is not located in Europe.
And the conclusion
 Q: Tokyo is not located in Europe
 This wff P1 Λ P2  Q is a tautology ( Always True)
Truth of Hypothesis leads to the conclusion. Mean the argument
is valid.
16
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Russia was a superior power, and either France was not
strong or Napoleon made an error. Napoleon did not make
an error, but if the army did not fail, then France was strong.
Hence the army failed and Russia was a superior power.
 Converting it to a propositional form using letters A, B, C and D
A: Russia was a superior power
B: France was strong B: France was not strong
C: Napoleon made an error C: Napoleon did not make an
error
D: The army failed D: The army did not fail
17
Preparedby:SharifOmarSalem–ssalemg@gmail.com
A: Russia was a superior power
B: France was strong B: France was not strong
C: Napoleon made an error C: Napoleon did not make an error
D: The army failed D: The army did not fail
 Combining, the statements using logic
(A Λ (B V C)) hypothesis
C hypothesis
(D  B) hypothesis
(D Λ A) conclusion
 Combining them, the propositional form is
(A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)
18
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Example:
Real Madrid is a superior power team, and either FC Barcelona is not
strong or Juardiola make an error. Juardiola does not make an error, but
if FC Barcelona wins the game, then FC Barcelona is strong. Hence FC
Barcelona loses the game and Real Madrid is a superior power team.
 Converting atomic prepositions to propositional symbols
Converting it to a propositional form using letters W, X, Y and Z
W: Real Madrid is a superior power team.
X: FC Barcelona is strong X: FC Barcelona is not strong
Y: Juardiola make an error Y: Juardiola do not make an error
Z: FC Barcelona loses the game Z: FC Barcelona wins the game
19
Preparedby:SharifOmarSalem–ssalemg@gmail.com
W: Real Madrid is a superior power team.
X: FC Barcelona is strong X: FC Barcelona is not strong
Y: Juardiola make an error Y: Juardiola do not make an error
Z: FC Barcelona loses the game Z: FC Barcelona wins the game
 Convert verbal argument to propositional logic (hypothesis, conclusion
and form)
(W Λ (X V Y)) hypothesis
Y hypothesis
(Z  X) hypothesis
(Z Λ W) conclusion
Argument form is
(W Λ (X V Y)) Λ Y Λ (Z  X)  (Z Λ W)
20
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Example:
 If the program is efficient, it executes quickly. Either the program is
efficient, or it has a bug. However, the program does not execute
quickly. Therefore it has a bug.
 Converting Key statements to propositional symbols
E: The program is efficient.
Q: The program executes quickly Q: The program does not
execute quickly
B: The program has a bug
21
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Convert verbal argument to propositional logic (hypothesis,
conclusion and form)
E  Q hypothesis
E ˅ B hypothesis
Q’ hypothesis
B conclusion
Argument form is
(E  Q) ˄ (E ˅ B) ˄ Q’  B
22
Preparedby:SharifOmarSalem–ssalemg@gmail.com
If the room temperature is hot, then the air conditioner is on. If
the room temperature is cold, then the heater is on. If the
room temperature is neither hot nor cold, then the room
temperature is comfortable. Therefore, If neither the air
conditioner nor the heater is on, then the room temperature
is comfortable.
Translate the argument using propositional Logic.
23
Preparedby:SharifOmarSalem–ssalemg@gmail.com
How to prove Validity of an argument?
 Truth Table proof
 Equivalency Laws deduction proof
 Resolution Theorem proof
24
Preparedby:SharifOmarSalem–ssalemg@gmail.com
If the room temperature is hot, then the air conditioner is on. If the room
temperature is cold, then the heater is on. If the room temperature is
neither hot nor cold, then the room temperature is comfortable. Therefore,
If neither the air conditioner nor the heater is on, then the room
temperature is comfortable.
 Converting Key statements to propositional symbols
 H = the room temperature is hot
 C = the room temperature is cold
 M = the room temperature is comfortable
 A = the air conditioner is on
 G = the heater is on.
 Convert propositional logic (hypothesis/conclusion/form)
 Hypothesis1: F1= H  A
 Hypothesis2: F2= C  G
 Hypothesis3: F3= ¬(H ˅ C)  M
 Conclusion: F4= ¬(A ˅ G)  M
Truth Table proof
25
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Argument Formula:
 F1 ˄ F2 ˄ F3  F4
 (H  A) ˄ (C  G) ˄ [¬(H ˅ C)  M]  [¬(A ˅ G)  M]
Truth Table proof
26
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 To prove this proposition with the truth-table technique. You have to
exhaustively checks every interpretation of the formula F4 to
determine if it evaluates to T. The truth table shows that every
interpretation of F4 evaluates to T, thus F4 is valid.
27
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Definition of Proof Sequence:
 It is a sequence of wffs in which each wff is either a hypothesis or
the result of applying one of the formal system’s derivation rules to
earlier wffs in the sequence.
 Derivation rules for propositional logic are
 Equivalence Rules.
 Inference Rules.
 Deduction Method.
Equivalency Laws-
Deduction proof
28
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Tautological proposition
 a tautology is a statement that can never be false
 all of the lines of the truth table have the result "true"
 Contradictory proposition
 a contradiction is a statement that can never be true
 all of the lines of the truth table have the result "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
 all of the lines of one column of the truth table have all of the same
truth values as the corresponding lines from another column of the
truth table
 it's indicated using  or ↔
29
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 These rules state that certain pairs of wffs are equivalent, hence one
can be substituted for the other with no change to truth values.
 The set of equivalence rules are summarized here:
30
Expression Equivalent to Abbreviation for rule
R V S
R Λ S
S V R
S Λ R
Commutative (comm)
(R V S) V Q
(R Λ S) Λ Q
R Λ (S Λ Q)
R V (S V Q)
Associative (ass)
(R V S)
(R Λ S)
R Λ S
R V S
De-Morgan’s Laws
(De-Morgan)
R  S R V S implication (imp)
R (R) Double Negation (dn)
PQ (P  Q) Λ (Q  P) Equivalence (equ)
Q  P P  Q Contraposition- cont
P PΛ P Self-reference - self
P V P P Self-reference - self
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Example for using Equivalence rule in a proof sequence:
 Simplify (A V B) V C to an argument.
The result must be an argument in the form of
P1 ^ P2^………..Pn  Q
31
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Example for using Equivalence rule in a proof sequence:
 Simplify (A V B) V C to an argument.
The result must be an argument in the form of
P1 ^ P2^………..Pn  Q
32
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Inference rules allow us to add a wff to the last part of the proof sequence,
if one or more wffs that match the first part already exist in the proof
sequence. ( Works in one direction , unlike equivalence rules)
33
From Can Derive Abbreviation for rule
R, R  S S Modus Ponens- mp
R  S, S R Modus Tollens- mt
R, S R Λ S Conjunction-con
R Λ S R, S Simplification- sim
R R V S Addition- add
P  Q, Q  R P  R Hypothetical syllogism- hs
P V Q, P Q Disjunctive syllogism- ds
(PΛ Q)  R P  (Q R) Exportation - exp
P, P Q Inconsistency - inc
PΛ (Q V R) (PΛ Q) V (PΛ R) Distributive - dist
P V (Q Λ R) (P V Q) Λ (P V R) Distributive - dist
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 To prove an argument of the form
P1 Λ P2 Λ ... Λ Pn  R  Q
 Deduction method allows for the use of R as an
additional hypothesis and thus prove
P1 Λ P2 Λ ... Λ Pn Λ R  Q
34
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Example :
 Prove (A  B) Λ (B  C)  (A  C)
35
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Prove that (P  Q)  (Q P) is a valid argument (called
Contraposition – con).
36
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Prove the argument
A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D
37
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Prove the argument
A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D
First, write down all the hypotheses.
1. A
2. B  C
3. (A Λ B)  (D V C)
4. B
38
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Prove the argument
A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D
First, write down all the hypotheses.
1. A
2. B  C
3. (A Λ B)  (D V C)
4. B
Use the inference and equivalence rules to get at the conclusion D.
5. C 2,4, mp
6. A Λ B 1,4, con
7. D V C 3,6, mp
8. C V D 7, comm
9. C  D 8, imp
and finally
10. D 5,9 imp
The idea is to keep focused on the result and sometimes it is very easy to go
down a longer path than necessary.
39
Preparedby:SharifOmarSalem–ssalemg@gmail.com
 Russia was a superior power, and either France was not strong or
Napoleon made an error. Napoleon did not make an error, but if the
army did not fail, then France was strong. Hence the army failed
and Russia was a superior power.
Q: Prove the upper argument ?
 From previous slides we translate this argument to the following
argument formula
 (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)
 Now we have to proof this propositional formula using proof
sequence.
40
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prove (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)
 Proof sequence
1. A Λ (B V C) hyp
2. C hyp
3. D  B hyp
4. A 1, sim
5. B V C 1, sim
6. C V B 5, comm
7. B 2, 6, ds
8. B  (D) 3, cont
9. (D) 7, 8, mp
10. D 9, dn
11. D Λ A 4, 10 , con
41
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Example:
Real Madrid is a superior power team, and either FC Barcelona is not strong
or Juardiola make an error. Juardiola does not make an error, but if FC
Barcelona wins the game, then FC Barcelona is strong. Hence FC
Barcelona loses the game and Real Madrid is a superior power team.
Q: Prove the upper argument ?
 From previous slides we translate this argument to the following
argument formula
 (W Λ (X V Y)) Λ Y Λ (Z  X)  (Z Λ W)
 Now we have to proof this propositional formula using proof sequence.
42
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prove the propositional form using the prove sequence rules (equivalence, inference
and deduction)
43
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Example:
 If the program is efficient, it executes quickly. Either the program is
efficient, or it has a bug. However, the program does not execute
quickly. Therefore it has a bug.
Q: Prove the upper argument ?
 From previous slides we translate this argument to the following
argument formula
 (E  Q) ˄ (E ˅ B) ˄ Q’  B
 Now we have to proof this propositional formula using proof
sequence.
44
Preparedby:SharifOmarSalem–ssalemg@gmail.com
(E  Q) ˄ (E ˅ B) ˄ Q’  B
Prove the propositional form using the prove sequence
rules (equivalence, inference and deduction)
45
Preparedby:SharifOmarSalem–ssalemg@gmail.com
For Proving Verbal Arguments, you need to pass three steps
 Step 1: Converting atomic prepositions to propositional
symbols
 Step 2: Convert verbal argument to propositional logic
(hypothesis, conclusion and form)
 Step 3: Prove the propositional form using the prove sequence
rules (equivalence, inference and deduction)
46
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prepared by: Sharif Omar Salem – ssalemg@gmail.com
47
End of Lecture
Preparedby:SharifOmarSalem–ssalemg@gmail.com
Prepared by: Sharif Omar Salem – ssalemg@gmail.com
48

More Related Content

What's hot (20)

PPTX
#2 formal methods – principles of logic
Sharif Omar Salem
 
PPT
Intro automata theory
Rajendran
 
PPT
CPSC 125 Ch 1 sec 2
David Wood
 
PPTX
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Mohammad Ilyas Malik
 
PPTX
Computational logic Propositional Calculus proof system
banujahir1
 
PPT
Programming Paradigms
Directi Group
 
PPTX
Theory of automata and formal language
Rabia Khalid
 
PPT
Regular expressions and languages pdf
Dilouar Hossain
 
PDF
Introduction to the theory of computation
prasadmvreddy
 
PPT
Regular Grammar
Ruchika Sinha
 
PPTX
Regular expressions
Ratnakar Mikkili
 
PPTX
Regular Expression
valuebound
 
PDF
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
PPTX
Operators php
Chandni Pm
 
PPTX
3.5 equivalence of pushdown automata and cfl
Sampath Kumar S
 
PPTX
OOP Introduction with java programming language
Md.Al-imran Roton
 
PPTX
Asymptotic Notation
Protap Mondal
 
PDF
Python course syllabus
Sugantha T
 
PPTX
language , grammar and automata
ElakkiyaS11
 
#2 formal methods – principles of logic
Sharif Omar Salem
 
Intro automata theory
Rajendran
 
CPSC 125 Ch 1 sec 2
David Wood
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Mohammad Ilyas Malik
 
Computational logic Propositional Calculus proof system
banujahir1
 
Programming Paradigms
Directi Group
 
Theory of automata and formal language
Rabia Khalid
 
Regular expressions and languages pdf
Dilouar Hossain
 
Introduction to the theory of computation
prasadmvreddy
 
Regular Grammar
Ruchika Sinha
 
Regular expressions
Ratnakar Mikkili
 
Regular Expression
valuebound
 
Algorithm and Programming (Introduction of Algorithms)
Adam Mukharil Bachtiar
 
Operators php
Chandni Pm
 
3.5 equivalence of pushdown automata and cfl
Sampath Kumar S
 
OOP Introduction with java programming language
Md.Al-imran Roton
 
Asymptotic Notation
Protap Mondal
 
Python course syllabus
Sugantha T
 
language , grammar and automata
ElakkiyaS11
 

Similar to #3 formal methods – propositional logic (20)

PDF
propositional_logic.pdf
ShivareddyGangam
 
PDF
AI NOTES ppt 4.pdf
ARMANVERMA7
 
PDF
Chapter 01 - p3.pdf
smarwaneid
 
PPTX
Chapter1p3.pptx
CireneSimonSimbahan
 
PDF
Ch1_part3.pdfเานดวย่ากจวาเครากนยวกวสดสสนยดสรตสะารนสเ
ssusere35d57
 
DOCX
Propositional logic is a good vehicle to introduce basic properties of logic
pendragon6626
 
PPTX
Week 3 Logic and Proof Logic and Proof Logic and Proof
HERMANSANTOSOPAKPAHA
 
PPTX
Knowledge representation and Predicate logic
Amey Kerkar
 
PPT
logic_lec4.ppt
noramohed732
 
PPTX
Chapter1p3.pptx
sneha510051
 
PPT
Logic.ppt
syedadamiya
 
PPTX
Propositional logic
Mamta Pandey
 
PPT
Propositional and first-order logic different chapters
ines396023
 
PPT
Propositional Logic in Artificial Intelligence
AMSERMAKANITeaching
 
PPTX
chapter 1 (part 2)
Raechel Lim
 
PPT
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
sundarKanagaraj1
 
PPT
PropositionalLogic.ppt
Marc Angelo Cabaddu
 
PPT
Propositional Logic for discrete structures
ShraddhaShrivastava30
 
PPT
Propositional Logic, Truth Table, Compound Proposition
charliejackson35
 
PDF
AI R16 - UNIT-3.pdf
JNTUK KAKINADA
 
propositional_logic.pdf
ShivareddyGangam
 
AI NOTES ppt 4.pdf
ARMANVERMA7
 
Chapter 01 - p3.pdf
smarwaneid
 
Chapter1p3.pptx
CireneSimonSimbahan
 
Ch1_part3.pdfเานดวย่ากจวาเครากนยวกวสดสสนยดสรตสะารนสเ
ssusere35d57
 
Propositional logic is a good vehicle to introduce basic properties of logic
pendragon6626
 
Week 3 Logic and Proof Logic and Proof Logic and Proof
HERMANSANTOSOPAKPAHA
 
Knowledge representation and Predicate logic
Amey Kerkar
 
logic_lec4.ppt
noramohed732
 
Chapter1p3.pptx
sneha510051
 
Logic.ppt
syedadamiya
 
Propositional logic
Mamta Pandey
 
Propositional and first-order logic different chapters
ines396023
 
Propositional Logic in Artificial Intelligence
AMSERMAKANITeaching
 
chapter 1 (part 2)
Raechel Lim
 
Unit III Knowledge Representation in AI K.Sundar,AP/CSE,VEC
sundarKanagaraj1
 
PropositionalLogic.ppt
Marc Angelo Cabaddu
 
Propositional Logic for discrete structures
ShraddhaShrivastava30
 
Propositional Logic, Truth Table, Compound Proposition
charliejackson35
 
AI R16 - UNIT-3.pdf
JNTUK KAKINADA
 
Ad

More from Sharif Omar Salem (6)

PPTX
PhD Presentation (Doctorate)
Sharif Omar Salem
 
PPTX
#8 formal methods – pro logic
Sharif Omar Salem
 
PPTX
#7 formal methods – loop proof examples
Sharif Omar Salem
 
PPTX
#6 formal methods – loop proof using induction method
Sharif Omar Salem
 
PPTX
#5 formal methods – hoare logic
Sharif Omar Salem
 
PPTX
#1 formal methods – introduction for software engineering
Sharif Omar Salem
 
PhD Presentation (Doctorate)
Sharif Omar Salem
 
#8 formal methods – pro logic
Sharif Omar Salem
 
#7 formal methods – loop proof examples
Sharif Omar Salem
 
#6 formal methods – loop proof using induction method
Sharif Omar Salem
 
#5 formal methods – hoare logic
Sharif Omar Salem
 
#1 formal methods – introduction for software engineering
Sharif Omar Salem
 
Ad

Recently uploaded (20)

PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPTX
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PPTX
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
Views on Education of Indian Thinkers Mahatma Gandhi.pptx
ShrutiMahanta1
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 

#3 formal methods – propositional logic

  • 2. Preparedby:SharifOmarSalem–[email protected] Prepositional logic is a formal system of representing knowledge Prepositional logic has:  Syntax – what the allowable expressions are. Structure of the sentence.  Semantics – what the expressions mean. Meaning  Proof theory – how conclusions are drawn from a set of statements. Reasoning. 1
  • 3. Preparedby:SharifOmarSalem–[email protected]  Symbols represent facts  E.g. “Penguins need a cold environment” is a fact  That could be represented by the symbol P  Each fact is called an atomic formulas or atoms  Atomic propositions can be combined using logical connectives –  Order of precedence: ¬ ∧ ∨ → ↔ 2
  • 4. Preparedby:SharifOmarSalem–[email protected] These symbols P, Q,………. etc used to represent propositions, are called atomic formulas, or simply atoms. To express more complex propositions such as the following compound proposition, we use logical connectives such as → (if-then or imply):  “if car brake pedal is pressed, then car stops within five seconds.” This compound proposition is expressed in propositional logic as:  P → Q 3
  • 5. Preparedby:SharifOmarSalem–[email protected]  We can combine propositions and logical connectives to form complicated formulas.  Well-Formed Formulas: Well-formed formulas in propositional logic are defined recursively as follows:  1. An atom is a formula.  2. If F is a formula, then (¬F) is a formula, where ¬ is the not operator.  3. If F and G are formulas, then (F ∧ G), (F ∨ G), (F → G),and (F ↔G) are formulas. (∧ is the and operator, ∨ is the or operator , ↔ stands for if and only if or iff.)  4. All formulas are generated using the above rules. 4
  • 6. Preparedby:SharifOmarSalem–[email protected]  Logic is made up sentences  P might be a sentence  P ∧ Q is also a sentence  If we know the truth values of P and Q, we can work out the truth value of the sentence.  If P and Q are both true then P ∧ Q is true, otherwise it is false  Can use truth tables to ascertain the truth of a sentence 5
  • 7. Preparedby:SharifOmarSalem–[email protected]  An interpretation of a propositional formula G is an assignment of truth values to the atoms A1,... , An in G in which every Ai is assigned either T or F, but not both.  The Figure shows the truth table for several simple formulas. 6
  • 8. Preparedby:SharifOmarSalem–[email protected]  A literal is an atomic formula or the negation of an atomic formula.  A clause is a wff express a fact (premises or conclusion).  A clause set is a group of clause express an argument.  A formula is in conjunctive normal form (CNF) if it is a conjunction of disjunction of literals.  A formula is in disjunctive normal form (DNF) if it is a disjunction of conjunction of literals. 7
  • 9. Preparedby:SharifOmarSalem–[email protected] P - represents the fact “Penguins eat fish” Q - represents the fact “Penguins like fish”  P ∧ Q – Penguins eat fish and penguins like fish  P ∨ Q – Penguins eat fish or penguins like fish  ¬ Q – Penguins do not like fish  P → Q  Penguins eat fish therefore penguins like fish.  If penguins eat fish then penguins like fish.  P ↔ Q  Penguins eat fish therefore penguins like fish and penguins like fish therefore penguins eat fish. 8
  • 10. Preparedby:SharifOmarSalem–[email protected]  If the train arrives late and there is no taxi at the station, then john is late for this meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. 9
  • 11. Preparedby:SharifOmarSalem–[email protected]  If the train arrives late and there is no taxi at the station, then john is late for this meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. 10
  • 12. Preparedby:SharifOmarSalem–[email protected]  If the train arrives late and there is no taxi at the station, then john is late for this meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. 11
  • 13. Preparedby:SharifOmarSalem–[email protected]  If the train arrives late and there is no taxi at the station, then john is late for this meeting. John is not late for his meeting. The train did arrive late. Therefore, there were taxis at the station. 12
  • 14. Preparedby:SharifOmarSalem–[email protected] Definition of Argument:  An argument is a sequence of statements in which the conjunctionof theinitialstatements(calledthepremises/hypotheses) is said to imply the final statement (called the conclusion).  An argument can be presented symbolically as (P1 Λ P2 Λ ... Λ Pn)  Q where P1, P2, ..., Pn represent the hypotheses and Q represents the conclusion.  Deriving a logical conclusion by combining many propositions and using formal logic: hence, determiningthetruthofarguments.  This formula representing the whole argument as hypothesis and conclusion is known as NATURAL DEDUCTION 13
  • 15. Preparedby:SharifOmarSalem–[email protected]  What is a valid argument?  An argument is valid if Q (conclusion) logically follow from P1, P2, ..., Pn (hypotheses)  Informal answer: Whenever the truth of hypotheses leads to the conclusion  A formula is valid iff it is true under all its interpretations. (Called Tautology)  A formula is invalid iff it is not valid.  A valid argument is intrinsically true, i.e. (P1 Λ P2 Λ ... Λ Pn)  Q is a tautology.  Note: We need to focus on the relationship of the conclusion to the hypotheses and not just any knowledge we might have about the conclusion Q. 14
  • 16. Preparedby:SharifOmarSalem–[email protected]  Example:  P1: Neil Armstrong was the first human to step on the moon.  P2 : Mars is a red planet And the conclusion  Q: No human has ever been to Mars.  This wff P1 Λ P2  Q is not a tautology ( Not True)  Truth of Hypothesis doesn’t lead to the conclusion. Mean the argument is not valid. 15
  • 17. Preparedby:SharifOmarSalem–[email protected]  Example:  P1: Tokyo is located in Japan.  P2 : Japan is not located in Europe. And the conclusion  Q: Tokyo is not located in Europe  This wff P1 Λ P2  Q is a tautology ( Always True) Truth of Hypothesis leads to the conclusion. Mean the argument is valid. 16
  • 18. Preparedby:SharifOmarSalem–[email protected]  Russia was a superior power, and either France was not strong or Napoleon made an error. Napoleon did not make an error, but if the army did not fail, then France was strong. Hence the army failed and Russia was a superior power.  Converting it to a propositional form using letters A, B, C and D A: Russia was a superior power B: France was strong B: France was not strong C: Napoleon made an error C: Napoleon did not make an error D: The army failed D: The army did not fail 17
  • 19. Preparedby:SharifOmarSalem–[email protected] A: Russia was a superior power B: France was strong B: France was not strong C: Napoleon made an error C: Napoleon did not make an error D: The army failed D: The army did not fail  Combining, the statements using logic (A Λ (B V C)) hypothesis C hypothesis (D  B) hypothesis (D Λ A) conclusion  Combining them, the propositional form is (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A) 18
  • 20. Preparedby:SharifOmarSalem–[email protected] Example: Real Madrid is a superior power team, and either FC Barcelona is not strong or Juardiola make an error. Juardiola does not make an error, but if FC Barcelona wins the game, then FC Barcelona is strong. Hence FC Barcelona loses the game and Real Madrid is a superior power team.  Converting atomic prepositions to propositional symbols Converting it to a propositional form using letters W, X, Y and Z W: Real Madrid is a superior power team. X: FC Barcelona is strong X: FC Barcelona is not strong Y: Juardiola make an error Y: Juardiola do not make an error Z: FC Barcelona loses the game Z: FC Barcelona wins the game 19
  • 21. Preparedby:SharifOmarSalem–[email protected] W: Real Madrid is a superior power team. X: FC Barcelona is strong X: FC Barcelona is not strong Y: Juardiola make an error Y: Juardiola do not make an error Z: FC Barcelona loses the game Z: FC Barcelona wins the game  Convert verbal argument to propositional logic (hypothesis, conclusion and form) (W Λ (X V Y)) hypothesis Y hypothesis (Z  X) hypothesis (Z Λ W) conclusion Argument form is (W Λ (X V Y)) Λ Y Λ (Z  X)  (Z Λ W) 20
  • 22. Preparedby:SharifOmarSalem–[email protected] Example:  If the program is efficient, it executes quickly. Either the program is efficient, or it has a bug. However, the program does not execute quickly. Therefore it has a bug.  Converting Key statements to propositional symbols E: The program is efficient. Q: The program executes quickly Q: The program does not execute quickly B: The program has a bug 21
  • 23. Preparedby:SharifOmarSalem–[email protected]  Convert verbal argument to propositional logic (hypothesis, conclusion and form) E  Q hypothesis E ˅ B hypothesis Q’ hypothesis B conclusion Argument form is (E  Q) ˄ (E ˅ B) ˄ Q’  B 22
  • 24. Preparedby:SharifOmarSalem–[email protected] If the room temperature is hot, then the air conditioner is on. If the room temperature is cold, then the heater is on. If the room temperature is neither hot nor cold, then the room temperature is comfortable. Therefore, If neither the air conditioner nor the heater is on, then the room temperature is comfortable. Translate the argument using propositional Logic. 23
  • 25. Preparedby:SharifOmarSalem–[email protected] How to prove Validity of an argument?  Truth Table proof  Equivalency Laws deduction proof  Resolution Theorem proof 24
  • 26. Preparedby:SharifOmarSalem–[email protected] If the room temperature is hot, then the air conditioner is on. If the room temperature is cold, then the heater is on. If the room temperature is neither hot nor cold, then the room temperature is comfortable. Therefore, If neither the air conditioner nor the heater is on, then the room temperature is comfortable.  Converting Key statements to propositional symbols  H = the room temperature is hot  C = the room temperature is cold  M = the room temperature is comfortable  A = the air conditioner is on  G = the heater is on.  Convert propositional logic (hypothesis/conclusion/form)  Hypothesis1: F1= H  A  Hypothesis2: F2= C  G  Hypothesis3: F3= ¬(H ˅ C)  M  Conclusion: F4= ¬(A ˅ G)  M Truth Table proof 25
  • 27. Preparedby:SharifOmarSalem–[email protected]  Argument Formula:  F1 ˄ F2 ˄ F3  F4  (H  A) ˄ (C  G) ˄ [¬(H ˅ C)  M]  [¬(A ˅ G)  M] Truth Table proof 26
  • 28. Preparedby:SharifOmarSalem–[email protected]  To prove this proposition with the truth-table technique. You have to exhaustively checks every interpretation of the formula F4 to determine if it evaluates to T. The truth table shows that every interpretation of F4 evaluates to T, thus F4 is valid. 27
  • 29. Preparedby:SharifOmarSalem–[email protected] Definition of Proof Sequence:  It is a sequence of wffs in which each wff is either a hypothesis or the result of applying one of the formal system’s derivation rules to earlier wffs in the sequence.  Derivation rules for propositional logic are  Equivalence Rules.  Inference Rules.  Deduction Method. Equivalency Laws- Deduction proof 28
  • 30. Preparedby:SharifOmarSalem–[email protected]  Tautological proposition  a tautology is a statement that can never be false  all of the lines of the truth table have the result "true"  Contradictory proposition  a contradiction is a statement that can never be true  all of the lines of the truth table have the result "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  all of the lines of one column of the truth table have all of the same truth values as the corresponding lines from another column of the truth table  it's indicated using  or ↔ 29
  • 31. Preparedby:SharifOmarSalem–[email protected]  These rules state that certain pairs of wffs are equivalent, hence one can be substituted for the other with no change to truth values.  The set of equivalence rules are summarized here: 30 Expression Equivalent to Abbreviation for rule R V S R Λ S S V R S Λ R Commutative (comm) (R V S) V Q (R Λ S) Λ Q R Λ (S Λ Q) R V (S V Q) Associative (ass) (R V S) (R Λ S) R Λ S R V S De-Morgan’s Laws (De-Morgan) R  S R V S implication (imp) R (R) Double Negation (dn) PQ (P  Q) Λ (Q  P) Equivalence (equ) Q  P P  Q Contraposition- cont P PΛ P Self-reference - self P V P P Self-reference - self
  • 32. Preparedby:SharifOmarSalem–[email protected]  Example for using Equivalence rule in a proof sequence:  Simplify (A V B) V C to an argument. The result must be an argument in the form of P1 ^ P2^………..Pn  Q 31
  • 33. Preparedby:SharifOmarSalem–[email protected]  Example for using Equivalence rule in a proof sequence:  Simplify (A V B) V C to an argument. The result must be an argument in the form of P1 ^ P2^………..Pn  Q 32
  • 34. Preparedby:SharifOmarSalem–[email protected]  Inference rules allow us to add a wff to the last part of the proof sequence, if one or more wffs that match the first part already exist in the proof sequence. ( Works in one direction , unlike equivalence rules) 33 From Can Derive Abbreviation for rule R, R  S S Modus Ponens- mp R  S, S R Modus Tollens- mt R, S R Λ S Conjunction-con R Λ S R, S Simplification- sim R R V S Addition- add P  Q, Q  R P  R Hypothetical syllogism- hs P V Q, P Q Disjunctive syllogism- ds (PΛ Q)  R P  (Q R) Exportation - exp P, P Q Inconsistency - inc PΛ (Q V R) (PΛ Q) V (PΛ R) Distributive - dist P V (Q Λ R) (P V Q) Λ (P V R) Distributive - dist
  • 35. Preparedby:SharifOmarSalem–[email protected]  To prove an argument of the form P1 Λ P2 Λ ... Λ Pn  R  Q  Deduction method allows for the use of R as an additional hypothesis and thus prove P1 Λ P2 Λ ... Λ Pn Λ R  Q 34
  • 37. Preparedby:SharifOmarSalem–[email protected]  Prove that (P  Q)  (Q P) is a valid argument (called Contraposition – con). 36
  • 38. Preparedby:SharifOmarSalem–[email protected]  Prove the argument A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D 37
  • 39. Preparedby:SharifOmarSalem–[email protected]  Prove the argument A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D First, write down all the hypotheses. 1. A 2. B  C 3. (A Λ B)  (D V C) 4. B 38
  • 40. Preparedby:SharifOmarSalem–[email protected]  Prove the argument A Λ (B  C) Λ [(A Λ B)  (D V C)] Λ B  D First, write down all the hypotheses. 1. A 2. B  C 3. (A Λ B)  (D V C) 4. B Use the inference and equivalence rules to get at the conclusion D. 5. C 2,4, mp 6. A Λ B 1,4, con 7. D V C 3,6, mp 8. C V D 7, comm 9. C  D 8, imp and finally 10. D 5,9 imp The idea is to keep focused on the result and sometimes it is very easy to go down a longer path than necessary. 39
  • 41. Preparedby:SharifOmarSalem–[email protected]  Russia was a superior power, and either France was not strong or Napoleon made an error. Napoleon did not make an error, but if the army did not fail, then France was strong. Hence the army failed and Russia was a superior power. Q: Prove the upper argument ?  From previous slides we translate this argument to the following argument formula  (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)  Now we have to proof this propositional formula using proof sequence. 40
  • 42. Preparedby:SharifOmarSalem–[email protected] Prove (A Λ (B V C)) Λ C Λ (D  B)  (D Λ A)  Proof sequence 1. A Λ (B V C) hyp 2. C hyp 3. D  B hyp 4. A 1, sim 5. B V C 1, sim 6. C V B 5, comm 7. B 2, 6, ds 8. B  (D) 3, cont 9. (D) 7, 8, mp 10. D 9, dn 11. D Λ A 4, 10 , con 41
  • 43. Preparedby:SharifOmarSalem–[email protected] Example: Real Madrid is a superior power team, and either FC Barcelona is not strong or Juardiola make an error. Juardiola does not make an error, but if FC Barcelona wins the game, then FC Barcelona is strong. Hence FC Barcelona loses the game and Real Madrid is a superior power team. Q: Prove the upper argument ?  From previous slides we translate this argument to the following argument formula  (W Λ (X V Y)) Λ Y Λ (Z  X)  (Z Λ W)  Now we have to proof this propositional formula using proof sequence. 42
  • 44. Preparedby:SharifOmarSalem–[email protected] Prove the propositional form using the prove sequence rules (equivalence, inference and deduction) 43
  • 45. Preparedby:SharifOmarSalem–[email protected] Example:  If the program is efficient, it executes quickly. Either the program is efficient, or it has a bug. However, the program does not execute quickly. Therefore it has a bug. Q: Prove the upper argument ?  From previous slides we translate this argument to the following argument formula  (E  Q) ˄ (E ˅ B) ˄ Q’  B  Now we have to proof this propositional formula using proof sequence. 44
  • 46. Preparedby:SharifOmarSalem–[email protected] (E  Q) ˄ (E ˅ B) ˄ Q’  B Prove the propositional form using the prove sequence rules (equivalence, inference and deduction) 45
  • 47. Preparedby:SharifOmarSalem–[email protected] For Proving Verbal Arguments, you need to pass three steps  Step 1: Converting atomic prepositions to propositional symbols  Step 2: Convert verbal argument to propositional logic (hypothesis, conclusion and form)  Step 3: Prove the propositional form using the prove sequence rules (equivalence, inference and deduction) 46