• No results found

From Event-B Models

N/A
N/A
Protected

Academic year: 2022

Share "From Event-B Models"

Copied!
35
0
0

Loading.... (view fulltext now)

Full text

(1)

From Event-B Models

Dipak L. Chaudhari, Om P. Damani

Department of Computer Science and Engineering, Indian Institute of Technology, Bombay,

Mumbai, India

dipakc@cse.iitb.ac.in, damani@cse.iitb.ac.in

June 21, 2011

(2)

Motivation

Introduction to HASTM

Algorithm for Generation of HASTM from Event-B model Interactive

Automatic

Multiple Views of the System Related and Future Work Conclusion

Chaudhari and Damani (IITB) HASTM June 2011 2 / 32

(3)

Discovering/Ascertaining properties of the system Example Property: Lift Controller System After OpenDoor:

Allowed events: CloseDoor and PushCallBtn Disabled events: MoveUp, MoveDown, etc.

Animation Scenario analysis

Hierarchical Representation:

Easier to ascertain properties just by quick visual inspection.

Chaudhari and Damani (IITB) HASTM June 2011 3 / 32

(4)

INV

dirUp = F dirUp = T

doorOpen=F

doorOpen=T

cf = botFloor cf=topFloor

cf < topFloor

cf > botFloor

INV

doorOpen=T doorOpen=F

dirUp=T dirUp=F

cf=topFloor cf<topFloor cf > botFloor cf=botFloor

States Transitions

Pre-state and Post-state Transition Guards

Transitions originating from a superstate Transitions terminating in a superstate Our Goal: Generate Hierarchical Representation from Event-B model

State-partition Tree

(5)

Constants:

botFloor , topFloor Variables:

cf , doorOpen, callbtns, dirUp

Axioms:

botFloor ∈ Z, topFloor ∈ Z botFloor < topFloor

Invariants:

doorOpen ∈ BOOL callbtns ⊆

(botFloor ..topFloor ) dirUp ∈ BOOL

(doorOpen = T )

⇒ (cf ∈ callbtns) cf ∈ (botFloor ..topFloor)

Initialisation = b begin

cf := botFloor doorOpen := F callbtns := ∅ dirUp := T end

PushCallBtn = b any f where

f ∈ topFloor..botFloor f ∈ / callbtns

f 6= cf then

callbtns := callbtns ∪ {f } end

OpenDoor = b when

doorOpen = F cf ∈ callbtns then

doorOpen := T end

CloseDoor = b when

doorOpen = T then

doorOpen := F callbtns :=

callbtns \{cf } end

Chaudhari and Damani (IITB) HASTM June 2011 5 / 32

(6)

MoveUp = b when

dirUp = T doorOpen = F upRequested cf < topFloor cf ∈ / callbtns then

cf := cf + 1 end

MoveDown = b when

dirUp = F doorOpen = F downRequested cf > botFloor cf ∈ / callbtns then

cf := cf − 1 end

ReverseUp = b when

dirUp = F doorOpen = F upRequested

¬downRequested cf ∈ / callbtns then

dirUp := T end

ReverseDown = b when

dirUp = T doorOpen = F

¬upRequested downRequested cf ∈ / callbtns then

dirUp := F end

Chaudhari and Damani (IITB) HASTM June 2011 6 / 32

(7)

INV

Chaudhari and Damani (IITB) HASTM June 2011 7 / 32

(8)

INV

Partitioning

Partition the state INV with predicate (dirUp = T ) Results in two substates

INV ∧ (dirUp = T ) and INV ∧ (dirUp = F)

Chaudhari and Damani (IITB) HASTM June 2011 7 / 32

(9)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 8 / 32

(10)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 9 / 32

(11)

INV

dirUp=T dirUp=F

Strengthen the Pre-State of MoveUp transition(t)

INV ∧ t .K ⇒ (dirUp = T )

MoveUp transition is disabled for (dirUp = F )

Chaudhari and Damani (IITB) HASTM June 2011 9 / 32

(12)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 10 / 32

(13)

INV

dirUp=T dirUp=F

Strengthen the Post-State of MoveUp transition

