slicing of extended finite state machinescrest.cs.ucl.ac.uk/cow/6/slides/zheng-slicing-efsm.pdf ·...

69
Slicing of Extended Finite State Machines Kelly Androutsopoulos 1 , David Clark 1 , Nicolas Gold 1 , Mark Harman 1 , Rob Hierons 2 , Zheng Li 1 and Laurence Tratt 3 Centre for Research in Evolution, Search & Testing Centre for Research in Evolution, Search & Testing 1 CREST, King’s College London 2 Brunel University 3 Bournemouth University

Upload: dangthuan

Post on 22-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Slicing of Extended Finite State Machines

Kelly Androutsopoulos1, David Clark1, Nicolas Gold1,

Mark Harman1, Rob Hierons2, Zheng Li1 and Laurence Tratt3

Centre for Research in Evolution, Search & Testing

Centre for Research in Evolution, Search & Testing

1CREST, King’s College London2Brunel University

3Bournemouth University

SLIcing state based ModelsSLIcing state based Models

EPSRC Project

SLIM2008 – 2011

CREST

DependenceAnalysis

DataDependence

ControlDependence

Non-terminationSensitive

Non-terminationInsensitive

OrderDependence

Types ofSlicing

Dependence

BasedSlicing

EventRestriction

Slicing

Correctness

Semantics

Syntax

Applications

Compre-hension

Modeldebugging

Dependence Based Slicing- Dependence Analysis- Marked Transitions- ε-elimination- MinimisationEvent Restriction Slicing

- BasicSlice- Constant Propagation- R-mergeEquivalentStates- G-mergeEquivalentStates

Benchmarks

ATM

Cashier

CruiseControl

FuelPump

PrintToken

VendingMachine

DoorController

INRES protocol

TCP

TCSbin(Motorola)

slim.dcs.kcl.ac.uk

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 2 / 34

Program Slicing

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 3 / 34

Program Slicing

we only care about this line

which other lines affect the selected line?

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 3 / 34

Program Slicing

we only care about this line

which other lines affect the selected line?

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 3 / 34

Program Slicing

we only care about this line

which other lines affect the selected line?

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 3 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Program SlicingProgramcompre-hension

Impactanalysis

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Program SlicingProgramcompre-hension

Impactanalysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Program SlicingProgramcompre-hension

Impactanalysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Program SlicingProgramcompre-hension

Impactanalysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

Refactoring

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Program SlicingProgramcompre-hension

Program SlicingProgramcompre-hension

Impactanalysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

Refactoring

Program SlicingProgramcompre-hension

Impactanalysis

Dependencecluster

analysis

Testing anddebugging

RefactoringReverse

engineering

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 4 / 34

Can slicing be applied to model level?

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 5 / 34

Model

START

wait

T1

T2

closeDoor

T3

T4

doorIsClosed

T6

openDoor

T5T7

T8

T9

doorIsOpen

T10

T12

T11

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 6 / 34

Model

START

null_0

T1

call_initiated_1

T3

call_present_6

T15overlap_receiving_25

T16

T7 T8

call_delivered_4

T4

outgoing_call_proceeding_3

T5

bearer_estab

T6

overlap_sending_2

T9

T34

disconnect_ind

T35

initiated_clearing

T36

T32

T30

T31 T33

wait_bearer_estab

T41

T10

T11

T12

T13 T14

wait_bearer_disc_1

T17 wait_bearer_disc_2

T24

initiated_clearing_nobearer

T60

incoming_call_proceeding_9

T54

call_received_7

T64

connect_request_8

T56

T52

overlap_received_call_present

T50

release_request_19

T19T20

T21 T22 T23

T25

disconnect_request_11

T26 T27

T72

T28

T29T71

call_active_10

T38 T37

bearer_connect

wait_bearer_con

T44

T48 T49T46

T45T47

T59

T53

T63

T55

T61

T65

T57

T62

T58

T67

T66

T43T70T42

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 6 / 34

