Skip to main content
Springer logoLink to Springer
. 2022 Feb 22;23(2):407–430. doi: 10.1007/s11047-022-09880-8

Turning machines: a simple algorithmic model for molecular robotics

Irina Kostitsyna 1, Cai Wood 2,, Damien Woods 2
PMCID: PMC11297016  PMID: 39100658

Abstract

Molecular robotics is challenging, so it seems best to keep it simple. We consider an abstract molecular robotics model based on simple folding instructions that execute asynchronously. Turning Machines are a simple 1D to 2D folding model, also easily generalisable to 2D to 3D folding. A Turning Machine starts out as a line of connected monomers in the discrete plane, each with an associated turning number. A monomer turns relative to its neighbours, executing a unit-distance translation that drags other monomers along with it, and through collective motion the initial set of monomers eventually folds into a programmed shape. We provide a suite of tools for reasoning about Turning Machines by fully characterising their ability to execute line rotations: executing an almost-full line rotation of 5π/3 radians is possible, yet a full 2π rotation is impossible. Furthermore, line rotations up to 5π/3 are executed efficiently, in O(logn) expected time in our continuous time Markov chain time model. We then show that such line-rotations represent a fundamental primitive in the model, by using them to efficiently and asynchronously fold shapes. In particular, arbitrarily large zig-zag-rastered squares and zig-zag paths are foldable, as are y-monotone shapes albeit with error (bounded by perimeter length). Finally, we give shapes that despite having paths that traverse all their points, are in fact impossible to fold, as well as techniques for folding certain classes of (scaled) shapes without error. Our approach relies on careful geometric-based analyses of the feats possible and impossible by a very simple robotic system, and pushes conceptional hardness towards mathematical analysis and away from molecular implementation.

Keywords: Model of computation, Algorithmic molecular robotics, Self-assembly, Nubot, Reconfiguration

Introduction

The challenge of building molecular robots has many moving parts, as the saying goes. These include molecular parts that move relative to each other; units needing some sort of memory state; the ability to transition between states; and perhaps even the ability to use computation to drive robotic movements. Here we consider a simple algorithmic model of robotic reconfiguration called Turning Machines.

The main ethos behind our work is the notion of having a reconfigurable structure where component monomers actuate their position relative to their neighbours and governed by simple actuation rules. Volume exclusion applies (two monomers can not occupy the same position in space), almost for free we get massive parallelism and asynchronicity, and the complexity of allowable state changes is small: unit monomers start with a natural number and decrement step-by-step to zero. The Turning Machine model embodies these concepts.

On the one hand, there are a number of senses in which molecular systems are better suited to robotic-style reconfiguration than macro-scale robotic systems: there is no gravity nor friction fighting against components’ actuation, and should we know how to exploit them, randomness, freely diffusing fuel (robots need not carry all their fuel) and large numbers of components are all readily available as resources. On the other hand, building nanoscale components presents a number of challenges including implementing computational controllers at the nanoscale, as well as designing systems that self-assemble and interact in a regime where we can not easily send in human mechanics to diagnose and fix problems (Fig. 1).

Fig. 1.

Fig. 1

Turning Machine motivation: what shapes can be made by autonomously folding structures using simple local turning rules that effect non-local movement? Finding suitable abstract models and characterising their ability helps us to step back and create a vision of where we can go

Turning machines

Monomers are the atomic components of a Turning Machine and are arranged in a connected chain on the triangular grid G, with each monomer along the chain pointing at the next (Fig. 2). In an initial instance, the chain of monomers are sitting on the x-axis all pointing to the east. Each monomer has an initial (input) integer turning number sZ, the monomer’s ultimate goal is to set that number to 0: if s is positive, the monomer tries to simultaneously decrement s and turn anti-clockwise by an angle of π/3 (Fig. 2b), if s is negative, it tries to increment and turn clockwise by π/3.1 If s=0 the monomer has reached its target orientation and does not turn again (Fig. 2b).

Fig. 2.

Fig. 2

Turning Machine model. a Triangular grid conventions. A configuration showing a single monomer on the triangular grid G, along with axes x, y and w. b Local movement (rotation): A monomer in state 3 pointing to the east undergoes three turning rule applications finishing in state 0 with no more applicable rules. Locally, the monomer effects a rotation motion. c Global movement (translation): Left: Example initial configuration. Middle: A movement rule applied to a monomer in state 3 decrements the state to 2 and translates all subsequent monomers by +w. Right: A second state-3 monomer moves. d Blocking: Monomers are not permitted to make movements that would result in a self-intersecting configuration. The monomer mj is said to be blocked because if it were to move, then mk would move to overlap mi, but such self-intersections are not permitted

A key point is that although a monomer actuates by rotating the direction in which it points, when it does so it “drags” (translates) all monomers that come after it in the chain in the same way the rotation motion of a human arm (around a shoulder) appears to translate a flag through the air, or the way a cam in a combustion engine converts rotational shaft motion to translational piston motion (Figs. 2c and 3). Sect. 2 gives the precise model definition.

Fig. 3.

Fig. 3

Left: The Turning Machine Ln1 that rotates a line of n=11 monomers by π/3; illustration for Lemma 4. Four configurations are shown. The initial configuration has all monomers in state 1 sitting on the x-axis, in the final configuration all are in state 0 and sitting on the π/3 line. Two intermediate configurations are shown, respectively after 2, and then after 5, turning rules applications. Right: A configuration of the Line rotation Turning Machine L111 with the chain running from bottom left to top right. Lemmas 4 and 5 uses the fact that tail(mi) sits on or below i, head(mi) sits on or above i, and head(mi) sits strictly above i

The main challenge: blocking

Programming the model simply requires annotating an east-pointing line of monomers with turning numbers; an incredibly simple programming syntax.

Locally, individual monomers exhibit a small rotation, but globally this effects a large translation, or dragging, of many monomers (Fig. 2c). Thus globally, the main challenge is how to effect global rotations—in other words how to use translation to simulate rotation. In particular, how to do this when lots of monomers are asynchronously moving and bumping into each other, potentially blocking each other from moving.

Blocking is illustrated in Fig. 2d and comes in two forms. Temporary blocking where one monomer is in the way of another, but eventually will get out of the way, and permanent blocking where all monomers block each other in a locked configuration that will never free itself. We say that a target structure is foldable if all possible system trajectories lead to that structure, i.e. permanent blocking does not occur on any trajectory. A foldable structure may exhibit temporary blocking on some trajectories, indeed most of the work for our positive results in this paper comes down to showing that for certain folding tasks, any blockings that happen are merely temporary kinks in the chain that are eventually worked out. We measure the amount of blocking by considering the completion time: a foldable structure where temporarily blocked monomers can quickly become unblocked finishes faster than one where blocking takes a while to sort out. Our model of time assumes that the time to apply a turning rule to a given unblocked monomer is an exponential random variable with rate 1, and the system evolves as a continuous time Markov chain with the discrete events being rules applied asynchronously and in parallel.

Given a shape and a best-guess at an initial (input) state sequence to fold that shape, the main challenge often lies in showing that all trajectories lead to the desired shape, i.e. that permanent blocking never occurs. If we succeed in this, a second challenge is to analyse the time to completion—with speed of completion being a measure of efficiency and parallelism.

Results: line rotations and shape building

After defining the Turning Machines model (Sect. 2), and giving technical lemmas for reasoning about it (Sect. 4), in Sect. 5 we fully characterise the line rotation capabilities of the model, in two senses. First, we show that for each of the angles θ{π/3,2π/3,π,4π/3,5π/3}, and any number of monomers nN there is a Turning Machine with n monomers that starts on the x-axis and ends rotated by θ radians. We show this is the best one can do, that is, that rotation of θ2π is impossible (for any n>7, there are always some trajectories that are permanently blocked). Second, line rotation is fast: Up to constant factors the speed is optimal, completing in expected time O(logn). This shows that despite the fact that line rotations in the range πθ5π/3 experience large number of blockings along their trajectories, these blockings are all temporary, and do not conspire to slow the system down by more than a constant factor on average.

In Sect. 6, we go on to give results on the shape-building abilities of Turning Machines. To do this, we build on previous technical tools to show that so-called zig-zag paths (paths that wind over and back parallel to the x axis) are foldable, and in merely logarithmic expected time (Theorem 21). We use that result to prove that n×n squares, rastered in a zig-zag fashion, are foldable, and time-efficiently so (Corollary 22). By allowing error in the folding of a shape (the error is the symmetric difference between the set of points of the shape and points in the folding), any shape is trivially foldable, albeit with error up to the area of the shape, by simply folding the entire bounding box of the shape.2 This means that there are shapes, that are not Hamiltonian but are foldable with large error (e.g. a cross with thin arms, Fig. 9 and Theorem 25). What shapes can be folded with small error? We show that any shape from a wide class called y-monotone shapes is foldable in optimal3 expected time O(logn), and with error no more than the perimeter of the shape and no more than the perimeter of the folding (Theorem 24). Certain classes of shapes can be folded with zero error: Theorem 33 shows that there are shapes, that we call, y-monotone with a yw-separator, that are are foldable at scale factor 2. Finally, one can ask if every shape that has a Hamiltonian path is foldable. The answer is no: our main negative result (Theorem 38) gives a classes of shapes (thin spirals with a gap between their arms) and proves that they are not foldable.

Fig. 9.

Fig. 9

A foldable shape, but one that requires error >0

We would argue that programming in this model is deceptively simple: if a shape has a Hamiltonian path, it is typically straightforward to trace that path while assigning turning numbers to an initial configuration such that there is some trajectory that folds the shape. However, making the step forward to then show that all trajectories fold that shape may involve significant and subtle argumentation, or may be impossible. Programming in the model seems simple, the analysis may not be. This has the benefit of pulling hardness away from the molecular robot design and implementation problem (which is a rather challenging experimental problem) and instead pushing it towards a theoretical geometric analysis problem, exactly where we’d prefer it to be.

Related and future work

Besides finding insights at the interface of computation and geometry, another ultimate aim of this kind of work is to bridge the gap between what we can imagine in theory and what we can engineer in the lab (Ramezani and Dietz 2019). Biological systems actuated at the molecular scale provide inspiration: in the gastrulation phase of embryonic development of the model organism Drosophila melanogaster, large-scale rearrangements of the embryo are effected by thousands of (nanoscale) molecular motors working together to rapidly push and pull the embryo into a target shape (Dawes-Hoang et al. 2005; Martin et al. 2008).

Our Turning Machine model is a restriction of the nubot model (Woods et al. 2013), a molecular robotic model with many features including self-assembly capabilities, random agitation (jiggling) of monomers, the ability to execute cellular automata style rules, and floppy/rigid molecular bonds. The parallel computing capabilities (Chen et al. 2014b), and construction using random agitation and self-assembly (Chen et al. 2014a) have been studied. Dabby and Chen consider related (experimental and theoretical) systems that use an insertion primitive to quickly grow long (possibly floppy) linear structures (Dabby and Chen 2012), later tightly characterised by Hescott et al. (2017); Hescott et al. (2018) in terms of number of monomer types and time. Hou and Chen (2019) show that the nubot model can display exponential growth without needing to exploit state changes. Chin et al. (2018) look at both minimising numbers of state changes and number of ‘2D layers’ to assembly 1D structures. There are a number related autonomous self-folding models, both 1D to 2D (Cheung et al. 2011) and 2D to 3D (Connelly et al. 2010), and reconfigurable robotic/programmable matter systems, e.g. (Aloupis et al. 2009, 2008; Demaine et al. 2018; Geary et al. 2016; Gmyr et al. 2019; Michail et al. 2019).

