Lecture Notes in Computer Science 3456: Editorial Board
Lecture Notes in Computer Science 3456: Editorial Board
Editorial Board
David Hutchison
Lancaster University, 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, Switzerland
John C. Mitchell
Stanford University, CA, USA
Moni Naor
Weizmann Institute of Science, Rehovot, Israel
Oscar Nierstrasz
University of Bern, Switzerland
C. Pandu Rangan
Indian Institute of Technology, Madras, India
Bernhard Steffen
University of Dortmund, Germany
Madhu Sudan
Massachusetts Institute of Technology, MA, USA
Demetri Terzopoulos
New York University, NY, USA
Doug Tygar
University of California, Berkeley, CA, USA
Moshe Y. Vardi
Rice University, Houston, TX, USA
Gerhard Weikum
Max-Planck Institute of Computer Science, Saarbruecken, Germany
Heinrich Rust
Operational Semantics
for Timed Systems
13
Author
Heinrich Rust
BTU Cottbus, Software-Systemtechnik
Postfach 101344, 03013 Cottbus, Germany
E-mail: [email protected]
ISSN 0302-9743
ISBN-10 3-540-25576-1 Springer Berlin Heidelberg New York
ISBN-13 978-3-540-25576-5 Springer Berlin Heidelberg New York
This work is subject to copyright. All rights are reserved, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, re-use of illustrations, recitation, broadcasting,
reproduction on microfilms or in any other way, and storage in data banks. Duplication of this publication
or parts thereof is permitted only under the provisions of the German Copyright Law of September 9, 1965,
in its current version, and permission for use must always be obtained from Springer. Violations are liable
to prosecution under the German Copyright Law.
Springer is a part of Springer Science+Business Media
springeronline.com
© Springer-Verlag Berlin Heidelberg 2005
Printed in Germany
Typesetting: Camera-ready by author, data conversion by Olgun Computergrafik
Printed on acid-free paper SPIN: 11416166 06/3142 543210
Foreword
Credits
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2. Context: Formal Methods in Software Engineering . . . . . . . . 5
2.1 The Place of Formal Methods in Software Engineering . . . . . 5
2.2 The Role of Mathematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Conditions for Using Inconsistencies Productively . . . . . . . . . . 7
2.4 Two Sides of Machine Support for Proofs . . . . . . . . . . . . . . . . . 8
2.5 The Essence of Formal Methods in Software Engineering . . . 9
2.6 Specific and General Formalisms . . . . . . . . . . . . . . . . . . . . . . . . 10
2.7 Goals and Consequences from the Analysis . . . . . . . . . . . . . . . 12
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
1. Overview
This work introduces a novel approach to modelling timed systems. The main
idea consists of a new model of time which is both discrete and dense in the
real numbers. This allows to use a discrete base formalism for the description
of timed algorithms where system behaviors can be interpreted very straight-
forwardly in a timed manner without sacrificing that much precision.
Chapter 2 presents the context of our work, which is our understand-
ing of the role of formal methods in the software development process. The
main point in that chapter is that “formal methods” does not just mean the
use of concepts from mathematics explicitly in software engineering, but the
use of such concepts in order to deepen one’s understanding of a software
engineering problem and its solution, and to express this understanding un-
ambiguously and consistently. From this contextual frame, we derive some
consequences for the formalism to be developed.
Part I introduces basic concepts: Our model of time, the discrete base
formalism on which we build, and a notation for a temporal logic.
Chapter 3 discusses different models of linear time and introduces a new
model which avoids the main problems of classical discrete and continuous
models of linear time. The main idea consists in the use of infinitesimals: The
flow of time is conceptualized as a sequence of steps of identical infinitesimal
length, i.e., we use an infinitesimal discretization of real numbered time.
Chapter 4 presents a short introduction to the number concept we use,
which is Nelson’s axiomatic approach to infinitesimality.
Chapter 5 presents a variant of abstract state machines (ASMs) as a
base formalism for giving the operational semantics of discrete systems. This
variant admits two kinds of composition: synchronous and asynchronous. We
introduce a semantics for ASMs which is compositional for both kinds of
composition, which we call “action semantics”. We give reasons for using
ASMs as the discrete base formalism.
Chapter 6 describes how we combine ASMs and our model of time in order
to describe hybrid systems. Other applications of ASMs in the description of
timed and hybrid systems specify the timing independently from the discrete
changes – in our approach, the timing is derived from the discrete semantics.
An approach using a classical model of time (standard timed ASMs, STASMs)
is given first as a comparison; then we use our model of time (non-standard
time ASMs, NTASMs) and show that the infinitesimal discretization might
essentially change the semantics of an algorithm. We describe what simulation
means for two algorithms given as a STASM and an NTASM, and we intro-
duce a concept which relates the STASM interpretation of an algorithm and
the NTASM interpretation of an algorithm: an algorithm is “well-behaved” if
and only if each run of its STASM interpretation can be mimicked by a run
of its NTASM interpretation.
Chapter 7 introduces a notation for a temporal logic which allows us to
specify many properties of NTASM systems succinctly. It uses ideas from the
Duration Calculus, an interval-based temporal logic, and transfers them to
the infinitesimally discretized time domain.
Part II introduces basic modelling strategies for timed systems – interleav-
ing and synchronous composition, deadlines and openness – and it describes
how different magnitudes of hyperreals can be used.
Many modelling formalisms used for describing timed systems support ei-
ther interleaving or synchronous composition. Our formalism supports both.
Chapters 8 and 9 describe how interleaving composition and synchronous
composition of timed systems are expressed without formal overheads. We
point out how the typical problems of synchronous formalisms, those re-
garding causality and micro-steps, appear in our framework, and we discuss
some specific modelling problems of interleaving and synchronous systems of
NTASMs.
The concepts of deadlines, urgency and openness pose special problems
in the NTASM framework, which are discussed in Chaps. 10 and 11.
Chapter 12 presents a first application: We model hardware on the gate
level with timing-enhanced ASMs. We illustrate illustrated how different mag-
nitudes of the hyperreals can be used to express in the model the fact that
some delays are considered to be negligible with respect to others, but if the
system is considered using a finer timescale some previously neglected delays
can become considerable.
Part III describes some applications of our approach.
Chapter 13 presents an NTASM model of Fischer’s real-time based syn-
chronization protocol, and a purely discrete correctness proof made possible
by our model of time.
Chapters 14 and 15 present meta-models, i.e., STASM and NTASM se-
mantics of other modelling formalisms, in order to make it plausible that our
model can express other formalisms with minimal formal overheads. Chap-
ter 14 investigates two forms of quantitatively timed Petri nets, making ex-
plicit their differences in an operational way by supporting both variants in a
common formalism. Chapter 15 discusses timed automata. In both chapters,
we illustrate how the concept of well-behavedness can be lifted from the base
formalism to the expressed formalism.
Chapter 16 presents a larger case study, which is inspired by real-world
requirements. We describe the control program for a flexible and timing-
1. Overview 3
enhanced production cell. It will become clear that the necessary timing
properties are very simply expressed in our formalism, and the flexibility
with respect to the abstraction level chosen comes in handy when common
properties of different variants of the system are described.
Part IV presents a summary of our work.
The appendix collects the definition of some often used notation.
2. Context:
Formal Methods in Software Engineering
Before we go into the details of the formalisms which we propose for modelling
some classes of real-time and hybrid systems, we describe the role we give to
formal methods in software engineering and some relevant features of formal
methods which seem especially useful to us. This partly is an elaboration of
ideas first developed by the author in [Rus94]. This discussion will present
the context for the results described later, and it will be used to derive some
desiderata for the formalism to be used according to our understanding of
formal methods.
Formal methods deal predominantly with the relation between the sphere of
the intuitive understanding and the sphere of the expression of the under-
standing: They help to ensure that an intuitive understanding of something is
more or less consistent by expressing it in a strictly defined notational system
and checking this for plausibility and consistency. Only an expressed under-
standing can be exposed to public scrutiny by colleagues and customers, or to
consistency checks using mathematical proofs, or to automated consistency
checks using a computerized tool, e.g., a syntax checker, or to the execution
of a program in order to compare the behavior of a system in the test cases
with one’s expectations.
But if the use conditions of a formalism are given in some application area,
and the fulfillment of the axioms is easily checked, but the theorems are
difficult to understand, then purely formal proofs can help to ensure the
truth of the theorems.
For this use of formal methods, not much insight is necessary after the
soundness of the proof system is inductively ensured and the interpretation
of formalism elements is fixed. In this way of using formal methods, even
completely automatic proof algorithms, like the currently fashionable ones
based on symbolic model checking, are sensible.
We see the second and third uses of formal methods as derived from the
first one. Purely formal applicability of a formalism in an application area is
only sensible if the (informal) connection between the application area and
the formalism is inductively ensured. The social functions of formalisms are
also based on the possibility of getting a good intuitive understanding of the
subject area and then expressing it for scrutiny by others or comparing it
with the expressions others give of their understanding. Thus, for us, the
essence of formal methods can be described in the following way:
Formal methods in software engineering consist in the use of
mathematics in order to deepen one’s intuitive understand-
ing of a software-engineering problem and its solution, and
in order to express this understanding unambiguously and
consistently.
Thus, to apply formal methods it is not enough to use some strictly defined
notation – the goal of such a use is important: the striving to make one’s
intuitive understanding unambiguous and consistent. The use of mathematics
is just one of the best tools we know today that support this effort.
The goal we pursue in this work is to develop a formalism for the description
of quantitatively timed systems based on a linear model of time, since this
is the most popular model of quantitative time. This formalism should avoid
several problems of existing formalisms, which we will detail a little.
The formalism should be sufficiently general so that it can be used to
express other formalisms used for the description of systems in linear quan-
titative time with few formal overheads, i.e., it should not be necessary to
introduce additional model components only in order to allow the expression.
This allows our formalism to be used for the comparison of the relative merits
of other formalisms by expressing them in the same basic framework.
The formalism should be sufficiently flexible so that it can be used to
express algorithms in linear quantitative time essentially coding free with
respect to the data part of the algorithm. This means that we strive for a
general rather than for a more specific formalism.
Discreteness of the time model used in the formalism is attractive because
discrete algorithms are familiar to computer scientists.
We do not want to restrict the kinds of consistency checks we perform
on the models expressed – any concept from mathematics is allowed. This
goal results more from missing than from existing knowledge: We do not yet
know enough about checking timed systems for consistency so that we could
be sure that the methods we propose would suffice.
We do not want to fix an abstraction level for the algorithms to be de-
scribed – it should be possible to choose this level high enough so that relevant
ideas are concisely expressed, and low enough so that one does not have to
abstract from the relevant ideas.
3. Models of Time and of System Behaviors
third point different from both. A typical example for a discrete model of
time is N0 , and a typical example for a dense model of time is R+0 . The com-
pleteness property of R+ 0 is typically not used in applications of the time
model. A typical example for a model of time which is used in the description
of hybrid systems is sequences of intervals from R+0 [LSVW96]. The latter is
the most advanced classical model of time for hybrid systems, and so we will
use it later in the classical reference approach we use for comparison with
our non-classical approach based on infinitesimals. This time model will be
described in detail in Sect. 3.2.
Discrete models of time are attractive because they are so common in
computer science, but there also exists a downside: The following problems
in the use of a discrete time model are sometimes given [Hoo92, Jos92]:
– Independent events can occur arbitrarily near. In order to express this in
the model, a dense structure is necessary.
– Reactive systems often operate in an environment which contains (piece-
wise) continuously changing components, and they are often modelled as
functions from R to some state space. In order to describe a reactive system
in such an environment, it is convenient to be able to use the natural time
domain of the environment in the description of the context of the reactive
system.
– For composition of independently specified or developed units, a common
time base must be found. A dense model of time avoids this problem.
– Action refinement is difficult in a discrete model of time [Ben98].
Basically, R is a model of time suggested by our intuition from classical
physics, which makes it attractive to use its features also for reactive systems.
The main benefits of a discrete model of time are the following:
– It is intuitively very attractive to have a well-determined next state for
each state in a system behavior. This also allows us to use well-developed
methods for specification, description and analysis of (untimed) discrete
systems more or less unchanged for the work with timed systems. For
example, simple induction can be used to prove invariants.
– When dense models of time are used, the phenomenon of Zeno-ness [AL92]
has to be dealt with. This is an artifact of formalisms which have been
developed for the discrete domain and are used for dense quantitative time.
A system behavior is called “Zeno” if it consists of an infinite sequence of
states with strictly increasing time stamps for which there exists an upper
bound for the time stamps. Only dense models of time allow this artifact to
occur, and it must be handled in some way, since Zeno behaviors have to be
excluded from consideration: they are considered to be unimplementable.
Zeno-ness is a variant of infinite activity [NS92]: This is a property of a
system behavior in which in some bounded interval of real time an infinite
number of discrete transitions takes place. In approaches to the description
of real-time systems based on functions from R to some state domain, the
problem underlying the Zeno-ness phenomenon occurs in this guise.
3.2 Interval Sequences and Subclasses of Hybrid Systems 17
A side note: The concept of infinite activity is not the only sensible way to
formalize the intuition that systems which try to do too much in too short
time are not implementable. A perhaps better formalization of the idea is
the more restrictive concept of unbounded activity [NS92]. As an example,
consider a system in which in each time interval from n to n+1 (for n ∈ N),
exactly n discrete events take place. Such a system is not Zeno (since in each
finite interval, only a finite number of discrete events take place; specifically,
the number of events in an interval which is bounded from above by n ∈ N
is smaller than n2 ); but it shows unbounded activity in the sense that for
each bound n ∈ N, there is an interval of length 1 so that more than n
discrete events take place in that interval (for example take the interval
from n + 1 to n + 2). While this system is not Zeno, it can nevertheless not
be considered implementable; thus, boundedness of activity seems to be a
more appropriate abstract concept of implementability of a system with
respect to the amount of activity in finite intervals of time.
The fact that point intervals are allowed means that instantaneous transitions
from some state just entered can be modelled. This abstraction is very com-
mon for synchronous programming languages (e.g., [BdS91, BG92, Hal93]).
Systems modelled in interval sequence time are often modelled as tran-
sition systems with two types of transitions: There are discrete transitions
which take no time, and there are time transitions which might take time.
We will describe in Sect. 6.1.1 a variant of this approach.
Hybrid system behaviors are described by associating a state from A with
each element of each interval. Depending on the type of hybrid system, the
kind of change during the intervals is somehow restricted. The different kinds
of restrictions typically distinguish between discretely changing system
components which can only be changed in discrete transitions and keep their
value during intervals, and (possibly) continuously changing system com-
ponents, which can change both in discrete transitions and during intervals.
Typical restrictions for the changes during the intervals are the following:
– The only system quantity allowed to change continuously might be the
time (which we denote by the symbol now). Abadi and Lamport [AL92]
call this restriction convenient, perhaps because it fixes the values of all
quantities for each interval element.
– Another approach is to allow any number of (continuously changing) clocks,
all of them running with the same speed (equal to 1) all the time, but which
might be reset from time to time. This is the idea used for timed automata
[AD94]. All other quantities are discrete.
– A third approach is to associate a speed with each continuously chang-
ing quantity, where the quantities representing the speed only change dis-
cretely. Sometimes these systems are called “linear”, but we prefer to call
them PCD systems (for piecewise constant derivative). The formalism on
which HyTech [HHWT95] is based uses this approach. Because of the lin-
earity of all continuously changing quantities, the values at the interval end
points suffice to represent the values at all intermediate points.
– A fourth approach describes the system development during interval time
spans very generally by “trajectories” [Zei76, Chap. 9] [LSVW96] [Lyn96,
Chap. 23]. These trajectories have to obey some general conditions like
additivity (a trajectory leading to some state and a trajectory leaving from
the same state can be concatenated to another trajectory with a length
which is the sum of the lengths of the components) or time determinacy
(the state assumed by the system at a point inside an interval is completely
determined by the start state of the interval and the time span which has
been spent since the start state of the interval), but apart from this they can
be chosen quite freely. Not even continuity is required when this approach
is used.
All these variants have in common that the changes during time intervals do
not count as “activity” in the sense of finite or infinite activity in bounded
time intervals. For this, only the discrete transitions are relevant. System
3.3 The Main Idea: Use of Infinitesimals 19
changes which are represented in intervals are meant to describe what can
change just by the flow of time, needing no extra “system activity”.
The interval-sequence approach to modelling hybrid systems of different
kinds is quite flexible, but it also has some drawbacks:
– A fairly complicated, non-uniform model of time is used.
It would be nice to have a uniform model of time also for the description
of hybrid systems.
– Discrete transitions take no time at all. This contrafactual assumption is a
helpful abstraction in some situations, employed successfully in the appli-
cation of synchronous languages; but it leads to problems with causality in
the definition of such languages (see [HG92] for an analysis of the general
problem, and consider the different attempts to get at a satisfying seman-
tics for ESTEREL [BG92, Ber99] or for StateCharts [Har87, vdB94]).
It would be nice to have a model of time which can express both causality
and instantaneity of transitions in an intuitive way.
– Composition of independently developed deterministic systems is a prob-
lem: If in two such systems a discrete transition takes place at the same
real-numbered moment, we do not know which takes place before the other,
if they take place synchronously, or if there is just some partial overlap be-
tween the transitions. This is because transitions belonging to the same
moment are only in a relative order if they belong to the same system
behavior. A typical way to deal with this is by using nondeterminism to
express the missing knowledge about the relative orders of the transitions.
For deterministic systems, this artifact might be inconvenient.
It would be nice to be able to use, if needed, an absolute ordering for
discrete transitions taking place at the same point in real time.
The last three points mentioned three goals to be fulfilled by our model
of time, which will be a discrete model. In addition, we want to avoid the
problems of common discrete models of time mentioned earlier. We will reach
our goals by using infinitesimals.
time model can approximate behaviors defined in the reals with infinitesimal
exactness and allows action refinement. Also phases of continuous change can
be described with step-by-step actions of some underlying discrete formalism,
which makes a simple induction principle possible for proving invariants.
The main motivation to investigate the use of infinitesimals as the base
of the time domain is concisely given in the preface of [ACH97]:
The nonstandard framework allows many informal ideas (that could loosely
be described as idealization) to be made precise and tractable. For example,
the real line can (in this framework) be treated simultaneously as both a
continuum and a discrete set of points; and a similar dual approach can be
used to link the notions infinite and finite, rough and smooth.
Our initial hope was to be able to use well-established discrete techniques for
analysis of discrete systems in order to understand systems with continuously
changing components. During the investigation, another concept arose as
important: Time as multiples of an infinitesimal allows us to investigate the
problems of the discretization of a solution based on the abstraction of zero-
time discrete steps independently from the question of a minimal step width.
The concept of well-behavedness as defined and investigated in later chapters
is the formalization of this idea.
One technical problem of the interval-sequence approach is that discrete
transitions lead to several states being associated with the same point in “real”
time. There are temporal logics which are based on the idea that at most one
state is associated with each point in time. Gargantini et al. [GMM99] use
such a logic. The interval-sequence approach contradicts the intuition that
a system development can be adequately described by a function from a
time domain to a state domain (of course, this could be repaired by a more
complicated time domain, e.g., using R × N, which is unattractive because
of other reasons). Gargantini et al. use, for system specification, a temporal
logic which uses the temporal operator DIST(P ,t) for a predicate P and a real
number t; if interpreted at a time x of a system development, this operator
expresses that at time x + t the predicate P holds. This operator is obviously
best suited to models of system behaviors in which at most one state is as-
sociated with each moment of time. For interval-sequence models of system
behaviors this is not the case, which makes the use of the operator difficult.
Gargantini et al. propose to use a time model based on infinitesimals for solv-
ing the problem. A zero-time transition of the interval-sequence approach is
replaced by an infinitesimal-time transition which takes strictly positive time.
Gargantini et al. claim that this approach allows a simpler axiomatization
than the zero-time approach; the reason is that a system behavior associates
at most one state with an element of the set used for representing time. The
main idea explored in the current work is based on the same reasoning.
Note that it might seem inconvenient for some applications that the time
step width is fixed1 . We discuss this question in Chap. 12.
1
This was pointed out by Dino Mandrioli in a personal communication.
3.3 The Main Idea: Use of Infinitesimals 21
3.4 Summary
Infinitesimals, i.e., numbers which are in some respect like zero and in some
other respect unlike zero, have been used in mathematics since the beginning
of the calculus. Robinson [Rob96] gives an overview of the use of infinitesi-
mals in the history of the calculus: Leibniz uses infinitely small numbers in
the development of the calculus without admitting their existence; he consid-
ers them to be useful fictions. De l’Hospital seemed to believe in the existence
of infinitesimals, and he formulated Leibniz’ principles in a way which made
the main inconsistency stand out – that infinitesimal quantities are some-
times treated as being equal to zero, and sometimes as being not equal to
zero. At the end of the 18th century, the inconsistency led to different ap-
proaches to avoid infinitesimals: Lagrange tries to base the calculus on Taylor
expansions, and D’Alembert uses the concept of limit, an idea already used by
Newton, and related to the Method of Exhaustion, attributed to Archimedes.
D’Alembert seems to have made the approach popular on the continent. At
the beginning of the 19th century Cauchy, the founder of modern analy-
sis, strangely enough reverts again to infinitesimals (in some sense, by using
variables “tending to zero”), e.g., in the definition of continuity where he
says that a function is continuous for some argument value if changing the
argument value infinitesimally, the function value also only changes infinitesi-
mally. Starting with Weierstrass’ approach to analysis, talking of infinitesimal
quantities was just considered a shorthand description for an -δ-definition
or argument. At the end of the 19th century, different approaches for deal-
ing with the infinite were developed. Cantor’s set theory was developed in
that time, as was du Bois-Reymond’s theory of orders of magnitudes. In the
20th century, Skolem represented infinitely large natural numbers by func-
tions tending to infinity; nevertheless, neither Cantor nor Fraenkel believed
in the possibility of basing analysis on infinitesimal quantities.
So basically, the properties of infinitesimals could not be made precise for
nearly 300 years and their use led to contradictions. In the 1950s, the logician
Abraham Robinson used model-theoretic means to develop a non-standard
model of analysis [Rob96]. The existence of non-standard models of arith-
metic had already been shown by Skolem in the 1930s [Sko34], and Robinson
built on Skolem’s ideas for the real numbers. Robinson’s approach was to
extend the field of real numbers in a similar way as the real numbers can
(∀st fin
z ∃x ∀(y ∈ z) B(x, y)) ↔ (∃x ∀st y B(x, y))
The x on the right hand side is the “ideal” object the existence of which is
asserted. This is typically a non-standard object.
Let B(x, y) ⇔def x, y ∈ R+ ∧ x < y. Since for any finite set of positive real
numbers, there is a positive real number smaller than all of them (just take
half of the minimal element of the set), the axiom of idealization guarantees
the existence of positive real numbers strictly smaller than all standard pos-
itive real numbers. In a similar way, it can be proved that there are natural
numbers larger than all standard natural numbers. Another consequence of
4.2 The Axiom of Standardization 25
the axiom is that for a set X, every element of X is standard if and only if X
is a standard finite set, and by contraposition, that any infinite set contains
non-standard elements.
What needs most adaptation from the side of the user of IST is that the new
predicate “st” and derived predicates are not necessarily set-forming. This
means that the standard elements of some set do not necessarily form a set.
For example, there is no set containing exactly the standard natural numbers,
and there is no set containing exactly the non-standard reals. The axiom of
standardization defines how subsets can nevertheless be formed using non-
classical predicates.
Let C(z) be a predicate (classical or not) containing the free variable z
(and possibly others). Then:
The axiom of transfer is used to describe the idea that whatever holds for all
standard objects, holds for all objects.
Let A(x, t1 , . . . , tk ) be a classical formula with free variables x, t1 , . . . , tk ,
and no other free variables. Then:
if its value can be computed for each input argument in a finite number of
effective steps. Since the finite natural numbers also include unlimited ones,
this formalization might not be adequate in the non-standard framework.
The formal notion corresponding best to the intuition of effectivity is to
replace “finite” by “standard finite”, which is for natural numbers equivalent
to “limited”.
Let us be more specific. For a standard Turing machine with a standard
input, there exists a finite number n ∈ N0 so that after n steps, we can decide
if the Turing machine will ever halt: Just take an unlimited n. If the Turing
machine did not halt in the first n steps, it did not halt for any standard
number of steps, and since the Turing machine and its input are standard,
we can apply the transfer principle: If a standard Turing machine with a
standard input does not halt after any standard number of steps, it will not
halt at all. Thus, it can be decided in a finite number of steps if a standard
Turing machine with a standard input halts – but this can not be decided in
a limited number of steps.
Another important fact of IST is that each limited real number x is in
infinitesimal distance from some unique standard real number:
Proposition 4.4.1. Let x be a limited real number. Then there is a unique
standard real number, which we denote by o x, with x o x.
o
x is called the standard part or the shadow of x. Many theorems of non-
standard analysis are formulated in terms of the standard part of a limited
number. The operation of taking the standard part can be understood as an
abstraction operation on limited real numbers: using this abstraction means
ignoring infinitesimal distances between limited real numbers.
Note that o , as introduced above, is not a function, since its domain and
range are not sets. But for limited x, the standard set S {y ∈ R | y ≤ x} can be
formed by standardization, all elements are limited (all standard elements
are real numbers not greater than x, and, thus by transfer, all elements are
real numbers not greater than x), and, thus, has a supremum, which allows
us to define:
o
x =def supS {y ∈ R | y ≤ x}
Since in the formalism of non-standard analysis, not all predicates are set-
forming, we can not use the term “set” for the collection of elements for which
some predicate is fulfilled. If some term is needed, we call such a collection
a “class”; for example, we can talk about the class of standard real numbers.
Sometimes, it is convenient to use predicate symbols from set-theory also with
a class C. In this case, this means the corresponding predicate; for example,
if C is the class of standard real numbers and C is a class corresponding
to some other predicate, x ∈ C means that x is a standard real number,
and C → C means that being a standard real number implies fulfilling the
predicate of C .
28 4. Infinitesimals
4.6 Summary
This chapter gives a very short historical overview of the use of infinitesimals
in mathematics. We present Nelson’s approach of conservatively extending
ZFC, discussing the three axiom schemes proposed by him. Then we describe
that this theory allows us to discern additional structure in R, most impor-
tantly infinitesimal, limited/unlimited and appreciable numbers, and finally,
we describe some important properties of our model of time.
5. Operational Semantics of Discrete Systems
Different approaches exist for the description of discrete concurrent and reac-
tive systems. Often used examples are automata models (including hierarchi-
cal and parallel automata like Harel’s StateCharts [Har87]), formalisms for
the description of concurrent and reactive systems (including Lamport’s Tem-
poral Logic of Actions [Lam94a, Lam94b] or Manna and Pnueli’s Fair Transi-
tion Systems [MP92, MP95]), different versions of Petri nets [Rei86], or even
models used in theoretical computer science like Turing machines [Tur37].
We use abstract state machines (ASMs) [Gur88, Gur93, Gur95a, Gur97].
Abstract state machines are proposed as a formalism for operationally de-
scribing sequential discrete algorithms on any abstraction level [Gur99]. The
latter means that one intuitive step of the modelled algorithm corresponds
to one step of the formal algorithm. This is typically not possible in the
common models for effective computation used in theoretical computer sci-
ence like Turing machines or register machines, since in these models, inputs,
system state and output of the algorithms must be encoded with very basic
means, and the single steps which are allowed by these models are also of a
very simple kind. Thus, in these models, algorithms can only be encoded on
a quite low abstraction level. This means that these models are not adequate
for high-level modelling of algorithms. Abstract state machines are meant as
a remedy for this, as a model of computation which is both simple enough
to be attractive for being used in theoretical computer science, and powerful
enough to be used for modelling realistic systems and algorithms. In this way,
they are hoped to help bridge the gap between theoretical computer science
and more practice oriented branches of the discipline.
A system is defined by giving, for each state, the set of actions possible
in that state:
Definition 5.1.2. A (nondeterministic) action system is defined as a
function in A → P(A), i.e., a function which, for each state, defines a set of
actions which the system can perform in that state.
Consider an action system f . Note that we allow that f (q) might be empty.
This formalizes that the system f can not perform a step from state q. If
f (q) = {υ}, this formalizes that f can only perform the vacuous action in
state q, which represents a step which does not change anything.
A linear system behavior is defined by a start state and a sequence of
actions, which might be generated by an action system.
Definition 5.1.3. A start state q ∈ A and a sequence of actions a ∈ A
defines a sequence of states q ∈ A in which q(0) = q and q(i + 1) = q(i)[a(i)]
for i ∈ dom a. A run of an action system f : A → P(A) from some state q
is a sequence of actions a so that in the associated sequence of states q with
start state q, a(i) ∈ f (q(i)) for all i ∈ dom a.
The concept of an action system is different from the more often used
transition system. A transition system is a subset of A × A describing the
possible state transitions of the system. The action system represents explic-
itly, for each state change in which some locations do not change their value,
if this is just because there was no update for the location performed, or
because the value written into the location was just identical to the value in
the location before the transition. This additional information is needed for
the definition of parallel composition.
An action system f defines, in a canonical way, an associated transition
system {(q, q ) ∈ A × A | ∃(a ∈ f (q)) : q = q[a]}. Similarly, it defines in
a canonical way an associated labeled transition system, i.e., a transition
system in which each transition is an element of A × A × A, by {(q, a, q ) | a ∈
f (q) ∧ q = q[a]}. When we talk about an action system and then about a
transition system or a labeled transition system, these are the mathematical
structures derived from the action system.
A state q is said to be reachable from a state q, or, equivalently, a state q
is said to reach a state q in a given transition system, if there is a sequence
of transitions in the system which leads from q finally to q . Via the canonical
transition system, the concept of reachability can also be applied to action
systems.
Now we are prepared to describe the specific formalism we use for the
definition of action systems.
assignment and a state. We call such a function an extended state and will
denote individual extended states typically by p, q or decorated versions of
these letters.
5.2.2 Terms
for the Boolean functions AND and OR, which are often translated to ∧ and ∨.
E.g., the following notation denotes the term AND(t1,AND(t2,OR(t3,t4))):
∧ t1
∧ t2
∧ ∨ t3
∨ t4
Vertical alignment of partial terms at the same level and indentation makes
it clear how such a term is to be interpreted.
5.2.3 Rules
[[r]]d (q) = tt
[[r]](q) = {{}}
5.2 Abstract State Machines 37
– Let r be HALT. This rule can be used to signal an error condition, if executed.
It is always defined, and a computation stops if this is the only applicable
rule.
[[r]]d (q) = tt
[[r]](q) = {}
– Let r be s(t1 , . . . , tsa ) := t, where s ∈ S and t,t1 ,. . . ,tsa are terms over
the extended vocabulary S ∪ V. This represents an assignment, i.e., there is
just one action with just one update in which the location denoted by the
left-hand side gets the value denoted by the right-hand side. All terms are
evaluated in the current extended state.
[[r]]d (q) = tt
[[r]]d (q) = q(t) ∈ {tt, ff} ∧ (q(t) ? [[r1 ]]d (q) : [[r2 ]]d (q))
[[r]]d (q) =
∧ [[r1 ]]d (q)
∧ [[r2 ]]d (q)
∧ ∀(a1 ∈ [[r1 ]](q), a2 ∈ [[r2 ]](q)) : loc(a1 ) ∩ loc(a2 ) = {}
[[r]]d (q) =
∧ ∀(u ∈ U) : q[x → u](t) ∈ {tt, ff}
∧ ∀(u : q[x → u](t)) : [[r1 ]]d (q[x
→ u])
∧ ∀(u,: u : q[x
→ u](t) ∧ q[x → u ](t))
u = u → loc(q[x → u ]) = {}
→ u]) ∩ loc(q[x
[[r]](q) = { →u](t)
u:q[x au | au ∈ [[r1 ]](q[x
→ u])}
Note that a step of the FORALL-rule is not necessarily effective, even if for
each allowed value of the variable x which fulfills t, r1 is effective, since (1)
there might be an infinite number of values for x which make t true, or (2)
the set of values for x which fulfill t might be not effectively computable. In
Sect. 5.3, we will define a variant of this rule which avoids these problems.
– Let r be CHOOSE x : t IN r1 , where x is a variable, t is a term evaluating
to a Boolean for all values of x, and r1 is a rule. This denotes the nonde-
terministic choice between the instances of r1 for values of x such that t is
true, and such that r1 is enabled for this value of x.
[[r]]d (q) =
∧ ∀(u ∈ U) : q[x
→ u](t) ∈ {tt, ff}
∧ ∀(u : q[x
→ u](t)) : [[r1 ]]d (q[x
→ u])
[[r]](q) = →u](t)
u:q[x [[r1 ]](q[x
→ u])
5.3 Effectivity
Gurevich’s basic definition of sequential ASMs [Gur99] does not include HALT,
the nondeterministic rules and the FORALL rule. We allow them here, but
we note that for the CHOOSE rule and for the FORALL rule, our definition
in this generality deviates from the goal of describing just effective steps,
since in order to determine for which values of the variable the predicate
is true, typically an infinite amount of work is necessary (all values in U
have to be checked for the variable), and an infinite number of locations
might be changed in a FORALL step. Gurevich proves that his set of rules and
rule schemes (which Börger calls ‘basic ASMs’ [BS03]) suffices to describe
sequential algorithms (by assuming some plausible formalization for “bounded
work”).
We will use a special notation which combines the convenience of the no-
tation of FORALL and CHOOSE rules with effectiveness. We assume that the
vocabulary S contains a subset of unary predicate symbols F which are inter-
preted as finite sets which are given in an effective manner (those elements
u ∈ U are assumed to belong to the set described by F ∈ F in an extended
state q for which q((F, (u))) = tt). We call the interpretations of elements
40 5. Operational Semantics of Discrete Systems
in the vocabulary, and that for two compatible vocabularies, the properties
are the same for symbols occurring in both.
– Symbols can be classified as static. These denote functions whose locations
are not intended to be updated during a run. The latter makes it possible
to use a static symbol slightly incorrectly to denote also its interpretation.
There are other plausible reasons for defining a symbol as static in an ASM.
One is that its interpretation must not change, which would allow trivial
updates to locations of the symbol. Another is to call all symbols static
which do not change their value (or are not updated) in any run of a given
system, i.e., to define the concept semantically. We choose to call a symbol
static if it is denoted by the designer as such, which allows design errors to
be detected.
– Symbols can be classified as dynamic. These are symbols which may oc-
cur as the head of terms on the left-hand side of assignments, and they
represent dynamically changing components of the modelled system.
– Finally, symbols can be classified as derived. Derived symbols are inter-
preted as functions whose values can be computed from the static and
dynamic functions in the system. Thus, their interpretations do not need
to be represented explicitly in the system – they can be derived from the
state.
The meaning of a derived n-ary symbol s is defined by a term t with at most
n free variables, where each argument position i ∈ {1, . . . , n} is associated
with a variable symbol vi .
When the value of a term function s(t1 , . . . , tn ) with a derived n-ary symbol
s is to be determined, the values of the ti are determined and an extended
state is used for the evaluation of t which maps each vi to the value of ti .
We define syntactically a directed dependency graph between derived sym-
bols by saying that there is an edge between s and s if s = s and s occurs
in the defining term of s. We require that there are no infinite paths in this
graph, which excludes indirect recursion.
Direct recursion is allowed, but only if it is well-defined. We require that
when s(t1 , . . . , tn ) is a direct recursive occurrence in the definition of the
value s(v1 , . . . , vn ) (where v1 , . . . , vn denotes the variables used as formal
parameters in the definition of the derived symbol s), there is a well-ordered
domain O and a function f : Un → O so that ∀v1 ,...,vn (P → f (t1 , . . . , tn ) <
f (v1 , . . . , vn )) is a tautology, where P expresses the conditions for the re-
cursive invocation (we stole this approach to ensuring well-definedness of
function declarations from the proof support system PVS [ORSvH95]).
Derived symbols can not be written to, but they change their value when
a dynamic symbol occurring directly or indirectly in the defining term of
the symbol changes its value. The definition of the semantics of rules only
encodes the effects of updates on dynamic symbols. The change of the
meaning of a derived symbol is implicit.
42 5. Operational Semantics of Discrete Systems
But there are also features of algorithms which are implicit in some descrip-
tions and must be made explicit when abstract state machines are used. Ex-
amples are features of common programming languages, like the control state,
which is implicit, for example, in while-languages; or recursion; or different
visibility ranges of variables, etc. ASM rules provide only very basic means
to describe algorithms, e.g., for control structures. More complicated features
of common programming language must be encoded. Let us investigate two
of these features a bit more:
– Non-determinism is explicit by systems described by ASM. Only openness
(which might allow a non-deterministic environment) or an occurrence of
a CHOOSE or OR rule can make a system non-deterministic. Thus, implicit
non-determinism of other formalisms must somehow be coded explicitly
when an ASM model of the system is described.
– All state-components of the system must represented explicitly, i.e., must
be assigned to some locations. Typical state elements which are implicit in
other formalisms are the control state (which is one or a set of positions in
a program text), and elements like timers in real-time languages which are
44 5. Operational Semantics of Discrete Systems
used to determine minimal and maximal waiting times. Note that it is very
convenient not to be forced to think about a name for each configuration
a system might be in – but in order to reason about the dynamic system
behavior, one typically has to introduce some naming scheme for the control
locations or sets of control locations of a program described with implicit
control flow (see [MP92] for an example).
5.6.2 Operationality
Another type of restriction of the ASM model is that ASMs describe systems
operationally rather than declaratively. This is, for example, in contrast to
temporal logic with which a system can be described at a higher abstrac-
tion level. For example, a system might be described by requiring that every
possible run fulfill the formula 2(x = 0 → 3x = 1) of linear temporal
logic (meaning that every state in which x = 0 holds is followed by some
state in which x = 1 holds). This kind of declarative system characteriza-
tion is at a too high level of abstraction for ASMs, since ASMs can relate
only states of system behaviors in which one state is the direct follower of
the other. Tableau-based approaches exist for encoding the semantics of a
formula of some temporal logic by a characteristic automaton, i.e., somehow
operationally, but this expression of temporal formula as automata is exactly
the kind of low-level encoding which is to be avoided if systems are to be
described at their natural abstraction level.
Note that this observation does not contradict Gurevich’s claim. Algo-
rithms are supposed to perform their task step by step, i.e., operationally.
From the claim that a formalism is expressive enough for modelling algo-
rithms on any abstraction level, it does not follow that it must be expressive
enough to model also declarative specifications of properties of algorithms
concept-by-concept. Note that the original ASM approach allows some“cheat-
ing” by (1) modelling the system as an open system, (2) assigning a subtask
which is not easily described operationally to the environment, and (3) spec-
ifying the environment declaratively.
To highlight the reasons for choosing ASMs as the basic discrete formalism
on which we base our approach to modelling real-time systems, we describe
some features which distinguish it from other possible choices:
1
Personal communication.
48 5. Operational Semantics of Discrete Systems
5.8 Summary
This chapter details the reasons for using a variant of ASMs as the base
formalism for our approach. We introduce the concept of “action system” as
a semantical basis for ASMs. Our introduction of ASM term and ASM rule
syntax is rather standard; semantically, we use a variant from the standard
by disallowing concurrent updates of a location in a step if they update to
the same value, and by interpreting a CHOOSE rule with a false range for
the variable as deadlock. Environment interaction in our variant of ASMs
is defined so abstractly that refinement is made easy, but synchronisation
has to be made explicit. In the discussion of Gurevich’s thesis, we deal with
possible misunderstandings which the claim to coding-freedom of expressions
of algorithms as ASMs might induce. Finally, the basic ideas used in ASMs
are compared to decisions taken in other formalisms, and, where possible,
reasons are given why we follow the ASM approach.
6. Defining Hybrid Systems with ASMs
We will define hybrid systems using the most important ideas from ASMs.
First we define a classical approach to modelling hybrid systems, and then
we define a novel, non-standard approach of modelling hybrid systems.
[[R]] and [[R]]h differ only with respect to updates of now. Since in R, now is
not updated, there occur no updates of now in actions of [[R]](q), which means
that the updates we add can not lead to inconsistencies. In [[R]]h , we make
explicit that in discrete steps, now does not change its value, and that there
are additional time actions in which only now changes its value. These time
steps can be as long as [[R]] admits the vacuous action; they may lead into
states in which [[R]] does not admit the vacuous action.
Note that we never allow zero-time time transitions, since l must be
strictly positive. Note also that a discrete transition is assumed to take no
time, since now can not be changed during a discrete transition. Note also
that the only dynamical symbol of the vocabulary which changes during a
time transition is now. This means that other continuously changing quan-
tities must be modelled differently. For this, derived symbols involving the
symbol now directly or indirectly will be used. We will call now and the de-
rived symbols using now directly or indirectly in their definition continuous
symbols, since their values are the only ones which can change in the course
of a time transition.
The time transitions fulfill some conditions sometimes required from time
transitions of hybrid systems [LSVW96]:
Proposition 6.1.1. (1) A transition system defined by an STASM rule R is
forward and backward time deterministic, i.e., if p reaches q and q by time
transitions of the same length, then q = q , and if p and p both reach q by
time transitions of the same length, then p = p .
(2) The time transitions defined by an STASM rule R are closed under
concatenation, i.e., if p0 reaches p1 by a time transition and p1 reaches p2 by
a time transition, then p0 reaches p2 by a time transition.
Both facts follow directly from the definition.
An STASM rule R and an associated vocabulary S define a set of interval
sequences in the obvious way. In the start state, now has the value 0. To points
in time x between the end points of a continuous transition, we assign the
state q[now
→ x]. True system activity is only assumed to take place during
discrete transitions.
6.1 ASMs for the Definition of Classical Hybrid Systems 51
Above, we described a rule which counts the maxima of the sine function.
The similarly looking rule IF s=1 THEN count:=count+1 ELSE SKIP, which
might look like a counter for moments at which s equals 1, leads to a system
which up to time 1 can only let time pass and then, time can not increase any
longer, since discrete actions take no time in our model, which means that
after s has become equal to 1 for the first time, the discrete incrementation
step is performed again and again, and time can not flow on. This is a variant
of infinite activity, since there is a finite span of time, specifically: each finite
interval containing time 1, in which this system shows an infinite amount of
52 6. Defining Hybrid Systems with ASMs
activity. This problem can occur in models in which discrete steps take no
time and in which steps might be urgent, i.e., in which discrete steps might
imply that they be taken before any time passes.
The approach of using a constant infinitesimal step width for the descrip-
tion of real-time systems based on a discrete formalism can be used in the
ASM framework very easily by requiring that there is a static nullary sym-
6.2 ASMs with Infinitesimal Step Width 53
is real. For the first, the dissolution of the artifact sounds better than it is,
since NTASM systems might show a similar artifact: unlimited activity in
limited intervals of time. We discuss this in a bit more detail.
At the end of Sect. 3.1 on dense and discrete time domains we mentioned
the artifact of Zeno-ness (discussed by Abadi and Lamport [AL92]) which
occurs in some declarative formalisms based on dense models of time. Zeno
behaviors do not exist in NTASMs. But a problem very similar to Zeno-ness
can occur in NTASMs: A modelled system might show unlimited activity in
limited intervals of time. This is typically not admitted as result of an ade-
quate abstraction from a real system, in contrast to the abstraction to model
very short reaction times of the system by infinitesimals. The occurrence of
unlimited activity in a limited time interval can be a hint to a modelling
error, but it can also be understood as an artifact of the formalism, and can
lead to the same problems which Abadi and Lamport identify for Zeno-ness:
– It might make a proof system based on this semantics incomplete in spite
of the fact that only non-realistic runs of a modelled system do not fulfill
the property to be proved.
– It might make a system description or a specification inconsistent in the
sense that it only admits behaviors showing unlimited activity.
This would have the consequence that specifications which avoid the first
problem by simply using a limited-activity-requirement into the antecedent
are just vacuously true.
Thus, it can be expected that the check that an NTASM admits system be-
haviors with limited activity is part of the verification task for many systems.
In interleaving-based concurrent systems, a similar problem is being dealt
with by fairness constraints: They are used to express which system behaviors
can be considered as so unrealistic that they should be excluded from consid-
eration. The temporal logics typically used for the specification of properties
of interleaving systems are capable of expressing fairness constraints, so that
this artifact can be dealt with explicitly in the specification. In Chap. 7 we
develop a notation for a temporal logic which allows us to express that in
limited intervals of time, only limited activity occurs.
0 if u = u
d(u, u ) = 1 otherwise if u ∈ R ∨ u ∈ R
min(1, |u − u |) otherwise
For two pairs of a location and a value (, u) and ( , u ) of the ASM, d is
defined by
1 if =
d((, u), ( , u )) =
d(u, u ) otherwise
For two actions a and a of the ASM, d(a, a ) is defined by
IF now-lastEventTime = 1
THEN || clock := clock+1
|| lastEventTime := now
ELSE SKIP
from q which together mimic the time step of [[R]]h from q infinitesimally.
A (standard) induction on the number of discrete steps of [[R]]h completes
the proof.
Unfortunately, continuity in all locations is far too strong a requirement to
be helpful in practice. For example, we can not model a discrete clock counting
the time units with the rule in Fig. 6.2, where we assume that we start with
60 6. Defining Hybrid Systems with ASMs
IF now-lastEventTime >= 1
THEN || clock := clock+1
|| lastEventTime := now
ELSE SKIP
Proof. Let us call the discrete clock rule R, and let us use the name R for
R||now := now + dt.
A system behavior of [[R]]h has alternating phases: at integer times n > 0,
the rule must do a discrete step updating clock and lastEventTime to n;
and between integer times, it can only let time pass. More precisely: Let a
be a run of [[R]]h from a start state. For all n ∈ N, the nth discrete action
in a, if it exists, updates both clock and lastEventTime to n, and the time
steps before the first and between these discrete action sum up to length 1,
and the time steps after the last discrete action, if they exist, sum up to a
length ≤ 1.
Let us now consider the runs of [[R ]]. Only time can pass up to the point
in time which is the first multiple of dt which is ≥ 1. Let us call this time
1 + δ, where δ is a non-negative infinitesimal smaller that dt. At that time,
clock is set to 1 and lastEventTime is set to 1 + δ. Then, it again takes
1 + δ − dt time units until the next discrete step is taken, when clock is set
to 2 and lastEventTime is set to 2 + 2δ. An induction shows that the nth
discrete step starts from a state at time n + nδ, and it sets clock to n and
lastEventTime to n + nδ.
Obviously, for standard n ∈ N, the nth discrete steps of the two systems
take place in infinitesimally distanced states and are infinitesimally distanced
(limited n implies infinitesimal nδ). Each standard time step of the standard
system of length l can obviously be mimicked infinitesimally by a sequence of
dt
l
steps of the non-standard system, or by a sequence of dt-steps leading
up to the next discrete step, for the standard time steps preceding discrete
steps.
6.4 Well-Behaved Rules 61
IF now-clock >= 1
THEN clock := clock+1
ELSE SKIP
6.5 Summary
This chapter introduces a way to use ASMs to define classical timed sys-
tems based on an interval-sequence model of time (the STASM model). This
is done in order to have a reference for comparison with the infinitesimal-
step-width based approach. We encode the flow of time in the rule, not by
an extra formalism. This makes it necessary to discuss some artifacts of the
chosen formalization: infinite activity and hesitation. Then we introduce an
ASM-based way to define timed system for the infinitesimal-step-width model
of time (the NTASM model), we discuss syntactical restrictions for the rule
defining the algorithm and describe the tasks of the timing rule Rtime . We
describe in which guise the (classical) Zeno-ness artifact appears in our for-
malism. Finally, we compare the STASM and the NTASM interpretations of
the same algorithm, given by an ASM rule, by defining simulation and well-
behavedness: The fact that the effects of infinitesimal discretization of time
does not hurt is formalized by the concept of (strong) well-behavedness of an
ASM rule, which is formalized by the fact that the NTASM interpretation
can simulate each behavior of the STASM interpretation.
7. A Notation for a Temporal Logic
If Gurevich’s thesis is valid, ASMs can be used to model any sequential algo-
rithm on any abstraction level. But algorithms are defined in an operational
way, and they operate step by step. Often, a higher abstraction level than
this is wanted for describing properties of systems. Temporal logics of dif-
ferent kinds are proposed for this in computer science (see [Pnu77] for the
introduction of the concept into computer science, and [MP92, Lam94b] for
several well-developed approaches).
A well worked-out temporal logic consists of three components. One is a
concise notation for the specification of important temporal system proper-
ties. Normally the semantics of this notation is presented as a set of operator
definitions, reducing formulas of the logic to formulas of some first-order logic.
A second component is a proof system, i.e., a collection of axioms and proof
rules which allows the derivation of the validity of a formula without recur-
rence to the semantic definitions of the operators of the logic. And a third
component are proof techniques and heuristics for using the proof system.
This chapter will not present a logic in this sense; we will only describe a
concise specification notation for important system properties.
When a system is specified with a temporal logic, this is by using a formula
for characterizing a set of system behaviors. Behaviors are typically modelled
as functions from a time domain T to a domain of states A. States are often
modelled as assignments from a fixed set of locations, often formalized by
a finite set of symbols, into a fixed universe. As time domains, linear and
tree-like domains are most popular, where trees represent nondeterminism
more directly and in more detail. Both dense and discrete domains are used.
As already discussed in Chap. 3, we use a discrete model of linear time.
The operators of a temporal logic are typically defined by a first-order
predicate logic to be interpreted in positions of runs of the systems to be
specified. The reasons why they are used instead of their definitions are the
reasons why definitions are typically introduced elsewhere in mathematics:
(1) Using these operators, specifications can be written in a shorter form, and
(2) they make important concepts explicit by using a specialized notation for
them.
The conciseness of temporal logic notations results from the fact that the
defined operators allow references to points in time and the most important
relations between them to be made implicit. The approaches of Manna and
Heinrich Rust: LNCS 3456, pp. 63–72, 2005.
c Springer-Verlag Berlin Heidelberg 2005
64 7. A Notation for a Temporal Logic
Pnueli and of Lamport mentioned at the beginning of the chapter use logi-
cal formulas which are interpreted over positions in infinite state sequences,
i.e., the structure over which such a formula is interpreted is an element of
(N0 → A) × N0 .
We consider situations in which quantitative properties of the model of
time are important, and in which not only the states are relevant, but also
the updates resp. the actions which led into a state. It is convenient to use an
interval-based temporal logic for these situations, and to use an interpretation
context in which the sequence of actions connecting the states is explicit. In
[Mos85], an interval based logic for discrete time is defined; our operators are
more similar to the “Duration Calculus” of [CHR91] which is defined for a
dense model of time.
– Count terms are of the form #p, where p is a focused predicate (see
below).
– The two-argument Boolean chop operator p1 ; p2 takes two interval pred-
icates.
Disallowing dynamic symbols makes interpretation over the interval un-
ambiguous. Count terms are interpreted as the (natural) number of positions
in the interval under consideration which fulfill the formula p; as defined be-
low, focused predicates are interpreted over positions in state sequences. A
chop term is interpreted as true if and only if the interval under consideration
can be split into two subintervals so that p1 holds in the first and p2 holds in
the second. We define the semantics formally further down.
Definition 7.2.2. Focused predicates are interpreted over elements of
{(q, a, i) ∈ A × A × dom q}. They are extensions of state predicates of the un-
derlying ASM. We allow the following additional forms of terms in a focused
predicate:
– A bar term p1 ”|p2 is a predicate, where p1 and p2 are interval predicates.
If one of the interval predicates is just true, it can be dropped, yielding a
term of the form p| or |p.
– For a rule R without free variables, the rule predicates enabled(R),
hasChoice(R), taken(R), takenAlone(R) and takenVacuously(R) are fo-
cused predicates.
Focused predicates are defined at positions in state sequences. A bar term
is true at a position if just before that position, an interval ends which fulfills
p1 , and at that position, an intervals starts which fulfills p2 . The vertical bar
represents the position just in front of the focus. Rule predicates are true if
in the state and step defined by the position under consideration, the rule is
enabled, taken, etc.
The formal definition of the semantics of interval terms and focused terms
is the following:
Definition 7.2.3. The semantics [[t]](q,a,I) of an interval-term t is defined
inductively:
– If the top-level structure of the term is that of a first-order term without
dynamic symbols, just take the meaning of this term in q, applying the in-
terpretation function [[·]](q,a,I) to the components of the top-level structure.
– [[#p]](q,a,I) =def |{i ∈ I | [[p]](q,a,i) }|
– [[p1 ; p2 ]](q,a,I) ⇔def
∃(k ∈ I ∪ {min(I) − 1}) : [[p1 ]](q,a,{i∈I | i≤k}) ∧ [[p2 ]](q,a,{i∈I | i>k})
The semantics of focused terms [[t]](q,a,i) is defined for positions in state
sequences:
– State symbols s in a focused predicate are just interpreted by [[s]](q,a,i) =
[[s]]q(i) .
66 7. A Notation for a Temporal Logic
7.3 Abbreviations
We assume that we have the usual arithmetical predicate and function sym-
bols available in the static ASM vocabulary, with their usual interpretation.
– pWq ⇔def p ∨ (p; q; true), for interval predicates p and q: This is similar
to the “weak until” operator of classical temporal logic.
– 3p ⇔def (true; p; true), for an interval formula p: this expresses that in
the current interval, there is a subinterval fulfilling p.
– 2p ⇔def ¬3¬p for an interval formula p: this expresses that in the current
interval, all subintervals fulfill p.
– ◦p ⇔def ( = 1; p) for an interval formula p: this expresses that p is valid
starting with the second position of the current interval.
– takenNonvacuously(R) ⇔def taken(R) ∧ ¬ takenVacuously(R). This pred-
icate expresses that an R-step has taken place, and that this step was not
equivalent to a SKIP.
There are two rule predicates which are used to detect if a rule is taken in
some step: “taken” and “takenNonvacuously”. This deserves some comment.
Typically, “taken” is more helpful if the system to be described is modelled in
an interleaving fashion, since in that case, non-execution of a rule is typically
encoded by a HALT. In systems which are combined by synchronous execution,
non-execution of a rule is typically encoded by a SKIP, which is excluded from
consideration by “takenNonvacuously”.
In this work, we will not develop a calculus for our logical notation. We
will present some possible candidates for axioms, of which some match those
given in [CHR91] for the Duration Calculus. We will present them as seman-
tical propositions, to be proved by replacing the defined symbols by their
definitions.
Definition 7.4.1. We write |= P for an interval predicate or a focused pred-
icate P which is tautologically true, i.e., which holds in each model.
Proposition 7.4.1. Let P , Q be any focused predicates. Then:
|= #false = 0 (7.1)
|= #P ≥ 0 (7.2)
|= #(P ∨ Q) − #(P ∧ Q) = #P + #Q (7.3)
For all a, b ∈ N0 ,
Proposition 7.4.2.
limited( ∗ dt) ∧ ¬ limited(#P )
|= → (7.5)
∀st n ∈ N0 : 3(infinitesimal( ∗ dt) ∧ #P ≥ n)
Often, the time rule is just now:=now+dt, but in general, also dynamical
symbols different from now might be changed just by the flow of time. The
context will make it clear what kinds of changes are admitted in a pure time
step if the limited-activity specification is used.
The fairness definitions have wrong antecedents in finite intervals, i.e.,
they are only meaningful if interpreted over infinite intervals, as can be ex-
pected.
Other example specifications are:
– “A p-state is followed by a q-state between x and y time units.” Let p and
q be characterized by focused predicates:
[p]; {¬q}; [q] → dt ∗ > x
2 ∧
([p]; true) ∧ dt ∗ > y → ◦3[q]
2([cr] → limited())
– “After a new input has been provided, the computation of the correspond-
ing output only takes negligible time.” We use two focused predicates “in-
putProvided” and “outputReady” to characterize the respective states.
[inputProvided]; {¬outputReady}; [outputReady]
2 →
infinitesimal(dt ∗ )
|= enabled(R) → cr (7.11)
Assume that each phase of computing a reaction needs only a limited num-
ber of steps:
|= 2([cr] → limited()) (7.12)
Assume that any interval in which at least two reaction computations start
is longer than infinitesimal:
la(R) (7.14)
7.7 Accountability of a Step to Some Rule 71
Formula 7.13 contradicts the consequence, which means that the antecedent
is false, which is propositionally equivalent to
2(limited(#cr) → limited(taken(R)))
Proof. The second fact of Proposition 7.4.4, the first fact of Proposition 7.4.3
and formula 7.11 imply that there are at most as many states in which R is
taken as there are cr states. For natural numbers, if the larger one is limited,
so is the smaller one.
Now we can do the proof of Theorem 7.6.1:
Proof. Consider an arbitrary interval. The antecedent of la(R) is limited(dt∗).
Apply Lemmas 7.6.1, 7.6.2 and 7.6.3 in that order.
72 7. A Notation for a Temporal Logic
7.7 Summary
between the steps which expresses that if some step occurs in a system run,
other steps may not occur in that run (event structures, [Win88]). In this
work, we deal with quantitatively timed systems, which means that each
step will be assigned to a moment in real-numbered time. This implies that
the abstractions used for distributed concurrent systems are not adequate in
our context; thus, we will not go into the details of the models for distributed
systems.
For modelling concurrent rsp. reactive systems with a totally ordered
model of time, two main approaches can be found. One is the interleaving
approach, to be described in the rest of this chapter, and the other is the
synchronous approach, to be described in Chap. 9. We will describe the
two variants with their respective application areas, their strong points, their
weaknesses, and their expression in our model.
Note that a process might be nondeterministic even though all its transitions
are deterministic, because there might be states in which several transitions
with different allowed follower states might be enabled.
In an ASM model of a concurrent system in which each τ is in each state
either disabled or deterministic (which is a typical case), we can model each
τ by a rule of the following form:
IF <guard> THEN <parallelAssignments> ELSE HALT
<guard> is a term which evaluates to a Boolean. It determines if the statement
is enabled. <parallelAssignments> is a number of assignments which are
performed in parallel. We call rules of this form “guarded assignments”. They
are the ASM representation of the basic transition descriptions of Dijkstra’s
“guarded command” language [Dij75].
Now let us define what it means for a transition τ to be taken in a system
run.
Definition 8.1.2. Consider a run of a system, i.e., a function σ : N0 → A.
We say that τ is taken at position i ∈ N0 of σ if qi+1 ∈ τ (qi ).
Note that in general, several transitions might be considered to be taken at
some position i of σ, but in many applications it is typically unambiguous
which transition is taken for any position in a run.
Definition 8.1.3. In a run σ, a transition τ is treated weakly fair if there
is no moment so that in σ from that moment on, τ is enabled all the time
without being taken, and τ is treated strongly fair in σ if there is no moment
so that from that moment on, τ is infinitely often enabled without ever being
taken.
In Chap. 7, formalizations of the concepts of a rule being taken or a rule being
treated fairly have been introduced. Obviously, they fit these definitions.
In interleaving based models of concurrent systems, weak fairness is typi-
cally used to ensure that independent processes are treated with some mini-
mal amount of fairness: no transition of a process which is willing to work all
the time from some moment on can be discriminated against by the scheduler
forever. For communication or coordination statements, this kind of fairness
is too weak: The enabledness of this kind of statements depends on the state
of concurrent processes. If τ toggles from enabledness to disabledness ever
and ever again, e.g., because some concurrent processes enter and leave their
critical sections all the time, and the scheduler “asks” τ if it wants to work
only at moments at which it is disabled, it will never be scheduled. In order
to ensure that also in such scenarios, τ will be scheduled, τ must be treated
strongly fair. Note that for transitions which can only be disabled by being
taken, weak fairness and strong fairness are equivalent. Manna and Pnueli
[MP92] use the terms strong and weak fairness in the sense just described.
78 8. Concurrency and Reactivity: Interleaving
Manna and Pnueli [MP92] call fairness the difference between nondetermin-
ism and concurrency. Unconstrained nondeterminism does not adequately
describe concurrent systems, since it allows too unrealistic runs, or more
specifically: unfair runs.
If it was not for fairness, the set of all the transitions T of some process
might be combined to one of the form λ(q) : ∪τ ∈T τ (q), but since different
transitions of a process might have to be treated with different kinds of fair-
ness, a process is typically described by a set of transitions rather than by just
one transition. As mentioned, this requirement applies only to formalisms in
which liveness properties are to be specified and proved. If a formalism is
only used for safety properties, the whole process can be represented by just
one transition. In Gurevich’s proposal to extend the ASM formalism to the
description of distributed systems [Gur95a], fairness constraints are not dealt
with, but they can easily be incorporated into the model, by describing each
process not with only one rule but with a (finite) set of rules, where each
single rule can be associated with a fairness constraint.
The fairness concepts discussed here are no quantitative concepts. If two
transitions τ and τ , which are to be treated weakly fair, are continuously en-
abled in a run, a weakly fair scheduler might on average schedule τ a thousand
times more often than τ , or it might even become more and more discrim-
inating against τ in time. Thus, these fairness concepts are quite minimal,
not intended to be implemented as such, but meant as minimal constraints
on an implicit scheduler of a concurrent system which nevertheless suffice to
prove important properties of many protocols. If a protocol is proved to be
correct if the scheduler can be assumed to fulfill the minimal fairness types
just described, then it is also expected to be correct for realistic schedulers,
which typically can be assumed to fulfill the minimal properties.
Fairness as defined here is admittedly no effective concept. This idea can
be made formal by showing that fairness is equivalent to unbounded nonde-
terminism [Fra86].
8.3 Properties 79
8.3 Properties
The list of OR-prefixed statements inside the CHOOSE has one line for each rule
identifier ri and each associated rule Rri .
We will assume that execution of Rri is in no state equivalent to SKIP.
This is in order to ensure that we can recognize unlimited activity of the
interleaving scheduler in an interval.
Note that the CHOOSE construct in the definition selects only one of the en-
abled agents, by the definition of the semantics of CHOOSE. Note also that
each rule Rri might contain occurrences of the unbound variable a, which it
can use to refer to the agent for which it works.
The fairness requirements are used in the semantics of an interleaving
NTASM model to restrict the set of its runs.
Definition 8.4.3. An infinite sequence σ of states is a run of an interleaving
NTASM model if the following conditions are fulfilled:
– Each step of σ is a step of the same interleaving NTASM model scheduler.
– For each agent a, if from some point in the sequence on, the rule associ-
ated with rule identifier rule(a) is enabled continuously and wf(A) holds
continuously, the rule is taken infinitely often.
– For each agent a, if there is an infinite number of states in the sequence
so that sf(a) holds and the rule associated with rule identifier rule(a) is
enabled, the rule is taken infinitely often.
Note that fairness constraints can be expressed “almost operationally” if we
allow infinitely branching non-determinism [Fra86]. We feel that a declarative
specification of fairness at the level of runs is simpler.
This definition allows us, for example, to model the Fair Transition Sys-
tems which Manna and Pnueli use as the semantical basis of their approach
to concurrency [MP92, MP95]. The only restriction is that we require the
basic steps, the transitions of Manna and Pnueli, which are represented by
ASM rules, to be effective.
two steps is expressed in the interleaving linear time model by the existence
of two runs so that in one, s precedes s and in the other, it is the other way
round. In the interleaving approach, the a priori plausible idea to also allow
runs in which the two steps are taken synchronously is not admitted.
The decision to allow only interleavings of the transitions of processes and
to disallow synchronous or overlapped execution of such steps makes for fewer
global transitions of the concurrent system composed of the processes: The
set of transitions of the system is just the union of the transitions of the sub-
systems. If also synchronous execution of transitions of concurrent processes
was admitted, this would in general lead to a number of global transitions
which is exponential in the number of processes. Many proof techniques of
properties of a concurrent system use a case distinction over all global tran-
sitions. This makes the interleaving approach attractive.
The decision to model a concurrent system by interleaving introduces
nondeterminism (which is restricted by fairness constraints). While this fair
nondeterminism is in some cases an appropriate abstraction, e.g., if the steps
of the runs of a concurrent system are best modelled as a partial order, there
is also a large class of applications in which this is not the case. For example
in hardware systems, there is an abstraction level at which it is best assumed
that the processes of the concurrent systems work in perfect synchrony. If
such systems are modelled with an interleaving semantics, nondeterminism
is introduced which is not present in the original concurrent system, and the
synchronization between the processes must be encoded explicitly. While this
should be possible, the interleaving approach introduces a complexity into
the model which is only necessary because the interleaving models do not
provide the appropriate means for modelling the synchronous composition of
subsystems. In order to model such systems, the synchronous approach can
be used, which is described in Chap. 9.
8.6 Summary
For linear-time concurrent systems, two composition strategies are often cho-
sen: interleaving and synchronous composition. This chapter discusses impor-
tant concepts of the interleaving approach and describes how it can be used
in the current framework.
9. The Synchronous Approach to Concurrency
(q, i). Input-enabledness of an I/O automaton means that in each state there
is a follower state for each input. Note that deterministic I/O automata are
input-enabled.
The behavior of an input-enabled I/O automaton is interpreted in the
following way: The system starts in a state q ∈ A0 and waits for some input.
After some time, input i ∈ I arrives, and instantaneously, the system selects a
possible reaction (which always exists, because of input-enabledness), moves
to the state part of the reaction and outputs the output part of the reaction.
Then it starts waiting again for the next input.
The instantaneous computation of the reaction on some input is called a
macro-step. Typically, this macro-step is implemented by a sequence of micro-
steps. If an I/O automaton is implemented as a real system, the selection of
a reaction takes some time, and, thus, it is an abstraction to assume that the
reaction takes its effect instantaneously when an input arrives. For a given
application, the synchrony hypothesis is the claim that this abstraction
is appropriate: The time needed for macro-step of the implemented I/O au-
tomaton is negligible in comparison to the reaction times of its environment.
Applications for which the synchrony hypothesis holds are typically not
well described by interleaving concurrency. One reason is that the inherent
nondeterminism of interleaving systems is only restricted by fairness, and the
fairness types defined are not well suited to model that the reaction to some
input be immediate – at least one would need a specific interpretation. A way
to extend fairness based formalisms is to define a subset of the transitions
as urgent, which means that they must be executed as soon as they are
enabled (or before any non-urgent transition is taken, since in general, several
transition might be enabled in some state, and only one transition can be
taken in a step of an system based on interleaving concurrency). Such an
approach could combine synchrony and interleaving.
In applications which are typical for synchronous systems, there is not
much need for interleaving; rather, they are deterministic and have a fixed
structure, and since they have a finite number of states, inputs and outputs,
they are Mealy automata. Hardware systems and process controllers are typ-
ical examples. The formalism used for describing such applications does not
have to deal with nondeterminism and fairness. The problem lies elsewhere:
It consists of describing a Mealy automaton with large sets of states, inputs
and outputs in a way which allows the structure to be dealt with in a com-
positional way. This means that it should be specified, designed, understood,
analyzed, optimized, debugged, possibly also compiled, etc., by dealing with
the elements of some partition of the synchronous system and putting to-
gether the partial work results in order to construct the work result for the
entire system.
Basically, it is only the transition function δ which has to be defined.
Thus in synchronous systems, the task of defining a reactive system can be
reduced to defining one macro-step of the system, which is just some trans-
formation of inputs (the current state and the input event) into some results
9.1 Reactive Systems as Mealy Automata 85
(the next state and the output reaction). Thus, what is needed for defining
a synchronous reactive system is exactly what Harel and Pnueli [HP85] call
a transformational system. This might be considered as a contradiction in
terms, since reactive systems and transformational systems are considered to
be disjoint classes. This contradiction dissolves if we admit that a system can
be transformational at one level of abstraction and reactive on another. Syn-
chronous systems can be considered as reactive systems either at a higher
abstraction level than that of a single macro-step – where the synchronous
system describes a sequence of macro-steps which are reactions on inputs
from the environment, fitting exactly the definition of a reactive system–and
also if we consider a lower abstraction level – where a single step of the
synchronous system is computed as the effect of the work of concurrent
modules, each reacting on inputs from other modules, as will be discussed
further down in more detail, and where each such module also fits nicely the
definition of a reactive system.
Let us consider synchronous systems on the abstraction level where they
are transformational. Classical techniques for describing functions in a man-
ageable way are:
1. Hierarchy: Use step-wise refinement [Wir71] to develop a detailed design
or an implementation from a high-level, i.e., more abstract design, repre-
senting also the higher design levels as procedures or functions explicitly
in the implementation.
2. Modularity: Decompose a unit of a higher abstraction level into smaller
units, called modules [Par72]. The task of a higher-level module is split
into sub-tasks which are dealt with by several lower-level modules, which
possibly interact in performing their work.
The only difference between the classical approach to the definition of a tran-
sition function and the approach often used for synchronous systems is that
in order to compose modules into higher-level units, classical approaches typ-
ically used only deterministic selection, repetition and an operator for se-
quential composition, while the different approaches used for synchronous
systems use additionally some kind of parallel (or concurrent) composition
of submodules. The latter also makes necessary some kind of communication
mechanism for submodules, which for many synchronous formalisms can be
understood as a shared-variable approach. This means that a partial result
computed by some module is instantaneously available to all other modules
which monitor the location of the result. Halbwachs [Hal93] calls this ap-
proach “broadcasting”, since it is a form of one-to-many communication not
involving any synchronization on the part of the sender1 .
1
Neither the classical nor the synchronous approach to describing transformational
systems uses explicit nondeterministic selection, and where nondeterminism is
introduced in the use of a synchronous formalism, this is typically considered to
be a designer error (most synchronous formalisms do not admit nondeterminism).
86 9. The Synchronous Approach to Concurrency
There are many different proposals for modularly describing Mealy au-
tomata. ESTEREL [BdS91, BG92, Ber99] is an imperative programming lan-
guage. STATECHARTS [Har87] is a graphical formalism, based on some
extensions of finite automata, for operational system specification; ARGOS
[Mar89, Mar90] can be considered as a version of StateCharts with a cleaned-
up semantics. LUSTRE [HCP91] is a functional stream-processing language.
Signal [LBBG85, LGLL91] is a stream-processing language with a constraint-
programming flair. The system description language of the model-checking
tool SMV is a synchronous language [McM93]. VERILOG [TM95, Gor95] and
VHDL [LMS86] are hardware description languages. Halbwachs [Hal93] gives
an overview of some synchronous formalisms proposed for programming. In
order to get some order into this zoo of synchronous formalisms, we inves-
tigate some concepts which are important for several of the formalisms in a
general setting.
Note that compatibility implies that at most one automaton controls a given
location, and that output locations of one automaton may be input loca-
tions of the other. It is over these common locations that the automata can
communicate when they are combined.
We are now prepared to define synchronous composition of structured I/O
automata:
Definition 9.2.3. Let P1 and P2 be two compatible structured I/O automata.
Then their synchronous composition P = (P1 ||P2 ) is defined by
– P.LQ = P1 .LQ ∪ P2 .LQ 2 ,
– P.LI = (P1 .LI ∪ P2 .LI ) − (P1 .LO ∪ P2 .LO ),
– P.LO = P1 .LO ∪ P2 .LO ,
– P.A0 = {q1 [q2 ] | q1 ∈ P1 .A0 , q2 ∈ P2 .A0 }
– For all q ∈ P.A, i ∈ P.I, δ(q[i]) is defined as
{q [o] | q ∈ P.A, o ∈ P.O,
(q [o] ↓ P1 .L) ∈ P1 .δ(q[i[o]] ↓ (P1 .LQ ∪ P1 .LI )),
(q [o] ↓ P2 .L) ∈ P2 .δ(q[i[o]] ↓ (P2 .LQ ∪ P2 .LI ))}
The input locations of the combination of the two automata are those inputs
of either automaton which are not controlled by the other automaton. As the
set of possible results of processing input i in state q, we admit all mappings
from state and output locations to universe elements which are consistent
with possible results of both combined automata.
Unfortunately, the synchronous composition operator just described does
not fulfill a condition which is important for synchronous systems: The com-
position of deterministic systems should be deterministic. We investigate the
problem and a solution for structured Mealy automata.
Proposition 9.2.1. There are compatible deterministic structured Mealy au-
tomata with non-deterministic synchronous composition.
Proof. We present two compatible deterministic structured Mealy automata
with a non-deterministic composition.
Consider P1 = ({0, 1}, {}, {x}, {y}, , δ1), where δ1 (q) = {{y → q(x)}},
and P2 = ({0, 1}, {}, {y}, {x}, , δ2), where δ2 (q) = {{x → q(y)}}. Then the
transition function δ of P1 ||P2 is defined by δ() = {{x → u, y → u}|u ∈ U},
which has two elements.
Note that by replacing δ2 in the proof above by δ2 (q) = {{x → 1 − q(y)}},
a δ would result which is empty, i.e., the composition of the two automata is
inconsistent.
Corollary 9.2.1. The class of deterministic structured Mealy automata is
not closed with respect to synchronous composition.
This means that we need a more restrictive compatibility criterion in order
to ensure that the synchronous composition of deterministic structured Mealy
automata is deterministic. In order to define such a criterion, we need the
88 9. The Synchronous Approach to Concurrency
The first conjunct ensures that the input value combinations i and i differ
at most at location lI , and the second conjunct ensures that the difference
at location lI between i and i leads to a difference between the values of lO
in the two resulting states. Note that the selection function yields the only
element of P.δ(q[i]) rsp. P.δ(q[i ]), because we only consider deterministic I/O
automata.
Dependency of lO on lI in state q means that there are values for the
input locations in which the value of the output location lO depends on the
input lI . Independence means that in order to compute the value of lO , the
value of lI does not have to be known.
Definition 9.2.5. Let P = (U, LQ , LI , LO , A0 , δ) be a deterministic struc-
tured Mealy automaton. The dependence relation between input locations and
output locations defines, for each q ∈ A, a partial order ≤q on LI ∪ LO , by
defining l ≤ l if l depends on l in state q or l = l.
This partial order is called the state-relative I/O dependency rela-
tion of P .
The union of the ≤q for all states q is a partial order ≤ so that lI ≤ lO
expresses that there exists a state in which lO depends on lI .
This relation is called the I/O dependency relation of P , since it is
not relative to some state.
If two automata are combined, some output locations of one automaton
are typically identical to some input locations of the other automaton. If the
transitive hull of the union of the partial orders of the single automata is
not a partial order, then there is a dependency cycle between some locations
which might lead to problems. The concept of “causal compatibility” between
deterministic structured Mealy automata encapsulates the idea that if no
dependency cycles are generated by a combination of the two dependency
relations, the resulting automaton is deterministic again.
Definition 9.2.6. Two deterministic structured Mealy automata are called
causally compatible if they are compatible and the transitive hull of the
union of the I/O dependency relations is a partial order.
9.2 Composing I/O Automata 89
9.6 Summary
This chapter describes a way to model reactive systems based on the syn-
chronous composition of subsystems rather than on interleaving composition.
We explain the approach by describing a system as a Mealy automaton and
explain why in order to compose systems, more structure is necessary than
there is explicit in Mealy automata descriptions. We define the concepts of
compatibility and causal compatibility of Mealy automata, which are needed
to understand the needs of the composition operation. Finally, we describe
three strategies of implementing micro-step semantics of synchronous systems
based on ASMs, and we describe how the interaction with the environment
might be modelled.
10. Deadlines
least one event is urgent, only discrete transitions can take place, executing
the urgent transitions or disabling them. Otherwise, the system might do a
time step whose length is so small that no strict deadline of any event is
reached, and no non-strict deadline of any event is transgressed.
There are two reasons why this simple strategy does not work in NTASM
systems in general: (1) In each step, also when a discrete step takes place, a
non-zero amount of time passes. (2) If the execution interval of some event is
a point interval, the use of a constant step width implies that the execution
interval does not intersect the time domain if the point is not an integer
multiple of the step width.
In this section, we describe several ways to model deadlines in the NTASM
context under different conditions. We use the convention that an event
is modelled by an agent a. Thus, we will talk about the enabling time of
a, the deadline of a or about urgency of a, always transferring the con-
cepts from an event to the agent modelling the event. For an agent a,
enablingTime(a) and deadline(a) denote the enabling time and the dead-
line of a. By performEvent(a), we denote a rule which describes the ef-
fect of performing the event associated with agent a. Since agent a models
only a single event, it is assumed that one of the effects of the execution of
performEvent(a) is the destruction of agent a.
Proposition 10.1.1. There are two standard real numbers a and b so that
no number divides both without rest.
√
Proof. Just take a = 1 and b = 2.
Corollary 10.1.2. No infinitesimal divides all standard real numbers with-
out rest.
A rule R(a) defining the activity of an agent a with enabling time and
deadline might be given as in Fig. 10.1.
IF enablingTime(a) ≤ now
THEN IF now+dt ≤ deadline(a)
THEN OR SKIP
OR performEvent(a)
ELSE performEvent(a)
ELSE SKIP
Fig. 10.1. Form of a rule in a synchronous NTASM model with enabling times and
deadlines.
The outermost IF ensures that before the enabling time has come, the
effect of the rule is equivalent to SKIP, i.e., that the rule has no effect, but
does not interfere with any synchronously executed rules. The inner IF checks
whether execution of the event can wait. This is the case if at the next point
in time, i.e., at now+dt, the deadline condition has not yet been violated. In
this case, the event might either take place, or it might wait. Otherwise the
current moment is the last one at which the event might take place, i.e., a has
become urgent, and the ELSE branch of the inner IF ensures that the event
in fact takes place.
Since we consider rules of a synchronous NTASM model as presented in
Chap. 9.5, it is ensured that the different instances of performEvent(a) in
synchronously executed rules are pairwise compatible. Thus, no synchroniza-
tion is necessary between concurrent agents whose deadlines run out at the
same point in time.
Under the conditions described, the rule of Fig. 10.1 will not miss a dead-
line:
Theorem 10.1.1. Consider a rule R(a) of the form of Fig. 10.1. Assume
that
(1) rule R(a) is executed by a synchronous NTASM model scheduler,
(2) both enablingTime(a) and deadline(a) are standard numbers,
(3) the constant step width dt divides deadline(a),
(4) the execution interval is non-empty,
(5) the agent a is created before its deadline has run out, and
(6) the agent a is destroyed only by the rule performEvent(a), which only
occurs in R(a).
100 10. Deadlines
Proof. (1) Use induction on the number of steps: Each step increments now
by dt, and simNow by a value which is between zero and dt.
(2) We proceed in three steps (a), (b) and (c): (a) Consider a run of rule
infinitesimalDelayScheduler and any position i of the run at which now is
limited. The interval between the start of the run and position i is of limited
time length (now is the time length, and is limited), and, thus, by the limited
activity assumption, only a limited number of discrete steps have taken place
up to position i. Let us call this limited number j. (b) By induction, it is clear
that the difference now-simNow at any position k in the run is not larger than
10.3 Admitting Infinitesimal Delays 105
infinitesimalDelayScheduler =def
|| now := now + dt
|| IF ∃(a:Agent):urgent(a)
THEN doDiscreteStep
ELIF ∃(a:Agent):executable(a)
THEN OR doDiscreteStep
OR doTimeStep
ELSE doTimeStep
urgent(a) ⇔def
simNow = deadline(a)
executable(a) ⇔def
∧ enablingTime(a) ≤ simNow
∧ simNow ≤ deadline(a)
doDiscreteStep =def
CHOOSE (a:Agent):executable(a) IN
|| simNow := simNow
|| lastScheduledAgent := a
|| Agent(a) := false
|| OR IF rule(a)=r1 THEN Rr1 ELSE HALT
OR ...
OR IF rule(a)=rn THEN Rrn ELSE HALT
doTimeStep =def
|| lastScheduledAgent := ⊥
|| IF (∃(a:Agent):deadline(a)<simNow+dt) THEN
simNow := min {t | ∃(a:Agent):t=deadline(a)<simNow+dt}
ELSE
simNow := simNow+dt
Fig. 10.3. The step rules used in the scheduler of Fig. 10.2.
dt times the number of discrete steps which have taken place up to position
k. (c) We put (a) and (b) together: For a limited j and an infinitesimal dt,
j ∗ dt is infinitesimal, which is an upper bound for the value of now-simNow
by (b).
(3) Since enabling times and deadlines of events are compared to simNow,
and simNow increases in a (weakly) monotone way, agent b will not be enabled
before the deadline of agent a has passed.
The fact that there is only an infinitesimal difference between the time
when an event takes place and the time when it should take place and the
fact that we only consider strict enabling times and deadlines implies that the
106 10. Deadlines
standard part of the time at which an event takes place fulfills the enabledness
conditions:
Corollary 10.3.1. Consider a run as in the precondition of Theorem 10.3.1.
If the discrete step of an event agent takes place at a state with a limited value
of now, the standard part of now is an element of the execution interval.
Note that the result only holds for the standard part. now itself might be an
infinitesimal too large.
10.4 Summary
case of a tie, S is charged. A discrete move has length 0, a time move can
have any non-negative length. If both S and E propose a discrete move, the
arbiter performs their moves synchronously; if one proposes a time move and
the other a discrete move, the arbiter just performs the discrete move; and
if both components propose a time move, the arbiter performs a time move
of a length which is the minimum of the lengths of the proposed moves. The
goal of S is to let time increase for time 1, or to get charged only for a finite
number of steps; the goal of the environment is the opposite. S is receptive if
there is a strategy for S to win this game from every reachable state.
Note that this game-theoretical conceptualization expresses exactly the
difference between the existential quantification of the non-determinism of
the system and the universal quantification of the non-determinism of its
environment.
Let us transfer the ideas to the NTASM framework. We assume that the
whole system is composed synchronously from two rules RS and RE , where
RE includes the effect of the time rule, i.e., the whole system is modelled by
a rule RS ||RE .
The “proposal” of some step in the classical framework is replaced just
by the execution of an action, which might be equivalent to SKIP to model
the “proposal” of an infinitesimal time step. The proposal of a discrete step
is replaced by the execution of a step which is not equivalent to SKIP; and
the proposal of a time step of some length is expressed by a sequence of
infinitesimal time steps the lengths of which sum up to the proposed length.
The number of moves charged to RS in some interval is then simply the
number of non-SKIP steps performed by RS in the interval.
This approach means that we assume that the “strategy” the existence
of which the classical game-theoretical definition requires for receptivity is
already assumed to be implemented in the rule. If we want to use non-
determinism of the system rule to model freedom of implementation, it should
not be restricted by a receptivity requirement. Interpreting nondeterminism
in a rule in this way, we have to require that each resolution of the non-
determinism of RS leads to an admissible system behavior.
Using these ideas, and replacing the finiteness requirement of the classi-
cal formulation by a limitedness requirement in the NTASM framework, we
define:
Definition 11.1.1. A rule RS is receptive if in any limited span of time
of any system behavior of some RS ||RE , where RE includes the effect of a
time rule, RS is taken only a limited number of times non-vacuously; or as
a formula:
[takenAlone(RS ||RE )]
→
2(limited(dt ∗ ) → limited(# takenNonvacuously(RS )))
11.2 (m,n)-Receptivity 109
Note that the receptivity definition has become far simpler than in the
classical game-theoretical formulation. This can be traced back to one prop-
erty of the NTASM framework and one interpretational decision:
– The uniform model of time makes it unnecessary to treat discrete steps
and time steps of different lengths differently. The arbiter of the classical
definition is not necessary any more.
– The decision to interpret the nondeterminism of the system as freedom of
implementation which should not be restricted by the receptivity require-
ments obviates the need to distinguish between existential and universal
occurrences of nondeterminism.
The most important consequence of the receptivity definition is that syn-
chronous composition of two receptive rules yields a receptive rule:
Proposition 11.1.1. Let R1 and R2 be compatible receptive rules. Then also
R1 ||R2 is a receptive rule.
Proof. No matter what the environment of R1 does: in a limited interval of
time, R1 is taken non-vacuously only a limited number of times. The same
is true for R2 . The number of non-vacuous steps of R1 ||R2 in an interval is
bounded from above by the sum of the non-vacuous steps of R1 and R2 in the
interval. The sum of two limited numbers is limited, and a natural number
bounded by a limited number is limited; thus, also R1 ||R2 performs only a
limited number of non-vacuous steps in a limited interval.
11.2 (m,n)-Receptivity
The receptivity concept described in Definition 11.1.1 is a strict requirement
on a receptive rule: No matter how wildly the environment acts, a receptive
rule must behave orderly. In specifications of open systems which use the
assume/guarantee scheme [FP78, AL95], a system may start to behave dis-
orderly if its environment previously started to do so. Thus, the system is
not required to behave orderly under all conditions: The exception is if the
environment can be blamed for the disorder of the system behavior.
In order for this freedom to be usable, the system must be able to notice
if the assumptions are fulfilled by the environment. In the formalism used by
Abadi and Lamport [AL95], this can be expressed by looking at the safety
part of the assumption: remember that a safety property is defined so that
if it is not fulfilled by a system behavior, then there is a first moment at
which this can be noticed. The liveness part of the assumption can not be
used, since a liveness property is one which can always be fulfilled by some
future behavior, no matter what has happened up to now, i.e., the system
can not decide, based on the finite prefix of a system behavior known up to
some moment, if the environment will fulfill the liveness assumption or not.
Because of this, Abadi and Lamport use the safety closure of the assumption
as the effective assumption in an assumption/guarantee paradigm.
110 11. Open Systems
The definition implies that an (m, n)-receptive rule may “go wild”, i.e., may
perform more than n discrete steps per unit of time, as soon as its environment
has shown discrete activity which is not bounded by m per unit of time.
A rule which admits more activity from the environment or guarantees a
tighter bound for its own activity fulfills also the less strict conditions:
Proposition 11.2.2. If a rule R is (m, n)-receptive and m ≤ m and n ≤ n ,
then R is also (m , n )-receptive.
Proof. m ≤ m implies that an (m, n)-receptive rule assumes not more than
an (m , n)-receptive rule about the environment, and n ≤ n implies that
an (m, n)-receptive rule guarantees not less than an (m, n )-receptive rule.
Thus, the concept of (m, n)-receptivity is not weaker than that of (m , n )-
receptivity.
We now consider the synchronous composition of two rules R1 and R2 :
Proposition 11.2.3. Consider an (m1 , n1 )-receptive rule R1 and an
(m2 , n2 )-receptive rule R2 , with m1 ≥ n2 and m2 ≥ n1 . Then R1 ||R2 is
(min(m1 − n2 , m2 − n1 ), n1 + n2)-receptive.
Proof. In unit time, R1 will at most perform n1 discrete transitions, if its
environment performs at most m1 discrete transitions. m1 ≥ n2 implies that
as far as R1 is concerned, the environment of R1 ||R2 might do at most m1 −n2
discrete steps per unit time before R1 may start “going wild”. For R2 , this
number is m2 − n1 . If the environment of R1 ||R2 performs not more discrete
transitions in unit time than are given by these two bounds, R1 and R2 fulfill
their guarantees, which in the worst case means that their discrete steps
never fall together, and in this case at most n1 + n2 steps are performed in
unit time. Thus, if the environment of R1 ||R2 is guaranteed to do at most
min(m1 − n2 , m2 − n1 ) discrete steps in any unit time interval, then R1 ||R2
will do not more than n1 + n2 steps in a unit time interval, which means that
R1 ||R2 is (min(m1 − n2 , m2 − n1 ), n1 + n2 )-receptive.
112 11. Open Systems
11.3 Summary
for values and locations. Such a rule scheme sometimes can make good use of
non-parameter locations which should be local to itself. We use the keyword
“LOCAL”to introduce function symbols which are understood to be interpreted
as different functions for different instantiations of the rule scheme. Addition-
ally, we will use function schemes, i.e., symbols which get terms, not values
as their arguments and can build other terms out of them.
Counter =def
IF falling_clock_edge
THEN value := (value + 1) mod 16
ELSE SKIP
JKFF(J, K, T, Q) =def
LOCAL risingT_J, risingT_K
IF rising_edge(T)
THEN || risingT_J := J
|| risingT_K := K
ELIF falling_edge(T)
THEN IF risingT_J = 1 AND risingT_K = 1
THEN Q := 1-Q
ELIF risingT_J != risingT_K
THEN Q := risingT_J
ELSE SKIP
ELSE SKIP
of T is relevant for the value of the expression, and the current value would
be the only value available to a proper ASM function); we assume that they
represent function schemes and we assume that such function schemes can
be defined so that they yield the expected results for their arguments.
The local symbols risingT_J and risingT_K are used to record the values
of the input during rising edges of the clock which have to be known on the
next falling edge of clock. T, Q, J and K are formal parameters for the clock,
the output and the two data inputs of the circuit.
Using the JK flip flop rule scheme, we can put together a ripple counter
scheme and instantiate it in the manner described in Fig. 12.3. The scheme
describes how the output of one flip flop is wired up with the clock input of
the other, as is characteristic of a ripple counter, and that the data inputs are
set to one; the last line is an instantiation of the scheme which uses nullary
symbols whose values represent the current clock and the current values of
the four flip flops.
RippleCounter(clock,q0,q1,q2,q3)
from value 15 to value 0, the latter value being stable up to the next falling
clock edge, the low level run has (using the order q3,q2,q1,q0 for the bits)
1111->1110->1100->1000->0000 (but only if no other falling clock edge is
detected), where the last value is also stable up to the next falling clock edge.
If one or more other falling clock edges intervene, such a sequence might
also look like 1111->1110->1101->1001->0001 (and there are many other
possibilities, depending on the moments of further falling edges of clock).
We might deal with this problem by assuming that changes of the clock
are separated by time intervals of a larger magnitude than the reaction time
of the flip flop; this is a natural abstraction as long as the reaction time of the
circuits driven by a clock is negligible in comparison to the clock cycle, which
exactly means that we can disregard the working times of some circuit. In
this case, no other falling clock edge can happen during the ripple phase of
the counter (as long as it has standard finite length). Thus, the only possible
value sequence is 1111->1110->1100->1000->0000.
But also if no falling clock edge intervenes during a ripple phase of the
counter, we have the problem that the ripple counter goes through the values
14, 12 and 8 before it reaches the zero during a ripple phase of maximal
length (and through a shorter sequence of intermediate values in some other
cases). A circuit using the output of the counter as input might malfunction
because of this; but when? Here again, time scale considerations can help. We
associate a reaction time with the inputs of a circuit: Single changes on an
input line are only noticed by the circuit after the line has stabilized for some
time; this is a plausible abstraction, as long as the input does not change
its value often during such a reaction time phase. If the reaction time of the
circuit which uses the output of the counter as input is of a larger scale than
the flip flop reaction time, the ripple phase would not hurt, since this phase
would, because of its short duration (a standard finite multiple of the flip
flop reaction time), not be noticed. And if the reaction time plus the working
time of the circuit reading the output of the ripple counter is, at the same
time, of a smaller scale than the clock cycle, this ensures that it has enough
time to compute its result before the counter value changes again.
after some delay after an input has changed is modelled by the serial con-
nection of an instantaneously working NAND and a circuit only representing
the delay.
Hardware description languages commonly allow the expression of several
forms of delay mechanisms. Two common ones are inertial delay and trans-
port delay. The specific semantics differ for different formalizations, but the
basic idea is that a change at the input of an inertial delay circuit cancels a
change event for the output which has been scheduled but not yet performed,
while for transport delay, no such cancellation takes place.
To be specific, we describe the two forms of delay by two rule schemes
with formal parameters for the input signal, the delay time and the output
signal, both with two local symbols: one for detecting changes of the input
signal, and one for recording information for one (InertialDelay) or sev-
eral (TransportDelay) scheduled changes. Fig. 12.4 gives rules implementing
these forms of delay.
here, the update of the internal data structure representing scheduled updates
is performed in the third branch for those changes which have just been
performed. Note that in the third synchronous branch of TransportDelay, if
there exists a pair of values s and t as in the condition, there is just one such
pair, which is then chosen and processed in the THEN branch.
The important point about an inertial delay is that at its output, pulses
are never shorter than the delay time:
Proposition 12.3.1. Consider a location l which is written at most by an
instantiation of rule scheme InertialDelay. Then, between value changes of
l, at least the delay time of the instantiation passes.
Proof. Consider a system with an instantiation of InertialDelay so that
the output location l of that instantiation is not written by any other rule.
Consider any run q of this system and a position i ∈ N, i > 0 with a value
change at l, i.e., a position which fulfills q(i)(l) = q(i − 1)(l).
We use an induction to prove an invariant for the value of
next_change_time:
Claimed invariant. From position i on, the value of the symbol
next_change_time local to the rule scheme instantiation considered will
never be smaller than t = q(i − 1)(now+Delay) = (i − 1) ∗ dt + Delay.
Induction start. For position i, inspection of the rule scheme shows that
the occurrence of an update of location l at position i in the run implies
that at that position, the value of the symbol next_change_time local
to the rule scheme instantiation considered must either be ∞ (if no input
change has just been detected at position i − 1 in the run) or t (as defined
above, if an input change has been detected at position i − 1). It can not
be smaller.
Induction step. For a position j > i, either the value of next_change_time
did not change in the last step (which implies the claim because of the
induction assumption), or it has just been set to (j − 1) ∗ dt + Delay
because of a detection of an input change, which is larger than t because
of j > i.
The first moment at which the value of the output location might change
is dt after the first moment when now ≥ t holds. Let us call the position at
which that condition is fulfilled j − 1, so that j is the position of the first
possible change after that at position i. We see that the condition now ≥ t
at that moment means (j − 1) ∗ dt ≥ (i − 1) ∗ dt + Delay; adding dt on both
sides, we see that j ∗ dt, which is the moment of the first possible change after
that of i ∗ dt, comes at least by Delay later than i ∗ dt.
As long as the time interval between changes of the inputs is always longer
than the delay time, both delay rules are equivalent. They only differ if during
the propagation time for one signal change, the input signal changes anew.
For InertialDelay, the propagation of the earlier signal change is canceled;
12.4 Analyzing a Logical Circuit for Hazards 121
for TransportDelay, each signal change of the input is replayed after the
delay (plus a discretization error) on the output.
Let us assume that the delay behavior of a JK flip flop with timing con-
stant D (for the delay from the falling edge of the clock input to the update
of the output) is well expressed as an inertial delay. Then we can describe a
JK flip flop with explicit timing as in Fig. 12.5
JKFF_D(J,K,T,D,Q) =def
LOCAL internal_Q
|| JKFF(J, K, T, internal_Q)
|| InertialDelay(internal_Q, D, Q)
x
y
q
We will now analyze the system and detect a possible hazard. Let us
consider the following situation: The inputs x, y, z are all set to 1, and we
wait until the system has stabilized (there is no feedback and there are no
active components, so it will stabilize in finite time). The output of the first
AND gate is 1; the outputs of the NOT gate and of the second AND gate are 0;
and the output of the OR gate is 1.
In a run starting from this situation, the system stays stable as long as
none of the inputs change, which implies that the output stays at 1. Now
consider that input y changes from 1 to 0 and let the first moment with the
new value of y be at time t. The logic formula for our system shows that the
output should not change in this case. But in fact, a negative pulse of width τ ,
a hazard, will occur at the output; let us first look at this in a rough manner,
disregarding the infinitesimal step widths which might lead to infinitesimal
errors:
1. At time t, the change of y leads to changes of the outputs of the first AND
and of the NOT being scheduled for time t + τ + dt.
2. Around time t + τ , the change of y has propagated through the first
AND (making its output 0) and through the NOT, but not yet through the
second AND or the OR gate; but in this moment, both inputs of the OR
gate are zero, and, thus, a change of the output of the circuit from 1 to
0 is scheduled; and both inputs of the second AND gate are 0, so a change
of its output from 0 to 1 is scheduled.
3. Around time t+2∗τ , both scheduled changes become effective: q becomes
0, and the second input of the OR gate becomes 1 again, leading to another
change of the output being scheduled.
4. Around time t + 3 ∗ τ , the scheduled change of q is performed, and the
system becomes stable again.
This analysis is not exact because it disregards the following facts about our
model:
– When a change of the input of a gate with explicit timing takes place, first
the untimed (“instantaneous”) version of the gate computes its output,
which needs time dt.
12.4 Analyzing a Logical Circuit for Hazards 123
AND_D(X,Y,D,Q) =def
LOCAL internal_Q
|| AND(X, Y, internal_Q)
|| InertialDelay(internal_Q, D, Q)
OR_D(X,Y,D,Q) =def
LOCAL internal_Q
|| OR(X, Y, internal_Q)
|| InertialDelay(internal_Q, D, Q)
NOT_D(X,D,Q) =def
LOCAL internal_Q
|| NOT(X, internal_Q)
|| InertialDelay(internal_Q, D, Q)
HazardCircuit(X,Y,Z,Q) =def
LOCAL neg_Y, O1, O2
|| NOT_D(Y, τ , neg_Y)
|| AND_D(X, Y, τ , O1)
|| AND_D(neg_Y, Z, τ , O2)
|| OR_D(O1, O2, τ , Q)
HazardCircuit(x,y,z,q)
– When a change of the output of the untimed gate is detected at its input
τ
by the delay rule, its output only changes after dt ∗ dt time units.
Altogether, a change at an input of a timed circuit can only lead to a change
at its output (if at all) after time τ +dt. Since we assume that the time delay τ
is of a larger magnitude than dt, this difference can be ignored in most cases.
In our specific case, this might just lead to the hazard being an infinitesimal
of magnitude dt being shifted or longer than expected.
The following section discusses conditions under which such tedious cycle-
counting as just performed is not necessary.
124 12. Making Use of Different Magnitudes of Reals
IndependentDelaysHazardCircuit(X,Y,Z,Q,T1,T2,T3,T4) =def
LOCAL neg_Y, O1, O2
|| NOT_D(Y, T1, neg_Y)
|| AND_D(X, Y, T2, O1)
|| AND_D(neg_Y, Z, T3, O2)
|| OR_D(O1, O2, T4, Q)
Fig. 12.8. A circuit illustrating a hazard, where speeds of components are inde-
pendent from each other.
1
Personal communication.
12.5 Modelling Missing Knowledge Explicitly 125
Here, we make explicit that the delay times of the gates might be different;
further declarative restrictions on the different τi might be used to express
knowledge about relative timings of the gates which we might possibly have.
Note that this description might seem unnecessarily wordy in comparison
to models using formalisms in which nondeterminism can be implicit; this is
just the price we have to pay for explicit nondeterminism.
Let us analyze in more detail a condition under which hazards can not
occur in the system above if only a single input bit changes. This will illustrate
an example of the case where we do not have to count each cycle in order to
avoid errors.
Proposition 12.5.1. Consider the instantiated rule scheme
IndependentDelaysHazardCircuit(x,y,z,q,τ1,τ2 ,τ3 ,τ4 ), where the τi re-
sult from standard real numbers scaled by some arbitrary non-zero real num-
ber, and the step width dt is assumed to be of a smaller magnitude than the τi .
If τ4 is larger than the absolute value of τ1 + τ3 − τ2 , hazards resulting
from single input bit changes of that circuit can not occur.
Proof. From the inputs to the output of the circuit, four different paths are
possible, one from the x, two from the y and one from the z. We only look for
hazards occurring from changes of a single input bit when the system is in a
stable state. If the x or the z input changes, the change will propagate along
its only path until it either stops being propagated at some gate or it reaches
the output q; this depends on the rest of the system, but is not relevant for
hazard generation. Thus, only with changes of y, from where two paths lead
to the output, hazards can happen.
If some of the single-path inputs x and z are zero during the change of y,
propagation of the y-signal change along the paths which are common with
the zero-inputs is blocked at the AND gates, i.e., in this case, at most one,
and possibly none, of the inputs of the OR gate changes because of the signal
change. In these cases, no hazard can occur. Thus, we only have to deal with
the case that x and z are both one, since only in this case, two changes can
in general occur at inputs of the OR gate.
Note that in both steady states which are left to be considered, one input
of the OR gate is zero and the other is one. The accumulated signal propagation
times from y to the inputs of the OR gate are τ2 for the upper path and τ1 + τ3
for the lower path. If the absolute value of the difference between them is
smaller than τ4 , there is no problem, because the inertial delay of the OR gate
will buffer possible effects of the first signal change away.
This almost closes the argument; it only rests to be shown why it does not
invalidate our argument that we disregarded the infinitesimal errors induced
by our discretization of time. For this, we apply Proposition 12.1.2 to the
τi , which fulfill the requirements of the proposition. The proposition implies
that τ4 − |τ1 + τ3 − τ2 | is either zero or of the same magnitude as the τi .
Under the condition that it is positive (which is the condition considered in
the proposition), this means that the difference is of a larger magnitude than
126 12. Making Use of Different Magnitudes of Reals
UntimedHazardCircuit(X,Y,Z,Q) =def
LOCAL neg_Y, O1, O2
|| NOT(Y, neg_Y)
|| AND(X, Y, O1)
|| AND(neg_Y, Z, O2)
|| OR(O1, O2, Q)
UntimedHazardCircuit(x,y,z,q)
12.7 Summary
As another example for the NTASM approach, let us describe and analyze
Fischer’s real-time based synchronization protocol [Lam87]. It is meant to
ensure mutual exclusion of access to commonly used resources via real-time
properties of a shared variable. The idea is to use just one shared variable
(which we call v) for coordinating the access to the critical section. The
variable can contain a process id or some neutral value (which we call noProc).
When a process wants to enter its critical section, it first has to wait until
v=noProc; then it sets v to its process id, waits some time, and then reads v
again. If v has kept the old value, i.e., the id of the process considered, the
process may enter its critical section; on leaving the critical section, v is set
to noProc again. If v has not kept its old value, the attempt has failed and
the process must go back and wait again till v=noProc.
Two time distances are relevant for the correctness of the protocol: the
time from ensuring that v=noProc holds up to the moment at which v is
set to the process id; this span is required to be smaller than or equal to a
value called d1. The other time span is that from setting v to the process id
to checking it again. This is assumed to be greater than or equal to a value
called d2. Mutual exclusion is ensured for d2>d1.
What distinguishes our approach from classical ones is that the formal-
ization and proof is based on an infinitesimal discretization of time.
– s(p)=w2, “wait at least d2”: after setting v to its process id, the process
waits at least time d2 before v is checked again.
– s(p)=cr, “critical section”: the process is in its critical section.
In order to express the waiting times, we will use two dynamic functions
tr(p) and tw(p) mapping processes to points in time. tr(p) will be equal
to the time when process p has read v as being noProc for the last time, and
tw(p) will be equal to the time when process p has written the process id
the last time to v.
Proc is the finite set of process ids.
The initial conditions of the system are the following:
FischerInitial ⇔def
now=0 ∧ v=noProc ∧ ∀(p ∈ Proc) : s(p)=nc
This means that at the start, time is zero, the coordination variable signi-
fies that no process attempts to enter its critical section or is there, and that
all processes are non-critical.
The system transitions are described by the following rule. In each step,
one of seven alternatives is chosen. The first alternative is that only time
flows, i.e., no process attempts to move from one state to another. The other
alternatives describe that some process attempts to move from one state to
another. As will be seen when the rules are defined, each rule increments
the time and chooses some process nondeterministically from the processes
in some state, and possibly under some additional conditions. The six alter-
natives for possible moves of the process are given by named rules which are
defined and discussed in sequence.
FischerRule =def
OR incremTime
OR enterrv
OR enterw1
OR enterw2
OR resign
OR entercr
OR exitcr
Rule incremTime describes the steady flow of time:
incremTime =def
now := now + dt
Rule enterrv describes that a process in the non-critical state might
decide to attempt to use its critical section. It does this by moving on to the
state where the shared variable is checked.
enterrv =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=nc IN
s(p):=rv
13.1 A Hybrid Abstract State Machine Describing Fischer’s Protocol 133
Rule enterw1 describes that from rv, w1 can be entered if v=noProc. The
time when the variable is read is recorded in tr(p).
enterw1 =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=rv ∧ v=noProc IN
|| s(p):=w1
|| tr(p):=now
Rule enterw2 describes that a process in w1 might move on to w2. v is set
to p, which is used as the process id, and the time of this write access to v
is recorded in tw(p). The assumption that the move from w1 to w2 happens
in time d1 after reading v as noProc will be encoded by a global assumption
which will be discussed later.
enterw2 =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=w1 IN
|| s(p):=w2
|| v:=p
|| tw(p):=now+dt
Rule resign describes that a process in w2 might move back to rv if at
least time d2 has passed since v has been written and if the value in v has
changed since process p set it to its id.
resign =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=w2 ∧ now>=tw(p)+d2 ∧ v!=p IN
s(p):=rv
Rule entercr is very similar to rule resign; the difference is that it checks
that v has not changed since process p wrote to it, and that the target state
is then cr.
entercr =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=w2 ∧ now>=tw(p)+d2 ∧ v=p IN
s(p):=cr
The last rule exitcr describes that process p leaves the critical state for
the noncritical and resets v to noProc.
exitcr =def
|| incremTime
|| CHOOSE(p:Proc):s(p)=cr IN
|| s(p):=nc
|| v:=noProc
134 13. A Case Study: Fischer’s Protocol
Our ASM does not express the assumption that between checking that
v=noProc and setting v to p not more than time d1 passes. We might oper-
ationalize this assumption, but it is more convenient to express this assump-
tion declaratively by restricting our attention to system behaviors of the ASM
which fulfill the following formula invariantly:
FischerAssumption =def
∀(p ∈ Proc): s(p)=w1 → now+dt≤tr(p)+d1
If we are in a configuration in which process p in state w1 is selected to move
on to w2, v has the new value p at the next moment, i.e., at time now+dt.
Formula FischerAssumption ensures that all processes in state w1 leave for
w2 before it is too late, i.e., before time d1 has passed since v=noProc has
been checked; otherwise, the mutex property might be invalidated.
Formally, we will use the assumption by showing that for all system behaviors
of the ASM for which FischerAssumption is valid, the mutual exclusion
property holds, which we describe by the following formula:
FischerMutex =def ∀(p, q ∈ Proc) : s(p)=s(q)=cr → p=q
Now we are ready to formulate the main theorem:
Theorem 13.2.1. All ASM-runs starting in the state fulfilling FischerIni-
tial, allowed by FischerRule with d1<d2 and fulfilling invariantly Fis-
cherAssumption fulfill invariantly FischerMutex.
We prove the theorem with completely discrete means, by finding an in-
ductive invariant of the system which implies FischerMutex. The hard part,
as is typical in proving invariants of discrete systems, is in finding an ade-
quate inductive invariant, i.e., a state property which is fulfilled by the initial
condition, which is preserved by each transition of the system, and which im-
plies the property to be shown to be invariant [MP95]. We use the following
idea for constructing an inductive invariant: We see the development of the
whole system as proceeding cyclically through four phases:
– The system is passive. We describe this phase by the following formula:
PhPassive =def
∧ ∀(p ∈ Proc) : s(p) ∈ {nc,rv,w2}
∧ v=noProc
Processes are non-critical (nc), just reading the variable (rv), or waiting to
be allowed to re-check the variable (w2). v=noProc implies that processes
in state w2 will have to pass through rv again before they get a new chance
to access their critical sections.
13.2 Specification and Proof of the Mutex Property 135
FischerInductive =def
∨ PhPassive
∨ PhFillingW1
∨ PhEmptyingW1
∨ PhUsingResource
Several lemmata will be used to establish the validity of the following formu-
las. Let us denote by rule[c] the set of configurations reachable from con-
figuration c by one application of rule rule, and let us denote by [[formula]]
the set of all configurations in which formula holds.
LemInitial =def
FischerInitial → FischerInductive
LemOnlyTime =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
incremTime[c] ⊆ [[FischerInductive]]
LemEnterrv =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
enterrv[c] ⊆ [[FischerInductive]]
LemEnterw1 =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
enterw1[c] ⊆ [[FischerInductive]]
LemEnterw2 =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
enterw2[c] ⊆ [[FischerInductive]]
LemResign =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
resign[c] ⊆ [[FischerInductive]]
LemEntercr =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
entercr[c] ⊆ [[FischerInductive]]
LemExitcr =def
∀(c ∈ [[FischerInductive ∧ FischerAssumption ∧ d1 < d2]]) :
exitcr[c] ⊆ [[FischerInductive]]
LemMutexImplied =def
FischerInductive → FischerMutex
LemInital claims that FischerInductive holds in the start configurations.
LemMutexImplied claims that the inductive property implies the mutex-
property, and the other lemma-formulas claim for each possible transition
of the system that from an inductive configuration which fulfills the assump-
tion, an inductive configuration is reached. We now proceed to prove the
lemmata given above.
13.2 Specification and Proof of the Mutex Property 137
Proof (Proof of LemEntercr). The only phase in which rule entercr is not
equivalent to incremTime is PhEmptyingW1. In order to move process p to
state cr, enough time must have been spent: the formula now>tw(p)+d2 must
be true; p=v must also hold. We will demonstrate that this implies that no
process is in w1 under these conditions, the only problematical consequence
from PhUsingResource under these conditions.
now>tw(p)+d2 and v=p implies now>tw(v)+d2. Since d2 is larger than
d1 and tw(v) is larger than tr(p) for processes p in w1, this means that
now>tr(p)+d1 for processes in w1. Together with FischerAssumption, this
implies that there is no process in w1 when a process leaves w2 for cr.
Proof (Proof of LemExitcr). Rule exitcr can only be non-equivalent to rule
incremTime in phase PhUsingResource, and it moves the system obviously
into phase PhPassive
Proof (Proof of LemMutexImplied). LemMutexImplied claims that inductive
configurations fulfill the mutex property. Only phase PhUsingResource, has
to be considered, since only in this phase there can be a process in state cr.
Since any process in state cr must have id v, this implies that in PhUsin-
gResource, exactly one process is in state cr – the mutex-property.
Now, we can prove the main theorem:
Proof (Proof of main theorem). The formula FischerInductive is induc-
tive for initial condition FischerInitial and rule FischerRule, under
the assumptions d1<d2 and FischerAssumption, by the lemmata LemIni-
tial, LemOnlyTime, LemEnterrv, LemEnterw1, LemEnterw2, LemResign, Le-
mEntercr and LemExitcr, and FischerInductive implies FischerMutex by
lemma LemMutexImplied. Thus, FischerMutex is an invariant of the system.
Perhaps it might seem strange that the infinitesimality of dt does not enter
the proof. The fact that dt can be chosen infinitesimally is only relevant in two
regards: for the plausibility that the ASM given describes the Fischer protocol
faithfully, and, more specifically, for the plausibility that the assumption that
processes having read v as noProc write v before time d1 has been passed is
properly formalized as FischerAssumption. More exactly, we have to assume
that no matter how many processes there are, there are enough time steps in
phase PhFillingW1 for as many of them to enter w1, and there are enough
time steps so that each of them can leave state w1 before its timer runs
out. This can be made formal by requiring that the specification, i.e., the
program together with FischerAssumption, is not contradictory, since the
latter would mean that the main theorem holds only vacuously.
13.4 Summary 139
13.4 Summary
there exist enough tokens in the current marking so that they all can be fired
synchronously; or (c) a maximal such set of transitions might be fired. The
latter dynamics is the “maximal progress dynamics”. The dynamics in (a) is
adequate if it is assumed that firing a transition takes very short time and
it is not relevant if the processes modelled by some transitions perform their
work (partially) overlapping. (b) expresses synchronous execution of any set
of transitions so that enough tokens exist in the pre-places of all the transi-
tions in the set, and (c) is a variant of (b) in which each transition is taken as
early as possible, where we must deal with the case that a transition t might
be in (dynamic) conflict with a set of transitions st, i.e., while st might be
fired and t might be fired alone, it might be the case that st ∪ {t} can not be
fired because there are not enough tokens for all these transitions at once. In
general, the use of variant (c) reduces the nondeterminism of variant (b) quite
considerably, at least in states which admit a large number of non-conflicting
transitions to be taken.
To model a net as an ASM, we assume that the vocabulary contains the
static unary predicates P and T characterizing finite effective sets, a static
binary function E : P × T ∪ T × P → N0 ; the dynamic state component is
modelled by a dynamic marking function m : P → N0 , which is initialized
as the initial marking. The interleaving dynamics is described by the rule in
Fig. 14.1. enabled(t) expresses if a transition t can be taken. If no transi-
tion can be taken, the CHOOSE rule is equivalent to a HALT rule, and if some
transition can be taken, one of the enabled transitions is chosen and the new
values of all places are computed.
InterleavingNetDynamics =def
CHOOSE(t:T):enabled(t) IN
FORALL(p:P) DO
m(p) := m(p) - E(p,t) + E(t,p)
MaximalProgressNetDynamics =def
CHOOSE(st ∈ P(T )):maximalSetEnabled(st) IN
FORALL(p:P ) DO
m(p) := m(p) - t∈st
E(p,t) + t∈st
E(t, p)
setEnabled(st) ⇔def
st
= {} ∧ ∀(p:P ):m(p)≥ t∈st E(p, t)
maximalSetEnabled(st) ⇔def
∧ setEnabled(st)
∧ ¬∃(st1 ∈ P(T )):
∧ setEnabled(st1)
∧ st⊆st1
∧ st1
=st
Fig. 14.2. A rule capturing the maximal progress dynamics of a discrete place-
transition net.
the form [0, 0] and the second by a point interval expressing the duration
of the work of the modelled process. Two new further places for each timed
transition to be simulated are used to model the state of the transition, i.e.,
if it is currently working or not, and the function E is defined for these
new places so that the start transition can only be fired if the transition is
currently passive. Note that in this simulation, one process of the original
application is modelled by several transitions and additional places of the
time net.
InterleavingTimeNetDynamics =def
IF (∃(t:T):mustStartWork(t) ∨ mustStopWork(t))
THEN DoDiscreteStep
ELIF (∃(t:T):canStartWork(t) ∨ canStopWork(t))
THEN OR DoDiscreteStep
OR SKIP
ELSE SKIP
canStartWork(t) ⇔def
∧ now - enabledSince(t) ≥ reactionTimeLB(t)
∧ now - enabledSince(t) ≤ reactionTimeUB(t)
mustStartWork(t) ⇔def
now - enabledSince(t) = reactionTimeUB(t)
canStopWork(t) ⇔def
∧ now - workingSince(t) ≥ workingTimeLB(t)
∧ now - workingSince(t) ≤ workingTimeUB(t)
mustStopWork(t) ⇔def
now - workingSince(t) = workingTimeUB(t)
Fig. 14.3. An STASM rule capturing the interleaving dynamics of a doubly timed
net (part 1).
DoDiscreteStep =def
CHOOSE(t:T):canStartWork(t) ∨ canStopWork(t) IN
IF canStartWork(t)
THEN
|| enabledSince(t) := ⊥
|| workingSince(t) := now
|| FORALL(p:P) DO m(p) := m(p)-E(p,t)
=t DO
|| FORALL(t1:T):t1
IF ∧ enabledSince(t1)
=⊥
∧ (∃(p:P):m(p)-E(p,t)<E(p,t1))
THEN enabledSince(t1) := ⊥
ELSE SKIP
ELSE
|| workingSince(t) := ⊥
|| FORALL(p:P) DO m(p) := m(p)+E(p,t)
|| FORALL(t1:T) DO
IF ∧ enabledSince(t1)=⊥
∧ (∀(p:P):m(p)+E(p,t)≥E(p,t1))
THEN enabledSince(t1) := now
ELSE SKIP
Fig. 14.4. An STASM rule capturing the interleaving dynamics of a doubly timed
net (part 2).
checked if with the new tokens produced by t finishing its work, t1 switches
from disabled to enabled. This is the case if currently, enabledSince(t1) is
undefined, but with the marking in the next state, all pre-places of t1 have
enough tokens for t1 to be taken. In this case, the enabledSince time of t1
is set to the current time, which is equal to that of the next state since a
discrete step is done.
MaxTimeNetDynamics =def
CHOOSE(st1:P(T )):maxStartWork(st1) IN
CHOOSE(st2:P(T )):maxStopWork(st2) IN
IF st1 ∪ st2 = {} THEN SKIP
ELSE
|| FORALL(p:P) DO
m(p) := nextMarking(p,st1,st2)
|| FORALL(t:T) DO
IF t ∈ st1 THEN workingSince(t) := now
ELIF t ∈ st2 THEN workingSince(t) := ⊥
ELSE SKIP
|| FORALL(t:T) DO
IF t ∈ st1 THEN enabledSince(t) := ⊥
ELIF ∧ enabledSince(t)=⊥
∧ nextMarkingEnabled(t,st1,st2)
THEN enabledSince(t) := now
ELIF ∧ enabledSince(t) = ⊥
∧ NOT halfNextMarkingEnabled(t,st1)
THEN IF nextMarkingEnabled(t,st1,st2)
THEN enabledSince(t) := now
ELSE enabledSince(t) := ⊥
ELSE SKIP
Fig. 14.5. An STASM rule capturing the maximal progress dynamics of a doubly
timed net (without derived functions).
If the union of the transitions for which some discrete step is to be per-
formed is empty, just a SKIP is performed, which means that time may flow.
Otherwise, three statements are performed in parallel. The first updates the
marking of the places; the second updates the workingSince-values for the
transitions which start or stop working. The third is responsible for com-
puting necessary changes of the enabledSince-times for all transitions. For
transitions which start work, the time is reset to the undefined value; for
transitions which are currently not enabled but are after the current step,
this value is set to the current time; and for transitions which are currently
enabled, but are disabled by the next half-step (where we assume that first,
the tokens of started transitions are taken away, and then, the tokens of
stopped transitions are added; other alternatives exist, and no alternative is
the obviously best choice, so our decision might be called arbitrary), it is
checked if they are enabled after the next full step: If they are, the value is
set to the current time; otherwise, it is undefined.
The derived functions in Fig. 14.6 describe important conditions and func-
tions. maxStartWork defines, for a set of transitions, if they can start working
together in a maximal progress dynamics. canStartWorkTogether defines,
for a set of transitions, if there are enough tokens in the places so that all
transitions can be fired synchronously. maxStopWork is the analogue of maxS-
tartWork for stopping work. nextMarkingEnabled checks, for a transition
14.3 STASM Models of Doubly Timed Nets 149
maxStartWork(st) ⇔def
∧ st ⊆ T
∧ canStartWorkTogether(st)
∧ ∀(t:T):
mustStartWork(t)
→
(t ∈ st ∨ ¬ canStartWorkTogether(st ∪ {t})
canStartWorkTogether(st) ⇔def
∧ ∀(t:st):canStartWork(t)
∧ ∀(p:P): t:st E(p, t) ≤ m(p)
maxStopWork(st) ⇔def
∧ st ⊆ T
∧ ∀(t:st):canStopWork(t)
∧ ∀(t:T): mustStopWork(t) → (t ∈ st)
nextMarkingEnabled(t1,st1,st2) ⇔
def
∀(p:P):m(p) - t∈st1
E(p,t) + t∈st2
E(t,p) ≥ E(p,t1)
halfNextMarkingEnabled(t1,st1) ⇔def
∀(p:P):m(p) - t∈st1
E(p,t) ≥ E(p,t1)
Fig. 14.6. Derived functions of the STASM rule capturing a maximal progress
dynamics of a time net.
t1, a set st1 of transitions which start work and a set st2 of transitions
which stop work, if t1 will be enabled after the transition. halfNextMarkin-
gEnabled determines, for a transition t1 and a set st1 of transitions, if after
taking away the tokens needed by the transitions in st1 from the current
marking, t1 is enabled or not.
t1: 1,1/0,0
t2: 1,1/0,0
t3: 2,2/0,0
Fig. 14.7. A doubly timed net for which interleaving dynamics and maximal
progress dynamics are essentially different.
(0, 2; 0, 0, 0; ⊥, ⊥, ⊥)
↓1
(1, 2; 0, 0, 0; ⊥, ⊥, ⊥)
↓ ({t1, t2}, {})
(1, 0; ⊥, ⊥, ⊥; 1, 1, ⊥)
↓ ({}, {t1, t2})
(1, 2; 1, 1, 1; ⊥, ⊥, ⊥)
↓1
(2, 2; 1, 1, 1; ⊥, ⊥, ⊥)
..
.
Fig. 14.8. Start of the configuration sequence of the net in Fig. 14.7 with a maximal
progress dynamics.
splitting a time step into several time steps, or by unifying neighbouring time
steps. The configuration sequence in Fig. 14.8 is the only possible, where steps
labeled with reals represent time steps of the given length, and steps labeled
with pairs of transition sets represent discrete actions in which the transitions
in the first set start working, and transitions in the second set stop working.
The behavior repeats after the first three steps, which means that transition
t3 is never fired: it is always preempted by the common firing of transitions
t1 and t2.
Figure 14.9 is the start of a configuration sequence admitted by the inter-
leaving dynamics. This system is not deterministic, and while there are se-
quences of transitions which together mimic the effect of the maximal progress
(0, 2; 0, 0, 0; ⊥, ⊥, ⊥)
↓1
(1, 2; 0, 0, 0; ⊥, ⊥, ⊥)
↓ ({t1}, {})
(1, 1; ⊥, 0, 0; 1, ⊥, ⊥)
↓ ({}, {t1})
(1, 2; 1, 0, 0; ⊥, ⊥, ⊥)
↓ ({t2}, {})
(1, 1; 1, ⊥, 0; ⊥, 1, ⊥)
↓ ({}, {t2})
(1, 2; 1, 1, 0; ⊥, ⊥, ⊥)
↓1
(2, 2; 1, 1, 0; ⊥, ⊥, ⊥)
↓ ({t3}, {})
(2, 1; 1, 1, ⊥; ⊥, ⊥, 2)
↓ ({}, {t3})
(2, 2; 1, 1, 2; ⊥, ⊥, ⊥)
Fig. 14.9. Start of a configuration sequence of the net in Fig. 14.7 with an inter-
leaving dynamics.
152 14. An ASM Meta-model for Petri Nets with Timing
dynamics (if we allow action refinement, i.e., what happens in one discrete
step in the maximal progress dynamics is allowed to happen in a finite se-
quence of discrete steps in the interleaving dynamics), there are also runs
for which no similar run of the maximal progress dynamics exist, e.g., runs
in which t3 is fired. This is possible because t1 and t2, which do their work
earlier than t3, might take turns, in which case there are always enough to-
kens in the place so that t3 does not become disabled, and, thus, after 2 time
units, t3 can be fired.
This illustrates that if semantics for timed Petri nets are investigated,
details like that when exactly an enabling time is reset can be very important;
this has not been defined unambiguously in the original definition of timed
Petri nets by Merlin and Farber.
t1: 0,1/0,1
t2: 1,2/0,1
Fig. 14.10. A non-punctual doubly timed Petri net which is not well-behaved.
Proof. Consider the doubly timed Petri net of Fig. 14.10. An STASM run
of this net can start with a time step of one time unit length, followed by
transition t2 starting to work, and this followed by transition t1 starting to
work. Now consider an NTASM with a step with dt which does not divide
1. The earliest time at which t2 can start work is dt ∗ dt 1
, which, by the
condition on dt, is strictly larger than 1. But this is too late for t1 to start
work. Thus, the described standard run can not be mimicked by an NTASM
run independently from the choice of the infinitesimal step width.
The counter-example to well-behavedness given in the last proof can be traced
back to the phenomenon that a state is reachable by a standard run – in
this case, it is the initial state – in which the two future “event windows”
overlap, but in just one point. This leads us to a sufficient condition on well-
behavedness for doubly timed Petri nets.
We will use the following strategy: Consider a standard STASM run
with finite activity. We will construct a simulating run of the correspond-
ing NTASM from this, and discover in doing so a sufficient condition for this
to be possible.
(1) We can associate, with each state q of the run, a set of next possible
discrete events E(q), i.e., transitions starting or stopping to work. For each
transition currently enabled, there is an interval of time when it can start its
work, and for each transition currently working, there is an interval of time
when it can stop work. These intervals are called the “execution windows”
I(e) of the associated events e ∈ E(q). Note that an enabled transition might
be disabled before it starts work, i.e., for these events, it is not really ensured
that they are taken in this run.
(2) We restrict our attention to standard states reachable by standard
STASM runs in which no event is urgent, i.e., in which time may be spent.
Let us fix such a state q. If there are no events associated with this state, the
system can only let time pass. Otherwise, we can single out an event eq with
a minimal upper bound of the associated execution window I(eq ).
(3) We now require from the system, and this is the sufficient condition
for well-behavedness, that the intersection of eq ’s window with the window of
any other event e waiting currently for execution is no point interval (i.e., is
154 14. An ASM Meta-model for Petri Nets with Timing
either empty, which implies that the window of e starts later than when the
window of e ends, or the intersection is an interval of strictly positive length).
We now investigate why this condition suffices for well-behavedness.
(4) Since there are only finitely many transitions in a doubly timed Petri
net, there are only finitely many events and associated windows, and the
intersection of the window of e with the windows of all events with which the
intersection is not empty is again no point interval. Let us call this non-empty
result of the intersection Iq .
(5) Consider a standard, finite activity STASM run of a doubly timed
Petri net. As any STASM run, it consists of a sequence of clusters consist-
ing of contiguous discrete events, and these clusters are separated by time
transitions. From this run, we construct a simulating run of the associated
NTASM system.
(6) The first step in this construction consists in replacing each time step
l
of real length l in the run by a sequence of dt time steps of length dt, and
by changing each discrete step by incrementing now by dt in it instead of
keeping now constant. If there exists a last infinite time step in the run, it
is replaced by an infinite sequence of dt-length time steps. This translation
yields a run in which now is incremented in each step by dt, but since the
discrete steps necessarily and the time step sequences possibly use more time
than they used in the STASM run, some events might occur too late in this
translation. This has yet to be detected and corrected.
(7) The second step in the construction of a simulating run consists of
this correction. Note that since the original STASM run was assumed to be
standard and have finite activity, the n’th cluster for all standard n only
contains a standard natural number of discrete transitions, and it is preceded
by a standard number of time transitions. Altogether, this implies that each
event takes place at most an infinitesimal later in the translated run than
in the original run. We now correct the position of each nth cluster (for all
standard n), if necessary. We can classify the events in a cluster into two sets:
(7.i) One set consists of events which became possible because some pre-
vious event in the cluster has taken place; these can be transitions starting to
work with a lower bound for reaction time of zero, and transitions stopping
to work with a working time of zero. For these transitions, the infinitesimal
delay can be no problem, since each positive infinitesimal lies in the execution
window of the event, which is assumed to have strictly positive length.
(7.ii) The other set consists of events with a preparation time which was
already running since the start of the time transition preceding the cluster.
This set might contain events which now are delayed unduly. If it does not,
we are ready with this cluster; if there are unduly delayed events, we move so
many dt-step time transitions from the sequence of time transitions in front
of the cluster to the sequence of time transitions behind the cluster that no
event is unduly delayed after this change. This operation moves the current
cluster a bit into the direction of the beginning of the run, an infinitesimal
14.4 Comparison of STASM and NTASM Semantics 155
which is just enough so that all events in the cluster take place not later
than in the corresponding STASM run. A consequence might be that by
this operation, events in later clusters might have become unduly delayed by
another infinitesimal; but this will be taken care of when we deal with the
later cluster.
(8) We only have to show that by the operation last described, the clus-
ter can not move so much that afterward, some events in it take place too
early. This can not happen because the intersection of execution windows has
standard non-zero length, which is larger than any infinitesimal, and because
the expanded cluster has also only infinitesimal length. Moving the expanded
cluster of discrete transitions in the direction of the beginning by an infinites-
imal can not move it out of the intersection of execution windows at the left
end if before the move, the cluster touched the right end. But the latter is
ensured because the right end must be touched if there was an event in the
cluster which took place too late, which is the precondition for the cluster
being moved.
We conclude:
Proposition 14.4.3. Let R be the rule of Figures 14.3 and 14.4, and fix a
doubly timed Petri net which is encoded by the initial state. This defines an
STASM. Let At be the set of states which is reachable by a standard finite run
of the STASM. If, for all q ∈ At , the intersection of the execution window
of an event with a minimal upper bound with any other execution window
associated with q does not form a point interval, R is well-behaved for the
start state defined by the doubly timed Petri net under consideration.
canStartWork(t) ⇔def
now - enabledSince(t) ≥ reactionTimeLB(t)
mustStartWork(t) ⇔def
now - enabledSince(t) ≥ reactionTimeUB(t)
canStopWork(t) ⇔def
now - workingSince(t) ≥ workingTimeLB(t)
mustStopWork(t) ⇔def
now - workingSince(t) ≥ workingTimeUB(t)
NTASM system, the steps happen an infinitesimal later than the correspond-
ing steps in the STASM dynamics. Note that the STASM interpretations of
the original rule and of the variant define the same runs:
Proposition 14.4.4. Let R be the rule of Figures 14.3 and 14.4, and let R
be the variant rule with the definitions of Fig. 14.11. For definitions of static
symbols and of initial conditions for doubly timed Petri nets, the runs of [[R]]h
and [[R ]]h are the same.
Proof. (I) Consider a run of [[R]]h from the start state. (a) The discrete steps
consist of some transition t starting or stopping to work. If in some state, [[R]]h
allows t to start or stop work, also [[R ]]h allows this (since the can-conditions
are weaker in R than in R). (b) And if, in some state, the STASM semantics
of R admits a time transition of some length, i.e., no transitions becomes
urgent during that time, the same is true for the STASM semantics of R
from that state, since the states in which a transition is urgent with respect
to R but not with respect to R can not be reached by a discrete transition,
and by a time transition from a reachable state it could only be reached
from another state in which the transition was already urgent, which can
not happen because of the urgency, which means that these states are not
reachable in a run of [[R ]]h . (c) Thus, each R-run is also an R -run.
(II) Conversely, consider a run of [[R ]]h from the start state. (a) Here, too,
the discrete steps consist of some transition t starting or stopping to work;
but there are states in which R admits a discrete step in which R does not
admit it, namely: if the upper bound of the time for the transition to take
place has passed. But since these states are not reachable (such a state can
not be reached by a discrete step, and before such a state could be reached
by a time step, the transition would become urgent), this is irrelevant. (b)
If, in some state, the STASM semantics of R admits a time step of some
length, i.e., no transition becomes urgent for this time, the same is true for
the STASM semantics of R, since the states in which a transition is urgent
14.4 Comparison of STASM and NTASM Semantics 157
q r ⇔def
∧ q standard
∧ d(q, r) 0
∧ q reachable by [[R ]]h from the start state
∧ ∀(p ∈ P ) : q(m(p)) = r(m(p))
∧ ∀(t ∈ T ) : q(enabledSince(t)) =⊥
→
∧ r(enabledSince(t)) =⊥
∧ q(now - enabledSince(t)) ≤ r(now - enabledSince(t))
∧ ∀(t ∈ T ) : q(workingSince(t)) =⊥
→
∧ r(workingSince(t)) =⊥
∧ q(now - workingSince(t)) ≤ r(now - workingSince(t))
The most interesting consequence probably is that the time which has passed
since a transition started its reaction time or its work might be an infinitesimal
longer in r than in q. This is because we have to allow that the infinitesimal
discretization might come an infinitesimal too late.
We claim: This predicate fulfills the conditions of (A). Together with (B),
this implies that R is well-behaved.
(C.i) Assume that the STASM system admits a standard discrete step
a from q. a represents a transition t starting or stopping to work. Let us
consider the first case and the second case in that order. (C.i.a) If t can start
work in q by an STASM step, t can also start work in a state r with q r. This
start is represented by an action a so that d(a, a ) 0 and for the reached
states q and r , q r holds:
– If q and a are standard, then q = q[a] is standard.
– d(q, r) 0 and d(a, a ) 0 implies d(q[a], r[a ]) = d(q , r ) 0.
– If q is reachable in the STASM system, also q[a] is reachable.
– The (initially identical) markings of q and r are changed in an identical
way.
– Starting t can at most disable some t ∈ T , i.e., the condition on
enabledSince is not falsified.
– In the transitions, workingSince changes only for t, and in the follower
states we have
q (now - workingSince(t)) = 0 and r (now - workingSince(t)) = dt.
This completes the proof for the case that a represents a start of work of a
transition.
(C.i.b) If t can stop work in state q, the reasoning is similar to the previous
case, only for newly enabled t ∈ T , q (now - enabledSince(t)) = 0 and
r (now - enabledSince(t)) = dt, and workingSince is only changed, for
t, to undefined. This completes the proof for the case that a represents a stop
of work of a transition.
14.5 Summary 159
(C.ii) Assume that the STASM system admits a standard time step of
length l from q, i.e., for all l with 0 ≤ l < l, υ ∈ [[R ]](q[now:=now+l]), or: for
no t ∈ T , t must start or stop work in these states. We call such a transition
“urgent”. Let us consider the start case; the stop case is similar.
(C.ii.a) If, after time l waiting from state q, no transition is urgent, the
same is true for time l + δ for an infinitesimal δ ≥ 0. Thus, [[R ||now:=now+dt]]
can do dtl time steps from r, the two behaviors leading to states q and r
with q r .
(C.ii.b) If after time l, some non-empty set T of transitions become ur-
maxt∈T (r(x(t))−q(x(t)))
gent, the NTASM can do n = dt time steps from r,
where x(t) is the term now-enabledSince(t) for transitions t which must
start work, and x(t) is the term now-workingSince(t) for transitions t which
must stop work after time l has passed starting in state q. Obviously, n∗dt l,
i.e., the sequence of n NTASM steps simulates the STASM time step, and for
the reached states q and r , q r holds.
14.5 Summary
Timed and hybrid automata are formalisms for the description of real-time
systems which are designed primarily to make algorithmic analysis possible
[ACD93, AD94, ACH+ 95]. Both formalisms are based on the following ideas:
– Each system component which can change both discretely and continuously
is modelled by a real-valued variable.
– The different control states of the system are modelled by a finite set. Each
of the states in this finite set is associated with an invariance predicate over
the continuous variables, and with a predicate restricting possible changes
of these variables with respect to time. The time change predicates define
in which way a variable may change during the time when the system is in
a control state, and the invariance defines how long the system may stay in
a control state: The state must be left before or as soon as the invariance
becomes false.
– A transition between two states is labeled with a guard predicate on the
continuous variables, and with a discrete-change predicate involving primed
and non-primed versions of the continuous variables. A transition from one
state to the other may only be taken if the guard is true, and if it is taken,
the continuous variables may change as described by the discrete change
predicate.
– Several such automata can be combined by using CSP-like labels at the
transitions: One transition with a label can only be taken if each parallel
automaton which has the label in its alphabet also performs a transition
with the same label.
In hybrid automata, as predicates for the definition of invariants, derivations,
guards and discrete changes, conjunctions of strict and non-strict inequalities
of linear functions of the continuous variables are allowed. The coefficients
used in the definition of the linear functions of the continuous variables are
required to be integers. Inequalities of linear expressions involving rational
numbers can be converted to an equivalent form with integer coefficients in
the obvious way.
The tool HyTech [HHWT95] allows reachability checks for systems de-
scribed with this formalism. A variant formalism allowing the description of
modules, instantiation and hierarchy has been developed by the author and
a colleague [BR98, BR99, BR00b, BR00a, BR01].
AUTOMATON: the partial automata out of which the whole system is composed
FORMULA: formulas involving variables, for describing invariants, guards and ad-
missible derivations
FORMULA2: formulas involving primed and unprimed variables, for describing ad-
missible discrete changes
TRANS: transitions between states
P(TRANS): sets of transitions between states
STATE: the disjoint union of states of all automata
SYNC: synchronization labels
VA: value assignments to variables
Fig. 15.1. Sub-universes of the STASM expressing the semantics of hybrid au-
tomata.
cur_va =def
va+(now-last_discrete_step_at)*vad
transition_possible(t,s) ⇔def
∧ sync(t)=s
∧ active(from(t))
∧ fulfills(cur_va, guard(t))
next_va_possible(v,t) ⇔def
∧ fulfills2(cur_va, v, disc_step(t))
∧ fulfills(v, inv(to(t)))
the formula. “*” is used for time intervals and value assignments interpreted
as derivations: if the VA argument expresses the changes to variables in one
time unit, then the result expresses the changes after the number of time
units as given by the REAL argument. “+”, if applied to value assignments,
adds the values component-wise.
In Fig. 15.4, the derived function “cur_va” is defined which repre-
sents the current value assignment. This is the only place where the static
functions “*” and “+” on value assignments are used. The predicate
“transition_possible(t,s)” expresses if transition t can be taken and syn-
chronizes with s, and “next_va_possible(v,t)”defines if v is a possible next
value assignment if transition t is taken.
mainRule:
OR timeRule
OR discreteStepRule
timeRule:
IF ∀(s ∈ STATE) : active(s) → fulfills(cur_va, inv(s))
THEN SKIP
ELSE HALT
discreteStepRule:
|| last_discrete_step_at := now
|| OR unsyncedDiscreteStepRule
OR syncedDiscreteStepRule
Fig. 15.5. The top-level rules defining the dynamics of hybrid automata.
unsyncedDiscreteStepRule:
CHOOSE(t : TRANS) : transition_possible(t, ⊥) IN
CHOOSE(v : VA) : next_va_possible(v, t) IN
CHOOSE(d : VA) : fulfills(d, der(to(t))) IN
|| va := v
|| vad := d
|| moveRule(t)
syncedDiscreteStepRule:
CHOOSE(T : P(TRANS))IN
∧ T
= {}
∧ ∀(t, t ∈ T ) : automaton_of(t) = automaton_of(t ) → t = t
∧ ∃(s ∈ SYNC) :
∧ ∀(t ∈ T ) : transition_possible(t, s)
∧ ∀(a ∈ AUTOMATON) : α(a, s) → ∃(t ∈ T ) : a = automaton_of(t)
IN
CHOOSE(v : VA) : (∀(t ∈ T ) : next_va_possible(v, t)) IN
CHOOSE(d : VA) : (∀(t ∈ T ) : fulfills(d, der(to(t)))) IN
|| va := v
|| vad := d
|| FORALL(t ∈ T ) DO moveRule(t)
moveRule(t):
IF from(t)
= to(t)
THEN || active(from(t)) := FALSE
|| active(to(t)) := TRUE
ELSE SKIP
Fig. 15.6. Rules defining the details of the dynamics of hybrid automata.
x’=x
x<1
the following strategy is possible: each discrete step of the STASM system is
mimicked by a discrete step of the NTASM system resetting exactly the same
variables, and each time step of the STASM system of length l is mimicked
by dtl steps of the NTASM system. Using this strategy, we have to deal
with the problem that after a sequence of steps mimicking a time step might
take an infinitesimal longer, and in a discrete step, the variables not reset
also become by an infinitesimal larger in the NTASM system, while in the
STASM system, they stay the same.
Under which condition does it not matter if in the NTASM behavior,
variables have infinitesimally larger values that in the STASM behavior? We
propose to require the following:
Definition 15.3.2. A right-open timed automaton is a timed automa-
ton with the following restriction:
Let φ range over the guards and invariants of a timed automaton, and let
x range over its variables. If for all such φ and x, the conjuncts for x in φ
describe a standard right-open interval, then the timed automaton is called
right-open.
This restriction will allow us to prove:
Proposition 15.3.2. The rule R as defined by Figures 15.5 and 15.6 is well-
behaved for right-open timed automata.
Proof. We will use the same idea as in the proof of Proposition 14.4.5: We
define a predicate q q on state pairs so that each standard step of [[R]]h from
standard q to r can be mimicked by a (possibly empty) sequence of steps of
[[R||now:=now+dt]] from q to some state r with r r .
(A) Define by:
q q ⇔def
∧ d(q, q ) 0
∧ ∀x∈Vars q(cur_va(x)) ≤ q (cur_va(x))
(B) Consider q and q with q q , q standard. We will prove: (B.i) If [[R]]h
admits a time step of standard length l from q to r, then [[R||now:=now+dt]]
admits a sequence of dtl time steps of length dt from q to r with r r .
(B.ii) If [[R]]h admits a discrete step represented by update set u from q to r,
then [[R||now:=now+dt]] admits a discrete step represented by u simulating
u from q to a state r with r r .
(B.i) Assume that [[R]]h admits a time step of standard length l from q to
r. This means, by the definition of time steps of STASMs, that the change
from q to r can be accounted for only by continuous increase of now, i.e.,
by the flow of time, and in all configurations reached on this way (possibly
excluding r), [[R]] admits a SKIP step. This is only possible if in all these con-
figurations, all invariants of active states are fulfilled for the values of cur_va
reached during the time step (except possibly the last). Right-openness of the
timed automaton implies for the invariants that for standard values of cur_va
15.4 Well-Behavedness of Hybrid Automata 169
which fulfill all active invariants, it does not hurt if the values of some (or all)
variables are incremented by an infinitesimal: Also the value assignment com-
puted by such an operation fulfills all active invariants. Thus, if [[R]]h admits
a time transition of standard length l from q, then [[R||now:=now+dt]] admits
a sequence of dtl time-only steps from q ; and since this sequence of steps
takes at most an infinitesimal longer than l, and also in q , the cur_va-value
of all variables is at most an infinitesimal larger than in q, the same is true
for the reached state r in comparison to r, so that r r holds.
(B.ii) Assume that [[R]]h admits a standard discrete step with update set
u from q, leading to r. We have to show that this step can be mimicked by
[[R||now:=now+dt]] from q for any q with q q . u consists of some discrete
transitions being taken. The same transitions can be taken from q , (a) be-
cause the same states are active in q and q (because of d(q, q ) 0), and (b)
because of the right-openness of the guards of the transitions being taken,
so that it does not matter if the cur_va-values of some variables are an in-
finitesimal larger in q than in q. The resulting set of updates u is similar
to u. It remains to be shown that the two states reached are in -relation.
In the reached states r and r , cur_va-values of variables which have been
reset are both zero, and values of non-reset variables are in r , where time
has been incremented by dt in the discrete step, have increased by not more
than another infinitesimal from q , so that also for the reached states r and
r , we have r r .
(C) A standard induction on the length of STASM-runs yields the result.
there can be a problem with choosing values for the primed variables. Note
that is not necessarily a problem if the values chosen in the step to be sim-
ulated do not fulfill the inequalities with the slightly changed values for un-
primed variables, since it is possible to choose these value also slightly changed
(an infinitesimal larger for positive variables, and an infinitesimal smaller for
negative variables). Only neutral variables must be chosen as in the original
step.
Unfortunately, just knowing that unprimed variables might be a bit larger
or smaller in the original is not enough. Satisfiability of Φ might depend on
more specific properties of the unprimed variables. For example, let X be
a neutral variable, Y and Z positive variables, which have equal values in
the step to be simulated. Consider the discrete-step equation X = Z − Y
(more precisely, assume that X + Y ≥ Z and X + Y ≤ Z are elements
of Φ for the discrete step considered). This can be simulated if also in the
simulation, before the step Y = Z holds, but we can not guarantee this,
since we only know that Y and Z are at most by an infinitesimal larger than
zero in the simulation before the step, not that they are equal. This means
that investigations of satisfiability of discrete-step formulas would need more
specific restrictions of the hybrid automata considered.
We just point out two special cases of hybrid automata which admit in-
finitesimal discretization. One are right-open timed automata, for which the
rule is well-behaved; the other are hybrid automata in which for each discrete
transition, the set of potentially problematic formulas Φ is empty.
15.5 Summary
This chapter presents an NTASM semantics for timed and hybrid automata,
which is another approach to modelling timed and hybrid systems. It is
demonstrated that the concept of well-behavedness can be transferred to
this context as well. For timed automata, it is fairly simple to find a plau-
sible condition to ensure well-behavedness. For hybrid automata, this is a
bit more complicated, because the values of continuously changing variables
might become infinitesimally smaller or infinitesimally larger in the NTASM
variant because of the infinitesimally imprecise simulation. This means that
more cases have to be distinguished, and in our approach to simulation, more
restrictions are necessary. Again it is shown that concepts from the formalism
used for expressing the semantics are helpful in defining important properties
of models of the defined formalism.
16. A Production Cell with Timing
16.1 Introduction
Lewerentz and Lindner [LL95] designed a case study inspired from an indus-
trial application. This case study was often used for illustration of features
of different modelling formalisms for reactive systems.
We will use a case study similar to this, which also seems to be inspired
by industrial examples, in order to illustrate features of our approach in such
a more practical context.
In the case study by Lewerentz and Lindner, no timing properties were
specified; in a similar case study, defined by Lötzbeyer and Mühlfeld [LM96],
this changes. Interesting features of this second case study are the following:
– Variants of the system have to be taken into account by implementors;
Lötzbeyer and Mühlfeld do not define just one production cell but an ab-
stract scheme for a production cell which can be realized in different ways.
Specifically:
– The realized variants might have different global structure. There might
be one or two cranes for transporting blanks being worked an, and there
might be two or four processing machines which can be used for working
the plates.
– Each processing machine can be of one of two different types. (a) Oven-
type machines work on a blank as long as it is located in the machine;
working time can only be controlled by choosing the time interval be-
tween putting a blank into a machine and taking it out. The machines do
not have to be switched on or off, they are on all the time. (b) A drill-
or-press-type machine has to be switched on when a blank has to be
processed, and it is switched off automatically when the fixed processing
time has ended.
– Blanks have to be processed according to different programs, i.e., the se-
quence of processing steps is not fixed, but can be different for any blank
entering the system.
– Timing is relevant: Each blank may be associated with an upper bound for
the time of its being in the system, and for the oven-type processing units,
with a time interval defining upper and lower processing time.
L1
processing unit 1
processing unit 2
1
This assumption is not justified by the original task description, but it is plausi-
ble.
16.2 Task Description 175
In the figure, two processing units are depicted. Each has a sensor which
tells if it is working, and each has an actuator with which it might be switched
on or off; but oven-type machines are not supposed to be switched on or off
by the control program, and drill-or-press-type machines are only switched
on; they switch themselves off by themselves. Note that it is not fixed which
processing unit is of which type. The specification has to take this into ac-
count.
“L1” in the figure is the crane used for moving plates; it can be moved
in three directions. The x-direction is that from the feed belt to the deposit
belt, the y-direction is that from one processing unit to the other, and the
z-direction is the vertical direction, i.e., the crane can move up or down. Two
vertical positions are defined explicitly, a “lower” and an “upper” position.
In the lower position, the magnet gripper of the crane can pick up or drop
blanks; in the upper position, the crane can travel horizontally without that
collisions with belts or processing units can occur.
The variant with a different global structure just consists of two cranes
which are located in parallel, and of four processing units. See Fig. 16.2 of a
view from above.
The actuators to be driven by the control program are the following:
– Switch on/off the feed belt movement.
– Activate the code reader of the feed belt. After activation, the code reader
needs some (unspecified) time until the result is presented.
– Switch on processing unit i (i ∈ {1, 2} or i ∈ {1, 2, 3, 4}) for processing
units of drill-or-press type.
L1
y1
y2
L2
x1 x2 x3 x4 x5 x6 x7 x8
Fig. 16.2. Larger version of a flexible production cell and special crane positions,
mostly copied from [LM96].
176 16. A Production Cell with Timing
processing time for the processing unit s, where ∞ can be used as value for
an unbound maximal processing time3 . For drill-or-press-type processing
units, it may be assumed that the numbers for min and max are 0 and ∞,
respectively, and for oven-type machines, the max value can be assumed to
never be ∞.
We assume that the list ist not empty and each processing unit occurs at
most once in it4 .
– The third component is a Boolean value if the order of processing steps
is fixed by the list, or of any order can be chosen for the execution of the
steps.
– The fourth component is an element of N ∪ {∞} again. It denotes the
maximal time in seconds which the blank may spend in the system, i.e.,
from the moment the gripper takes it from the feed belt to the moment
the gripper puts it on the deposit belt.
The initial state of the system is defined by the feed belt movement switch
being off, the cranes are not moving, magnets are off and no blanks are
carried, and drill-and-press-type processing units are not operating5 . There
may be blanks in the system, which are just moved to the deposit belt6 .
Since in our approach, it is an invariant that at most one blank is in the
system-cum-deposit belt, the deposit belt can be assumed to be empty.
Several timing constants are used to describe the production cell.
– vxi , vyi and vzi describe, in meters per second, how quickly the crane
i or the gripper moves in the different directions. Positive and negative
acceleration times are neglected, i.e., it is assumed that these speeds are
instantly reached after a movement is initiated, and that the movement
instantly stops after a target position has been reached.
– pxi for i ∈ {1, . . . , 8} and pyi for i ∈ {1, 2, 3} describe positions in me-
ters. Their differences can be used to compute, together with the speeds,
traveling times from one position to another.
– height, in meters, is the distance between the lower and upper position of
the crane grippers; it is the same for all cranes.
– t stationi is the processing time in seconds for processing unit i, which is
of the drill-and-press type.
We use several assumptions which are not allowed explicitly by the original
task descriptions, but which seem sensible:
3
This interpretation is different from the original task specification, which is pre-
sumably false. In the original task specification, the minimal and maximal times
of the i-th list entry are presrcibed to be used for processing unit i, not for the
processing unit number s.
4
This assumption is not mentioned explicitly by the original task description.
5
The original task description says that no processing units are operating, but
this is in conflict with the fact that oven-type processing units are switched on
all the time.
6
The original task description does not define what to do with blanks which are
in the system in the initial configuration.
178 16. A Production Cell with Timing
– The feed belt must be switched off when a blank arrives at its end, and
a gripper magnet may only be switched off if the gripper is in the lower
position above a processing unit or a belt.
– Every blank taken from the feed belt will eventually be put on the deposit
belt.
– Blanks go through the processing units given in their programs; if the
program specifies that the order of the program list has to be respected,
this is the order used for the blank.
– Between the moment when a blank is picked up from the feed belt and the
moment it is put on the deposit belt, no more than the maximal allowed
system processing time as specified in its program may be spent.
– The minimal and maximal processing times in oven-type processing units
must be respected.
slower times suffice. Then, a repeated crane switching for movements is not
necessary; it only has to be ensured that the single crane switch necessary
can be done quickly enough.
– It might be assumed that each of the speeds of one crane is larger than or
equal to the corresponding speed of the other crane. Only crane one can
serve the feed belt and only crane two can serve the deposit belt.
We will not use any of these simplifications.
OperateFeedBelt =def
IF AND feedBeltIsOn
AND feedBeltSignalsBlank
THEN || SwitchFeedBeltOff
|| feedBeltIsOn := FALSE
ELIF AND NOT feedBeltIsOn
AND NOT feedBeltSignalsBlank
THEN || SwitchFeedBeltOn
|| feedBeltIsOn := TRUE
ELSE SKIP
Fig. 16.3. A rule for operating the feed belt of the system.
TPSystem =def
IF modeTP = cleaningUp
THEN IF blankInSystem
THEN CleanUp
ELSE modeTP := waitingForNextBlank
ELIF modeTP = waitingForNextBlank
THEN || MoveCraneOneToFeedBelt
|| IF AND craneOneAtFeedBelt
AND feedBeltSignalsBlank
THEN || ActivateCodeReader
|| modeTP := waitingForNextProgramAndDepositBelt
ELSE SKIP
ELIF AND modeTP = waitingForNextProgramAndDepositBelt
AND nextProgramAvailable
AND NOT depositBeltSignalsBlank
THEN || ComputeSchedule
|| modeTP := executingSchedule
ELIF modeTP = executingSchedule
THEN || ExecuteSchedule
|| IF scheduleHasFinished
THEN modeTP := waitingForNextBlank
ELSE SKIP
ELSE SKIP
Fig. 16.4. A rule describing the control program for the transport-and-processing
subsystem in an abstract fashion.
for the feed belt to become empty, and waiting for a new blank program
to become available. If all this is true, a scheduling for the blank program
is determined and its execution starts. As soon as the scheduling has been
executed to its end, the system starts waiting for the next blank again. The
derived symbol blankInSystem signals if there is a blank in some processing
unit or connected to some gripper. Rule CleanUp is supposed to remove a
blank from the system if on start, the system is not empty; it moves the
182 16. A Production Cell with Timing
blank just to the deposit belt. Rule MoveCraneToFeedBelt moves crane one
to the end of the feed belt, where the gripper is to stay in the upper position.
The derived symbol craneOneAtFeedBelt signals if the crane has arrived at
the feed belt. Rule ActivateCodeReader corresponds directly to an actua-
tor of the system. The derived symbol nextProgramAvailable signals if the
code reader has computed the next program to use. Rule ComputeSchedule
computes a new schedule for the transport-and-processing system.
A schedule is a finite list, the elements of which are executed in the order
given in the list; each element is either (a) an actuator to be activated when
that list element is reached, or (b) a condition on the sensors, meaning that
on reaching that list element, the control program waits until the condition
becomes true, or (c) a real number, meaning that when the list element is
reached, the system waits for the time given by the number before it proceeds
to the next element.
The schedule to be computed by ComputeSchedule will have to fulfill the
correctness and safety requirements for the system. As we assume that such
a schedule always exists, the task of ComputeSchedule is a possible one.
Rule ExecuteSchedule executes the current schedule, as described above
for the possible entries. When a schedule entry has been processed, it is
removed from the list. The derived symbol scheduleHasFinished signals if
the currently active schedule has been computed up to its end, by checking
if the list representing it is empty.
Only rule ComputeSchedule needs more discussion and refinement for the
different alternatives of the system. We consider an abstract version of this
rule. Figure 16.5 presents this abstract version; it describes which conditions
a schedule for a program has to fulfill. Symbol currentProgram designates
the program for which a schedule is to be computed. currentSchedule is to
contain the schedule which is being computed. processingTime(s) denotes,
for a schedule s, the time from the moment when the blank is taken from the
feed belt up to the time when it is put at the deposit belt. maxTimeToUse(p)
ComputeSchedule_Abstract =def
CHOOSE s:isScheduleForProgram(s,currentProgram) IN
currentSchedule := s
isScheduleForProgram(s,p) =
AND processingTime(s)≤maxTimeToUse(p)
AND setOfPUs(s) = setOfPUs(p)
AND FORALL (u:setOfPUs(s)):
AND minProcessingTime(u,p)≤processingTime(u,s)
AND processingTime(u,s)≤maxProcessingTime(u,p)
AND followOrder(p)→(listOfPUs(s) = listOfPUs(p))
Fig. 16.5. An abstract rule specifying the schedule for the current program.
16.6 Schedules for Variable-Order Programs 183
denotes the maximal time to use for the program p. setOfPUs yields the set
of processing units mentioned in a schedule or a program. minProcessing-
Time and maxProcessingTime yield, for a processing unit and a program,
the minimal and maximal admissible processing times, and processingTime
yields, for a processing unit and a schedule, how long the processing unit op-
erates on the blank for the schedule. followOrder extracts the information
from a program if the processing machines have to be used in the order given,
and listOfPUs yields the list of processing units in the order in which they
are mentioned in a schedule or in a program, where for a schedule, several
mentionings of the same processing unit are collapsed into one.
Any implementation of ComputeSchedule will have to replace the non-
constructive CHOOSE statement with a constructive variant so that the sched-
ule put into currentSchedule fulfills the same conditions as listed in the
abstract specification.
ComputeSchedule_Concrete =def
currentSchedule :=
IF followOrder(currentProgram)
THEN mkScheduleForFixedOrder(currentProgram)
ELSE mkScheduleForVariableOrder(currentProgram)
mkScheduleForVariableOrder(p) =def
LET S = {s|∃(q : PUPermutations(p)) :
s = mkScheduleForFixedOrder(q)
}
IN ({s ∈ S : ¬∃(t ∈ S) : processingTime(t) < processingTime(s)})
mkScheduleForFixedOrder(q) =def
IF systemHasOneCrane
THEN mkScheduleForFixedOrder_oneCrane(q)
ELSE mkScheduleForFixedOrder_twoCranes(q)
Fig. 16.6. Rule describing how a schedule for a program with a flexible ordering
of processing units is computed.
up again. Then, for each processing unit in the program, the same happens:
The crane is moved to the position of the processing unit; the gripper is
moved down; the magnet is switched off; for oven-type processing units, the
system waits for the minimal processing time as given in the program, while
for drill-or-press-type processing units, the processing unit is switched on
and it is waited until it has finished its work; remember that we assume
that the gripper may stay in the lower position during processing of a blank,
which is neither explicitly allowed nor explicitly forbidden by the original task
description. Then, the magnet is turned on again, and the gripper moves up
again. When there is no more processing unit to be worked with, the crane
moves to the deposit belt, lowers the gripper, switches the magnet off, and
moves the gripper up gain. The movement back to the feed belt is controlled
by the general control program described by rule TPSystem in Fig. 16.4.
Using the dot as denoting list concatenation (again using a prefix syntax
as for other associative operators), we can express the computation of the
schedule for a one-crane system as given in Fig. 16.7, where the correspon-
dence of list elements with actuators and sensors should be clear. Function
list creates a list from its argument(s). isOvenType(q) tells, for an element
of the list component of a blank program, if the processing unit to be used
is of the oven type; minTime fetches the minimal processing time given for
such an element, switchOnPU switches on the processing unit mentioned in
the list element, and isProcessing determines if the processing unit is cur-
rently processing some blank. isEmpty tells, for a list, if it is empty, and
emptySchedule is an empty schedule list. first and rest yield, for a non-
empty list, the first element and the list consisting of all elements but the
first one.
16.8 Executing the Current Schedule 185
mkInitSchedule =def
list(moveGripperDown(1), isGripperDown(1),
switchMagnetOn(1),
moveGripperUp(1), isGripperUp(1))
mkExitSchedule =def
list(moveCrane(1,x8), moveCrane(1,y2),
isCraneAt(1,x8) ∧ isCraneAt(1,y2),
moveGripperDown(1), isGripperDown(1),
switchMagnetOff(1),
moveGripperUp(1), isGripperUp(1))
mkPUSchedule(q) =def
. list(moveCrane(1,xpos(q)), moveCrane(1,ypos(q)),
isCraneAt(1, xpos(q)) ∧ isCraneAt(1, ypos(q)),
moveGripperDown(1), isGripperDown(1),
switchMagnetOff(1))
. IF isOvenType(q)
THEN list(minTime(q))
ELSE list(switchOnPU(q), ¬ isProcessing(q))
. list(switchMagnetOn(1),
moveGripperUp(1), isGripperUp(1))
mkProgramSchedule(p) =def
IF isEmpty(p)
THEN emptySchedule
ELSE mkPUSchedule(first(p)) . mkProgramSchedule(rest(p))
mkScheduleForFixedOrder_oneCrane(p) =def
. mkInitSchedule
. mkProgramSchedule(PUList(p))
. mkExitSchedule
Fig. 16.7. Computing the schedule for a program with a one-crane system.
We have yet to discuss if the schedule constructed here obeys the require-
ments; obviously, the order in which a blank is processed is as given in the
program for the blank. Requirements for processing times are also fulfilled
(this will be ensured by the executor rule of the schedule to be described
in the next section), as are the requirements regarding collision avoidance.
Finally, the maximal residence time of the blank in the system will not be
exceeded because this is the quickest possible schedule, and we assume that
the quickest possible schedule fulfills the residence time requirement.
ExecuteSchedule =def
IF isEmpty(currentSchedule)
THEN SKIP
ELSE LET s=first(currentSchedule),
t=rest(currentSchedule)
IN
IF isActuator(s)
THEN || ActivateActuator(s))
|| currentSchedule := t
ELIF isSensorPredicate(s)
THEN IF sensorPredicateIsTrue(s)
THEN currentSchedule := t
ELSE SKIP
ELSE IF waitUntilMoment = ⊥
THEN waitUntilMoment := now + s
ELIF now ≥ waitUntilMoment
THEN || currentSchedule := t
|| waitUntilMoment := ⊥
ELSE SKIP
of rule TPSystem as given in Fig. 16.4. Figure 16.8 presents our approach. is-
Actuator and isSensorPredicate tell if a schedule element is an actuator
or a sensor predicate, respectively; a schedule element which is neither of
these is a real number representing a delay. If an actuator has been rec-
ognized, it is activated (rule scheme ActivateActuator is assumed to do
this), and the first element of the current schedule is removed. If a sensor
predicate has been recognized, it is checked if it is true (via the predicate
sensorPredicateIsTrue); if it is, the entry is removed from the schedule;
otherwise, nothing is done, i.e., the controller just waits. Finally, i.e., if the
first element of the schedules says that the controller should wait for some
time, it is checked if the moment when the waiting should end (waitUntil-
Moment, initialized with ⊥) has already been computed or not. If it has not
yet been computed, the computation is performed; and if it already has been
computed, it is checked if the control program already waited long enough;
when this is the case, i.e., when the current time is at least as large as the
moment up to which the system should wait, the entry is removed from the
schedule; otherwise, the system does nothing, i.e., it just waits.
Note that the STASM semantics of these rules fulfill the timing require-
ments quite obviously. In the NTASM semantics of the rule, waiting times
might be by an infinitesimal longer than given in the program, because of
the infinitesimal discretization, and because of the fact that activating an
actuator or evaluating a sensor predicate takes at least time dt. We deem
such an infinitesimal deviation from the specified timing acceptable, which
16.9 Two Cranes, Order of Processing Units Fixed 187
16.9.2 The Active and the Passive Crane and Their Tasks
We call the crane which is responsible for moving the blank during a segment
the active crane of the segment. The other crane is called passive. The latter
mkScheduleForFixedOrder_twoCranes(p) =def
LET S = {s|∃(q : EvenPUSegmentations(p)) :
s = mkScheduleForSegmentation(q)
}
IN ({s ∈ S : processingTimeOk(s,p) ∧ ovenTimesOk(s,p)})
Fig. 16.9. Computing the schedule for a program with a two-crane system.
16.9 Two Cranes, Order of Processing Units Fixed 189
term is slightly misleading because also the passive crane has specific tasks,
as will be described shortly. In order to be specific, let us say that a segment
ends precisely in the moment the active crane drops the blank at the last
position of the segment.
Let us now consider the tasks of the two cranes during a segment.
During a segment, the active crane (which, at the beginning of the seg-
ment, has not yet gripped the blank) is responsible for moving to the place
where the blank will be taken up, for taking up the blank from its place, for
moving it to its first destination, and for putting it down at its destination; if
the segment has not yet ended, the active crane then waits for the processing
of the blank being finished, picks up the blank again and continues as before.
After the transport of the blank to the place marking the end of a segment
has been accomplished and there is another segment in the schedule, the re-
sponsibilities change. Altogether, during a segment, the behavior of a crane
is similar to the case with one crane; a difference is that possibly, the other
crane is not yet far enough out of the way, so that before the active crane
starts a movement into the direction of the passive crane, it has to be ensured
that the distance to the other crane will not become too small. This can be
done during the planning phase, since we assume that the system runs error
free.
A formerly active, now passive crane has two tasks: Firstly, it has to get
out of the way so that the formerly passive, now active crane can do its work
without collision. Secondly, it has to assume a sequence of positions during
its waiting time so that it can resume responsibility again quickly, as soon as
it should be required to do so. Thirdly, if (and when) its time has come to
become active again, it has to move towards the processing unit from where
it has to take up the blank, i.e., to the first position of the segment in which
it is (or will be) again active.
Before work on a blank starts, the passive crane might have to assume
a special position or even start moving from there in order to take over its
responsibility from the other one quickly enough when the residence time of
the blank is running, i.e., before the active crane picks up the blank from the
feed belt.
mkTargetPosition(q) =def
IF length(q) = 1
THEN mkFeedBeltPosition
ELSE mkPosition(xIdx(lastPU(first(q))),
yIdx(lastPU(first(q))))
mkRestingPosition(q,crane) =def
IF length(q) = 1
THEN mkFeedBeltPosition
ELSE mkPosition(xIdx(lastPU(first(q)))+(crane=1 ? -1 : 1),
yIdx(lastPU(first(q))))
segment, always called with crane one. The computation of the two positions
is different if we deal with the last segment in a segmentation or with another
segment. In the first case, we are computing the positions for crane one at
the end of a schedule; it seems sensible to use the position over the feed belt
for both. In the other case, the positions are defined by the position of the
last element of the currently executed segment in the segmentation: this is
the target position, and for the resting position, the y index is the same, and
the x index is, for crane one, by one less than the index of the last processing
unit in the current segmentation, and by one larger than this in the other
case. Figure 16.10 defines the functions.
The resting position is assumed by the passive crane before a fresh blank
is picked up from the feed belt, and after a crane has dropped the blank at the
end of its activity during a segment and the other has taken over. A special
case is crane two after it has completed the last segment for a blank: In this
case, there is no resting position defined for the crane, and it just moves its
gripper up and waits until a next blank reaches the end of the feed belt.
As soon as a segmentation to use has been determined, a resting position
is defined and crane two will move there during the initialization of the system
for the work on the next segmentation, before the new blank to be processed is
picked up. The initialization of the transport-and-processing system consists
just of crane two moving to its resting position for the first segment (see
Fig. 16.11). The global controller rule TPSystem deals with the requirement
that crane one moves to the feed belt before a schedule starts.
mk2CranesInitialization(q) =def
LET r = mkRestingPosition(q,2) IN
list(
moveCrane(2,xPos(r)), moveCrane(2,yPos(r)),
isCraneAt(2,xPos(r)) ∧ isCraneAt(2,yPos(r))
)
down1
wait1
magnet on
up1
start_y_movement_to_next_PU
wait2
x_move_to_next_PU
down2
yes no
finishing segment?
drop_first_segment
drop_first_PU
wait3
start_processing2 start_processing1
up2
start_y_movement_to_resting_position
x_move_to_resting_position
no yes
wait4 finished work? stop
x_move_towards_target
no yes
x at target? wait5
is moved downwards. The state is left when the gripper has reached the
lower position.
This is also the state in which crane one starts its work after the initializa-
tion.
– When the gripper has reached the lower position, the crane must possibly
wait before it may pick up the blank. This phase is represented by state
wait1. There are three reasons why it might be necessary to wait: (a) If
the blank is in an oven-type processing unit, the minimal processing time
might not yet have been reached. In this case, the crane waits until the
minimal processing time has been reached. (b) If the blank is in a drill-or-
press type processing unit, the work of the processing unit might not yet
have been finished. In this case, the cranes waits until the processing unit
has finished its work. (c) If the blank is located on the feed belt (then the
active crane is necessarily crane one), it might be necessary to wait until
crane two has reached a position from where it can pick up the blank after
the first segment has ended as quickly as possible. If the second crane needs
more time from its resting position to its target position than is needed
for the first segment of the current segmentation, the second crane might
come later than necessary; to avoid that the total residence time is already
counting in such a case, crane one will wait until crane two is near enough.
– After the crane has waited long enough, it picks up the blank by switching
its magnet on, and then moving the loaded gripper up in state up1.
– When the gripper has reached the upper position, the movement in the
y-direction which is necessary in order to reach the position of the next
processing unit of the first segment of the segmentation is initiated. State
start y movement to next PU represents this; this state is immedi-
ately left for state wait2.
– Before the crane can start its x-direction movement into the direction of
the next position it has to check if the passive crane, which is currently
moving to its resting position, is far enough out of the way. If it is not, it
has to wait. This happens in state wait2.
– When it is ensured that the passive crane is far enough out of the way, the
active crane moves in the x-direction to the next position in the currently
executed segment. This movement happens in state x move to next PU.
– After the crane has reached its target position (both its x- and its y-
coordinate), it moves the gripper down again. State down2 represents
this phase.
– What happens next depends on the case if the current is the last transport
of the current segment, i.e., if the active crane is just finishing the current
segment. If this is not the case, no change of responsibilities has to take
place: The current program step is just stripped from the current segment
(in state drop first PU), the magnet is turned off, and possibly, the pro-
cessing unit is turned on. The latter happens in state start processing1.
After this, the computation continues in state wait1, which has already
been discussed.
16.9 Two Cranes, Order of Processing Units Fixed 193
(in state x move towards target). This state is left if that x-position
isreached.
– After the crane has reached the next position, it is checked if this is already
the x-coordinate of the target. If it is not, we might have to wait again until
the other crane leaves the next position where we have to go (again in state
wait4). If the target x-coordinate has been reached, we have to wait until
also the y-coordinate has been reached (state wait5), and then, the gripper
of the crane which now is becoming active again can start moving down
again (in the already discussed state down1).
This interpretation fixes most features of the schedule for a single crane
to be constructed. Only the waiting times to use in states wait1, wait2,
wait3 and wait4 deserve more discussion (see Sect. 16.9.5). Let us as-
sume that this problem has been solved; then, the derivation of a schedule
for a single crane from the flow diagram specification is straight forward,
but tedious. We will not do this here, but simply assume that a function
mkOneCraneScheduleForSegmentation(q,crane) has been defined which,
for a segmentation q and a crane number, yields the schedule for this crane.
It remains to be shown how these two schedules can be combined into one.
Our strategy is to insert, in each of both schedules, in front of each Boolean
expression on the sensors of the system, which implies a waiting time for the
schedule, this implied delay. These waiting times can be computed because
(a) the initial configuration (the one assumed by the system after the initial-
ization of the system for a blank program) is known, (b) the speeds of all
movements and the processing times in drill-or-press type processing units
are known, and (c) no sensors which are controlled from outside the system
occur in the constructed schedule for the cranes; the only sensors for which
such times could not have been computed are the ones of the feed belt and the
deposit belt, and both do not have to be dealt with by the work on a segmen-
tation – they are dealt with by the enclosing abstract control program. We
assume that a function addExplicitDelays(schedule1,schedule2,conf),
invoked with two schedules for the two cranes and the configuration of the
system from where to start, and yielding a pair of two schedules for the two
cranes, but without sensor occurrences, implements this strategy.
Note that ideally, i.e., if we assumed that the processing times and speeds
of the system components are exactly known, we could just drop the sensor
expressions from the schedules and get the same total behavior. The decision
not to remove the sensor expressions from the schedules reflects our decision
that this assumption would be too ideal.
The second (and last) step then consists of combining the two schedules.
Figure 16.13 describes how the pieces fit together. combineSchedules com-
putes the combination in a recursive fashion, by using any non-delay at the
start of one of the argument schedules first, and by using the minimum delay
if both schedules start with a delay step.
16.9 Two Cranes, Order of Processing Units Fixed 195
mkScheduleForSegmentation(q) =def
LET schedPair
= addExplicitDelays(
mkOneCraneScheduleForSegmentation(q,1),
mkOneCraneScheduleForSegmentation(q,2),
mkInitialConfiguration(q)
)
IN combineSchedules(first(schedPair),second(schedPair))
The only thing that remains to be determined are the waiting times in the
single-crane schedules for the two-crane system as defined in Sect. 16.9.4. We
use the state names from the diagram in Fig. 16.12 again and repeat, for
convenience, the reasons for the waiting times:
– Crane one might have to wait in state wait1 until crane two is near enough
before the blank is picked up from the feed belt and total residence time
starts running).
– A loaded crane might have to wait in wait2 some time before it transports
the blank to the next processing unit because the passive crane might not
yet have moved far away enough.
– A crane which is about to drop the blank at the end of a segment might
have to wait in state wait3 if the blank is to be dropped on an oven-type
processing unit and the other crane might be too slow to pick up the blank
again before the maximal processing time has been reached.
– A passive crane will typically have to wait in state wait4 before it may
start the movement to the next x-position in the direction of the processing
unit where it has to become active again.
196 16. A Production Cell with Timing
Note that when the waiting time computed for a state is negative (which
is not uncommon, as will be seen), the value zero has to be put into the
single-crane schedule, since the function combineSchedules does not handle
negative delays properly.
It is most convenient to start with discussing the waiting time in wait4.
How long must a passive crane wait until it may move one x-position in the
direction of its target? To be specific, let us assume that crane two is the
passive crane for which we compute the waiting time; the other case can be
reasoned about analoguously. Let us call the x-position of crane two xi ; since
its target position must be to the left, the next x-position to head for on its
way to the target is xi−1 ; we call this x-coordinate the intermediate target
of the passive crane (which before the last movement is at the same time the
final target). After it is started, the movement can not be stopped until that
x-position is reached. In order to avoid a collision with crane one, crane two
must wait so long that crane one will be on its way away from xi−1 when
crane two reaches that region, and will never come back again during its work
on the current segment.
In order to compute the time until crane one is far enough out of
the way up to the end of the work on a segment, we use a function
timeUntilLeft(q,crane,x,conf). For a segment q, a crane number, an x-
coordinate and a current configuration (conf), this function computes the
time up to the first moment in which the crane will start leaving the x-
coordinate given into the direction away from the other crane and never
come back again until it reaches the resting position to be assumed af-
ter the work on the current segment, all this under the assumption that
the waiting times in states wait1, wait2 and wait3 are zero. For exam-
ple, timeUntilLeft(q,1,xi−1,conf) is the time after which crane one will
have left the intermediate target if started from the configuration conf
and will not come back again until it has reached its resting position, and
timeUntilLeft(q,1,xi−1 − min_x_dist,conf) is the time after which crane
one will be far enough away from the intermediate target position so that a
collision with crane two at that position is avoided.
The time until the active crane has left some area is computed under the
(in general wrong) assumption that in the waiting states of an active crane
wait1, wait2 and wait3, no time is spent. We have to discuss why this can
not lead to problems:
– First, note that the value of the function is only relevant when the passive
crane is far enough out of reach, i.e., after the passive state has reached
its resting position, and during its careful approach to its target position;
this means that ignoring the waiting time in state wait2 can not lead to
problems, since also in a proper computation of waiting times, this situation
would lead to a waiting time of zero in this state.
– Second, note that not waiting in states wait1 and wait3 will not lead to
collisions, only to the possibility that the total processing time for a blank
16.9 Two Cranes, Order of Processing Units Fixed 197
will be longer than strictly necessary (for wait1), or that a blank is pro-
cessed longer in an oven than allowed (for wait3). These two problems will
be dealt with later, when the waiting times for these states are computed.
Let us now consider the case that crane two is slower than or as quick
as crane one in its x-movements. Then the optimal waiting time, i.e., the
time so that crane two reaches the target as quickly as possible without
danger of collision, is so that crane two reaches the x-coordinate xi−1 +
min x dist exactly when crane one leaves from xi−1 : in this moment, we
have the minimal allowed distance; earlier during the movement towards the
intermediate target, the distance was larger; and later during this movement,
it will not be smaller, because crane one leaves the intermediate target at
least as quickly as crane two approaches it.
If crane two is quicker than crane one, the described waiting time would be
too short because crane two would approach the intermediate target position
quicker than crane one would move away from it. In this case, the time of
nearest approach should be when crane two reaches the intermediate position
and crane one is moving away from xi−1 − min x dist.
Function wait4time in Fig. 16.14 expresses the result of this reasoning
for the general case, i.e., without restriction to the case that crane two is
passive. First, the special case is handled that the passive crane is crane one
and we deal with the last segment. In this case, the crane does not have
to wait, because the target is to the left of the crane, away from the other
crane, so no collision can occur because of the next movement. Otherwise,
we use a LET-phrase for computing the waiting time. First, the number of
the other crane is computed. sign is used for determining the intermediate
target position intmdtTarget one index position from the current x position
into the direction of the target, where we have to deal with the special case
wait4Time(q,conf,crane) =def
IF crane=1 ∧ lastSegment(q)
THEN 0
ELSE
LET otherCrane = (crane=2 ? 1 : 2),
sign = (crane=2 ? -1 : +1),
intmdtTarget = xCoord(xPos(crane,conf)+sign),
slower = (vxcrane < vxotherCrane ),
refCrane = IF slower
THEN intmdtTarget
ELSE intmdtTarget - sign*min_x_dist,
refOtherCrane = refCrane + sign*min_x_dist
IN
timeUntilLeft(q,otherCrane,refOtherCrane,conf)
- abs(refCrane-xCoord(crane,conf))/vx crane
Fig. 16.14. Waiting time before the passive crane does the next x-movement to-
wards its target position.
198 16. A Production Cell with Timing
that during the last segment, the target of crane one is to the left, not to the
right. slower is a Boolean variable recording if the passive crane is slower
than its counterpart. It is used in the case distinction for the computation
of the x-coordinate of the crane for the moment of nearest aproach between
the two cranes. This coordinate is assigned to refCrane, and it is used in the
computation of the position of the other crane at the moment of nearest ap-
proach (refOtherCrane). Finally, the waiting time is computed as difference
from the time until the other crane has left the x-coordinate of the point of
nearest approach, and the time the passive crane needs to reach its position
for the moment of nearest approach.
Note that the time computed by wait4time might be negative. This
means that the passive crane might even have started its movement ear-
lier (by the absolute value of the computed time) than the current moment
without that a collision would have occurred. But since we assume that the
waiting time is checked as early as possible, i.e., as soon as the passive crane
has reached the x-coordinate from which it can start the next move, it is not
possible for the passive crane to use this extra time. But there are situations
in which the other crane might use this time: Instead of moving as quickly as
possible, it might wait exactly this time before it starts its movement without,
and yet, collisions will be avoided. This feature is used in the computation of
the waiting times in states wait1 and wait3.
Figure 16.15 presents the function for computing the waiting time for
crane one before it picks up the blank from the feed belt. If the waiting time
of the then passive crane, i.e., of crane two, is negative in the initial situation,
this means that the total residence time of the blank in the system can me
reduced when the blank is picked up by crane one after this amount of time.
Figure 16.16 presents the function computing the waiting time for a crane
before it drops the blank onto an oven at the end of a segment. Here again,
the crane may only wait if its passive counterpart has a negative waiting
time (otherwise, a collision would occur), and the waiting time again may be
at most as long as the absolute value of this negative waiting time, similar
to the case for state wait1. But since the total residence time is already
running when a crane is in this state, the crane should move as early as
possible without endangering that the blank stays too long in the oven. For
this, we compute the oven time which would ensue if the blank would be
dropped immediately (we assume that this is determined by the function
wait1Time(q) =def
LET t=wait4Time(q,mkInitialConfiguration(q),2)
IN IF t < 0
THEN −t
ELSE 0
Fig. 16.15. Waiting time before blank is picked up for the first time.
16.10 Are the System Properties Ensured? 199
wait3Time(q,conf,crane) =def
LET t=wait4Time(q,conf,3-crane) IN
IF t ≥ 0
THEN 0
ELSE
LET s=defaultOvenTime(q,conf,crane),
m=maxOvenTime(q,conf)
IN IF s ≤ m
THEN 0
ELSE min(s − m,−t)
Fig. 16.16. Waiting time before the blank is dropped in an oven at the end of a
segment so that a slow different crane can be near enough to pick the blank up in
time.
defaultOvenTime), and we determine the maximal oven time (via the func-
tion maxOvenTime). If the default oven time is smaller than or equal to the
maximal oven time, we do not have to wait. Otherwise, we either wait for the
difference between the default oven time and the maximal oven time or the
absolute value of the waiting time of the passive crane, whichever is smaller.
In this case, collisions are avoided, but maximal oven times are not necessar-
ily obeyed. If a constructed schedule does not fulfill the oven-time condition
(because the difference s − m is larger than −t at the end of some segment),
it will be sorted out from the set of considered schedules in mkScheduleFor-
FixedOrder_twoCranes by the predicate ovenTimesOk (see Fig. 16.9).
Figure 16.17 presents the last function, that for waiting time in state
wait2. The case is very similar to the one with state wait4, only the roles
are exchanged: Now the active crane is the one which possibly has to wait
before it can start its movement towards its next target, because perhaps,
the passive crane is not yet far enough out of the way. Now, we do not deal
with intermediate targets: When the movement starts, it goes directly to the
x-coordinate of the next processing unit (target). In this case, a problem
can only ensue if the crane is quicker than its counterpart, and if the next
x-coordinate lies to the same side as the other crane; otherwise, the crane
does not have to wait. If it might have to wait, the reference point for the
other crane is computed analoguously to the case for state wait4, but the
waiting time can be computed simply by dividing the distance to travel to
the reference point by the traveling speed and subtracting from this the time
which the current crane will need to reach its target when it has been started.
wait2Time(q,conf,crane) =def
LET otherCrane = (crane=2 ? 1 : 2),
sign = (crane=2 ? -1 : +1),
target = xCoord(xPos(nextPU(q))),
quicker = (vxcrane > vxotherCrane ),
refOtherCrane = target + sign*min_x_dist
IN
IF quicker ∧ sign*(target - xCoord(crane,conf))>0
THEN sign*(refOtherCrane-xCoord(otherCrane,conf))/vx otherCrane
- sign*(target-xCoord(crane,conf))/vx crane
ELSE 0
Fig. 16.17. Waiting time before a loaded crane can move to the next processing
unit when the other crane might not yet be far enough away.
– The two cranes may never be nearer that min x dist on their x-coordinates.
This holds in the initial case, and the waiting times for states wait1, wait2,
wait3 and wait4 were carefully chosen to ensure that this also holds during
the processing. An induction will show that this invariant will hold, only
possibly allowing infinitesimal errors.
– A blank may only be put into a processing unit if it is not occupied by some
other blank, and it may only be put onto the deposit belt if the sensor does
not report that the start of the belt is occupied.
This is obviously fulfilled by the system, since a blank is only picked up
from the feed belt if there is no blank in the rest of the system, including
the deposit belt.
– The feed belt must be switched off when a blank arrives at its end, and
a gripper magnet may only be switched off if the gripper is in the lower
position above a processing unit or a belt.
Both invariants are obviously fulfilled by the control program; for the latter,
this can be seen be inspecting the schedules for the crane or cranes.
– Every blank taken from the feed belt will eventually be put on the deposit
belt.
Since a blank is only taken from the feed belt when the whole system is
free, and the sum of processing times, transport times and (possibly) crane
change times is finite, the computed schedule will lead to the blank being
dropped on the deposit belt after some finite amount of time.
– Blanks go through the processing units given in their programs; if the pro-
gram specifies that the order of the program list has to be respected, this is
the order used for the blank.
This is obviously fulfilled by the computation of the schedules for the
crane(s).
– Between the moment when a blank is picked up from the feed belt and the
moment it is put on the deposit belt, no more than the maximal allowed
system processing time as specified in its program may be spent.
16.11 Summary 201
Since each crane starts all its movements as early as is possible considering
the other restrictions (collision avoidance, maximal oven times), a minimal
time schedule for a program or a segmentation will be constructed. And if
several possibilities for the order of the program steps or the split of the
program into segments exist, for each of them a minimal time schedule is
computed; if a schedule fulfilling this condition exists (which we assume),
it will thus be found. This holds for both the one-crane system and the
two-crane system.
– The minimal and maximal processing times in oven-type processing units
must be respected.
For the one-crane system, this is trivial. For the two-crane system, the wait-
ing time in wait1 if the current processing unit is an oven will ensure that
the minimal processing time is respected, and the waiting time in wait3 is
computed so that the maximal oven processing time is respected during the
work on the current segmentation, if this is possible obeying the no-collision
requirement (which need not be the case for some segmentations).
16.11 Summary
The main result of this work is that there exists a model of quantitative
linear time which is both discrete and dense in the real numbers, and which
can be used for the description and analysis of algorithms which make use of
quantitative properties of a linear dense model of time with purely discrete
means.
During the development and use of this model, the concepts of well-
behavedness and strong well-behavedness arise naturally for the characteriza-
tion of dense-time algorithms which lend themselves to infinitesimal discretiz-
ability. Because of the choice of the very flexible ASMs as base formalism it
is possible to transfer these concepts to more specific machine models.
Looking more specifically at the goals described in Sect. 2.7, we conclude:
– Timing enhanced Petri nets and timed automata are modelled quite di-
rectly by our approach: the data-part of the models can be expressed with-
out overhead induced by the formalism. The same holds for Fischer’s syn-
chronization protocol. It might sensibly be expected that this would also
work for other formalisms or applications to be modelled.
– The discreteness of the time model has made it possible that Fischer’s
protocol can be proved with purely discrete means. We think that this
discrete method can be used for proving safety properties of timed systems
in general.
– The formalism is quite flexible in that it does not fix the abstraction level at
which an algorithm is to be described. An example is given in the definition
of timed automata where an abstract definition has been made concrete in
two different ways, and in the production cell case study where the common
features of the variants of the system could be dealt with at an abstract
level.
Chapter 3 gave an overview of problems of different models of time. Let
us sum up if our approach can solve them:
– A problem of classical discrete models of time is that the unit must be fixed
beforehand; this means that there is a lower bound on the time distance of
events. This bound also exists in our approach, but it is smaller than any
strictly positive classical real number, and its exact value is not supposed
to be known.
– More case studies could help to show the range of the approach (and its
limitations).
– The temporal logic might be axiomatized, a proof system might be inves-
tigated, and heuristics for its use might be developed.
– We did not yet investigate the possibility to describe system behaviors as
solutions of differential equations. The base idea would be to describe the
change of a continuously changing quantity y by an assignment of the form
y:=y+dt*y’. This would mean that now is not the only non-derived symbol
any more which changes its value continuously and where we have to deal
with infinitesimal errors when compared with a classical description of the
system. We did not yet explore in detail which problems arise from this
approach to system description.
– Since the formalism is very general, for practical use it would be helpful to
develop more conventions for the expression of different concepts of timing-
based systems in this framework (i.e., in NTASM rules and the associated
logic). This can make the missing guidance resulting from generality of the
formalism less urgent.
– Tool support, and specifically the possibility for simulation is missing. As
already described, simulation can not be done step-by-step. We expect that
the formalization of the concept of simulability of an NTASM interpretation
of an ASM rule will yield important insights into restrictions which are
sensible to effectiveness of descriptions of timing-based algorithms.
A. Common Notation
For two sets A and B, A → B represents the set of functions with domain
A and range B.
For a non-empty set S, (S) is Hilbert’s choice function yielding an ele-
ment of S.
The domain of a function f is denoted dom(f ) and the range is denoted
ran(f ).
For a function f the expression f [a → b] is a function mapping elements
x ∈ dom(f ) − {a} to f (x) and mapping a to b.
Finite functions may be given as sets of mappings, written like {x →
0, y → 1}.
Two functions f and g are consistent if they agree on common arguments.
Note that disjointness of domains implies consistency.
For two functions f and g, f [g] denotes the function λ(e : dom(f ) ∪
dom(g)) : (e ∈ dom(g) ? g(e) : f (e)), i.e., f is extended and overridden by g.
Note that for consistent f and g, f [g] = g[f ].
[dR98] W.-P. de Roever. The need for compositional proof systems: A survey.
In W.-P. de Roever, H. Langmaack, and A. Pnueli, editors, Composi-
tionality: The Significant Difference, LNCS 1536, pages 1–22, Berlin,
1998. Springer-Verlag.
[DS94] M. Diaz and P. Sénac. Time stream petri nets, a model for timed mul-
timedia information. In Proc. 15th Int. Conf. Application and Theory
of Petri Nets 1994, LNCS 815, pages 219–238, Berlin, 1994. Springer-
Verlag.
[FMM94] M. Felder, D. Mandrioli, and A. Morzenti. Proving properties of real-
time systems through logical specifications and petri net models. IEEE
Transactions on Software Engineering, 20(2):127–141, February 1994.
[FP78] N. Francez and A. Pnueli. A proof method for cyclic programs. Acta
Informatica, 9:133–157, 1978.
[Fra86] N. Francez. Fairness. Springer-Verlag, New York, Berlin, Heidelberg,
Tokyo, 1986.
[GH96] Y. Gurevich and J. K. Huggins. The railroad crossing problem: An
experiment with instantaneous actions and immediate reactions. In
H. Kleine-Büning, editor, Computer Science Logics. Selected Papers
from CSL’95, LNCS 1092, pages 266–290. Springer-Verlag, 1996.
[GM95] Y. Gurevich and R. Mani. Group membership protocol: Specifica-
tion and verification. In E. Börger, editor, Specification and Validation
Methods, pages 295–328. Oxford University Press, 1995.
[GMM99] A. Gargantini, D. Mandrioli, and A. Morzenti. Dealing with zero-time
transitions in axiom systems. Information and Computation, 150:119–
131, 1999.
[Gor95] M. Gordon. The semantic challenge of verilog hdl. In Proceedings of the
Tenth Annual IEEE Symposium on Logic in Computer Science, 1995.
[Gur88] Y. Gurevich. Logic and the challenge of computer science. In E. Börger,
editor, Current Trends in Theoretical Computer Science, pages 1–57.
Computer Science Press, 1988.
[Gur93] Y. Gurevich. Evolving algebras: An attempt to discover semantics. In
G. Rozenberg and A. Salomaa, editors, Current Trends in Theoretical
Computer Science, pages 266–292. World Scientific, 1993.
[Gur95a] Y. Gurevich. Evolving algebras 1993: Lipari guide. In E. Börger, editor,
Specification and Validation Methods, pages 9–36. Oxford University
Press, 1995.
[Gur95b] Y. Gurevich. Platonism, constructivism, and computer proofs vs.
proofs by hand. Bulletin of the EATCS, 57:145–166, October 1995.
[Gur97] Y. Gurevich. May 1997 draft of the ASM guide. Technical Report
CSE-TR-337-97, University of Michigan, EECS Department, 1997.
[Gur99] Y. Gurevich. Sequential ASM thesis. Technical Report MSR-TR-99-09,
Microsoft Research, Redmond, 1999.
[GY76] S. L. Gerhart and L. Yelowitz. Observations of fallibility in applica-
tions of modern programming methodologies. IEEE Transactions on
Software Engineering, 2(3):195–207, September 1976.
[Hal90] A. Hall. Seven myths of formal methods. IEEE Software, pages 11–19,
September 1990.
[Hal93] N. Halbwachs. Synchronous Programming of Reactive Systems. Kluwer
Academic Publishers, 1993.
[Har87] D. Harel. Statecharts: A visual formalism for complex systems. Science
of Computer Programming, 8:231–274, 1987.
[HCP91] N. Halbwachs, P. Caspi, and D. Pilaud. The synchronous dataflow
programming language lustre. Proceedings of the IEEE, 79(9):1305–
1320, September 1991.
218 References