Mutual Visibility by Luminous Robots
Without Collisions
Abstract
Consider a finite set of identical computational entities that can move freely in the Euclidean plane operating in LookComputeMove cycles. Let denote the location of entity at time ; entity can see entity at time if at that time no other entity lies on the line segment . We consider the basic problem called Mutual Visibility: starting from arbitrary distinct locations, within finite time the entities must reach, without collisions, a configuration where they all see each other. This problem must be solved by each entity autonomously executing the same algorithm. We study this problem in the luminous robots model; in this generalization of the standard model of oblivious robots, each entity, called robot, has an externally visible persistent light that can assume colors from a fixed set of size . The case where the number of colors is less than 2 (i.e., ) corresponds to the classical model without lights: indeed, having lights of one possible color is equivalent to having no lights at all.
The extensive literature on computability in such a model, mostly for and recently for , has never considered the problem of Mutual Visibility because it has always assumed that three collinear robots are mutually visible.
In this paper we remove this assumption, and investigate under what conditions luminous robots can solve Mutual Visibility without collisions, and at what cost, in terms of the number of colors used by the robots. We establish a spectrum of results, depending on the power of the adversary (i.e., the scheduler controlling the robots’ actions), on the number of colors, and on the apriori knowledge the robots have about the system. Among such results, we prove that Mutual Visibility can always be solved without collisions in SSynch with colors and in ASynch with colors. If an adversary can interrupt and stop a robot before it reaches its computed destination, Mutual Visibility is still solvable without collisions in SSynch with colors, and, if the robots agree on the direction of one axis, also in ASynch. All the results are obtained constructively by means of novel protocols.
As a byproduct of our solutions, we provide the first obstructedvisibility solutions to two classical problems for oblivious robots: collisionless convergence to a point (also called neargathering) and circle formation.
1 Introduction
1.1 Computational Framework
Consider a distributed system composed of a team of mobile computational entities, called robots, moving and operating in the Euclidean plane , initially each at a distinct point. Each robot can move freely in the plane, and operates in LookComputeMove cycles. During a cycle, a robot determines the position (in its own coordinate system) of the other robots (Look); it executes a protocol (which is deterministic and it is the same for all robots) to determine a destination point (Compute); and moves towards the computed destination (Move). After each cycle, a robot may be inactive for an arbitrary but finite amount of time. The robots are anonymous, without a central control, and oblivious (i.e., at the beginning of a cycle, a robot has no memory of any observation or computation performed in its previous cycles). What is computable by such entities has been the object of extensive research within distributed computing; e.g., see AgP06 (); CiFPS12 (); CohP05 (); DaFSY14 (); EfP07 (); FloPSW08 (); FujYKY12 (); ISKIDWY12 (); SuS90 (); SuY99 (); YaS10 (); for a recent review see FlPS12 ().
Vision and mobility provide the robots with stigmergy, enabling the robots to communicate and coordinate their actions by moving and sensing their relative positions; they are otherwise assumed to lack any means of explicit direct communication. This restriction could enable deployment in extremely harsh environments where communication is impossible or can be jammed. Nevertheless, in many other situations it is possible to assume the availability of some sort of direct communication. The theoretical interest is obviously for weak communication capabilities.
A model employing a weak explicit communication mechanism is that of robots with lights, or luminous robots, initially suggested by Peleg Peleg2005 (). In this model, each robot is provided with a local externallyvisible light, which can assume colors from a fixed set. The robots explicitly communicate with each other using these lights. The lights are persistent (i.e., the color is not erased at the end of a cycle), but otherwise the robots are oblivious DasFPSY12 (); DasFPSY14 (); EfP07 (); FlSVY13 (); Peleg2005 (); Vi13 (). Notice that a light with only one possible color is the same as no light; hence the luminous robots model generalizes the classical one.
Both in the classical model and in that with lights, depending on the assumptions on the activation schedule and the duration of the cycles, different settings are identified. In the synchronous setting, the robots operate in rounds, and all the robots that are activated in a round perform their cycle in perfect synchrony. In this case, the system is fully synchronous (or FSynch) if all robots are activated at all rounds, and it is semisynchronous (or SSynch) otherwise. In the asynchronous setting (or ASynch), there is no common notion of time, and no assumption is made on the timing and duration of each computation and movement, other than that it is finite. (For the SSynch and ASynch models there are bland fairness assumptions that prevent robots from remaining inactive forever, which are discussed in Section 2.1).
The choice of when a robot is activated (in SSynch) and the duration of an activity within a cycle (in ASynch) is made under the control of an adversary, or scheduler. Similarly, the choices of the initial location of each robot and of its private coordinate system are made under adversarial conditions.
A crucial distinction is whether or not the adversary has also the power to stop a moving robot before it reaches its destination. If so, the moves are said to be nonrigid. The only constraint is that, if interrupted before reaching its destination, the robot moves at least a minimum distance (otherwise, the adversary would be able to prevent robots from reaching any destination, in any amount of cycles). If the adversary does not have such a power, the moves are said to be rigid. The model with rigid moves is referred to as Rigid, and the other one is called NonRigid.
In the rest of the paper, with abuse of terminology, we will often refer to FSynch, SSynch, or ASynch robots or schedulers (as opposed to systems), and to Rigid or NonRigid robots or schedulers (as opposed to models).
1.2 Obstructed Visibility
The classical model and the more recent model of robots with lights share a common assumption: that three or more collinear robots are mutually visible. It can be easily argued against such an assumption, and for the importance of investigating computability when visibility is obstructed by the presence of other robots: that is, if two robots and are located at and at time , they can see each other if and only if no other robot lies on the segment at that time.
Very little is known on computing with obstructed visibility. In fact, the few studies on obstructed visibility have been carried out in other models: the model of robots in the onedimensional space CoP08 (); and the socalled fat robots model, where robots are not geometric points but occupy unit disks, and collisions are allowed and can be used as an explicit computational tool (e.g., AgGM13 (); BoKF12 (); CzGP09 ()). In our model, collisions can create unbreakable symmetries: since robots are oblivious and anonymous and execute the same protocol, if (a collision), then the activation adversary can force for all if the two robots do not have lights or their lights have the same color. Thus, unless this is the intended outcome, collision avoidance is always a requirement for all algorithms in the model considered here.
In this paper we focus on luminous robots in the presence of obstructed visibility, and investigate computing in such a setting. Clearly, obstructed visibility increases the difficulty of solving problems without the use of additional assumptions. For example, with unobstructed visibility, every active robot can determine the total number of robots at each activity cycle. With obstructed visibility, unless a robot has apriori knowledge of and this knowledge is persistently stored, the robot might be unable to decide if it sees all the robots; hence it might be unable to determine the value .
The main problem we investigate, called Mutual Visibility, is perhaps the most basic in a situation of obstructed visibility: starting from arbitrary distinct positions in the plane, within finite time the robots must reach a configuration in which they are in distinct locations, they can all see each other, and they no longer move. This problem is clearly at the basis of any subsequent task requiring complete visibility. Notice that this problem does not exist under unobstructed visibility, and has never been investigated before.
Among the configurations that achieve mutual visibility, a special class is that where all robots are in a strictly convex position; within that class, of particular interest are those where the robots are on the perimeter of a circle, possibly equally spaced. The problems of forming such configurations (respectively called Convex Formation and Circle Formation) have been extensively studied both directly (e.g., DatDGM13 (); Defago2008 (); DiLaPe08 (); FlPSV14 ()) and as part of the more general Pattern Formation problem (e.g., FloPSW08 (); FujYKY12 (); SuS90 (); SuY99 (); YaS10 ()). Unfortunately, none of these investigations consider obstructed visibility, and those algorithms do not work in the setting considered here.
Note that a requirement of the Mutual Visibility problem is that robots stop moving after they have reached a configuration in which they all see each other. To this end, we will grant robots the ability to perform a special operation called termination, after which they can no longer be activated by the scheduler. The termination operation is especially useful in practice when the robots have to perform several tasks in succession. Of course, even if this operation is not directly available, it can still be simulated via the addition of an extra color, which can be used by a robot to indicate (to the other robots, as well as to itself) that it has terminated. Moreover, if the termination operation is removed from the algorithms presented in this paper (and some straightforward adjustments are made, which do not require extra colors), then a weaker form of the Mutual Visibility problem is solved, in which the robots get to permanently see each other, but they never stop moving. That is, all obstructions are permanently removed, but the termination condition is not met. In some cases, removing the termination operation will even allow us to successfully apply our algorithms to different problems, such as Circle Formation and Near Gathering, as discussed in Section 6.
1.3 Main Contributions
In this paper we investigate under what conditions luminous robots can solve Mutual Visibility and at what cost (i.e., with how many colors). We establish a spectrum of results, depending on the power of the adversary, on the number of colors, and on the apriori knowledge the robots have about the systems.
We first consider the case when the adversary can choose the activation schedule (in SSynch) and the duration of each robot’s operations (in ASynch), but cannot interrupt the movements of the robots; that is, movements are rigid. In this case, we show the following.
Theorem 1.1.
Mutual Visibility is solvable without collisions by Rigid robots

