Writing Specifications
An individual assignment
CS 420 - Spring 2005 - Ms. Katz

Due: beginning of class, Monday, March 28th

Goals
- to practice writing precise specifications
- to use various specifications techniques on a single problem
- to write an algebraic specification for an abstract data type

Overview
On the mid-term, you considered behavioral specifications of the process of pre-registering for classes at Millersville. For this assignment, you'll consider that process more closely and apply various specifications techniques to do so.

You'll also write algebraic specifications for a queue.

You'll turn in paper for this assignment. The pictures and answers may be handwritten as long as they are legible.

Details of the Pre-registration Portion
Consider the task of pre-registering for classes at Millersville. This is something you have done many times. To pre-register, you need to refer to and obtain various pieces of information. Some actions must occur in a specific order. There are timing dependencies.

Your task is to use many of the specification techniques we've studied to explain how to pre-register. Your intended audience is a new student who understands the specification techniques but not pre-registration. You are writing specifications of what not how. You should deliver:

Algebraic Specifications for Queue
I expect you to do your own work on this part (as well as the other parts), but I realize that you can find help for this part out on the web. Note that you'll need to wade through different terminology. Even the text's terminology is more involved than what we're using and assumes an existing container algebra for the queue on p. 245. David Stotts's ADT page at http://www.cs.unc.edu/~stotts/COMP204/senotes/L06.html has the syntax of a queue (and other examples) in similar notation to what we're using. He doesn't have the axioms.

(25 pts) Using the stack and set examples as references, give an algebraic specification for a queue of items of some type. Give both the syntax and the axioms. All items in a queue are the same type (sort). The stack was last-in-first-out, but a queue is first-in-first-out. The operations should be NEW, BACK (which places an item on the back of the queue), FRONT (which inquires about the front item but doesn't remove it), REMOVE (which returns a queue minus the front item), and EMPTY. Note that you might need to use an if-then-else approach to define some of the axioms for queue.

For example, if in the stack you wanted to define a REPLACE operation, you might have
    REPLACE(stk, itm) = if EMPTY(stk) then error else PUSH(POP(stk), itm)
Think of different ways of having the same result. Consider the empty and error cases. Draw pictures for yourself.

Collaboration
This assignment is to be completed on your own. It is NOT a group assignment. I've tried to make it focussed enough to make it straightforward.