1 Introduction
The computational model of population protocols was introduced in the seminal paper by Angluin et al. [AAD04]. Their model provides a universal platform for the formal analysis of pairwise interactions within a large collection of indistinguishable entities, frequently referred to as agents. In this model the agents rely on very limited communication and computation power. The actions of agents are prompted by their pairwise interactions with the outcome determined by a finite state machine When two agents engage in an interaction they mutually examine the content of their local states, and on the conclusion of this encounter their states change according to the transition function forming an integral part of A population protocol terminates with success when eventually all agents stabilise w.r.t. the output (which depends only on their states).
The number of states utilised by the finite state machine constitutes the space complexity of the protocol. In the probabilistic variant of population protocols, introduced in [AAD04] and used in this paper, in each step the interacting pair of agents is chosen uniformly at random by the random scheduler. In this variant one is also interested in the time complexity, i.e., the time needed to stabilise (converge) the protocol. More recently the studies on population protocols focus on performance in terms of parallel time defined as the total number of pairwise interactions (leading to stabilisation) divided by the size of the population. The parallel time can be also interpreted as the local time observed by agents proportional to the number of interactions it participates in.
Populations protocols attracted studies on several central problems in distributed computing. This includes work on majority problem, a special instance of consensus [Fis83], in which the final configuration of states reflects the unique colour of the larger fraction of the population. The majority problem was first posed in the context of population protocols in [AAD04] and later a 3state oneway protocol for approximate majority was given in [AAE08]. In more recent work [AGV15] Alistarh et al. consider timeprecision tradeoffs in exact majority population protocols. Further studies on timespace tradeoffs can be found in [AAE17, BCER17] and [AAG18], where in the latter an asymptotically spaceoptimal protocol is given. The convergence (stabilisation) of majority protocols was also studied in more specific network topologies [DV12, MNRS14, GHMS15], as well as in the deterministic setting [MNRS14, GHM16]. A nice survey on a range of combinatorial problems suitable for population protocols can be found in [MCS11].
In this paper the focus is on leader election where in the final configuration a unique agent must converge to a leader state and every other agent has to stabilise in a follower state. While the problem is quite well understood and covered in the literature it received greater attention in the context of population protocols only recently, partly due to several developments in a related model of chemical reactions [CCDS14, Dot14]. In particular, the work of Doty and Soloveichik [DS15] led to the result that leader election cannot be solved in sublinear time when agents are equipped with a fixed (constant) number of states. On the other hand Alistarh and Gelashvili [AG15] proposed a new leader election algorithm operating in time and utilising states. In more recent work [AAE17] Alistarh et al. consider a general tradeoff between the number of states utilised by agents and the time complexity of the solution. They provide a separation argument distinguishing between slowly stabilising population protocols which utilise states and rapidly stabilising protocols requiring states. This result coincides nicely with another fundamental observation due to Chatzigiannakis et al. [CMN11] which indicates that population protocols utilising states can only cope with semilinear predicates while the availability of states enables computation of symmetric predicates. Another recent development includes a protocol which elects the leader in time whp and in expectation utilising states per agent [BCER17]. The number of states was later reduced to by Berenbrink et al. in [BKKO18] through the application of two types of synthetic coins.
The recent progress in leader election is also aligned with improved understanding of phase clocks capable of counting parallel time approximately. The relevant work includes leaderless phase clocks adopted by Alistarh et al. in [AAG18] and juntadriven phase clocks utilised in the fastest currently known spaceoptimal leader election algorithm operating in time time due to Gąsieniec and Stachowiak [GS18]. The concept of phase clocks is also closely related to oscillators which are used to model behaviour of periodic dynamic systems. An interesting study of 3state oscillators can be found in Czyzowicz et al. [CGK15] and the follow up work by Dudek and Kosowski [DK18].
Our results
In this paper we propose the first leader election protocol which operates in time and in addition utilises the minimum number of states by each agent. In particular, we propose a new protocol which operates in time with each agent’s operating space limited to
states. The solution is always correct, however the improved time performance refers to the expected time, i.e., we can guarantee the high probability only in time
as in [GS18].The new algorithm utilises partition of the original population into three subpopulations including coins (C) responsible for generation of asymmetric coins with different bias levels, leaders (L) among which the unique leader is eventually drawn, and inhibitors (I) delegated to maintain variablerate phase clocks.
Note that due to space limitation all proofs are located in Appendix A.
Related work
Leader election is one of the fundamental problems in Distributed Computing besides broadcasting, mutualexclusion, consensus, see, e.g., an excellent text book by Attiya and Welch [AW04]. The problem was originally studied in networks with nodes having distinct labels [Lan77], where an early work focuses on the ring topology in synchronous [FL87, HS80] as well as in asynchronous models [Bur80, Pet82]. Also, in networks populated by mobile agents the leader election was studied first in networks with labelled nodes [HKM08]. However, very often leader election is used as a powerful symmetry breaking mechanism enabling feasibility and coordination of more complex protocols in systems based on uniform (indistinguishable) entities. There is a large volume of work [Ang80, ASW88, AS91, BSV96, BV99, YK89, YK96] on leader election in anonymous networks. In [YK89, YK96] we find a good characterisation of messagepassing networks in which leader election is feasible when the nodes are anonymous. In [YK89], the authors study the problem of leader election in general networks under the assumption that node labels are not unique. In [FKK04], the authors study feasibility and message complexity of leader election in rings with possibly nonunique labels, while in [DP04] the authors provide solutions to a generalised leader election problem in rings with arbitrary labels. The work in [FP11] focuses on the time complexity of leader election in anonymous networks where this complexity is expressed in terms of multiple network parameters. In [DP14], the authors study feasibility of leader election for anonymous agents that navigate in a network asynchronously. Another important study on tradeoffs between the time complexity and knowledge available in anonymous trees can be found in recent work of Glacet et al. [GMP16]. Finally, a good example of recent extensive studies on the exact space complexity in related models refers to plurality consensus. In particular, in [BFGK16] Berenbrink et al. proposed a plurality consensus protocol for original opinions converging in synchronous rounds using only bits of local memory. They also show a slightly slower solution converging in rounds utilising only bits of the local memory. This disproved the conjecture by Becchetti et al. [BCN15] and indicated that any protocol with local memory has the worstcase running time In [GP16] Ghaffari and Parter propose an alternative algorithm converging in time in which all messages and the local memory are bounded to bits. In addition, some work on the application of the random walk in plurality consensus protocols can be found in [BCN15, GHMS15].
2 Preliminaries
In this paper we study population protocols defined on populations of agents of size in which the random scheduler connects sequentially (or in parallel) pairs of agents uniformly at random. The agents are identical and the protocol assumes all agents start in the same initial state. Our protocol utilises the classical model of population protocols [AAD04, AAE08]
in which each interaction refers to an ordered pair of agents (
responder,initiator). The interaction triggers an update of states in both agents according to some predefined deterministic transition function. We focus on two complexity measures including space complexity defined as the number of states utilised by each agent, and time complexity reflecting the number of interactions required to stabilise the population protocol. We also consider parallel time defined as the total number of interactions divided by the size of the population. This time measure can be also seen as the local time observed by an agent, i.e., the number of pairwise interactions in which the agent is involved in. We aim at protocols formed of interactions equivalent to the parallel running timeIn order to maintain clarity of presentation we assume that each state has a name drawn from either a fixed size set of suitable names or a small range of integer values. However, when it is clear from the context we tend to omit the name of this field. Moreover, since each node belongs to exactly one of 3 subpopulations, for simplicity we shorten the notation omitting the part and writing for example instead of . This notation allows us to refer only to the relevant fields, i.e., those affected during one particular type of interaction. One should keep in mind also that interactions may trigger several nonconflicting rules. For example, rules of transition of clocks happen in parallel to the rules of transition of coins.
Consider an event and let be some predefined constant. We say that an event occurs with negligible probability, if there is an integer s.t., the probability of this event for is at most . An event occurs with high probability (whp) if its probability is at least for If the event refers to a behaviour of an algorithm, we say it occurs with high probability if the constants used in the algorithm can be finetuned so that the probability of this event is at least . Analogously an event occurs with very high probability (wvhp) if for any there exists an integer such that event occurs with probability is at least for . In particular if an event occurs with probability for some , it occurs with very high probability.
3 Phase clock
The actions of our leader election protocol are coordinated by a phase clock utilising junta of clock leaders. A similar approach can be found in [GS18]. The junta leaders are drawn from subpopulation coins denoted by C. With the help of the phase clock every agent in C keeps track of for a suitable large constant , and maintains its . Let denote addition modulo and
The transition rules of interaction with respect to the phase clock include:
where and . Every agent is initialised to . During execution of coin preprocessing protocol, see Section 5, some agents in C become junta members. We say that the phase clock passes through 0 whenever its current phase of the clock is reduced in absolute terms. We denote this transition by
Definition 3.1 (c.f., [Gs18]).
The passes through 0 of agents and are equivalent if they both occur in a period when the respective agent’s clock phases and satisfy .
Theorem 3.2 (c.f., Theorem 3.1 and Fact 3.1 in [Gs18]).
For any constant , there exists a constant s.t., if the number of junta members is at most at any time whp the following conditions are satisfied whp until each agent completes passes through 0:

All passes through 0 form equivalence classes for all agents and the number of interactions between the closest passes through 0 in different equivalence classes is at least

The number of interactions between two subsequent passes through in any agent is .
By Theorem 3.2, the rounds for different agents form equivalence classes whp that are referred to as rounds of the protocol. The updated agent is the one which acts as responder during the relevant interaction. Interactions with both start and endphase in are denoted by and those with start and endphase in are denoted by . Finally, applying Theorem 3.2 and with being twice as big as required by Theorem 3.2, we can guarantee that passes through and through form strictly separate equivalence classes.
4 High level description
An execution of our algorithm consists of three consecutive epochs whp. These include the
initialisation epoch, the fast elimination epoch and the final elimination epoch. For the case when any epoch fails, which happens with negligible probability, we use as backup the slow leader election protocol working in time [AAE08]. During the initialisation epoch the whole population is divided into subpopulations, where the descriptor differentiates agents between the three subpopulations of coins, inhibitors and leaders respectively. At the start of the protocol all agents are subject to symmetry breaking rules. Each agent gets assigned to one of the three roles (or gets deactivated), and this role is never changed. The two symmetry breaking rules adopted during the initial partition process are as follows:(1) 
where describes an agent before initialisations, and refers to an intermediate stage before entering subpopulation C or
During the initialisation epoch a junta of size at most is elected from C whp, which allows to start the phase clock using this junta as clock leaders. This phase clock synchronises all actions of our algorithm until it concludes. In our approach it is important to terminate the initialisation epoch and in turn to stabilise the roles of agents in time . With this in mind we adopt two extra rules, s.t., whenever a node in state or X reaches the end of the first round, it deactivates itself:
(2) 
where denotes deactivated agents that, except for passing clock state, do not play any meaningful role in the leader election protocol.
Lemma 4.1.
With high probability, only agents are not initialised in the course of the protocol, i.e., agents join C, I or L during the first interactions.
Proof.
By Theorem 3.2, the first round of the phase clock is completed with high probability during the first interactions, for some constant . We first show that after interactions at most not yet initialised in state agents remain. Let
be the random variable denoting the number of agents in state
.Assume for some We prove that the number of interactions it takes to reduce by a factor of 2 is at most , with very high probability. Let be a 01 sequence of length referring to the relevant interactions. In this sequence an entry is set to 1 if during the corresponding interaction the number of not yet initialised agents is reduced, and 0 otherwise. For as long as , the probability of having 1 at each position in is at least and in turn the expected number of 1s in is at least . Thus by Chernoff bound the number of 1s in is at least with very high probability. This implies that at least agents in state get initialised. And iterating this process times we get reduction of agents in state to in at most consecutive interactions. A similar reasoning can be used for agents in the intermediate state in the next (subsequent to reduction of agents in state 0) interactions. Thus one can conclude that after initial interactions the number of not yet initialised agents is at most . ∎
Using Lemma 4.1 one can immediately conclude that during the first round all not initialised agents, i.e., those not given roles or I, become deactivated with high probability by rule (2). Below we explain functionality of the three adopted subpopulations.
 Coin