t .Pre(v) ∧ t.K (v , u) ∧ BA(v , u, v

0

) ` t .Post(v

0

)

Post-state = (dirUp = T ): Proof Obligation discharged.

Post-state = (dirUp = F ): Proof Obligation NOT discharged.

Chaudhari and Damani (IITB) HASTM June 2011 11 / 32

(14)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 12 / 32

(15)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 13 / 32

(16)

INV

dirUp=T dirUp=F

Strengthen the Pre-State of CloseDoor transition

INV ∧ (OpenDoor = T ) ⇒ (dirUp = T ) is not valid INV ∧ (OpenDoor = T ) ⇒ (dirUp = F) is not valid

Chaudhari and Damani (IITB) HASTM June 2011 14 / 32

(17)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 15 / 32

(18)

INV

dirUp=T dirUp=F

Strengthen the Post-State of CloseDoor transition

t .Pre(v ) ∧ t .K (v, u) ∧ BA(v , u, v

0

) ` t .Post(v

0

)

Chaudhari and Damani (IITB) HASTM June 2011 15 / 32

(19)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 16 / 32

(20)

INV

dirUp=T dirUp=F

Chaudhari and Damani (IITB) HASTM June 2011 17 / 32

(21)

Selection of right partitioning predicate.

Different predicate choices result in different diagrams.

INV

dirUp=T dirUp=F

INV

doorOpen=F doorOpen=T

Chaudhari and Damani (IITB) HASTM June 2011 18 / 32

(22)

INV

Score: Number of transitions whose pre-state can be strengthened without splitting the transition.

dirUp = T - ReverseUp - ReverseDown - MoveUp - MoveDown score = 4

cf = topFloor -ReverseUp -MoveUp score = 2

cf = botFloor -ReverseDown -MoveDown score = 2

doorOpen = T - ReverseUp - ReverseDown - MoveUp - MoveDown - CloseDoor - OpenDoor score = 6

Chaudhari and Damani (IITB) HASTM June 2011 19 / 32

(23)

INV

doorOpen=F doorOpen=T

Chaudhari and Damani (IITB) HASTM June 2011 20 / 32

(24)

INV

dirUp = F dirUp = T

doorOpen=F

doorOpen=T

Chaudhari and Damani (IITB) HASTM June 2011 21 / 32

(25)

INV

dirUp = F dirUp = T

doorOpen=F

doorOpen=T

cf < topFloor cf=topFloor

Chaudhari and Damani (IITB) HASTM June 2011 22 / 32

(26)

INV

dirUp = F dirUp = T

doorOpen=F

doorOpen=T

cf = botFloor cf=topFloor

cf < topFloor

cf > botFloor

Chaudhari and Damani (IITB) HASTM June 2011 23 / 32

(27)

functionMain() BuildPrimitiveHASTM() PartitionAbstractState(I) for transitiontinT

StrengthenPostState(t) StrengthenPostState(t0) functionBuildPrimitiveHASTM()

v:= variables ofM Σ := Event signatures ofM I:= Conjunction of invariants ofM S:={I}

: =∅

T:={hEvt:Em,Pre:I,K:Gm, Act:Actm,Post:Ii|m∈1..r}

t0:=hEvt:init,Pre:Null,

K:True,Act:Act0,Post:Ii functionPartitionAbstractState(X: abstract state)

p: =SelectPredicate(X) ifp=Null

return

X1:= AddSubState(X,p) X2:= AddSubState(X,¬p) PartitionAbstractState(X1) PartitionAbstractState(X2)

functionAddSubState(X: abstract state,q: predi- cate)

X0(v) :=X(v)∧q(v) S:=S ∪ {X0} := ∪{X7→X0} fortinTsuch thatt.Pre=X

if (X(v)∧t.K(v,u)⇒q(v)) t.Pre:=X0

t.K=K0 returnX0

returnX0

functionSelectPredicate(X: abstract state) score:=∅//score∈P→N forpinP

ifX(v) already has conjuctp(v) or¬p(v) continue

eT:=

t∈T

t.Pre=Xandtis amenable to partitioning ofXwithp

score(p) :=|eT|

ifscore=∅ returnNull

bestPred :∈arg maxpscore(p) ifscore(bestPred) = 0

bestPred:=Null returnbestPred

functionStrengthenPostState(t: transition) Y={Y∈ S|t.PostY}

ifY=∅ //t.Postis a basic abstract state return

forYinY if

proof obligation for {t.Pre} t.Evt[t.K]/t.Act

−−−−−−−−−−→ {Y} is discharged

 t.Post:=Y

strengthenPostState(t) break

return

(28)

INV

dirUp = F dirUp = T

CloseDoor

OpenDoor

doorOpen=F

cf>botFloor

cf<topFloor MoveUp

MoveUp

MoveDown

MoveDown ReverseDown

ReverseDown ReverseUp ReverseUp doorOpen=T

cf=topFloor cf<topFloor

cf=botFloor

cf=topFloor

