Skip to main content Accessibility help
×
Hostname: page-component-7bb8b95d7b-wpx69 Total loading time: 0 Render date: 2024-09-30T07:17:22.608Z Has data issue: false hasContentIssue false

2 - State constraints

Published online by Cambridge University Press:  03 September 2009

J. C. Huang
Affiliation:
University of Houston
Get access

Summary

Consider a restrictive clause of this form:

The program state at this point must satisfy predicate C, or else the program becomes undefined.

By program state here we mean the aggregate of values assumed by all variables involved. Because this clause constrains the states assumable by the program, it is called a state constraint, or a constraint for short, and is denoted by /\C.

State constraints are designed to be inserted into a program to create another program. For instance, given a program of the form of Program 2.1, a new program can be created, as shown in Program 2.2.

Program 2.1

S1; S2.

Program 2.2

S1; /\C; S2.

Program 2.2 is said to be created from Program 2.1 by constraining the program states to C prior to execution of S2. Intuitively, 2.2 is a subprogram of 2.1 because its definition is that of 2.1 restricted to C. Within that restriction, 2.2 performs the same computation as 2.1.

A state constraint is a semantic modifier. The meaning of a program modified by a state constraint can be formally defined in terms of Dijkstra's (1976) weakest precondition as follows. Let S be a programming construct and C be a predicate, then for any postcondition R,

Axiom 2.3

wp(/\C;S, R) ≡ C ⋀ wp(S, R).

Of course a constraint can also be inserted after a program.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2007

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.

  • State constraints
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.003
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.

  • State constraints
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.003
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.

  • State constraints
  • J. C. Huang, University of Houston
  • Book: Path-Oriented Program Analysis
  • Online publication: 03 September 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511546990.003
Available formats
×