+ All Categories
Home > Documents > Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

Date post: 24-Dec-2015
Category:
Upload: rodney-moore
View: 216 times
Download: 0 times
Share this document with a friend
Popular Tags:
56
Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification
Transcript
Page 1: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

Lecture 6Template Semantics

CS6133 Fall 2011Software Specification and

Verification

Page 2: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 2

Input Language to Formal Analysis Tools

Input languages to many analysis tools are close to low-level computation models

Kripke structures BDDs Automata

Model inN’s Input Language Model Checker

N Properties

Trueor False

(withCounterexample

s)

Page 3: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 3

Formal Specification NotationsSpecification notations describe systems’ behavior

Process algebras, e.g., CCS, FSP State-based notations, e.g., statecharts

Model-based notations are suitable and flexible for modeling large reactive systems

Step semantics are intuitive for software practitioners Composition mechanisms provide facilities to

represent concurrency, communication, and synchronization

Specification errors can be easier and cheaper to fix in the early stages – using analysis tools

Page 4: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 4

Analyzing Specification Notations

Model inN’s Input Language Model Checker

N Properties

Trueor False

(withCounterexample

s)

How to bridge the gap

between specification notations

and analysis tools ?

Model inSpecificationNotation M

Page 5: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 5

Current Approaches for Analyzing Specification

Construct a specific tool for a specification notation [Cleaveland & Parrow & Steffen, Harel & Naamad]

Properties

Trueor False

(withCounterexample

s)

Model inSpecificationNotation M

Model inN’s Input Language Model Checker

N

Model Checker

for Notation M

Page 6: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 6

Current Approaches for Analyzing Specifications

Write a translator from a notation to the input language of an analyzer [Atlee & Gannon, Cheng et al., Chan et al.]

Model inN’s Input Language Model Checker

N Properties

Trueor False

(withCounterexample

s)

Model inSpecificationNotation M

Translator

From M to N

Page 7: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 7

Semantics-Based Model Compilation

[Day & Joyce, Dillion & Stirewalt, Pezze & Young]

Model inN’s Input Language Model Checker

N Properties

Trueor False

(withCounterexample

s)

Model inSpecificationNotation M

Semantics for Notation M

Model Compiler

Transition Relationor Reachability Graph

Page 8: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 8

Parameterized Semantics-Based Model Compilation

Model inN’s Input Language Model Checker

N Properties

Trueor False

(withCounterexample

s)

Model inSpecificationNotation M

Model Compiler

Transition Relation

CommonTemplate Semantics Semantics of M

Given by Template Parameter

Values

Page 9: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 9

Template SemanticsTemplate semantics

A new approach to structure the semantics of model-

based specification notations that captures the common

behavior

among notations and parameterizes their differences

Separation of concerns among aspects of a notation’s

semantics, e.g., step semantics, composition operators

Page 10: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 10

Computation ModelHierarchical transition system (HTS) is a hierarchical, extended finite state machine without concurrency

Page 11: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 11

Computation Model --- Syntax

An HTS contains States and a state hierarchy Internal and external events Variables Transitions

src name: trig, [cond], gen, /asn, #prty

dest

S1 t1: e, [x>3], a

S2

Example:

Page 12: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 12

Semantics of HTS --- SnapshotSnapshot: observable point in execution

BasicElements

current statescurrent internal eventscurrent variable valuescurrent generated events

AuxiliaryElements

used to determine which transitions are enabled

auxiliary statesauxiliary internal eventsauxiliary variable values auxiliary external events

Page 13: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 13

Common Semantics of HTSBehavior of an HTS is described by the possible execution steps it can take

Which transition is enabled

enabling states

enabling events

enabling variables How the HTS is affected by executing a transition

Step relates the current snapshot and the next snapshot of an HTS

Page 14: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 14

Micro-step: one transition execution Macro-step: a sequence of micro steps until the system is stable

Step Semantics

macro-step

micro-step micro-step micro-step

Input

stableSS0 SS1 SS2

Page 15: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 15

Three types of macro-steps Simple diligent: e.g., CCS

take a micro-step if a transition is enabled

Simple non-diligent: e.g., BTS

take a micro-step or stay idle

Stable: e.g., statecharts

a maximal sequence of micro-steps until no

enabled transitions for the set of inputs

Step Semantics

Page 16: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 16

Common Template Definitions Common semantics

reset

enabled transitions

apply

Template parameters

reset state info reset event info reset variable info

enabling states enabling events enabling variable

values

change state generate events change variable

values

Page 17: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 17

Common Templates

enabled_trans (ss,T): the subset of transitions in T that are enabled by snapshot ss’s states, events, and variable values apply (ss,,ss’): applying transition ’s actions (variable assignments, generated events) to snapshot ss may produce snapshot ss’

