25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 6. Expressions<br />

all expression = ‘forall’, bind list, ‘&’, expression ;<br />

exists expression = ‘exists’, bind list, ‘&’, expression ;<br />

bind list = multiple bind, { ‘,’, multiple bind } ;<br />

exists unique expression = ‘exists1’, bind, ‘&’, expression ;<br />

Semantics: There are three forms of quantified expressions: universal (written as forall), existential<br />

(written as exists), and unique existential (written as exists1). Each yields a<br />

boolean value true or false, as explained in the following.<br />

The universal quantification has the form:<br />

✞<br />

✡✝<br />

forall mbd1, mbd2, ..., mbdn & e<br />

where each mbdi is a multiple bind pi in set s (or if it is a type bind pi : type),<br />

and e is a boolean expression involving the pattern identifiers of the mbdi’s. It has the value<br />

true if e is true when evaluated in the context of every choice of bindings from mbd1,<br />

mbd2, ..., mbdn and false otherwise.<br />

The existential quantification has the form:<br />

✞<br />

✡✝<br />

exists mbd1, mbd2, ..., mbdn & e<br />

where the mbdi’s and the e are as for a universal quantification. It has the value true if<br />

e is true when evaluated in the context of at least one choice of bindings from mbd1,<br />

mbd2, ..., mbdn, and false otherwise.<br />

The unique existential quantification has the form:<br />

✞<br />

✡✝<br />

exists1 bd & e<br />

where bd is either a set bind or a type bind and e is a boolean expression involving the<br />

pattern identifiers of bd. It has the value true if e is true when evaluated in the context<br />

of exactly one choice of bindings, and false otherwise.<br />

All quantified expressions have the lowest possible precedence. This means that the longest<br />

possible constituent expression is taken. The expression is continued to the right as far as it<br />

is syntactically possible.<br />

Examples: An example of an existential quantification is given in the function shown below,<br />

QualificationOk. This function, taken from the specification of a nuclear tracking<br />

system in [Fitzgerald&98], checks whether a set of experts has a required qualification.<br />

49<br />

✆<br />

✆<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!