There are several avenues for future work.

  • Concretely, it remains to fully characterise the classes of shapes foldable with zero error (Open Problem 26). For example, can our main negative result showing the impossibility of folding spirals be generalised to give impossibility result for wider classes of shapes? Can we find new techniques to increase the class of shapes that are foldable (with zero error), beyond the zig-zag rastering techniques we heavily use in Sects. 6.16.3 (to fold n×n squares, and certain other y-monotone shapes including those with a yw-separator at scale factor 2).

  • Establishing error bounds for various classes of shapes, including trade-offs between notions of shape complexity and error could be another avenue to explore. It seems interesting to consider folding where we permit a small number of trajectories to be permanently blocked.

  • In this paper, our positive results are mainly for model instances with either positive integer states, which define an anti-clockwise rotation-and-translation motion about the origin, or with negative integer states which define a clockwise motion; our negative results hold for both directions. Does the combination of both anti-clockwise (positive) and clockwise (negative) turning rules strictly increase the expressivity of the model?

  • Using a variant (Woods et al. 2013; Chen et al. 2014a) of the model with random agitation of monomers would side-step our negative result about the impossibility of reaching a full 2π line rotation, essentially by allowing reversible movement out of blocked configurations (although upon reaching the target configuration, the Turing machine would also immediately reverse out it). We don’t know if adding agitation to the model can help increase the set of foldable shapes, however since it is a somewhat natural physical notion it is worth investigating—either with or without the notion of locking into position when a monomer has completed all of its movements by reaching state 0. Indeed, the analysis of such systems would provide intellectual fruit by mixing probability, geometry and computation.

  • As indicated in Fig. 1, it is straightforward to generalise the model to (say) 2D trees folding into 3D shapes.

  • We know that certain kinds of zig-zag paths (e.g. over-and-back parallel to x-axis, while moving monotonically either positive or negative along the y axis, see for example Fig. 8) are efficiently foldable, and under certain conditions mixing of two kinds of of zig-zag paths are foldable (e.g. prooxf of Theorem 33 and Fig. 10).

In all of these cases fully characterising the classes of shapes that can be folded, and characterising the time to fold such classes of structures, provides questions whose answers would expand our understanding of the capabilities of simple reconfigurable robotic systems.

Fig. 8.

Fig. 8

Left: The yellow points define an n×n zig-zag square for n=8 (Definition 17). Corollary 22 states that, for any n, such a square is foldable, and the proof works by showing there is a Turning Machine Tzz that traces the positive zig-zag path shown (with monomer m0 at the origin). Right: An intermediate configuration of Tzz: all initially-non-0-monomers have moved. The horizontal lines (in red) subdivide Tnzz into n independent subchains each equivalent to a separate line-rotating Turning Machine Ln3, which gives some intuition that the target configuration is safely reached on all trajectories without permanent blocking (although our actual proof proceeds by a different argument)

Fig. 10.

Fig. 10

Left: an xy-connected y-monotone shape S with a yw-separator (purple). Right: S×2, a scaled version of S by a factor two, its traversal Σ (black) by a chain of a Turning Machine TΣ, and the cut γ (purple)

Turning machine model definition

In this section we define the Turning Machine model. Formally speaking, the model is a restriction of the Nubot model (Woods et al. 2013), for simplicity we instead use a custom formalism.

Grid. Positions are pairs in Z2 defined on a two-dimensional (2D) triangular grid G using x and y axes as shown in Fig. 2. We use the notation N2 to denote points in the positive orthant, or positive sextant, of the 2D triangular grid. For convenience, we define a third axis, w, centred on the origin and running through the point (x,y)=(-1,1). We let ±x,±y,±w denote the unit vectors along the x, y and w axes.

Monomer, configuration, trajectory. A monomer is a pair m=(s(m),pos(m)) where s(m)Z is a state and pos(mi)Z2 is a position. A configuration, of length nN, is a tuple of monomers c=(m0,m1,,mn-1) whose positions σ(c)=pos(m0),pos(m1),, pos(mn-1) define a length n-1 simple directed path (or non-self-intersecting chain) in Z2 (on the grid G) and where pos(m0)=(0,0).4

A configuration is a tuple of nN monomers (m0,m1,,mn-1). A final configuration has all monomers in state 0. A pair of configurations (ci,ci+1) is said to be a step if ci yields ci+1 via a single rule application (defined below) which we write as cici+1. A trajectory, of length k, is a sequence of configurations c0,c1,,ck-1 where, for each i{0,1,,k-2} the pair (ci,ci+1) is a step cici+1. A Turning Machine initial configuration c0 is said to compute the target configuration ct if all trajectories that start at c0 lead to ct, and is said to compute its target configuration if it reaches the configuration with all monomers in state 0. A Turning Machine instance is an initial configuration. For a monomer mi, we let s0(mi) denote its state in the initial configuration, and we let i denote the horizontal line through pos(mi). Given a monomer mi in configuration c we say that for 0in-2 monomer mi points in direction d{±x,±y,±w} if pos(mi+1)-pos(mi)=d. By convention, monomer mn-1 does not point in any direction, and whenever we say all monomers point in some direction d, we mean all except mn-1. A configuration c is reachable from configuration c if there is at least one sequence of rule applications from c to c (if c is not specified we mean the initial configuration c0).

Turning rule: state decrement/increment. Let SinitZ be the set of states that appear in the initial configuration. Let smin=min(Sinit{0}) and smax=max(Sinit{0}), and let S={smin,smin+1,,smax} be the called the Turning Machine state set. The turning rules of a Turning Machine are defined by a function r such that for all states s(S\{0}):

r(s)=s-1ifs>0,s+1ifs<0. 1

Let C be the set of all configurations. The turning rule R:C×ZC is a function and R(ci) is said to be applicable to monomer mi in configuration c if s(mi)0 and the rule is not blocked (defined below). If the rule is applicable, we write R(c,i)=c and say that R(ci) yields the new configuration c, and we say that (c,c) is a step.

Turning rule: blocking. For i{0,1,,n-1}, we define the head and tail of monomer mi as head(mi)=mi+1,mi+2,,mn-1 and tail(mi)=m0,m1,,mi. Consider the following tuple of unit vectors: d=(x,y,w,-x,-y,-w), and let dk denote the kth element of that tuple. Let di=pos(mi+1)-pos(mi) be the direction of monomer mi, and then if s(mi)>0 let i(i+2)mod6, or if s(mi)<0 let i(i-2)mod6. For a vector dZ2 we write mi+d to mean the monomer mi translated by d. Define5head(mi)=mi+1+di,mi+2+di,,mn-1+di.If the set of positions of tail(mi) has a non-empty intersection with the set of positions of head(mi) we say that the rule is blocked, and the rule is not applicable. If the rule is not blocked, it is applicable and the resulting next configuration is c=tail(mi), head(mi)=m0,m1,,mi,mi+1+di,mi+2+di,,mn-1+di.

A configuration c is said to be permanently blocked if (a) not all states are 0, and (b) none of the monomers in c has an applicable rule. A monomer m within a configuration c is said to be temporarily blocked if (a) m is not in state 0, and (b) there is no rule applicable to m, and (c) there is a trajectory starting at c that reaches a configuration c where there is a rule applicable to m.

Time. A Turning Machine evolves as a continuous time Markov process. The rate for each rule application is 1. If there are k applicable transitions for a configuration ci (i.e. k is the sum of the number of rule applications that can be applied to all monomers in ci), then the probability of any given transition being applied is 1/k, and the time until the next transition is applied is an exponential random variable with rate k (i.e. the expected time is 1/k). The probability of a trajectory is then the product of the probabilities of each of the transitions along the trajectory, and the expected time of a trajectory is the sum of the expected times of each transition in the trajectory. Thus, tTPr[t]·time(t) is the expected time for the system to evolve from configuration ci to configuration cj, where T is the set of all trajectories from ci to cj, and time(t) is the expected time for trajectory t.

Example. These concepts are illustrated in the proof of Lemma 4 in Appendix A, and in the example in Fig. 3.

Introduction to line rotation turning machines

Every Turning Machine analysed in this paper starts with nN monomers, sitting on the x-axis, pointing to the east. We define a class of Turning Machines which we call line rotation Turning Machines.

Definition 1

(Line rotation Turning Machine) Let nN and let Lnσ be the Turning Machine with initial configuration of n monomers c0=m0,m1,,mn-1 all pointing to the east, positioned on the x-axis (pos(mi)=(i,0)Z2), and for 0in-2 all monomers in the same state s0(mi)=σN+ and s0(mn-1)=0.

Remark 2

The initial monomer state σ0 dictates that each monomer wishes to turn (have a rule applied) a total σ times, i.e. be rotated through an angle of σπ/3.

Remark 3

(Target configuration) For intuition, if there was no notion of blocking in the Turning Machine model, that is, if the model permitted self-intersecting configurations (which it does not), then the final configuration c of the Turning Machine in Definition 1 is a straight line of monomers sitting along the ray that starts at the origin and is at an angle of σπ3, i.e. at positions (0,0),(0,-1),,(0,-(n-1)) and all pointing to the west. We call c the desired target configuration of the line rotation Turning Machine Lnσ. Also, if there was no notion of blocking: expected time to completion would be fast, O(logn) (by a generalisation of the analysis used in the proof of Lemma 4). However, a model with no blocking would be rather uninteresting.

Figure 3 (left) illustrates Lemma 4 and Appendix A contains its straightforward, yet instructive, proof.

Lemma 4

For each nN, the line-rotating Turning Machine Ln1 computes its target configuration, and does so in expected O(logn) time.

Tools for reasoning about turning machines

The following lemma is illustrated in Fig. 3 (right).

Lemma 5

Let nN and let Tn3 be a Turning Machine with initial states 0s(mi)3 for all 0in-1. For any monomer mi in a reachable configuration c of Tn3, the monomers head(mi) are positioned on or above i, and tail(mi) are positioned on or below i, where i is a horizontal line passing through mi.

Proof

The claim follows from the fact that in any configuration of Ln3, and for any j{0,1,,n-2} the angle of the vector pos(mj)pos(mj+1) (from monomer mj to mi+1) is either 0, 60, 120, or 180 (and, in particular, is not strictly between 180 and 360).

The notion of turn angle of a monomer is crucial to our analysis and is illustrated in Fig. 4.

Fig. 4.

Fig. 4

Illustration of turn angle (Definition 6). The turn angles αi and αi+1 are positive (and to the left), and αj is negative (and to the right)

Definition 6

(Turn angle) Let c be the configuration of an n-monomer Turning Machine and let 0i<n-1. The turn angle αi at monomer mi is the angle between pos(mi-1)pos(mi) and pos(mi)pos(mi+1), and it is the positive counterclockwise angle if the points pos(mi-1),pos(mi),pos(mi+1) make a left turn,6 and the negative clockwise angle otherwise.

For a monomer mi, the following definition gives a measure, Δs(mi), of how its state s(mi) has progressed since the initial configuration.

Definition 7

Let c be a reachable configuration of an n-monomer Turning Machine, let mi be a monomer with state s(mi) in c and initial state s0(mi)0. We define Δs(mi) to be the number of rule applications to (or, moves of) the monomer mi from the initial configuration to c. That is, Δs(mi)=s0(mi)-s(mi).

Lemma 8

(Difference of State is 2) Let nN, and let c be any reachable configuration of an n-monomer Turning Machine Tn with all monomers pointing in the same direction in its initial configuration, then

|Δs(mi)-Δs(mi+1)|2,

for all 0i<n-1.

Proof

Let mkt, for tN and k{0,1,,n-1}, denote the kth monomer in the tth configuration ct. Initially, Δs(mj0)=0 for all monomers mj, and thus |Δs(mi0)-Δs(mi+10)|=0.

Observe, that |Δs(mi)-Δs(mi+1)|3 because otherwise pos(mi)=pos(mi+2) making c a self-intersecting (non-simple) configuration, contradicting its definition.

By Eq. (1), when a rule is applied to one of mit or mi+1t the absolute value of its state decreases by 1 and its Δs(·) increases by 1. Then |Δs(mit)-Δs(mi+1t)|=|Δs(mit-1)-Δs(mi+1t-1)|±1. When a rule is applied to some other monomer mk with ikj, then |Δs(mit)-Δs(mi+1t)|=|Δs(mit-1)-Δs(mi+1t-1)|±0. Thus, after each rule application the value of |Δs(mi)-Δs(mi+1)| changes by at most 1, and as it cannot be equal to 3, we have that |Δs(mi)-Δs(mi+1)|2.

We can now prove the following lemma, which gives a relation between the states of any two monomers of a Turning Machine and the geometry of the current configuration.

