2. Aims
• Present the concept of Formalspecifications
• Present the concept for Zlanguage
3. Objectives
• Haveaclear understanding of Formalspecifications
• Haveaclear understanding for Z– ZEDLanguage
• Understand, read and interpret Formalspecifications
3
4. What is a formal specification?
4
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Formal Specification
mathematical description of software or
hardware that may be used to develop an
implementation.
Uses mathematical notation to describe in
a precise way the properties which an
information system must have
5. FORMAL METHODS
5
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
Techniques based upon mathematics can be
used at every stage of software development.
Why mathematics?
abstraction vs confusion
precision vs ambiguity
reason vs doubt
Programming Language vs Mathematics
6. Benefits of Using formal Specification
6
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
7. Benefits of Using formal Specification
7
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
8. Structure of a Formal specification language
8
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
9. Z Notation
9
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
The Z notation
universally pronounced zed, named after
Zermelo-Fränkel set theory
is a formal specification language used for
describing and modeling computing systems.
10. Z Notation
The Z Notation represents;
•a mathematical language of logic, sets, and relations;
•a schema language of patterns and objects;
•a theory of refinement between abstract data types.
10
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
11. Formal verification
11
Prof.Dr. Bekim Fetaj
The act of proving or disproving the correctness of
a system with respect to a certain formal
specification or property, using formal methods of
mathematics.
The verification of these systems is done by
providing a formal proof on an abstract
mathematical model of the system, the
correspondance between the mathematical model
and the nature of the system being otherwise
known by construction.
12. Refinement
12
Prof.Dr. Bekim Fetaji
The verifiable transformation of an abstract (high-level) formal
specification into a concrete executable program.
Stepwise refinement allows this process to be done in
stages. Logically, refinement normally involves implication,
but there can be additional complications.
Data refinement is used to convert an abstract data model
(in terms of sets for example) into implementable data
structures (such as arrays).
Operation refinement converts a specification of an
operation on a system into an implementable program (e.g.,
a procedure).
27. FUNCTIONS IN ZED
Partial function: if for each x there is a description (mapping) of y
Total function, if also for each x, there is some y;
27
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
with xR® y
28. FUNCTIONS IN ZED
Injective function
А function f is said to be injective (one-to-one) if it maps distinct x in the
domain to distinct y in the codomain, such that f(x) = y.
Domain Range (codomain)
28
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
29. FUNCTIONS IN ZED
Surjective function
А function f is said to be surjective (onto) if its values span its whole codomain;
that is, for every y in the codomain, there is at least one x in the domain such that
f(x) = y.
Domain Range (codomain)
29
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
30. FUNCTIONS IN ZED
Bijective function
Bijective function is a function f (Injective and surjective at the same time)
from a set X to a set Y with the property that, for every y in Y, there is exactly
one x in X such that f(x) = y.
Domain Range (codomain)
30
Prof.Dr. Bekim Fetaji (b.fetaji@seeu.edu.mk)
57. FUNCTIONS IN ZED
Partial function:if for each x there is adescription (mapping) of y
Totalfunction,if also for each x, there is somey;
1
1
1
1
Prof.Dr. BekimFetaji(b.fetaji@seeu.edu.mk)
with xR®y