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 3. Data Type Definitions<br />

Operator Name<br />

Distributes intersection<br />

Finite power set<br />

Semantics Description<br />

the resulting set is the intersection of all the elements<br />

(these are sets themselves) of, i.e. it contains the elements<br />

that are in all the elements/sets of ss. ss must<br />

be non-empty.<br />

yields the power set of s1, i.e. the set of all subsets of<br />

s1.<br />

Examples: Let s1 = {,,,}, s2<br />

= {2, 4, 6, 8, 11} and s3 = {} then:<br />

in set s1 ≡ false<br />

<strong>10</strong> not in set s2 ≡ true<br />

s2 union s3 ≡ {2, 4, 6, 8, 11}<br />

s1 inter s3 ≡ {}<br />

(s2 \ {2,4,8,<strong>10</strong>}) union {2,4,8,<strong>10</strong>} = s2 ≡ false<br />

s1 subset s3 ≡ false<br />

s3 subset s1 ≡ true<br />

s2 psubset s2 ≡ false<br />

s2 s2 union {2, 4} ≡ false<br />

card s2 union {2, 4} ≡ 5<br />

dunion {s2, {2,4}, {4,5,6}, {0,12}} ≡ {0,2,4,5,6,8,11,12}<br />

dinter {s2, {2,4}, {4,5,6}} ≡ {4}<br />

dunion power {2,4} ≡ {2,4}<br />

dinter power {2,4} ≡ {}<br />

3.2.2 Sequence Types<br />

A sequence value is an ordered collection of elements of some type indexed by 1, 2, ..., n;<br />

where n is the length of the sequence. A sequence type is the type of finite sequences of elements<br />

of a type, either including the empty sequence (seq0 type) or excluding it (seq1 type). The elements<br />

of a sequence type can be arbitrarily complex; they could e.g. be sequences themselves.<br />

In the following this convention will be used: A is an arbitrary type, L is a sequence type, S is<br />

a set type, l, l1, l2 are sequence values, ll is a sequence of sequence values. e1, e2 and en<br />

are elements in these sequences, i will be a natural number, P is a predicate and e is an arbitrary<br />

expression.<br />

Syntax:<br />

type = seq type<br />

| . . . ;<br />

seq type = seq0 type<br />

| seq1 type ;<br />

15

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

Saved successfully!

Ooh no, something went wrong!