micro-step (ss,,ss’): transition is enabled in snapshot ss, and its actions may produce next snapshot ss’

macro-step (ss,I, ss’): there is a sequence of micro-steps that starts from snapshot reset(ss,I) and ends the macro-step in snapshot ss’

reset (ss,I)=ssr: reseting snapshot ss at the start of a macro-step with inputs I produces snapshot ssr

Page 18: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 18

current statecurrent int_evcurrent var_valcurrent output

auxiliary stateauxiliary int_ev

auxiliary

var_val

auxiliary

ext_even_states

en_eventsen_cond

RESET NEXT

how reset atbeginning of macro-step

how changed when a transition is taken

how used toenable a transition

Template Parameters

Page 19: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 19

current state CScurrent int_ev IEcurrent var_val

AVcurrent output O

auxiliary state

CSaauxiliary int_ev

IE

auxiliary var_val

AVa

auxiliary ext_ev

Iaen_states

en_eventsen_cond

RESET NEXT

how reset atbeginning of macro-step

how changed when a transition is taken

how used toenable a transition

Event-Related Template Parameters

EnablingEvents

Page 20: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 20

Enabling Events

Enabling internal events1. Events generated since the beginning of the macro-

step

2. Events generated in the previous micro-step

Enabling external events1. Events from the input are persistent through macro-

step

2. Events from the input are enabling only at the first micro-step

Page 21: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 21

Enabling Events

Enabling internal events1. Events generated since the beginning of the macro-

step

Enabling external events1. Events from the input are persistent through macro-

step

SS11: e, ^a

IE = Ia = {e}

trig() = e

SS0

Input

Page 22: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 22

Enabling Events

Enabling internal events1. Events generated since the beginning of the macro-

step

Enabling external events1. Events from the input are persistent through macro-

step

SS0 SS2SS0

IE = {a} Ia = {e}

trig() = a

1: e, ^a 2: a

IE = Ia = {e}

trig() = e

SS1

Input

Page 23: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 23

Enabling Events

Enabling internal events1. Events generated since the beginning of the macro-

step

Enabling external events1. Events from the input are persistent through macro-

step

SS0 SS3SS0

IE = {a} Ia = {e}

trig() = a

1: e, ^a 2: a

IE = Ia = {e}

trig() = e

SS1 SS2

IE = {a} Ia = {e}

trig() = e

3: e

Input

Page 24: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 24

Enabling Events

Enabling internal events1. Events generated since the beginning of the macro-

step

Enabling external events1. Events from the input are persistent through macro-

step

SS0SS0

IE = {a} Ia = {e}

trig() = a

1: e, ^a 2: a 3: e

IE = Ia = {e}

trig() = e

SS1 SS2

IE = {a} Ia = {e}

trig() = e

IE = {a} Ia = {e}

trig() IE Ia

SS3

Input

Page 25: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 25

Enabling Events

Enabling internal events2. Events generated in the previous micro-step

Enabling external events2. Events from the input are enabling only at the first

micro-step

SS11: e, ^a

IE = Ia = {e}

trig() = e

SS0

Input

Page 26: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 26

Enabling Events

Enabling internal events2. Events generated in the previous micro-step

Enabling external events2. Events from the input are enabling only at the first

micro-step

SS21: e, ^a

IE = Ia = {e}

trig() = e

SS0

IE = {a} Ia =

trig() = a

SS12: a

Input

Page 27: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 27

Enabling Events

Enabling internal events2. Events generated in the previous micro-step

Enabling external events2. Events from the input are enabling only at the first

micro-step

1: e, ^a

IE = Ia = {e}

trig() = {e}

SS0

IE = {a} Ia =

trig() = {a}

SS12: a

IE = Ia =

trig() IE Ia

SS2

Input

Page 28: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 28

current state CScurrent int_ev IEcurrent var_val

AVcurrent output O

auxiliary state

CSaauxiliary int_ev

IE

auxiliary var_val

AVa

auxiliary ext_ev

Iaen_states

en_eventsen_cond

RESET NEXT

how reset atbeginning of macro-step

how changed when a transition is taken

how used toenable a transition

Template Parameters for STATEMATE

EnablingEvents

IE’ = gen()

n/a n/a

Ia’ = ss.Ia Ia’ =

trig() ss.IE ss.Ia

Page 29: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 29

Enabling States

Current statesStates at the beginning of the macro-step

SS0 SS1 SS2 SS3SS0

CS

CSa

en_states

1 2 3

Page 30: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 30

Enabling States

Current states

SS0 SS1 SS2 SS3SS0

CS = {P}

CSa = {P}

source(1)=P

1

en_states := source () CS

Page 31: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 31

Enabling States

Current states

SS0 SS2 SS3SS0

CS = {P}

CSa = {P}

source(1)= P

1 2

CS = {Q}

CSa =

source(2)=Q

