Formal Methods and Software Engineering: Kazuhiro Ogata Mark Lawford Shaoying Liu
Formal Methods and Software Engineering: Kazuhiro Ogata Mark Lawford Shaoying Liu
Formal Methods and Software Engineering: Kazuhiro Ogata Mark Lawford Shaoying Liu
Mark Lawford
Shaoying Liu (Eds.)
LNCS 10009
Formal Methods
and Software Engineering
18th International Conference
on Formal Engineering Methods, ICFEM 2016
Tokyo, Japan, November 14–18, 2016, Proceedings
123
Lecture Notes in Computer Science 10009
Commenced Publication in 1973
Founding and Former Series Editors:
Gerhard Goos, Juris Hartmanis, and Jan van Leeuwen
Editorial Board
David Hutchison
Lancaster University, Lancaster, UK
Takeo Kanade
Carnegie Mellon University, Pittsburgh, PA, USA
Josef Kittler
University of Surrey, Guildford, UK
Jon M. Kleinberg
Cornell University, Ithaca, NY, USA
Friedemann Mattern
ETH Zurich, Zurich, Switzerland
John C. Mitchell
Stanford University, Stanford, CA, USA
Moni Naor
Weizmann Institute of Science, Rehovot, Israel
C. Pandu Rangan
Indian Institute of Technology, Madras, India
Bernhard Steffen
TU Dortmund University, Dortmund, Germany
Demetri Terzopoulos
University of California, Los Angeles, CA, USA
Doug Tygar
University of California, Berkeley, CA, USA
Gerhard Weikum
Max Planck Institute for Informatics, Saarbrücken, Germany
More information about this series at http://www.springer.com/series/7408
Kazuhiro Ogata Mark Lawford
•
Formal Methods
and Software Engineering
18th International Conference
on Formal Engineering Methods, ICFEM 2016
Tokyo, Japan, November 14–18, 2016
Proceedings
123
Editors
Kazuhiro Ogata Shaoying Liu
School of Information Science Department of Computer Science
Japan Advanced Institute of Science and Hosei University
Technology (JAIST) Tokyo
Nomi Japan
Japan
Mark Lawford
Department of Computing and Software
McMaster University
Hamilton, ON
Canada
their help during the production of this proceedings volume and the EasyChair team for
their great conference system.
Program Committee
Bernhard K. Aichernig TU Graz, Austria
Étienne André Université Paris 13, France
Toshiaki Aoki JAIST, Japan
Christian Attiogbe University of Nantes, France
Richard Banach University of Manchester, UK
Ezio Bartocci TU Wien, Austria
Michael Butler University of Southampton, UK
Ana Cavalcanti University of York, UK
Sungdeok Cha Korea University, South Korea
Yuting Chen Shanghai Jiao Tong University, China
Sylvain Conchon Université Paris-Sud, France
Frank De Boer CWI, The Netherlands
Zhenhua Duan Xidian University, China
Jeremy Gibbons University of Oxford, UK
Stefania Gnesi ISTI-CNR, Italy
Lindsay Groves Victoria University of Wellington, New Zealand
Ian J. Hayes University of Queensland, Australia
Michaela Huhn TU Clausthal, Germany
Alexei Iliasov Newcastle University, UK
Fuyuki Ishikawa National Institute of Informatics, Japan
Weiqiang Kong Dalian University of Technology, China
Fabrice Kordon LIP6/UPMC, France
Mark Lawford McMaster University, Canada
Xiaoshan Li University of Macau, SAR China
Shaoying Liu Hosei University, Japan
Yang Liu Nanyang Technological University, Singapore
Larissa Meinicke University of Queensland, Australia
Stephan Merz Inria Nancy, France
Huaikou Miao Shanghai University, China
Mohammadreza Mousavi Halmstad University, Sweden
Shin Nakajima National Institute of Informatics, Japan
Akio Nakata Hiroshima City University, Japan
Manuel Nuñez UC, Spain
Kazuhiro Ogata JAIST, Japan
Kozo Okano Shinshu University, Japan
Jun Pang University of Luxembourg
Jan Peleska TZI, Universität Bremen, Germany
VIII Organization
Additional Reviewers
W. Eric Wong
Studies have shown that combinatorial testing can help programs detect hard-to-find
software bugs that may not be revealed by test cases generated using other testing tech-
niques. The first part of this talk focuses on traditional black-box requirements-based
combinatorial testing. In particular, I will discuss results and lessons learned from two
real-life industry applications: a control panel of a rail-road system and a Linux system.
The second part extends the concept of combinatorial testing to a white-box
structure-based setting. I will present an advanced coverage criterion, Combinatorial
Decision Coverage, in conjunction with symbolic execution to achieve high coverage
cost-effectively without suffering from potential space exploration. Finally, I will explain
how combinatorial testing can be applied to a graph-based methodology for testing IoT
(Internet of Things).
Bio
W. Eric Wong received his M.S. and Ph.D. in Computer Science from Purdue
University, West Lafayette, Indiana, USA. He is a Full Professor, the Director of
International Outreach, and the Founding Director of Advanced Research Center for
Software Testing and Quality Assurance (http://paris.utdallas.edu/stqa) in Computer
Science at the University of Texas at Dallas (UTD). He also has an appointment as a
guest researcher at the National Institute of Standards and Technology, an agency
of the U.S. Department of Commerce. Prior to joining UTD, he was with Telcordia
Technologies (formerly Bellcore) as a senior research scientist and the project manager
in charge of Dependable Telecom Software Development.
Dr. Wong is the recipient of the 2014 IEEE Reliability Society Engineer of the Year.
He is also the Edit-in-Chief of the IEEE Transactions on Reliability. His research focuses
on helping practitioners improve software quality while reducing production cost. In
particular, he is working on software testing, program debugging, risk analysis, safety,
and reliability. Dr. Wong has published more than 180 papers and edited 2 books.
Dr. Wong is also the Founding Steering Committee Chair of the IEEE International
Conference on Software Security and Reliability (SERE) and the IEEE International
XII W.E. Wong
Workshop on Program Debugging. In 2015, the SERE conference and the QSIC
conference (International Conference on Quality Software) merged into one large
conference, QRS, with Q representing Quality, R for Reliability, and S for Security.
Dr. Wong continues to be the Steering Committee Chair of this new conference
(http://paris.utdallas.edu/qrs).
A (Proto) Logical Basis for the Notion
of a Structured Argument in a Safety Case
Abstract. The introduction of safety cases was a step in the right direction in
regards to safety assurance. As presently practiced, safety cases aim at making a
serious attempt to explicate, and to provide some structure for, the reasoning
involved in assuring that a system is safe, generally in terms of so-called
structured arguments. However, the fact current notations for expressing these
structured arguments have no formal semantics and, at best, are loosely linked to
goal structuring ideas and to Toulmin’s notion of an argument pattern, is a
crucial issue to be addressed. History clearly demonstrates that languages that
have no formal semantics are deficient in relation to the requirements of a
serious approach to engineering. In other words, one can only go so far with
intuition, and certainly not far enough to justify the safety of complex systems,
such as Cyber Physical Systems or autonomous cars. By rehearsing Gentzen’s
program for formalizing mathematical reasoning, his famous Calculus of Nat-
ural Deduction, we show how we can begin a program of formalizing safety
reasoning by developing a working definition of a structured argument in a
safety case and a calculus for safety reasoning.
Promotion of Formal Approaches in Japanese
Software Industry and a Best Practice
of FeliCa’s Case
(Extended Abstract)
Formal Verification of the rank Algorithm for Succinct Data Structures . . . . . 243
Akira Tanaka, Reynald Affeldt, and Jacques Garrigue
Contextual Trace Refinement for Concurrent Objects: Safety and Progress . . . 261
Brijesh Dongol and Lindsay Groves
Verifying Nested Lock Priority Inheritance in RTEMS with Java Pathfinder . . . 417
Saurabh Gadia, Cyrille Artho, and Gedare Bloom
Abstract. The introduction of safety cases was a step in the right direc-
tion in regards to safety assurance. As presently practiced, safety cases
aim at making a serious attempt to explicate, and to provide some struc-
ture for, the reasoning involved in assuring that a system is safe, gener-
ally in terms of so-called structured arguments. However, the fact cur-
rent notations for expressing these structured arguments have no formal
semantics and, at best, are loosely linked to goal structuring ideas and
to Toulmin’s notion of an argument pattern, is a crucial issue to be
addressed. History clearly demonstrates that languages that have no for-
mal semantics are deficient in relation to the requirements of a serious
approach to engineering. In other words, one can only go so far with intu-
ition, and certainly not far enough to justify the safety of complex sys-
tems, such as Cyber Physical Systems or autonomous cars. By rehearsing
Gentzen’s program for formalizing mathematical reasoning, his famous
Calculus of Natural Deduction, we show how we can begin a program
of formalizing safety reasoning by developing a working definition of a
structured argument in a safety case and a calculus for safety reasoning.
1 Introduction
Safety cases were introduced into safety practice as a way of making explicit
and organizing the justification for a claim that some engineered artifact is safe.
Initially, safety cases were cast as natural language documents whose nature
and structure were only informally defined, complicating the knowing of what is
required of them. The introduction of the idea that a safety case is a structured
argument, with references to Toulmin’s notion of an argument pattern (see [1]),
was a big step forward in providing a more rigorous definition of a safety case.
A lot of very useful work has been done in developing these ideas into useful
methods and notations and software based tools to support the development of
safety cases. To make further progress in transforming safety cases into a properly
grounded engineering tool, enabling a systematic and scientific construction and
analysis, we need to develop a more formal, logically principled basis for them.
What exactly do we mean by “more logically principled”? Firstly, to date,
existing notations and languages for safety cases do not have a rigorous logical
semantics. When presented with a safety case, say in GSN or CAE notation (see
[2,3]), we have no mean for deciding whether the safety case is syntactically well
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 1–17, 2016.
DOI: 10.1007/978-3-319-47846-3 1
2 V. Cassano et al.
2 Preliminary Observations
We will begin by outlining some of our observations about important elements of
safety case reasoning. Perhaps the first point to make is that notations for present-
ing so called structured arguments in safety cases, such as GSN or CAE diagrams
(see [2,3]; to save us from having to continually refer to all of them, we will use
GSN as a witness of a set of similar notations) do not present arguments as such,
they present safety goal decomposition structures, goal G can be achieved via its
decomposition into sub-goals G1 , . . . , Gn , with some reference to goal decomposi-
tion justification. In GSN diagrams, this justification takes the form of strategies:
They justify why the proposed goal decomposition achieves the goal G, if appro-
priately combined. This is reminiscent of problem solving by decomposition (see
[4]), where solutions to sub-problems can be combined in a prescribed way to solve
the original problem, and also of goal structured requirements approaches such as
KAOS (see [5]), which applies problem decomposition ideas to requirements defi-
nition. However, goal decomposition and structured arguments in safety cases are
completely different things: Goal decomposition serves as a way of breaking down
the structure of complex goals into more manageable ones, in contrast, safety argu-
ments serve as a way of substantiating the notion that a safety claim follows from
A (Proto) Logical Basis for the Notion of a Structured Argument 3
others. For us, notations like GSN fall short at presenting arguments, and what
they do well at representing, goal decomposition, while very important, is hindered
by not having a properly defined semantics (in comparison, KAOS trees enjoy of a
formal semantics, well defined decomposition patterns, etc., making them better
suited for engineering use.)
To further complicate things, attempts at supporting safety reasoning by
casting it into First Order Logic (FOL) and using FOL automated deduction
support (see [6]) are bound to face a great obstacle to overcome: Safety rea-
soning is not that of FOL (and, more generally, it is quite different from that
captured by classical deductive logics). There are several reasons for this, but
we will focus only on some of them. Firstly, some of the inference licenses used
in safety reasoning are textbook examples of fallacies in FOL (e.g., judgments
from expert opinions). Secondly, some of the inference licenses used in safety
reasoning are inductive in nature (as in inductive reasoning). An obvious exam-
ple of the latter occurs in reasoning about test cases: Concluding from a test
set where every test case is successful that the corresponding program is correct
for all input data, a proper generalization, requires a truly inductive reasoning
step. Thirdly, safety case reasoning includes elements of defeasible reasoning, i.e.,
reasoning in which conclusions are open to revision or annulment (as discussed
in the field of non-monotonic logics; see [7]). We make contingent inferences in
the absence of certain information. They are contingent because further inves-
tigation may invalidate the conclusions drawn from them. Fourthly, safety case
reasoning sometimes also uses a form of reasoning called eliminative induction
(see [8]). Eliminative induction, first developed by Francis Bacon, and taken up
by philosophers such as John Stuart Mill, John Maynard Keynes, Karl Popper,
et al., works like this: Suppose that we want to conclude property A and we
have identified that A may not be true if one or more properties B1 , . . . , Bn
are true; if we can prove that no Bi holds, then we can conclude that A holds.
This form of reasoning is in fact an example of a form of probabilistic reasoning
that departs from the frequentist based reasoning of probability and is more
related to confidence (as in confidence in a scientific theory). Confidence under-
lies reasoning about scientific theories, legal cases, and in other domains. For
example, it is the basis on which semantics for statements in law like “beyond a
reasonable doubt” or “on the balance of probabilities” can be defined. In safety
reasoning confidence is absolutely necessary for it manifests the conventional wis-
dom that safety cannot be absolutely guaranteed. Lastly, safety reasoning has a
global rather than a localized inductive nature (as in mathematical induction).
Defeasible and probabilistic reasoning exhibit this particularity. In defeasible and
probabilistic reasoning it is in general not possible to just add another branch to
a proof in a soundness-preserving way (see [9]). This has grave consequences for
the possibility of devising incremental safety approaches that support the well
tried and understood concept of incremental design improvement (see [10]). The
above combined lead to the observation that FOL, and, more generally, classical
deductive settings, may be unfit for the purposes of safety reasoning.
4 V. Cassano et al.
The commonly found definition of a safety case reads: “A safety case is a struc-
tured argument [. . . ] that provides a compelling, comprehensible, and valid case
that a system is safe for a given application in a given operating environment”
(see [11]). On the one hand, safety cases are a step in the right direction in
regards to safety assurance. They make a serious attempt to explicate, and to
provide some structure for, the inference licenses used in guaranteeing that a
system is safe. On the other hand, a striking feature of the definition of a safety
case just given is its logical vagueness. It is unclear what is to be taken as con-
stituting a structured argument, i.e., what are its defining characteristics, and
how is such a structured argument to be assessed in terms of the soundness of
the reasoning it involves. We discuss these issues from a logical point of view.
To provide some context for discussion, and to fix the terminology we will use in
what follows, let us recall some basic facts about Gentzen’s Calculus of Natural
Deduction for Classical First Order Logic (N K for short; see [12–14]). In brief,
with his N K, Gentzen aimed at developing: “A formalism that reflects as accu-
rately as possible the actual logical reasoning involved in mathematical proofs”
(see [12, p. 291]). Gentzen offers as an example of this kind of reasoning:
“(∃x∀yF xy) ⊃ (∀y∃xF xy). The argument runs as follows: Suppose there
is an x such that for all y F xy holds. Let a be such an x. Then for all y:
F ay. Now let b be an arbitrary object. Then F ab holds. Thus there is an
x, viz., a, such that F xb holds. Since b was arbitrary, our result therefore
holds for all objects, i.e., for all y there is an x, such that F xy holds. This
yields our assertion” (see [12, p. 292]).
[∀yF ay]1
∀−E
F ab
∃−I
∃xF xb
∀−I
[∃x∀yF xy]2 ∀y∃xF xy
∃−E 1
∀y∃xF xy
⊃−I 2
(∃x∀yF xy) ⊃ (∀y∃xF xy)
D / So, Q, C
such a restriction is not necessary and could be lifted. However, at this point, it
presents a firmer basis on which to start building a calculus for safety reasoning.
The relation between Toulmin’s argument patterns and s-inference figures
places the work of Toulmin in the context of safety reasoning: Toulmin’s argu-
ment patterns present an interesting framework in which to formulate what
s-inference figures, or s-figure schemata, may look like. However, in and of
themselves, Toulmin’s argument patterns are not s-inference figures nor s-figure
schemata. This means that Toulmin’s argument patterns do not define, at least
not obviously, a calculus for safety reasoning, our sought after SK. Such a calcu-
lus, which we view as a fundamental tool for analyzing the logical well-formedness
of safety arguments, is only defined by the provision and justification of a sen-
sible set of s-inference figures via s-inference figure schemata. In other words,
the appeal to Toumin’s argument patterns in the context of safety reasoning is
rather limited, it serves as a way of showing the sources of validity of a safety
argument, but it does not propose a way of assessing the validity of said sources.
[C]
W
−I
CW
(As usual, square brackets indicate discharged assumptions.) The complete safety
argument under consideration may be incorporated into a s-derivation such as
5 Discussion
There are some points worth noting about the difference in nature between the
s-derivation that we presented in the previous section, tW, Done(t) D C W,
and the formulation of a safety arguments typically presented, say, as GSN dia-
grams. Firstly, there is a clear distinction between the formulation of the safety
claim E from which C W obtains and the commonly found formulation of
safety claims that play the same role. E is a specific property of the system that
turns on a warning light, the warning light being lit under certain conditions,
and C W is a s-formula. The relation between E, and/or C W, and ‘The
system is (acceptably/adequately/sufficiently) safe’, where ‘system’ refers to the
system that turns on the warning light, is one of design intent: Presumably, the
warning light being lit under certain critical conditions issues a warning so that
an agent can take whatever appropriate actions are necessary, serving in this way
as a safety mechanism, thus contributing to whatever conception of safety the
designer had in mind. Now, as commented on in Sect. 3.3, C W is internal to
the calculus of safety argumentation (compare program correctness), our sought
after SK, whereas ‘The system is safe’ is about the calculus, i.e., it corresponds
to a claim about what tW, Done(t) D C W represents to the designer, i.e.,
there has to be an agreement that ‘The system is safe’ can be made on the basis
of C W and the s-derivation. Secondly, there is a clear cut distinction between
14 V. Cassano et al.
E and L. Again, E is a property of the system that turns on the warning light.
Instead, L is a consequence conducive statement about E seen as a safety claim,
i.e., as part of a safety argument, and the safety claims from which it follows.
This distinction is of utmost importance for the logical analysis of the sound-
ness of inference licenses and s-inference figures. There is one last distinction
between inference licenses such as L and the kind of strategies present in GSN
diagrams that is worth noting: GSN strategies have no concept analogous to that
of discharging an assumption. Unless other measures are taken, this limitation
severely restricts most forms of conditional reasoning in the kind of Gentzen-like
logical calculi that we have considered here, making it too severe a restriction.
There are also some important elements worth noting about the formulation
of tW, Done(t) D C W, in particular, in relation to the standard formal-
ization of the logical concepts it involves. Firstly: Are we to interpret as the
symbol for material implication? Thought it is known that material implication
does not cope well with ordinary understandings of conditional statements, if
we were to answer the question in the negative, say by interpreting as rele-
vant or strict implication, then, we need to provide clarification as to how the
s-inference figure corresponding to the introduction of differs from ⊃−I (see
[13]). Secondly, the standard interpretation of tW reads as: There is a possi-
ble execution of t which results in W being the case. Such an interpretation of
tW is seemingly appropriate for capturing T , i.e., ‘The execution of t lights the
warning light’. After all, it is not difficult to envision scenarios where t may be
executed and yet the warning light might not be lit, e.g., scenarios where not all
things went according to plan. At the same time, the standard reading of tW
preempts us from concluding W from the assumption that Done(t) is the case,
for we would have to ensure that the execution of t referred to by Done(t) is
one which lead us to W being the case and no other – a nontrivial matter. This
said, there may be a formulation of a s-derivation which allows us to conclude
W from tW and Done(t) via appropriate s-inference figure schemata which
include “scenarios where not all things went according to plan” as rebuttals.
In such a s-derivation, the s-endformula W will be open to revision and poten-
tial annulment if things do not go according to plan. Altogether, the scheme of
things just discussed is not a matter of logical pedantry, but rather they are
important issues, and the leading causes of fallacies in safety reasoning, that are
being brought into the foreground by the use of appropriate logical machinery.
There is a final issue to discuss: The use of evidence in s-derivations as a way
of grounding initial s-formulæ. To provide some context for discussion, let us first
recall some basic facts about the role of initial formulæ in N K. According to
Gentzen, a distinguishing feature of N K is that derivations start from assump-
tions, some of which may subsequently be discharged, to which logical deductions
are then applied (see [12, p. 292]). These initial assumptions are the initial for-
mulæ of a derivation. An important thing to notice about Gentzen’s treatment
of initial formulæ is their assumptive nature; they are, in a sense, “true” in them-
selves, given deus ex machina, and, as such, are accepted as the basis on which
the derivation is built. In contrast, in safety reasoning, it is typically proposed
A (Proto) Logical Basis for the Notion of a Structured Argument 15
that the safety claims from which a safety argument is built need to be provided
with a rationale which justifies their postulation. This means that the initial
s-formulæ in s-derivations lack the assumptive nature enjoyed by Gentzen’s view
of initial formulæ in derivations. Providing a rationale for justifying the postula-
tion of a safety claim is reminiscent of the notion of justified belief in studies in
epistemology or scientific explanation. It is at this point where evidence makes
an appearance. Bringing in the concept of evidence in safety reasoning is a topic
for research in its own right. In this respect, without elaborating at length, we
cannot do more than offer some pointers to some of the literature which we
consider provides a proper context for discussing the use of evidence in safety
cases, and some of the challenges that this use presents (see classic texts such as
[15,19], or more recent works such as [20–22]).
6 Conclusions
The present practice of safety cases, recorded in some notation, is the result of
over 25 years of work. The object-oriented (OO) community and the Unified
Modeling Language (UML) underwent a similar situation over a similar period.
In both cases it has been pointed out that simply providing a loose syntax is
not enough. Engineering disciplines rely on scientific theories and mathematics
to enable precision in design and analyses to support sound design decisions.
This was acknowledged by the OO community, who started incorporating math-
ematical precision into its notations some years ago, not without its hurdles
and sometimes against the protests of the notation’s inventors! The safety case
community is slowly awakening to this; pushed by a need for proper engineering
guarantees about safety, especially due to the increasing complexity of safety crit-
ical systems, and by the recognition that relying on the informal understanding
and intuition of individuals, no matter how experienced, is not only unscientific,
but a historic invitation to disaster.
In this paper, we have tried to take the first steps towards developing a
proper scientific and logical basis for safety case understanding and construction:
A working definition of a safety case via its incorporation in a precisely defined
calculus. We start from two pillars. The first pillar, in line with other researchers
in the area (see [23]), is the observation that assurance case reasoning is more
akin to the argument based reasoning ideas of Toulmin than to the conventional
deductive logic reasoning well known to mathematicians and software engineers
(or computer scientists). This form of reasoning is already (more or less) well
known in domains such as legal reasoning and scientific reasoning/explanation.
The second pillar is Gentzen’s program for formalizing mathematical reasoning
in terms of a logical language, inference rules to support reasoning steps, and
proofs to capture the “informal” notion of argument used by mathematicians.
One can debate about the adequacy of Gentzen’s formalization, but if one accepts
it, and most mathematicians have, then one can make remarkable progress in
analyzing mathematical reasoning, including developing automated tools such as
theorem provers and model checkers. Though safety reasoning is very different
16 V. Cassano et al.
References
1. Toulmin, S.: The Uses of Argument. Cambridge University Press, Cambridge
(2003)
2. The GSN Working Group: Goal Structuring Notation. Version 1, November 2011
3. Adelard: Claim, Argument, Evidence Notation. Accessed 25 Jan 2016
4. Pólya, G.: How to Solve It, 2nd edn. Princeton University Press, Princeton (2004)
5. van Lamsweerde, A.: Requirements Engineering: From System Goals to UML Mod-
els to Software Specifications. Wiley, Hoboken (2009)
6. Rushby, J.: Logic and epistemology in safety cases. In: Bitsch, F., Guiochet, J.,
Kaâniche, M. (eds.) SAFECOMP 2013. LNCS, vol. 8153, pp. 1–7. Springer,
Heidelberg (2013). doi:10.1007/978-3-642-40793-2 1
7. Bochman, A.: Non-monotonic reasoning. In: Gabbay, D., Woods, J. (eds.) Hand-
book of the History of Logic: The Many Valued and Nonmonotonic Turn in Logic,
vol. 8, pp. 555–632. North-Holland, Amsterdam (2007)
8. Goodenough, J., Weinstock, C., Klein, A.: Eliminative induction: a basis for argu-
ing system confidence. In: 35th International Conference on Software Engineering
(ICSE 2013), pp. 1161–1164 (2013)
9. Bloomfield, R., Littlewood, B.: Multi-legged arguments: the impact of diver-
sity upon confidence in dependability arguments. In: International Conference on
Dependable Systems and Networks (DSN 2003), pp. 25–34 (2003)
10. Vincenti, W.: What Engineers Know and How They Know It: Analytical Studies
from Aeronautical History. Johns Hopkins University Press, Baltimore (1993)
11. UK Ministry of Defense: Defence standard 00–56 issue 4: safety management
requirements for defence systems (2007)
12. Gentzen, G.: Investigations into logical deduction. Am. Philos. Q. 1(4), 288–306
(1964)
13. Prawitz, D.: Natural Deduction: A Proof-theoretical Study. AWE (1965)
14. van Dalen, D.: Logic and Structure, 5th edn. Springer, Heidelberg (2013)
15. Carnap, R.: An Introduction to the Philosophy of Science, 5th edn. Dover, Mineola
(1966)
16. Hoare, C.: An axiomatic basis for computer programming. Commun. ACM 12(10),
576–580 (1969)
17. Hitchcock, D.: Toulmin’s warrants. In: van Eemeren, F., et al. (eds.) Anyone Who
Has a View: Theoretical Contributions to the Study of Argumentation, vol. 8, pp.
69–82. Springer, Heidelberg (2003)
18. Åqvist, L.: Deontic logic. In: Gabbay, D., Guenthner, F. (eds.) Handbook of Philo-
sophical Logic, vol. 8, 2nd edn, pp. 1–12. Springer, Heidelberg (2002)
19. Hempel, C.: Philosophy of Natural Science. Prentice Hall, Upper Saddle River
(1966)
A (Proto) Logical Basis for the Notion of a Structured Argument 17
20. Achinstein, P.: The Book of Evidence. Oxford University Press, Oxford (2001)
21. Haack, S.: Evidence Matters: Science, Proof, and Truth in the Law. Cambridge
University Press, Cambridge (2014)
22. Mayo, D., Spanos, A.: Error and Inference: Recent Exchanges on Experimental
Reasoning, Reliability, and the Objectivity and Rationality of Science. Oxford
University Press, Oxford (2010)
23. McDermid, J.: Safety arguments, software and system reliability. In: 2nd Interna-
tional Symposium on Software Reliability Engineering (ISSRE 1991), pp. 43–50
(1991)
Promotion of Formal Approaches in Japanese
Software Industry and a Best Practice
of FeliCa’s Case (Extended Abstract)
1 Introduction
We promote formal methods in Japan, and reported the status of formal methods
in Japan. [1,2] Many Japanese companies are interested in formal methods in
development of software systems. Some companies introduce and apply formal
approaches successfully in their own development processes. However, there are
not so many companies apply formal methods in their real development projects.
In this paper, we report our activities to promote formal methods in Japan,
and briefly introduce our current research project.
We aim to propose formal approaches applicable and effective in the real software
development projects. We focus on the way how to incorporate formal develop-
ment methodologies into the development process of each specific project in an
IT company. We propose a development process for a specific purpose as a ref-
erence model. [9,10] We recommend the developers to customize our reference
process model for their own project.
Figure 2 shows the overview of our current research project to propose formal
approaches effective over the whole software life cycle. There exist many theories,
methodologies, tools in formal methods. We believe each of them is applicable
and effective for a specific purpose at some phase(s) in the software life cycle.
We have developed several tools to support construct rigorous descriptions
for the target systems. Here we briefly introduce the following three tools:
4.1 VDMPad
VDMPad is an interactive VDM-SL tool. [11] Fig. 3 shows a screen shot of VDM-
Pad. A user writes a VDM-SL description in the top window. VDMPad performs
the syntax and type checking for the VDM-SL description. If the state invariants
are included in the description, VDMPad also check the invariants. In the second
window, the user can write an expression to be evaluated by the VDMPad. And
Formal Approaches in Japanese Software Industry 21
then the result of the evaluation appears in the third window. If any error is
detected, the message is output beneath the bottom line.
VDMPad is very useful to write VDM-SL description with a simple and
interactive user interface. For beginners of VDM specification, VDMPad is easy
to use and understand how to write VDM-SL specifications. It is also a nice tool
for matured specifiers to describe components in VDM-SL and validate them
with testing at the specification level.
The VDMPad service is available on the VDMPad Server [14].
4.2 ViennaTalk
ViennaTalk is an IDE (Integrated Development Environment) for lightweight
formal approach which is a SmallTalk library to handle VDM-SL specifications.
[12,15] Major components of ViennaTalk is as follows:
The third tool is JOD, Dictionary Tool to Support Rigorous System Description.
[13] It accepts informal documents written in a natural language, and manipu-
lates the documents and provides useful information to clarify the system struc-
tures and functions. It bridges between informal documents and rigorous descrip-
tions written in VDM-SL and VDL++.
24 K. Araki and T. Kurita
Figure 5 shows a screen shot of JOD. This tool is open to use and embedded
in the Overture Tool.
5 Concluding Remarks
– Know thyself.
– Heaven helps those who help themselves.
Formal Approaches in Japanese Software Industry 25
These are very common teachings. We will continue to promote formal methods
in Japan and support IT engineers and users keeping the above commandments
and teachings in mind.
References
1. Araki, K.: Are formal methods relevant?: how to explode the seven myths in Japan.
In: Proceedings of the APSEC 1995, pp. 514–515 (1995)
2. Araki, K., Chang, H.-M.: Formal methods in Japan: current state, problems and
challenges. In: Proceedings of the Third VDM Workshop, VDM 2002 (2002)
3. Bowen, J.P., Hinchey, M.G.: Ten commandments of formal methods. IEEE Com-
put. 28(4), 56–63 (1995)
4. Gmehlich, R., Jones, C.: Experience of deployment in the automotive industry. In:
Romanovsky, A., Thomas, M. (eds.) Industrial Deployment of System Engineering
Methods, pp. 13–26. Springer, Heidelberg (2013)
5. Hall, A.: Seven myths of formal methods. IEEE Softw. 7(5), 11–19 (1990)
6. IPA/SEC: Report on Successful Cases of Formal Approaches with Rigorous Spec-
ification, WG on Rigorous Specification, IPA/SEC, Tokyo (2013) (in Japanese).
http://sec.ipa.go.jp/reports/20130125.html
7. Kurita, T., Nakatsugawa, Y.: The application of VDM to the industrial develop-
ment of firmware for a smart card IC chip. Int. J. Softw. Inf. 3(2–3), 343–355
(2009)
8. Kurita, T., Ishikawa, F., Araki, K.: Practices for formal models as docu-
ments: evolution of VDM application to “Mobile FeliCa” IC chip firmware. In:
Bjørner, N., Boer, F. (eds.) FM 2015. LNCS, vol. 9109, pp. 593–596. Springer,
Heidelberg (2015)
9. Kusakabe, S., Lin, H.-H., Omori, Y., Araki, K.: Developing core software require-
ments of energy management system forsmart campus with advanced software
engineering. Int. J. New Comput. Archit. Appl. 4(1), 48–55 (2014)
10. Kusakabe, S., Lin, H.-H., Omori, Y., Araki, K.: Visualizing centrality of process
area networks in CMMI-DEV. In: Proceedings of International Conference on Soft-
ware and Systems Process (ICSSP 2015), pp. 173–174 (2015)
11. Oda, T., Araki, K., Larsen, P.G.: VDMPad: a lightweight IDE for exploratory
VDM-SL specification. In: Proceedings of the 2015 IEEE/ACM 3rd FME Work-
shop on Formal Methods in Software Engineering, pp. 33–39 (2015)
12. Oda, T., Araki, K., Larsen, P.G.: ViennaTalk and assertch: building lightweight
formal methods environments on pharo 4. In: Proceedings of the International
Workshop on Smalltalk Technologies (2016, to appear)
13. Omori, Y., Araki, K., Larsen, P.G.: JODTool on the Overture Tool to manage
formal requirement dictionaries. In: Proceedings of the 13th Overture Workshop,
Co-located with FM 2015, pp. 3–17 (2015)
14. VDMPad Server: http://vdmpad.csce.kyushu-u.ac.jp/
15. ViennaTalk: https://github.com/tomooda/ViennaTalk-doc
Automated Requirements Validation for ATP
Software via Specification Review and Testing
1 Introduction
ATP (Automatic Train Protection) software is one of the kernel components of railway
transportation system, which performs safety-critical functionalities of a train. The
validation of the ATP software requirements must be considered for ensuring the
quality of the ultimate software systems, since the requirements specification act as the
foundation of the ATP software development.
Requirements validation focuses on checking the completeness and correctness of
the requirements specification [1–3]. That is, the requirements specification needs to
cover the user’s expected functions as complete as possible. Potential scenarios of the
target system should be satisfied by the specification. Meanwhile, the requirements
specification should not contain logic errors (e.g., inconsistency). Research efforts have
been devoted to the requirements validation from both the academic and the industrial
communities, including specification review/inspection [4–7], specification testing
[18–20] and animation [13, 17]. However, effective requirements validation for the
industrial ATP software practitioners is still a challenge.
© Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 26–40, 2016.
DOI: 10.1007/978-3-319-47846-3_3
Automated Requirements Validation for ATP Software 27
One major problem is how to validate whether the user’s (e.g., the train driver)
concerned safety-critical scenarios (e.g., accelerate and then run at a designated
velocity) of the train operation are completely and correctly satisfied by the require-
ments specification. Usually there is a gap between the concerned scenarios and the
requirements specification. The specification is established by the requirements analyst
and the ATP domain expert, which describes the ATP software from the functional
perspective in terms of individual functions. However, such a specification does not
explicitly specify the scenarios of running a train in the real world. The practitioner
demands effective methods for validating whether the user’s concerned scenarios can
be satisfied by the specification.
In this paper, we propose a scenario-based specification testing approach to
requirements validation of ATP software. The ATP analyst constructs the requirements
document using a particular modeling language. To facilitate the automation of
requirements validation, the specification is transformed into an equivalent executable
ATP prototype. Since ATP software is a large-scale system that involves complex
interactions among variables, directly reviewing the specification or the code of the
prototype is tedious and error-prone. To tackle this problem, we provide an intuitive
diagram-guided specification review technique. The variable dependency diagrams and
the state transition diagrams are derived from the prototype. Potential errors of variable
interactions are detected via the diagram-guided review. To validate whether the
specification satisfies the user’s concerned scenarios, we adopt the idea of “model-based
testing”. Specifically, concerned scenarios of train operations are defined in the scenario
document using a designated scenario notation. Then the scenario document is trans-
formed into an executable test script for running the prototype. The satisfaction of the
prototype with respect to the scenarios can be evaluated via analyzing the test results.
Through the static review and the dynamic testing, the requirements specification is
rigorously validated.
To support the automation of the approach, we have developed a supporting tool
for applying this approach in practice. We have also carried out a systematic case study
for validating the efficacy of the approach in a real ATP software development project
of our industrial partner, the CASCO Signal Ltd. of China. The feedback provided by
the practitioner and the experimental results demonstrate that the approach can improve
the efficacy of the requirements validation and lead to higher productivity of the ATP
software development.
The rest of the paper is organized as follows. Section 2 overviews the state-of-art in
the area of requirements validation. Section 3 presents the technical details of the
approach. In Sect. 4, we present the case study and experiments for demonstrating the
efficacy of the approach in real ATP software development. Section 5 summarizes the
paper and points out our future research plans.
2 Related Work
querying a model, which is built from the requirements specification. Then scenario
questions are raised and the results are analyzed for validating whether the derived
model’s behavior satisfies the given requirements. This work inherits the advantages of
the review/inspection process. In the work [5], a mental model is introduced as the
foundation for requirements validation. The requirements are aligned with the model
and be reviews following certain criteria. A specification review approach based on
virtual prototype is proposed in the work [22]. Specification in natural language is
transformed into virtual prototype for structural and functional review. In practice,
however, when the specification is in large-scale and the logics is complex, directly
reviewing or inspecting textual requirements specification may be difficult. The effi-
cacy, to a large extent, relies on the practitioner’s experience. To facilitate the speci-
fication review, our approach recommends a diagram-based review strategy.
Animation of specification is also used for requirements validation. Specification
animation is usually done through model checking and specification execution. ProB is
a validation toolset for B formal specification that animates counter-examples by dis-
playing its state transition paths [11, 12]. UPPAAL also animates dynamic behaviors of
the target system by model checking [13, 14]. It allows system modeling with states
and transitions and explores the state space automatically. In [15], the authors propose
an approach to animating tabular specification. In [17], an animation-based inspection
approach is proposed where animation is used to guide the inspection process. By
demonstrating the relationship between input and output of the selected functional
scenarios, the efficiency of the inspection activity can be improved. In fact, the
effectiveness of animation relies on the understanding of the intended functions by
human.
Specification testing is a promising technique for requirements validation.
VDMTools is developed to support the analysis of VDM specifications [16]. It is able
to execute a large subset of VDM notations. With test cases generated by certain
criteria, VDMTools will show system behaviors by executing the concerned specifi-
cations. In [18], the authors propose a tool suite for testing software design specifi-
cations using dynamic slicing technology. In [19], the authors use testing modules to
test formal specifications. The testing modules are described in the same formalism as
the formal specification and can be automatically generated. Liu proposes a specifi-
cation testing method for reviewing task trees of the target formal specifications [20]. It
includes different strategies for generating test cases for different kinds of review task
trees. Our approach differs from them in the way of test case generation and the
automated test result analysis. The test cases in our approach are generated from
dedicated scenarios. The scenario also acts as the foundation of the test oracle of
specification testing.
Some researches adopt the formal methods for requirement validation. In the work
[8, 9], the authors present the VDM++ specification validation of ATP software. [10]
introduces a specification verification technique based on the SCADE platform. How-
ever, these approaches require that the practitioner construct the proof obligations using
complex mathematics notations. Although in recent years formal methods have been
reorganized by the industrial practitioners, exploiting these formal techniques including
formal modeling and verification in industry is still challenging. In particular, how the
formal methods can benefit traditional industrial software engineering activities such as
Automated Requirements Validation for ATP Software 29
specification review and inspection is still a problem. In our approach, we try to support
the traditional specification review and testing using the formal specification written in a
light-weight formal language for the ATP software. In this way, the precision of formal
methods can help the requirements validation without change the practitioner’s engi-
neering processes radically.
3 The Approach
3.1 Main Framework of the Approach
Before a detailed illustration of the techniques involved in the approach, we first
introduce the framework of the approach, which is described in Fig. 1.
In our approach, requirements are documented using the CASDL (Casco Accurate
Description Language) language developed for ATP software modeling. The CASDL
is a light-weight formal language for specifying the functions of an ATP system. In the
textual specification, each function is specified in terms of the relations between the
input and the output variables. In addition, there are some descriptions written in
natural language in the specification.
Diagram-guided Inspection
Variable Dependency Diagram
Model
Parser
Scenario-based Testing
Test
Executor
period). In Fig. 2, the parameter k explicitly specifies the time period. The ATP soft-
ware just runs in a sequential non-terminating execution cycle when the power is on.
This specification describes the functionalities of the odometer monitoring component
of the ATP software. The function is responsible for monitoring the speed of the train
and the distance the train has passed. The odometer can switch between certain states.
The state transitions of the variable OdometerState is regarded as a function in the
specification. For instance, it can change from uninitialized state (i.e., NOT INITI-
ALIZED) to the state that the meter is disabled or idled (i.e., INVALID). In this example,
these functionalities are defined in terms of if-else control blocks.
Since the ATP software is a typical large-scale control system, the requirements
validation should be automated. To this end, the textual requirements specification is
transformed into an executable prototype for automated analysis and specification
testing. The transformation focuses on removing all the natural language descriptions;
meanwhile, the syntax errors in the specification are detected. We have implemented a
Model Parser that uses the ANTLR tool [21] as the foundation for the transformation.
Aided by the ANTRL (Another Tool for Language Recognition) tool, the parser can
generate an executable CASDL requirement model. Given a language and its syntax,
ANTLR can build the ASTs (Abstract Syntax Tree) for analyzing the target language.
Our parser derives the prototype through analyzing the ASTs of the CASDL
specification.
When the specification is processed, syntax errors of the CASDL specification can
be detected. In particular, the circular dependency errors of variables can be auto-
matically detected. Circular dependency error of variables is a typical logical error in
ATP software, which refers to the situation that the relations among certain variables
constitute a cycle. For instance, the value of variable A relies on the value of vari-
able B. B relies on the value of variable C and C relies on the value of A. In this case,
the variables A, B and C constitute a circular relation. From the perspective of data
flow, a circular relation refers to a cycle of the data flows between certain variables.
Such circular relations need to be detected. Otherwise, the system will be stuck in
certain states. We have the additional criterion for detecting such errors.
32 W. Miao et al.
Criterion 1. Each variable V specified in the specification (i.e., the prototype) should
be checked whether V is involved in any circular dependency relation.
The state transition diagrams of each concerned variable can also be derived from the
prototype. For the sake of space, we omit the definition of the STD here since the
definition is the same to the traditional definition of STD. The following criteria can be
applied for the validation.
Criterion 2. For each concerned variable V, generate the VDD for validating the
intended relations between the involved variables.
Criterion 3. For each concerned variable V, generate the STD for validating the state
transitions.
Following the criteria, the analyst can validate the requirements from the perspectives
of the relations among variables and the state transitions. We use the sample specifi-
cation shown in Fig. 2 as an example to illustrate the review process. Figure 3 shows a
part of the generated variable dependency diagram of the variable OdometerState.
The VDD shows that the value of this variable is determined by various variables
such as INITIALIZED. If some relations conflict with the analyst’s understanding of the
requirements or some relations are missing, then the analyst can make decision that the
Automated Requirements Validation for ATP Software 33
Scenario Representation. The scenarios represent how the train works in the real
world. For example, the train driver may concern whether the train can stop at certain
position after an acceleration. The scenarios are defined by the user based on domain
knowledge. The domain engineer or the user may not familiar with software requirements
modeling languages. Therefore, the scenario representation notation should be both
precise and easy to understand. Our group and the industrial partner develop a domain
specific scenario notation called CASSL for defining the expected scenarios of the train.
Definition 2. An ATP scenario is a description of train operations, which consists of
the train settings, the train actions and the event triggers.
The train settings refer to the environment information for running the train, such as the
routes and length of the train. The train actions are the primitive commands (e.g., stop
or accelerate) for running a train. The event triggers refer to the configuration infor-
mation for describing the reactions of the train with its external hardware (e.g., the
signal equipment on the tracks).
The user can freely define the expected scenarios for running a train using the
CASSL by setting the parameters values of each involved command. Figure 5
describes a scenario document in the CASSL language.
The train settings section defines the routes of the train using a sequence of blocks
on the tracks. The “start” command in the train settings section represents that the train
starts from the 0 position of the 247 block. In the train action section, the command
start(@0,30) indicates that the train starts from the 0 position 30 s later after receiving
the command. The train accelerates to the 4 speed units by the acceleration of 1 unit
and then stops at position @94.
Test Execution. The user focuses on defining the physical variables such as the speed
and the position information for the concerned scenarios. Then the scenarios are
transformed into XML test scripts for testing the prototype. For each variable x in the
The above condition serves as the test oracle. For each variable x of the scenario S, its
expected value is evaluated as E(x). Function R represents the associations defined in
the association file of the Test Executor. By referring to the associations, the expected
values R(E(x)) of the corresponding variables of the prototype can be computed. P(x)
denotes the execution results produced by the prototype after running the test script. If
R(E(x)) does not equal to P(x), we say that the prototype does not satisfy the scenario
S. Note that we linearise the computation of the kinematic behaviors such as the
braking curves in our tool. That is, the engineer focuses on the concerned values at each
time cycle.
For the previous example scenario, the expected speed of the train at the destination
should be 0 based on the computation formulas. The expected value of its corre-
sponding variable TrainMaxSpeed in the prototype should be 0 according to the
association file. Figure 6 is the test results.
The output value −594760564 after testing obviously violates the expected value 0.
That is, the prototype does not implement the scenarios correctly.
4 Experiments
To validate the feasibility and demonstrate the efficacy of our approach, we have
applied our approach and the tool in a real ATP software project. An ATP specification
is established by the requirements analyst of our industrial partner. The specification is
a Microsoft Word file which includes 455 requirements items. Two well-trained
engineers participated in the experiments.
In particular, the functional errors refer to the errors related to the functions that are
detected via specification review and testing. The exception errors are basically the
unhandled code exception in the prototype. For instance, division by zero is an
arithmetic exception. Figure 7 shows the statistics of the case study.
The tool generated both the textual test report and the visualized statistics. The chart
shows 127 syntax errors, 11 circular errors, 83 functional errors, 5 exceptions and 61
no data errors were detected through the review and testing phases. Four of the
exception errors were arithmetic errors (i.e., division by zero) and one was the out of
bound of an array definition. There is a special type of error called no data, which is
caused by the missing association definitions between the scenario variables and the
variables in the prototype.
Our tool estimates the statement coverage of functions in the prototype. This figure
shows that the statement coverage of the ATP prototype is 77.5 % after running a
certain scenario. For the 317 scenarios used in the case study, the average statement
coverage of the functions was approximately 82 %. Table 1 summarizes the compar-
ison of the error detections achieved by the manual specification review and the
automated approach.
In general, our proposed approach can reach higher error detection than the manual
specification review method applied by the industrial partner. The two engineers
reviewed the same specification manually and detected 81 syntax errors. They also
detected 2 exceptions in the specification. Similarly, the engineers detect 7 circular
errors of variables. For the functional errors, only 27 functional errors were detected
through the manual review. Most of the functional errors detected by the engineers
were the execution logic errors in individual functions, e.g., the missing of if-else
branches.
38 W. Miao et al.
To find out the syntax and circular errors, the two engineers spent about 0.5 week in
reviewing the specification. By the contrast, the tool only used 12 min to finish the
static checking. Most of the time was spent on transforming the Word requirements
specification to the executable CASDL prototype and the generation of the variable
relations. They spent 3 weeks in identifying the functional errors by manual work while
this task was performed within 1.5 weeks aided by the tool. When using the new
approach, most of the human efforts were devoted to the construction of the concerned
scenarios.
The results of the experiments have convinced us that the automated approach can
significantly improve the efficacy and the productivity of the requirements validation
for developing the ATP software.
5 Conclusion
Requirements validation is still a challenging problem for the ATP industrial practi-
tioners due to the lack of effective methodologies and powerful tool support. To tackle
this problem, in this paper we propose an automated requirements validation approach.
Textual requirements specification is transformed into executable ATP prototype. In
the static analysis phase, diagram-based review is conducted for validating the
requirements from the perspective of variable interactions. The dynamic phase focuses
on checking whether the requirements specification can satisfy the user’s intended train
operation scenarios. We have proposed a particular scenario description language. Test
scripts are transformed from the scenarios for running the prototype. The conformance
of the specification to the scenarios is evaluated via analyzing the test results. To
facilitate the approach in practice, we have also developed a supporting tool for
automating the activities involved in the approach.. The case study indicates that our
approach is effective in requirements validation and can significantly improve the
productivity of ATP software development.
Automated Requirements Validation for ATP Software 39
References
1. Kotonya, G., Sommerville, I.: Requirements Engineering. Wiley, Hoboken (1998)
2. Nuseibeh, B., Easterbrook, S.: Requirements engineering: a roadmap. In: Proceedings of
International Conference on Software Engineering, pp. 35–41, April 2000
3. Wiegers, K.E.: Software Requirements. Microsoft Press, Redmond (2003)
4. Laitenberger, O., Beil, T., Schwinn, T.: An industrial case study to examine a non-traditional
inspection implementation for requirements specifications. In: Proceedings of Eighth IEEE
Symposium on Software Metrics, pp. 97–106 (2002)
5. Lee, G.Y.K., In, H.P., Kazman, R.: Customer requirements validation method based on
mental models. In: 2014 21st Asia-Pacific Software Engineering Conference (APSEC),
pp. 199–206, December 2014
6. Sinha, A., Sutton Jr., S.M., Paradkar, A.: Text2Test: automated inspection of natural
language use cases. In: 2010 Third International Conference on Software Testing,
Verification and Validation (ICST), pp. 155–164, April 2010
7. Aceituna, D., Do, H., Lee, S.W.: SQ2E: an approach to requirements validation with
scenario question. In: 2010 17th Asia Pacific Software Engineering Conference (APSEC),
pp. 33–42, November 2010
8. Xie, G., Hei, X., Mochizuki, H., Takahashi, S., Nakamura, H.: Model based specification
validation for automatic train protection and block system. In: Proceedings of 7th
International Conference on Computing and Convergence Technology, pp. 485–488,
December 2012
9. Xie, G., Asano, A., Takahashi, S., Nakamura, H.: Study on formal specification of automatic
train protection and block system for local line. In: Proceedings of 5th International
Conference on Secure Software Integration Reliability Improvement Companion (SSIRI-C),
pp. 35–40, June 2011
10. Wang, H., Liu, S., Gao, C.: Study on model-based safety verification of automatic train
protection system. In: Proceedings of Asia-Pacific Conference on Computational Intelli-
gence and Industrial Applications, pp. 467–470, November 2009
11. Leuschel, M., Butler, M.: ProB: a model checker for B. In: Araki, K., Gnesi, S.,
Mandrioli, D. (eds.) FME 2003. LNCS, vol. 2805, pp. 855–874. Springer, Heidelberg (2003)
12. Leuschel, M., Butler, M.: ProB: an automated analysis toolset for the B method. Int.
J. Softw. Tools Technol. Transf. 10(2), 185–203 (2008)
13. Behrmann, G., David, A., Larsen, K.G.: A tutorial on UPPAAL. In: Bernardo, M., Corradini, F.
(eds.) SFM-RT 2004. LNCS, vol. 3185, pp. 200–236. Springer, Heidelberg (2004)
14. Vaandrager, F.: A first introduction to UPPAAL. Deliverable no.: D5. 12 Title of
Deliverable: Industrial Handbook (2011)
40 W. Miao et al.
15. Gargantini, A., Riccobene, E.: Automatic model driven animation of SCR specifications. In:
Pezzé, M. (ed.) FASE 2003. LNCS, vol. 2621, pp. 294–309. Springer, Heidelberg (2003)
16. Fitzgerald, J., Larsen, P.G., Sahara, S.: VDMTools: Advances in support for formal
modeling in VDM. ACM Sigplan Not. 43(2), 3 (2008)
17. Li, M., Liu, S.: Integrating animation-based inspection into formal design specification
construction for reliable software systems. IEEE Trans. Reliab. 65(1), 88–106 (2016)
18. Li, J.J., Horgan, J.R.: A tool suite for diagnosis and testing of software design specifications.
In: Proceedings of International Conference on Dependable Systems and Networks,
New York, USA, pp. 295–304 (2000)
19. Brockmeyer, M.: Using modechart modules for testing formal specifications. In: Proceedings
of 4th IEEE International Symposium on High-Assurance Systems Engineering,
Washington, DC, USA, pp. 20–26 (1999)
20. Liu, S.: Utilizing specification testing in review task trees for rigorous review of formal
specifications. In: Proceedings of Tenth Asia-Pacific Software Engineering Conference,
pp. 510–519 (2003)
21. http://www.antlr.org/
22. Aceituna, D., Do, H., Lee, S.W.: Interactive requirements validation for reactive systems
through virtual requirements prototype. In: Model-Driven Requirements Engineering
Workshop (MoDRE), Trento, 2011, pp. 1–10 (2011)
Automatic Generation of Potentially
Pathological Instances for Validating Alloy
Models
1 Introduction
Software has permeated society. Computers now control systems that in the
past have had few or limited numbers of relations, such as automobile and train
systems. As a result, it is becoming more and more important to ensure the reli-
ability of software. A formal specification language is a technique for improving
the reliability of software. It eliminates ambiguity from system specifications and
makes it easy to get software assistance such as a machine-aided proof or model
checking.
Alloy [5] is a formal specification language. It was developed by MIT and
has widely been used in research and in practical applications. Alloy is often
called a lightweight formal method. It brings the power of model checkers such
as SPIN [4] to formal specification languages. Users write specifications in Alloy
language based on first-order propositional logic. Alloy Analyzer, the official
tool of the Alloy language, then verifies their properties automatically by model
checking.
On the other hand, it is not easy to express exactly what users intend in the
specification using the mathematical notation in the Alloy language. Properties
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 41–56, 2016.
DOI: 10.1007/978-3-319-47846-3 4
42 T. Saeki et al.
are sometimes too weak or too strong, and the specification accepts or rejects
unexpected instances. To tackle this difficulty, Alloy Analyzer offers a feature to
show concrete instances. It gives users quick feedback on what they have written
and helps them to understand the consequences of their models. Users can vali-
date their models by checking instances, or scenarios, one by one. The process of
checking concrete scenarios iteratively is called scenario exploration. The impor-
tant role of this process is “debugging” of models. In exploring scenarios, users
may find pathological instances where unexpected relations exist or instances
where expected relations do not exist. In this way, they come to notice that new
constraints should be added that they hadn’t thought of before or that some of
the current constraints are wrong.
Alloy Analyzer is useful tool for scenario exploration, but it has a problem
with how it enumerates scenarios; the order of scenario generation is not tai-
lored for validation. Alloy Analyzer shows possible scenarios one by one, and
it “tends to” start generating them from small instances, but there is no fur-
ther ordering control. During the scenario exploration process, Alloy Analyzer
shows a scenario, and the user checks it; if it has no problem, the user pushes
the “next” button and checks another scenario. This is not an effective way of
model validation. All that the user can do is push the “next” button and hope
for an interesting scenario to come along while iterating unordered scenarios one
by one.
To solve this problem, some studies have proposed ways to provide users
with methods to guide scenario generation; examples include Aluminum (2013)
[10] and the work of Macedo et al. (2015) [8]. These studies help users to reach
the scenarios they desire. For example, Aluminum offers an “augment” feature
to guide scenario generation. It enables users to add relations interactively to
current scenarios to reach the ones they want. In this way, users can explore
scenarios they are interested in manually. However, users often even do not
know what kinds of scenarios are useful to validate their models. Defects in
models often arise from unnoticed problems such as under-constraints or over-
constraints that did not come to their mind. In such cases, it is difficult for users
to guide the scenario generation because the cause of the defects is an unnoticed
gap between their intention and the actual models they write.
In this paper, we propose a way of automatically generating a set of sce-
narios that are likely to be pathological through heuristics based on pairwise
testing. The method also presents unrealizable scenarios that are likely to be
invalid when compared against the user’s intention. We call it Scenario Tour ;
it generates a set of scenarios that should be checked for validation. In other
words, it is test generation for scenario exploration. Scenario Tour helps users
validate their models without all the trouble of manually guided scenario gen-
eration. We implemented Scenario Tour on top of Aluminum and evaluated its
effectiveness by artificially adding defects to test models and checking whether
the tour offered scenarios exposing the defects. In our experiments, Scenario
Tour detected most of the mutation defects. It also detected a new defect not
known before in an example model distributed with Alloy Analyzer.
Automatic Generation of Potentially Pathological Instances 43
Alloy Analyzer has a feature to enumerate concrete instances that satisfy con-
straints in a given model in the form of a graph to visualize the relations in each
instance. A simple gradebook model is illustrated in Fig. 1. This model is the
same as the one in the original paper on Aluminum [10], but with a gradedBy
relation added by us for the sake of explanation. There are four signatures, i.e.,
Class, Student, Professor and Assignment. A class has an instructor and
sometimes has TAs. The classes may have assignments. The assignments always
have students who submitted them and professors or students who grade them.
The constraint of gradedBy states that the professor or students who grade them
must be instructors or TAs of the classes they are submitted for. Figure 2 shows
the scenario of the gradebook model.
This gradebook model has a defect. It lacks a constraint that prohibits stu-
dents from being a TA of a class in which they have to submit their own assign-
ments; that is, they can grade their own assignments. However, simply looking
at scenarios such as in Fig. 2 does not help one to find this defect. Alloy Analyzer
is not tailored to selectively show the most effective scenarios for validation.
It is believed that small instances are more likely to expose subtle defects [5].
Thus, presenting the smallest scenario first would be a desirable feature. Here,
although Alloy Analyzer tends to present small scenarios first, this is not guar-
anteed and the order can change arbitrarily according to the situation. On the
other hand, Aluminum, an extension of Alloy Analyzer, presents only the mini-
mal scenarios [10]. A minimal scenario is one that consists of the smallest num-
ber of Aluminum terms tuples, which roughly corresponds to the number of
atoms or relations. Since the scenarios that Aluminum gives to users are always
minimal ones, users can be sure that every one of their relations is necessary.
Aluminum also offers a way to guide the scenario generation. It allows users to
“augment” scenarios; users can add arbitrary relations to given minimal models.
This enables them to explore scenarios they are interested in.
However, the manual guiding ability is not always useful. In the “debugging”
phase, users often do not know what sorts of scenarios should be checked for
defects. Model defects are often due to unnoticed gaps such as under-constraints
or over-constraints that do not come to the user’s mind. In such cases, it is
difficult for users to guide the exploration towards pathological scenarios because
the causes of the defects go unnoticed.
Therefore, it would be useful if we could generate a set of scenarios that are
likely to be pathological automatically. By checking these generated scenarios,
users would have more chance to find defects and increase their confidence in
the validity of the models. Our approach tries to generate such scenario sets
heuristically.
There are studies that use Alloy to generate test suites for program code
such as TestEra [7]. These studies, as well as ours, generate test suites using
Alloy, but our study is different from them in that it generates test suites for an
Alloy model itself instead of program code. There are also studies on random
test generation for program code such as Randoop [11]. Whereas these studies
generate many tests for random testing, our approach concentrates on generating
a limited number of test cases by heuristics for manual checking.
As stated above, to the best of our knowledge, there has not been any research
on generation of instance sets for finding defects by focusing on relations for first-
order logic specification languages such as Alloy.
3 Method
3.1 Scenario Generation Heuristics Overview
We stated that for effective validation it would be useful to automatically gen-
erate a set of scenarios that are likely to have defects in Sect. 2.2. Our method
generates such scenarios heuristically. The basic idea of our heuristics is that
the gaps between the user’s intention and the actual models tend to cause too
weak or strong constraints, and they often appear in the form of unexpected
co-occurrences of relations or absences of ones. We generate such scenarios that
consist of many combinations of co-occurrences or absences of relations artifi-
cially. However, checking all combinations of relations amounts to a combina-
torial explosion that is as impossible as to check as all possible scenarios. To
avoid this problem and make the number of scenarios small enough to check,
we apply pairwise testing. In addition, we assume that thorough co-occurrences
or absences make especially pathological instances; our method generates such
instances deliberately.
Our method also presents inconsistent scenarios, that is, scenarios that do
not meet the given constraints. Incorrect under-constraints appear in scenarios
in the form of pathological relation combinations. However, over-constraints do
not appear in such form; users have to notice the absence of the scenarios they
want, and that is more difficult than finding incorrect under-constrained scenar-
ios. Thus, presenting inconsistent scenarios that are against the user’s intention
would be useful for validation. As described above, our method generates a set
of scenarios through pairwise heuristics. Moreover, in the pairwise generation
process, our method finds those scenarios that cannot meet the constraints.
After that, it searches for the combinations of relations assigned by the pairwise
process that make the scenarios inconsistent and presents the inconsistent sce-
narios to users for them to check if the combinations of relations actually should
not meet their specifications.
Table 1. Combinatorial table for inward relations: “MTE2” is short for “More Than
or Equal to 2”. This corresponds to the constraint “#relations ≥ 2”
some Student. Scenario Tour surely presents a case that includes the concurrent
pair on a Student signature and points out the signature to users.
As this example for the gradebook model, we separate inward and outward
relations for pairwise scenario generation because the consequent scenarios tend
to be too complicated if we combine them. The latter pairwise testing would
be more thorough, but our experiments indicated that the separated method
is capable enough of finding the gaps. Thus, the pairwise scenario generation
process is carried out twice for inward relations and outward relations.
48 T. Saeki et al.
4 Implementation
4.1 Alloy Engine
order is arbitrary. In our current implementation, Scenario Tour shows two maxi-
mal scenarios for inward and outward relations in order at first, and two minimal
scenarios for them next. After that, it presents the remaining scenario sets for
inward relations first, and those for outward relations next.
5 Experimental Setting
Remove a fact
Delete a single constraint
Replace a part of an expression with its type signature
6 Experimental Results
6.1 Evaluation of Mutation Results
Tables 6 and 7 show the results of our experiments, while Tables 8 and 9 explain
the table headings. The results of the mutation analysis shown in Table 6 suggest
that Scenario Tour is useful for both quick incremental checks of Alloy specifi-
cations during the modeling process and careful validation of them at the end
of the modeling process.
The ST First numbers are almost the same as the number of Killed by
next, and this indicates that in Scenario Tour, users can notice invalid scenarios
in earlier or as early scenarios as they can do in scenarios generated incrementally
by Alloy Analyzer. This is accomplished by the scenario presentation order that
shows the combinations of all MTE2 and all NONE first and second at the start
points of the pairwise generation. In fact, the most of faults about multiplicity
or quantifier are detected at the first or second scenario. This is a very useful
feature for making quick checks in incremental modeling processes.
Killed by The Inconsistent indicates how many mutants were killed by
inconsistent scenarios. We cannot evaluate the effect of inconsistent scenarios
quantitatively since Alloy has no comparable feature. However, they killed many
mutants that Alloy Analyzer could not. In addition, we found a new defect
that was not known before in an official example model through an inconsistent
sis
t
yn
ten
y
nt
on
Th led b
by
st
ste
db
sis
nc
t
Fir
tan
nsi
eI
on
lle
lle
I
l
Ki
NM
Mu
Inc
ST
Co
Ki
Ki
Model Name
Grandpa 15 12 15 7 11 15.42 8.83 0
Filesystem 40 24 39 17 17 14.66 23.19 6.81
Gradebook 18 13 18 6 12 24.39 9.17 0
Automatic Generation of Potentially Pathological Instances 53
Heading Description
Mutant This shows the number of mutations applied to the model.
We eliminate mutants that make a scenario unrealizable.
Thus, Mutant means the number of valid mutants
Killed by next This is the number of mutants killed by the next iteration,
the regular scenario iteration feature of Alloy Analyzer. Note
that next can iterate all possible scenarios. Thus, if Killed by
next is smaller than Mutant, it means there are mutants that
can be only killed by presenting inconsistent scenarios. For
instance, such mutations that change the “set” multiplier to
“some” never show their pathology through observable
consistent scenarios because the defect caused by them is the
absence of some relation
Killed by ST “ST” means “Scenario Tour”. This is the number of mutants
killed by Scenario Tour
Killed by This is the number of mutants killed by the especially
The Inconsistent inconsistent scenario presentation in Scenario Tour. This
number does not include mutants killed by NMI
ST First This may be the most difficult one to grasp as to its meaning.
This is the number of mutants that the number of instances
Scenario Tour requires users to check before killing is smaller
or as small as that of the regular Ally Analyzer scenario
iteration feature
Consistent This shows the average number of regular consistent scenarios
generated by Scenario Tour for each model
Inconsistent Similarly, this is the average number of inconsistent scenarios
NMI “NMI” is an abbreviation for “Non-Minimal Inconsistent”.
This is the average number of non-minimal inconsistent
scenarios for each model
scenario, as we will describe later. This fact also indicates the usefulness of
presenting inconsistent scenarios. NMI scenarios are complex and inconsistent
ones not showing minimal constraints. The NMI numbers indicate that the NMI
scenarios are fewer by comparison with the inconsistent or (minimal) inconsistent
cases.
54 T. Saeki et al.
Heading Description
Inward relation As we described in the Methods section, Scenario Tour generates
and outward two sets of scenarios; the first is based on pairwise inward
relation relation combinations and the second is based on pairwise
outward ones. Though Scenario Tour can take scenarios out of
the two sets in arbitrary order, we measured the generation time
for them separately
First scenario This shows the time spent to generate the first scenario
Median This is the median of the running times for generating scenarios.
We used the median instead of the average since the very long
running time for the first scenario affects the average too much
Alloy This is the median of the running times of Alloy to generate
scenarios by next
Table 7 indicates that the running time of Scenario Tour is generally longer than
that of the simple next iteration of Alloy Analyzer. This is natural because
Scenario Tour generates scenarios by adding somewhat complicated constraints
to the original models. The running time for the first scenarios of each tour is
especially long. This must be because Scenario Tour checks for inconsistency
in all single relation values in advance of the pairwise process, as we described
before.
However, we think that the running time (a few seconds) is not too long for
practical use. Even if it is not suitable for quick checks in incremental modeling,
waiting for a few seconds does not seem to be problem for careful validation to
complete the model.
As can be seen, they both extend signature Dir. This makes them disjoint; thus,
Scenario Tour reported that the current directory cannot be the root directory.
For correct modeling of Filesystem, the author should have defined Cur by “in”.
After we fixed the definition, Scenario Tour told us that the situation was now
a consistent scenario. Thus, we found an unnoticed defect of an official example
model through our method. This indicates the usefulness of Scenario Tour.
7 Conclusion
We introduced “Scenario Tour”, which helps users validate Alloy models by
automatically generating scenarios that are likely to present gaps between the
intentions of users and what actually they write. Scenario Tour also presents
inconsistent scenarios that the regular scenario iteration feature of Alloy Ana-
lyzer never would present. Through this feature, we found a heretofore unno-
ticed defect in an example model distributed with Alloy Analyzer, and this sug-
gests the usefulness of Scenario Tour in practice. Scenario Tour has a limitation
as regards non-minimal inconsistent scenarios and its generation performance.
However, mutation analysis suggests that it is powerful enough for practical use.
References
1. Cohen, D.M., Dalal, S.R., Fredman, M.L., Patton, G.C.: The AETG system: an
approach to testing based on combinatorial design. IEEE Trans. Softw. Eng. 23(7),
437–444 (1997)
2. Czerwonka, J.: Pairwise testing in the real world: practical extensions to test-case
scenarios. In: Proceedings of 24th Pacific Northwest Software Quality Conference,
pp. 419–430. Citeseer (2006)
3. DeMillo, R.A., Lipton, R.J., Sayward, F.G.: Hints on test data selection: help for
the practicing programmer. Computer 4, 34–41 (1978)
4. Holzmann, G.: Spin Model Checker, the: Primer and Reference Manual, 1st edn.
Addison-Wesley Professional, Boston (2003)
5. Jackson, D.: Software Abstractions: Logic, Language, and Analysis. The MIT
Press, Cambridge (2012)
6. Jia, Y., Harman, M.: An analysis and survey of the development of mutation
testing. IEEE Trans. Softw. Eng. 37(5), 649–678 (2011)
7. Khurshid, S., Marinov, D.: Testera: specification-based testing of Java programs
using sat. Autom. Softw. Eng. 11(4), 403–434 (2004). doi:10.1023/B:AUSE.
0000038938.10589.b9
56 T. Saeki et al.
8. Macedo, N., Cunha, A., Guimarães, T.: Exploring scenario exploration. In:
Egyed, A., Schaefer, I. (eds.) FASE 2015. LNCS, vol. 9033, pp. 301–315. Springer,
Heidelberg (2015)
9. Montaghami, V., Rayside, D.: Extending alloy with partial instances. In:
Derrick, J., Fitzgerald, J., Gnesi, S., Khurshid, S., Leuschel, M., Reeves, S.,
Riccobene, E. (eds.) ABZ 2012. LNCS, vol. 7316, pp. 122–135. Springer, Heidelberg
(2012). doi:10.1007/978-3-642-30885-7 9
10. Nelson, T., Saghafi, S., Dougherty, D.J., Fisler, K., Krishnamurthi, S.: Aluminum:
principled scenario exploration through minimality. In: Proceedings of the 2013
International Conference on Software Engineering, pp. 232–241. IEEE Press (2013)
11. Pacheco, C., Ernst, M.D.: Randoop: feedback-directed random testing for Java. In:
Companion to the 22nd ACM SIGPLAN Conference on Object-oriented Program-
ming Systems and Applications Companion, OOPSLA 2007, pp. 815–816. ACM,
New York (2007). http://doi.acm.org/10.1145/1297846.1297902
12. Smith, B.D., Feather, M.S., Muscettola, N.: Challenges and methods in testing the
remote agent planner. In: AIPS, pp. 254–263 (2000)
13. Tai, K.C., Lie, Y.: A test generation strategy for pairwise testing. IEEE Trans.
Software Eng. 28(1), 109 (2002)
A General Lattice Model for Merging Symbolic
Execution Branches
1 Introduction
Symbolic execution [7,20] is a classic program analysis technique that was used
with considerable success in the past years, for example, in program testing [8]
and program verification [4]. One of the main bottlenecks of symbolic execution
is the path explosion problem [8]. It stems from the fact that symbolic execu-
tion must explore all symbolic paths of a program to achieve high coverage (in
testing), respectively, soundness (in verification). As a consequence, the num-
ber of paths from the root to the leaves in a symbolic execution tree is usually
exponential in the number of static branches of the executed program.
Various strategies are in use to mitigate path explosion, including subsump-
tion [3,9], method contracts [5] and value summaries [23]. The last two allow one
to perform symbolic execution per method: different symbolic execution paths
are merged into the postcondition of a contract or a value summary (a con-
ditional execution state over guard expressions). Summaries are computed on
the fly and bottom-up, while contracts characterize all possible behaviors and
must at least partially be written by hand. Unfortunately, even the use of rich
contracts (instead of inlining) is insufficient to deal with complex problems [15].
A seemingly obvious technique to alleviate state explosion in symbolic execu-
tion trees consists of merging the states resulting from a symbolic execution step
that caused a split (e.g., guard evaluation, statements that can throw exceptions,
polymorphic method calls). After all, graph-based data structures are standard
in model checking for the exploration of symbolic state spaces [10], as well as
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 57–73, 2016.
DOI: 10.1007/978-3-319-47846-3 5
58 D. Scheurer et al.
in other static software analyses. Indeed, several state merging variants were
suggested for symbolic execution [18,21,23], but there are problems:
(1) State merging does not come for free, but creates considerable overhead:
states must be merged, graph data structures are more complex than trees,
path conditions as well as summaries tend to grow fast and must be simpli-
fied. Eager state merging can make things worse [18], therefore, it has to be
carefully controlled. Simplification of intermediate expressions with the help
of automated deduction is indispensable.
(2) All mentioned approaches assume that merged states are identical to corre-
sponding unmerged states, possibly up to the differences encoded in value
summaries. This is insufficient to merge large numbers of different behaviors.
In the present paper we address both issues. Regarding the second, we observe
that instead of encoding merged states precisely into a conditional state, one
might also abstract from the precise value of a variable. This results in a loss of
precision, but reduces complexity. For example, consider symbolic execution of
“if (b) x = 1 else x = 2;” in state σ. Precise state merging would result in a state
identical to σ except the value of x is “x → (1, if σ(b) = true) | x → (2, if σ(b) =
false)”. This does not avoid path explosion, it only delays it. Now, assume that
we define an abstract domain A for the possible values of x, where α(x) is the
abstraction of x and A is an upper semilattice . For example, A might be the
sign lattice {⊥, −, 0, +, }. Then the merged state can be over-approximated by
the partially abstract state that is identical to σ except x → +. Path explosion
is avoided. We lost precision about the exact value of x, but for many analyses
this is acceptable provided that the abstract lattice is suitably chosen.
Based on the theory of symbolic execution with abstract interpretation [6],
in the present paper we put forward a general lattice-based framework for state
merging in symbolic execution where a family of abstract lattices is defined by
formulas of a program logic. Our framework preserves soundness of verification
and we show that it subsumes earlier approaches to state merging [18,21,23].
Regarding issue (1) above, as a second contribution, we improved automation
by implementing suitable proof macros for KeY as well as an extension of the
Java Modeling Language (JML)1 which allows software engineers to annotate
Java source code with instructions on when to perform state merges.
We implemented the framework in the state-of-art verification system KeY[5],
where contracts are available to mitigate state explosion. Since the latter must
be partially written by hand, state merging is a complementary technique that
promises a high degree of automation. We confirmed the usefulness of our app-
roach empirically with an extensive evaluation: Results for small to medium sized
programs are, as expected, mixed, because of the overhead of state merging. The
strength of symbolic execution with state merging emerges when applied to com-
plex verification problems like the TimSort implementation in the Java standard
library [15], where we observe reductions in proof size of up to 80 %. Additionally,
some proofs become feasible that were elusive before.
1
http://www.eecs.ucf.edu/∼leavens/JML//OldReleases/jmlrefman.pdf.
A General Lattice Model for Merging Symbolic Execution Branches 59
2 Background
We formalize our theory in the program logic JavaDL [5], but the approach is
easily adaptable to any program logic with an explicit notion of symbolic state.
The SE state (U, C, ϕ) given above is valid iff for any Kripke state σ satisfying
the path condition C, whenever we execute the program if (y<x) ... ; in σ, then
in the reached final state the value of program variable result is non-negative.
We explain how the SET for the example is constructed by stepwise symbolic
execution: Symbolic execution of the first statement (by applying the appropriate
calculus rule) splits the SET into the following two new intermediate states:
On each branch, either the body of the then-branch or the else-branch has to be
executed, followed by the remaining program. The remaining program is just a
single assignment statement here, but could be arbitrarily complex in general. In
addition, the path condition in each branch has been extended by the conjunct
y < x and its negation, respectively. Continuing symbolic execution on the first
branch results in the state
((x := y y := x), {x > 0, y > 0, y < x}, [result = y − x;] result ≥ 0)).
The motivation for state merging becomes very clear now: on each branch the
same remaining program has to be executed.
A concrete execution state for a given program counter assigns to each program
variable a concrete value of the universe. We define the semantics of SE states
by stipulating a concretization function from SE states to concrete states based
on the evaluation function val (K, σ; ·) (β is not needed as formulas are closed).
Definition 6 (Concretization Function). Let s = (U, C, ϕ) be an SE state.
The concretization function concr maps s to the set of concrete states
The set of concrete states for a symbolic state s contains all pairs of Kripke
states σ and the program counter such that σ can be reached via some state σ
satisfying s’s path condition in some Kripke structure. So the set concr (s) con-
tains exactly the concrete states that are described by the SE state s. Consider,
for instance, the SE state (x := c, {c > 0}, ϕ): The set of concretizations for this
state consists of all pairs (σ, ϕ), where σ is any function mapping the program
variable x to a strictly positive integer.
Based on Definition 6, we define a weakening relation expressing that one
symbolic execution state describes more concrete states than another one.
Definition 7 (Weakening Relation). Let s1 , s2 be two SE states. State s2 is
weaker than (a weakening of) s1 (written: s1 s2 ) iff concr (s1 ) ⊆ concr (s2 ).
Given a state s1 with satisfiable path condition, Definitions 6 and 7 imply that
a state s2 can only be weaker than s1 if both have syntactically the same pro-
gram counter. States with unsatisfiable path condition have an empty set of
concretizations and hence are stronger than any other state.
Consider the SE states s1 = (x := c, {c > 0}, ϕ) and s2 = (x := c, {c ≥ 0}, ϕ).
The set of concretizations of s2 contains all concrete states of s1 and additionally
all concrete states that map x to zero, hence s2 is a weakening of s1 (s1 s2 ).
Consider the SE state s3 = (x := if (true) then (c) else (t), {c > 0}, ϕ).
Although s1 and s3 are syntactically different, all Kripke models coincide on
the value of x and we would actually prefer to consider them as equal. Hence, we
concr
define an extensional equality s1 = s2 :⇔ concr (s1 ) = concr (s2 ) stating that
symbolic execution states are equal iff they evaluate to the same set of concrete
concr
execution states. Using = as equality, we can state the following lemma:
Lemma 1. The weakening relation is a partial order relation.
The core of our formal framework is a family of join-semilattices parametric
in a join operation. The partial order induced by the join operation is constrained
by the semantic weakening relation, see Definition 7.
Definition 8 (Induced Join-Semilattice of States). Let ϕ ∈ Fml be a
closed formula. The carrier set Sϕ for ϕ is defined as
{U1 } xi if ( ) holds
ti :=
joinVal (s1 , s2 ; xi , cxi ) otherwise
Define C ∗ = (U1 , C1 ) (U2 , C2 ) := ( C1 ∨ C2 ) ∧ {U ∗ } Ciabs where
true if ( ) holds
Ciabs :=
constraints (s1 , s2 ; xi , cxi ) otherwise
Condition ( ) holds if xi is evaluated identically in either state and is defined as
( ) (C1 → {U1 } P (xi )) ↔ (C2 → {U2 } P (xi ))
where P is a fresh (for U1 , U2 , C1 , C2 , ϕ) predicate symbol.
The provability relation “ ” in ( ) is undecidable, but it can be safely approxi-
mated in practice. For example, a prover may simply return “unprovable” after
exceeding a fixed time limit. This way soundness is maintained at the cost of
completeness due to overapproximation
in some situations. The update applica-
tion of {U ∗ } to Ciabs allows to take into account relations between values of
program variables changed by the merge (e.g., the merge by predicate abstrac-
tion for the dist example in Sect. 5). Otherwise, only relations between constants
and values before the merge would be reflected.
( x := if (y < x) then (y) else (x) y := if (y < x) then (x) else (y) , Γ, ϕ)
( x := y y := x, Γ ∪ {y < x} , ϕ) ( x := x y := y, Γ ∪ {y ≥ x} , ϕ)
The constraints on defAx k state that they must be contained in the abstract
domain lattice. There is not necessarily a unique element such that Ck →
defAx k ({Uk } xi ) is provable. Any element for which there is no strictly smaller
one suffices. For countable abstract lattices with an enumerable linearization,
the functions defAx k are computable, in particular, for finite domains an enu-
meration is obtained by topological sorting. For the sign analysis domain, one
enumeration is ⊥, −, 0, +, . Generally, infinite domains should support widen-
ing [11] to ensure that suitable abstractions can be computed.
In Definition 13 we consider lattices with a uniform type. It is possible to use
different lattices for different types in the merge technique. When no lattice is
specified for some type, If-Then-Else merges are used as fallback. Depending on
the situation, it may also be appropriate to define multiple lattices for the same
type (see Example 3 and Fig. 3 for a concrete example for ˙ abstr ).
State Merging with Join-Semilattices. The following theorem establishes the cor-
rectness of state merges with induced join-semilattices in the course of symbolic
execution. We omit the proof for space reasons, and refer the reader to [22].
.. ..
. .
( x := y y := x, {C1 , y ≤ −1 + x} , ϕ) ( x := x y := y, {C2 , y ≥ x} , ϕ)
( x := c1 y := c2 , {( C1 ) ∨ ( C2 ) ,
{ x := c1 y := c2 }(c1 ≥ x ∧ c1 ≥ 0 ∧ c2 ≥ x ∧ c2 ≥ 0)} , ϕ)
5 Evaluation
To assess the efficacy of our state merging methods, we implemented them in the
KeY verification system and applied them on a micro benchmark suite consisting
of four Java programs. We also present the results of a highly complex case study
on the TimSort method [15], which has been redone using our implementation.
Our micro benchmarks comprise the dist method (→ Listing 1), method abs
(→ Listing 2) computing the absolute of a given integer parameter, method gcd
(→ Listing 4) computing the Greatest Common Divisor (GCD) of two integers,
and method posSum computing the absolute of the sum of two positive integers
A General Lattice Model for Merging Symbolic Execution Branches 69
(→ Listing 3). In the dist example, the SE states after the execution of the if
statement are suitable for merging. For abs, where the proof goal is to show
that the result is positive, we use state merging after the execution of the if
block before Line 5. In the case of gcd, we aim to prove that the returned result
is actually the GCD of the input; state merging techniques are applied after
Lines 2 and 3. Method posSum demonstrates the application of state merging
for a while loop. Our goal is to prove that the returned result is the absolute of
the sum of the inputs. To render the SET finite, we constrain the value of x by
the upper bound 5. Thus, the loop is unwound five times during SE, giving the
opportunity of four merges before the call to the method abs in Line 3.
For each example, we compare the number of rule applications in a proof
without merging to the corresponding number in a proof containing merge rule
applications on the basis of the If-Then-Else as well as the predicate abstraction
technique. Results are shown in Table 1. In the last column, the predicates used
for abstraction are listed; v is a placeholder for an input term of type int. The
choice for abs induces a standard abstract domain for sign analysis of integers;
in the other cases, the predicates are tailored to the specific situations.
The result for dist demonstrates that If-Then-Else merging can even increase
the proof size when states are merged close to the end of SE. Merging with pred-
icate abstraction was beneficial in all cases. However, If-Then-Else merging is
easy to automate, whereas it is a harder problem to automatically infer abstrac-
tion predicates. Furthermore, the TimSort case study affirms that If-Then-Else
merges can substantially decrease the sizes of larger proofs.
5.2 TimSort
Example # Rule Apps Diff. (%) #Merges Merge Techn. Abstr. Predicates
w/o merge with merge
dist 219 254 -15.98 % 1 ITE –
dist 219 206 5.94 % 1 PRED (conj) {v ≥ 0, v ≤ y}
abs 156 137 12.18 % 1 ITE –
abs 156 132 15.38 % 1 PRED (disj) {v > 0, v = 0, v < 0}
gcd 9,056 8,758 3.29 % 2 ITE –
{v ≥ 0, (v = a ∨ v = −a)}
gcd 9,056 7,591 16.18 % 2 PRED (conj)
{v ≥ 0, (v = b ∨ v = −b)}
posSum 1,422 926 34.88 % 4 ITE –
posSum 1,422 911 35.94 % 4 PRED {v = x + y}
PRED (conj/disj): predicate abstraction with conjunctions/disjunctions of the predicates
ITE : the If-Then-Else merge technique.
et al. kindly allowed us to include their current results as part of our evaluation.4
Table 2 provides a comparison of the proof sizes with and without merging. It
shows that the proof sizes improved significantly for most proofs. All merges
used, if not stated otherwise, the If-Then-Else technique and thus required no
expert knowledge. In particular, state merging allowed to verify the method
mergeHi which was out of reach in [15] due to the path explosion problem.
For ensuresCapacity, where merging with If-Then-Else actually increased
the proof size, we created a new proof using a merge based on predicate abstrac-
tion. The resulting proof size is 15 % smaller compared to the version without
merging and even 25 % smaller than the proof with If-Then-Else based merging.
*) Proof by authors of this paper, uses predicate abstraction rather than If-Then-Else.
ensures that, if the subtree below a merge node is closed (or the merge node is
pruned away), then the linked node is also closed (or “unlinked”).
It is important to automate state merging as much as possible, in par-
ticular for less complex verification tasks that are otherwise fully automatic.
To help this, we extended the specification language JML with the annota-
tion / ∗ @ merge proc < join operator > @ ∗ /. It is placed in front of a Java
block after which the merge is supposed to happen. For certain join opera-
tors, for example the If-Then-Else join operator, this requires much less expert
knowledge than the definition of a block contract, i.e. an annotation of a block of
statements with pre- and postconditions, as an alternative way of tackling path
explosion.
In our experiments, we discovered that state merging with the If-Then-Else
technique is most beneficial when applied in situations where (1) a substantial
amount of code remains to be executed, and thus a lot of repetition can be
avoided, and (2) the difference between the states to be merged is as small as
possible. “Difference” means the number of variables attaining different values in
the symbolic states and the number of different formulas in the path conditions.
Predicate abstraction-based state merging is applicable to a wider range of
constellations. However, to come up with suitable predicates requires a certain
amount of expertise. An unsuitable choice of abstraction predicates can cause
the unfeasibility of the proof goal, because abstraction loses precision. At this
time, to merge states with predicate abstraction is comparable in difficulty to
writing block contracts. Nevertheless, we think that state merging is more suit-
able for automation, because it can be performed on-the-fly during the proof
process. Future work will aim at integrating heuristic approaches to improve the
performance of If-Then-Else state merging [21] as well as methods developed for
specification generation to automatically infer abstraction predicates [17,25].
Acknowledgment. We would like to thank the authors of [15] for the permission to
quote data from the extended journal version of their paper under preparation.
References
1. Ahrendt, W., et al.: The KeY platform for verification and analysis of Java pro-
grams. In: Giannakopoulou, D., Kroening, D. (eds.) VSTTE 2014. LNCS, vol. 8471,
pp. 55–71. Springer, Heidelberg (2014)
2. Anand, S., Godefroid, P., Tillmann, N.: Demand-driven compositional symbolic
execution. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol.
4963, pp. 367–381. Springer, Heidelberg (2008)
3. Anand, S., Păsăreanu, C.S., Visser, W.: Symbolic execution with abstract sub-
sumption checking. In: Valmari, A. (ed.) SPIN 2006. LNCS, vol. 3925, pp. 163–181.
Springer, Heidelberg (2006)
4. Beckert, B., Hähnle, R.: Reasoning and verification. IEEE Intell. Syst. 29(1), 20–29
(2014)
5. Beckert, B., Hähnle, R. (eds.): Verification of Object-Oriented Software: The KeY
Approach. Springer, Berlin (2006)
6. Bubel, R., Hähnle, R., Weiß, B.: Abstract interpretation of symbolic execution
with explicit state updates. In: Boer, F.S., Bonsangue, M.M., Madelaine, E. (eds.)
FMCO 2008. LNCS, vol. 5751, pp. 247–277. Springer, Heidelberg (2009)
7. Burstall, R.M.: Program proving as hand simulation with a little induction. In:
Information Processing, pp. 308–312. Elsevier (1974)
8. Cadar, C., Sen, K.: Symbolic execution for software testing: three decades later.
Commun. ACM 56(2), 82–90 (2013)
9. Chu, D.-H., Jaffar, J., Murali, V.: Lazy symbolic execution for enhanced learning.
In: Bonakdarpour, B., Smolka, S.A. (eds.) RV 2014. LNCS, vol. 8734, pp. 323–339.
Springer, Heidelberg (2014)
10. Clarke, E.M., Grumberg, O., et al.: Model Checking. The MIT Press, Cambridge
(1999)
11. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for sta-
tic analysis of programs by construction or approximation of fixpoints. In: 4th
Symposium of POPL, pp. 238–252. ACM Press, January 1977
12. Fitting, M.C.: First-Order Logic and Automated Theorem Proving, 2nd edn.
Springer, Berlin (1996)
13. Fitting, M.C., Mendelsohn, R.: First-Order Modal Logic. Kluwer, Dordrecht (1998)
14. Gosling, J., Joy, B., et al.: The Java (TM) Language Specification, 3rd
edn. Addison-Wesley Professional, Wokingham (2005). http://psc.informatik.uni-
jena.de/languages/Java/javaspec-3.pdf
15. de Gouw, S., Rot, J., de Boer, F.S., Bubel, R., Hähnle, R.: OpenJDK’s
Java.utils.Collection.sort() is broken: the good, the bad and the worst case. In:
Kroening, D., Păsăreanu, C.S. (eds.) CAV 2015. LNCS, vol. 9206, pp. 273–289.
Springer, Heidelberg (2015)
16. Graf, S., Saidi, H.: Construction of abstract state graphs with PVS. In:
Grumberg, O. (ed.) CAV 1997. LNCS, vol. 1254, pp. 72–83. Springer, Heidelberg
(1997)
17. Hähnle, R., Wasser, N., et al.: Array abstraction with symbolic pivots. In:
Ábrahám, E., Bonsangue, M., et al. (eds.) Theory and Practice of Formal Methods.
LNCS, vol. 9660, pp. 104–121. Springer, Berlin (2016)
A General Lattice Model for Merging Symbolic Execution Branches 73
18. Hansen, T., Schachte, P., Søndergaard, H.: State joining and splitting for the sym-
bolic execution of binaries. In: Bensalem, S., Peled, D.A. (eds.) RV 2009. LNCS,
vol. 5779, pp. 76–92. Springer, Heidelberg (2009)
19. Harel, D., Tiuryn, J., et al.: Dynamic Logic. MIT Press, Cambridge (2000)
20. King, J.C.: Symbolic execution and program testing. Commun. ACM 19(7), 385–
394 (1976)
21. Kuznetsov, V., Kinder, J., et al.: Efficient state merging in symbolic execution. In:
Proceedings of the 33rd Conference on PLDI, pp. 193–204. ACM (2012)
22. Scheurer, D.: From trees to DAGs: a general lattice model for symbolic execu-
tion. Master’s thesis, Technische Universität Darmstadt (2015). http://tinyurl.
com/Trees2DAGs
23. Sen, K., Necula, G., et al.: MultiSE: multi-path symbolic execution using value
summaries. In: 10th Joint Meeting on Foundations of Software Engineering, pp.
842–853. ACM (2015)
24. Shoenfield, J.R.: Mathematical Logic. Addison-Wesley, Wokingham (1967)
25. Weiß, B.: Predicate abstraction in a program logic calculus. In: Leuschel, M.,
Wehrheim, H. (eds.) IFM 2009. LNCS, vol. 5423, pp. 136–150. Springer, Heidelberg
(2009)
A Case Study of Formal Approach
to Dynamically Reconfigurable Systems
by Using Dynamic Linear Hybrid Automata
1 Introduction
1.1 Background
Dynamically reconfigurable systems are being used in a number of areas
[11,13,15]. The major methods of checking system safety include simulation
and testing; however, it is often difficult for them to ensure safety precisely,
since these methods don’t check all states. In such cases, model checking is a
more effective method. In this paper, we propose the Dynamic Linear Hybrid
Automaton (DLHA) specification language for describing dynamically reconfig-
urable systems and provide a reachability analysis algorithm for verifying system
safety.
σ, wQ →δ σ , wQ ⇐⇒ ∀i.σi ⇒δ σi .
iff ∃i.σi ⇒a! σi ∧ ∀j = i.σj ⇒a? σj ∨ ((¬∃σj .σj ⇒a? σj ) ∧ σj = σj ).
A run (or path) ρ of the system S is the following finite (or infinite) sequence
of states.
δ
ρ : s0 →δa00 s1 →δa11 · · · →ai−1 δi
i−1 si →ai · · ·
The initial state s0 is a tuple (σ0 1 . . . , σ0 |A| ), (w0 1 , . . . , w0 |Q| ) , where each
σ0i is the initial state of DLHA Ai and each w0j is empty; that is, ∀j.w0j = ε.
A Case Study of Formal Approach to Dynamically Reconfigurable Systems 79
4 Reachability Analysis
4.1 Reachability Problem
We define reachability and the reachability problem for a dynamically reconfig-
urable system as follows:
Definition 1 (Reachability). For a dynamically reconfigurable system S =
δ
(A, Q) and a location lt , S reaches lt if there exists a path s0 →δa00 · · · →at−1
t−1 st
such that st has a DLHA-state which contains the location lt .
Lemma 2. If this algorithm terminates and returns “lt is reachable”, the system
S does not hold the safety property.
By definition, all linear hybrid automata are DLHAs. Our system dynam-
ically changes its structure by sending and receiving messages. However, the
messages statically determine the structure, and the system is a linear hybrid
automaton with a set of queues. It is basically equivalent to the reachability
analysis of a linear hybrid automaton. Therefore, the reachability problem of
dynamically reconfigurable systems is undecidable, and this algorithm might
not terminate [1].
Moreover, in some cases, a system will run into an abnormal state in which
the length of a queue becomes infinitely long, and the verification procedure does
not terminate.
5 Practical Experiment
5.1 Model Checker
– A transition between locations can have a label asap (that means ‘as soon as
possible’). For a transition labeled asap, a time transition does not occur just
before the discrete transition.
– Each DLHA can have constraints and update expressions for the variables of
another DLHA in the same system. That is, for each DLHA, invariants, guard
conditions, update expressions and flow conditions can be used by all DLHAs.
TaskB with every 200 ms. The Scheduler (Fig. 6) performs scheduling in accor-
dance with the priority and actions for creation and destruction of DLHAs. For
example, when TaskA is created by EnvA with Crt taskA! and TaskB is already
running, The Scheduler receives Crt taskA? from EnvA and sends Act Preempt!
to TaskA and TaskB. Then, Act Preempt! causes TaskA to move to RunA and
TaskB to move to WaitB.
TaskA and TaskB send a message to The Sender if they need a co-task. The
Sender (Fig. 9) enqueues the message to create a co-task to q when it receives
a message from tasks. When TaskA sends Act Create a0! and moves to RunA
from WaitA, The Sender receives Act Create a0? and enqueues cotask a0 in q
with q!cotask a0.
The DRP Dispatcher (Fig. 10) dequeues a message and creates cotask a0
(Fig. 12), cotask a1 (Fig. 13), and cotask b0 (Fig. 14) if there are enough free
tiles. The Frequency Manager (Fig. 11) is a module that manages the operat-
ing frequency of the DRP. When a DLHA of a co-task is created, The Fre-
quency Manager moves to the location that sets the frequency to the minimum
value.
Other Cases. We have the parameters of the model in Subsect. 5.2 and con-
ducted experiments with it.
Fig. 16. Monitor automaton checking Fig. 17. Monitor automaton checking
creation of co-task a0 destruction of co-task a0
Fig. 18. Monitor automaton checking Fig. 19. Monitor automaton checking
frequency management tile management
The experimental results shown in Table 5 indicate that the modified tasks
cases and the modified co-tasks cases were verified with less computation
resources (memory and time) than were used by the original model. This reduc-
tion is likely due to the following reasons:
– Regarding the schedulability of the modified tasks model, the processing time
is shorter than that of the original model since the verification terminates if
a counterexample is found.
– In the cases of the modified co-tasks, the most obvious explanation is that
the state-space is smaller than that of the original model since the number of
branches in the search tree (i.e. nondeterministic transitions in this system)
88 R. Yanase et al.
is reduced by changing the start timings of the tasks and co-tasks with the
parameters.
– In cases other than those of the modified tasks, it is considered that the
state-space is smaller than that of the original model because this system is
designed to stop processing when a task exceeds its deadline.
References
1. Alur, R., Courcoubetis, C., Halbwachs, N., Henzinger, T.A., Ho, P.H., Nicollin,
X., Olivero, A., Sifakis, J., Yovine, S.: The algorithmic analysis of hybrid systems.
Theor. Comput. Sci. 138, 3–34 (1995)
2. Alur, R., Courcoubetis, C., Henzinger, T.A., Ho, P.-H.: Hybrid automata: an algo-
rithmic approach to the specification and verification of hybrid systems. In: Gross-
man, R.L., Ravn, A.P., Rischel, H., Nerode, A. (eds.) HS 1991 and HS 1992. LNCS,
vol. 736, pp. 209–229. Springer, Heidelberg (1993)
A Case Study of Formal Approach to Dynamically Reconfigurable Systems 89
3. Amano, H., Adachi, Y., Tsutsumi, S., Ishikawa, K.: A context dependent clock
control mechanism for dynamically reconfigurable processors. Technical report of
IEICE, vol. 104, no. 589, pp. 13–16 (2005)
4. Attie, P.C., Lynch, N.A.: Dynamic input/output automata, a formal model for
dynamic systems. In: Proceedings of the Twentieth Annual ACM Symposium on
Principles of Distributed Computing, PODC 2001, pp. 314–316 (2001)
5. Bagnara, R., Hill, P.M., Zaffanella, E.: The parma polyhedra library: toward a
complete set of numerical abstractions for the analysis and verification of hardware
and software systems. Sci. Comput. Program. 72(1–2), 3–21 (2008)
6. Boigelot, B., Godefroid, P.: Symbolic verification of communication protocols with
infinite state spaces using QDDs. Form. Methods Syst. Des. 14(3), 237–255 (1999)
7. Boigelot, B., Godefroid, P., Willems, B., Wolper, P.: The power of QDDs (extended
abstract). In: Hentenryck, P. (ed.) SAS 1997. LNCS, vol. 1302, pp. 172–186.
Springer, Heidelberg (1997). doi:10.1007/BFb0032741
8. Bouajjani, A., Esparza, J., Maler, O.: Reachability analysis of pushdown automata:
application to model checking. In: Mazurkiewicz, A., Winkowski, J. (eds.) CON-
CUR 1997. LNCS, vol. 1243, pp. 135–150. Springer, Heidelberg (1997)
9. Bouajjani, A., Habermehl, P.: Symbolic reachability analysis of FIFO-channel sys-
tems with nonregular sets of configurations. In: Degano, P., Gorrieri, R., Marchetti-
Spaccamela, A. (eds.) ICALP 1997. LNCS, vol. 1256, pp. 560–570. Springer, Hei-
delberg (1997)
10. Clarke, E.M., Grumberg, O., Jha, S., Lu, Y., Veith, H.: Counterexample-guided
abstraction refinement. In: Emerson, E.A., Sistla, A.P. (eds.) CAV 2000. LNCS,
vol. 1855, pp. 154–169. Springer, Heidelberg (2000)
11. Garcia, P., Compton, K., Schulte, M., Blem, E., Fu, W.: An overview of reconfig-
urable hardware in embedded systems. EURASIP J. Embed. Syst. 2006(1), 1–19
(2006)
12. Henzinger, T.A., Ho, P.H., Wong-Toi, H.: HyTech: a model checker for hybrid.
Softw. Tools Technol. Transf. 1(Cav 97), 110–122 (1997)
13. Lockwood, J.W., Moscola, J., Kulig, M., Reddick, D., Brooks, T.: Internet worm
and virus protection in dynamically reconfigurable hardware. In: Military and
Aerospace Programmable Logic Device (MAPLD), p. E10 (2003)
14. Minami, S., Takinai, S., Sekoguchi, S., Nakai, Y., Yamane, S.: Modeling, specifica-
tion and model checking of dynamically reconfigurable processors. Comput. Softw.
28(1), 190–216 (2011). Japan Society for Software Science and Technology
15. Motomura, M., Fujii, T., Furuta, K., Anjo, K., Yabe, Y., Togawa, K., Yamada, J.,
Izawa, Y., Sasaki, R.: New generation microprocessor architecture (2): dynamically
reconfigurable processor (DRP). IPSJ Mag. 46(11), 1259–1265 (2005)
16. Nieuwenhuis, R., Oliveras, A., Tinelli, C.: Abstract DPLL and abstract DPLL
modulo theories. In: Baader, F., Voronkov, A. (eds.) LPAR 2005. LNCS (LNAI),
vol. 3452, pp. 36–50. Springer, Heidelberg (2005). doi:10.1007/978-3-540-32275-7 3
17. Ono, Y., Yamane, S.: Computation of quantifier elimination of linear inequalities of
first order predicate logic. COMP Comput. 111(20), 55–59 (2011). IEICE Technical
report
18. Varshavsky, V., Marakhovsky, V.: GALA (Globally Asynchronous - Locally Arbi-
trary) design. In: Cortadella, J., Yakovlev, A., Rozenberg, G. (eds.) Concurrency
and Hardware Design. LNCS, vol. 2549, pp. 61–107. Springer, Heidelberg (2002)
19. Yamada, H., Nakai, Y., Yamane, S.: Proposal of specification language and verifi-
cation experiment for dynamically reconfigurable system. J. Inf. Process. Soc. Jpn.
Program. 6(3), 1–19 (2013)
Modelling Hybrid Systems in Event-B
and Hybrid Event-B: A Comparison
of Water Tanks
1 Introduction
Hybrid [9] and cyberphysical [10] systems pose significant challenges for a for-
mal development formalism based on discrete events. A number of compromises
are needed in order to allow a discrete event formalism to relate to the impor-
tant continuous aspects of the behaviour of such systems. Formalisms that are
more purpose built address such concerns more easily. This paper compares the
capabilities of (conventional) Event-B (EB) for modelling such systems with the
capabilities of the more purposely designed Hybrid Event-B (HEB). We do the
comparison in the context of a simple water tank example, in which filling and
emptying take place at different rates, necessitating a control strategy to ensure
that the required safety invariants are maintained. This familiar scenario makes
the discussion easier to follow. The example was modelled using EB in [8] using
facilities built in EB for expressing certain continuous features of behaviour.
The rest of this paper is as follows. Section 2 overviews the HEB framework,
and shows how EB results from forgetting the novel elements of HEB. Section 3
briefly recalls the water tank problem. Then Sect. 4 overviews the development
in [8], which is a detailed study of the water tank example in the EB framework.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 90–105, 2016.
DOI: 10.1007/978-3-319-47846-3 7
Modelling Hybrid Systems in Event-B and Hybrid Event-B 91
Pliant events are new. They specify the continuous evolution of the pliant vari-
ables over an interval of time. Figure 1 has a schematic pliant event P liEv. There
are two guards: iv, for specifying enabling conditions on the pliant variables, clocks,
and time; and grd, for specifying enabling conditions on the mode variables.
The body of a pliant event contains three parameters i?, l, o!, (input, local,
and output, again) which are functions of time, defined over the duration of the
pliant event. The behaviour of the event is defined by the COMPLY and SOLVE
clauses. The SOLVE clause contains direct assignments, e.g. of y and output o!
(to time dependent functions); and differential equations, e.g. specifying x via
an ODE (with D as the time derivative).
The COMPLY clause can be used to express any additional constraints that
are required to hold during the pliant event via the before-during-and-after pred-
icate BDApred. Typically, constraints on the permitted ranges of the pliant vari-
ables, can be placed here. The COMPLY clause can also specify at an abstract
level, e.g. stating safety properties for the event without going into detail.
Briefly, the semantics of a Hybrid Event-B machine consists of a set of system
traces, each of which is a collection of functions of time, expressing the value of
each machine variable over the duration of a system run.
Time is modeled as an interval T of the reals. A run starts at some initial
moment of time, t0 say, and lasts either for a finite time, or indefinitely. The dura-
tion of the run T , breaks up into a succession of left-closed right-open subinter-
vals: T = [t0 . . . t1 ), [t1 . . . t2 ), [t2 . . . t3 ), . . .. Mode events (with their discontinuous
updates) take place at the isolated times corresponding to the common endpoints
of these subintervals ti , and in between, the mode variables are constant, and the
pliant events stipulate continuous change in the pliant variables.
We insist that on every subinterval [ti . . . ti+1 ) the behaviour is governed
by a well posed initial value problem D xs = φ(xs . . .) (where xs is a relevant
tuple of pliant variables). Within this interval, we seek the earliest time ti+1 at
which a mode event becomes enabled, and this time becomes the preemption
point beyond which the solution to the ODE system is abandoned, and the next
solution is sought after the completion of the mode event.
In this manner, assuming that the IN IT IALISAT ION event has achieved
a suitable initial assignment to variables, a system run is well formed, and thus
belongs to the semantics of the machine, provided that at runtime:
• Every enabled mode event is feasible, i.e. has an after-state, and on its
completion enables a pliant event (but does not enable any mode event).1
• Every enabled pliant event is feasible, i.e. has a time-indexed family of
after-states, and EITHER:
(i) During the run of the pliant event a mode event becomes enabled. It
preempts the pliant event, defining its end. ORELSE
(ii) During the run of the pliant event it becomes infeasible: finite termination.
ORELSE
(iii) The pliant event continues indefinitely: nontermination.
1
If a mode event has an input, the semantics assumes that its value only arrives at a
time strictly later than the previous mode event, ensuring part of (1) automatically.
Modelling Hybrid Systems in Event-B and Hybrid Event-B 93
Thus in a well formed run mode events alternate with pliant events. The last
event (if there is one) is a pliant event (whose duration may be finite or infinite).
In reality, there are several semantic issues that we have glossed over in the
framework just sketched. We refer to [5] for a more detailed presentation (and to
[6] for the extension to multiple machines). The presentation just given is quite
close to the modern formulation of hybrid systems. See e.g. [13,15], or [9] for a
perspective stretching further back.
If, from Fig. 1, we erase time, clocks, pliant variables and pliant events, we
arrive at a skeleton (conventional) Event-B machine. This simple erasure process
illustrates (in reverse) the way that Hybrid Event-B has been designed as a clean
extension of the original Event-B framework. The only difference of note is that
now—at least according to the (conventional) way that Event-B is interpreted in
the physical world—(the mode) events (left behind by the erasure) execute lazily,
i.e. not at the instant they become enabled (which is, of course, the moment of
execution of the previous event).2
The Fig. 3 development starts with EB T ank1. This introduces the water
level variable, as well as the now variable (the analogue of clk in Fig. 2). Ini-
tialisation fixes now at 0 and level to the constant function over the degenerate
closed interval [0 . . . 0] with value L, the lower water level.
There is one event M odeChange, which illus-
MACHINE EB Tank30
REFINES EB Tank2 trates how continuous behaviour is handled in the
VARIABLES EB modelling style of [8]. As is clear, this is a simple
level, now, step, slevel, mode
INVARIANTS instantiation of the pattern of Fig. 2.
step ∈ R From its name, one can infer that M odeChange is
slevel ∈ ctsF(now, step)
mode = UP ⇒ intended to model the transitions between filling and
slevel ∈ mono inc emptying episodes. However, there is nothing in its
mode = DOWN ⇒
slevel ∈ mono dec definition that forces this—the event merely extends
level(now) = slevel(now) the level function, defined by its graph, by some non-
slevel(step) = (L . . . H)
EVENTS empty chunk into the future (that obeys the restric-
INITIALISATION tion on its range).
REFINES INITIALISATION
BEGIN EB T ank1 is refined to EB T ank2. The variables
now := 0 are the same, and another invariant level(now) ∈
level := const(0, 0, L)
step := 0 (L . . . H) is introduced to aid proof (of course, it
slevel := const(0, 0, L) follows mathematically from the earlier invariants
mode := UP
END level ∈ ctsF (0, now) and ran level ⊆ (L . . . H)).
StepUp The previous event M odeChange, is refined to two
ANY l
WHERE separate events, F ill and Empty. These events
mode = UP ∧ have additional contraints in their guards, l ∈
slevel(step) ≤ HT ∧
l ∈ ctsF(step, step + P) ∧ monotonically increasing functions for F ill, and l ∈
slevel(step) = l(step) ∧ monotonically decreasing functions for Empty. So
l ∈ mono inc ∧
l(step) ≤ l(step + P) ∧ each chunk that increments the level function is
l(step + P) ≤ increasing or decreasing, but cannot oscillate.
l(step) + (RU × P) ∧
l(step + P) ≤ H Again, from their names, we might infer that F ill
THEN and Empty are intended to model the full filling and
step := step + P
slevel := slevel ∪ l emptying episodes, which we expect to alternate. But
END there is no requirement that filling results in a level
EndFill
REFINES Fill anywhere near H, nor analogously for emptying; also
WHEN there is nothing to prevent successive filling, or suc-
mode = UP ∧
¬ (slevel(step) ≤ HT) cessive emptying episodes.
WITH EB T ank2 is refined to EB T ank3. The vari-
l = slevel
t = step ables are the same, and there are no new invariants.
THEN The only change now is that monotonic behaviour
now := step
level := level ∪ slevel is implemented by an axiomatic form of an ordinary
mode := DOWN differential equation. Thus, l ∈ mono inc in F ill is
slevel := const(step, step,
slevel(step)) replaced by der(l) = const(now, t, RU ), which says
END that the derivative of l is a constant function over the
StepDown . . . . . .
EndEmpty . . . . . . interval [now . . . t], with value RateU p. This, and the
END analogously modified Empty, covers what is shown
in Fig. 3.
Fig. 4. The EB T ank30
machine.
96 R. Banach and M. Butler
Aside from the machines in Fig. 3, there is a further machine, T ank30, in the
development discussed in [8]. This is also a refinement of EB T ank2, although
a different one. This one models a putative implementation of EB T ank2 using
a time triggered loop. A new variable step is introduced, whose job, like that
of now, is to model increments of time, but on this occasion small ones, whose
duration is determined by a constant P . Another new variable slevel models
the small increments or decrements to the water level accrued in each interval
of length P . The events modelling these small increments or decrements also
follow the pattern described earlier. Most of this machine is shown in Fig. 4 (the
parts omitted are the details of events StepDown and EndEmpty, which are
straightforward analogues of events StepU p and EndF ill).
Unlike the models of Fig. 3, there is a variable mode ∈ {U P, DOW N } to
enforce filling or emptying behaviour until the boundary values are approached.
And since, when using fixed time increments of length P , it is not realistic to
expect filling and emptying to reach the limits H or L ‘on the nose’, thresh-
olds HT and LT are introduced (respectively less than and greater than H and
L), upon reaching which, the mode changes. Technically, the ‘intermediate’ fill-
ing and emptying events, StepU p and StepDown, are ‘new’ events, refining a
notional skip in EB T ank2. The ‘endpoint’ events, EndF ill and EndEmpty,
refine F ill and Empty in EB T ank2, determining the needed values of now and
level to achieve refinement.3
Finally, we comment on the methodology used to arrive at these results. The
properties of the reals, and of real functions, were axiomatised using the theory
plugin of the Rodin tool [3,14]. One aspect of this is that derivatives, expressed
using axioms for der, are axiomatised as belonging to the continuous functions
ctsF , for convenience (see [8]). If we then look at the way that these are used in
EB T ank3, we see that the derivatives specified are always constant functions.
But filling episodes have a positive derivative of the l function, and emptying
episodes give l a negative derivative. Joining two such episodes cannot yield a
continuous derivative.
This apparent contradiction is resolved by noticing that each element of
ctsF is only defined with respect to its domain. Thus, a function f1 defined on
[t1 . . . t2 ] may have one continuous derivative, and a different function f2 defined
on [t2 . . . t3 ] may have a different continuous derivative. Even if f1 and f2 can
be joined at t2 , the exclusive use of closed intervals for domains of continuous
behaviour (which happens quite commonly in formulations of hybrid systems, see
e.g. [9,13,15]) does not enable us to deduce that their derivatives can be joined
at t2 . While consistent, the consequence of this is that the joined f1 ∪ f2 cannot
be regarded as a differentiable function on [t1 . . . t3 ], and in fact, an attempt
3
The use of thresholds HT and LT rather than the precise limits H and L, correlates
with the absence of guards to check reaching H or L in the corresponding EB T ank1
and EB T ank2 events. However, since the behaviour stipulated is nondeterministic
monotonic, adding an extra constraint to demand that the behaviour exactly reached
the required limit in events EndF ill and EndEmpty would be perfectly feasible
(mathematically, if perhaps not practically).
Modelling Hybrid Systems in Event-B and Hybrid Event-B 97
be introduced that was increased by these events and decreased by the mode
events to create a variant, but this would clutter the model. Thus we see
that HEB T ankM on mirrors EB T ank2 quite closely, aside from the presence
of pump and its controlling events, which fix the durations of the monotonic
episodes to be maximal, and ensures that switching takes place at the extreme
values of the range.
Machine HEB T ankODE refines EB T ankM on. This time the various
events are refined 1-1, so there are no ‘new’ events to worry about. The monotonic
continuous behaviour of W aterEmpty and W aterF ill is further refined to be
given by ODEs in which the derivative of the water level variable wl is RD for
W aterEmpty and RU for W aterF ill, as in EB. This appears in the SOLVE
clauses of these events. Once more, HEB T ankODE mirrors EB T ank3 quite
closely, aside from issues concerning pump, which we have discussed already.
Supplementing the machines of Fig. 5, machines analogous to the EB T ank30
machine appear in Fig. 6. Machine HEB T ankT T L is a time triggered devel-
opment of HEB T ankM on, and comparing it with T ank30 is instructive.
Note that there are no new variables, just new behaviour of events. Thus
W aterF ill is refined to W aterF illN ormal and to W aterF illEnd. The for-
mer of these is enabled when the water level is below the threshold HT . It
demands increasing wl behaviour, but restricted to a filling rate no greater than
RU . Occurrences of W aterF illN ormal are interleaved by occurrences of mode
event W aterF illObs, which runs at times that are multiples of P , provided the
water level is not actually H itself. Since W aterF illN ormal is increasing wl,
W aterF illObs merely skips. Once above HT , W aterF illEnd runs. This is like
W aterF illN ormal except for an additional condition insisting that wl hits H
at the end of the interval.4 And once wl has reached H, P umpOf f runs, as
previously. While this design is unimpeachable mathematically, it is, of course,
much more questionable from a practical perspective, as we pointed out in foot-
note 3. It does have the virtue though, of providing a straightforward refine-
ment from HEB T ankM on. Machine HEB T ankT T L is completed by events
W aterEmptyN ormal, W aterEmptyEnd, W aterEmptyObs, P umpOn, which
do the same as the preceding, but for the emptying phase.
Machine HEB T ankT T L is data refined to HEB T ankIM P on the right of
Fig. 6. This ‘implementation’ machine illustrates the refinement of pliant behav-
iour interleaved by mode skips, to pliant skips interleaved by mode updates—
a major aim of HEB is to allow such a passage from a high level continu-
ous design to a discrete, digital implementation. A fresh variable mwl (moni-
tored water level) is introduced, inc/decremented at each of the mode events.
Observing wl and updating mwl at each multiple of P enables the invariant
|mwl − wl| ≤ P × max(RU, RD) to be maintained, attesting to the reasonable-
ness of the digital implementation.
What has been achieved by formulating the development in the HEB way
compared to the EB way? Firstly, there is a certain fluency in referring to con-
tinuous behaviour via expressions that denote instantaneous values rather than
4
The constraint is consistent provided the various constants are suitably related, of
course.
100 R. Banach and M. Butler
having to assemble and disassemble graphs of functions (but only in the con-
tinuous case). Secondly, there are issues of potential semantic subtlety. We saw
an example in the discussion of the differential properties of the level function
in EB T ank3: it was not formally differentiable globally, but consisted of dif-
ferentiable monotonic pieces, leading to the join points having more than one
derivative value, despite these being ‘kink’ points of the function. In HEB such
matters are handled ab inito in the semantics, by the use of closed/open inter-
vals and the Carathéodory formulation of differential equations and derivatives
(which are only required to be defined almost everywhere). Thirdly, there is also
the fluency of the passage from pliant behaviour interleaved by mode skips to
pliant skips interleaved by mode updates. Discussion of further and more general
matters appears in the next section.
1. First and foremost, EB has a well developed existing tool, whereas for
HEB, tool development is, as yet, an aspiration. Having an existing tool is of
inestimable benefit when you need to get the job done.
2. In an EB development, real time has to be modelled as a normal state
variable. This imposes a responsibility on the model writer to not abuse the
capabilities this offers. In truth, time is (in physical parlance) an independent
variable—whereas other state variables correspond (physically) to dependent
variables. From a linguistic formalism point of view, staying faithful to the phys-
ical reality means that time has to be a read-only variable, and that all other
variables have to be functions of time. In an EB context, it is down to the
self-discipline of the model writer to reflect these properties properly. Clearly it
is possible to transgress them and to write unphysical models. In HEB these
realities are hardwired into the syntax and semantics, making it impossible for
the model writer to violate them.
3. An analogue of point 2 concerns the mathematical equipment of EB and
HEB. In EB all mathematical objects beyond those needed for discrete mod-
elling need to be axiomatised, typically using the theory plugin of the Rodin tool
[3,14]. Although this framework is agnostic regarding the level of abstraction of
the concepts being axiomatised, existing work emphasises a bottom up approach
(as in the case study above). This potentially creates a lot of work before the
level of abstraction needed for applications is reached, increasing risk.
The HEB perspective on this is to design the theoretical foundations of
the semantics in a way that best suits the needs of applications engineering,
giving system developers a mental model that is clear and easy to grasp, and,
importantly, is free from unexpected surprises (such as the two-valued ‘deriva-
tive’ discussed earlier). The aim would be to internalise the world of continuous
mathematics with the same level of care and consistency as the Rodin tool cur-
rently supplies for discrete mathematics and logic, and to supplement it via
extensive imported support from external tools such as Mathematica [12] for
calculational purposes. The facility for user designed rules and axiom schemes
would be retained for specialised purposes, but would not be the default app-
roach for continuous mathematics.
4. A specific example of the general remarks in the preceding point lies in the
contrast between the explicit construction of functions as relations, manipulated
via their graphs in Sect. 4 and their representation as expressions based on values
of variables at a single (arbitrary) element of their time domain in Sect. 5.
5. Connected with the previous point is the observation that in EB, the
discrete and continuous updates have to be handled by different means. Thus,
discrete transitions are written down using (in effect, pairs of) state expres-
sions, referred to via syntax such as xs := E(xs), with the accepted conventions
surrounding the syntactic machinery enabling the relevant expressions to be dis-
cerned. For continuous transitions though, because the EB framework offers no
alternative syntax for update than that which is used for discrete transitions,
updates to continuous behaviour have to be handled by updating the relation
describing (the function of time that is) the continuous behaviour as a whole, in
102 R. Banach and M. Butler
one action. Section 4 offers many examples. The discrete analogue of such an app-
roach would be to update (in one action), for a discrete variable x, a non-trivial
portion of its trace during an execution, i.e. to update say xi−1 , xi . . . xi+k ,
as a whole. (Aside from anything else, this would require the introduction into
every model of an index variable (incremented at each event occurrence), as well
as suitable history variables.)
By contrast, HEB provides special purpose syntactic machinery (via the
COMPLY and SOLVE clauses) to specify continuous update incrementally and
microscopically, rather than macroscopically, which is significant from an expres-
sivity standpoint. As most physical models specify behaviour in a microscopic
way (usually via differential equations etc.), being able to write these directly in
the formal framework aids the ability to specify in a manner as close to appli-
cation domain concerns as possible. Also, since the solutions to these micro-
scopic specifications are macroscopic (describing properties of the solution over
an extended portion of time/space), specifying in a microscopic way prevents
forcing the move from microscopic to macroscopic from being done offline. In
this way, discontinuous transitions and continuous transitions are handled in a
consistent manner, via mode transitions and pliant transitions respectively, both
of which are predominantly expression based ways of specifying updates.
6. Continuing from point 5, when specifying the unavoidable handovers
between continuous and discrete behaviours while using the macroscopic, rela-
tion based, way of specifying continuous behaviour, the endpoints of the periods
of continuous behaviour need to be described within the relations themselves, so
that the domain of the relevant relation can be specified. This is potentially an
overhead for the model designer when the problem is complicated enough, since
the handovers take place when prompted by physical law. In HEB, this job is
taken over by a generic preemption mechanism, which is, in turn, much easier
to handle in the expression based way of managing pliant behaviour, since all
the details regarding the domain of applicability of the pliant behaviour do not
need to be specified in advance.
7. Another consequence of point 5 concerns invariants. Invariants are nor-
mally expressions written in the state variables, that are expected to be true at
all times. Now, when we only have the usual changes of discrete state, and we
have the conventional interpretation of Event-B in the physical world in which
discrete transitions occur at isolated times, then the state does not change in
between these discrete transitions. Thus, once true at some point of an execution
(e.g. at initialisation time), if invariants are reestablished at each discrete tran-
sition, then the invariants hold throughout the duration of the execution. Note
that this reasoning takes place largely outside of the formal EB framework.
When the discrete EB transitions are extended to encompass updates
to lumps of continuous behaviour, the preceding argument no longer holds.
Straightforward safety properties built out of natural problem entities no longer
correspond to equivalent expressions built on state variables, but need to be
extracted from the relations containing pieces of continuous behaviour, poten-
tially making the proof of safety properties more difficult.
Modelling Hybrid Systems in Event-B and Hybrid Event-B 103
7 Conclusions
In the previous sections we reviewed Event-B and its hybrid extension, and then
summarised the water tank development in the two formalisms. This provided
the background for a more thorough comparison of the two ways of develop-
ing hybrid systems in Sect. 6. What this showed was that although many issues
5
Strictly speaking, not-free-in means ‘does not occur free—but may occur bound —in’.
Thus, the possibilities for alpha conversion are latent in the B-Method, even if they
are downplayed.
Modelling Hybrid Systems in Event-B and Hybrid Event-B 105
that were rather natural to express in Hybrid Event-B could be handled, with
some effort, in Event-B, doing it that way placed more and more reliance on
conventions that lay outside the formal Event-B framework. Obviously, the aim
of having a formal framework is to open the possibility of having a system
whereby properties directly relevant to the application can be checked mechan-
ically, instead of relying on informal conventions verified by humans for their
enforcement. Thus the pure Event-B approach to hybrid system design and
development will inevitably struggle increasingly, as the scale of the problem
being tackled grows.
References
1. Abrial, J.R.: The B-Book: Assigning Programs to Meanings. Cambridge University
Press, Cambridge (1996)
2. Abrial, J.R.: Modeling in Event-B: System and Software Engineering. Cambridge
University Press, Cambridge (2010)
3. Abrial, J.R., Butler, M., Hallerstede, S., Hoang, T.S., Mehta, F., Voisin, L.: Rodin:
an open toolset for modelling and reasoning in Event-B. STTT 12, 447–466 (2010)
4. Back, R.J.R., von Wright, J.: Refinement Calculus: A Systematic Introduction.
Springer, Heidelberg (1998)
5. Banach, R., Butler, M., Qin, S., Verma, N., Zhu, H.: Core hybrid Event-B I: single
hybrid Event-B machines. Sci. Comput. Program. 105, 92–123 (2015)
6. Banach, R., Butler, M., Qin, S., Zhu, H.: Core Hybrid Event-B II: Multiple Coop-
erating Hybrid Event-B Machines (2015, submitted)
7. Barendregt, H.: The Lambda Calculus its Syntax and Semantics. Elsevier,
Amsterdam (1981)
8. Butler, M., Abrial, J.R., Banach, R.: Modelling and refining hybrid systems in
Event-B and Rodin. In: Petre, S. (ed.) From Action System to Distributed Systems:
The Refinement Approach. Dedicated to Kaisa Sere, pp. 29–42. CRC Press/Taylor
and Francis, Oxford/Boca Raton (2015)
9. Carloni, L., Passerone, R., Pinto, A., Sangiovanni-Vincentelli, A.: Languages and
tools for hybrid systems design. Found. Trends Electron. Des. Autom. 1, 1–193
(2006)
10. Geisberger, E., Broy (eds.), M.: Living in a Networked World. Integrated Research
AgendaCyber-Physical Systems (agendaCPS) (2015). http://www.acatech.de/
fileadmin/user upload/Baumstruktur nach Website/Acatech/root/de/Publikation
en/Projektberichte/acaetch STUDIE agendaCPS eng WEB.pdf
11. Hindley, R., Seldin, J.: Introduction to Combinators and λ-Calculus. Cambridge
University Press, Cambridge (1986)
12. Mathematica. http://www.wolfram.com
13. Platzer, A.: Logical Analysis of Hybrid Systems: Proving Theorems for Complex
Dynamics. Springer, Heidelberg (2010)
14. RODIN Tool. http://www.event-b.org/, http://sourceforge.net/projects/rodin-b-
sharp/
15. Tabuada, P.: Verification and Control of Hybrid Systems: A Symbolic Approach.
Springer, Heidelberg (2009)
A System Substitution Mechanism for Hybrid
Systems in Event-B
Abstract. Changes like failure or loss of QoS are key aspects of hybrid
systems that must be handled during their design. Preserving the system
state is a common requirement that can be ensured by reconfiguration
relying on system substitution. The specification and design of these sys-
tems usually rely on continuous functions whereas their implementation
is discrete. Moreover, the associated safety properties are characterized
by a safety envelope defining safe system states. This paper presents
a novel approach for formalizing the system substitution mechanism for
hybrid systems, in which the system substitution maintains a safety enve-
lope of the given hybrid system during system failure or switching from
one supporting system to another. Proving the correctness of the discrete
implementation of the defined reconfiguration mechanism for hybrid sys-
tems is a challenging problem. In this purpose, we propose to combine
system substitution and incremental system modeling to ensure correct
discretization. We rely on the Event-B method and the Rodin Platform
with the Theory plug-in to develop the system models and carry out the
proofs on dense real numbers.
1 Introduction
Context. Cyber Physical Systems refer to the tight integration and coordination
between computational and physical resources [18]. In these systems, a software
component, the controller, manages the physical parts of the system. The early
models for such systems usually rely on continuous functions. The controller is
then implemented in a discrete manner thus combining continuous environment
models with discrete controller models, building an hybrid system.
Proving the correctness of discrete implementations of continuous controllers
is a challenging problem. Formal methods allow checking the correctness of such
system functional requirements, including the required safety properties. Due
to these core benefits, they have been adopted for designing and developing
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 106–121, 2016.
DOI: 10.1007/978-3-319-47846-3 8
A System Substitution Mechanism for Hybrid Systems in Event-B 107
the new age of discrete controllers that must satisfy their original continuous
specification [19] for building safe and reliable hybrid systems.
To prevent a system failure, controllers must react according to environment
changes to keep a desired state or to meet minimum requirements that maintain
a safety envelope for the system. A safety envelope is a safe over-approximation
of system states. It can be modeled as invariants that define a set containing all
possible system states under its nominal conditions. One key property studied
in system engineering is the ability to take actions according to an evolving
behavior. It may occur in different situations (e.g. failures, quality of service
change, context evolution, maintenance, etc.). Most safety critical systems, such
as avionics, nuclear, automotive and medical devices, whose failure could result
in loss of life, including reputation and economical damage, use reconfiguration or
substitution mechanisms to prevent losing the quality of system services required
for system stability when a random failure occurs.
In our earlier work, we proposed both a correct by construction system sub-
stitution mechanism [8,9] and a strategy to derive discrete controllers from con-
tinuous specifications [6]. In [8,9], we defined the reconfiguration mechanism
to maintain a safety property for a system (defined as a state-transitions sys-
tem) during failure or to switch from one supporting system to another. The
defined approach has been successfully applied, for the discrete case, on web
services [7]. But it is not applicable straightforwardly for hybrid systems which
need to handle continuous features. In [6], we presented the formal development
of a continuous controller that is refined by a discrete one preserving the contin-
uous functional behavior and the required safety properties. This work helped us
formulating more general strategies, that we aim to develop in this paper, for the
development of system substitution for hybrid systems using formal techniques.
2 Preliminaries
3 Studied Systems
1
http://wiki.event-b.org/index.php/Theory Plug-in#Standard Library.
A System Substitution Mechanism for Hybrid Systems in Event-B 111
At any time, the feedback information value of the controlled system shall be Req. 1
less or equal to M in any mode
At any time, the feedback information value of the controlled system shall Req. 2
belong to the safety envelope [m, M ] in progress mode
The system feedback information value can be produced either by f , g or Req. 3
f + g (f and g being associated to Sysf and Sysg )
The system Sysf may have feedback information values outside [m, M ] Req. 4
At any time, in the progress mode, when using Sysf , if the feedback Req. 5
information value of the controlled system equals to m or to M , Sysf must
is stopped
4 Formal Development
This section describes the stepwise formal development of studied systems in an
abstract model and a sequence of refined models. The abstract model formalizes
only the system initial behavior, while the refined models are used to define the
concrete and more complex behaviors in a progressive manner that preserves the
required safety properties at every refinement level.
Due to the limitation of the paper length, we only include a brief description
of the model development and refinements. We invite readers to rely on the
complete formal model available at [1] to understand the basic steps of the
formal development, refinements and associated safety properties.
The previous two contexts (C envelope and C margin) deal with the defini-
tion of a safety envelope. As mentioned in the requirements defined in Table 3,
we define the interval of safe values as [m, M ] in the continuous case and
[m + z, M − z] with margin z in the discrete case.
The first refinement introduces the safety envelope [m, M ]: the main invari-
ant satisfied by all functions: f initially, f + g during substitution and g after
substitution. Machine M1, defined in Listing 1.6, refines M0. It preserves the
behavior defined in M0 and introduces two kinds of events: environment events
(event name prefixed with ENV ) and controller events (event name prefixed
with CTRL) [23]. The ENV events produce the system feedback observed by
the controller.
In this refinement, three new real variables f, g and p are introduced. f
and g record the feedback information of Sysf and Sysg individually, while
p records the feedback information of both systems before, during and after
substitution. The variable p corresponds to f of Sysf in MODE F, g of Sysg in
MODE G and f + g of combined Sysf and Sysg in MODE R corresponding to
the system reparation (invariants mode01 to mode05 ). In all cases, p shall belong
to the safety envelope (invariants envelope01 and envelope02 ). The CTRL events
correspond to refinements of the abstract events of M0. They modify the control
variable active and md. The ENV events observe real values corresponding to
A System Substitution Mechanism for Hybrid Systems in Event-B 115
the different situations where Sysf and Sysg are running or when Sysf fails and
Sysg boots. This last situation corresponds to the reparation case.
This section gives the proof statistics through detailed data about generated
proof obligations. Event-B supports consistency checking which shows that a list
of events preserves the given invariants, and refinement checking which ensures
that a concrete machine is a valid refinement of an abstract machine. The whole
formal development is presented through one abstract model and a sequence of
three refinement models to cover the possible operations of system substitution
of hybrid systems.
Table 4 gives the proof statistics for the development using the Rodin tool.
To guarantee the correctness, we established various invariants in the incre-
mental refinements. This development resulted in 732 (100 %) proof obligations,
of which 202 (28 %) were proved automatically, and the remaining 530 (72 %)
were proved interactively using the Rodin prover (see Table 4). These interactive
proof obligations are mainly related to the complex mathematical expressions
and the use of Theory plug-in for REAL datatype, which are simplified through
interaction, providing additional information to assist the Rodin prover.
5 Discussion
envelope to preserve the desired behavior; (3) Handle the continuous behavior
and dense time; (4) Model the discretization of the continuous function.
The proposed work is an extension of our previous work [6,8]. In [8], we
have developed a generic formal model for system substitution and in [6], we
have proposed the stepwise formal development for modeling continuous func-
tion using concrete functions. In this paper, we have used our existing approaches
for addressing the challenges related to formal modeling and verification for the
system substitution for hybrid systems. As far as we know, there are no similar
published work. This work is a preliminary step for applying a system substi-
tution mechanism for hybrid systems. We use the Theory plug-in for describing
the hybrid systems and the required properties. In this experiment, we found
that proof are quite complex and the existing Rodin tool support is not powerful
enough to prove the generated proof obligation automatically. In fact, we need
to assist the Rodin provers to find the required assumptions and predicates to
discharge the generated proof obligations. On the other hand, we also found that
the Theory plug-in is not yet complete. We have defined several assumptions and
theorems in our model to help the proving process with the Real theory.
6 Related Work
7 Conclusion
Hybrid systems are dynamic systems that combine continuous and discrete
behaviors to model complex critical systems, such as avionics, medical, and auto-
motive, where an error or a failure can lead to grave consequences. For critical
systems, recovering from any software failure state and correcting the system
behavior at runtime is mandatory. The substitution mechanism is an approach
that can be used to recover from failure by replacing the failed system. Its use
for hybrid systems is a challenging problem as it requires to maintain a safety
envelope through discrete implementation of continuous functions. To address
this problem, we have presented a refinement based formal modeling and veri-
fication of system reconfiguration or substitution for hybrid systems by proving
the preservation of the required safety envelope during the process of system
substitution. In this paper, we have extended our work on system substitution
to handle systems characterized by continuous models. First, we formalized the
system substitution at continuous level, then we developed a discrete model
through refinement by preserving the original continuous behavior. The whole
approach is supported by proofs and refinements based on the Event-B method.
Refinements proved useful to build a stepwise development which allowed us
to gradually handle the requirements. Moreover, the availability of a theory of
real numbers allowed us to introduce continuous behaviors which usually raise
from the description of the physics of the controlled plants. All the models have
been encoded within the Rodin Platform [4]. These developments required many
interactive proofs in particular after the introduction of real numbers. The inter-
active proofs mainly relate to the use of the Theory plug-in for handling real
numbers. Up to our understanding, the lack of dedicated heuristics due to the
representation of real numbers as an axiomatically-defined abstract data type,
and not as a native Event-B type together with our limited experience in defining
tactics led to this number of interactive proofs.
120 G. Babin et al.
This work opened several research directions. First, the models defined in
this work handled a single parameter for information feedback with a simple
safety envelope (interval that the value must belong to). We plan to investigate
the reformulation of this problem when several parameters will be considered.
In this case, the safety envelope becomes a more complex expression (a con-
straint solving problem). The second possible extension of this work is related
to parametrization of the safety envelope with time. In other words, instead
of having constant interval bounds, we may define bound functions m(t) and
M (t). Other properties like elasticity could be expressed. However, this exten-
sion requires a powerful prover on real numbers and constraint solving problems
techniques. Another possible extension of this work is the development of sim-
ulation. The integration of simulation or co-simulation to validate the formal
model hypotheses will undoubtedly strengthen the approach. Finally, studying
particular systems through realistic case studies is another objective of our work.
References
1. Models. http://babin.perso.enseeiht.fr/r/ICFEM 2016 Models/
2. Abrial, J.R.: The B-Book: Assigning Programs to Meanings. Cambridge Uni-
versity Press, Cambridge (1996). http://ebooks.cambridge.org/ebook.jsf?bid=
CBO9780511624162
3. Abrial, J.R.: Modeling in Event-B: System and Software Engineering, 1st edn.
Cambridge University Press, New York (2010)
4. Abrial, J.R., Butler, M., Hallerstede, S., Hong, T.S., Mehta, F., Voisin, L.: Rodin:
an open toolset for modelling and reasoning in Event-B. Int. J. Softw. Tools Tech-
nol. Transf. 12(6), 447–466 (2010)
5. Abrial, J.R., Butler, M., Hallerstede, S., Leuschel, M., Schmalz, M., Voisin, L.:
Proposals for mathematical extensions for Event-B. Technical report (2009)
6. Babin, G., Aı̈t-Ameur, Y., Nakajima, S., Pantel, M.: Refinement and proof based
development of systems characterized by continuous functions. In: Li, X., et al.
(eds.) SETTA 2015. LNCS, vol. 9409, pp. 55–70. Springer, Heidelberg (2015).
doi:10.1007/978-3-319-25942-0 4
7. Babin, G., Aı̈t-Ameur, Y., Pantel, M.: Formal verification of runtime compensation
of web service compositions: a refinement and proof based proposal with Event-B.
In: IEEE International Conference on Services Computing, pp. 98–105 (2015)
8. Babin, G., Aı̈t-Ameur, Y., Pantel, M.: Correct instantiation of a system reconfig-
uration pattern: a proof and refinement-based approach. In: IEEE International
Symposium on High Assurance Systems Engineering (HASE), pp. 31–38 (2016)
9. Babin, G., Aı̈t-Ameur, Y., Pantel, M.: Trustworthy cyber-physical systems engi-
neering. In: Romanovsky, A., Ishikawa, F. (eds.) A Generic Model for System
Substitution. Chapman and Hall/CRC, Boca Raton (2016)
10. Banach, R., Butler, M., Qin, S., Verma, N., Zhu, H.: Core hybrid Event-B I: single
hybrid Event-B machines. Sci. Comput. Program. 105, 92–123 (2015)
11. Bhattacharyya, A.: Formal modelling and analysis of dynamic reconfiguration of
dependable systems. Ph.D. thesis, Newcastle University, January 2013
12. Butler, M., Abrial, J.R., Banach, R.: From Action Systems to Distributed Systems:
The Refinement Approach, chap. Modelling and Refining Hybrid Systems in Event-
B and Rodin, pp. 29–42. Chapman and Hall/CRC., April 2016
A System Substitution Mechanism for Hybrid Systems in Event-B 121
13. Butler, M., Maamria, I.: Practical theory extension in Event-B. In: Liu, Z., Wood-
cock, J., Zhu, H. (eds.) Theories of Programming and Formal Methods. LNCS, vol.
8051, pp. 67–81. Springer, Heidelberg (2013)
14. Henzinger, T.A., Ho, P.H., Wong-Toi, H.: HyTech: a model checker for
hybrid systems. Int. J. Softw. Tools Technol. Transf. 1(1–2), 110–122 (1997).
http://dx.doi.org/10.1007/s100090050008
15. Iftikhar, M.U., Weyns, D.: A case study on formal verification of self-adaptive
behaviors in a decentralized system. In: Kokash, N., Ravara, A. (eds.) 11th Inter-
national Workshop on Foundations of Coordination Languages and Self Adaptation
(FOCLASA 2012), EPTCS, vol. 91, pp. 45–62 (2012)
16. Jastram, M., Butler, M.: Rodin User’s Handbook: Covers Rodin V.2.8. CreateSpace
Independent Publishing Platform, USA (2014). ISBN 10: 1495438147, ISBN 13:
9781495438141, http://handbook.event-b.org
17. Lanoix, A., Dormoy, J., Kouchnarenko, O.: Combining proof and model-checking to
validate reconfigurable architectures. Electron. Notes Theor. Comput. Sci. 279(2),
43–57 (2011)
18. Lee, E.A., Seshia, S.A.: Introduction to Embedded Systems - A Cyber-Physical
Systems Approach. LeeSeshia.org, 1.5 edn. (2014). http://leeseshia.org/
19. Lin, H.: Mission accomplished: an introduction to formal methods in mobile robot
motion planning and control. Unmanned Syst. 02(02), 201–216 (2014)
20. Pereverzeva, I., Troubitsyna, E., Laibinis, L.: A refinement-based approach to
developing critical multi-agent systems. Int. J. Crit. Comput.-Based Syst. 4(1),
69–91 (2013)
21. Platzer, A.: Logical Analysis of Hybrid Systems: Proving Theorems for Complex
Dynamics. Springer, Heidelberg (2010). http://symbolaris.com/lahs/
22. Rodrigues, R., Liskov, B., Chen, K., Liskov, M., Schultz, D.: Automatic reconfig-
uration for large-scale reliable storage systems. IEEE Trans. Dependable Secure
Comput. 9(2), 145–158 (2012)
23. Su, W., Abrial, J.R., Zhu, H.: Formalizing hybrid systems with Event-B and the
Rodin platform. Sci. Comput. Program. 94, 164–202 (2014)
Service Adaptation with Probabilistic Partial
Models
Manman Chen1(B) , Tian Huat Tan1 , Jun Sun1 , Jingyi Wang1 , Yang Liu2 ,
Jing Sun3 , and Jin Song Dong4
1
Singapore University of Technology and Design, Singapore, Singapore
2
Nanyang Technological University, Singapore, Singapore
manman [email protected]
3
The University of Auckland, Auckland, New Zealand
4
National University of Singapore, Singapore, Singapore
1 Introduction
flow to find a path for execution that can maximize the ability to satisfy the
non-functional requirements. Therefore, we present runtime ADaptation frame-
work based on workFlow (ADFlow), a framework to alleviate the management
problem of complex Web compositions that operate in rapidly changing environ-
ments. We propose the notion of probabilistic partial model, which is extended
from the previous notion of partial model [11], to capture the uncertainties of
system execution with probabilistic. The global constraints of the composite
service are decomposed into local requirements for each state of a probabilistic
partial model. When a possible violation of the global constraints is detected,
adaptive actions are taken preemptively based on the probabilistic partial model,
to avoid unsatisfactory behaviors or failures. In particular, the adaptive action
chooses the execution that could maximize the likelihood of conformance of the
global constraints.
Our contributions are summarized as follows.
1. We propose the probabilistic partial model to capture the runtime uncertain-
ties of Web service composition.
2. We propose a runtime adaptation framework, ADFlow for Web service com-
position. ADFlow monitors the execution of Web service composition based
on local requirements of the probabilistic partial model. If a possible violation
of the global constraints of the composite service is detected, adaptive actions
would be taken preemptively to prevent the violation.
3. To reduce the monitoring overhead, we propose to use asynchronous mon-
itoring where the execution status is monitored asynchronously whenever
possible. We show that this approach reduces the overhead significantly.
4. We have evaluated our method on real-world case studies, and we show that
it significantly improves the chance of the composite service to conform to
the global constraints.
Outline. The rest of paper is structured as follows. Section 2 describes a moti-
vating example. Section 3 introduces the probabilistic partial model used for Web
service compositions. Section 4 presents our ADFlow adaptation framework for
runtime adaptation. Section 5 evaluates the performance of our approach in sev-
eral scenarios with the increasing complexity. Section 6 discusses related work.
Section 7 concludes the paper and describes future work.
2 Motivating Example
In this work, we introduce four elementary compositional structures for compos-
ing the component services, i.e., the sequential (sequence), parallel (flow),
loop (while) and conditional (if) compositions, which are all the essential
structures of many programming languages; therefore, our work can be applied
to other languages potentially. In addition, there are three basic activities to
communicate with component services, i.e., receive (receive), reply (reply),
and invocation (invoke) activities. The receive and reply activities are
used to receive requests from and reply results to the users of the composite
Service Adaptation with Probabilistic Partial Models 125
Receive User
Fig. 1.
126 M. Chen et al.
Now, let us consider a scenario where the flight searching service takes 500 ms.
Classic point adaptation strategy may switch some service to an alternating
service [5,15,17,18], which has been mentioned in the introduction, as it involves
retrying or switching of a particular service. There are cases where such a strat-
egy does not work. For example, there is no alternate service that can satisfy the
non-functional requirements. In addition, there might not exist an alternating
service that could be switched directly. In such a case, our workflow adaptation
strategy, could be used.
PTBS = {({[sInv(F S)]64 ; C([g1 ][sInv(BF1 )]33 , [g2 ][sInv(BF2 )]22 , [sInv(BF3 )]11 )31 }64 |||[sInv(HB)]22 )64 ; [reply]00 }64
sInv (BF1 ) sInv (BF2 ) sInv (BF3 ) if [g1 ], p1 elseif [g2 ], p2 else, p3
s7 :(P7 , < (22 ), (11 ), (11 ) >) s8 :(P8 , < (33 ), (0.95
0.95
), (22 ) >) s9 :(P9 , < (22 ), (0.9 2 1 0.95 1
0.9 ), (2 ) >) s10 :(P10 , < (1 ), (0.95 ), (1 ) >)
reply
where S=(sInv(F S); A)|||(sInv(HB)); reply, P1 =A|||sInv(HB); reply, P2 =sInv(F S); A; reply, P3 =P7 |||sInv(BF1 ); reply,
P4 =P7 |||sInv(BF2 ); reply, P5 =P7 |||sInv(BF3 ); reply, P6 =A; reply, P8 =sInv(BF1 ); reply, P9 =sInv(BF2 ); reply, P10 =sInv(BF3 );
reply, A=C([g1 ]sInv(BF1 ), [g2 ]sInv(BF2 ), sInv(BF3 )))
The process description of TBS, PTBS is shown in Fig. 2a. The numbers anno-
tated to each activity will be introduced in our technical report [3].
3 Preliminaries
In this work, we use three QoS attributes, i.e., response time, availability and
cost as examples to demonstrate our approach. The response time r ∈ R≥0 of
a service is defined as the delay between sending the request to the service and
receiving the response from it. The availability a ∈ R ∩ [0, 1] of a service is
the probability of the service being available. The cost of a service is the price
that incurs by invoking the service. We use R(a), A(a) and C (a) to denote the
response time, availability and cost of the activity a respectively. Table 1 lists
QoS values for component services of TBS, that will be used in the subsequent
sections. There are two kinds of QoS attributes, positive and negative ones.
Positive attributes, e.g., availability, provide good effect on the QoS; therefore,
they need to be maximized. While negative attributes, e.g., response time and
cost, need to be minimized. Our QoS attributes could be addressed similarly as
these three QoS attributes. For example, reliability could be handled in the same
way as availability.
128 M. Chen et al.
Given a state s = (P, V, Q), we use the notation P (s), V (s), and Q(s) to
denote the process, valuation, and local estimation of the state s respectively.
Two states are said to be equal if and only if they have the same process P , the
same valuation V and the same QoS attribute vector Q.
For convenience, given a composite service CS, we use P(CS ) to denote the
probabilistic partial model of CS. P(CS ) is extended from T (CS ) by mapping
values (e.g., True, or Maybe, 0.5) for transitions on T (CS ). We illustrate how
the value on transitions of P(CS ) are decided. Given an action a ∈ Act(s),
F (s, a) denotes whether action a ∈ Σ could be executed from state s, P (s, a)
provides the probability of executing the action a ∈ Σ at the state s. Clearly,
F (s, a) = False and P (s, a) = 0 if a ∈ Act(s). F (s, a) = True and P (s, a) =
1 if action a ∈ Act(s) and could always be executed regardless the valuation
of the variables. Otherwise, F (s, a) = Maybe and P (s, a) = 1 where
a∈M Act(s)
M Act(s) = {a|a ∈ Act(s) ∧ (F(s, a) = Maybe)}. MAct(s) represents a set of
Maybe actions from s, where exactly one of actions a ∈ MAct(s) would be
executed. The execution of a Maybe action depends on the evaluation of the
guard (e.g., if activity), or dependent on the response from other component
services (e.g., pick activity). We also use TAct(s) to denote the set of True
actions enabled by s; formally, T Act(s) = {a|a ∈ Act(s) ∧ (F(s, a) = True)}. For
example, actions if [g1 ], elseif [g2 ], and else (with p1 , p2 and p3 as their respective
probabilities) are Maybe actions, since the execution of these actions dependent
on the evaluation of the guard conditions. In contrast, actions FS and HB are
True actions, since both actions are triggered concurrently at state s0 .
Consider the probabilistic partial model of TBS, P(TBS ), as shown in
Fig. 2b. Recall that a state is represented as (P, V, Q). Since V = ∅ for all states
in P(TBS ), we represent states in P(TBS ) as (P, Q) for simplicity. An edge is
shown using solid (resp., dotted) arrow if the triggered action is a True (resp.,
Maybe) action, and an edge is labelled with probability if the triggered action is
a Maybe action. Since the probability is 1 if the action is a True action, we omit
the 1 in the P(TBS ).
4 ADFlow Framework
then Adapter could choose an action, that maximizes the chance of satisfying
the global constraints, to be executed by Executor.
Consider TBS with active state at state s1 in Fig. 2b, which has three Maybe
actions, i.e., if [g1 ], elseif [g2 ], and else. For an if activity, it is the evalua-
tion of guard conditions that decides which branch to execute. It is a violation
of the semantics of the if activity if Executor, simply follows a different
action (e.g., elseif [g2 ]) chosen by Adapter, without checking the evaluation
of the guard condition. For this purpose, we extend the if activity with an
attribute ctr, so that users are allowed to specify whether the if activity is
controllable by Adapter. If ctr is set to true, then Executor would send an
Adaptation Query message to Adapter to consult which action to be executed
next. Adapter would either select an action to be executed or decide not to
control if there is no potential violation of the global constraints detected, and
then replies to Executor. If Adapter chooses an action, Executor would
disregard the valuation of guard condition and execute the action that is chosen
by Adapter.
Given an activity P , Ctrl (P ) ∈ {true, false} denotes the controllability of
P , which is defined recursively with Eq. (1). If P is a sequential activity P1 ; P2 ,
the controllability of P is decided on the controllability of process P1 . For a
concurrent activity P = P1 |||P2 , P is controllable if either activity P1 or activity
P2 is controllable, since activities P1 and P2 are triggered at the same time. For
conditional activity P = C([g1 ]P1 , [g2 ]P2 , . . .), the controllability is decided by
the user-specified controllability of the conditional activity C.
⎧
⎪
⎨Ctrl (P1 ) if P (s) = P1 ; P2
Ctrl (P )= Ctrl (P1 ) ∨ Ctrl (P2 ) if P (s) = P1 |||P2 (1)
⎪
⎩
Ctrl (C) if P (s) = C([g1 ]P1 , [g2 ]P2 , . . .)
In this section, we introduce the local estimation and the method to calculate it.
The local estimation of a state s provides an estimation of QoS from two perspec-
tives, pessimistic and probabilistic, for all executions starting from state s.
Pessimistic Estimation. The pessimistic estimation of a QoS attribute a pro-
vides a conservative estimation of the attribute a for all executions starting from
the state s. For example, the pessimistic estimation of state s for the response
time attribute is the maximum response time that is required for all executions
starting from state s. The pessimistic estimation is used to help Adapter to
decide whether to take over the composite service at the active state sa . For
example shown in Fig. 3a, suppose the total response time from the initial state
s0 to state sa takes 1 s, and the global constraints for the response time is
2 s. If the pessimistic estimation of the response time at state sa is r seconds,
where r > 1, then the runtime adaptation is required. The reason is that since
1+r > 2 s, there exists an execution path that could violate the global constraint
of the response time.
132 M. Chen et al.
r1
r2
Adaptation Query
s0 . . . sa sn
...
Message (Synchronous)
<BPEL>
rn-1 < />
1 second ....
rn messsage </BPEL>
queue
Global response time requirement: 2 State Update Message
Runtime Monitor and Adapter (Asynchronous) Runtime Execution Engine
seconds (Adapter) (Executor)
Fig. 3. ADFlow
4 if ¬(Sr ∧ Sa ∧ Sc ) then
5 return argmax (0.5·Q(a) + 0.5·fb (Sr (a) ∧ Sa (a) ∧ Sc (a)));
a∈MAct(s)
6 return ∅;
probabilistic estimations of its QoS attributes with the maximum and minimum
probabilistic estimations of all enabled Maybe actions. The calculation of Q(a)
3
is provided in Eq. (2), where wi ∈ R+ is the weight with i=1 wi = 1. The local
optimality value of an action a, denoted by L(a), is calculated using Eq. (3),
where Sr (a), Sa (a), Sc (a) ∈ {true, false} denote whether the execution of action
a could allow potential satisfaction of global constraints of response time, avail-
ability and cost respectively. Function fb (b) takes an input b ∈ {true, false}.
When b is true, fb (b)=1, otherwise, fb (b)=0. The local optimality value of the
action a ranges from 0.5 to 1 if Sr (a) ∧ Sa (a) ∧ Sc (a), otherwise L(a) ranges from
0 to 0.5. Therefore, it could guarantee that the local optimality values of actions
that could possibly satisfy the global constraints are higher than the one that
could not.
(r)
UM ax (s) − a.probtag
Q(a) = w1 · (r)
(r) (r)
UM ax (s) − UM in (s) UM (s) = M (a.probtag)
a∈MAct(s)
(a)
A(a) · Lpr (a)
A (s ) − UM in (s)
UM (s) = M (A(a) · Lpr
A (s ))
+ w2 · (a) (a)
with a∈MAct(s)
UM ax (s) − UM in (s) (c)
UM (s) = M (C(a) + Lpr
C (s ))
a∈MAct(s)
(c)
UM ax (s) − (C(a) + Lpr
C (s )) M ∈ {min, max}
+ w3 · (c) (c)
UM ax (s) − UM in (s)
(2)
Adapter might require to deal with multiple concurrent state update messages
due to the concurrent execution of activities in the composite service (recall that
service composition supports the parallel composition). Synchronous communi-
cation between the Adapter and the Executor for each state update message
could result in high overhead and the parallel execution in the Executor can
be “sequentialized”. To be efficient, ADFlow adopts an asynchronous moni-
toring mechanism. That is, asynchronous communication is used between the
Adapter and the Executor during normal situations, and synchronous com-
munication is used when it is necessary. In particular, all the state update mes-
sages are sent asynchronously to the message queue, and the Adapter updates
states in batches on the probabilistic partial model. Synchronous communication
is used only when the Executor encounters controllable activities. In such a
case, an adaptation query message is sent to the message queue synchronously
(i.e., the Executor waits for the reply before continuing execution) to consult
whether there is a need for adaptation before their execution. The asynchronous
monitoring of ADFlow is shown in Fig. 3b. We have shown that synchronous
monitoring has effectively reduced the overhead for monitoring (see Sect. 5 for
the evaluation).
5 Evaluation
To reduce the external noise and control the non-functional aspect of a service,
we make use of controlled experiment to evaluate our approach. We aim to
answer the following research questions:
The evaluation was conducted using two different physical machines, which
are connected by a 100 Mbit LAN. One machine is running ApacheODE [1] to
host the Runtime Engine to execute the service program, configured with Intel
Core I5 2410M CPU with 4 GiB RAM. The other machine is to host the Runtime
Adapter, configured with Intel I7 3520M CPU with 8 GiB RAM.
We use two case studies in this paper to evaluate our approach: Travel Book-
ing Services and Large Service. Component services used in both services are
real-world services that are set up on the server.
Travel Booking Service (TBS). This is the running example that has been
used through out the paper.
Large Service (LS). To evaluate the scalability of our approach, we construct a
large service LS with sequential execution of k base activities. The base activity
is constructed by sequential execution of a synchronous invocation, followed by
a controllable conditional activity with three branches which one branch has a
better QoS, and subsequently followed by a concurrent activity. We denote the
composite service with sequential execution of k base activities as LS(k), which
would consult Adapter for adaptation for k times since there are k controllable
conditional activities.
5.2 Evaluation
We conduct three experiments E1, E2, and E3, to answer the research ques-
tion RQ1, RQ2, and RQ3, respectively. Each experiment is repeated for 10000
times, and a configuration generation E is randomly generated for each repeti-
tion. We show the experiments and their results in the following.
E1: The overhead of our approach mainly comes from two sources: the asyn-
chronous monitoring and synchronous adaptation. Given a composite service
CS, in order to measure the overhead, we first generate an execution config-
uration E = (M, Q) for an adaptive run r(CS, ADFlow, E). Adaptive run
may not select a branch according to M , since the selection of a branch could
also be decided by the Adapter, in the case where Adapter decides to con-
trol a controllable conditional structure. Therefore, after the adaptive run, we
modifies M to M , according to the actual conditional branch selected by the
Adapter. Then, using the M , we perform the non-adaptive run r(CS, ∅, E ),
where E = (M , Q). These ensure that both adaptive run and non-adaptive
run have the same execution, which allow effective measurement of the overhead
introduced by ADFlow. In this experiment, we set the conformance of each
component service to 0.8. We compare the overhead of the following:
ADFLOW Approach. Runtime adaptation using ADFlow, for which the case
studies are specified without any subscript, e.g., TBS , LS (10 ).
Results. The experiment results can be found in Fig. 4a. Note that due to the
space constraint, the result of LS (10 )S is not shown in our results. The average
running time of TAS with adaptation is 278.28 ms and the average running
time of TAS without adaptation is 271.69 ms; therefore the overhead is only
6.59 ms, 2.3 % of the running time. In contrast, the overhead for synchronous
monitoring is 179.12 ms for TAS. On the other hand, the average running time of
LS(10) is 457.65 ms and the average running time of LS(10) without adaptation
is 450.66 ms; therefore, average overhead is 6.99 ms. In contrast, the overhead
for the adaptation using synchronous monitoring is around 1100 ms. The results
show that our approach has a little overhead, and compared to the adaptation
using synchronous monitoring, our approach reduces the overhead noticeably.
Service Adaptation with Probabilistic Partial Models 137
500
TBS TBS
0.4 LS (10 )
Running Time (ms)
TBSN
Improvement
400 TBSS
LS (10 )
LS (10 )N 0.2
300
200 0
2,000 4,000 6,000 8,000 10,000 2,000 4,000 6,000 8,000 10,000
Number of Repetition Number of Repetition
LS (10 ) LS (10 )
40 LS (20 ) 0.4 LS (20 )
Overhead (ms)
Improvement
LS (30 ) LS (30 )
LS (40 ) LS (40 )
20 LS (50 ) 0.2 LS (50 )
LS (60 ) LS (60 )
LS (70 ) LS (70 )
LS (80 ) LS (80 )
0 0
2,000 4,000 6,000 8,000 10,000 LS (90 ) 2,000 4,000 6,000 8,000 10,000 LS (90 )
Number of Repetition LS (100 ) Number of Repetition LS (100 )
Results. The experiment results can be found in Fig. 4b. We notice that
although the improvement fluctuates at the beginning, ADFlow always pro-
vides an improvement, compared to no adaptation. We also notice that the
improvement provided by ADFlow starts to converge when the number of rep-
etition grows. Overall, our approach improves 0.283 over T BSN and improves
0.3 over LS(10)N . The experiment results show that our approach noticeably
improves the conformance of global constraints.
E3: We compare the overhead and improvement with respect to the size of LS ,
ranging from 10 to 100.
138 M. Chen et al.
Results. The experiment results can be found in Fig. 4c and d. In Fig. 4c, the
overhead increases with the size of LS , due to the reason that more synchronous
adaptations are required with the size of the composite service increases. Nev-
ertheless, we still have low overhead compared to the total running time, which
is around 1 %–3 %. In Fig. 4c, we observe that the improvement for each case
studies fluctuates between 0.2–0.42 at the beginning. The improvement starts
to converge when the number of repetition grows. On average, the improvement
for the case studies is between 25 %–32 %. This is consistent to our observations
in experiment E2. Together, these show our approach scales well.
6 Related Work
In [5], Cardellini et al. propose to use a set of service components to implement
the functionality of a component service adaptively. Their work focuses on adapt-
ing a single service for the purpose of decreasing response time and increasing
availability. In [17], Moser et al. propose a framework that uses non-intrusive
monitoring based on aspect-oriented programming (AOP), to detect failure ser-
vice and replace them at runtime. In [15], Irmert et al. present the CoBRA
framework to provide runtime adaptation, where the infeasible component ser-
vices are replaced at runtime. In [18], Mukhija and Glinz propose an approach to
adapt an application by recomposing its components dynamically, which imple-
mented by providing alternative component compositions for different states of
the execution environment. This work is orthogonal to our approach, they adopt
point adaptation strategy, while we adopt workflow adaptation strategy.
Our work is also related to the non-functional aspect of Web service compo-
sition. In [13], Fung et al. propose a message model tracking model to support
QoS end-to-end management. In [16], Koizumi and Koyama present a business
process performance model which integrates the Timed Petri model and sta-
tistical model to estimate process execution time. Epifani et al. [9] present the
KAMI approach to update model parameters by exploiting Bayesian estimators
on collected runtime data. These aforementioned works are concerned with the
prediction of QoS attributes, while our work focuses on runtime adaptation based
on QoS attributes. In [20], given the response time requirement of the composite
service, Tan et al. propose a technique to synthesize the local time requirement
for component services that are used to compose the service. In [6,7,19,23], we
focus on verification of combined functional and non-functional properties of the
web service composition based on QoS of each component service. In [21,22], we
propose to solve the optimal selection problem and recovery problem so that it
could satisfy the requirements. The aforementioned works are orthogonal to this
work.
7 Conclusion
In this paper, we have presented ADFlow, a novel approach for monitoring and
self-adapting the running of Web service composition to maximize its ability to
Service Adaptation with Probabilistic Partial Models 139
References
1. Apache ODE. http://ode.apache.org/
2. Microservices. http://microservices.io/patterns/microservices.html
3. Technical report. http://tianhuat.bitbucket.org/technicalReport.pdf
4. Akyildiz, I.F., Su, W., Sankarasubramaniam, Y., Cayirci, E., et al.: A survey on
sensor networks. IEEE Commun. Mag. 40(8), 102–114 (2002)
5. Cardellini, V., Casalicchio, E., Grassi, V., Iannucci, S., Presti, F.L., Mirandola, R.:
Moses: a framework for qos driven runtime adaptation of service-oriented systems.
TSE 38(5), 1138–1159 (2012)
6. Chen, M., Tan, T.H., Sun, J., Liu, Y., Dong, J.S.: VeriWS: a tool for verification of
combined functional and non-functional requirements of web service composition.
In: ICSE, pp. 564–567 (2014)
7. Chen, M., Tan, T.H., Sun, J., Liu, Y., Pang, J., Li, X.: Verification of functional and
non-functional requirements of web service composition. In: ICFEM, pp. 313–328
(2013)
8. Chinnici, R., Moreau, J.-J., Ryman, A., Weerawarana, S.: Web services description
language (WSDL) version 2.0. http://www.w3.org/TR/wsdl20/
9. Epifani, I., Ghezzi, C., Mirandola, R., Tamburrelli, G.: Model evolution by run-
time parameter adaptation. In: ICSE, pp. 111–121 (2009)
10. Ermedahl, A., Sandberg, C., Gustafsson, J., Bygde, S., Lisper, B.: Loop bound
analysis based on a combination of program slicing, abstract interpretation, and
invariant analysis. In: WCET (2007)
11. Famelis, M., Salay, R., Chechik, M.: Partial models: towards modeling and reason-
ing with uncertainty. In: ICSE, pp. 573–583 (2012)
12. Foster, H.: A rigorous approach to engineering web service compositions. Ph.D.
thesis, Citeseer (2006)
13. Fung, C.K., Hung, P.C.K., Wang, G., Linger, R.C., Walton, G.H.: A study of
service composition with QoS management. In: ICWS, pp. 717–724 (2005)
14. Gudgin, M., Hadley, M., Mendelsohn, N., Moreau, J.-J., Nielsen, H.F.,
Karmarkar, A., Lafon. Y.: Simple object access protocol (SOAP) version 1.2.
http://www.w3.org/TR/soap12/
15. Irmert, F., Fischer, T., Meyer-Wegener, K.: Runtime adaptation in a service-
oriented component model. In: SEAMS, pp. 97–104. ACM (2008)
16. Koizumi, S., Koyama, K.: Workload-aware business process simulation with sta-
tistical service analysis and timed Petri Net. In: ICWS, pp. 70–77 (2007)
17. Moser, O., Rosenberg, F., Dustdar, S.: Non-intrusive monitoring and service adap-
tation for WS-BPEL. In: WWW, pp. 815–824 (2008)
18. Mukhija, A., Glinz, M.: Runtime adaptation of applications through dynamic
recomposition of components. In: ARCS, pp. 124–138 (2005)
140 M. Chen et al.
19. Tan, T.H.: Towards verification of a service orchestration language. In: ISSRE, pp.
36–37 (2010)
20. Tan, T.H., André, É., Sun, J., Liu, Y., Dong, J.S., Chen, M.: Dynamic synthesis
of local time requirement for service composition. In: ICSE, pp. 542–551 (2013)
21. Tan, T.H., Chen, M., André, É., Sun, J., Liu, Y., Dong, J.S.: Automated runtime
recovery for QoS-based service composition. In: 23rd International World Wide
Web Conference, WWW 2014, Seoul, Republic of Korea, 7–11 April 2014, pp.
563–574 (2014)
22. Tan, T.H., Chen, M., Sun, J., Liu, Y., André, É., Xue, Y., Dong, J.S.: Optimizing
selection of competing services with probabilistic hierarchical refinement. In: ICSE,
pp. 85–95 (2016)
23. Tan, T.H., Liu, Y., Sun, J., Dong, J.S.: Verification of orchestration systems using
compositional partial order reduction. In: Qin, S., Qiu, Z. (eds.) ICFEM 2011.
LNCS, vol. 6991, pp. 98–114. Springer, Heidelberg (2011)
24. Yoon, K., Hwang, C.: Multiple Attribute Decision Making: An Introduction. Sage
Publications, Incorporated, Thousand Oaks (1995)
A Formal Approach to Identifying Security
Vulnerabilities in Telecommunication Networks
1 Introduction
Over the last few years the number of attacks on the telecom networks has
increased. The network operators observe the attempts of call and SMS inter-
ceptions, unauthorised call re-directions or alternations of billing information,
etc. By using the services provided by the standard network protocols, e.g., such
as SS7-MAP [16], the attackers can masquerade themselves as trusted network
components and exploit network vulnerabilities with malicious intent. To pre-
vent further escalation of the number of attacks, the telecom sector is looking for
novel techniques that can help systematically, in a highly automated manner,
analyse the existing network protocols, identify potential vulnerabilities, and
propose recommendations for rectifying them.
In this paper, we propose a formal approach that allows the designers to auto-
matically generate a set of potentially harmful scenarios and analyse possibilities
for their prevention. Our approach consists of four steps: a representation of the
standardised telecom operations and aggregated services in terms of input and
output data, consistency analysis of such a representation, generation of feasible
execution scenarios and identification of the harmful ones, and finally, suggesting
recommendations for hardening the system against the identified attacks.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 141–158, 2016.
DOI: 10.1007/978-3-319-47846-3 10
142 L. Laibinis et al.
became easy to get access to the network services, which has attracted not only
a variety of small service providers but also attackers. The network operators
report on increasing number of denial of service (DOS) attacks, call and SMS
interception or re-direction, illegal alternation of the user profile data, etc.
Let us consider the component interaction while executing the “Provide
roaming number” service. Figure 1 shows a (simplified) architecture of two cel-
lular networks – A and B. Assume that a subscriber – a holder of a mobile
phone – is “native” to A, i.e., his/her data are stored in Home Location Register
(HLR) of A. This data includes a mobile subscriber’s id, the user profile data
(including the subscription details and billing address), current location, etc.
Assume also that the user moves from A to B. When a base station in the B net-
work detects a new foreign id, it contacts the Gateway of Mobile Switch Centre
(MSC/Gateway) of B. In its turn, MSC/Gateway of B identifies the id origins
and sends a request to the MSC/Gateway of A. MSC/Gateway of A checks the
subscription info for the given id in HLR of A and replies to MSC/Gateway of B
with the confirmation of user validity or notification of the invalid request. In the
case of success, MSC/Gateway of B makes a request to Visitor Location Register
(MSC/VLR) of B to associate a roaming number with the given id. Once this
number is obtained, the services of B become available to the subscriber.
Since the protocol assumes the presence of trusted parties only, each request
sent by a network element with a valid id is replied either with the requested
data or an error diagnostic message. Nowadays an attacker can relatively easy
obtain a valid network element id that allows him/her to intrude the trusted
environment. Once it is done, the attacker can start to send requests to the net-
work components, collect and analyse responses, and thus accumulate sufficient
information to masquerade himself as a trusted party with the corresponding
privileges and rights. For instance, it can result in associating a random (victim)
subscriber id with the attacker’s phone and interception of sensitive data.
Even if we only focus on the SS7 Core network shown on Fig. 2, it is possible
to construct such attack scenarios. For instance, if the attacker obtains the id
(called global title) of the SMS-C (Short Message Service Center) component,
this may eventually, e.g., by subsequent requests to MSC/VLR and HLR, lead to
getting access to the user profile and changing such sensitive data as the address
144 L. Laibinis et al.
of the component responsible for customer billing. We will consider this scenario
in more detail, while presenting our formal approach in Sect. 4.
A seemingly obvious solution is to introduce an authentication for each
request. However, since a typical scenario consists of several steps, the resulting
performance deterioration will be unacceptable. Hence, to harden the protocol,
we should explore other ways to prevent an intruder from accumulating suffi-
cient knowledge for an attack. A combination of such accumulated data and the
command sequence represents a potential attack vector. To disable the execu-
tion of the identified scenario, we may try alter the associated data flow, i.e.,
to augment commands with additional inputs available only for trusted parties
or remove some (redundant) outputs. In both cases, however, we should ensure
that no valid execution scenarios are disabled as a result of such hardening.
produce the (final) output of the composite command, i.e., it orchestrates the
service execution and data flow. We introduce the function
CommSeq ∈ C → seq(C),
If a command is single, its produced data elements coincide with its outputs.
The introduced definitions of the command inputs, outputs and produced
data elements allows us to explicitly formulate the properties for consistency of
a particular data flow. We aim at ensuring that, for composite commands, there
is always a component associated with each produced output or forwarded input.
Formally, for all c ∈ C, i ∈ 1..n(c),
Inputs(c[i]) ⊆ Inputs(c) ∪ P roduced(c) ∪ (Outputs(c[j])) (1)
j∈1..i−1
Outputs(c) ⊆ P roduced(c) ∪ (Outputs(c[j])), (2)
j∈1..n(c)
provided that
∀i ∈ 1..n(S). Inputs(S[i]) ⊆ Initials ∪ (Outputs(S[j])),
1..i−1
146 L. Laibinis et al.
and
∀i ∈ 1..n(S). F inals(c) ⊆ (Outputs(c[j])),
1..n(c)
where S[i] = CommSeq(S)(i) and n(S) = size(CommSeq(S)).
We assume that we can distinguish the critical knowledge (specific combina-
tions of data type elements) that is not supposed to be leaked to an unauthorised
external user. Accessing such a knowledge in many cases would indicate scenarios
that can be used for malicious purposes by the intruder. Moreover, we assume
that all such scenarios where this knowledge is accessed safely and legally or the
scenarios that we want to exclude from consideration are known beforehand.
Let us introduce two constants –
Critical ∈ P(DataT ypes) and KnownSequences ∈ seq(C),
formalising the described notions. We also assume the presumed initial knowl-
edge given in the constant Initials ∈ P(DataT ypes).
Our goal is to identify a scenario S such that S ∈
/ KnownSequences and
Initials S Critical.
where S[c1/c1 ] denotes a sequence where c1 was substituted with the modified
command c1 . Moreover, the above data consistency conditions 1 and 2 should
be shown to hold for the modified set C[c1/c1 ]. This ensures that all the other
commands that rely on the substituted command c1 are still functional.
The proposed command modifications together with the consistency
conditions 1 and 2 define the basis for system hardening against attacks. In
Sect. 4, after a short Event-B background description given in the next section,
we demonstrate how it can be implemented within the Event-B framework.
where e is the event’s name, a is the list of local variables, Ge is the event guard,
and Re is the event action.
The guard is a state predicate that defines the conditions under which
the action can be executed, i.e., when the event is enabled. If several events
are enabled at the same time, any of them can be chosen for execution non-
deterministically. If none of the events is enabled then the system deadlocks.
The occurrence of events represents the observable behaviour of the system.
In general, the action of an event is a parallel composition of deterministic
or non-deterministic assignments. In Event-B, this assignment is semantically
defined as the next-state relation Re . A deterministic assignment, x := E(x, y),
has the standard syntax and meaning. A non-deterministic assignment is denoted
either as x :∈ S, where S is a set of values, or x :| P (x, y, x ), where P is a
predicate relating initial values of x, y to some final value of x . As a result of
such an assignment, x can get any value belonging to S or according to P .
Event-B employs a top-down refinement-based approach to system develop-
ment. A development starts from an abstract specification that nondeterministi-
cally models most essential functional requirements. In a sequence of refinement
steps, we gradually reduce nondeterminism and introduce detailed design deci-
sions. The consistency of Event-B models, i.e., verification of well-formedness,
invariant preservation as well as correctness of refinement steps, is demonstrated
by proving the relevant verification theorems – proof obligations [1].
Modelling, refinement and verification in Event-B is supported by an auto-
mated tool – Rodin platform [12]. The platform provides the designers with an
integrated modelling environment, supporting automatic generation and proving
of the proof obligations. Moreover, various Rodin extensions allow the modeller
to transform models from one representation to another. They also give access
to various verification engines (theorem provers, model checkers, SMT solvers).
For instance, the ProB extension [17] of Rodin supports automated consis-
tency checking of Event-B machines via model checking, constraint based check-
ing, and animation. ProB supports analysis of liveness properties (expressed in
linear or computational tree logic (LTL/CTL)), invariant violations as well as
the absence of deadlocks.
148 L. Laibinis et al.
In this paper, we propose a formal approach for identifying and preventing pos-
sible security attacks based on formal modelling and model checking in Event-B.
In Sect. 2.2 we discussed how we can formally reason about telecommunication
commands, their execution scenarios, the involved data and control flows, the
critical knowledge,“leakage” of which should be prevented, etc. We will show
how to capture these notions in the Event-B framework.
We start by giving a short outline of the overall approach. We propose an
iterative method consisting of four phases (see Fig. 3), discussed in detail below.
In Phase 1, we create or subsequently modify the Event-B context com-
ponent, containing the (types of) involved data elements and the definitions of
protocol commands of interest. The structure of the commands (inputs, outputs,
internally produced values, the lower layer commands) corresponds to the one
described in Sect. 2.2. The context also introduces the initial knowledge of the
attacker as well as the critical knowledge that should not be “leaked”.
In Phase 2, we rely on the created Event-B (machine) model to simulate
execution of all the defined above commands and then model check this model
in ProB looking for inconsistencies or gaps in their execution. Essentially, any
violations of the data flow consistency conditions 1 and 2 lead to deadlocking the
model, which in turn indicate such inconsistencies in the command definitions.
If such a deadlock is found, we return to the first phase for necessary modi-
fications of one or several commands. Otherwise, we proceed to Phase 3.
In Phase 3, we rely on other created Event-B (machine) model that simulates
random “intruder” attacks, trying to access the predefined critical knowledge.
Phase 1:
Phase 2:
Checking consistency of the control and
Phase 3:
Simulating of intruder attacks while
distinguishing them from legal scenarios
Phase 4:
Analysing and modifying command
attacks
4.2 Phase 1
CONTEXT CommData
SETS Commands, Data
CONSTANTS Inputs, Outputs, Produced, CommSeq, KnownSequences, Initial, Critical, ...
AXIOMS
axm1: Inputs ∈ Commands → P(Data)
axm2: Outputs ∈ Commands → P(Data)
axm3: P roduced ∈ Commands → P(Data)
axm4: CommSeq ∈ Commands → (N → Commands)
axm5: KnownSequences ∈ P(N → Commands)
axm6: Initial ∈ P(Data)
axm7: Critical ∈ P(Data) ...
END
The first command, SRI4SM, stands for a composite service “Send Routing
Info”, sent by SMS-C to MSC/Gateway. The required inputs are SMSC GT,
the global title (id) of SMS-C, and MSISD, the customer’s mobile number. The
command results are IMSI, International Mobile Subscriber Identity, as well as
HLR GT and VLR GT – global titles of the involved HLR and MSC/VLR network
components. The SRI4SM request is further decomposed to the respective lower
layer commands (subservices) to the MSC/VLR and HLR components.
The second command, UL4SM, stands for a single service “Update Location”,
sent by MSC/VLR to HLR. As a result, a snapshot of the user profile informa-
tion, UPI, is returned, including user services, forwarding settings, as well as the
billing platform address. Finally, the third command, ISD4HLR, stands for a sin-
gle service “Insert Subscriber Data”, sent by HLR to MSC/VLR. The last input
parameter, Billing GT, is a new billing platform address to update the current
one. The command result is simply a confirmation of successful update.
All three commands are internal services provided within a trusted network.
However, as we will see later, they can be combined by the attacker to access and
update sensitive information. In the remaining part of the context component
(see Fig. 6), we instantiate the abstract data structures (e.g., Commands, Data,
Inputs, Outputs, Produced, and CommSeq) for the chosen example.
axm8: Commands = {SRI4SM, SRI4M SC, SRI4V LR, SRI4HLR, U L4V LR, ISD4HLR}
axm9: Data = {SM SC GT, M SISD, M SC GT, V LR GT, V LR OK, HLR GT, IM SI,
U P I, Billing GT, ISD OK}
axm10: Inputs = {SRI4SM → {SM SC GT,M SISD}, SRI4M SC → {M SISD,M SC GT },
SRI4VLR → {V LR GT, M SISD}, SRI4HLR → {HLR GT, M SISD},
U L4V LR → {V LR GT, M SCI}, ISD4HLR → {HLR GT, U P I, Billing GT }}
axm11: Outputs = {SRI4SM → {HLR GT, V LR GT, IM SI},
SRI4M SC → {HLR GT, V LR GT, IM SI}, U L4V LR → {U P I},
SRI4VLR → {V LR OK}, SRI4HLR → {IM SI}, ISD4HLR → {ISD OK}}
axm12: P roduced = {SRI4SM → {M SC GT }, SRI4M SC → {V LR GT },
SRI4VLR → ∅, SRI4HLR → ∅, U L4V LR → ∅, ISD4HLR → ∅}
axm13: CommSeq = {SRI4SM → {1 → SRI4M SC},SRI4M SC → {1 → SRI4VLR, 2 →
SRI4HLR}, SRI4VLR → ∅, SRI4HLR → ∅, U L4V LR → ∅, ISD4HLR → ∅}
axm14: KnownSequences = ∅
axm15: Initial = {SM SC GT, M SISD} ∧ Critical = {U P I, ISD OK}
The internally produced data elements are instantiated using the following
principle: all the data that are passed to the lower layer or returned to the
higher layer can be either one of the command inputs, received outputs, or
internally produced values. In other words, to guarantee consistency of the data
flow, no data can come from nowhere. The only exception is for the lowest layer
commands, where all their outputs coincide with internally produced ones.
4.3 Phase 2
The results of Phase 1 serve as a basis for the subsequent Phases 2 and 3. Before
identification of possible intruder attacks (which will be the focus of Phase 3),
we need to check/ensure that the given (or modified) command definitions are
consistent, e.g., they do not contain loops and gaps in their execution.
To ensure such consistency, we employ the interplay of formal verification
and model checking in Event-B. We model the process of intended command
execution in general and then rely on model checking techniques (checking for
deadlocks in Phase 2 and invariant violations in Phase 3) to find inconsistencies,
incompleteness and security holes in the given concrete command definitions.
Specifically, in Phase 2 we rely on the Event-B model (machine) that
– non-deterministically picks a (still unchecked) command from the concrete
collection defined in the context component;
– simulates execution of this command. The command can be either single or
composite. In the latter case, its execution is decomposed into a sequence of
commands of the lower layer.
– maintains what is “known” at each execution layer (for the component calling
a command) and checks both data and control flow consistency;
– terminates when all the defined commands are successfully checked.
Then, for the created model, we employ model checking to find deadlocks.
The presence of such deadlocks would mean that the hierarchy of commands is
broken because some required inputs, outputs or produced data are missing.
Let us consider the Event-B model in more detail. Its overall structure is
given in Fig. 7. The model introduces five variables. The variable chosen indi-
cates whether a particular command is currently chosen for simulated execution,
while stacklevel models the current stack level of command execution. The func-
tion variables step, knows, and Sequence respectively store, for each stack level,
the current execution step, the accumulated knowledge (in terms of received or
produced data), and the sequence of the lower layer commands to be executed.
The model events specify choosing a new command (the event choose), exe-
cuting a single lowest layer command (execute single), starting execution of a
sequence of the lower layer commands (start seq), thus increasing stacklevel, and
finishing execution of a sequence of the lower layer commands (finish seq), thus
decreasing stacklevel. Finally, the event finish checks that the whole command
hierarchy has been executed and thus a new command may be chosen.
Below we present the specifications of a couple of model events. The event
execute single models execution of a single command. In that case, the knowl-
edge of the calling command is updated with the produced outputs, while the
execution step in the considered command sequence is increased.
execute single =
any curr comm where
chosen = T RU E ∧ step(stacklevel) ∈ dom(Sequence(stacklevel)) ∧
curr comm = Sequence(stacklevel)(step(stacklevel)) ∧
CommSeq(curr comm) = ∅ ∧ Inputs(curr comm) ⊆ knows(stacklevel) ∧
then
knows(stacklevel) := knows(stacklevel) ∪ Outputs(curr comm)
step(stacklevel) := step(stacklevel) + 1
end
Note that the guard Inputs(curr comm) ⊆ knows(stacklevel) serves here as a data
flow consistency condition, violation of which would lead to a model deadlock.
The event start seq models the opposite situation, i.e., when the execution
moves to the higher stack level. The affected variables knows, step, and Sequence
are updated accordingly. The dual event finish seq decreases the stack level and
updates the affected values associated with the higher level.
start seq =
any curr comm where
chosen = T RU E ∧ step(stacklevel) ∈ dom(Sequence(stacklevel)) ∧
curr comm = Sequence(stacklevel)(step(stacklevel)) ∧ CommSeq(curr comm) = ∅ ∧
Inputs(CommSeq(curr comm)(1)) ⊆ Inputs(curr comm) ∪ P roduced(curr comm)
then
knows(stacklevel + 1) := Inputs(curr comm) ∪ P roduced(curr comm)
step(stacklevel + 1) := 1 stacklevel := stacklevel + 1
Sequence(stacklevel + 1) := CommSeq(curr comm)
end
The required data flow consistency condition (for start seq) is given as the guard
Inputs(CommSeq(curr comm)(1)) ⊆ Inputs(curr comm) ∪ P roduced(curr comm).
collection of commands following the pre-defined structure (see Fig. 4), thus
disregarding concrete command instantiations for the chosen example (Fig. 6).
Model checking, on the other hand, is predominantly used to find inconsistencies
and gaps (as deadlocks) in the concrete command definitions of Fig. 6.
4.4 Phase 3
The main focus of Phase 3 is the identification of possible intruder attacks. This
phase is based on the results of the previous phases. We build a formal model
simulating different service scenarios and then rely on model checking to check
for invariant violations indicating possible intruder attacks.
The Event-B model that we rely on in Phase 3
– simulates intruder attacks trying to obtain the predefined critical data. The
attack is represented as the corresponding command sequence. This sequence
is built by starting from the critical knowledge and simulating random com-
mand execution leading to it. The building process is completed when the
presumed initial knowledge (data) of the intruder is reached;
– reverses the resulting command sequence in order to represent it in the form
convenient for further analysis (i.e., a command sequence that starts with the
initial data as an input and reaches the critical data);
– distinguishes whether the found command sequence is already known or not.
If the found sequence matches one of the predefined known sequences, the
search for intruder attack scenarios continues until all scenarios are analysed.
the Critical data as the initial value of the variable to be obtained and look
which commands can produce one or more items from it. If such a command is
found, the critical data it produces are removed from to be obtained and replaced
with the required command inputs. We repeat this process until all required data
from to be obtained belong to Initial. This condition is repeatedly re-checked and
the corresponding boolean value is assigned to the variable found.
search =
any comm, var where
found = FALSE ∧ comm ∈ dom(Inputs) ∧ comm ∈ / ran(commands) ∧
Outputs(comm) ∩ to be obtained = ∅ ∧ var = Outputs(comm) ∩ to be obtained
then
to be obtained := (to be obtained \ var) ∪ Inputs(comm) num := num + 1
commands := commands ∪ {num → comm} jj := num
f ound := bool(((to be obtained \ var) ∪ Inputs(comm)) ⊆ Initial)
end
The second step of the Phase 3 (the event reverse) is used to reverse the
obtained command sequence stored in the variable commands. Specifically, the
resulting sequence will be the command sequence that the first command inputs
uses the initial data and outputs of the last command lead to the critical data.
Finally, the event comparison specifies checking whether the obtained com-
mand sequence is known or not. The command sequence is considered as known
if it matches one of the predefined known sequences, i.e., belongs to KnownSe-
quences. The comparison outcome is stored in result.
The resulting Event-B model is model checked against invariant violations. In
particular, in Phase 3 we are interested to find possible new command sequences
leading to the critical knowledge. Therefore, we check the created Event-B model
against the property stating that the collective critical data elements can be
obtained only by the given known sequences. This property is formulated as the
following model invariant: f inished = TRUE ⇒ result = TRUE.
The result of model checking indicating a violation of this invariant is the
command sequence that leads to the critical knowledge. If such an illegal com-
mand sequence leading to critical knowledge is found, it becomes an input to
Phase 4. To try model checking techniques on our running example (see Fig. 5),
we instantiated the initial and critical data with concrete values in the Event-B
model context. Namely, we assumed that the attacker initially knows the global
title of SMS-C as well as the phone number of the user he/she wants to defraud,
A Formal Approach to Identifying Security Vulnerabilities 155
i.e., Initial = {SM SC GT, M SISD}. The successful attack would be obtaining
the access of the user profile and updating this profile with the attacker supplied
billing address, i.e., Critical = {U P I, ISD OK}.
Then we checked the Event-B model for invariant violations. For the given
values of our running example, the result of such verification was the following
command sequence: {1 → SRI4SM, 2 → U L4V LR, 3 → ISD4HLR}, indicating a
specific command chain to obtain the predefined critical data.
4.5 Phase 4
Related Work. The problem of analysis of security protocols has been studied
over several decades [2,13] in the different application domains: web services [4,
14], mobile and sensor networks [11], operating systems [5], etc. There are several
approaches proposed to model attacks and perform security evaluation for main
types of attacks [3,6,8–10]. For instance, Armando et al. [3] demonstrate how to
relate a specification of security protocols and their implementations to enable
model-based security testing. In particular, they show how to use the traces of
potential attacks found by a model checker to generate the corresponding test
suits for verifying a protocol implementation. Our approach also employs model
checking to generate possible attack scenarios. However, we also go further and
propose recommendations for rectifying the found vulnerabilities. By combining
proofs and model checking, we can verify that the proposed recommendations
are feasible and correct, i.e., they do not disable the execution of the intended
services yet prevent an execution of attack scenarios.
A cyber attack modelling and assessment of their impact are investigated in
the work by Kotenko and Chechulin [9]. The authors introduce a framework that
comprises an explicit representation of the intruder’s behaviour, generation of
attack graphs, as well as calculation of different security metrics. In our work, we
rather focus on analysing the attack possibilities that the system architecture
opens for an intruder. We assume that, e.g., by using social engineering, an
intruder can gain an access to different data about the network components. By
relying on formal modelling and verification, we construct an attack vector and
identify the ways to prevent it.
There are several works that rely on Event-B or the B method to reason
about security. For instance, the B4MSecure platform proposed in [7] introduces
facilities for graphical modelling of access control policies as UML class diagrams
and automates a translation of the graphical models into B specifications. Event-
B has been also combined with Alloy to formally verify a security model of
an operating system [5]. The authors investigate verification of integrity and
confidentiality requirements. In our approach, we address these requirements
by identifying possible ways an intruder can masquerade himself as a trusted
party and get access or even alter sensitive data. Currently, the attack scenarios
are analysed using model animation. However, we are planning to extend our
approach to support graphical representation of scenarios as sequence diagrams.
Conclusions. In this paper, we have proposed a formal approach to identify-
ing security vulnerabilities in the telecommunication protocols and defining the
recommendations for rectifying them. The approach relies on formal modelling
in Event-B that allowed us, in a unified way, to not only generate potentially
harmful scenarios but also explore various alternatives for rectifying the identi-
fied vulnerabilities. The proposed approach is iterative: it enables a systematic
analysis of all potential vulnerabilities and provides an immediate feedback on
feasibility of the proposed hardening actions.
A Formal Approach to Identifying Security Vulnerabilities 157
Event-B and the Rodin platform have offered us a suitable basis for the for-
malisation and automation of our approach. Event-B supports a separate treat-
ment of static and dynamic parts of the model. In the static part of the model
– the context – we defined the architectures of the analysed services. To verify
feasibility of the proposed recommendations, we had to modify the context only.
The dynamic part remained essentially unchanged and represented a generic
pattern of service execution under the given constraints. Such a separation of
concerns allowed us to significantly reduce the involved efforts.
The availability of the automated tool support – the Rodin platform – has
been critical for ensuring applicability of our approach. The provers have been
used to verify consistency of the architectures and the Pro-B model checker to
find attack scenarios. Moreover, model animation has facilitated analysis of the
scenarios as well as the recommendations for hardening. We believe that inte-
gration of these techniques allowed us to create a powerful support for security
analysis of complex telecommunication protocols.
The proposed approach can be also used to provide an input for standard-
isation activities, and in particular for the currently on-going evolution of the
SS7 protocol suite. As a future work, we are planning to investigate the idea of
generating test suits on the basis of the identified attack scenarios.
References
1. Abrial, J.R.: Modeling in Event-B. Cambridge University Press, Cambridge (2010)
2. Armando, A., et al.: The AVISPA tool for the automated validation of internet
security protocols and applications. In: Etessami, K., Rajamani, S.K. (eds.) CAV
2005. LNCS, vol. 3576, pp. 281–285. Springer, Heidelberg (2005). doi:10.1007/
11513988 27
3. Armando, A., Pellegrino, G., Carbone, R., Merlo, A., Balzarotti, D.: From model-
checking to automated testing of security protocols: bridging the gap. In: Brucker,
A.D., Julliand, J. (eds.) TAP 2012. LNCS, vol. 7305, pp. 3–18. Springer, Heidelberg
(2012). doi:10.1007/978-3-642-30473-6 3
4. Backes, M., Mödersheim, S., Pfitzmann, B., Viganò, L.: Symbolic and cryp-
tographic analysis of the secure WS-ReliableMessaging scenario. In: Aceto, L.,
Ingólfsdóttir, A. (eds.) FoSSaCS 2006. LNCS, vol. 3921, pp. 428–445. Springer,
Heidelberg (2006). doi:10.1007/11690634 29
5. Devyanin, P.N., Khoroshilov, A.V., Kuliamin, V.V., Petrenko, A.K.,
Shchepetkov, I.V.: Formal verification of OS security model with alloy
and event-B. In: Ait Ameur, Y., Schewe, K.-D. (eds.) ABZ 2014. LNCS,
vol. 8477, pp. 309–313. Springer, Heidelberg (2014)
6. Goldman, R.P.: A stochastic model for intrusions. In: Wespi, A., Vigna, G., Deri,
L. (eds.) RAID 2002. LNCS, vol. 2516, pp. 199–218. Springer, Heidelberg (2002).
doi:10.1007/3-540-36084-0 11
7. Idani, A., Ledru, Y.: B for modeling secure information systems. In: Butler, M.,
Conchon, S., Zaı̈di, F. (eds.) ICFEM 2015. LNCS, vol. 9407, pp. 312–318. Springer,
Heidelberg (2015). doi:10.1007/978-3-319-25423-4 20
8. Ingols, K., Chu, M., Lippmann, R., Webster, S.E., Boyer, S.W.: Modeling mod-
ern network attacks and countermeasures using attack graphs. In: 25th Annual
Computer Security Applications Conference (ACSAC), pp. 117–126. IEEE (2009)
158 L. Laibinis et al.
9. Kotenko, I., Chechulin, A.: A cyber attack modelling and impact assessment frame-
work. In: Proceedings of the 5th International Conference on Cyber Conflict.
NATO CCD COE Publications (2013)
10. Noel, S., Wang, L., Singhal, A., Jajodia, S.: Measuring security risk of networks
using attack graphs. IJNGC 1(1), 135–147 (2010)
11. Rekhis, S., Boudriga, N.: Formal reconstruction of attack scenarios in mobile ad
hoc and sensor networks. J. Wirel. Commun. Netw. 39 (2011)
12. Rodin: Event-B Platform. http://www.event-b.org/
13. Ryan, P.Y.A., Schneider, S.A.: Modelling and Analysis of Security Protocols.
Addison-Wesley-Longman, Boston (2001)
14. Salaün, G., Bordeaux, L., Schaerf, M.: Describing and reasoning on web services
using process algebra. In: Proceedings of the IEEE International Conference on
Web Services (ICWS 2004), p. 43. IEEE Computer Society (2004)
15. SS7: Signalling System No.7. http://www.informit.com/library/content.aspx?
b=Signaling System No 7&seqNum=15/
16. SS7-MAP: SS7 - Mobile Application Part. http://www.informit.com/library/
content.aspx?b=Signaling System No 7&seqNum=114/
17. The ProB Animator and Model Checker. http://www.stups.uni-duesseldorf.de/
ProB/index.php.5/
Multi-threaded On-the-Fly Model Generation
of Malware with Hash Compaction
1 Introduction
Model checking is one of the main approaches for detecting malware [10]. The
underlying idea consists of two steps including model generation and model check-
ing. Model generation phase disassembles the infected executables and extracts
the control flow graph (CFG) which contains nodes presenting all explored
instructions in targeted file and edges linking between them. After a CFG
(abstract model) is generated, the second phase is applied with popular analy-
sis techniques like model checking [2,10]. Among them, model generation phase
takes a very important task.
However, this model generation phase is not easy. The main drawback of this
phase bases on the problem of obfuscation techniques, e.g. indirect jump, Struc-
tured Exception Handling (SEH) and self-modifying code. Model generation is
implemented in many binary analysis tools, e.g. CodeSurfer/x86 [1], McVeto [18],
JakStab [9], and a commercial product, IDA Pro1 which is claimed to be one
of the most popular and powerful tools for binary code analysis. However, they
are quite limited when dealing with obfuscation techniques, e.g. indirect jumps.
In [15,16], we propose a new tool, BE-PUM which applies an on-the-fly push-
down model generation of x86 binaries based on dynamic symbolic execution.
1
http://www.datarescue.com/idabase/.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 159–174, 2016.
DOI: 10.1007/978-3-319-47846-3 11
160 N.M. Hai et al.
Contributions. Inspired by [5], this paper studies an approach for reducing the
processing time of exploring states in BE-PUM by applying the computational
power of multiple threads. Our key contributions are summarized as follows.
2 Background
2.1 On-the-Fly Pushdown Model Generation of BE-PUM
BE-PUM [15,16] (Binary Emulation for PUshdown Model generation) targets
on generating the precise CFG from binary code of malware. It applies an on-
the-fly pushdown model generation of x86 binaries based on dynamic symbolic
execution. BE-PUM traces precise control flow against obfuscation techniques.
The current version of BE-PUM supports 300 of the most frequently occurring
x86 (32bit) instructions and 450 of the most frequently occurring Win32 APIs.
2
https://www.virustotal.com/en/.
Multi-threaded On-the-Fly Model Generation of Malware 161
p, γw → p , γ w p, γw → p , αβw p, γw → p , w
inter push pop
(p, γ → p , γ ) ∈ Δ (p, γ → p , αβ) ∈ Δ (p, γ → p , ) ∈ Δ
The state of program can be represented by a pair (k, asm), Env with an
address k, an x86 instruction asm and an environment Env consisting of values
of registers R, flags F , and a memory status M (which includes the status of the
stack S) after the execution starting from the entry point. When self-modifying
code appears, which modifies the assembly code at k from asm to asm , BE-PUM
introduces a new CFG node as a pair (k, asm ). Thus, BE-PUM distinguishes
(k, asm) and (k, asm ) as different CFG nodes. This idea is also presented in
McVeto [18].
– Static Symbolic Execution (SSE) applies the static detection for next
destination candidates and the feasibility of each destination p is checked by
the satisfiability of ψ ∧ next = p .
– Dynamic Symbolic Execution (DSE) applies testing for checking the fea-
sibility with a satisfiable instance of ψ (concolic testing), which requires a
binary emulator. This process continues until ψ ∧ next = p ∧ next = p ....
becomes UNSAT for exploring next destinations p , p , ..., like in [4].
3
http://metasm.cr0.org/.
4
http://www.hopperapp.com/.
164 N.M. Hai et al.
Following the path from location 8, one can observe that at 9, there is a
system call of the API GetM oduleHandleA. Then, there is an indirect jump
at 12.
Currently, most of binary analysis tools suffer from difficulties when deal-
ing with such system API invocation and indirect jump. BE-PUM success-
fully tackles those obstacles due to its mechanism of dynamic symbolic sim-
ulation. In BE-PUM, GetM oduleHandleA at 9 is invoked with parameter 0.
BE-PUM simulates its symbolic execution using JNA5 . The return value by exe-
cuting this API is the base address of this program and stored in register eax.
In the meantime, BE-PUM also evaluates the corresponding path formula as
(start → 0 → 1 → 2 → 3 → 4 → 1 → 5 → 6 → 8 → 9 → 10 → 11 → 12) is
(ebx == 1000). To decide the next destination at 12, BE-PUM applies concolic
testing by setting the value (ebx = 1000) (as a satisfiable instance detected by
Z3 4.3), and finds a new destination 14 (13 is dead node described with dotted
line).
From 15, BE-PUM follows two paths P1 = (15 → 16 → 17 → 18 → 16 →
... → 18 → 19) and P2 = (15 → 20 → 21 → 22 → 21 → ... → 22 → 23 → 24 →
17 → 18 → 16 → 17 → ... → 18 → 19).
5
https://jna.java.net/.
Multi-threaded On-the-Fly Model Generation of Malware 165
of this approach is to apply a hash function H which maps from state vector V
to the fixed length of bit strings B. The length of B can be typically 32 or 64 bits.
V is a data structure which unambiguously represents a state. For each visited
state s stored in a list, instead of storing full state descriptor, only the hash
value H(s) is stored. Clearly, the main drawback of this method is that the hash
function can produce the same output for different inputs. It implies that the two
different state vectors can be mapped to the same value. The problem of hash
collision can be alleviated by applying multiple hash functions [17,19]. Although
this approach cannot guarantee collision-free, the probability of collision can be
kept small enough to be applied in practice.
We start this section by a running example showing how our approach can han-
dle the problems pointed out in the motivating example. It is illustrated again
by Fig. 1 but now we focus on the execution flow starting from 15, where two
possible paths are generated and to be explored by two individual threads. In
the naive design, when BE-PUM explores multiple paths, it sequentially tra-
verses one by one. In this new design, BE-PUM supports multiple threads for
exploring multiple paths at the same time, hence speeding up the process of
CFG generation.
In this multi-threaded approach, we use global list Q for keeping all explored
states of all threads and local list Li for storing all visited states in each thread Ti .
From 15, BE-PUM follows two paths P1 = (15 → 16 → 17 → 18 → 16 → ... →
18 → 19) and P2 = (15 → 20 → 21 → 22 → 21 → ... → 22 → 23 → 24 → 17 →
18 → 16 → 17 → ... → 18 → 19). Let us assume that at this time there are two
threads, T1 and T2 , which explore P1 and P2 respectively. Those threads explore
states in depth-first manner and update new visited states in their corresponding
local lists, L1 and L2 . As described in Fig. 1, when T1 explores states 16, 17 and
18, these states are stored in the local list L1 .
When a local list is full, we will update the states in the local list to the
global list. If there is a state in the local list already kept in the global list,
it means this state is already visited by another thread previously. Thus, the
corresponding thread will be terminated.
For example, we assume that after T1 explores 16, 17 and 18 and T2 explores
20, 21 and 22, their local lists are full. Then, two threads update their internal
states into the global list Q, resulting in Q keeping all of 6 those states, as
presented in Fig. 1(b). Next, T2 continues explores 23, 24, 17 and its local list L2
is full again. At this point, T2 again updates its internal states into Q and finds
out that its internal state 17 is already in Q as depicted in Fig. 1(c) (since it is
explored by T1 beforehand). Thus, T2 is terminated with no further exploration.
166 N.M. Hai et al.
Remarks. There are two remarks for the approach we just describe as follows.
First, to minimize the memory consumption of storing states in global list and
local list, we implement the hash compaction mechanism as previously discussed
in Sect. 2.2. Secondly, when applied in real program, the chance that two local
lists are updated into the global list at the same time is quite relatively small,
since each thread is basically exploring a different path in the CFG. That is why
our approach requires very little synchronization or cooperation between threads
when handling real malware samples.
Let us consider state S = (k, asm, H1 (Env), H2 (Env)) with k is location and
asm is instruction. Given H1 (Env) and H2 (Env) are hash functions which map
the environment Env denoted in Sect. 2 to 32 bit fixed size string. We use two
hash functions for minimizing the probability of hash collision as described in
Sect. 2.2.
Let T = (t1 , t2 , ..., tn ) be the set of threads participating in the exploration
of states. We denote L = (l1 , l2 , ..., ln ) as the set of local list which is stored in
each thread.
In our proposed parallel approach, the primary data structures include the
global list Q containing all explored states of all threads and local lists li storing
all visited states in each thread ti . As depicted in Fig. 2, each thread operates
in three phases. In the first phase, thread ti explores state in depth-first manner
and updates new state in local list li . When local list is full, the second phase
performs duplication detection to find duplicated states, i.e. states in li that are
represented in Q. If duplication is detected, ti is halted. If there is no state of
li stored in Q, the thread starts the third phase which moves all the states of li
into Q.
Within each phase, all threads work independently and it does not need to
synchronize or cooperate before the algorithm proceeds to the next phase. This
is the main feature of our algorithm.
This section describes three phases of our algorithm in details. Figure 3 illustrates
the partial state space where the initial state s0 is assumed to have three new
successors of s1 , s2 and s3 . These states are handled by three threads, t1 , t2 and
t3 respectively.
Phase 2: Duplication Detection. The second phase starts when local list li
of thread ti is full. It first check whether any states in li are stored in Q. Note
that two states are duplicated if the values of location k, instruction asm and two
168 N.M. Hai et al.
Phase 3: Update of the State Space. In this third phase, thread moves all
the state in local list to global list. Then, Phase 1 starts all over again. Figures 7
and 8 illustrate this phase. In Fig. 7, t1 moves s7 , s4 and s1 from l1 to Q. In
Fig. 8, t2 moves s8 , s5 and s2 from l2 to Q. Note that each thread basically
explores a different path in the CFG. Thus, the chance that their local lists are
updated into the global lists at the same time is quite relatively small. Hence,
each thread can perform its three phases independently, without concern of the
status of other threads.
4 Implementation Issues
We have implemented our approach in the new version of BE-PUM. This section
discusses the most important aspects in our implementation.
of HashSet is that it provides constant time performance for the basic opera-
tions (addition, removal). Moreover, seeking operation of HashSet requires O(1)
time. In worst case, it produces O(n) times when all elements have the same
hash value. At some points, many threads can access HashSet concurrently. For
resolving the concurrency, we declare the external synchronization using the
Collections.synchronizedSet method.
of our approach with different buffer size. Empirical results show that best result
achieves when the size of local list is 150.
5 Experiments
5.1 Experimental Setup
For evaluating our approach, we have preformed our experiments on 125 real-
world malwares collected mainly from VirusTotal8 . Their sizes mostly range from
a few to hundreds of kilobyte. All experiments are performed on 4-core machine,
Windows XP with 2.9 GHz and 8 GB memory. We have conducted our algorithm
on each malware with 1 to 4 worker threads and no multicore. Note that, in the
case of no multicore, our approach reduces to the sequential algorithm which is
implemented in the old version of BE-PUM.
In some cases, the increase is significant e.g. in analyzing malware 038a99 , the
processing time reduces approximately 59 % from 6501 (s) for no multicore to
3806 (s) for 4 cores.
However, looking at the results closely, there are some cases in which the
increase of working threads does not reduce the processing time, e.g. 040f 8. The
reason is that this malware just traces one path which is not suitable for multiple
threads. However, this case does not commonly happen in real-life malware.
6 Related Works
7 Conclusion
9
The real malware’s name is 038a994d075553b5cbc6b46ad033bf 893b3ddc889d8c713c3c
245e320c693d36. For short presentation, we use the first 5 bytes of malware’s name.
174 N.M. Hai et al.
References
1. Balakrishnan, G., Reps, T.: Analyzing memory accesses in x86 executables. In:
Duesterwald, E. (ed.) CC 2004. LNCS, vol. 2985, pp. 5–23. Springer, Heidelberg
(2004)
2. Balakrishnan, G., Reps, T., Kidd, N., Lal, A.K., Lim, J., Melski, D., Gruian,
R., Yong, S., Chen, C.-H., Teitelbaum, T.: Model checking x86 executables with
codeSurfer/x86 and WPDS++. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005.
LNCS, vol. 3576, pp. 158–163. Springer, Heidelberg (2005)
3. Bardin, S., Herrmann, P., Leroux, J., Ly, O., Tabary, R., Vincent, A.: The BINCOA
framework for binary code analysis. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV
2011. LNCS, vol. 6806, pp. 165–170. Springer, Heidelberg (2011)
4. Moser, A., et al.: Exploring multiple execution paths for malware analysis. In: SP,
pp. 231–245 (2007)
5. Evangelista, S., Kristensen, L.M., Petrucci, L.: Multi-threaded explicit state space
exploration with state reconstruction. In: Hung, D., Ogawa, M. (eds.) ATVA 2013.
LNCS, vol. 8172, pp. 208–223. Springer, Heidelberg (2013)
6. Evangelista, S., Westergaard, M., Kristensen, L.M.: The ComBack method revis-
ited: caching strategies and extension with delayed duplicate detection. In: Jensen,
K., Billington, J., Koutny, M. (eds.) Transactions on Petri Nets and Other Models
of Concurrency III. LNCS, vol. 5800, pp. 189–215. Springer, Heidelberg (2009)
7. Holzmann, G.: Design and Validation of Computer Protocols. Prentice-Hall, Upper
Saddle River (1991). International Editions
8. Holzmann, G.: An improved protocol reachability analysis technique. Softw. Pract.
Exp. 2, 137–161 (1988)
9. Kinder, J., Kravchenko, D.: Alternating control flow reconstruction. In: Kuncak,
V., Rybalchenko, A. (eds.) VMCAI 2012. LNCS, vol. 7148, pp. 267–282. Springer,
Heidelberg (2012)
10. Kinder, J., Katzenbeisser, S., Schallhart, C., Veith, H.: Detecting malicious code
by model checking. In: Julisch, K., Kruegel, C. (eds.) DIMVA 2005. LNCS, vol.
3548, pp. 174–187. Springer, Heidelberg (2005)
11. King, J.C.: Symbolic execution and program testing. CACM 19(7), 385–394 (1976)
12. Laarman, A., van de Pol, J., Weber, M.: Boosting multi-core reachability perfor-
mance with shared hash tables. In: FMCAD 2010, pp. 247–255. IEEE (2010)
13. Lakhotia, A., Kumar, E.U., Venable, M.: A method for detecting obfuscated calls
in malicious binaries. IEEE Trans. Softw. Eng. 31(11), 165–170 (2005)
14. Nanda, S., Li, W., Lam, L., Chiueh, T.: BIRD: binary interpretation using runtime
disassembly. In: 4th CGO, pp. 358–370 (2006)
15. Nguyen, M.H., Nguyen, T.B., Quan, T.T., Ogawa, M.: A hybrid approach for
control flow graph construction from binary code. In: APSEC, pp. 159–164 (2013)
16. Hai, N.M., Ogawa, M., Tho, Q.T.: Obfuscation code localization based on CFG
generation of malware. In: Garcia-Alfaro, J., et al. (eds.) FPS 2015. LNCS, vol.
9482, pp. 229–247. Springer, Heidelberg (2016). doi:10.1007/978-3-319-30303-1 14
17. Stern, U., Dill, D.L.: Improved probabilistic verification by hash compaction. In:
Camurati, P.E., Eveking, H. (eds.) CHARME 1995. LNCS, vol. 987, pp. 206–224.
Springer, Heidelberg (1995)
18. Thakur, A., Lim, J., Lal, A., Burton, A., Driscoll, E., Elder, M., Andersen, T.,
Reps, T.: Directed proof generation for machine code. In: Touili, T., Cook, B.,
Jackson, P. (eds.) CAV 2010. LNCS, vol. 6174, pp. 288–305. Springer, Heidelberg
(2010)
19. Wolper, P., Leroy, D.: Reliable hashing without collision detection. In: Courcou-
betis, C. (ed.) CAV 1993. LNCS, vol. 697, pp. 59–70. Springer, Heidelberg (1993)
CPDY: Extending the Dolev-Yao Attacker
with Physical-Layer Interactions
1 Introduction
In recent years, security of Cyber-Physical systems (CPS) has received increasing
attention by researchers from the domain of computer science, electrical engi-
neering, and control theory [20,29]. We use the term CPS to refer to systems
that consist of networked embedded systems, which are used to sense, actuate,
and control physical processes. Examples for such CPS include industrial water
treatment facilities, electrical power plants, public transportation infrastructure,
or even smart cars. All those systems have seen a rapid increase in automation
and connectivity, which threatens to increase vulnerability to malicious attacks.
Security analysis of any system relies on well-defined attacker and system
models [3,16]. While the system model provides an appropriate abstraction of the
system under attack, the attacker model ideally fully defines the possible inter-
actions between the attacker and the attacked system. In particular, the model
M. Rocchetto—The work was carried out while Marco was with iTrust at Singapore
University of Technology and Design.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 175–192, 2016.
DOI: 10.1007/978-3-319-47846-3 12
176 M. Rocchetto and N.O. Tippenhauer
will also define constraints for the attacker (e.g. finite computational resources,
no access to shared keys).
In contrast to the domain of information security, where the Dolev-Yao
attacker model [16] (DY) is widely used for protocol analysis, the state-of-the-
art for CPS security does not have a common terminology for attacker models.
Even if the topic has been broadly discussed in the CPS research community, e.g.,
in [12], only a small number of tentative works (e.g., [18,35]) have addressed that
problem. The DY model used by the information security community represents
a very strong attacker, who can access and manipulate all network traffic arbi-
trarily. One could directly translate this attacker to CPS by allowing the attacker
to intercept any communication in a real system (e.g. local fieldbus communica-
tion), or to be within physical proximity of all (unprotected) devices. However,
such an attacker would only be capable of finding attacks on the network level
of the CPS. Since the network traffic of CPS does not contain information about
all interactions possible in a CPS, it is not sufficient for comprehensive analysis.
As a result, there likely are (physical-layer) interactions between the attacker
and the system that cannot be captured by the DY paradigm.
In this paper, we investigate the application of the DY attacker model for
security analysis of CPS. We present a set of extensions to allow for a more
general attacker model for CPS, that we named CPDY (Cyber-Physical Dolev-
Yao) [24]. The CPDY attacker model allows us to consider the interaction of an
attacker on the communication network, the physical presence of attackers, and
the physical interaction with the mechatronics component of the CPS.
We summarize our contributions as follows:
2 Background
Level of Modeling Detail. Formal languages, e.g. HLPSL [36] and ASLan++
[37], permit a modeler to define not only the exchanged messages but also the
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 177
In this work, we use the term Cyber-Physical System (CPS) to refer to systems
that consist of networked embedded systems, which are used to sense, actuate,
and control physical processes. Examples for such CPS include industrial water
treatment facilities, electrical power plants, public transportation infrastructure,
or even smart cars. All those systems have seen a rapid increase in automation
and connectivity, which threatens to increase vulnerability to malicious attacks.
While details on network topology, protocols, and control differ between engi-
neering domains, the fundamental architecture is similar. We now explain that
architecture using an industrial control system (ICS).
178 M. Rocchetto and N.O. Tippenhauer
Fig. 1. (a) Example CPS architecture. (b) Use case scenario of water tank with motor-
ized valve and pump controlled by a PLC. A level meter reports to the PLC. A manual
valve is placed between tank and pump.
M1 ∈ M M1 ∈ DY M2 ∈ DY M1 ∈ DY M2 ∈ DY
Gaxiom Gpair Gcrypt
M1 ∈ DY [M1 , M2 ] ∈ DY {M1 }M2 ∈ DY
M1 ∈ DY M2 ∈ DY [M1 , M2 ] ∈ DY {|M1 |}M2 ∈ DY M2 ∈ DY
Gscrypt Apairi Ascrypt
{|M1 |}M2 ∈ DY Mi ∈ DY M1 ∈ DY
{M1 }M2 ∈ DY inv(M2 ) ∈ DY {M1 }inv(M2 ) ∈ DY M2 ∈ DY
Acrypt A−1
M1 ∈ DY M1 ∈ DY crypt
Although the classic DY model can be applied to CPS security analysis straight
away, we argue that it will not be able to detect a large set of attacks possible in
that context (i.e. those that involve physical-layer interactions). To illustrate that
argument, we now provide three example scenarios. For the sake of simplicity,
we start by presenting the intuition behind the model and the goal. Further
details on the ASLan++ prototype of these scenarios along with our results are
provided in Sect. 5 and [24].
1. A motorized inflow valve, initially open, let water flows into a tank through
a pipe
2. A tank is equipped with a sensor which checks the level of the water inside
the tank
3. The sensor communicates its reading of the level of the water inside the tank
to a PLC
180 M. Rocchetto and N.O. Tippenhauer
4. When the level of the water reaches a certain upper threshold, the PLC
communicates to the motorized inflow valve to close and to the pump to start
5. Symmetrically, when the water reaches a certain lower threshold, the PLC
communicates to the inflow valve to open and to the pump to stop
6. A manual valve (placed between the tank and the pump) can be manually
opened/closed, e.g., to prevent the water to flow into the rest of the testbed
in case the water in the tank is contaminated or the pump broken
7. A central SCADA control that communicates with the PLC over the network
In the following, we assume that the attacker’s goal is to cause a water spillage
(or burst) in the tank component. The abstract messages exchanged over the
network are quite simple (see Fig. 3a). The valve controls the inflow of the water
to the tank. The sensor of the tank reports the current fill state to the PLC as
analog signals. The PLC converts the analog signals into digital messages (value
in the picture) that it sends to the SCADA. If the water level in the tank has
crossed certain high/low thresholds, the SCADA sends a close/open message to
the inflow valve and on/off to the pump. We note that in this setting, there is no
distinction between the tank and the sensor. Nothing prevents us in considering
them as two separate entities, but this would complicate the model without
benefit in terms of attacks.
We analyzed the ASLan++ model using the AVANTSSAR platform, and
found a simple attack (as expected). In that attack, the attacker drops the
messages from the PLC to the SCADA. As result, the tank will overflow and the
attacker will achieve his goal. Even if the attack is simple, it shows that one can
easily use state-of-the-art verification tools and the standard DY attacker model
to search for attacks on a CPS model. This basic example demonstrates that it is
possible to reason on similar scenarios without considering the (fluid) mechanics
of the process under attack. In particular, even in such a simple example the
equations describing the flow of the water are far from trivial and are usually
considered when reasoning on similar scenarios. In the remainder of this section,
we consider a modification of this scenario in which the network-only DY attacker
model cannot find the attack.
Fig. 3. (a) Physical interaction (dashed line) and digital interaction (solid line) between
components in the first example. (b) Example interactions, with direct (out-of-band)
communication between PLC, sensor, and actuator.
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 181
The previous examples demonstrates that the DY attacker model can be used to
reason on network-related security aspects of CPS. We now consider a scenario
in which the agents also interact through physical-layer interactions. In particu-
lar, in real-world CPS the communication between PLCs, sensors and actuators
usually uses analog signals. When a distributed control scheme is used, the logic
of the system is usually integrated directly into the PLC, instead of relying on
the SCADA component. In addition, components can interact though the phys-
ical layer directly (e.g. by exchanging water from a pipe into a tank). To reflect
such a setting, we modify the system in the previous example as follows: the
inflow valve and the pump are now directly controlled by the PLC based on
analog signals from the sensor. In other words, the valve and the pump operate
without interrogating the SCADA. As a result, the messages on the network and
SCADA are not directly involved in the operations of the valve and the pump.
We can consider the setting as one in which there is just one entity whose inter-
nal behavior encapsulate the behaviors of the valves, sensor, tank, pump and
PLC (see Fig. 3b). Since there is no communication over the network related to
the opening/closing of the valve or to the level of the water, there is no way
for the DY attacker model to achieve the goal, i.e., overflowing the tank. We
confirmed this intuition with a related model in ASLan++ and evaluation in
the AVANTSSAR platform. No successful attack is found.
Nevertheless, it could be expected that attacks by a physically present
attacker are possible in the given setting, in particular if a physically present
attacker can manually open or close the valves. Our ASLan++ model does not
find such an attack because potential malicious physical-layer interactions with
the system have not been considered.
We claim that, (so far) the related work generally models the operation of a CPS
as a set of messages exchanged between entities over a network (see Sect. 6). For
that reason, we consider prior work as limited modification of the DY attacker
model. However, consideration of the physical actions is often crucial to find
real-world attacks on CPS (e.g. attacks such as Stuxnet [38]). For that reason,
we propose an extension of the DY attacker model with new physical interac-
tion rules to support reasoning on the physical-layer security of CPS. We will
introduce those rules in Sect. 4. Before that, we briefly discuss two aspects of our
proposed approach in more detail: abstraction of physical process behavior, and
whether verification tools or model checkers are better suited.
Abstraction of Physical Processes. In our proposed approach, physical layer
interactions will be modeled as abstract interactions between components. In
particular, we do not model all the details of the behavior of an agent for CPS.
We believe that it will be very challenging for a security verification tool (or a
model checker in general) to consider all details of the behavior of an agent for
182 M. Rocchetto and N.O. Tippenhauer
CPS. For example, differential equations that model the behavior of an ultra-
filtration process will be difficult to consider by the DY model or verification
tool.
In this work, we abstract away all these details, similar to the way that
perfect cryptography is used for security protocols analysis where we abstract
from cryptographic primitives (see [15] for more details). In security protocols,
that abstraction is justified by the observation that most of the attacks rely
on the logical aspects of the protocol. Encryption schemes are treated as black
box and the attacker cannot learn any useful information from an encrypted
message without the proper decryption key. As such, a generic predicate over a
term defines the encryption as {M1 }M2 in Sect. 2. In CPS, we assume that all
the physical processes can be abstractly represented.
Verification Tools vs. Model Checkers. In particular, we propose to use a
DY verification tool, and not a general model checker. Our argument for that is
the following: in order to model a CPS to formally validate it against an attacker
model, CPS (or subparts) are often modeled with languages supported by tools
which do not implement the DY attacker model, e.g. NuSMV, SPIN [14]. How-
ever, it has been shown [7] that an ad-hoc implementation of the DY is more
advanced in terms of efficiency and coverage than using a “general purpose”
model checker with the DY model-hard coded in the specification. That is par-
ticularly evident when considering the numerous amount of verification tools
developed specifically to reason on the security aspects of various systems, e.g.,
[4,8,9,17,32].
New Rules for the System. The new rules for our system model aim to cap-
ture the diverse physical-layer interactions between components in the system
under attack. The interactions are usually constrained by the laws of physics,
which will never be violated. A very exhaustive coverage of all kinds of physical
layer interactions and laws of physics would potentially result into a large set
of additional rules (potentially automatically extracted from a system specifi-
cation, e.g., [28]). In the following, we will consider only few additional rules
to model specific interactions. In Fig. 4, we present rules that represent laws
of physics related to our example (Fig. 1b). With a slightly abuse of notation,
each rule represents a modification of the system status Sys from preconditions
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 183
(top) to postconditions (bottom). Sys is a set collecting all the physical prop-
erties of the systems (e.g., water level, temperature, pressure) for each compo-
nent in the system (e.g., tank). The properties are expressed with the predicate
C (property, value) (C(·) as short form of Component(·)). In Fig. 4, raise1 (Tank )
and raise2 (Tank ) relates a system configuration with its physical effects, i.e.,
the increase of the water level in the tank. damaged (C ) expresses the effect of
the burst of the tank, and close(C ) and open(C ) defines the effect of physical
interactions with a component (e.g., a valve) which can be manually operated
to change its status.
Rules for DY Attacker. The new rules for our attacker model aim to cap-
ture the diverse physical-layer interactions between the attacker and the system
(see Fig. 5). Similar to the system specification rules, the interactions between
attacker and system are usually constrained by the laws of physics—even a strong
attacker would not be able to create or consume arbitrary amounts of energy,
move at infinite speed, or similar.
5 Case Studies
In this section, we first show that a DY verification tool can be used to check
security goals in CPS models. We have used the ASLan++ specification lan-
guage [37] to define our examples which are based on a process of the SWaT
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 185
testbed [19] depicted in Fig. 6 (see Fig. 3a for the message sequence chart). We
start by providing more details on the example summarized in Sect. 3. In particu-
lar, we present a network-only modeling of the CPS and potential attacks, which
shows that the DY model can be used to find attacks similar to ones discussed
in related work (e.g., man-in-the-middle attacks in [2,33]). For that analysis,
we abstract away the implementation details of the CPS and detect the same
(network related) security flaw of most of the approaches we have found in the
literature. We then modify the specification (as depicted in Fig. 3b) to show
that when some physical operations (which are the at very core of a CPS) are
involved in the process, the standard DY attacker model might not be able to
find all attacks. To mitigate this, we modify the DY model to let him physically
interact with the system under certain constraints. This allows the attacker to
detect new attacks which involves physical interaction with the system. We show
that almost all the attacks which relay on attackers’ physical actions cannot be
found. We propose a first investigation on how to extend the DY model in order
to capture both cyber and physical attacks. Our results, along with timing, are
summarized in Table 1.
– The status of the system (e.g., the level of water and measurements of sensors)
– The behavior of each entity (i.e., tank, valves, pump, PLC and SCADA)
– The communication between various entities (analog and network channels)
In this example, the PLC converts the analog signals to digital messages and
sends them to the SCADA control. To be coherent with the example, we model
an analog channel (e.g., by using a database) between the inflow valve, the
tank, the pump, and the PLC. The PLC then translates and communicates
the tank/valve/pump status over a network channel with the SCADA. For the
sake of readability, we assume the PLC automatically converts and sends the
tank/valve/pump status. As a result, the valve, the tank, and the pump directly
communicate with the SCADA over a network channel. The full implementation
is reported in [24].
System Status. CPS can be seen as communicating over two channels: one is
the network channel (maybe itself divided into several layers or regions) and the
other is the physical flow of the events, e.g., electricity in power grids or water
in water treatment or distribution CPS. We believe that an understanding on
how to model the physical flow of a CPS, integration of that with the network
(in such a way that an attacker model can concretely find new attacks) is still
not well defined in the literature.
In this work, the status of the system is defined by a database systemStatus,
shared between all the entities (but hidden to the DY attacker). The database
is defined as a set of pairs (agent, status) that keeps track of the status of all
entities of the specification.
Manual Valve. The behavior of the manual valve is the same as the inflow valve.
The only difference is that the manual valve can only be manually operated (e.g.,
to change its status from open to close), i.e., cannot be operated using network
messages.
Tank. In the real testbed the PLC interrogates the sensor of the tank in order to
obtain the level of the water inside the tank. For simplicity, we do not distinguish
between the tank as a container and its sensors. We also assume that the sensor
sends the sensed data of the level of the water whenever the level is above or
below a certain threshold. We can obviously consider the more complicated and
realistic tank specification containing a sensor that waits for the PLC to inter-
rogate it. This complicates the analysis but the performance of the validation
phase does not change order of magnitude (there is a variation of some millisec-
onds) and the result of the analysis remains the same. We recall that messages
are directly sent to the SCADA instead of PLC for readability.
The tank model checks for two, mutually exclusive, status of the tank.
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 187
– If the level of the water has reached an upper threshold overT , the inflow valve
is closed, the pump is on, and the manual valve is open, the systemStatus data-
base is updated as if the water level had lowered to a lower threshold underT .
After the status update, the tank communicates its new status underT to the
SCADA.
– Symmetrically, if the level of the water has reached a threshold underT , the
inflow valve is open, and either the manual valve is closed or the pump is off,
the systemStatus database is updated as if the water level had reached the
upper threshold overT .
SCADA. As for the valve entity, we have defined the behavior of the SCADA
waiting for incoming messages from the tank entity. When the tank communi-
cates to the SCADA that the water has reached the upper threshold overT , the
SCADA closes the inflow valve and turns on the pump. Symmetrically, when the
tank reaches the lower threshold, the SCADA opens the inflow valve and turns
off the pump.
Initial Status of the System. The initial status of the specification is defined
with the tank empty (i.e., the level of the water is underT in the systemStatus
database), the inflow and the manual valve are open, and the pump is off.
Goal. The goal is to overflow the tank and in ASLan++ we can define our goal
as the following LTL (Linear Temporal Logic) formula.
(inflowValve(status, open) ∈ Sys ⇒
manualValve(status, open) ∈ Sys ∧ (tank (status, underT ) ∈ Sys ∨ pump(status, on) ∈ Sys))
In the formula, we define that whenever the inflow valve is open, i.e. the
systemStatus database contains valve(status, open), then the manual valve is
open, and either the tank must be empty or the pump turned on. In other words,
if we find a configuration of the system such that the inflow valve is opened, the
tank is full of water, and the pump is off, then the tank is overflowing. The
at the beginning of the goal states that the goal must hold in every state of the
system (i.e., LTL global operator).
Security Analysis. The AVANTSSAR platform finds a violation of the goal (i.e.,
a states where the goal does not hold). The goal is violated because there is a
state of the system in which the tank has reached the overT but the valve is
still open and the pump is switched off. In order to achieve the goal, an attacker
have to drop the packet, communicating the overT status, sent from the tank
to the SCADA.
automatically close the inflow valve when the level of the water inside the tank
reaches the threshold level overT . The DY attacker cannot spoof or eavesdrop
the communication between entities anymore since there is no more network
communication with the SCADA.
Security Analysis. Against the DY model, the AVANTSSAR platform does not
report any attack on the specification with respect to the goal defined in Sect. 5.1.
This result is straightforward since the attacker does not receives any message
and there is no interactions over network between various entities.
As we are considering a CPS, an attacker who could have physical access to
the system could most likely find a number of ways to overflow the tank. Being in
close proximity of the CPS could give to the attacker an advantage with respect
to a cyber-attacker who can only access the system through the network. For
example, an attacker could manually operates the valves to increase the level of
the water in the tank and burst the tank. In this perspective, it is fair to assume
that there are some attacker properties, e.g., distance, that can be exploited by
an attacker to perform some actions (or even attacks) that leads to some physical
consequences in the CPS. As a simple motivating example, the following rule has
been added to the specification (as a Horn clause as discussed in Sect. 5).
DYProp(distance, physical access) ∧ C (status, open) ∈ Sys ∧ C (operate, manual) ∈ Sys
C (status, close) ∈ Sys
The clause states that whenever the attacker has physical access to the CPS,
he can close any valve which can be manually operated. We also modeled the
opening of a valve.
When we run the AVANTSSAR platform searching for a state of the system
in which the level of the water in the tank has reached the upper threshold overT
(defined as a goal), we (unsurprisingly) find an attack. To perform the attack,
the attacker manually opens the inflow valve and closes the manual valve.
Fig. 7. Rules that represent physical laws in use case of Sect. 5.3
Goal. We check if the attacker can burst the tank, increasing the pressure of the
tank.
(Tank (pressure, overT ) ∈ Sys)
6 Related Work
The formal verification of security properties of CPS is a non trivial task, as CPS
introduce physical properties to the system under analysis. SAT/SMT solvers
used by security analysis tools (e.g.,[3]) do not support such properties. In order
to overcome this limitation, one could simulate the process (e.g., [2]) or adapt the
level of abstraction of CPS components. In [35], the author presents a formal
definition of an attacker model for CPS. The attacker is defined as a set of
pairs representing locations and capabilities. Capabilities are defined as a set
of tuples expressing actions, cost (energy/time) and range (with respect to the
topology) of the attacker. The attacker is assumed to perform two types of
attacks: physical, against a device and cyber against the communications; where
the first requires physical access while the second proximity to the node. The
actions of the attacker are WSN actions (remove, read/write, reveal, reprogram,
starve) and cyber actions (block, eavesdrop, inject).
In [6,26], the authors present a formalization to reason on security properties
of wireless networks (including a considerations of physical properties related
to those networks). The authors present an attacker model as a variation of
the DY attacker model. The attacker is a malicious agent of the network who
cannot break cryptography. He has a fixed location, while the usual DY controls
the entire network, a set of transmitters and receivers, an initial knowledge
with his private/public keys which can use to create and analyze messages. The
authors also consider constraints on the distance of communicating parties. An
attacker can only intercept messages at his location and colluding attackers do
not instantaneously exchange knowledge, they are constrained by the network
topology.
190 M. Rocchetto and N.O. Tippenhauer
References
1. Adepu, S., Mathur, A.: An investigation into the response of a water treatment
system into cyber attacks. In: IEEE Symposium on High Assurance Systems Engi-
neering (HASE) (2015)
2. Antonioli, D., Tippenhauer, N.O., MiniCPS: a toolkit for security research on
CPS networks. In: Proceedings of Workshop on Cyber-Physical Systems Security
& Privay (SPC-CPS), co-located with CCS, October 2015
3. Armando, A., et al.: The AVANTSSAR platform for the automated validation of
trust and security of service-oriented architectures. In: Flanagan, C., König, B.
(eds.) TACAS 2012. LNCS, vol. 7214, pp. 267–282. Springer, Heidelberg (2012)
4. Armando, A., Compagna, L.: SATMC: a SAT-based model checker for security
protocols. In: Alferes, J.J., Leite, J. (eds.) JELIA 2004. LNCS (LNAI), vol. 3229,
pp. 730–733. Springer, Heidelberg (2004)
5. AVANTSSAR. Deliverable 5.3: AVANTSSAR Library of validated problem cases
(2010). www.avantssar.eu
6. Basin, D., Capkun, S., Schaller, P., Schmidt, B.: Formal reasoning about physical
properties of security protocols. Trans. Inf. Syst. Secur. (TISSEC) 14(2), 16 (2011)
7. Basin, D., Cremers, C., Meadows, C.: Model checking security protocols. In: Hand-
book of Model Checking (2011)
8. Basin, D., Mödersheim, S., Viganò, L.: OFMC: a symbolic model checker for secu-
rity protocols. J. Inf. Secur. 4(3), 181–208 (2005)
9. Blanchet, B.: An efficient cryptographic protocol verifier based on prolog rules. In:
Computer Security Foundation Workshop (CSFW). IEEE (2001)
CPDY: Extending the Dolev-Yao Attacker with Physical-Layer Interactions 191
10. Buchler, M., Hossen, K., Mihancea, P., Minea, M., Groz, R., Oriat, C.: Model infer-
ence and security testing in the spacios project. In: IEEE Conference on Software
Maintenance, Reengineering and Reverse Engineering (CSMR-WCRE) (2014)
11. Camenisch, J., Mödersheim, S., Sommer, D.: A formal model of identity mixer.
In: Kowalewski, S., Roveri, M. (eds.) FMICS 2010. LNCS, vol. 6371, pp. 198–214.
Springer, Heidelberg (2010)
12. Cárdenas, A.A., Amin, S.M., Sinopoli, B., Giani, A., Perrig, A., Sastry, S.S.: Chal-
lenges for securing cyber physical systems. In: Workshop on Future Directions in
Cyber-physical Systems Security. DHS, July 2009
13. Cárdenas, A.A., Roosta, T., Sastry, S.: Rethinking security properties, threat mod-
els, and the design space in sensor networks: a case study in scada systems. Ad
Hoc Netw. 7(8), 1434–1447 (2009)
14. Choi, Y.: From NuSMV to SPIN: experiences with model checking flight guidance
systems. Formal Methods Syst. Des. 30(3), 199–216 (2007)
15. Cortier, V., Delaune, S., Lafourcade, P.: A survey of algebraic properties used in
cryptographic protocols. J. Comput. Secur. 14(1), 1–43 (2006)
16. Dolev, D., Yao, A.C.: On the security of public key protocols. IEEE Trans. Inf.
Theor. 29(2), 198–207 (1983)
17. Escobar, S., Meadows, C., Meseguer, J.: Maude-NPA: cryptographic protocol
analysis modulo equational properties. In: Aldini, A., Barthe, G., Gorrieri, R. (eds.)
FOSAD 2009. LNCS, vol. 5705, pp. 1–50. Springer, Heidelberg (2009)
18. LeMay, E., Ford, M.D., Keefe, K., Sanders, W.H., Muehrcke, C.: Model-based secu-
rity metrics using adversary view security evaluation (ADVISE). In: Proceedings
of Conference on Quantitative Evaluation of Systems, QEST (2011)
19. Mathur, A., Tippenhauer, N.O.: A water treatment testbed for research and train-
ing on ICS security. In: Proceedings of Workshop on Cyber-Physical Systems for
Smart Water Networks (CySWater), April 2016
20. Mo, Y., Kim, T.-H., Brancik, K., Dickinson, D., Lee, H., Perrig, A., Sinopoli, B.:
Cyber-physical security of a smart grid infrastructure. Proc. IEEE 100(1), 195–209
(2012)
21. Morris, T., Srivastava, A., Reaves, B., Gao, W., Pavurapu, K., Reddi, R.: A con-
trol system testbed to validate critical infrastructure protection concepts. J. Crit.
Infrastruct. Prot. 4(2), 88–103 (2011)
22. Reaves, B., Morris, T.: An open virtual testbed for industrial control system secu-
rity research. J. Inf. Secur. 11(4), 215–229 (2012)
23. Rocchetto, M., Ochoa, M., Torabi Dashti, M.: Model-based detection of CSRF.
In: Cuppens-Boulahia, N., Cuppens, F., Jajodia, S., Abou El Kalam, A., Sans, T.
(eds.) SEC 2014. IFIP AICT, vol. 428, pp. 30–43. Springer, Heidelberg (2014)
24. Rocchetto, M., Tippenhauer, N.O.: CPDY (Cyber-Physical Dolev-Yao) (2016).
http://research.scy-phy.net/cpdy/
25. Rocchetto, M., Viganò, L., Volpe, M., Vedove, G.D.: Using interpolation for the
verification of security protocols. In: Accorsi, R., Ranise, S. (eds.) STM 2013.
LNCS, vol. 8203, pp. 99–114. Springer, Heidelberg (2013)
26. Schaller, P., Schmidt, B., Basin, D.A., Capkun, S.: Modeling and verifying phys-
ical properties of security protocols for wireless networks. In: Computer Security
Foundations Symposium (CSF), pp. 109–123 (2009)
27. Schmidt, B., Sasse, R., Cremers, C., Basin, D.A.: Automated verification of group
key agreement protocols. In: Symposium on Security and Privacy (S&P), pp. 179–
194 (2014)
28. Schmidt, M., Lipson, H.: Distilling free-form natural laws from experimental data.
Science 324(5923), 81–85 (2009)
192 M. Rocchetto and N.O. Tippenhauer
1 Introduction
Big Data is a prominent area, involving both academia and industry, researching
innovative solutions to support the entire life-cycle (from design to deployment)
of so-called data-intensive applications (DIAs), which are able to process huge
amounts of information. Hence, defining frameworks for the development of DIAs
that leverage Big Data technologies is nowadays of major importance.
The DICE project [9] defines techniques and tools for the data-aware quality-
driven development of DIAs. In the DICE approach, designers model DIAs
through UML diagrams tagged with suitable annotations capturing the features
of Big Data applications, and in particular their topology. A topology provides
an abstract representation of a DIA through directed graphs, where nodes are
of two kinds: computational nodes implement the logic of the application by
elaborating information and producing an outcome, whereas input nodes bring
information into the application from the environment.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 193–209, 2016.
DOI: 10.1007/978-3-319-47846-3 13
194 F. Marconi et al.
2 Related Works
Formal verification of distributed systems has been the focus of several decades
of software engineering research. Challenging tasks in this context are: (i) find-
ing the right abstraction for the formal model of the real world (formalization);
(ii) developing techniques to prove the correctness of the modeled systems (veri-
fication); and (iii) bridging the gap between formalization and verification, since
Towards the Formal Verification of DIAs Through Metric Temporal Logic 195
the formal model is often too complex to be tackled by the verification methods.
Various approaches exist for the formalization of distributed systems; however,
to the best of our knowledge none focuses on Storm-like streaming technologies.
Timed counter networks, the novel model of Storm topologies introduced in
this paper, are inspired from vector addition systems with states (VASS) [14]
and Timed Petri Nets [13]. VASS are a subclass of counter systems; that is,
they are finite-state automata augmented with counters, whose values are non-
negative integers, and which can be incremented and decremented. VASS are
also equivalent to Petri nets for decision problems such as boundedness, covering
and reachability [15]. Since distributed systems have unreliable communication,
timed counter networks are also similar to lossy VASS [8], an abstraction of
FIFO-channel systems, when only the number of messages is relevant, but not
their ordering. Unlike (lossy) VASS, timed counter networks can express timing
constraints along system executions through the notion of clocks.
Timed counter networks are inherently non-deterministic, and their behavior
is effectively captured through formalisms such as the counter-augmented CLT-
Loc. At first glance they also seem expressible in terms of formalisms such as
Timed Petri Nets (TPN) [13]. However, CLTLoc is more suitable to this end
because, typically, TPN-based models adopt, both in theory and in practice, an
urgent semantics for the firing of transitions [4], where an enabled transition
must fire when it reaches its upper time bound if it is not disabled earlier. This
makes modeling the possible occurrence of events in timed counter networks (e.g.,
failures in Storm topologies) less natural. Moreover, the typical semantics of the
firings of transitions in TPNs does not allow for the modeling of a policy such
as the following: dequeuing always removes the maximum number of available
elements in the queue, but never more than k elements at the same time. The
model in Sect. 5, instead, makes use of this abstraction to represent the behavior
of a node when it extracts new elements from its queue to process them.
Concerning formal verification issues, the reachability problem is decidable
for lossy unbounded FIFO-channel models [3,12] which implies the decidability
of the verification problem of safety properties for lossy VASS. To the best of
our knowledge, lossy VASS have been investigated only from a theoretical point
of view, and no verification tools handling them currently exist.
from external systems such as queuing brokers (e.g., Kafka, RabbitMQ, Kestrel)
or from other data sources, e.g., Twitter Streaming APIs. Bolts apply transfor-
mations over the incoming data streams and generate new output streams to be
processed by the connected bolts. When a topology component generates new
data into an output stream, it is said to emit tuples. Connections are defined at
design time by the subscription of the bolts to other spouts or bolts. Figure 1
shows an example of Storm topology that will be used in Sect. 6.
Spouts can be reliable or unreliable. The former keep track of all the tuples
they emit, and if one of them fails to be processed by the entire topology within a
certain timeout, then the spout re-emits it into the topology. The latter, instead,
always emit each tuple only once, without checking for successful processing.
Single bolts usually perform simple operations, such as filtering, join, functions,
database interaction, which are combined in the topology to apply more complex
transformations. IRichBolt and IRichSpout are the main Java interfaces to use
for implementing the components of a topology. execute() is the method of
IRichBolt defining the functionality of bolts; it reads the input tuples, processes
the data, and emits (via the emit() method) the transformed tuples on the
output streams. When the spouts are reliable, bolts have to acknowledge the
successful or failed processing of each tuple at the end of the execution.
The Storm runtime is designed to leverage the computational power of dis-
tributed clusters. At a high level, its architecture is composed of one master node,
and several worker nodes. One or more worker processes can be instantiated on
a worker node, each of them executing different parts of the same topology.
Each worker process runs a JVM where one or more executors (i.e. threads) are
spawned. Executors can run one or more tasks which, in turn, can execute a
spout or a bolt. The configuration of the topology defines the number of worker
processes and, for each component (spout or bolt), the number of executors run-
ning it in parallel (the value of parallelism in Fig. 1) and the total number of
tasks over those executors. Since each executor corresponds to a single thread,
multiple tasks run serially on the same executor. However, each executor usually
runs exactly one task (default option). Intra-worker and inter-worker commu-
nications are managed through queues. Each executor has its own input queue
and output queue. Tuples are read from the input queue and processed by the
thread handling the spout/bolt logic; they are emitted on the outgoing queue
and then are moved to the parent worker’s transfer queue by a send thread.
Towards the Formal Verification of DIAs Through Metric Temporal Logic 197
φ := p | x ∼ c | θ | φ ∧ φ | ¬φ | Xφ | Yφ | φUφ | φSφ
the underlying assignment v is such that v(αj ) = σ(i + |αj |, t(αj )):
y
y
– Deployment details, such as the number of worker nodes and the features of
the (possibly) underlying cluster are abstracted away; topologies are assumed
to run on a single worker process and each executor runs a single task, which
is the default configuration of the runtime, as described at the end of Sect. 3.
– Each bolt has a single receive queue for all its parallel instances and no sending
queue, while the workers’ queues are not represented, since we assume to be
in a single-worker scenario. For generality, all queues have unbounded size.
– We do not detail the contents of tuples, but only their quantities, since we
measure the size of queues by the number of tuples they contain.
– The external sources of information from which spouts pull data are not explic-
itly represented, since they are outside of the perimeter of the application.
Then, spouts are sources of tuples, so their queues are not represented.
– For each component, the duration of each operation or the permanence in a
given state has a minimum and a maximum time.
A Storm
topology is a directed graph G = {N, Sub} where the set of nodes
N = S B includes in the sets of spouts (S) and bolts (B), and Sub ⊂ B × N
captures the subscription relation defining how the nodes are connected to one
another. If it holds that (i, j) ∈ Sub, this indicates that “bolt i subscribes to the
streams emitted by spout/bolt j”.
The behavior of both spouts and bolts can be illustrated by means of finite
state automata (see Fig. 3). Spouts can be either emitting tuples or idle, therefore
the corresponding automaton only has two states, idle and emit. Different emit
actions (whose occurrence is captured by the system being in the emit state)
can happen consecutively; also, the spout can be in the idle state for consecutive
time instants. The possible execution sequences are determined by the timing
constraints, as discussed in detail later. A bolt can alternatively be processing
tuples, idle or in a failure state. The process macro-state is composed of three
states, namely take, execute and emit. If a bolt is idle and its queue is not empty,
it eventually reads tuples from the queue, performing an instantaneous take
action, that is captured by the take state of the related finite state automaton.
Immediately after a take, each bolt starts processing the tuples, an operation
which lasts α time units, with α a parameter of the bolt, a positive real value
which represents the amount of time that a bolt requires to process one tuple.
This corresponds to the state execute in the automaton. Once the execution is
completed, the bolt emits output tuples. This instantaneous action corresponds
to the emit state. Bolts may fail and failures may occur at any moment; upon
process
idle emit
idle fail
(a) (b)
Fig. 3. Finite state automata describing the states of spout (a) and bolt (b).
202 F. Marconi et al.
a bolt failure, the system goes to the fail state and all tuples stored, at that
moment, in the queue of the failed bolt are lost, or replayed in case of a reliable
topology. If no failure occurs, after an emit a bolt goes to idle, where it stays
until it reads new tuples. Spout failures are not modeled; their effect is irrelevant
for the growth analysis of bolt queues as they would reduce the workload on
the topology. Hence, our approach focuses only on the analysis of topologies
processing a full workload, i.e., where spouts never fail.
We model the behavior of Storm topologies through a set of formulae of
CLTLoc with counters. We refer to this logic-based model as timed counter
network. We break this model down in four parts: (i) the evolution of the state
of the nodes; (ii) the behavior of the counters (i.e., the queues); (iii) timing
constraints; (iv) failures. We present here only some highlights of the model,
whose full version can be found in [5].
State Evolution. Each state is described through a combination of propo-
sitional variables. For example, a bolt j is in the macro-state process when
processj holds. In addition, it is in take (resp. emit) state when takej (resp.,
emitj ) holds. The execute state, instead, corresponds to the configuration where
processj is true while both takej and emitj are false. Formula (2) defines the
conditions for processj to hold.
processj S (takej ∨ (orig ∧ processj )) ∧
processj ⇒ (2)
processj U (emitj ∨ failj ) ∧ ¬failj
j∈B
The number of tuples extracted from the queue depends on the parallelism level
of the bolt (i.e., the number of parallel executors as described in Sect. 3), that
is represented in the model by the value of r̂takej . When a take occurs, if the
number of elements in the queue plus the ones being added in the current time
instant is greater than r̂takej , the variable representing the number of tuples that
will be processed (rprocessj ) is equal to r̂takej , otherwise it is equal to qj + raddj
Towards the Formal Verification of DIAs Through Metric Temporal Logic 203
(i.e., the bolt takes all elements from the queue). This captures how each bolt
is able to concurrently process a number of tuples that is at most equal to the
number of its executors.
The number of tuples emitted by the bolt j (remitj ) at the end of the processing
phase depends on parameter σj (a constant in R), representing the ratio between
output and input tuples. That is, given nin input tuples, the total number of
output tuples is equal to σ · nin . The value of σ is either measured by monitoring
a deployed application, or defined by making assumptions based on the kind
of operation performed by the bolt. Since remitj ∈ N, simply imposing remitj =
σ · rprocessj (resp., remitj = σ · rprocessj ) may lead to excessive under- (resp.,
over-) approximation, especially when 0 ≤ σ · rprocess 1. For this reason we
keep track of the number of tuples processed, but not leading to the emission of
output tuples. This is achieved through the auxiliary variable bufferj , which is
incremented as new tuples are correctly processed by the bolt. As formalized in
Formula (7), when an emit occurs on bolt j, remitj is equal to σ · bufferj , and
remitj
bufferj is then decremented by σ . Conversely, Formula (8) defines that
when the bolt is not emitting, buffer keeps its value until the next emit.
⎛ ⎛ ⎞⎞
bufferj = Y bufferj + rprocessj ∧
⎜ ⎜
⎜ remitj ≤ σj bufferj
⎜ ∧ ⎟ ⎟
⎟
⎟
⎜emitj ⇒ ⎜ remitj > σj bufferj − 1 ∧ ⎟⎟ (7)
⎜ ⎜ ⎟⎟
j∈B ⎝ ⎝ Xbufferj ≥ bufferj − remitj ∧ ⎠⎠
σ
¬final(j) remit
Xbufferj < bufferj − σ j + 1
(¬emitj ⇒ (remitj = 0 ∧ (Xbufferj = bufferj )UXemitj )) (8)
j∈B,¬final(j)
Notice that some of the variables appearing in Formulae (3)–(8) have infinite
domains, but some range over finite domains. More precisely, variables qj for
each bolt j, raddj for bolts subscribing to spouts, and remiti for each spout i, are
infinite counters. Variables rprocessj , instead, are finite counters since they have
values between 0 and r̂takej . Variables bufferj and remitj for each bolt, as well
as raddj for all bolts not subscribing to spout streams, are also finite counters. In
fact, bufferj , whose behavior is defined by Formulae (7) and (8), is finite since
its value is always less than r̂takej + σ1 + 1. We do not show the reasoning that
allows us to conclude the finiteness of the aforementioned counters for lack of
space. The finiteness of some of the counters allows us to write succinct formulae
where multiplications and divisions are abbreviations for long case formulae.
Timing Constraints. To measure the time spent in each state, and to impose
timing constraints between different events, for each topology component we
define a set of clock variables. Specifically, the duration of adjacent mutually
exclusive processing phases (such as idle, process and fail for a bolt, idle and
204 F. Marconi et al.
emit for a spout) is measured through two clocks, as done in [7]. At each instant
only one of the two clocks is relevant to measure the time spent in the current
processing phase; when the next phase starts, the second clock is reset and
becomes the new relevant clock, while at the same time the value of the former is
tested to verify if the measured delay satisfies the desired bound. In the following,
we use a shorthand tphase to indicate the currently relevant clock. Formula (9)
defines the conditions for resetting tphase for a bolt: in the origin, when a take
occurs, when a failure starts and when an idle phase starts.
Formula (10) imposes that when emit occurs, the duration of the current process-
ing phase is between α − and α + , where α is a positive constant that
captures possible (small) variations in the duration of the processing.
Measuring non-adjacent time intervals, such as the time between the end of a
failure and the start of the next one (i.e., time to failure), can be done using a
single clock, which does not need to be tested at the same time it is reset.
Failures. In our model, whenever a node fails, the tuples being processed by
the node, together with the tuples in its receive queue, are considered as failed
(not fully processed by the topology). According to the reliable implementa-
tion of Storm, the spout tuples that generated them must be resubmitted to
the topology. Since we do not keep track of single tuples, but we only con-
sider quantities of tuples throughout the topology, given an arbitrary amount
of failed tuples we can estimate the amount of spout tuples that have to be re-
emitted by the connected spouts. In order to express this relationship between
the failing tuples in a specific (failing) node and the new tuples having to be
re-emitted, we introduce the concept of impact of the node failure with respect
to another (connected) node. Imp(j, i) (“impact of node j failure on node i”) is
the coefficient expressing the ratio tuples to be replayed(i)
where j ∈ B is the fail-
f ailed tuples(j)
ing bolt and i ∈ {S B} is another node in the topology. If there exists a path
{p0 , . . . , pn |n > 0, p0 = i, pn = j} in the topology connecting the two nodes such
that ∀k ∈ [0, n − 1]Sub(pk , pk+1 ) holds, then a failure of node j has an impact
on node i and Imp(j, i) > 0. If such a path does not exist, then Imp(j, i) = 0.
The procedure to obtain the values of Imp(j, i) for each bolt is described in [5].
Once this coefficient is calculated for all pairs of (bolt, spout) in the topology, it
allows us to determine rreplayi , (i.e., the number of tuples to be re-emitted by
spout i after a bolt failure) by simply multiplying the number of failed tuples
by the appropriate coefficient, as i∈S (rreplayi = j∈B rfailji · Imp(j, i)), where
rfailji expresses “the number of failed tuples in bolt j affecting spout i”. This
value is incremented as in Formula (11) whenever a failure starts and is reset
after all the rfailji · Imp(j, i) tuples are emitted by the spout. Interested readers
can refer to [5] for the complete model.
Towards the Formal Verification of DIAs Through Metric Temporal Logic 205
(startFailj ∧ ¬emiti ⇒ Xrfailji = rfailji + qj + rprocessj + raddj ) (11)
i∈S,j∈B
6 Experimental Results
We present some experimental results obtained with our prototype tool D-
VerT1 , whose architecture is described in [5]. As shown in Fig. 4, D-VerT
takes as input the description of a Storm topology, through a suitable JSON
format, and implements the model-to-model transformation which produces the
corresponding instance of timed counter network representing the topology. The
resulting model is fed to the Zot formal verification tool [2], which has been mod-
ified to deal with CLTLoc formulae including unbounded counters. The property
is violated if a non-spurious counterexample (i.e. a run of the system violating
the property) is found. In this case, Zot returns the violating trace (SAT result),
that is processed back and displayed graphically by D-VerT. If the verification
terminates without providing counterexamples (UNSAT result), then the prop-
erty holds limited to ultimately periodic executions represented by a prefix αsβs
of bounded length.
We consider two different topologies: a simple DIA and a more complex
topology (named “focused-crawler”) provided by an industrial partner within the
DICE consortium. In both cases, we verify the property “all bolt queues have a
bounded occupation level ”. If the property holds, then we claim that all bolts are
able to process the incoming tuples in a timely manner. Otherwise, there exists a
counterexample that violates (i.e., disproves) the property and that corresponds
to an unwanted execution of the topology where at least one queue grows with an
unbounded trend. This behavior can be expressed in the k-satisfiability problem
with a formula constraining the size of the queues. Over ultimately periodic
executions, defined through a k-bounded model, a queue q grows indefinitely if
its size at position k is strictly greater than the size at position l. Therefore, to
enforce the construction of models satisfying sucha constraint, we add to the
formulae defining the k-satisfiability the conjunct j∈B qj (l) + c < qj (k), where
c is a non-negative constant.
The first use case (depicted in Fig. 1) allowed us to test some basic structures
that may appear in a Storm topology, such as split and join of multiple streams.
On this topology, we experimented on how modifying the parallelism level of a
bolt affects its ability of processing incoming tuples. In the first analysis, run
with the configuration in Fig. 1, Zot produces a trace showing that the adopted
configuration leads to an unbounded increase of the queue occupation of B2 and
B3 . By changing the parallelism level of the bolts (setting it to, respectively, 8 for
B2 and 5 for B3 ) we obtain a configuration showing no counterexample (up to
length k = 15) of unbounded queue increase (timings of the two configurations
– simple-DIA-cfg-1 and simple-DIA-cfg-2 – are reported in Table 1).
The second use case represents a typical usage of Storm in big data appli-
cations. As part of a social network analysis framework, the topology depicted
in Fig. 5 is in charge of fetching and indexing articles and multimedia items
from multiple web sources. The formal analysis of the “focused-crawler” topol-
ogy is motivated by some concerns raised by the industrial partner that were
textIndexer
articleExtraction
mediaTextIndexer
mediaExtraction
webPageUpdater
Fig. 6. D-VerT output trace of bolts expander and wpDeserializer. Black solid lines
represent the number of tuples in each bolt queue over time. Dashed lines show the
processing activity of the bolt, and dotted lines show the emits from the component
upstream. Gray background highlights the suffix of the trace, that is repeated infinitely
many times.
References
1. Apache Storm. http://storm.apache.org/
2. The Zot bounded satisfiability checker. github.com/fm-polimi/zot
3. Abdulla, P.A., Jonsson, B.: Verifying programs with unreliable channels. In: Pro-
ceedings of LICS, pp. 160–170 (1993)
4. Bérard, B., Cassez, F., Haddad, S., Lime, D., Roux, O.H.: Comparison of the
expressiveness of timed automata and time Petri nets. In: Pettersson, P., Yi, W.
(eds.) FORMATS 2005. LNCS, vol. 3829, pp. 211–225. Springer, Heidelberg (2005).
doi:10.1007/11603009 17
5. Bersani, M., Erascu, M., Marconi, F., Rossi, M.: DICE verification tool - initial
version. Technical report, DICE Consortium (2016). www.dice-h2020.eu
6. Bersani, M.M., Frigeri, A., Morzenti, A., Pradella, M., Rossi, M., Pietro, P.S.:
Constraint LTL satisfiability checking without automata. J. Appl. Log. 12(4), 522–
557 (2014)
Towards the Formal Verification of DIAs Through Metric Temporal Logic 209
7. Bersani, M.M., Rossi, M., San Pietro, P.: A tool for deciding the satisfiability of
continuous-time metric temporal logic. Acta Informatica 53(2), 171–206 (2016)
8. Bouajjani, A., Mayr, R.: Model checking lossy vector addition systems. In:
Meinel, C., Tison, S. (eds.) STACS 1999. LNCS, vol. 1563, pp. 323–333. Springer,
Heidelberg (1999). doi:10.1007/3-540-49116-3 30
9. Casale, G., Ardagna, D., Artac, M., Barbier, F., Nitto, E.D., Henry, A., Iuhasz,
G., Joubert, C., Merseguer, J., Munteanu, V.I., Perez, J., Petcu, D., Rossi, M.,
Sheridan, C., Spais, I., Vladušič, D.: DICE: quality-driven development of data-
intensive cloud applications. In: Proceedings of MiSE, pp. 78–83 (2015)
10. Demri, S., D’Souza, D.: An automata-theoretic approach to constraint LTL. Inf.
Comput. 205(3), 380–415 (2007)
11. Demri, S., Gascon, R.: The effects of bounding syntactic resources on Presburger
LTL. Technical report LSV-06-5, LSV (2006)
12. Finkel, A.: Decidability of the termination problem for completely specified proto-
cols. Distrib. Comput. 7(3), 129–135 (1994)
13. Furia, C.A., Mandrioli, D., Morzenti, A., Rossi, M.: Modeling Time in Computing.
Monographs in Theoretical Computer Science. An EATCS Series. Springer, Berlin
(2012)
14. Karp, R.M., Miller, R.E.: Parallel program schemata. J. Comput. Syst. Sci. 3(2),
147–195 (1969)
15. Reutenauer, C.: The Mathematics of Petri Nets. Masson and Prentice, Paris (1990)
Proving Event-B Models with Reusable Generic
Lemmas
1 Introduction
We want to change the way proofs are done, at least in an industrial set-
ting. In place of an interactive proof - something that is inherently a one-off
effort in Event-B and comparable model-based notations - we incite modellers
to gradually accumulate a library of general support condition called a schematic
lemmas. The principle here is that a fitting schematic lemma added to hypothesis
set would discharge an open proof obligation. Such a lemma may not refer to any
model variables or user-defined types and is, in essence, a property supporting
the definition of the underlying mathematical language1 . From our experience,
a modelling project has a fairly distinctive usage of mathematical language and,
we hypothesise, this leads to a distinctive set of supporting lemmas.
Since a schematic lemma does not reference model-specific variables or types
it can be immediately reused in a new context and thus is a tangible and per-
sistent outcome of a modelling effort, even an abortive one. It is not affected
by model refactoring and restructuring of refinement steps. In a long term, we
see schematic lemmas as a methodological tool promoting wider application of
model restructuring (or even restarting from scratch) and thus helping engineers
to construct better models and not feel constrained by the cost of a proof effort.
Another intriguing possibility, yet untested in practice, is that for a narrow
application domain combined with tailored development patterns it is feasible
to reach a point where a schematic lemma library makes modelling nearly free
of interactive proofs.
The rest of the paper is organised as follows. In Sect. 2 we briefly present the
Event-B modelling notation as well as its verification rules; we also introduce the
Why3 plug-in that makes use of the Why3 umbrella prover [8]. Section 3 expands
on the idea behind schematic lemmas and their potential role as a proof process.
We present some experimental results in Sect. 4 and summarise the findings in
Sect. 5.
2 Background
2.1 Event-B
never arrives at a state that is deemed unsafe (i.e., a shaft door is never open
when a lift cab is on a different floor). Progress properties ensure that a system
is able to achieve its operational goals (i.e., a lift cab eventually arrives).
Being a general-purpose formalism, Event-B does not attempt to fit any
specific application domain. It has found applications in hardware modelling,
validation of high-level use case scenarios, verification of business process logics
and even as a friendly notation for a mathematician looking for a support from
machine provers.
An Event-B development starts with the creation of a very abstract specifi-
cation. A cornerstone of the Event-B method is the stepwise development that
facilitates a gradual design of a system implementation through a number of
correctness-preserving refinement steps. The general form of an Event-B model
(or machine) is shown in Fig. 1. Such a model encapsulates a local state (pro-
gram variables) and provides operations on the state. The actions (called events)
are characterised by a list of local variables (parameters) vl, a state predicate
g called event guard, and a next-state relation S called substitution or event
action.
With one model (of a train control system), we had a disappointing result of
32 undischarged proof obligations with the Why3 plug-in against 5 left undis-
charged by the SMT plug-in.
3 Schematic Lemmas
There is a number of circumstances when existing interactive proofs become
invalidated and a new version of an undischarged proof obligation appears.
On rare occasions a model or its sizeable part are changed significantly so
that there is no or little connection between old and new proof obligations. Far
more common are incremental changes that alter the goal, set of hypotheses,
identifier names or types. During the refactoring of a refinement tree it is very
common to lose a large proportion of manual proofs.
While there is a potential to improve the way the Rodin Platform handles
interactive proofs, the fragility of such proofs has mainly to do with their nature.
Unlike more traditional theorems and lemmas found in maths textbooks, model
proof obligations have no meaning outside of the very narrow model context. And
since Event-B relies on syntactic proof rules for invariant and refinement checks,
even fairly superficial syntactic changes would result in new proof obligations
which are, in fact, if not logically equivalent are often quite similar to the deleted
ones.
Even in the case of a significant model change, it is, in our experience, likely
that proof obligations similar to those requiring an interactive proof re-appear.
In addition, there is a large number of essentially identical interactive proofs
re-appearing in different projects due to specific weaknesses in the underlying
automatic provers.
The key to our approach is understanding what ‘similar’ means in the relation
to some two proof obligations. One interpretation is that similar conditions can
be discharged by the same proof scripts. To make it practical, this has to be
relaxed with some form of a proof script template [24]. The interpretation we
take in this work is that two proof obligations are similar if they both can be
discharged by adding same schematic lemma to the set of their hypotheses.
This definition is rather intricately linked with the capabilities of underlying
automated provers: adding a tautology (a proven lemma) to hypotheses does
not change a conjecture but it might help to guide an automated prover to
successful proof completion.
It is our experience that the existing the Rodin automatic provers do not
benefit from adding a schematic lemma (with instantiated type variables, to
make it first order) to hypotheses and they still need to be instantiated manually
by manually by an engineer to have any effect. However, in the case of the Why3
plug-in, with which this approach has a close integration, it is different: a fitting
schematic lemma in hypotheses makes proof nearly instantaneous.
Proving Event-B Models with Reusable Generic Lemmas 215
There are situations when the only viable way to complete a proof is by
providing a proof hint. One such case - refinement of event parameters - is
adequately addressed at the modelling notation level where a user is requested
to provide a witness as a part of a specification. There are proposals to generalise
this, for the majority of situations, and define hints at the model level [10].
A schematic lemma considered on its own is of a little use. But if a proof
obligation can be proven by adding a schematic lemma, then the construction
of a schematic lemma in itself a proof process. As a simple illustration, consider
the following (trivial) conjecture:
library ∈ BOOKS → N
b ∈ BOOKS ∧ c ∈ N
...
library − {b → c} ∈ BOOKS → N
f ∈A→B
∀x, y · x ∈ A ∧ y ∈ B ⇒ f − {x → y} ∈ A → B
Since the Event-B mathematical language does not have type variables such
a condition may only be defined either for specific A’s and B’s, or, in a slightly
altered form, using the Theory plug-in [6]. But to discharge the original proof
obligation one still needs to find this lemma and instantiates it. It is a tedious
and error-prone process for a human but a fairly trivial task for a certain kind
of automated provers.
The example above is quite generic in the sense it is potentially useful for in
many other contexts. At times a schematic lemma need to be fairly concrete (see
examples in Sect. 4. It is also easier to write a lemma that narrowly targets a proof
obligation. This distinction between ‘general’ and ‘specific’ is, at the moment,
completely subjective and relies on the modeller’s intuition. To reflect the fact
that a more general lemma is more likely to be reused, schematic lemmas are
classified into three visibility classes: machine (single model), project (collection
of models) and global. A machine-level lemma will be considered for a proof
obligation of the machine with which the lemma is associated; similarly, for
the project-level attachment. A global schematic lemma becomes a part of the
Event-B mathematical language definition for the Why3 plug-in.
Just as model construction is often an iterative process, we have discovered
during our experiments that finding a good schematic lemma may require several
attempts. A common scenario is that an existing lemma may be relaxed so that
while it is still strong enough to discharge conditions that were dependent on it, it
can also discharge some new ones. For instance, we have seen several cases where
a fairly narrow and detailed lemma would gradually slim down to a simple (and
216 A. Iliasov et al.
where w∗ (i) = cnt(i)−1 and cnt(i) is number of times i occurs in all hypotheses
and support lemmas. Very common shingles contribute little to the similarity
assessment and may be disregarded so that there is some k such that card(I1 ) <
k, card(I2 ) < k.
Proving Event-B Models with Reusable Generic Lemmas 217
Fig. 2. Schematic lemma prover interface. Instead of working with the built-in interac-
tive prover, a modeller attempts to construct a provable schematic lemma that would
discharge the current proof obligation
218 A. Iliasov et al.
discharges the proof obligation. If either fails, a user gets an indication of what
has happened and it is not until both generic and concrete proofs are carried
out that the schematic lemma may be used in the local library and assigned a
binding level (machine, project or global). In the case of a success, the current
open goal is closed.
To aid in the construction of a schematic lemma, the plug-in provides some
simple productivity mechanisms. A hypotheses can be deselected without remov-
ing it to check whether both the lemma goal and the context proof obligation are
still provable. An identifier may also be deselected and this automatically dese-
lects all the hypotheses mentioning the identifier. It will take more experiments
to arrive at methodological guidelines on constructing lemmas.
4 Case Study
In this section we discuss the experience of applying the schematic lemmas tech-
nique to prove several pre-existing models. Since this is an on-going project, we
also discuss perceived advantages and disadvantages of doing proofs with our
technique.
As the case study we consider four models, some of them fairly well known
to the Event-B community. They are not very large but still have a reasonable
number of proof obligations and make a good use of refinement and the Event-B
modelling notation. Our intention was to take models from different domains
constructed by different people to see how the technique performs in different
settings. On the whole we were pleased to find that such diverse models still share
a lot of schematic lemmas and it supports our conjecture that it is worthwhile to
build lemma library. We do not have enough to show that this process definitely
leads to a saturation point but we did observe that each subsequent model we
tackled was a little bit easier since lemmas are reused.
In the following subsections we start by addressing the importance of auto-
matic part of the verification process providing statistics on recent experiment
results. Then we demonstrate an example of how the schematic lemma method
was used to discharge a single goal and how lemmas propagate within a model.
The core of the experiment was to apply the schematic lemma plug-in to sev-
eral diverse models and compare results with the existing proof infrastructure
including the Why3 plug-in not equipped with schematic lemmas. The Rodin
Platform provides facility to define automatic tactics, combining certain rewrite
rule and automatic provers, and apply them redo all the proofs of a project. For
this experiment, we have defined four such tactics and compared their perfor-
mance. We have made every attempt to make best use of the available tools such
as the Atelier-B ML prover, built-in PP and nPP provers, and, of course, the
SMT plug-in that relies on some of the same back-end SMT provers.
Proving Event-B Models with Reusable Generic Lemmas 219
Table 1. Comparative performance of four proof tactics; the first column is the overall
number of generated proof obligations, the following four columns give the number of
proof obligations remaining open (undischarged) after applying, from a scratch (that
is, purging any previous proofs) the certain proof tactic. The final column gives in
brackets the number of schematic lemmas used in the model (but not necessarily defined
specifically for the model).
Table 1 summarises the results of our experiment. We use two tactics that are
commonly available to the Rodin users. Tactic1 applies a number of rewrite rules
and then tries nPP, PP and ML provers; Tactic2 does the same with addition of
the SMT plug-in. The Why3 tactic is similar to Tactic1 but with the Why3 plug-
in as the sole automatic prover. This tactic does not use any schematic lemmas
and relies solely on the basic axiomatisation library defining various Event-B
operators. In the last column, the Why3 plug-in is able to locate an include
suitable schematic lemmas. This is a completely automatic process: one can
define a number of schematic lemmas (when doing interactive proofs), then purge
all the proofs and the lemmas will be picked up automatically when relevant.
The last number (+x) is the number of used schematic lemmas.
With one of the models (Train Control System) not only the Why3 plug-in
showed a lacklustre performance compared to the SMT plug-in but we also found
it hard to come up with any useful schematic lemmas. Two of the remaining
models were not proven completely as we have found it quite hard to read large
proof obligations and deduce what is really happening there. It should, we hope,
easier for a modeller who has a ready intuition as to what is the underlying
meaning of a given proof obligation.
In this subsection we go a bit a deeper and discuss one specific example where
a schematic lemma is used to complete a proof. We approached the experiment
in a more or less blind style where a model itself was not analysed in any detail
and we were generally concerned only with the specifics of a proof obligation -
its goal and hypothesis, - in an attempt to deduce a schematic lemma strong
enough to discharge the condition.
220 A. Iliasov et al.
lemma lemma_total_overriding_help1:
forall f:rel ’a ’b, s:set ’a, t:set ’b, x: ’a, y : ’b.
Proving Event-B Models with Reusable Generic Lemmas 221
Both statements were proven. For Alt-Ergo the times are 1.74 s and 1.08 s
respectively. It is important to note that these lemmas only appear in the context
of proving lemma total overriding.
As we have stated previously, it has been one of the goals of this research to
establish to what degree schematic lemmas are reusable at least within the same
project. Clearly, it would not make any sense to write a dedicated lemma for
each open proof obligation.
In this experiment, we address the problem of proof re-usability by shifting
the focus from proving a single verification condition to validating remaining
undischarged proof obligations of the model. We use a publicly available model
Buyer/Seller B2B Communication protocol [18]. In our view, it is a fairly typical
example of a model not constructed solely for illustration purposes, i.e., there is
some scale and purpose to it.
A Buyer/Seller B2B Communication protocol model has 11 refinement steps
and 498 verification conditions. Combining all the default tactics with all the
available automatic provers and the SMT plug-in results in 25 undischarged
verification conditions (63 without the SMT plug-in).
Our standard routine based on the Why3 plug-in consists in first applying
the plug-in without any schematic lemmas with increasingly longer timeouts
and only afterwards reviewing remaining conditions for the purpose of writing
schematic lemmas.
For this specific experiment, we used an incremental timeout tactic with
three theorem provers: Z3, EProver and Alt-Ergo. The initial timeout was set
to 5 s then to 15 s and finally 45 s which roughly the point when provers start
to run out of memory. The vast majority of conditions were proven under 5s,
only few more between 5 and 15 s, and no new conditions were proven with the
45 s timeout. The Why3 plug-in on its own has discharged a significant part
of the obligations: only 4.6 % of the 498 open verification conditions were not
automatically proven which is better than the SMT plug-in.
One immediately satisfying result that the schematic lemmas defined for two
other models (Order/Supply Communication and Fisher’s Algorithm) - com-
pletely unrelated in terms of domain and provenance - discharged ten proof
obligations of the B2B model. After that, we have added further five schematic
lemmas each discharging between 2 and four proof obligations. Table 2 shows
the proof progress taking the model from 20 POs to 8 via five schematic lem-
mas. The remaining 8 could not be easily done with this approach. We have not
arrived at a definite conclusion of whether there is a sizeable class of proof oblig-
ations for which one cannot construct meaningful lemmas or if it is just the case
of unfamiliarity with the model making writing schematic lemmas inordinately
difficult.
222 A. Iliasov et al.
Table 2. The dynamics of proving the B2B communication protocol model using the
schematic lemma technique. The numbers show how each next lemma (L1 , L2 , ...)
affects the overall number of open proof obligations.
A fairly common tactic in the schematic lemma approach, when not familiar
with the model, and the condition appears to be true, is to try and identify the
few key hypothesis and come up with a lemma that would bridge them to the
goal. Although it sounds fairly trivial, proof obligations may contain tens if not
hundreds hypotheses so just visually spotting the right few one might be tricky.
We are working on heuristics to automatically filter and rank schematic lemma
hypotheses.
As an illustration of the finiteness properties consider the following simple
example.
finite(B 2 S proposal)
B 2 S counter proposal ∈ B 2 S proposal dom(B 2 S rejection)
finite(B 2 S counter proposal)
lemma lemma_finite_partial_domain:
forall f : rel ’a ’b, s : set ’a, t : set ’b.
finite (dom f) /\ mem f (s +-> t) ->
finite f
Proving Event-B Models with Reusable Generic Lemmas 223
5 Discussion
References
1. Event-B and the Rodin Platform. http://www.event-b.org/
2. Furst, A.: Event-B model of the Order/Supply Chain A2A Communication. http://
deploy-eprints.ecs.soton.ac.uk/129/
3. Abrial, J.-R.: The B-Book. Cambridge University Press, Cambridge (1996)
4. Abrial, J.-R.: Modelling in Event-B. Cambridge University Press, Cambridge
(2010)
5. de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R.,
Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg
(2008)
6. Butler, M., Maamria, I.: Practical theory extension in Event-B. In: Liu, Z.,
Woodcock, J., Zhu, H. (eds.) Theories of Programming and Formal Methods.
LNCS, vol. 8051, pp. 67–81. Springer, Heidelberg (2013)
7. Clearsy. Atelier B.: User and Reference Manuals. http://www.atelierb.societe.com/
index uk.html
8. Marché, C., Paskevich, A., Bobot, F., Filliâtre, J.-C.: Why3: shepherd your herd of
provers. In: Boogie 2011: First International Workshop on Intermediate Verification
Languages, pp. 53–64, August 2011
Proving Event-B Models with Reusable Generic Lemmas 225
9. Hallerstede, S.: On the purpose of Event-B proof obligations. In: Börger, E., Butler,
M., Bowen, J.P., Boca, P. (eds.) ABZ 2008. LNCS, vol. 5238, pp. 125–138. Springer,
Heidelberg (2008)
10. Hoang, T.S.: Proof hints for Event-B (2012). CoRR, abs/1211.1172
11. Iliasov, A., Bryans, J.: A proof-based method for modelling timed systems. In:
Voronkov, A., Virbitskaite, I. (eds.) PSI 2014. LNCS, vol. 8974, pp. 161–176.
Springer, Heidelberg (2015)
12. Industrial deployment of system engineering methods providing high dependability
and productivity (DEPLOY), IST FP7 project. http://www.deploy-project.eu/
13. Burdy, L.: Automatic refinement. In: Proceedings of BUGM at FM 1999 (1999)
14. Conchon, S., Contejean, É., Kanig, J., Lescuyer, S.: CC(X): semantical combi-
nation of congruence closure with solvable theories. In: Post-proceedings of the
5th International Workshop on Satisfiability Modulo Theories (SMT 2007), vol.
198, no. 2 of Electronic Notes in Computer Science, pp. 51–69. Elsevier Science
Publishers (2008)
15. Rigorous Open Development Environment for Complex Systems (RODIN), IST
FP6 STREP project. http://rodin.cs.ncl.ac.uk/
16. Iliasov, A., Stankaitis, P., Adjepon-Yamoah, D., Romanovsky, A.: Rodin platform
Why3 plug-in. In: Butler, M., Schewe, K.-D., Mashkoor, A., Biro, M. (eds.) ABZ
2016. LNCS, vol. 9675, pp. 275–281. Springer, Heidelberg (2016). doi:10.1007/
978-3-319-33600-8 21
17. Said, M.Y., Butler, M., Snook, C.: Language and tool support for class and state
machine refinement in UML-B. In: Cavalcanti, A., Dams, D.R. (eds.) FM 2009.
LNCS, vol. 5850, pp. 579–595. Springer, Heidelberg (2009)
18. Hoang, T.S.: Event-B model of the Buyer/Seller B2B Communication. http://
deploy-eprints.ecs.soton.ac.uk/128/
19. The RODIN platform. http://rodin-b-sharp.sourceforge.net/
20. TPTP: Thousands of Problems for Theorem Provers. www.tptp.org/
21. Deharbe, D., Fontaine, P., Guyot, Y., Voisin, L.: Integrating SMT solvers in Rodin.
Sci. Comput. Program. 94(Part 2), 130–143 (2014)
22. Kovács, L., Voronkov, A.: First-order theorem proving and Vampire. In:
Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 1–35.
Springer, Heidelberg (2013)
23. Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL - A Proof Assistant for
Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002)
24. Freitas, L., Whiteside, I.: Proof patterns for formal methods. In: Proceedings of
FM 2014: Formal Methods - 19th International Symposium, Singapore, 12–16 May
2014, pp. 279–295 (2014)
25. Weidenbach, C., Dimova, D., Fietzke, A., Kumar, R., Suda, M., Wischnewski, P.:
SPASS version 3.5. In: Schmidt, R.A. (ed.) CADE-22. LNCS, vol. 5663, pp. 140–
145. Springer, Heidelberg (2009)
Formal Availability Analysis Using Theorem
Proving
1 Introduction
Availability analysis is used to identify and assess the causes and frequencies
of system failures. The outcomes of availability analysis play a vital role in
ensuring failure-free operation of the given system. Due to the rapid increase
in the usage of technological systems in safety and mission-critical domains,
such as transportation and healthcare, the demand of their availability and thus
availability analysis is also growing dramatically.
The first step, in the availability analysis, is the evaluation of basic metrics of
reliability and maintainability, such as mean-time to failure (MTTF) [1], mean-
time between failure (MTBF) [1] and mean-time to repair (MTTR) [1], at the
The original version of this chapter was revised. The spelling of the author
Waqar Ahmad has been corrected. The erratum to this chapter is available at
DOI: 10.1007/978-3-319-47846-3 30
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 226–242, 2016.
DOI: 10.1007/978-3-319-47846-3 15
Formal Availability Analysis Using Theorem Proving 227
individual component level of the given system. These metrics are then used to
calculate the availability of each component of the system by using the reliability
and the maintainability distributions, such as Exponential or Weibull, with fail-
ure and repair rates, λ = M T1T F and μ = M T1T R . The next step is the selection of
an appropriate availability modeling technique, such as Availability Block Dia-
grams (ABD) [2] and unavailability Fault Trees (FT) [2]. These techniques are
the extension of traditionally used reliability modeling techniques, such as Relia-
bility Block Diagram (RBD) [1] and Fault Tree (FT) [1], for availability analysis
purposes. Besides these two techniques, Markov chains [3] have also been used
for availability assessment. In practice, it provides much more detailed analy-
sis compared to ABD and UFT. However, the major problem with the Markov
chain based availability analysis is its exponential growth in the state-space as
the system complexity increases [3]. For instance, consider the large Multistage
Interconnection Networks (MINs) [3] that are mainly used in the supercomput-
ers and multi-process systems to realize communication among thousands of
processors. To conduct the Markov chain based availability analysis of a 8 × 8
MIN consisting of 16 switching elements, we need to consider 216 possible states
[3]. Although, we can somewhat reduce the number of states by taking appropri-
ate assumptions but it can compromise the accuracy of the availability results [3].
On the other hand, ABD and UFT are intuitive and transparent methods that
can be used to describe the availability of large and complex systems, like MINs
[4]. The ABD and UFT based modeling techniques also allow us to estimate
the availability of the given system at the system level and play a particularly
useful role at the design stages of the system to scrutinize the design alternatives
without building the actual system. Once an appropriate availability model is
obtained then the next step is to perform the system level availability analysis
of the model using an appropriate analysis technique.
Traditionally, simulation tools, such as ReliaSoft [5] and ASENT [6], are used
to analyze the availability models. However, these techniques cannot be termed
as accurate due to their inherent incompleteness and the involvement of pseudo-
random numbers and numerical methods. Given the safety and financial-critical
nature of many technological systems these days, a slight unavailability of such a
system, at a particular instant, may lead to disastrous situations, including the
loss of human lives or heavy financial setbacks. For instance, it is reported that
the Amazon Web Service (AWS) suffered an unavailability for 12 h, in April 21,
2011, causing hundreds of high-profile Web sites to go offline [7], which resulted
in a loss of 66,240 US$ per minute downtime of its services.
Model checking techniques have been used to overcome the above-mentioned
limitations for conducting the reliability analysis (e.g., [8,9]), which is in turn
used to assess the failure free operation of a system in a given interval and is thus
quite closely related to availability analysis. Stochastic Petri Nets (SPN) have
also been utilized to formalize RBD and FT, which are then used to analyze the
availability [10]. However, a major disadvantage of using these approaches is their
inability to analyze large size systems. Moreover, the computation of probabili-
ties in these methods [8,9] involves numerical methods, which compromises the
228 W. Ahmad and O. Hasan
some of the most widely used probability axioms, which play a pivotal role in
formal reasoning about reliability properties. A random variable is a measurable
function between a probability space and a measurable space. The measurable
functions belong to a special class of functions, which preserves the property that
the inverse image of each measurable set is also measurable. A measurable space
refers to a pair (S, A), where S denotes a set and A represents a nonempty
collection of sub-sets of S. Now, if S is a set with finite elements, then the
corresponding random variable is termed as a discrete random variable otherwise
it is called a continuous one.
Now, reliability R(t) is defined as the probability of a system or component
performing its desired task over certain interval of time and expressed mathe-
matically in terms of random variable as R(t) = P r(X > t). This concept can
be formalized in HOL4 as follows:
The above definition takes a probability space p, a list of random variable pairs
L, representing the working and repair time random variables, a number n and
a time variable t and returns the corresponding availability event. The function
SIGMA takes an arbitrary function f and a set s and returns the sum of all the
values obtained by applying the function f on each element of the given set.
The HOL4 function count takes a number n and returns a set containing all the
natural numbers less than the given number n. Similarly, the function EL takes
an index variable and a list and retrieves the list element located at the given
index number. The HOL4 functions FST and SND are primarily used to access the
first and second elements in a pair. Definition 1 models the corresponding event
of the ith working interval only. To cover all the working intervals, we take the
union of these availability events, corresponding to the pairs of random variable
in list L, in HOL4 as follows:
Definition 2. ∀ p L t. union avail events p L t =
BIGUNION (IMAGE (λa. avail event p L a t) (count (LENGTH L)))
The first two assumptions ensure that p is a valid probability space and time
index t must be positive. The next two assumptions make sure that the given
list of random variables must not be empty and the availability events are in
the events space p. The last assumption ensures that the availability events are
disjoint. The conclusion models the property that the instantaneous availabil-
ity is always greater or equal to reliability. The function Reliability takes a
probability space p, a random variable that is associated with the system or
component and a time variable t and returns the reliability of the system or
component [12].
Consider that the failure and repair random variables are exhibiting expo-
nential distributions with failure and repair rates λ and μ, respectively, then the
instantaneous availability at the component level can be expressed mathemati-
cally as follows [1]:
μ λ
Ainst (t) = + e−(λ+μ)t (1)
μ+λ μ+λ
where the failure and repair rates are the mean-time-to-failure (MTTF) and
mean-time-to-repair (MTTR), i.e. λ = M T1T F and μ = M T1T R , which are basic
metrics for reliability and maintainability, respectively.
Formal Availability Analysis Using Theorem Proving 231
(a) (b)
(c) (d)
Fig. 1. ABDs (a) Series (b) Parallel (c) Series-Parallel (d) Parallel-Series
where the function union avail event list can be obtained by mapping the
function union avail event on every element of the given random variable list.
The function list prod returns the product of given real number list. The first
two assumptions (A1–A2) ensure that p is a valid probability space and the
time t must be positive. The assumptions (A3–A4) guarantee that the failure
and repair rates are positive and the length of failure-repair random variable
and the corresponding rate lists are equal. The next two assumptions (A5–A6)
make sure that the length of availability event list, representing the availability
of individual components, must not be empty and each availability event in a
avail event list is in events space p. The last two assumptions (A7–A8) pro-
vide the mutual independence among all the availability events and the instanta-
neous availability of each component. The conclusion of the theorem represents
Formal Availability Analysis Using Theorem Proving 233
Eq. (3) as the function steady state avail list takes a list of pairs, represent-
ing the failure and repair rates, and returns a list of steady-state availabilities,
corresponding to each component of the given system.
Similarly, the availability of a system with parallel connected components,
depicted in Fig. 1(b), mainly depends on the component with the maximum
availability. In other words, the system will continue functioning as long as at
least one of its components remains functional. Mathematically [20]:
N
N
μi
lim P r( Ainsti (t)) = 1 − (1 − ) (4)
t→∞
i=1 i=1
μi + λi
The function parallel struct accepts a list of reliability events and returns
the parallel structure reliability event by recursively performing the union oper-
ation on the given list of reliability events or an empty set if the given list is
empty. We can now verify Eq. (4) as follows:
Theorem 4. ∀p L M.
(lim (λt. prob p (parallel struct p (union avail event list p L (&t)))) =
1 - list prod (one minus list (steady state avail list M))
The above theorem is verified under the same assumptions as Theorem 3. The
conclusion of the theorem represents Eq. (4) where, the function one minus
list accepts a list of real numbers [x1, x2, · · · , xn] and returns the list of real
numbers such that each element of this list is 1 minus the corresponding element
of the given list, i.e., [1 − x1, 1 − x2 · · · , 1 − xn]. The proof of Theorem 4 is based
on Theorem 3 along with the fact that given a list of n mutually independent
events, the complement of these n events are also mutually independent.
If in each serial stage the components are connected in parallel, as shown
in Fig. 1(c), then the configuration is termed as a series-parallel structure. If
Ainstij (t) is the event corresponding to the instantaneous availability of the j th
component connected in an ith subsystem at time instant t, then the steady-state
availability of the complete system can be expressed as follows [20]:
N
M
N
M
μij
lim P r( Ainstij (t)) = (1 − (1 − )) (5)
t→∞
i=1 j=1 i=1 j=1
μij + λij
where the function list union avail event list is obtained by mapping the
function union avail event list on each element of the given random variable
list.
The function series parallel struct models the series-parallel ABD by
first mapping the function parallel struct on each element of the given event
list and then applying the function series struct to this obtained list. Simi-
larly, the function compl steady state avail returns a list of one minus steady-
state availabilities.
The functions list prod and one minus list are used to model the product
and complement of steady-state availabilities, respectively. The assumptions are
similar to the ones used in Theorems 3 and 4 with the extension that the given
lists are two-dimensional lists. The HOL4 function FLAT is used to convert a
two dimensional list into a single list. The conclusion models the right-hand-
side of Eq. (5). The proof of the above theorem uses Theorems 3 and 4 and also
requires a lemma that given the list of mutually independent reliability events,
an event corresponding to the series-parallel structure and a reliability event are
also independent in probability.
If the components in these reserved subsystems are connected serially then
the structure is called a parallel-series structure, as depicted in Fig. 1(d). If Aij (t)
is the event corresponding to the availability of the j th component connected in
a ith subsystem at time t, then the steady-state availability becomes:
M
N
M
N
μij
lim P r( Aij (t)) = 1 − (1 − ) (6)
t→∞
i=1 j=1 i=1 j=1
μij + λij
The above equation is also verified as a HOL4 theorem in our development and
more details about it can be found in [21].
contribute towards the occurrence of a top event, i.e., a critical event, which can
cause the whole system unavailable upon its occurrence.
We can formalize the unavailability event of a system by taking the comple-
ment of the availability event with respect to the probability space p.
Definition 6. ∀ p X t.
union unavail events p L t = p space p DIFF union avail events p L t
The assumptions of the above theorem are similar to the ones used in Theorem 2
and the conclusion of Theorem 5 represents Eq. (8).
In the OR unavailability FT gate, the occurrence of the output unavailability
event depends upon the occurrence of any one of its input unavailability event.
The function OR unavail FT gate, given in Table 1, models this behavior as it
returns the union of the input unavailability list L by using the recursive function
union list. The NOR unavailability FT gate, modeled by using the function
NOR unavail FT gate, given in Table 1, can be viewed as the complement of the
OR unavailability FT gate and its output unavailability event occurs if none of
the input unavailability event occurs.
Similarly, the NAND unavailability FT gate, represented by the function
NAND unavail FT gate in Table 1, models the behavior of the occurrence of an
236 W. Ahmad and O. Hasan
output unavailability event when at least one of the unavailability events at its
input does not occur. This type of gate is used in unavailability FTs when the
non-occurrence of the unavailability event in conjunction with the other unavail-
ability events causes the top unavailability event to occur. This behavior can be
expressed as the intersection of complementary and normal events, where the
complementary events model the non-occurring unavailability events and the
normal events model the occurring unavailability events. The output unavail-
ability event occurs in the 2-input XOR unavailability FT gate if only one, and
not both, of its input unavailability events occur. The HOL4 representation of
the behaviour of the XOR unavail FT gate is also presented in Table 1. The
function NOT unavail FT gate accepts an unavailability event A and probabil-
ity space p and returns the complement to the probability space p of the given
input unavailability event A. The verification of the corresponding unavailabil-
ity expressions, of the above-mentioned unavailability FT gates, is presented
in Table 2. These expressions are verified under the same assumptions as the
ones used for Theorem 6 and the proofs are mainly based on some fundamental
mutual independence properties of the given unavailability events along with
some axioms of probability theory.
The principle of inclusion exclusion (PIE) forms an integral part of the rea-
soning involved in verifying the unavailability of a FT. In FT based unavailability
analysis, firstly all the basic unavailability events are identified that can cause the
Formal Availability Analysis Using Theorem Proving 237
occurrence of the system top unavailability event. These unavailability events are
then combined to model the overall fault behavior of the given system by using
the fault gates. These combinations of basic unavailability events, called cut sets,
are then reduced to minimal cut sets (MCS) by using set-theory rules, such as
idempotent, associative and commutative. The PIE is then used to evaluate the
overall failure probability of the given system.
If Ai represent the ith basic unavailability event or a combination of unavail-
ability events then the overall unavailability of the given system can be expressed
in terms of the probabilistic inclusion-exclusion principle as follows:
n
P( Ai ) = (−1)|J|−1 P( Aj ) (9)
i=1 J={},J⊆{1,2,...,n} j∈J
The function sum set recursively sums the return value of the function f , which
is applied on each element of the given set s. In the above theorem, the set s is
represented by the term {x|C(x)} that contains all the values of x, which satisfy
function (λt. -1 pow (CARD t - 1) * prob
condition C. Whereas, the λ abstraction
p (BIGINTER t)) models (−1)|J|−1 P( j∈J Aj ), such that the functions CARD and
BIGINTER return the number of elements and the intersection of all the elements
of the given set, respectively.
The proof script [21] of the above-mentioned formalizations of ABD and
unavailability FT gates and the PIE principle is composed of more than 9000
lines of HOL script and took about 350 man-hours. The main outcome of this
formalization is that the definitions and theorems of ABDs and FT gates can be
used to capture the behavior of wide variety of real-world systems and analyze
their corresponding availability in higher-order logic.
Definition 8. ∀p X ED X CK X SS X HB X HL t.
RO ABD p X ED X CK X SS X HB X HL t =
series parallel struct p
(list union avail event list
([[X ED;X ED];[X CK];[X SS;X SS];[X HB];[X HB];[X HL;X HL]]) t)
Formal Availability Analysis Using Theorem Proving 239
We verified the following theorem for the availability of the satellite solar array:
Theorem 8. ∀p X ED X CK X SS X HB X HL.
(lim (λt. prob p ( RO ABD p X ED X CK X SS X HB X HL &t)) =
(1 - (1 - steady state avail ED) pow 2) * steady state avail CK *
(1 - (1 - steady state avail SS) pow 2) *
((steady state avail HB) pow 2) * (1 - (1 - steady state avail HL) pow 2)
We have omitted the assumptions of this theorem here due to space limitations
and the complete formalization is available at [21]. The proof of the above the-
orem is primarily based on Theorem 5 and is very straightforward.
An unavailability FT can be constructed by considering the faults in the
solar array mechanical components, which are the fundamental causes of satel-
lite’ solar array mechanisms failure. The unavailability FT for the solar array
of the DFH-3 Satellite that was launched by the People’s Republic of China
on May 12, 1997 [19] is depicted in Fig. 3 and we formally analyze this FT
in this paper. The proposed FT formalization (functions OR unavail FT gate
and AND unavail FT gate, given in Table 1) is used to model the MCS of the
unavailability of the solar array as follows:
[OR unavail FT gate (union avail event list p [x1; x2; x3; x4] t);
AND unavail FT gate p (union avail event list p [x5; x6] t);
OR unavail FT gate
(union avail event list p [x7; x8; x9; x10; x11; x12; x13; x14] t)]
Again all quantifiers and the assumptions of the above theorem have not been
included due to space limitations and the complete theorem can be found at
[21]. The proof of the above theorem utilizes the PIE principle (Theorem 7) and
the unavailability FT gates with their corresponding mathematical expression,
given in Tables 1 and 2.
The proof script [21] for Theorems 8 and 9 is composed of about 100 lines
of HOL code compared to about 9000 lines of code that had to be written to
formalize the foundational availability concepts. This straightforward reasoning
clearly indicates the usefulness of our work. The distinguishing features of the
formally verified Theorems 8 and 9, compared to the other existing availabil-
ity analysis alternatives, include their generic nature, i.e., all the variables are
universally quantified and thus can be specialized to obtain the availability for
any given failure and repair rates, and their guaranteed correctness due to the
involvement of a sound theorem prover in their verifications. Moreover, the usage
of a theorem prover in their verification ensures that all the required assump-
tions for the validity of the results are explicitly included in the theorems, which
is quite important for designing accurate systems.
In order to facilitate the use of our formally verified results by industrial
design engineers for their availability analysis, we have also developed a set
of SML scripts to automate the simplification step of these theorems for any
given failure and repair rate values corresponding to the DFH-3 satellite solar
array components. For instance, the auto solar RBD avail script automatically
computes the availability up to 12 decimal places based on Theorem 8 as follows:
prob space p ∧
(∀t’. (∀z. MEM z (FLAT (list union avail event list
[[X ED;X ED];[X CK];[X SS;X SS];[X HB];[X HB];[X HL;X HL]] (&t’))) ⇒
z ∈ events p) ∧
mutual indep p (FLAT
(list union avail event list
[[X ED;X ED];[X CK];[X SS;X SS];[X HB];[X HB];[X HL;X HL]] (&t’)))) ∧
two dim inst avail exp p
[[X ED;X ED];[X CK];[X SS;X SS];[X HB];[X HB];[X HL;X HL]]
[[(0.1,0.3);(0.1,0.3)];[(0.2,0.5)]; [(0.3,0.4); (0.3,0.4)]; [(0.7,0.8)];
[(0.7,0.8)]; [(0.5,0.5); (0.5,0.5)]] ⇒
lim (λt. prob p ( RO ABD p X ED X CK X SS X HB X HL &t)) = 0.116618075802
Formal Availability Analysis Using Theorem Proving 241
This auto solar RBD avail script can be used for any values of the failure
and repair rates and can be easily extended to be used for the instantiation
of the generic result of Theorems 9 [21]. With a very little modification, these
kind of automation scripts can facilitate industrial design engineers to accurate
determine the availability of many other safety-critical systems.
7 Conclusion
The foremost requirements to conduct the formal availability analysis within a
theorem prover is to formalize the ABD configurations, i.e., series, parallel, series-
parallel and parallel-series, unavailability FT gates, such as AND, OR, NAND,
NOR, XOR and NOT, and instantaneous and steady-state availability. This
paper fulfills the above-mentioned requirement and thus provides a framework,
which can be used to carry out the formal availability analysis of any system
within a sound core of HOL4 theorem prover. For illustration, our formalizations
are utilized to conduct the formal availability analysis of an satellite solar array
and the results have been found to more rigorous than the existing availability
analysis alternatives. However, this formalization is only limited to static ABD
and UFT models and cannot express the time varying system states, dependent
systems and non-series-parallel topologies. This limitation can be removed by
extending the present formalization to dynamic ABD and dynamic UFT. This
can be done by combining this formalization of ABD and UFT with the recently
proposed Markov chain formalization [22] in HOL4.
References
1. Trivedi, K.S.: Probability and Statistics with Reliability, Queuing and Computer
Science Applications, 2nd edn. Wiley, London (2002)
2. Stapelberg, R.F.: Handbook of Reliability, Availability, Maintainability and Safety
in Engineering Design. Springer Science & Business Media, Berlin (2009)
3. Blake, J.T., Trivedi, K.S.: Multistage interconnection network reliability. Trans.
Comput. 38(11), 1600–1604 (1989)
4. Bistouni, F., Jahanshahi, M.: Analyzing the reliability of shuffle-exchange networks
using reliability block diagrams. Reliab. Eng. Syst. Saf. 132, 97–106 (2014)
5. ReliaSoft (2016). http://www.reliasoft.com/
6. ASENT (2016). https://www.raytheoneagle.com/asent/rbd.htm
7. Bailis, P., Kingsbury, K.: The network is reliable. Queue 12(7), 20 (2014)
8. Robidoux, R., Xu, H., Xing, L., Zhou, M.: Automated modeling of dynamic reli-
ability block diagrams using colored Petri nets. IEEE Trans. Syst. Man Cybern.
Part A: Syst. Hum. 40(2), 337–351 (2010)
9. Bozzano, M., Cimatti, A., Katoen, J.-P., Nguyen, V.Y., Noll, T., Roveri, M.: The
COMPASS approach: correctness, modelling and performability of aerospace sys-
tems. In: Buth, B., Rabe, G., Seyfarth, T. (eds.) SAFECOMP 2009. LNCS, vol.
5775, pp. 173–186. Springer, Heidelberg (2009)
10. Signoret, J.P., Dutuit, Y., Cacheux, P.J., Folleau, C., Collas, S., Thomas, P.: Make
your Petri nets understandable: reliability block diagrams driven Petri nets. Reliab.
Eng. Syst. Saf. 113, 61–75 (2013)
242 W. Ahmad and O. Hasan
11. Mhamdi, T., Hasan, O., Tahar, S.: On the formalization of the Lebesgue integration
theory in HOL. In: Kaufmann, M., Paulson, L.C. (eds.) ITP 2010. LNCS, vol. 6172,
pp. 387–402. Springer, Heidelberg (2010)
12. Ahmed, W., Hasan, O., Tahar, S., Hamdi, M.S.: Towards the formal reliability
analysis of oil and gas pipelines. In: Watt, S.M., Davenport, J.H., Sexton, A.P.,
Sojka, P., Urban, J. (eds.) CICM 2014. LNCS, vol. 8543, pp. 30–44. Springer,
Heidelberg (2014)
13. Ahmed, W., Hasan, O., Tahar, S.: Formal reliability analysis of wireless sensor
network data transport protocols using HOL. In: Wireless and Mobile Computing,
Networking and Communications, pp. 217–224. IEEE (2015)
14. Ahmed, W., Hasan, O.: Towards formal fault tree analysis using theorem proving.
In: Kerber, M., Carette, J., Kaliszyk, C., Rabe, F., Sorge, V. (eds.) CICM 2015.
LNCS, vol. 9150, pp. 39–54. Springer, Heidelberg (2015)
15. Gordon, M., Melham, T.: Introduction to HOL: A Theorem Proving Environment
for Higher-Order Logic. Cambridge Press, Cambridge (1993)
16. Mathematica (2008). www.wolfram.com
17. Harrison, J., Théry, L.: Extending the HOL theorem prover with a computer alge-
bra system to reason about the reals. In: Joyce, J.J., Seger, C.-J.H. (eds.) HUG
1993. LNCS, vol. 780, pp. 174–184. Springer, Heidelberg (1994)
18. Wu, H.C., Wang, C.J., Liu, P.: Reliability analysis of deployment mechanism of
solar arrays. Appl. Mech. Mater. 42, 139–142 (2011)
19. Wu, J., Yan, S., Xie, L.: Reliability analysis method of a solar array by using
fault tree analysis and fuzzy reasoning Petri net. Acta Astronaut. 69(11), 960–968
(2011)
20. Ebeling, C.E.: An Introduction to Reliability and Maintainability Engineering.
Tata McGraw-Hill Education, Maidenherd (2004)
21. Ahmed, W.: Formalization of Availability Block Diagram and Unavailability FT
(2016). http://save.seecs.nust.edu.pk/availability/
22. Liu, L.Y.: Formalization of discrete-time Markov chains in HOL. Ph.D. thesis,
Concordia University (2013)
Formal Verification of the rank Algorithm
for Succinct Data Structures
Succinct data structures are data structures designed to use an amount of com-
puter memory close to the information-theoretic lower bound in a time-efficient
way (see [18] for an introduction). They are used in particular to process big data.
Concretely, succinct data structures make it possible to provide data analysis
with a significantly reduced amount of memory (for example, one order of mag-
nitude less memory for string search facilities in [2]). Thanks to an important
amount of research, succinct data structures are now equipped with algorithms
that are often as efficient as their classical counterparts. In this paper, we are
concerned with the most basic one: the rank algorithm, which counts the number
of 1 (or 0) in the prefixes of a bitstring (for example, rank is one of the few basic
blocks in the implementation of [2]—see Appendix A of the technical report).
The salient property of the rank algorithm is that it requires o(n) storage for
constant-time execution where n is the length of the bitstring (see Sect. 2 for
background information).
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 243–260, 2016.
DOI: 10.1007/978-3-319-47846-3 16
244 A. Tanaka et al.
its storage requirements, Sect. 2.2). These points are addressed formally using
Coq resp. in Sects. 5.2 and 5.3.
n
input
bitstring 1001 0100 1110 0100 1101 0000 1111 0100 1001 1001 0100 0100 0101 0101 10
sz1 sz1 sz1
first-level
directory 7 15 21
sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2 sz2
second-level
directory 2 3 6 3 3 7 2 4 5 2 4
Fig. 1. Illustration for the rank algorithm (sz2 = 4, sz1 = 4 × sz2 , n = 58). Example
extended from [13].
246 A. Tanaka et al.
fixed-size integers, whose bit-size is large enough to represent the intended values,
so that the bit-size for each directory depends on n.
Let sz2 be the size of the substrings used for the second-level directory. Here-
after, we refer to these substrings as the “small blocks”. The size of the substrings
used for the first-level directory is sz1 = k × sz2 for some k. We refer to these
substrings as the “big blocks”. The first-level directory is precisely an array of
n/sz1 integers such that the ith integer is ranks ((i + 1) × sz1 ). The second-level
directory is also an array of integers. It has n/sz2 entries and is such that the
ith entry is the number of bits among the (i%k + 1) × sz2 bits starting from the
((i/k) × sz1 )th bit (/ is integer division and % is the remainder operation). One
can observe that when i%k = k − 1, the ith entry of the second-level directory
(the hatched rectangles in Fig. 1) can be computed from the first-level directory
and therefore does not need to be remembered.
Given an index i, Jacobson’s rank algorithm decomposes i such that ranks (i)
can be computed by adding the results of (1) one lookup into the first-level
directory, (2) one lookup into the second-level directory, and (3) direct com-
putation of rank for a substring shorter than sz2 . For example, in Fig. 1,
ranks (36) = ranks (2 × 16 + 1 × 4 + 0) is computed as 15 + 2 and ranks (58) =
ranks (3 × 16 + 2 × 4 + 2), as 21 + 4 + 1. Since the computation of rank for a
substring shorter than sz2 in (3) can also be tabulated or computed with a single
instruction on some platforms, rank’s computation is constant-time.
It can be shown (and we will do it formally in Sect. 5.3) that the directories
2 log2 n
require only logn n + 2n log
log2 n ∈ o(n) bits with integers of the appropriate size
2
(not necessarily the word size of the underlying architecture).
The generic version essentially consists of two functions: one that constructs the
directories and one that performs the lookup.
Formal Verification of the rank Algorithm for Succinct Data Structures 247
In the code below, we use notations from the Mathematical Components [7]
library: .+1 is the successor function, %/ and %% are the integer division and
modulo operators, and if x is xp.+1 then e1 else e2 means: if x is greater
than 0 then return e1 with xp bound to x − 1, else return e2.
1
The function bcount is not intended to be extracted as it is but replaced by a more
efficient function. It could be tabulated as explained in Sect. 2.2, but in this paper,
it will be replaced by a single gcc built-in operation (see Sect. 4.2).
248 A. Tanaka et al.
j1 (resp. j2) is the index of the block in the first-level directory (resp. second-
level directory). They are computed using the size of small blocks sz2 and the
ratio between the size of big and small blocks k (or in other words, sz1 = k *
sz2). lookupD1 (resp. lookupD2) is meant to perform array lookup; it will be
instantiated later.
However, code extracted from above functions does not achieve the desired
complexity. For example, the code extracted from bsize, bnth, and bcount
(Sect. 3.1) would be linear-time because these functions scan the lists obtained
from bits2 . Regarding memory usage, the list constructor cons would allocate
one memory block per argument (see Fig. 2, on the left, for an illustration).
In addition, OCaml needs one more word for each block to manage memory.
Assuming the machine word is 64 bits, cons would therefore need 192 bits to
represent a Coq bool, that was supposed to represent a single bit. . .
In the next section (Sect. 4.2), we provide OCaml definitions to replace the
Coq type bits, its constant bnil and the functions bsize, bnth, bappend, etc.
How the OCaml definitions are substituted for the Coq definitions is explained
in Sect. 6.1.
2
Let s be a bitstring of length n. bsize s is O(n), bnth i s is O(i), bcount b i l
s is O(i + l). bcount requires an additional O(i) because of the drop function (see
Sect. 3.1).
3
Currently, bytes is the same as string; OCaml plans to change string to
immutable.
4
The OCaml definitions below belong to the module Pbits; the prefix Pbits. is
omitted when no confusion is possible.
250 A. Tanaka et al.
len
b0 b1 b2 len b0 b1 b2 . . .
used
Fig. 2. A Coq bits on the left and the corresponding OCaml bits on the right
Bitstrings are stored in a bits buffer as a value of type bytes together with
the number of bits used so far. (The first bit is the least significant bit of the first
byte in the bytes.) Let us first explain the constructor for arbitrary-length bit-
strings (Bref) and then explain how short bitstrings are implemented as unboxed
integers (this will explain Bdummy0 and Bdummy1).
bits Represented with Bref. The data structure Bref(len, buf ) (depicted
on the right of Fig. 2) represents the prefix of size len of the bitstring buf . Let
us call used the value of the field used of the corresponding bits buffer data
structure.
The dynamics of Bref is as follows. Initially, a Bref has 0 as len and refer-
ences a bits buffer with used as 0, which means that the bitstring is empty.
When a bit is appended to the Bref, the bits buffer is destructively updated
and a new Bref is allocated. The bit is assigned to the usedth bit in data and
used is incremented. A new Bref is allocated with incremented len and reference
the bits buffer. (When the bits buffer is full (i.e., 8 × |data| = used ), data
is copied into a new bytes with a doubled length before the bit is appended.)
Array construction always append a bit to Bref which len is equal to used .
The constructor Bref can represent any bitstring but it requires memory
allocation for each value, even to represent an empty bitstring, a single boolean,
etc. We can improve efficiency by avoiding memory allocation for bitstring that
fit in machine words. Note that there is no soundness problem in losing sharing
of bitstrings, because bitstrings bits are immutable in Coq.
The reason for adding the constructors Bdummy0 and Bdummy1 to the datatype
bits is technical. Without them, OCaml optimizes pattern-matching (discrimi-
nation of values with match) if a datatype has no constant constructor (assum-
ing that the value must be a pointer), or if it has only one constant constructor
(assuming that any non-zero value must be a pointer). Adding two constant
constructors disables these optimizations, and allows us to safely use pattern-
matching to discriminate unboxed integers from Bref blocks.
OCaml Functions for Bitstrings. Using the OCaml bits datatype, we have
implemented OCaml functions that match the Coq functions of Sect. 4.1 but
with better complexities, as summarized in Table 1. For this purpose, we make
use of OCaml imperative features such as destructive update and random access
in bytes.
Table 1. Time complexity of OCaml functions w.r.t. their Coq counterparts (n and
n are the lengths of s and s’)
At the abstract level, the rank algorithm stores natural numbers in directo-
ries but a concrete implementation manipulates fixed-size integers instead. For
this reason, we extend our Coq formalization and OCaml implementation of
bitstrings with functions to manipulate fixed-size integers:
Table 2. Interface and implementation of the first-level directory using generic array
functions
Interface Implementation
D1Arr bits
emptyD1 : D1Arr bnil
pushD1 w1 s n : D1Arr bappend s (bword w1 n)
lookupD1 w1 i s : nat getword (i * w1) w1 s
252 A. Tanaka et al.
We instantiate the functions from Sect. 3.1 (rank lookup gen and
rank init gen) with the array of bits from Sect. 4.3. The parameters of this
instantiation (number and size of blocks in the directories, etc.) are important
because they need to be properly set to achieve the storage requirements speci-
fied in Sect. 2.2. For the sake of clarity, we isolate these parameters by means of
two datatypes. Record Param carries the parameters of Jacobson’s algorithm.
Record Aux essentially carries the results of the execution of the initialization
phase:
Formal Verification of the rank Algorithm for Succinct Data Structures 253
Similarly, rank lookup gen is instantiated with the parameters resulting from
the execution of rank init together with the functions D1Arr, D2Arr, etc. from
Sect. 4.3:
The many parameters D1Arr, D2Arr, etc. come from the array interface that we
implemented using the Section mechanism of Coq.
complexity. We use the following parameters. They are taken from [4, Sect. 2.2.1].
We add 1 to sz2 and k to make them strictly positive for all n ≥ 0.
k = log2 (n + 1) + 1 w1 = log2 (n/sz2 × sz2 + 1)
sz2 = log2 (n + 1) + 1 w2 = log2 ((k − 1) × sz2 + 1)
sz1 = k × sz2 = (log2 (n + 1) + 1)2
rank default param has been explained just above. rank param w neq0 is just
a technicality to take care of the uninteresting case where the length of input
bitstring is zero6 . The contribution of the first-level directory to space complex-
ity is the length of the bitstring that represents it, i.e., size (directories
(rank init b s)).1 (.1 stands for the first projection of a pair). In Coq, we
proved the following lemma about this length:
Extraction of Coq Lists. To replace inductive types and functions with cus-
tom OCaml code, we provide the following hints:
At line 1, we replace the Coq inductive type bits with the OCaml type
Pbits.bits defined in OCaml. Pbits.bseq and Pbits.bmatch are specified
to replace the constructor and pattern-matching expression which converts list
of booleans to Pbits.bits and vice versa. Pbits.bseq and Pbits.bmatch are
defined but our application doesn’t use them to avoid memory-inefficient list of
booleans.
From line 3, the constant and functions bnil, bsize, bnth, etc. from
Sect. 4.1 are replaced by Pbits.bnil, Pbits.bsize, Pbits.bnth etc. to be
explained in Sect. 4.2.
Extraction of the rank Algorithm. Because we used abstractions in Coq,
we must be careful about inlining at extraction-time to obtain OCaml code
as efficient as possible. In particular, we need to ensure that the function
parameters we have introduced for modularity using Coq’s Sections are
inlined. Concretely, we inline most function calls using the following Coq
command: Extraction Inline emptyD1 pushD1 lookupD1 ... . As a result,
rank lookup looks like an hand-written program, prefix notations aside. As for
the function buildDir in rank init, we obtain a tail-recursive OCaml func-
tion, like the one we wrote in Coq, so that it should use constant-size stack
independently of the input bitstring.
Since we obtain almost hand-written code, we can expect ocamlopt to pro-
vide us with all the usual optimizations. There are however specific issues
256 A. Tanaka et al.
due to Coq idiosyncrasies. For example, the pervasive usage of the successor
function .+1 for natural numbers is extracted to a call to the OCaml func-
tion Pervasives.succ that ocamlopt luckily turns into an integer increment.
(One can check which inlining ocamlopt has performed by using ocamlopt
-dclambda.) In contrast, anonymous function calls produced by extraction may
be responsible for inefficiencies. For example, the mapping from Coq nat to
OCaml int is defined as follows (file ExtrOcamlNatInt.v from the Coq stan-
dard library):
It is responsible for calls of the form (fun fO fS n -> ...) (fun -> E1)
(fun jp -> E2) that ocamlopt unfortunately cannot β-reduce.
Figure 3 shows the performance of a single lookup invocation for the rank func-
tion by measuring the time taken by rank lookup aux i for inputs up to
1000Mbit (recall that the input string s is part of aux). We make measure-
ments for 1000 values of the input size n. For each n, we make 10 measures for
i between 0 and n. The measurement order is randomized (n and i are picked
randomly).
2.5
6
time[ s]
time[ s]
2.0
1.5
4
1.0
2
0.5
0
0.0
Execution seems constant-time (0.83 µs on average) w.r.t. the input size. One
can observe that execution seems a bit faster for small inputs. We believe that
this is the effect of memory cache. One can also observe that the result is noisy.
We believe that this is because of memory cache with access patterns and some
instructions, such as IDIV (integer division), that use a variable number of clock
cycles [9].
Figure 4 shows the performance of initialization for the rank function by
measuring the time taken by rank init for inputs up to 1000 Mbit. We make
measurements for 1000 values of the input size. As expected, the result seems
linear. There are several small gaps, for input size 537 Mbit for example. This
happens because the parameters for Jacobson’s rank algorithm are changed at
Formal Verification of the rank Algorithm for Succinct Data Structures 257
this point: sz2 and k are changed from 30 bit to 31 bit, w1 is changed from 29 bit
to 30 bit. As a result, the size of the first-level directory decreases from 17.3 Mbit
to 16.8 Mbit and the second-level directory, from 179 Mbits to 174 Mbits, leading
to a shorter initialization time.
About the Correctness of OCaml Code. The OCaml part of the library
has not been formally proved, but it has been extensively tested for functional
correctness. We have implemented a test suite for the OCaml bitstring library
using OUnit [17]. Concretely, we test functions for bits by comparison with
list functions using random bitstrings. We also test the extracted rank function
by comparison with the rank function defined in specification like style, i.e.,
count mem b (drop i s). Since we plan to reuse this library for other func-
tions, it will endure even more testing. Formal verification of the OCaml part
would be interesting, but it seems difficult as of today, because we are relying
on unspecified features regarding optimization, Obj.magic, and C.
Our rank function is careful to use bitstrings in a linear way (i.e., it never
adds bits twice to the same bitstring), but the correctness of the OCaml bitstring
library does not rely on this fact. Whenever it detects repeated addition to a
shared buffer, which can be seen through a discrepancy between the used field
of the bits buffer and the len part of the Bref, it copies the first len bits to a
new buffer before adding the extra bits.
Formal verification of the Coq library may be used to further guarantee
the time-complexity properties of the OCaml library. For example, to achieve
linear-time construction of arrays with bappend (Sect. 4.2), bappend s s’ must
be called on s at most once. The approach that we are currently exploring to
ensure this property is to augment the rank function with an appropriate monad.
8 Conclusion
We discussed the verification of an OCaml implementation of the rank func-
tion for succinct data structures. We carried out formal verification in the Coq
proof-assistant, from which the implementation was automatically extracted.
We assessed not only functional correctness but also storage requirements, thus
ensuring that data structures are indeed succinct. To obtain efficient code, we
developed a new OCaml library for bitstrings whose interface match the Coq
lists used in formal verification. To the best of our knowledge, this is the first
application of formal verification to succinct data structures.
We believe that the libraries developed for the purpose of our experiment are
reusable: the OCaml library for bitstrings of course, the array interface for direc-
tories (that are used by other functions for succinct data structures), lemmas
developed for the purpose of formal specification of rank (as we saw in Sect. 5.2,
verification of functional correctness can be carried out at the abstract level). We
also discussed a number of issues regarding extraction from Coq to OCaml: the
interplay between inlining at extraction-time and by the OCaml compiler, the
soundness of code replacement at extraction-time, etc. Based on the results of
this paper, we are now tackling formal verification of rank’s counterpart function
select and plan to address more advanced algorithms.
Acknowledgments. The authors are grateful to the anonymous reviewers for their
helpful comments. This work is partially supported by a JSPS Grant-in-Aid for Scien-
tific Research (Project Number: 15K12013).
References
1. Affeldt, R., Marti, N.: An approach to formal verification of arithmetic functions
in assembly. In: Okada, M., Satoh, I. (eds.) ASIAN 2006. LNCS, vol. 4435, pp.
346–360. Springer, Heidelberg (2008)
2. Agarwal, R., Khandelwal, A., Stoica, I.: Succinct: enabling queries on compressed
data. In: NSDI 2015, pp. 337–350. USENIX Association (2015). Technical report:
http://people.eecs.berkeley.edu/∼rachit/succinct-techreport.pdf
3. Armand, M., Grégoire, B., Spiwack, A., Théry, L.: Extending Coq with imperative
features and its application to SAT verification. In: Kaufmann, M., Paulson, L.C.
(eds.) ITP 2010. LNCS, vol. 6172, pp. 83–98. Springer, Heidelberg (2010)
4. Clark, D.: Compact pat trees. Doctoral dissertation, University of Waterloo (1996)
5. The Coq Development Team: Reference Manual. Version 8.5. INRIA (2004–2016).
http://coq.inria.fr
6. Free Software Foundation: GCC 4.9.2 Manual (2014). http://gcc.gnu.org/
onlinedocs/gcc-4.9.2/gcc
7. Gonthier, G., Mahboubi, A., Tassi, E.: A small scale reflection extension for the
Coq system. Version 16. Technical report RR-6455, INRIA (2015)
8. Intel Advanced Vector Extensions Programming Reference, June 2011
9. Intel 64 and IA-32 Architectures Optimization Reference Manual, September 2015
10. Intel SSE4 Programming Reference, April 2007
11. Jacobson, G.: Succinct static data structures. Doctoral dissertation, Carnegie
Mellon University (1988)
260 A. Tanaka et al.
1 Introduction
Concurrent objects provide operations that can be executed simultaneously by
multiple threads, and provide a layer of abstraction to programmers by managing
thread synchronisation on behalf of client programs, which in turn improves
safety and efficiency. Correctness of concurrent objects is usually defined in terms
of the possible histories of invocation and response events generated by executing
the operations of a sequential specification object. There are several notions of
safety for concurrent objects [7,12]: sequential consistency, linearizability, and
quiescent consistency being the most widely used. Similarly, there are many
different notions of progress [12,13], e.g., wait-, lock- and obstruction-freedom
are popular non-blocking conditions.
Both safety and progress properties are stated in terms of a concurrent object
in isolation, and disregard their context, i.e., the client programs that use them.
Programmers (i.e., client developers) have therefore relied on informal “folk the-
orems” to link correctness conditions on concurrent objects and substitutability
of objects within client programs. We seek to provide a formal account of this
relationship, addressing the question: “Provided concurrent object OC is correct
with respect to sequential object OA, how are the behaviours of C[OA] related
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 261–278, 2016.
DOI: 10.1007/978-3-319-47846-3 17
262 B. Dongol and L. Groves
to those of C[OC ]?”, where C[O] denotes a client program C that uses object
O, for different notions of correctness. One of the first answers to this ques-
tion was given by abstraction theorems [9], linking safety properties: sequential
consistency and linearizability to a contextual notion of correctness called obser-
vational refinement, which defines substitutability with respect to the initial
and final state of a system’s execution. For terminating clients, linearizability is
shown to be equivalent to observational refinement, while sequential consistency
is shown to be equivalent to observational refinement provided that clients do
not communicate outside the given objects.
Since non-termination is common in many concurrent systems, e.g., oper-
ating systems and real-time controllers, our work aims to understand the
link between concurrent correctness and substitutability for potentially non-
terminating clients. Related to this aim is the work of Gotsman and Yang [10] and
Liang et al. [15], who link observational refinement to safety and progress prop-
erties of concurrent objects. However, both [10,15] assume that the concurrent
objects in question are already linearizable; in contrast, we do not assume lin-
earizability. Further, [10] aims to understand compositionality of progress prop-
erties, while [15] develops characterisations of progress properties based on their
observational guarantees.
The motivation for our work differs from [10,15] in that we take contextual
trace refinement as the underlying correctness condition when substituting OC
for OA in C, then aim to understand the safety/progress properties on OC
that are required to guarantee trace refinement between C[OA] and C[OC ]. To
this end, we develop an action systems framework that integrates and extends
existing work [1,18] from the literature, building on our preliminary results on
this topic [8]. As part of our contributions we (i) extend Sere and Waldén’s
treatment of action systems with procedures [18] with non-atomic procedures;
(ii) develop a theory for contextual trace refinement, adapting Back and von
Wright’s [1] theory for trace refinement of action systems, then reduce system-
wide proof obligations (i.e., properties of the client and object together) to proof
obligations on the objects only; (iii) show that linearizability [14] and minimal
progress [13] together are sufficient to guarantee contextual trace refinement;
and (iv) show that both sequential consistency and quiescent consistency are
too weak to ensure contextual trace refinement, even in the presence of minimal
progress.
the following client program consists of threads 1 and 2 using a shared stack s,
and variables x, y and z.
Init x , y , z = 0 , 0 , 0
Thread 1: Thread 2:
T1 : s . push (1); U1 : s . pop ( y );
T2 : s . push (2); U2 : z := x ;
T3 : s . pop ( x );
Thread 1 pushes 1 then 2 onto the stack s, then pops the top element of s and
stores it in x. Concurrently, thread 2 pops the top element of s and stores it in
y, then reads the value of x and stores it in z.
The abstract behaviour of a stack is defined in terms of a sequential object, as
shown in Fig. 1. The abstract stack consists of a sequence of elements S together
with two operations push and pop (‘’ and ‘’ delimit sequences, ‘ ’ denotes the
empty sequence, and ‘’ denotes sequence concatenation). Note that when the
stack is empty, pop returns a special value empty that cannot be pushed onto
the stack.
If concurrent objects are implemented using fine-grained concurrency, the
call statements in their clients are not necessarily atomic because they may
invoke non-atomic operations. Furthermore, depending on the implementation
of s, we will get different traces of the client program because the effects of the
concurrent operations on s may take effect in different orders. For example, Fig. 2
presents a simplified version of a non-blocking stack example due to Treiber [19].
In this implementation, each line of the push and pop corresponds to a single
atomic step. Synchronisation of push and pop operations is achieved using a
compare-and-swap (CAS) instruction, which takes as input a (shared) variable
gv, an expected value lv and a new value nv:
We say that TS contextually trace refines AS with respect to the client program
C iff every trace of C[TS ] is a possible trace of C[AS ]. In this paper, we wish
to know whether contextual refinement holds for every client program. To this
end, we say TS contextually trace refines AS iff TS contextually trace refines
AS with respect to every client program C.
The action system resulting from using the Treiber stack (which we will refer to
as TS ) as the shared concurrent object in Sect. 2.1 is D[TS ]. It is similar to the
action system in Example 2, except that the unobservable variables are Nodes
(the set of all available nodes), Head (a pointer to a node, or null ), val (a partial
function of type Nodes → Val ), next (a partial function of type Nodes → Node);
the procedure declarations above are used; and initialisation of the object is
Nodes, Head , val , next := N, null , ∅, ∅. 2
We now make the concept of an object and the notation C[O] for an object
O and client C more precise. An object is a triple O = (L, P , I ), where L is a
set of variables, P = {ph1,t = P1,t , . . . , phn,t = Pn,t } is a set of (potentially
parameterised) procedure declarations, and I is an initialisation action. A client
is a triple C =
(G, A, J ), where G is a set of variables, and A and J are the main
and initialisation actions, respectively. Then C[O] is the action system
|[ varu L; varo G; proc ph1,t = P1,t . . . proc phn,t = Pn,t ; I ; J ; do A od ]|.
The next section formalises the semantics of action systems and defines our
notion of contextual trace refinement for it.
268 B. Dongol and L. Groves
the abstract, one must remove stuttering from a trace. An action system may
also exhibit infinite stuttering by generating a trace that ends with an infi-
nite sequence of consecutive stuttering steps. After infinite stuttering, one will
never be able to observe any state changes, and hence, we treat infinite stut-
tering as divergence, which is denoted by a special symbol ‘↑ ∈ Σ’. For any
trace s ∈ A , we define Tr .s to be the non-stuttering observable sequence
of states, possibly followed by ↑, which is obtained from s as follows. First,
we obtain a sequence s by removing all finite stuttering in s and replac-
ing any infinite stuttering in s by ↑. Second, for each i ∈ dom(s ), we let
(Tr .s ).i = if s .i = ↑ then VarU −
s .i else ↑. It is straightforward to define
functions that formalise both the steps above (see for example [6]).
Definition 3. Abstract action system A is trace refined by concrete action sys-
tem C (denoted A C ) iff ∀ s ∈ C • ∃ s ∈ A • Tr .s = Tr .s holds.
Back and von Wright have developed simulation rules (details elided due to lack
of space) for verifying trace refinement of action systems [1], which we adapt to
reason about client-object systems in Lemmas 1 and 2. First, we formalise the
meaning of contextual trace refinement. The notion is similar to the notion of
data refinement given by He et al. [3,11], but extended to traces, which enables
one to cope with non-terminating reactive systems.
Definition 4. An abstract object OA is contextually trace refined by a concrete
OC , iff for any client C we have C[OA] C[OC ].
object OC , denoted OA
In this paper, for simplicity, we assume that (atomic) actions do not abort [3],
therefore the proof obligations for aborting actions do not appear in Lemmas 1
and 2 below – it is straightforward to extend our results to take aborting behav-
iour into account. However, like Back and von Wright [1], our notion of refine-
ment ensures total correctness of the systems we develop, i.e., the concrete system
may only deadlock (or diverge) if the abstract system deadlocks (or diverges).
Thus, in addition to the standard step correspondence proof obligations for
ensuring safety of the concrete system, we include Back and von Wright’s proof
obligations that ensure progress.
Because the entire state of the client is observable, the proof obligations
pertaining to the client can be trivially discharged, leaving one with proof oblig-
ations that only refer to the object. For procedure declarations P = {ph1,t =
P1,t , . . . , phn,t = Pn,t }, we let tact.v .x .t.P =
p1,t (v , x ) · · · pn,t (v , x ) denote
the choice between procedures in P for inputs v and x and thread t then define:
act.P = v ,x ,t tact.v .x .t.P rem.P = v ,x ,t dec.pc t → tact.v .x .t.P
To simplify the syntax, we implicitly assume that in tact.v .x .t.P the inputs
v and x are of the correct type for each procedure. Guard dec.pc t is used to
detect whether the procedure being executed by thread t has terminated — if
t will hold and when this
t is executing a procedure, say phi,t , we know dec.pc
procedure terminates ¬dec.pc t will hold, which disables thread t. The intention
is to use rem.P in (4) below, which attempts to execute the remaining steps of
the running operations by each thread to completion.
270 B. Dongol and L. Groves
The first three proof obligations are straightforward. Proof obligation (4) requires
that the main action of the concrete object OC terminates if threads do not
invoke new operations after the operation currently being executed has termi-
nated. Note that (4) does not rule out infinite stuttering within the program
C[OC ], but it does ensure that any infinite stuttering is caused by the client
as opposed to the object OC , and hence, this infinite stuttering must also be
present within C[OA]. Therefore, if (4) holds, so does Back and von Wright’s
non-termination condition.
Dually to forward simulation, there exists a method of backward simulation,
which requires that the abstract action system under consideration is continuous.
An action system A with main action A is continuous iff for all σ, the set
{σ | rel .A.σ.σ } is finite, i.e., A does not exhibit infinite non-determinism.
Lemmas 1 and 2 reduce the proof obligations for trace refinement of client-object
systems to the level of objects only. This allows one to explore properties of
objects in isolation to guarantee contextual trace refinement.
that has no input (output). Thus, for example, inv (1, push, 2) denotes an push
invocation by thread 1 with value 2, and ret(1, push, ⊥) denotes a return from
this invocation.
The history of an object is a (potentially infinite) sequence of events, i.e.,
History = seq Event. A history of an object is generated by an execution of a
most-general client for the object [5]. We formalise the concept of a most general
client in our framework in Definition 5 below, but first we describe how invoca-
tions and responses are recorded in a history. For an object O = (L, {ph1,t =
H
P1,t , . . . , phn,t = Pn,t }, I ) assuming H ∈ L is a history variable, we let Pi,t
be the history-extended procedure derived from Pi,t by additionally recording
invocation and response events in H (also see [4]).
Example 4. The history-extended procedure for pusht from Example 2 is:
H := H inv (t, push, in); S := in S ; H := H ret(t, push, ⊥)
while the history-extended version of pusht procedure from Example 3 is:
¬ dec.pc
t → var pc
t , vt , nt , sst ; vt := in;
H := H inv (t, push, in); pc t := H 1
...
t = H 6 → H := H ret(t, push, ⊥); rav pc
pc t , vt , nt , sst
2
Definition 5. The most general client of O = (L, {ph1,t = P1,t , . . . , phn,t =
Pn,t }, I ) is the action system M[O] below, where H ∈ L is its history, tt ∈ L is a
fresh variable that models termination and P H = H
{ph1,t = P1,t H
. . . phn,t = Pn,t }
is the set of history extended procedures:
|[ varu L ∪ {H , tt}; varo VarO ;
M[O] =
H H
proc ph1,t = P1,t . . . proc phn,t = Pn,t ;
I ; H := ; tt := false ;
do ¬tt → act.P H ( w :VO ,a:Val w := a) tt := true od ]|
That is, for any trace s of M[O] and index i ∈ dom(s) there is a state s.j (where
j i ) from which some pending operation in s.j completes. There are a variety
of objects that satisfy minimal progress, e.g., wait-, lock-free objects under any
scheduler, and obstruction-free objects under isolating schedulers (see [13] for
details). Objects that do not satisfy minimal progress include obstruction free
implementations that are executed using a weakly fair scheduler.
The lemma below states that any object that satisfies minimal progress does
not suffer from deadlock, and is guaranteed to terminate if no additional opera-
tions are invoked.
Lemma 3. If O = (L, P , I ) satisfies minimal progress, then for any γ ∈ M[O]
and i ∈ dom(γ), both grd .(act.P ).(γ.i ) and condition (4) hold.
Using Lemma 3, we simplify and combine Lemmas 1 and 2. In particular, we are
left with the proof obligations for safety only as in the theorem below.
When formalising correctness conditions, one must also consider incomplete his-
tories, which have pending operation invocations that may or may not have taken
effect. To cope with these, like Herlihy and Wing [14], we use history extensions,
which are constructed from a history h by concatenating a sequence of returns
corresponding to some of the pending invocations of h. A correctness condition
Z is a predicate on a history and a mapping function.
Definition 8. A concurrent object OC implementing an abstract object OA is
correct with respect to a correctness condition Z , denoted OC |=OA Z , iff for
any history h of OC , there exists an extension he of h, a valid mapping function
f such that VMF (he, f ) ∧ Z (he, f ) holds and map(he, f ) is a history of OA.
7.1 Linearizability
We now show that linearizability is a sufficient safety condition for discharging
the proof obligations in Theorem 1. Linearizability is a total condition, which
means that all completed (i.e., returned) operation calls in a given history h must
be mapped by f .1 In addition, it must satisfy an order condition lin, which states
that the return of an operation may not be reordered with an invocation that
occurs after it. We use inv ?(e) = ∃ t, o, v • e = inv (t, o, v ) if e is an invocation
event and ret?(e) = ∃ t, o, v • e = ret(t, o, v ) if e is a response.
∀ m : dom(h) • ¬pi (m, h) ⇒ m ∈ dom(f )
total (h, f ) =
lin(h, f ) = ∀ m, n : dom(f ) • m < n ∧ ret?(h.m) ∧ inv ?(h.n) ⇒ f .m < f .n
Definition 10. For an abstract procedure pht (val in, res out) = Pt , the canon-
ical implementation of the procedure is:
t → var pc
¬dec.pc t := 1; H inv (t, p, in)
t ; pc
t = 1 → pht (in, out); pc
pc t := 2
t = 2 → rav pc
pc t ; H ret(t, p, out)
Invocation and response actions modify the auxiliary history variable by record-
ing the corresponding event, while the effect action has the same effect as the
abstract operation call. Unlike the abstract object, the histories of a canonical
implementation are potentially concurrent.
Theorem 2 (Canonical Contextual Trace Refinement). Suppose OA and
OB are objects, where OB is a canonical implementation of OA. Then OA OB .
Proof. We use Lemma 1 because OB may not satisfy minimal progress. Here,
rel .act.OB trivially satisfies (4) because by nature each procedure of a canon-
ical object terminates. The proof of (3) requires further consideration because
rel .act.OB may deadlock. For example, OB may be a stack with a pop operation
that blocks when the stack is empty. In such cases, because no data refinement
is performed, the guard of the canonical object is false when the guard of the
abstract object is false, allowing one to discharge (3). The remaining proof oblig-
ations are straightforward. 2
Next, we restate a completeness result by Schellhorn et al. [17], who have shown
completeness of backward simulation for verifying linearizability. In particular,
provided OC is a linearizable implementation of OA, they show that it is always
possible to construct a backward simulation relation between the OC and the
canonical implementation of OA.
Lemma 4 (Completeness of Backward Simulation [17]). Suppose
OA, OB and OC are objects and M[OA] is continuous. If OC |=OA lin ∧ total
and OB is a canonical implementation of OA, then there exists a total relation
R such that both (5) and (6) hold between M[OB ] and M[OC ].
Finally, we prove our main result for linearizability, i.e., that linearizability and
minimal progress together preserves contextual trace refinement.
Theorem 3. Suppose object OC is linearizable with respect to OA, OC satisfies
minimal progress, and M[OA] is continuous. If C is a client such that C[OA] is
continuous then C[OA] C[OC ].
Proof. Construct a canonical implementation OB of OA. By transitivity of ,
the proof holds if both (a) C[OA] C[OB ] and (b) C[OB ] C[OC ]. Condition (a)
holds by Theorem 2, and (b) holds by Theorem 1 (part 2), followed by Lemma 4.
Application of Theorem 1 (part 2) is allowed because if C[OA] is continuous then
C[OB ] is continuous, whereas application of Lemma 4 is allowed because if R
satisfies (5) and (6) for M[OB ] and M[OC ], then R also satisfies (5) and (6)
for C[OB ] and C[OC ]. 2
Contextual Trace Refinement for Concurrent Objects: Safety and Progress 275
We now consider contextual trace refinement for concurrent objects that satisfy
sequential consistency and quiescent consistency, both of which are weaker than
linearizability. Both conditions are total [7]. Additionally, sequential consistency
disallows reordering of operation calls within a thread (see sc below), while
quiescent consistency (see qc below) disallows reordering across a quiescent point
(defined by qp below).
Our results for sequential consistency and quiescent consistency are nega-
tive — neither condition guarantees trace refinement of the underlying clients,
regardless of whether the client program in question is data independent, i.e., the
state spaces of the client threads outside the shared object are pairwise disjoint.
Proof. Consider the program in Fig. 3, where the client threads are data inde-
pendent — x is local to thread 1, while y and z are local to thread 2 — and s
is assumed to be sequentially consistent. Suppose thread 1 is executed to com-
pletion, and then thread 2 is executed to completion. Because s is sequentially
consistent, the first pop (at T3) may set x to 1, the second (at U2) may set y to
2. This gives the execution:
(x , y, z ) → (0, 0, 0), (x , y, z ) → (1, 0, 0), (x , y, z ) → (1, 0, 1), (x , y, z ) → (1, 2, 1)
that cannot be generated when using the abstract stack AS from Fig. 1 for s. 2
Theorem 4 differs from the results of Filipović et al. [9], who show that for data
independent clients, sequential consistency implies observational refinement. In
essence, their result holds because observational refinement only considers the
initial and final states of a client program — the intermediate states of a client’s
execution are ignored. Thus, internal reorderings due to sequentially consistent
objects have no effect when only observing pre/post states. One can develop
hiding conditions so that observational refinement becomes a special case of
contextual trace refinement, allowing one to obtain the result by Filipović et al.
[9]. Further development of this theory is left for future work. We now give our
result for quiescent consistency.
276 B. Dongol and L. Groves
Note that the pop operations at T3 and T4 have been reordered, which could
happen if the execution of pop at U 1 overlaps with T1, T2, T3 and T4. The trace
above is not possible when the client uses the abstract stack AS from Fig. 1. 2
8 Conclusions
In this paper, we have developed a framework, based on action systems with
procedures, for studying the link between the correctness conditions for concur-
rent objects and contextual trace refinement, which guarantees substitutability
of objects within potentially non-terminating reactive clients. Thus, we bring
together the previously disconnected worlds of correctness for concurrent objects
and trace refinement within action systems. We have shown that linearizability
and minimal progress together ensure contextual trace refinement, but sequen-
tial consistency and quiescent consistency are inadequate for guaranteeing con-
textual trace refinement regardless of whether clients communicate outside the
concurrent object. The sequential consistency result contrasts earlier results for
observational refinement, where sequential consistency is adequate when clients
only communicate through shared objects [9].
We have derived the sufficient conditions for contextual trace refinement
using the proof obligations for forwards and backward simulation. However,
neither of these conditions have been shown to be necessary, leaving open the
possibility of using weaker correctness conditions on the underlying concurrent
objects. Studying this relationship remains part of future work — areas of inter-
est include the study of how the correctness conditions for safety of concurrent
Contextual Trace Refinement for Concurrent Objects: Safety and Progress 277
objects under relaxed memory models [7] can be combined with different sched-
uler implementations for progress (e.g., extending [13,15]) to ensure contextual
trace refinement.
Acknowledgements. We thank John Derrick and Graeme Smith for helpful discus-
sions. Brijesh Dongol is supported by EPSRC grant EP/N016661/1. “Verifiably correct
high-performance concurrency libraries for multi-core computing systems”.
References
1. Back, R.J.R., Wright, J.: Trace refinement of action systems. In: Jonsson,
B., Parrow, J. (eds.) CONCUR 1994. LNCS, vol. 836, pp. 367–384. Springer,
Heidelberg (1994). doi:10.1007/978-3-540-48654-1 28
2. Colvin, R., Doherty, S., Groves, L.: Verifying concurrent data structures by simu-
lation. Electr. Notes Theor. Comput. Sci. 137(2), 93–110 (2005)
3. de Roever, W.P., Engelhardt, K.: Data Refinement: Model-Oriented Proof Meth-
ods and Their Comparison. Cambridge Tracts in Theoretical Computer Science.
Cambridge Univ. Press, Cambridge (1996)
4. Derrick, J., Schellhorn, G., Wehrheim, H.: Mechanically verified proof obligations
for linearizability. ACM Trans. Program. Lang. Syst. 33(1), 4 (2011)
5. Doherty, S.: Modelling and verifying non-blocking algorithms that use dynamically
allocated memory. Master’s thesis, Victoria University of Wellington (2003)
6. Dongol, B.: Progress-based verification and derivation of concurrent programs.
Ph.D. thesis, The University of Queensland (2009)
7. Dongol, B., Derrick, J., Smith, G., Groves, L.: Defining correctness conditions for
concurrent objects in multicore architectures. In: Boyland, J.T. (ed.) ECOOP.
LIPIcs, vol. 37, pp. 470–494. Dagstuhl (2015)
8. Dongol, B., Groves, L.: Towards linking correctness conditions for concurrent
objects and contextual trace refinement. In: REFINE Workshop (2015 to appear)
9. Filipović, I., O’Hearn, P.W., Rinetzky, N., Yang, H.: Abstraction for concurrent
objects. Theor. Comput. Sci. 411(51–52), 4379–4398 (2010)
10. Gotsman, A., Yang, H.: Liveness-preserving atomicity abstraction. In: Aceto, L.,
Henzinger, M., Sgall, J. (eds.) ICALP 2011. LNCS, vol. 6756, pp. 453–465. Springer,
Heidelberg (2011). doi:10.1007/978-3-642-22012-8 36
11. He, J., Hoare, C.A.R.: Data refinement refined resume. In: Robinet, B.,
Wilhelm, R. (eds.) ESOP 86. LNCS, vol. 213, pp. 187–196. Springer, Heidelberg
(1986)
12. Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming. Morg. Kauf.,
Burlington (2008)
13. Herlihy, M., Shavit, N.: On the nature of progress. In: Fernàndez Anta, A.,
Lipari, G., Roy, M. (eds.) OPODIS 2011. LNCS, vol. 7109, pp. 313–328. Springer,
Heidelberg (2011). doi:10.1007/978-3-642-25873-2 22
14. Herlihy, M.P., Wing, J.M.: Linearizability: a correctness condition for concurrent
objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990)
15. Liang, H., Hoffmann, J., Feng, X., Shao, Z.: Characterizing progress properties of
concurrent objects via contextual refinements. In: D’Argenio, P.R., Melgratti, H.
(eds.) CONCUR 2013. LNCS, vol. 8052, pp. 227–241. Springer, Heidelberg (2013).
doi:10.1007/978-3-642-40184-8 17
16. Lynch, N.A.: Distributed Algorithms. Morgan Kaufmann, Burlington (1996)
278 B. Dongol and L. Groves
17. Schellhorn, G., Derrick, J., Wehrheim, H.: A sound and complete proof technique
for linearizability of concurrent data structures. ACM TOCL 15(4), 31:1–31:37
(2014)
18. Sere, K., Waldén, M.A.: Data refinement of remote procedures. Formal Asp. Com-
put. 12(4), 278–297 (2000)
19. Treiber, R.K.: Systems programming: coping with parallelism. Technical report RJ
5118, IBM Almaden Res. Ctr. (1986)
Local Livelock Analysis of Component-Based
Models
1 Introduction
Component-based System Development (CBSD) has been used to deal with the
increasing complexity of software. It focuses on the construction of systems from
reusable and independent components [1]. Its correct application, however, relies
on the trust in the behaviour of the components and in the emergent behaviour
of the composed components because failures may arise if the composition does
not preserve essential properties, especially in concurrent systems.
In [9], we have proposed a systematic design of CBSD that integrates compo-
nents via asynchronous compositions, mediated by buffers, considering a grey-
box style of composition [2], in which services that cannot be accessed by
other components remain visible to the environment. This strategy is based
on safe composition rules that guarantee, by construction, deadlock freedom.
The absence of livelock is trivially ensured since the basic components are, by
definition, livelock-free, and no operator that may introduce such a behaviour
is used. The approach is underpinned by the process algebra CSP [4,10], a well
established formal notation for modelling and verifying concurrent systems. We
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 279–295, 2016.
DOI: 10.1007/978-3-319-47846-3 18
280 M.S.C. Filho et al.
2 CSP
CSP is one of the most important formalisms for modelling and verifying concur-
rent reactive systems. This process algebra can be used to describe systems as
interacting components: independent entities called processes that interact with
Local Livelock Analysis of Component-Based Models 281
datatype EV = up | down
datatype LF = thinks | eats
channel fk 1, fk 2, pfk 1, pfk 2 : EV
channel life : LF
Fork = (fk 1.up → fk 1.down → Fork ) 2 (fk 2.up → fk 2.down → Fork )
Phil = life.thinks → pfk 1.up → pfk 2.up → life.eats →
pfk 1.down → pfk 2.down → Phil
The process Fork ensures that two philosophers cannot hold a fork simulta-
neously. It offers a deterministic choice between the events fk 1.up and fk 2.up,
where fk 1 and fk 2 are channels of type EV . The process Phil represents the life
cycle of a philosopher: before eating, the philosopher thinks and picks the forks
up. After eating, the philosopher puts the forks down.
There are three well-established semantic models of CSP: traces (T ), stable
failures (F), and failures-divergences (FD) [10]. The set traces(P ) contains all
282 M.S.C. Filho et al.
possible sequences of events in which P can engage. The set failures(P ) contains
all the failures of P , that is, pairs (s, X ), where s is a trace of P and X is a set
of events which P may refuse after performing s. The failures-divergences is the
most satisfactory model for analysing liveness properties of a CSP process. In
FD, a process P is represented by the pair (failures⊥ (P ), divergences(P )). The
set failures⊥ (P ) contains all failures of P , and additional failures that record
that P can refuse anything after diverging. The set divergences(P ) contains all
traces of P that lead it to a divergent behaviour and all extensions of those
traces. A process P is divergence-free if, and only if, divergences(P ) = ∅.
3 BRIC
The BRIC component model [9] has been originally proposed to ensure, by con-
struction, the absence of deadlock. It is an algebra that has contracts as operands
and composition rules as operators. A component contract, whose definition is
presented below, is a tuple and encapsulates a component in BRIC.
We use BCtr , RCtr , ICtr and CCtr to denote the elements of the contract Ctr .
The behaviour BCtr is represented by an I/O process, which is defined as follows,
where we use αP to denote the set of events that P can communicate.
All channels of an I/O process are either input or output channels. I/O processes
are also non-terminating processes but, for practical purposes in model checking,
they have finite state spaces, and are divergence free. Input determinism and
strong output decisiveness are not relevant in the context of livelock analysis.
For this reason, we omit their formal definitions, which can be found in [8].
We illustrate the compositional development of BRIC with the construction
of an asymmetric dining table with 2 philosophers and 2 forks. The behaviour of
each philosopher and each fork is represented as a process Phili or Forki , where
i ∈ {1, 2}. The channels fk , pfk , both of type ID.ID.EV , and lf of type ID.LF ,
Local Livelock Analysis of Component-Based Models 283
where ID : {1, 2}, distinguish each philosopher and each fork, whose behaviours
are described as an instantiation of Phil and Fork described in Sect. 2.
As all forks and philosophers are represented by one process with indices on its
channels, there is a separate definition for each component contract. For example,
the contracts CtrFork1 and CtrPhil1 are:
The contract CtrFork1 has a behaviour defined by Fork1 , and two channels: fk .1.1
and fk .1.2, both of type EV . The behaviour of the contract CtrPhil1 is Phil1 . This
contract has three channels, lf .1 of type LF , and pfk .1.1 and pfk .2.1 of type EV .
In BRIC, we have two types of component composition: binary composition
and unary composition. The former is defined below. It provides an asynchronous
interaction on channels ic and oc between two contracts Ctr1 and Ctr2 mediated
by a (possibly infinite) bi-directional buffer (BUFFIO ).
Definition 3 (Asynchronous Binary Composition). Let Ctr1 and Ctr2 be
two distinct component contracts with disjoint sets of channels (CCtr1 ∩ CCtr2 =
∅), and ic and oc be channels within CCtr1 and CCtr2 , respectively. The asynchro-
nous binary composition of Ctr1 and Ctr2 is given by:
Ctr1ic oc Ctr2 = ((BCtr1 ||| BCtr2 ) {|ic,oc|} BUFFIO ), RCtr3 , ICtr3 , CCtr3
where CCtr3 = (CCtr1 ∪ CCtr2 ) \ {ic, oc}, RCtr3 = CCtr3 (RCtr1 ∪ RCtr2 ), and
ICtr3 = ran(RCtr3 ).
The behaviour of a binary composition is defined as the synchronisation of the
behaviour of Ctr1 and Ctr2 via a (possibly infinite) bi-directional buffer. The
channels used in the composition are not offered to the environment in further
compositions (CCtr3 ). The operator stands for domain restriction and is used
to restrict the mapping from channels to interfaces (RCtr3 ) and, furthermore, to
restrict the set of interfaces of the resulting contract (ICtr3 ).
Unary compositions are used to assemble channels of a single component Ctr .
where CCtr = (CCtr \ {ic, oc}), RCtr = CCtr RCtr , and ICtr = ran RCtr .
284 M.S.C. Filho et al.
The proviso of strong compatibility ensures that the outputs of each process
are always accepted by the other process. Formally, considering that IPs and OPs
denote the inputs and outputs of a process P after a trace s, respectively, P and
Q are strong compatible if, and only if:
In our example, we are able to compose the contracts Forks and Phils using
the communication composition: PComm = Forks[fk .1.1 ↔ pfk .1.1]Phils. The
resulting contract includes all philosophers and forks. The remaining connec-
tions that are needed to complete the dining table require the connection of two
channels of the same component. For this reason, BRIC also provides unary
compositions that can be used for such connections and enables the construc-
tion of systems with cyclic topologies. Due to the existence of possible cycles,
however, new conditions are required to preserve deadlock freedom.
The unary composition rules are feedback and reflexive. The feedback com-
position represents the simpler unary composition case, where two channels of
the same component are assembled, but do not introduce a new cycle [9]. The
requirement on the independence of the channels guarantees that no cycles are
introduced. A channel c1 is independent of a channel c2 in a process when any
communication on c1 does not interfere with the communications on c2 , and
vice-versa; hence, both channels are independently offered to the environment.
Local Livelock Analysis of Component-Based Models 285
The contract PComm contains all forks and philosophers. The channels fk .2.2
and pfk .1.2, however, are independent in PComm because they occur in the
interleaved sub-components Forks and Phils, respectively. We may, therefore,
connect these channels using feedback: PFeed1 = PComm[pfk .1.2 → fk .2.2].
The channels fk .2.1 and pfk .2.1 are also independent in PFeed1 . Intuitively, their
connection do not introduce a cycle; we may, therefore, connect these channels
using the feedback composition: PFeed2 = PFeed1 [pfk .2.1 → fk .2.1].
The reflexive composition deals with more complex compositions that intro-
duce cycles of dependencies in the topology of the system structure, some of
which may be undesirable because they introduce divergence.
Definition 8 (Reflexive Composition). Let Ctr be a component contract,
and ic and oc two communication channels from CCtr such that BCtr {ic, oc}
is buffering self-injection compatible. The reflexive composition is defined as
ic
¯ oc] = Ctr oc .
Ctr [ic →
The definition of the reflexive composition is similar to that of the feedback
composition. It, however, has a stronger proviso that requires buffering self-
injection compatibility, which allows one to assembly two dependent channels of
a process via a buffer, without introducing deadlocks. This property is similar to
the notion of strong compatibility, except for the fact that two distinct channels
of the same process must be compatible. Its formalisation can be found in [8].
In our example, we conclude the design of our system using the reflexive
composition to connect channels fk .1.2 and pfk .2.2.
This connection could not be achieved using feedback because the two channels
are not independent in PFeed2 . Intuitively, their connection introduces a cycle
that causes the dependence between these channels.
In what follows, we present the definitions used in our livelock analysis technique
and describe the local conditions that guarantee livelock-free BRIC compositions
at the component contract level. We make a clear distinction of asynchronous
compositions via finite and infinite buffers because the finiteness of the buffer
is relevant for detecting the possibility of livelock in asynchronous systems. We
consider BRIC ∗ , which achieves asynchronous compositions via finite buffers,
and BRIC ∞ , in which asynchronicity is achieved using infinite buffers.
Here, Σ ∗ is the set of finite sequences of elements of Σ, seq(Σ ∗ ) is the set of finite
sequences over Σ ∗ , / ss is the distributed concatenation of all the elements of
the sequence of sequences ss, and ran(ss) is the set of the elements of ss.
The set of Minimal Interaction Patterns of a process P , MIP (P ), is the
minimal set from which we are able to generate the same traces that can be
generated from IP (P ). Formally, it is a subset of any other subset of interaction
patterns S of IP (P ), such that S ◦ = IP (P ).
MIPN (N ) = {}
MIPN (SKIP ) = MIPN (STOP ) = {}
MIPN (c → W1 ) = {t : MIPN (W1 ); e : {| c |} • e t}
MIPN (W1 2 W2 ) = MIPN (W1 W2 ) = MIPN (W1 ) ∪ MIPN (W2 )
MIPN (W1 [[R]]) = {t : MIPN (W1 ) • ren(t, R)}
t1 : traces(W1 ); t2 : MIPN (W2 ) | last(t1 ) =
MIPN (W1 ; W2 ) =
• front(t1 ) t2
MIPN (g & W1 ) = MIPN (W1 )
MIPN (if g then W1 else W2 ) = MIPN (W1 ) ∪ MIPN (W2 )
The sequence front(t) contains all elements of the sequence t but the last one,
last(t) returns the last element of t, and the function ren(t, R), presented below,
applies the renaming relation on events R to the trace t. For functional renaming,
this function returns a singleton set that contains a trace that corresponds to
t but replaces every element in the domain of the renaming function by its
image. However, relational renaming needs special care because it may turn
simple prefixing into an external choice. By way of illustration, for P = a → P ,
P [[a ← b, a ← c]] = a → P 2 c → P . For this reason, the function
ren presented
below returns a set of traces and we need a distributed union ( ) in the definition
of MIPN for renaming (see Proposition 1).
288 M.S.C. Filho et al.
ren(, R) = {}
ren(e t, R) = if e ∈ dom(R) then {e : R[{e}]; s : ren(t, R) • e s}
else {s : ren(t, R) • e s}
We are now able to infer which channels can be used to compose a livelock-free
contract in BRIC. The function Allowed identifies all communication channels
that can be individually hidden with no introduction of contract livelock.
Definition 12 (Allowed ). Let Ctr be a livelock-free component contract. The
set of communication channels of CCtr that can be individually hidden with no
introduction of divergence is given by Allowed (Ctr ) defined below:
Allowed (Ctr ) =
CCtr \ {c : CCtr | ∃ s : MIP (BCtr ) • ran(s) ∩ evs(CCtr ) ⊆ evs({c})}
The set evs(cs) = {c : cs • {| c |}} contains all events produced by the channels
in the set cs given as argument.
The set of Allowed channels of a given contract Ctr contains all communi-
cation channels c, such that there is no MIP (BCtr ) composed only by events
on c. Using these channels on compositions does not introduce a contract live-
lock because even after individually hiding the communication on these chan-
nels, every member of MIP (BCtr ) still has at least one further external com-
munication on a different channel with the environment. In our example, the
Local Livelock Analysis of Component-Based Models 289
sets of allowed channels are Allowed (CtrPhil1 ) = {lf .1, pfk .1.1, pfk .2.1} and
Allowed (CtrFork1 ) = ∅. The latter is empty because every member of MIP (Fork1 )
either contains only interactions on fk .1.1 or only interactions on fk .1.2.
The composition Ctr1 [a ↔ c]Ctr3 is valid in BRIC because a and c are strong
compatible. However, neither a or c are allowed in the corresponding contracts;
this composition yields a divergent contract. In general, however, this would
not necessarily happen. For example, Ctr1 [a ↔ b]Ctr2 would not introduce a
contract livelock because the channels would not be able to synchronise. The
BRIC rules, however, require the connecting channels to be strong compatible,
that is, at every state of a in BCtr1 if a.n is offered, then b.n is also offered by
BCtr2 . In Ctr1 [a ↔ b]Ctr2 , a and b are not strong compatible. As a consequence
of the strong compatibility requirement, there is no case in which neither of the
connecting channels are in Allowed of their contracts and the BRIC compositions
result in a livelock-free component contract.
In BRIC ∞ , the assumption that communications with the buffer will halt at
some point because the buffer is full is no longer valid because the buffers are
infinite. We, therefore, need stronger conditions to ensure livelock freedom.
For the same reason, the infiniteness of the buffers, unary compositions in
BRIC ∞ have a stronger condition for ensuring livelock freedom. We require
both connecting channels to be allowed to be hidden together.
The Theorems 1 to 4 establish the conditions under which we ensure that the
result of any BRIC composition is a livelock-free component contract.
In order to be able to perform further compositions using the resulting con-
tracts in an efficient manner, we calculate the new MIP after every livelock-free
composition. This information is stored in the contracts as metadata that aims
at alleviating further verifications in our method for component composition.
For any two minimum interaction patterns ip1 and ip2 from MIP (Fork1 ) and
MIP (Fork2 ), respectively, this merge includes a large number of traces that com-
municate on the same channels from ip1 and ip2 , which only differ in the order
of the events. This order, however, is not relevant for our strategy because, using
BRIC, further compositions like, for instance, with a contract Ctr3 , will be made
on a one channel to one channel basis. As a consequence, composing Ctr3 with
Ctr1 [|||] Ctr 2 will be a communication between Ctr3 with either Ctr1 or Ctr2 .
Based on this analysis, we provide a variation of the merge function from [10].
This optimisation is extremely relevant to the scalability of our approach.
s ,t
xs0 0 = {} (1)
x s xs
s0 ,t0
= {u | u ∈ x s xs
s0 ,t0
t0 } (2)
xs0 0 x t = {u | u ∈ s0 xs0 0 x t} (3)
s ,t s ,t
x s xs
s0 ,t0
x t = { } (7)
The differences between our definition for trace merging and that of [10]
are: (1) Our merge function has the original traces s0 and t0 as arguments.
This allows us to merge n concatenations of s0 with m concatenations of t0 ;
(2) In the cases in which one side is willing to perform a synchronisation event
x and the other side has finished (lines 2 and 3), we “reset” the side that has
finished, enforcing at least one synchronisation on x and decreasing the size of
one of the sequences by at least one; (3) In the cases in which one side is willing
to perform an independent event (lines 4 and 5), we do not take all possible
combinations of permuting the independent events for the reasons previously
explained; and (4) In the cases in which the synchronisation is feasible (line 6),
our merge function does not include the synchronised event in the result because
they are hidden after composition. We define the merge function as follows.
Definition 15 (MIP Merge). Let Ctr1 and Ctr2 be two livelock-free compo-
nent contracts, ic and oc two communication channels in CCtr1 and CCtr2 , respec-
tively, and x a fresh channel name. The MIP merge is defined as follows.
The resulting merge contains all MIP s from BCtr1 and BCtr2 that do not have
events on the connecting channels ic and oc, respectively. The remaining MIP s
are merged using the optimised trace merge. Before the merge, however, the
MIP s have to be unified on the events of the connecting channels. For that, we
use a fresh channel name x and the function ren to replace references to ic and
oc in BCtr1 and BCtr2 , respectively, by x . The function extensions(c) returns the
values which will ‘complete’ the channel yielding an event [10].
Next, the metadata calculation for the binary operators is as follows.
Proposition 2 (Binary Composition Metadata). Let Ctr1 and Ctr2 be two
livelock-free component contracts and ic and oc two channels in CCtr1 and CCtr2 ,
respectively. The MIP of the binary compositions are defined as follows.
Local Livelock Analysis of Component-Based Models 293
The calculation of the resulting MIP for unary compositions simply removes
both connecting channels from the original MIP s.
5 Evaluation
Tables 1 and 2 summarise our results. The column N is the number of cells
and philosophers for Milner’s scheduler and dining philosophers, respectively.
294 M.S.C. Filho et al.
Table 2. Results of the livelock analysis for the dining philosophers in BRIC ∗ .
The column # is the number of compositions, and the columns FDR2, SLAP
and LLA present the time cost of the global analysis in FDR2, SLAP Static
Analysis (using BDD and SAT), and our local analysis (LLA). The * indicates
one hour timeout and ** indicates memory overflow.
The results show that FDR2 and SLAP are unable to deal with large asyn-
chronous configurations. On the other hand, our method provided successful
results of livelock analysis for 10,000 philosophers and 10,000 forks (20,000 CSP
processes and 39,988 BRIC ∗ compositions) in less than 4 min. This proved to
be a very promising result in dealing with complex and large systems.
6 Conclusion
References
1. Beneken, G., Hammerschall, U., Broy, M., Cengarle, M., Jürjens, J., Rumpe, B.,
Schoenmakers, M.: Componentware - State of the Art 2003, October 2003
2. Bruin, H.: A grey-box approach to component composition. In: Czarnecki, K.,
Eisenecker, U.W. (eds.) GCSE 1999. LNCS, vol. 1799, pp. 195–209. Springer,
Heidelberg (2000). doi:10.1007/3-540-40048-6 15
3. Filho, M., Oliveira, M., Sampaio, A., Cavalcanti, A.: Local livelock analysis of
component-based models. Technical report, UFRN 2(016). http://goo.gl/zl1MQV
4. Hoare, C.A.R.: Communicating Sequential Processes. Prentice-Hall, Upper Saddle
River (1985)
5. Formal Systems Ltd.: FDR2: User Manual, version 2.94 (2012)
6. Milner, R.: Communication and Concurrency. Prentice-Hall, Upper Saddle River
(1989)
7. Ouaknine, J., Palikareva, H., Roscoe, A.W., Worrell, J.: A static analysis frame-
work for livelock freedom in CSP. Log. Methods Comput. Sci. 9(3) (2013)
8. Ramos, R.T.: Systematic development of trustworthy component-based systems.
Ph.D. thesis, Federal University of Pernambuco (2011)
9. Ramos, R., Sampaio, A., Mota, A.: Systematic development of trustworthy com-
ponent systems. In: Cavalcanti, A., Dams, D.R. (eds.) FM 2009. LNCS, vol. 5850,
pp. 140–156. Springer, Heidelberg (2009). doi:10.1007/978-3-642-05089-3 10
10. Roscoe, A.W.: The Theory and Practice of Concurrency. Prentice-Hall Series in
Computer Science. Prentice-Hall, Upper Saddle River (1998)
11. Soni, P., Ratti, N.: Analysis of component composition approaches. Int. J. Comput.
Sci. Commun. Eng. 2(1) (2013). ISSN: 2319-7080
Session-Based Compositional Analysis
for Actor-Based Languages Using Futures
1 Introduction
While distributed and concurrent systems are the pillars of modern IT infrastruc-
tures, it is non-trivial to model asynchronous interactions and statically guar-
antee communication correctness of such systems. This challenge motivates us
to bring a compositional analysis framework, which models and locally verifies
the behaviors of each distributed endpoints (i.e. components) from the specifi-
cation of their global interactions. For modeling, we focus on core ABS [10,15],
an object-oriented actor-based language designed to model distributed and con-
current systems with asynchronous communications. For verification, we estab-
lish a hybrid analysis, which statically type checks local objects’ behaviors and,
at the same time ensures that local schedulers obey to specified policies dur-
ing runtime. We apply session types [12,21] to type interactions by abstracting
structured communications as a global specification, and then automatically gen-
erating local specifications from the global one to locally type check endpoint
behaviors.
The distinguishing features of the core ABS concurrency model are (1) coop-
erative scheduling, where methods explicitly control internal interleavings by
explicit scheduling points, and (2) the usage of futures [11], which decouple
the process invoking a method and the process reading the returned value. By
Every author contributed to this paper equally.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 296–312, 2016.
DOI: 10.1007/978-3-319-47846-3 19
Session-Based Compositional Analysis 297
sharing future identities, the caller enables other objects to wait for the same
method results. Note that core ABS does not use channels. Communication
between processes is restricted to method calls and return values.
The order of operations on futures is fixed: First a fresh future identity is
created upon the caller invoking a method on the callee, then the callee starts the
method execution. After method termination, the callee sends the result to the
future, i.e. future is resolved. Finally, any object which can access the future can
read the value from this future. Our session-based type system ensures that the
specification respects this order. We have two kinds of communications: Caller
invoking a method at a remote callee, and callee returning values via a future
to those who know that future. The later is non-trivial since several endpoints
can read more than once from the same resolved future at any time.
To the best of our knowledge, it is the first time that session types are consid-
ered for typing the concurrency model of core ABS. Our contributions include:
(1) extending core ABS with sessions (SABS for short) by giving special anno-
tations to specify the order of interactions among concurrent class instances, (2)
establishing a session-based type system, and (3) generating session automata [2]
from session types to represent scheduling policies and typestate [20]. To cap-
ture the interactions among objects, which are running several processes, we
introduce a two-fold notion of local types: Object types defining behaviors (i.e.
including scheduling behavior) among class instances, while method types defin-
ing behaviors that processes should follow.
Outline: Section 2 gives a motivating example which is used in the rest of the
paper. Section 3 introduces the concurrency model of SABS. Section 4 defines
session types for SABS (ABS-ST for short), while Sect. 5 gives a type system.
Section 6 introduces session automata which are used to verify behaviors of
schedulers. Section 7 gives the related works, while Sect. 8 concludes our work.
If a student requests his/her grades before the service desk receives the grades
from c by publish, the scheduler of d must postpone the process of request until
publish has been executed and terminated. This is not possible for core ABS,
because a scheduler in core ABS cannot be idle while waiting for a specific
message when the process queue is non-empty. Thus we propose an extension of
core ABS to ensure that the endpoints and their local schedulers behave well to
the specified communication order.
Fig. 2. SABS syntax. Terms · denote possibly empty lists over corresponding syntactic
categories, and [ ] optional elements. The highlighted ones are the new syntax added
to core ABS.
Session-Based Compositional Analysis 299
A future of built-in type FutT expresses that the value stored in the future is
of type T. Function declarations F consist of a return type A, a function name
fn, an optional list of parameters of types A, a list of variable declarations x of
types A, and an expression e. Expressions e include boolean expressions b, vari-
ables x, (ground) terms t, the self-identifier this, the return address destiny
of the method activation, constructor expressions Co(e), function expressions
fn(e), and case expressions case e {br} where br is a branch. An interface IF
has a name I and method signatures Sg. A method signature Sg declares the
return type T of a method with name m and formal parameters x of types T .
A class CL has a name C, the fields x of type T for formal parameters and state
variables, implemented interfaces I and methods M . The right-hand side expres-
sions rhs include (pure) expressions e, asynchronous remote method invocation
e!m(e), and future fetching expression e.get. Statements s include sequential
composition, assignment, session creation, object creation, guarding statement
await e?, if, while, branching, skip and return statement.
The Concurrency Model. In SABS each object has one scheduler and one proces-
sor. It is possible to have more than one processes on an object, but at most
one process is executed by the processor on an object at a time. For a method
call, a fresh future identity, say f , is generated by the caller upon sending an
asynchronous remote method invocation to the callee. A future can be seen
as a placeholder for the method result. The callee creates a new process for the
receiving call. If the processor of the callee is busy while the new message arrives,
the created process will be put into the process pool and can later be chosen
for execution by the scheduler. Upon method termination, the callee returns
the result to f , i.e. f is resolved. Any object sharing the identity f can read
the value from f by executing f.get. This statement blocks the current process
until f is resolved and then returns the value. Since execution control is not
transferred between objects and there is no direct access from one object to the
fields of other objects, each object can be analyzed individually. SABS supports
cooperative scheduling. Each object relies on its scheduler to select a process for
execution at the explicit scheduling points, which can be upon termination of
object initialization, at await statement, and upon method termination. When a
process execution encounters statement await f ?, if the future f is not resolved
yet, the processor is released and the current process is suspended and put into
the process pool. Then the processor is idle and the scheduler chooses a process
from the pool for execution based on a scheduling policy (i.e. specified by a local
specification). We say the chosen process from the pool is reactivated.
SABS provides a set of new features in order to guide the scheduler to select
the intended process for execution according to the required interaction order-
ing. In Fig. 2, the statement [Protocol : G] x = new Session(e) creates a new
session with a fresh session id stored in x. The parameter e is the session name
300 E. Kamburjan et al.
Here a suspends its first process computing f0 until f1 has been resolved; during
this period, a can execute the call on m2 .
302 E. Kamburjan et al.
The branching type p{gj }j∈J expresses that as p selects the jth branch, gj
guides the continuing interactions. The type end means termination.
Note that only a self-contained g can be repeatedly used. We say g is self-
contained if (1) wherever there is a remote call or releasing, there is a correspond-
ing resolving and visa versa; and (2) it contains no end, and (3) every repeated
type within it is also self-contained. We say A ∈ g if A appears in g and A ∈ G
f f0 f
if A ∈ g for some g ∈ G. E.g., we have q − → p : m ∈ 0 −→ q : m.q − → p:m
and q{g2 } ∈ q{gj }j∈{1,2,3} and its negation means the inverse. A future f is
f
introduced in g (or G) if p −
→ q ∈ g (or G).
Now we define type g∗ = fresh(g).g∗ (in case fresh(g) is a branching, we
append g∗ to the end of every branch), meaning finite repetition of a self-
contained g by giving every repetition fresh future names:
⎧
⎨g{f1 /f1 }...{fn /fn } if f1 , ..., fn are introduced in g and f1 , .., fn fresh
⎪
fresh(g) = p{fresh(gj )}j∈J if p{gj }j∈J
⎪
⎩
Undefined otherwise
The session is started by a call on c.pubGrd, while other objects are inactive
f
at the moment. After the call c −→ d : publish, the service desk d is active at
computing f in a process running publish. We position d ↓ f there to specify
that d must resolve f after it is called by c and before it is called by s (i.e.
f f
s −−→ d : request). For c, it can have a second remote call c −→ s : announce
after its first call. Thus in this case it is no harm to move d ↓ f right after
f
c −→ s : announce. As d is called by s, d can start computing f in a process
running request only after d ↓ f , which means the process computing publish has
terminated. s will fetch the result by s ↑ f after d resolves f ; then s resolves
f . Note that, since c does not need to get any response from d nor s, c simply
finishes the session by c ↓ f0 . The end is there to ensure all processes in the
session terminate. The valid use of futures is examined during generating object
types from a global type, a procedure introduced in Sect. 4.3. If s ↑ f is specified
before d ↓ f , the projection procedure will return undefined since f can not
be read before being resolved.
Definition 2
L :: = p!f m.L p?f m.L Put f : (C).L Get f : (C).L Await(f, f ).L
React(f ).L ⊕{Lj }j∈J &f{Lj }j∈J L∗ .L skip.L end
Example 3 Consider object d in the grading system in Sect. 2. Its method type
on future f , which is used for calling method publish, is c?f publish.Put f . Its
object type is L = c?f publish.Put f .s?f request.Put f .end, and its condensed
type is L̂ = c?f publish.skip.s?f request.skip.skip ≡ c?f publish.s?f request.
4.3 Projection
A projectable global type implies that the futures appear in it are located cor-
rectly across multiple objects; thus the object types gained from it ensure the
correct usage of futures.
We define pre(G, G ) as the set of prefixes of G:
f
The first conjunct captures that after p − → o, f becomes active on o, while after
o ↓ f : (C), f becomes inactive on o; the second conjunct captures that if f has
been suspended on f (i.e. Rel(p, f ) ∈ pre(G, G )∧ f active in Rel(p, f )), then
f must have been reactivated by resolving f (i.e. o ↓ f ∈ pre(G, G )).
Figure 4 defines the projection rules as a function pj (g, o)G projecting g to
object o, where g ∈ G. We write pj (G, o)G = G o. The side-conditions verify
the defined cases, where the futures are used correctly; others are undefined.
The interaction type projects a sending action on the caller side and a receiv-
ing action on the callee side. A resolving type gives an action for resolving f on
the corresponding object, and generates a reactivation for every objects who are
waiting for f ; for others, it gives skip. A fetching type gives an action for fetch-
ing the result from f on the corresponding object and gives skip for others. Its
side-condition ensures that a future is resolved before fetching it. This must be
checked at a global level because resolving and fetching take place in different
objects. A releasing type gives suspension for the corresponding object and gives
skip for others. Its side-condition ensures that the releasing object does not have
any other future waiting for the same resolving. A branching type gives a choice
type for the active side and an offer for every one that either receives one of the
calls invoked by the object making the choice or reads from the active future. For
other objects, each branch should have the same behavior so that those objects
always know how to proceed no matter which branch was selected. Termination
type gives end, which means every future has been resolved and all objects are
inactive. The repetition and concatenation are propagated down.
it projects on an active future used by the target object, while gives a unique
L when it projects on a future which only appears in one branch. Similarly for
the case of offer object type. A reactivation object type gives a method type
skip when it projects on any future because the next action after a suspension
306 E. Kamburjan et al.
will always be a reactivation inside a method type. Termination object type also
always gives skip for any future because it is not visible. A concatenation object
type gives a concatenation method type on any future.
5 Type System
We say the objects involving in a sequence of communications, i.e. a session, sat-
isfy communication correctness iff, during the interactions, they always comply
with some pre-defined global type. To locally check endpoint implementations
and statically ensure communication safety, which is currently not supported by
core ABS, we here introduce a type system, which is defined in Fig. 5.
We use Θ as session environments, which contain sessions associating to
global types that they follow, with information about the types of participants;
we use Γ as shared environments mapping expressions to ground types, and Δ
as channel environments mapping channels (composed by a session name and
an object) to local types. Note that, channel environments only exist in the type
system. When we write Θ, Θ , we mean domain(Θ) ∩ domain(Θ ) = ∅, so as for
ϕ, Γ and Δ. Θ and Γ together store the shared information. For convenience, we
define role(G) returning the set of participants in G, ptypes(C) returning the
types of parameters of C, implements(C, I) returning true if C can implement
interface I, obj (C) returning an instance of class C, and fields(C) returning a
shared environment containing attributes of C. We only list the session-related
typing rules related. Others are as same as those in core ABS [15].
Rule (T-New-Session) types a session creation by checking if G in the annotation
is projectable (see Sect. 4.4), the session id s is fresh, and the type of e is String.
If all conditions are satisfied, we create Θ = {Any : 0}s:G to record mappings
of types to the participants in G. The first mapping is Any : 0, in which Any
types the session initializer. Also, a channel s[0] and its type G 0 is created in
shared environments to specify this object playing 0 in G. Rule (T-New-Join) types
an object creation, which joins session s, which is a name (with type String) of a
session. The object creation is valid if s has been created (i.e. Θ {ϕ}s:G ) and
the type of e is ptypes(C).
Rule (T-Scheduler) is the key rule to activate session-based typing. A class with
annotation [Scheduler: L ] is well-typed if its methods are well-typed (this part
is as same as the rule (T-Class) in [15]) and, by given the fact that the instance of
C has joined session s (i.e. s[obj (C)] : ∅), the local scheduler who specifies the
behavior of obj (C) against L should find L = G p where p ∈ role(G), which
implies that obj (C), typed by I, plays as p in G when it joins s. Then we extend
Θ to Θ by adding I : p into {ϕ}s:G to claim that p associates to interface I,
and replacing s[obj (C)] : ∅ with s[p] : L in the channel environment.
Rule (T-Send) types an asynchronous remote method call. The object is allowed
to have such a call, specified by s[p] : q!f m, when the object calls a method m
using f (by checking x : f ) at an object playing q in G (i.e. Θ has {ϕ, I : q}s:G
and Γ has e : I) and its next statement s is also well-typed.
Session-Based Compositional Analysis 307
Fig. 5. The type system for the concurrent object level of ABS (Parts: Session-related)
Rule (T-Offer) types case e{p1 ⇒ s1 , ..., pn ⇒ sn } with &f {Lj }j∈J by checking
if every branch pj ⇒ sj is well-typed by Lj and checking if f is active in Lj on
the object p in session s. Rule (T-Choice) is the counterpart of (T-Offer). Rule (T-
Await) types the await statement with Await(f, f ). It checks if the next statament
is well-typed by React(f ).L , which specifies the next action is to reactivate the
usage of f and, since f has been resolved, in L we have f inactive on p. Other
rules are straightforward.
After locally type checking every objects’ implementations in a session based
on their corresponding local types, which are projected from a global type that
the session follows, our system ensures overall interactions among those objects
comply with communication correctness:
6 Session Automata
Data words are words over an alphabet Σ ×D. A data word automata has a data
store, which can save k data values. A transition fires for a letter (a, d) ∈ Σ × D
if a set of equalities of the form d = ri are satisfied, where ri refers to the ith
stored data value. After a transition fires, the data store records d.
Session-Based Compositional Analysis 309
where I = {1..n} and σi [k/dji ] is a function mapping the kth stored data to
dji . Now we revise Σ to Σ = ({invocREv} × Met) ∪ {reactEv} and D = Fut,
where invocREv labels process activation and reactEv labels process reactiva-
tion. Given an object type, we can build a session automaton.
Definition 5. Let L be an object type. Let k be number of futures in L̂. We
assume the futures are ordered and pos(f ) refers to the number of f in the
ordering. The k-register session automaton AL is defined inductively as follows:
– p?f m is mapped to a 2-state automaton which reads (invocREv, m) and
stores the future f in the pos(f )-th register on its sole transition.
– React f is mapped to a 2-state automaton which reads reactEV and tests for
equality with the pos(f )-th register on its sole transition.
– Concatenation, branching, and repetition using the standard construction for
concatenation, union, and repetition for NFAs.
When a process is activated, the automaton stores the process’s corresponding
futures; when a process is reactivated, the automaton compares the process’s
corresponding futures with the specified register. As all repetitions in types pro-
jected from a global type are self-contained, after the repetition, the futures used
there are resolved and thus the automaton can overwrite it safely. The example
below shows how a session automaton works based on an object type.
Example 4. Consider the example from Sect. 2. A simple automaton describing
the sequence for the d (Service Desk) is
(invocREv, publish) (invocREv, request)
start 1 2 3
d → r0 d → r1
The scheduler above does not need to use registers because it does not have
reactivations. The following one must read the registers to schedule reactivations:
∗
L = (p?f m1 .Await(f, f ).p?f m3 .Put f .React(f ).Put f )
The following theorem states that the objects involving in a session are faithful
to the session’s protocol if their processes can be verified by the corresponding
schedulers, whose behaviors follow the session automata.
Neykova and Yoshida [18] also consider an actor model with channels, where
processes are monitored by automata. Deniélou and Yoshida [4] used commu-
nicating automata to approximate processes and local types. However, their
approaches do not consider scheduling and validating the usage of futures.
We plan to prove that our type system ensures that interactions among
objects are deadlock-free and always progresses, and then implement a session-
based extension for the core ABS language.
8 Conclusion
Acknowledgments. We thank Reiner Hähnle and Patrick Eugster who provided the
original idea and insightful discussions for this paper. We also thank the reviewers
for their constructive comments. This work was supported by the ERC grant FP7-
617805 LiVeSoft: Lightweight Verification of Software and the EU project FP7-610582
Envisage: Engineering Virtualized Services.
References
1. Bjørk, J., de Boer, F.S., Johnsen, E.B., Schlatte, R., Tarifa, S.L.T.: User-defined
schedulers for real-time concurrent objects. ISSE 9(1), 29–43 (2013)
2. Bollig, B., Habermehl, P., Leucker, M., Monmege, B.: A fresh approach to learning
register automata. In: Béal, M.-P., Carton, O. (eds.) DLT 2013. LNCS, vol. 7907,
pp. 118–130. Springer, Heidelberg (2013). doi:10.1007/978-3-642-38771-5 12
3. Campos, J., Vasconcelos, V.T.: Channels as objects in concurrent object-oriented
programming. In: Honda, K., Mycroft, A. (eds.) PLACES 2010. EPTCS, vol. 69,
pp. 12–28 (2010)
4. Deniélou, P.-M., Yoshida, N.: Multiparty session types meet communicating
automata. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 194–213. Springer,
Heidelberg (2012). doi:10.1007/978-3-642-28869-2 10
5. Din, C.C., Bubel, R., Hähnle, R.: KeY-ABS: a deductive verification tool for the
concurrent modelling language ABS. In: Felty, A.P., Middeldorp, A. (eds.) CADE
2015. LNCS (LNAI), vol. 9195, pp. 517–526. Springer, Heidelberg (2015). doi:10.
1007/978-3-319-21401-6 35
6. Din, C.C., Owe, O.: Compositional reasoning about active objects with shared
futures. Formal Aspects Comput. 27(3), 551–572 (2015)
7. Field, J., Goyal, D., Ramalingam, G., Yahav, E.: Typestate verification: abstraction
techniques and complexity results. Sci. Comput. Program. 58(1–2), 57–82 (2005)
8. Gay, S.J., Gesbert, N., Ravara, A., Vasconcelos, V.T.: Modular session types for
objects. Logical Methods Comput. Sci. 11(4), 1–76 (2015)
312 E. Kamburjan et al.
9. Grigore, R., Distefano, D., Petersen, R.L., Tzevelekos, N.: Runtime verifica-
tion based on register automata. In: Piterman, N., Smolka, S.A. (eds.) TACAS
2013. LNCS, vol. 7795, pp. 260–276. Springer, Heidelberg (2013). doi:10.1007/
978-3-642-36742-7 19
10. Hähnle, R.: The abstract behavioral specification language: a tutorial introduc-
tion. In: Giachino, E., Hähnle, R., Boer, F.S., Bonsangue, M.M. (eds.) FMCO
2012. LNCS, vol. 7866, pp. 1–37. Springer, Heidelberg (2013). doi:10.1007/
978-3-642-40615-7 1
11. Halstead, R.H.: Multilisp: a language for concurrent symbolic computation. ACM
TOPLAS 7(4), 501–538 (1985)
12. Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In:
Necula, G.C., Wadler, P. (eds.) POPL 2008, pp. 273–284. ACM (2008)
13. Hu, R., Yoshida, N., Honda, K.: Session-based distributed programming in Java. In:
Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 516–541. Springer, Heidelberg
(2008). doi:10.1007/978-3-540-70592-5 22
14. Jaghoori, M.M., de Boer, F.S., Chothia, T., Sirjani, M.: Schedulability of asyn-
chronous real-time concurrent objects. J. Logic Algebraic Program. 78(5), 402–416
(2009)
15. Johnsen, E.B., Hähnle, R., Schäfer, J., Schlatte, R., Steffen, M.: ABS: a core
language for abstract behavioral specification. In: Aichernig, B.K., Boer, F.S.,
Bonsangue, M.M. (eds.) FMCO 2010. LNCS, vol. 6957, pp. 142–164. Springer,
Heidelberg (2011). doi:10.1007/978-3-642-25271-6 8
16. Kamburjan, E.: Session Types for ABS. Technical report (2016). www.se.
tu-darmstadt.de/publications/details/?tx bibtex pi1[pub id]=tud-cs-2016-0179
17. Kaminski, M., Francez, N.: Finite-memory automata. Theor. Comput. Sci. 134(2),
329–363 (1994)
18. Neykova, R., Yoshida, N.: Multiparty session actors. In: Kühn, E., Pugliese, R.
(eds.) COORDINATION 2014. LNCS, vol. 8459, pp. 131–146. Springer, Heidelberg
(2014). doi:10.1007/978-3-662-43376-8 9
19. Scalas, A., Yoshida, N.: Lightweight session programming in Scala. In: Krishna-
murthi, S., Lerner, B.S. (eds.) ECOOP 2016. LIPIcs, vol. 56, pp. 21:1–21:28. Schloss
Dagstuhl - Leibniz-Zentrum fuer Informatik (2016)
20. Strom, R.E., Yemini, S.: Typestate: a programming language concept for enhancing
software reliability. IEEE Trans. Softw. Eng. 12(1), 157–171 (1986)
21. Takeuchi, K., Honda, K., Kubo, M.: An interaction-based language and its typ-
ing system. In: Halatsis, C., Maritsas, D., Philokyprou, G., Theodoridis, S. (eds.)
PARLE 1994. LNCS, vol. 817, pp. 398–413. Springer, Heidelberg (1994). doi:10.
1007/3-540-58184-7 118
An Event-B Development Process
for the Distributed BIP Framework
1 Introduction
In this paper, we are concerned with providing tool support to assist system
design using a safe refinement-based process. The considered systems will be
seen as a collection of interacting actors. The first levels of the process provides
a centralized view of the system behavior. It will be built by taking into account
system requirements incrementally, in the form of a series of abstract machines
written in Event-B [3]. Then, we propose dedicated, user guided, refinement gen-
erators to take into account the distributed nature of the designed system. As
a result, we obtain a set of interacting machines of which composition is proven
to conform to the abstract levels. The system can then be executed on a dis-
tributed platform via a translation to the BIP (Behavior, Interaction, Priority)
language [5]. By now, it should be clear that our aim is not to fully automate
the distribution process but to assist it. While keeping modest, the difference
is similar to that between a model checker where the proof of a judgement is
automatic and a theorem proving assistant where the user ha s to compose basic
strategies in order to make his proof. Actually, while a theorem proving assistant
helps to construct the proof of a goal, we intend to help in the elaboration of a
distributed model through refinement patterns [16].
The semantics of Event-B and BIP are based on labeled transition systems
thereby promoting their coupling. Event-B is used for the formal specification
and the decomposition of initially centralized reactive systems. BIP is used for
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 313–328, 2016.
DOI: 10.1007/978-3-319-47846-3 20
314 B. Siala et al.
2 Event-B
The Event-B method allows the development of cor-
rect by construction systems and software [3]. To
achieve this, it supports natively a formal develop-
ment process based on a refinement mechanism with
mathematical proofs. Figure 2 illustrates a refine-
ment step where a machine M0 using a context C0
is refined by a machine M1 using an extension C1
of C0. Contexts define abstract data types through Fig. 2. Event-B develop-
sets, constants and axioms while machines define ment step
symbolic labelled transition systems through vari-
ables and events specifying their evolution while preserving invariant properties.
As a running example, we will consider the electronic hotel key system case
study [15]1 . The context (Listing 1.1) introduces basic data structures: guests,
rooms and cards defined as ordered pairs of keys2 . State variables (Listing 1.2)
declare the current key of a room (currk), the rooms owned by a guest (owns),
the cards issued by the hotel and cards owned by a guest.
context chotel machine h o t e l s e e s c h o t e l
sets variables
ROOM GUEST KEY c u r r k owns i s s u e d c a r d s
constants invariants
CARD @ c u r r k t y c u r r k ∈ ROOM → KEY
axioms @ o w n s t y owns ∈ ROOM → P (GUEST)
@crd CARD = KEY × KEY @ i s s u e d t y i s s u e d ∈ P (CARD)
end @ c a r d s t y c a r d s ∈ GUEST → P (CARD)
1
The full code is available in https://dl.dropboxusercontent.com/u/98832434/
hotelrefinements.html.
2
prj1 returns the left projection of an ordered pair.
An Event-B Development Process for the Distributed BIP Framework 315
where x, y, p are sets of parameters from the events E1 and E2 and m1 and m2
are the variables of the two subcomponents. Sending a value v can be modeled
by using a guard of the form p = v. The other guards will constrain the sent
value either at the sending point or at the receiving point. This design pattern
originating from CSP has been proposed by Butler for action systems [7] and in
[18] for Event-B.
The composed machine is supposed to satisfy the Event-B standard Proof
Obligations (POs) related to invariants and refinements. Moreover, during the
316 B. Siala et al.
where
The Rodin platform provides an interactive tool [19] as a plugin allowing the
shared event composition/decomposition of Event-B specifications. Composition
is defined by editing a composed machine which designates the subcomponents
and defines synchronization events as a product of subcomponent events. Con-
versely, decomposition is built by naming subcomponents and mapping variables
on them. In case of success, the tool generates a machine for each subcompo-
nent and a composed machine. Given that the decomposition of the invariants
depends on the scope of the variables, invariants containing variables distributed
over several subcomponents are discarded.
An Event-B Development Process for the Distributed BIP Framework 317
atom t y p e t y D e s k ( )
/∗ s t a t e v a r i a b l e s ∗/
d a t a INT c u r r k . . .
/∗ t e m p o r a r y v a r i a b l e s ∗/
d a t a INT r e g i s t e r g
/∗ p o r t i n s t a n c e s ∗/
export port ty empty port c o m p u t e r e g i s t e r r ()
export port t y r e g i s t e r D e s k r e g i s t e r ( r e g i s t e r g , r e g i s t e r c )
p l a c e P0
i n i t i a l t o P0 do /∗ i n i t i a l i z e v a r i a b l e s ∗/
/∗ t r a n s i t i o n s ∗/
on c o m p u t e r e g i s t e r c from P0 t o P0 p r o v i d e d r e g i s t e r g c o m p u t e d
on r e g i s t e r from P0 t o P0 p r o v i d e d r e g i s t e r g c o m p u t e d do /∗ a c t i o n ∗/
end
For example, Listing 1.6 defines two connector types3 . The first one denotes a
pure synchronization and the second one a synchronization with data exchange.
c o n n e c t o r t y p e t y c o m p u t e r e g i s t e r r ( t y e m p t y p o r t Desk , t y e m p t y p o r t G u e s t )
d e f i n e Desk G u e s t
on Desk G u e s t down {}
end
c o n n e c t o r t y p e t y r e g i s t e r ( t y r e g i s t e r D e s k Desk , t y r e g i s t e r G u e s t G u e s t )
d e f i n e Desk G u e s t
on Desk G u e s t down {
G u e s t . r e g i s t e r c =Desk . r e g i s t e r c ; Desk . r e g i s t e r g =G u e s t . r e g i s t e r g ;
}
end
3
produced by our BIP code generator in Sect. 4.3.
An Event-B Development Process for the Distributed BIP Framework 319
The BIP execution engine starts with the calculation of executable interactions
(Interaction layer). Then, it schedules these interactions, taking into account the
priority constraints (Priority layer). Finally, the transitions of the atomic compo-
nents involved in the interaction are executed (Behavior layer). We now give the
operational semantics of the composition of a set of components (Ci )i∈1..n con-
nected through a set of connectors γ. First, we sum up the syntax of components
and connectors as follows:
( g
i∈I i i(v )) ∧ G(x i v i | i ∈ I)
v
i∈I i = a (v
i i <+ D i (x j v j | j ∈ I) ∧ i∈I vi = vi
p(U ( xi vi |i∈I ))
(σ1 , v1 ), . . . , (σn , vn ) −−−−−−−−−−−→ (σ1 , v1 ), . . . , (σn , vn )
For readability reasons, priorities are not taken into account. We should add that
the fired interaction is not hidden by ready interactions having a lower priority.
The BIP tool-chain includes translators from other languages to BIP, formal
verification tools and code generators from a BIP model. The BIP language
features a static checker called D-Finder [5]. It is a compositional verification
tool (invariants, deadlock). Likewise, the BIP language has a runtime verification
tool [11]. The code generators take the BIP model and generate single-threaded
or multi-threaded code that can be executed and analyzed [14].
320 B. Siala et al.
We specify for some of the model events, e.g. ev, the parameters (p) to be
computed, the parameters on which it depends (pi ), the default value v of p (for
typing purposes) and the guards (gi ) acting as the specification of the value of
p. The plugin generates a refinement of the input machine.
Such a specification provides a partial order on event parameters. It is used
to schedule newly introduced events aiming at computing and storing in a state
variable the value of their associated parameter. Ordering constraints are imple-
mented through the introduction of one boolean variable for each parameter, its
computed state. The machine invariant is extended by the properties of the newly
introduced variables: if a variable has been computed, its specification, given by
4
We consider here that non-determinism is only introduced through event parameters.
322 B. Siala et al.
its guards, is satisfied. When all the parameters of an event have been computed
as state variables, the event itself can be fired. The progress of parameters com-
putation is ensured by a variant defined as the number of parameters remaining
to be computed. More precisely, the previous specification for parameter p of
event ev will produce the following machine contents:
machine g e n e r a t e d r e f i n e s i n p u t m a c h i n e
variables
ev p e v p c o m p u t e d // witness and s t a t u s f o r parameter p o f event ev
invariants
@ e v g i e v p c o m p u t e d ⇒ g i // where p i s replaced by ev p
v a r i a n t // count o f the remaining parameters to compute
{FALSE → 1 , TRUE → 0}( e v p c o m p u t e d ) + . . .
events
e v e n t INITIALISATION e x t e n d s INITIALISATION
then
@ev p e v p := v
@ev p comp e v p c o m p u t e d := FALSE
end
event ev r e f i n e s ev
when
@p comp e v p c o m p u t e d = TRUE
with
@p p = e v p // parameter p o f i n h e r i t e d event i s r e f i n e d to ev p
then
@ p i e v p i c o m p u t e d := FALSE // f o r a l l e v p i with updated guards
... // r e p l a c e p by ev p in actions o f the r e f i n e d event
end
end
component Cj . Its guard reads the local copy of vi while the action has remote
access to vk . Event synchronization ensures the local copy of vi is up-to-date
and gives access to vk by constraining the event parameter (lk in the figure,
local vk in the code pattern).
Listing 1.10 presents the transformation pattern focused on component Ci .
The resulting machine should refine the input machine. This is for the moment
verified by discharging the proof obligations generated by Rodin. As previously,
we plan to establish this result at the meta-level and the arguments will be very
similar to those given for the splitting transformation.
machine g e n e r a t e d r e f i n e s i n p u t m a c h i n e
variables
v i // i n h e r i t e d v a r i a b l e s , on Ci
C j v i // copy o f v i mapped on Cj ( used by a Cj guard )
v i f r e s h // true i f v i has been copied , on Ci
invariants
@ C j v i f v i f r e s h = TRUE ⇒ C j v i = v i // copy i s synchronized
variant
{FALSE → 1 , TRUE → 0}( v i f r e s h ) + . . .
events
c o n v e r g e n t e v e n t s h a r e v i // shared by Ci and Cj
any l o c a l v i
where
@g v i f r e s h = FALSE // on Ci
@ l l o c a l v i = v i // on Ci
then
@ t o C j C j v i := l o c a l v i // on Cj
@done v i f r e s h := TRUE // on Ci
end
e v e n t e v r e f i n e s e v // shared by Ci , Cj ,Ck
any l o c a l v k
where
@ v j a c c e s s l o c a l v k = vk // on Ck, access to remote v a r i a b l e s
@ v i f r e s h v i f r e s h = TRUE // on Ci , copy to Cj has been done
@g [ v i := C j v i ] g // i n h e r i t e d guard on Cj , access to l o c a l copy o f v i
then
@a v j := [ v i := C j v i | | vk := l o c a l v k ] e // on Cj
end
end
Furthermore, as for the splitting plugin, the freshness of copies is reset when
the source variable is updated by an action.
machine C j
variables vj Cj vi
i n v a r i a n t s // keep only those r e f e r r i n g v j and C j v i
events
e v e n t s h a r e v i // sync with Ci event , import v i
any l o c a l v i then
@ t o C j C j v i := l o c a l v i
end
event ev
any l o c a l v k // read by some Cj action
where
@ v j f r e s h v j f r e s h = TRUE // needed by Cl , v j has been exported
@g [ v i := C j v i ] g // mapped on Cj , access to copy o f v i
then
@a v j := [ v i := C j v i ; vk:=l o c a l v k ] e
end
end
We have to note that some invariants may be lost: we only keep those who refer
variables local to the considered component. It means that the correctness of the
resulting machines (i.e. the fact that events preserve the remaining invariants)
should be proven. If this is not possible, invariants should be added by the user.
However, the composition of the projections, as defined in [19], to which lost
invariants are added is, by construction, the machine we had before decompo-
sition. As a consequence, thanks to the monotony of composition, the design
process can be pursued on each component machine.
This step assumes that the input Event-B model conforms to a subset of Event-
B, we called Event-B0, which plays the role of the subset B0 of the B language
that is translated to C. In the considered subset, shared events should be those
resulting from the application of the replication phase of the mapping step.
Furthermore, we suppose that subcomponent machines do not need to be refined.
Events should be deterministic (parameters should have a value) and use a subset
326 B. Siala et al.
of the Event-B expression and predicate languages for which their exists a direct
mapping to their BIP counterparts. For this purpose, we require that used set
expressions and predicates have been refined to calls to a set library [10] of
which signature has a C implementation within the BIP framework. Here, we
present how the architectural part of the BIP code is generated. The generator
takes as input the mapping specification (subcomponent names, variable and
guards mappings) and the refined machine produced by the mapping step.
Port Type Generation. For each shared event and each component of which
variables are referenced by this event, we generate a port type taking as parame-
ter the type of exported variables (variables mapped to this component and used
by guards or actions mapped to other components). A port type for synchro-
nisation purpose only is generated for all events that do not export variables.
Listing 1.5 provides port types generated for our example.
Connector Type Generation. For each event which uses variables of several
components, we generate a connector type taking as parameters ports specified
by the previously introduced port types. They are supposed to be synchronous.
They define a down action which copies (via the ports) variables of one compo-
nent to their copies located in components which need them. Listing 1.6 illus-
trates the application of this rule in our example.
5 Related Work
Over the last years, several formalisms such as process algebra, input/output
automata, UNITY and TLA+ have been proposed to model and mostly to reason
An Event-B Development Process for the Distributed BIP Framework 327
over concurrent and distributed systems. However, to the best of our knowledge,
their effective use within development frameworks leading to a distributed imple-
mentation has not yet been a general tendency. The automatic generation of
source code from formal specifications is supported by few formal methods such as
B and Event-B. In [6], an approach is developed allowing the generation of efficient
code from B formal developments by using an imperative intermediate language
B0. Several Event-B source code generators have been proposed [9,12,20]. Indeed,
an Event-B model can represent sequential, concurrent or distributed code as well
as reactive, distributed or hybrid systems. The work described in [20] proposes a
set of plugins for the Rodin development tool that automatically generate impera-
tive sequential code from an Event-B formal specification. These works do not take
into account Event-B composition. Whereas the works described in [9] generate
concurrent Ada code restricted to binary synchronization. The automatic refine-
ment of B machines is also possible thanks to the Bart tool [8]. Also, in Event-B,
the atomicity decomposition plugin [16] defines a DSL to parametrize the refine-
ment generator. However, the refinement pattern is dedicated to event splitting
and does not apply to our problem.
6 Conclusion
In this paper, we have presented a distribution process for system designs for-
mally expressed as Event-B models. Starting from an Event-B machine, the
studied process proposes successively the splitting step and the mapping step.
The specification of these two steps is done through two domain specific lan-
guages. Eventually, a distributed Event-B model and a distributed BIP code
architecture are also automatically generated. As we said in the introduction,
our primary aim is provide tools to assist the user in the design of distributed
systems. Providing a fully automatic process is not in our objectives as we target
system engineering and requirements may provide constraints in functions/data
to component mapping. Each proposed step generates refinements. The proof
obligations generated by Rodin for these refinements remain to be discharged in
order to assert the correctness of the developed model.
As future work, we envision to enhance the tooling of our process. Currently,
the splitting and mapping steps have been implemented with the xtext [2] lan-
guage infrastructure, the refinements and the BIP code have been generated
with the accompanying xtend language [1] which provides support for writing
code generators5 . We are interested in achieving a distributed code generator
plugin for the Rodin platform by taking into account types and the translation
of Event-B expression and predicate languages.
We are also interested in studying how the proof obligations generated by the
refinements can be discharged definitively at the meta level. In the long term,
we seek to enrich the set of transformations and to provide a library of certified
transformations dedicated to the development of distributed systems for various
architectures.
5
The generated code is available at
https://dl.dropboxusercontent.com/u/98832434/hotelrefinements.html.
328 B. Siala et al.
References
1. Java 10, today! http://www.eclipse.org/xtend/. Accessed 16 Jan 2006
2. Language engineering for everyone! https://eclipse.org/Xtext. Accessed 16 Jan
2006
3. Abrial, J.-R.: Modeling in Event-B: System and Software Engineering, 1st edn.
Cambridge University Press, New York (2010)
4. Abrial, J.-R., Hallerstede, S.: Refinement, decomposition, and instantiation of dis-
crete models: application to Event-B. Fundam. Inf. 77(1–2), 1–28 (2007)
5. Basu, A., Bensalem, S., Bozga, M., Combaz, J., Jaber, M., Nguyen, T.-H., Sifakis,
J.: Rigorous component-based system design using the BIP framework. IEEE
Softw. 28(3), 41–48 (2011)
6. Bert, D., Boulmé, S., Potet, M.-L., Requet, A., Voisin, L.: Adaptable translator of
B specifications to embedded C programs. In: Araki, K., Gnesi, S., Mandrioli, D.
(eds.) FME 2003. LNCS, vol. 2805, pp. 94–113. Springer, Heidelberg (2003)
7. Butler, M.: A CSP approach to action systems. Ph.D. thesis, Oxford University
(1992)
8. Clearsy. Bart (b automatic refinement tool). http://tools.clearsy.com/wp-content/
uploads/sites/8/resources/BART GUI User Manual.pdf
9. Edmunds, A., Butler, M.: Tasking Event-B: An extension to Event-B for generating
concurrent code. Event Dates: 2nd April 2011, February 2011
10. Edmunds, A., Butler, M.J., Maamria, I., Silva, R., Lovell, C.: Event-B code gen-
eration: type extension with theories. In: ABZ Proceedings, pp. 365–368 (2012)
11. Falcone, Y., Jaber, M., Nguyen, T.-H., Bozga, M., Bensalem, S.: Runtime veri-
fication of component-based systems in the BIP framework with formally-proved
sound and complete instrumentation. Softw. Syst. Model. 14(1), 173–199 (2015)
12. Fürst, A., Hoang, T.S., Basin, D., Desai, K., Sato, N., Miyazaki, K.: Code genera-
tion for Event-B. In: Albert, E., Sekerinski, E. (eds.) IFM 2014. LNCS, vol. 8739,
pp. 323–338. Springer, Heidelberg (2014)
13. Fürst, A., Hoang, T.S., Basin, D., Sato, N., Miyazaki, K.: Formal system modelling
using abstract data types in Event-B. In: Ait Ameur, Y., Schewe, K.-D. (eds.) ABZ
2014. LNCS, vol. 8477, pp. 222–237. Springer, Heidelberg (2014)
14. Jaber, M.: Centralized and Distributed Implementations of Correct-by-
construction Component-based Systems by using Source-to-source Transforma-
tions in BIP. Theses, Université Joseph-Fourier - Grenoble I, October 2010
15. Nipkow, T.: Verifying a hotel key card system. In: Barkaoui, K., Cavalcanti, A.,
Cerone, A. (eds.) ICTAC 2006. LNCS, vol. 4281, pp. 1–14. Springer, Heidelberg
(2006)
16. Salehi Fathabadi, A., Butler, M., Rezazadeh, A.: A systematic approach to atom-
icity decomposition in Event-B. In: Eleftherakis, G., Hinchey, M., Holcombe, M.
(eds.) SEFM 2012. LNCS, vol. 7504, pp. 78–93. Springer, Heidelberg (2012)
17. Silva, R., Butler, M.: Supporting reuse of Event-B developments through generic
instantiation. In: Breitman, K., Cavalcanti, A. (eds.) ICFEM 2009. LNCS, vol.
5885, pp. 466–484. Springer, Heidelberg (2009)
18. Silva, R., Butler, M.: Shared event composition/decomposition in Event-B. In:
Aichernig, B.K., Boer, F.S., Bonsangue, M.M. (eds.) Formal Methods for Compo-
nents and Objects. LNCS, vol. 6957, pp. 122–141. Springer, Heidelberg (2011)
19. Silva, R., Pascal, C., Hoang, T.S., Butler, M.: Decomposition tool for Event-B.
Softw. Pract. Experience 41(2), 199–208 (2011)
20. Singh, N.K.: EB2ALL: an automatic code generation tool. In: Singh, N.K. (ed.)
Using Event-B for Critical Device Software Systems, pp. 105–141. Springer, London
(2013)
Partial Order Reduction for State/Event
Systems
1 Introduction
In modular and component-based software, communication proceeds via events
and is commonly data-dependent. In order to apply existing model checking
techniques [3,14] to such software, we need to provide formalisms which incor-
porate both events and states. Modeling techniques based on annotated finite
state automata might be either state-based or event-based. Although these two
frameworks are interchangeable, converting from one representation to the other
often results in a significant enlargement of the state space. In addition, both
approaches are not practical when it comes to modular software, in which events
This work was supported by the National High-tech R&D Program of China (863
Program) under Grant No. 2015AA015303, Funding of Jiangsu Innovation Program
for Graduate Education KYLX 0315, the Fundamental Research Funds for the Cen-
tral Universities, Joint Research Funds of National Natural Science Foundation of
China and Civil Aviation Administration of China (U1533130).
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 329–345, 2016.
DOI: 10.1007/978-3-319-47846-3 21
330 S. Kan et al.
are often data-dependent. In order to address this issue, Chaki et al. [2] provided
a framework in which both states and events can be expressed. In the frame-
work, the behavior of a system is modeled by Labeled Kripke Structures (LKS).
The property specification logic is State/Event Linear Temporal Logic (SE-LTL)
which is an extension of standard LTL [9]. SE-LTL distinguishes it from LTL
by introducing events as atomic propositions. Moreover, Chaki et al. [2] showed
that standard automata-theoretic LTL model checking algorithms can be ported
to the framework at no extra cost.
However, conventional Partial Order Reduction (POR) [6,13,16], which is
one of the most successful state space reduction techniques, cannot be directly
used to verify SE-LTL formulas. The reason is that most SE-LTL formulas are
not preserved under stutter-equivalence. Chaki et al. [2] do not introduce POR
into their framework, but they suggest it as a future direction. Benes et al. [1]
provided a POR for SE-LTL by introducing a notion of state/event stutter-
equivalence. However, the drawback of [1] is that most SE-LTL formulas are
also, in general, not preserved under state/event stutter-equivalence. So they
defined a new logic based on SE-LTL, called weak state/event LTL (wSE-LTL),
which is invariant under the state/event stutter-equivalence. In fact, wSE-LTL
is a subset of SE-LTL. Our previous work introduced a technique to exploit
POR for checking LTL with nexttime operator [11]. As each SE-LTL formula
can be converted into an LTL formula with nexttime operators, the SE-LTL
formula could be checked with the POR in [11]. This technique is suitable for
the full class of SE-LTL, but it is less efficient than the technique presented in
this paper. There is work like [15], which transforms state/event systems into
purely state-based ones and then uses conventional POR. However, this approach
enlarges the state space (the number of both states and transitions can be in the
worst case multiplied by the size of the alphabet). Lawford et al. [12] provided
a technique for compositional model reduction of real-time systems with respect
to real-time state-event temporal logic. This technique is based on state-event
equivalent relations for runs in models. Our technique also retains equivalent
runs in reduced models, but we also consider SE-LTL formulas to reduce more
states.
In this paper, we propose a novel technique to exploit POR for checking SE-
LTL. POR is integrated into the construction of the Synchronous Product (SP)
of a BA translated from an SE-LTL formula (such a BA is called SE-BA in the
sequel) and an LKS. Our technique needs some more insight into the SE-BAs. We
aim at detecting a “state part” of an SE-BA. State parts indicate that the parts
could be checked with POR. In other words, when checked against a state part of
an SE-BA, an LKS could be reduced by POR. In addition, the conventional POR
should also be modified to check SE-LTL. We need to reconsider the identification
of visible actions in an LKS with respect to events. The core of our technique
is the definition of a synchronous product of an SE-BA and an LKS with the
integration of the modified POR. State parts direct the use of the modified
POR during the construction of the SP. Our POR for SE-LTL is called SE-
POR. Moreover, we also compare our work with existing POR for checking
Partial Order Reduction for State/Event Systems 331
wSE-LTL [1] and show that SE-POR is also suitable for wSE-LTL. We give a
technique to combine SE-POR with the POR for wSE-LTL [1] to obtain more
reduction. We have implemented our technique into SPIN model checker [8] and
the experimental results show that SE-POR is much more efficient than SE-LTL
model checking without POR and pure state-based POR.
This paper is organized as follows. In Sect. 2, we present some preliminaries.
In Sect. 3, some more insight into the translation from SE-LTL formulas into
SE-BAs is presented. In Sect. 4, we introduce the POR for checking SE-LTL.
In Sect. 5, we compare our technique with the POR for wSE-LTL and combine
SE-POR with it to obtain greater state reduction. In Sect. 6, we present the
implementation and experimental results. In Sect. 7, we draw some conclusions
and discuss future work.
2 Preliminaries
In this section, we recall the basic idea of SE-LTL model checking [2] and give a
brief description of conventional POR.
ψ :: = p | e | ¬ψ | ψ ∧ ψ | Xψ | ψUψ,
where e ranges over a set EP of events and p ranges over a set SP of atomic
state propositions. Events and atomic state propositions are all called atomic
332 S. Kan et al.
Synchronous Products of SE-BAs and LKSs. Chaki et al. [2] exploited standard
automata-theoretic model checking algorithms to verify SE-LTL by proposing a
definition of synchronous products of SE-BAs and LKSs.
Let M = (S, Init, P, Act, T, Ls ) be an LKS and B = (Q, Σ, T , I, F ) be an
SE-BA. Let E be a partial map from actions to events. The synchronous product
of M and B is defined as M ⊗ B = (Qp , Σ, Tp , Ip , Fp ), where (1) Qp ⊆ S × Q, is
Partial Order Reduction for State/Event Systems 333
Partial Order Reduction. We give a rough description of the basic idea of con-
ventional POR. As LKSs can be obtained by labeling actions on transitions in
KS, here we use LKSs instead of KSs to describe conventional POR to facilitate
the successive presentation. In fact, conventional POR also needs to consider the
semantics of transitions in KSs.
For a state s in an LKS M, whose transition relation is T , The notation
enable(s) = {(s, a, s ) | (s, a, s ) ∈ T } denotes the set of all transitions that
are enabled at s. Conventional POR avoids searching redundant runs in M
by only selecting a subset of enable(s) to expand s and the subset is called
the ample set, denoted as ample(s). Since ample(s) is a subset of enable(s),
only a subset of runs of L(M) is checked, therefore some states are reduced.
The core of conventional POR is the computation of ample sets. There are
two important notions in conventional POR. For two transitions t1 and t2 in
enable(s), if they can execute concurrently then they are independent; otherwise
they are dependent. The formal definition of dependent and independent can
be found in the textbook [4]. An action a ∈ Act is an invisible action if for
each transition (s, a, s ) in an LKS, L(s) = L(s ); otherwise a is a visible action.
Conventional POR computes an ample set of a state s by selecting a subset of
enable(s) that satisfies the following 4 conditions:
C0 ample(s) = ∅ if and only if enable(s) = ∅,
C1 along every run in the full LKS that starts at s, the following condition
holds: a transition that is dependent on a transition in ample(s) cannot be
executed without a transition in ample(s) occurring first,
C2 if s is not fully expanded (i.e., ample(s) ⊂ enable(s)), then every transition
t ∈ ample(s) is labeled by an invisible action,
C3 for any cycle in the LKS, there exists at least one state along the cycle that
is fully expanded.
Step 1. The first step computes a set of pairs (P, N ) for each temporal formula
in {φ1 , . . . , φm }, where P is a set of literals and N is a set of temporal formulas.
A literal is an atomic proposition or its negation. Let φ be a temporal formula.
The set of pairs for φ is denoted as trans(φ). We introduce an operator ⊗ for
sets of pairs in order to compute trans(φ). Let S1 and S2 be two sets of pairs,
then S1 ⊗ S2 = {(P, N ) | ∃(P1 , N1 ) ∈ S1 .∃(P2 , N2 ) ∈ S2 .P = P1 ∪ P2 and N =
N1 ∪ N2 }. The recursive computation of trans(φ) is presented as follows:
Step 2. This step constructs all outgoing transitions of q. The set of outgoing
transitions of q is trans(φ1 ) × . . . × trans(φm ). More precisely, let (Pl , Nl ) ∈
trans(φl ) for 1 l m. One outgoing transition of q is (q, P1 ∪ . . . ∪ Pm , q ),
where q is identified with N = N1 ∪ . . . ∪ Nm , which is also a set of temporal
formulas and q is identified with ψi = {φ1 , . . . , φm }. The transition can be
explained as follows: in order to satisfy the formula ψi identified with q, the
transition selects to satisfy the conjunction of literals in P1 ∪ . . . ∪ Pm at the
current state in an LKS and satisfy the conjunction of temporal formulas in
N by a run starting from the next state. We use the notation S(qi ) to denote
the conjunction that the state qi is identified with. For example, S(q) = ψi and
S(q ) = N . For each state qt in Qg , we construct all its outgoing transitions.
Let (qt , α, qt ) be an outgoing transition. If qt is already in Qg then we only
add the transition to Tg ; otherwise we add qt and the transition to Qg and Tg ,
respectively.
At last, we construct the accepting condition Fg . Let U be the set of until
subformulas of ψ, that is, the formula of type ψ1 Uψ2 . The accepting condition
is defined as Fg = {Tf | f ∈ U }, where Tf = {(q, α, q ) | f ∈ / S(q) or ∃(P, N ) ∈
trans(f ).P ⊂ α and f ∈ / N ⊆ S(q )}. The definition of Tf is complex and it
comes from [5]. But we should not be concerned about it, as it has less relation
with our technique. We now define two kinds of transitions in a GBA. A literal
is an event literal if it is an event or the negation of an event.
336 S. Kan et al.
In this section, we consider SE-POR for checking SE-LTL without the X oper-
ator. The full version of this paper also considers SE-POR for SE-LTL with
the X operator. It can be download at https://sourceforge.net/projects/se-spin/
files/full version se por.pdf/download. In conventional POR for LTL, we always
select the ample set of a state s to expand s. But in SE-POR, the selection of
ample(s) or enable(s) to expand s depends on whether s is checked against a
state part of an SE-BA. In addition, since SE-LTL has atomic propositions of
events, the computation of ample sets is different from conventional POR. In
Subsect. 4.1, we introduce a synchronous product of an LKS and an SE-BA with
the integration of POR. The synchronous product illustrates when ample sets
are exploited during the verification. In Subsect. 4.2, we discuss the computation
of ample sets for SE-LTL.
Partial Order Reduction for State/Event Systems 337
The synchronous product of an LKS and an SE-BA with the integration of POR
is defined as follows:
Definition 3. Let M = (S, Init, P, Act, T, Ls ) be an LKS and B =
(Q, Σ, T , I, F ) be an SE-BA. The synchronous product of M and B with the
integration of POR is defined as a BA M ⊗s B = (Qp , Σ, Tp , Ip , Fp ), where
(1) Qp = S × Q is a set of states, (2) Ip = {(s, p) ∈ Qp | s ∈ Init and q ∈ I} is
a set of initial states, (3) Fp = {(s, q) ∈ Qp | q ∈ F } is a set of accepting states,
and (4) Tp ∈ Qp × Qp is a transition function and a transition ((s, q), (s , q )) is
in Tp iff one of the following two conditions holds:
α
(1) there exists an event-transition q − → q in B, and there exists a transition
s−
a
→ s in enable(s) such that L
s (s) ∧ E(a) α,
α
(2) there exists a state-transition q − → q in B, and there exists a transition
s−
a
→ s in ample(s) such that L
s (s) ∧ E(a) α.
The synchronized transitions are ((s0 , q0 ), (s2 , q2 )) and ((s0 , q0 ), (s3 , q2 )) shown
in Fig. 2(c). Therefore M ⊗s B only expands (s0 , q0 ) with 3 transitions, while
M ⊗ B will expands (s0 , q0 ) with 5 transitions.
U R(φ) denotes the set of all subformulas of φ, which are either U-form or R-form.
An event literal is said to be uncovered by U-form and R-form subformulas in
an SE-LTL formula if it appears outside U-form and R-form subformulas. More
formally, Let φ be an SE-LTL formula and l be an event literal appearing in φ.
The DNF of φ is φ1 ∨ . . . ∨ φn , where φi is a conjunction of temporal formulas
for 1 i n. If there is a conjunction φi = {ϕ1 , . . . , ϕm } such that there exists
a temporal formula ϕj ∈ φi with 1 j m and ϕj is the literal l, then we say
that l is uncovered by U-form and R-form subformulas in φ, or l is uncovered in
φ for short. For example, let e be an event and p be an atomic state proposition.
The event e is uncovered in e ∨ Gp and e ∧ (pUe), but not uncovered in p ∧ (eUp).
We now introduce the predicate, denoted as inst(φ, l).
For each event literal l ∈ elit(φ), if inst(φ, l) = true, we can select either
vib(l) or vib(¬l) as visible actions. If inst(φ, l) = f alse, we can only select
vib(l) as visible actions. For example, assume φ = F(e1 → G(p ∧ ¬e2 )), where
p is an atomic state proposition, and e1 and e2 are events. Let f1 = F(e1 →
G(p ∧ ¬e2 )) ≡ U(e1 → G(p ∧ ¬e2 ) and f2 = G(p ∧ ¬e2 ) ≡ ⊥R(p ∧ ¬e2 ),
then U R(φ) = {f1 , f2 }. For f1 , ¬e2 is not uncovered in (e1 → G(p ∧ ¬e2 ) and
for f2 , ¬e2 does not appear in ⊥, so inst(φ, ¬e2 ) = true. The visible actions
identified by events in φ could be vib({e1 , ¬e2 }) or vib({e1 , e2 }). In this paper,
if vib(e) and vib(¬e) both could be detected as visible actions, where e is an
event, our strategy always selects vib(e). This strategy yields more reduction for
the benchmarks of our experiments. The details of our strategy are introduced
as follows. We first define the notation c(l) for the literal l.
e, if l = ¬e, where e is an event, and inst(φ, l) = true
c(l) = (1)
l, otherwise
The notation elit (φ) = {c(l) | l ∈ elit(φ)}. For all event literals in φ, our strategy
identifies all actions in vib(elit (φ)) as visible actions with respect to these event
literals. We illustrate the strategy by an example. Consider the property that
for all states in a system, if a process sends a message to other processes then
it will eventually receive a response. It can be specified as φ = G(send → F
receive), where send and receive are events. We first translate its negation
¬φ ≡ F(send ∧ G¬receive) into an SE-BA. As inst(¬φ, ¬receive) is true, so all
actions in vib({send, receive}) are identified as visible actions. Based on elit , we
redefine state-transitions and event-transitions in SE-BAs (see Definition 2). The
new definition yields more state-transitions, so we might obtain more reduction.
where e ranges over a set of events EP and p ranges over a set of atomic state
propositions SP . Let σ = s0 , a0 , s1 , a1 , . . . be an infinite run of an LKS. The
semantics of wSE-LTL is explained over infinite runs of LKSs.
(1) σ
P(e) iff ∃k 0.E(ak ) = e and ∀0 j < k.E(aj ) ∈
/ EP ,
(2) σ p iff p ∈ Ls (s0 ),
(3) σ ¬ψ iff σ ψ,
(4) σ ψ1 ∧ ψ2 iff σ ψ1 and σ ψ2 ,
(5) σ ψ1 Uψ2 iff ∃k 0.σ k ψ2 and ∀0 j < k.σ j ψ1 ,
(6) σ iff ∃k 0.E(ak ) ∈ EP, ∀0 j < k.E(aj ) ∈
Xψ / EP and σ k+1 ψ,
(7) σ ψ1 Ue ψ2 iff ∃k 0.E(ak ) = e, σ k+1
ψ2 and ∀0 j < k + 1.σ j ψ1 .
The work of [1] illustrates that wSE-LTL is a subset of SE-LTL by proposing
a translation
from wSE-LTL formulas into equivalent SE-LTL formulas. Let
ξ = e∈EP ¬e. The notation T (ψ) denotes the translation for the wSE-LTL
formula ψ. Then T (ψ) is the following:
T (p) := p
T (P(e)) := ξUe
:= ξU(¬ξ ∧ XT (ψ))
T (Xψ) T (ψUφ) := T (ψ)UT (φ)
T (ψ ∧ φ) := T (ψ) ∧ T (φ) T (¬ψ) := ¬T (ψ)
T (ψUa φ)] := T (ψ)U(a ∧ T (ψ) ∧ XT (φ))
More details of wSE-LTL could be found in [1]. The method of wSE-POR
computes an ample set for each state and use the ample set to expand the state.
Partial Order Reduction for State/Event Systems 341
The difference between wSE-POR and SE-POR is that wSE-POR always selects
ample sets to expand states in LKSs, while SE-POR only selects ample sets to
expand states when encountering state-transitions. The computation of ample
sets in wSE-POR also reconsiders the condition C2 of conventional POR.
We now compare the identification of visible actions between SE-POR and
wSE-POR. For a wSE-LTL formula φ, assume the set of events appearing in φ
is evt(φ). In Subsect. 4.2, elit(φ) denotes the set of event literals appearing in φ.
In wSE-POR, it detects the actions in vib(evt(φ)) as visible actions. That is, the
visible actions are vib(evt(φ)) = {a ∈ Act | ∃e ∈ evt(φ).E(a) = e}. In SE-POR,
we detects vib(elit (φ)) as the set of visible actions. We will show that, in fact,
vib(evt(φ)) = vib(elit (φ)) for any wSE-LTL formula φ (for SE-LTL formulas,
which are not wSE-LTL, they may not have the same set of visible actions).
We only need to consider the identification of visible actions with respect to
P(e) and ¬P(e) in a wSE-LTL formula φ. As T (P(e)) ≡ ξUe, inst(ξUe, e) =
true, so SE-POR can select either vib(e) or vib(¬e) as visible actions. Accord-
to elit
ing
(φ), SE-POR
always
selects vib(e). For ¬P(e), as T (¬P(e)) ≡
( e ∈EP e )R¬e, inst(( e ∈EP e )R¬e, ¬e) = true, so we can select either vib(e)
or vib(¬e) as visible actions. According to elit (φ), SE-POR always selects vib(e).
Therefore vib(evt(φ)) = vib(elit (φ)). As both SE-POR and wSE-POR only
modify the condition C2 of conventional POR, so they compute the same ample
set for a state s. The following theorem illustrates that SE-POR could also be
applied to check wSE-LTL formulas.
Theorem 3 illustrates that our technique is suitable for a larger class of SE-LTL
formulas compared with the work introduced in [1]. For example, the SE-LTL
formula FGe, where e is an event, could not be checked by wSE-POR. Since
this formula is not preserved under state/event stutter-equivalence, which is
introduced in [1], and wSE-POR requires SE-LTL formulas are preserved under
state/event stutter-equivalence. But this formula can be checked by SE-POR.
However, we must admit that SE-POR is less efficient compared with wSE-
POR when checking a wSE-LTL formula, since SE-POR checks a larger set of
runs in LKSs in order to enable a larger class of SE-LTL. But as Theorem 3
indicates that our technique is also suitable for wSE-LTL, and SE-POR and
wSE-POR compute the same ample set for a state s, we provide a technique to
combine them to obtain more reduction for the formulas that incorporate both
the notions of SE-LTL and wSE-LTL. The combined logic is called Combined
State/Event LTL (cSE-LTL). The syntax of cSE-LTL is defined as follows:
φ :: = p | e | φw | ¬φ | φ ∧ φ | φUφ
1. if q is not a weak-state then either one of the following two conditions should
α
hold: (1) there exists an event-transition q −→ q and there exists a transition
s −
a
→ s in enable(s) such that L
s (s) ∧ E(a) α, (2) there exists a state-
α a
transition q −→ q and there exists a transition s −
→ s in ample(s) such that
L
s (s) ∧ E(a) α.
α
2. if q is a weak-state then there exists a transition q −→ q and there exists a
a
transition s −
→ s in ample(s) such that L
s (s) ∧ E(a) α.
check SE-LTL formulas and integrated SE-POR into it. We conducted experi-
ments on two benchmarks. All experiments were performed on a computer with
Intel core i5, 4GB RAM and a 64-bit version of Mac OS X. The time limitation
is one hour. The source code of SE-SPIN and benchmarks can be obtained at
https://sourceforge.net/p/se-spin/code/ci/master/tree/.
In this paper, we combine SE-LTL model checking with partial order reduction to
improve the performance of the verification of systems incorporating both states
and events. The core of SE-POR is a synchronous product of an LKS and an
SE-BA with the integration of POR and the identification of visible actions with
respect to events. In addition, we compare our technique with wSE-POR and
combine them to obtain more reduction. The preliminary experimental results
illustrate the potential for reduction of SE-POR compared with pure state-based
POR and SE-LTL model checking without POR. In the future, we will focus
on the selection of visible actions of SE-POR to obtain most reduction as we
provide several strategies to identify visible actions. Moreover, we would like to
implement our technique using symbolic model checking.
References
1. Beneš, N., Brim, L., Buhnova, B., Černá, I., Sochor, J., Vařeková, P.: Partial
order reduction for state/event LTL with application to component-interaction
automata. Sci. Comput. Program. 76(10), 877–890 (2011)
2. Chaki, S., Clarke, E.M., Ouaknine, J., Sharygina, N., Sinha, N.: Concurrent soft-
ware verification with states, events, and deadlocks. Formal Asp. Comput. 17(4),
461–483 (2005)
3. Clarke, E.M., Emerson, E.A.: Design and synthesis of synchronization skeletons
using branching-time temporal logic. In: Kozen, D. (ed.) Logics of Programs, Work-
shop, Yorktown Heights, New York. LNCS, vol. 131, pp. 52–71. Springer, Heidel-
berg (1981)
4. Clarke, E.M., Grumberg, O., Peled, D.A.: Model Checking. MIT Press, Cambridge
(1999)
5. Gastin, P., Oddoux, D.: Fast LTL to Büchi automata translation. In: Berry, G.,
Comon, H., Finkel, A. (eds.) CAV 2001. LNCS, vol. 2102, pp. 53–65. Springer,
Heidelberg (2001)
6. Godefroid, P., Wolper, P.: A partial approach to model checking. Inf. Comput.
110(2), 305–326 (1994)
7. Holzmann, G.J.: Design and Validation of Computer Protocols. Prentice Hall,
Upper Saddle River (1990)
8. Holzmann, G.J.: The SPIN Model Checker: Primer and Reference Manual.
Addison-Wesley, Boston (2004)
Partial Order Reduction for State/Event Systems 345
9. Huth, M., Ryan, M.: Logic in Computer Science: Modelling and Reasoning About
Systems. Cambridge University Press, Cambridge (2004)
10. Kamel, M., Leue, S.: Formalization and validation of the General Inter-ORB Pro-
tocol (GIOP) using PROMELA and SPIN. STTT 2(4), 394–409 (2000)
11. Kan, S., Huang, Z., Chen, Z., Li, W., Huang, Y.: Partial Order Reduction for
Checking LTL Formulae with the Next-time Operator (2016). doi:10.1093/logcom/
exw004
12. Lawford, M., Pantelic, V., Zhang, H.: Towards integrated verification of timed
transition models. Fundam. Inform. 70(1–2), 75–110 (2006)
13. Peled, D.: All from one, one for all: on model checking using representatives. In:
Courcoubetis, C. (ed.) CAV 1993. LNCS, vol. 697, pp. 409–423. Springer, Heidel-
berg (1993)
14. Queille, J., Sifakis, J.: Specification and verification of concurrent systems in
CESAR. In: Dezani-Ciancaglini, M., Montanari, U. (eds.) International Sympo-
sium on Programming. LNCS, vol. 137, pp. 337–351. Springer, Heidelberg (1982)
15. Sun, J., Liu, Y., Dong, J.S., Wang, H.H.: Specifying and verifying event-based
fairness enhanced systems. In: Liu, S., Araki, K. (eds.) ICFEM 2008. LNCS, vol.
5256, pp. 5–24. Springer, Heidelberg (2008)
16. Valmari, A.: Stubborn sets for reduced state space generation. In: Rozenberg, G.
(ed.) Advances in Petri Nets 1990. LNCS, vol. 483, pp. 491–515. Springer, Heidel-
berg (1991)
Concolic Unbounded-Thread Reachability
via Loop Summaries
1 Introduction
Unbounded-thread program verification continues to attract the attention it
deserves: it targets programs designed to run on multi-user platforms and web
servers, where concurrent software threads respond to service requests of a num-
ber of clients that can usually neither be predicted nor meaningfully bounded
from above a priori. Such programs are therefore designed for an unspecified and
unbounded number of parallel threads as a system parameter.
We target in this paper unbounded-thread shared-memory programs where
each thread executes a non-recursive Boolean (finite-data) procedure. This model
is popular, as it connects to multi-threaded C programs via predicate abstrac-
tion [4,14], a technique that has enjoyed progress for concurrent programs in
recent years [7]. The model is also popular since basic program state reachability
questions are decidable. They are also, however, of high complexity: the equiv-
alent coverability problem for Petri nets was shown to be EXPSPACE hard [6].
The motivation for our work is therefore to improve the efficiency of existing
algorithms.
A sound and complete method for coverability analysis for well quasi-ordered
systems (WQOS) is the backward search algorithm by Abdulla [1]. Coverability
for WQOS subsumes program state reachability analysis for a wide class of multi-
threaded Boolean programs. Starting from the target state whose reachability
This work is supported by US National Science Foundation grant no. 1253331.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 346–362, 2016.
DOI: 10.1007/978-3-319-47846-3 22
Concolic Unbounded-Thread Reachability via Loop Summaries 347
s s
(6,0) (6,1) (6,2) (6,3) (6,4) (6,0) (6,1) (6,2) (6,3) (6,4)
(6,3) (6,4)
(5,0) (5,1) (5,2) (5,3) (5,4) (5,0) (5,1) (5,2) (5,3) (5,4)
(5,4)
(4,0) (4,1) (4,2) (4,3) (4,4) (4,0) (4,1) (4,2) (4,3) (4,4)
(4,2) (4,3)
(3,0) (3,1) (3,2) (3,3) (3,4) (3,0) (3,1) (3,2) (3,3) (3,4)
(3,2)
(2,0) (2,1) (2,2) (2,3) (2,4) (2,0) (2,1) (2,2) (2,3) (2,4)
(1,0) (1,1) (1,2) (1,3) (1,4) (1,0) (1,1) (1,2) (1,3) (1,4)
(1,1)
(0,0) (0,1) (0,2) (0,3) (0,4) (0,0) (0,1) (0,2) (0,3) (0,4)
l l (0,0)
Fig. 1. (a) A thread transition diagram P (initial state tI = (0, 0)); (b) the Expanded
TTD P + with a path σ + ; (c) the SCC quotient graph P of P + , with quotient path σ.
The black disc represents the loop in σ + (the other SCCs are trivial)
paper the thread state reachability problem: given a TTD P and a final thread
state (s, lF ), is (s, lF ) reachable in P∞? It is easy to show that this question is
decidable, by reducing P∞ to a well quasi-ordered system (WQOS) [1]: let the
covers relation over V∞ be defined as follows:
(s|l1 , . . . , ln ) (s |l1 , . . . , ln )
whenever s = s and for all l ∈ L, |{i : li = l}| ≥ |{i : li = l}|. The latter inequal-
ity states that the number of threads in local state l “on the left” is at least
the number of threads in local state l “on the right”. Relation is a well quasi-
order on V∞ , and (P∞ , ) satisfies the definition of a WQOS, in particular the
monotonicity property required of and . The proof of this property exploits
the symmetry of the multi-threaded system: the threads execute the same pro-
gram P: a state (s|l1 , . . . , ln ) can be compressed without loss of information into
the counter notation (s|n1 , . . . , n|L| ), where nl = |{i : li = l}|.
The thread state reachability question can now be cast as a coverability
problem, which is decidable but of high complexity, e.g. EXPSPACE-hard for
standard Petri nets [6], which are equivalent in expressiveness to infinite-state
transition systems obtained from TTD [16].
A sound and complete algorithm to decide
coverability for WQOS is the backward search Algorithm 1. Bws(M, I, q)
algorithm by Abdulla et al. [1,2], a simple ver- Input: initial states I,
sion of which is shown on the right. Input is a final state q ∈ I
WQOS M , a set of initial states I, and a non- 1: W := {q} ; U := {q}
initial final state q. The algorithm maintains a 2: while ∃w ∈ W
work set W of unprocessed states, and a set 3: W := W \ {w}
U of minimal encountered states. It iteratively 4: for p ∈ CovPre(w)\↑ U
computes minimal cover predecessors 5: if p ∈ I then
6: “q coverable”
CovPre(w) = min{p : ∃w w : p w } (1) 7: W := min(W ∪ {p})
starting from q, and terminates either by back- 8: U := min(U ∪ {p})
ward-reaching an initial state (thus proving 9: “q not coverable”
coverability of q), or when no unprocessed ver-
Algorithm 1: Infinite-state back-
tex remains (thus proving uncoverability).
ward search. Symbol ↑ U stands
Strongly Connected Components. In this paper for the upward closure of U :
↑ U = {u : ∃u ∈ U : u u}.
we also frequently make use of the following
standard notions. Given a directed graph G, a strongly connected component
(SCC) is a maximal set C of vertices such that for any two vertices c1 and c2 in
C, there is a path in C from c1 to c2 . If the subgraph of G induced by C has no
edge, C is called trivial.
The SCC quotient graph G of G has exactly one vertex for each SCC of G,
and no other vertices; we identify each vertex of G with the SCC it represents.
An edge (C1 , C2 ) exists in G whenever C1 = C2 and there is a G-edge from
some vertex in C1 to some vertex in C2 . For a vertex v, we denote by v the
unique SCC that v belongs to (hence, by identification, v is also a vertex in G).
Since each cycle of G is contained entirely in one SCC, and nodes in G have no
self-loops, G is acyclic.
350 P. Liu and T. Wahl
To distinguish the edge types in P + , we speak of real edges (in R) and expansion
edges. Intuitively, expansion edges close the gap between two real edges whose
target and source, respectively, differ only in the local state. This can be seen
in Fig. 1(b), which shows the ETTD generated from the TTD in Fig. 1(a). In
2
Simple SCC nodes (representing a simple loop) are not to be confused with trivial
SCC nodes (representing a single node). Simple nodes are by definition non-trivial.
Concolic Unbounded-Thread Reachability via Loop Summaries 351
the graphical representation, expansion edges run horizontally and are shown as
dashed arrows (s, l) (s , l ).
To facilitate the identification and treatment of loops, we collapse the ETTD
P + into its (acyclic) SCC quotient graph, denoted P. An example is shown in
Fig. 1(c). For ease of presentation, we assume that both the initial and final
thread states tI and tF of P form single-node SCCs in P, i.e. loops occur only
in the interior of a path. This can be enforced easily using artificial states.
Being acyclic, the quotient graph P contains only finitely many paths between
any two nodes. It also has another key property that makes it attractive for our
approach. Let us interpret P as a sequential transition system. That is, when we
speak of reachability of a thread state and paths in P, we assume P is executed
by a single thread from tI . (In contrast, the semantics of P is defined via the
unbounded-thread transition system P∞ .) Given these stipulations, P overap-
proximates P, in the following sense:
hi
i
hm hm−1 h0
hi−1
tI
m i+1 i−1
Fig. 2. A path σ in the acyclic structure P with a non-trivial and magnified SCC
node i , representing some kind of loop structure in P +
Our approach builds a symbolic summary for this path segment. We then
do the same for the simple loop collapsed inside i , and for the path from the
entry point of the loop back to tI . These summaries are combined conjunctively
352 P. Liu and T. Wahl
In this section we generalize path summaries to the case of simple SCCs, formed
by a single simple loop, i.e., a single cyclic path without repeated inner nodes.
354 P. Liu and T. Wahl
We aim at an exact solution in the form of a closed expression for the value
of local state counter nl after Algorithm 1 traverses the loop some number of
times κ.
In this section, since we need to “zoom in” to SCCs collapsed into single nodes
in P, we instead look at paths in P + . Recall that for a loop-free path σ + , the
value of counter nl after Algorithm 1 traverses σ + can be computed using σ + ’s
path summary function Σl , determined via symbolic execution (Algorithm 2).
In the case that σ + is a loop, we would like to obtain a summary formula
parameterized by the number κ of times the loop is executed (we cannot replicate
σ + ’s summary function κ times, since κ is a variable).
To this end, let σ + = t1 , . . . , tk with tk = t1 be a loop in P + , and define
(si , li ):=ti for 1 ≤ i ≤ k. Let
Recall that ⊕ is not associative (it associates from left to right); the right-hand
side of Eq. (4) can generally not be simplified to nl ⊕bl κ · δl . Intuitively, the term
nl ⊕bl δl marks the contribution to counter nl of the first loop traversal, while
(κ − 1) · δl marks the contribution of the remaining κ − 1 traversals.
Example. We show how the unreachability of thread state (6, 4) for the TTD in
Fig. 1 is established. For each local state l ∈ {0, . . . , 4}, the following constraints
Concolic Unbounded-Thread Reachability via Loop Summaries 355
are obtained (after simplifications) from summaries of the loop-free path segment
from (6, 4) to (3, 1) (“loop exit point”), the loop inside the SCC node (black disc)
using Theorem 3, and the loop-free path segment from (1, 0) (“loop entry point”)
via (1, 1) to the initial thread state (0, 0). Parameter κ is the number of times
the loop is executed:
n0 : 0 ⊕0 0 ⊕2 2 ⊕2 (κ − 1) · 2 ⊕3 3 ≥ 1
n1 : 0 ⊕1 0 ⊕1 −1 ⊕1 (κ − 1) · −1 ⊕0 −3 = 0
n2 : 0 ⊕2 2 ⊕0 −1 ⊕0 (κ − 1) · −1 ⊕0 0 = 0
n3 : 0 ⊕0 −2 ⊕0 0 ⊕0 (κ − 1) · 0 ⊕0 0 = 0
n4 : 1 ⊕1 0 ⊕0 0 ⊕0 (κ − 1) · 0 ⊕0 0 = 0
Consider an SCC along quotient path σ that represents several distinct simple
loops in P + . An example is an SCC with two loops A and B that have one point
in common and form an “eight” ∞. Such a double loop features paths of the
form (A|B)∗ , where in each iteration there is a choice between A and B. Our
loop acceleration technique from Sect. 5 does not apply to such paths.
To solve this problem, we exploit the synergy between the pathwise analysis
suggested by the acyclic structure P, and the fact that certain — namely, sim-
ple — paths can be processed using the technique described in Sects. 4 and 5.
Spaghetti paths are explored by Algorithm 1, but restricted to the narrow “slice”
of P marked by the quotient path in P.
This algorithm is shown in Algorithm 3. It takes as input the TTD P, as well
as the initial and final thread states, tI and tF . The algorithm begins by building
the quotient structure P. This acyclic structure is now analyzed pathwise. For
each path σ from tI to tF in P, we first decide whether it is spaghetti or simple.
• If σ is simple (does not visit any spaghetti SCCs), we can accelerate explo-
ration along it using the techniques introduced in Sects. 4 and 5. We build a
Presburger summary for the path, parameterized by the loop iteration counts
κi , one for each loop.4 If this formula is satisfiable, again we have that tF is
reachable in P∞ from tI . The assignment to the κi gives the number of times
each loop needs to be traversed; from this data a multi-threaded path through
P can easily be constructed.
4
Loop-free paths (m = 0) can be processed either using Algorithm 1, or via summaries.
Concolic Unbounded-Thread Reachability via Loop Summaries 357
Proof
7 Empirical Evaluation
In this section we provide experimental results obtained using Cutr. The goal
of the experiments is to measure the performance impact of the presented app-
roach compared to the backward search Algorithm 1. We expect our approach to
improve the latter, as it is short-cutting standard backward exploration across
simple loops and linear path segments. The question is whether solving Presburger
equations instead of concretely exploring loops actually amounts to speed-up.
5
Cutr “=” Concolic Unbounded-Thread Reachability analysis.
358 P. Liu and T. Wahl
RO RO
3 unsafe BP unsafe PN
10 safe BP 103 safe PN
102 102
Cutr (sec.)
Cutr (sec.)
101 101
100 100
RO
Bws (sec.) Bws (sec.)
RO RO
Bws Bws
Cutr Cutr
103 103
Memory Usage (MB.)
102 102
101 101
20 40 60 80 100 124 10 20 30 40 49
BP Benchmark PN Benchmark
Fig. 4. Performance impact (BP/PN = TTD from BP/PN). RO stands for “out of
resources”: the run reached the time or the memory limit before producing a result.
• Top row shows the comparisons of execution time. Left: comparison on BPs; Right:
comparison on PNs. Each plot represents execution time on one example.
• Bottom row shows the comparison of memory usage. Left: comparison on BPs; Right:
comparison on PNs. The curves are sorted by the memory usage of Cutr.
8 Related Work
6
Webpage: http://www.ccs.neu.edu/home/lpzun/cutr.
360 P. Liu and T. Wahl
9 Conclusion
partial but exact symbolic acceleration of existing sound and complete infinite-
state search algorithms is very much feasible, and in fact very beneficial.
References
1. Abdulla, P.A.: Well (and better) quasi-ordered transition systems. Bull. Symb.
Log. 16(4), 457–515 (2010)
2. Abdulla, P.A., Cerans, K., Jonsson, B., Tsay, Y.K.: General decidability theorems
for infinite-state systems. In: LICS, pp. 313–321 (1996)
3. Athanasiou, K., Liu, P., Wahl, T.: Unbounded-thread program verification using
thread-state equations. In: Olivetti, N., Tiwari, A. (eds.) IJCAR 2016. LNCS, vol.
9706, pp. 516–531. Springer, Heidelberg (2016)
4. Ball, T., Majumdar, R., Millstein, T., Rajamani, S.K.: Automatic predicate
abstraction of C programs. In: PLDI, pp. 203–213 (2001)
5. Bardin, S., Finkel, A., Leroux, J., Schnoebelen, P.: Flat acceleration in symbolic
model checking. In: Peled, D.A., Tsay, Y.-K. (eds.) ATVA 2005. LNCS, vol. 3707,
pp. 474–488. Springer, Heidelberg (2005)
6. Cardoza, E., Lipton, R.J., Meyer, A.R.: Exponential space complete problems for
Petri nets and commutative semigroups: preliminary report. In: STOC, pp. 50–54
(1976)
7. Donaldson, A., Kaiser, A., Kroening, D., Wahl, T.: Symmetry-aware predicate
abstraction for shared-variable concurrent programs. In: Gopalakrishnan, G.,
Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806, pp. 356–371. Springer, Heidelberg
(2011)
8. Esparza, J., Ledesma-Garza, R., Majumdar, R., Meyer, P., Niksic, F.: An SMT-
based approach to coverability analysis. In: Biere, A., Bloem, R. (eds.) CAV 2014.
LNCS, vol. 8559, pp. 603–619. Springer, Heidelberg (2014)
9. Finkel, A., Leroux, J.: How to compose presburger-accelerations: applications to
broadcast protocols. In: Agrawal, M., Seth, A.K. (eds.) FSTTCS 2002. LNCS, vol.
2556, pp. 145–156. Springer, Heidelberg (2002)
10. Finkel, A., Schnoebelen, P.: Well-structured transition systems everywhere!. Theor.
Comput. Sci. 256(1–2), 63–92 (2001)
11. Geeraerts, G., Raskin, J.F., Begin, L.V.: Expand, enlarge and check: new algo-
rithms for the coverability problem of WSTS. J. Comput. Syst. Sci. 72(1), 180–203
(2006)
12. Geeraerts, G., Raskin, J.-F., Van Begin, L.: On the efficient computation of the
minimal coverability set for Petri nets. In: Namjoshi, K.S., Yoneda, T., Higashino,
T., Okamura, Y. (eds.) ATVA 2007. LNCS, vol. 4762, pp. 98–113. Springer, Hei-
delberg (2007)
13. German, S.M., Sistla, A.P.: Reasoning about systems with many processes. J. ACM
39(3), 675–735 (1992)
14. Graf, S., Saı̈di, H.: Construction of abstract state graphs with PVS. In: CAV, pp.
72–83 (1997)
15. Jonsson, B., Saksena, M.: Systematic acceleration in regular model checking.
In: Damm, W., Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 131–144.
Springer, Heidelberg (2007)
16. Kaiser, A., Kroening, D., Wahl, T.: A widening approach to multithreaded program
verification. ACM Trans. Program. Lang. Syst. 36(4), 14 (2014)
362 P. Liu and T. Wahl
17. Karp, R.M., Miller, R.E.: Parallel program schemata. J. Comput. Syst. Sci. 3(2),
147–195 (1969)
18. Leroux, J.: The general vector addition system reachability problem by Presburger
inductive invariants. In: LICS, pp. 4–13 (2009)
19. Leroux, J.: Presburger vector addition systems. In: LICS, pp. 23–32 (2013)
20. Liu, P., Wahl, T.: Infinite-state backward exploration of Boolean broadcast pro-
grams. In: FMCAD, pp. 155–162 (2014)
21. Liu, P., Wahl, T.: Concolic unbounded-thread reachability via loop summaries
(extended technical report). CoRR abs/1607.08273 (2016). http://arxiv.org/abs/
1505.02637
22. de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R.,
Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg
(2008)
23. Reynier, P.A., Servais, F.: Minimal coverability set for Petri nets: Karp and Miller
algorithm with pruning. In: Petri Nets, pp. 69–88 (2011)
24. Valmari, A., Hansen, H.: Old and new algorithms for minimal coverability sets. In:
Haddad, S., Pomello, L. (eds.) PETRI NETS 2012. LNCS, vol. 7347, pp. 208–227.
Springer, Heidelberg (2012)
Scaling BDD-based Timed Verification
with Simulation Reduction
Truong Khanh Nguyen1 , Tian Huat Tan2 , Jun Sun2 , Jiaying Li2(B) ,
Yang Liu3 , Manman Chen2 , and Jin Song Dong4
1
Autodesk, San Rafael, USA
[email protected]
2
Singapore University of Technology and Design, Singapore, Singapore
{tianhuat tan,sunjun,manman chen}@sutd.edu.sg,
jiaying [email protected]
3
Nanyang Technological University, Singapore, Singapore
[email protected]
4
National University of Singapore, Singapore, Singapore
[email protected]
1 Introduction
Timed automata are an extension of finite automata with clock variables which
represent timed constraints [3]. Interesting model checking problems of timed
automata, like the verification of the reachability and LTL properties, are shown
to be decidable through the construction of region graphs [3]. However, since
the size of region graphs grows exponentially with the number of clocks and the
maximal clock constants, verification based on region graphs is impractical.
There are two lines of work that are proposed to address this problem.
The first line of work is based on Difference Bound Matrices (DBMs). DBMs
were proposed to represent a set of clock valuations satisfying a set of convex
clock constraints [20] with a zone graph. The resulted zone graph is often much
smaller than the region graph, which often results in efficient verification of timed
automata models [15]. There are several problems with DBMs. First, it is diffi-
cult to verify LTL properties with non-Zeno assumption. A run is called Zeno
if there are infinite actions happening in finite time. Zeno runs are unrealistic
and therefore should be excluded during the system verification. However, this
process has shown to be fairly non-trivial [44]. Second, DBMs cannot represent
non-convex zones. Some verification/reduction techniques for timed automata
may result in non-convex zones, and novel techniques need to be invented for
handling such cases. For instance, with a particular abstraction technique called
LU abstraction [7], the resulted zone can be non-convex. In such a case, a convex
subset of LU abstraction, called Extra+ LU extrapolation [7], needs to be used.
Third, since locations and clock valuations are stored separately in zone graphs,
state space explosion is often encountered with models having many processes.
The other line of work is based on digitization [30]. It replaces the contin-
uous passage of time with a passage in discrete steps. The advantage of this
approach is that it helps transforming the problem to model checking a dis-
crete system and techniques such as BDD-based symbolic model checking [16]
can be leveraged. There are several advantages of using BDD-based verification
compared to DBMs-based verification. First, checking non-Zenoness with digi-
tization and BDDs is almost trivial. Furthermore, it has been shown to outper-
form zone-based approach in many existing works (e.g., [5,9,12,15,46]). Second,
we can store both locations and clock valuations together symbolically and is
not limited to non-convex sets. However, the problem with digitization and the
BDD-based approach is that it does not scale for large clock constants. Large
clock constants would significantly increase the number of tick transitions which
denote the passage of one time unit. As a result, a large number of iterations
are often necessary to completely explore the state space.
In this work, we propose the usage of LU simulation to address the aforemen-
tioned problem. In particular, we propose two algorithms, based on LU simula-
tion, for model checking reachability and LTL properties respectively. A desired
property of LU simulation is that it can be obtained for free in timed automata.
Our algorithms depend on two clock bounds: the maximal lower bound and the
maximal upper bound (LU bounds) [7]. By leveraging these clock bounds, we
could explore the set of all reachable states from initial states in fewer iterations.
Intuitively, this is achieved in two ways. First, during the verification, given a set
of reachable states S encoded as BDD, we actively enlarge it by adding states
which can be simulated by those in S. Thus, we have more states and it is pos-
sible to find all the reachable states with fewer iterations. Second, according to
LU simulation relation, states with clock value greater than the maximal lower
bound can simulate all states with larger clock values. Therefore, our method
could perform well even if the maximal upper bound is very large.
Scaling BDD-based Timed Verification with Simulation Reduction 365
1. We have applied simulation reduction in a BDD efficient way for both reach-
ability and LTL properties. To the best knowledge of the authors, we are the
first to apply LU simulation relation in BDD-based approach model checking
of timed automata.
2. We have shown the soundness and completeness of our proposed algorithms.
In addition, we further prove that for the algorithm on verifying reachability
properties, our approach always requires the same or fewer iterations than
classic approaches.
3. We have compared our approaches on verifying reachability and LTL proper-
ties with state-of-the-art DBMs-based and BDD-based model checkers, e.g.,
Uppaal [31] and Rabbit [10] on benchmark systems. The results show that
our approach achieves a significant speed up and outperforms other tools.
2 Preliminaries
In this section we introduce timed automata, arguably one of the most popular
modeling languages for real-time systems. We denote the finite alphabet by Σ.
Let R≥0 be the set of non-negative real numbers. Let X be the set of non-
negative real variables called clocks. The set Φ(X) contains all clock constraints
δ defined inductively by the grammar: δ := x ∼ c | x − y ∼ c | δ ∧ δ where
x, y ∈ X, ∼∈ {<, ≤, =, ≥, >}, and c ∈ N. Given a set of clocks X, a clock
valuation v : X → R≥0 is a function which assigns a non-negative real value to
|X|
each clock in X. We denote R≥0 the set of clock valuations over X. We write
v |= δ if and only if δ evaluates to true using the clock valuation v. We denote as
0 the valuation that assigns each clock with the value 0. Given a clock valuation
v and d ∈ R≥0 , the clock valuation v = v + d is defined as v (x) = v(x) + d for
all clocks x in X. For R ⊆ X, let [R → 0]v denote the clock valuation v such
that v (x) = v(x) for all x ∈ X \ R and v (x) = 0 for all x ∈ R.
Definition 1. A timed automaton is a tuple A = (Σ, X, L, l0 , T, I) where
d t d
We write (l, v) −
→−→ (l , v ) if there exists (l1 , v1 ) where (l, v) −
→ (l1 , v1 ) and
t d t d t
→ (l , v ). A run of A is a sequence (l0 , v0 ) −→
(l1 , v1 ) − 0 0
−→ 1
(l1 , v1 ) −→ 1
−→ ···.
A state (ln , vn ) is reachable from (l0 , v0 ) if there is a run starting from (l0 , v0 )
Scaling BDD-based Timed Verification with Simulation Reduction 367
and endingat (ln , vn ). The duration of the run is defined as the total delay over
this run, i≥0 di . A run is called Zeno if there are infinite actions happening in
finite time. Given a timed automaton A = (Σ, X, L, l0 , T, I) and a location l ∈ L,
reachability analysis is to decide whether a given state (l, v) is reachable from
the initial state (l0 , 0). Next, we define the emptiness checking problem for timed
automata. Let Acc ⊆ L be the set of accepting locations. An accepting run of A
is a run which visits a state in Acc infinitely often. The language of A over Acc,
L(A), is defined as the set of accepting non-Zeno runs. The emptiness problem
is to determine whether L(A) is empty, i.e., whether there exists an infinite run
which is non-Zeno and accepting. We remark that reachability analysis is often
used to verify safety problem, whereas algorithms for the emptiness checking
problem can often be extended to verify liveness properties like LTL formulae.
In the above semantics, clock values are continuous and events are observed
at real time points. Thus, the number of states is infinite and BDDs can not
be applied to verify timed automata under this semantics. In the following, we
introduce discrete semantics which are based on the assumption that events are
observed at integer time points only.
In discrete semantics, we assume that clock constraints are always closed, i.e.,
defined by δc := x ∼c c | x − y ∼c c | δc ∧ δc where x, y ∈ X, ∼c ∈ {≤, =, ≥},
and c ∈ N. Timed automata with closed constraints are called closed timed
automata [5,24].
Given any clock x ∈ X, we write M (x) to denote the maximal constant to
which x is compared in any clock constraint of A. Given a clock valuation v,
v ⊕ d denotes the clock valuation where (v ⊕ d)(x) = min(v(x) + d, M (x) + 1).
Intuitively, for each clock x, once the clock value is greater than its maximal
constant M (x), its exact value is no longer important, but the fact v(x) > M (x)
matters.
The discrete semantics of a closed timed automaton A = (Σ, X, L, l0 , T, I) is
a transition system DS(A) = (S, s0 , →) where S = L × N|X| is a set of states,
s0 = (l0 , 0) is the initial state, and → is the smallest labeled transition relation
satisfying the following condition:
tick
– Tick transition: (l, v) −−→ (l, v ⊕ 1) if v |= I(l) and v ⊕ 1 |= I(l)
t
– Action transition: (l, v) − → (l , v ) with t = (g, e, R) if there exists
(l, g, e, R, l ) ∈ T such that v |= g, v = [R → 0]v, and v |= I(l )
encodings of the initial states, tick transitions, and action transitions of DS(A),
respectively. Note that the encoding of the transition relation of DS(A) is the
disjunction of T ick and T rans. The tick transitions and action transitions are
encoded separately for efficiency. The details are discussed in Sect. 3.
– l1 = l 2 .
d d
→ (l1 , v1 + d) then there exists d such that (l2 , v2 ) −→ (l2 , v2 + d )
– if (l1 , v1 ) −
and ((l1 , v1 + d), (l2 , v2 + d )) ∈ R.
t t
→ (l1 , v1 ) then there exists (l2 , v2 ) such that (l2 , v2 ) −
– if (l1 , v1 ) − → (l2 , v2 ) and
((l1 , v1 ), (l2 , v2 )) ∈ R.
The proof is the same as Lemma 3 in [7]. For simplicity, we denote the BDD
encoding of the simulation relation R defined in Proposition 1.
Scaling BDD-based Timed Verification with Simulation Reduction 369
[1 ≤ x ≤ 106]
l0 l1 l2
e
(a)
e e ... e tick
Fig. 1. Timed automaton with large clock constant and the transition system based
on discrete semantics
states of Q as succ(Q, R). Intuitively, Q stores the set of states reachable within
i time units after ith iteration (lines 5–11). The algorithm reaches the fixpoint
if no new state is found in the next time unit.
While Algorithm 1 is relatively efficient in computing the reachable states, it
still suffers from large maximal clock constants. Models with large maximal clock
constants require a large number of iterations to obtain the fixpoint. Figure 1a
presents a timed automaton with a large clock constant, i.e., with a maximal
clock constant of 106 . We remark that in practice, large clock constants are
not uncommon because different time units are often used in the same time.
Figure 1b is the transition system generated by the discrete semantics. States at
location l2 are ignored in Fig. 1b for simplicity. We denote (li , j) the state where
the location is li and the clock valuation v such that v(x) = j. Assume the
property is whether location l2 is reachable. Then, Algorithm 1 requires 106 + 2
iterations to reach the fixpoint to conclude that l2 is unreachable. Specifically,
106 + 1 iterations to find all the reachable states and the last iteration does not
find any new state and concludes that the fixpoint is reached. However, with
simulation reduction, our approach can verify whether l2 is reachable within 3
iterations.
In the next section, we present our improved algorithm by using the sim-
ulation relation. We prove that the number of iterations can be reduced, and
experimental results given in Sect. 5 confirm that our improved algorithm is
much more efficient.
Since the reachability analysis requires many fixpoint computations, the ratio-
nale of Algorithm 2 is to converge faster to the fixpoint. In the following, we
prove that Reachsim (Down(Q)) requires the same or smaller number of iter-
ations to reach the fixpoint than Reach(Q). In our proof, to distinguish with
Algorithm 1, given any variable Q appearing in Algorithm 2, we use the prime
version Q to denote that variable in Algorithm 2.
– Q0 = {(l0 , 0)}, Q1 = {(l0 , 0), (l0 , 1), (l1 , 1)}
– Q2 = {(l0 , i) | 0 ≤ i ≤ 106 + 1} ∪ {(l1 , i) | 1 ≤ i ≤ 106 + 1}, Q3 = Q2
In the 2nd iteration, we have (l0 , 2), (l1 , 2) ∈ Q2 at first. Since (l0 , i) (l0 , 2) and
(l1 , i) (l1 , 2) for all i > 2, we add all states (l0 , i), (l1 , i) where i > 2 to Q2 by
Down function. Thus, finally Q2 = {(l0 , i) | 0 ≤ i ≤ 106 + 1} ∪ {(l1 , i) | 1 ≤ i ≤
106 + 1}.
Under digitization and automata theory, LTL verification can be done by empti-
ness checking. Thus, the emptiness checking algorithm of Kesten et al. [28] can
be used. In this section, we first present the algorithm of Kesten. Then, we
introduce our improved algorithm by using the simulation relation.
(line 12). This loop is iterated until new is closed under predecessor. Thus, new
is the set of all reachable SCCs. Because of the loop from line 7 to line 9, those
SCCs are accepting by contain a state in Ji for all Ji ∈ J. At the end, new
contains all reachable accepting SCCs in this transition system.
Lemma 4. Given q1 q1 , if there exists a path with length n, q1 =⇒ q2 =⇒
· · · =⇒ qn in L , there exists a path with the same length n, q1 → q2 → · · · → qn
in L such that qi qi for all 1 ≤ i ≤ n.
Following Theorem 4, we can use the transition system L as the input for
Algorithm 3. However, explicitly computing the transition relation of L is not
efficient. Instead, we apply Down for the result of any call succ(Q) on the fly in
Algorithm 3 because of the fact that succ(Q, =⇒ ) = Down(succ(Q, →)).
Algorithm 4 does not guarantee that it always takes fewer or the same num-
ber of iterations than Algorithm 3. To distinguish between Algorithms 4 and 3,
we use new and new to denote the variable new in Algorithm 4 and Algorithm 3
respectively. Then, the reason that Algorithm 4 might take more iterations is
new = Down(new) is not an invariant during the algorithm. Assume before exe-
cuting the line 12, it holds that new = Down(new), then new = Down(new)
may not hold after this line is executed as shown in Lemma 8 in [2]. Thus,
new = Down(new) is not an invariant. Nevertheless, in our evaluation in Sect. 5,
Algorithm 4 always outperforms Algorithm 3 and takes less number of succ func-
tion calls. The reason is that during the computation of all reachable states from
initial states at line 4 and the first run of the while-loop in lines 7–9, Algorithm 4
can take much lesser number of succ function calls than Algorithm 3 as the result
of Theorem 3 and Lemma 7 in [7]. Moreover, the computation of all reachable
states (line 4) is the most expensive computation in these algorithms.
Algorithm 4 can be adopted to verify the emptiness of TBA straightfor-
wardly. The requirement that the run must visit an accepting location infinite
times and contain an infinite number of tick transitions and action transitions is
represented as a set of Büchi conditions J = {Acc, J0 , J1 } where Acc is a set of
accepting locations in DS(A) and J0 (respectively J1 ) is the set of states which
are the destination states of the action transition (respectively tick transition).
A boolean variable isT ick can be introduced during the encoding. For each tran-
sition, this variable is updated to false if that is an action transition. Otherwise
it is updated to true. Then J0 is the set of states where isT ick is false and J1 is
the set of states where isT ick is true.
We have presented our approach on the verification of reachability and LTL
properties by using the LU simulation relation. We evaluate them in the next
section.
5 Evaluation
the memory usage of CUDD library (in MB) (Memory) over three benchmark
systems from [1,15,36]: CSMACD protocol, Fischer’s protocol, and Lynch-Shavit
protocol. We run PAT in two settings, i.e., with and without simulation, which
are referred to as PAT-Sim and PAT-NonSim. The algorithms for PAT-Sim
(PAT-NonSim resp.) on verifying reachability and LTL properties are given in
Algorithms 2 and 4 (Algorithms 1 and 3 resp.).
All experiments are conducted with a time limit of 2 CPU hours. An entry
‘oot’ in the table means that the time limit is reached, and an entry ‘oom’
means that the program runs out of memory. Given a benchmark system, when
a smaller model is running out of time or memory, we omit the evaluation of
larger models. An entry ‘-’ means the information is unavailable.
Scaling BDD-based Timed Verification with Simulation Reduction 377
Table 3. Results in the LTL verification with increasing maximal clock constants
PAT-Sim PAT-NonSim
MCC #Succ Time Memory #Succ Time Memory
CSMACD 404 4,334 5 36 14,169 493 876
CSMACD 808 8,608 18 75 28,257 2,857 1,489
CSMACD 1,616 16,688 35 82 - - oom
Fischer 200 979 2 28 2,812 417 1,101
Fischer 400 1,779 3 29 5,412 3,847 1,600
Fischer 800 3,379 8 34 - oot -
Lynch 200 6,937 25 53 19,682 2,404 1,434
Lynch 400 13,137 45 62 - oot -
Lynch 800 25,537 90 63 - - -
We evaluate our approach with Rabbit and Uppaal in the verification of reach-
ability properties. Since our approach is digitization-based, naturally, the first
question is how well the library scales with the number of clock ticks. In the first
experiment (cf. Table 1), we exponentially increase the maximal clock constants
while keeping the number of processes constant (we set it 4). Since Uppaal is
378 T.K. Nguyen et al.
a DBM-based model checker, its performance does not depend on the maximal
clock constants; therefore, it is not used in the experiment. The column MCC
is the maximal clock constant values in the corresponding models. Compared
to PAT-NonSim, PAT-Sim takes smaller number of succ function calls which
can be reduced from 2 to 4 times by using simulation. Compared to Rabbit,
PAT-Sim achieves a speedup from 2 to 21 times, and there are five cases where
Rabbit runs out of memory or time. As a result, PAT-Sim outperforms both
PAT-NonSim and Rabbit and can handle larger maximal clock constants.
In the second experiment (cf. Table 2), we compare PAT, Rabbit, and Uppaal
using the same benchmark systems. The column #Proc represents the number of
processes. In this experiment, we set the maximal clock constants to 64 in Fischer
protocol, 16 in Lynch-Shavit protocol, and 404 in CSMACD protocol. Then, we
increase the number of processes in each benchmark system to find out which tool
can verify the most number of processes. By using simulation, the number of succ
function calls is reduced. Thus, PAT-Sim is faster and can handle larger number
of processes compared to PAT-NonSim. For example, in the Lynch model with
8 processes, PAT-Sim requires 169 succ function calls and takes 8 s, while PAT-
NonSim requires 696 succ function calls and takes 6,203 s. The verification time
is thus reduced significantly. According to Table 2, PAT-Sim also outperforms
Rabbit and Uppaal. Although Uppaal achieves shorter evaluation time in smaller
number of processes, both Rabbit and Uppaal easily run out of memory or time
when the number of processes increases. On the contrary, PAT-Sim can still
verify models while both other tools are out of memory or time, for example, 64
processes in the CSMACD benchmark.
6 Discussion
Limitation. A limitation of our approach is that when maximal lower and upper
bounds are the same, LU abstraction would not provide better performance. This
is because our method will take the same number of iterations to achieve the
fixpoint, and there are overheads for calling the Down operator.
Complexity of Down operator. [7] For checking of reachability properties,
given the maximal distance from the initial state to a state in the explored
model as N , the complexity is O(N). For checking of LTL properties, the time
complexity is linearly dependent upon the size of the symbolic (BDD) repre-
sentation in terms of the distances between states in the automaton graph, the
number and arrangement of the strongly connected components in the graph,
and the number of fairness conditions asserted [39]. Overall, Down operator can
be computed efficiently. In addition, variable ordering could affect the perfor-
mance of BDD. Overall, the Down operator can be computed efficiently. In our
implementation, we make use of several well-known heuristics [6,9,23,38] that
can produce a fairly good ordering.
7 Conclusion
In this paper, we propose to use the simulation relation to improve the BDD-
based model checking for real-time systems. Our approach is applied to verify
reachability and LTL properties. Experimental results confirm that our approach
achieves a significant speedup and outperforms Rabbit, Uppaal, and CTAV. As
future works, first, we plan to investigate the extensibility of our method to other
variety of timed automata, such as parametric timed automata [4]. Second, we
plan to investigate other reduction techniques, e.g., interpolation [34] or IC3 [18],
on top of our proposed techniques.
References
1. MCMT Benchmarks of Timed Automata. http://crema.di.unimi.it/∼carioni/
mcmt ta.html
2. Technical Report of Scaling BDD-based Timed Verification with Simulation Reduc-
tion. http://tianhuat.github.io/tr bddsr.pdf
380 T.K. Nguyen et al.
3. Alur, R., Dill, D.L.: A theory of timed automata. Theor. Comput. Sci. 126(2),
183–235 (1994)
4. Alur, R., Henzinger, T.A., Vardi, M.Y.: Parametric real-time reasoning. In: STOC,
pp. 592–601 (1993)
5. Asarin, E., Maler, O., Pnueli, A.: On discretization of delays in timed automata
and digital circuits. In: Sangiorgi, D., de Simone, R. (eds.) CONCUR 1998. LNCS,
vol. 1466, pp. 470–484. Springer, Heidelberg (1998)
6. Aziz, A., Tasiran, S., Brayton, R.K.: BDD variable ordering for interacting finite
state machines. In: DAC, pp. 283–288 (1994)
7. Behrmann, G., Bouyer, P., Larsen, K.G., Pelánek, R.: Lower and upper bounds
in zone based abstractions of timed automata. In: Jensen, K., Podelski, A. (eds.)
TACAS 2004. LNCS, vol. 2988, pp. 312–326. Springer, Heidelberg (2004)
8. Behrmann, G., Larsen, K.G., Pearson, J., Weise, C., Yi, W.: Efficient timed reach-
ability analysis using clock difference diagrams. In: Halbwachs, N., Peled, D.A.
(eds.) CAV 1999. LNCS, vol. 1633, pp. 341–353. Springer, Heidelberg (1999)
9. Beyer, D.: Improvements in BDD-based reachability analysis of timed automata.
In: Oliveira, J.N., Zave, P. (eds.) FME 2001. LNCS, vol. 2021, pp. 318–343.
Springer, Heidelberg (2001)
10. Beyer, D., Lewerentz, C., Noack, A.: Rabbit: a tool for BDD-based verification of
real-time systems. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol.
2725, pp. 122–125. Springer, Heidelberg (2003)
11. Beyer, D., Noack, A.: Efficient verification of timed automata using BDDs. In:
FMICS, pp. 95–113 (2001)
12. Beyer, D., Noack, A.: Can decision diagrams overcome state space explosion in
real- time verification. In: König, H., Heiner, M., Wolisz, A. (eds.) FORTE 2003.
LNCS, vol. 2767, pp. 193–208. Springer, Heidelberg (2003)
13. Bouyer, P.: Forward analysis of updatable timed automata. Formal Methods Syst.
Des. 24(3), 281–320 (2004)
14. Bozga, M., Daws, C., Maler, O., Olivero, A., Tripakis, S., Yovine, S.: Kronos: a
model-checking tool for real-time systems. In: Vardi, Y.M. (ed.) CAV 1998. LNCS,
vol. 1427, pp. 546–550. Springer, Heidelberg (1998)
15. Bozga, M., Maler, O., Pnueli, A., Yovine, S.: Some progress in the symbolic veri-
fication of timed automata. In: Grumberg, O. (ed.) CAV 1997. LNCS, vol. 1254,
pp. 179–190. Springer, Heidelberg (1997)
16. Burch, J.R., Clarke, E.M., McMillan, K.L., Dill, D.L., Hwang, L.J.: Symbolic model
checking: 1020 states and beyond. Inf. Comput. 98(2), 142–170 (1992)
17. Chen, M., Tan, T.H., Sun, J., Liu, Y., Pang, J., Li, X.: Verification of functional
and non-functional requirements of web service composition. In: Groves, L., Sun,
J. (eds.) ICFEM 2013. LNCS, vol. 8144, pp. 313–328. Springer, Heidelberg (2013)
18. Cimatti, A., Griggio, A.: Software model checking via IC3. In: Madhusudan, P.,
Seshia, S.A. (eds.) CAV 2012. LNCS, vol. 7358, pp. 277–293. Springer, Heidelberg
(2012)
19. Daws, C., Tripakis, S.: Model checking of real-time reachability properties using
abstractions. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 313–329.
Springer, Heidelberg (1998)
20. Sifakis, J.: Timing assumptions and verification of finite-state concurrent systems.
In: Dill, D.L. (ed.) Automatic Verification Methods for Finite State Systems.
LNCS, vol. 407, pp. 197–212. Springer, Heidelberg (1989)
21. Dill, D.L., Hu, A.J., Wong-Toi, H.: Checking for language inclusion using simula-
tion preorders. In: Larsen, K.G., Hu, A.J., Wong-Toi, H. (eds.) CAV 1991. LNCS,
vol. 575, pp. 255–265. Springer, Heidelberg (1991)
Scaling BDD-based Timed Verification with Simulation Reduction 381
22. Doyen, L., Raskin, J.-F.: Antichain algorithms for finite automata. In: Esparza, J.,
Majumdar, R. (eds.) TACAS 2010. LNCS, vol. 6015, pp. 2–22. Springer, Heidelberg
(2010)
23. Fujii, H., Ootomo, G., Hori, C.: Interleaving based variable ordering methods for
ordered binary decision diagrams. In: ICCAD, pp. 38–41 (1993)
24. Henzinger, T.A., Manna, Z., Pnueli, A.: What good are digital clocks? In: Kuich,
W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 545–558. Springer, Heidelberg (1992)
25. Herbreteau, F., Srivathsan, B.: Efficient on-the-fly emptiness check for timed Büchi
automata. In: Bouajjani, A., Chin, W.-N. (eds.) ATVA 2010. LNCS, vol. 6252, pp.
218–232. Springer, Heidelberg (2010)
26. Herbreteau, F., Srivathsan, B., Walukiewicz, I.: Efficient emptiness check for timed
Büchi automata. In: Touili, T., Cook, B., Jackson, P. (eds.) CAV 2010. LNCS, vol.
6174, pp. 148–161. Springer, Heidelberg (2010)
27. Herbreteau, F., Srivathsan, B., Walukiewicz, I.: Better abstractions for timed
automata. In: LICS, pp. 375–384 (2012)
28. Kesten, Y., Pnueli, A., Raviv, L.: Algorithmic verification of linear temporal logic
specifications. In: Larsen, K.G., Skyum, S., Winskel, G. (eds.) ICALP 1998. LNCS,
vol. 1443, pp. 1–16. Springer, Heidelberg (1998)
29. Laarman, A., Olesen, M.C., Dalsgaard, A.E., Larsen, K.G., van de Pol, J.: Multi-
core emptiness checking of timed Büchi automata using inclusion abstraction. In:
Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 968–983. Springer,
Heidelberg (2013)
30. Lamport, L.: Real-time model checking is really simple. In: Borrione, D., Paul, W.
(eds.) CHARME 2005. LNCS, vol. 3725, pp. 162–175. Springer, Heidelberg (2005)
31. Larsen, K.G., Pettersson, P., Yi, W.: UPPAAL in a Nutshell. STTT 1(1–2), 134–
152 (1997)
32. Li, G.: Checking timed Büchi automata emptiness using LU-abstractions. In: Ouak-
nine, J., Vaandrager, F.W. (eds.) FORMATS 2009. LNCS, vol. 5813, pp. 228–242.
Springer, Heidelberg (2009)
33. Li, Y., Tan, T.H., Chechik, M.: Management of time requirements in component-
based systems. In: Jones, C., Pihlajasaari, P., Sun, J. (eds.) FM 2014. LNCS, vol.
8442, pp. 399–415. Springer, Heidelberg (2014)
34. McMillan, K.L.: Interpolation and SAT-based model checking. In: Hunt Jr., W.A.,
Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 1–13. Springer, Heidelberg
(2003)
35. Møller, J.B., Lichtenberg, J., Andersen, H.R., Hulgaard, H.: Difference decision
diagrams. In: Flum, J., Rodrı́guez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683,
pp. 111–125. Springer, Heidelberg (1999)
36. Morbé, G., Pigorsch, F., Scholl, C.: Fully symbolic model checking for timed
automata. In: Gopalakrishnan, G., Qadeer, S. (eds.) CAV 2011. LNCS, vol. 6806,
pp. 616–632. Springer, Heidelberg (2011)
37. Nguyen, T.K., Sun, J., Liu, Y., Dong, J.S., Liu, Y.: Improved BDD-based dis-
crete analysis of timed systems. In: Giannakopoulou, D., Méry, D. (eds.) FM 2012.
LNCS, vol. 7436, pp. 326–340. Springer, Heidelberg (2012)
38. Rice, M., Kulhari, S.: A survey of static variable ordering heuristics for efficient
BDD/MDD construction. Technical report, University of California, Riverside
(2008)
39. Rozier, K.Y.: Linear temporal logic symbolic model checking. Comput. Sci. Rev.
5(2), 163–203 (2011)
382 T.K. Nguyen et al.
40. Seshia, S.A., Bryant, R.E.: Unbounded, fully symbolic model checking of timed
automata using Boolean methods. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV
2003. LNCS, vol. 2725, pp. 154–166. Springer, Heidelberg (2003)
41. Somenzi, F.: CUDD: CU Decision Diagram Package. http://vlsi.colorado.edu/
∼fabio/CUDD/
42. Sun, J., Liu, Y., Dong, J.S., Pang, J.: PAT: towards flexible verification under
fairness. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 709–
714. Springer, Heidelberg (2009)
43. Tan, T.H., Liu, Y., Sun, J., Dong, J.S.: Verification of orchestration systems using
compositional partial order reduction. In: Qin, S., Qiu, Z. (eds.) ICFEM 2011.
LNCS, vol. 6991, pp. 98–114. Springer, Heidelberg (2011)
44. Tripakis, S.: Verifying progress in timed systems. In: Katoen, J.-P. (ed.) AMAST-
ARTS 1999, ARTS 1999, and AMAST-WS 1999. LNCS, vol. 1601, pp. 299–314.
Springer, Heidelberg (1999)
45. Tripakis, S.: Checking timed Büchi automata emptiness on simulation graphs.
ACM Trans. Comput. Logic 10(3), 1–19 (2009)
46. Wang, F.: Symbolic verification of complex real-time systems with clock-restriction
diagram. In: Kim, M., Chin, B., Kang, S., Lee, D. (eds.) FORTE 2001, vol. 69, pp.
235–250. Springer, Heidelberg (2001)
47. Wang, F.: Efficient verification of timed automata with BDD-like data-structures.
In: Zuck, L.D., Attie, P.C., Cortesi, A., Mukhopadhyay, S. (eds.) VMCAI 2003.
LNCS, vol. 2575, pp. 189–205. Springer, Heidelberg (2003)
Model Checking Real-Time Properties
on the Functional Layer of Autonomous Robots
1 Introduction
Software is an essential part of robotic systems. As robots and autonomous
systems are more and more deployed in human environments (autonomous
cars, coworker robots, surgery robotics, etc.) and/or costly exploration missions
(extraterrestrial rover, deep space mission, etc.), we need to use more elaborated
V&V techniques, in order to gain a higher level of trust in the behavior of such
systems. Indeed, the trust we currently put in robotics software mainly rely on
testing campaigns, best coding practices, and the choice of sound architecture
principles. This does not rise to the level found in many regulated domains, such
as the aeronautic or nuclear industries, where formal methods are routinely used
to check the most vital parts of systems.
On the other hand, robotics software provides new opportunities to apply
formal methods. Indeed, robotics applications are often deployed using model-
based software engineering approaches [14] and described as a set of functional
modules orchestrated by a robotics middleware. These modules, and their inter-
actions, are amenable to an interpretation into formal models.
Autonomous systems are typically organized along layers [13]. The lower one,
the functional layer, interacts directly with sensors and actuators and performs
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 383–399, 2016.
DOI: 10.1007/978-3-319-47846-3 24
384 M. Foughali et al.
the data processing tasks. The decisional layer deals with more cognitive activ-
ities, such as task planning or monitoring. With respect to V&V, the decisional
layer models are often formal and range from planning models (PDDL, ANML,
NDDL, etc.) to acting models (TDL, SMach, RMPL, OpenPRS, etc.) or moni-
toring models (Livingstone, etc.) [22], a fact reflected by a large body of research
applying formal V&V approaches to the deliberation functions [1,16,21,29]. In
contrast, little has been done to bridge frameworks used to deploy functional
level modules with formal methods and their associated V&V tools.
In this paper, we propose to connect a robotics model-based approach
(GenoM3) with a formal V&V framework (Fiacre/TINA). We describe how we
can automatically synthesize a formal model of robotics functional modules and
then use it to prove important behavioral and timed properties of the mod-
ules implementation on the robot. We illustrate our presentation with a realistic
autonomous navigation example, on which we formally prove properties of inter-
est to the robot programmers.
The paper is organized as follows. After a section on related works focusing
on formal verification of the functional level of robotic systems, we introduce
(Sect. 3) the Fiacre formal specification language and the TINA model-checking
toolbox. We then describe the GenoM3 framework (Sect. 4), used to specify func-
tional level modules for robotic systems. In Sect. 5, we illustrate our robot nav-
igation example as specified in GenoM3. Section 6.1 gives examples on how we
map GenoM modules constituents into Fiacre so as to automatically synthesize
formal models. Before concluding, Sect. 7 discusses some examples of properties
formally checked on our navigation modules.
2 Related Work
BIP [4], a modeling framework based on automata, is used in the joint veri-
fication effort presented in [2]. The functional modules, written in GenoM, of an
outdoor robot with two navigation modes, are modeled in BIP. The invariant
extractor and SAT-solving tool D-Finder [5] is used to check, offline, the absence
of deadlocks within the BIP model. Additional safety constraints can be added
and automatically translated from logical formulae into BIP. The resulting model
is run within the BIP Engine on DALA, an iRobot ATRV (All-Terrain Robotic
Vehicle), and the constraints are consequently enforced at runtime. Timing con-
straints are not considered.
In [20], the MAUVE framework is used to build functional level components
for a P3DX mobile robot. The schedulability of the different components is
formally verified. Execution scenarios are manually translated into Fiacre [6]
models and behavioral properties are asserted on them.
This list is far from being exhaustive. Indeed, we only mentioned methods
comparable to ours, omitting for instance those relying on hybrid formal models
like [17] or on pure theorem proving as in [31]. Our approach is the closest in spirit
to that of [19] and relies on model-checking. Formal models are automatically
synthesized and all properties are checked in the same verification framework,
including timed properties.
select
on target; wait [0,0]; to idle
unless
wait ]Δ,...[; to error /* where Δ = d2 − d1 */
end
Time Petri nets. Together with Timed Automata, Time Petri nets [26] (TPN for
short) are a prominent model for analysis of real-time systems. Time Petri nets
enrich Petri nets with time intervals associated with the transitions of the net
specifying the possible time delays between last enabledness of these transitions
and their activation (or firing in Petri net terminology).
Due to the dense nature of time considered in TPN, their state spaces are
typically infinite, but finite abstractions of these are available since [8], known
as State Classes. State Classes provide a finite time-abstracted representation
of the behavior of bounded TPN preserving their markings and traces. A state
class associates a marking of the TPN with a system of difference constraints
(a DBM) capturing the times in the future at which the transitions enabled at
that marking can fire.
Since it preserves markings and traces, the state classes construction is suit-
able for LTL model-checking. A simple variation of the construction (reducing
classes by inclusion) only preserves markings and is typically coarser; it is the
method of choice for reachability analysis.
In contrast with the well known zone constructions for Timed Automata,
state classes do not capture clock domains for the enabled transitions, but poten-
tial firing times in the future (called firing domains). For these reasons, state class
constructions are typically coarser than zone constructions preserving the same
properties. But zone constructions are also applicable to TPN and are indeed
necessary to handle some TPN extensions like priorities.
A description of available abstraction methods for TPN can be found in [9,
10]. TINA offers all constructions discussed in these papers, as well as several
constructions relying on discrete time and a number of constructions specific to
Petri nets.
Verification in TINA. The TINA toolbox provides state space generators and
offline model-checkers for LTL and modal µ-calculus. The generators produce
compressed representations of state spaces into files. Some classes of properties
can also be checked on the fly when building state spaces. When a property
reveals false, a counter example scenario is generated as a timed trace and can
be replayed in a simulator.
4 GenoM3
Functional modules are the building block of LAAS robot architecture functional
level [23]. Each module is in charge of a specific function on the robot, from con-
trolling a low-level driver (e.g. motors), a sensor (e.g. laser, camera, etc.), up to
more complex functionalities (e.g. motion planning, Simultaneous Localization
And Mapping “SLAM”, etc.). These modules are controlled by a supervisor (e.g.
OpenPRS1 , eltcsh2 , etc.).
GenoM3 [24] is a tool that parses a specification language for functional mod-
ules. It provides a template-based generator to synthesize code, libraries, models,
etc., from the specification.
A GenoM3 module (Fig. 1) is specified in the language with the following
elements:
Requests Reports
PORTS
IDS
Execution Tasks
Activitiy Services
Services can take parameters and return values. Each Activity executes in an
execution task ET that it specifies. It also defines an automaton that specifies
for each state:
– the codel3 to execute in this state, taking as arguments the elements in and
out from the IDS, and the ports in and out it needs for its execution.
– the list of states it yields to.
– the WCET (Worst Case Execution Time) of the codel.
All activities have a start state-codel, which is the entry point in the automa-
ton, and an ether state which is a sink (terminal) state. At runtime, the codel
associated with a state must return the state to which it will transition, or
throw an exception. An activity thus terminates (transitions to ether) either
with an exception or with a nominal end. In both cases, exception or return
values are reported to the client that requested the activity. A service may have
a validate codel to validate the in arguments before it runs. Any service may
be incompatible with a list of services that need to be interrupted before it exe-
cutes (including itself if e.g. at most one instance of the same service may run
at any time). Interrupted activities execute directly their stop codel, if defined,
otherwise they transit to ether.
3
Codels (code elements) are the programmer implementation of the specified service,
broken down to small chunks of C or C++ code.
390 M. Foughali et al.
Each module has an implicit aperiodic control task CT , in charge of the mod-
ule I/O. The CT handles requests from clients as well as the reports upon exe-
cution of services. CT is also responsible for executing attributes and functions,
and instructing the different ETi of the activity instances to run or interrupt.
Templates Mechanism. The GenoM3 parser builds an abstract syntax tree and
converts it into a suitable representation for the scripting language of the tem-
plate interpreter (TCL). Then, every file of the template is read by GenoM3 and
interpreted within this representation. Special markers in the file are detected
and their content replaced in a manner similar to how a PHP script is embedded
into an HTML page. The scripted code has access to all the information of the
module description file. A typical template will consist of regular code, mixed
with scripted loops on e.g., services that generate calls to functions of the core
libraries. Since the interpreter relies on a complete scripting language, there are
virtually no restrictions on what a template can express and synthesize.
There are already templates to synthesize: the module itself for various mid-
dleware (e.g., PocoLibs4 , ROS-Com [27], Orocos [15]); client libraries to control
the module (e.g., JSON, C, OpenPRS), etc. The template we developed in this
work maps the PocoLibs module implementation of any set of modules speci-
fied in GenoM3 into their timed Fiacre model. From now on, when we refer to a
GenoM3 module, we implicitly mean the GenoM3 PocoLibs implementation of the
module.
5 Illustrative Example
robloco is in charge of the robot low-level controller. It has a track task (period
50 ms) associated to the activity TSStart (TrackSpeedStart, interruptible by
the function TSStop) that reads data from the speed port and sends it to the
motor controller. In parallel, one of the odo task (period 50 ms) associated
activities, namely OdoStart (interruptible by the function OdoStop), reads
the encoders on the wheels and produces a current position on the pos port.
roblaser is in charge of the laser. It has a scan task (period 50 ms) associated,
inter alia, to the StartScan activity (interruptible by the function StopScan).
The latter produces, on the port scan, the free space in the laser’s range
tagged with the position where the scan has been made (read on pos).
4
https://git.openrobots.org/projects/pocolibs/gollum/index.
5
http://rmp.segway.com/tag/rmp400/.
Model Checking Real-Time Properties on the Functional Layer 391
(a) The robot navigation with its four (b) The GotoPosition activity automa-
modules, their tasks and a par- ton.
tial list of their services (activities are in
italic)
robmap aggregates the successive scan data in the map port. A fuse task
(period 50 ms) and FuseMap, one of its activities, perform the computation.
The function FuseStop interrupts the activity FuseMap.
robmotion has one task plan (period 500 ms) which, given a goal position (via
the activity GotoPosition), computes the appropriate speed to reach it and
writes it on speed, using the current position (from pos), and avoiding obsta-
cles (from map). GotoPosition interrupts itself, so a new request will cancel
the currently running one (if it exists) and force the execution of its stop
state. Similarly, The Stop service (function) interrupts GotoPosition.
Each activity introduced above has its own automaton. Figure 2b presents
the automaton of GotoPosition. For each state, we define a codel, its WCET,
the ports and the elements of the IDS it needs (in and out). Listing 1 presents
the GenoM3 specification of this activity.
activity GotoPosition (in robloco::position goto_position)
{ validate controlPosition (in goto_position) wcet 10 ms;
codel <start> gotoposStart(in goto_position, port in pos, port in map,
ids out goal_pos, ids out attempts) yield read_ports, ether wcet 50 ms;
codel <read_ports> gotoposReadPorts(ids out pos, ids out explored_map,
port in pos, port in map) yield compute_speed wcet 50 ms;
codel <compute_speed> gotoposComputeSpeed(ids in goal_pos, ids in pos,
ids in explored_map, ids in verbose, /* This codel takes a long time */
ids out speed, ids inout attempts) /* we make sure no ports are locked */
yield write_port, end, path_blocked wcet 200 ms;
392 M. Foughali et al.
6.1 Mapping
the activities. The timer (Listing 2–left) assigns, every new time period PERIOD,
the value true to the variable tick that it shares with the manager. The man-
ager starts only when tick is true and switches this flag to false. If there are
active activities in this task, it transitions to the state manage and executes them
accordingly (Sect. 5). It does not transition back to its initial state, start, unless
all eligible executions in this cycle have ended.
wait ]0,WCET];
NTS := NOT_RUNNING;
... /* possible transitions */
Listing 3. Fiacre model of a non-thread safe state-codel (simplified)
For producing Fiacre models from GenoM3 descriptions, we rely on the generic
template mechanism provided by the GenoM3 environment (Sect. 4). Fiacre mod-
els are generated fully automatically from unrestricted GenoM3 descriptions.
Model Checking Real-Time Properties on the Functional Layer 395
The mappings from GenoM3 to Fiacre, some of which are discussed in Sect. 6.1,
have been carefully chosen so that the behavior of the generated Fiacre mod-
els faithfully represents that of the GenoM3 module. The translation of GenoM3
descriptions into Fiacre gives them a formal semantics, which enables verifica-
tion of real-time properties as illustrated in the next section. This constitutes
the very first formalization of GenoM3 specifications.
Safe End. Let us consider the module robmap (Sect. 5). We assert the following
safety property: when the module terminates following a kill request, all services
have properly terminated. This translates in Fiacre to: for all execution paths, if
the process timer is in state shutdown, then the function running returns false
for all services instances:
property safeshut is always ((robmap/timer/state shutdown) ⇒
not (robmap/manager/value (running (.../*all services
instances*/))))
Indeed, our unique execution task’s timer transits to the state shutdown when
the module is killed, and the function running evaluates to true only if at least
one of the services is running or being interrupted. Again, this property is an
invariant and does not rely on traces. In our experiment, this property can be
checked true by exploring a state class graph with 125 606 classes and 102 512
markings, computed in 4 s.
We synthesize the global Fiacre model for the four modules communicating
through ports. We then add a Fiacre client defining a full-navigation scenario.
Safe Stop. We extend the client providing the navigation scenario to generate,
at any given moment, a TSStop (Sect. 5) request. We again rely on the pattern
leadsto within (Sect. 3) to formally prove that the generation of such a request
leads to the termination of the running instance of TSStart in a maximum
duration. We proved that this duration amounts to 72 ms with the model checker
succeeding to find a counterexample for the next smaller value (i.e. 71 ms). Since
the end of TSStart (through an interruption) means necessarily sending a null
speed to the motor controller, the programmer may deduce critical information
from this current setup, e.g., that the robot driving at 2 m/s will advance at
least 0.14 m before a full stop. The reachability graph features 1 484 091 classes
built in about 3 mn.
8 Conclusion
We formally check important real-time properties on the navigation modules
of our RMP 400 robot. Our results compare favorably with previous works. In
contrast to [2,13], we take all time constraints into account. Also, unlike the
related works cited in Sect. 2 ([2] aside), we provide a fully automatic trans-
lation from GenoM3 specifications to the equivalent Fiacre model. Finally, and
compared to [19], our experiments tackle examples of a high complexity and
a maximum level of parallelism. We succeed to check nontrivial timed proper-
ties; no property verification lasted more than 18 mn (including the time needed
to generate the reachability graph). These promising results are mainly due to
careful modeling choices (Sects. 6 and 7) and optimized state space generation
techniques implemented in TINA.
Formalizing GenoM3 specifications (Sect. 6) remains the hardest part of our
effort. Several PocoLibs/GenoM3 aspects were not trivially expressible in Fiacre.
Moreover, avoiding the combinatory explosion of model checking was challeng-
ing. Modeling choices were systematically assessed considering, despite their cor-
rectness, the ability to express and verify important properties on them. Many
of such choices were thus discarded or refined throughout the process. As a
consequence, the resulting models for our experiments remain scalable.
An unexpected result from this work is that transforming a GenoM3 specifi-
cation and its PocoLibs implementation in a language like Fiacre, with a clear
formal semantics, forced us to clarify some of the implementation choices and
fix bugs.
398 M. Foughali et al.
Acknowledgement. This work was supported in part by the EU CPSE Labs project
funded by the H2020 program under grant agreement No. 644400.
References
1. Abdeddaı̈m, Y., Asarin, E., Gallien, M., Ingrand, F., Lesire, C., Sighireanu,
M.: Planning robust temporal plans: a comparison between CBTP and TGA
approaches. In: ICAPS (2007)
2. Abdellatif, T., Bensalem, S., Combaz, J., de Silva, L., Ingrand, F.: Rigorous design
of robot software: a formal component-based approach. Robot. Auton. Syst. 60,
1563–1578 (2012)
3. Abid, N., Dal Zilio, S., Le Botlan, D.: A formal framework to specify and verify
real-time properties on critical systems. Int. J. Crit. Comput. Based Syst. 5(1),
4–30 (2014)
4. Basu, A., Bozga, M., Sifakis, J.: Modeling heterogeneous real-time components in
BIP. In: SEFM, pp. 3–12 (2006)
5. Bensalem, S., Bozga, M., Nguyen, T.-H., Sifakis, J.: D-Finder: a tool for composi-
tional deadlock detection and verification. In: Bouajjani, A., Maler, O. (eds.) CAV
2009. LNCS, vol. 5643, pp. 614–619. Springer, Heidelberg (2009)
6. Berthomieu, B., Bodeveix, J.-P., Farail, P., Filali, M., Garavel, H., Gaufillet, P.,
Lang, F., Vernadat, F.: Fiacre: an intermediate language for model verification in
the topcased environment. In: ERTS, HAL - CCSD, Toulouse (2008)
7. Berthomieu, B., Dal Zilio, S., Fronc, L
.: Model-checking real-time properties of an
aircraft landing gear system using fiacre. In: Boniol, F., Wiels, V., Ait Ameur, Y.,
Schewe, K.-D. (eds.) ABZ 2014. CCIS, vol. 433, pp. 110–125. Springer, Heidelberg
(2014)
8. Berthomieu, B., Menasche, M.: An enumerative approach for analyzing time Petri
nets. IFIP Congr. Ser. 9, 41–46 (1983)
9. Berthomieu, B., Ribet, P.-O., Vernadat, F.: The tool TINA - construction of
abstract state spaces for Petri nets and Time Petri. Int. J. Prod. Res. 42(14),
2741–2756 (2004)
10. Berthomieu, B., Vernadat, F.: State Space Abstractions for Time Petri Nets. Hand-
book of Real-Time and Embedded Systems. CRC Press, Boca Raton (2007)
Model Checking Real-Time Properties on the Functional Layer 399
11. Bourdil, P.-A., Berthomieu, B., Jenn, E.: Model-checking real-time properties of
an auto flight control system function. In: IEEE ISSREW (2014)
12. Boussinot, F., de Simone, R.: The ESTEREL Language. In: Proceeding of the
IEEE, pp. 1293–1304, September 1991
13. Brat, G., Denney, E., Giannakopoulou, D., Frank, J., Jónsson, A.K.: Verification of
autonomous systems for space applications. In: IEEE Aerospace Conference (2006)
14. Brugali, D.: Model-driven software engineering in robotics. IEEE Robot. Autom.
Mag. 22(3), 155–166 (2015)
15. Bruyninckx, H.: Open robot control software: the OROCOS project. In: IEEE
International Conference on Robotics and Automation (2001)
16. Cimatti, A., Roveri, M., Bertoli, P.: Conformant planning via symbolic model
checking and heuristic search. Artif. Intell. 159, 127–206 (2004)
17. Dolginova, E., Lynch, N.: Safety verification for automated platoon maneuvers: a
case study. In: Maler, O. (ed.) HART 1997. LNCS, vol. 1201, pp. 154–170. Springer,
Heidelberg (1997)
18. Dwyer, M.B., Avrunin, G.S., Corbett, J.C.: Patterns in property specifications for
finite-state verification. In: ICSE (1999)
19. Espiau, B., Kapellos, K., Jourdan, M.: Formal verification in robotics: why and
how? In: Giralt, G., Hirzinge, G. (eds.) Robotics Research. Springer, London (1996)
20. Gobillot, N., Lesire, C., Doose, D.: A modeling framework for software architecture
specification and validation. In: Brugali, D., Broenink, J.F., Kroeger, T., MacDon-
ald, B.A. (eds.) SIMPAR 2014. LNCS, vol. 8810, pp. 303–314. Springer, Heidelberg
(2014)
21. Hähnel, D., Burgard, W., Lakemeyer, G.: GOLEX—bridging the gap between logic
(GOLOG) and a real robot. In: Herzog, O. (ed.) KI 1998. LNCS, vol. 1504, pp.
165–176. Springer, Heidelberg (1998)
22. Ingrand, F., Ghallab, M.: Deliberation for autonomous robots: a survey. Artif.
Intell. 1–40 (2014). Elsevier
23. Ingrand, F., Lacroix, S., Lemai-Chenevier, S., Py, F.: Decisional autonomy of plan-
etary rovers. J. Field Robot. 24(7), 559–580 (2007)
24. Mallet, A., Pasteur, C., Herrb, M., Lemaignan, S., Ingrand, F.: GenoM3: building
middleware-independent robotic components. In: IEEE ICRA (2010)
25. Maraninchi, F.: Operational and compositional semantics of synchronous automa-
ton compositions. In: Cleaveland, W.R. (ed.) CONCUR 1992. LNCS, vol. 630, pp.
550–564. Springer, Heidelberg (1992)
26. Merlin, P.M., Farber, D.J.: Recoverability of communication protocols: implica-
tions of a theoretical study. IEEE Trans. Commun. 24(9), 1036–1043 (1976)
27. Quigley, M., Gerkey, B., Conley, K., Faust, J., Foote, T., Leibs, J., Berger, E.,
Wheeler, R., Ng, A.Y.: ROS: an open-source Robot Operating System. In: IEEE
ICRA (2009)
28. Rangra, S., Gaudin, E.: SDL to Fiacre translation. In: Embedded Real-Time Soft-
ware and Systems, Toulouse (2014)
29. Simmons, R., Pecheur, C.: Automating model checking for autonomous systems.
In: AAAI Spring Symposium on Real-Time Autonomous Systems (2000)
30. Simon, D., Joubert, A.: ORCCAD: towards an open robot controller computer
aided design system. Technical report, Research report 1396, INRIA (1991)
31. Täubig, H.H., Frese, U., Hertzberg, C., Lüth, C., Mohr, S., Vorobev, E.,
Walter, D.: Guaranteeing functional safety: design for provability and comp
uter-aided verification. Auton. Robots 32(3), 303–331 (2011)
32. Wongpiromsarn, T., Murray, R.M.: Formal verification of an autonomous vehicle
system. In: Conference on Decision and Control, May 2008
Decision Problems for Parametric Timed
Automata
1 Introduction
Timed automata (TAs) [1] are a powerful formalism that extend finite-state
automata with clocks (real-valued variables evolving linearly) that can be com-
pared with integer constants in locations (“invariants”) and along transitions
(“guards”); additionally, some clocks can be reset to 0 along transitions. Many
interesting problems for TAs (including the reachability of a location) are decid-
able. However, the classical definition of TAs is not tailored to verify systems
only partially specified, especially when the value of some timing constants is
not yet known.
Parametric timed automata (PTAs) [2] leverage this problem by allowing the
specification and the verification of systems where some of the timing constants
are parametric. PTAs extend TAs by allowing the use of integer- or rational-
valued parameters in place of timing constants in guards and invariants. PTAs
were used to verify a variety of case studies, from hardware circuits to com-
munication protocols (see [3]). This expressive power comes at the price of the
undecidability of most interesting problems. The EF-emptiness problem (“does
there exist a parameter valuation such that a given location is reachable?”) is
This work is partially supported by the ANR national research program “PACS”
(ANR-14-CE28-0002).
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 400–416, 2016.
DOI: 10.1007/978-3-319-47846-3 25
Decision Problems for Parametric Timed Automata 401
undecidable in general [2], even when parameters are bounded [15], even when
only strict inequalities are used [11], and with a single integer-valued parame-
ter [8].
In [13], L/U-PTAs are introduced as a subclass of PTAs where each para-
meter is either always compared to a clock as a lower bound in guards and
invariants, or always as an upper bound. The EF-emptiness problem is decidable
for L/U-PTAs. In [10], further results are proved for L/U-PTAs with integer-
valued parameters: emptiness, finiteness and universality of the set of parameter
valuations for which there exists an infinite accepting run are decidable. The AF-
emptiness problem (“does there exist a parameter valuation for which a given
location is eventually reached for any run?”) is undecidable for L/U-PTAs [14].
It is also shown in [14] that the synthesis of the parameters reaching a given
location in an L/U-PTA is intractable in practice. Two further subclasses have
been defined in [10]: L-PTAs and U-PTAs, where all parameters are always lower
bounds and upper bounds respectively.
In [14], PTAs with bounded integer-valued parameters are considered. The
problem of finding parameter valuations such that a given location is reach-
able or unavoidable becomes decidable, and two algorithms are provided that
compute the exact such sets of integer valuations in a symbolic manner, i.e.,
without performing an exhaustive enumeration. In [6], it is shown that comput-
ing a parametric extrapolation of the integer hull of symbolic states allows one
to synthesize (rational-valued) parameter valuations for bounded PTAs, guaran-
teeing the synthesis of at least all integer-valued valuations, but also sometimes
most or even all rational-valued valuations.
1
The bounded integer PTAs of [14] are arguably a trivial such subclass (even though
the associated analysis techniques are not).
402 É. André et al.
Our second main contribution is to study several open problems for PTAs and
several known subclasses (as well as the new class of IP-PTAs): we study here the
emptiness and universality of reachability (EF), as well as unavoidability empti-
ness (AF). Emptiness is of utmost importance as, without decidability of the
emptiness, exact synthesis is practically ruled out. Universality checks whether
all parameter valuations satisfy a property, which is important for applications
where the designer has no power on some valuations; this is the case of net-
works, where some latencies (e.g., the transmission time of some packets) may
be totally arbitrary. Among our results, we prove in particular that AF-emptiness
is undecidable for both bounded IP-PTAs and bounded L/U-PTAs. Overall, we
significantly enhance the knowledge we have of decidability problems for PTAs
and subclasses.
2 Preliminaries
2.1 Clocks, Parameters and Constraints
Let N, Z, Q+ and R+ denote the sets of non-negative integers, integers, non-
negative rational numbers and non-negative real numbers respectively.
Throughout this paper, we assume a set X = {x1 , . . . , xH } of clocks, i.e., real-
valued variables that evolve at the same rate. A clock valuation is a function
w : X → R+ . We identify a clock valuation w with the point (w(x1 ), . . . , w(xH )).
An integer clock valuation is a valuation w : X → N. We write 0 for the valuation
that assigns 0 to each clock. Given d ∈ R+ , w + d denotes the valuation such
that (w + d)(x) = w(x) + d, for all x ∈ X.
We assume a set P = {p1 , . . . , pM } of parameters, i.e., unknown constants.
A parameter valuation v is a function v : P → Q+ . We identify a valuation v
with the point (v(p1 ), . . . , v(pM )). An integer parameter (resp. clock) valuation
is a valuation that assigns an integer value to each parameter (resp. clock).
In the following, we assume ≺ ∈ {<, ≤} and ∈ {<,
≤, ≥, >}. lt denotes
a linear term over X ∪ P of the form 1≤i≤H αi xi + 1≤j≤M βj pj + d, with
xi ∈ X, pj ∈ P , and αi , βj , d ∈ Z. plt denotes a parametric linear term over P ,
that is a linear term without clocks (αi = 0 for all i). A constraint C over X ∪ P
is a conjunction of inequalities of the form lt 0 (i.e., a convex polyhedron).
Given a parameter valuation v, v(C) denotes the constraint over X obtained
Decision Problems for Parametric Timed Automata 403
We say that a PTA is closed if all its guards and invariants use only non-strict
constraints. Note that the grammar of constraints does not include negation so
this restriction is meaningful, and that = defines closed constraints.
Given a parameter valuation v, we denote by v(A) the non-parametric timed
automaton where all occurrences of a parameter pi have been replaced by v(pi ).
– S = {(l, w) ∈ L × RH
+ | w|v |= I(l)}, s0 = (l0 , 0)
404 É. André et al.
In this paper, we will sometimes consider bounded PTAs, i.e., PTAs with a
bounded parameter domain that assigns to each parameter a minimum integer
bound and a maximum integer bound. That is, each parameter pi ranges in
an interval [ai , bi ], with ai , bi ∈ N. Hence, a bounded parameter domain is a
hyperrectangle of dimension M .
Let us now recall L/U-PTAs [10,13].
3 Undecidability of EF-Emptiness
Let us first recall the following classical result for PTAs.
Theorem 1 [15]. The EF-emptiness problem is undecidable for bounded PTAs.
We provide an alternative and original proof of this result. This new con-
struction is similar to that of Miller [15], but it might be seen as a bit simpler
and we will provide a complete proof. And above all, it allows us to extend it to
obtain several of the main results of this paper.
Proof. We build a PTA that encodes a 2-counter machine (2CM) [16], such that
the machine halts iff there exists some valuation of the parameters of the PTA
such that it reaches a specific location.
Recall that such a machine has two non-negative counters C1 and C2 , a finite
number of states and a finite number of transitions, which can be of the form:
– when in state si , increment Ck and go to sj ;
– when in state si , decrement Ck and go to sj ;
– when in state si , if Ck = 0 then go to sj , otherwise block.
The machine starts in state s0 and halts when it reaches a particular state
lhalt . The halting problem for 2-counter machines is undecidable [16].
Given such a machine M, we now provide an encoding as a PTA A(M):
each state si of the machine is encoded as a location of the automaton, which
we also call si .
406 É. André et al.
z = 1, li2 y = a + 1,
z := 0 y := 0
x = 1,
x=0 x := 0
si li1 li3 sj
x=1
x := 0 y = a + 1, z = 1,
l0 s0 y := 0
li2 z := 0
The counters are encoded using clocks x, y and z and one parameter a,
with the following relations with the values c1 and c2 of counters C1 and C2 :
in any location si , when x = 0, we have y = 1 − ac1 and z = 1 − ac2 . Note
that all three clocks are parametric, i.e., are compared with a in some guard or
invariant. We will see that a is a rational-valued bounded parameter, typically
in [0, 1]. The main idea of our encoding is that, to correctly simulate the machine,
the parameter must be sufficiently small to encode the maximum value of the
counters, i.e., for 1 − ac1 and 1 − ac2 to stay non-negative all along the execution
of the machine.
We initialize the clocks with the gadget in Fig. 1a. Clearly, when in s0 with
x = 0, we have y = z = 1, which indeed corresponds to counter values 0.
We now present the gadget encoding the increment instruction of C1 in
Fig. 1b. The transition from si to li1 only serves to clearly indicate the entry
in the increment gadget and is done in 0 time unit.
Since we use only equalities, there are really only two paths that go through the
gadget: one going through li2 and one through li2 . Let us begin with the former.
We start from some encoding configuration: x = 0, y = 1−ac1 and z = 1−ac2
in si (and therefore the same in li1 ). We can enter li2 (after elapsing enough
time) if 1 − ac2 ≤ 1, i.e., ac2 ≥ 0, which implies that a ≥ 0, and when entering
li2 we have x = ac2 , y = 1 − ac1 + ac2 and z = 0. Then we can enter li3 if
1 − ac1 + ac2 ≤ 1 + a, i.e., a(c1 + 1) ≥ ac2 . When entering li3 , we then have
x = a(c1 + 1), y = 0 and z = a(c1 + 1) − ac2 . Finally, we can go to sj if
a(c1 + 1) ≤ 1 and when entering sj we have x = 0, y = 1 − a(c1 + 1) and
z = 1 − ac2 , as expected.
We now examine the second path. We can enter li2 if 1 − ac1 ≤ a + 1,
i.e., a(c1 + 1) ≥ 0, and when entering li2 we have x = a(c1 + 1), y = 0 and
z = 1 − ac2 + a(c1 + 1). Then we can go to li3 if 1 − ac2 + a(c1 + 1) ≤ 1 + a, i.e.,
a(c1 + 1) ≤ ac2 . When entering li3 , we then have x = ac2 , y = ac2 − a(c1 + 1)
and z = 0. Finally, we can go to sj if ac2 ≤ 1 and when entering sj we have
x = 0, y = 1 − a(c1 + 1) and z = 1 − ac2 , as expected.
Remark that exactly one path can be taken depending on the respective order
of c1 + 1 and c2 , except when both are equal or a = 0, in which cases both paths
lead to the same configuration anyway.
Decrement is done similarly by replacing guards y = a + 1 with y = 1, and
guards x = 1 and z = 1 with x = a + 1 and z = a + 1, respectively.
Decision Problems for Parametric Timed Automata 407
Definition 4. A PTA A is an integer points PTA (in short IP-PTA) if, in any
reachable symbolic state (l, C) of A, C contains at least one integer point.
Our main positive result is that the EF-emptiness problem is decidable for
bounded IP-PTAs.
Proof. We first need to recall two lemmas relating symbolic and concrete runs
(proved in [4,13]).
e0 e1 em−1
Given a concrete (respectively symbolic) run (l0 , 0) → (l1 , w1 ) → ··· →
e0 e1 em−1
(lm , wm ) (respectively (l0 , C0 ) ⇒ (l1 , C1 ) ⇒ · · · ⇒ (lm , Cm )), we define the
e0 e1 em−1
corresponding discrete sequence as l0 ⇒ l1 ⇒ · · · ⇒ lm . Two runs (concrete
or symbolic) are said to be equivalent if their associated discrete sequences are
equal.
equal to v(p+ j ) also belong to C↓P . In particular, this is the case of the integer
parameter valuation assigning 0 to all lower-bound parameters, and assigning to
upper-bound parameters p+ j the smallest integer greater than or equal to v(pj ).
+
The previous lemma that ensures the presence of an integer parameter valua-
tion in any symbolic state does not guarantee that an L/U-PTA is an IP-PTA,
because clocks may have non-integer values.
Proof
– It is easy to exhibit an IP-PTA that is not an L/U-PTA. This is for example the
case of a simple PTA with only one location, one clock x and one parameter p
with a self-loop with guard x = p and resetting x.
However, we can prove that any closed L/U-PTA, i.e., with only non-strict
inequalities, is an IP-PTA. In order to show that the class of closed L/U-PTAs
is included in IP-PTAs, we need the following lemma.
Proof. Since there is at least one integer parameter valuation v in C↓P , then
v(C) is not empty. Since v is an integer valuation, v(C) is a zone of a timed
automaton with integer constants, so the vertices of v(C) are integer points.
Finally, there is at least one vertex in v(C) because all clocks are nonnegative
(and hence are bounded from below by 0), and this vertex does belong to v(C)
because it is topologically closed due to the non-strict constraints. So C contains
at least one integer point.
Proposition 2. The class of IP-PTAs is strictly larger than the class of closed
L/U-PTAs.
Proposition 3. The class of bounded IP-PTAs is strictly larger than the class
of closed bounded L/U-PTAs.
Proof. Lemma 3 extends to bounded L/U-PTAs, since the bounds are integers
(this would not hold otherwise). Then, the proof of Proposition 1 (⇐) holds with
bounded IP-PTAs and closed bounded L/U-PTAs. Applying Lemma 4 concludes
the proof.
Proof. The proof of Proposition 1 can be applied with bounded PTAs on either
side.
Since bounded IP-PTAs are incomparable with L/U-PTAs (for which the EF-
emptiness problem is known to be decidable), and since L/U-PTAs are the only
non-trivial subclass of PTAs for which this problem is known to be decidable,
then Theorem 3 strictly extends the subclass of PTAs for which this problem is
decidable.
Decision Problems for Parametric Timed Automata 411
Proof. We reuse the idea of [10] used for proving that constrained emptiness for
infinite runs acceptance properties is undecidable, and reused in [14, Theorem
2]. Suppose that the solution to the EF-synthesis problem for closed bounded
L/U-PTAs can be represented using a formalism for which emptiness of the
intersection with equality constraints is decidable. Assume a closed bounded
PTA A; for each parameter pi of A that is used both as an upper bound and a
lower bound, replace its occurrences as upper bounds by a fresh parameter pui
and its occurrences as lower bounds by a fresh parameter pli . We therefore obtain
a closed bounded L/U-PTA. Assume we can derive a solution to the EF-synthesis
problem for this closed bounded L/U-PTA, and let K be that solution. Then,
by hypothesis, we can decide whether K ∧ i pli = pui is empty or not; hence,
we can solve the EF-emptiness for A, which contradicts the undecidability of
EF-emptiness for closed bounded PTAs (from Theorem 2).
4.4 Membership
We first show that it cannot be decided in general whether a PTA is a (bounded)
IP-PTA.
Proof. Let us consider the PTA A(M) encoding the 2-counter machine M pro-
posed in our proof of Theorem 1. The PTA A(M) has only one parameter a and
all the symbolic states of A(M) contain the integer value a = 0 except the states
corresponding to the location lhalt . Since all constraints are non-strict, except
that of the transition leading to lhalt , all reachable symbolic states, except those
412 É. André et al.
associated with lhalt , contain an integer point. Then the PTA A(M) reaches
the location lhalt if and only if A(M) is not an IP-PTA. As a consequence, this
PTA is an IP-PTA iff the 2-counter machine does not halt. Finally, note that
this PTA can be bounded by 0 ≤ a ≤ 1, without any change in the reasoning
above.
Nevertheless, Proposition 2 provides a sufficient syntactic membership con-
dition, since any closed L/U-PTA is an IP-PTA. In addition, we now define
another new non-trivial set of restrictions leading to IP-PTAs:
Definition 5 (Reset-PTA). A reset-PTA is a PTA where:
– all guards and invariants are conjunctions of constraints of the form x ≤ p+k,
x ≥ p + k, x ≤ k, or x ≥ k, with x a clock, p a parameter, and k an integer;
– and all clocks are reset to 0 on any transition with a guard or a source location
invariant in which a parameter appears.
This kind of restriction is somewhat reminiscent of those enforced by initial-
ized hybrid automata [12] to obtain decidability. We now prove that reset-PTAs
are IP-PTAs, which in turn means that the EF-emptiness problem is decidable
for bounded reset-PTAs. It is worth noting that, to the best our knowledge,
bounded reset-PTAs and L/U-PTAs are the only non-trivial sets of syntactic
restrictions of PTAs making the reachability emptiness problem decidable.
Theorem 6. Any reset-PTA is an IP-PTA.
Recall that the synthesis is intractable for bounded IP-PTAs (from
Corollary 1) and for bounded L/U-PTAs. In contrast, and although studying
reset-PTAs in detail goes beyond the scope of this work, we highly suspect that
exact synthesis can be computed for reset-PTAs (see remarks in Sect. 6).
5.3 Summary
Before being able to summarize our results in Table 1, we need to prove two
further missing results.
Proof. The proof of the undecidability of the EF-emptiness problem for general
PTAs in [2] can be interpreted over integer parameter valuations. Any symbolic
state contains at least one integer parameter valuation (the one that is large
enough to correctly encode the value of the two counters), as well as all larger
parameter valuations. Furthermore, since the proof only uses non-strict inequal-
ities (in fact only equalities), from Lemma 4, all symbolic states contain at least
one integer point. Hence the PTA used in [2] to encode the 2-counter machine
is an IP-PTA.
Finally, we show below (without surprise) that the EF-emptiness problem (shown
to be decidable for L/U-PTAs [13]) and the EF-universality problem (shown to
be decidable for integer-valued L/U-PTAs [10]) are also decidable for bounded
L/U-PTAs.
Fig. 2. Decidability results for PTAs and subclasses (Color figure online)
6 Conclusion
In this paper, we exhibited a new subclass of PTAs (namely bounded IP-PTAs)
for which the EF-emptiness problem is decidable. By showing that bounded IP-
PTAs are incomparable with L/U-PTAs, we strictly extend the set of PTAs for
which this problem is decidable. Although we showed that it cannot be decided
whether a PTA is an IP-PTA, we introduced a new syntactic subclass of IP-
PTAs, namely reset-PTAs, for which, when bounded, the EF-emptiness problem
Decision Problems for Parametric Timed Automata 415
Future Works. Our new class of reset-PTAs seems promising in terms of synthe-
sis, as the symbolic states have a very special form. Using a proper extrapolation,
exact synthesis might be achievable. In addition, we are interested in extending
this class to hybrid systems, and combining its restrictions with the condition
of initialized hybrid automata [12]. The AF-universality problem is not treated
in this paper, as it connects in an interesting manner with the problems of the
existence of deadlocks or livelocks, which warrants a study on its own: in [5], we
show in particular that the AF-universality problem is decidable for bounded
L/U-PTAs with a closed parameter domain, and becomes undecidable if we lift
either the assumption of boundedness or of closedness. Finally, all problems
undecidable for L/U-PTAs remain open for L-PTAs and U-PTAs.
References
1. Alur, R., Dill, D.L.: A theory of timed automata. TCS 126(2), 183–235 (1994)
2. Alur, R., Henzinger, T.A., Vardi, M.Y.: Parametric real-time reasoning. In: STOC,
pp. 592–601. ACM (1993)
3. André, É.: What’s decidable about parametric timed automata? In: Ölveczky, P.C.,
Artho, C. (eds.) Formal Techniques for Safety-Critical Systems. CCIS, vol. 596, pp.
1–17. Springer, Heidelberg (2015)
4. André, É., Chatain, T., Encrenaz, E., Fribourg, L.: An inverse method for para-
metric timed automata. IJFCS 20(5), 819–836 (2009)
5. André, É., Lime, D.: Liveness in L/U-parametric timed automata (2016, submit-
ted). https://hal.archives-ouvertes.fr/hal-01304232
6. André, É., Lime, D., Roux, O.H.: Integer-complete synthesis for bounded paramet-
ric timed automata. In: Bojanczyk, M., et al. (eds.) RP 2015. LNCS, vol. 9328, pp.
7–19. Springer, Heidelberg (2015). doi:10.1007/978-3-319-24537-9 2
7. André, É., Lime, D., Roux, O.H.: On the expressiveness of parametric timed
automata. In: Fränzle, M., Markey, N. (eds.) FORMATS 2016. LNCS, vol. 9884,
pp. 19–34. Springer, Heidelberg (2016). doi:10.1007/978-3-319-44878-7 2
8. Beneš, N., Bezděk, P., Larsen, K.G., Srba, J.: Language emptiness of
continuous-time parametric timed automata. In: Halldórsson, M.M., Iwama, K.,
Kobayashi, N., Speckmann, B. (eds.) ICALP 2015. LNCS, vol. 9135, pp. 69–
81. Springer, Heidelberg (2015)
9. Bengtsson, J.E., Yi, W.: Timed automata: semantics, algorithms and tools. In:
Desel, J., Reisig, W., Rozenberg, G. (eds.) Lectures on Concurrency and Petri
Nets. LNCS, vol. 3098, pp. 87–124. Springer, Heidelberg (2004)
10. Bozzelli, L., La Torre, S.: Decision problems for lower/upper bound parametric
timed automata. Formal Methods Syst. Des. 35(2), 121–151 (2009)
416 É. André et al.
11. Doyen, L.: Robust parametric reachability for timed automata. Inf. Process. Lett.
102(5), 208–213 (2007)
12. Henzinger, T., Kopke, P., Puri, A., Varaiya, P.: What’s decidable about hybrid
automata? J. Comput. Syst. Sci. 57, 94–124 (1998)
13. Hune, T., Romijn, J., Stoelinga, M., Vaandrager, F.W.: Linear parametric model
checking of timed automata. JLAP 52–53, 183–220 (2002)
14. Jovanović, A., Lime, D., Roux, O.H.: Integer parameter synthesis for timed
automata. Trans. Softw. Eng. 41(5), 445–461 (2015)
15. Miller, J.S.: Decidability and complexity results for timed automata and semi-
linear hybrid automata. In: Lynch, N.A., Krogh, B.H. (eds.) HSCC 2000. LNCS,
vol. 1790, pp. 296–309. Springer, Heidelberg (2000)
16. Minsky, M.L.: Computation: Finite and Infinite Machines. Prentice-Hall Inc.,
Upper Saddle River (1967)
Verifying Nested Lock Priority Inheritance
in RTEMS with Java Pathfinder
1 Introduction
execution time, and therefore the lock is released eventually. However, if middle-
priority tasks preempt and starve the low-priority task, the high-priority task
may be blocked indefinitely since the low-priority task continues to hold the lock
while the middle-priority tasks execute. Priority inversions are solved by using
the priority inheritance protocol (PIP) or priority ceiling protocol (PCP) [15].
PIP works by promoting the priority of a lock holder to that of the highest-
priority task waiting for the lock. Hence, when a task fails to acquire a lock, the
lock holder will inherit the task’s priority until the lock is released. PIP ensures
that a middle-priority task cannot indefinitely block higher-priority tasks by
starving low-priority lock holders. The lock holder’s priority is restored to the
previous value when releasing the lock. Although PIP works well for single lock
acquire and release, some real-time applications require mutual exclusion for
multiple resources at a time. Hence, multiple locks are acquired, one for each
resource. We say these locks are nested. The proper implementation of PIP with
nested resources requires that each time a lock is released, the lock holder’s
priority should be changed to that of the highest priority task still blocked on
any lock held by the releasing task, or to the lock holder’s normal priority, i.e.,
the priority it held when entering the outermost lock.
RTEMS is an open-source real-time operating system with an implementa-
tion of PIP. However, RTEMS implementation of the PIP for nested locks is
incorrect. When a nested lock is obtained and priority is inherited, the task’s
current priority is saved. When the nested lock is released, the current prior-
ity is restored without checking what the highest priority is on the outer lock.
Therefore, a task could be blocked on the outer lock with a higher-priority than
the task that just released the inner lock, thus creating a priority inversion.
Currently, this inversion is avoided by retaining the highest inherited priority
until all locks are released, which has a different problem in that schedulability
analysis needs to account for interference caused by all critical sections of any
lower-priority tasks that may outer-nest a lock shared with a high priority task.
In this paper, we present our experience creating and model-checking a Java
model of the locking and scheduling algorithms from the implementations in
RTEMS relevant to PIP with nested resources. Our model detects priority inver-
sion conditions via exhaustively searching through the lock and scheduler data
structures. We passed the Java model through the Java Pathfinder (JPF) model
checker [16] to detect potential deadlocks, data races, and priority inversions.
After confirming the priority inversion in the existing RTEMS nested resource
locking, we model-checked an alternative algorithm, which we then implemented
in RTEMS. In our model analysis, we use intelligent pre-processing to reduce
the size of the state space by a factor of 158, which made it possible to check
the model repeatedly for different versions of our algorithm.
This paper is organized as follows: Sect. 2 provides the necessary background
and shows related work. Section 3 shows how we modeled the relevant parts of
the RTEMS kernel for verification with JPF. Section 4 shows the flaw we found in
the adaption of PIP in RTEMS, and our fix. The final results of the verification
with JPF are shown in Sects. 5 and 6 concludes.
Verifying Nested Lock Priority Inheritance in RTEMS with Java Pathfinder 419
2 Background
2.1 RTEMS
The Real-Time Executive for Multiprocessor Systems (RTEMS) [1] is an open-
source real-time operating system (RTOS) that provides essential RTOS ser-
vices with support for POSIX interfaces. RTEMS is used in particle accelerators,
satellite instruments, medical devices, military systems, robotics, and other data
acquisition and real-time control applications. RTEMS has been an open-source
project since 1988 and is widely used in academic, government, and private sec-
tors around the world.
properties checking the outcome of each operation that may be affected by shared
memory access.
For our work, we chose Java Pathfinder because the input language (Java)
is much closer to C than the input languages of other model checkers, such
as Promela used by SPIN [7]. Furthermore, many locking features used by the
RTEMS kernel have close equivalents in Java or JPF, which makes it easier to
model RTEMS in JPF than on other platforms (see Sect. 3).
Table 1. RTEMS kernel data structures and constructs in Java and JPF.
The RTEMS kernel also exhibits similarities to the Pthreads interface, and
by extension Java concurrency features: see Table 1 for a high-level mapping. We
employ nested locking and unlocking implemented in a straightforward way using
synchronized blocks in Java; non-nested locking could be supported using extra
libraries [9]. Thread signaling and condition variables use the same semantics as
in POSIX. Furthermore, priority queues in the RTEMS kernel are modeled using
priority queues from the Java base library.
For uniprocessor systems, RTEMS has a mechanism that temporarily disables
the scheduler making a block of code behave atomically. Java has no direct
construct for such scheduler disabling, and while a global lock can be used, it only
guarantees mutual exclusion with respect to other global locks. Fortunately, Java
Pathfinder has a construct that provides atomic sections: Verify.beginAtomic
and endAtomic. These two functions are not available in standard Java.
422 S. Gadia et al.
Another modeling problem is that the Java scheduler does not obey thread
priorities strictly, but thread priorities in RTEMS are strict, and a higher-
priority thread is always scheduled before lower-priority threads. Although Java
Pathfinder allows a user to provide a custom scheduler, which we could have
used to model the RTEMS scheduler in addition to its locking implementation,
we chose not to do so for two reasons. First, writing a custom scheduler in JPF
is more difficult than writing a model in Java. Second, we wanted our lock model
to be correct under any scheduler, not just under the current scheduler used by
RTEMS.
lock to multiple slots in the same test thread. Each thread is also assigned a
priority chosen from three values, representing high, medium, and low priority.
We currently do not test non-nested locking and unlocking, which could however
be achieved by permuting the order of unlock operations (Fig. 1).
The test harness includes a main method that parses arguments from the
command line, which indicate the lock indices and thread priorities. Because
some types of cyclic deadlocks require three threads, we wanted to simulate at
least as many threads in our model. In doing, so, we ran into the state space
explosion problem: If each thread non-deterministically uses two locks (out of
three candidate locks), and a non-deterministic priority setting taken from three
possible values, we have a total of (32 )3 (2 locks per thread) ∗ 33 (priorities) =
39 = 19683 combinations.
Encoding all these options as non-deterministic choices would be extremely
inefficient for the following reasons:
1. A lot of symmetries exist in the state space, some of which would not be
recognized by JPF and explored redundantly.
2. Exploring the entire state space at once increases memory usage and may
cause JPF to run out of memory or trigger garbage collection excessively
often.
3. Debugging a failed test (from a faulty model) is more difficult because the
error trace by JPF does not show the lock indices or thread priorities as such.
They could be made visible in other ways, through listeners or printing them
on the screen, but the latter option would print a lot of clutter during the
state space exploration.
424 S. Gadia et al.
1. Let F be the set of final candidates, and B be the set of “bad” lock permutations
that result in a deadlock.
2. Generate the set I of all isomorphic mapping functions (permutations of symbols
identifying locks) pi ∈ I with ik = A → A for all lock indices in A.
3. Generate all lock permutations, called the candidates C.
4. For each candidate c ∈ C:
(a) Generate all isomorphic variants M of c, for each permutation in I:
∀iso ∈ I, M = M ∪ iso(c).
(b) For each isomorphic candidate m ∈ M , sort the lock index sequences of all
threads: S = sorted(M ).
(c) We add all items in S to F : F = F ∪ S.
5. For each unique permutation f ∈ F , check if the lock indices form a cycle between
all threads; if so, add that permutation to B: ∀f ∈ F, B = B ∪ f if cyclic(f ).
6. Output the set of “good” candidates, F \ B, and “bad” candidates B.
3.5 Properties
By default, JPF reports a deadlock where the program cannot proceed with
execution, such as when multiple threads have a cyclic lock dependency. It can
also be configured to report data races. A data race exists if at least two threads
access the same memory location without mutual exclusion, and at least one of
these accesses is a write access. We used deadlock and data race detection along
with model-specific properties in our verification.
Specific properties are encoded as assertions (safety properties) in our
model [5], and cover the following:
Property 1. The priority of a thread waiting for a lock corresponds to its actual
(original) priority.
Property 2. A thread is in the correct state when acquiring a new mutex.
Property 3. A newly acquired mutex is not held by another thread, and its lock
count is zero.
426 S. Gadia et al.
Table 2. Model checking time, number of states, and number of instructions for all
distinct scenarios. Lock usage is shown as a triple of sequences (of length two) of lock
IDs. These IDs correspond to the two locks used by the test harness of each thread.
Each lock configuration was tested for all relevant priority settings.
Deadlock-free configurations
Lock configuration Time Number of states Number of instructions
(00,00,00) 00:05:51 3,597,839 39,134,614
(00,00,01) 00:08:31 5,359,776 53,499,140
(00,00,10) 00:29:50 20,530,383 158,243,065
(00,00,11) 00:22:19 15,321,110 117,084,710
(00,00,12) 00:31:16 21,614,670 159,649,787
(00,01,01) 00:10:26 7,277,751 71,695,034
(00,01,02) 00:10:21 7,277,751 71,695,034
(00,01,11) 00:25:07 17,704,921 137,981,768
(00,01,12) 00:37:20 26,655,214 198,517,948
(00,01,20) 00:46:39 32,883,641 249,273,627
(00,01,21) 00:49:55 35,524,795 262,654,448
(00,01,22) 00:34:44 23,805,000 181,621,827
(00,10,10) 00:27:31 19,231,201 164,864,689
(00,10,12) 00:38:42 27,290,669 221,112,177
(00,10,20) 02:06:17 93,616,077 713,877,172
(00,10,21) 01:41:56 72,693,793 556,663,234
(00,10,22) 01:33:02 66,929,870 529,446,674
(00,11,22) 01:27:25 61,758,697 504,124,972
(00,12,12) 00:45:33 32,800,449 266,311,244
(01,01,01) 00:11:18 9,172,281 90,384,827
(01,01,02) 00:13:13 9,327,571 91,742,294
(01,01,12) 00:41:50 29,339,526 222,928,606
(01,01,20) 00:52:03 45,084,155 339,817,731
(01,01,21) 01:04:19 50,192,733 371,521,061
(01,02,12) 00:40:47 38,795,617 290,831,840
Deadlock-prone configurations
Lock configuration Time Number of states Number of instructions
(00,01,10) 00:00:01 8,486 270,677
(00,12,21) 00:00:01 8,486 270,677
(01,01,10) 00:00:01 8,486 271,022
(01,02,10) 00:01:37 940,738 7,995,738
(01,10,20) 00:02:21 1,402,381 11,219,277
(01,12,20) 00:03:22 2,062,672 16,476,034
Verifying Nested Lock Priority Inheritance in RTEMS with Java Pathfinder 427
Property 4. The lock count of a lock being released is greater than zero. After a
lock is released, there is no holder registered anymore for it.
Property 5. If there is another thread waiting on a just-released lock, that thread
must be in the waiting state.
Property 6. The thread releasing a lock must contain a matching lock entry at
the head of the list maintained in that thread’s TCB.
Property 7. The thread releasing a lock must not contain any higher-priority
threads linked from the list of lock entries in the thread’s TCB.
Property 8. The promotion of a thread’s priority is caused by a different thread.
Property 9. The priority of a thread is correctly reverted to the original priority
after all locks have been released.
Fig. 2. Data structures linking the mutexes with the lock queues.
6 Conclusion
Despite the rich, robust theoretical frameworks that have been built around
real-time scheduling, the correctness of scheduler design and implementation—
especially with synchronization—is challenged by system complexity. In this
paper, we have presented a Java model of a real-time operating system’s PIP
implementation that we model-checked in JPF to look for deadlocks, race con-
ditions, and priority inversions, the latter by way of nine correctness properties
that were encoded as assertions in the Java model. Key to the efficient model
checking is the state space preprocessing of Algorithm 1, which reduces JPF’s
search space. JPF found a potential priority inversion, a correctness error, that
was known to exist in the C language implementation. We further proposed a
fix to the PIP implementation and validated it to be free of potential deadlocks,
race conditions, and priority inversions. Future work may consider validating
multi-core scheduling algorithms, which are even more complex and less well-
understood than the established uniprocessor algorithms.
Acknowledgments. This material is based upon work supported by the Google Sum-
mer of Code program, the National Science Foundation under Grant No. CNS 0934725,
and the Office of Naval Research under ONR Award No. N00014-14-1-0386. Any opin-
ions, findings, and conclusions or recommendations expressed in this material are those
of the authors and do not necessarily reflect the views of Google, NSF, or ONR.
References
1. RTEMS real time operating system (RTOS) (2016). https://www.rtems.org/
2. Artho, C., Hagiya, M., Leungwattanakit, W., Tanabe, Y., Yamamoto, M.: Model
checking of concurrent algorithms: from Java to C. In: Hinchey, M., Kleinjohann,
B., Kleinjohann, L., Lindsay, P.A., Rammig, F.J., Timmis, J., Wolf, M. (eds.)
DIPES 2010. IFIP AICT, vol. 329, pp. 90–101. Springer, Heidelberg (2010)
3. Clarke, E., Enders, R., Filkorn, T., Jha, S.: Exploiting symmetry in temporal logic
model checking. Form. Methods Syst. Des. 9(1), 77–104 (1996)
4. Clarke, E., Grumberg, O., Peled, D.: Model Checking. MIT Press, Cambridge
(1999)
5. Gadhia, S., Artho, C., Ramirez, D.: Model locks with thread priority from RTEMS
(2015). https://github.com/saurabhgadia4/lock-model
6. Henzinger, T.A., Jhala, R., Majumdar, R., Sutre, G.: Software verification with
BLAST. In: Ball, T., Rajamani, S.K. (eds.) SPIN 2003. LNCS, vol. 2648, pp.
235–239. Springer, Heidelberg (2003)
432 S. Gadia et al.
1 Introduction
Logical clock, as defined by Lamport [9], gives a flexible abstraction to compare
and order the occurrences of events, and is useful for the design of distributed
systems and real-time embedded systems. In order to facilitate the design of real-
time embedded systems, a general modeling framework marte [1] is proposed by
extending uml. A time model has been adopted in marte to support different
forms of time such as discrete, dense, chronometric or logical. Clock Constraint
Specification Language (ccsl) is originally proposed as an annex of the marte
specification to express constraints between clocks in marte models, and has
evolved and been developed independently of the uml. Although it is still an
This research work was supported by National Natural Science Foundation of China
(NSFC) projects: No. 61502171, No. 61361136002, and China HGJ Project: No.
2014ZX01038-101-001.
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 433–449, 2016.
DOI: 10.1007/978-3-319-47846-3 27
434 M. Zhang et al.
open problem of checking the existence of schedules for a given set of ccsl
constraints, it is desirable to perform formal analysis of ccsl constraints such
as to simulate a schedule that satisfies all the constraints with certain policy and
to verify if a given set of constraints satisfy some properties. Many efforts have
been made in this direction, relying on the transformation into automata and
other specific formats [11,14]. However, successive intermediate transformation
is prone to introduce accidental complexity. In this paper, we propose an SMT-
based approach to the formal analysis of ccsl constraints. In our approach, ccsl
constraints are naturally transformed into SMT formulas. It is well-known that
SMT-based approaches can effectively overcome the notorious state-explosion
problem in model checking, and can also be used for theorem proving. The former
feature helps improve the efficiency when ccsl constraints are verified by model
checking. The latter one allows to prove the invalidity of ccsl constraints by
means of theorem proving, which most of the existing approaches lack.
Among the properties of ccsl constraints, periodicity is a basic but impor-
tant one with the fact that real-time embedded systems are inherently periodic
and it is a crucial task of designing correct periodic schedules for such systems.
Given a set of ccsl constraints, it is desired to know if there exists periodic
schedules of a given set of ccsl constraints. In our earlier work [16], we pro-
posed a sufficient condition to periodic scheduling of ccsl constraints, and a
state-based approach to search all the schedules to find one that satisfies the
condition. The approach is applicable when the number of schedules of the given
constraints is reasonably small and the condition is satisfied at early step, but
becomes less efficient otherwise due to state explosion. In this paper, we propose
a less constraining sufficient condition and encode it into SMT formulas, with
which we can find periodic schedules of given ccsl constraints by SMT solvers
such as Z3 [12] and verify their properties by bounded model checking.
Execution trace analysis is another important application of ccsl con-
straints. In the scheme of marte/ccsl, execution trace analysis is an effective
way to design and debug real-time embedded systems [5]. Execution traces are
produced by instrumented code. Events in the generated traces are extracted
and then analyzed to check if they satisfy initial constraint specification. One of
the most challenging problems with execution trace analysis is to find an effi-
cient way of checking if a trace satisfies the predefined constraints. We show the
SMT-based approach to be proposed is also suited to execution trace analysis.
We implement a prototype tool using the K framework [13] for the trans-
formation from ccsl constraints into SMT formulas and Z3 as its underlying
SMT solver. K is a rewrite-based executable semantic framework in which pro-
gramming languages, type systems and formal analysis tools can be defined. We
choose Z3 because it also accepts and can work with formulas that use quanti-
fiers. Although it is no longer a decision procedure for formulas with quantifiers
in general, it is often able to handle formulas involving quantifiers. Thus, Z3
could return answers to some formulas with quantifiers that are transformed
from ccsl constraints even if no bound is set.
An SMT-Based Approach to the Formal Analysis of MARTE/CCSL 435
The rest of this paper is organized as follows: Sect. 2 briefly introduces ccsl
language and some existing work on its periodic scheduling; Sect. 3 presents
the transformation approach from ccsl constraints to SMT formulas. Section 4
shows the applications of the SMT-based approach to invalidity proving, peri-
odic scheduling, execution trace analysis, etc. Section 5 describes the prototype
tool and some concrete examples. Section 6 compares our approach with other
existing ones and Sect. 7 finally concludes the paper.
In ccsl, clocks are used to measure the occurrence time of events in a system.
Each event is associated to a clock. Time is represented in a logical way as
a sequence of discrete steps, instead of physical time. Thus, clocks are called
logical clocks. The constraints between clocks can be interpreted as the relations
between events, e.g., some event must occur earlier than another. Event relations
are usually established at early design stage in the development of a real-time
and embedded system.
In [11], clock relations are divided into two classes, i.e., ccsl constraints and
clock definitions. There are four primitive constraint operators which are binary
relations between clocks, and five kinds of clock definitions. The four constraint
operators are called precedence, causality, subclock and exclusion; and the five
clock definitions are called union, intersection, infimum, supremum, and delay.
Besides, we introduce a new clock definition called periodic filter, which is used
to define the periodicity between two clocks. The meanings of the ten primitive
operators are given by schedule and history. Intuitively, a schedule is used to
record the clocks that tick at each given step, and a history is used to record the
number of ticks of each clock before it reaches a given step.
436 M. Zhang et al.
Obviously, χ(c, i) is the number of the ticks that clock c has ticked immediately
before it reaches step i.
We use δ |= φ to denote that schedule δ satisfies constraint φ. Figure 1 shows
the definition of the satisfiability of a constraint φ with regards to a schedule δ.
We take the definition of precedence for example. δ |= c1 ≺ c2 holds if and only
if for any n in N+ , c2 must not tick at step n if the number of the ticks of c1
is equal to the one of c2 immediately before they reach step n. Precedence and
causality are asynchronous constraints and they forbid clocks to tick depending
on what has happened on other clocks in the earlier steps. Subclock and exclusion
are synchronous constraints and they force clocks to tick or not depending on
whether another clock ticks or not.
Clock definitions from 5 to 10 are used to define new clocks such that the
clock c1 at the left-hand side of “” is uniquely determined by the clock(s) at
the right-hand side. By union it defines a clock c1 which ticks whenever c2 or c3
ticks, and by intersection it defines a clock c1 which ticks whenever both c2 and
c3 tick. Supremum is used to define the slowest clock c1 which however is faster
than both c2 and c3 , and infimum is used to define the fastest clock c1 which
however is slower than both c2 and c3 . By delay it defines the clock c1 which is
delayed by c2 with d steps, and by periodicity it defines the clock c1 which ticks
once every after c2 ticks p times.
Given a set Φ of ccsl constraints and definitions, we use δ |= Φ to denote
that the schedule δ satisfies all the constraints in Φ, and δ; k |= Φ with k ∈ N+
to denote that δ satisfies all the constraints in Φ at step k. It is obvious that
δ |= Φ if and only if ∀k ∈ N+ .δ; k |= Φ.
The satisfiability problem of ccsl is still open, and there has not been a decision
procedure proposed to it so far. Nevertheless, the satisfiability problem of some
subclass of ccsl constraints has been studied [11]. For instance, the satisfiability
problem of ccsl constraints without operators ≺, ∧, and ∨ is decidable. The
ccsl operators except ≺, ∧, and ∨ can be encoded as finite-state transition
systems [11], and the satisfiability problem of a given subclass of ccsl constraints
is transformed into the reachability problem of the synchronized product of finite-
state transition systems, which is decidable. The three operators ≺, ∧, and ∨
cannot be encoded as finite-state transition systems if no extra information such
as counter is provided. They are called unsafe operators in [11] in that they
may cause non-terminating of composing state transition systems. To solve the
satisfiability problem of ccsl constraints with unsafe operators, we can set an
upper bound to schedules in that we are only concerned with the schedules
within a bounded step. In [16], we call them bounded schedules.
Definition 5 (Bounded schedule). Given a set Φ of clock constraints on
≤n → 2 , δ is called an n-bounded schedule if
clocks in C, and a function δ : N+ C
for any i ≤ n, δ; i |= Φ.
In most of the cases, bounded schedule is too restrictive in practice for real-
time systems, because real-time systems are assumed to run infinitely until they
are shut down. We consider a special class of infinite schedules by which each
clock ticks periodically from a pragmatic point of view. We call such schedules
periodic schedules. Periodic schedules are useful in practice based on the fact
that periodicity is one of the intrinsic features of real-time embedded systems.
Definition 6 (Periodic schedule). A schedule δ is called periodic if there exist
k, p in N+ such that for any k ≥ k, δ(k + p) = δ(k ), and p is called a period
of δ.
438 M. Zhang et al.
Definition 6 means that after step k the schedule δ repeats every p steps. p is
called the smallest period of δ if there does not exist p in N+ such that p is
also a period of δ and p < p.
It is also an open problem of deciding the existence of a periodic schedule
for a given set of ccsl constraints. In [16] we proposed an approach to extend
a bounded schedule to a periodic one and a sufficient condition under which the
approach can be applied. We omit the extension approach here due to space
limitation. Interested readers are referred to the work [16] for the details of the
approach. In this paper, we propose a less constraining sufficient condition than
the one in the work [16].
Theorem 1. Given a bounded schedule δ : N+ ≤n → C of a set Φ of ccsl con-
straints, δ can be extended to a periodic one if there exist two natural numbers
k, k ≤ n and k < k such that the following five conditions are satisfied:
1. δ(k) = δ(k );
2. If φ is in form of c1 ≺ c2 or c1 c2 , then χ(c1 , k ) − χ(c1 , k) ≥ χ(c2 , k ) −
χ(c2 , k);
3. If φ is in form of c1 c2 $ d , then χ(c2 , k) ≥ d and χ(c1 , k ) − χ(c1 , k) =
χ(c2 , k ) − χ(c2 , k);
4. If φ is in form of c3 c1 ∧ c2 or c3 c1 ∨ c2 , then χ(c1 , k ) − χ(c1 , k) =
χ(c2 , k ) − χ(c2 , k) = χ(c3 , k ) − χ(c3 , k);
5. If φ is in form of c1 p c2 , then there exists m ∈ N+ such that (χ(c2 , k ) −
χ(c2 , k)) = m × p.
Intuitively, Condition 1 says that the clocks that tick at step k are the same
as those at step k ; Condition 2 means from the step k to k , c1 must tick faster
than or at the same speed as c2 if c1 and c2 satisfy precedence or causality; and
Condition 3 says that for the constraint that a clock c1 is delayed d steps by
c2 the number of ticks of c2 immediately before step k must be greater than or
equal to d and c1 and c2 must tick the same steps from step k to k . Condition 4
requires that for the three clocks i.e. c1 , c2 and c3 that are constrained by infimum
or supremum, they must tick the same number of ticks from step k to k . The
last condition says that between k and k there must be m times p steps ticking
of c2 .
The above conditions are less constrained than the ones in our earlier work
[16] in that by the new conditions all the clocks do not necessarily need to tick
the same number of ticks from step k to k , which is required by the conditions
in the work [16]. With the new sufficient condition, we may find more periodic
schedules for a given set of ccsl constraints. Theorem 1 can be proved by
case analysis on ccsl constraints. We omit the proof in the paper due to space
limitation.
The generated formulas may contain quantifiers, linear integer arithmetic and
uninterpreted functions, and hence belongs to UFLIA (abbreviated for the linear
fragment of theory of integer arithmetic with free sort and function symbols)
logic according to SMT-LIB standard [2].
ccsl constraints can be straightforwardly encoded as SMT formulas. Given
a set Φ of ccsl constraints on a set C of clocks, a schedule δ of Φ can be encoded
by a finite set T = {tc : N+ → Bool|c ∈ C} of functions such that for any c
in C and n in N+ , c ∈ δ(n) ⇐⇒ tc (n). The functions in T are uninterpreted
functions. Given a set Φ of ccsl constraints, finding a schedule of Φ is equal to
giving interpretations to these uninterpreted functions.
We introduce another set H = {hc : N+ → N|c ∈ C} of functions in order to
encode ccsl constraints into SMT formulas. Each function in H takes a natural
number n as its argument, and returns the number of steps that its associated
clock has ticked immediately before the clock reaches step n. That is, for any c in
C and n in N, there is hc (n) = χ(c, n). According to Definition 3, the functions
in H must satisfy the following two formulas:
hc (1) = 0 (F1)
c∈C
∀n ∈ N+ .(¬tc (n) ⇒ hc (n + 1) = hc (n)) ∧ (tc (n) ⇒ hc (n + 1) = hc (n) + 1) (F2)
c∈C
The SMT formulas that are transformed from ccsl specifications contain unin-
terpreted functions and quantifiers. As there can be no decision procedure for
first-order logic, we may not get an answer to the problem that whether there
exists a model satisfying generated SMT formulas. Nevertheless, there are still
multiple applications of the SMT-based approach to the formal analysis of ccsl
specifications such as invalidity proving, periodic scheduling, bounded model
checking and execution trace analysis.
In the work [11], a set Φ of ccsl constraints is called invalid if there does not
exist any schedule δ such that δ |= Φ. Namely, there does not exist a set T of
functions such that T satisfies all the formulas in {[Φ]}, i.e., {[Φ]} is not satisfiable.
Consequently, we have the following proposition hold:
By the above proposition, we can conclude that Φ is valid once we find a solu-
tion, i.e., a set T of functions, to the satisfiability problem of {[Φ]}. As mentioned
in Sect. 3, the formulas in {[Φ]} are in UFLIA logic and hence its satisfiability
problem is undecidable. If an upper bound is set to the universally quantified
variable n in each formula in {[Φ]}, the satisfiability problem becomes decidable
because the quantifiers in the formulas can be eliminated. We denote the set of
formulas in {[Φ]} with a common upper bound u for each n in the formulas by
{[Φ]}≤u . If {[Φ]}≤u is unsatisfiable, by Proposition 1 we can immediately conclude
that Φ must be invalid because the unsatisfiability of {[Φ]}≤u implies that {[Φ]}
is also unsatisfiable.
Invalidity proving is also useful to prove automatically the derivation of a
constraint φ from a set Φ of ccsl constraints.
Definition 7. A constraint φ is derived from a set Φ of ccsl constraints if for
any schedule δ, δ |= Φ implies δ |= φ.
Let Tδ be the set of functions that represent δ. δ |= Φ implies that Tδ is a
solution of {[Φ]}. By Definition 7, Tδ must be a solution of [[φ]] if φ can be derived
from Φ. That is, for any solution of {[Φ]}, it must be a solution of [[φ]]. Namely,
{[Φ]} =⇒ [[φ]] is valid. Thus, we have the following proposition hold:
Proposition 2. A constraint φ is derived from a set Φ of ccsl constraints if
and only if [[Φ]] =⇒ [[φ]] is valid.
An SMT-Based Approach to the Formal Analysis of MARTE/CCSL 441
The formula says that for each clock c it much tick at some step i, and for any
step j if c ticks at step j there must be a forthcoming step j where c+also ticks.
For a periodic schedule, it suffices to define a formula c∈C ∃i ∈ N .(k ≤ i <
k ) ∧ tc (i)), which says that each clock c must tick at least once in a period. By
specifying these specific constraints, we can obtain desired periodic schedules.
We can also verify if all the periodic schedules of a given set of ccsl con-
straints satisfy some desired properties by bounded model checking. For the
periodicity, we can verify even liveness properties of periodic schedules. For some
liveness properties, it suffices to verify if they are satisfied before the step k where
all the clocks start a new period. The approach to bounded model checking of a
property with respect to periodic schedules is the same as the one described in
the previous subsection.
idle if i ∈ {2, 4} tick if i ∈ {2, 4, 6} tick if i ∈ {3, 5}
ta (i) = tb (i) = tc (i) = .
tick if otherwise idle if otherwise idle if otherwise
By the solution, at step 6 clock a ticks but clock c idles, which violates the
constraint c a $ 1 at step 7 where χ(a, 7) = 4 but χ(c, 7) = 2. However, by
An SMT-Based Approach to the Formal Analysis of MARTE/CCSL 445
Similar to the proof of a # b, Z3 returns unsat when the bound is set an odd
number, and returns a spurious counterexample when the bound is an even
number. The reason for the occurrence of spurious counterexample is the same
as one for the occurrence of spurious solution. If no bound is given, Z3 times out
without outputting any result.
Next, we show that the returned periodic schedule satisfies the one-step alter-
nation property. As mentioned in Sect. 4, it suffices to verify the property is sat-
isfied by a single period, e.g. from step 2 to 3. That is, the formula to be verified
is that ¬({[Φalt ]}≤5 =⇒ A12≤i≤3 ), where A12≤i≤3 represents the formula A1
with the quantified variable i range from 2 to 3, instead of N+ . Z3 returns unsat,
which means the property is verified.
We finally consider a more complex set of ccsl constraints which are
abstracted from an application for Flow Latency Analysis (FLA) on AADL
(abbreviated for Architecture Analysis & Design Language) specifications [7].
Figure 4 shows the clocks and the constraints denoted by Φfla among them in
the application. There are eight clocks, each of which is associated to an event.
Clocks in1 and in2 stand for two inputs, based on which some calculations are
performed at step1 and step2 respectively. At step3 the calculation results are
synthesized and the final result is output at out. Clocks tmp1 and tmp2 are
two intermediate clocks which are used to represent the alternation constraint
between in1 ∨ in2 and out.
We try to find periodic schedules that satisfy the constraints in Φfla . Table 2
shows the returned results with different bounds. No periodic schedule is found
in the first 4 steps. With the increase of the bound, different periodic schedules
are found. Note that when the bound is set to 5 and 8, the same schedule is
returned. It is obvious that for the periodicity a periodic schedule that satisfies
the constraints within 5 steps must also satisfy within 8 steps. We can also give
a specific period p so that the returned schedule must have the period p. A
different schedule whose period is 3 is returned when the bound is set to 10.
In particular, a schedule whose period is 31 is found when the bound is 100.
(a) The results with different bounds (b) The periodic schedule found
Bound Time (sec) with bound 5
4 unsat 0.011 Clock/Step 1 2 3 4 5
5 2 4 0.018 t i t i -
10 5 7 0.028 i t i t -
100 97 99 2.042 i i t i -
Figure 3 depicts the periodic schedule. The period is much longer than what we
expected and is not founded by any other existing approaches.
6 Related Work
Many efforts have been made to the formal analysis of ccsl constraints and sev-
eral approaches have been proposed. André defined the operational semantics of
ccsl as a set of rewrite rules and built a simulation engine that can perform
the clock calculus dynamically on the fly [10]. Gascon et al. proposed to encode
ccsl specifications as Büchi automata and compare its expressiveness with tem-
poral logic [8]. Yin et al. proposed to transform ccsl specifications into Promela
and perform model checking using Spin [15]. In all of their approaches, only a
safe subset of ccsl operators were taken into consideration, i.e., the underly-
ing state space is finite. Mallet et al. proposed a state-based semantics of ccsl
and encoded each constraint as a transition system [11]. However, some ccsl
constraints such as precedence, supremum and infimum cannot be represented
as a finite-state transition system, which may lead to non-termination of the
synchronization of transition systems. Suryadevara et al. proposed to encode
ccsl as timed automata and showed that clocks of ccsl were complementary
to real-valued clocks of timed automata [14]. In our earlier work [16], we defined
an executable semantics of ccsl in Maude and showed its applications to both
simulation and model checking. The above-mentioned approaches can be used
to boundedly model check those unsafe specifications by setting a bound to the
steps that the clocks can proceed, which is similar to our SMT-based approach
to bounded model checking.
Compared with the above existing approaches, the main advantage of the
SMT-based approach proposed in this paper is that it is more suited to verify-
ing the invalidity of ccsl constraints and finding bounded and periodic sched-
ules even for unsafe ccsl constraints. Moreover, the direct interpretation of
ccsl constraints as SMT formulas makes the transformation easier to imple-
ment than other state-based approaches. From the efficiency perspective SMT-
448 M. Zhang et al.
based approaches are generally more efficient than state-based approaches. These
features make the proposed SMT-based approach complementary to existing
approaches to the formal analysis of ccsl constraints.
References
1. André, C., Cuccuru, A., Dekeyser, J.L., et al.: MARTE: a new OMG profile RFP
for the modeling and analysis of real-time embedded systems. In: Proceedings of
the 2nd UML-SoC Workshop (2005)
2. Barrett, C., Fontaine, P., Tinelli, C.: The SMT-LIB standard (version 2.5) (2015)
3. Clarke, E.M., Grumberg, O., Peled, D.A.: Model Checking. MIT Press, Cambridge
(2001)
4. Clavel, M., Durán, F., Eker, S., Lincoln, P., Martı́-Oliet, N., Meseguer, J., Tal-
cott, C. (eds.): All About Maude - A High-Performance Logical Framework: How
to Specify, Program and Verify Systems in Rewriting Logic. LNCS, vol. 4350.
Springer, Heidelberg (2007)
5. Ebeid, E., Fummi, F., Quaglia, D.: HDL code generation from UML/MARTE
sequence diagrams for verification and synthesis. Des. Autom. Embed. Syst. 19(3),
277–299 (2015)
6. Ellison, C., Roşu, G.: An executable formal semantics of C with applications. In:
Proceedings of the 39th POPL, pp. 533–544. ACM (2012)
7. Feiler, P., Hansson, J.: Flow latency analysis with the architecture analysis and
design language (AADL) (2007)
8. Gascon, R., Mallet, F., DeAntoni, J.: Logical time and temporal logics: comparing
UML MARTE/CCSL and PSL. In: Proceedings of the 18th TIME, pp. 141–148.
IEEE CS (2011)
9. Lamport, L.: Time, clocks, and the ordering of events in a distributed system.
Commun. ACM 21(7), 558–565 (1978)
10. Mallet, F., André, C.: On the semantics of UML/MARTE clock constraints. In:
Proceedings of ISORC, pp. 305–312. IEEE CS (2009)
11. Mallet, F., de Simone, R.: Correctness issues on MARTE/CCSL constraints. Sci.
Comput. Program. 106, 78–92 (2015)
12. de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R.,
Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg
(2008)
An SMT-Based Approach to the Formal Analysis of MARTE/CCSL 449
13. Roşu, G., Şerbănută, T.F.: An overview of the K semantic framework. J. Logic
Algebraic Program. 79(6), 397–434 (2010)
14. Suryadevara, J., Seceleanu, C., Mallet, F., Pettersson, P.: Verifying MARTE/CCSL
mode behaviors using UPPAAL. In: Hierons, R.M., Merayo, M.G., Bravetti, M.
(eds.) SEFM 2013. LNCS, vol. 8137, pp. 1–15. Springer, Heidelberg (2013)
15. Yin, L., Mallet, F., Liu, J.: Verification of MARTE/CCSL time requirements in
Promela/SPIN. In: Proceedings of the 16th ICECCS, pp. 65–74. IEEE CS (2011)
16. Zhang, M., Mallet, F.: An executable semantics of clock constraint specification
language and its applications. In: Artho, C., et al. (eds.) FTSCS 2015. CCIS, vol.
596, pp. 37–51. Springer, Heidelberg (2016). doi:10.1007/978-3-319-29510-7 2
Checking SysML Models for Co-simulation
1 Introduction
Cyber-physical systems (CPSs) are designed to actively engage with the physical
world in which they reside. They tend to be heterogenous: their subsystems
tackle a wide variety of domains (such as, mechanical, hydraulic, analogue and
a plethora of software domains) that mix phenomena of both continuous and
discrete nature, typical of physical and software systems, respectively.
CPSs are often handled modularly to tackle both heterogeneity and complex-
ity. To effectively separate concerns, the global model of the system is decom-
posed into subsystems, each typically focussed on a particular phenomenon or
domain and tackled by the most appropriate modelling technique. Simulation,
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 450–465, 2016.
DOI: 10.1007/978-3-319-47846-3 28
Checking SysML Models for Co-simulation 451
the standard validation technique of CPSs, is often carried out modularly also,
using co-simulation [18] – the coupling of subsystem simulations. This constitutes
the backdrop of the industrial Functional Mockup Interface (FMI) standard [4,5]
for co-simulation of components built using distinct modelling tools.
This paper presents an approach to formally verify the well-formedness and
healthiness of SysML CPS architectural designs as a prelude to co-simulation.
The designs are described using INTO-SysML [3], a profile for multi-modelling
and FMI co-simulation. The well-formedness checks verify that designs comply
with all the required constraints of the INTO-SysML meta-model; this includes
connector conformity, which checks the adequacy of the connections between
SysML blocks (denoting components) with respect to the types of the ports
being wired. The healthiness checks concern detection of algebraic loops, a feed-
back loop resulting in instantaneous cyclic dependencies; this is relevant because
a desirable property of co-simulation, which often reduces to coupling of simu-
lators, is convergence – whether numerical simulations approximates the solu-
tion –, which is dependent on the structure of the subsystems and cannot be
guaranteed if this structure contains algebraic loops [6,18]. The work presented
here demonstrates the capabilities of our verification workbench for modelling
languages and engineering theories, which rests on Fragmenta [2], a theory
to formally represent designs of visual modelling languages, and its accompa-
nying mechanisation in the Isabelle proof assistant [22], and the CSP process
algebra [13] with its accompanying FDR3 refinement-checker [12].
– A novel SysML profile for architectural modelling of CPSs that tackles hetero-
geneity by providing support for multi-modelling and co-simulation in com-
pliance with the FMI standard.
– An approach to statically check the adequacy of a SysML architectural model
for co-simulation, supporting connector conformity and algebraic loops detec-
tion, by using a theorem prover and a model-checker.
– A prototyping environment for Fragmenta [3], a mathematical theory to
represent typed visual models, based on the proof assistant Isabelle/HOL that
enables model verification and transformation.
– A CSP-based solution to the detection of algebraic loops, which is based on a
novel approach to represent graphs in CSP.
– An evaluation of approaches to the detection of algebraic loops.
2 Background
We give some background on two main ingredients of the work presented here:
Fragmenta and CSP.
F_VTypes
F_VTypes
Imports Continues
F_Props, F_PTypes F_AD
F_PTypes
F_PTypes Imports
F_Common
NamedElement
F_Common Property
NamedElement Interval
Type Type PType lb : Int props *
name : String Literal ValueType
ub : Int
Real literals *
StrtType
String
Enumeration super
©F_ASD Imports
©F_AD Nat Int Bool DType PType
F_Common *
UnitType
unit : String
NamedElement F_Props
F_Props Imports
F_PTypes
Block
MM_GFG
* F_AD
<<Enum>> <<Enum>> F_Comps
blocks NamedElement Direction
VarKind
varInit in
ArchitectureDiagram F_Common F_CD
varNoInit out
parameter Property type
F_VTypes
compositions types init : String Type
* * F_PTypes
F_Blocks
Composition ValueType Variable FlowPort depends
kind: VarKind direction : Direction F_Props
*
Legend
Imports
F ©F C AC P F1, F2 FN GFG
Fragment
Fragment Continuing Class Abstract Proxy inheritance composition association Fragment Import Continuation Global Fragment
Imports Node
Fragment Class Graph
– ADs (see Fig. 2a) describe a decomposition in terms of the types of sys-
tem components and their relations. They emphasise multi-modelling: certain
components encapsulate a model built using some modelling tool (such as
VDM/RT [20], 20-sim [17] or Open Modelica [11]).
– CDs (see Fig. 2b) are AD instances. They convey the configuration of the
system’s components, highlighting flow and connectedness.
The water tanks system, sketched in Fig. 3, is
source this paper’s running example. A source of water
fills a tank whose water outflow is controlled by
Valve
a valve; when the valve is open the water flows
into the drain. The valve, managed by a software
Tank
controller, is opened or closed depending on the
drain tank’s water level. We also consider a variant of
this system with the drain connected to the tank.
Fig. 3. Water tanks system. Figure 2 portrays the architectural model of
water tanks, built using INTO-SysML’s Modelio
implementation5 . The AD of Fig. 2a is as follows:
5
Available from http://forge.modelio.org/projects/intocps-modelio34.
456 N. Amálio et al.
F_CD Imports
F_CD F_Blocks, F_V_Types
ConnectionsDiagram
1
NamedElement * connectors
Connector ValueType
insideBlocks 4 6
* * blocks
tgt
src
Block BlockInstance type
3 type 2 ports
Port FlowPort
5 7
*
F_WTSys_CD Imports
F_WT_Sys_AD
WaterTankSysCD 1
blocks = [WTSys, WT, C, T, D, S] Source
connectors = [C_WT_V, T_WT_WL, C_WT_WL, WT_T_V, S_T_F, T_D_F] 3
WaterTankSys WTSys S sw SW
WaterTank 2 5 7
3 2 3
Controller Drain
3 3 FlowRate C_S_T
6 4
ValveState
6
WLI C WT D dw DW
2 VI 2 2 5 7
7 VO 7
7
C_WT_V
4 C_T_D_F FlowRate2
wli T 4 6
5 vo 2
vi WIN
5 5 7
(a) A topology without (b) A topology with an (c) PDG of a variant of Fig. 2
algebraic loops algebraic loop with algebraic loop
Fig. 5. The algebraic loops check is about finding cycles in a system topology empha-
sising component communication
Fig. 7. A PDG with labelled channel sw win, win wout, wout dwi , tvi wout,
nodes and edges wtvi tvi , vo wtvi , wli vo, . . .
PortDependancyGraph =
let P (1) = sw win → P (2)
6
https://www.cs.ox.ac.uk/projects/fdr/.
Checking SysML Models for Co-simulation 459
5 Evaluation
FDR3 is a tool based on model-checking, a verification technique whose drawback
is scalability. We compare our CSP approach to detect algebraic loops (Sect. 4)
against one approach based on Alloy [14] and one graph algorithm [15], to gauge
scalability.
Alloy [14] is a declarative modeling language based on first-order logic with tran-
sitive closure. It is used for data modelling and provides an automatic bounded
analysis of a model. Our Alloy model of PDGs is based on the signature Port:
abstract sig Port { tgt : set Port }{ tgt = this }
Above, we declare a set of Port instances – abstract says that Port has no
instances of its own and that all its instances belong to its extensions (subsets) –
with the relation tgt between Ports declared to be non-reflexive: the tgt of some
Port cannot be itself (this).
The actual nodes of the PDG of Fig. 7 extend Port:
one sig sw , win , wout , dwi , wl , wlo , wli , vo , wlvi , tvi
extends Port {}
Above, the nodes are singletons (constraint one) that subset Port(extends).
The following Alloy fact defines the edges of the graph:
fact { sw . tgt = win
win . tgt = wout
wout . tgt = dwi
no dwi . tgt . . . }
assert AcyclicTgt { no ^ tgt & iden }
check AcyclicTgt for 10
Above, each edge is declared through relation tgt: sw.tgt =win says that there
is an edge from sw to win – operator . is the relational image –, win.tgt =wout
says that there is an edge from win to wout, and no dwi.tgt says that dwi has no
outgoing edges (set is empty).
Finally, we assert the acyclicity of the relation tgt representing the PDG and
declare the command to check the assertion:
assert AcyclicTgt { no ^ tgt & iden }
check AcyclicTgt for 10
Above, the assertion says that there can be no elements (operator no) in the set
resulting from the intersection (operator & ) of the relation’s transitive closure
(^tgt) with the identity relation (iden). The check command includes a scope
declaration: the analysis should consider at most 10 PDG nodes.
Checking SysML Models for Co-simulation 461
5.3 Comparisons
The plots of Fig. 9 depict the data obtained from running the experiments. They
display the number of nodes of the analysed graph in the abscissa and the dura-
tion of the check (in seconds) in the ordinate.
CSP 164.98
160
Alloy Johnson
CSP 652.59
650
145
130
550
115
450
100
85
350
70
250
55
40
150
25
50
0 10
8.58 0.02
10
0
0 20 40 60 80 100 120 140 160 180 0 50 100 150 200 250 300 350 400
Fig. 9. The performances of the Alloy and CSP solutions (seconds on the ordinate and
number of nodes of a graph on the abscissa)
6 Discussion
11
It is a non-parametric test that compares the two sampled distributions without
assuming that they follow the normal distribution.
462 N. Amálio et al.
choice); the property is expressed in an ingenious, but less evident way: through
an abstract process and a traces refinement check.
FDR3 and Alloy 4 are both based on model-checking; however, the CSP
solution outperforms Alloy overwhelmingly. Alloy’s exponential time complex-
ity is attributed to the complexity of SAT whose worst-case time complexity is
exponential [19,21] – the Alloy solution resorts to the transitive closure, a com-
putationally demanding operation (specialised algorithms do it in O(n 3 )). An
important factor in CSP’s lower O(n 3 ) time complexity lies in the use of traces
refinement, founded on the simplest denotational model of CSP and with the
least expensive time complexity – polynomial according to [16].
Our CSP solution is beaten by Johnson’s algorithm, but it is used in our ver-
ification approach, which employs FDR3 for more sophisticated checks of FMI
co-simulations [1]. It is difficult for general-purpose model-checking to outper-
form specialised algorithms taking advantage of problem specificities.
The experimental setup varies size but not structure, which remains essen-
tially the same throughout the different water tanks systems. However, as the
results show, this is enough to expose differences; furthermore, as discussed
above, the obtained results are consistent with theoretical results.
7 Related Work
Feldman et al. [9] generate FMI model descriptions from Rhapsody SysML mod-
els and FMUs from statecharts to enable integration with continuous models.
Unlike our work, this does not define a profile embodying a paradigm designed
for multi-modelling and FMI-co-simulation; furthermore, formal static checks
covering connector conformity and absence of algebraic loops are not covered.
Pohlmann et al. [23] propose a UML-based DSL for real-time systems; FMI
FMUs are generated from model components described as real-time statecharts;
our work specialises the SysML block diagrams, a standard notation for archi-
tectural modelling, and supports multi-modelling.
This paper applies the Fragmenta theory presented in [2] to a real-world
problem. This required an extension to the Isabelle/HOL theory of [2], devel-
oped to prove that paper’s main theorem. This extension builds an infrastructure
to support automated verification and transformation for visual modelling lan-
guages. Fragmenta/Isabelle constitutes a prototyping environment supporting
all the novel aspects of Fragmenta, namely: a formal theory of proxies and
its verified theory of decomposition and the support for fragmentation strate-
gies. This is the first time that the novel theory of modularity with its Isabelle
mechanisation is applied to a real-world application. To our knowledge, this is
also the first prototyping environment based on a proof assistant that provides
formal reasoning and transformation capabilities for visual models.
The approach to connector conformity used here is based on typing. It
supports sub-typing according to the inheritance relations specified in the
metamodel; for instance, in INTO-SysML, natural numbers may be used when
integers are expected because the metamodel says that the former is a subtype
464 N. Amálio et al.
8 Conclusions
This paper has presented our approach to check a SysML model in preparation
for co-simulation. This involves checking the consistency and well-formedness
of the INTO-SysML model, which involves checking the conformance of the
model with respect to its metamodel based on Fragmenta’s representation.
The actual checks are carried out using Fragmenta’s Isabelle mechanisation,
ensuring, among other things, connector conformity. The paper then showed how
the INTO-SysML models could be transformed into other modelling languages to
perform a check for the absence of algebraic loops using Fragmenta’s Isabelle
mechanisation as a transformation engine. The paper presented a novel CSP
approach to detect algebraic loops by checking a traces refinement in FDR3.
The paper’s evaluation highlighted how our CSP approach based on refinement-
checking performs well when compared with an Alloy SAT-based model-checking
approach, but that it does not perform better than a special-purpose graph
algorithm. The work presented in this paper is done in tandem with the effort
on the formal semantics of FMI in CSP [1].
References
1. Amalio, N., Cavalcanti, A., König, C., Woodcock, J.: Foundations for FMI co-
modelling. Technical report, INTO-CPS Deliverable, D2.1d, December 2015
2. Amálio, N., de Lara, J., Guerra, E.: FRAGMENTA: a theory of fragmentation for
MDE. In: MODELS 2015. IEEE (2015)
3. Amalio, N., Payne, R., Cavalcanti, A., Brosse, E.: Foundations of the SysML profile
for CPS modelling. Technical report, INTO-CPS Deliverable, D2.1a, December
2015
4. Blochwitz, T., Otter, M., Akesson, J., Arnold, M., Clauss, C., Elmqvist, H.,
Friedrich, M., Junghanns, A., Mauss, J., Neumerkel, D., Olsson, H., Viel, A.: The
functional mockup interface 2.0: the Standard for tool independent exchange of
simulation models. In: Modelica Conference, Munich, Germany (2012)
Checking SysML Models for Co-simulation 465
5. Blochwitz, T.: Functional mock-up interface for model exchange and co-simulation,
July 2014. https://www.fmi-standard.org/downloads (Blochwitz, T. (ed.))
6. Broman, D., Brooks, C., Greenberg, L., Lee, E., Masin, M., Tripakis, S., Wetter, M.:
Determinate composition of FMUs for co-simulation. In: EMSOFT (2013)
7. Dragomir, I., Preoteasa, V., Tripakis, S.: Compositional semantics and analysis of
hierarchical block diagrams. In: Bošnacki, D., Wijs, A. (eds.) SPIN 2016. LNCS,
vol. 9641, pp. 38–56. Springer, Heidelberg (2016). doi:10.1007/978-3-319-32582-8 3
8. Ehrig, H., Ehrig, K., Prange, U., Taentzer, G.: Fundamentals of Algebraic Graph
Transformation. Springer, Heidelberg (2006)
9. Feldman, Y., Greenberg, L., Palachi, E.: Simulating rhapsody SysML blocks in
hybrid models with FMI. In: Modelica Conference, pp. 43–52 (2014)
10. Fitzgerald, J., Gamble, C., Payne, R., Pierce, K.: Method guidelines 1. Technical
report, INTO-CPS Deliverable, D3.1a, December 2015
11. Fritzson, P.: Principles of Object-Oriented Modeling and Simulation with Modelica
2.1. Wiley-IEEE Press, Hoboken (2004)
12. Gibson-Robinson, T., Armstrong, P., Boulgakov, A., Roscoe, A.W.: FDR3 — a
modern refinement checker for CSP. In: Ábrahám, E., Havelund, K. (eds.) TACAS
2014 (ETAPS). LNCS, vol. 8413, pp. 187–201. Springer, Heidelberg (2014)
13. Hoare, T.: Communication Sequential Processes. Prentice-Hall International,
Englewood Cliffs (1985)
14. Jackson, D.: Software Abstractions: Logic, Language, and Analysis. MIT Press,
Cambridge (2012)
15. Johnson, D.B.: Finding all the elementary circuits in a directed graph. SIAM J.
Comput. 4(1), 77–84 (1975)
16. Kanellakis, P.C., Smolka, S.A.: CCS expressions, finite state processes, and three
problems of equivalence. Inf. Comput. 86(1), 43–68 (1990)
17. Kleijn, C.: Modelling and simulation of fluid power systems with 20-sim. Int. J.
Fluid Power 7(3), November 2006
18. Kübler, R., Schiehlen, W.: Two methods of simulator coupling. Math. Comput.
Model. Dyn. Syst. 6(2), 93–113 (2000)
19. Kullmann, O.: New methods for 3-SAT decision and worst-case analysis. Theor.
Comput. Sci. 223(1–2), 1–72 (1999)
20. Larsen, P.G., Battle, N., Ferreira, M., Fitzgerald, J., Lausdahl, K., Verhoef, M.:
The overture initiative - integrating tools for VDM. SIGSOFT Softw. Eng. Notes
35(1), 1–6 (2010)
21. Monien, B., Speckenmeyer, E.: Solving satisfiability in less than 2n steps. Discret.
Appl. Math. 10(3), 287–295 (1985)
22. Nipkow, T., Klein, G.: Concrete Semantics: with Isabelle/HOL. Springer,
Switzerland (2014)
23. Pohlmann, U., Schäfer, W., Reddehase, H., Röckemann, J., Wagner, R.: Generat-
ing functional mockup units from software specifications. In: Modelica Conference
(2012)
24. R Core Team: R: A Language and Environment for Statistical Computing. R Foun-
dation for Statistical Computing, Vienna, Austria (2015). https://www.R-project.
org/
25. OMG Systems Modeling Language (OMG SysMLTM ). Technical report version
1.3, SysML Modelling Team, June 2012. http://www.omg.org/spec/SysML/1.3/
26. Tripakis, S., Lickly, B., Henzinger, T.A., Lee, E.A.: A theory of synchronous rela-
tional interfaces. ACM TOPLAS 33(4), 14 (2011)
A CEGAR Scheme for Information Flow
Analysis
1 Introduction
Information flow analysis aims at finding data leaks in programs. More precisely,
it analyses whether information flows from a private, confidential source to a
public sink. Information flow control should thus provide confidentiality of data:
access to confidential information is only given in ways allowed by specified
security policies (or security lattices). A typical policy is the explicit division of
variables into low (L) and high (H) ones, disallowing flow of data from high to
low.
A large number of information flow analyses exist today. These are e.g. based
on type systems [12,18], logic [1,7,13], theorem proving [7], dependency analysis
that operates either on the control flow [1] or on program dependence graphs
[11]. A good survey of the known approaches is given by Sabelfeld and Myers
[15]. Most of these approaches are computing overapproximations of the actual
information flow in program executions, thereby potentially raising false alarms.
As a large number of false alarms makes such an analysis practically useless, a
lot of approaches try to get rid of false alarms by making the analysis itself more
precise, e.g. by augmenting it with costly points-to analysis. A different approach
is taken by the path conditions of [16]: path conditions encode the potential flow
of information from a source to a sink as a logical formula and use SMT solvers
This work was partially supported by the German Research Foundation (DFG)
within the Collaborative Research Centre “On-The-Fly Computing” (SFB 901).
c Springer International Publishing AG 2016
K. Ogata et al. (Eds.): ICFEM 2016, LNCS 10009, pp. 466–483, 2016.
DOI: 10.1007/978-3-319-47846-3 29
A CEGAR Scheme for Information Flow Analysis 467
Fig. 1. Running example of a secure program and its control flow automaton
violation which turns out to be real, i.e., for which none of the candidates are
correct. We prove soundness of both this refinement step and for the initial
analysis.
We integrated our approach into the configurable software verification frame-
work CPAChecker. Its implementation within CPAChecker allows for com-
binations with several other software analyses, e.g. predicate analysis which pro-
vides path sensitivity.
2 Background
We start with defining the programs which we consider in this paper. For the
formal treatment, we restrict ourselves to simple imperative programs; the imple-
mentation treats a larger class. In the following, x is a variable (of type integer
or boolean) and a ∈ AExpr , b ∈ BExpr are arithmetic and boolean expressions,
respectively.
Stmt :: = skip; | x := a; | Stmt; Stmt | if (b) then Stmt else Stmt fi |
while (b) do Stmt od
describe assignments, assume (i.e., conditions of if and while) and skip state-
ments. We let V denote the set of all program entities (variables1 ) that occur in
any operation op ∈ Ops of any edge (·, op, ·) ∈ G. We say that a location l ∈ L
occurs inside a loop if l is on a cycle of the control flow graph. Every program can
be transformed into a control flow automaton by assigning names to its program
locations. We therefore often directly give programs with their location names.
Figure 1 describes our running program and its control flow automaton.
The semantics of a control-flow automaton (and thus of a program) (L, G, l0 )
is defined by a transition system T = (C , →, c0 ). In this, the concrete data state
C : V → Z ∪ {true, false} of a program is a total (type-correct) function that
maps every variable from the set V to a concrete integer or boolean value, c0 ∈ C
is the initial state and → ⊆ C × G × C is a transition between states. Note that
initial states may vary and thus a number of transition systems can be assigned
to a program.
A tuple (c, (l, op, l ), c ) ∈ → describes that at location l with state c the
operation op can be applied and thereby location l with state c is reached.
1
We consider V in general as variables, however, objects, function identifiers etc. are
also possible as entities used in security policies.
A CEGAR Scheme for Information Flow Analysis 469
Note that we use in the semantics two evaluation functions c : AExpr → Z and
c : BExpr → {true, false} to evaluate expressions. A feasible path to a location
lk ∈ L in T = (C , →, c0 ), is a sequence of concrete states and transitions a
program can pass through, starting in location l0 with concrete state c0 and
ending in location lk with concrete state ck :
Paths(T ) = {(c0 , (l0 , op 0 , l1 ), c1 ), (c1 , (l1 , op 1 , l2 ), c2 ), .., (ck−1 , (lk−1 , op k−1 , lk ), ck ) |
∀0 ≤ i < k : ∃li ∈ L, ∃ci ∈ C , ∃op i ∈ Ops s.t. (li , op, li+1 ) ∈ G
∧ (ci , (li , op, li+1 ), ci+1 ) ∈ →}
2.2 Security
Having stated our security policies, we can next define non-interference. The non-
interference property [10] is a well-known standard security concern. Informally,
it says that a program executed twice with the same public input should not
behave observably distinguishable on the public output channels even when the
secret information differs. Many authors consider policies that consist of only
one public (low) and one secret entity (high). We will define something similar
but consider security policies in general. First of all we define non-interference
of entities:
For each v ∈ V and l ∈ L we can separate the set of all entities into the
following two disjoint sets:
We demand for the final location l ∈ L of the two paths π and π not to be
inside a loop. For the while-language this means it is not inside the loop body of
a while-statement. Omitting this restriction would in general cause a violation
for this location even if two program runs are identical the same with the same
initial values c0 = c0 . To see this, consider the example in Fig. 3: Each loop
iteration will decrease at location 3 the concrete state of the variable v ∈ V
by one and therefore, differ to the previous loop iteration. However, even for
two paths with c0 (v ) = c0 (v ) > 1 the concrete states for location 3 will differ
after the first (c4 ) and the second iteration (c6 ) and therefore Ξ3 (v , vh ) does
not hold and signals an interference to vh although there is no influence for any
computation in the loop.
Nevertheless, all other locations occurring before l in the paths π and π are
without restriction allowed to be part of loops and to occur in a loop more than
once. With these definitions at hand we can fix our non-interference security
property:
Definition 4. Security at a location
Let P ∈ Pol (S ) be a security policy, let CFA = (L, G, l0 ) be a program
and let V be the set of entities that occur in the CFA. The program is secure
472 M. Töws and H. Wehrheim
Fig. 3. Small example that explains why locations like 3 are excluded from the non-
interference definition. If not, location 3 would signal for v an interference of vh and
conclude a violation.
Table 1. The program in Fig. 1 is secure at all locations according to the definition.
3 Dependency Analysis
We base our technique for analysing programs with respect to security (as given
in Definition 4) on a forward dataflow analysis. It computes the set of interfer-
ences over program entities based on the ideas of Amtoft and Banerjee [1]), i.e.,
A CEGAR Scheme for Information Flow Analysis 473
it computes for every location l and pair of variables v and w, whether v might
depend on w’s value at program start. A small difference to [1] is that we aim
at computing the set of interferences while they aim at computing the set of
non-interferences.
We intend to compute an abstract state space of dependencies. Dependencies
are specific to the program part which has already been executed. After the
execution of a statement, these dependencies can differ. Let V again describe the
set of all program entities of a program CFA. The total mapping Dep : Stmt ×
V → 2V is the sole attribute of an abstract state where the idea is that for
each entity a set of those entities is described it depends on. E.g., an expression
Dep(st, v) = {w, z} stands for the case that an entity v – after having executed
the statements st ∈ Stmt – depends on the initial values of the entities w and z.
We define Dep(st, v) by induction on the structure of programs where we
assume the initial dependencies of an empty program, Dep(skip, v ) = {v}, to
be the identity function. The remaining cases are given in Fig. 4 where st 0 , st 1 ,
st 2 , lst ∈ Stmt. Furthermore, fv (e) ⊆ V defines the set of all free variables
occuring in an expression e ∈ AExpr ∪ BExpr . For while statements, an iterative
computation of dependencies until a fixpoint is reached is needed. Since there
are only finitely many variables, a fixpoint always exists.
The mapping Dep gives us the dependencies between variables. For the running
example from Fig. 1 (called Ex ) we list in Table 2 all the dependencies that will be
computed during the analysis. Our interest is, however, in the security classes of
these dependencies. The mapping CSC : Stmt × V → 2 S (security classes of the
474 M. Töws and H. Wehrheim
content in the entity) is a function that associates to each program entity a set
of security classes that classifies the current content stored in the entity. We base
the semantics of CSC for a program entity on the dependencies (see Sect. 3) to
other entities and the security level of the union of these dependencies. Therefore
this mapping can and will vary between different abstract program states:
CSC (st, v) = SC (w) ∪ SC (v)
w∈Dep(st,v)
We will check security of a program st by checking that SC (v), CSC (st, v)) ∈ P
holds for all v ∈ V . This procedure is similar to Definition 4 with the only
difference that the computed set Dep takes the place of Interferences. This is a
sound procedure, which we show in Theorem 1. To get a correspondence between
a location and statements we use the notation [l : st; l :] where l ∈ L stands for
the location right before and l ∈ L labels the location right after the statement.
Proof. We only give a proof sketch here. We prove this property by induction,
and show that for each location l ∈ L following a statement st ∈ Stmt
Interferences l0 (v) ⊆ Dep([st ; l0 :], v) holds. The base clause for the induction is
given by the empty program [skip; l :] where Interferences l (v) = {v} ⊆ {v} =
Dep([skip; l :], v) holds.
As induction step, we show that this relation still holds if we extend the
sequence [st ; l0 :] of k to k + 1 statements by adding a st after st : [st ; l0 :
st; l :]. Then the relation can be straightforward shown by considering all possi-
ble cases that can occur for Interferences and Dep by using the definition from
Definition 3 and Fig. 4 per each case of statements (namely skip, assignment, if
and while). Comparing these two sets will lead to a proof of the ⊆ relation.
The main reason we are using the dependency analysis is that we consider the
evaluation of the formula representing the definition of Security from Definition 3
as too costly to be applied for every entity and every security state at every
location. The analysis stated in the previous Sect. 3 though is conservative and
not precise with respect to the security definition. In this section, we explain
how we can refine the analysis results for the usage in a CEGAR scheme. In
principle we will do this by applying the mentioned costly evaluation of the
formula representing security when we detect a possible violation. So we evaluate
this formula not on all locations, but only when needed.
Given this counter example from the previous Sect. 3, our next step is to
show that there are no violations by refining the dependencies. We do this by
first determining a set of possible candidates for a refinement of the security class
mapping. Let P ∈ Pol (S ) be an aggregation policy. We define the set of next
feasible security states for a given non-secure state (a, A) ∈ P by
This set determines possible candidates for a refinement of the security states
of the counter example. For our detected possible violation (, {, h, i }) ∈ LHI ,
this set consists of two elements:
This is also illustrated in Fig. 6. Now let l ∈ L be the (potentially insecure) loca-
tion after execution of program st, and w ∈ V be the variable which causes the
violation, i.e., (SC (w ), CSC ([l : st; l ], w )) ∈
/ P . Next we take a logical encoding
476 M. Töws and H. Wehrheim
of the program Ψ ([l : st; l :]) leading to l . The encoding of the program as
formula assumes an SSA-form (static single assignment) [6] of variables which
we below mimic by using a renaming into unique SSA names for variables in the
form v, l (variable plus location), where l ∈ L is the location the variable was
last assigned to. For example, a variable x ∈ V in a statement [l : x = a; l :]
with location l ∈ L before and l ∈ L afterwards will be renamed to a pair x, l.
For joining variables in SSA-form, we use the standard technique of inserting
φ-functions which join variables after two branches have merged. Notationally,
the φ-functions in if statements appear after the if and those for while in a square
bracket before the loop condition.
st0 ; if (b) then st 1 else st 2 fi; x1 , l = φ( x1 , l11 , x1 , l12 ); . . . ; xk , l = φ( xk , lk1 , xk , lk2 )
st0 ; while[ x1 , l = φ( x1 , l10 , x1 , l1l ); . . . ; xk , l = φ( xk , lk0 , xk , lkl ); ] (b) do lst od
In this, li1 , li2 , li0 and lil denotes the location where xi was written the last time
in [st 0 ; st 1 ], [st 0 ; st 2 ], [st 0 ; ] and [lst; ], respectively. The SSA-form of the running
example program is illustrated in Fig. 5. SSA-forms are automatically generated.
Based on the SSA-form, we define the program encoding Ψ as depicted in
Fig. 7. Each statement for Ψ is encoded according to its semantics, except for
the while-loop. For while-loops there exist in general several possibilities for han-
dling the unknown number of loop iterations. Common variants are the bounded
unrolling of the loop of at most k rounds or the use of invariants. At the moment
we encode a loop as two cases. One is that the loop condition is not fulfilled at
the beginning and the loop body will not be iterated. In the second case, we
completely ignore the current state of the variables appearing in the loop and
iterate the loop body only once. The idea is here to make an encoding which
models a run through the loop in an arbitrary start state, and thus to overap-
proximate all finite loop iterations. We do so by substituting every loop variable
xi , l with a new fresh variable ai , l in both the formula encoding of the loop
body as well as of the loop condition (see Fig. 7, while statement).
As we now aim at checking non-interference, we evaluate another formula
Φ : (Stmt × V × (S × 2S )) → {true, false} for unsatisfiability. For this, we use the
above mentioned program encoding twice as Ψ (l : st : l ]), Ψ (l : st; l ]), where in
Ψ all variable names are renamed disjoint to Ψ (i.e., variable v occurs as v ).
A CEGAR Scheme for Information Flow Analysis 477
Let w ∈ V be the entity for which we detected the spurious counter example
(a, A) ∈ P as violation. Let VB = {v ∈ V | SC (v ) ∈ B } ⊆ V . For all (a, B) ∈
XP ((a, A)), we then do an evaluation according to the security Definition 4 and
check whether
w w
Φ(l : st; l :, w, (a, B)) = v, 0 = v , 0 ∧ Ψ (l : st; l ) ∧ Ψ (l : st; l :) ∧ ¬( w, lst = w , lst )
v∈VB
Proof. We only give a proof sketch here. We will show this theorem by
an indirect proof. Assume Φ(st; l :, w, (a, B))is unsatisfiable and V \ VB ⊆
Noninterferences l (w). This means, there is a z ∈ V \ VB such that Ξl (w, z)
is satisfiable. We argue that in this case for the search space – Φ explores to
proof unsatisfiablity – contains always the search space that Ξ(w, z) explores.
Because of the satisfiability of Ξl (w, z), there exist two paths π, π (corre-
sponding to those in the formula Ξl (w, z)) where the initial concrete states of
the paths are restricted by ∀v ∈ V \ {z} : c0 (v) = c0 (v) and the end states
differ for w: ¬(cj (w) = ck (w)). First we argue that the domain of initial con-
crete states of Ξ is contained in Φ, since V \ VB ⊆ V \ {z} implies that by the
subformula v∈VB v, 0 = v , 0 in Φ at least all these concrete initial states of
Ξ are modelled.
Let us consider the path π (π is analogous) defined in Ξ. We argue that in
the program encoding of the subformula Ψ of Φ each path π of Ξ is modelled.
That means if the path π exists, the formula Ψ will evaluate to true. That is
because skip, assignment and if-statements are represented one to one to its
correlating semantics. The encoding of while-statements in Ψ covers more since
we ignore restriction to the concrete states of those entities rewritten in the loop
body before entering the while-statements. However, π is also contained in the
encoding of Ψ . On the one hand a path that does not enter the loop body is
directly represented in Ψ . On the other hand each path that iterates several
times the loop body before leaving it is covered by the other branch of Ψ which
represents the last iteration by simultaneously ignoring the past of in the loop
rewritten variables (further restriction to concrete states of these variables).
We can conclude, that Φ explores all possible paths of Ξl (w, z) and considers
also all domains of initial concrete states that are considered by Ξl (w, z). So
if π, π would result for Ξl (w, z) to be evaluated to satisfiable, Φ would have
recognized these two paths too and would also be evaluated to satisfiable. This
contradicts the assumption.
The primed formula Ψ (Ex ; 7 :) looks similar. Like previously mentioned, for
Ex our dependency analysis determined a spurious counterexample as a pair
(v , Dep(v ) = {vi , vh }) with the conclusion (, {, h, i }) ∈
/ LHI . The two can-
didates for downgrading of the violation (, {, h, i }) are (, {}), (, {, i }) ∈
XLHI ((, {, h, i })). We will then check the following two formulas for unsatisfi-
ability:
A CEGAR Scheme for Information Flow Analysis 479
The formula Φ([Ex ; 7 :], v , (, {, i})) is unsatisfiable, but Φ([Ex ; 7 :], v , (, {}))
is satisfiable. So v depends only on variables with security classes of and i but
not on h like the result of the dependency analysis claimed. We will therefore
try to modify our dependencies to accomplish this first element as the result. We
achieve this now by modifying the dependencies by removing the dependencies to
entities that are too restrictive. The set Δ defines for a spurious counterexample
(a, A) ∈ P at location l ∈ L for variable w the difference of security classes of
the aimed refinement to the spurious counterexample:
Δl (w, (a, A)) := A \ B
(a,B)∈XP ((a,A))
Φl (w,(a,B)) unsat
Furthermore based on this set Δl , the set RΔl describes the set of entities that
has to be removed for making the result more precise:
Dep ([l : st; l :], w) := Dep([l : st; l :], w) \ RΔl (w, (a, A))
Since we memorize (7, v , {vi }) for further iterations, the same counter examples
will not appear again. In this case, no other violation is detected and hence
the program is proven secure. In general, several iterations of the checking and
refinement procedure might be necessary to finally state security or report a real
violation.2
2
As additional remark we want to clarify that the refinement technique is able to
handle more complex examples than the illustrated implicit flow example. E.g. in
examples like [v = vh ; v = v − vh ]the firstly computed dependency to vh will be
recognized as nonexistent as well.
480 M. Töws and H. Wehrheim
5 Implementation
We implemented our approach within the CPAChecker framework [3–5]3 . This
is a framework for specifying a configurable program analysis – a unification
which allows both model checking approaches as well as data flow analysis.
The implementation of our approach is divided into three interleaved separate
configurable program analysis which are
1. Dependency Analysis,
2. ControlContext Analysis, and
3. PolicyChecker.
The set SC can be partial defined instead of a total function. The analysis will
expand the function to a total mapping by setting all not specified entities to a
security class s ∈ S that can be given as additional input. The set E = V \ I is
implicit.
The usage of the CPAChecker framework allows for an easy combination
of our approach with different already integrated program analysis, in particular
the possibility of using information of other analyses for improving precision
of our own analysis. We can for instance use a standard Points-to-Analysis [2]
to improve precision of the Dependency Analysis or a Predicate Analysis [5] to
eliminate dead paths.
3
https://cpachecker.sosy-lab.org/.
A CEGAR Scheme for Information Flow Analysis 481
6 Conclusion
We presented a CEGAR Scheme for information flow analysis that is based
on a conservative dependency analysis. In this, we inspect counter examples
for their spuriousity by an evaluation of a program encoding that overapproxi-
mates the underlying security concern – non-interference. Soundness of both the
dependency analysis and refinement triggered by the evaluation of the program
encoding is shown by Theorems 1 and 2.
As an advantage we can process arbitrary security policies, with the only
restriction that the joining of several secure states (for the dataflow analysis) has
to result in a secure state. Resting the security upon the dependency analysis
result allows an exchange of the security policy without the need of recomputing
the dependencies (but in some circumstances to use the CEGAR scheme to make
the dependencies more precise).
Related Work. The approach most similar to ours is that of Taghdiri et al.
[17]. Both their and our analysis perform a security analysis on the basis of a
dependency analysis with CEGAR aspects. While they generate and use a con-
servative program dependence graph to signal dependencies, we compute conser-
vative dependencies with a dataflow analysis to use it in the CPAChecker frame-
work together with other software analysis that can refine the dependencies. The
aggregation policies we consider in this paper are equal in expressiveness to the
lattices they consider as policies. However, the CEGAR schemes differ. Their
analysis marks the nodes on a path in the PDG with ascending security classes
according to their lattice. Such a path can be a spurious counter example they
plan to eliminate, where they use a path encoding to validate whether this path
is possible. In our CEGAR scheme, the computed security classes that an entity
contains can violate the security at a location. We then use an encoding of the
paths to this location for the purpose of evaluating the non-interference property
for a smaller subset that would imply a secure state. If that is the case we refine
the dependencies.
For our dependency analysis we use a forward dataflow analysis on aggre-
gation policies, which has similarities to the forward analysis of Amtoft and
Banarjee [1]. While they consider independences of variables, we consider depen-
dencies.
Darvas et al. [7] use a theorem proving approach where they evaluate two
variants of program encodings of non-interference in dynamic logic. One of the
evaluation examples is similar to ours. However, they only validate the program
as a whole and not per location of interest, and they consider only the standard
policy (bipartition in high and low entities).
The policy specification is based on the framework used by Foley [8,9]. Mantel
[14] gives a good overview of formalizing security concerns – including non-
interference – based on the specification of a general policy. However, they con-
sider more security concerns like e.g. separability, perfect security etc. which
are ordered in a hierarchy and are expressed as formulas. At the moment, we
482 M. Töws and H. Wehrheim
Future Work. We use general security policies which are only restricted by sound
joining of secure states, because of the underlying forward data flow analysis.
By using a model checking approach instead, we could allow arbitrary feasible
policies with no further restriction since joining of states would not be needed.
For this case, we have to extend the definition of refinement candidates XP from
Sect. 4 to each maximal state of context change between secure and non-secure
states with respect to the ⊆ relation. For the downgrading of security states, a
spurious counter example refinement would then have to consider not only false
negatives but false positives as well, and has to choose the maximal candidate
that holds.
Another aspect is the program encoding we use for while-loops to overap-
proximate the non-interference definition. At the moment we consider only the
last iteration with arbitrary concrete states for the rewritten variables. A next
step would be to allow further subformulas at the beginning of the loop iteration
encoding to make the allowed concrete states more precise while retaining the
conservativeness of the approach, which will be similar to loop invariants.
References
1. Amtoft, T., Banerjee, A.: Information flow analysis in logical form. In:
Giacobazzi, R. (ed.) SAS 2004. LNCS, vol. 3148, pp. 100–115. Springer, Heidelberg
(2004)
2. Andersen, L.O.: Program analysis and specialization for the C programming lan-
guage. Ph.D. thesis, University of Cophenhagen (1994)
3. Beyer, D., Henzinger, T.A., Théoduloz, G.: Configurable software verification: con-
cretizing the convergence of model checking and program analysis. In: Damm, W.,
Hermanns, H. (eds.) CAV 2007. LNCS, vol. 4590, pp. 504–518. Springer, Heidelberg
(2007)
4. Beyer, D., Henzinger, T.A., Théoduloz, G.: Program analysis with dynamic preci-
sion adjustment. In: ASE 2008, pp. 29–38. IEEE Computer Society (2008)
5. Beyer, D., Keremoglu, M.E., Wendler, P.: Predicate abstraction with adjustable-
block encoding. In: Bloem, R., Sharygina, N. (eds.) FMCAD 2010, pp. 189–197.
IEEE (2010)
6. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently
computing static single assignment form and the control dependence graph. ACM
Trans. Program. Lang. Syst. 13(4), 451–490 (1991)
7. Darvas, Á., Hähnle, R., Sands, D.: A theorem proving approach to analysis of
secure information flow. In: Hutter, D., Ullmann, M. (eds.) SPC 2005. LNCS, vol.
3450, pp. 193–209. Springer, Heidelberg (2005)
8. Foley, S.N.: Unifying information flow policies. Technical report, DTIC Document
(1990)
9. Foley, S.N.: Aggregation and separation as noninterference properties. J. Comput.
Secur. 1(2), 159–188 (1992)
10. Goguen, J.A., Meseguer, J.: Security policies and security models. In: 1982 IEEE
Symposium on Security and Privacy, pp. 11–20. IEEE Computer Society (1982)
A CEGAR Scheme for Information Flow Analysis 483
Erratum to:
Chapter “Formal Availability Analysis Using
Theorem Proving” in: K. Ogata et al. (Eds.):
Formal Methods and Software Engineering, LNCS,
DOI: 10.1007/978-3-319-47846-3_15
The original version of this chapter contained an error. The name of the author
Waqar Ahmad was spelled incorrectly as Waqar Ahmed in the original publication.
The original chapter was corrected.
The updated original online version for this chapter can be found at
DOI: 10.1007/978-3-319-47846-3_15
Yamane, Satoshi 74
Tan, Tian Huat 122, 363
Yanase, Ryo 74
Tanaka, Akira 243
Yao, Yinbo 26
Tho, Quan Thanh 159
Tippenhauer, Nils Ole 175
Töws, Manuel 466 Zhang, Min 433
Troubitsyna, Elena 141 Zhu, Huibiao 433