Presentation is loading. Please wait.

Presentation is loading. Please wait.

IntroductionIntroduction Copyright, 2003 © Jerzy R. Nawrocki Models and Analysis.

Similar presentations


Presentation on theme: "IntroductionIntroduction Copyright, 2003 © Jerzy R. Nawrocki Models and Analysis."— Presentation transcript:

1 IntroductionIntroduction Copyright, 2003 © Jerzy R. Nawrocki Models and Analysis of Software Lecture 2 Models and Analysis of Software Lecture 2

2 J. Nawrocki, Models & Analysis (2) From the last lecture Rational Robot isnt as good as Rational claims. Rational Robot is too difficult and time consuming. More info about Cactus and DOM (with a little help of students ). We should try to solve some more practical problems, not only the easy Notice Board. I think this subject should be done during laboratories. There was a little bit of jumping between the slides.

3 J. Nawrocki, Models & Analysis (2) Plan of the lecture Specification styles A model-based specification An axiomatic specification An unexpected specification Course organisation

4 J. Nawrocki, Models & Analysis (2) Specification styles Formal methods Model-basedModel-basedAxiomaticAxiomatic ImperativeImperativeDeclarativeDeclarative FunctionalFunctionalLogicalLogical AlgebraicAlgebraic

5 J. Nawrocki, Models & Analysis (2) Plan of the lecture Specification styles A model-based specification An axiomatic specification An unexpected specification Course organisation

6 J. Nawrocki, Models & Analysis (2) A model-based specification Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {};INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {}; m

7 J. Nawrocki, Models & Analysis (2) A model-based specification Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {};INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; m

8 J. Nawrocki, Models & Analysis (2) A model-based specification Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {};INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; LOOKUP (name: Name) r: TelephoneNo ext rd dir: Directory; ext rd dir: Directory; pre name dom dir; pre name dom dir; post dir (name); post dir (name); LOOKUP (name: Name) r: TelephoneNo ext rd dir: Directory; ext rd dir: Directory; pre name dom dir; pre name dom dir; post dir (name); post dir (name); m

9 J. Nawrocki, Models & Analysis (2) A model-based specification Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend Directory = Name TelephoneNo state telbook of dir: Directory dir: Directoryend INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {};INIT() ext wr dir: Directory; ext wr dir: Directory; post dir = {}; post dir = {}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; ADD (name: Name, telno: TelephoneNo) ext wr dir: Directory; ext wr dir: Directory; post dir = dir {name telno}; post dir = dir {name telno}; LOOKUP (name: Name) r: TelephoneNo ext rd dir: Directory; ext rd dir: Directory; pre name dom dir; pre name dom dir; post dir (name); post dir (name); LOOKUP (name: Name) r: TelephoneNo ext rd dir: Directory; ext rd dir: Directory; pre name dom dir; pre name dom dir; post dir (name); post dir (name); DELETE (name: Name) ext wr dir: Directory; ext wr dir: Directory; post dir = {name} dir ; post dir = {name} dir ; DELETE (name: Name) ext wr dir: Directory; ext wr dir: Directory; post dir = {name} dir ; post dir = {name} dir ; m

10 J. Nawrocki, Models & Analysis (2) Plan of the lecture Specification styles A model-based specification An axiomatic specification An unexpected specification Course organisation