with no colors in SSynch, if the robots know their number, ;

with colors in SSynch, always;

with colors in ASynch, always.
We then consider the case when the adversary has also the power to interrupt the movements of the robots; that is, movements are nonrigid. The only restriction is that there exists a constant absolute length such that, even if a robot’s move is interrupted before it reaches the destination, it travels at least a length towards it (otherwise it many never be able to reach any destination). In the case of nonrigid movements, we prove the following.
Theorem 1.2.
Mutual Visibility is solvable without collisions by NonRigid robots

with no colors in SSynch, if the robots know and their number, ;

with colors in SSynch, if the robots know ;

with colors in SSynch, always;

with colors in ASynch, if the robots agree on the direction of one coordinate axis.
All these results are established constructively. We present and analyze two protocols, Algorithm 1 (Shrink) and Algorithm 2 (Contain), whose goal is to allow the robots to position themselves at the vertices of a convex polygon, solving Convex Formation, and thus Mutual Visibility. These two algorithms are based on different strategies, and are tailored for different situations. Protocol Shrink uses two colors and requires rigid movements, while protocol Contain uses more colors but operates also with nonrigid movements. We prove their correctness for SSynch robots (Sections 3 and 4). We then show how, directly or with simple expansions and modifications of these two algorithms, all the claimed results follow (Sections 5 and 6). Finally, we propose some open problems (Section 7).
Let us point out that, to prove the correctness of Shrink, we solve a seemingly unrelated problem, Communicating Vessels, which is interesting in its own right.
As a byproduct of our solutions, we provide the first obstructedvisibility solution to a classical problem for oblivious robots: collisionless convergence to a point (NearGathering) (see FlPS12 (); PaPeVi12 ()), Indeed, if the robots continue to follow algorithm Shrink once they reach full visibility, the convex hull of their positions converges to a point, and the robots approach it without colliding, thus solving NearGathering (Section 6.3). This algorithm has an interesting faulttolerance property: if a single robot is faulty and becomes unable to move, the robots will still solve NearGathering, converging to the faulty robot’s location (Section 6.6).
Additionally, both protocols can be modified so that the robots can position themselves on the perimeter of a circle, thus providing an obstructedvisibility solution to the classical problem of Circle Formation. The problem can be solved with colors in Rigid SSynch, with colors in NonRigid SSynch, and with colors in Rigid ASynch, and NonRigid ASynch with agreement on one axis (Section 6.2).
2 Model and Definitions
2.1 Modeling Robots
We mostly follow the terminology and definitions of the standard model of oblivious mobile robots (e.g., see FlPS12 ()).
By we denote a set of oblivious mobile computational entities, called robots, operating in the Euclidean plane, and initially placed at distinct points. Each robot is provided with its own local coordinate system centered in itself, and its own notion of unit distance and handedness. We denote by the position occupied by robot at time ; these positions are expressed here in a global coordinate system, which is used for description purposes, but is unknown to the robots. Two robots and are said to collide at time if . A robot can see another robot (equivalently, is visible to ) at time if and only if no other robot lies in the segment at that time.
The robots are luminous: each robot has a persistent state variable, called light, which may assume any value in a finite set of colors. The color of at time can be seen by all robots that can see at that time.
The robots are autonomous (i.e., without any external control), anonymous (i.e., without internal identifiers), indistinguishable (i.e., without external markings), without any direct means of communication, other than their lights. At any time, robots can be performing a variety of operations, but initially (i.e., at time ) they are all still and idle.
When activated, a robot performs a LookComputeMove sequence of operations: it first obtains a snapshot of the positions, expressed in its local coordinate system, of all visible robots, along with their respective colors (Look phase); using the last obtained snapshot as an input, the robot executes a deterministic algorithm, which is the same for all robots, to compute a destination point (expressed in its local coordinate system) and a color , and it sets its light to (Compute phase); finally, it moves towards (Move phase). It then starts a new cycle, whenever the scheduler (which is an abstract entity controlling to some extent the behavior of the robots) decides to activate it again.
In the Compute phase, a robot may also decide to terminate its execution. When a robot has terminated, it remains still forever, and its light remains the same color that it was at the moment of termination.
The robots are oblivious in the sense that, when a robot transitions from one cycle to the next, all its local memory, except for the light, is reset. In other words, a robot has no memory of past computations and snapshots, except for the light.
With regards to the activation and timing of the robots, there are two basic settings: semisynchronous (SSynch) and asynchronous (ASynch). In SSynch, the time is discrete; at each time instant (called a round or a turn) a subset of the robots is activated by the scheduler and performs a whole LookComputeMove cycle atomically and instantly. At any given round, any subset of robots may be activated, from the empty set to all of . In particular, if all robots are activated at every round, the setting is called fully synchronous (FSynch). There is a bland fairness constraint on the choices that the scheduler can make: every robot must be activated infinitely many times (unless it terminates). In ASynch, there is no common notion of time: each robot executes its cycles independently, the Look operation is instantaneous, but the Compute and Move operation can take an unpredictable (but finite) amount of time, unknown to the robot. In a Move phase there are no constraints on the speed of a robot, as long as it always moves directly towards its destination point at nonnegative speed.
The scheduler that controls the activations (in SSynch) and the durations of the operations (in ASynch) can be thought of as an adversary, whose purpose is to prevent the robots from doing their task. Other than acting as a scheduler, the adversary also determines the initial position of the robots and their local coordinate systems; in particular, the coordinate system of a robot might not be preserved over time and might be modified by the adversary between one cycle and the next. In the simplest model, the robots do not necessarily agree on the orientation of the coordinate axes, on the unit distance, and on the clockwise direction (i.e., the handedness of the system). However, in Section 5.2, we will discuss the special model in which all the robots agree on the direction of one axis, and the adversary is unable to change it.
The adversary might or might not have the power to interrupt the movement of a robot before it reaches its destination in the Move operation. If it does, the system is said to be NonRigid. The only constraint on the adversary is that there exists a constant such that, if interrupted before reaching its destination, a robot moves at least a distance . The value of is decided by the scheduler once and for all, and typically it is not known by the robots, which therefore cannot use it in their computations (we will discuss the scenario in which the robots know the value of in Section 6.4). Notice that, without this constraint, the adversary would be able to prevent a robot from reaching any given destination in a finite number of turns. If movements are not under the control of the adversary, and every robot reaches its destination at every turn, the system is said to be Rigid.
2.2 Mutual Visibility and Related Problems
The Mutual Visibility problem requires robots to form a configuration in which they occupy distinct locations, and no three of them are collinear. Subsequently, the robots have to terminate. A protocol is a solution of Mutual Visibility if it allows the robots to solve Mutual Visibility starting from any initial configuration in which their positions are all distinct, and regardless of the decisions of the adversary (including the activation schedule, the local coordinate systems of the robots, and the value of ).
Let us stress that, since robots are oblivious and anonymous and execute the same protocol, if (a collision), then the adversary can force for all if the two robots do not have lights or their lights have the same color. Hence the two robots will never again occupy distinct locations, and will no longer be able to solve Mutual Visibility. Thus, collision avoidance of robots with the same color is a requirement for any solution protocol.
Among the configurations that solve the Mutual Visibility problem, a special class is that in which all robots are in a strictly convex position. Within this class, of particular interest are the configurations in which the robots lie on the perimeter of a circle. Among these, there are the notable configurations in which the robots occupy the vertices of a regular gon. The problems of forming such configurations are called Convex Formation, Circle Formation, and Uniform Circle Formation, respectively.
2.3 Geometric Notions and Observations
A finite set of points is said to be convex if all the points of lie on the perimeter of the convex hull of . If a point of a convex set lies in the relative interior of an edge of the convex hull of , then is said to be a degenerate vertex of the convex hull. If none of the points of a convex set is a degenerate vertex of the convex hull, then is said to be a strictly convex set. On the other hand, we will say that a polygon is degenerate if its area is zero. These two notions of degeneracy are used in different contexts (one refers to vertices, the other refers to whole polygons), hence they can hardly be confused.
Let denote the convex hull of at time . The robots lying on its boundary are called external robots at time , while the ones lying in its interior are the internal robots at time .
Observe that a robot may not know where the convex hull’s vertices are located, because its view may be obstructed by other robots. However, it can easily determine whether it is an external or an internal robot. In fact, a robot is external at time if and only if there is a halfplane bounded by a straight line through whose interior contains no robots at time . In other words, is external if and only if it lies on the boundary of the convex hull of the robots that it can currently see. Note also that the neighbors of an external robot on its visible convex hull are indeed its neighbors on the actual convex hull. If, in addition, lies at a nondegenerate vertex of the (visible) convex hull, it is said to be a vertex robot.
Moreover, a robot is able to tell if is a line segment, i.e., if all the robots are collinear. In particular, if a robot can see only one other robot, it understands that it is an endpoint robot. Conversely, nonendpoint robots can always see more than one other robot.
The points of are treated like vectors, and as such they can be added, subtracted, multiplied by scalars, etc. The dot product between vectors and will be indicated by the expression .
3 Solving Mutual Visibility for Rigid SSynch Robots
In this section we consider the Mutual Visibility problem in the Rigid SSynch setting. We present and analyze a protocol, Algorithm 1 (Shrink), and we prove it solves Mutual Visibility in such a setting using only two colors.
3.1 Description of Algorithm 1
The main idea of Algorithm 1 is to make only the external robots move, so as to shrink the convex hull. When a former internal robot becomes external, it starts moving as well. Eventually, all the robots reach a strictly convex configuration, and at this point they all see each other and they can terminate.
If an active robot , located at , realizes that it is not a vertex robot, it does not move. Otherwise, it locates its clockwise and counterclockwise neighbors (in its own coordinate system) on the convex hull’s boundary, say located at and , which are necessarily visible. Then, attempts to move somewhere in the triangle , in such a way to shrink the convex hull, and possibly make one more robot become a vertex robot. To avoid collisions with other robots that may be moving at the same time, ’s movements are restricted to a smaller triangle, shaded in gray in Figure 1. Moreover, to avoid becoming a nonvertex robot, does not cross any line parallel to that passes through another robot, and it carefully positions itself on the closest of such lines, as shown in Figure 1(a). In particular, if no such line intersects the gray area, makes a default move, and it moves halfway toward the midpoint of the segment , as indicated in Figure 1(b).
In order to recognize that the Mutual Visibility problem has been solved, and to correctly terminate, the robots carry visible lights of two possible colors: namely, . All robots’ lights are initially set to Off. If an active robot realizes that it is a vertex of the convex hull, it sets its light to the other value, Vertex. Hence, when a robot sees only robots whose lights are set to Vertex, it knows it can see all the robots in the swarm, and hence it terminates.
The above rules are sufficient to solve the Mutual Visibility problem in most cases, but there are some exceptions. It is easy to see that there are configurations in which Mutual Visibility is never solved until an internal robot moves, regardless of the algorithm employed. For instance, suppose that the configuration is centrally symmetric, with one robot lying at the center. Let the local coordinate systems of any two symmetric robots be oriented symmetrically and have the same unit distance, and assume that the scheduler chooses to activate all robots at every turn. Then, every two symmetric robots have symmetric views, and therefore they move symmetrically. If the central robot—which is an internal robot—never moves, then the configuration remains centrally symmetric, and the central robot always obstructs all pairs of symmetric robots. Hence Mutual Visibility is never solved, no matter what algorithm is executed.
It turns out that our rules can be fixed in a simple way to resolve also this special case: whenever an internal robot sees only robots whose lights are set to Vertex (except its own light), it moves to the midpoint of any edge of the convex hull.
Finally, the configurations in which all the robots are collinear need special handling. In this case it is impossible to solve Mutual Visibility unless some robots leave the current convex hull. Suppose that a robot realizes that all robots lie on a line, and that it is not an endpoint (i.e., can see only two other robots, which are collinear with it). Then, moves by any positive amount, orthogonally to the line formed by the other two visible robots. When this is done, the previous rules apply.
3.2 Correctness of Algorithm 1
3.2.1 Invariants
In the following we discuss some basic invariants, which will serve to prove the correctness of Algorithm 1.
Suppose that, for some , is not a line segment: the situation is illustrated in Figure 2. If a vertex robot is activated, it is bound to remain in the corresponding gray triangle, called movement region of the robot. More precisely, the movement region consists of the interior of the gray triangle, plus the vertex where the robot currently is, plus the interior of the edge that is opposite to the robot. Hence all movement regions are disjoint. Moreover, if there is only one internal robot and it sees only robots whose light is set to Vertex, it moves to the midpoint of an edge of , which does not lie in any movement region. It follows that, no matter which robots are activated at time , they will not collide at time . Also, .
Recall that a robot is a vertex robot if an only if it lies at the vertex of a reflex angle whose interior does not contain any robots. Now, referring to Figure 1, it is clear that a vertex robot will remain a vertex robot after a move. Additionally, if no new vertex robots are acquired between time and , then the ordering of the vertex robots around the convex hull is preserved from time to time . This easily follows from the fact that every robot remains in its own movement region (cf. Figure 2).
3.2.2 Convergence
We seek to prove that Algorithm 1 makes every robot eventually become a vertex robot. As it will be apparent in the proof of Theorem 3.1, the crux of the problem is the situation in which only default moves are made (cf. Figure 1(b)). We first prove that, if all robots perform only default moves, then they all converge to the same point (see Lemma 3.3 below).
Since we are assuming that only the vertex robots move, and that their movements depend only on the positions of other visible vertex robots, we may as well assume that all robots are vertex robots, and that their indices follow their order around the convex hull. Indeed, by the invariants observed in Section 3.2.1, all robots will remain vertex robots throughout the execution, and their ordering around the convex hull will remain the same. So, let , , be three vertex robots, which appear on the boundary of consecutively in this order. Let perform a default move at time . Then, the new position of is a convex combination of the current positions of these three robots, and precisely
(1) 
In general, as different sets of vertex robots are activated in several rounds, and nothing but default moves are made, the new location of each robot is always a convex combination of the original positions of all the robots, obtained by applying (1) to the set of active robots, at every round. In formulas,
with and , assuming that the robots start making only default moves at time . Let . We fix , and we let , where indices are taken modulo . We claim that
(2) 
If such a claim is true (for all ), it implies that the robots get arbitrarily close to each other, as grows. This, paired with the fact that for every , as observed in Section 3.2.1, allows us to conclude that the robots converge to the same limit point.
A proof of this statement can be obtained using the theory of convergence of asynchronous algorithms in the book BeTsi89 (). Indeed, the update rule (1) corresponds to performing time stepping on a Markov chain with circulant transition matrix
It is proven in a statement on (BeTsi89, , page 435) that the timestepping iteration converges even when performed asynchronously, under a model that generalizes our SSynch.
Nevertheless, we give here an alternative selfcontained proof. First we reformulate the problem in the following terms.
Communicating Vessels
Suppose that vessels containing water are arranged in a circle, and there is a pipe between each pair of adjacent vessels, regulated by a valve. At every second, some of the valves are opened and others are closed, in such a way that each of the valves stays open for infinitely many seconds, in total. If a valve between two adjacent vessels stays open between seconds and , then of the surplus of water, measured at second , flows from the fuller vessel to the emptier one. Our claim is that the amount of water converges to the same limit in all vessels, no matter how the valves are opened and closed. We call this problem Communicating Vessels.
In this formulation, the amount of water in the th vessel at time would be our previous . However, here we somewhat abstract from the Mutual Visibility problem, and we consider a slightly more general initial configuration, in which the ’s are arbitrary real numbers.
This problem is a special case of a diffusion model on a simple circular graph. To solve it, we shall introduce a quadratic energy functional , and prove that it is decreasing. The use of such an energy functional in this class of problems is well known in the literature (see for instance Cyb89 ()), but the fact that the iteration is performed semisynchronously on each node separately is less standard, so we need to do a little more work.
We set if the valve between the th and the th vessel is open between time and (indices are taken modulo ), and otherwise. It is easy to verify that activating robot at time in our previous discussion corresponds to setting in the Communicating Vessels formulation.
Let us denote by the vector whose th entry is , and let . We first prove an inequality on the Euclidean norms of the vectors . Note that the inequality holds regardless of what assumptions are made on the opening pattern of the valves.
Lemma 3.1.
For every ,
(3) 
Proof.
For brevity, let , , ; hence, and .
Suppose first that , i.e., both valves connecting the th vessel with its neighbors are open. Then, . We have
(4) 
which can be obtained by dropping the term from the algebraic identity
Now, suppose instead that and . Then we have , and
(5) 
where the first equality comes from the identity
If and , an analogous argument gives
(6) 
Finally, if , , and trivially
(7) 
We sum for each the relevant inequality among (4), (5), (6), (7), depending on the value of and . Each of the terms appears twice if and only if , and the coefficients of the terms in sum to 1 for every , hence we get (3). ∎
From the previous lemma, it immediately follows that the sequence is nonincreasing. Since it is also bounded below by , it converges to a limit, which we call . Let and . Observe that each entry of is a convex combination of entries of , hence is nonincreasing and is nondecreasing. Therefore they both converge, and we let and .
Corollary 3.1.
Proof.
For every , we have
which proves the second inequality. As for the first inequality, for every and largeenough , we have . ∎
For the next lemma, we let .
Lemma 3.2.
Suppose that for at least distinct values of . Then,
Proof.
Due to Corollary 3.1, it is enough to prove that . By contradiction, assume , and let . We have
hence there exists such that for every . By Lemma 3.1,
for every and every such that . This implies , that is, a necessary condition for the valve between the th and the th vessel to be open at time is that . Consider now the open intervals
each of width . Since and , there are ’s above and below all these intervals. Moreover, by the pigeonhole principle, at least one of the intervals contains no ’s, for any . In other words, we can find a partition , with and both nonempty, and a threshold value such that for every , and for every . Hence, at time , only valves between entries of whose indices belong to the same can be open. It is now easy to prove by induction on the following facts:

,

,

whenever and belong to two different classes of the partition.
Since and are nonempty, there must be at least two distinct indices and such that and (where indices are taken modulo ). It follows that the th and th valve are never open for , and this contradicts the hypothesis that for at most one choice of . ∎
This solves the Communicating Vessels problem.
Corollary 3.2.
Under the hypotheses of Lemma 3.2, for every ,
Proof.
By Lemma 3.2, since , all the limits coincide. Moreover, the sum of the ’s does not depend on ; hence their average, taken at any time, must be equal to the joint limit. ∎
Let us return to the Mutual Visibility problem, to prove our final lemma.
Lemma 3.3.
If, at every round, each robot makes a default move (cf. Figure 1(b)) or stays still, all external robots have their lights set to Vertex, and no new robots become vertex robots or terminate, then all robots’ locations converge to the same limit point.
Proof.
We are now ready to prove our main theorem.
Theorem 3.1.
Algorithm 1 solves Mutual Visibility for Rigid SSynch robots with 2colored lights.
Proof.
If the initial convex hull is a line segment, it becomes a nondegenerate polygon as soon as one or more of the nonvertex robots are activated. It is also easy to observe (cf. Figure 2) that, from this configuration, the convex hull may never become a line segment. So the invariants discussed in Section 3.2.1 apply, possibly after a few initial rounds: no two robots will ever collide, and a vertex robot will never become a nonvertex robot.
Assume by contradiction that the execution never terminates. Note that a robot terminates if and only if all robots terminate. Indeed, if there are any nonvertex robots (whose lights are still set to Off), then each vertex robot can see at least one of them. Hence we are assuming that all robots execute the algorithm forever.
At some point, the set of vertex robots reaches a maximum , and as soon as all of these robots have been activated, they permanently set their lights to Vertex. Let be a time at which all the robots in have their lights set to Vertex. Suppose that there are external robots that are not vertex robots after time , and let be one such robot that is adjacent to a vertex robot . Then, after is activated and moves, becomes a vertex robot as well, contradicting the maximality of . Hence the external robots are exactly the robots in , and no other robot may become external after time .
If there is only one internal robot at time , it becomes external as soon as it is activated, due to line 23 of the algorithm, which is impossible, as argued in the previous paragraph. Therefore there are at least two internal robots at every time . On the other hand, if a vertex robot makes a nondefault move at any time , a new robot becomes external at time . Indeed, referring to Figure 1(a), the line passes through and , and no robot lies above this line at time . Hence becomes a new external robot, which again is impossible.
As a consequence, only default moves are made after time . Moreover, no robot becomes external or becomes a vertex robot after time , and no robot ever terminates. Therefore Lemma 3.3 applies, and the robots converge to the same limit point. But since there are at least two internal robots, this means that at least one of them has to move, implying that it becomes a vertex robot at some point (by the above assumptions, only vertex robots can move), a contradiction.
Hence the execution terminates, meaning that at some point one of the robots sees only vertex robots. This implies that there are no nonvertex robots, hence the configuration is strictly convex, all robots can see each other, and they all terminate without moving as soon as they are activated, thus solving the Mutual Visibility problem. ∎
4 Solving Mutual Visibility for NonRigid SSynch Robots
Here we give a protocol, Algorithm 2 (Contain), for the Mutual Visibility problem that works for NonRigid robots and the SSynch scheduler. Recall that, in the NonRigid model, the robots make unreliable moves, that is, the scheduler can stop them before they reach their destination point, but not before they have moved by at least a constant . Since these robots are weaker than the ones considered in Section 3, they will require lights of three possible colors, as opposed to two.
Our goal is also to design an algorithm that can be applied to robots in the Rigid ASynch model, as well as the NonRigid SSynch one. This model will be discussed in Section 5.1. In order to do this, we introduce a couple of extra technical subtleties into Algorithm 2, which are irrelevant here, but will turn out to be necessary in Section 5.1.
4.1 Description of Algorithm 2
Algorithm 2 consists of three phases, to be executed in succession: a segment breaking phase, an interior depletion phase, and a vertex adjustments phase. The first phase deals with the special configuration in which the robots are all collinear, and makes them not collinear. If the robots are not initially collinear, this phase is skipped. In the second phase, the internal robots move toward the boundary of the convex hull, thus forming a convex configuration, perhaps with some degenerate vertices. In the third phase the robots (which are now all external) make small movements to finally reach a strictly convex configuration. Three colors are used by the robots: . Initially, all robots’ lights are set to Off.
For added clarity, in the algorithm the line numbers of instructions belonging logically to different phases are typeset in different colors, according to the following table.
Segment breaking  red 
Interior depletion  green 
Vertex adjustments  blue 
Recall that we denote by the convex hull of the positions of all the robots at time . In this section we also denote by the convex hull of the positions of the internal robots at time . Note that the “global” notions of and may differ from the ones computed by the robots executing Algorithm 2, because a robot may be unable to see the positions of all the other robots in the swarm. In the following discussion, when referring to and , we will typically mean the “global” ones, unless we explicitly state otherwise.
We first describe the interior depletion phase, starting from a noncollinear initial configuration. To begin with, all the robots’ lights are set to Off. As soon as an external robot is activated, it sets its own light to External (lines 34, 35) and does not move as long as it can still see robots whose light is Off (lines 26, 27). Note that a robot that occupies a vertex of eventually becomes aware of it, by looking at the convex hull of the visible robots whose lights are Off. These may not all be internal robots, because perhaps not all external robots have been activated yet, but eventually gets to see a goodenough approximation of a “neighborhood” of , and it realizes it occupies one of its vertices.
So, when a robot understands that it lies on a vertex of , it moves toward the boundary of , part of which is also identifiable by . We distinguish three cases.

