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

Operator Name Type<br />

dom m Domain (map A to B) → set of A<br />

rng m Range (map A to B) → set of B<br />

m1 munion m2 Merge (map A to B) * (map A to B) → map A to B<br />

m1 ++ m2 Override (map A to B) * (map A to B) → map A to B<br />

merge ms Distributed merge set of (map A to B) → map A to B<br />

s s Range restrict by (map A to B) * (set of B) → map A to B<br />

m(d) Map apply (map A to B) * A → B<br />

m1 comp m2 Map composition (map B to C) * (map A to B) → map A to C<br />

m ** n Map iteration (map A to A) * nat → map A to A<br />

m1 = m2 Equality (map A to B) * (map A to B) → bool<br />

m1 m2 Inequality (map A to B) * (map A to B) → bool<br />

inverse m Map inverse inmap A to B → inmap B to A<br />

Semantics of Operators: Two maps m1 and m2 are compatible if any common element of dom<br />

m1 and dom m2 is mapped to the same value by both maps.<br />

Operator Name Semantics Description<br />

Domain yields the domain (the set of keys) of m.<br />

Range yields the range (the set of information values) of m.<br />

Merge<br />

yields a map combined by m1 and m2 such that the<br />

resulting map maps the elements of dom m1 as does<br />

m1, and the elements of dom m2 as does m2. The<br />

two maps must be compatible.<br />

Override<br />

overrides and merges m1 with m2, i.e. it is like a<br />

merge except that m1 and m2 need not be compatible;<br />

any common elements are mapped as by m2 (so<br />

m2 overrides m1).<br />

Distributed merge yields the map that is constructed by merging all the<br />

maps in ms. The maps in ms must be compatible.<br />

Domain restricted to creates the map consisting of the elements in m whose<br />

key is in s. s need not be a subset of dom m.<br />

Domain restricted creates the map consisting of the elements in m whose<br />

by<br />

key is not in s. s need not be a subset of dom m.<br />

Range restricted to creates the map consisting of the elements in m whose<br />

information value is in s. s need not be a subset of<br />

rng m.<br />

19

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

Saved successfully!

Ooh no, something went wrong!