You are on page 1of 2

10 Formal Specification with Z

The language Z is one example of a formal specification language. It is widely known, supported by an
ISO standard, and conceptually simple, allowing us to examine some of the core ideas of formal software
specifications. Z is a state-based specification language, where legal system states are defined through
pre-conditions, post-conditions and invariants. It is based on mathematical foundations from predicate
logic, set theory, functions, and relations. Complex systems can be decomposed into individual schemas,
which are then combined to form the complete specification through Zs import mechanism. Z is also
supported by a number of tools for creating and formally verifying a specification, which will be discussed
in the quality assurance lecture. 10.1

Key Points
State-based Specification
Z is a well-known formal specification language
model-based specification
describe legal system states through pre-/post-conditions and invariants
mathematical foundations are (typed) sets, relations, and functions; as well as first-order predicate
logic and lambda calculus
ISO Standard (2002) 13568
10.2

Learning Objectives
Learning Objective 1:
Learn core ideas of a formal software specification language
Review foundations from set theory, functions, and relations
Understand how to read a Z specification
Learn how to specify (simple) systems in Z

Learning Objective 2:
Understand how to specify a systems state with a Z data schema
Understand the Z import mechanism for schemas
Understand how system operations are modeled with Z operation schemas
Understand how to strengthen specifications for robust operations
Learn how to combine Z schemas for complex systems

Notes and Further Reading


The van Lamsweerde textbook provides a brief introduction to Z in [4, Chapter 4.4.3], but for a more
detailed description it is recommended you review [2, Chapter 1: Tutorial Introduction]. A handy print-
your-own tri-fold Z reference card is available at [3].

Reading Material
Required
[4, Chapter 4.4.3]

Supplemental
[3] (Z Reference Card)
[2, Chapter 1: Tutorial Introduction]
[1, The Community Z Tools (CZT) project]
10.7

10-1
10-2 Bibliography

Bibliography
[1] The Community Z Tools (CZT) project. http://czt.sourceforge.net.
[2] J. M. Spivey. The Z Notation: A Reference Manual. Prentice Hall, second edition, 1992. http:
//spivey.oriel.ox.ac.uk/mike/zrm/index.html.
[3] Mike Spivey. Z Reference Card. http://spivey.oriel.ox.ac.uk/mike/fuzz/refcard-3up.pdf.
[4] Axel van Lamsweerde. Requirements Engineering: From System Goals to UML Models to Software
Specifications. John Wiley & Sons, 2009.

Study Questions
1. Explain the core features of a Z specification.
2. What is meant by the statement that Z provides state-based specifications?
3. What are the benefits of using Z for software specifications?
4. What are the downsides of using Z for software specifications?
5. In an operation schema, what happens when a precondition is not satisfied? What can you say about
the systems state in this case?
6. How are complex systems specified in Z?
7. Why are we interested in the least restrictive precondition and the most complete postcondition?
Illustrate the problems that arise when this is not done using examples based on the BirthdayBook
specification.
8. What is meant by robust operations when strengthening a specification? How is it done in Z?
9. Are Z specifications covering functional or non-functional requirements? Explain.
10. What are the issues when you want to design&implement a system based on a Z specification?
Could this be done automatically?

SOEN 6481 Lecture Notes, Winter 2015/16

You might also like