Dwyer99 Icse Patterns
Dwyer99 Icse Patterns
in Property
Specifications
for Finite-State
Verification*
Matthew
B. Dwyer
Kansas State University
Department of Computing
and Information Sciences
Manhattan, KS 66506-2302
+l 785 532 6350
[email protected]
George S. Avrunin
University of Massachusetts
Department of Mathematics
and Statistics
Amherst, MA 01003-4515
+l 413 545 4251
[email protected]
ABSTRACT
Keywords
Patterns, finite-state
concurrent systems
verification,
formal specification,
INTRODUCTION
work
James C. Corbett
University of Hawaii
Department of Information
and Computer Science
Honolulu, HI 96822
+l 808 956 6107
[email protected]
wan partially
supported
by NSF grants
q ((cal1
A Oopen) +
((Tatfloor A lopen) U
(open V ((atfloor A -open) U
(open V ((Tatfloor A -open) U
(open V ((atfloor A -open) U
(open V (=tfioor
U own)))>)>>>>>
CGR-
411
We contend that acquiring this level of expertise represents a substantial obstacle to the adoption of automated finite-state verification techniques and that providing an effective way for practitioners to draw on a
large experience base can greatly reduce this obstacle.
Even with significant expertise, dealing with the complexity of such a specification can be daunting. In many
software development phases, such as design and coding, complexity is addressed by the definition and use
of abstractions. For complex specification problems, abstraction is just as important.
In [9], we proposed to capture the experience base of expert specifiers and enable the transfer of that experience
between practitioners by way of a specification pattern
system. This system is, essentially, a collection of parameterizable, high-level, formalism-independent
specification abstractions. To maximize the coverage of these
abstractions, we have described a variety of techniques
for tuning their semantics to meet the needs of different
users. We adopted a pattern-based approach to presenting our specification abstractions because of its focus on the matching of problem characteristics to solution strategies. Patterns were originally developed to
capture recurring solutions to design and coding problems [12]. Design and coding languages are rich expressive formalisms that provide for a wide-variety of
solutions to a given problem, but the full range of possible solutions is is usually much wider than is necessary
or useful. Patterns are successful because practitioners want to solve naturally occurring domain problems.
They dont need the full expressiveness of the languages
they use and would often prefer guidance on how best
to use language features to solve commonly occuring
problems.
Property
Specification
Patterns
Design patterns were introduced [12] as a means of leveraging the experience of expert system designers. Patterns are intended to capture not only a description of
recurring solutions to software design problems, but also
the requirements addressed by the solution, the means
by which the requirements are satisfied, and examples of
the solution. All of this information should be described
in a form that can be understood by practitioners so
that they can identify similar requirements in their systems, select patterns that address those requirements,
and instantiate solutions that embody those patterns.
For finite-state verification, the system is modeled as
a transition system with a finite number of states and
a set of transitions, possibly labeled with events, between these states. A property specification pattern is
a generalized description of a commonly occurring requirement on the permissible state/event sequences in
such a finite-state model of a system. A property specification pattern describes the essential structure of some
aspect of a systems behavior and provides expressions
of this behavior in a range of common formalisms.
412
Precedence
Intent
To describe a relationships between a pair of events/states where the occurrence of the first is a necessary
pm-condition for an occurrence of the second. We say that an occurrence of the second is enabled by an
occurrence of the first. Also known as Enables.
Example Mappings
In these mappings S enables the occurrence of P.
CTL
S precedes P:
Globally
Before R
After Q
Between Q and R
After Q until R
-JE[lS
U(P A G))]
-u?~[(+'A~R)U(PA+A~R
A EF(R))]
lE[-Q
U(QA lE[-dU(P
A-S)])]
AG(Q+ +3[(+ A TR)U(P AdA
-R A EF(R))])
AG(Q + +[(+
A TR)U(P A+A
TR)])
LTL S precedes P:
Globally
Before R
After Q
Between Q and R
After Q until R
OP -+ (d
iLd(s A +))
OR-+(TPU(SVR))
a-QVO(QA
(lPU(S V 0-P)))
q((Q A OR)+(TPU(S V R)))
q(Q -+ ((-,PU(S v R)) V qhP))
Quantified
Regular Expressions
Let C be the set of all events, let [-P, Q, R] denote the expression that
matches any symbol in E except P, Q, and R, and let e? denote zero or one instance of expression e.
Event S precedes P:
Globally
Before R
After Q
Between Q and R
After Q until R
[-PI* 1([-s,P]*;s;c*)
[-RI* 1([-P,R]*;R;C*)
) ([-S,P,R]*;S;C*)
[--Ql*;(Q;Wl* I W, PI*;S;C*>>>
[-&I*;(&;([-P,R]*
1([-S,P,R]*;S;[-R]*));R;[-Q]*)*;(Q;[-RI')?
f-Q]*; (Q; (L-p, RI* I (k-s, p, RI*; S; [-RI*)); R; [-Ql*)*;
(Q;(1-CRI*I (L-s,p,RI;S;k--RI*)))?
separate states/events
to constitute
P and
413
Global
Before &
After Q
Between Q and R
After & until R
State Sequence
A System of Specification
Patterns
We have developed a system of property specification
patterns for finite-state verification tools. The pattern
system is a set of patterns organized into one or more
hierarchies, with connections between related patterns
to facilitate browsing. A user would search. for the appropriate pattern to match the requirement being specified, use the mapping section to obtain a template of
the property in the formalism used by a particular tool,
and then instantiate that template by plugging in the
state formulas or events specific to the requirement.
QRQ
because they are relatively easy to encode in specifications and they have been the most commonly encountered in the real property specifications we studied. It
is possible, however, to define scopes that are open-left
and closed-right; we explain how to construct these variants of the mappings in a special part of the pattern system (described below). In event-based formalisms the
underlying model does not allow two events to coincide,
thus event-delimited scopes are open at both ends.
The Patterns
Space limitations prohibit description of the patterns
in full detail; for that we have set up a web-site IS].
The full patterns contain additional examples, explanation of relationships among the patterns, and mappings
to various formalisms.
A list of our set of patterns,
with short descriptions, follows. In the descriptions, for
brevity, we use the phrase a given state/event occurs
to mean a state in which the given state formula is
true, or an event from the given disjunction of events,
occurs.
Absence
scope.
Existence
414
A given state/event
A given state/event
scope.
Bounded
Universality
scope.
A state/event P must always be preceded
by a state/event Q within a scope. Figure 1 gives the
key elements of the pattern.
Precedence
SURVEY
TIONS
Data
PROPERTY
SPECIFICA-
Collection
Response
l
l
Precedence
A sequence of states/events
9 , . . . , P,, must always be preceded by a sequence
Chain
Chain
s
OF
Organization
We examined each specification and manually determined whether it matched a pattern and, if so, the scope
of the property. In most cases,the formal version of the
specification was an instantiation of a template mapping
for a specific pattern/scope; in this case.the classification was trivial. If we could not find a trivial match,
we looked at the specification more carefully and still
counted it as a match if:
l
In the original pattern system described in [9], we provided mappings to three formalisms: LTL, CTL, and
QREs. We have since added mappings for two additional formalisms: Graphical Interval Logic (GIL) [7]
and the INCA query language [5] (due to space limitations, we do not show these mappings in Figure 1).
The specifichtion was formally equivalent to an instantiation of one of our ternplate mappings. For
example, the LTL formula YOP is equivalent to
q TP, which is our mapping for (global) absenceof
P.
The specification can be obtained from one of our
As depatterns using parameter substitution.
scribed in Section 2, the template mapping parameters for logics are usually state-formulae (i.e.,
415
/
OCCUAW
*bd/
Order
\\&cl
Universality
paa\
Existence
Preceded
Existence
lhhain
Precedence
Response
Results
The data are summarized in Table 1, which gives totals for each pattern/scope combination, and in Figure 4, which graphs the totals for each pattern and
scope (examples not matching any pattern are grouped
under UNKNOWN). Of the 555 example specifications
we collected, 511 (92%) matched one of our patterns.
As shown in Figure 4, the most, common pattern in the
sample is Response, with the next, most common being
Universality and its dual Absence. Together, these three
patterns accbunted for 80% of the sample.
A prose description
infor-
of the requirement,.
416
Pattern
Absence
Universality
Existence
Bound Exist
Response
Precedepce
Fksp. Chain
Prec. Chain
UNKNOWN
Total
Glbl
41
110
12
0
241
25
8
1
438
Scope
Aftr
Btwn
12
18
5
2
4
8
0
1
3
0
1
0
0
0
0
0
25
29
Patterns
Untl
9
1
1
0
0
0
0
0
Tot
85
119
26
1
245
26
8
1
1 44
11 1 555
Response
48
Universality
32
Absence
UNKNOWN
Precedence
Existence
Patterns
Resp.Chain
UNKNOWN
Pm. Chain
<l
o
Bounded Exist.
<l
0
Scopes
Global
Between
After
Scopes
Until
Global
Between
us
Them
Before
After
Until
Before
ples that used a non-global scope were instances of Absence, Universality, or Existence. These three patterns
are conceptually the simplest; for global scopes, they
map to single operators of temporal logics.
417
ments to be checked, as well as the way these requirements are expressed in terms of the model, is usually left
to the analyst. Given a pattern system to assist in the
formulation of property mappings, an analyst might be
more likely to use more complex patterns and/or scopes.
To investigate this, we took the set of specifications we
or those affiliated with us had written (the us set from
above), and divided it into the 165 specifications written before we developed the pattern system and the 139
specifications written after. This comparison is shown
in Figure 6.
Patterns
Response
Universality
Absence
UNKNOWN
Precedence
The differences in this case are more pronounced (although the sample size is smaller, so there may be more
noise). Several more complex patterns (e.g., chains)
only appear after the pattern system was introduced.
More specifications created after the development of the
pattern system used non-global scopes (33% vs. 5%),
and those later specifications were more evenly (though
not uniformly) spread over the different patterns. Also,
note that all specifications written after the pattern system matched one of the patterns.
Existence
Resp.Chain
Prec.Chain
BoundedExist. y
We have demonstrated that a pattern system for property specifications for finite-state verification is potentially useful by showing that most specifications fall into
a small number of categories. To show that. the system
is actually useful would require answering several more
difficult questions, including:
Scopes
Global
Between
Before
After
6
Before
1
i 4
4 RELATED WORK
Traditionally, specification formalisms are presented in
terms of a minimal set of operators in order to simplify their semantics definition. Additional operators
are then defined in terms of those operators, e.g., q IP =
YOTP, so only a few primitives need to be formally defined. Users of such formalisms would prefer to write
specifications at a higher level than this, so many formalisms provide built-in higher-level operators or abstractions. The classic example is leads-to, introduced
by Owicki and Lamport [21], which plays a critical role
in formalisms such as UNITY [2] and TLA 11151.
Leads-
Another interesting question is whether having the pattern system affects the kind of specifications people
write. Finite-state verification is often used to check
critical requirements, but the exact choice of require-
418
to corresponds to a global response pattern in our system. A number of formalisms have been designed to
allow for the definition of additional higher-level derived operators. For example, LUSTRE [13] property
specifications, which are safety properties written in a
linear-time temporal logic, are often written in terms of
derived operators. In [13], the authors illustrate this capability by defining since and never operators in terms
of the basic LUSTRE operators. These derived operators correspond to an existence with an after scope and
an absence with a global scope, respectively. Our pattern system supports a common, but fixed set of specification abstractions in formalisms that lack explicit support for defining abstractions.
In [16], Manna and Pnueli adopt a more pragmatic approach that is in line with the intent of our pattern system. They claim that very little of the general theory of
temporal logic is required to handle the most important,
and common, correctness properties of concurrent programs. They define a restricted proof-system that handles invatiance properties (which subsume most universal and absence patterns), response properties (which
subsume response patterns) and precedence properties
(which subsume precedence and bounded existence and
are similar to chain patterns). Their precedence properties also subsume after-until scope versions of universal
and absencepatterns. The data we present in this paper
support Manna and Pnuelis intuition about common
properties, since we found that absence, universal and
response patterns constitute the bulk of the properties
in our survey.
5 CONCLUSIONS
We believe that the definition and use of high-level
abstractions in writing formal specifications is an important factor in making automated formal methods,
specifically finite-state verification tools, more usable.
Our specification pattern system provides a set of commonly occuring high-level specification abstractions for
formalisms that do not support the definition of such abstractions directly. We have described an updated pattern system we developed for property specifications in
finite-state verification and have collected a large sample of specifications that suggests that most property
specifications people write are instances of patterns in
this system.
Some recent work in requirements engineering has explored the use of templates or patterns in the construction of requirements. For instance, van Lamsweerde and
his co-authors [6,18] have suggested using a library of refinements to construct detailed requirements from goals,
and the Attempt0 Controlled English project [ll], which
uses a restricted subset of natural language to formulate
requirements, offers annotated templates to guide nonexpert users. These efforts are aimed at the development of essentially complete requirements for a system,
while our pattern system is concerned more with the
translation of particular aspects of such requirements
into the formal specifications suitable for use with finitestate verification tools.
There has been little study of the classes of specifications that developers may or do write. Manna and
Pnueli [17] address this issue from a theoretical angle by
proposing a syntactic classification of LTL formula that
completely describes the space of possible specifications
one may write in LTL. Their taxonomy of specifications
includes categories that are much broader than our patterns. As a consequence, most of our patterns are easily categorized in their classification: precedence, absence, and universal patterns with global scopes are all
safety properties, existence patterns with global scope
are guarantee properties, and response patterns with
global scope are response properties. Our k-bounded existence pattern is very similar to their k-bounded overtaking property (which is a safety property). With chain
patterns and complex scopes themapping to syntactic
categories is more difficult (due to the nature of the
canonical forms which define the categories). In contrast to this work, the goal of our work is to give a
The survey described in this paper is certainly not exhaustive, and we expect that, as the application of
finite-state verification technology spreads, the types of
419
PI
K. Havelund,
A System
//uvw . cis . ksu. edu/
ACKNOWLEDGMENTS
R. Gulla,
and J. Corbett.
http:
of Spec%ication Patterns.
santos/spec-patterns,
1997.
PI M.
M. Dover, G. Avrunin,
PO1M.
Dwyer and L. Clarke. Data flow analysis for verifying properties of concurrent programs. Software Engineering Notes, 19(5):62-75, Dec. 1994. Proceedings
of the Second ACM SIGSOFT Symposium on Foundations of Software Engineering.
L.
WI
PI
Attempt0 Controlled
REFERENCES
PI G.
Avrunin, U. Buy, J. Corbett, L. Dillon, and J. Wileden. Automated analysis of concurrent systems with
the constrained expression toolset. IEEE Transactions
on Software Engineering, 17(11):1204-1222, Nov. 1991.
P51 L. Lamport.
PI K.
WI Z. Manna and A. Pnueli. Tools and rules for the practicing verifier. Technical Report STAN-CS-90-1321, Stanford University, July 1990. appeared in Carnegie Mellon
ACM
Computer Science: A 25 year Commemorative,
Press, 1990.
WI
PI
K. McMillan.
Symbolic Model Checking.
demic Publishers, 1993.
WI
K. Olender
and L. Osterweil.
Cecil:,
Kluwer
Aca-
A sequencing
constraint language for automatic static analysis generation. IEEE nansuctions on Software Engineering,
16(3):268-280,
Mar. 1990.
PI
420
D. Rosenblum.
Formal methods and testing:
Why
the state-of-the-art
is not the state-of-the-practice
(ISSTA96/FMSP96
panel summary).
ACM SIGSOFT
Software Engineering Notes, 21(4), July 1996.