0% found this document useful (0 votes)
56 views17 pages

Benefits of Formal Methods in SE

Uploaded by

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

Benefits of Formal Methods in SE

Uploaded by

gmovie0007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Formal Methods in SE

By: Syed Umair Kazmi

Credit Hours: 3+0

1
Shortcomings Of Diagrams
(Informal Specification)
 Lack of Structure: Diagrams often lack formal structure,
making them unfit for precise communication of a system's
behavior or requirements.
 Lack of Syntax and Semantics: Diagrams do not have a
well-defined syntax (rules for constructing them) or
semantics (meaning), which makes it difficult to ensure
clarity and consistency.
 No Formal Correctness: It is impossible to prove their
formal correctness of the model of system. Without formal
checks, we can't be sure the system will work as expected.
 Difficult to Translate into Algorithms: It's difficult to
take a diagram and turn it into clear, step-by-step
instructions (or code) for a computer to follow. Making sure
the program matches the diagram is also tricky, since the
diagram might not be detailed enough.

2
Why To Use Formal Methods
 The whole point of using formal methods is to
be able to predict what a program will do
without running any code - in fact, without
writing any.
 This ability to model behavior distinguishes
the formal methods from diagrams that can
only model program structure.
 Formal methods can help you create software
so that you can understand it before you run
it.
 This means we can discover many errors
without having to run any tests.
3 Formal Methods in Software Engineering
Why To Use Formal Methods:
Analysis
 Analysis is any activity devoted to
understanding software without actually
running programs - anything that involves
reading, discussing, and trying to understand
programs without testing.
 Formal methods provide the analysis of a
software.
 Formal methods allow you to create designs
and write code directly from a clear
specification. They also help you check if the
designs and code match the original
specification correctly.
4 Formal Methods in Software Engineering
5 Formal Methods in Software Engineering
Formal Analysis Vs Testing
 What we call formal methods are just
particular kinds of analyses that employ
mathematical notations.
 Analysis can be more effective than testing for
many purposes.
 Testing cannot take place until some
implementation is available.
 Therefore correcting errors uncovered by
testing could involve retracing many steps
and undoing work previously done.

6 Formal Methods in Software Engineering


Formal Methods Vs Testing
 Testing is useful for finding errors but cannot
ensure that all possible errors have been
detected.
 Formal methods can help ensure a correct
design by identifying potential issues early in
the process and providing stronger
guarantees about the absence of errors,
especially in critical parts of the system.

7 Formal Methods in Software Engineering


Where We Use Formal Methods
 Formal methods help in expressing the
specification of a system using precise
mathematical languages. This includes defining
what the system is supposed to do without
worrying about how it will be implemented.
 At the design stage, formal methods are used to
model the system’s architecture, components,
and their interactions, helping in identifying
design flaws early in the development process.
 Formal methods involve writing another formal
description of the program, in addition to the
code itself.

8 Formal Methods in Software Engineering


How To Use Formal Methods

Formal modeling
Formal design
Formal verification

9 Formal Methods in Software Engineering


How to use formal methods:
Formal modeling
 Formal modeling helps us create a simple version
of a system to understand how it will work before
coding.
 We use the model to figure out how the system will
behave in different situations before writing any code.
 We construct a model to focus on some particular
aspect of a system, and we omit all the details that
are inessential to that aspect.
 We build the model using mathematical concepts like
sets and functions for clarity.
 We explain how the system should behave based on
the model, which helps us write the code correctly.

10 Formal Methods in Software Engineering


How to use formal methods:
Formal Design
 Design is about organizing how a program
works inside. It involves creating diagrams,
like block diagrams and data flow diagrams, to
show the program's parts and how they
connect.
 We can also use formal methods during the
design phase to describe how the program
should behave, not just its structure.
 Formal methods allow us to clearly define
each part of the program and identify which
components are needed to achieve specific
tasks.
11 Formal Methods in Software Engineering
How to use formal methods:
Formal verification
 Verification means showing that our code will do
what we intend.
 One outcome of formal verification is a proof,
which is a convincing argument that the code
does what it is supposed to do based on the
specification.
 The proof relies solely on the written specification
and the actual code.
 A proof system uses mathematical logic to ensure
the correctness of a statement. It provides a
structured way to confirm that the program
behaves correctly according to the specified
requirements.
12 Formal Methods in Software Engineering
Getting Abstract Mathematical
Model
 To find the best structure for a system, we
first need to understand how it behaves. This
model focuses on essential behaviors,
ignoring unnecessary details.
 Software design outlines how the different
parts of a program fit together.
 Software design also explains how the system
should behave in different situations,
describing actions or responses of the system.

13 Formal Methods in Software Engineering


Static Aspect Of A System
The static aspect of a system refers to the
parts of the system that don’t change as the
system operates. It includes:
System States are the different conditions
the system moves through.
Invariant Relationships are the fixed rules
that never change, regardless of the system’s
current state..
In Z, schemas are used to describe both static
and dynamic aspects of a system.

14 Formal Methods in Software Engineering


Dynamic Aspects Of System
Dynamic aspects refer to how a system behaves and
changes over time. Understanding these aspects is crucial for
finding the best structure for a system. The dynamic aspects
include:
Possible Operations: The actions or functions that can be
performed by the system. For example, in a banking system,
possible operations might include deposit, withdraw, and
transfer.
Input-Output Relationships: This describes how the inputs
to the system relate to the outputs. For instance, if you input a
certain amount to deposit into an account, the output (the new
account balance) changes accordingly.
Changes of State: This refers to how the system transitions
from one state to another based on operations. For example,
when a user withdraws money, the state of the account
changes from one balance to a lower balance.
15 Formal Methods in Software Engineering
Summary Of The Lecture:
Conclusion

 Why we use formal methods


 Formal methods vs testing
 How to use formal methods
 Getting abstract mathematical/formal model

16 Formal Methods in Software Engineering


Thanks

17

You might also like