1 Introduction
As autonomous mobile robots, drones, and vehicles become widely spread and nanoscale manufacturing enables synthesis of target DNA, RNA, and polymers, computational power of a collection of mobile computing entities with very weak capabilities attracts much attention in distributed computing theory. The investigation also reveals the minimum capabilities for the mobile computing entities to accomplish a given task and provides design guidelines for hardware robots. These results are also expected to give a clue to understanding complex behavior of natural systems. Each mobile computing entity is called robots, agents, or particles, and it is often assumed that it is anonymous and oblivious (memoryless), and does not have any communication capability or any access to the global coordinate system. Many distributed computing models have proposed for modular robots [13], mobile robots [20], mobile adhoc networks [1], biological systems [7], and chemical reactions [19]. There are a variety of indicator tasks such as gathering [4, 20, 21], leader election [7, 10], decomposition [17], shape formation [7, 10, 13, 16, 18, 19, 20, 21, 22, 23, 24], and computing functions [1, 19].
Suzuki and Yamashita investigated the pattern formation problem by anonymous mobile robots moving in the continuous 2D space [20]. Each robot observes the positions of other robots, computes its next position with a common deterministic algorithm, and moves to the next position. The pattern formation problem requires that the mobile robots form a specified target pattern (shape) from a given initial configuration. They pointed out that the pattern formation problem is essentially related to the agreement problem. For example, the simplest agreement problem is the point formation problem, also called the gathering problem, that requires the robot to agree on a single point. Additionally, once the robots agree on a common coordinate system, they can form any target pattern. However, the anonymous robots cannot break the symmetry of their initial configuration, and the set of formable patterns is characterized by the rotational symmetry of the initial configuration.
Derakhshandeh et al. presented a shape formation algorithm for the amoebot model in the 2D triangular grid [7]. The amoebot model consists of anonymous programmable particles each of which is equipped with constantsize memory and communication capability with neighboring particles. Each vertex of a triangular grid is occupied by at most one particle at each time step, and each particle moves by repeating an extension and a contraction. Their algorithm is based on a randomized leader election, that allows formation of an arbitrary shape consisting of triangles.
Dumitrescu et al. considered shape formation in the metamorphic robotic system model that consists of oblivious modules moving in the 2D square grid [13, 12]. Each module autonomously perform two types of local movements, called a rotation and a sliding; however they are required to maintain connectivity. They presented a canonical shape, to which any convex shape can be transformed. The reversibility of movements guarantees transformation between any pair of convex shapes via the canonical shape.
The goal of these existing studies is the structure of shapes of a distributed system consisting of mobile computing entities. Reachability among shapes decomposes the system’s configuration space into subspaces, that indicate the degree of agreement and coordination, in other words, computational power of the system. When we take a closer look at existing shape formation algorithms, we find that intermediate shapes are used to guarantee the progress of distributed coordination. In other words, a shape of the system serves as its global memory while each computing entity is memoryless or equipped with constantsize memory.
In this paper, we investigate the functionality of shapes of a distributed system. We focus on the search problem by the metamorphic robotic system. The problem requires the metamorphic robotic system to find a target put in one cell of a given field, which is a finite rectangular subspace of the 2D square grid. Each module is not given any apriori knowledge of the field or the target cell and the metamorphic robotic system may start from an arbitrary initial configuration. To find the target, the metamorphic robotic system needs to remember, for example, its starting point, its current moving direction, and the progress of search. Clearly, as the number of modules increases, the number of possible shapes increases and the system can store more information. We investigate the minimum number of modules for search in an unknown 2D square grid and the effect of the global compass that allows the modules to agree on north, south, east, and west.
Our results. Although shape formation [13, 18] and locomotion [3, 12] by the metamorphic robotic system have been discussed, to the best of our knowledge, this is the first time the search problem is discussed for a metamorphic robotic system. We first demonstrate when the modules are equipped with the global compass, three modules are necessary and sufficient for search from an arbitrary initial configuration. We show impossibility for less than three modules and present a distributed search algorithm for three modules. The proposed algorithm is based on the exploration of a given field, i.e., the metamorphic robotic system visits each cell of a given field. The advantage of the proposed algorithm is that the metamorphic robotic system can start from an arbitrary initial configuration, i.e., the algorithm guarantees selfstabilization. A selfstabilizing distributed algorithm guarantees that the system autonomously converges to a legitimate execution from an arbitrary initial system configuration [11]. Selfstabilization promises robustness against a finite number of transient faults and autonomous adaptability to intermittent environment changes. Note that search and exploration by a single metamorphic robotic system is different from search by ants [14], mobile agents [5], or mobile robots [2, 8, 15] because the metamorphic robotic system cannot separate into several small fragments.
We next demonstrate that when the modules are not equipped with the global compass, five modules are necessary and sufficient; however there are initial shapes from which the metamorphic robotic system cannot perform search due to symmetric deadlocks. We present a distributed algorithm for five modules from any initial configurations without deadlocks. We also demonstrate that less than five modules cannot perform search in a given field even when we exclude initial deadlocks.
We finally consider selfstabilizing search when the modules are not equipped with the global compass. As a primitive, we consider locomotion that requires a metamorphic robotic system to keep on moving to one direction. The metamorphic robotic system must break their initial symmetry so that they agree on a moving direction. We demonstrate that seven modules can perform locomotion from any initial configuration. We thus conclude seven modules are necessary and sufficient for selfstabilizing search.
Related works. Most existing papers on the computational power of distributed system consisting of mobile computing entities focus on shape formation. One of the most active areas is pattern formation by autonomous mobile robots and the effect of various capabilities such as obliviousness [20], asynchrony [16, 21], limited visibility [23], and randomness [24] has been discussed. These papers showed that rotational symmetry of an initial configuration determines formable shapes, i.e., obliviousness and asynchrony generally have no effect. Randomness allows probabilistic symmetry breaking and realizes universal pattern formation. These results consider mobile robots in the 2D space, and Yamauchi et al. extended them to mobile robots in the 3D space, where rotational symmetry consists of five types of rotation groups [22].
Shape formation in the amoebot model is investigated for shapes consisting of triangles [7] and arbitrary shapes [10]. Di Luna et al. considered the limit of deterministic leader election and characterized formable shapes by the symmetry of an initial configuration [10]. Derakhshandeh et al. presented a universal shape formation algorithm based on a randomized leader election [7].
Shape formation for the metamorphic robotic system is investigated in a distributed setting and in a centralized setting. Dumitrescu et al. considered distributed transformability of an initial (horizontally) convex shape to a line (also called a chain) shape with the global compass [13]. Dumitrescu et al. considered locomotion of the metamorphic robotic system and presented shapes that realizes fastest locomotion [12]. While these two papers assume unlimited visibility, Chen et al. considered locomotion with limited visibility [3]. Michail et al. considered decidability of centralized transformation [18]. When the movement is limited to rotations, there are pairs of shapes that are not transformable to each other. They showed that deciding whether an initial connected shape can be transformed to a target connected shape only by rotations is in if disconnection during transformation is allowed, otherwise the decision problem is in . Then they showed combination of rotations and slidings allows transformation of any initial connected shape to a target connected shape.
Michail and Spirakis proposed the network constructor model that consists of finitestate agents under passive movement [19]. The interaction model is based on the population protocol model [1], while the agents can construct an edge when they interact. They considered distributed transformation to a spanning line and showed that agents can compute any symmetric predicate in .
All these papers consider reachability and classification of shapes. Little is investigated for the functionality of shapes. Das et al. investigated the formation of a sequence of patterns, that also serves as finite memory formed by oblivious mobile robots [6]
. Simulating a Turing machine by a line shape of computing entities has been separately discussed for the metamorphic robotic system model
[13], the network constructor model [19], and the amoebot model [10]. Di Luna et al. showed a constant number of oblivious mobile robots can simulate a robot with memory in a continuous space of an arbitrary dimension [9]. In this paper, we focus on the fact that geometric configuration of the metamorphic robotic system functions as memory and processor, and we investigate how a small number of oblivious modules collectively perform search in an unknown rectangular field.Organization. We introduce the metamorphic robotic system model and the search problem in Section 2. In Section 3 we consider modules equipped with the global compass and present the minimum number of modules for search from an arbitrary initial configuration. In Section 4 we consider modules not equipped with the global compass. We first illustrate initial deadlock states (shapes) caused by symmetric positions of modules. We then present the minimum number of modules for search from an initial configuration without deadlock. Finally, we discuss the minimum number of modules for symmetry breaking and give the minimum number of modules for locomotion from an arbitrary initial configuration. We conclude this paper with Section 5.
2 Preliminary
We consider the rectangular metamorphic robotic system introduced in [3, 12, 13, 18]. Consider a two dimensional (2D) square grid where each square cell is labeled by the underlying  coordinate system. We consider a finite subspace of width and height and call it the field. Without loss of generality, we assume that is the southwesternmost cell and is the northeasternmost cell (Figure 1). Each cell has eight adjacent cells; (E)ast , (N)orth(E)ast , (N)orth , (N)orth(W)est , (W)est , (S)outh(W)est , (S)outh , and (S)outh(E)ast . The four cells N, S, E, and W are said to be sideadjacent to . An infinite sequence of cells with the same coordinate is called a column and an infinite sequence of cells with the same coordinate is called a row. The field is surrounded by walls, the st column (the west wall), the th column (the east wall), the st row (the south wall), and the th row (the north wall). These cell labels are used just for description and there is no way to distinguish cells.
A metamorphic robotic system consists of anonymous modules, each of which occupies a distinct cell in the square grid at discrete time steps . The configuration of at time is the set of cells occupied by the modules at time . An execution is an evolution of configurations . The evolution is generated by movements of modules. Let be the set of modules that move at time . We call the modules in a backbone, that does not move at time . There are two types of movements, a rotation and a sliding, guided by backbone modules (Figure 2). A rotation of module sideadjacent to a backbone module is a rotation around by either clockwise or counterclockwise. A sliding of module is a sliding to a sideadjacent cell. In this case, there must be two backbone modules; one is that is sideadjacent to and the other is that is sideadjacent to and the destination cell of . A sliding () is defined in the same way and it requires backbone modules along the track.^{1}^{1}1 The metamorphic robotic system model in [3, 12, 13, 18] allows rotations and slidings. We extend the original model by allowing slidings for . We assume is constant with respect to the size of the field. In a rotation and sliding, the cells that passes must not contain any module. The modules cannot enter or pass through the cells of the walls.
The connectivity of configuration is represented by a connectivity graph . The edge set contains an edge for if and only if cells and are sideadjacent. When is connected, we say is connected. Any execution must satisfy the following three conditions:

Connectivity: For any , is connected.

Single backbone: For any , is connected.

No interference: For any , the trajectories of two moving modules and never overlap.
The modules are anonymous and execute a common deterministic distributed algorithm; they are uniform. At each time step, each module observes the modules in its neighborhood and decides its movement; the modules are synchronous. A cell is a neighborhood of cell if and . A distributed algorithm of neighborhood size is a total function that maps a square grid to one cell; the modules are oblivious. We assume that is constant with respect to and , and a module can observe whether each cell in its neighborhood is occupied by a module and whether it is a cell of a wall. When the modules are equipped with the global compass, they share common north, south, east, and west directions. When the modules are not equipped with the global compass, they do not know directions and their observations may be inconsistent. However, we assume that the modules agree on the clockwise direction; they share a common handedness.
The state of in is the local shape of . We use to describe a state of consisting of modules. If the modules are equipped with the global compass, the state of contains global directions, otherwise it does not contain any direction because the modules cannot recognize any rotation on their state.
When the modules are equipped with the global compass, the execution of a given algorithm is uniquely determined by because the modules can agree on a total ordering among themselves. On the other hand, when the modules are not equipped with the global compass, there exist multiple executions from depending on the local compass of each module.
The search problem requires the metamorphic robotic system to find a target put in one cell of a given field without any apriori information about the field, e.g., the size of the field, the target, the initial position of the metamorphic robotic system in the field, and so on. The target is stationary; it does not move during search. We call the cell where the target is put a target cell. For simplicity, we assume that the field is large enough so that for any initial configuration there exists at least one cell that cannot be observed by any module. We say that the metamorphic robotic system finds the target from a given initial configuration if in any execution from , some module reaches the target cell and the metamorphic robotic system stops thereafter.
The exploration problem requires the metamorphic robotic system to visit all cells of the field without any apriori information about the field. We say that the metamorphic robotic system explores a given field from a given initial configuration if in any execution from , each cell of the field is visited by some module at least once.
3 Search with global compass
In this section, we consider the metamorphic robotic system consisting of modules equipped with the global compass. When more than one modules equipped with the global compass form the metamorphic robotic system, they can agree on a total ordering of themselves. Hence, modules can perform different movements in any step. We give the following theorem.
Theorem 1
Three modules equipped with the global compass are necessary and sufficient for the metamorphic robotic system to find a target in any given field from any initial configuration.
Theorem 1 indicates that three modules can perform selfstabilizing search in any given field because they can start from any initial configuration.
We demonstrate the necessity by impossibility for less than three modules in Section 3.1 and the sufficiency with a search algorithm for three modules in Section 3.2.
3.1 Impossibility for less than three modules
By definition, a single module cannot perform any movement because there is no backbone module. When two modules form the metamorphic robotic system, one module can always perform a rotation. By repeating a rotation, the metamorphic robotic system can move in the field, however we demonstrate that it cannot find the target.
Lemma 2
Consider the metamorphic robotic system consisting of less than three modules equipped with the global compass in a sufficiently large field. For any deterministic algorithm and any initial state of , there exists a choice of the target cell such that cannot find the target.
Proof. The metamorphic robotic system consisting of a single module cannot perform any movement and search is impossible.^{2}^{2}2
If we allow random walk of a single module, of course, it can find the target with probability
. We consider the metamorphic robotic system consisting of two modules, each of which can observe its neighborhood where is a constant with respect to the size of the field. Assume that there exists a deterministic search algorithm for the two modules.There are two connected states of the two modules. In each state, specifies which module to take what type of movement. resumes the same state after two movements. Figure 3 shows all possible moves from a horizontal state after two steps. See also Figure 4 as an example of movements in two steps. If the two modules do not see a cell or the target, they repeat one of the eight moves and keep on moving to one direction. Note that we can obtain all possible moves after two movements from the other (vertical) state by rotating Figure 3.
Without loss of generality, we assume that the initial state of is the horizontal state. We first consider the case where the modules start moving to the northeast or to the east. When the field is large enough so that the modules around the center of the field cannot see the wall in their constant neighborhood, makes keep on moving to one direction. For any and , there exists an initial configuration where one module is in the th column and after the straight move the two modules reach a wall where they cannot see any corner of the field. If the two modules leave the wall, as soon as the wall goes out of their sight, they return to a wall with the straight move. The modules can visit the cells near the wall but they cannot leave the wall. Another choice of is to make keep on moving along the wall to one direction. In both cases, the two modules eventually reaches a corner of the field. At this corner, has no choice other than to make the two modules move around the adjacent wall because even when they leave the corner, they will return to the first wall due to the straight move of . Then, by the same discussion as the first wall, two modules move along the second wall until it reaches the second corner. There are two choices at the second corner and Figure 5 shows the decision diagram. There are two different routes depending on the choice of the second corner. As shown in Figure 7 and 7, there are initial configurations from which these two routes cannot visit all cells in the field. If the target is put in unvisited cells, the metamorphic robotic system cannot find it.
By the same discussion, when the two modules start moving to the south east, there are cells that the metamorphic robotic system cannot visit. In this case, the decision diagram branches not at the second corner but at the third corner. We can then extend the proof where the two modules start moving to the north east, to the north, to the south east, to the north, or to the south.
Consequently, two modules cannot find a target put in an arbitrary cell of an arbitrary field.
3.2 Search algorithm for three modules
In this section, we show the sufficiency of Theorem 1 with a search algorithm that enables three modules equipped with global compass to find a target. The proposed algorithm is so powerful that it can guarantee selfstabilizing search; three modules can start search from any initial configuration. We will show the following lemma.
Lemma 3
Three modules equipped with the global compass are sufficient for the metamorphic robotic system to find a target in any given field from any initial configuration.
Our basic method is exploration, i.e., the metamorphic robotic system visits all cells of the field. moves to the south with sweeping each row. However, since the initial configuration is arbitrary, when it reaches the southernmost (th) row, it moves to the northernmost (st) row along either the east wall or the west wall and it explores unvisited cells. Figure 8 shows examples of “tracks” of . Depending on the number of rows and an initial configuration, moves along one of such tracks. We demonstrate the progress of exploration using a reference point of defined by its spine and frontier that will be defined later. The tracks in Figure 8 show the tracks of reference points. Note that the reference point does not refer to some specific module. Rather, different modules serve as temporal reference points during exploration.
The proposed algorithm consists of the following basic moves;