Agents in this group differentiate themselves into nonempty levels , where The number of agents on level is at most and these agents form the junta running the phase clock. The levels are also used to simulate types of asymmetric coins, s.t., if the probability of drawing heads by th coin is the probability of drawing heads by st coin is roughly . In terms of implementation, tossing th asymmetric coin is realised by an agent interacting with another agent in C. And the outcome is heads if this coin agent is on level or higher.
 Leader

Agents in this group are leader candidates, i.e., each agent in this group has a chance to become the unique leader. In due course the number of candidates is reduced to one. The main challenge is in fast but also safe candidate elimination, i.e., we need to guarantee that our protocol does not eliminate all candidates.
 Inhibitor

Agents in this group split into distinct levels with level targeting size i.e., the sizes of levels span from to for a constant . We use level to request returning signals with the expected response time rounds. These signals are used to guide through the late elimination process when we safely reduce the number of leaders from to a single one.
The first (initialisation) epoch generates at least one leader candidate and with high probability the number of candidates is almost . The protocol will eventually elect a single leader among leader candidates in L during the second and the third epoch. The second epoch related to fast elimination reduces the number of elev (not rejected yet) leader candidates to agents in time both with high probability and in average sense. Fast elimination uses the subpopulation C to simulate assorted biased coins. The third epoch eliminates all but one competitor which becomes the unique leader. This process requires utilisation of inhibitors from I to guarantee survival of at least one leader candidate. The third epoch works in expected time and in time with high probability.
The leader candidates elimination process during the second and the third epoch works as follows. The protocol operates in consecutive rounds, each taking time For each agent a round is defined as the time between two subsequent passes of the phase clock through value zero. In the first half of each round still active leader candidates flip a coin to decide whether they intend to survive (heads) this round or not (tails). If any heads are drawn during this round, the relevant information is distributed (via oneway epidemic [AAE08]) to all agents during the second half of the round. This results in elimination of all active candidates which drew tails. However, if no heads are drawn the round is considered void.
In the fast elimination process we utilise asymmetric coins implemented through interactions with agents in diverse population of C. The first asymmetric coin is used 4 times to reduce the population of elev leader candidates to size at most . Further we use each of asymmetric coins exactly twice. Using a biased coin with heads coming with probability guarantees whp reduction of elev leader candidates by a factor close to . On the conclusion of this process (all coins are used) the number of elev leader candidates is down to whp.
In contrast, in the third epoch symmetric almost fair coins are used in the elimination process indefinitely. This results in elimination of all but a single leader candidate in rounds. In order to guarantee that the protocol is always correct, i.e., we never eliminate the last alive leader candidate we use the support of agents in subpopulation
5 Coins
Let . The states of coins, i.e., agents belonging to subpopulation C store the following information: reflecting the level of asymmetry, and indicating whether a coin is still willing to increment its level. We also need an extra constant space to store the current state of the phase clock. When formed after application of split rule (1) each coin is initialized to .
Coin preprocessing
In what follows we introduce the rules governing level incrementation. Note that these closely resemble the rules from forming junta protocol proposed in [GS18].
Once the level of a coin in C reaches it stops growing. Moreover, we give name injunta to all coins which managed to reach In order to characterise properties of coins we formulate a series of lemmas. Let be the total number of coins. By Lemma 4.1 and rules (1) and (2), with very high probability. Let be the number of coins which reach level or higher. The value of depends on the execution thread of the protocol. We first observe that
, and further estimates on
for are determined by Lemmas 5.1 (upper bound) and 5.2 (lower bound).Lemma 5.1 (Lemma 4.2. in [Gs18]).
Assume and , then with very high probability.
The lower bound argument (similar to the proof of Lemma 5.1) is given below.
Lemma 5.2.
Assume and , then wvhp.
Proof.
Each coin contributing to value arrives at level during some interaction . These coins arrive sequentially. Consider st coin that got to level . At the time the coin arrives there are already coins on levels . Consider the first interaction succeeding in which coin acts as the responder. During this interaction the initiator is a coin on level with probability Thus moves to level with probability at least as otherwise the responder would end up in state and would not contribute to . Consider now the sequence of such interactions , in which each of coins act as responder after getting to level . We can attribute to this sequence a binary  sequence of length , s.t., if during interaction a coin ends up in state , the respective entry in becomes 0, and otherwise this entry becomes 1 (this happens with probability at least ). The expected number of these s is at least . And by Chernoff bound with very high probability. ∎
Lemma 5.3.
For large enough and we have wvhp.
Proof.
Lemma 5.4 (Analogue of Lemma 4.5. in [Gs18]).
Proof.
(Sketch) In coin preprocessing protocol we need to stabilise first subpopulation of coins in time The time complexity analysis of the remaining part of the protocol is analogous to the one used in forming junta protocol in [GS18]. ∎
6 Fast elimination
The goal in fast elimination epoch is to reduce the number of active leader candidates to whp. We also guarantee that at least one agent remains in the group of active leaders A whp. All other leader candidates join group P of passive agents.
The state of each leader candidate in this epoch consists of: , (in fast elimination W standing for withdrawn from leader election process is not used), , (telling whether the round is void), and a constant number of phase clock values. Each leader candidate is initialised at the beginning of the first round of the second epoch to .
After the first round of the phase clock, when the roles of all agents are fixed and levels of all coins are computed whp, agents enter the fast elimination epoch. This is ensured by starting the counter at one larger than the intended number of coin uses. At the beginning of the fast elimination all leader candidates are active (A). In fast elimination we use the subpopulation C of coins as the source of different types of asymmetric coins. The coin result is generated, when a leader candidate interacts with another agent acting as the responder. The outcome of using th biased coin is heads when the interaction refers to a coin on level at least and tails otherwise. When , the probability of drawing heads at this level is . Thus when there are substantially more than active leader candidates almost certainly at least one of them has to draw heads. In turn the number of active leader candidates will be reduced by factor of in expectation. On the other hand, if the number of active leader candidates does not exceed , no agent may draw heads. In order to have good understanding of the situation the agents with heads drawn inform others (using oneway epidemic) about this fact. Thus if an agent draws tails and receives a message about other agent(s) having heads, it can safely become passive (P). This elimination cycle can be carried in one round in time .
During fast elimination active leader candidates utilise coins, s.t., each coin is used exactly twice and coin is applied four times. In other words, the elimination process can be represented by a sequence which tells us which coin level is used with what cnt value. In total, the elimination process operates in rounds translating to time We are also able to guarantee reduction of the number of remaining active leader candidates to whp.
The following transitions are used in the second epoch. When the phase clock passes through zero we have
for  (3) 
When , at the end of the round we move to the third epoch. Otherwise, in the first half of the round application of the coin from the current level is guaranteed whp, for all active leader candidates. For :
(4)  
(5) 
when and respectively.
In the second half of the round the broadcast (via oneway epidemic) informing about drawn heads is performed as follows
(6)  
(7) 
The following lemmas guarantee the correctness of the second epoch whp.
Lemma 6.1.
There exists a constant s.t., for any when agents toss an asymmetric coin resulting in heads with probability , the following holds:

