Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-s9k8s Total loading time: 0 Render date: 2024-10-02T14:22:19.327Z Has data issue: false hasContentIssue false

8 - Elements

Published online by Cambridge University Press:  06 July 2010

Jonathan Jacky
Affiliation:
University of Washington
Get access

Summary

This chapter introduces the three basic constructs that appear everywhere in Z texts: declarations, expressions, and predicates. Declarations, introduce variables. Expressions describe the values that variables might have. Predicates express constraints that determine which values the variables actually do have.

Sets and types, declarations, and variables

The systems that we need to model might contain vast numbers of things. How can we possibly deal with them all? We gather similar objects into collections and treat each collection as a single object in its own right. These collections are called sets. Sets are central in Z.

Displaying sets

The obvious way to describe a set is to list or enumerate all of its members or elements. This is called a set display. In Z we follow the ordinary mathematical convention and write sets with braces, separating elements by commas. Here is a display of the set of lamps in a traffic light:

{red, yellow, green}

Elements in a set are not ordered, so the order you write elements in a set display is not significant. Here is another (equally good) display of the same set:

{yellow, red, green}

Sets contain no duplicate elements, and mentioning the same element more than once is redundant but innocuous.

Type
Chapter
Information
The Way of Z
Practical Programming with Formal Methods
, pp. 63 - 77
Publisher: Cambridge University Press
Print publication year: 1996

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Elements
  • Jonathan Jacky, University of Washington
  • Book: The Way of Z
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574924.011
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Elements
  • Jonathan Jacky, University of Washington
  • Book: The Way of Z
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574924.011
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Elements
  • Jonathan Jacky, University of Washington
  • Book: The Way of Z
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511574924.011
Available formats
×