Abstract
It is a characteristic of swarm robotics that specifying overall emergent swarm behaviours in terms of the low-level behaviours of individual robots is very difficult. Yet if swarm robotics is to make the transition from the laboratory to real-world engineering realisation we need such specifications. This paper explores the use of temporal logic to formally specify, and possibly also prove, the emergent behaviours of a robotic swarm. The paper makes use of a simplified wireless connected swarm as a case study with which to illustrate the approach. Such a formal approach could be an important step toward a disciplined design methodology for swarm robotics.
Introduction
In a previous paper (Winfield et al., 2005) we introduced the notion of a ‘dependable swarm’, that is a distributed multi-robot system based upon the principles of swarm intelligence upon which we can place a high degree of reliance. That paper concluded that, although some of the tools needed to assure a swarm for dependability exist, most do not, and set out a roadmap of the work that needs to be done before embodied swarm intelligence can make the transition from the research laboratory to real-world applications.
One of the defining characteristics of robotic swarms is that overall swarm behaviours are, typically, an emergent consequence of the interaction of robots with each other and their environment (Bonabeau et al., 1999), (Şahin, 2005). If future real-world robotic swarms are to exploit emergence and self-organisation to generate desired system behaviours then we will need to be able to verify, or better still prove, that those behaviours are guaranteed to emerge (since few real-world applications would tolerate only some possibility of desired behaviour).
Within swarm robotics research relatively little work has been done in the direction of mathematical analysis and modelling; for a recent review see (Lerman et al., 2005). Perhaps the most successful analytical modelling approach to date is the work of (Martinoli et al., 2004), which uses a stochastic approach in which an ensemble of probabilistic finite state machines describe the overall structure of the swarm in terms of its microscopic (individual robot) parameters. Martinoli's work is concerned with modelling rather than specification, or formal proof.
(Kiriakidis and Gordon-Spears, 2002) modelled a multi-robot system as a Discrete Event System (DES) and went further than modelling, toward formal verification, using automata-theoretic model checking. However, the multi-robot system of Kiriakidis and Gordon-Spears employs a central supervisory controller which assures the behaviour of the overall system by constraining the actions of individual robots. By contrast the work of this paper is concerned with fully distributed robotic swarms in which there is no centralised command and control structure. Thus we are faced with the difficult problems of, firstly, designing and specifying individual robot behaviours such that when the robots of the swarm interact with each other and their environment the desired overall swarm behaviours will emerge and, secondly, verifying those emergent behaviours.
There has been recent work in the area of applying formal methods to specifying and verifying swarm intelligent systems, notably within the NASA project ‘Autonomous Nano-Technology Swarm’ (ANTS) (Rouff et al., 2003, Rouff et al., 2004). That work evaluated and compared four formal specification techniques: Communicating Sequential Processes (CSP), the Weighted Synchrononous Calculus of Sequential Systems (WSCCS), Unity Logic and X-Machines and concluded that none of those approaches is - on its own - sufficient for the task of formal specification and verification of robotic swarms.
By contrast, in this paper we shall explore the use of a temporal logic to formally specify and verify emergent behaviours of a robotic swarm system. The recent theoretical results that have led to the mechanisation of fragments of first-order temporal logic are exciting new results that, for the first time, open up the possibility of applying first order temporal theorem proving in areas such as swarm verification. Temporal logics have been shown to be useful for specifying dynamical systems that change over time (Manna and Pnueli, 1992), and we believe that this ability is essential for describing emergent behaviours. Indeed, in the world of multi-agent systems, temporal formalisms (often extended with modal logics) have been widely used for specification, verification, and even implementation (Fisher, 2005).
This paper proceeds as follows. In section 2 we introduce the wireless connected robotic swarm that forms the case study of this paper. Section 3 proposes a formal approach to swarm specification and verification, then introduces the linear-time temporal logic that we propose to use, and its notation. Section 4 then applies this formal approach to the wireless connected swarm of our case study. Finally, section 5 summarises the findings of the work to date.
Case study: A Wireless Connected Swarm
We have developed a class of algorithms which make use of local wireless connectivity information alone to achieve swarm aggregation (Nembrini et al., 2002, Nembrini, 2005). These algorithms use situated communications in which connectivity information is linked to robot motion so that robots within the swarm are wirelessly ‘glued’ together. This approach has several advantages: firstly the robots need neither absolute nor relative positional information; secondly the swarm is able to maintain its coherence (i.e. stay together) even in unbounded space and, thirdly, the connectivity needed for, and generated by, the algorithms means that the swarm naturally forms an ad-hoc communications network. Such a network would be a significant advantage in many swarm robotics applications. In this case study we make use of the simplest (alpha) algorithm. The basic premise of this algorithm is that each robot has range-limited wireless communication which, for simplicity, we model as a circle of radius rw with the robot at its centre. The boundary of the circle represents the threshold beyond which another robot is out of range. Each robot also has collision avoidance sensors with a range ra, where ra < rw. The basic algorithm is very simple. The default behaviour of a robot is forward motion. While moving each robot periodically broadcasts an ‘I am here’ message. The message will of course be received only by those robots that are within wireless range - its neighbours. If the number of a robot's neighbours should fall below the threshold α then it assumes it is moving out of the swarm and will execute a 180° turn. When the number of neighbours rises above α (when the swarm is regained) the robot then executes a random turn. This is to avoid the swarm simply collapsing in on itself. In the interests of simplicity we can consider each robot as having three basic behaviours, or states: move forward (default); avoidance (triggered by the collision sensor), and coherence (triggered by the number of neighbours falling below α). Figure 1 shows the finite state machine (FSM) for the individual robots in the swarm.