If realizes it is the only internal robot, it moves toward the midpoint of an edge of the convex hull (line 41). To avoid bouncing back and forth at different turns, it always chooses the closest of such midpoints.

If realizes that is a line segment and it occupies one endpoint of it, it moves like in Figure 3(a). That is, it moves to the boundary of , while remaining within a right angle oriented away from (lines 43–45).
Figure 3: Interior depletion phase 
Finally, if “believes” that is a nondegenerate polygon and that it lies on one of its vertices, it moves as in Figure 3(b) (lines 47–54). Remember that may believe so even if is actually degenerate, because some external robots may still be Off. However, gets an approximation of , which we call , and it knows it lies on a vertex of , implying that it also lies on a vertex of the “real” . Now, if the internal angle of at is acute, moves as the robot in in Figure 3(b): it moves to the boundary of while remaining between the extensions of its two incident edges of . Otherwise, if the angle is not acute, moves as the robot in in Figure 3(b): it moves to the boundary of while staying between the two perpendiculars to its incident edges of . Moreover, actually performs the move only if it is sure that its destination point lies on the boundary of the “real” . For this reason, it has to check if the destination point computed as described above lies on a completelyvisible edge of the observed convex hull whose endpoints are both set to External (line 53). For instance, in Figure 4, the robot in cannot move to the gray area even if the robots in and are set to External, because the robot in prevents the one in from seeing the whole edge . On the other hand, the robot in can move to its own gray area, provided that and are set to External. Indeed, the robot in can see all of , and it is therefore sure that it is an edge of the “real” convex hull.
Now to the vertex adjustments phase. When a robot lies at a vertex of and it sees only robots whose light is set to External, it makes the “default move” of Figure 1(b), where and are the locations of its two neighbors on (line 29). Moreover, while doing so it also sets its light to the third value, Adjusting, as a “selfreminder” (line 28). So, when it is activated again, it knows it has already adjusted its position, and it terminates, after reverting its light to External (lines 20–25). This way we make sure that each vertex robot adjusts its position exactly once, and we ensure termination. When the adjustment is done, the robots at and are guaranteed to occupy vertices of , instead of lying in the middle of an edge. So, each external robot becomes a vertex robot at some point, then it adjusts its position while remaining a vertex, possibly making its adjacent robots become vertices as well, and it terminates. When all robots have terminated, the configuration is strictly convex, and therefore Mutual Visibility is solved.
Finally, the segment breaking phase deals with the special case in which all robots are initially collinear. Let robots and be the two endpoints of : as soon as one of them is activated (possibly both), it sets its light to Adjusting, moves orthogonally to , and then waits (lines 11, 12). Meanwhile, the other robots do not do anything until some conditions are met (lines 31–34). If only moves, realizes it (line 32) and sets its own light to External (and vice versa). If both and move together, some other robot realizes that it is a nondegenerate vertex of the convex hull and that it can see both and set to Adjusting (line 33): in this case, it sets itself to External. When or sees some robots set to External, it finally sets itself to External, as well (lines 22, 23). Additionally, it may terminate, provided that neither of its neighboring robots on the convex hull’s boundary has still its light set to Off (line 24) and that it recognizes no robots as internal (line 25). This is to force and to make at least one default move in the unfortunate case that a third external robot is found between them after their initial move, or gets there during the interior depletion phase (refer to the complete discussion in Section 4.2.3). After this is done, the execution transitions seamlessly into one of the general cases.
If this is not sufficient. Suppose first that . Then, and may move in such a way that the configuration remains centrally symmetric, with the middle robot obstructing and . However, after moving once, and become External and terminate (lines 8, 9). Meanwhile waits until it sees both and set to External, and finally it moves orthogonally to (lines 13–16), thus solving Mutual Visibility also in this special case.
If , each robot moves once (lines 11, 12), and then it detects a situation in which it can safely terminate (lines 6–9).
4.2 Correctness of Algorithm 2
4.2.1 Interior Depletion Phase
We first prove that no collisions occur during the interior depletion phase, and then that the phase itself eventually terminates, with all the robots becoming external. In this section we will assume that the robots are not initially collinear. The collinear case will be discussed in Section 4.2.3, and it will be shown that is seamlessly transitions into one of the other cases.
It is easy to observe that, during the interior depletion phase, all external robots keep seeing (internal) robots whose lights are set to Off, and therefore none of them moves. On the other hand, no internal robot moves outside of the convex hull.
Observation 4.1.
If there are internal robots at time , no external robot moves, and .
Lemma 4.1.
If and are two internal robots at time , then
Proof.
If is not activated at time , or it is activated but it does not move, then the lefthand side is zero, and therefore the inequality holds. Suppose now that moves by a positive amount, so is not the null vector. Let be the line through that is orthogonal to the segment . By construction, moves in such a way that lies in the open halfplane bounded by that does not contain (note that this holds a fortiori also if some external robots have not set their lights to External yet, and therefore the computed by is larger than the real one). Since , lies on or in the halfplane bounded by that does not contain . This is equivalent to saying that the dot product between and is not positive. ∎
Lemma 4.2.
As long as there are internal robots, no collisions occur.
Proof.
If there are internal robots, every external robot sees robots whose light is set to Off, and hence it does not move. By construction, the internal robots avoid moving on top of external robots, and therefore there can be no collision involving external robots.
Suppose by contradiction that two robots and that are internal at time collide for the first time at , and therefore . By Lemma 4.1 applied to and , we have
(8) 
Applying Lemma 4.1 again with and inverted, we also have
(9) 
Adding 8 and 9 together and doing some algebraic manipulations, we obtain
The latter is equivalent to , implying that . This contradicts the fact that and collide for the first time at . ∎
We still have to prove that the interior depletion phase terminates, that is, eventually all robots become external. Due to Observation 4.1, when a robot becomes external, it stops moving and remains external, at least as long as there are other internal robots. Thus, if by contradiction this phase does not terminate, the set of internal robots reaches a nonempty minimum, and from that time on no new robot becomes external. After possibly some more turns, say at time , all external robots have been activated and have set their lights to External, and hence no robot changes its light any more.
In the following lemmas, we will show that these assumptions on yield a contradiction. We will prove that, if is a nondegenerate polygon, then either its area or its diameter will grow unboundedly. Therefore, at some point in time, will not be a subset of any more. (The analysis when is a degenerate polygon is easy, and it will be carried out in the proof of Lemma 4.7.)
Recall that, due to line 50 of Algorithm 2, when a robot computes its destination, it remains within the extensions of its incident edges of . Hence, referring to Figure 5, it is easy to observe the following.
Observation 4.2.
Let robots and lie at adjacent vertices of at time , and let the area of be positive. Then, and lie on the same side of the line through and (or possibly on the line itself).
Lemma 4.3.
If and the area of is positive, then .
Proof.
Let be the set of robots that lie at vertices of , at time . Let be the polygon (illustrated in Figure 5 as a thick dashed polygon) whose vertices are the locations at time of the robots of , taken in the same order as they appear around the boundary of . Note that, since the robots are NonRigid and not all of them are necessarily activated at time , is not necessarily a convex polygon.
Because the property stated in Observation 4.2 holds for all the edges of and , we have that . But, by definition of , none of the robots of ever becomes external, and hence is the convex hull of . We conclude that . ∎
Corollary 4.1.
For , the area of and the diameter of do not decrease as increases.
Proof.
By Lemma 4.3, if , then . Hence the area of cannot be greater than the area of , and the diameter of cannot be greater than the diameter of . ∎
Corollary 4.2.
If is an internal robot at time , and is not a nondegenerate vertex of , then is internal at any time , and is not a nondegenerate vertex of .
Proof.
Recall that, due to line 53 of Algorithm 2, a robot on the perimeter of is able to move only if it completely sees an entire edge of . Next we prove that, after time , there exists at least one robot that is able to move.
Lemma 4.4.
At any time after , there is a robot that, if activated, makes a nonnull movement.
Proof.
Suppose for a contradiction that no robot is able to move, and let be a nondegenerate vertex of . If is the internal angle of at , we let be the point at which the bisector of intersects the perimeter of , as Figure 6 shows.
Let be an edge of such that (note that may coincide with either or ). Since and are convex, either the segment is completely visible to , or the segment is. Without loss of generality, let be completely visible to , i.e., . By definition of , both robots in and have their lights let to External. Also, note that lies within , as computed by the robot in executing line 52 of Algorithm 2. Hence, by line 53, the robot in can move, provided that . But by assumption no robot can move, and therefore there must be one robot occupying a nondegenerate vertex of neighboring , say , such that the ray from through intersects the segment , say in .
Observe that is strictly closer to the line than . By the convexity of , the bisector of the explementary of the internal angle at intersects the segment , say in . In fact, lies between and (refer to Figure 6). Also, can see all the points in the segment . As we argued for in the previous paragraph, there must be another vertex of , closer to the line , that prevents from seeing the entire segment .
Proceeding in this fashion, we obtain a sequence , , , , of vertices of , which get closer and closer to the line . Since these vertices must be all distinct, and there are only finitely many robots in the swarm, there must be one last element of the sequence, . It follows that can see all of , and the corresponding angle bisector intersects as well, say in . This implies that the robot in can actually move to a neighborhood of , contradicting our assumption. ∎
As a consequence of Corollary 4.2, no new robot becomes a nondegenerate vertex of after time , but some robots may indeed cease to be nondegenerate vertices of , and stop moving forever. Hence, at some time , the set of robots that lie at nondegenerate vertices of reaches a minimum . By Lemma 4.3, the area of is positive at every time , and hence .
In the next lemma we prove two fundamental properties of that hold after time .
Lemma 4.5.
After time , the following statements hold.

