Vienna Development Method SIM5104. one of the longest-established Formal Methods for the development of computer- based systemsFormal Methods Originating.

Slides:



Advertisements
Similar presentations
ML Lists.1 Standard ML Lists. ML Lists.2 Lists  A list is a finite sequence of elements. [3,5,9] ["a", "list" ] []  ML lists are immutable.  Elements.
Advertisements

1 Modelling using sets Sets: The finite set type constructor Value definitions: enumeration, subrange, comprehension Operators on sets Case Study: the.
Chapter 3 DATA: TYPES, CLASSES, AND OBJECTS. Chapter 3 Data Abstraction Abstract data types allow you to work with data without concern for how the data.
Getting started with ML ML is a functional programming language. ML is statically typed: The types of literals, values, expressions and functions in a.
Lambda Calculus and Lisp PZ03J. Lambda Calculus The lambda calculus is a model for functional programming like Turing machines are models for imperative.
ML: a quasi-functional language with strong typing Conventional syntax: - val x = 5; (*user input *) val x = 5: int (*system response*) - fun len lis =
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices
1 Basic elements of a formal model Having explored the logic of VDM-SL, we go on to introduce the main data types and operators of the language. Recall.
Chapter 9 Imperative and object-oriented languages 1.
1 Lecture 1:Modelling in VDM-SL (adapted from Fitzgerald & Larsen, 1998) Deriving a Model The Chemical Plant Alarm System: Requirements Data Types and.
Discrete Mathematics Lecture 4 Harper Langston New York University.
Sets 1.
Sets 1.
Theoretical Computer Science COMP 335 Fall 2004
Sequences for system modelling. At the end of this lecture you should be able to: provide a definition of a VDM sequence; identify situations in which.
Procedure specifications CSE 331. Outline Satisfying a specification; substitutability Stronger and weaker specifications - Comparing by hand - Comparing.
Sequences At the end of this lecture you should be able to: provide a definition of a VDM sequence; utilize and interpret sequence notation; make appropriate.
Sequences At the end of this lecture you should be able to: provide a definition of a VDM sequence; utilize and interpret sequence notation; make appropriate.
1 COSC 4406 Software Engineering COSC 4406 Software Engineering Haibin Zhu, Ph.D. Dept. of Computer Science and mathematics, Nipissing University, 100.
Math 3121 Abstract Algebra I Section 0: Sets. The axiomatic approach to Mathematics The notion of definition - from the text: "It is impossible to define.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Analyzing the Requirements with Formal Specifications Vienna Development Method Specification Language (VDM-SL) Book: Formal Software Development From.
Model-Based Specification CIS 376 Bruce R. Maxim UM-Dearborn.
An Algebra for Composing Access Control Policies (2002) Author: PIERO BONATTI, SABRINA DE CAPITANI DI, PIERANGELA SAMARATI Presenter: Siqing Du Date:
0 REVIEW OF HASKELL A lightening tour in 45 minutes.
Lecture 4 Sequences CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
Formal Methods in SE Lecture 20. Agenda 2  Relations in Z Specification Formal Methods in SE.
An introduction to specification in VDM-SL At the end of this lecture you should be able to: write a formal specification of a system in VDM-SL; correlate.
TIVDM1Modelling ordered collections1 Peter Gorm Larsen.
TIVDM1Modelling ordered collections1 Peter Gorm Larsen.
111 Protocols CS 4311 Wirfs Brock et al., Designing Object-Oriented Software, Prentice Hall, (Chapter 8) Meyer, B., Applying design by contract,
CSC264 Modelling and Computation 10. Modelling State Steve Riddle, John Fitzgerald, Maciej Koutny Computing Science Semester /06.
Introduction to VDM Copyright, 2003 © Jerzy R. Nawrocki Models and Analysis of Software.
Introduction to Z Copyright, 2002 © Jerzy R. Nawrocki Models and Analysis of Software.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
TIVDM1Modelling unordered collections1 Peter Gorm Larsen.
Built-in Data Structures in Python An Introduction.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
Chapter 2: Basic Structures: Sets, Functions, Sequences, and Sums (1)
10. The composite and product types The outline of this part: Composite types Constructing a composite type Constructor Operators Comparison Product types.
An introduction to specification in VDM-SL At the end of this lecture you should be able to: write a formal specification of a system in VDM-SL; correlate.
MATH 224 – Discrete Mathematics
CompSci 102 Discrete Math for Computer Science
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Section 2.1. Section Summary Definition of sets Describing Sets Roster Method Set-Builder Notation Some Important Sets in Mathematics Empty Set and Universal.
Mathematical Preliminaries
Chapter 2 With Question/Answer Animations. Section 2.1.
8. The set types The set types are one of the compound types available in SOFL, and usually used for the abstraction of data items that have a collection.
1 Assertions. 2 A boolean expression or predicate that evaluates to true or false in every state In a program they express constraints on the state that.
Module #10: Proof Strategies Rosen 5 th ed., §3.1 (already covered)
Lecture 1 Data Structures Shafay Shamail September 05, 2006.
1 Modelling using Sequences Sequences The finite sequence constructor Value definitions: enumeration, subsequence Operators on Sequences Case Study: the.
Section 2.1. Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the.
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
“It is impossible to define every concept.” For example a “set” can not be defined. But Here are a list of things we shall simply assume about sets. A.
Functional Programming
Formal Methods in SE Lecture 21.
Types CSCE 314 Spring 2016.
VDM: Vienna Development Method
CS 326 Programming Languages, Concepts and Implementation
A lightening tour in 45 minutes
MATH 224 – Discrete Mathematics
Cardinality of Sets Section 2.5.
Mathematical Background 1
Mathematical Background 1
Sub-system interfaces
Introduction to Computer Science
Terminology and Symbols
Presentation transcript:

Vienna Development Method SIM5104

one of the longest-established Formal Methods for the development of computer- based systemsFormal Methods Originating in work done at IBM's Vienna Laboratory in the 1970s has grown to include a group of techniques and tools based on a formal specification language - the VDM Specification Language (VDM-SL).

VDM features Basic Types: numeric, character, token and quote types –bool, boolean datatype, false, true –nat, natural numbers (including zero)0, 1, 2, 3,… –nat1, natural numbers (excluding zero)1, 2, 3, 4,.. –int, integers,..., -3, -2, -1, 0, 1, 2, 3,... –rat, rational numbers a/b, where a and b are integers, b is not 0 –real, real numbers,... –char, characters, A, B, C,... –token, structureless tokens... –, the quote type containing the value...

VDM features Type Constructors –Union of types T1,...,Tn T1 | T2 |... | Tn –Example : SignalColour = | | | –Cartesian product of types T1,...,Tn T1*T2*...*Tn –Composite (Record) type T :: f1:T1... fn:Tn

The composite or record type is a Cartesian product with labels for the fields. The type T :: f1:A1 f2:A2... fn:An is the Cartesian product with fields labelled f1,…,fn.

For example, the type Date :: day:nat1 month:nat1 year:nat inv mk_Date(d,m,y) == day <=31 and month<=12

Collection The set type constructor (written set of T where T is a predefined type) constructs the type composed of all finite sets of values drawn from the type T. For example, the type definition UGroup = set of UserId

set {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 se is an element of set s e not in set se is not an element of set s s1 union s2Union of sets s1 and s2 s1 inter s2Intersection of sets s1 and s2 dunion sDistributed 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 sThe cardinality of set s s1 \ s2Set difference of sets s1 and s2

Sequence The finite sequence type constructor (written seq of T where T is a predefined type) constructs the type composed of all finite lists of values drawn from the type T. For example, the type definition String = seq of char Defines a type String composed of all finite strings of characters

Operators on sequence [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 sThe head (first element) of s tl sThe tail (remaining sequence after head is removed) of s len sThe length of s elems sThe set of elements of s s(i)The ith element of s s1^s2the sequence formed by concatenating sequences s1 and s2

Finite mapping A finite mapping is a correspondence between two sets, the domain and range, with the domain indexing elements of the range. It is therefore similar to a finite function. The mapping type constructor (written map T1 to T2) where T1 and T2 are predefined types) constructs the type composed of all finite mappings from sets of T1 values to sets of T2 values. For example, the type definition Birthdays = map String to Date Defines a type Birthdays which maps character strings to Date

Operators on mapping {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 mThe domain of m rng mThe 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 ++ m2m1 overwritten by m2

Functional Modelling functions are defined over the data types defined in a model Support for abstraction requires that it should be possible to characterize the result that a function should compute without having to say how it should be computed The main mechanism for doing this is the implicit function definition in which, instead of a formula computing a result, a logical predicate over the input and result variables, termed a postcondition, gives the result's properties For example, a function SQRT for calculating a square root of a natural number might be defined as follows: SQRT(x:nat)r:real post r*r = n

A more constrained function specification is arrived at by strengthening the postcondition. For example the following definition constrains the function to return the positive root. SQRT(x:nat)r:real post r*r = n and r>=0

All function specifications may be restricted by preconditions which are logical predicates over the input variables only and which describe constraints that are assumed to be satisfied when the function is executed. For example, a square root calculating function that works only on positive real numbers might be specified as follows: SQRTP(x:real)r:real pre x >=0 post r*r = n and r>=0 The precondition and postcondition together form a contract that to be satisfied by any program claiming to implement the function

In an explicit function definition, the result is defined by means of an expression over the inputs. For example, a function that produces a list of the squares of a list of numbers might be defined as follows: SqList: seq of nat -> seq of nat SqList(s) == if s = [ ] then [ ] else [(hd s)**2] ^ SqList(tl s)

State-based Modelling functions do not have side-effects such as changing the state of a persistent global variable. This is a useful ability in many programming languages, so a similar concept exists; instead of functions, operations are used to change state variables (AKA globals). For example, if we have a state consisting of a single variable someStateRegister : nat, we could define this as: state Register of someStateRegister : nat end

An operation to load a value into this variable might be specified as: LOAD(i:nat) ext wr someStateRegister:nat post someStateRegister = i The externals clause (ext) specifies which parts of the state can be accessed by the operation; rd indicating read-only access and wr being read/write access

Sometimes it is important to refer to the value of a state before it was modified for example, an operation to add a value to the variable may be specified as: ADD(i:nat) ext wr someStateRegister : nat post someStateRegister = someStateRegister~ + i Where the ~ symbol on the state variable in the postcondition indicates the value of the state variable before execution of the operation.

Queue abstract data type The queue is modelled as a sequence composed of elements of a type Qelt. The representation is Qelt is immaterial and so is defined as a token type. types Qelt = token; Queue = seq of Qelt; state TheQueue of q : Queue end

ENQUEUE(e:Qelt) ext wr q:Queue post q = q~ ^ [e]; DEQUEUE()e:Qelt ext wr q:Queue pre q <> [ ] post q~ = [e]^q; IS-EMPTY()r:bool ext rd q:Queue post r (len q = 0)