Robot Finite State Machine
The alpha algorithm achieves useful swarm coherence in which a larger value of α results in a smaller more highly connected swarm and a smaller value of α in a larger more loosely connected swarm, as shown in figure 2.

Swarm with α = 5 (left) and α = 10 (right)
It is the contention of this paper that formal methods can be usefully applied to swarm robotic system specification and development, especially in relating emergent behaviours to individual robot behaviours. We propose the following formal methodology:
Formally specify the individual robots, including their safety and liveness properties. Formally specify the swarm by combining the specifications of individual robots. Formally specify any anticipated or desired emergent behaviours. Carry out proofs to determine if the swarm specification satisfies any of the emergent behaviours.
Safety 3 and liveness are defined as follows. The safety property specifies the set of legal actions, i.e. the set of actions that are allowed. If the robot performs actions from within this set, it will not make the system unsafe. The liveness property specifies the dynamic behaviour, i.e. the set of eventualities that will occur. If we only have the safety property, we cannot guarantee that anything will happen at all. If we only have the liveness property, we cannot guarantee that what is happening is safe. So we need to establish both safety and liveness.
The four steps proposed above can be applied iteratively. The outcomes of each iteration - typically ‘proven’, ‘not-proven’ or ‘unable to determine either way’ - will provide feedback to the swarm designer. Based on these outcomes, modifications to individual robot specifications may be carried out. Expectations of overall emergent behaviours may also be adjusted.
A Linear Time Temporal Logic
Temporal logic is an extension of classical logic, in which time becomes an extra parameter when considering the truth of logical statements (Emerson, 1990). The variety of temporal logic we are particularly concerned with is based upon a discrete, linear model of time, having both a finite past and infinite future, i.e.,
Here, a model (σ) for the logic is an infinite sequence of states which can be thought of as ‘moments’ or ‘points’ in time. As we use a first-order temporal logic, associated with each of these states is a first-order structure.
The temporal language we use is that of classical logic extended with various modalities characterising different aspects of the temporal structure above. Examples of the key operators include ‘
More formally, the semantics of the language can be defined with respect to the model (σ) in which the statement is to be interpreted, and the moment in time (i) at which it is to be interpreted. Thus, the semantics for the key temporal operators is given as follows:
We also allow standard first-order quantifiers, such as ‘∃’, ∀ and arithmetical operators.
Such a logic is widely used in the specification of concurrent and distributed systems, in both Computer Science (Manna and Pnueli, 1992) and Artificial Intelligence (Fisher et al., 2005a).
Applying our Formal Approach
In this section we formally specify a simplified version of the wireless connected swarm (the alpha algorithm) outlined in section 2.
A simplified alpha algorithm
For simplicity, we discretise the robot space so that the robots move in a grid world, and make the following assumptions.
The bearing of each robot will have only one of these four values: N, S, E, and W. The maximum connected distance between two robots is rw units. At each time step a robot moves a units (a rw). A robot can move forward, turn 90° left before making a move, turn 90° right before making a move or turn 180° back before making a move. Given a robot i in position x, y, if another robot j is in the shaded area shown in Figure 3, then robotsi and j are ‘connected’. We simplify the FSM of figure 1 by omitting the avoidance state. We assume a value of α = 1 so that the loss of any connection triggers the coherence state.