Lemma 9

Let c be any reachable configuration of an n-monomer Turning Machine Tn, whose initial configuration c0 has all monomers pointing in the same direction, and let mi and mj be two monomers of c such that i<j<n-1, then

Δs(mj)-Δs(mi)=3πk=i+1jαk,

where αk is the turn angle at monomer mk.

Proof

For any intermediate configuration, the turn angle αi+1 between monomers mi and mi+1 depends only on the number of moves each monomer has made. Initially, αi+1=0. It increases by π/3 each time monomer mi moves anti-clockwise or monomer mi+1 moves clockwise, and it decreases by π/3 every time monomer mi moves clockwise or monomer mi+1 moves anti-clockwise. By Lemma 8, for two consecutive monomers mi and mi+1, in any configuration, |Δs(mi)-Δs(mi+1)|2. Hence, for a pair of consecutive monomers mi and mi+1, the turn angle αi+1 is in the range [-2π3,2π3], and thus αi+1=π3(Δs(mi+1)-Δs(mi)). Summing over all i gives the lemma conclusion.

The following technical lemma is used extensively for our main results. Intuitively, it tells us that high-state monomers are not blocked.

Lemma 10

Let Tn5 be a Turning Machine with initial state values 0s(mi)5 for all 0i<n. In any reachable configuration c of Tn5 no monomer mi with Δs(mi)1 is blocked (neither temporarily blocked nor permanently blocked).

Proof

Suppose, for the sake of contradiction, there is a blocked monomer mi with Δs(mi)1. Then there exist two monomers mjhead(mi) and mktail(mi) such that pos(mk)=pos(mj), where pos(mj) is the position of mj in head(mi) (see Fig. 5).

Fig. 5.

Fig. 5

Illustration for Lemma 10. Monomer mi is shown in black, head(mi) is shown in blue and tail(mi) is shown as the green curve plus the black monomer mi. Left: monomer mi is in its initial state (Δs(mi)=0), and polygon P is traversed anti-clockwise. Right: monomer mi has moved once (Δs(mi)=1), and polygon P is traversed clockwise

By definition of head and tail we know that ki<j. Consider the closed chain P=pos(mk),pos(mk+1),,pos(mj-1),pos(mj),pos(mk). Since configurations are simple, P defines a simple polygon. The turn angles of a simple polygon sum to 2π if the polygon is traversed anticlockwise (interior of P is on the left-hand side while traversing), or -2π if the polygon is traversed clockwise (interior of P is on the right-hand side). For P, this sum is defined as:

αP==k+1j-1α+βj+βk=±2π,

where α is the turn angle at monomer m, and βj and βk are the turn angles of the polygon at vertices pos(mj) and pos(mk) respectively (see Fig. 5). More precisely,

α=(pos(m)-pos(m-1),pos(m+1)-pos(m)),βj=(pos(mj)-pos(mj-1),pos(mk)-pos(mj)),andβk=(pos(mk)-pos(mj),pos(mk+1)-pos(mk)).

Furthermore, by Lemma 9,

Δs(mj-1)-Δs(mk)=3π=k+1j-1α.

Thus,

Δs(mj-1)=Δs(mk)+3π=k+1j-1α=Δs(mk)+3π(±2π-βj-βk)=Δs(mk)±6-3π(βj+βk).

Observe that when a monomer mi moves, its head translates in the direction corresponding to the current direction of mi rotated by angle 2π/3. Therefore, the state of mk can be represented as a function of the state of mi and the angle βk, more precisely

Δs(mk)=Δs(mi)+2+3πβk.

(See Fig. 5 for an example.) Therefore, by the previous two equalities

Δs(mj-1)=Δs(mi)+2±6-3πβj.

Recall, that the angle βj[-2π/3,2π/3], that 0Δs(mi)1 by the assumption of the lemma, and that Δs(mj-1)s. If the polygon defined by P is traversed anti-clockwise, then

Δs(mj-1)=Δs(mi)+8-3πβj0+8-2=6,

which implies that s(mj-1) is out of the range of valid states, as mj-1 must have moved more times as its initial state. Else, if the polygon P is traversed clockwise, then

Δs(mj-1)=Δs(mi)-4-3πβj1-4+2=-1,

which again implies that s(mj-1) is out of the range of valid states, as mj-1 must have moved in the wrong direction. In either case we contradict that the state s(mj-1) is in the range of valid states, and, therefore, the monomer mi is not blocked.

Lemma 11

Let Lns be a line-rotating Turning Machine with s5. Let c be a reachable configuration of Lns where each monomer mi in c has sc(mi)<s. Then the line-rotating Turning Machine Lns-1 has a reachable configuration c such that for every mi, sc(mi)=sc(mi) and the geometry (chain of positions) of c is equal to that of the rotation of c by π/3 around the origin.

Proof

Consider the sequence ρc rule applications (moves) that brings the initial configuration of Lns to configuration c. We claim that ρc can be converted into another sequence ρc, of the same length, in which the first n-1 moves are by monomers in state s.

First, we claim: for any two consecutive moves, where the second move is applied to a monomer in state s, swapping the two moves results in a valid sequence of moves transforming the Turning Machine into the same configuration. Let the first move be applied to monomer mi which transitions from state s to s-1, and the second move be applied to monomer mj which transitions from state s to s-1. Suppose for the sake of contradiction that swapping the moves results in at least one of the monomers mi or mj being blocked. We begin by attempting to apply the move to monomer mj, but, by Lemma 10, that move is not blocked. Then we attempt to apply a move to monomer mi, but that is not blocked either since the coordinates of all monomers before and after swapping the two moves are exactly the same; i.e. the resulting configuration is a valid (non-self-intersecting) configuration in both cases. Hence neither monomer is blocked.

Thus, the original sequence of moves resulting in configuration c, can be converted into another sequence where the first n-1 moves are applied to monomers in state s. Then, after the first n-1 moves the configuration of Lns is equivalent to the initial configuration of Lns but rotated by π/3 and with all monomers in state s-1. Hence equivalent to the initial configuration of Lns-1 rotated by π/3.

Applying the remaining moves to Lns-1 transforms it into configuration c.

Line rotation: 5π/3 possible and fast, 2π impossible

Line rotation to 5π/3

In this section we show that for 1s5 the line-rotation Turning Machine Lns computes its target configuration of a sπ/3 rotated line (Theorem 12), and does so in expected time O(logn) (Theorem 13). In addition to those results for any state s5, in Appendix A we include stand-alone proofs for each of s=1, s=3, and s=4 which showcase a variety of geometric techniques for analysing Turning Machine movement, but are not needed to prove our main results. Also, the cases of s=1 and s=3 are illustrated in Figs. 3 and 6 .

Fig. 6.

Fig. 6

Example trajectory of the Turning Machine Ln3 that rotates a line of east-pointing monomers by an angle of π. Illustration for Theorem 13 with s=3 (and for Lemma 40 and Theorem 41 in Appendix A). Seven configurations are shown, the initial configuration has all monomers in state 3 (blue), final in state 0 (yellow). Darker shading indicates later in time. A red bond (edge) indicates a blocked monomer. The proof of Lemma 40 shows that only monomers in state 1 are ever blocked and only when they are adjacent to a monomer in state 3, and that all such blockings are temporary—if we wait long enough they become unblocked

Theorem 12

For each nN and 1s5, the line-rotation Turning Machine Lns computes its target configuration.

Proof

We prove by induction on 1s5 that any reachable configuration c of Lns is not permanently blocked.

Base case s=1. In any configuration reachable by Ln1, monomers have either state s=1 or 0. Monomers in state s=1 cannot be permanently blocked by Lemma 10. Thus, any non-final configuration is not permanently blocked.

Assume for s-1 the claim is true, i.e. it holds for Lns-1. We will prove that for s it is also true, i.e. it holds for Lns. Suppose, for the sake of contradiction, there is a permanently blocked configuration c of Lns for some nN and s5. If there is no monomer in c in state s, then by Lemma 11 there exists a corresponding configuration c in Lns-1 with monomers m0,m1,,mn-1, such that, for any monomer mi in c with state si<s the corresponding monomer mi in c has the same state si. Configurations c and c form chains equal up to rotation by angle π/3. Configuration c is not blocked by the induction hypothesis, thus configuration c cannot be blocked either.

On the other hand, if there is a monomer mi in configuration c in state s, then by Lemma 10 it is unblocked, and configuration c, again, is not blocked.

Hence the induction hypothesis holds for s, and Lns does not have a reachable permanently blocked configuration.

Theorem 13

For each nN and 1s5, the line-rotation Turning Machine Lns computes its target configuration in expected time O(logn).

Proof

By Theorem 12, Lns computes its target configuration. For the time analysis we use a proof by induction on u{0,1,,s}, in decreasing order.

The induction hypothesis is that for a reachable configuration cu of Lns with maximum state value u (there may be states <u in the configuration), the expected time to reach a configuration cu-1 with maximum state u-1 is O(logn).

For the base case we let u=s and assume c is such that all monomers are in state u. Hence c is an initial configuration and hence, by definition, is reachable. By Lemma 10, monomers in state s are never blocked and hence we claim that the first configuration with maximum state u-1 appears after expected time O(logn). To see this claim, note that for each monomer mi in state s(mi)=u the rule application that sends mi to state u-1 occurs at rate 1, independently of the states and positions of the other monomers (by Lemma 10, there is no blocking of a monomer in state u=s). Since there are n monomers in state u, the expected time for all n to transition to u-1 is Graham et al. (1989):

k=1n1k=O(logn). 2

We assume the inductive hypothesis is true for 0<u+1s, and we will prove it holds for u. Thus, there exists a reachable configuration cu where the maximum state value is us, which is reachable from cu+1 in expected O(logn) time. Let there be nn monomers in state u in cu. By Lemma 11, there is a line-rotating Turning Machine Lnu that has a reachable configuration cu such that for every mi in cu, scu(mi)=scu(mi) and the positioning of cu is equal to the rotation of cu by π/3 around the origin. By Lemma 10 monomers in state u in Lnu are never blocked, hence monomers in state u in cu are not blocked either. Setting n=n in Eq. (2), and noting that O(logn)=O(logn), proves the inductive hypothesis for u.

Since we need to apply the inductive argument at most s5 times, by linearity of expectation, the expected finishing time for the s processes is their sum, 5·O(logn)=O(logn).

Negative result: line rotation to 2π is impossible

Theorem 14

For all nN,n7, the line-rotating Turning Machine Ln6 does not compute its target configuration. In other words, there is a permanently blocked reachable configuration.

Proof

Figure 7, looking only at the first 7 (initially blue) monomers, shows a valid trajectory of L76 , then ends in a permanently blocked configuration, hence the lemma holds for n=7.

Fig. 7.

Fig. 7

Impossibility of 360 line rotation (Theorem 14), by showing that for all nN, the line-rotation Turning Machine Ln6 has a reachable but permanently blocked configuration. Looking at the evolution of the first seven monomers (i.e. ignore the rotation of the red line segment) we see one trajectory of the Turning Machine that exhibits permanent blocking in the final (bottom-right) configuration, which has respective states 6, 4, 3, 2, 1, 0, 0. We imagine the red line segment as representing an arbitrary long sequence of monomers running collinear with it, and transitions 14–16, 22–23, and 24–25, each representing the (many step) rotation of the red line by respective angles of 180, 120 and 60. These rotations of the red line can proceed by two applications of Theorem 12 (first with s=3, then with s=1) and the fact that the first monomer of the red line is strictly above, or below, the first seven monomers. Hence the final, permanently blocked, configuration is reachable no matter what length the red line is

