You are on page 1of 20

FORMAL

METHODS
Lecture 4: Formal Specification

LECTURER: QURATULAIN
DEPARTMENT OF INFORMATION TECHNOLOGY
GOVERNMENT COLLEGE UNIVERSITY FAISALABAD
let me remind you
What was today's topic

Formal Specification
Formal Methods are a particular kind of mathematically based technique for
the Specification, Development and Verification of software and hardware systems.

Specification Development Verification


An act of identifying The process of conceiving, A discipline of software
something precisely or of specifying, designing, programming, engineering whose goal is to
stating a precise requirement. documenting, testing, and bug fixing assure that software fully
involved in creating and maintaining satisfies all the expected
applications, frameworks, or other requirements.
software components.
Specification
FIRST
A detailed description of how something should be done, made, etc.
• All products are made exactly to the
customer's specifications.
• A specification has been drawn up for the new
military aircraft.

Formal Specification
In computer science, formal specifications are
mathematically based techniques whose purpose are to
help with the implementation of systems and software.
They are used to describe a system, to analyze its behavior, and to
aid in its design by verifying key properties of interest through
rigorous and effective reasoning tools.
These specifications are formal in the sense that
they have a syntax, their semantics fall within
one domain, and they are able to be used to infer
Branch of linguistics and logic
concerned with meaning.
‫لسانیات‬
useful information.
Study of language and its structure
This is where normal system specification is use
and translated using a formal language into a
formal specification. Syntax

Semantics

Programmatic
DJI Mavic 2
There are basically two type of formal language;
Model Oriented: Construct a Property Oriented: Use a set of
model of the system behavior necessary properties to describe
using mathematical objects like system behavior, such as axioms
sets, sequences etc. ‫اصول‬, rules etc.
Statecharts, SCR, VDM, Z Algebraic semantics
Petri Nets, CCS, CSP, Temporal logic models.
Automata theoretic models
This is the cheapest way to handle formal method.
In computer science, algebraic semantics is a form of axiomatic semantics based on
algebraic laws for describing and reasoning about program semantics in a formal manner.
Axiomatic semantics Programming semantics
is an approach based on is the field concerned with the rigorous
mathematical logic for proving the ‫ سخت‬mathematical study of the meaning
correctness of computer programs. of programming languages.
The formal specification generally does the following process.

1. Get user requirement usually from the specification written in the natural language.

2. Clarify the requirement using mathematical approach. This is to remove all ambiguous, incomplete and
inconsistent statement.
3. After statements are clearly identified. Then find all assumptions (Things that must be in place before
something can happen) that is state or not stated within the clarified requirement.

4. Then expose every possible logic defect (fault) or omission in the clarified requirement.

5. Identify what are the exceptions (bad things) that will arise if the defects are not corrected.

6. Find a way to test for all the possible each exception. Only when you can test for an exception can you be
able to stop that exception from happening
Conclusion
In computer science, formal specifications are mathematically based techniques whose
purpose are to help with the implementation of systems and software.
These specifications are formal in the sense that they have a syntax, their semantics fall
within one domain, and they are able to be used to infer useful information.
Model Oriented: Construct a Property Oriented: Use a set of
model of the system behavior necessary properties to describe
using mathematical objects like system behavior, such as axioms
sets, sequences etc. ‫اصول‬, rules etc.
Statecharts, SCR, VDM, Z Algebraic semantics
Petri Nets, CCS, CSP, Temporal logic models.
Automata theoretic models
Creating software need not use formal method, having said that, having formal
method imbedded into the SDLC does give the software huge advantages and also a
new set of disadvantages.
Advantages Disadvantages
1. Discovers ambiguity, incompleteness, and 1. Time consuming and expensive.
inconsistency in the software. 2. Difficult to use this model as a communication
2. Offers defect-free software. mechanism for non technical personnel.
3. Incrementally grows in effective solution after 3. Extensive training is required since only few
each iteration. developers have the essential knowledge to
4. This model does not involve high complexity implement this model.
rate.
5. Formal specification language verify self-
consistency.
CRITICAL SYSTEM
A critical system is a system which must be highly reliable and retain
this reliability as they evolve without incurring prohibitive costs.
Critical system essentials
Safety: The system should not A critical system is rarely a single
harm people or the system’s system but is a network of several
environment software-intensive systems as well
Security: The system must be as infrastructure systems
able to protect itself and its data Systems of systems
from malicious use
(SoS)
Availability: The system must be
available to deliver services when
requested to do so
Reliability: The system must
operate without serious failures
Systems of systems (SoS)
System of systems is a collection of task-oriented or
dedicated systems that pool their resources and
capabilities together to create a new, more complex system
which offers more functionality and performance than simply
the sum of the constituent systems.

