i r i s aymodel c hec king in the presen t framew ork that considers in nite state systems and prop...

22
I R I S A I N S T IT U T D E R E C H E R C H E E N IN F O R M A TIQ U E E T S Y S T È M E S A L É A T OIR E S P U B L I C A T I O N I N T E R N E N o I R I S A CAMPUS UNIVERSITAIRE DE BEAULIEU - 35042 RENNES CEDEX - FRANCE ISSN 1166-8687 1640 VERIFICATION AND SYMBOLIC TEST GENERATION FOR SAFETY PROPERTIES VLAD RUSU, HERVÉ MARCHAND, AND THIERRY JÉRON

Upload: others

Post on 24-Jan-2021

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

I R

I S

AIN

STIT

UT D

E R

EC

HER

CH

E E

N IN

FORM

ATIQUE E

T SYSTÈMES ALÉATOIRES

P U B L I C A T I O NI N T E R N ENo

I R I S ACAMPUS UNIVERSITAIRE DE BEAULIEU - 35042 RENNES CEDEX - FRANCEIS

SN

116

6-86

87

1640

VERIFICATION AND SYMBOLIC TEST GENERATION FOR SAFETYPROPERTIES

VLAD RUSU, HERVÉ MARCHAND, AND THIERRY JÉRON

Page 2: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques
Page 3: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTÈMES ALÉATOIRES

Campus de Beaulieu – 35042 Rennes Cedex – FranceTél. : (33) 02 99 84 71 00 – Fax : (33) 02 99 84 71 71

http://www.irisa.fr

Veri�cation and Symbolic Test Generation for Safety Properties

Vlad Rusu� Herv� Marchand� and Thierry J�ron

Syst�mes communicantsProjet VerTeCs

Publication interne n����� � ao�t ��� � � pages

Abstract� This paper presents a combination of verication and conformance testing techniquesfor the formal validation of reactive systems� A formal specication of a system � an input�outputautomaton with variables that may range over innite domains � is assumed� Additionally a set ofsafety properties for the specication are given under the form of observers described in the sameformalism� Then each property is veried on the specication using automatic techniques �e�g� ab�stract interpretation� that are sound but not necessarily complete for the class of safety propertiesconsidered here� Next for each property a test case is automatically generated from the specicationand the property and is executed on a black�box implementation of the system� If the vericationstep was successful that is it has established that the specication satises the property then thetest execution may detect the violation of the property by the implementation and the violation of thestandard ioco conformance relation ���� between implementation and specication� On the other hand if the verication step did not conclude �i�e� it did not allow to prove or to disprove the property� then the test execution may additionally detect a violation of the property by the specication�The informations about the relative �in�consistencies between specication implementation and

properties are reported to the user as test verdicts� The approach is illustrated on the BRP protocol ����

Key�words� symbolic verication conformance testing symbolic test generation

�R�sum� � tsvp�

Centre National de la Recherche Scientifique Institut National de Recherche en Informatique(UMR 6074) Université de Rennes 1 – Insa de Rennes et en Automatique – unité de recherche de Rennes

Page 4: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

V�ri�cation et g�n�ration de tests symboliques pour des propri�t�s

de s�ret�

R�sum� � Cet article pr�sente une combinaison de techniques de v�rication et de test de conformit�pour la v�rication de syst�mes r�actifs� A partir d�une sp�cication formelle d�un syst�me r�actif d�crit sous la forme d�un automate � entr�es�sorties �tendu avec des variables portant sur des domainesnis ou innis et d�un observateur �d�crit dans le m�me formalisme� pour une propri�t� de s�ret� la premi�re �tape consiste � v�rier automatiquement la propri�t� sur la sp�cication par des tech�niques approch�es �� base d�interpretation abstraite� qui sont conservatives pour la classe de propri�t�sconsid�r�e� Ensuite un cas de test est automatiquement g�n�r� et ex�cut� sur une impl�mentationbo�te�noire du syst�me� Si la v�rication a permis d��tablir que la propri�t� est satisfaite par la sp��cication l�ex�cution du cas de test peut d�tecter des violations de la propri�t� par l�impl�mentationet�ou la violation de la relation de conformit� ioco ���� entre impl�mentation et sp�cication� Enrevanche si la v�rication n�a pas permis d��tablir si la sp�cication satisfait la propri�t� ou non �cequi peut arriver en pratique pour des syst�mes innis� l�ex�cution du cas de test peut en plus d�tecterla violation de la propri�t� par la sp�cication� Les informations ainsi obtenues sur les comportementsrelatifs de la sp�cication de l�impl�mentation et de la propri�t� sont retourn�es � l�utilisateur sousla forme de verdicts de test� L�approche est illustr�e sur le protocole BRP ��� de Phillips�

Mots cl�s � v�rication symbolique test de conformit� g�n�ration de tests symboliques

Page 5: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties �

� Introduction

Formal verication and conformance testing are two well�established approaches for validating softwaresystems� Both approaches consist in checking the consistency of two representations of a system�

� formal verication typically compares an operational specication of the system with respect tosome higher�level required properties

� conformance testing �� �� compares the observable behaviour of a black�box implementation ofthe system with the corresponding behaviour described by an operational specication�

Conformance testing is typically performed by automatically deriving test cases from the specication and by running the test cases on the implementation to obtain test verdicts about the conformancebetween the two representations of the system �� � � �� �� ����For example in ��� enumerative model�checking algorithms are employed for generating test

cases from an operational specication and so�called test purposes as guidelines for test selection�Test generation consists in exploring a product between specication and test purpose eliminatingnondeterminism and incorporating verdicts into the result� and the generated test cases check theconformance between the implementation and the part of the specication selected by the test purposes�An alternative approach is proposed in ����� Rather than exploring the �large or potentially innite�

state space of the product between test purpose and specication the product is kept in a symbolicform� The resulting test cases are reactive programs that operate on symbolic variables and exchangevalues with the implementation by means of input�output actions carrying symbolic parameters�In ���� we propose to integrate the verication of safety properties and conformance testing in a

formal validation methodology for reactive systems�

� rst the safety properties are automatically veried on the specication by model checking

� then test cases are automatically derived from the specication and the properties

� nally the test cases are executed on the black�box implementation of the system which allowsto check the satisfaction of the properties by the implementation and the conformance betweenimplementation and specication�

The present paper proposes a symbolic approach that extends ���� very much like ���� extends ����

� the verication and the test generation steps are symbolic rather than enumerative�

� safety properties rather than test purposes are employed for test generation�

A major di�erence between ���� and this paper concerns the decidability of the verication step� In thenite�state framework of ���� the verication is decidable and is performed by model checking� In thepresent framework that considers innite�state systems and properties the verication is undecidable�it is performed using automatic techniques based on abstract interpretation that are sound but as aprice to pay for automation are not necessarily complete for the class of safety properties consideredhere� If the verication succeeds then the property is satised by the specication� otherwise thestatus of the property is unknown and the test generation algorithm has to take this into account�Hence the test execution produces verdicts which may reveal one or several of the following situations�

� violation of the property by the specication

� violation of the property by the implementation

� violation of conformance between implementation and specication�

PI n�����

Page 6: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

� Vlad Rusu� Herv� Marchand� and Thierry J�ron

