Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Formal Methods (continued) Formal Methods: Modifying a Formal Specification.

Similar presentations


Presentation on theme: "1 Formal Methods (continued) Formal Methods: Modifying a Formal Specification."— Presentation transcript:

1 1 Formal Methods (continued) Formal Methods: Modifying a Formal Specification

2 2 Propositional Logic Formal methods: Allow us to "prove" properties of the system under development Here we will use the Z language to represent formal specifications Note: the example below is a specification, not a design. In the operations, for example, the specification describes the state of the system before and after the operation, it does not describe how the operation is to be carried out.

3 3 Additional Z Notation

4 4 Z Sequence Notation

5 5 Z example revisited (1) Example (from Pressman, Software Engineering, A Practitioner’s Approach): “Block Handler” 1 3 4 6 9 2 5 7 8 10 11 12 25 8 117 Unused (free) blocks Queued for entry into Unused Blocks released to queue when files deleted Used blocks

6 6 Z example revisited (2) Z specification: -------BlockHandler---------------------- used,free:  BLOCKS BlockQueue: seq P BLOCKS ----------------------------------------------- used  free =   used  free = AllBlocks   i: dom BlockQueue. BlockQueue i  used   i,j : dom BlockQueue. i  j  BlockQueue i  BlockQueue j = 

7 7 Z example revisited (3) ---------RemoveBlock--------------------------  BlockHandler ----------------------------------------------------- #BlockQueue > 0, used’ = used \ head BlockQueue  free’ = free  head BlockQueue  BlockQueue’ = tail BlockQueue ------------------------------------------------------ ---------AddBlock-------------------------------  BlockHandler Ablocks? : BLOCKS ----------------------------------------------------- Ablocks?  used, used’ = used  free’ = free  BlockQueue’ = BlockQueue ^ (Ablocks?) ------------------------------------------------------

8 8 Modifying the example Examples: 1. Change BlockQueue to BlockStack: 2. Output size of BlockQueue in AddBlock or RemoveBlock 3. Make BlockQueue part of “free” instead of “used”

9 9 Modifying the example

10 10 Formal methods in project (exercise) Class exercise: --Describe a priority queue in Z notation --Are there operations you need which have not yet been defined in these slides on the Z notation?


Download ppt "1 Formal Methods (continued) Formal Methods: Modifying a Formal Specification."

Similar presentations


Ads by Google