Community Z Tools HELP


Getting Started

This guide introduces you to using this graphical user interface of the Community Z Tools (CZT). The tutorials in this guide lead you through the process of analysis which includes parsing, type checking and animation of specifications.

Contents

  1. Overview
    1. Introduction
    2. Background
    3. CZT Objectives
    4. Formal Specification
  2. Basic software operations
    1. Opening and Parsing a file (specification)
    2. Specifying the Language and Mark-up to parse a file with
    3. Type-Checking
    4. Exploring the Structure of a Specification
    5. Exporting a file
    6. Closing the workspace
  3. ZLive Animator
  4. Appendix
    1. Supported file Extensions
    2. Running CZT as a commandline tool
    3. Glossary
    4. For more information go to the CZT website at http://czt.sourceforge.net

1. Overview

1.1 Introduction


The Community Z Tools (CZT) project is building a set of tools for editing, typechecking and animating formal specifications written in the Z specification language, with some support for Z extensions such as Object-Z and Circus.

Back to Contents

1.2 Background


(Adapted from Andrew Martin's original CZT proposal)

The Z specification language was adopted as an ISO standard in 2002. It can be used to precisely specify the requirements or behaviour of systems, and analyze that behaviour via proof, animation, test generation etc.

Back to Contents

1.3 CZT Objectives


Our objectives are to encourage interchange between existing Z tools (via a standard XML interchange format for Z), and to provide open-source libraries for building and integrating new Z tools. The software we are building includes:

Back to Contents

1.4 Formal Specification


From Wikipedia (http://en.wikipedia.org/wiki/Formal_specification), the free encyclopedia

''A formal specification is a mathematical description of software or hardware that may be used to develop an implementation. It describes what the system should do, not (necessarily) how the system should do it. Given such a specification, it is possible to use formal verification techniques to demonstrate that a candidate system design is correct with respect to the specification. This has the advantage that incorrect candidate system designs can be revised before a major investment has been made in actually implementing the design. An alternative approach is to use provably correct refinement steps to transform a specification into a design, and ultimately into an actual implementation, that is correct by construction.''

''The Z notation is an example of a leading formal specification language. Others include the Specification Language(VDM-SL) of the Vienna Development Method and the Abstract Machine Notation (AMN) of the B-Method.''

Back to Contents

2. Basic software operations

2.1 Opening and Parsing a file (specification)


Z specifications like programming languages can be parsed and checked for errors, this may include checking for semantics and syntax errors and also during the process of parsing a specification, the contents contained within it can be determined.

From the main window click File, then click Open, a 'Specification' dialog will pop up. Then click "...", an open dialog will pop up, choose the file and click Open, then click OKs to open and parse the file with default settings. Alternatively, you can type in the full path of a file in the Specification text area and click OK.

Back to Contents

2.2 Specifying the Language and Mark-up to parse a file with


Z specifications can be represented and encoded in different ways. There are many different dialects (languages) that the user can choose to write Z specifications in, therefore in order for CZT to parse a specification the user must let CZT know what dialect they are using. Similarly, the user must let CZT know how their specification is encoded (mark-up) so that CZT knows how to decoded it for parsing.

Follow the steps to Opening a file "except" before clicking on OK, click on the Language drop down menu and choose Standard Z, Object Z, Z Rules, or Circus as the language to parse the file with.

By clicking on the Markup drop down menu you can choose Latex, UTF8, UTF16 or XML as the mark-up to parse the file with.

Click OK.

Note: These options are chosen automatically depending on the file extension of the file being opened if it has a common extension. Choosing the wrong encoding may result with errors and/or no Z sections found since CZT is expecting to look for information in one way and the file being represented in another. Files without obvious extensions will not have all options chosen automatically (For example *.zml can be written in any language which cannot be easily determined).

Back to Contents

2.3 Type-Checking


Type-checking is the process of verifying that variable types are compatible in expressions which may use different types to form an expression.

A general example:

{1,3,5} = {(1,3),(1,4)}

This term has type errors since a set of integers cannot be compared to a set of pairs

To perform type-checking, follow the steps to Opening a file except before clicking on OK, make sure the Typecheck? Checkbox is checked. If the box is checked then type-checking will be performed on the specification otherwise the specification would not be type-checked.

Back to Contents

2.4 Exploring the Structure of a Specification


Once a specification has been opened and parsed, the structure of the specification is displayed in a tree format on the Specification Structure Explorer panel allowing the user to inspect the sections and paragraphs contained in the specification by expanding or collapsing the tree.

Back to Contents

2.5 Exporting a file


The goal of providing different mark-ups for Z specifications is to make it easier for tools to exchange annotated specifications. For example, a specification might be parsed and typechecked by one tool, then passed to another tool (in XML format) which expands schema calculus and puts predicates into disjunctive normal form, then passed to another tool (in XML format) which generates test cases from each disjunct. The XML format is simply a textual representation of the annotated syntax tree of the Z specification.

From the main window click File, then click Export to, then click Latex, Unicode8, Unicode16 or XML to export to the preferred mark-up. Then a save dialog will pop up requesting a file name (a suggested file name will be provided) and once a file name is entered click Save.

Note: The user can use any file extension when exporting, the resulting file will remain as the mark-up the user chose to export to in the first place.

Back to Contents

2.6 Closing the workspace


Closing the workspace will give the user the interface CZT initially starts with, this includes clearing the Specification Structure Explorer and clearing the Output area.

From the main window click File, then click Close

Back to Contents

3. ZLive Animator

ZLive is an animator for evaluating Z expressions, predicates and schemas. It can be used to execute some schemas, to test that given values satisfy a schema, or to generate all solutions of a set or schema.

There are two ways to run ZLive, one of which is ZLiveDefault and can be run independently but commands are limited to general commands which do not correspond to a specification and the other way is to run the ZLive Animator which requires the user to open a specification before it can be run.

To run ZLiveDefault, click Animate then click Start ZLive Default

To run ZLive Animator, click Animate then click Start ZLive Animator with and choose a section to animate

Interaction with ZLive animation is done through the ''Output'' window

For a full list of commands type "help" on the ZLive prompt

Note: Running the ZLive Animator causes the current specification to be parsed again. Also the ZLive Animator can be similarly started by ZLiveDefault by loading a specification from it and setting the section.

Back to Contents

4. Appendix

4.1 Supported file Extensions


In general, CZT supports all types of files with any kind of extension as long as it contains content that can be read as Z specifications. The most common CZT associated file extensions are:

Extension Language Mark-up
zed Standard Z Latex
zed8 Standard Z Unicode (UTF8)
zed16 Standard Z Unicode (UTF16)
oz Object Z Latex
oz8 Object Z Unicode (UTF8)
oz16 Object Z Unicode (UTF16)
Circus Circus Latex
Circus8 Circus Unicode (UTF8)
Circus16 Circus Unicode (UTF16)
zedpatt Z Rules Latex
zedpatt8 Z Rules Unicode (UTF8)
zedpatt16 Z Rules Unicode (UTF16)
tex Standard Z Latex
zml [Undefined] XML

When browsing for a file you can filter out files with uncommon extensions by clicking on the Files of Type drop down menu and select Common CZT files or specify it to display All Files (does not display hidden files). This can be useful when your specification files are mixed in a folder with files of other types

Back to Contents

4.2 Running CZT as a command line tool


CZT was originally developed for commandline and required users to enter specific commands into the commandline for desired outcomes

The jar file CZT_HOME/lib/czt.jar can be executed and used as a command line tool by calling

java -jar czt.jar

followed by arguments. Calling it without arguments invokes the CZT graphical user interface. The command line tool can be used in two different ways.

Firstly, it can be called with the file name as argument, preceded by optional flags. This file is then parsed and typechecked and errors, if present, are reported. By specifying an output file using the -o flag, a specification can be translated into a different mark-up. The mark-up of a file (input or output) is determined by its file ending. For example, to translate a file in LaTeX mark-up into Unicode, call

java -jar czt.jar -o file.utf8 file.tex

See the usage information to get a list of supported mark-ups and file endings. There are other various flags that control the parsing behaviour; see the usage message to get more information about those.

Secondly, the command line tool can be used to call other CZT tools like, for example, the Z animator ZLive. This is done by giving the name of the CZT tool as first argument followed by the arguments for the selected tool. For example, the animator is started using

java -jar czt.jar zlive

For more help, type "-help" without quotes as the argument when starting CZT

Back to Contents

4.3 Glossary


Language many different languages can be used to construct Z specifications some of which are Standard Z, Object Z, Circus and Z Rules.

Mark-up is a way of representing the same information in a different format. For example, a specification written in LaTeX can also be represented in XML.

Paragraph a Z construct which defines names and constants

Section contains paragraphs and can have parents that are in separate files

Specification see Formal Specification

Back to Contents