A move to the east and a move to the west.

A turn on the east wall and a turn on the west wall.

A turn on the southwest corner and a turn on the southeast corner.

A move to the north wall along the east wall and that along the west wall.

A turn on the northeast corner and a turn on the northwest corner.
Figure 9 shows all possible states of . We assume that each module can observe the cells in its neighborhood. When one module of reaches a cell with the target, stops. More precisely, due to the sufficient visibility, when one module reaches a target cell, the other modules can detect the target and never perform any movement thereafter.
In the following, we show the proposed algorithm with a sequence of steps where just one module performs a rotation or sliding in each step. The proposed algorithm consists of ten types of basic moves. The point is that no pair of different moves use a state (including cells of walls ) in common. Hence, in each step, the modules can agree on what move they are performing and which module to perform a movement.
Moves along a row. Figure 14 and Figure 14 show the move to the east and the move to the west, respectively. By repeating one of the two moves, moves to one direction. Each module can observe the state of and the two sets of states used in the two moves are disjoint. Thus, the modules can agree on the direction to which is moving.
In the first state of the unit move to the east, the spine is the th row and the frontier is the th column (Figure 14). At the end of a unit move, the frontier reaches st column. During the move, the modules do not care whether st row, nd row and rd column are walls or not.
In the first state of the unit move to the west, the spine is the th row and the frontier is the th column (Figure 14). The modules do not care whether nd row, st row and st column are walls or not.
Turns on the walls. By repeating the above two moves, eventually reaches either the west wall or the east wall. Figure 14 and Figure 14 show a turn on the east wall and a turn on the west wall, respectively. changes its spine and starts a new move to the opposite direction.
In the first step of a turn on the east wall, the leftmost module cannot see the east wall and performs a rotation in the same way as the move to the east. After that, all modules can see the east wall and they perform the movements as shown in Figure 14. After the turn, performs the move to the west.
In a turn on the west wall, the three modules see the west wall from the first step. After the turn, performs the move to the east.
Turns on the south corners and moves to the north wall. By repeating the above four moves, eventually reaches the south wall. Then, it turns and moves along either the east wall or the west wall until it reaches the north wall. Figure 14 and Figure 19 show these turns.
In the first step of a turn on the southeast corner, the leftmost module cannot see the east wall and performs a rotation in the same way as the move to the east. After that, all modules can see the east wall and performs the movements of Figure 14.
In the first step of a turn on the southwest corner, the top module cannot see the south wall and performs a rotation in the same way as the turn on the west wall. After that, all modules can see the east wall and performs the movements of Figure 19.
Figure 19 and Figure 19 show the moves to the north along the vertical walls. When moves along the east wall (the west wall, respectively), the frontier is the northernmost module and the spine is the th column (the th column, respectively). By repeating one of the two moves, the reference point of eventually reaches the st row.
Turns on the north corners. By repeating the move in Figure 19 or Figure 19, eventually reaches the north wall. Then, it turns in the corner and starts moving along a row with the moves shown in Figure 14 and Figure 14. Figure 19 and Figure 19 shows these turns. In the first step of a turn on the northeast corner (the northwest corner, respectively), the bottom module cannot see the north wall and performs a rotation in the same way as the move to the north corner. After that, all modules can see the east wall and performs the movements of Figure 19 (Figure 19, respectively).
Figure 20 shows how to handle exceptions. When is in the center of the field, all states appear in the above moves and any move can be executed. However, when is on a wall or in a corner, moves for some states are not defined or impossible. We add exceptional movements to avoid deadlocks in these states.
The reference point of visits all cells in each row except the southernmost row and the northernmost row. The cells of the southernmost row are visited by the modules under the spine when moves along the st row. The cells of the northernmost row are visited by the modules over the spine when moves along the nd row. Each module is visited by some module and eventually find the target and stops thereafter. Consequently, we have Lemma 3.
4 Search without global compass
In this section, we consider the metamorphic robotic system consisting of modules not equipped with the global compass. In this case, symmetry among the modules causes deadlocks. Figure 24 shows an example with two modules. Each module can perform a rotation; however when the two modules have symmetric local compasses, they cannot distinguish each other and perform symmetric rotations simultaneously. Then, the backbone is not maintained. Each module does not know the compass of the other module, thus they cannot perform a rotation. Figure 24 shows another example with rotations. The four modules cannot move because if one of them moves, the other three modules may also move. Figure 24 shows an example with slidings.^{3}^{3}3Deadlock states with rotations are also illustrated in [18]. Figure 24 shows another type of deadlock state. If one endpoint module performs a rotation, the other endpoint module also performs a rotation when they have symmetric local compasses with respect to their midpoint. The two modules perform symmetric movements simultaneously and the three modules cannot move forward. Consequently, when modules are not equipped with the global compass, search is generally impossible from an arbitrary initial configuration.
We first focus on the minimum number of modules for search from a predefined “good” initial states. We show the following theorem through Section 4.1 and 4.2. We show the necessity with impossibility for less than five modules and the sufficiency with a search algorithm for five modules.
Theorem 4
Five modules not equipped with the global compass are necessary and sufficient for the metamorphic robotic system to find the target in any given field from allowed initial states.
We then consider the minimum number of modules for search from an arbitrary initial state. As a basic symmetry breaking problem, we first consider locomotion to one direction from an arbitrary initial state. We present deadlock states for even number of modules and modules (). Then, we demonstrate that seven modules can start locomotion from an arbitrary initial state. We conclude that seven modules are necessary and sufficient for search from an arbitrary initial configuration.
4.1 Impossibility for less than five modules
When the modules are not equipped with the global compass, there are two causes that make search by the metamorphic robotic system impossible. One is the deadlock in an initial state, and the other is the nonexistence of an exploration track as discussed in the proof of Lemma 2. In this section, we show the following lemma.
Lemma 5
Consider the metamorphic robotic system consisting of less than five modules not equipped with the global compass in a sufficiently large field. For any deterministic algorithm and any initial state of , there exists a choice of the target cell such that cannot find the target.
Proof. We assume that each module can observe its neighborhood where is a constant with respect to the size of the field. We have the following four cases.
Case A: One module. The single module cannot move because there is no backbone.
Case B: Two modules. There is a single initial connected state for the two modules. Possible moves from the initial state are rotations, however if one module performs a rotation, the other module performs a symmetric rotation in the worst case. The two modules cannot maintain a backbone and they cannot move.
Case C: Three modules. Consider the metamorphic robotic system
consisting of three modules not equipped with the global compass. We can classify initial states into two types; the line states and the “L” states.
In a line state, the possible movements are rotations of endpoint modules. When one endpoint module performs a rotation, the other endpoint module also performs a rotation in the worst case. The new state is also a line, and the two endpoint modules repeat the same rotation. does not move forward to any direction. Thus, the line state should be avoided during the search procedure.
In an “L” state, the possible movements are rotations of the two endpoint modules. For the simplicity of the notation, we consider possible movements from the first state of Figure 26 and Figure 26.
We call the left (upper) endpoint module the left module and the right (lower) endpoint module the right module. Since the modules share the handedness, they can agree on the left module and the right module. We have the following five cases.
Case C(i): The left module performs a rotation. The possible rotation is the clockwise rotation, and the resulting state is the (vertical) line state. From the line state, cannot move forward to any direction in the worst case.
Case C(ii): The right module performs a rotation. The possible rotation is the counterclockwise rotation, and the resulting state is the (horizontal) line state. From the line state, cannot move forward to any direction in the worst case.
Case C(iii): Two endpoint modules perform rotations. When the both endpoint modules perform rotations, the resulting configuration is the L shape. Again, the two modules perform rotations, and the resulting state is the initial state. cannot move forward to any direction.
Case C(iv): The left module performs a sliding. The possible sliding is the sliding to the south and the resulting state is again the L shape, where the other module becomes the new left module and performs a sliding. Figure 26 shows the sequence of sliding movements, and after four steps, the configuration returns to the initial configuration.
Case C(v): The right module performs a slide. In the same way as Case C(iv), the configuration returns to the initial configuration. Figure 26 shows this case.
Consequently, three modules cannot move forward to any direction and they cannot find a target that is out of the initial visibility ranges.
Case D: Four modules. Consider the metamorphic robotic system consisting of four modules not equipped with the global compass. Figure 28 shows all possible states of . There are seven states and Figure 28 shows the reachability of these states. An arc shows that there is a set of moves that translates the state of its tail to the state of its head. For example, is translated to by the rotation of the left module. State cannot be translated to because the two endpoint modules perform symmetric movements in the worst case.
In , no module can move because of symmetry, and , , and form a loop that has no outgoing arc. There are possible sequence of states consisting of these three states (e.g., , , , ); however, cannot move forward to any direction. The remaining three states are , , and . By repeating and , can move to one direction in the same way as Figure 36; however, neither the transition from to nor to move forward. The only way to move is to repeat and . By turning upsidedown, it can move both directions; however, this just results in a loop in two rows. Hence, the four modules cannot find a target outside of the loop.
Consequently, less than five modules cannot find a target even when we can choose an initial state of the metamorphic robotic system.
4.2 Search algorithm for five modules
In this section, we consider the metamorphic robotic system consisting of five modules not equipped with the global compass. Figure 30 shows the unique deadlock state and related three states , , and from which may transit to the deadlock state. Figure 30 shows the transition diagram of these four states. Each arc represents the fact that there are possible movements that translates its starting state to its endpoint state. For example, in possible movements are rotations of the two endpoint modules. However, when one of them moves, the other may also move. Then, possible next states are and . When two endpoint modules move in or , possible next states are (by slidings), (by slidings), (by slidings), and (by rotations). However, cannot be translated to an asymmetric state in the worst case due to its symmetry. During these transitions, cannot move forward to any direction. Consequently, these four states cannot be used in a search algorithm.
In the following, we consider initial configurations where the state of is none of the four states. Figure 31 shows all the remaining states of . Note that since the modules are not quipped with the global compass, they cannot recognize any rotation of a state. We assume that each module can observe the cells in its neighborhood. In addition, we use slidings and slidings, which are not used in Section 3.2. To prove the following lemma, we present a search algorithm.
Lemma 6
Five modules not equipped with the global compass are sufficient for the metamorphic robotic system to find a target in any given field from allowed initial states.
We adopt search by exploration in the same way as Section 3.2. However, the modules cannot use the global compass, and it is not easy to realize all the ten moves in Section 3.2. Instead, uses a single track that checks the rows from north to south with visiting each cell of a row from west to east (Figure 32). rotates the track by at the southwest corner in order to visit all cells. It repeats the moves until it finds the target. We explain the basic case where the directions are identical to the global compass.
Moves along a row. Figure 36 and Figure 36 show the move to the east and the move to the west, respectively. By repeating one of the two moves, moves to one direction. In the beginning of the two moves, its spine is the th row an its frontier is the th column.
Turns on the walls. Figure 36 and Figure 36 show a turn on the east wall and a turn on the west wall, respectively. During the turns, each module can see the walls. The spine changes after a turn on the west wall, while it does not change after a turn on the east wall.
A turn on the southwest corner. When the spine of reaches the first row and it comes back to the west wall, it turns the track by as shown in Figure 39. Note that the cells of the th row have been visited by the modules under the spine when moves from the east wall to the west wall. The final state of the turn is and moves along the th column by the moves in Figure 36. Here, the spine is the first column, and the th column is visited by the modules over the spine.
We finally add exceptional movements. Figure 39 and 39 show all states, for which no movement is defined yet. To be more precise, for states , almost all states (including walls) are used in the proposed algorithm except and with walls. For states , only six states with walls are used in the proposed algorithm. Hence in the remaining states, changes its state to one of through at most two steps as shown in Figure 39 and 39.
The reference point of visits all cells in each row and its progress is clear from the proposed algorithm.
4.3 Locomotion without global compass
Theorem 4 excludes initial deadlock states of five modules and related initial states. We now discuss the minimum number of modules for selfstabilizing search. We start with a more fundamental problem called the locomotion problem that requires the metamorphic robotic system in an infinite 2D square grid to keep on moving to one direction. Hence, the modules need to break their initial symmetry and agree on a moving direction.
We formalize the symmetry of the modules in the 2D square grid. In a square grid, the symmetry of an initial state of the metamorphic robotic system is identified with three types of cyclic groups, , , and , where consists of the identity element. The cyclic group consists of rotations by around a specified center. For example, the symmetry of Figure 24 is because the state obtained by a rotation or is identical to itself. The two modules at symmetric positions regarding the rotation center (i.e., the center cell) may have symmetric local coordinate systems and they may move symmetrically forever. The symmetry of Figure 24 and is , and the four modules cannot move because if one of them moves, the other three modules move simultaneously and symmetrically in the worst case and the backbone does not exist. The symmetry of Figure 24 is also ; however, readers may expect that the module on the rotation center can break the symmetry by leaving the center. The following lemma presents a counterintuitive fact; the module on the center cannot break the symmetry due to connectivity requirement.
Lemma 7
When modules are not equipped with the global compass, the metamorphic robotic system can start locomotion from any initial state only if it consists of modules for some positive integer .
Proof. We present initial states of modules from which the metamorphic robotic system cannot start locomotion. We have the following three cases.
Case 1. modules. Consider an initial state of modules in which they form two parallel lines, i.e., . The rotational symmetry of is with the rotational center . In this case, every pair of modules in cells and (or and ) for perform symmetric movement in the worst case. Assume that there exists an algorithm that makes the modules start locomotion from any initial state. If the module in moves to , then the module in moves to cell . Eventually, and becomes large enough to make the modules disconnected. Hence, there is no locomotion algorithm for this initial state.
Case 2. modules. Consider an initial state of modules where they form a large plus sign with center cell . See Figure 24 as an example for . The rotational symmetry of is with the rotation center . In the same discussion as the previous case, the modules forming the four long lines move symmetrically in the worst case. The only possibility to break their symmetry is to move the module in . When the module performs a sliding, one of the sideadjacent cells must be empty. Because of the symmetry, if the module in one of the four cells moves, the other three modules move simultaneously, and the metamorphic robotic system cannot maintain its connectivity. Hence, the module in cannot perform a sliding. In the same way, the module in cannot perform a rotation because any rotation requires that one of the four sideadjacent cells is empty. Consequently, the module in cell cannot perform any movement and the modules cannot perform locomotion.
Case 3. modules. By the same discussion as the first case, the modules cannot perform locomotion.
Consequently, modules are necessary condition for the metamorphic robotic system to perform locomotion from an arbitrary initial state.
By Lemma 7, the minimum number of modules that may perform locomotion from an arbitrary initial state is seven. Actually, there is an algorithm that transforms any symmetric initial state of seven modules to the leftmost state in Figure 40, and the center module can break the symmetry by sliding to east or west.^{4}^{4}4Consequently, it is impossible to break the initial symmetry of , while it is possible for . Then, for example, the modules can perform a locomotion as shown in Figure 40.
Lemma 8
Seven modules not equipped with the global compass are necessary and sufficient for the metamorphic robotic system to perform locomotion from an arbitrary initial state.
After the first movement of Figure 40, the seven modules do not have any symmetry and they can agree on a total ordering among themselves because they agree on the clockwise direction. Thus, from this state, each module can perform different movements. We can easily extend the proposed search algorithm in Section 4.2 for seven modules and we have the following result. The necessity is by Lemma 5 and Lemma 7.
Corollary 9
Seven modules not equipped with the global compass are necessary and sufficient for the metamorphic robotic system to find a target in any given field from any initial configuration.
5 Conclusion and future work
We considered three dynamic tasks for the metamorphic robotic system, i.e., search, exploration, and locomotion. We demonstrated the effect of the global compass on the minimum number of modules for search in an unknown field. We first demonstrated that when the modules are equipped with the global compass, three modules can find a target from an arbitrary initial sate and less than three modules cannot perform search. Then, we demonstrated that when the modules are not equipped with the global compass, five modules perform search from limited initial states and less than five modules cannot perform search. Finally, we discussed locomotion and demonstrated that when the modules are not equipped with the global compass, seven modules perform locomotion from any initial state. The proposed search algorithms make the metamorphic robotic system perform exploration of a field until it finds the target. When there is no target in the field, the proposed algorithm makes the metamorphic robotic system perform perpetual exploration, i.e., exploration without stop.
The proposed search algorithms also illustrate the effect of global compass on the search time. Both search algorithms exhibit the worst search time when the metamorphic robotic system starts from a row just below the target. The search algorithm in Section 3 makes the metamorphic robotic system consisting of three modules equipped with the global compass sweep all rows to find the target. On the other hand, the search algorithm in Section 4 makes the metamorphic robotic system consisting of five modules not equipped with the global compass sweep all rows and columns. Intuitively, the latter algorithm imposes two visits of each cell in the worst case, while the former algorithm imposes a single visit of each cell. We believe that additional modules can reduce the second visits, that is, five modules are not enough for efficient exploration track. It remains to be investigated how many modules are necessary and sufficient for efficient search when the modules are not equipped with the global compass. Of course, the number of steps in a search can be improved with faster moves and turns.
Another important directions is search in other fields, for example, a convex and nonconvex field in the 2D square grid, a finite 3D square grid, torus, graphs, sphere, and generalization to continuous space.
References
 [1] Dana Angluin, James Aspnes, Zoë Diamadi, Michael J. Fischer, and René Peralta. Computation in networks of passively mobile finitestate sensors. Distributed Computing, 18(4):235–253, 2006.
 [2] François Bonnet, Alessia Milani, Maria PotopButucaru, and Sébastien Tixeuil. Asynchronous exclusive perpetual grid exploration without sense of direction. In Proceedings of the 15th International Conference on Principles Of Distributed Systems (OPODIS 2011), pages 251–265, 2011.
 [3] Fengqi Chen, Yukiko Yamauchi, Shuji Kijima, and Masafumi Yamashita. Locomotion of metamorphic robotic system based on local information (extended abstract). In Proceedings of the 33rd International Symposium on Reliable Distributed Systems Workshops, pages 40–45, 2014.
 [4] Mark Cieliebak, Paola Flocchini, Giuseppe Prencipe, and Nicola Santoro. Distributed computing by mobile robots: Gathering. SIAM Journal on Computing, 41:829––879, 2012.
 [5] Shantanu Das, Paola Flocchini, Shay Kutten, Amiya Nayak, and Nicola Santoro. Map construction of unknown graphs by multiple agents. Theoretical Computer Science, 385:34–48, 2007.
 [6] Shantanu Das, Paola Flocchini, Nicola Santoro, and Masafumi Yamashita. Forming sequences of geometric patterns with oblivious mobile robots. Distributed Computing, 28(2):131–145, 2015.
 [7] Zahra Derakhshandeh, Robert Gmyr, Andréa W. Richa, Christian Scheideler, and Thim Strothmann. Universal shape formation for programmable matter. In Proceedings of the 28th ACM Symposium on Parallelism in Algorithms and Architectures (SPAA 2016), pages 289–299, 2016.
 [8] Stéphane Devismes, Anissa Lamani, Franck Petit, Pascal Raymond, and Sébastien Tixeuil. Optimal grid exploration by asynchronous oblivious robots. In Proceedings of the 14th International Symposium on Stabilization, Safety, and Security of Distributed Systems (SSS 2012), pages 64–76, 2012.
 [9] Giuseppe A. Di Luna, Paola Flocchini, Nicola Santoro, and Giovanni Viglietta. Turingmobile: A turing machine of oblivious mobile robots with limited visibility and its applications. In Proceedings of the 32nd International Symposium on Distributed Computing (DISC 2018), pages 19:1–19:18, 2018.
 [10] Giuseppe A. Di Luna, Paola Flocchini, Nicola Santoro, Giovanni Viglietta, and Yukiko Yamauchi. Shape formation by programmable particles. In Proceedings of the 21st International Conference on Principles of Distributed Systems (OPODIS 2017), pages 31:1–31:16, 2018.
 [11] Edsger W. Dijkstra. Selfstabilizing systems in spite of distributed control. Communications of the ACM, 17(11):643–644, 1974.
 [12] Adrian Dumitrescu, Ichiro Suzuki, and Masafumi Yamashita. Formations for fast locomotion of metamorphic robotic systems. The International Journal of Robotics Research, 23(6):583–593, 2004.
 [13] Adrian Dumitrescu, Ichiro Suzuki, and Masafumi Yamashita. Motion planning for metamorphic systems: feasibility, decidability, and distributed reconfiguration. IEEE Transactions on Robotics and Automation, 20:409–418, 2004.
 [14] Yuval Emek, Tobias Langner, David Stolz, Jara Uitto, and Roger Wattenhofer. How many ants does it take to find the food? Theoretical Computer Science, 608:255–267, 2015.
 [15] Paola Flocchini, David Ilcinkas, Andrzej Pelc, and Nicola Santoro. Computing without communicating: Ring exploration by asynchronous oblivious robots. Algorithmica, 65(3):562–583, 2013.
 [16] Nao Fujinaga, Yukiko Yamauchi, Hirotaka Ono, Shuji Kijima, and Masafumi Yamashita. Pattern formation by oblivious asynchronous mobile robots. SIAM Journal on Computing, 44:740––785, 2015.
 [17] Zhiqiang Liu, Yukiko Yamauchi, Shuji Kijima, and Masafumi Yamashita. Team assembling problem for asynchronous heterogeneous mobile robots. Theoretical Computer Science, 721:27–41, 2018.
 [18] Othon Michail, George Skretas, and Paul G. Spirakis. On the transformation capability of feasible mechanisms for programmable matter. Journal of Computer and System Sciences, 102:18–39, 2019.
 [19] Othon Michail and Paul G. Spirakis. Connectivity preserving network transformers. Theoretical Computer Science, 671:36–55, 2017.
 [20] Ichiro Suzuki and Masafumi Yamashita. Distributed anonymous mobile robots: Formation of geometric patterns. SIAM Journal on Computing, 28(4):1347––1363, 1999.
 [21] Masafumi Yamashita and Ichiro Suzuki. Characterizing geometric patterns formable by oblivious anonymous mobile robots. Theoretical Computer Science, 411:2433–2453, 2010.
 [22] Yukiko Yamauchi, Taichi Uehara, Shuji Kijima, and Masafumi Yamashita. Plane formation by synchronous mobile robots in the threedimensional euclidean space. Journal of the ACM, 64(3):16:1–16:43, 2017.
 [23] Yukiko Yamauchi and Masafumi Yamashita. Pattern formation by mobile robots with limited visibility. In Proceedings of the 20th Structural Information and Communication Complexity (SIROCCO 2013), pages 201–212, 2013.
 [24] Yukiko Yamauchi and Masafumi Yamashita. Randomized pattern formation algorithm for asynchronous oblivious mobile robots. In Proceedings of the 28th International Symposium on Distributed Computing (DISC 2014), pages 137–151, 2014.