Model

If the model like this?

EFSM_CallControl: Dependence Graph:(NTSCD and DATA)

T4

T65

T63

T64

T34 T35T36

T58

T62

T6

T55

T56

T57

T41

T42 T43

T70

T66

T67

T8

T28

T16

T15

T3

T17

T27

T37

T60

T61

T59

T24

T71

T29

T20

T52

T9

T10

T11

T12

T13

T14

T50

T53

T54

T30

T31T32

T33

T72

T19

T21

T22

T23

T26

T25

T44

T48T46T45 T47 T49

T38

T5 T7

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 6 / 34

MotivationModels tend to be larger and more complex.

Slicing has provided a valuable suite of maintenance techniques atthe implementation level, but little at model level.

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 7 / 34

MotivationModels tend to be larger and more complex.

Slicing has provided a valuable suite of maintenance techniques atthe implementation level, but little at model level.

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 7 / 34

Extended Finite State Machine(EFSM)

DefinitionAn Extended Finite State Machine (EFSM) M is a tuple (S, T, E, V) whereS is a set of states, T is a set of transitions, E is a set of events, and V is astore represented by a set of variables. Transitions have a source statesource(t) ∈ S, a target state target(t) ∈ S and a label lbl(t). Transitionlabels are of the form e1[c]/a where e1 ∈ E, c is a condition and a asequence of actions.

S1 S2Event[Condition]/Action

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 8 / 34

An EFSM example:DoorControl

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 9 / 34

Slicing EFSM

Definition (Slicing Criterion)A slicing criterion for an EFSM is a pair (t,V) where transition t ∈ T andvariable set V ⊆ Var. It designates the point in the exaluation immediatelyafter the execution of the action contain in transition t.

Definition (Slice)An EFSM slice M′ is a reduced machine, where for all inputs i it containsat least one execution where the value of v ∈ V at t is equal to the value ofv at t in the original EFSM M.

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 10 / 34

The CREST EFSM slicing tool

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 11 / 34

The CREST EFSM slicing tool

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 11 / 34

EFSM VS CFG

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Start

READ(x)

x>0

y:=-x y:=x

WRITE(y)

Exit

yesno

Difference1 Transition in EFSM VS Node in CFG2 Self-looping edge and multi-edges between two nodes3 Non-termination (Exit node)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 12 / 34

EFSM VS CFG

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Start

READ(x)

x>0

y:=-x y:=x

WRITE(y)

Exit

yesno

Difference1 Transition in EFSM VS Node in CFG

2 Self-looping edge and multi-edges between two nodes3 Non-termination (Exit node)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 12 / 34

EFSM VS CFG

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Start

READ(x)

x>0

y:=-x y:=x

WRITE(y)

Exit

yesno

Difference1 Transition in EFSM VS Node in CFG2 Self-looping edge and multi-edges between two nodes

3 Non-termination (Exit node)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 12 / 34

EFSM VS CFG

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Start

READ(x)

x>0

y:=-x y:=x

WRITE(y)

Exit

yesno

Difference1 Transition in EFSM VS Node in CFG2 Self-looping edge and multi-edges between two nodes3 Non-termination (Exit node)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 12 / 34

Dependence Analysis of EFSM

Data Dependence

Control Dependence

Traditional Control Dependence [Korel et al, ICSM 2003]

Non-Termination Insensitive Control Dependence (NTICD)[Ranganath et al. ESOP 2005]Non-Termination Sensitive Control Dependence (NTSCD)[Ranganath et al. ESOP 2005]

Unfair Non-Termination Insensitive Control Dependence (UNTICD)[Androutsopoulos et al. FASE 2009]

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 13 / 34

Dependence Analysis of EFSM

Data Dependence

Control DependenceTraditional Control Dependence [Korel et al, ICSM 2003]

Non-Termination Insensitive Control Dependence (NTICD)[Ranganath et al. ESOP 2005]Non-Termination Sensitive Control Dependence (NTSCD)[Ranganath et al. ESOP 2005]

