Formal Methods in Software Engineering
Formal Methods in Software Engineering
Formal Methods in Software Engineering
Lecture 03
Recapping…..
What is Logic? In computer science, the aim of the logic is to
develop a language that models a situation, in which, it can reason
formally to realize the desired objective.
What is Reasoning? Reasoning is a process of using existing
knowledge or observations to make predictions or draw conclusions.
Due to basic techniques of logical formalisms, formal methods were
born.
Formal methods are used in the industry with their specification
languages, theorem proving, and model checking
What is Propositional Logic?
Proposition: A = It is raining.
Possible value: true or false therefore in a truth table.
(A) It is raining
F
Proposition: ⌐A = It is not raining or Not (It is raining).
Possible value: true or false therefore in a truth table.
A Results (⌐A)
T F
F T
Disjunction
p q pvq
T T T
T F T
F T T
F F F
Disjunction Example
(P v Q) v R
Conjunction
p q p^q
T T T
T F F
F T F
F F F
Conjunction Example
P v (Q ^ R)
Implication
p → (q → r)
Bi-implication / equivalence
(p → q) ^ (q → p)
Tautology and Contradiction
Tautology
if it is always true.
When all results in the truth table are true
Example: p ∨ ¬p.
Contradiction /Un-satisfiability
if it always false.
When all results in the truth table are false
Example: p ∧ ¬p.
Satisfiability
T T
T F
F T
F F
Laws in Propositional Logic