A critical system is distinguished by the consequences


associated with system or function failure.

Likewise, critical systems are further distinguished between fail-operational and fail safe systems,
according to the tolerance they must exhibit to failures:
Fail-Operational Fail-safe
Typically required to operate not only in Must safely shut down in case of single or
nominal conditions (expected), but also multiple failures.
in degraded situations when some parts
are not working properly. For example, Trains are fail-safe systems
For example, airplanes are fail- because stopping a train is typically
operational because they must be able to sufficient to put into safe state.
fly even if some components fail.
BUSINESS CRITICAL SYSTEM
Business Critical System refers to a system where the honesty and integrity (‫)سالمیت‬
of the business is paramount.
All data kept in the system must be accurate at all times. If a fault is found the entire
process must be stop to allow correction.
• Customer account system in a bank.
• Online shopping cart.
Most government, business and
• Areas where secrecy is required.
manufacturing company that
• Defense.
requires payment are business
critical.
• Secret service.
• Sensitive areas in companies.
• Areas where personal data are administered.
• Police records.
• Administration of data of customers.
• Administration of student marks.
MISSION CRITICAL SYSTEM
Mission Critical System refers to a system where the continuous running of the
system is paramount. Accurate takes a lower priority compare to the running of
the system.
Examples
Auto Teller Machine,
Car ticketing system,
Alarm Systems are mission critical.
SAFETY CRITICAL SYSTEM
Safety Critical System refers to a system where the safety of everyone directly or
indirectly affected by the system is paramount.
Functionality and Accurate takes a lower priority compare to the safety of the users.
Most medical, construction and oil rig systems are safety critical system.
• Medical Devices.
• Aerospace Civil aviation.
• Military aviation.
• Manned space travel Chemical Industry.
• Nuclear Power Stations.
• Traffic control. Railway control system.
• Air traffic control.
• Road traffic control (esp. traffic lights).
• Automotive control systems.
• Other military equipment.
SECURITY CRITICAL SYSTEM
Security critical systems deal with the loss of
sensitive data through theft or accidental loss.
• Credit card numbers.

• Electronic identification numbers, electronic mail


names or addresses, Internet account numbers, or
Internet identification names.

• Medical record

• Contracts
Formal method  converts “Statement it into its mathematical equivalent.

Statement ? A definite or clear expression of something in speech or writing.D


Gives us Information

Ali is smarter then Saqib Ali is taller then Saqib


Is it a Mathematical statement ?

Ambiguous (Neither True or false)


What is a mathematical statement?
Mathematical statement is a sentence which is either
true or false. It may contain words and symbols.
For example ``The square root of 4 is 5" is
a mathematical statement (which is, of course, false).

(Either True or false)


Formal Method Cont.…

“Five is added to a number to give a result of twelve”.


“Five is added to a number to give a result of
twelve”
Replace the words with Numbers and Math's
EXAMPLE symbols.
TRANSLATION Five  5
“Four is less than x” 4 < x
Is added to  +
“The sum of Ten & y”  y + 10 A number  N
“ x multiplied by 22”  22x To give a result of  =
Twelve 
Final Answer: 5+N=12 or N+5=12
A Number is multiplied by 3, and then six is
subtracted to give a result of nine”
Requirement: Replace the words
with Numbers and Math's symbols.
And write down the final answer. Final Answer: 3N-6=9
What is the number ?
1 . Five more then three times a number is twenty-six.
2. The difference between four times a number and seven is five.
3. Six less than five times a number is nine.
4.Seven more then quotient of a number and three is ten.
5. Five less then three times the sum of a number and four is twenty-
two.
Conclusion
Formal Method will also bring to light all different probable perspective
to any given variables and functions that could have been hidden
behind the English language.
• ADVANTAGES & DISADVANTAGES
• CRITICAL SYSTEM
• CRITICAL SYSTEM ESSENTIALS
• FAIL-OPERATIONAL AND FAIL SAFE
• TYPES OF CRITICAL SYSTEM

You might also like