Unfair Non-Termination Insensitive Control Dependence (UNTICD)[Androutsopoulos et al. FASE 2009]

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 13 / 34

Dependence Analysis of EFSM

Data Dependence

Control DependenceTraditional Control Dependence [Korel et al, ICSM 2003]

Non-Termination Insensitive Control Dependence (NTICD)[Ranganath et al. ESOP 2005]Non-Termination Sensitive Control Dependence (NTSCD)[Ranganath et al. ESOP 2005]

Unfair Non-Termination Insensitive Control Dependence (UNTICD)[Androutsopoulos et al. FASE 2009]

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 13 / 34

Dependence Analysis of EFSM

Data Dependence

Control DependenceTraditional Control Dependence [Korel et al, ICSM 2003]

Non-Termination Insensitive Control Dependence (NTICD)[Ranganath et al. ESOP 2005]Non-Termination Sensitive Control Dependence (NTSCD)[Ranganath et al. ESOP 2005]

Unfair Non-Termination Insensitive Control Dependence (UNTICD)[Androutsopoulos et al. FASE 2009]

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 13 / 34

Data Dependence

Definition

TiDD−→ Tj means that transitions Ti and Tj are data dependent with respect

to a variable v if:1 v ∈ D(Ti), where D(Ti) is a set of variables defined by transition Ti,

i.e. variables defined by actions and by the event of Ti;

2 v ∈ U(Tj), where U(Tj) is a set of variables used in a condition andactions of transition Tj;

3 there exists a path in an EFSM from the source(Ti) to the target(Tj)whereby v is not modified by any of the intermediate transitions.

Ti:def(v)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 14 / 34

Data Dependence

Definition

TiDD−→ Tj means that transitions Ti and Tj are data dependent with respect

to a variable v if:1 v ∈ D(Ti), where D(Ti) is a set of variables defined by transition Ti,

i.e. variables defined by actions and by the event of Ti;2 v ∈ U(Tj), where U(Tj) is a set of variables used in a condition and

actions of transition Tj;

3 there exists a path in an EFSM from the source(Ti) to the target(Tj)whereby v is not modified by any of the intermediate transitions.

Ti:def(v) Tj:use(v)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 14 / 34

Data Dependence

Definition

TiDD−→ Tj means that transitions Ti and Tj are data dependent with respect

to a variable v if:1 v ∈ D(Ti), where D(Ti) is a set of variables defined by transition Ti,

i.e. variables defined by actions and by the event of Ti;2 v ∈ U(Tj), where U(Tj) is a set of variables used in a condition and

actions of transition Tj;3 there exists a path in an EFSM from the source(Ti) to the target(Tj)

whereby v is not modified by any of the intermediate transitions.

Ti:def(v) Tj:use(v)NO def(v) Tj:use(v)

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 14 / 34

Types of Control Dependence and Paths in EFSM

Name Path type

NTSCD −→ Maximal Path

NTICD −→ Sink-bounded Path

UNTICD −→ Unfair Sink-bounded Path

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 15 / 34

Definition (Maximal Path)A maximal path is any path that terminates in a final transition, or is infinite.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 16 / 34

Definition (Maximal Path)A maximal path is any path that terminates in a final transition, or is infinite.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T2:waitTimer[timer>0]/timer:=timer - 1

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 16 / 34

Definition (Maximal Path)A maximal path is any path that terminates in a final transition, or is infinite.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T9:opening

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 16 / 34

Definition (Maximal Path)A maximal path is any path that terminates in a final transition, or is infinite.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 16 / 34

Definition (Control Sink)A control sink in an EFSM is a set of transitions K that form a stronglyconnected component (SCC) such that, for each transition t in K eachsuccessor of t is also in K.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 17 / 34

Definition (Control Sink)A control sink in an EFSM is a set of transitions K that form a stronglyconnected component (SCC) such that, for each transition t in K eachsuccessor of t is also in K.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 17 / 34

