0% found this document useful (0 votes)
57 views25 pages

VDM-SL Data & Compund Type

This document discusses data types and compound types in VDM-SL. It describes the basic data types including Boolean, numeric, character, and quote types. It also covers compound types such as sets, sequences, maps, and how they model collections of values. Finally, it mentions type constructors that are used to build new structured data types from the basic types through operations like union of types and Cartesian products.

Uploaded by

Saad Choudry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views25 pages

VDM-SL Data & Compund Type

This document discusses data types and compound types in VDM-SL. It describes the basic data types including Boolean, numeric, character, and quote types. It also covers compound types such as sets, sequences, maps, and how they model collections of values. Finally, it mentions type constructors that are used to build new structured data types from the basic types through operations like union of types and Cartesian products.

Uploaded by

Saad Choudry
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

VDM-SL

Data Types &


Compound Types
REHMAT ULLAH
VDM

As in traditional programming languages it is possible to define data types in the


VDM languages and give them appropriate names. Such an equation might look
like:
Basic Data Types

► The Boolean Type

► The Numeric Types

► The Character Type

► The Quote Type


The Boolean Type
The Boolean Type
The Numeric Types

There are five basic numeric types: positive naturals, naturals,


integers, rationals and reals.
The Numeric Types
The Character Type

► The character type contains all the single character elements of


the VDM character set
The Quote Type

► The quote type corresponds to enumerated types in a programming language


like Pascal. However, instead of writing the different quote literals between
curly brackets in VDM it is done by letting a quote type consist of a single
quote literal and then let them be a part of a union type.
Compound Types

Collection types model groups of values.

► Sets are finite unordered collections in which duplication between values is


suppressed.

► Sequences are finite ordered collections (lists) in which duplication may occur

► Mappings represent finite correspondences between two sets of values.


Set Types

► A set is an unordered collection of values, all of the same type5, which is


treated as a whole. All sets in VDM languages are finite, i.e. they contain
only a finite number of elements.
Set Types
Sequence Types

A sequence value is an ordered collection of elements of some type indexed


by1, 2, ..., n; where n is the length of the sequence.
Sequence Types
Sequence Types
Map Types

A map value can be thought of as an unordered collection of pairs. The first


element in each pair is called a key, because it can be used as a key to get the
second element(called the information part) in that pair.
All key elements in a map must therefore be unique. The set of all key elements is
called the domain of the map

while the set of all information values is called the range of the map.
Map Types
Mapping
Mapping
Type Constructors

► The basic types alone are of limited value. New, more


structured data types are built using type constructors.
Union of types
Cartesian product types
Composite Type

An element of type T can be composed from its constituent parts by a


constructor, written mk_T.
Conversely, given an element of type T, the field names can be used to select
the named component. For example, the type
State-based Modelling
State-based Modelling

You might also like