Let n>7, and in Fig. 7 let the red line segment denote a straight line n-7 of n-7 monomers co-linear with the red line segment. By inspection, it can be verified that (a) in all 25 configurations the line does not intersect any blue monomer, and moreover (b) the transitions from configurations 1 through 14, configurations 17 through 23, and configuration 24 to 25 are all valid, meaning that the length n-7 line n-7 does not block the transition. The transitions for configurations 14 through 17 are valid by Theorem 12 (with s=3) and the fact that the last blue monomer (the origin of n-7) is strictly above all other blue monomers (hence the 180 rotation of n-7 proceeds without permanent blocking by blue monomers). The transition for configuration 23 to 24 is valid by applying Lemma 4 (or Theorem 12, with s=1) reflected through a horizontal line that runs through the last blue monomer, and the fact that the last blue monomer (the origin of n-7) is strictly below all other blue monomers (hence the 60 rotation of n-7 proceeds without permanent blocking). Thus all transitions are valid and the permanently blocked configuration is reachable, giving the lemma statement.

Folding shapes

In this section we show how to fold certain kinds of shapes with Turning Machines, and we show that other kinds of shapes are impossible to fold, and that others are not foldable but can be approximated.

Definition 15

(Shape) A shape is a set of points in the grid G such that its induced graph is connected (using unit length edges on G).

Definition 16

(xy-connected shape) An xy-connected shape S is a set of points in the grid G such that if we remove all the edges parallel to the direction w from the induced graph of S, it remains connected.

For example squares are a classic benchmark shape in self-assembly:

Definition 17

(n×n square) For nN the n×n square is the set of points (x,y)N2 such that 0x,y<n.

Typically, we are interested in folding a shape with a Turning Machine, and ideally we’d like each monomer to sit on one point of the shape, but in the non-ideal case there are errors:

Definition 18

(Error of folding a shape) Given a shape S and Turning Machine configuration c, the error of folding of c with respect to S is the size of the symmetric difference of the shape and the positions of c (i.e., the number of positions of c that are not in S, plus the number of positions S not in c).

Folding zig-zag paths and n×n squares

Recall that a path in Z2 is simple, connected and directed, and its length is the number of its points. Intuitively, a zig-zag path is a path that winds over and back parallel to the x axis, while heading off in one direction (positive or negative) along the other two axes. For example, Fig. 8 shows a positive zig-zag path that rasters an 8×8 square (traced out by a Turning Machine configuration).

In this section, we apply our techniques from previous sections to help us prove Theorem 21, which states that zig-zag paths (Definition 19) are foldable by Turning Machines in expected time logarithmic in path length. Since for any nN, an n×n square can be rastered (traced out) using a zig-zag path, we then get that they too are efficiently foldable by Turning Machines.

Definition 19

(Zig-zag path) A positive zig-zag path, or simply zig-zag path, is a path in Z2 composed of unit length line segments that run along directions ±x, +y and +w. A negative zig-zag path, has unit length line segments that run along ±x, -y and -w.

The previous definition captures the intuition of a path that zig and zags over and back (e.g. Fig. 8) but is much more general since a positive, respectively negative, zig-zag path is any path that is monotone in y (and hence in w), respectively -y (and hence in -w).

The following lemma will find future use in showing that a Turning Machine folds a positive zig-zag path.

Lemma 20

Let c be any configuration reachable by a line-rotating Turning Machine Ln3, then there is a Turning Machine Tn that has c as its target configuration. Moreover, Tn runs in expected time O(logn).

Proof

We first define Tn as having the initial configuration c0, of length nN, where for 0in-1 monomer mi in c0 has state 3-si,c, where si,c is the state of monomer mi in c. By hypothesis, c is reachable in Ln3, which means there is a trajectory (sequence of rule applications) from the initial configuration of Ln3 to c, thus applying the same sequence of moves in Tn, starting with c0, also yields c. We need to show that c is the target of Tn (meaning all trajectories from c0 reach c).

We will define a “suppressed-L3-system” to be a Turning Machine-like system7 that acts like Ln3 in all ways, except that for each i, after monomer mi reaches state 3-si,c any rule application to mi is “suppressed” (not applied).8 By Lemma 10, for any i where si,c{1,2,3}, monomer mi in the suppressed-L3-system is never blocked since to experience blocking a monomer needs be in the process of transitioning from state 1 to 0, which never happens for si,c{1,2,3}). In other words, we only expect blocking to affect monomers mi for which si,c=0. Consider such a monomer mi. By applying Conclusion (i) of Lemma 40 to mi we note that blocking only occurs if mi is in state 1 and is adjacent to a monomer in state 3. However, such blocking is temporary, which follows from the claim that that adjacent monomer mj eventually leaves state 3: to see the claim note that: (a) Ln3 does not experience permanent blocking (hence mj does not) and (b) sj,c<3, since otherwise two monomers would occupy the position in c which contradicts the positions of c tracing out a path (i.e. non-self-intersecting). Therefore, since there is no permanent blocking in the suppressed-L3-system it always reaches c.

Both Tn and the restricted-L3-system have the same set of trajectories because (a) suppressed rules in the restricted-L3-system make no change to a configuration, and (b) for any configuration c it has the same set of applicable (non-suppressed) rules in the restricted-L3-system and in Tn.

For the time analysis, we analyse the expected time for the restricted-L3-system to reach c. To do that, we consider two processes (two Markov chains): the process where rules are applied/blocked and the process where rules are suppressed. Observe that suppressed rules do not change a configuration and do not change the rate of applications of rules, thus from now on in our analysis, we ignore the latter process. For the restricted-L3-system to reach c, applicable rules are either unblocked (rate 1 per rule application) or temporarily blocked, and the latter case only occurs when a monomer mi in state 1 is adjacent to a monomer mj{mi-1,mi+1} where mj is in state 3 and is unblocked (as argued above). Since all such mj are unblocked, the expected time until they are all in a state <3 is O(logn), after which there are no blocked monomers in the resulting configuration. The rule application process then completes in expected time O(logn), giving an overall expected time of O(logn).

Theorem 21

A positive, or negative, zig-zag path P, of length n, is foldable by a Turning Machine in expected time O(logn).

Proof

Let P be a positive zig-zag path. We begin by defining a length-n Turning Machine Tzz whose target9 configuration c traces out the zig-zag path P. By the definition of P, each monomer in c points in one of the directions ±x,+y and +w. For any configuration c, and 0in-1, let mi,c denote monomer mi in configuration c. In the initial configuration c0 of Tzz, for i{0,1,,n-2} we define monomer mi,c0 to have the state

s(mi,c0)=0if direction(mi,c)=+x1if direction(mi,c)=+y2if direction(mi,c)=+w3if direction(mi,c)=-x 3

and s(mn-1,c0)=0, where direction(mi)=pos(mi+1)-pos(mi), i.e. the direction of mi as defined in Sect. 2. Thus the initial configuration has all states 3.

Let si denote the initial state of monomer mi. Consider the line-rotating Turning Machine Ln3 in its initial configuration and consider the following trajectory. We begin by moving sequentially along the chain of monomers from left to right starting at m0, and for each monomer mi with si>0 we apply a turning rule to mi once. After we reach monomer mn-1, we move back along the chain and for each monomer mi such that si>1 we apply a turning rule to it. After we get back to m0, we once again move left to right and for each mi with si>2 we apply a turning rule to it. Once we reach mn-1 again we are done. At this point each monomer mi has had si turning rules applied and thus we are in a configuration which traces out the path P. Since target configuration c of Tzz traces out the path P, c is reachable by Ln3. Thus by Lemma 20, Tzz folds P in O(logn) expected time.

For a negative zig-zag path P, we use the same proof but mirror-flipped around the x-axis, and using negative (instead of positive) turning numbers.

An example of an n×n square nN (Definition 17), with n=8 in the example, is traced out by the path in Fig. 8 (left). Since for any n the n×n square is traced out by a positive zig-zag path, by Theorem 21 we immediately get the following corollary:

Corollary 22

For any nN, the n×n square is foldable with zero error and in expected time O(logn).

Folding y-monotone shapes, but with error

If we permit error in a folding, by which we mean that some points of the folding are not in the shape (or vice-versa) then any shape is foldable. In particular, for any shape S there is a (boring) Turning Machine that folds a zig-zag traversal of the bounding rectangle of S. The error will be bounded by the area of S. Can we do any better? In this section, we show that, yes, the class of y-monotone shapes are foldable with error bounded merely by the perimeter of S, and if we allow spatial scaling for y-monotone shapes with the yw-separator property (see Definition 29) we have zero error.

Definition 23

We say that a shape is y-monotone if the points along each of its y-coordinates form a line segment.

The perimeter of a shape is defined as the set of points in the shape that are adjacent (in Z2) to point(s) not in the shape, and the perimeter length is the number of points in the perimeter. A traversal is a simple path in Z2. A zig-zag traversal is a traversal that traces a positive (or negative) zig-zag path (Definition 19) such as the 8×8 square shown in Fig. 8 (Left).

Theorem 24

Any y-monotone shape S can be folded with error no more than the perimeter length of S, and no more than the perimeter of the shape induced by the folding. Moreover, S is folded with error in expected time O(logn).

Proof

We will give a zig-zag traversal that covers all points of the shape, as well as possibly a number of points outside the shape, but within the stated error bound. We will then show that the traversal is foldable using the techniques from Sect. 6.1.

For each y-coordinate yi in the shape, i.e. y0<y1<<yH-1 where the shape is of height (or span) H along the y-axis, let σi denote the set of points along y. The set σi is a line segment by y-monotonicity of the shape S.

We define a zig-zag traversal Σ that includes all points of S: If i is an even index such that yi is a y-coordinate of S, then let Σi include all points of σi, plus any points p to the right of σi such that there is a point p+(0,1)σi+1, and any points p to the left of σi such that there is p+(0,-1)σi-1. Else if i is an odd index such that yi is a y-coordinate of S, then let Σi include all points of σi, plus any points p to the left of σi such that there is a point p+(0,1)σi+1, and any points p to the right of σi such that there is p-(0,1)σi-1.

In either case Σi is a line segment, this follows from the fact that S is connected and y-monotone. For j{0,1,,|Σi|-1} we write Σi(j) to mean the jth point, where for even i we index from the left hand side (from smallest to largest x-coordinate), and for odd i we index from the right hand side (from largest to smallest x-coordinate) of the line segment Σi.

We next claim that the sequence Σ is a path that includes all points of S. Writing Σ point-by-point:

Σ=Σ0(0),Σ0(1),,Σ0(|Σ0|-1),Σ1(0),Σ1(1),,Σ1(|Σ1|-1),ΣH-1(0),ΣH-1(1),,ΣH-1(|ΣH-1|-1)

First, Σ includes all points of S because for each i where yi is a y-coordinate of S, the set of points iΣi includes all points at y-coordinate yi of S (because iσi does and iσijΣj). Second, we need to show that Σ is a simple path. Σ is composed of H-1 non-intersecting line segments therefore is simple. To see that Σ is connected it suffices to observe that for each j0, pos(Σj(|Σj|-1))=pos(Σj+1(0))-(0,1). This completes the claim that Σ is a path that includes all of S.

For the error, any point in Σ that is not in S is adjacent to a perimeter point of S, this follows from the definition of Σi, i.e. points in Σi\σi are not in S but are adjacent to points in (σi-1σi+1)S.

Also, there is no perimeter point p of S such that there are 2 points of Σ adjacent to p (if there were, this would contradict Σ being simple, or S being connected/y-monotone).

Since Σ is a zig-zag path, it is foldable in O(logn) expected time by Theorem 21.

Theorem 24 states that all y-monotone shapes are foldable, albeit with some error. One might ask: Is it possible to fold y-monotone shapes without error? The answer is no, via a straightforward argument:

Theorem 25

There are y-monotone shapes that require folding error >0.

Proof

Let S be a cross shape with width-1 line segments for arms, with arm length >1, as illustrated in Fig. 9.

Since S is y-monotone, by Theorem 24 it is foldable (with error) by a Turning Machine, but since it is not Hamiltonian (does not have a traversal), any folding of it has non-zero error.

Theorem 25 feels unsatisfactory: it is not fair to ask Turning Machines to exactly (zero error) fold shapes that don’t even have an error-free traversal. Later, in Theorem 38, we give a much stronger result: there is a class of shapes that are unfoldable (with zero error), even though each shape in the class has a (zero error) traversal, and moreover that traversal is foldable on at least one Turning Machine trajectory.

We leave the following open problem as future work:

Open Problem 26

