SE381-06 (Week 3, lecture 2)
Introduction to Z (continued)
Types of schemas
State schema (review)
Declarations: state variables for the schema
Predicates: invariants (what's an invariant?)
Initialization schema
Typical organization
Declaration: "inclusion" of state schema
Predicate: constraints that (normally) specify a single state
What does the "inclusion" do???
Declarations from "included" schema in effect are inserted "above the line"
Predicates from "included" schema in effect are inserted (ANDed in) "below the line"
Operation schema
Declaration ("above the line")
Included schema(s)
Input variables ("?")
Output variables ("!")
Predicate ("below the line")
Precondition(s)
Operation definition
Constraints on unchanged state values
Wait a minute !!! (see "AddProfessor" example)
What is that "delta" prefix on the included state schema?
A shorthand for two schemas (Schedule and Schedule')
See example handout
Interpreting the two schemas, relative to the operation
Unprimed = "before" state of system
Primed = "after" state of system
Composing operation schemas (simple example of "schema calculus")
Schemas can be combined using logical operators
As in definition of "delta Schedule"
What does this mean?
Horizontal vs vertical format
Horizontal form can be more compact
Now . . .
. . . that you are totally confused . . .
If there is really no time in Z, how do we model software operations that DO take place over time?
Using Z, we can create many copies of a system (schema) state
We can think of these copies as being "before" or "after" certain operations
. . . and we can "string together" these state copies with equality predicates
Requires more schema calculus to express
Supplementary and total operations
Common reason for using schema calculus
Define separate operation schemas
Main one for the "normal" case
Additional ones for alternative or exceptional cases
Combine with logical OR
More on schema calculus later