none of the agents draws heads with a negligible probability, and

more than agents draw heads with a negligible probability.
Proof.
The probability that all agents draw tails is at most The expected number of agents which draw heads is . By Chernoff bound the probability that more than agents draw heads is smaller than . ∎
Lemma 6.2.
Applying coin (from level) four times and then coins twice reduces the number of active leader candidates to at most , where is the probability of tossing heads by coin .
Proof.
Induction is on . In the base case when we apply coin four times. By Lemma 5.3 we have . So applying this coin four times gives reduction of the number of active leader candidates to at most whp.
Now assume the thesis holds for level and we prove it for . By inductive hypothesis and Lemma 5.2, after application of coin twice there are at most active leader candidates ( is the counterpart of at level ). Applying this coin twice gives further reduction of active leader candidates to at most whp. ∎
7 Final elimination
The protocol executes rounds of fast elimination (applying coins from level down to ) with active leaders left whp. All other leader candidates become passive. In order to finalize leader election we utilise coin (from level) . However we target construction of Las Vegas type algorithm which always elects exactly one leader. In order to guarantee this we continue using leader modes A (active), P (passive) and W (withdrawn). In contrast to withdrawn candidates, active and passive candidates may still become the unique leader. We use a joint term alive candidates for these two groups.
All alive candidates keep track of a the counter drag which is increasing during the final elimination epoch. However, only active candidates can increment this counter. If a passive candidate detects an increase of the counter value it transitions to withdrawn state. This is safe because there must have been an active candidate with a higher drag value. In other words, we guarantee that not all alive candidates transition into withdrawn state. As the required number of rounds can be relatively large (i.e., as big as ), due to space limitation we cannot use drag counter explicitly as the counter of rounds. Instead, we will use a counter with states. This counter will have the th incrementation roughly during round (for some constant ) of final elimination. This process will rely on inhibitor agents (I) preprocessed at the same time as coins (C).
Preprocessing:
Preprocessing begins with the first pass through 0 of the phase clock. Inhibitor agents keep track of , (flag whether agent is advancing or stopped) and elevation . The agents are initialized to , and drag counts how many subsequent successful coin flips they managed to obtain.
We denote by the total number of inhibitor agents in I. By Lemma 4.1, . Let be the number of agents that reach drag .
Lemma 7.1.
After the first round of the clock whp.
Proof.
Let be the number of inhibitor agents reaching slowness or higher and be the ratio of coins in the population. By Lemma 4.1 after interactions of the first round and remains stable with high probability. An inhibitor agent reaches level by a series of successful synthetic coin flips, which happens with probability . By Chernoff bound we have , with high probability. We have , and for and Thus there exists and the claimed bound holds.
In addition, we observe that with high probability during the initial interactions each inhibitor agent experiences interactions with coin agents, determining its drag during the second round of the clock. ∎
Sloweddown inhibitor communication:
Inhibitor agents get activated through interaction with leader agents which reached the appropriate drag value, and this communication is done via oneway epidemic (between inhibitors of the same drag), i.e.
(8)  
Safe withdrawal:
All active leader candidates with are subject to coinflipping rules (4) and (5). More precisely, in the first half of the round each of them draws the coin from level whp. As rules (6) and (7) apply to agents with coinflips resulting in success inform (via oneway epidemic) other agents accordingly.
We give below an updated reset rule (analogue of (3)) observing that this rule does not change the drag value, and updated rules for leaders:
(9)  
(10) 
Let be the number of active leaders with . Let be a random variable denoting the number of interactions between the first occurrence of an active leader candidate with and the first occurrence of an active leader candidate with .
Lemma 7.2.
There exist constants such that for we have and whp .
Proof.
Consider the first interaction in which a leader candidate assumes . We are to prove inequalities on the number of interactions till the first interaction in which a leader candidate assumes .
We start with the first inequality, which is in fact a lower bound on . When the first leader with occurs it starts propagation (via oneway epidemic) of state high amongst inhibitors with . In the context of the lower bound argument, we can consider a situation in which informed agents spread rumour to uninformed agents in the population. By Lemma 7.1 . We observe the following. If the informed part of population is of size , then a single interaction increments this size with probability approximately . Thus, when it takes interactions to go from informed agents to , with high probability (which follows from Chernoff bound). So it takes interactions, i.e., more than for some , to reach the subpopulation of inhibitors that are high with of cardinality . During this time the probability of having an interaction incrementing value drag to is . For large enough this probability is smaller than .
With respect to the upper bound, consider the same communication process. Observe that if a single inhibitor with gets high, all inhibitors with get high in subsequent interactions, with high probability. In further interactions some active leader with interacts with one of these inhibitors whp. Thus there is a constant such that whp. ∎
We now establish the bound on time the protocol requires to elect a single leader whp. Recall that at the beginning of the third epoch, there are at most active leaders.
Lemma 7.3.
Assume that the preprocessing, the phase clock and coin propagations work properly. After rounds in expectation and rounds with high probability the number of active leaders is reduced from to .
Proof.
Consider a sequence , referring to the number of active leaders after rounds of elimination. Let be the number of rounds needed to obtain a single active leaders, that is . Let be as follows: for , and otherwise . Let be the probability of drawing heads and .
Let be the event that all leader candidates drew tails which happens with probability . When occurs . Otherwise, with probability , the value of corresponds to the number of successes during consecutive coinflips. Thus, . Assume that . Then for large enough . Thus, by the definition of , we have . In turn . Since , we get
and
We now compute the time needed to elect a single leader, i.e., to preserve a single agent in state A and to change states of all agents in state P to W.
Lemma 7.4.
Assume that the preprocessing, the phase clock and coin propagations work properly and that exactly one active leader enters . After rounds in expectation and rounds with high probability there is exactly one leader remaining in state A and all other candidates are moved to W.
Proof.
Let be the number of rounds it takes to go from to of agents in state A. By Lemma 7.3 is in expectation and with high probability. It is enough to consider the round number , s.t., between and all leader agents increase their drag, since any such interaction moves all P to W. Let be the highest drag value achieved by a P candidate. This candidate moves to state W as soon as it encounters a higher value of drag in another candidate. In the proof we use value defined just before Lemma 7.2.
Note that by Lemma 7.3 drag value is smaller than . By Lemma 7.2 we also have whp. Finally, the value of is propagated amongst leaders in interactions whp, which completes the proof of the time bound obtained whp.
Let be the number of interactions of first two epochs. In order to obtain the improved time bound in expectation we observe that by Lemma 7.2 there exists an integer constant such that for any : whp, where is the constant defined in Lemma 7.2. Because of this whp. Note that whp, and the time of propagation of value amongst leaders is . Thus . Finally, whp the extra time cost of getting all passive agents withdrawn increases the total number of interactions at most a constant number of times. With remaining negligible probability the expected value of is at most the average number of interactions to get all leader candidates to which is . ∎
8 Slow protocol backup
We have shown earlier that our protocol elects a single leader in expected time and with high probability in time . However, we still need to provide guarantee that our protocol always elects the unique leader. In other words, the probability of eliminating all possible candidates must be null.
We first show that the population of leaders is always reduced to at most one eventually. This is achieved by running in the background the elimination protocol discussed before. Formally speaking, we say that and agents are mapped to the leader in the output, and , C, I, , and state are mapped to nonleader in the output.
We also adopt an extra interaction rule in which when two agents interact changes its state to
(11) 
when has no smaller priority than . The priority relationship is defined as follows. An agent of higher drag has greater priority and in case of a tie wins with , and further the agent with a smaller level wins, and finally heads wins with none and tails.
We first observe that with high probability rule (11) may only speed up the elimination process analysed in Sections 6 and 7, since it reduces the number of agents, and whp this rule never eliminates during one round all agents with heads.
Lemma 8.1.
Throughout execution of the leader election protocol there is always at least one agent in state or .
Proof.
We conclude this section with the main result of this paper.
Theorem 8.2 (Main result).
Presented protocol always elects a leader. Election happens in expected time , and time with high probability.
Proof.
By Lemma 5.4 in rounds whp we elect a junta of the appropriate size as indicated by Lemma 5.3. This junta starts the phase clock. By Lemma 6.2, fast elimination epoch leaves active leaders in rounds, with high probability. By Lemma 7.4, slow elimination epoch leaves a single leader in expected time and in time with high probability. In addition, by Lemma 8.1 we never eliminate all leader candidates, and rule (11) guarantees that whp in rounds in expectation and in whp a single leader is chosen, which does not affect the overall running time. ∎
9 Conclusion
In this paper we presented the first time leader election protocol. Our algorithm operates in parallel time which is equivalent to pairwise interactions. The solution is always correct, however the obtained speed up refers to the expected time, and our protocol works whp only in time time, as in [GS18]. The first two epochs operate in time whp. Thus the main bottleneck is the last epoch when we reduce the number of leader candidates from to a single one. We would like to claim that likely the hardest problem in leader election is reduction from two leader candidates to a single one. And if one is able to solve this problem rapidly whp, they should be able to solve leader election withe the same time complexity too.
References
 [AAD04] D. Angluin, J. Aspnes, Z. Diamadi, M.J. Fischer, and R. Peralta. Computation in networks of passively mobile finitestate sensors. In PODC, pages 290–299, 2004.
 [AAE08] D. Angluin, J. Aspnes, and D. Eisenstat. A simple population protocol for fast robust approximate majority. Distributed Computing, 21(2):87–102, 2008.
 [AAE17] D. Alistarh, J. Aspnes, D. Eisenstat, R. Gelashvili, and R.L. Rivest. Timespace tradeoffs in population protocols. In SODA, pages 2560–2579, 2017.
 [AAG18] D. Alistarh, J. Aspnes, and R. Gelashvili. Spaceoptimal majority in population protocols. In SODA, pages 2221–2239, 2018.
 [AG15] D. Alistarh and R. Gelashvili. Polylogarithmictime leader election in population protocols. In ICALP, pages 479–491, 2015.
 [AGV15] D. Alistarh, R. Gelashvili, and M. Vojnović. Fast and exact majority in population protocols. In PODC, pages 47–56, 2015.
 [Ang80] D. Angluin. Local and global properties in networks of processors (extended abstract). In STOC, pages 82–93, 1980.
 [AS91] H. Attiya and M. Snir. Better computing on the anonymous ring. J. Algorithms, 12(2):204–238, 1991.
 [ASW88] H. Attiya, M. Snir, and M.K. Warmuth. Computing on an anonymous ring. J. ACM, 35(4):845–875, 1988.
 [AW04] H. Attiya and J. Welch. Distributed Computing: Fundamentals, Simulations and Advanced Topics. John Wiley & Sons, 2004.
 [BCER17] A. Bilke, C. Cooper, R. Elsässer, and T. Radzik. Brief announcement: Population protocols for leader election and exact majority with states and convergence time. In PODC, pages 451–453, 2017.
 [BCN15] L. Becchetti, A.E.F. Clementi, E. Natale, F. Pasquale, and R. Silvestri. Plurality consensus in the gossip model. In SODA, pages 371–390, 2015.
 [BFGK16] P. Berenbrink, T. Friedetzky, G. Giakkoupis, and P. Kling. Efficient plurality consensus, or: the benefits of cleaning up from time to time. In ICALP, pages 136:1–136:14, 2016.
 [BKKO18] P. Berenbrink, D. Kaaser, P. Kling, and L. Otterbach. Simple and efficient leader election. In SOSA, pages 9:1–9:11, 2018.
 [BSV96] P. Boldi, Sh. Shammah, S. Vigna, B. Codenotti, P. Gemmell, and J. Simon. Symmetry breaking in anonymous networks: Characterizations. In ISTCS, pages 16–26, 1996.
 [Bur80] J.E. Burns. A formal model for message passing systems. Technical Report TR91, Computer Science Department, Indiana University, September 1980.
 [BV99] P. Boldi and S. Vigna. Computing anonymously with arbitrary knowledge. In PODC, pages 181–188, 1999.
 [CCDS14] H.L. Chen, R. Cummings, D. Doty, and D. Soloveichik. Speed faults in computation by chemical reaction networks. In DISC, pages 16–30, 2014.
 [CGK15] J. Czyzowicz, L. Gąsieniec, A. Kosowski, E. Kranakis, P.G. Spirakis, and P. Uznański. On convergence and threshold properties of discrete lotkavolterra population protocols. In ICALP, pages 393–405, 2015.
 [CMN11] I. Chatzigiannakis, O. Michail, S. Nikolaou, A. Pavlogiannis, and P.G. Spirakis. Passively mobile communicating machines that use restricted space. Theor. Comput. Sci., 412(46):6469–6483, 2011.
 [DK18] B. Dudek and A. Kosowski. Universal protocols for information dissemination using emergent signals. In STOC, to appear, 2018.
 [Dot14] D. Doty. Timing in chemical reaction networks. In SODA, pages 772–784, 2014.
 [DP04] S. Dobrev and A. Pelc. Leader election in rings with nonunique labels. Fundam. Inform., 59(4):333–347, 2004.
 [DP14] D. Dereniowski and A. Pelc. Leader election for anonymous asynchronous agents in arbitrary networks. Distributed Computing, 27(1):21–38, 2014.
 [DS15] D. Doty and D. Soloveichik. Stable leader election in population protocols requires linear time. In DISC, pages 602–616, 2015.
 [DV12] M. Draief and M. Vojnović. Convergence speed of binary interval consensus. SIAM J. Control and Optimization, 50(3):1087–1109, 2012.
 [Fis83] M.J. Fischer. The consensus problem in unreliable distributed systems (a brief survey). In FCT, pages 127–140, 1983.
 [FKK04] P. Flocchini, E. Kranakis, D. Krizanc, F.L. Luccio, and N. Santoro. Sorting and election in anonymous asynchronous rings. J. Parallel Distrib. Comput., 64(2):254–265, 2004.
 [FL87] G.N. Frederickson and N.A. Lynch. Electing a leader in a synchronous ring. J. ACM, 34(1):98–115, 1987.
 [FP11] E.G. Fusco and A. Pelc. How much memory is needed for leader election. Distributed Computing, 24(2):65–78, 2011.
 [GHM16] L. Gąsieniec, D.D. Hamilton, R. Martin, P.G. Spirakis, and G. Stachowiak. Deterministic population protocols for exact majority and plurality. In OPODIS, pages 14:1–14:14, 2016.
 [GHMS15] L. Gąsieniec, D.D. Hamilton, R. Martin, and P.G. Spirakis. The matchmaker: Constantspace distributed majority via random walks. In SSS, pages 67–80, 2015.
 [GMP16] Ch. Glacet, A. Miller, and A. Pelc. Time vs. information tradeoffs for leader election in anonymous trees. In SODA, pages 600–609, 2016.
 [GP16] M. Ghaffari and M. Parter. A polylogarithmic gossip algorithm for plurality consensus. In PODC, pages 117–126, 2016.
 [GS18] L. Gąsieniec and G. Stachowiak. Fast space optimal leader election in population protocols. In SODA, pages 2653–2667, 2018.
 [HKM08] M. Amine Haddar, A. Hadj Kacem, Y. Métivier, M. Mosbah, and M. Jmaiel. Electing a leader in the local computation model using mobile agents. In AICCSA, pages 473–480, 2008.
 [HS80] D.S. Hirschberg and J.B. Sinclair. Decentralized extremafinding in circular configurations of processors. Commun. ACM, 23(11):627–628, 1980.
 [Lan77] G. Le Lann. Distributed systems  towards a formal approach. In IFIP Congress, pages 155–160, 1977.
 [MCS11] O. Michail, I. Chatzigiannakis, and P.G. Spirakis. New Models for Population Protocols. Synthesis Lectures on Distributed Computing Theory. Morgan & Claypool Publishers, 2011.
 [MNRS14] G.B. Mertzios, S.E. Nikoletseas, Ch. Raptopoulos, and P.G. Spirakis. Determining majority in networks with local interactions and very small local memory. In ICALP, pages 871–882, 2014.
 [Pet82] G.L. Peterson. An o(nlog n) unidirectional algorithm for the circular extrema problem. ACM Trans. Program. Lang. Syst., 4(4):758–762, October 1982.
 [YK89] M. Yamashita and T. Kameda. Electing a leader when processor identity numbers are not distinct (extended abstract). In Distributed Algorithms, 3rd International Workshop, Nice, France, September 2628, 1989, Proceedings, pages 303–314, 1989.
 [YK96] M. Yamashita and T. Kameda. Computing on anonymous networks: Part 1  characterizing the solvable cases. IEEE Trans. Parallel Distrib. Syst., 7(1):69–89, 1996.
Comments
There are no comments yet.