Formal Methods in Software Engineering
(FMSE)
Lecture # 4
September 26, 2017
(Lecture # 4) FMSE September 26, 2017 1 / 25
Recapping.....
What is propositional Logic?
Why do we need to use Propositional Logic in formal
methods?
(Lecture # 4) FMSE September 26, 2017 2 / 25
Syntax of Propositional Logic
There are six different types of sentences:
Negation consist of negation operators “neg”
Conjunction consists of sequence of sentences separated by “∧”
operator and enclose in parenthesis. For example; (p ∧ q)
Disjunction consists of sequence of sentences separated by “∨”
operator and enclose in parenthesis. For example; (p ∨ q)
Implication consist of pair of sentences separated by “→” and
enclosed in parenthesis. For Example; (p → q) where p is called
antecedent and q is known as consequent.
(Lecture # 4) FMSE September 26, 2017 3 / 25
Syntax of Propositional Logic
Reduction is the reverse of implication. For example; (p ← q). In
implication, “q” is the antecedent and “p” is consequent.
Equivalence expresses the equivalence of both arguments p and q. It
represents the combination of an implication and a reduction. For
example; (p → q) ∧ (p ← q) or (p ↔ q)
(Lecture # 4) FMSE September 26, 2017 4 / 25
Semantics of Propositional Logic
Semantic shows the meaning or interpretation of the given expression.
It reveals the real world meaning of the arguments.
If the truth value of any sentence is true then the truth value of its
negation is false and vice versa. For example; If p is true then ¬p is
false. If ¬p is true then p is false.
The truth value of conjunctive sentence is true if and only if both
conjunctive arguments must be true. otherwise truth value is false.
For example; (p ∧ q) is true iff p and q both are true.
The truth value of disjunctive sentence is true if and only if any one
or both sentences must be true. otherwise truth value is false. For
example; (p ∨ q) is true iff p or q is true or both p and q are true.
(Lecture # 4) FMSE September 26, 2017 5 / 25
Semantics of Propositional Logic
The truth value of an implication is false if and only if its antecedent
is true and consequent is false, otherwise the truth value must be
true. For example; (p → q) if p is true and q is false then we can say
that the argument is not valid. For all other combinations, it must be
valid.
The truth value of a reduction is false if and only if its antecedent is
true and consequent is false, otherwise the truth value must be true.
For example; (q ← p) if q is true and p is false then we can say that
the argument is not valid. Otherwise it will be valid for all other
combinations.
An equivalence is said to be true if and only if the truth value of its
consequent must match, which means either both true or both false.
For example; (p ↔ q) iff both p and q are true or both p and q are
false.
(Lecture # 4) FMSE September 26, 2017 6 / 25
Validity in Propositional Logic
Valid sentence is a sentence that is true under all interpretations, no
matter what the world actually like or how semantics are defined.
An argument is said to be valid when premises are true and
conclusion must be true.
A formula is valid if it holds under every assignment and called
tautology.
For Example; Sky is blue or (p ∨ ¬p)
(un)satisfiable if it is true in some (no) interpretation,
(Lecture # 4) FMSE September 26, 2017 7 / 25
Decidability in Propositional Logic
Propositional logic is clearly decidable.
We can determine it with the finite amount of time whether the
argument is valid or not.
We can do the same task by constructing truth table but constructing
truth table is an expensive procedure, it requires exponential time
namely 2n .
(Lecture # 4) FMSE September 26, 2017 8 / 25
Entailment in Propositional Logic
A model is an interpretation (i.e., an assignment of truth values to
symbols) of a set of sentences such that each sentence is True. A
model is just a formal mathematical structure that “stands in” for the
world.
Given a set Γ of formulas and
A formula ϕ,
we write Γ |= ϕ iff every interpretation that makes all formulas in Γ
true makes ϕ also true.
Γ |= ϕ is read as “Γ entails ϕ” or “ϕ logically follows from Γ”.
(Lecture # 4) FMSE September 26, 2017 9 / 25
Properties of Entailment in Propositional Logic
(Lecture # 4) FMSE September 26, 2017 10 / 25
Soundness of Propositional Logic
In the soundness, reasoning derive only true statements.
It is a formula that is provable, is true.
Example; If Γ ` ϕ, then Γ |= ϕ. (if a formula ϕ can be derived from a
set of formulas Γ, then ϕ is a consequence of Γ).
(Lecture # 4) FMSE September 26, 2017 11 / 25
Sound Rules of Inference
Some examples of sound rules of inference. Each can be shown to be
sound once and for all using a truth table. We write each of these
derivations as A ` B , where A is the premise and B is the derived
sentence.
(Lecture # 4) FMSE September 26, 2017 12 / 25
Completeness in Propositional Logic
In completeness, Reasoning derives all true statements, which means
every true formula is provable.
Completeness asserts the existence of rules that allow to deduce every
consequence from any set of formula in the logic.
For example; Γ |= ϕ if and only if Γ ` ϕ. If Γ models ϕ then we can
also derive ϕ from a set of formula Γ.
(Lecture # 4) FMSE September 26, 2017 13 / 25
Logical Equivalences
(Lecture # 4) FMSE September 26, 2017 14 / 25
Conditional Logical Equivalences
(Lecture # 4) FMSE September 26, 2017 15 / 25
Biconditional Logical Equivalences
(Lecture # 4) FMSE September 26, 2017 16 / 25
Practice Question
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q
(Lecture # 4) FMSE September 26, 2017 17 / 25
A Proof in Propositional Logic
(Lecture # 4) FMSE September 26, 2017 18 / 25
Normal Form in PL
A literal is an atomic formula or negation of an atomic formula that
may be positive or negative.
For example; A is positive literal. ¬ A is negative literal.
There are two major types of Normal forms.
Conjunctive normal form: A formula in conjunctive normal form
(CNF) is a conjunction of clauses.Example: (p ∨ ¬q ∨ r ) ∧ (¬p ∨ ¬r )
Disjunctive normal form: we can define formulae in disjunctive
normal form (DNF) by swapping the words “conjunction” and
“disjunction” in the definitions above. Example:
(¬p ∧ q ∧ r ) ∨ (¬q ∧ ¬r ) ∨ (p ∧ r ‘).
(Lecture # 4) FMSE September 26, 2017 19 / 25
Transformation into Conjunctive Normal Form
For every propositional formula one can construct an equivalent one in
conjunctive normal form.
1 Express all other operators by conjunction, disjunction and negation.
2 Push negations inward by De Morgan’s laws and the double negation
law until negations appear only in literals.
3 Use the commutative, associative and distributive laws to obtain the
correct form.
4 Simplify with domination, identity, idempotent, and negation laws.
(Lecture # 4) FMSE September 26, 2017 20 / 25
Example: Transformation into CNF
(Lecture # 4) FMSE September 26, 2017 21 / 25
Limitations of Propositional Logic
Propositional Logic is too weak representational language. Due to certain
limitations, other logics were introduced to overcome these problem:
Propositional Logic deals with simple declarative sentences.
Proposition have only boolean value that may either be true or false.
No quantifier variables are used in this logic. e,g; there exit, for all.
In propositional logic, it is very difficult to express the large domains
concisely.
There is no defined properties of individuals. For example; Bill is tall.
Generalization, patterns and regularities can’t be easily presented.
(Lecture # 4) FMSE September 26, 2017 22 / 25
Summary
Our aim is to give a broad overview of the formal verification methods
employed in the industry.
Model Checking
Theorem Proving
Propositional Logic (we already have discussed)
We started with the ‘simplest’ logic (propositional logic) and will proceed
as per plan
(Lecture # 4) FMSE September 26, 2017 23 / 25
Summary
Traditionally, propositional logic has been regarded as fairly boring,
and is usually regarded as a stepping-stone on the way to first order
logic (and beyond).
There are several limitations but Propositional logic is clearly
decidable in theory
However, the last decade has seen a remarkable upsurge of interest in
propositional logic. In fact, it’s arguably the hottest topic in
automated theorem proving!
(Lecture # 4) FMSE September 26, 2017 24 / 25
Thanks!
(Lecture # 4) FMSE September 26, 2017 25 / 25