en_states := source () CS

SS1

Page 32: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 32

Enabling States

Current states

SS0 SS1 SS3SS0

CS = {P}

CSa = {P}

source(1)=P

1 2 3

CS = {Q}

CSa =

source(2)=Q

en_states := source () CS

CS = {R}

CSa =

source(3)=R

SS2

Page 33: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 33

Enabling States

Current states

SS0 SS1 SS2SS0

CS = {P}

CSa = {P}

source(1)= P

1 2 3

CS = {Q}

CSa =

source(2)=Q

en_states := source () CS

CS = {R}

CSa =

source(3)=R

CS = {S}

CSa =

source CS

SS3

Page 34: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 34

Enabling States

States at the beginning of the macro-step

SS0 SS1 SS2 SS3SS0

CS = {P}

CSa = {P}

source(1)=P

1

en_states := source () CSa

Page 35: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 35

Enabling States

States at the beginning of the macro-step

SS0SS0

CS = {P}

CSa = {P}

source(1)=P

1

CS = {Q}

CSa =

source CSa

en_states := source () CSa

SS1

Page 36: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 36

Compose multiple HTSs into a system, and represent

Concurrency Communication Synchronization

Constrain Which component to execute When to transfer control to each other How to exchange events and data

Rely on template parameters to ensure their semantics are consistent with the step semantics

Composition Operators

Page 37: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 37

Composition Operators

CP1

CP2 CP3

CP4HTS3

HTS1 HTS2

HTS4 HTS5

Page 38: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 38

Parallel

Interleaving

Synchronization Environmental synchronization Rendezvous synchronization

Interrupt

Sequence

Choice

Composition Operators

Page 39: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 39

Parallel

Interleaving

Synchronization Environmental synchronization Rendezvous synchronization

Interrupt

Sequence

Choice

Composition Operators

Page 40: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 40

Parallel Composition

Components execute in parallel

Page 41: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 41

Parallel Composition

Each component takes a transition if both are enabled simultaneously

Page 42: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 42

Parallel Composition

Enabled component executes in isolation

Page 43: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 43

Environmental Synchronization

x x

y

Components synchronize on an external synchronization event

Page 44: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 44

Environmental Synchronization

x x

y

x syncEv

Each component takes a transition if enabled by an external synchronization event

Page 45: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 45

Environmental Synchronization

x x

yy syncEv

Components interleave

Page 46: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 46

Interrupt

Transfer control from one component to the other

Page 47: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 47

Interrupt

Interrupt transition has priority and executes

Page 48: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 48

Interrupt

The left component has priority and steps

Page 49: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 49

Interrupt --- Formal Definition

Page 50: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 50

Validation of Template Semantics

Template semantics is Succinct

Description of a notation is an instantiation of parameters

ExpressiveCCS, CSP, LOTOS, statecharts variants, and BTS

SCR, Petri Net, and SDL Extensible

History states, negated events, and SDL timers

Template semantics eases a user’s effort in understanding and comparing specification notations

Page 51: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 51

Template Semantics for Notations

Instantiate the template definitions to describe a

modeling notation Specify the notation’s step semantics as a set of

parameter values Map notation’s composition operators to pre-defined

template composition operators

Page 52: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 52

Comparing Statecharts Variants

Page 53: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 53

Model Checker

Metro

Transition Relation

Semantics of M given bytemplate parameter valuesnew composition operators

Spec inCHTS

Spec informal

notation M

SyntacticTransliteration

Model Compiler (SFE)

Fusion

CommonTemplateSemantics

Pre-definedComposition

Operators

SnapshotGenerator

Snapshots

: Parameterized Model Compiler

Page 54: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 54

Template semantics forms the theoretical

foundation for Parameterized template definitions represent

common allowable execution steps of model-based

notations

Parameters describe a notation’s distinct semantics

Composition operators, defined as a separate

concern, constrain how multiple HTSs execute

concurrently

A notation’s semantics is expressed as a set of

parameter values and composition operators

: Parameterized Model Compiler

Page 55: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 55

takes as input a specification and its template semantics description (a set of template-parameter values and composition operators)

produces for a specification a transition relation, which can be used as an input to formal analysis tools (e. g., model checker)

eases effort required for mapping multiple notations to analysis tools

As a notation evolves, a user only needs to modify parameter values to reflect the notation’s changes

: Parameterized Model Compiler

Page 56: Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.

CS6133 56

SummaryTemplate semantics: structure a notation’s semantics

Capture the common behaviors among notations and parameterizes their differences

Separate concerns among aspects of a notation’s semantics

Ease a specifier’s effort in understanding and comparing different model-based notations

: map specification notations to analysis tools

Compile a specification into a transition relation based on the template-semantics description of the notation

Facilitate the transformation of new notations or notation variants to analysis tools


Recommended