0% found this document useful (0 votes)
179 views22 pages

Formal Methods in Software Engineeri

Formal specifications are precise, unambiguous descriptions of a system written in a mathematical notation. They focus on defining a system's operations, states, and transitions using concepts from logic and discrete mathematics. Specifying systems formally helps reduce errors, improve communication between stakeholders, and enable automated analysis. Some common approaches to formal specification include model-based specifications using sets and relations, algebraic specifications defining operations, and state-based specifications describing state transitions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
179 views22 pages

Formal Methods in Software Engineeri

Formal specifications are precise, unambiguous descriptions of a system written in a mathematical notation. They focus on defining a system's operations, states, and transitions using concepts from logic and discrete mathematics. Specifying systems formally helps reduce errors, improve communication between stakeholders, and enable automated analysis. Some common approaches to formal specification include model-based specifications using sets and relations, algebraic specifications defining operations, and state-based specifications describing state transitions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

FORMAL METHODS IN

SOFTWARE ENGINEERI
LECTURE # 02

FORMAL SPECIFICATIONS

INSTRUCTOR: RUBINA SHAHEEN


WHAT IS SPECIFICATION?

• An exact statement of the particular need to be satisfied, or


essential characteristics that a customer requires and which a
vendor must deliver
• Specifications are usually written in a manner that
• enables both parties (and/or an independent certifier) to measure the
degree of conformance

• A software specification is a precise, unambiguous and complete


statement of the requirements of a system (or program or process),
written in such a way that it can be used to predict how the system
will behave
WHAT IS FORMAL SPECIFICATION?

• Focus in this lecture on formal specification languages for


expressing software or computer system models:
• Formal specifications are expressed in a
mathematical notation with precisely defined
vocabulary, syntax and semantics

• Formal specification languages are part of the field of Formal


Methods
SPECIFICATION AND DESIGN

Stages of software specification and its interface with the design process.
FORMAL SPECIFICATION IN
SOFTWARE PROCESS

Formal specifications reveals errors, inconsistencies in informal specifications


FORMAL SPECIFICATION
LANGUAGES
● A formal specification language consists of
– syntax (the notation)
– semantics (the meaning)
– satisfies (relation defining which objects satisfy which notations)
● A formal specification defines
– syntax (signature of the mapping)
– semantics (meaning of the mapping)
– exceptions (undefined/erroneous mappings)
● If sat(syn,sem) then
– syn is a specification of sem
– sem is a specificand of syn
FORMAL SPECIFICATION
LANGUAGES
• Formal specifications are expressed in a mathematical
notation with precisely defined vocabulary, syntax, and
semantics
• Algebraic approach: The system is specified in terms of its
operations and their relationships
• Model-based approach: The system is specified in terms of a
state model that is constructed using mathematical
constructs such as sets and sequences
BASIC SPECIFICATION LANGUAGE TYPES

➊Abstract Model Specifications – defines operations in terms


of well-defined mathematical model
➋Algebraic Specifications – defines operations by a
collection of equivalence relations
➌State Transition Specifications – defines operations in terms
of states and transitions
➍Axiomatic Specifications – defines operations by logical
assertions
FORMAL SPECIFICATION
LANGUAGES
WHAT ARE FORMAL METHODS?

• The use of techniques from logic and discrete mathematics in the


specification, design, and development of software (computer systems)
• Master complexity using abstraction
• Reduce argumentation to a calculation which can be checked by
mechanical means
• Replace reviews with a repeatable analysis
• Can be used at different levels of rigor
Formal methods are part of practical systems engineering, not theoretical
computer science
WHY SPECIFY FORMALLY?

1. Problem specifications are essential for


i. designing,
ii. validating,
iii. documenting,
iv. communicating,
v. reengineering,
vi. Reusing solutions.

2. Formality helps in obtaining higher-quality specifications


within such processes.
3. It also provides the basis for their automated support.
SPECIFY... FOR WHOM?

1. Users with different


1. background,
2. abstractions and
3. languages
• clients,
• domain experts,
• users,
• architects,
• programmers, and
• tools.
ABSTRACTION

• Engineering models omit details that are not relevant to the


purpose of the model.
• The omission of detail not relevant to a model’s purpose is called
abstraction

• The choice of which details to omit is a matter of


engineering skill
RIGOR

• The most important property of a model of a software /


computer system is its suitability for analysis.
• It must be objective (not the opinion of individual
engineers),
• So the modelling language must be rigorously defined:
• little room for disagreement about what a model actually says
• analysis tools reach the same conclusion about its properties
DIFFERENT LEVELS OF RIGOUR

• Level 1: Use of concepts and notation from discrete


mathematics
• Level 2: Use of formalized abstract specification languages
with some mechanized support tools
• Level 3:Verification of the abstract precise specification
• Level 4: Fully formal development process (refinement from
abstract specifications)
VALIDATION TECHNIQUES

• Inspection: organized process of examining the model alongside


domain experts
• Static analysis: automatic checks of syntax and type correctness,
detect unusual features
• Testing: run the model and check the outcome against expectations
• Model checking: search the state space to find states that violate the
properties being checked
• Proof: use a logic to reason symbolically about whole classes of states
at once
CLASSES OF FORMAL METHODS

o Model-based approaches (B,VDM, Z)


• Algebraic approaches (CASL, Act One, Larch, OBJ)
• Transition-based approaches (Statecharts, Promela)
• Process algebras (CSP, CCS)
• Logic-based approaches (TLA, RTL)
• Reactive approaches (Petri nets, SDL, SAO)
• ISO standards for VDM and Z over 100 different ones:
• http://formalmethods.wikia.com/wiki/VL
MODEL-BASED APPROACHES …

• Specify admissible system states (or values) at some


arbitrary snapshot, using mathematical entities like sets,
relations, first order predicate logic (pre-condition/post-
conditions, invariant
• B,Vienna Development Method, Z (pronounced ‘zed’)
• Also called state based approaches
APPLICATIONS OF FORMAL
SPECIFICATIONS
• Examples
• Paris metro line for traffic .
• IBMS Customer Information and Control System (CICS)
• Civil aviation Display information system for UK’s air traffic
management.
• Tektronics, family of oscilloscopes
• Clinical neutron medical system (Washington)
SUMMARY

• Formal Specifications refer to process as well as to a


product.
• It is a language that contains three parts, syntax, semantics
and proof theory.
• It is related to the problem domain.
• Good formal specifications are complete, consistent,
complete, unambiguous and adequate.
• One cannot express a system formally in a sinlge step.
SUMMARY

• It requires a series of steps and refinements.


• Formal specifications are useful for every stakeholder who
is involved directly or indirectly in system development.
• Formal Specifications are used in different applications of
aviation, telecommunication and transportation.
• Their use is being expanded to even design of buildings.
QUESTIONS

You might also like