25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 13. Statements<br />

✞<br />

bootSequence : runLevel ==> ()<br />

bootSequence(rl) ==<br />

for all p in set pInit(rl) do<br />

start(p);<br />

✡✝<br />

Alternatively we could use the startlist statement here:<br />

✞<br />

bootSequenceList : runLevel ==> ()<br />

bootSequenceList(rl) ==<br />

startlist(pInit(rl))<br />

✡✝<br />

✆<br />

✆<br />

13.15 The Specification Statement<br />

Syntax: statement = . . .<br />

| specification statement ;<br />

specification statement = ‘[’, implicit operation body, ‘]’ ;<br />

Semantics: The specification statement can be used to describe a desired effect a statement in<br />

terms of a pre- and a post-condition. Thus, it captures the abstraction of a statement, permitting<br />

it to have an abstract (implicit) specification without being forced to an operation<br />

definition. The specification statement is equivalent with the body of an implicitly defined<br />

operation (see section 12). Thus specification statements can not be executed.<br />

Examples: We can use a specification statement to specify a bubble maximum part of a bubble<br />

sort:<br />

✞<br />

Sort2 : () ==> ()<br />

Sort2 () ==<br />

while x < y do<br />

|| (BubbleMin(),<br />

[ext wr l : seq1 of nat<br />

wr y : nat<br />

rd x : nat<br />

pre x < y<br />

post y < y˜ and<br />

permutation(l˜(x,...,y˜),l(x,...,y˜)) and<br />

forall i in set {x,...,y} & l(i) < l(y˜)]<br />

)<br />

✡✝<br />

121<br />

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

Saved successfully!

Ooh no, something went wrong!