0% found this document useful (0 votes)
77 views

Assignment 4 - FM

The document provides instructions for two assignments on designing systems in Z specification language. The first assignment asks students to design a simple document control system to prevent conflicts when multiple users are editing the same file. The second assignment is to design a library system in Z that allows users to check out and return books, add or remove book copies, and find books by author or subject as well as books checked out by a specific borrower. The document defines basic types like Book, Copy, Person and sets of authors and subjects that could be used in the specifications.

Uploaded by

Humza Zahid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

Assignment 4 - FM

The document provides instructions for two assignments on designing systems in Z specification language. The first assignment asks students to design a simple document control system to prevent conflicts when multiple users are editing the same file. The second assignment is to design a library system in Z that allows users to check out and return books, add or remove book copies, and find books by author or subject as well as books checked out by a specific borrower. The document defines basic types like Book, Copy, Person and sets of authors and subjects that could be used in the specifications.

Uploaded by

Humza Zahid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

* Ê* ~ Bahria University

jT \MA

x
Discovering Knowledge

4
-
V

ASSIGNMENT 4 [CLO 3]
TOPICS:
 Z Specification

INSTRUCTIONS:
 Max Number of Students in a Group: 2
 Deadline: 30 December,2019
 Marks will be deducted for late submission

QUESTION # 1

DOCUMENT CONTROL SYSTEM

Design a simple document control system in Z. People who work together need to
share their work, but there are many opportunities for misunderstandings and
confusion.

Errors can be introduced when two people working on the same thing a file of
program code, for example make changes that conflict with each other. We can enlist
the computer to help prevent such errors: this is the purpose of a document control
system.

Here is an excerpt from the informal description:

 If a user wants to check out a document in order to change the document and
the user has the permission to change it, and nobody else is changing it at the
moment, then that user may check the document out.
 As soon as a user has checked out a document for editing everyone else is
disallowed from checking it out (of course people with read permission can
read it).
 When the user is done editing the document, it should be checked in, allowing
another user to check it out.
Introduce two basic sets that hold everything of interest in this universe, namely
people and documents: [PERSON, DOCUMENT]

QUESTION # 2

WING’S LIBRARY PROBLEM

Design a library system in Z. Consider a small library database with the following
transactions:

1. Checkout a copy of a book. Return a copy of a book.


2. Add a copy of a book to the library. Remove a copy of a book from the
library.
3. Give the list of books by a particular author or in a particular subject area.
4. Find out the list of books currently checked out by a particular borrower.
5. Find out what borrower last checked out a particular copy of a book.

There are two types of users:

 Staff Users
 Ordinary Borrower

Transactions 1, 2, 4 & 5 are restricted to staff users, except that ordinary borrowers
can perform transaction 4 to find out the list of books currently borrowed by
themselves. The database must also satisfy the following constraints:

1. All copies in the library must be available for check-out or be checked out.
2. No copy of a book may be both available & checked out at the same time.
3. A borrower may not have more than a predefined number of books checked
out at one time.

Basic Types & User-defined Sets

This specification makes use of the following basic types:

[Book, Copy, Person, Author, Subject]

Book: The type Book is the set of all possible books.

Copy: Copy is the type of all possible copies of books.

Person: The type Person is the set of all possible people.


Author: The type Author is the set of all possible authors.

Subject: Subject is the type of all conceivable subjects, that is to say, the things
that books can be about.

IMPORTANT:

The type Author & Person are distinguished because some books are considered to
have been written by institutions. Some manuals & standards fall in this category.

MESSAGES

We also need a set of all necessary messages. It is defined by the enumeration like this
(few examples are included as sample):

Report::=’Okay’

| ‘Unauthorized requestor’

| ‘Not registered’

| ‘Copy checked out’

You might also like