Definition (Sink-bounded Paths)A maximal path π is sink-bounded iff there exists a control sink K such that:

π contains a transition from K

if π is infinite, then all transitions in K occur infinitely often.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimerSlicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 18 / 34

Definition (Sink-bounded Paths)A maximal path π is sink-bounded iff there exists a control sink K such that:

π contains a transition from K

if π is infinite, then all transitions in K occur infinitely often.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimerSlicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 18 / 34

Definition (Unfair Sink-bounded Paths)A maximal path π is unfair sink-bounded iff there exists a control sink K such that

π contains a transition from K

if π is infinite, then all transitions in K occur infinitely often.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1 T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T4:closing

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 19 / 34

Definition (Unfair Sink-bounded Paths)A maximal path π is unfair sink-bounded iff there exists a control sink K such that

π contains a transition from K

if π is infinite, then all transitions in K occur infinitely often.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1 T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T4:closingT4:closing

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 19 / 34

Definition (Unfair Sink-bounded Paths)A maximal path π is unfair sink-bounded iff there exists a control sink K such that

π contains a transition from K

if π is infinite, then all transitions in K occur infinitely often.

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1 T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

T4:closing

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 19 / 34

Definition (Control Dependence)

TiCD−→ Tj means that a transition Tj is control dependent on a transition

Ti iff Ti has at least one sibling Tk such that:1 for all paths π ∈ PATHs(target(Ti)), the source(Tj) belongs to π;2 there exists a path π ∈ PATHs(source(Tk)) such that the source(Tj)

does not belong to π.

CD PATH typeNTSCD −→ Maximal PathNTICD −→ Sink-bounded Path

UNTICD −→ Unfair Sink-bounded Path

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 20 / 34

Definition (Control Dependence)

TiCD−→ Tj means that a transition Tj is control dependent on a transition

Ti iff Ti has at least one sibling Tk such that:1 for all paths π ∈ PATHs(target(Ti)), the source(Tj) belongs to π;2 there exists a path π ∈ PATHs(source(Tk)) such that the source(Tj)

does not belong to π.

CD PATH typeNTSCD −→ Maximal PathNTICD −→ Sink-bounded Path

UNTICD −→ Unfair Sink-bounded Path

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 20 / 34

Example (NTSCD)

T3NTSCD−−−→ T4,T5,T6

T5NTSCD−−−→ T9,T10

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 21 / 34

Example (NTSCD)

T3NTSCD−−−→ T4,T5,T6

T5NTSCD−−−→ T9,T10

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 21 / 34

Example (NTICD)NO NTICD in this example

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 22 / 34

Example (UNTICD)

T3UNTICD−−−→

T5UNTICD−−−→ T9,T10

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 23 / 34

Example (UNTICD)

T3UNTICD−−−→

T5UNTICD−−−→ T9,T10

Start wait closing opening

opened

closed

T1:setTimer/timer:=5 T3:ready[timer==0] T5:buttonInterrupt/timer:=3

T6:fullyClosed

T10:fullyOpenedT12:timeout

T8:open/timer:=

10

T2:waitTimer[timer>0]/timer:=timer - 1T4:closing T9:opening

T11:openTimer[timer>0]/timer:=timer-1

T7:closeTimer

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 23 / 34

Metrics

Definition (Slice Size)For a model M, t′ is a transition dependent on t (i.e., t′ ∈ T ∧ t −→ t′), thesize of slice with respect to t is:

|S(M, t)| =∑

t′

|M|

Definition (Average Slice Size)For a model M, NT is subset of transitions of M with non-zero slice size(i.e., NT ⊆ T and ∀t ∈ NT, |S(M, t)| > 0) .Thus, the average slice size ofM is:

Avg(M) =

∑t∈NT

|S(M, t)|

|NT|

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 24 / 34

Metrics

Definition (Slice Size)For a model M, t′ is a transition dependent on t (i.e., t′ ∈ T ∧ t −→ t′), thesize of slice with respect to t is:

|S(M, t)| =∑

t′

|M|

Definition (Average Slice Size)For a model M, NT is subset of transitions of M with non-zero slice size(i.e., NT ⊆ T and ∀t ∈ NT, |S(M, t)| > 0) .Thus, the average slice size ofM is:

Avg(M) =

∑t∈NT

|S(M, t)|

|NT|

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 24 / 34

Subjects

Models #S #T #V EXIT DescriptionATM 9 23 8 Yes Automated Teller MachineCashier 12 21 10 Yes Cashier MachineCruiseControl 5 17 18 Yes Cruise Control SystemFuelPump 13 25 12 Yes Fuel Pump SystemPrinTok 11 89 5 Yes Print TokenVendingMachine 7 28 7 Yes Vending Machine systemINRES 8 18 8 No INRES protocolTCP 12 57 31 No TCP Standard(RFC793)TCSbin 24 65 61 No Telephony Control ProtocolLift 6 12 1 No Lift SystemTotal 107 355 161

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 25 / 34

Slice Size

Forward Slices Backward SlicesDependence # T Avg # T AvgDD+NTSCD

276 87.45% 345 70.46%

DD+NTICD

220 61.99% 278 49.48%

DD+UNTICD

267 83.20% 335 66.83%

DD

161 35.67% 174 33.15%

NTSCD

205 86.10% 336 53.63%

NTICD

92 78.67% 167 44.59%

UNTICD

190 82.21% 313 51.00%

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 26 / 34

Slice Size

Forward Slices Backward SlicesDependence # T Avg # T AvgDD+NTSCD 276 87.45%

345 70.46%

DD+NTICD 220 61.99%

278 49.48%

DD+UNTICD 267 83.20%

335 66.83%

DD 161 35.67%

174 33.15%

NTSCD 205 86.10%

336 53.63%

NTICD 92 78.67%

167 44.59%

UNTICD 190 82.21%

313 51.00%

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 26 / 34

Slice Size

Forward Slices Backward SlicesDependence # T Avg # T AvgDD+NTSCD 276 87.45% 345 70.46%DD+NTICD 220 61.99% 278 49.48%DD+UNTICD 267 83.20% 335 66.83%DD 161 35.67% 174 33.15%NTSCD 205 86.10% 336 53.63%NTICD 92 78.67% 167 44.59%UNTICD 190 82.21% 313 51.00%

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 26 / 34

Backward Slice size using NTICD

Av

era

ge

Sli

ce

Siz

e

100%

80%

60%

40%

20%

0%TCSbinTCPLiftINRESVending

MachinePrinTokFuelPumpCruise

ControlCashierATM

DataNTICDData-NTICD

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 27 / 34

Correlation of Slice Size

Forward BackwardModel Dependence NTICD UNTICD NTSCD NTICD UNTICD NTSCD

NTICD - 1.000 .652 - 1.000 .941ATM UNTICD 1.000 - .652 1.000 - .941

NTSCD .652 652. - .941 .941 -NTICD - 1.000 .898 - 1.000 1.000

Cashier UNTICD 1.000 - .898 1.000 - 1.000NTSCD .898 .898 - 1.000 1.000 -NTICD - 1.000 1.000 - 1.000 1.000

CruiseControl UNTICD 1.000 - 1.000 1.000 - 1.000NTSCD 1.000 1.000 - 1.000 1.000 -NTICD - 1.000 .786 - 1.000 -.509

FuelPump UNTICD 1.000 - .786 1.000 - -.509NTSCD .786 .786 - -.509 -.509 -NTICD - 1.000 1.000 - 1.000 1.000

PrinTok UNTICD 1.000 - 1.000 1.000 - 1.000NTSCD 1.000 1.000 - 1.000 1.000 -NTICD - 1.000 .360 - 1.000 .224

VendingMachine UNTICD 1.000 - .360 1.000 - .224NTSCD .360 .360 - .224 .224 -NTICD - x x - x x

