Lecture 1: Formal Models and Methods PDF
Document Details
Uploaded by SimplerNaïveArt9871
Libyan International University
Dr. Salwa Elakeili
Tags
Summary
This lecture introduces formal models and methods in software engineering at Libyan International University. It covers various aspects of formal methods. Dr. Salwa Elakeili, of the Faculty of Information Technology, provides an overview of formal specifications, their use cases, the myths around formal methods, and their real-world applications.
Full Transcript
Libyan International University Formal Models and Methods Lecture 1 Dr. Salwa Elakeili Faculty of Information Technology Outline ❑ Introduction ❑ Formal Methods ❑ Myths of Formal Methods ❑ Why Study Formal Methods in Software Engineering? ❑...
Libyan International University Formal Models and Methods Lecture 1 Dr. Salwa Elakeili Faculty of Information Technology Outline ❑ Introduction ❑ Formal Methods ❑ Myths of Formal Methods ❑ Why Study Formal Methods in Software Engineering? ❑ Specification ❑ Formal Specification ❑ Difference between specification and formal specification ❑ The Importance of Proof Objectives Understand why formal specification techniques help discover problems in system requirements Understand the concepts of formal methods definition Understand the importance of mathematical logic Introduction Formal methods of the software development are not widely used in industrial software development. Most SW development companies do not consider it cost-effective to apply them in their SW processes. The term formal methods includes a number of different activities: Formal system specification Specification analysis and proof Transformational development Program verification All of these activities are dependent on a formal specification of the SW Myths of Formal Methods 1. Formal methods can guarantee that software is perfect. Rather: they are very helpful at finding errors early and can nearly eliminate some classes of error. 2. They are all about program proving. Rather: they work largely by making you think very hard about the system you propose to build. 3. They are useful only for safety-critical systems. Rather: they are useful for almost any application. Myths of Formal Methods 4. They require highly trained mathematicians. Rather: they are based on mathematical specifications, which are much easier to understand than programs. 5. They increase the cost of development. Rather: they can decrease the cost. 6. They are unacceptable to clients. Rather: they help clients understand what they are buying. 7. They are not used on real, large scale software. Rather: they are being used successfully on practical projects in industry. Introduction (Cont..) A formal SW specification is a specification expressed in a language whose vocabulary, syntax and semantics are formally defined. This need for a formal definition means that the specification languages must be based on mathematical concepts. The branch of mathematics which is used is called discrete mathematics and the mathematical concepts are drawn from set theory, logic and algebra. Why Study Formal Methods in Software Engineering? In software development, formal methods are mathematical approaches to solving software problems at the requirements, specification, and design levels. Formal methods are most likely to be applied to safety- critical or security-critical software and systems Formal Methods Formal methods can be used to produce precise, unambiguous documentation, in which information is structured and presented at an appropriate level of abstraction. This documentation can be used to support the design process, and as a guide to subsequent development, testing, and maintenance. Formal methods are route to improve SW quality. The detailed analysis that are an essential part of formal methods would lead to programs with fewer errors. The cost & problems of introducing formal methods into SW processes are very high. However, formal specification is an excellent way of discovering errors and presenting system specification in an unambiguous way. Specification All successful projects which have used formal methods have reported fewer errors in the delivered software. A specification can be regarded as a description that is intended to be as precise, unambiguous, concise and complete as possible in the context of its specific application. Formal Specification A formal specification is a specification written in a formal language where a formal language is either based on a rigorous mathematical model or simply on a standardized programming or specification language. In most cases, formal specifications are for code review execution and for passing the specification around to members in a design team. In most cases only subsets of formal specification languages, e.g. of Z and VDM (Vienna Development Method), are machine executable. A formal method implies the application of at least one formal specification language. Formal methods are often employed during system design when the degree of confidence in the prescribed system behavior, concluded from a finite number of tests, is low. Existing formal method implementations include: The use of probability theory in performance modeling; The use of context-free grammars in compiler design; The use of the relational calculus in database theory. The Importance of Proof When we introduce the language of mathematical logic, we explain the use of a proof system. Once we introduce the language of sets and relationships, we explain how objects can be built with formal proofs. The Importance of Proof When we introduce the language of schemas, we show how to prove that a specification is consistent, and how to prove that one specification refines another. Our intentions are two-fold: First to show that proof adds quality to software development; Second, to show that proof is a viable part of the industrial use of formal methods. The Importance of Proof If we think about specification, if we attempt to construct proofs about its properties, then we are more likely to detect problems at an early stage of system development. The process of constructing proofs can help us to understand the requirements upon a system, and can assist us in identifying any hidden assumptions. Proof at the specification stage can make a significant contribution to the quality of software. At the design stage, a proof can show us not only that a design is correct, but also why it is correct. The new information it offers may be useful : When requirements change and the design is modified, it is easier to analyze the consequences At the implementation stage, a proof can help us to ensure that a piece of code behaves according to the specification. Again, a significant contribution to quality can be made. Summary Knows the seven Myths of Formal Method The importance of studying Formal Methods in Software Engineering Recognize the importance of Formal Specification