The information obtained in this manner may be employed for detecting and xing errors in thespecication the implementation or the property� The verication and testing steps may be repeated until su cient condence is gained about the consistency of the three representations�The rest of the paper is organised as follows� Section presents the model of Input�Output Symbolic

Transition Systems �IOSTS� that we use for modeling all aspects of a system �specications properties implementations and test cases�� An example �the sender of the BRP protocol ���� illustrates themodel� In Section � we dene several symbolic operations on IOSTS together with some fairly standarddenitions relative to verication and conformance testing using IOSTS as the underlying model�Section � is devoted to dening a symbolic test generation algorithm that takes a specication and asafety property and produces a test case for checking the conformance of an implementation with thespecication and the satisfaction of the safety property by the implementation� As discussed above thetest case may also detect violations of the property by the specication� The test generation algorithmis proved correct in the sense that the verdicts returned by test execution correctly characterise therelations between implementation specication and property� As a by�product of the correctnessproofs we show that conformance to a given specication is equivalent to satisfaction of a safetyproperty which can be expressed as an observer built from the specication� as far as we know thisrather general result connecting verication and conformance testing is new� In Section � we outlinea technique for statically eliminating parts of a test case from which violations of the property by theimplementation �arguably the main goal of testing� cannot be detected any more� We show that thisoptimisation preserve the correctness of test cases� Section � concludes and presents related work�

� The IOSTS Model

The model of Input�Output Symbolic Transition Systems �IOSTS� is inspired from I�O automata �����Unlike I�O automata IOSTS do not require input�completeness �all input actions enabled all the time��

De�nition � �IOSTS� An IOSTS is a tuple hD��� Q� q����T i where

� D is a nonempty� �nite set of typed data� which is the disjoint union of a set V of variables� a setC of symbolic constants and a set P of parameters� For d � D� type�d� denotes the type of d�

� � is the initial condition� a Boolean expression on V � C�

� Q is a nonempty� �nite set of locations�

� q� � Q is the initial location�

� � is a nonempty� �nite alphabet� which is the disjoint union of a set �� of input actions� a set ��

of output actions� and a set �int of internal actions� For each action a � �� its signature sig�a�is a tuple of types� The signature of internal actions is the empty tuple�

� T is a set of transitions� Each transition is a tuple hq� a� ��G�A� q�i made of�

� a location q � Q� called the origin of the transition�

� an action a � � called the action of the transition�

� a tuple h�iii�����k of parameters such that if sig�a� � h�jij�����l then k � l and �i � � � � � k�type��i� � �i�

� a Boolean expression G on V � C � �� called the guard�

� an assignment A� which is a set of expressions of the form �x �� Ax�x�V such that� for each

x � V � the right�hand side Ax of the assignment x �� Ax is an expression on V �C � ��

� a location q� � Q called the destination of the transition�

Irisa

Page 7: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties �

rn=0 & head=0& max>=1 & bit=true

tau2rn:=0

l>headREQ?(l)last:=l

pMsg=f[head] & pBit=bitMSG!(pMsg,pBit)

rn:=rn+1

head<last-1ACK?

head:=head+1rn:=0, bit:=not bit

rn<maxtau1

rn=maxtau1

head=last-1ACK?

head:=head+1

head<last-1NOT_OK!

head=lastOK!

head=last-1DONT_KNOW!

Wait_Req

Send_File

Wait_Ack

Send_Complete

Wait_Timeout2

Figure �� � the Sender of the BRP Protocol�

Our running example is the specication of the BRP protocol ��� which was designed to safely transmitles over an unsafe medium� The protocol uses a combination of alternating�bit and resend�on�timeoutmechanisms� Here we are only interested in the sender of the protocol which is represented in Figure ��The corresponding IOSTS has variables rn head last and bit symbolic constants max and f

and parameters l pMsg and pBit� Except for bit pBit and f all the other data are of integer type�bit is a Boolean modeling the alternating bit� f �the le to be sent� is an array of integers� pMsg is aninteger that models the current message being sent together with the Boolean parameter pBit�The variable last �resp� the constant max� stand for the number of packets in the le to be sent

�resp� the maximum number of retransmissions of a packet�� The variable head indicates the currentpacket �f���� f��� � � � � to be sent and the variable rn is employed for counting retransmissions�Consider for example the transition with origin Send�File and destination Wait�Ack� It has

the output action MSG with parameters pMsg� pBit guard �pMsg � f head� � �pBit � bit� andassignment rn �� rn�� bit �� bit f �� f head �� head� In the graphical representation the symbol� �resp� �� denotes an input �resp� an output� action and identity assignments �rn �� rn� are omitted�

An IOSTS starts in the initial location with values of the variables and symbolic constants satisfyingthe initial condition and proceeds by ring transitions updating the variables according to the guardsand assignments of the transitions red and exchanging information with the environment throughinput and output actions� For example the sender of the BRP protocol �cf� Figure �� initially waitsfor a REQ input� On reception of this input with parameter l � head the value of l is saved in thevariable last� Then f���� f��� etc are sent to the receiver �output MSG� together with an alternatingbit� A packet may be acknowledged �input ACK� or there may be a timeout �internal action ���

PI n�����

Page 8: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

� Vlad Rusu� Herv� Marchand� and Thierry J�ron

after which a the packet may be resent at most max� � more times� Finally the status of the wholetransmission is reported to the environment by an output action� either OK �all packets were sent andacknowledged�� DONT�KNOW �all packets were sent and all but the last were acknowledged meaningthat either the last packet or the last acknowledgment were lost�� or NOT�OK �some intermediarypacket was not acknowledged��

Semantics More formally a state is a pair hl� vi where l is a location and v is a valuation for thevariables and the symbolic constants� The set of valuations is denoted V and the set Q� V of statesis denoted by S� An initial state is a state hl�� v�i such that l� is the initial location and v� satisesthe initial condition� The set of initial states is denoted S�� A valued action is a pair ha�wi where a isan �input output or internal� action and w is a valuation for the parameter�s� carried by the action�Note that the values of parameters are not contained in states but in valued actions� to be memorised the values of parameters have to be assigned to variables otherwise they are lost� The set of valuedactions is denoted by �� it is the disjoint union of the set of valued inputs �� valued outputs �� andvalued internal actions �int� The latter is identied with the set �int of internal actions�For t a transition of the IOSTS the transition relation�t is the set of triples hs� �� s

�i � S���S where s � hl� vi s� � hl�� v�i are states and � � ha�wi is a valued action such that l� l� and a arerespectively the origin the destination and the action labeling t� the values of variables symbolicconstants and actions dened by v w satisfy the guard G of the transition t� and the valuation v� isobtained from v� w by executing the �parallel� assignments of transition t�The global transition relation � is ��

St�T �t where T denotes the set of transitions of the

IOSTS� We write s�� s� for �s� �� s�� ���

De�nition �behavior� A behavior fragment is a sequence of alternating states and valued actions

� � s���� s�

��� sn���n��� sn� A behaviour is a behavior fragment that starts in an initial state�

A state is reachable if it is the last state of a behaviour� For a sequence � ���� �n of valued actions we sometimes write s

�� s� for there exist s�� � � � sn�� � S such that s � s�

��� s���� sn