11 J. Nawrocki, Models & Analysis (2) An axiomatic specification scheme DIRECTORY = class type Name, PhoneNo, Dir value empty: Dir, add: Name x PhoneNo x Dir Dir, add: Name x PhoneNo x Dir Dir, lookup: Name x Dir PhoneNo, lookup: Name x Dir PhoneNo, delete: Name x Dir Dir delete: Name x Dir Dir scheme DIRECTORY = class type Name, PhoneNo, Dir value empty: Dir, add: Name x PhoneNo x Dir Dir, add: Name x PhoneNo x Dir Dir, lookup: Name x Dir PhoneNo, lookup: Name x Dir PhoneNo, delete: Name x Dir Dir delete: Name x Dir Dir axiom forall name, name1: Name, t: PhoneNo, d: Dir delete (name, empty) empty delete (name, empty) empty delete (name, add(name1, t, d)) delete (name, add(name1, t, d)) if name = name1 if name = name1 then delete (name, d) then delete (name, d) else add (name1, t, delete (name, d)) else add (name1, t, delete (name, d)) end end axiom forall name, name1: Name, t: PhoneNo, d: Dir delete (name, empty) empty delete (name, empty) empty delete (name, add(name1, t, d)) delete (name, add(name1, t, d)) if name = name1 if name = name1 then delete (name, d) then delete (name, d) else add (name1, t, delete (name, d)) else add (name1, t, delete (name, d)) end end Not d ?

12 J. Nawrocki, Models & Analysis (2) An axiomatic specification axiom forall name, name1: Name, t: PhoneNo, d: Dir lookup (name, add(name1, t, d)) lookup (name, add(name1, t, d)) if name = name1 then t if name = name1 then t else lookup (name, d) else lookup (name, d) end end pre name = name1 name d pre name = name1 name d axiom forall name, name1: Name, t: PhoneNo, d: Dir lookup (name, add(name1, t, d)) lookup (name, add(name1, t, d)) if name = name1 then t if name = name1 then t else lookup (name, d) else lookup (name, d) end end pre name = name1 name d pre name = name1 name d scheme DIRECTORY = class type Name, PhoneNo, Dir value empty: Dir, add: Name x PhoneNo x Dir Dir, add: Name x PhoneNo x Dir Dir, lookup: Name x Dir PhoneNo, lookup: Name x Dir PhoneNo, delete: Name x Dir Dir delete: Name x Dir Dir scheme DIRECTORY = class type Name, PhoneNo, Dir value empty: Dir, add: Name x PhoneNo x Dir Dir, add: Name x PhoneNo x Dir Dir, lookup: Name x Dir PhoneNo, lookup: Name x Dir PhoneNo, delete: Name x Dir Dir delete: Name x Dir Dir

13 J. Nawrocki, Models & Analysis (2) Plan of the lecture Specification styles A model-based specification An axiomatic specification An unexpected specification Course organisation

14 J. Nawrocki, Models & Analysis (2) Another axiomatic specification type ext_nat_numbers is sorts nat sorts nat opns 0 nat opns 0 nat suc: nat nat suc: nat nat _ + _ : nat, nat nat _ + _ : nat, nat nat type ext_nat_numbers is sorts nat sorts nat opns 0 nat opns 0 nat suc: nat nat suc: nat nat _ + _ : nat, nat nat _ + _ : nat, nat nat eqns forall x,y ofsort nat x + 0 = x; x + 0 = x; x + succ(y) = succ(x+y); x + succ(y) = succ(x+y); eqns forall x,y ofsort nat x + 0 = x; x + 0 = x; x + succ(y) = succ(x+y); x + succ(y) = succ(x+y); int zero () int succ (int x) int plus (int x, int y) int zero () int succ (int x) int plus (int x, int y) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) Our intuition: plus(2, 3)= 5 Our intuition: plus(2, 3)= 5

15 J. Nawrocki, Models & Analysis (2) An unexpected implementation int zero () int succ (int x) int plus (int x, int y) int zero () int succ (int x) int plus (int x, int y) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) Our intuition: plus(2, 3)= 5 Our intuition: plus(2, 3)= 5 int zero () { return 1; } { return 1; } int zero () { return 1; } { return 1; }

16 J. Nawrocki, Models & Analysis (2) An unexpected implementation int zero () int succ (int x) int plus (int x, int y) int zero () int succ (int x) int plus (int x, int y) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) Our intuition: plus(2, 3)= 5 Our intuition: plus(2, 3)= 5 int zero () { return 1; } { return 1; } int zero () { return 1; } { return 1; } int succ (int x) { return 2*x; } { return 2*x; } int succ (int x) { return 2*x; } { return 2*x; }

