Presentation is loading. Please wait.

Presentation is loading. Please wait.

Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1.

Similar presentations


Presentation on theme: "Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1."— Presentation transcript:

1 Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1

2 What are Formal Methods?  Formal Language Specification Formal Methods centred around a notation known as a formal specification language. Formal Semantics  Mathematical base allows precise notions.  Unambiguous.  Allows consistency, correctness, specification and implementation to be expressed. Increase Human Understanding of Specified System. & Allow the possibility of formal reasoning and development. 2Formal Methods in Software Engineering

3 Three Levels of Formal Methods 1. Requirements Only 2. No Analysis/Proof 3. Cost effective 1. Produce a program in a more formal manner 2. Use proofs of properties or refinements from formal specification 3. Costly 1. Use theorem prover 2. Fully formal machine- checked proofs. 3. Expensive, hard and often costly 4. Formally prove the entire system. LEVEL 0 Formal Specification LEVEL 1 Formal Verification LEVEL 2 Theorem Provers 3Formal Methods in Software Engineering

4 Use in the Design Process  Specification Description of system to be developed at any level of detail desired. Formal specification can be used: 1.to guide further development. 2.verify requirements of system are completely and accurately specified. 4Formal Methods in Software Engineering

5 Use in the Design Process  Development Formal specification can be used as a guide to progress the development of the actual system. Model-Orientated Specification Observed behaviour of actual system compared to behaviour of specification. Property-Orientated Specification Preconditions and postconditions may be able to become assertions in executable code of system. 5Formal Methods in Software Engineering

6 Use in the Design Process  Verification Formal specification can be used to prove certain properties of specification and hence the developed system. Human-Directed Proof Understand the system better Mathematical-style proofs Handwritten using a natural language Automated Proof Produce proofs using automated means Automated Theorem Proving Model Checking 6Formal Methods in Software Engineering

7 Weakness of natural language specifications Withdraw: “Receives a requested amount to withdraw from the bank account and, if there are sufficient funds in the account, meets the request. Returns a boolean value indicating success or failure of the attempt to withdraw money from the account.” Natural language descriptions do not have a fixed meaning, they are ambiguous. These notations do not have a fixed semantics 7Formal Methods in Software Engineering

8 Incomplete specifications A specification can be considered incomplete when the behaviour is not completely defined. Withdraw: “Receives a requested amount to withdraw from the bank account and, if there are sufficient funds in the account, meets the request. Returns a boolean value indicating success or failure of the attempt to withdraw money from the account.” 8Formal Methods in Software Engineering

9 Inconsistent specifications A specification is inconsistent when it contains within it contradictions. Withdraw: “Receives a requested amount to withdraw from the bank account and, if there are sufficient funds in the account, meets the request. Returns a boolean value indicating success or failure of the attempt to withdraw money from the account.” OVERDRAFT? 9Formal Methods in Software Engineering

10 Formal languages It is desirable to use a specification notation with a fixed, unambiguous, semantics. Notations that have a fixed semantics are known as formal notations, or formal languages. A fixed semantics is achieved by defining a language in a completely unambiguous way using a mathematical framework. 10Formal Methods in Software Engineering

11 Formal Methods initial formal specification 1st transformation 2nd transformation nth transformation final program A formal method includes a proof system for demonstrating that each transformation preserves the formal meaning captured in the previous step. 11Formal Methods in Software Engineering

12 Advantages of formal methods formal specifications can help considerably in generating suitable test cases; the discipline required in producing a formal specification allows for feedback on system specifications at early development stages, increasing confidence that the specification accurately captures the real system requirements; important properties of the initial specification can be checked mathematically and incorporated as run-time checks in the final program; proofs can help uncover design errors as soon as they are made, rather than having to wait for testing of the final implementation; a proof of program correctness can be constructed that is a much more robust method of achieving program correctness than is testing alone. 12Formal Methods in Software Engineering

13 Critical Analysis 1. Full formalisation considered: too difficult too time-consuming too expensive given 1. Expressiveness of languages involved 2. Complexity of systems to be modelled. 2.A good Human-Directed Proof requires high level of mathematical sophistication and expertise. 3.Automated-proof requires “guidance”. 13Formal Methods in Software Engineering

14 14 Advantages of Formal Methods  Formal methods treat system components as mathematical objects and provide mathematical models to describe and predict the observable properties and behaviors of these objects.  There are several advantages to using formal methods for the specification and analysis of real-time systems.  the early discovery of ambiguities, inconsistencies and incompleteness in informal requirements  the automatic or machine-assisted analysis of the correctness of specifications with respect to requirements  the evaluation of design alternatives without expensive prototyping Formal Methods in Software Engineering

15 15 Formal Specification Methods  Logic  Z, VDM, First order logic, temporal logic  State Machines  Finite state machines, communicating state machines, extended state machines  State Chart, Objectime, Automata  Petri Nets Formal Methods in Software Engineering

16 Conclusions  Formal Methods are: Mathematically based techniques for the specification, development and verification of software and hardware systems.  Formal Methods can be used: To varying extents and locations throughout the design process.  Sometimes considered to be: Too expensive, difficult and time consuming. 16Formal Methods in Software Engineering

17 Thanks 17


Download ppt "Formal Methods in Software Engineering Credit Hours: 3+0 By: Qaisar Javaid Assistant Professor Formal Methods in Software Engineering1."

Similar presentations


Ads by Google