The Expressive Power of Uniform Population Protocols with Logarithmic Space
Abstract
Population protocols are a model of computation in which indistinguishable mobile agents interact in pairs to decide a property of their initial configuration. Originally introduced by Angluin et. al. in 2004 with a constant number of states, research nowadays focuses on protocols where the space usage depends on the number of agents. The expressive power of population protocols has so far however only been determined for protocols using states, which compute only semilinear predicates, and for states. This leaves a significant gap, particularly concerning protocols with or states, which are the most common constructions in the literature. In this paper we close the gap and prove that for any and , both uniform and non-uniform population protocols with states can decide exactly those predicates, whose unary encoding lies in .
Keywords and phrases:
Population Protocols, Uniform, Expressive PowerCopyright and License:
2012 ACM Subject Classification:
Theory of computation Distributed computing modelsEditors:
Kitty Meeks and Christian ScheidelerSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
Population protocols are a model of computation in which indistinguishable mobile agents randomly interact in pairs to decide whether their initial configuration satisfies a given property. The decision is taken by stable consensus; eventually all agents agree on whether the property holds or not, and never change their mind again. While originally introduced to model sensor networks [4], population protocols are also very close to chemical reaction networks [24], a model in which agents are molecules and interactions are chemical reactions.
Originally agents were assumed to have a finite number of states [4, 5, 6], however many predicates then provably require at least time to decide [20, 7, 1], as opposed to recent breakthroughs of time using or even fewer states for important tasks like leader election [9] and majority [18]. Limitting the number of states to logarithmic is important in most applications, especially the chemical reaction setting, since a linear in number of states would imply the unrealistic number of approximately different chemical species. Therefore most recent literature focuses on the polylogarithmic time and space setting, and determines time-space tradeoffs for various important tasks like majority [3, 1, 2, 21, 8, 18], leader election [1, 21, 9] or estimating/counting the population size [19, 15, 10, 16, 17].
This leads to the interesting open problem of characterizing the class of predicates which can be computed in polylogarithmic time using a logarithmic or polylogarithmic number of states. There is however a fundamental problem with working on this question: Despite the focus on number of states in recent times, the expressive power for this number of states has not yet been determined. While it is known that protocols with number of states can only compute semilinear predicates [6, 14] and with states the expressive power is [14], i.e. predicates which can be decided in , when the input is encoded in unary, the important case of having logarithmically many states is unknown. To the best of our knowledge, the only research in this direction is [12], where the expressive power is characterised for number of states for a similar model – not population protocols themselves. Their results do not lead to a complete characterization for states since their construction is slightly too space-inefficient, simulating a -space TM by approximately space protocols.
In this paper, we resolve this gap by proving that for functions , where , we have , i.e. predicates computable by population protocols using number of states are exactly the predicates computable by a non-deterministic Turing machine using space with the input encoded in unary. The “U” in stands for uniform: Modern population protocol literature distinguishes between uniform and non-uniform protocols. In a non-uniform protocol, a different protocol is allowed to be used for every population size. While we have stated the expressive power for uniform protocols here, our complexity characterization also holds for non-uniform population protocols.
Our results complete the picture of the expressive power of uniform protocols: For only semilinear predicates can be computed (open for non-uniform), for a class of reasonable functions , which contains most practically relevant functions111This will be clarified in the next section. we have by our results, and for we have . (A slight gap between and remains.)
Main Contribution.
The technically most involved part of our result is the lower bound, i.e. constructing a space uniform population protocol simulating a space Turing machine, or – equivalently [23], and used in our construction – simulating a -bounded counter machine. Let us briefly illustrate the main techniques and difficulties towards this result. In a nutshell, the crucial difference between and states is the ability to assign unique identifiers to agents, and to store the population size in a single agent. In our construction, therefore, we must distribute the value of over multiple agents, and they must collaborate to compute operations involving it. We also introduce a novel approach for encoding the counters of the counter machine, as those described in previous publications such as [5] and [12] cannot encode large enough numbers for our purposes.
Overview.
The paper is structured as follows: In Section 2 we give preliminaries and define population protocols. Section 3 briefly states our main result and prove the lower bound for weakly uniform population protocols. The proof of the matching upper bound (even for uniform protocols) is presented in Section 4.
2 Preliminaries
We let denote the set of natural numbers including and let denote the set of integers. We write for the binary logarithm .
A multiset over a set is a multiplicity function , which maps every to its number of occurances in the multiset . We denote multisets using a set notation with multiplicities, i.e. . We define addition on multisets via for all . Multisets are compared via inclusion, defined as for all . If , then subtraction is defined via for all . The number of elements of is denoted and defined as if only finitely many fulfill , and otherwise. Elements of are identified with the multiset . The set of all finite multisets over is denoted . Given a function , its extension to finite multisets is .
Definition 1.
A protocol scheme is a 5-tuple of
-
a (not necessarily finite) set of states ,
-
a finite input alphabet ,
-
a transition function ,
-
an input mapping ,
-
an output mapping .
A configuration of is a finite multiset . A step in consists of choosing a multiset and replacing by or , i.e. . The intuition is that the configuration describes for every the number of agents in , and a step consists of an agent in exchanging messages with , upon which these two agents change into the states . Observe that the transition function distinguishes between the initiator of the exchange and the responder, while in the configuration all agents are anonymous. The number of agents is denoted .
We write for the reflexive and transitive closure of , and say that a configuration is reachable from if . A configuration is initial if there exists a multiset such that . In that case is the initial configuration for input .
A configuration is a -consensus for if for all such that , i.e. if every state which occurs in the configuration has output b. A configuration is stable with output if every configuration reachable from is a -consensus.
A run is an infinite sequence of configurations such that for all . A run is fair if for all configurations which occur infinitely often in , i.e. such that there are infinitely many with , also every configuration reachable from occurs infinitely often in . A run has output if some configuration along the run is stable with output (and hence all for are also stable with output ).
An input has output if every fair run starting at its corresponding initial configuration has output . The protocol scheme computes a predicate if every input has some output. In that case the computed predicate is the mapping , which maps to the output of .
Example 2.
Consider , and define , otherwise is the identity function. Let , and let be the input mapping. Then a configuration is initial if every agent is in state . Intuitively this protocol will eventually end up with the binary representation of the number of agents. Namely each transition preserves the total sum of all agents’ values, and every actual transition (which does not simply leave the agents the same) causes an agent to enter , so this protocol in fact always reaches a terminal configuration. For example if we start this protocol with 22 agents we will eventually reach the stable configuration , which corresponds to the binary encoding of .
We now define the state complexity of a protocol scheme. A state is coverable from some initial configuration if there exists a configuration reachable from which fulfills . The state complexity of for agents is the number of states which are coverable from some initial configuration with agents.
Example 3.
In the scheme of Example 2, let be the unique initial configuration with agents, i.e. and otherwise. For , the states coverable from are exactly . Hence the state complexity is .
As defined so far, protocol schemes are not necessarily computable. Hence actual population protocols require some uniformity condition, and that is finite for all .
Definition 4.
A uniform population protocol is a protocol scheme s.t. 1) the space complexity for all and 2) there is a representation of states as binary strings and linear space Turing-machines (TMs) , where
-
1.
: Given (the representation of) two states , outputs .
-
2.
: Given multiset , outputs a representation of .
-
3.
: Given a state and , checks whether .
We remark that “linear space” then in terms of our , the number of agents, is space (since the input of the machine is a representation of a state).
In the literature on uniform population protocols, e.g. [13, 14, 19, 15], often agents are defined as TMs and states hence automatically assumed to be represented as binary strings. We avoid talking about the exact implementation of a protocol via TMs because it introduces an additional logarithm in the number of states and potentially confuses the reader, while most examples are clearly computable.
Example 5.
In the protocol scheme of Example 2 we represent states by the binary representation of the exponent. Clearly incrementing natural numbers or setting the number to a fixed value are possible by a linear space TM, hence this is a uniform population protocol.
Next we define a more general class of population protocols, which we call weakly uniform. This class includes all known population protocols, and our results also hold for this class, which shows that having a different protocol for every does not strengthen the model.
Definition 6.
A finite population protocol is a protocol scheme with a finite set .
A population protocol is an infinite family of finite population protocols. The state complexity for inputs of size is .
is weakly uniform if there exist TMs using space which:
-
1.
: Given two states and in unary, outputs .
-
2.
: Given multiset with elements, outputs a representation of .
-
3.
: Given a state , and in unary, checks whether .
The configurations of with agents are exactly the configurations of with agents, and accordingly the semantics of steps, runs and acceptance are inherited from .
The protocol for a given population size is allowed to differ completely from the protocol for agents, as long as TMs are still able to evaluate transitions, input and output. Usually this is not fully utilised, with the most common case of a non-uniform protocol being that is encoded into the transition function [18].
Clearly uniform population protocols are weakly uniform. Namely let be a protocol scheme. Then for every we let be the set of states coverable by some initial configuration with agents, similar to the definition of state complexity, and define , where is the restriction of to inputs in . This protocol family computes the same predicate, and is weakly-uniform with the same state complexity.
Next we define the complexity classes for our main result. Let be a function. is space-constructible if there exists a TM which computes using space. Given a space-constructible function , we denote by the class of predicates computable by a non-deterministic Turing-machine in space. Similarly, let be the class of predicates computable by uniform population protocols with space, and be the class of predicates computable by weakly-uniform population protocols with space.
Population protocols decide predicates on multisets , or equivalently predicates on for . In order to compare the complexity classes defined on predicates with those defined on languages over an alphabet we define the unary encoding of a predicate as the language . For any complexity class we can now define as the class of predicates whose unary encoding lies in . More specificaly we define 222Previous work has instead used the complexity class consisting of the symmetric languages (i.e. languages closed under permutation) over the alphabet in to reflect that the agents in a population protocol are unordered. We find it more intuitive to think about a unary encoding with separators, but languages with either encoding can be polynomially reduced to the other..
3 Main Result
We give a characterisation for the expressive power of both uniform and weakly uniform population protocols with states, where , for some . For technical reasons, we must place two limitations on :
-
1.
for some , i.e. is computable knowing only .
-
2.
is space-constructible, i.e. the function can be computed in , and
-
3.
is monotonically increasing.
All practically relevant functions fulfil these properties. For the first, we remark that “usually” .333The exceptions are plateau functions with large jumps. For example, while is not computable from , we can instead use , which is asymptotically equivalent.
In the remainder of this paper, a function with these properties is called reasonable.
Our bound applies to uniform and weakly uniform protocols. As mentioned in the previous section, the latter includes, to the best of our knowledge, all non-uniform constructions from the literature.
Theorem 7.
Let and let be reasonable. Then
Proof.
This will follow directly from the upper and lower bounds given by Proposition 8 and Theorem 9. In particular, we have .
Proposition 8.
Let and let be space-constructible. Then
Proof.
follows since uniform protocols are also weakly-uniform.
Hence let be a weakly uniform population protocol computing a predicate . We have to show that there exists a TM computing , when given the input in unary. We employ a similar argument as in the proof of the upper bound in [11]: First observe that a configuration of with agents can be described by many numbers up to , i.e. can be stored using bits. Namely one can store the number of agents per state . The encoding of the initial configuration can easily be calculated by simply counting the ones on the input tape corresponding to each initial state.
Since is space-constructible, is space-constructible as well. By the Immerman-Szelepcsényi theorem we have .
Since the population protocol computes a predicate, either every fair run starting from the initial configuration accepts or every fair run rejects. has to determine which of these is the case. In fact, because every fair run has the same output, we claim that some configuration reachable from is stable for output if and only if is accepted. By definition, an accepting run visits a configuration stable for output , proving one direction, and for the other direction construct a fair run by extending in a fair way. This run is accepting, and hence also every other fair run is.
We hence construct as follows: applies to obtain a representation of the initial configuration . It guesses a configuration , and checks using repeatedly that is reachable from . It remains to check that is stable with output . A configuration is not stable for output if and only if some configuration reachable from contains an agent with output . Therefore non-stability can be checked in by guessing , checking using that is not a -consensus and checking reachability. By Immerman-Szelepcsényi hence also stability is decidable in .
4 Lower Bound
In this section, we prove the following.
Theorem 9.
Let and let be reasonable. Then
To do this we first fix a reasonable function and a predicate with . With a slight modification to the classic 3-counter simulation of a space-bounded Turing machine described in [23], we obtain a counter machine with input registers and 3 computation registers that decides using space.
We now construct a population protocol simulating . There are three main difficulties involved in this construction:
Firstly, in order to sequence multiple operations such that an operation only starts once the previous one has finished, we need a way of performing a zero-check, i.e. detecting whether an agent with a certain state exists. We achieve this by counting the number of agents using a binary encoding similar as to [12]. By keeping track of the agents already seen in an additional counter, we can then perform loops over all agents, and so detect absence of a certain state.
Secondly, we need to encode the counters of , which can hold values up to . The two counter encodings described in existing literature of either counting in unary the number of agents in a special state [5], or the binary encoding of [12] both cannot encode numbers this large. We improve on the binary encoding by using digits in a higher base of and counting in unary within each digit. Manipulating these digits makes heavy use of the looping construct mentioned above.
The final problem, which is inherent to all population protocols, is that an arbitrary number of agents may not participate in any interactions for an arbitrary long amount of time. These errors are detected at some point, but this can happen arbitrarily late. At that point, we solve this by providing a way for the simulation to re-initialize itself.
The protocol consists of multiple phases:
-
1.
We count the number of agents and initialize the additional counters to zero. This process is detailed in Section 4.2. Section 4.3 describes how the counters are manipulated, and Section 4.4 presents a macro for looping over all agents using the counters for bookkeeping.
-
2.
We set up the digits, which encode the counters of . This phase is described in Section 4.6.
-
3.
The instructions of are simulated. This is described in Section 4.7.
As a technical aside, as is usual we assume that the protocol is started with a sufficient number of agents (i.e. exceeding some constant). We argue in the proof of Theorem 9 why this is not a problem.
4.1 State Space
The states will be of the form for a finite set of flags. A state has level . We defer precise definitions until they become relevant.
Notation.
To compactly denote sets of states characterised by flags, we, for example, write for the set of all level states which do not include the flag Ldr. In particular, this notation avoids mentioning other flags.
Formally, we write , where and to refer to the set of all states where fulfils for all .
On the right-hand side of a transition, we use the same notation with a different meaning: it refers to the state where flags are as given, and all other flags match the corresponding state that initiated the transition. I.e. similar to an assignment command, the mentioned values are set while leaving other flags the same as before.
We also use as wildcard. On the left-hand side of a transition, it matches anything, and on the right-hand side, it refers to the same value as the corresponding element of the left-hand side. For example, the transition
means that any two agents with flag Ex can interact. The first moves to the next level (with flags unchanged), while the second removes the Ex flag (and leaves its level unchanged).
Sometimes, we want to refer to groups of flags at once, and we write for instead of .
4.2 Initialisation
Our first goal is to reach a configuration with one leader at level , with agents each storing one bit of the binary representation of , and all other agents “ready to be reset”. Let be the binary representation of . Formally we want the leader in state , exactly one counter agent in for each , and all other agents in states . The flags indicate whether the agent is currently a leader, a counter agent, or free, respectively (these are exclusive). Additionally, , where N indicates whether the bit of the counter is set, and I whether the leader should perform initialisation.
Regarding the input we define for .
In the counter, the agents perform usual bitwise increments as in Example 2, though now expressed in terms of the exponent , and we have to leave one agent in every bit.
This uses the compact notation for transitions introduced above. Consider the first line. If two agents with value are both responsible for the counter and have their N flag set to , then, regardless of any other flags, the outcome is as follows: The first agent increments (leaving every flag unchanged), and the second agents sets N to , again leaving the rest as is.
For the second line, if – in the same type of encounter – at most one of the two bits and was set, then one of the agents unsets his counter flag and becomes a leader with I flag set to .
This is the way for agents to originally set the leader flag. Since we want to have only one leader, we execute a leader election subprotocol. Every time a leader is eliminated, it moves into Free, and the remaining leader re-initialises.
The second line causes the leader to eventually point to the most significant bit of .
Let . For the following proof, as well as later sections, it will be convenient to denote the value of the counter. Given a configuration and we write . For example, the goal of the initialisation is to ensure at all times.
We say that a configuration is initialised, if it has
-
(1)
exactly one agent in ,
-
(2)
exactly one agent in , for and the -th bit of , and
-
(3)
all other agents in .
Lemma 10.
Assume that each transition leaves flags unchanged, and does not affect levels of agents with the or flag. eventually reaches an initialised configuration with an agent in , and will remain in an initialised configuration.
Proof.
We will show that eventually such a configuration is reached via a 4.2 transition. Since transitions in observe only flags and levels of leader and counter agents, which by assumption no other transition can change, we can disregard all transitions in for the purposes of this proof.
We have that is invariant in all reachable configurations , as no transition changes its value. Further, in an initial configuration we have . Hence the level of any agent with flags Ctr and N is at most .
Furthermore, let denote the number of counter agents at level . Then decreases lexicographically with every 4.2 transition. As 4.2 is enabled as long as we have two counter agents on the same level, eventually we will have exactly one agent in for every , and by the invariant the N flag corresponds to the binary representation of , proving (2).
4.3 The Counter
We created a counter during initialisation, which now contains the precise number of agents. To perform arithmetic on this counter, we designate a helper agent that executes one operation at a time. This agent uses flags to store the operation it is currently executing, and it uses its level to iterate over the bits of the counter. Formally, we say that an agent is a (counter) helper, if it has one of the flags in .
The value stored in the counter using the N flag is immutable (to satisfy the assumptions of Lemma 10), so we use flags to store two additional values in the counter agents.
The first operation clears the value in A, i.e. sets it to zero.
It iterates over each bit using the level. To detect that the end has been reached, the helper communicates with the leader, which always has level .
To access the value stored in B, we create an operation that swaps it with A. It proceeds in much the same way.
Incrementing is slightly more involved, but only because we do multiple things: we increase the value in A by 1, and then compare it with N. If they match, the value of A is cleared and the helper sets flag R to indicate whether this happened.
Let .
Observation 11.
Let denote an initialised configuration with exactly one counter helper in state . If only transitions in are executed, eventually reaches a configuration with
-
(1)
exactly one counter helper in state , where ,
-
(2)
, if ,
-
(3)
and if ,
-
(4)
and , if and ,
-
(5)
and , if and .
In cases (2), (4), and (5), we also have .
Proof.
Each operation iterates through the bits of the counter and performs the operations according to the above specification. Once the helper reaches level , we use Lemma 10 to deduce the existence of a leader at level , causing the helper to move to Done. We also remark that the increment operation cannot overflow, as (by specification) .
4.4 Loops
A common pattern is to iterate over all agents. To this end, we implement a loop functionality, which causes a loop body to be executed precisely times.
This transition is to be understood as a template. Any agent can set flag Loop, and 4.4 will then interact with the counter, and set flag Body. The agent must then execute another transition removing flag Body, to commence another iteration of the loop. At some point, 4.4 will instead indicate that the loop is finished, by setting flag End.
4.5 Cleanup
After the initialisation of Section 4.2, most agents are in some state in . We now want to move all of them into state , and move the leader to . (For intuitive explanations we sometimes elide, as here, the flags corresponding to the input , but the transitions take care to not inadvertently clear them.)
During the cleanup, we need one helper agent to perform operations on the counter. The leader will appoint one such agent and mark it using Q. However, it is unavoidable that sometimes such an agent may already exist. Therefore, any counter helper can cause the leader to reset, and during a reset the leader moves any such agents to . Additionally, while resetting the leader sets flag T on any agent it encounters.
For the actual cleanup, the leader first appoints one free agent as helper, then uses the loop template from the previous section to iterate over all agents. Free agents are moved to , and all other agents are left as-is. At the end of the loop, the helper is moved as well, and the leader enters Start, indicating that cleanup is complete. The following transition 4.5 part 1 is the only transition which unsets the I flag.
Now we are ready to prove that eventually the protocol reaches a “clean” configuration as in the following lemma. Let .
Lemma 12.
Assume that the assumptions of Lemma 10 hold, and that every transition in
-
(a)
does not change or ,
-
(b)
does not reduce the number of counter helpers,
-
(c)
does not use any free agent or counter helper with set,
-
(d)
does not use any agent with set, and
-
(e)
does not only use a counter helper or agents in or .
Then eventually reaches an initialised configuration with
-
(1)
exactly one agent in and agents in , and
-
(2)
all other agents in for , i.e. only and input flags are set.
Proof.
Let denote the set of initialised configurations with in agent in .
Lemma 10 guarantees that we reach a configuration . As stated there, all configurations reachable from are initialised. We start by arguing that reaches a configuration with exactly one counter helper and one leader with I unset.
First, we note that it is possible to reach such a , by executing line 2 of 4.5 to remove all counter helpers, and then executing the first line of 4.5 to create one counter helper and unset I. So any fair run from that does not reach such a must avoid configurations in eventually. (If it visited infinitely often, by fairness it would have to reach at some point.)
So we now assume that is the last configuration in on that run. The only possibility to leave is to have the leader clear I, which by assumption (a) can only be done in 4.5. This transition creates a counter helper; since we do not reach we thus must have multiple such helpers.
By assumption (b), the number of counter helpers can only be reduced by a transition in . Inspecting these transitions, the only candidates are line 2 of 4.5 and line 3 of 4.5. The former is only enabled at configurations in . The latter reduces the number of counter helpers by 1 and sets flag Start on the leader. This flag, by assumption (a), cannot be cleared by any transition other than line 1 of 4.5. (Note that line 3 modifies an agent that is not the leader, and there is only one leader since we are operating within initialised configurations.)
Since Start prevents further reductions in the number of counter helpers, at least one such helper remains. Therefore, it is possible to execute the first line of 4.5 and move back to . By fairness, this happens eventually, contradicting our assumption that is visited finitely often and not reached, proving our first claim.
Reaching such a must be done by line 1 of 4.5 (since no other transition clears I), which clears the counter and initiates a loop. As we have argued, is initialised and has exactly one counter helper. We now show that all fair runs from either reach or a configuration fulfilling conditions (1-2).
By assumption (d), transitions outside of do not interact with the counter, and by (c) cannot interact with the counter helper (since it has T set). The only transitions involving the counter helper in a state other than Done are and the first line of 4.5. Since the latter moves to a configuration in , we may assume wlog that it does not occur.
Inspecting 4.4, line 2 of 4.5 is only enabled when the counter helper is in Done. Similarly for line 3 of 4.5. So when we move the helper to another state, we can apply Observation 11 and conclude that it performs its operation correctly. (Transitions outside of may be executed, but cannot affect either the counter or the counter helper.)
This means that line 3 of 4.5 is only executed once line 2 has run exactly times. If , this is not possible, and we go back to eventually using line 1 of 4.5. Otherwise, T is set on all non-leader agents and we claim that it was set by lines 2-3 of 4.5. Namely note that by assumption (c) no transition other than 4.5 may use the agents in at all, and by assumption (e) no transition may be initiated using only the counter helper, the free agents, and the leader without Start.
4.6 Digits
Let be the function, such that for all . For the simulation of , we organise the agents into many “digits”, which are counters that count up to (roughly) . They do not work by storing the bits individually, as for the counters of the previous section, but instead digit is stored by having the appropriate number of agents in state .
Overall, the goal is to simulate registers by using multiple digits. For example, consider digits, where digit can store a number in , and currently stores . Then the number stored by this group of digits would be . This is a generalization of standard base number systems to allow every digit to have a different base .
In the previous sections, we have made use of a helper agents that could autonomously execute certain tasks (e.g. interacting with the counter). We will continue in this vein and designate a new agent for each task.
We start by distributing the free agents into the digits. This happens in a simple round-robin fashion.
We use a new flag V to mark agents that have already been seen. This ensures that all available agents are distributed. The restriction to is necessary to satisfy the assumptions of Lemma 12 – but once the cleanup has successfully completed, no agents will have T set.
Now we implement arithmetic operations on the digits. First, we give a subroutine to detect whether a digit is full (or empty). For the following transition, let , and , with and .
This is slightly more involved. Similar to before, we mark agents that have been counted (this time using U). To avoid having to do a second loop which resets U, we instead alternate between and every time 4.6 is executed. In each iteration, we count agents by setting U to the opposite of the value stored in the digit helper. After the loop has completed, the digit helper then flips its own U flag.
To use this routine on digit , we move an agent into , where indicates whether we want to check that the digit is not empty () or not full (). The output is returned using the R flag. (For technical reasons, the agent ends in level – this will be useful when checking multiple digits.)
There are two ways to change the value of a digit : incrementing and decrementing. Both are analogous, so we only describe the former. The process is straightforward: we check whether digit is already full; if it is not, we move an agent from to . Otherwise the digit overflows; we have to set it to and increment digit . (This is simply adding 1 to a number represented using multiple digits in some base.)
Similar to before, let , and , with and .
We define transitions for DigDecr analogously.
4.7 Counter Machine
In this section, we describe a subprocess that simulates instructions of , using the digits of the previous section. Each of the registers is simulated by digits. We write for the function that maps each register to its first digit. In particular, is then simulated by digits . Formally, we have .
4.7.1 Input
Initially, each agent holds one input in . We need to initialise the input registers of accordingly. We use a loop to make sure that all agents have been moved. However, both the loop and incrementing the digit use the counter stored in A by the Ctr agents; therefore, we swap A and B to switch between them.
Let denote inputs, where is stored in digits .
There are two considerations complicating the implementation of 4.7.1. First, the agent in Inp must count its own input. Second, the overall amount of input flags in the population must not change. We ensure the latter by marking agents with O (instead of e.g. consuming the input) and exchanging input flags (second to last line).
4.7.2 Simulating Instructions
Finally, we can start simulating the instructions of the counter machine. There are two types of instructions. Incr instructions increment a register and then go nondeterministically to one of two instructions. Decr instructions decrement a register and go to one of two instructions, depending on whether the resulting value is zero. The counter machine accepts by reaching the last instruction. We make the following assumptions on the behaviour of the counter machine:
-
(P1)
No increment that would cause an overflow is performed, nor is a decrement on an empty register.
-
(P2)
If it is possible to accept from the initial configuration, every fair run will accept eventually.
-
(P3)
Once reaching the final instruction, the counter machine loops and remains there.
Let denote the instructions of the counter machine. The subprocess simulating the machine is led by the agent with flag CM; it stores the current instruction using flag , with . Fix some instruction . If , we increment counter and move nondeterministically to instruction or . Let .
We remark that the digits have no concept of being grouped into registers – if digit overflows during an increment, the digit helper moves on to the next digit, even if it “belongs” to a different register. For our purposes, this is not a problem, since property (P1) ensures that the last digit of a register never overflows.
If , we decrement counter and check whether it is zero. If so, we move to , else to .
4.7.3 Output
For the population protocol to have an output, we do a standard output broadcast. The agent simulating the counter machine outputs once the machine has reached the last instruction, and otherwise. All other agents copy that output.
And if , else .
4.7.4 Starting the Simulation
All that remains is initialising the above subprocesses. After cleanup, there will be one unique leader in Start (Lemma 12). It creates the subprocesses for the counter and the digits. Then it starts the subprocess that distributes the agents in to the digits. Once that is finished, the leader starts the initialisation of the input registers, and after that, finally starts the counter machine simulation.
Proof.
Let denote a predicate, where . Then there is a -bounded counter machine deciding , for some , using registers. (The three additional counters are usually used to store the tape left of the head, right of the head, and as a temporary area to perform multiplication and division by constants.)
We may assume that never exceeds its bounds (ensuring (P1)). Further, we can assume that stores its inputs in some fashion and may nondeterministically restart, as long as it has not accepted. This yields (P2). Property (P3) can easily be achieved by a syntactic modification.
Furthermore, it is enough to show that our uniform population protocol is correct for all inputs for some constant by possibly taking a product with an states population protocol computing for small inputs.
We argue that there is a constant , s.t. the construction from Section 4 can simulate registers that are -bounded, using digits in total. Each digit has at least agents and there are digits per register. Taking the logarithm, we obtain
where is a constant s.t. . We can further lower-bound this by . Choosing a suitably large constant , this is at least , as desired.
It remains to argue that our construction is correct. Using lemmas 10 and 12, we know that the protocol eventually reaches a configuration with exactly one leader, a counter initialised to , and all other agents in a well-defined state. Afterwards, at each step at most one agent can execute a transition, and correctness follows from careful inspection of the transitions defined above.
5 Conclusion
We have characterised the expressive power of population protocols with states. This closes the gap left open by prior research for uniform protocols, and gives the complexity for protocols with or states – the most common constructions in the literature. Our characterisation applies to both uniform and non-uniform protocols.
The upper bound uses the Immerman-Szelepcsényi theorem to argue that a nondeterministic space-bounded Turing machine can simulate the protocol and determine whether it has stabilised. Similar arguments can be found in the literature [11].
Our construction is more involved. It uses the standard idea of determining the total number of agents and then performing zero-checks, i.e. checking whether a state is absent by iterating over all agents. Using zero-checks, it is straightforward to simulate counter-machines. There are two main difficulties: First, with only states, no single agent can store . Instead, we have to distribute that information over multiple agents (namely those with flag Ctr), and those agents must collaborate to perform computations on that number. Second, it is neither sufficient to use a constant number of counters with agents, nor to use counters with constant number of agents (i.e. bits). We must do both at the same time, which results in the Digit agents. This is one main point where our construction improves upon [12] and prevents the loss of log factors.
We have focused on the expressive power of protocols that can run for an arbitrary amount of time. However, time-complexity plays an important role, and many constructions in the literature focus on being fast. Does limitting the running time affect the expressive power? We conjecture that such protocols can be modelled well by randomised, space-bounded Turing machines, but it is unclear whether one can obtain a characterisation in that case.
One important result about constant-state population protocols is the decidability of the verification problem [22] – a natural question is whether this result can be extended to, e.g. protocols with states. Unfortunately, our characterisation answers this question in the negative. This does open the question of whether there exist subclasses that exclude our construction (and may, therefore, have a decidable verification problem), but include known constructions from the literature for e.g. the majority predicate.
Finally, one gap remains for non-uniform (or weakly uniform) protocols with states. In particular, is it possible to decide a non-semilinear predicate with states? We conjecture , i.e. there is a (non-uniform) population protocol with states for every predicate in , in particular for or for deciding whether a given input is a prime number.
References
- [1] Dan Alistarh, James Aspnes, David Eisenstat, Rati Gelashvili, and Ronald L. Rivest. Time-space trade-offs in population protocols. In SODA 2017, pages 2560–2579. SIAM, 2017. doi:10.1137/1.9781611974782.169.
- [2] Dan Alistarh and Rati Gelashvili. Recent algorithmic advances in population protocols. SIGACT News, 49(3):63–73, 2018. doi:10.1145/3289137.3289150.
- [3] Dan Alistarh, Rati Gelashvili, and Milan Vojnovic. Fast and exact majority in population protocols. In PODC, pages 47–56. ACM, 2015. doi:10.1145/2767386.2767429.
- [4] Dana Angluin, James Aspnes, Zoë Diamadi, Michael J. Fischer, and René Peralta. Computation in networks of passively mobile finite-state sensors. In PODC 2004, pages 290–299. ACM, 2004. doi:10.1145/1011767.1011810.
- [5] Dana Angluin, James Aspnes, and David Eisenstat. Fast computation by population protocols with a leader. In DISC, volume 4167 of Lecture Notes in Computer Science, pages 61–75. Springer, 2006. doi:10.1007/11864219_5.
- [6] Dana Angluin, James Aspnes, David Eisenstat, and Eric Ruppert. The computational power of population protocols. Distributed Comput., 20(4):279–304, 2007. doi:10.1007/S00446-007-0040-2.
- [7] Amanda Belleville, David Doty, and David Soloveichik. Hardness of computing and approximating predicates and functions with leaderless population protocols. In ICALP, volume 80 of LIPIcs, pages 141:1–141:14. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPICS.ICALP.2017.141.
- [8] Petra Berenbrink, Robert Elsässer, Tom Friedetzky, Dominik Kaaser, Peter Kling, and Tomasz Radzik. Time-space trade-offs in population protocols for the majority problem. Distributed Comput., 34(2):91–111, 2021. doi:10.1007/S00446-020-00385-0.
- [9] Petra Berenbrink, George Giakkoupis, and Peter Kling. Optimal time and space leader election in population protocols. In STOC, pages 119–129. ACM, 2020. doi:10.1145/3357713.3384312.
- [10] Petra Berenbrink, Dominik Kaaser, and Tomasz Radzik. On counting the population size. In PODC, pages 43–52. ACM, 2019. doi:10.1145/3293611.3331631.
- [11] Michael Blondin, Javier Esparza, and Stefan Jaax. Expressive power of broadcast consensus protocols. In CONCUR, volume 140 of LIPIcs, pages 31:1–31:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPICS.CONCUR.2019.31.
- [12] Olivier Bournez, Johanne Cohen, and Mikaël Rabie. Homonym population protocols. Theory Comput. Syst., 62(5):1318–1346, 2018. doi:10.1007/S00224-017-9833-2.
- [13] Ioannis Chatzigiannakis, Othon Michail, Stavros Nikolaou, Andreas Pavlogiannis, and Paul G. Spirakis. Passively mobile communicating logarithmic space machines. CoRR, abs/1004.3395, 2010. arXiv:1004.3395.
- [14] Ioannis Chatzigiannakis, Othon Michail, Stavros Nikolaou, Andreas Pavlogiannis, and Paul G. Spirakis. Passively mobile communicating machines that use restricted space. Theor. Comput. Sci., 412(46):6469–6483, 2011. doi:10.1016/J.TCS.2011.07.001.
- [15] David Doty and Mahsa Eftekhari. Efficient size estimation and impossibility of termination in uniform dense population protocols. In PODC, pages 34–42. ACM, 2019. doi:10.1145/3293611.3331627.
- [16] David Doty and Mahsa Eftekhari. A survey of size counting in population protocols. Theor. Comput. Sci., 894:91–102, 2021. doi:10.1016/J.TCS.2021.08.038.
- [17] David Doty and Mahsa Eftekhari. Dynamic size counting in population protocols. In SAND, volume 221 of LIPIcs, pages 13:1–13:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2022. doi:10.4230/LIPICS.SAND.2022.13.
- [18] David Doty, Mahsa Eftekhari, Leszek Gasieniec, Eric E. Severson, Przemyslaw Uznanski, and Grzegorz Stachowiak. A time and space optimal stable population protocol solving exact majority. In FOCS, pages 1044–1055. IEEE, 2021. doi:10.1109/FOCS52979.2021.00104.
- [19] David Doty, Mahsa Eftekhari, Othon Michail, Paul G. Spirakis, and Michail Theofilatos. Brief announcement: Exact size counting in uniform population protocols in nearly logarithmic time. In DISC, volume 121 of LIPIcs, pages 46:1–46:3. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2018. doi:10.4230/LIPICS.DISC.2018.46.
- [20] David Doty and David Soloveichik. Stable leader election in population protocols requires linear time. In DISC, volume 9363 of Lecture Notes in Computer Science, pages 602–616. Springer, 2015. doi:10.1007/978-3-662-48653-5_40.
- [21] Robert Elsässer and Tomasz Radzik. Recent results in population protocols for exact majority and leader election. Bull. EATCS, 126, 2018. URL: http://bulletin.eatcs.org/index.php/beatcs/article/view/549/546.
- [22] Javier Esparza, Pierre Ganty, Jérôme Leroux, and Rupak Majumdar. Verification of population protocols. Acta Informatica, 54(2):191–215, 2017. doi:10.1007/S00236-016-0272-3.
- [23] Patrick C. Fischer, Albert R. Meyer, and Arnold L. Rosenberg. Counter machines and counter languages. Math. Syst. Theory, 2(3):265–283, 1968. doi:10.1007/BF01694011.
- [24] David Soloveichik, Matthew Cook, Erik Winfree, and Jehoshua Bruck. Computation with finite stochastic chemical reaction networks. Nat. Comput., 7(4):615–633, 2008. doi:10.1007/S11047-008-9067-Y.