Area of Connectivity, showing movement grid
These assumptions may appear to be severe but, we argue, do not compromise the thesis of this paper. For example, the avoidance behaviour, while necessary in a real-world swarm, is not essential to the emergent swarm behaviours we seek. Similarly, a swarm with α = 1 may have limited practical value, but our contention that temporal logic can be used to specify swarm properties, including emergence, is uncompromised by this assumption.
Given the above assumptions, the behaviour of each robot can be described as follows. Each robot can be in one of two motion states: forward or coherence. The connectivity of each robot can also be in one of two states: connected or not connected. The combination of the motion states and the connectivity states give us four possible state transitions:
In the forward state, when connected → move forward In the forward state, but not connected → turn 180° and change the motion state to ‘coherent’ In the coherent state, but not connected → move forward In the coherent state, when connected → perform a random turn (i.e. either left or right) and change the motion state to ‘forward’.
Now, given a swarm of robots with the above behaviours, there may potentially be the following (desirable) emergent behaviours:
Property 1: It is repeatedly the case that for each robot, we can find another robot so that they are connected. Property 2: Eventually it will always be the case that every robot is connected to at least k robots, where k is a pre-defined constant.
Before defining the specification of individual robots, we need some auxiliary definitions to make the specification more readable.
The following local variables and global constants are used in the subsequent specifications:
position of roboti. bearing of roboti. This can be N, S, E or W. flag indicating whether roboti is in the forward or coherence state. total number of robots in the swarm. connectivity range. distance of one move. roboti will transition from the current state to the next state if πi is true.
Auxiliary definitions
Set of Robots
robotSet denotes the set of robots in the collection:
Detection of Connectivity
Two robots i and j are within the connection range if the Euclidian distance between their x, y coordinates is less than the connection distance, thus:
Robot i is connected to some other robots in the set if there exists another robot within its connection range, thus:
Movements
First, we specify the ‘move north’ action. If in the next time step robot i moves in the direction north by a units, the value of the x-coordinate of robot i in the next state is the same as the value of the x-coordinate now; and the value of the y-coordinate of robot i in the next state is the same as the value of the y-coordinate now plus the distance a. Thus:
And for directions south, east and west respectively:
We now specify the ‘move forward’ action. If the current direction is north, in the next time step, the robot remains in the same direction and moves north by a units. If the current direction is south, in the next time step, the robot again remains in the same direction and moves south by a units, etc. Thus:
The turn90Move() action specifies that in the next step robot i turns 90° randomly and moves a units in the new direction:
The turn180Move() action specifies that in the next step robot i turns 180° and moves a units in the new direction:
State transitions
We can now specify the four possible combinations of motion states and connectivities, described in section 4.1, as follows. forwardConnected(i) specifies that the robot is in the forward motion state and is connected:
Idle situation
Finally, we specify the ‘idle’ situation.
The above formula specifies that in the next step robot idoes not make any change.
Let Roboti denote the specification of robot i:
The above formula states that the behaviour of Roboti will always satisfy both its safety and liveness properties.
The safety properties specify the valid actions. In our specification, concurrency is modelled through interleaving. So, for each robot, we need to specify two cases: one for the robot taking an action and another for the robot not taking an action. The first case we label the component action and the second the environment action. The component action defines what robot i is allowed to do. The environment action defines what the environment is allowed to do to robot i. Now the environment of robot i consists of all the other robots, but the environment action does not need to specify all possible actions of the other robots, only those that affect robot i. In our particular case study, when the environment is taking an action, there will be no changes to robot i; robot i will thus be idle.
To distinguish between a component step and a environment step for robot i, we use the proposition πi to label robot i's actions. Therefore πi is true if robot i is taking an action; it is false if it is not taking an action. Thus:
The Safetyi formula above specifies what robot i is allowed to do when it is taking an action (i.e. a component action) or that it remains idle when it is not taking an action. This idle period leaves the space for the environment to take some actions.
The CompActioni formula specifies three allowed actions:
We can now specify liveness for robot i. The livenessi formula specifies that if, in the current step, robot i is active (πi = true), and it is in the forward state, and it is connected to another robot, then it will move forward and remain in the forward state; if robot i is in the forward state and it is not connected to another robot, it will do a 180° turn and change the motion state to ‘coherent’, and so on. Thus:
The swarm of robots consists of all robots executing concurrently. Therefore our specification for the whole collection is defined as the logical ‘and’ of all the individual robots. As we use interleaving to model concurrency, we also need to ensure that only one robot is taking an action at a time. This mutual exclusion is specified by the exclusive ‘or’ (⊕) condition. Thus:
The exclusive or condition ensures that at any moment in time, if πi is true, only robot i is taking an action, all the other robots are idling. For example, if π1 is true, π2 to πN are false. Therefore according to the safety property specification, the behaviour of robot 1 is specified by compActioni, i.e. one of the three actions: moveF(i), turn180Move(i) and turn90Move(i). The behaviour of all the other robots are specified by their environment action, i.e. idling.
It is important to recognise that the specification of the swarm above specifies the set of all possible orderings of interleaved actions of all robots. The swarm specification must not be taken to imply that the actions of robot 1, robot 2, etc, are interleaved in order 1, 2…N.
In this subsection, we demonstrate how we can use the same notation to describe possible emergent behaviours.
Property 1: It is infinitely often the case that, for each robot, we can find another robot so that they are connected.
Property 2: Eventually it will always be the case that every robot is connected to at least k distinct robots, where k is pre-defined.
Thus property1 specifies that each robot has just 1 connected neighbour; property2 is stronger, and specifies that each robot in the swarm has k connected neighbours. However, property2 does still admit the possibility that our swarm of N robots might split into a number of connected subswarms each with k + 1 robots (which, in fact, can happen with the alpha algorithm). However, the purpose of this paper is not to derive a full specification, but to demonstrate the validity of the approach we are advocating.
Since the disposition and connectivity of our swarm experiences a time evolution we also need to assume that property1 and property2 are true at the initial moment, in other words that our robots are initially tightly swarmed and fully connected. Over time the swarm will tend to disperse but the purpose of the alpha algorithm is to maintain swarm connectivity. Thus we seek to prove that property1 and property2 remain true.
Our goal for this stage in our formal approach is to prove (or disprove) that the swarm of robots satisfies the emergent behaviours, i.e.
Currently we are experimenting with mapping specifications for the swarm and the emergent behaviours into a monodic first-order temporal logic (FOTL) so that a monodic 4 first-order temporal prover can be used to prove if the swarm robotic system satisfies the anticipated emergent behaviours. Our initial study has indicated that by rewriting the problem specification and the emergent behaviours into a monodic first order temporal specification, we are indeed able to use the temporal prover TeMP to carry out such proofs. Note that, whereas the scenario described in previous sections for the swarm of robots assumes infinite domains, we have used finite domains for the re-written specification. In particular, we have assumed a finite number of robots involved as well as a finite grid. This is necessary in order to map the specification into the monodic form. Although mapping to the monodic temporal logic produces a large number of clauses and the time taken for the proof is relatively long, this is a first step towards a solution for designing dependable swarm robotic systems that will guarantee certain emergent behaviours.
TeMP (Hustadt et al., 2004) is a resolution-based theorem-prover for first-order temporal logic (FOTL). This logic is very expressive and, consequently, problems expressed in FOTL are often difficult (and sometimes impossible) to prove automatically. However, the restriction to monodic FOTL (Hodkinson et al., 2000) helps us considerably. Monodic FOTL has many appealing properties, for instance it is often possible to automatically prove monodic FOTL formulae when an appropriate first-order basis is used. In order to build tools that achieve this, the clausal resolution method for propositional temporal logic (Fisher et al., 2001) has been extended to monodic FOTL (Degtyarev et al., 2004, Konev et al., 2005). This has been implemented as TeMP, which currently utilises Vampire (Riazanov and Voronkov, 2001) (the fastest prover for first-order logic) for the base first-order proving activities. Specification using monodic FOTL, and then proof of properties in TeMP, has already been used in a number of areas, including security verification (Gago et al., 2005) and distributed protocols (Fisher et al., 2005b).
It should be noted that in its re-written finite, form, the finite-state descriptions of the robots could also be verified using model-checking techniques (Clarke et al., 2000). However, our aim is to revise the specification in order to take more first-order cases into consideration, thus allowing techniques such as in (Fisher et al., 2005b) to be utilised.
This paper has proposed the use of a formal method, which would normally be used to specify and prove properties of a software system, in swarm robotics. We have argued that a linear time temporal logic formalism can be applied to the specification of swarm robotic systems, because of its ability to model concurrent processes and - we maintain - robots in a swarm can usefully be modelled as concurrent processes in a highly parallel system. We have applied this temporal logic schema to the specification of a wireless connected swarm, starting with the specification of individual robots and building up to the overall swarm. Furthermore, we have mapped the specification to a form that can be proven in an automated prover, and validated its suitability.
This work is developing and we have made a large number of simplifying assumptions. Our example specification thus falls well short of specifying even the simple alpha algorithm of our case study. We have argued, however, that our simplifying assumptions do not compromise the contention of this paper, that temporal logic can be used to specify swarm behaviours, including emergent behaviours. We would further argue that the logic proposed here is perfectly valid for real-world problems. Our discretisation of robot movement, for instance, while necessary to reduce the number of logic clauses to a manageable level does not compromise real-world applicability since we can reduce the movement and time steps to arbitrarily small values to specify smooth motion. Similarly, the time interleaving approach needed to model the swarm does not compromise the validity of the approach, since the specification makes no assumptions about the order of interleaving and, indeed, describes all possible orderings. Note also that our swarm specification is expressed from an external point-of-view in which we (the designers) are allowed to know each robot's position and bearing at any time. However, we seek here a swarm specification not a controller design, and the individual robot controllers do not need to have this global knowledge. Thus the principles of swarm intelligence remain uncompromised by our approach.
We are confident that there is merit in the approach proposed in this paper. We believe that such an approach could be an important step toward a disciplined design methodology for swarm robotics and, if we combine formal specification using temporal logic with a method for provable design of the individual robots of the swarm (Harper and Winfield, 2005), then we have a methodology for verifyable design at all levels of the robotic swarm.
Further work will include:
development of the case study to reduce the number of simplifying assumptions and hence improve the fidelity of the formal specification of our wireless connected swarm; further work to understand the scope and implications of the use of the temporal prover to prove the emergent properties of the swarm, and work to extend and generalise this approach to other types of robotic swarm and hence determine whether the approach has merit as a generic tool in swarm engineering.
Footnotes
Acknowledgements
The authors gratefully acknowledge discussion and feedback from Krysia Broda of the Department of Computing, Imperial College London, and the constructive and insightful comments of the reviewers. This work was partially supported by the EPSRC under research grant GR/R45376.
3
In this paper, we adopt the convention that the safety property defines the set of valid actions. In some literatures, the safety property is defined as the set of invalid actions. Both approaches can be used to the same effect.
4
A monodic first-order temporal logic is one in which any subformulas beginning with a temporal operator contain at most one free variable.
