some properties that must always be satisfied by the
variables x and maintained by the activation of the
events. Generalized substitutions provide a way to
express the transformations of the values of the state
variables of a formal model. An event consists of two
parts : a guard (denoted grd) and an action. A guard
is a predicate built from the state variables, and an
action is a generalized substitution (denoted GS).
Example : A parcel sorting device.
In this section, we present an example of reactive sys-
tem : a parcel sorting device (Jaray and A.Mahjoub,
1996) which will be taken to illustrate our proposed
approach. We just give the abstract model of the sys-
tem and not the refinement steps. The problem is to
sort parcels into baskets according to an address writ-
ten on the parcel. In order to achieve such a sort-
ing function we are provided with a device made of
a feeder connected to the root of a binary tree made
of switches and pipes as shown in the figure 1. The
switches are the nodes of the tree, pipes are the edges
and baskets are the leaves. A parcel, thanks to gravity,
can slide down through switches and pipes to reach a
basket.
Feeder
0
1
2
3
4 5 6
7 8 9 10 11 12 13
14
1 2 3 4 5 6 7 8
Baskets
Figure 1: Router.
A switch is connected to an entry pipe and two
exit pipes, a parcel crossing the switch is directed to
an exit pipe depending on the switch position. The
feeder releases one parcel at a time in the router, the
feeder contains a device to read the address of the par-
cel to be released. When released, a parcel enters
a first switch (the root of the binary tree) and slides
down the router to reach a basket. The controller can
activate the feeder and change the switches position.
For safety reasons, it is required that switch change
should not occur when a parcel is crossing it. In order
to check this condition, sensors are placed at the entry
and the exits of each switch.
We consider a simplified version of the system
with only safety properties to illustrate a specification
with the event B method and we will deal in the fol-
lowing with liveness properties (eventuality and fair-
ness) to explain our approach.
Abstract model of the system
The abstract model of the system is given figure 2.
1 2 3 4 5 6 7 8
Baskets
channel
Feeder
Figure 2: Router.
The sorting device. The sorting device consists of a
feeder and a sorting layout. The feeder has two func-
tions: selection of the next parcel to be introduced into
the sorting layout and gate opening (releasing a par-
cel in the sorting layout). We introduce the events se-
lect and release to capture the two functions. In order
to produce the abstract model of the sorting layout,
we have to notice that a given state of the switches
forms a channel linking the entrance to a unique sort-
ing basket. A basket is an element of a set named
Baskets. Channels and sorting baskets are in a one to
one correspondence. Therefore, the abstract model of
the sorting device can be reduced to a single variable
channel taking the value of the sorting basket it leads
to, namely a value in the set Baskets. The channel
value is changed by the event set
channel.
Parcels. Parcels, as part of the environment, are rep-
resented as elements of a set we name PARCELS. We
use a total function (adr) from PARCELS to the inter-
val Baskets to refer to the parcels address. We give
the status ”arrived” to the parcel which has reached
a sorting basket. The variable (arrived) is a function
from PARCELS to Baskets. The goal of the sorting
system is to decrease the set of the parcels to sort. The
variable sorted represents the set of sorted parcels.
The remaining parcels are defined by the expression
PARCELS - sorted named UNSORTED. As pe is un-
defined when the sorting device is empty, we have in-
troduced a set PPARCELS of which PARCELS is a
proper subset; pe is an element of PPARCELS and
assignment of any value in PPARCELS - PARCELS
stands for ”undefined”. The expression PPARCELS -
PARCELS will be referred as NOPARCELS. The se-
lection of a parcel is an event which may be activated
once the device is free and the variable pe is unde-
fined, which means that no parcel is processed.
Moving parcels. In our abstraction a parcel takes no
time to travel from the feeder to a basket. A parcel
A FORMAL APPROACH FOR THE DEVELOPMENT OF AUTOMATED SYSTEMS
305