\documentclass[letterpaper,11pt]{article}
\usepackage[hmargin=1.0in,vmargin=1.0in,headheight=18pt]
           {geometry}
\usepackage{z-eves}
\usepackage{color}
\begin{document}
\title{Faculty Schedule System (Version 0.1 - 2003)}
\author{Mark Sebern}
\maketitle
\section{Introduction}
The faculty schedule system maintains schedule information for an academic term.
It keeps track of teaching assignments (professors assigned to each course section).

The basic elements in the schedule system include professors, courses, sections, 
and academic departments.
\begin{zed}
[PROF, COURSE, SECTION]\\
\end{zed}
\begin{zed}
DEPT::=AEBC | BUS | EECS | GS | MATH | ME | NUR | PC
\end{zed}

\begin{quote}
\sffamily
\small
\centerline{Note}
\marginpar{$\Longleftarrow$}
Although it may not be necessary in this example specification,
it is possible to declare
variables that represent specific instances of these types.
This can be done with a Z axiomatic description.
\begin{axdef}
se381 : COURSE \\
jones, smith : PROF
\end{axdef}

Variable names in Z are case-sensitive.
They may contain alphanumeric characters, punctuation marks,
Greek letters, and some pictorial symbols.
Some of the non-alphanumeric characters have conventional
meanings.

At times, it may be helpful to define sets with elements of a
certain type.

\begin{axdef}
SEcourses : \power COURSE \\
CEcourses : \power COURSE
\end{axdef}

Sets like these can also be used in variable declarations.

\begin{axdef}
se283 : SEcourses \\
ee210 : CEcourses
\end{axdef}

In the declarations just above, the type of $se283$ and $ee210$
is $COURSE$ and there are implicit predicates that require
their values to be members of the sets $SEcourses$ and
$CEcourses$, respectively. The declarations could be
\underline{normalized} by making these facts explicit.

\begin{axdef}
se283 : COURSE \\
ee210 : COURSE
\where
se283 \in SEcourses \\
ee210 \in CEcourses
\end{axdef}

An axiomatic description with a predicate can also be used
to declare a variable that represents the maximum size of a
class section.
\begin{axdef}
max\_section\_size : \nat
\where
max\_section\_size \leq 100
\end{axdef}

Note that this declaration of $max\_section\_size$ means that it can
take on \underline{one} value between 0 and 100.
(If zero is not a reasonable value, the declaration above could
be modified by adding another predicate.)
\end{quote}

\section{State schema for the schedule}

A schedule keeps track of the basic elements described above.
A course has zero or more sections associated with it.
Note that each section is associated with exactly one course.
Professors are assigned to teach course sections.

Here is the state schema for the schedule system.
It consists of declarations of the various state variables
(including functions) and the predicates that specify the
system invariants.
\begin{schema}{Schedule}
profs : \power PROF \\
courses : \power COURSE \\
sections : \power SECTION \\
prof\_dept : PROF \pfun DEPT \\
course\_sections : SECTION \pfun COURSE \\
assigned\_sections : PROF \rel SECTION
\where
\dom prof\_dept = profs \\
\dom course\_sections = sections \\
\ran course\_sections \subseteq courses \\
\dom assigned\_sections \subseteq profs \\
\ran assigned\_sections \subseteq sections
\end{schema}

\section{Initialization schema}
Initially, the schedule system has no professors, courses, or sections.
\begin{schema}{Init}
Schedule
\where
profs = \emptyset \\
courses = \emptyset \\
sections = \emptyset \\
prof\_dept = \emptyset \\
course\_sections = \emptyset \\
assigned\_sections = \emptyset
\end{schema}

\section{Operations involving professors}
Professors may be added to or deleted from the schedule.

\subsection{Adding a professor}
Adding a professor to the schedule is pretty simple.
The schedule's courses and sections are unaffected.
\begin{schema}{AddProfessor}
\Delta Schedule \\
prof? : PROF \\
dept? : DEPT
\where
prof? \notin profs \also
profs' = profs \cup \{prof?\} \\
prof\_dept' = prof\_dept \cup \{prof? \mapsto dept?\} \also
courses' = courses \\
sections' = sections \\
course\_sections' = course\_sections \\
assigned\_sections' = assigned\_sections \\
\end{schema}

\begin{quote}
\sffamily
\small
\centerline{Note}
\marginpar{$\Longleftarrow$}
The $\Delta Schedule$ notation above is shorthand
for a schema definition that can be written in one of two ways.

\begin{zed}
\Delta Schedule \defs Schedule \land Schedule'
\end{zed}

\begin{schema}{\Delta Schedule}
Schedule \\
Schedule'
\end{schema}

The decoration apostrophe in $Schedule'$ is propagated to the state
variables inside the $Schedule$ schema.

\end{quote}


\subsection{Deleting a professor}
Deleting a professor from the schedule removes all section assignments for that professor. The operation precondition is that the professor must be in the system.
Courses and course sections are not affected.
\begin{schema}{DeleteProfessor}
\Delta Schedule \\
prof? : PROF
\where
prof? \in profs \also
profs' = profs \setminus \{prof?\} \\
prof\_dept' = \{prof?\} \ndres prof\_dept \\
assigned\_sections' = \{prof?\} \ndres assigned\_sections \also
courses' = courses \\
sections' = sections \\
course\_sections' = course\_sections
\end{schema}

\end{document}