INRES UNTICD x - 1.000 x - 1.000NTSCD x 1.000 - x 1.000 -NTICD - x x - x x

Lift UNTICD x - .813 x - 1.000NTSCD x .813 - x 1.000 -NTICD - x x - x x

TCP UNTICD x - 1.000 x - 1.000NTSCD x . - x 1.000 -NTICD - x x - x x

TCSbin UNTICD x - 1.000 x - 1.000NTSCD x 1.000 - x 1.000 -

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 28 / 34

Correlation of Slice Size

Forward BackwardModel Dependence NTICD UNTICD NTSCD NTICD UNTICD NTSCD

NTICD - 1.000 .652 - 1.000 .941ATM UNTICD 1.000 - .652 1.000 - .941

NTSCD .652 652. - .941 .941 -NTICD - 1.000 .898 - 1.000 1.000

Cashier UNTICD 1.000 - .898 1.000 - 1.000NTSCD .898 .898 - 1.000 1.000 -NTICD - 1.000 1.000 - 1.000 1.000

CruiseControl UNTICD 1.000 - 1.000 1.000 - 1.000NTSCD 1.000 1.000 - 1.000 1.000 -NTICD - 1.000 .786 - 1.000 -.509

FuelPump UNTICD 1.000 - .786 1.000 - -.509NTSCD .786 .786 - -.509 -.509 -NTICD - 1.000 1.000 - 1.000 1.000

PrinTok UNTICD 1.000 - 1.000 1.000 - 1.000NTSCD 1.000 1.000 - 1.000 1.000 -NTICD - 1.000 .360 - 1.000 .224

VendingMachine UNTICD 1.000 - .360 1.000 - .224NTSCD .360 .360 - .224 .224 -NTICD - x x - x x

INRES UNTICD x - 1.000 x - 1.000NTSCD x 1.000 - x 1.000 -NTICD - x x - x x

Lift UNTICD x - .813 x - 1.000NTSCD x .813 - x 1.000 -NTICD - x x - x x

TCP UNTICD x - 1.000 x - 1.000NTSCD x . - x 1.000 -NTICD - x x - x x

TCSbin UNTICD x - 1.000 x - 1.000NTSCD x 1.000 - x 1.000 -

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 28 / 34

Properties of Control Dependence

UNTICD and NTSCD dependences for all transitions within controlsinks are identical.

UNTICD and NTICD dependences for all transitions outside of controlsinks are identical.

The transitive closure for NTICD is contained in the transitive closurefor UNTICD.

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 29 / 34

Properties of Control Dependence

PropositionFor an EFSM M, if Ti ∈ M is a self-looping transition, then there is notransition Tj that is control dependent (NTSCD, NTICD or UNTICD) on Ti.

Ti

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 30 / 34

Properties of Control Dependence

PropositionFor an EFSM M, if two transitions Ti and Tj have the same source and

target states, and TiCD−→ Tl (using NTSCD, NTICD or UNTICD) then

TjCD−→ Tl (using NTSCD, NTICD or UNTICD respectively).

Ti

Tj

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 31 / 34

Properties of Control Dependence

PropositionFor an EFSM M, if all states s ∈ M where s 6= START have a transition Ti

where source(Ti) = s and target(Ti) = EXIT, then the set of transitions thatare directly control dependent on Ti are the same for all types of controldependence, i.e. NTSCD, NTICD and UNTICD.

START

S1

T1

S2

T2

EXIT

T16

T3T4T5T6T7

S3

T8 T9 T10

T15

T11T12 T13 T14

T17

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 32 / 34

Summary of Dependence Analysis

NTSCD, NTICD and UNTICD are defined for EFSM

The properties are formally proved

Empirically studies on dependence size

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 33 / 34

Questions?

[email protected]

http://slim.dcs.kcl.ac.uk/

Slicing of EFSMs Zheng Li CREST, KING’S COLLEGE LONDON 34 / 34