�n� sn�� � s��For a set of states S� S of the IOSTS we write s

�� S� if there exists a state s� � S� such that s

�� s��

De�nition � �coreachability� A state s is coreachable for a set of states S� if there exist � ��

such that s�� S�� The set of states that are coreachable for S� is called the coreachable set of S��

We often identify a location q � Q with the set of states fhq� vijv � Vg �V denotes the set of valuationsof the variables and symbolic constants of the IOSTS�� Then the notation s

�� q and the notions of

reachable location and coreachable set of a given location are also dened� A trace is the subsequenceof a behavior containing only what is externally visible that is valued inputs and valued outputs�

De�nition � �trace� The trace of a behavior � is the projection of � on �� � ��� The set of traces

of an IOSTS S �i�e�� the set of traces of all behaviours of S� is denoted by Traces�S��

� Veri�cation and conformance testing with IOSTS

This section sets the framework for verication and conformance testing with IOSTS� First we presenta few operations on IOSTS and then the satisfaction relation �for verication� and the conformancerelation �for conformance testing� between IOSTS are formally dened�

Irisa

Page 9: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties �

��� Parallel Product

The parallel product operation lets each system perform independently its internal actions and imposessynchronization on the shared input and output actions� The operation is dened for compatible IOSTS�

De�nition �Compatible IOSTS� For j � �� � the two IOSTS Sj � hDj ��j � Qj � q�j ��j �T ji with

data Dj and alphabet �j � ��j � ��

j � �intj are compatible if D� � D� � �� ��

� � ���� �

�� � ��

��

�int� ��int

� � �� and each a � ��� � ��

� �� ��� � ��

�� has the same signature in both systems�

De�nition � �Parallel Product� The parallel product S � S�jjS� of two compatible IOSTS S��S�

is the IOSTS hD�P��� Q� q����T i that consists of the following elements� V � V� � V�� C � C� �C��

P � P��P�� � � ������ Q � Q��Q�� q� � hq��� q

��i� �

� � ��� � ��

�� �� � ��

� � ���� �

int � �int� ��int

� �

The set T of transitions of the composed system is de�ned as follows�

� for each transition hq�� a� ��G�A� q��i � T � with a � �int

� and for each location of the form

hq�� q�i with q� � Q�� there is a transition of the form hhq�� q�i� a� ��G�A� hq��� q�ii in S�jjS� �and

similarly for all a � �int� ��

� for all transitions hq�� a� ��� G�� A�� q��i � T �� hq�� a� ��� G�� A�� q

��i � T � with a � ��

�� let G���

�resp� A���� denote the expression obtained by syntactically replacing in G� �resp� A�� each

parameter from �� by the corresponding� same�position parameter from ��� Then� in S�jjS�

there is a transition hhq�� q�i� a� ��� G� �G���� A� �A���� hq��� q

��ii �and similarly when a � ��

���

Lemma � ������ Traces�S�jjS�� � Traces�S�� �Traces�S���

��� Quiescence� and quiescent IOSTS

We here assume that the environment may observe not only outputs but also absence of outputs �i�e� in a given state the system does not emit any output for the environment to observe�� This is calledquiescence in conformance testing ����� On a black�box implementation quiescence is observed usingtimers� a timer is reset whenever the environment sends a stimulus to the implementation� when thetimer expires the environment observes quiescence� However on a �white�box� specication such asthat depicted in Figure � quiescence is materialized by adding a special output action which mayoccur in a location if and only if no other output or internal actions are reable in that location�

De�nition � �quiescent IOSTS� Given an IOSTS S with set of variables V � actions � � �������int� and transitions T � the quiescent IOSTS S� is obtained from S by adding a new output action to ��� and� for each location l of S� a new self�looping transition� labeled with action � with identityassignments i�e�� x �� x for all variables x � V � and whose guard is de�ned by the expression

a��int���

G�a� ���

where

G�a� ��

t�hl�a���Gt�At�l�ti�T

�� � sig�a��Gt��� ��

Interpretation� The new output action may be red in a location l i� no other outputs or in�ternal actions may be red in l� Now an action a may be red in l i� there exists a transitiont � hl� a� ��Gt� At� l

�ti � T with action a and values for the parameters � carried by a �which can be

seen as a single vector value of type sig�a� cf� Denition �� such that by replacing the parameters �

PI n�����

Page 10: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

� Vlad Rusu� Herv� Marchand� and Thierry J�ron

rn=0 & head=0 & max>=1 & bit=true

head=lastOK!

l>headREQ?(l)last:=l

head=last-1DONT_KNOW!

DELTA!

head>last+1DELTA!

pMsg=f[head] & pBit = bitMSG!(pMsg,pBit)

rn:=rn+1

tau2rn:=0

head<last-1ACK?

head:=head+1rn:=0

bit:=not bit

rn<maxtau1

rn = maxtau1

head=last-1ACK?

head:=head+1

rn>maxDELTA!

head<last-1NOT_OK!

Wait_Req

Send_File

Wait_Ack

Send_Complete

Wait_Timeout2

Figure � � the IOSTS Sender��

with their values the resulting formula Gt��� is satisable� Hence Formula �� takes the disjunction for all transitions t � hl� a� ��Gt� At� l

�ti � T and valuations of �� of the formulas Gt����

The result denoted G�a� in Formula �� gives the conditions on the system�s variables and symbolicconstants under which the action a is reable in l� Finally Formula ��� says that may be red in li� no other output or internal action is reable in l� Hence it takes the conjunction of the negationsof all formulas G�a� for all a � �int � ���

Example For the IOSTS Sender depicted in Fig� � the IOSTS Sender� is depicted in Fig� � In theSend�File location Formula ��� becomes �hpMsg � int� pBit � booli��pMsg � f head � pBit � bit� which reduces to false� Similarly in Wait�Timeout� the �� action is always reable and Formula ���evaluates to false� Hence is not reable in locations Send�File and Wait�Timeout�� On the otherhand might be reable in the three remaining locations� Wait�Req Wait�Ack and Send�Complete�For example the guard of the �labeled transition on location Wait�Ack is rn � max because� thereare two outgoing transitions labeled by an internal action ���� which have the guards rn � max andrn � max respectively� and no outgoing transitions are labeled by outputs� �Of course just as anyother action is actually reable only if its guard actually evaluates to true in a reachable state��

�disjunction over all valuations of � is encoded using existential quanti�cation�

Irisa

Page 11: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties �

rn=0 & head=0 & max>=1 & bit=true

head>last+1DELTA!

l>headREQ?(l)last:=l

rn<max&pMsg=f[head]&

pBit=bitMSG!(pMsg,pBit)

rn:=rn+1

DELTA!

rn=max&head<last-1NOT_OK!

pMsg=f[head]&pBit=bit

MSG!(pMsg,pBit)rn:=rn+1

rn=max&head=last

OK!

head<last-1ACK?

head:=head+1rn:=0

bit:=not bit

rn=max&head=last-1

DONT_KNOW!

head=last-1ACK?

head:=head+1

rn=max& head>last+1

DELTA!

rn>maxDELTA!

l>headREQ?(l)

rn:=0last:=l

head<last-1NOT_OK!

DELTA!rn:=0

head=lastOK!

head=last-1DONT_KNOW!

Wait_Req