Characterise the class of shapes that are foldable with 0 error.

In the next section we make some partial progress.

Folding scaled shapes with 0-error

In this section we present an approach to folding spatially scaled shapes with 0-error. In our setting, factor-2 scaling is sufficient. See an example in Fig. 10.

Definition 27

Given a shape S, we define its scaled version S×k by a factor k in the following way. Each vertex (i,j)S is replaced by a k×k square in shape S×k. That is, for every (i,j)S, shape S×k contains all grid-vertices {(ki+a,kj+b)0a,b<k}.

If we blindly attempt to take our approach of folding with error, Theorem 24, and attempt to apply it directly to fold factor-2 scaled shapes, we will fail (for example, consider a factor-2 scaled version of the cross in Fig. 9). However, in this section we introduce a sufficient property of a shape S to have, such that its scaled version S×2 is foldable by a Turning Machine (leading to Theorem 33).

Let C={c1,c2,,ck} be a chain of grid-vertices in S. That is, C is a non-self-intersecting sequence of grid-points such that ci and ci+1 are neighboring grid vertices, for all i.

Definition 28

We say that chain C is a yw-chain if the y-coordinates of ci and ci+1 differ by exactly one.

Note that in this case C is a chain of straight-line segments parallel to one of the y or w directions.

Now, let S be a y-monotone shape, let ymin be the y-coordinate of its bottom most row, and let ymax be the y-coordinate of its topmost row.

Definition 29

We say that chain C={c1,c2,,ck} is a yw-separator of a y-monotone shape S if (1) C is a yw-chain, (2) ciS for all i, and (3) the y-coordinates of c1 and ck are ymin and ymax, respectively.

First, we prove that a scaled version of an xy-connected y-monotone shape with a yw-separator can be partitioned into two pieces with “nice” left and right boundary, respectively (see Fig. 10 (right)).

Definition 30

Define the left (right) boundary of a y-monotone shape S to be the set of the leftmost (rightmost) grid-points in every row of S.

Definition 31

Given the yw-separator C of a y-monotone shape S. Define C×2 as the set of grid points in S×2 that corresponds to C in S, that is, for each ci=(xi,yi)C, we denote the four points in C×2 corresponding to ci, as ci,(0,0)=(2xi,2yi), ci,(1,0)=(2xi+1,2yi), ci,(0,1)=(2xi,2yi+1), and ci,(1,1)=(2xi+1,2yi+1).

Consider the yw-separator C of S, where S is a xy-connected y-monotone shape, and consider the grid-points C×2 of S×2.

We cut S×2 in between the points of C×2 in the following way (refer to Fig. 11). Let C and C be the rightmost boundary of S×2 and the leftmost boundary of S×2 respectively. Assign the bottommost points c1,(0,0) to C and c1,(1,0) to C.

Fig. 11.

Fig. 11

Left: an xy-connected y-monotone shape S containing 6 points, along with a yw-separator C (in purple). Right: grid points in black show S×2 which is the factor-2 scaling of S and the separator C (in purple) that separates S×2 into S×2 (left) and S×2 (right)

For two consecutive points ci and ci+1 on C, if cici+1¯ is parallel to y, then assign ci,(0,1) and ci+1,(0,0) to C, and ci,(1,1) and ci+1,(1,0) to C.

Otherwise, if cici+1¯ is parallel to w, then one of the following cases holds: either the point ci-(1,0) belongs to S, or the point ci+1+(1,0) belongs to S. Indeed, as S is a xy-connected y-monotone shape, one of the two points must belong to S. Then, in the first case, when ci-(1,0) belongs to S, we assign one point ci+1,(0,0) to C, and three points ci,(0,1), ci,(1,1), and ci+1,(1,0) to C. In the second case, when ci+1+(1,0) belongs to S, we assign three points ci,(0,1), ci+1,(0,0), and ci+1,(1,0) to C, and one point ci,(1,1) to C.

Finally, assign the topmost points ck,(1,0) to C and ck,(1,1) to C.

In the following lemma we prove that the described method indeed partitions S×2 into two simply-connected pieces with yw-chains on the right and left boundary.

Lemma 32

Let S be an xy-connected y-monotone shape that has a yw-separator. Then S×2 can be partitioned into two simply-connected y-monotone pieces S×2 and S×2 such that (1) every row of S×2 is partitioned into two non-empty subsets, with the left belonging to S×2, and the right to S×2, and (2) the right boundary of S×2 and the left boundary of S×2 form yw-chains.

Proof

We argue that by splitting S×2 between the two chains C and C constructed above, we indeed obtain such S×2 and S×2.

First, observe that C and C are both yw-chains. Indeed, for each pair of rows in S×2 corresponding to a row in S from ymin to ymax both C and C have grid-points assigned to them (from the points corresponding to either grid-points in C×2 or adjacent grid-points in direction x or -x). Furthermore, by construction, for every two consecutive points cj,cj+1C (and cj,cj+1C) they differ in y-coordinate by exactly 1, and they differ in x-coordinate by 0 or -1.

Furthermore, observe that C and C are both yw-separators of S×2, as they span from the bottommost to the topmost row of S×2.

Let S×2 consist of C and all the grid-points of S×2 to the left of C, and let S×2 consist of C and all the grid-points of S×2 to the right of C. Shapes S×2 and S×2 are simply-connected, as C and C are connected, and have yw-chains on the rightmost and the leftmost boundary respectively.

We next define a traversal Σ of S×2. Consider the shapes S×2 and S×2 constructed as described in the proof of the above lemma. For each pair of rows of S×2 corresponding to a row in S, we traverse the bottom of the two rows of S×2 from the grid-point on C left to the end of the row, and return to the grid-point on C along the top one of the two rows (see Fig. 10). As the two leftmost grid-points of the two rows in S×2 correspond to the same grid-point of S, the traversal from the first to the second row is valid. Similarly, we traverse the bottom of the two rows of S×2 from the grid-point on C right to the end of the row, and return to the grid-point on C along the top one of the two rows. As C and C are yw-chains, the traversal between the two pairs of rows in S×2 and S×2 is valid as well. Finally, we connect the two parts of the traversal Σ across C and C in the bottommost row of S×2.

Theorem 33

Let S be an xy-connected y-monotone shape that has a yw-separator C, then S×2 is foldable by a Turning Machine in expected time O(logn).

Proof

We prove that the Turning Machine TΣ defined as follows folds the shape S×2, i.e. on all trajectories. Let TΣ consist of n monomers m0,m1,,mn-1, where n is the number of grid-points of S×2, and the first monomer m0 corresponds to the topmost grid-point of C (defined above). In the folded state, TΣ traverses S×2 from top to bottom, and then traverses S×2 from bottom to top. Let the initial states of the monomers forming the bottommost row (except for the rightmost one) of S×2 be 0. Applying Lemma 9 we derive the initial states of the remaining monomers (refer to Fig. 10). Let monomer mj correspond to a grid-point pjS×2. We consider the following cases: pj is in an odd or even row of S×2; furthermore, we consider the cases when pj is the leftmost point, the rightmost point, or an interior point of the row. Let C={c1,c2,,ck} and C={c1,c2,,ck}, where c1 and c1 are the bottom most grid-points, and ck and ck are the top most grid-points. Let pj be in an odd row, then

  • if pj=cC and >1, then s(mj)=-2 if c-1,c¯ is parallel to y, and s(mj)=-1 if c-1,c¯ is parallel to w,

  • otherwise, if pjC or pj=c1, then s(mj)=0.

Let pj be in an even row of S×2, then

  • if pj is the leftmost point in its row, then s(mj)=-2,

  • otherwise, s(mj)=-3.

Similarly, for the monomers whose final positions fall in S×2, we specify the following initial states. Let pj be in an even row of S×2, then

  • s(mn-1)=0,

  • if pj=cC and <k, then s(mj)=1 if c,c+1¯ is parallel to y, and s(mj)=2 if c,c+1¯ is parallel to w,

  • otherwise, if pjC, then s(mj)=-3.

Let pj be in an odd row of S×2, then

  • if pj is the right point in its row, then s(mj)=1,

  • otherwise, s(mj)=0.

We claim that TΣ indeed computes S×2 and does not enter a permanently blocked configuration for any sequence of transition rules (trajectory). Assume that there is a configuration c that is reachable from the initial configuration of TΣ that is permanently blocked. Let mi be the monomer corresponding to the bottommost grid-point of C, that is, mi is the last monomer in the traversal Σ that is still in S×2. Let T and T be Turning Machines consisting of the monomers {m0,,mi} and {mi+1,,mn-1} correspondingly. Similarly to the proofs of Theorems 21 and 24 , we can argue that T and T individually compute the shapes S×2 and S×2, i.e., they fold without entering in a permanently blocked configuration. Thus, if c is blocked, then for every monomer m there must be a pair of monomers mj with ji and mk with k>i that are blocking the transition of m.

Consider individual folding of the Turning Machine T. Without loss of generality, let the monomer mi+1 be fixed in the origin of the coordinate system, and the remaining monomers move with respect to it. We consider the cut γ between the shapes S×2 and S×2 in this global coordinate system, and extend its ends to infinity along the y direction (see Fig. 12). We claim that the monomers of T always remain to the right of γ. Consider how the position pos(mj) changes when the transition rules are applied to the monomers of T. The monomers of T rotate from orientation x to y, from y to w, and from w to -x. If a monomer mk moves, where kj, the position of mj does not change. If a monomer mk moves, where k<j, the position of mj changes by one unit distance in the directions w, -x, or -y. Suppose in an intermediate configuration c some monomer mjT has a position to the left of the cut γ. From this moment on, the position of mj is confined to a 120 with its apex in pos(mj) and the two rays emanating in the directions w and -y. Thus, monomer mj will never cross the cut γ to the right side, and thus T does not compute S×2.

Fig. 12.

Fig. 12

Folding of a Turning Machine T. Its monomers remain on the right side of the cut γ. If monomer mj were to the left of γ, its further position is confined to the cone shown in green

Similarly, we argue that the monomers of T always remain to the left of the cut γ. This implies that there can never be a blocked pair mj with ji and mk with k>i. Therefore, TΣ folds S×2 on every trajectory.

For the time analysis, we note that the target configuration of T is a negative zig-zag path, and the target configuration of T is a positive zig-zag path. By Theorem 21, both T and T would each individually fold in O(logn) expected time if they were separate Turning Machines. In the construction in this proof, we show that monomers in T don’t block any monomers in T (and vice-versa), hence even if both T and T are joined, they fold independently. Thus, TΣ completes in O(logn) expected time.

Shapes that have a traversal, yet are not foldable: spirals

The goal of this section is to prove Theorem 38, which gives a class of shapes that have a traversal yet are not foldable. Specifically, the following definition of k-turn, 1-gap, spiral, defines a particular kind of spiral that makes k anti-clockwise turns, and has its arms held at unit distance (gap 1) apart, as shown in Fig. 13.

Fig. 13.

Fig. 13

A k=3-turn, gap 1, spiral on the triangular grid G, as defined in Definition 34. The centre of the spiral is at (0,0), and the arms of the spiral turn anti-clockwise while keeping at a distance (gap) of exactly 1 from each other. The monomers framed in red are those which reside in the “almost rectangle” Rk=R2 in Definition 34

Definition 34

(k-turn 1-gap spiral) For kN+, define the anti-clockwise k-turn 1-gap spiral to be kkRk, where Rk is an “almost rectangle” formally defined as follows (see Fig. 13 for a pictorial definition):

Rk={(x,y)y=±2kand-2kx2k-1}{(x,y)x{-2k,2k-1}and-2ky2k}{(2k-2,-2k+2),(2k,-2k),(2k+1,-2k)}\{(2k-1,-2k+1)}.

Remark 35

For each k, the k-turn 1-gap spiral has two traversals—one starting at the centre, one ending at the centre. It can also be seen that k-turn 1-gap spiral has a Turning Machine that has a trajectory whose final configuration is the spiral—SM starts as a line with monomer m0 at the centre of the spiral, and with initial states being turning numbers10 for the spiral curve. One can then imagine a trajectory that folds each arm of the spiral one at a time starting at the centre and working its way out (like rolling up a piece of paper). However, despite this, in this section we show that for each kN+, the k-turn 1-gap spiral is not foldable by a Turning Machine (Theorem 38). The proof shows that any Turning Machine that attempts to fold a spiral must fail by either having invalid/illegal states, or else having at least one permanently blocked reachable configuration.