cf>botFloor cf=botFloor PushCallBtn

Init

Chaudhari and Damani (IITB) HASTM June 2011 25 / 32

(29)

From visual specifications to B models.

[Ledang and Souqui` eres, 2002, Sekerinski and Zurob, 2002, Snook and Butler, 2006, Snook and Butler, 2008]

Structured Event-B. [Hallerstede, 2010]

ProB: [Leuschel and Butler, 2003] Can generate state-space graph of a B machine by traversing the state-space of the machine.

GeneSyst: [Bert et al., 2010] Builds symbolic labeled transition systems from Event-B specifications

Supports refinement

Requires the invariants associated with the states in the transition systems to be specified by the user.

FlowGraph: [Bendisposto and Leuschel, 2011]

Useful for uncovering implicit algorithmic structures.

Chaudhari and Damani (IITB) HASTM June 2011 26 / 32

(30)

Implementation Support for refinement

Partitioning the local state-space defined by event parameters.

Chaudhari and Damani (IITB) HASTM June 2011 27 / 32

(31)
(32)

Bendisposto, J. and Leuschel, M. (2011).

Automatic flow analysis for Event-B.

In Giannakopoulou, D. and Orejas, F., editors, Fundamental

Approaches to Software Engineering, volume 6603 of Lecture Notes in Computer Science, pages 50–64. Springer Berlin / Heidelberg.

10.1007/978-3-642-19811-3 5.

Bert, D., Potet, M., and Stouls, N. (2010).

GeneSyst: a tool to reason about behavioral aspects of B event specifications. application to security properties.

CoRR, abs/1004.1472.

Chaudhari and Damani (IITB) HASTM June 2011 29 / 32

(33)

Hallerstede, S. (2010).

Structured Event-B models and proofs.

In Frappier, M., Gl¨ asser, U., Khurshid, S., Laleau, R., and Reeves, S., editors, Abstract State Machines, Alloy, B and Z, volume 5977 of Lecture Notes in Computer Science, pages 273–286. Springer Berlin / Heidelberg.

10.1007/978-3-642-11811-1 21.

Ledang, H. and Souqui` eres, J. (2002).

Contributions for modelling UML State-Charts in B.

In Proceedings of the Third International Conference on Integrated Formal Methods, IFM’02, pages 109–127, London, UK, UK.

Springer-Verlag.

Chaudhari and Damani (IITB) HASTM June 2011 30 / 32

(34)

Leuschel, M. and Butler, M. (2003).

ProB: a model checker for B.

In FME 2003: FORMAL METHODS, LNCS 2805, pages 855–874.

Springer-Verlag.

Sekerinski, E. and Zurob, R. (2002).

Translating statecharts to B.

In Proc. of the 3rd International Conference on Integrated Formal Methods (IFM’02), volume 2335 of LNCS, pages 128–144.

Springer-Verlag.

Snook, C. and Butler, M. (2006).

UML-B: formal modeling and design aided by UML.

ACM Transactions on Software Engineering and Methodology, 15(1):92–122.

Chaudhari and Damani (IITB) HASTM June 2011 31 / 32

(35)

Snook, C. and Butler, M. (2008).

UML-B and Event-B: an integration of languages and tools.

In Proceedings of the IASTED International Conference on Software Engineering, SE ’08, pages 336–341, Anaheim, CA, USA. ACTA Press.

Chaudhari and Damani (IITB) HASTM June 2011 32 / 32

References

Related documents

uses of water; adaptation to climate change; enhancing water available for use; demand management and water use efficiency; water pricing; conservation of river

–  Hierarchical and Concurrent State Machines –  Data Flow Models, Discrete Event Models. •  Each model suitable for

Government of Telangana has announced creation of a Life Sciences Grid to provide necessary support to the Life Sciences Industry including pharma, biotechnology, healthcare and

Rhizome short, covered with fibrous roots and ramenta; scales brown, lanceolate; stipe brown/black, slender, erect, 5-10 cm long.. Lamina lanceolate- deltoid, 10-25 cm long, at

a) Every course can have one or more of its preceding course(s) as prerequisite(s). b) To register for a course, the student must successfully complete the course(s) earmarked as

b) A Student can re-register in any course at any time before the completion of his/her program provided the University permits. c) A student cannot reappear for semester

Abstract Blue jet, a transient luminous event propagating upward from the top of active thundercloud is yet a mysterious to scientists A few models have been suggested for

DATA AND ABUNDANCE DETERMINATION METHOD Our goal is to determine reliable interstellar C ii column den- sities from the strong 1334 Å transition through profile fitting of