Send_File

Wait_Ack

Send_Complete

Wait_Timeout2

Figure �� the IOSTS det�Sender���

��� Deterministic IOSTS� and determinisation

An IOSTS is deterministic if it does not have internal actions and in each location the guards oftransitions labeled by the same action are mutually exclusive�

De�nition � �deterministic IOSTS� An IOSTS hD��� Q� q����T i is deterministic if �int � ��and� for all q � Q and for each pair of transitions with origin in q and labeled by the same action a�hq� a� ��� G�� A�� q�i and hq� a� ��� G�� A�� q�i� the conjunction G� �G� is unsatis�able�

Determinising an IOSTS S means computing a deterministic IOSTS det�S� with the same tracesas S i�e� Traces�det�S�� � Traces�S�� This operation is an important step of conformance testgeneration �cf� Section ����� We brie!y present it below� full details can be found in �����For the IOSTS Sender� �cf� Fig� � the IOSTS det�Sender�� is shown in Fig� ��

Determinisation

Determinisation consists in eliminating internal actions� followed by the resolution of nondeterministic choices that remain for theobservable actions� For eliminating internal actions� the idea is to compute the e�ect of any sequence of internal actions that leadsto an input� or output�labeled transition� and to encode this e�ect in the guard and assignments of the last transition� Let ������ � � � � �n be a sequence of internal actions that leads to an input or output action a �see below�� The guard and assignmentscorresponding to �i are Gi� Ai� and the guard �resp� assignments� corresponding to a are G� A� Then� the whole sequence is replacedby a transition with origin l�� destination ln��� action a� guard G��G� �A�� � � � Gn �An�� �� � ��A��G�An �An�� �� � ��A��and assignments A �An �An�� � � � � �A�� where � denotes function composition� The procedure terminates if the IOSTS does notcontain cycles of internal actions� a common hypothesis in conformance testing ��� which is made consistently through this paper�

ln���� ��

� � �l� l��n a

G�� A� G�� A� Gn� An G�Aln��

PI n�����

Page 12: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

�� Vlad Rusu� Herv� Marchand� and Thierry J�ron

The second step consists in postponing the e�ect of a nondeterministic choice on the observable actions that follow it� This amountsto splitting� e�g�� two transitions �with non�exclusive guards G�� G� and assignments A�� A�� see below� into three� one for thecase G� � G� holds� another for the case when G� � G� holds� and the last for the case G� � G� holds� In the latter case� thechoice whether to assign the variables according to A� or to A� is postponed until the observable action that follows� Thus� if b isthe next action� then the assignment A� should have been executed� hence� this assignment is composed with the guard and theassignment corresponding to b �which produces the guard G� �A� and assignment A� �A��� Similarly� if c is the next action� thenA� should have been executed� which produces the guard G� � A� and assignment A� � A�� This procedure may not terminate�e�g�� if a � b and q� � q�� the postponing goes on forever�� but it does terminate for a nontrivial subclass of IOSTS de�ned in �� �

q�

q� q�

q� q�

q�q� q�q�

q�

G� � �G�

aG� �G�

b

G�

bG�

A�

a a

A�

cG�A�

G�A�

bG�

A�

a a

G� � �G�A�

A�

cG�A�

G� � A�A� � A� A� � A�

G� � A�

q���c

��� Veri�cation of Safety Properties

The problem considered here is� given a reactive system modeled by an IOSTS S and a safetyproperty � does S satisfy �" We model properties using observers which are deterministic IOSTSequipped with a set of #bad$ locations� the property is violated when a #bad$ location is reached�

De�nition � �Observer� An observer is a deterministic IOSTS together with a set of dedicated

locations Violate� Q�� Its language is

L� �Violate�� � f � ��� j �so � S�

���q � Violate��so��� qg ���

We say an observer � �Violate�� is compatible with an IOSTS M � or with another observer

�M�ViolateM�� if is compatible with M � The set of observers compatible with M is denoted ��M��

For example consider the following safety property of the BRP protocol� The sender cannot bequiescent between a request and a con�rmation�� That is between the REQ� input and the OK� orNOT�OK� or DONT�KNOW� outputs the sender should always output something� The observerfor the negation of this property is depicted in Figure �� The set of #bad$ locations is fViolateg� Theself�loops #%$ denote all actions that do not label other outgoing transitions�

REQ?(m)

DELTA!

OK! NOT_OK! DONT_KNOW!

*

*

l0

l1

Violate

Figure �� Sample observer�

De�nition �� �IOSTS Satis�es Observer� For S an IOSTS and an observer � �Violate�� � ��M��we say S satis�es � �Violate��� denoted by S j� � �Violate��� if Traces�S� � L� �Violate�� � ��

For example the IOSTS Sender� depicted in Figure does satisfy the observer depicted in Fig�ure �� This can be automatically veried using abstract interpretation techniques e�g� using theNBac tool ���� which has been incorporated in our STG �Symbolic Test Generation� tool ���� First

Irisa

Page 13: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties ��

STG computes the product Sender�jj and then NBac performs a symbolic reachability analysis �fromthe initial states� and coreachability analysis �to the violating locations� of the product� In our exam�ple the violating locations are found unreachable hence the property holds� In general the analysismight not allow to conclude because of the over�approximations in the reachability and coreachabilityanalyses� Note that exact analyses are impossible in general because the standard state�reachabilityproblem is undecidable for IOSTS �e�g� IOSTS subsume the class of �counter automata��

Finally the parallel product of two observers can be seen as an observer as well�

Lemma Given two compatible observers � �Violate�� and ���Violate�� the pair � jj��Violate� �Violate�� is an observer� whose language is L� jj��Violate��Violate�� � L� �Violate���L���Violate���

Note that this is not the only interpretation of the parallel product as an observer� alternative choicesfor the violating locations are e�g� Violate� � �Q� n Violate�� which indicates the violation of theformer observer but not that of the latter� and �QnViolate���Violate� which indicates the violationof the latter but not of the former observer� These notions are employed in Section � where we denetest cases for detecting violations of safety properties and of conformance to a specication�

��� Conformance Testing

A conformance relation formalises the set of implementations that behave consistently with a specica�tion� An implementation I is not a formal object �it is a physical system� but in order to reason aboutconformance it is necessary to assume that the behavior of I can be modeled by a formal object in thesame class as the specication �i�e� an IOSTS� and having a compatible interface with it� Moreover the implementation is assumed to be input�complete i�e� all its inputs are enabled all the time�These assumptions are called test hypothesis in conformance testing� The central notion in confor�

mance testing is that of conformance relation� we rephrase the ioco relation dened by Tretmans �����

De�nition �� �Conformance� For compatible IOSTS S�I �cf� Def� ��

I ioco S � Traces�S�� ��� � fg� � Traces�I�� Traces�S���

Intuitively an implementation I ioco�conforms to its specication S if after each trace of the quiescentIOSTS S� the implementation only exhibits outputs and quiescences allowed by S� Hence in thisframework the specication is partial with respect to inputs i�e� after an input that is not described bythe specication the implementation may have any behaviour without violating conformance to thespecication� This corresponds to the intuition that a specication models a given set of services thatmust be provided by a system� a particular implementation of the system may implement more servicesthan specied but these additional features should not be accounted for in conformance testing�

Example After an initial input REQ����� which is not accepted by the specication Sender� every trace conforms to the specication because the conformance relation constrains only outputs�On the other hand assume an implementation I of the Sender process depicted in Figure � such

that I� behaves just as the IOSTS Sender� depicted in Figure except for input�completeness andfor the initial condition max � � which is omitted� Then it is not hard to check that REQ���� MSG��f���� true� is a trace of I�� Hence the implementation I does not conform to Sender becauseSender� does not have traces of the form REQ� MSG� � This is because �cf� Section ���� Sender�

satises the observer depicted in Fig� � but sequences of the form REQ�MSG� violate this observer�The second part of the above example has highlighted the fact a non�conformance between imple�

mentation and specication may be indicated by the fact that the former violates a safety propertythat the latter satises� We now show how to relate conformance testing to the satisfaction of safetyproperties and how to generate test cases for attempting to violate them individually or one at a time�

PI n�����

Page 14: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

� Vlad Rusu� Herv� Marchand� and Thierry J�ron

� Test Generation for Safety and Conformance

This section shows how to generate a test case from a specication using a safety property as a guide�The test case attempts to detect violations of the property by an implementation of the system andviolations of the conformance between the implementation and the specication� Moreover if theverication step �Section ���� could not establish whether the specication satises the property thetest cases may also detect violations of the property by the specication as well�All inconsistencies between implementation specication and property discovered in this manner

are returned to the uses under the form of test verdicts� We show that the test cases generated by ourmethod always return correct verdicts� In this sense the test generation method itself is correct�

Outline We rst dene the output�completion ���M� of any deterministic IOSTS M � We thenshow that the output�completion of any IOSTS of the form det�S�� obtained by suspending and thendeterminising a given IOSTS S �cf� Sections �� ���� can be seen as a canonical tester ��� for S andthe ioco relation dened in Section ���� �A canonical tester for a specication with respect to agiven relation allows in principle to detect every implementation that disagrees with the specicationaccording to the relation�� This derives from the fact proved below that ioco�conformance to aspecication S is equivalent to satisfying �a safety property described by� an observer obtained from���det�S���� Finally by composing this observer with an arbitrary observer � �Violate�� we obtain testcases for checking the conformance to S and�or the satisfaction of the property dened by � �Violate���

De�nition � �output�completion� Given a deterministic IOSTSM with locations L� variables V �actions �� transitions T � and alphabet � � ������ the output completion ofM � denoted ���M�� is anIOSTS obtained fromM by adding a new location FailM �� L� and for each l � L and a � ��� a transition

with origin l� destination FailM� action a� assignments �x �� x�x�V � and guardV

t�hlt�at���Gt�At�l�ti�T

Gt�

That is any output not reable in M becomes reable in ���M� and leads to the new �deadlock�location FailM� The output�completion of a deterministic IOSTS M can be seen as an observer bychoosing the singleton fFailMg in Denition � as the set of violating locations� Its language satises�

Lemma � For a deterministic IOSTS M� L����M�� fFailMg� � Traces�M����MnTraces�M��

The following lemma says that ioco�conformance to a specication is basically a safety property�

Lemma � For compatible IOSTS I� S� I ioco S i� I� j� ����det�S���� fFaildet�S��g��

Proof � By Def� �� I ioco S is just Traces�S�� ��S � fg� � Traces�I�� Traces�S�� whichis equivalent to Traces�S�� ��S � fg� n Traces�S

�� � Traces�I�� � �� Using Lemma � this is justL����det�S���� fFaildet�S��g��Traces�I

�� � � which by Def� �� is just I� j� ����det�S���� fFaildet�S��g���

The lemma also says that the IOSTS ���det�S��� is a canonical tester for ioco�conformance to S�Indeed I� j� ����det�S���� fFaildet�S��g� can be interpreted as the fact that execution of �

��det�S���on the implementation I never reaches the Fail location i�e� it never leads to a #Fail$ verdict� the factthat this is equivalent to I ioco S �as stated by Lemma �� amounts to having a canonical tester ����A canonical tester is in principle enough for detecting all implementations that do not conform to a

given specication� However our goal in this paper is to detect in addition to such non�conformances some potential violations of some �additional� safety properties� The additional properties typicallyoriginate from the system�s requirements� The observers �cf� Denition �� employed for expressing theproperties also serve as a test selection mechanism� they allow to choose among the many possibleinteractions between the canonical tester and an implementation�We rst note that for M a deterministic IOSTS and � �Violate�� � ��M� the IOSTS jj���M�

is deterministic and compatible with M � It can be interpreted as an observer of M by identifying itsset of violating locations� Let for now this set be fFailMg �Violate� denoted by ViolateFail�jj��M��

�The subscript is omitted whenever it is clear from the context�

Irisa

Page 15: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties ��

Lemma �Violate�Fail language�

L� jj���M��ViolateFail�jj��M�� � L� �Violate�� � Traces�M� ��M n Traces�M��

Proof �

L� jj���M��ViolateFail�jj��M�� � L� �Violate�� � L����M�� fFailMg� �by Lemma �

� L� �Violate�� � Traces�M����M n Traces�M� �by Lemma ��

The IOSTS jj���det�S��� will play an important role and deserves a denition of its own�

De�nition �� �test�S � �� For an IOSTS S and � �Violate�� � ��S��� test�S� � � jj���det�S����

In the rest of the section we show that every test�S� � can be seen as a test case that renes thecanonical tester by identifying the traces in which the property described by � �Violate�� is violated�

Proposition � For compatible IOSTS S� I�

I ioco S i �� �Violate�� � ��S��� I� j� �test�S� ��ViolateFailtest�S�����

Proof � ���I ioco S � �cf� Lemma ��

I� j� ����det�S���� fFaildet�S��g� � �cf� Denition ���

Traces�I�� � L����det�S���� fFaildet�S��g� � � �

�� �Violate�� � ��S��� Traces�I�� � L� �Violate�� � L����det�S���� fFaildet�S��g� � �

� �cf� Denitions �� and ���

�� �Violate�� � ��S��� I� j� �test�S� ��ViolateFailtest�S�����

��� First note that ����det�S����Faildet�S��� is an observer of S�� Then

�� �Violate�� � ��S���I� j� �test�S� ��ViolateFailtest�S���� � �cf� Def� �� and above observation�

I� j� ����det�S����Faildet�S���jj����det�S����Faildet�S��� �

I� j� ����det�S����Faildet�S��� which by Lemma � is equivalent to I ioco S� �

Interpretation The IOSTS test�S� � can be seen as a test case to be executed in parallel with animplementation I� Proposition � says that if this execution enters a location in ViolateFailtest�S��� �&Violate��fFail��det�S���g� then the implementation violates both the property dened by � �Violate��and the conformance to specication S� In this situation the ViolateFail verdict is given�

ViolateFail� the implementation violates the property and the conformance

We now consider another interpretation of the IOSTS jj���M� which leads to another test verdict�By choosing the violating locations to be �Q� nViolate���fFailMg �rather than Violate��fFailMg� weobtain a di�erent observer� We denote by Fail�jj��M� the set �Q� nViolate��� fFailMg� The subscriptis omitted whenever is is clear from the context� The new observer satises�

Lemma � �Fail language� L� jj���M��Fail�jj��M�� Traces�M����M n Traces�M��

PI n�����

Page 16: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

�� Vlad Rusu� Herv� Marchand� and Thierry J�ron

Proof � By Lemma L� jj���M��Fail�jj��M�� � L����M��FailM��L� � �Q�nViolate��� L����M��FailM��and by Lemma � L����M��FailM� � Traces�M� ��

M n Traces�M�� �

Proposition For compatible IOSTS I� S and � �Violate�� � ��S���

I ioco S � I� j� �test�S� ��Failtest�S�����

Proof � By Def� �� I ioco S is Traces�S�� ��S �fg��Traces�I�� Traces�S�� which is equivalent

to Traces�S�� ��S � fg� n Traces�S�� � Traces�I�� � �� Using Lemma � and Denition �� thisimplies L�test�S� ��Failtest�S�����Traces�I�� � � which by Def� �� is I� j� �test�S� ��Failtest�S����� �

Proposition says that when test�S� � enters a location in the set Failtest�S��� �& �Q� n Violate�� �fFail��detS�g � when executed on an implementation I then I violates conformance to S� Theproperty is not violated �the Violate� set is not entered�� In this case the Fail verdict is given�

Fail� the implementation violates the conformance but not the property

A third interpretation of the IOSTS jj���M� as an observer can be given by choosing the set ofviolating locations to be Violate� �QM� We denote this set by Violate�jj��M� and omit the subscriptwhenever it is clear from the context� The language of this observer satises�

Lemma � �Violate language� L� jj���M��Violate�jj��M�� � L� �Violate�� � Traces�M��

Proof � L�M�QM� � Traces�M� and by Lemma L� jj���M��Violate�jj��M�� � L�M�QM� �L� �Violate��� �

Proposition � For compatible IOSTS I� S and observer � �Violate�� � ��S���

�a� S� j� � �Violate��� I� j� �test�S� ��Violatetest�S����

�b� I� j� � �Violate�� � I� j� �test�S� ��Violatetest�S����

Proof � �a� By Def� �� S� j� � �Violate�� is Traces�S�� � L� �Violate�� � � which impliesTraces�I���Traces�det�S����L� �Violate�� � �� by Lemma � we get I� j� �test�S� ��Violatetest�S������b� is proved in a similar manner �replace the rst two occurrences of S� by I� in the above proof�� �

Proposition � says that when test�S� � enters a location in Violatetest�S��� �& Violate� � Qdet�S���when executed on an implementation I then a violation of the property by both specication andimplementation is detected� In this case the Violate verdict is given�

Violate� the specication and the implementation violate the property

Discussion Propositions � and � show that the test generation algorithm i�e� the constructionof the IOSTS test�S� � is correct in the sense that the verdicts ViolateFail �resp� Fail� correctlydetect the violation of the property and of the conformance �resp� of the conformance only� by theimplementation� This holds irrespectively of whether the specication satises the property or not�which may not always be possible to establish�� The test case execution may detect violations of theproperty by the specication �using the Violate verdict whose correctness is proved as well��A natural question that arises is why a violation of the property by the implementation is always

detected simultaneously with either ��� a violation of the property by the specication or �� a violationof the conformance between implementation and specication� The reason is that our test cases areextracted from the specication i�e� they only contain traces of the specication� An implementationmay only violate a property without ��� or �� occurring when it executes a trace that diverges atsome point from the specication by an input� indeed as seen in Section ��� this does not compromiseconformance and of course the specication does not violate the property on such a trace because itdoes not contain it� However such traces are excluded from the generated test cases by construction�

Irisa

Page 17: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties ��

rn=0 & head=0&max>=1 & bit=true

rn=max & head=last-1DONT_KNOW?

m>headREQ!(m)last:=m

head<last-1NOT_OK?

DELTA?

head=lastOK?

pMsg=f[head]& pBit=bitMSG?(pMsg,pBit)

rn:=rn+1

head=last-1DONT_KNOW?

head<last-1ACK!

head:=head+1rn:=0,bit:=not bit

DELTA?

head=last-1ACK!

head:=head+1

m>headREQ!(m)

rn:=0last:=m

DELTA?

DELTA?rn:=0

rn<max & pMsg=f[head] & pBit=bit|MSG?(pMsg,pBit)|rn:=rn+1

rn=max&head<last-1NOT_OK?

rn=max & head=lastOK?

Wait_Req_l0

Send_File_l1

Wait_Ack_l1

Send_Complete_l1

ViolateFail

Wait_Timeout2_l0ViolateFail

Figure �� Test Case obtained from Sender �Figure �� and Observer �Figure ���

Building an actual test case To build an actual test case from test�S� � all inputs are trans�formed into outputs and reciprocally �this operation is called mirror � in the test execution process the actions of the implementation and those of the test case must complement each other�� Finally the result is automatically analysed using the NBac tool ���� for statically detecting and eliminatingtransitions that cannot lead to the ViolateFail verdict any more� This operation is described inSection ��For the Sender IOSTS depicted in Figure � and the observer depicted in Figure � the corresponding

test case is depicted in Figure �� For better readability the transitions leading to Fail have not beenrepresented and the location corresponding to the ViolateFail verdict has been duplicated�For example an implementation performing a sequence of the form REQ� MSG� leads to

ViolateFail� it has already been pointed out at the end of Section ��� that such an implementationexhibiting violates both the property described by the observer � �Violate�� �Fig �� and the confor�mance to the specication Sender �Fig ��� Finally note that the test case does not have a Violateverdict because �cf� Section ���� Sender� does satisfy the property described by � �Violate���

� Pruning a Test Case

The main goal of the testing process is to detect violations of the system�s required properties by thesystem�s implementation� In this section we outline a technique for statically detecting and eliminatinglocations and transitions of a test case �generated from a specication and a property as described inSection �� from which this goal cannot be achieved any more i�e� from which violations of the propertyby the implementation cannot be detected� Hence this operation constitutes an optimisation in thesense that it allows to terminate test execution earlier whenever it becomes clear that no futureviolations of the property may be detected� We show that the operation preserves test case correctness�

PI n�����

Page 18: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

�� Vlad Rusu� Herv� Marchand� and Thierry J�ron

The violation of a property � described as an observer � �Violate�� � by an implementation is mate�rialised by reaching the ViolateFail and Violate sets of locations in the IOSTS test�S� ��cf� Section ���We only deal here with the reachability of ViolateFail� the reachability of Violate can be dealt with ina similar manner� To simplify the presentation we assume that there is only one ViolateFail location�Then �cf� Denition �� we are interested in states that are not coreachable for the location

ViolateFail� It should be quite clear that computing the exact coreachable set of a location is impossiblein general however there exist techniques to compute over�approximations of these sets� We here useone such technique based on abstract interpretation and implemented in the NBac tool ����� Given alocation q of an IOSTS the tool computes for each location l a symbolic coreachable state for q�

De�nition �� �symbolic coreachable state� For l� q two locations of an IOSTS S� we say hl� �lqiis a symbolic coreachable state for q if �lq is a formula on the variables and constants of the IOSTS

such that� if a state of the form hl� vi is coreachable for q� then v j� �lq holds�

I�e� hl� �lqi over�approximates the set of states at location l that are coreachable for the location q�

De�nition � �pruning� For an IOSTS S and an observer � �Violate�� from the set ��S��� letprune�S� � be the IOSTS computed as follows�

� �rst� the IOSTS mirror�test�S� �� is computed as in Section �� Let L be its set of locations� Tits set of transitions� and � � �� � �� its alphabet� where �� � ��

S and �� � ��S � fg�

� then� for each location l � L� a symbolic coreachable state hl� �lViolateFaili for the location

ViolateFail is computed�

� next� for each location l � l of the IOSTS� and each transition t � T with origin l� guard G� andlabel a�

� if a � �� then

� if the conjunction G � �lViolateFail is unsatis�able� then t is removed from the set T �

� otherwise� the guard of t becomes G � �lViolateFail

� if a � ��� then

� the guard of t becomes G � �lViolateFail

� a new transition is added to T � with origin l� destination Inconc� action a� guard

G � �lViolateFail� and identity assignments� Here� Inconc �� L is a new location�

Interpretation The pruning operation consists essentially in removing some transitions �and chang�ing the destination of others� by which the ViolateFail location cannot be reached any more� If sucha #useless$ transition is labeled by an output then it may be removed from the test case �a test casecontrols its outputs hence it may decide not to perform an output if violations of the property can�not be detected afterwards�� On the other hand inputs cannot be prevented from occurring hence the transitions labeled by inputs by which the ViolateFail location cannot be reached any more arereoriented to a new location� The new location is called Inconc and it may be interpreted as a verdict�

Inconc� future simultaneous violations of the property and of conformance cannot be detected

By pruning the test case some more to eliminate states that are not coreachable to Violate the Inconcverdict can be strengthened to #future violations of the property cannot be detected$�In the rest of this section we prove that the pruning operation preserves the correctness of test

cases� The following lemma allows to dene a sequence of transitions that #matches$ a trace�

Irisa

Page 19: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties ��

Lemma � �support of a trace� If � ���� �n is a trace of a deterministic IOSTS S� then�

there exist states si �i � �� n� of S such that si�i� si�� for i � �� � � � � n� and there exists a sequence of

transitions ti � hqi� ai� Gi� �i� Ai� qi��i �i � �� � � � n� of the IOSTS such that� for i � � � � � n�

� si � hqi� vii� for some valuations vi of the variables and constants of the IOSTS�

� �i � hai� wii� for some valuation wi of the parameters �i�

� the valuations of variables� symbolic constants� and parameters de�ned by vi and wi satisfy the

guard Gi� i�e�� hvi� wii j� Gi�

In this case� the sequence of transitions �ti�i������ �n is called a support of the trace �

Proof � Follows directly the semantics of IOSTS and the denition of deterministic IOSTS �Def� ����

The next lemma gives necessary conditions under which a sequence of transitions supports a trace�

Lemma � �support and symbolic coreachability� Let � ���� �n be a trace of a determin�

istic IOSTS S� let ti � hqi� ai� Gi� �i� Ai� qi��i �i � �� � � � � n� be a sequence of transitions that supports� and let hqi� �qiqn��i �i � �� � � � n� be symbolic coreachability sets for the location qn��� Then� forall i � �� � � � n� the formula Gi ��qiqn�� is satis�able� Moreover� the sequence of modi�ed transitions

t�i � hqi� ai� Gi � �qiqn��� �i� Ai� qi��i �i � � � � � n� is a support for the trace as well�

Proof � For i � �� � � � � n let �i � hai� wii� By Lemma � there exist states si � hqi� vii such that ���hvi� wii j� Gi� Moreover by hypothesis hqi� �qiqn��i is a symbolic coreachability set for qn�� and it

is not hard to see that si�i����n� qn��� hence by Denition �� �� vi j� �qiqn��� Now ��� and ��

imply that hvi� wii j� Gi � �qiqn�� and we have proved that Gi � �qiqn�� is satisable�Finally since si � hqi� vii �i � hai� wii and hvi� wii j� Gi � �qiqn�� for i � �� � � � � n the

sequence of transitions t�i � hqi� ai� Gi � �qiqn�� � �i� Ai� qi��i �i � � � � � n� satises all the conditions�cf� Lemma �� for being a support for the trace � ���� �n and the proof is done� �

The following facts can be proved about the languages of prune�S� ��

Lemma �� �languages of prune�S � � and languages of test�S� ��

� � L�prune�S � ��ViolateFail� � L�test�S� ��ViolateFail�

��� L�prune�S � ��Fail� L�test�S � ��Fail�

��� L�prune�S � ��Violate� L�test�S� ��Violate��

Proof � �sketch�� L�prune�S� ��ViolateFail� L�test�S � ��ViolateFail�� let � L�prune�S� ��ViolateFail��

Then by Lemma � there exists a sequence of transitions of prune�S� � that supports � By construc�tion of prune�S� � �cf� Denition ��� this sequence is of the form t�i � hqi� ai� Gi��qiqn�� � �i� Ai� qi��i�i � � � � � n� such that for all i � � � � � n hqi� ai� Gi� �i� Ai� qi��i is a transition of test�S� � andqn�� � ViolateFail� Indeed all locations qi of the sequence must be locations of test�S� � � theonly location of prune�S � � that is not a location of test�S� � is Inconc which is a deadlock i�e� ViolateFail is not reachable from it which contradicts qn�� � ViolateFail� and prune�S� � is obtainedby strengthening the guards of transitions of test�S � � with the corresponding predicates �qiqn�� �Then the sequence of transitions of test�S� �� ti � hqi� ai� Gi� �i� Ai� qi��i �i � � � � � n� satises allthe conditions of Lemma � i�e� it supports the sequence which implies � L�test�S� ��ViolateFail��

� L�prune�S � ��ViolateFail� � L�test�S� ��ViolateFail�� Let � L�test�S� ��ViolateFail��Then by Lemma � there exists a sequence of transitions of test�S� �� ti � hqi� ai� Gi� �i� Ai� qi��i

PI n�����

Page 20: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

�� Vlad Rusu� Herv� Marchand� and Thierry J�ron

�i � � � � � n� that supports the sequence and qn�� � ViolateFail� By Lemma � the sequence ofmodied transitions t�i � hqi� ai� Gi � �qiqn�� � �i� Ai� qi��i �i � � � � � n� supports as well and byconstruction all the transitions of the sequence ti �i � � � � � n� also belong to prune�S� �� Indeed �cf�Denition ��� the only transitions of test�S� � that are removed or whose destination is changedto Inconc in prune�S� � are those whose guard Gi is inconsistent with �qiqn�� and Lemma �guarantees that such transitions cannot belong to the sequence ti �i � � � � � n�� Hence is supportedby the sequence t�i �i � � � � � n� in prune�S� � i�e� � L�prune�S� ��ViolateFail��

� The proofs of the inclusions �� and ��� are similar to the proof of the inclusion of ��� by considering the Fail and Violate locations respectively instead of ViolateFail� ��

Corollary � �languages of prune�S� ��

� � L�prune�S � ��ViolateFail� � L� �Violate�� � Traces�S�� ���S � fg� n Traces�S

��

��� L�prune�S � ��Fail� Traces�S�� ���S � fg� n Traces�S

��

��� L�prune�S � ��Violate� L� �Violate�� � Traces�S���

Our nal result is then�

Theorem � �correctness of prune�S� �� The test case prune�S� � is correct� i�e�� Propositions � �and � �cf� Section �� that characterise correctness still hold when test�S� � is replaced with prune�S� ��

Proof ��Sketch� For Propositions � it is enough to note that items ��� and �� of Corollary � stateexactly the same properties about the languages of prune�S� � as Lemmas � � about the languagesof test�S� � respectively� Moreover Lemmas � � are the only facts about test�S� � employed in theproofs of Propositions � �respectively�� Hence these propositions hold for prune�S� � as well�For Proposition � we note that item ��� of Corollary � for prune�S � � is weaker that the corre�

sponding Lemma � for test�S� �� only a language inclusion holds �instead of an equality� but trivially the inclusion is enough for establishing that Proposition � holds for prune�S� �� �

Conclusion and Related Work

A system may be viewed at several levels of abstraction� high�level properties operational speci�cation and nal black�box implementation� In the proposed framework these views are modeled using Input�Output Symbolic Transition Systems �IOSTS� which are labeled transition systems that operate onsymbolic variables and communicate with the environment through input and output actions carryingparameters� �The IOSTS for the black�box implementation is unknown only its existence is assumed��A conformance relation links the implementation and the specication and a satisfaction relationlinks them both with the required properties� A validation methodology is proposed for checkingthese relations i�e� for detecting inconsistencies between the di�erent views of the system� First the properties are automatically veried on the specication using abstract interpretation techniques�Then test cases are automatically generated from the specication and the properties and are executedon the implementation of the system� If the verication step was successful that is it has establishedthat the specication satises a property then the test execution may detect the violation of theproperty by the implementation and the violation of the conformance relation between implementationand specication� On the other hand if the verication step did not conclude �i�e� it did not allowto prove or to disprove a property� then the test execution may additionally detect a violation of theproperty by the specication� Any inconsistencies obtained in this manner are reported to the user inthe form of test verdicts� The approach is proved correct and is illustrated on the BRP protocol ����

Irisa

Page 21: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

Veri�cation and Symbolic Test Generation for Safety Properties ��

Related Work In addition to the references given in Section � we list a few more related works�In ��� an approach to generate tests from a specication and from observers describing linear�time

temporal logic requirements is described� The generated test cases do not check for conformance theyonly check that the implementation does not violate the requirements�The approach described in �� considers a specication S and an invariant P assumed to hold on

S� Then mutants S� of S are built using standard mutation operators and a combined machineis generated which extends sequences of S with sequences of S�� Next a model checker is used togenerate sequences that violate P which prove that S� is a mutant of S violating P � Finally theobtained sequences are interpreted as test cases to be executed on the implementation�The authors of ��� start from a specication S and a property P �expressed in temporal logic�

assumed to be satised by S and use the ability of model checkers to construct counter�examplesfor P on S� These counter�examples can be interpreted as witnesses of P on S� The paper ����exploits this idea to describing coverage criteria in temporal logic and generating test cases usingmodel�checking�The approaches described in all these papers rely on model checking hence they only work for

nite�state systems� moreover they do not take nondeterminism into account do not formally denea conformance relation and do not formally relate satisfaction of properties to conformance testing�A di�erent approach for combining model checking and black�box testing is black�box checking �����

Under some rather strict assumptions on the implementation �among others� the implementation isdeterministic� an upper bound n on its number of states is known� the black�box checking approachconstructs a complete test suite �the size of which is exponential in n� for checking properties expressedby B'chi automata� The approach mixes interesting concepts from game theory and learning theory�

References

��� ISO�IEC ����� Conformance Testing Methodology and Framework ����

�� P� Ammann W� Ding and D� Xu� Using a model checker to test safety properties� In InternationalConference on Engineering of Complex Computer Systems� IEEE Computer Society ����

��� A� Belinfante J� Feenstra R� de Vries J� Tretmans N� Goga L� Feijs and S� Mauw� Formal testautomation� a simple experiment� In International Workshop on the Testing of CommunicatingSystems IWTCS��� pages ���(��� �����

��� E� Brinskma� A theory for the derivation of tests� In Protocol Speci�cation� Testing and Veri�ca�tion PSTV��� pages ��(�� �����

��� E� Brinskma A� Alderen R� Langerak J� van de Laagemat and J� Tretmans� A formal approachto conformance testing� In Protocol Seci�cation� Testing and Veri�cation PSTV��� pages ���(��� �����

��� D� Clarke T� J�ron V� Rusu and E� Zinovieva� STG� a symbolic test generation tool� In Tools andAlgorithms for the Construction and Analysis of Systems TACAS��� number �� in LNCS pages ���(��� ���

��� J�C� Fernandez L� Mounier and C� Pachon� Property�oriented test generation� In Formal Aspectsof Software Testing Workshop FATES��� number ��� in LNCS ����

��� A� Gargantini and C�L� Heitmeyer� Using model checking to generate tests from requirementsspecications� In ESEC�SIGSOFT FSE pages ���(�� �����

��� L� Helmink M� P� A� Sellink and F� Vaandrager� Proof�checking a data link protocol� In Typesfor Proofs and Programs TYPES��� number ��� in LNCS pages ��(��� �����

PI n�����

Page 22: I R I S Aymodel c hec king In the presen t framew ork that considers in nite state systems and prop erties the v eri cation is undecidable it is p erformed using automatic tec hniques

� Vlad Rusu� Herv� Marchand� and Thierry J�ron

���� H� Hong I� Lee O� Sokolsky and H� Ural� A temporal logic based theory of test coverage andgeneration� In Tools and Algorithms for Construction and Analysis of Systems TACAS��� number �� in LNCS pages ��(��� ���

���� B� Jeannet� Dynamic partitioning in linear relation analysis� application to the verication ofreactive systems� Formal Methods in System Design ������(�� ����

��� T� J�ron and P� Morel� Test generation derived from model�checking� In Computer�Aided Veri��cation CAV��� number ���� in LNCS pages ���(� �����

���� N� Lynch and M� Tuttle� An introduction to input�output automata� CWI Quarterly ��� �����

���� D� Peled M� Vardi and M� Yannakakis� Black�box checking� Journal of Automata� Languagesand Combinatorics ����� ( �� ��� ����

���� V� Rusu L� du Bousquet and T� J�ron� An approach to symbolic test generation� In InternationalConference on Integrating Formal Methods IFM��� number ���� in LNCS pages ���(��� ����

���� V� Rusu H� Marchand V� Tschaen T� Jeron and B� Jeannet� From safety verifcation to safetytesting� In Intl� Conf� on Testing of Communicating Systems TestCom�� number ��� in LNCS ����

���� M Schmitt A� Ek J� Grabowski D� Hogrefe and B� Koch� Autolink � putting SDL�based testgeneration into practice� In International Workshop on the Testing of Communicating SystemsIWTCS��� pages �(�� �����

���� J� Tretmans� Testing concurrent systems� A formal approach� In CONCUR��� number ���� inLNCS pages ��(�� �����

���� E� Zinovieva� Symbolic Test Generation for Reactive Systems� PhD thesis University of Rennes I to be defended in November ����

Irisa