17 J. Nawrocki, Models & Analysis (2) An unexpected implementation int zero () int succ (int x) int plus (int x, int y) int zero () int succ (int x) int plus (int x, int y) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) Our intuition: plus(2, 3)= 5 Our intuition: plus(2, 3)= 5 int zero () { return 1; } { return 1; } int zero () { return 1; } { return 1; } int succ (int x) { return 2*x; } { return 2*x; } int succ (int x) { return 2*x; } { return 2*x; } int plus (int x, int y) { return x * y; } { return x * y; } int plus (int x, int y) { return x * y; } { return x * y; }

18 J. Nawrocki, Models & Analysis (2) An unexpected implementation x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) x plus(x, zero())= x x plus(x, zero())= x x,y plus(x,succ(y))= succ(plus(x,y)) x,y plus(x,succ(y))= succ(plus(x,y)) Our intuition: plus(2, 3)= 5 Our intuition: plus(2, 3)= 5 int zero () { return 1; } { return 1; } int zero () { return 1; } { return 1; } int succ (int x) { return 2*x; } { return 2*x; } int succ (int x) { return 2*x; } { return 2*x; } int plus (int x, int y) { return x * y; } { return x * y; } int plus (int x, int y) { return x * y; } { return x * y; }... but plus(2,3)= 6 The implementation satisfies those conditions

19 J. Nawrocki, Models & Analysis (2) Plan of the lecture Specification styles A model-based specification An axiomatic specification An unexpected specification Course organisation

20 J. Nawrocki, Models & Analysis (2) LecturesLectures GUI Testing and Rational Robot Introduction to Software Models VDM – part I 2.04 VDM – part II 9.04 Z Statecharts 7.05 Petri Nets Introduction to Software Test Automation Advanced Topics in Test Automation Tools for Automate Testing 4.06 Test Automation Case Studies Summary

21 J. Nawrocki, Models & Analysis (2) LabsLabs Extreme 90 Rational Sitecheck Rational Robot – part I Rational Robot – part II Rational Robot – part III VDM + Z Statecharts + Petri Nets

22 J. Nawrocki, Models & Analysis (2) Course organisation 13: Presence at lectures 20: Seminar 20: Laboratory classes 50: Written exam : Total Grading rules : : : : : : : : : : 3.0

23 J. Nawrocki, Models & Analysis (2) Course organisation Each student has to give a presentation lasting for 20 minutes. Any topic concerning Models & Analysis of Software will be accepted. The presentation does not have to be original. It can be based on someones paper or book. Title, name, address, keywords and abstract (about half a page) must be submitted to Bartek Walter at least 10 days before the presentation. Schedule will be prepared by Bartek Walter. Presentation at seminar

24 J. Nawrocki, Models & Analysis (2) Course organisation Each presentation gets from 1 up to 10 points. The best grade is excluded and the author is expected to grade his presentation at 10 points. The presentation grade is an average of the remaining grades. Average presentation grade will be multiplied by 2 to get overall presentation grade. Presentation grade

25 J. Nawrocki, Models & Analysis (2) SummarySummary Model-based specifications: an abstract implementation Axiomatic specifications: relations and superposition Problem of unexpected implementations

26 J. Nawrocki, Models & Analysis (2) Further readings A. Harry, Formal Methods Fact File, John Wiley & Sons, Chichester, 1996 (Chapters 1 - 3).

27 J. Nawrocki, Models & Analysis (2) Quality assessment 1. What is your general impression? (1 - 6) 2. Was it too slow or too fast? 3. What important did you learn during the lecture? 4. What to improve and how?


Download ppt "IntroductionIntroduction Copyright, 2003 © Jerzy R. Nawrocki Models and Analysis."

Similar presentations


Ads by Google