The following technical definition is used in the statement of Lemma 37. The notation [a]b, means a,a,,abtimes.

Definition 36

For kN+, let S be a k-turn 1-gap spiral. A sequence of inside-to-outside turning numbers for S is of the form

Tin-to-out(t0)=[t0]1,[t1]2,[t2]3,[t3]4,,[t4k-2]4k-1,[t4k-1]4k,[t4k]4k+1,t4k,

where t0Z is such that t00mod6 and

ti=ti-1+2ifiis even,ti-1+1ifiis odd. 4

A sequence of outside-to-inside turning numbers for S is any sequence of the form

Tout-to-in(t0)=t0,[t0]4k+1,[t1]4k,[t2]4k-1,[t3]4k-2,,[t4k-1]2,[t4k]1,

where t0Z is such that t03mod6, and

ti=ti-1-1ifiis even,ti-1-2ifiis odd. 5

Lemma 37

For kN+, the k-turn 1-gap spiral Sk is unfoldable by any Turning Machine M that has initial state sequence s0(m0),s0(m1),,s0(mn-1) that is not one of the turning number sequences Tin-to-out(s0(m0)) or Tout-to-in(s0(m0)) from Definition 36.

Proof

From its definition, Sk has exactly |Sk|=8k2+6k+2 points, which, by a straightforward calculation, is the same as the length of the sequences of canonical turning numbers in Definition 36. If M does not have exactly n=|Sk| monomers, does not fold Sk (either it does not cover all points of Sk or covers too many). Assume then that we are given a Turning Machine M with n=|Sk| monomers, but that do not have states given by Definition 36.

The spiral has exactly two points, namely (0, 0) and (2k+1,-2k), that have degree 1 (one neighbour in Sk); we respectively call them the inside and outside start points. If the spiral were foldable, then monomer m0 is positioned on either the inside or outside start point. By Lemma 8, |s0(mi)-s0(mi+1)|2 for all 0i<n-1.

Suppose pos(m0) is the inside start point. If any of the remaining claims do not hold, then the Sk is unfoldable:

