Next: About this document ...
Course Project
CpSc 828: LightWeight Formal Methods
Computer Science Department
Clemson University
Brian Malloy
Writing Specifications using Z
April 4, 2002
In order to receive credit for this assignment, you must submit
your latex source file by email by 9 AM on Thursday,
Apr 18th, 2002.
Presentations of the projects will begin on Thursday, April 18th
and will likely continue through April 23rd.
You must choose one of the projects below. I would
like to have the choices somewhat evenly distributed; so
please send me an email once you have made your selection
and I will let you know if it's okay.
You must write a Z specification that has been checked by fuzz
and found to be syntactically correct. Your spec should be
in latex format and you must submit the latex source.
Your specification must include proper comments, explaining
each Z specification,
Your spec should begin by providing an overview of your
specification, including the kinds of items
in the system and the operations that will be permitted
on the items. This overview
should be an introduction to your spec and should
be understandable to a reader who has never met you
and does not know what you're doing. I would like
to make your specifications available on my web page
so that newcomers to Z might find your work helpful.
Your specifiation should begin by specifying
the types and free variables that you will use in your
specification.
You should also describe the state
of the system and, where applicable,
the initial state of the system.
You may work in groups of size one or two. You must either choose
one of the projects listed below, or suggest a project of your
own and have it approved by me. Simply email me with your
suggestion and I will get back to you asap.
I have tried to express the projects below as unuequivocally
as possible; if you have questions, please send me email.
Please choose one of the following:
- On my web page for this course, you will find a Z specification
for a Stack, expressed from first principles. That is,
the specification for Stack uses the notion of a function or mapping
from the natural numbers to Elements,
rather than a data structure from the Z Math Toolkit, such as
sequence or bag.
Study the Z specification and notice that the operations
IsEmpty, Leave and Join provide a common
interface that may be applied to a Stack, a Queue, or
a PriorityQueue.
Please provide a Z specification for Queue and
PriorityQueue from first principles,
so that the interface is the same
for all three data structures. You may use the Stack
specification as a model for the Queue and
PriorityQueue. Using a common interface for all three
data structures will provide an opportunity
for you to compare and contrast the three structures.
- Provide a Z specification for Stack, Queue and
PriorityQueue using a sequence from the Z Math Toolkit.
Use the same interface
for each data structure, including operations for
IsEmpty, Leave and Join to provide a common
interface.
Be sure to specify, in your narrative, whether or not the
structures are generic or work on Element.
- We have discussed a Z specification for a FishGame that
included operations to CatchAFish, FreeSomeFish,
StockThePond and GetFishCount.
Modify this specification to allow upto three players in
the game. Your FishGame should maintain a ``list'' of the players
ordered by the number of fish that each player has caught;
use either a sequence to implement your list, or implement
the list from first principles, as in #1 above.
Include an operation in your game that returns the player
who has caught the most fish.
- Write a Z specification for a movie store that rents
movies in DVD format. Your specification should maintain
a ``list'' of customers, and should permit operations
such as renting a movie, returning a movie,
and finding
the number of movies that are currently being rented as
well as the number of movies available for rental.
Since a movie store can have more than one copy of a movie,
you should use a bag from the Math Toolkit.
- Write a Z specification for a binary tree, including operations
IsEmpty, Leave, Join and find. You may
either use first principles, or one of the structures in
the Z toolkit. (Note: there is a Z specification for a binary
tree in the Spivey reference manual in section 3.9).
Next: About this document ...
Brian Malloy
2002-04-04