<<

International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181

Vol. 1 Issue 4, June - 2012

Analysis of Three -Z, B and VDM

Dr.(Mrs.) Arvinder Kaur Ms.Samridhi Gulati Ms. Sarita Singh Associate Professor, M.Tech. Student M.Tech. Student University School of University School of University School of Information & Communication Information & Communication Information & Communication Technology, Technology, Technology, Guru Gobind Singh Guru Gobind Singh Guru Gobind Singh Indraprastha University, Indraprastha University, Indraprastha University, Dwarka, Sector-16C, Dwarka, Sector-16C, Dwarka, Sector-16C, Delhi, India Delhi, India Delhi, India

Abstract

Formal methods provide a much needed solid foundation for the ‘art’ of programming 2. Formal Specification Languages computers. Formal specifications can be used to This section describes an overview of formal provide an unambiguous and consistent supplement to specification languages. natural language descriptions and can be rigorously validated and verified leading to the early detection of The representation used in formal methods is called specification errors. Most of the software is delivered a formal . The language is with some bugs, with lack of complete functionality and “formal” in the sense that it has a formal semantics and sometimes with cost overrun. Formal methods can be a as a result can be used to express specifications in a silver bullet for software industry for solving these clear and unambiguous manner. A formal specification problems. This paper compares and contrasts the language can be used to specify the task at hand in a strengths and weaknesses of the model oriented formal clear and concise manner. As formal methods and specification languages such as Z, B and Vienna formal specification language has sound mathematical Development Method (VDM) basis of various factors. basis, it provides the means of proving that specification is realizable, complete, consistent and unambiguous. Even the most complex systems can be 1. Introduction modeled using relatively simple mathematical objects, Formal methods are mathematically based such as sets, relations and functions [1]. techniques that can be applied throughout the A formal specification language is usually development of a system to precisely describe a system composed of three primary components or in and involve the use of techniques and proof mathematical term we can say that it consists of two obligation at each stage to ensure the correctness, sets syntax and semantics and a set of relation. [1] completeness and consistency of specification. The formal specification languages are based on set theory The specific notation with which specification is and first order predicate calculus, but this mathematical represented is defined by syntactic domain or syntax. background was initially not fully formalized.[1] Formal techniques can have considerably different In this paper we describe formal specification semantic domain. Semantics helps to define a “universe language and different formal specification styles in of objects” that will be used to describe the system. Set Section 2. In Section 3, Z, B and VDM are compared of relations defines the rules that indicate which objects on the basis of factors such as characteristics, properly satisfy the specification. Formal specification concurrency, object oriented concept, tool support, and languages use mathematics as their basis. Most code conversion. Conclusions are presented in Section complex systems can be modelled using simple 4. mathematical objects, such as sets, relations and

www.ijert.org 1 International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181

Vol. 1 Issue 4, June - 2012

functions. A mathematical statement is unambiguous the Programming Research Group at Oxford University and precise, which provides a way to give convincing [8], whereas the B formal method is the method of arguments to justify ones solutions, and allows proving based on B, a tool-supported that an implementation satisfies the mathematical formal method based around an abstract machine specification [1]. notation, used in the development of computer software and was originally developed by Jean-Raymond Abrial in France and the UK [9]. One of the longest- Types of Formal Specification Styles established Formal Methods for the development of computer-based systems is termed as Vienna 2.1 Model Based Languages Development Method (VDM).It was originated at IBM's Vienna Laboratory [10] in the 1970s.The Z, B There are a number of different ways to write a and VDM are model based languages, which usually precise specification. One approach is model based model a system by representing its state as a collection languages. In it the specification is expressed as a of state variables, their values and some operations that system state model. This state model is constructed can change its state. All are based on set theory and using well understood mathematical entities such as mathematical logic. VDM was used in programming sets, relations, sequences and functions. Operations of a language description and compiler design. The main system are specified by defining how they affect the goal was to develop the language's fundamental state of the system model. Operations are also features and to establish some formal semantics. Z described by the predicates given in terms of pre and notation is a strongly typed [11] mathematical, post conditions [2]. specification language. It is not an executable notation; The most widely used notations for developing it cannot be interpreted or compiled into a running model based languages are Vienna Development program. Compared to Z, B is slightly more low level Method (VDM) [4], Zed (Z) [3] and B [5]. and more focused on refinement to code rather than just 2.2 Algebraic Specification formal specification hence it is easier to correctly implement a specification written in B than one in Z. System behaviour is formally specified using a software engineering technique called, algebraic specification. These languages uses methods derived 3.1 Characteristics from abstract algebra or category theory to specify The following table distinguishes Z, B and VDM information systems. For the definition of abstract data based on different characteristics [12], [13], [14] types interface, algebraic approach was originally designed. Type operation is specified in order to define Comparison Z B VDM the type rather than the type representation. Ex Factor LARCH, ASL, OBJ [6]. Formal Model - Model - Model - Method Style Oriented Oriented Oriented 2.3Process Oriented Mathematical Set Theory Set Theory Set Concurrent systems are described using process Basis First order First order Theory oriented formal specification language. A specific predicate predicate First implicit model for concurrency is the basis for these Calculus Calculus order languages. In these languages processes are denoted predicate and built up by expressions and elementary Calculus expressions, respectively, which describe particularly Appearance Key Word Boxes or Keyword simple processes by operations which combine Difference oriented Schemas oriented processes to yield new potentially more complex (eg, PRE, (e.g. pre- processes. Ex Communicating Sequential Processes THEN , , post-, (CSP) [7]. END, invariant INVARIA s) NT) 3. Comparison between Z, B and VDM Structuring Abstract Schema None is a formal specification language that Machine Calculus works at a high level of abstraction so that even Notation which complex behavior can be described precisely and allows concisely and it was originally proposed by Jean- various Raymond Abrial in 1977 and was developed further at schemas to

www.ijert.org 2 International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181

Vol. 1 Issue 4, June - 2012

be programming is an approach for developing software combined system based on the concepts of classes and objects. to form [15], [16] new schemas Specification None Before: • Before: of State undecorate hooked Z B VDM Changes d variables variables After: Support object No Support object primed •After: oriented concepts support for oriented concepts variables unhooke such as object such as d polymorphism, oriented polymorphism, variables inheritance and concept inheritance and Identification Input and Inputs: No of Inputs and output variable explicit encapsulation encapsulation Outputs parameters names way of are given ending in specifyin Using Object Using by an “?” g Z. VDM++. operation • Outputs: header: variable Output<-- names Table 3. Comparison on the basis of Object Oriented Operation_ ending in Concept Name(Inpu “!” ts) 3.4 Tool Support Table 1. Comparison on the basis of Characteristics There are variety of robust commercially available tools that provide support for writing specification, proof obligation, refinement, syntax checking, type checking, editing, creating, proving theorems and many 3.2 Concurrency others. The table given below describes different types Concurrency is a property used in distributed system of tools and their features supported by Z, B and VDM. that enables software systems to be served in large- [17], [18], [19], [20], [21]. scale distributed systems. This property allows several computations to execute simultaneously, and Z B VDM potentially interact with each other. Z Word AtlierB SpecBox Z B VDM Z/Eves ProB Overture

No support No support Provide Fastest VDM tools for concurrency for concurrency support for control control concurrency control using Table 4. Comparison on the basis of Tool Support VDM++

Table 2. Comparison on the basis of Concurrency 3.5 Code Generation Some formal specification languages support generation of computer source code from requirement specification. 3.3 Object Oriented Concept The object oriented concepts such as inheritance, Z B VDM polymorphism, and encapsulation are supported by some formal specification languages. Object oriented

www.ijert.org 3 International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181

Vol. 1 Issue 4, June - 2012

Software Software Software [3] J. Davies and J. Woodcock, Using Z: Specification, requirement requirement requirement Refinement, and Proof, In Prentice Hall, 1996. [4] C. B. Jones, Systematic Software Development using specification specification specification VDM, In Prentice Hall, 1990. cannot be can be can be [5] S. Schneider, B Method- An Introduction Palgrave, automatically automatically automatically Cornerstones of Computing series, 2001. [6] J. Guttag and J. J. Horning, The algebraic specification of converted into converted into converted into abstract abstract data types, Acta Inform., vol. 10, pp. computer source computer source computer source 27-52, 1978. code. code. code. [7] C. A. R. Hoare, Communicating Sequential Processes, In Prentice Hall, NJ., 1985. [8] J.R. Abrial, S. A. Schuman and B. Meyer: A Specification Table 5. Comparison on the basis of Code Conversion Language, in On the Construction of Programs, Cambridge 4. Conclusion University Press, eds. A. M. Macnaghten and R. M. McKeag, 1980 (describes early version of the language). Though Z, B and VDM are model based formal [9] J.R. Abrial. The B Book - Assigning Programs to specification languages used for specifying user’s Meanings. Cambridge University Press, 1996. requirements in a mathematical language that can be [10] D. Andrews. Report From The BSI Panel For The proved, verified and tested unambiguously. While the Standardisatio Of VDM (ist/5/50). In VDM '88 VDM | journey of all three languages starts at the requirements The Way Ahead. Springer Berlin/Heidelberg, 1988. specification phase of the software development life [11] J.M. Spivey, “The Z Notation,Reference Manual”, 2nd cycle (SDLC) model, but their path divides after this edition, Prentice Hall International, 1992. phase. Z works on high level of abstraction of a system [12] J. Davies and J. Woodcock, Using Z: Specification, Refinement, and Proof, In Prentice Hall, 1996. and provides a strong base for system designing and [13] C. B. Jones, Systematic Software Development using then testing it. However, B models the system in an VDM, In Prentice Hall, 1990. abstract machine notation that can be used further to [14] S. Schneider, B Method- An Introduction Palgrave, design system, generate its code and then refine and Cornerstones of Computing series, 2001. test the same. VDM was used to prove the equivalence [15] B. Mahony and J. S. Dong, Timed Communicating of programming language concepts as part of compiler Object Z, In IEEE Transactions on Software correctness arguments. While specification written Engineering, vol. 26, No. 2, February 2000. using B and VDM can be used to generate computer [16] Peter Gorm Larsen. VDM++ Tutorial At FM 06. source code directly, Z notation doesn’t provide such Handout, 2006. http://fm06.mcmaster.ca/VDM++. [17] The B-Toolkit". B-Core (UK) Limited. Archive.org. functionality. Free tool support is available for all three 2004. Retrieved February 22, 2012. languages. Z, B and VDM do not differ radically from [18] M. Saaltink, “The Z/EVES System,” in ZUM ’97: The Z one another. They are similar in their foundations and Formal Specification Notation, J. Bowen, M. Hinchey goals, and both allow the specifier to state requirements and D. Till, Eds., 1997, pp. 72–85. precisely and refine these specifications into designs [19] URL http://sourceforge.net/projects/zwordtools/. correctly .Developing software with formal [20] Steria, Aix-en-Provence, France. Atelier B, User and specification languages takes more time and hence Reference Manuals, 1996.Available at money in comparison to the developing the same http://www.atelierb.eu/index_en.html. software without it but this access cost can be scarified [21] CSK SYSTEMS CORPORATION. VDMTools User in order to make software a reliable one and hence Manual (VDM++) ver.1.2, 2008. http://www.vdmtools.jp/en/. increase the trust of the customer in software industry.

5. REFERENCES

[1] R. Pressman, “Software Engineering- A Practitioner’s Approach”, McGraw Hill, 5th edition. 2000. [2] D. Bjorner. Pinnacles of software engineering: 25 years of formal methods. In Annals of Software Engineering, vol 10, 2000, pp. 11–66.

www.ijert.org 4 International Journal of Engineering Research & Technology (IJERT) ISSN: 2278-0181

Vol. 1 Issue 4, June - 2012

www.ijert.org 5