Monomer m0’s initial state is s0(m0)0mod6, by directionality of m0 in the final configuration of M (if not, we are done because either m0 finishes in state 0 but pointing in the wrong direction and thus places pos(m1) outside of Sk, or else m0 never reaches state 0 meaning m0 is permanently blocked). Also, s0(m1)1mod6, for the same reason. But Lemma 8 tell us that |s0(mi)-s0(mi+1)|2 for all 0i<n-1, hence s0(m1)=s0(m0)+1. (If not, we would get that M is blocked (by violating Lemma 8), or that M does not precisely trace the spiral (if s0(m1)1mod6). Tracing around Sk using the same reasoning for each point along Sk gives that either Tin-to-out(s0)=s0(m0),s0(m1),,s0(mn-1) or else M does not fold Sk, giving the lemma conclusion for this case.

Else, pos(m0) is on the outside start point of Sk. A similar argument (to the inside case) shows that Tout-to-in(s0)=s0(m0),s0(m1),,s0(mn-1) or else M does not fold Sk, giving the lemma conclusion for this case.

Theorem 38

(Shapes with a traversal, but are unfoldable) For all k2 the k-turn 1-gap spiral Sk is not foldable.

Proof

Suppose for the sake of contradiction that there is a Turning Machine M that folds Sk, k2. By Lemma 37, there are two cases, either, (Case 1) M has initial states Tin-to-out(s0(m0)) and s0(m0)0mod6, or (Case 2) Tout-to-in(s0(m0)) and s0(m0)3mod6.

Case 1: M has initial states Tin-to-out(s0(m0)) for s0(m0)0mod6 (intuitively, folding the spiral from inside to outside).

We have pos(m0)=(0,0) (at the “centre” of the spiral), otherwise if M finishes with all monomers in state 0 it would place (many) monomers outside Sk and we get the statement. There are three subcases: (a) all initial states are positive, (b) all initial states are negative, or (c) there are both strictly positive and strictly negative initial states:

  • Case 1(a): all initial states are positive (s0(mi)0 for all 0i<n). Here, the idea is to find a reachable configuration cb of M that is permanently blocked, as illustrated in Fig. 14a. First, the M carries out repeated line rotations by π/3, until reaching a configuration where m0 is in state 0. Then the line of monomers m1,m2,m3, rotates by π/3, which puts m1,m2 in state 0. We next have the line of monomers m3,m4,m5, rotate by 2π/3, which puts m1,m2 in state 0, and parallel to the x-axis, pointing the -x direction (Fig. 14a, left). Next we apply a turning rule application to mn-2,mn-1, and then another to mn-1 (Fig. 14a, middle). Now we repeat the previous three steps, moving backwards along monomer indices, until we reach the configuration shown in Fig. 14a, right: i.e., for each jn-1 (starting at j=n-1) apply one turning rule to mj-2, one to mj-1 and then one more turning rule to mj-2, then decrement j and repeat. Eventually we reach a value of j for which no move is possible, yielding the permanently blocked configuration shown in Fig. 14a, right.

  • Case 1(b): all initial states are negative (s0(mi)0 for all 0i<n). Here, the intuition is to block M by using the fact that 2π line rotation is impossible (k2), as shown in Fig. 14b. First, by Definition 36, t0<t1<<t4k on Tin-to-out(t0). Moreover, for all monomer states to be negative, and by applying Eq. (4), it is case that t0-6k. By the definition of Tin-to-out(t0) and since k=2, there are 15 monomers with initial state -6. Next we apply the main idea used to prove Theorem 14, and illustrated in Fig. 7 (there we folded in the anticlockwise direction, here it is clockwise). Specifically, we claim that the configuration shown in Fig. 14b, right, is reachable, since the 15 monomers m0,m1,m14 have initial state -6, hence they are able to reach the configuration shown, and since the other monomers (orange, purple) can be moved as shown to enable the tight inner spiral to form. The configuration in Fig. 14b, right is not (yet) permanently blocked, but the 7 monomers in the inner tight spiral are permanently blocked and thus all trajectories forward lead to permanently blocked configurations.

  • Case 1(c): there are both strictly positive and strictly negative initial states. We know from the definition of Tin-to-out(t0), and the subcase we are in, that t0<0<t4k. Moreover, we claim that Tin-to-out(t0) has a contiguous subsequence 0,0,,0; in other words there is an i{1,2,,4k-1} such that the initial state sequence, Tin-to-out(s0)=Tin-to-out(t0)=t0,t4k, contains the state subsequence [ti]i+1=[0]i+1. To see the claim, first note that by Definition 36, t00mod6, and by Eq. (4) every 4th term t4j (here, 0<j<k) has the property that t4j0mod6. Second, since t0<0 and 0<t4k, there is some j such that t4j=0, giving the claim. Let li denote the segment of i+1 monomers with initial states 0,0,,0 (Fig. 14c purple segment). Then, the preceding segment li-1 has length |li|-1=i and monomers all in initial state -2, and all monomers preceding that have initial state <-2 (by Eq. (4)). Hence the second configuration in Fig. 14c is reachable (decrement each monomer in li-1 twice). The succeeding segment li+1 has length |li|+1+i+1 and monomers all in state 1, and and all monomers succeeding that have initial state 3 (by Eq. (4)). Hence the third configuration in Fig. 14c is reachable (increment each monomer in li+1 once, and each monomer in lj, for j>i+1, three times). Figure 14c is permanently blocked.

Case 2: M has initial states Tout-to-in(s0(m0)) for s0(m0)3mod6 (intuitively, folding the spiral from outside to inside).

Fig. 14.

Fig. 14

Illustration for Case 1 of the proof of Theorem 38, showing that a 2-turn, 1-gap, Spiral can not be folded from “inside to out”. Top left: initial configuration, monomers are co-linear, colours distinguish initial states. a Initial configuration with all states positive. First we fold the intended innermost coil/turn of the spiral, by rotating almost the full line of monomers anti-clockwise by π, creating a small “pocket” (red, green, and blue monomers). Then the teal/grey monomers “prematurely” fold the configuration into the pocket, eventually yielding a permanently blocked configuration—to carry out the folding it suffices that the teal monomers have initial state 6. b Initial configuration with all states negative. The trajectory shown folds into a permanently blocked configuration similar to that in Fig. 7, but here uses clockwise turning (negative states) and has an extra long tail that needs to be folded out of the way before completing the erroneous tight spiral. The configuration in on the right is not (yet) permanently blocked, but the 7 monomers in the inner tight spiral are permanently blocked and thus all trajectories forward lead to permanently blocked configurations. c Initial configuration with strictly positive and strictly negative states. By Case 1(c) in the proof, there is a contiguous segment of monomers in state 0, here shown in purple. Monomers to the left (negative states) fold clockwise, and monomers to the right (positive states) fold anticlockwise, yielding a pincer-like permanently blocked configuration

We have pos(m0)=(2k+1,-2k) (at the “outside” of the spiral, bottom right corner), otherwise if M finishes with all monomers in state 0 it would place (many) monomers outside Sk and we get the statement. There are three subcases: (a) all initial states are positive, (b) all initial states are negative, or (c) there are both strictly positive and strictly negative initial states:

  • Case 2(a): all initial states are positive (s0(mi)0 for all 0i<n). this case is illustrated in Fig. 15a. The proof here is very similar to that of Case 1(b), in particular Fig. 15a is a reflection about the x-axis of Fig. 14b, and the only other difference here is that to reach a permanently blocked configuration we start turning from the monomers that are intended to become the shorter (rather than longer) arms of the spiral.

  • Case 2(b): all initial states are negative (s0(mi)0 for all 0i<n). First, by Definition 36, t0>t1>>t4k on Tout-to-in(t0). Moreover, for all monomer states to be negative, and by applying Eq. (5), it is case that t0-3. We begin by applying |t0| turning rule applications to all monomers, until the first k monomers (i.e, m0,m1,,m4k) have each reached state 0. Next we apply 2 turning rules to all non-zero monomers such that monomers with initial state t1 turn to state zero (grey in Fig. 15b, left). Next we apply 1 turning rules to the remaining non zero monomers such that the monomers which were initially in state t2 are now in state zero (purple in Fig. 15b, left). Next we apply 2 turning rule applications to monomers mi with 12k+2<i<n in order to reach the ‘q-shaped’ configuration shown in Fig. 15b, right. We claim that all trajectories forward from this configuration reach a permanently blocked configuration: The first three “spiral arms” (monomers with initial states t0,t1,t2) have reached state 0 and thus will not rotate any further. In order for the remaining non-0 state monomers to attempt reach the target configuration of Sk, they can only make clockwise turns which results in them wrapping around the blocked inner region. Eventually all are permanently blocked

  • Case 2(c): there are both strictly positive and strictly negative initial states. This case is similar to that of Case 1(c). By the definition of Tout-to-in(t0), and the subcase we are in, t0>0>t4k. Similarly to Case 1(c) we claim that the initial state sequence Tout-to-in(s0) = Tout-to-in(t0) contains the state sequence [ti]4k+1-i=0 for some i{1,2,,4k-1}. To see this we first note that by Definition 36, t03mod6, and by Eq. (5) every 4th term after the 2nd term is congruent to 0mod6 (that is to say ti0mod6 such that i2mod4). Thus t4j+20mod6 for some j with 0j<k. We let li denote this segment of 4k+1-i monomers each with initial state 0. (Fig. 15c dark green segment). Then the preceding segment li-1 has length 4k-i+2 and has initial states 1 and the succeeding segment li+1 of length 4k+2 with initial state -2 by Eq. (5). Hence the second configuration in Fig. 15 is reachable. The segment li+2 of length 4k-i-1 has initial state -3 by Eq. (5). Hence the third configuration in Fig. 15c is reachable. Thus Fig. 15c is permanently blocked.

Fig. 15.

Fig. 15

Illustration for Case 2 of the proof of Theorem 38 showing that a 2-turn, 1-gap, Spiral can not be folded from “outside to in”. Top left: initial configuration, monomers are co-linear, colours distinguish initial states. a Initial configuration with all states positive. Trajectory shown folds into a permanently blocked configuration similar to that in Figs. 14b and 7 . The configuration to the right is not yet permanently blocked, but the 7 monomers in the inner tight spiral (starting at m0) are permanently blocked and thus all trajectories from this configuration will yield permanently blocked configurations. b Initial configuration with all states negative. First we fold the outer most part of the spiral by rotating almost a full line of monomers clockwise by π creating a large “C shape” (dark green, gray, purple monomers). Then the remaining arm of the spiral folds such that it is anti-parallel to the y-axis (right). This arm of the spiral wishes to rotate clockwise to reach the center, but to do so would cause these monomers to intersect with the “C shape” outer coil of the spiral, thus leading to a permanently blocked configuration. c Initial configuration with both strictly positive and strictly negative initial states. This construction is similar to that used in Fig. 14c such that there is a contiguous segment of monomers with states 0,0,,0, here shown in dark green. Monomers to its left (positive states) fold anti-clockwise, and monomers to the right (negative states) fold clockwise, yielding a “pincer-like” permanently blocked configuration

Acknowledgements

We thank Vera Sacristán and Suneeta Ramaswami for insightful ideas and important input. This work began at the 29th Bellairs Winter Workshop on Computational Geometry (March 21–28, 2014 in Holetown, Barbados), we thank Erik Demaine for organising a wonderful workshop and providing valuable feedback, and the rest of the participants for providing a stimulating environment. We also thank Dave Doty and Nicolas Schabanel for helpful comments. This paper expands upon the conference version published in Proceedings of the 26th International Conference on DNA Computing and Molecular Programming. Oxford 2020, Leibniz International Proceedings in Informatics (LIPIcs), with new material appearing in Sects. 6.26.4. We thank the anonymous reviewers of this work for insightful comments led to significant improvements of the text.

Appendix

Line rotation by π/3, πnd 4π/3

In this appendix we present proofs that line-rotating Turning Machine for respective angles of π/3, π and 4π/3 terminates in expected time O(logn). These claims are superseded by the results in the main paper, but we include the proofs as they give a number of techniques to analyse the Turning Machine model.

Line rotation by π/3: Ln1

The following proof of line rotation by π/3 radians is intended to be a simple example worked out in detail. Let Ln1 be the Turning Machine defined in Definition 1 with σ=1, as illustrated in Fig. 3 (left).

Lemma 39

For each nN, the line-rotating Turning Machine Ln1 computes its target configuration, and does so in expected O(logn) time.

Proof

The initial configuration (Fig. 3, left) of Ln1 is a line of n-1 monomers in state 1 with an additional final monomer in state 0, i.e. at time 0 the n states are s(m0)s(m1)s(mn-1)=1n-10. Since monomer states only change by decrementing from 1 to 0, any configuration on any trajectory of Ln1 has its (composite) state of the form {0,1}n-10. Consider a configuration c in a trajectory of evolution of Ln1, and the corresponding state11x{0,1}n-10. Let mic denote the ith monomer of Ln1 in configuration c. For any i{0,1,,n-2} such that s(mic)=1, consider the unique configuration c where cc and s(mi)=0 (and, by definition of next configuration step, ji implies s(mj)=s(mjc)).

We claim that tail(mic) does not share any positions with head(mic), in other words, that c is a non-self-intersecting configuration. To show this, consider a horizontal line i through monomer mic and observe that in c (and in c), the monomers tail(mic)=m0c,m1c,,mic lie on or below i (because the path pos(m0c),pos(m1c),,pos(mic) is connected and consists of unit length segments each at an angle of either 0 or 60 clockwise relative to the x-axis), but the monomers head(mic)=mi+1,mi+2,,mn-1 lie strictly above i (because pos(mi+1) is strictly higher than pos(mic), and because the path pos(mi+1),pos(mi+2),,pos(mn-1) is connected and consists of unit length segments each at an angle of 0 or 60 to the x-axis). Hence there are no blocked configurations reachable by Ln1 (neither permanent nor temporary blocking).

At each reachable configuration c, starting from the initial configuration, we can choose i independently from the set of non-zero states. The expected time for the first rule application is 1/(n-1) since it is the expected time of the minimum of n-1 independent exponential random variables each with rate 1. The next is 1/(n-2), and so on. By linearity of expectation, the expected value of the total time T is

E[T]=k=1n-11k=O(logn)

where the sum is the (n-1)th partial sum of the harmonic series, known to have a O(logn) bound. Hence Ln1 completes in expected O(logn) time.

Line rotation by π: Ln3

Next, we analyse line rotation of π radians.

Lemma 40

Let Ln3 be a line-rotating Turning machine, then:

  • (i)

    only monomers in state 1 adjacent to a monomer in state 3 are blocked, and that blocking is temporary,

  • (ii)

    any reachable configuration of Ln3 has no more than 2n/3 blocked monomers, and

  • (ii)

    there exists a configuration of Ln3 that has exactly 2n/3 blocked monomers.

Proof

Consider any reachable configuration c of Ln3, and let monomer mi be blocked in c. By Lemma 10, monomers in state 2 and 3 are never blocked. By definition, monomers in state 0 are not blocked. Thus if mi is blocked it is in state 1, i.e. s(mi)=1. We claim that in this case either s(mi-1)=3 or s(mi+1)=3 (or both). Consider the following two cases for s(mi+1):

  1. If s(mi+1){1,2}, then by Lemma 5 all monomers of head(mi), except its first monomer mi+1, lie strictly above i, and since tail(mi) lies on or below i, we get that tail(mi) does not intersect head(mi), except possibly at pos(mi+1). Whether pos(mi+1) intersects tail(mi) depends on the state of mi-1:
    1. If s(mi-1){1,2}, then all monomers of tail(mi) lie strictly below i (except its first monomer mi which is not at position pos(mi+1)), hence pos(mi+1) cannot intersect tail(mi). Then mi cannot be blocked.
    2. If s(mi-1)=0, then mi+1 does not intersect tail(mi): Indeed, pos(mi-1)=pos(mi)+x=pos(mi+1)+2xpos(mi+1). Furthermore, let mj, mj+1, ..., mi-1 be the longest consecutive subsequence of monomers in state 0 preceding monomer mi. Then pos(mj), pos(mj+1), ..., pos(mi+1) are all strictly to the west of pos(mi). If j-10, the non-zero-state12 monomer mj-1 enforces that the monomers m0, m1, ..., mj-1 lie strictly below i. Thus mi is not blocked.
    Therefore, monomer mi-1 can only be in state 3.
  2. If s(mi+1)=0: Both head(mi) and tail(mi) have monomers on i, but we claim the positions of head(mi) do not intersect those of tail(mi). If s(mi-1){1,2}, then all monomers of tail(mi) except mi lie strictly below i, and thus head(mi) does not intersect tail(mi) (and recall that head(mi) does not intersect pos(mi) because configurations are simple). If s(mi-1)=0 then the monomers M={mi-1,mi,mi+1} lie along i (pointing west). Note that a prefix of M is a suffix of tail(mi) and a (disjoint) suffix of M is a prefix of head(mi). Hence, in order for tail(mi) to intersect head(mi), one or both must depart from i, but, by Lemma 5, tail(mi) can only do so by having monomers strictly below i, and head(mi) can only do so by having monomers strictly above i. Thus, monomer mi-1 can only be in state 3.

Therefore, if mi is blocked, then it is in state 1 and either mi-1 or mi+1 is in state 3, and thus is temporarily blocked which yields Conclusion (i) of the lemma. Hence, there cannot be three monomers in a row which are blocked, resulting in Conclusion (ii) of the lemma.

For Conclusion (iii), consider a line-rotating Turning Machine Ln3 with n=3k for some k. The configuration c with state sequence S=(131)k-1130 has exactly 2n/3 blocked monomers, as every monomer in state 1 is either blocked by a preceding monomer in state 3, or by a following monomer in state 3.

Theorem 41

(rotate a line by π) For each nN, the line-rotating Turning Machine Ln3 computes its target configuration, and does so in expected time O(logn).

Proof

By Lemma 40, no configuration has a permanently blocked monomer, hence every trajectory of Ln3 ends in the target configuration.

At the initial step, the rate of rule applications is n-1 (there are n-1 monomers in state 3). Over time, for successive configurations along a trajectory, the rate of rule applications may decrease for two reasons: (a) some monomers may be temporary blocked, and (b) after a monomer transitions to state 0 no more rules are applicable to it. We reason about both:

  1. Lemma 40(ii) shows that a configuration with state sequence s=(131)n/3-1130 has 2n/3 blocked monomers, and Lemma 40(ii) states that no configuration has more than 2n/3 blocked monomers for n divisible by 3. Using that fact, and in order to simplify the proof, we shall analyse a new, possibly slower, system where for any configuration c that has nn monomers in state 0, we “artificially” block 2n/3 monomers.13 Since this assumption merely serves to slow the system, it is sufficient to give an upper bound on the expected time to finish.

  2. A second “slowdown” assumption will be applied during the analysis and is justified as follows. Intuitively, the number of monomers transitioning to state 0 increases with time, and since monomers in state 0 have no applicable rules, this causes a decrease in the rate of rule applications. Consider a hypothetical continuous-time Markov system M, with 3n steps with rate decreasing by 1 every third step, that is, with successive rates n,n,n,n-1,n-1,n-1,n-2,,2,1,1,1. By linearity of expectation, the expected value of the finishing time T is the sum of the expected times E[ti] for each of the individual steps i{1,2,,3n}:
    E[T]=i=13nE[ti]=m=1n3·1m=3m=1n1m=3Hn3(ln(n)+1)=O(logn), 6
    where Hn is the nth partial sum of the harmonic series m=11m with Hnln(n)+1 (see Graham et al. 1989). Since, in Ln3, it requires at least 3 steps to send a monomer from state 3 (the initial state) to state 0, no trajectory sends monomers to state 0 at a faster rate than a (hypothetical) trajectory where a transition to state 0 appears at every third configuration (step). Hence, if there were no blocking whatsoever, then the expected time for Ln3 would be no larger than 3Hn (given by Eq. (6)).

Taking the blocking “slowdown assumption” in (a) into account, if the rate at step i is ri, then the slowed down rate is 13ri giving an expected time of

E[T]=i=13nE[ti]=m=1n3·31·1m=9m=1n1m=9Hn9(ln(n)+1)=O(logn). 7

Since our two assumptions merely serve to define a new system that is necessarily slower than Ln3, we get the claimed expected time upper bound of O(logn) for Ln3.

Line rotation by 4π/3: Ln4
Lemma 42

Let mi be a blocked monomer in some reachable configuration c of a line rotation Turning Machine Lns with nN and 1s4, and let mjhead(mi) and mktail(mi) be a pair of monomers which block the movement of mi, then in the subchain of Lns from mk to mj-1 the number of unblocked monomers is at least half the number of blocked monomers.

Proof

Similarly to the proof of Lemma 10, consider the closed chain P=pos(mk), ..., pos(mj), pos(mk). Let x(mi) denote the x-coordinate of the position of monomer mi, and y(mi) denote the y-coordinate of the position of monomer mi. Note, that for any ,

  • if s(m)=s, then x(m+1)=x(m)+1 and y(m+1)=y(m),

  • if s(m)=s-1, then x(m+1)=x(m) and y(m+1)=y(m)+1,

  • if s(m)=s-2, then x(m+1)=x(m)-1 and y(m+1)=y(m)+1,

  • if s(m)=s-3, then x(m+1)=x(m)-1 and y(m+1)=y(m),

  • if s(m)=s-4, then x(m+1)=x(m) and y(m+1)=y(m)-1.

Let x(mk)-x(mj)=εx and y(mk)-y(mj)=εy, with εx,εy{-1,0,1}. The total change in x-coordinate and the total change in y-coordinate, when traversing P, is zero, that is,

=kj-1(x(+1)-x())+εx=0,=kj-1(y(+1)-y())+εy=0. 8

Considering the first part of Eq. (8), and taking into account that the x-coordinate increases only when traversing monomers in state s, and the x-coordinate decreases only when traversing monomers in state s-2 or s-3, we get #(s)+εx=#(s-2)+#(s-3), where #(u) denotes the number of monomers with state u in the subchain from mk to mj-1. Observe, by Lemma 10, monomers in states s and s-1 cannot be blocked, and since s4, only the monomers in states s-2 or s-3 can be blocked. This implies, that within the subchain from mk to mj-1, the number of blocked monomers is at most within an additive factor 1 from the number of unblocked monomers.

Suppose, for a given subchain from mk to mj-1, the number of monomers in state s is strictly positive (that is, #(s)1). Then, #(s)12(#(s-2)+#(s-3)), that is, in the subchain, the number of unblocked monomers is at least half the number of blocked monomers.

Now suppose that the number of monomers in state s in the subchain is zero (that is, #(s)=0). As the blocked monomer mi has state either s-2 or s-3, the x-coordinate decreases by 1 when traversing it. The x-coordinate only increases when traversing monomers in state s. Therefore, if there are no monomers in state s, εx has to be 1, and, besides the blocked monomer mi, the subchain from mk to mj-1 consists only of monomers in states s-4 and s-1.

Furthermore, as εx=1, we have that pos(mk)=pos(mj)-w (that is, mi is in state s-3). We claim that there is at least one monomer in state s-1 in the subchain from mk to mj-1. Indeed, consider the second part of Eq. 8. Traversing the edge between monomers mk and mj changes the y-coordinate by εy=y(mj)-y(mk)=y(-w)=-1. Thus there has to be at least one monomer traversing which increases the y-coordinate. This can only be a monomer in state s-1. Thus, in the subchain from mk to mj-1, there is one blocked monomer mi and at least one unblocked monomer in state s-1, and the total number of unblocked monomers is at least the number of blocked monomers.

Theorem 43

For each nN and 1s4, the line rotation Turning Machine Lns computes its target configuration in O(logn) steps.

Proof

By Theorem 12 the Turning Machine Lns computes its target configuration. That it computes the target configuration in O(logn) steps follows from the claim that in any intermediate configuration c, the number of blocked monomers is not greater than 3n/4.

To prove this claim, consider a reachable configuration c of Lsn, and consider all blocked monomers B={mi:miis blocked}.

Let ej,k be the edge connecting the positions of two monomers mj and mk which block the movement of some monomer miB (note, that mi can be blocked by more than one pair of monomers). Let E={ej,k} be the set of all such edges for all pairs mj and mk which block some monomer in Lsn. Observe, that no two edges in E cross each other, as they are unit segments in the triangular graph, and for the same reason no edge in E crosses the chain Lsn. Let the chain Lsn together with the set of edges E partition the plain into plane subdivision D (refer to Fig. 16). The bounded faces of D are formed of subchains of Lsn and edges from E. Now, remove the edges of E from D which are not incident to the outer face, resulting in a plane subdivision D. In it, every bounded face is formed by a single subchain of Lsn and a single edge from E.

Fig. 16.

Fig. 16

Subdivision D of the plane consists of chain Lsn (shown in blue), and all edges (shown in red), connecting pairs of monomers blocking the movement of some monomer, such that these edges are incident to the outer face of D

Observe, that all monomers of Lsn which are blocked are incident to at least one bounded face. Otherwise, there would be two monomers mj and mk blocking the move with the edge ej,k not in E, thus contradicting the definition of E.

For each bounded face fi in D, by Lemma 42, we have #i(unblocked)12#i(blocked), where #i(unblocked) denotes the number of unblocked monomers incident to the face fi, and #i(blocked) denotes the number of blocked monomers incident to the face fi.

Note, that each unblocked monomer can be incident to at most two bounded faces of D, and recall that each blocked monomer is incident to at least one bounded face of D. Then,

#(unblocked)12fiD#i(unblocked)1212fiD#i(blocked)14#(blocked),

where the sums are over the bounded faces of D, and #(unblocked) denotes the total number of unblocked monomers in Lsn, and #(blocked) denotes the total number of blocked monomers in Lsn.

Since there is a constant fraction of unblocked monomers in any configuration, the total expected time it takes Lns to compute its target configuration is O(logn).

Funding

Open Access funding provided by the IReL Consortium.

Footnotes

1

Having the monomer turning angle be confined to the range (0,π/2] seems to capture a range of interesting and important blocking behaviours that would otherwise be missed by the model. Having the angle be π/3, and in particular choosing the triangular grid over the square grid, is a somewhat arbitrary choice in the model definition.

2

Or even just drawing a line through a shape, or even just a single point in the shape, or even zero points in the shape!

3

We don’t state it as a result, but the folding tasks in this paper have an expected time lower bound of Ω(logn), for a length n Turning Machine instance, since they require they require n events to occur.

4

In the language of Woods et al. (2013), one can imagine that for all i{0,1,,n-2}, there is a rigid bond between monomer mi and monomer mi+1, and otherwise there are no bonds.

5

Another way to state this is that when a monomer mi moves, head(mi) translates in the direction corresponding to the current direction of mi rotated by the angle 2π/3.

6

The notion of left or right turn along the three points pos(mi-1),pos(mi),pos(mi+1) can be formalised by considering the line i running through pos(mi), in the direction pos(mi-1)pos(mi), noting that i cuts the plane in two, and defining the left- and right-hand side of the plane with respect to the vector along i.

7

We are using a technique here that leverages the statement of Lemma 40 from the appendix. We could alternatively use the same technique as Lemma 40, which more directly reasons about rule applications and blocking, without needing to define the restricted-L3-system.

8

This notion of “suppression” should not be confused with blocking, for the sake of analysis, we are simply defining a new model where we get to arbitrarily choose which rules are suppressed.

9

As discussed in Remark 3, a target configuration is one where all states are 0, in other words the intended final configuration of the Turning Machine. Note that we’ve not yet proven that such a target is always reachable—that’s our goal in fact.

10

Start with some integer (e.g. 0) and traverse the curve writing down an integer at each point, but incrementing the noted value at each turn of π/3 anti-clockwise, and decrementing at each turn of π/3 clockwise.

11

In fact any x{0,1}n-10 is the state of a reachable configuration, but we don’t need to prove that.

12

Which must be in state 1 or 2, since 3 would give a self-intersection along the configuration.

13

The monomers are not necessarily geometrically blocked, we are merely stopping any rule from being applied to them. No configuration in a trajectory of Ln3 witnesses a larger slowdown due to blocking than the slowdown we have imposed on the configurations of Tn.

This paper expands upon the conference version published in Proceedings of the 26th International Conference on DNA Computing and Molecular Programming. Oxford 2020, Leibniz International Proceedings in Informatics (LIPIcs). Authors C. Wood and D. Woods are supported by European Research Council (ERC) award number 772766 and Science foundation Ireland (SFI) grant 18/ERCS/5746 (this manuscript reflects only the authors’ view and the ERC is not responsible for any use that may be made of the information it contains).

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  1. Aloupis G, Collette S, Damian M, Demaine ED, Flatland R, Langerman S, O’Rourke J, Ramaswami S, Sacristán V, Wuhrer S (2009) Linear reconfiguration of cube-style modular robots. Comput Geom 42(6–7):652–663 10.1016/j.comgeo.2008.11.003 [DOI] [Google Scholar]
  2. Aloupis G, Collette S, Demaine ED, Langerman S, Sacristán V, Wuhrer S (2008) Reconfiguration of cube-style modular robots using O(log n) parallel moves. In: International symposium on algorithms and computation, pp 342–353. Springer
  3. Chen H-L, Doty D, Holden D, Thachuk C, Woods D, Yang C-T (2014a) Fast algorithmic self-assembly of simple shapes using random agitation. In: DNA20: the 20th international conference on DNA computing and molecular programming. LNCS, vol 8727, pp 20–36, Kyoto, Japan, September 2014. Springer. Full version: arXiv:1409.4828
  4. Chen M, Xin D, Woods D (2014) Parallel computation using active self-assembly. Nat Comput 14(2):225–250 10.1007/s11047-014-9432-y [DOI] [Google Scholar]
  5. Cheung KC, Demaine ED, Bachrach JR, Griffith S (2011) Programmable assembly with universally foldable strings (moteins). IEEE Trans Robot 27(4):718–729 10.1109/TRO.2011.2132951 [DOI] [Google Scholar]
  6. Chin Y-R, Tsai J-T, Chen H-L (2018) A minimal requirement for self-assembly of lines in polylogarithmic time. Nat Comput 17(4):743–757 10.1007/s11047-018-9695-9 [DOI] [Google Scholar]
  7. Connelly R, Demaine ED, Demaine ML, Fekete SP, Langerman S, Mitchell JSB, Ribó A, Rote G (2010) Locked and unlocked chains of planar shapes. Discrete Comput Geometry 44(2):439–462 10.1007/s00454-010-9262-3 [DOI] [Google Scholar]
  8. Dabby N, Chen H-L (2012) Active self-assembly of simple units using an insertion primitive. In: SODA: the 24th annual ACM-SIAM symposium on discrete algorithms, pp 1526–1536, Jan 2012
  9. Dawes-Hoang RE, Parmar KM, Christiansen AE, Phelps CB, Brand AH, Wieschaus EF (2005) Folded gastrulation, cell shape change and the control of myosin localization. Development 132(18):4165–4178 10.1242/dev.01938 [DOI] [PubMed] [Google Scholar]
  10. Demaine ED, Hendricks J, Olsen M, Patitz MJ, Rogers TA, Schabanel N, Seki S, Thomas H (2018) Know when to fold’em: self-assembly of shapes by folding in oritatami. In: DNA: international conference on DNA computing and molecular programming, pp 19–36. Springer
  11. Geary C, Meunier PÉ, Schabanel N, Seki S (2016) Programming biomolecules that fold greedily during transcription. In: MFCS: the 41st international symposium on mathematical foundations of computer science. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik
  12. Gmyr R, Hinnenthal K, Kostitsyna I, Kuhn F, Rudolph D, Scheideler C, Strothmann T (2019) Forming tile shapes with simple robots. Nat Comput 19:1–16 [Google Scholar]
  13. Graham RL, Knuth RL, Patashnik O (1989) Concrete mathematics. Addison-Wesley, Boston [Google Scholar]
  14. Hescott B, Malchik C, Winslow A (2017) Tight bounds for active self-assembly using an insertion primitive. Algorithmica 77:537–554 10.1007/s00453-015-0085-8 [DOI] [Google Scholar]
  15. Hescott B, Malchik C, Winslow A (2018) Non-determinism reduces construction time in active self-assembly using an insertion primitive. In: COCOON: the 24th international computing and combinatorics conference, pp 626–637. Springer
  16. Hou C-Y, Chen H-L (2019) An exponentially growing nubot system without state changes. In: International conference on unconventional computation and natural computation, pp 122–135. Springer
  17. Martin AC, Kaschube M, Wieschaus EF (2008) Pulsed contractions of an actin–myosin network drive apical constriction. Nature 457(7228):495–499 10.1038/nature07522 [DOI] [PMC free article] [PubMed] [Google Scholar]
  18. Michail O, Skretas G, Spirakis PG (2019) On the transformation capability of feasible mechanisms for programmable matter. J Comput Syst Sci 102:18–39 10.1016/j.jcss.2018.12.001 [DOI] [Google Scholar]
  19. Ramezani H, Dietz H (2019) Building machines with DNA molecules. Nat Rev Genet 21:1–22 [DOI] [PMC free article] [PubMed] [Google Scholar]
  20. Woods D, Chen H-L, Goodfriend S, Dabby N, Winfree E, Yin P (2013) Active self-assembly of algorithmic shapes and patterns in polylogarithmic time. In: ITCS: the 4th conference on innovations in theoretical computer science, pp 353–354. ACM, 2013. Full version: arXiv:1301.2626 [cs.DS]

Articles from Natural Computing are provided here courtesy of Springer

RESOURCES