Automated Verification of Signalling Principles in Railway Interlocking Systems
Automated Verification of Signalling Principles in Railway Interlocking Systems
1
) (x
n
)
Here, x
i
are new variables representing the state of the variables after execution;
and
i
is the result of replacing x
1
, . . . , x
i1
by x
1
, . . . , x
i1
in
i
. The rst proof
formula, corresponding to the base case, has the form
I
L
where
. It expresses
that after the rst iteration of the ladder the interlocking system is in a safe state.
The second formula is the inductive step, and proves that from an arbitrary state
where the safety condition holds, after executing the ladder the safety condition
still holds.
L
These two formul should always hold to prove correctness of the safety condition
in the ladder. When employing a SAT solver, both formul are negated; thus, if
the safety condition holds, neither formula should be satisable.
Example 1
If
I
:= x true
:= y x
L
:= x
y
then we obtain the formul
(x true) x
y x
and
(y x) x
y x
which, in this toy example, are provable. For the verication, we use a SAT solver
to search for a satisfying assignment which falsies one of the two formul above.
Limitations
The proof system described above suers from the problem that we may obtain a
false positive when trying to verify a safety condition, that is, a counter-example
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 24
which can not actually arise. There may be a state in which the safety condition
holds, but such that after the execution of the ladder the safety condition is violated;
however it may be that the original state is unreachable. In order to nd out whether
the counter-example is genuine, it is necessary to nd a trace from the initial state
to the identied counter-example. This is not straight forward with our inductive
proof system
6
.
To mitigate the identication of false positives the inductive statement is relaxed
to:
(
L
Inv
)
where
Inv
is an invariant of the ladder. We used two orthogonal techniques for
identifying such an invariant
Inv
:
1) Not all choices of input variables correspond to physically possible states. An
example is a 3-way switch which has 3 positions A, B, C (e.g. control from
central panel, control by local station and control by emergency panel).
The output of such a switch would then be represented by 3 variables, one
indicating whether A was chosen, one for B and one for C. At any time at
most one of A, B or C is chosen (possibly none of these is chosen, e.g. if the
switch is between positions). Therefore we obtain the invariant
A (B C)
B (A C)
C (A B)
2) Some combinations of variables are unreachable. When looking carefully at
false positives, it was usually found that some variables were in a state which
should not be reachable, typically when two variables are related to each other;
e.g. if a signals green aspect is activated, its red aspect should not be activated,
and vice versa. In this instance we would obtain the invariant
signal
i
is red signal
i
is green.
When such a possible invariant
Inv
is discovered we try to prove that it is in fact
an invariant, i.e. that it always holds:
(
I
L
)
Inv
and (
Inv
L
)
Inv
If this is provable, then we can assume that this invariant holds before executing
the ladder. Alas, it is a major area of research to eciently identify invariants
automatically.
6
Solutions for producing error traces are known but have not been explored in this research. One such
solution is to use time copies as introduced by Fokkink in [8] or to apply a model checking technique that
successively identies sets of reachable states from the initial state to the counter-example, yielding the
computation path [1,4].
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 25
5 Translating Signalling Principles to Safety Condi-
tions
Signalling principles, as used in this research, refer directly to the railway industry.
They are used as heuristics by the designers and are typically written in a natural
language as precisely as possible.
One aim of the research is to dene a formal unambiguous language with which
to formulate signalling principles. A typical signalling principle would be:
Points in a railway yard should not be set to
the normal and reverse positions simultaneously.
Normal and reverse are the two possible positions of a set of locked points. Signalling
principles do not refer directly to any specic railway yard, or the entities within
them. First-order logic with general predicates is ideal for formally expressing these
principles; the above principle would be translated to:
pt Points : [normal(pt) reverse(pt)]
These rst-order formul need to be translated into a propositional formula
(safety condition); to do this we build a topology model of the railway yard for
which the interlocking system was designed. A Prolog database is used for this
topology model. The entities in a railway yard are given names, and relations are
used to model the topographic aspect. For instance, two connected track segments
would be related using the binary predicate connected. For this research, the
track plans and control tables were (manually) converted into a Prolog database.
This database can then be automatically queried to help translate the signalling
principles.
The translation has two steps: the rst removes quantication, and the second
resolves predicates into literals from the ladder or a constant Boolean value depend-
ing on the context. Variables in the signalling principle range over nite domains,
as all railway yards are nite. Thus, universal quantication can be replaced by a
nite conjunction, and existential quantication can be replaced by a nite disjunc-
tion. The topology model would be queried for a nite set of quantied values. For
instance the variable pt in the example signalling principle introduced ranges over
the domain of all points in the railway yard.
Secondly, the predicates are resolved into literals. This is done by specifying
a list of predicates along with how they are reduced. This list is unique for each
railway yard, as dierent railway yards follow dierent naming conventions. For
instance, the predicate normal(pt) used in the example signalling principle would
be reduced to a literal pt.Normal by means of a string concatenation operation.
Predicates that are not specied in the railway yard specic list are resolved using
Prolog, and the topology model, to a constant Boolean value (see Example 2 below).
Thus, the second class of predicates greatly simplies the formulation of signalling
principles, as a safety condition can be given a guard.
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 26
Example 2
Consider a signalling principle such as
All points that are part of a route must be locked if the route is set.
This is formalised as
pt Points : rt Routes : point part of(pt, rt) [set(rt) locked(pt)]
where the predicates set(rt) and locked(pt) are reduced to literals; and
point part of(pt, rt) is reduced to true if point pt is part of route rt within the
topology model, and to false otherwise. In this case, the verication consists of
proving that set(rt) locked(pt) holds for all cases where point pt is part of
route rt.
Example 3
Consider a simple railway yard with only two points pta and ptb and a signalling
principle:
pt Points : [normal(pt) reverse(pt)]
After removal of the quantication and predicates, the following safety condition is
produced:
[pta.Normal pta.Reverse] [ptb.Normal ptb.Reverse]
In order to identify more precisely the reason for a possible counter-example, the
safety conditions which often form a large conjunction are split into their con-
juncts which form more specic safety conditions.
6 Implementation
The software implemented for this research takes as input a signalling principle,
an interlocking systems ladder logic, and a topology model; using these inputs, it
generates clause sets and starts the verication. L
A
T
E
X documentation is produced
if a counter-example is identied. The SAT-Solver used for this project is called
OKSolver, written by Kullmann [12,10], which is part of the OKlibrary [11]. The
interlocking system veried has 331 assignments and 599 variables. For illustration
purposes, two signalling principles have been veried; Table 2 contains information
about the verication of the clauses. The rst section in the table veries that the
interlocking system can never move the points to the normal and reverse position
in the same execution cycle. The second section shows that counter-examples have
been identied while attempting to verify that if a point is occupied, then it is locked
into position. This second signalling principle is only for demonstration purposes
and does not mean the railway is unsafe, as the proof system allows for trains to
magically appear and disappear. Thus, if a point is not locked, then the SAT-Solver
will place a train on the point, thus creating a counter-example.
Interestingly, the rst signalling principle, when the clause sets are all unsat-
isable, has a very fast running time while verifying the clause sets. The second
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 27
Clause Set
Number of
Clauses
Number of
Variables
OKSolver
Running
Time
(Seconds)
pointsNotNormalAndReverse0 14713 4076 0.06
pointsNotNormalAndReverse0.ind 12916 3559 0.06
pointsNotNormalAndReverse1 14713 4076 0.13
pointsNotNormalAndReverse1.ind 12916 3559 0.14
occupiedPointsLocked0 14713 4076 0.25
occupiedPointsLocked0.ind 12930 3560 1.34
occupiedPointsLocked1 14713 4076 0.21
occupiedPointsLocked1.ind 12930 3560 1.33
occupiedPointsLocked2 14716 4076 0.25
occupiedPointsLocked2.ind 12930 3560 1.37
occupiedPointsLocked3 14713 4076 0.27
occupiedPointsLocked3.ind 12930 3560 1.3
Table 2
Clause sets and there verication time, the clause sets in italic are satisable. Clause sets that end with
ind are the inductive step of the verication, those without are the base cases.
signalling principle, when the clause sets are all satisable, has a greater average
running time, especially through the inductive steps.
7 Related Work
There have been many attempts to apply formal methods to railways and their
associated interlocking systems. Indeed, this is the subject of the TRain Grand
Challenge proposed by Dines Bjrner [3].
Eriksson has applied formal methods to the problem with great success for over
ten years, notably on behalf of Banverket (the Swedish National Rail Administra-
tion) [5,6,7]. This approach works by creating two mathematical models: the rst
is that of the interlocking system and consists of rules, and the second is of the
topological aspects of the railway yard for which the interlocking system has been
designed. Verication proceeds by proving that a signalling principle holds for the
interlocking system model in the topology model of the railway yard. The NP-Tools
software produced by the company Prover
7
was used for the verication [5]. NP-
Tools is a collection of tools packaged with a proof engine; these tools translate
various problems into an acceptable format for the proof engine to process. The
7
www.prover.com
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 28
proof system implemented by NP-Tools is documented in [15]. NP-Tools has been
used by many other companies for formal verication of critical systems such as
ADTranz, Saab and Volvo.
Morley applied formal methods to the British Rail Solid State Interlocking
(SSI), focussing on safety properties and communication protocols between the
SSIs [14,13]. Our approach is somewhat dierent as we focus on the low level
Boolean logic whereas SSIs are programmed at a high level with a language which
merges the logic with geographic data.
Fokkink demonstrated how an interlocking system programmed using ladder
logic can be automatically veried to ensure that it implements the control tables
correctly [8]. This work did not cover the direct verication of signalling principles;
only safety conditions that were derived from the control tables were veried. The
paper discusses two verication techniques. The rst proves that a safety condition
is a logical consequence of executing the ladder. Let
L
be a model of the ladder
in propositional logic and be a safety requirement. The proof obligation used by
Fokkink is
If this obligation holds it proves that after any execution of the ladder the safety
requirement will always hold, even if the system was in an unreachable state before
executing the ladder. Note that our approach only demands that the obligation
holds if, before an execution of the ladder, the system was in the initial state or in a
state where the safety requirements hold as well. Our approach, therefore, restricts
the number of states for which the safety condition is required to hold to a smaller
subset of states which contains all reachable states and possibly some unreachable
states. By adding invariants, we further cut down the number of unreachable states
to be considered, therefore reducing the number of false positives.
The second technique introduced by Fokkink creates time copies of the propo-
sitional model of the ladder. He introduces variables x
i
(j) denoting the state of
variable x
i
after j executions of the ladder
8
. A time copy (i) would be the same
as with all of the atomic propositions x in replaced by x(i). This technique does
not show that after any execution of the ladder the safety requirement will hold,
but only after a nite number k of executions of the ladder. The proof obligation is
(0) (1) . . . (k) (k)
This technique can be used to prove temporal safety requirements, but is deprecated
as such safety conditions are veried for only a nite number of iterations; there
will always be uncertainty as to whether the safety requirements hold beyond k
iterations of the ladder. However, if a counter-example is found, then it is the case
that the counter-example is reachable, and from a falsifying assignment we obtain
a trace from the initial state to it.
8
So in our notation x
i
denotes x
i
(0) and x
i
denotes x
i
(1).
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 29
8 Conclusion
Our approach was applied to a model provided by our industrial sponsor of a modest
yet typical railway yard with 331 assignments and 599 variables, representing a
station with two platforms and one railway line with two tracks feeding into it. The
running time of the SAT solver itself was never longer than a couple of seconds.
We were able to prove a large variety of safety conditions. We found some counter-
examples, which were already known to the company but recognised not to be safety
critical, being intermittent and occurring for only one cycle of the ladder. In order
to prove that these counter-examples really occur only for at most one cycle, we
could adapt the proof obligation and prove that if the system is in a state in which
the safety condition does not hold, then it will hold after a single execution of
the ladder. The proof formula would be
L
We do not know how well our approach scales up, since we have only applied
it to a modest railway yard. Current interlocking systems being developed have
over 3000 assignments. We do not anticipate any serious problems although the
nature of the satisability problem means that the computational complexity will
grow exponentially when attempting to verify interlocking systems with more and
more assignments.
This project demonstrates that automated verication of railway interlocking
systems, at least for smaller examples, is feasible. The main advantages of our
approach is its simplicity and that it veries safety at the lowest level the level at
which it is actually executed.
References
[1] Baier, C. and I. Katoen, J.P., Principles of Model Checking, The MIT Press, 2008.
[2] Biere, A., M. Heule, H. van Maaren and T. Walsh, Handbook of Satisability, IOS Press, Amsterdam,
(to be published) 2008.
URL http://www.st.ewi.tudelft.nl/sat/handbook/toc.html
[3] Bjrner, D., TRain: The Railway Domain, in: Building the Information Society, IFIP International
Federation for Information Processing 156/2004 (2004), pp. 607611.
URL http://www.springerlink.com/content/527p7237102w5741/
[4] Clarke, E., O. Grumberg and I. Peled, D.A., Model checking, Springer, 1999.
[5] Eriksson, L., Formal Verication of Railway Interlockings, Swedish National Rail Administration
Technical Report 4 (1997).
[6] Eriksson, L., Formalising Railway Interlocking Requirements, Swedish National Rail Administration
Technical Report 3 (1997).
[7] Eriksson, L. and M. Fahlen, An Interlocking Specication Language, ASPECT IRSE 99 (1999).
[8] Fokkink, W., P. Hollingshead, J. Groote, S. Luttik and J. van Wamel, Verication of interlockings: from
control tables to ladder logic diagrams, Proceedings 3rd Workshop on Formal Methods for Industrial
Critical Systems (FMICS98) (1998), pp. 171185.
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 30
[9] Kanso, K., Formal Verication of Ladder Logic, Masters thesis, Swansea University, Swansea, SA2
8PP, UK (2008).
[10] Kullmann, O., Investigating the behaviour of a SAT solver on random formulas, Technical
Report CSR 23-2002, Swansea University, Computer Science Report Series (available from
http://www-compsci.swan.ac.uk/reports/2002.html) (2002).
[11] Kullmann, O., The OKlibrary: A generative research platform for (generalised) SAT solving, Technical
Report CSR 1-2008, Swansea University, Computer Science Report Series
(http://www-compsci.swan.ac.uk/reports/2008.html) (2008).
[12] Kullmann, O., Present and future of practical SAT solving, in: N. Creignou, P. Kolaitis and H. Vollmer,
editors, Complexity of Constraints, Lecture Notes in Computer Science (LNCS) 5250, Springer, 2008
pp. 283319.
[13] Morley, M., Safety in Railway Signalling Data: A Behavioural Analysis, LECTURE NOTES IN
COMPUTER SCIENCE (1994), pp. 465465.
[14] Morley, M., Safety-level communication in railway interlockings, Science of Computer Programming
29 (1997), pp. 147170.
[15] Stalmarck, G. and M. Saund, Modeling and verifying systems and software in propositional logic,
Safety of Computer Control Systems (SAFECOMP90) (1990), pp. 3136.
K. Kanso et al. / Electronic Notes in Theoretical Computer Science 250 (2009) 1931 31