0% found this document useful (0 votes)
60 views28 pages

Formal Methods in Software Engineering: Propositional Logic

The document discusses propositional logic and provides an overview of a lecture on the topic. It defines propositional logic and the concepts of knights and knaves. Examples are given to illustrate solving logic problems using techniques like truth tables and logical deductions.

Uploaded by

Izhar Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views28 pages

Formal Methods in Software Engineering: Propositional Logic

The document discusses propositional logic and provides an overview of a lecture on the topic. It defines propositional logic and the concepts of knights and knaves. Examples are given to illustrate solving logic problems using techniques like truth tables and logical deductions.

Uploaded by

Izhar Hussain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Formal Methods in

Software Engineering
Lecture # 04
Propositional Logic
Instructor: Saima Zareen
Assistant Professor
Department of Software Engineering
saima.zareen@uettaxila.edu.pk
RECAP

My name is ………………………….

I remember …………………………..
The Island of Knights and Knaves
The island has two types of
inhabitants: I always speak the
'knights', truth
The Island of Knights and Knaves contd..

'knaves',
 who always tell a lie.
If A is a knight S is true
If A is a Knave S is false
A S knight
~A ~S knave
Someone asks person A
“Are you a knight?”
He replies if I am a knight, I will eat my hat.
Prove that A has to eat his hat.
Solve it using logic.
A: A is a knight
H: A eats his Hat.
If A is a knight, A will eat his Hat
S=A=> H
We have seen that
A S
Therefore
For a knight
AA=>H
Two ways to solve problems
Truth tables
Logical deductions
Truth tables
Truth table becomes complex with the increasing
variables.
Logical deduction is more simpler.
P=>q= not p or q see lecture 03 slide 49
A(~A v H); PQ=(P˄Q)˅(~P ˄~Q)
((A^(~A v H) v (~A ^~(not A v H))
A^~A v A^H
False v (A ^ H)------ equation 1
v (~A ^~(not A v H))
V (~A^A) ^~H
 False ^ ~H= False ----- equation 2
Combining equation 1 and equation 2 using OR
False v A^H V False
False v False v A^H
A^H
Activity

on the island of knights and knaves, it is rumored that there


is gold buried on the island. You ask one of the natives, A
,whether there is gold on the island. He makes the following
response: “there is gold on this island if and only if I am a
knight”
ASG, ~A~S,
G : There is gold on island
can it be determined whether A is a knight or a knave?
Can it be determined whether there is gold on the island?
Rules of Inference and
logical deduction
Syntax of rules of inference
// above the line are premises

// below the line is the conclusion


To the right of the line, we write the name of the rule, ∧i
is read ‘and-introduction.
Notice that we have introduced a ∧ (in the conclusion).
The rule for conjunction
(Introduction) Notice that we have introduced a ∧ (in the
conclusion) where there was none before (in the
premises).

Rules for elimination

It is important to engage in this kind of pattern matching before the


application of proof rules.
Elimination rule(rule for conjunction )
If we are given complex proposition, we can conclude a simple
proposition from it.
Given p and q
When p and q is true, it means we can conclude p is true.
P and Q
---------
p

When p and q is true, it means we can conclude q is true.


P and Q
---------
Q
Example
Prove the rule given P^Q, R Q^R

p∧q
r

q∧r

fill the gap between the premises and the conclusion by applying a suitable
sequence of proof rules.
Given conjunction rule of elimination
we apply ∧e2 to the first premise, giving us q
Then we apply ∧i to this q and to the second premise, r, giving us q ∧ r.
1. p∧q premise
2. r premise
3. q ∧e2 1
4. q∧r ∧i 3, 2
Practice task 1
(p ∧ q) ∧ r, s ∧ t |− q ∧ s
Questions
References
http://
people.hofstra.edu/stefan_waner/realworld/logic/logi
cex2.html
http://
www.mathgoodies.com/lessons/vol9/biconditional.ht
ml
Program construction calculating implementations
from specifications by roland backhouse

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy