Introduce formal methods in software engineering
1. Introduction
Formal methods are mathematically-based techniques for specifying, developing, and verifying systems, both hardware and software. They involve using mathematical expressions to model the abstract representation of a system, allowing for the specification and verification of system properties. The use of formal methods has become increasingly important in software engineering due to the need for reliable and efficient software products.
Formal methods consist of two main parts: formal specification and formal verification. Formal specification is the process of using mathematics to specify the desired properties of a computer system. Formal verification is the process of using mathematics to prove that a computer system satisfies its specification. Automated theorem proving can be used to evaluate the validity of a formal specification, which helps identify potential flaws in the design process.
2. Examples
One example of a formal method technique is the B method, which covers the entire software development life cycle. The B method divides software into separated components that are further represented as Abstract Machines. The method represents system models in the form of mathematical expressions as an Abstract Notation Machine (AMN). These are further subject to stepwise refinement and proof obligation evaluation, consisting of verification of invariant preservation and refinement correctness. This method is widely used in scientific publications concerning formal method implementation, and it is used in the specification for transport automation systems in Paris and Sao Paulo by Siemens Transportation Systems.
Another example of a formal method technique is Z notation, which is a model-based, abstract formal specification technique. Z defines system models in the form of states where each state consists of variables, values, and operations that change from one state to another. Z formalizes a specification of the system at the design level and is most compatible with object-oriented programming.
Event-B is an advanced implementation of the B method. Using this approach, formal software specification is the process of creating a discrete model that represents a specific state of the system. The state is an abstract representation of constants, variables, and transitions (events). Part of an event is the guard that determines the condition for the transition to another state to take place. Constructed models (blueprints) are a further subject of refinement, proof obligation, and decomposition for the correctness of verification.
3. Summary
Before deciding on the use of formal methods, each architect must list the pros and cons against resources available, as well as the system’s needs. Formal methods offer several benefits, including improving system reliability at the design level and decreasing the cost of testing. They also improve system cohesion, reliability, and safety-critical components by detecting faults early in the development cycle. However, formal methods require qualified professionals competent in either mathematics or software engineering, and design proof-validation may introduce additional effort and cost to the overall project estimation.