Presentation is loading. Please wait.

Presentation is loading. Please wait.

VDM: Vienna Development Method

Similar presentations


Presentation on theme: "VDM: Vienna Development Method"— Presentation transcript:

1 VDM: Vienna Development Method
Originating in work done at IBM's Vienna Laboratory in the 1970s Vienna Definition Language (VDL) used to specify semantics of PL/I Vienna Development Method (VDM) Attempted to cover all of software lifecycle The VDM Specification Language (VDM-SL). Extended form, VDM++, supports the modeling of object-oriented and concurrent systems.

2 Example - Incubator The temperature needs to be carefully controlled and monitored in order to provide the correct conditions for a particular biological experiment to be undertaken. The temperature of the incubator increments or decrements in response to instructions and each time a change of one degree has been achieved, the software is informed of the change, which it duly records. Safety requirements dictate that the temperature of the incubator must never be allowed to rise above 10 C, nor fall below -10  C.

3 UML Specifications IncubatorMonitor temp: integer increment()
decrement() getTemp(): int

4 Specifying the State in VDM-SL
state refers to the permanent data that must be stored by the system, and which can be accessed by means of operations. The state is specified by declaring variables, in a very similar manner to the way that this is done in a programming language variable name and type

5 Intrinsic types available in VDM-SL
Mathematical Notation  : natural numbers (positive whole numbers)  1: natural numbers excluding zero Z: integers (positive and negative whole numbers) R : real numbers (positive and negative numbers that can include a fractional part) B : boolean values (TRUE or FALSE) Char: the set of alphanumeric characters

6 State Definition state IncubatorMonitor of temp : Z end

7 increment() ext wr temp: Z pre temp < 10 post temp = temp + 1

8 deccrement() ext wr temp: Z pre temp > -10 post temp = temp - 1

9 getTemp() currentTemp: Z ext rd temp: Z pre true post temp = currentTemp

10 Declaring Constants values MAX: Z =10 MIN: Z = -10 now we can write pre temp > MIN

11 Specifying a State Invariant
inv mk-IncubatorMonitor(t)  MIN  t  MAX expression mk-IncubatorMonitor(t) is the input to the inv function. This expression is itself a function, and is known as a make function (the mk is pronounced ‘make’).  is read ‘is defined as’

12 Specifying an Initialization Function
init mk-IncubatorMonitor(t)  t = 5

13 Main operations on sets
{a, b, c} Set enumeration: the set of elements a, b and c { x | x:T & P(x)} Set comprehension: the set of x from type T such that P(x) {i, ..., j} The set of integers in the range i to j e in set s e is an element of set s e not in set s e is not an element of set s s1 union s2 Union of sets s1 and s2 s1 inter s2 Intersection of sets s1 and s2 s1 \ s2 Set difference of sets s1 and s2 dunion s Distributed union of set of sets s s1 psubset s2 s1 is a (proper) subset of s2 s1 subset s2 s1 is a (weak) subset of s2 card s The cardinality of set s

14 Main Operators on Sequences (s, s1,s2 are sequences)
[a, b, c] Sequence enumeration: the sequence of elements a, b and c [f(x) | x:T & P(x)] Sequence comprehension: sequence of expressions f(x) for each x of (numeric) type T such that P(x) holds (x values taken in numeric order) hd s The head (first element) of s tl s The tail (remaining sequence after head is removed) of s len s The length of s elems s The set of elements of s s(i) The ith element of s s1^s2 the sequence formed by concatenating sequences s1 and s2

15 Main Operators on Mappings
{a | -> r, b | -> s} Mapping enumeration: a maps to r, b maps to s {x | -> f(x) | x:T & P(x)} Mapping comprehension: x maps to f(x) for all x for type T such that P(x) dom m The domain of m rng m The range of m m(x) m applied to x m1 munion m2 Union of mappings m1 and m2 (m1, m2 must be consistent where they overlap) m1 ++ m2 m1 overwritten by m2


Download ppt "VDM: Vienna Development Method"

Similar presentations


Ads by Google