The cyclic order of the robots of around is preserved.

The length of the shortest edge of does not decrease as increases.
Proof.
Similarly to Section 3, we call the gray regions in Figures 3 and 5 the movement regions of the respective robots.
Let , and consider the polygon as defined in the proof of Lemma 4.3. By our assumptions on , is a convex polygon, or else some robot would cease to occupy a vertex of . Hence and, by Lemma 4.3, . Let occupy two adjacent edges of at time , and let be the axis of the segment . It follows from Algorithm 2 that separates the movement regions of and at time (cf. Figure 5). This, paired with the fact that the movement region of a robot of at time does not intersect the interior of , implies (a).
Now, to prove (b), it is sufficient to note that, with the previous paragraph’s notation, the distance between the movement regions of and at time is precisely the distance between and (see Figure 5). Therefore, the segment is not shorter than , implying that the length of the shortest edge of cannot decrease. ∎
We need one last geometric observation.
Lemma 4.6.
If the internal angle at vertex of a convex polygon has measure less than , then the diameter of the polygon is the distance between and another vertex.
Proof.
The diameter of a polygon is the longest distance between two of its vertices. Suppose for a contradiction that vertices and have the maximum distance, with , as in Figure 7. Then, since the polygon is convex, the angle is containted in the internal angle at , and therefore its measure is less than . Since the sum of the internal angles of a triangle is , it follows that either or . By the law of sines, in the first case is longer than , and in the second case is longer than . In both cases, is not the longest segment joining two vertices of the polygon, which is a contradiction. ∎
We are finally ready to prove the termination, and therefore the correctness, of the interior depletion phase.
Lemma 4.7.
If Algorithm 2 is executed from a noncollinear configuration, after finitely many turns all robots become external, no robot’s light is set to Adjusting, and no two robots collide.
Proof.
The noncollision part has already been proven in Lemma 4.2, so we need to prove that eventually all robots become external.
By assumption has positive area, and we have to show that all robots become external in finitely many turns. If there is just one internal robot, it keeps moving somewhere within , until it either becomes external, or all external robots have been activated. When all external robots have their lights set to External, if there is still a single internal robot, it keeps moving toward the same edge of , until it finally reaches it.
If there there are exactly two internal robots, they move as shown in Figure 3(a). It is easy to see that, each time at least one of the two internal robots moves (by at least ), their distance increases by more than . Therefore, after finitely many turns, at least one of the two internal robots becomes external, and at most one internal robot remains.
Suppose now that there are at least three internal robots, but has null area, that is, all the internal robots are collinear. Then, according to Algorithm 2, only the two endpoint robots of are allowed to move, as Figure 3(a) shows. If they move in such a way that the internal robots keep remaining collinear, eventually one of them reaches the boundary of , and there is one less internal robot. Otherwise, they reach a situation in which has strictly positive area.
Therefore we may assume that has positive area, and we suppose for a contradiction that some internal robots never become external. By the previous lemmas and observations, we know that at some time the situation becomes “stable”. Specifically, never changes, the set of robots that occupy nondegenerate vertices of keeps remaining the same, and these robots’ positions preserve their order around , by Lemma 4.5.a. Also, the area and diameter of do not decrease, by Corollary 4.1. Let be the length of the shortest edge of . By Lemma 4.5.b, we know that is a weakly increasing function of .
Suppose that, at some time , some robot that is able to move is activated. By lines 53, 54 of Algorithm 2, the destination point of lies on the boundary of . Hence, the adversary must stop before it reaches its destination, or it would become external. But this cannot happen before has moved by at least , implying that . We distinguish two cases, based on the measure of the internal angle of corresponding to vertex . We will prove that, if , then the square of the diameter of increases by at least a constant; if , then the area of increases by at least a constant.