1. Formal Method
Lecture # 3
Umber Noureen Abbas
Lecturer
Department of Computer Science
10/27/2022
Computer Science Department,
University of Sahiwal
1
2. Software
• Computer software, or simply software, is a
collection of data or computer instructions
that tell the computer how to work.
• It is used not only to provide applications on
our PC, but also to control many systems
around us.
• Often the software is integrated into a
mechanical or electronic system (called
embedded software).
10/27/2022
Computer Science Department,
University of Sahiwal
2
3. High Integrity Software
• Software that has a higher expectation of
correctness called as high integrity software.
• This expectation of correctness is closely
linked to the risks inherent in software failure.
• Therefore, the development of high integrity
software demands greater resources than the
development of a ‘regular’ software product.
10/27/2022
Computer Science Department,
University of Sahiwal
3
4. Critical Software
• The term critical software applies to software
that cause danger while failure.
• Critical software can further be categorized
depending upon the types of danger imposed
by failure.
– business critical software
– mission critical software
– safety critical software
10/27/2022
Computer Science Department,
University of Sahiwal
4
5. Business Critical Software
• Failure could adversely affect the economic
success of an enterprise;
• Examples include
– Software used to control a bank’s ATM
transactions
– software aimed at providing security for sensitive
information.
10/27/2022
Computer Science Department,
University of Sahiwal
5
6. Mission Critical Software
• Failure could impair the goal of the given
mission;
• Examples
– Satellite Operation
– Rocket Launch Systems.
10/27/2022
Computer Science Department,
University of Sahiwal
6
7. Safety Critical Software
• It could result in harm to people, property or
the environment;
• Examples include
– Medical software
– Air traffic control software.
10/27/2022
Computer Science Department,
University of Sahiwal
7
8. The Importance of the Specification
• When a software contains an ‘error’ we mean
it does not behave as expected.
• There could be two reasons for this;
– either the software does not conform to its
specification
– there are errors or omissions in the original
specification
10/27/2022
Computer Science Department,
University of Sahiwal
8
9. Do you know?
• The crash of the European Ariane5 rocket,
because of a software failure
– Rocket took 10 years and 7 billion dollars to
develop
• Radiation overdose in medical equipment
– failed to detect the radiation overdose and causes
death of several patients
10/27/2022
Computer Science Department,
University of Sahiwal
9
10. Testing
• is the process of locate these software errors.
• Testing involves running a program with a set
of inputs and comparing the actual outputs
from the program against the expected
outputs (as defined in the specification).
10/27/2022
Computer Science Department,
University of Sahiwal
10
11. Testing limitation
• Testing cannot take place until some
implementation is available.
• Testing can only help to uncover errors – it
cannot guarantee the absence of them.
• Testing is always carried out with respect to
specification. If the specification is ambiguous,
test/software will fail always.
10/27/2022
Computer Science Department,
University of Sahiwal
11
12. Mechanism for Formal methods
Ambiguities in the specification and the limitations of
testing can result in errors in the final application
10/27/2022
Computer Science Department,
University of Sahiwal
12
13. Formal Specification
• There are two important aspects to an object:
• The information
– that it holds (referred to as its attributes)
• The things
– it can do (referred to as its methods or
operations).
10/27/2022
Computer Science Department,
University of Sahiwal
13
14. Class Diagram
a typical UML class diagram
specifying a BankAccount class.
10/27/2022
Computer Science Department,
University of Sahiwal
14
15. Method (withdraw)
• receives a requested amount to withdraw
from the bank account
– if there are sufficient funds in the account, meets
the request.
– Returns a boolean value indicating success or
failure of the attempt to withdraw money from
the account.
10/27/2022
Computer Science Department,
University of Sahiwal
15
16. Formal Methods
• Constitute a branch of software engineering
that incorporates the use of mathematics for
software development.
• A formal method provides a formal language
in which to express the initial specification and
all future design steps towards the final
program.
10/27/2022
Computer Science Department,
University of Sahiwal
16
18. Cont.
• A formal method is more than just a
specification language for recording these
transformations
• It also includes a proof system
– for demonstrating that each transformation
preserves the formal meaning captured in the
previous step
– guaranteeing the correctness of a statement and
relies upon mathematical logic
10/27/2022
Computer Science Department,
University of Sahiwal
18
19. Advantages of FM
• Formal specifications can help considerably in
generating suitable test cases.
• the ability to analyse a specification
• increasing confidence that the specification
accurately captures the real system requirements
• initial specification can be checked
mathematically
• Proofs can help uncover design errors as soon as
they are made, rather than having to wait for
testing of the final implementation
10/27/2022
Computer Science Department,
University of Sahiwal
19
20. Method of Specification
• Many formal methods approaches have been
established but these two are principal
approaches
– Algebraic
– model-based
10/27/2022
Computer Science Department,
University of Sahiwal
20
21. Classifying Leading FMs
Algebraic Model-based
Sequential
systems
• Larch • Vienna Development
Method (VDM)
• Z
• B
Concurrent
Systems
• Calculus of
Communicating
Systems (CCS)
• OBJ
• Prototype Verification
System (PVS)
• Communicating
Sequential Processes
(CSP)
10/27/2022
Computer Science Department,
University of Sahiwal
21
22. VDM (Vienna development Method)
• VDM specification corresponds closely to the
notion of a class in an object-oriented
methodology
• a lightweight approach
– At first; informal specification of software using
the UML class notation
– formal specification for a UML class in the form of
a VDM specification
10/27/2022
Computer Science Department,
University of Sahiwal
22
24. Cont.
• we will examine the data types
– natural numbers
– sets and sequences
• and demonstrate their use through example
specifications.
10/27/2022
Computer Science Department,
University of Sahiwal
24
25. Questions
Any Question Please?
You can contact me at: umber@uosahiwal.edu.pk
Your Query will be answered within one working day.
10/27/2022
Computer Science Department,
University of Sahiwal
25