FM - Lecture 1

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 17

Introduction to Formal

Methods in Software
Engineering
What is Software?
• Software is a set of programs, which is
designed to perform a well-defined
function.

• A program is a sequence of instructions


written to solve a particular problem.

• Hardware devices need user instructions


to function.
What is Engineering?

Engineering is all about developing products, using


well-defined, scientific principles and methods.
Definitions Of Software Engineering

Software Engineering is all about developing software


products, using well-defined, scientific principles and
methods.
Formal Methods for SE - Definition
• The Encyclopedia of Software Engineering defines formal methods in
the following manner:

The formal methods used in developing computer systems are


mathematically based techniques for describing system properties.
Why use FM? History of Software Bugs
• Software's encountered notorious bugs that were the cause of
financial loss and deaths of many people.

• Famous bugs are


• Therac-25
• Computerized radiation therapy machine called the Therac-25. Killed many people,
controller could not stop radiation due to software bug.
• AT & T long distance breakdown bug 1990
• Ill placed break statement in the code, caused the 1/3rd of entire American network to
go down for 9 hours.
• Pentium bug
• Software error in microcode of Pentium microprocessor, which resulted in error of
floating point calculation problems. Intel had to take back all the Pentiums, and it caused
huge loss.
Why use FM? History of Software Bugs

• So methods are needed that ensure that software is


• Correct

• Software correctness ensures that the software has quality. To achieve


software quality, we apply different testing techniques.

• Testing
• Verification OR Validation
• Black Box Testing OR White Box Testing
Verification & Validation

• Verification: The process of determining whether the products of a


given phase of the software development process fulfill the conditions
established during the previous phase.

• Validation: The process of evaluating software at the end of software


development to ensure its according to the user requirements.
Differences between Verification & Validation

Verification Validation

Are we building the system right? Are we building the right system?

Verification is carried out before the Validation activity is carried out just
Validation. after the Verification.

Cost of errors caught in Verification is Cost of errors caught in Validation is


less than errors found in Validation. more than errors found in Verification.
White Box Testing
• Also known as glass box testing or structural testing, is an approach
where the tests are derived from the knowledge of the software's
structure or internal implementation.

• It is a software testing method in which


the internal structure/implementation
of the application being tested is known
to the tester.
Black Box Testing
• Black Box Testing is a testing of the external behavior of the program,
also known as behavioral testing.
• This testing methodology looks at what
are the available inputs for an
application and what the expected
outputs are, that should result from
each input.

• It is a software testing method in which


the internal structure/implementation
of the application being tested is not
known to the tester.
Importance Of Formal Methods In
Software
• By building a mathematically rigorous model of a complex system, designers can
verify the system’s properties in a more thorough fashion.

• Also use mathematical proof as a complement to system testing so as to ensure


correct behavior.
Formal Methods + Testing = System Correctness

• As systems become more complicated, and safety becomes a more important


issue, the formal approach to system design offers another level of insurance.

• It is very important to note that formal verification does not obviate the need
for testing.
Formal Design Process

• Formal Design Can Be Seen As A Three Step Process:

1. Formal Specification
2. Verification
3. Implementation
Formal Design Process: Formal
Specification
• During the formal specification phase, the engineer rigorously defines
a system using a mathematical modeling language.

• Modeling languages are fixed grammars which allow users to model


complex structures.

• Formal modeling languages are more rigorously defined:


• There is a distinction between WFFs (Well-formed Formulas) and NON-WFFs
(syntactically incorrect statements).
Formal Design Process: Verification
• Building a system using a formal specification, the designer is actually
developing a set of mathematical formulas about his system.

• The formal Verification checks for correctness of the model and its
formulas. Verification is a difficult process, largely because even the
simplest system has several dozen formulas, each of which has to be
proven.

• Even a traditional mathematical proof is a complex affair.


Formal Design Process: Implementation

• Once the model has been specified and verified, it is implemented by


converting the specification into code.
End of Lecture

You might also like