The evolution of sleep is inevitable in a periodic world

There are two contrasting explanations of sleep: as a proximate, essential physiological function or as a behavioral, adaptive state of inactivity and these hypotheses remain widely debated. To investigate the adaptive significance of sleep, we develop an evolutionary argument formulated as a tractable partial differential equation model. We allow demographic parameters such as birth and mortality rates to vary through time in both safe and vulnerable sleeping environments. From this model we analytically calculate population growth rate (fitness) for sleeping and non-sleeping strategies. We find that, in a temporally heterogeneous environment, sleep behavior always achieves a higher fitness than non-sleeping behavior. As organisms do not exist in constant environments, we conclude that the evolution of sleep is inevitable. Further, we suggest that the two contrasting theories need not be mutually exclusive.


Introduction
Most attempts to explain the evolution of sleep, a vulnerable state observed across diverse taxa, have tended to focus on a search for benefits associated with physiological or vital functions. Sleep, it has been proposed, evolved because there is a universal core function that cannot occur during wakefulness. Indeed, it has been suggested that sleep can reduce oxidative stress accumulated during wakefulness [1][2][3], implicated in memory consolidation [4] and hypothesized to be necessary in heat regulation [5]. These and other theories, however, fail to explain either the diversity of sleep patterns observed in nature [6] or the existence of sleep or sleeplike behaviors in some organisms. It is difficult, for example, for the information processing theory of sleep [7] to account for lethargus, the sleep-like state in C. elegans [8].
An alternative perspective is to view sleep as an adaptive state of inactivity [9]. Sleep and sleep-like states have value insofar as they allow for efficient use of finite energy. Moreover, they may in some instances actually reduce the risk of injury and/or predation [9]. It is important to note that this adaptive view of sleep evolution does not exclude the existence of other vital functions. Indeed, there is no reason to suspect these functions did not evolve later via exaptation. A major objection to this view, however, is that if sleep is adaptive why do we not find organisms that have adapted to not sleep [10]? To be more precise, one should expect the a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 costs and benefits of sleep to vary drastically across species in different ecologies and thus, one might expect to find scenarios where the costs outweigh the benefits. Even this question, of whether all organisms have sleep or sleep-like states, is still widely debated [11].
At the core of this particular debate is disagreement over the definition of sleep. Broadly speaking, there is the physiological definition (characterized by certain brain activities) and the behavioral definition (characterized by inactivity and arousal thresholds). Some organisms, like dolphins, sleep according to one definition but not the other [9]. While research concerning the physiological definition is important, the behavioral definition presents the evolutionary puzzle.
Issues relating to lowered arousal thresholds involve the collection of information and this theme has been developed and recently extended elsewhere [12][13][14]. We have shown that there are certain periods when the collection of information will decrease an organism's fitness. In this way, we should expect organisms to sometimes be disconnected from their environment. For this reason, here we focus on the inactivity aspect of sleep. However, in the discussion we link those results with the conclusions of this paper and show that these lowered arousal thresholds occur precisely when we find activity should be lowest. In this way, we cover both the characterizations of the behavioral definition of sleep.
In this paper, we present a model for the behavioral, adaptive theory of sleep and in particular its inactivity characterization. This is in contrast to the model in [15], which investigates how predator-prey interactions produce particular sleeping patterns or as in [16], which studies behavioral shutdown. Both of these papers, as do others, assume a priori that sleep serves a separate function-here, we do not. Our model is formulated as a continuous partial differential equation (PDE) akin to the McKendrick-von Förster equation of classical demography [17]. However, we allow basal demographic and ecological parameters, such as birth and mortality rates, to vary through time. We then weight these basal parameters by sleep strategies or functions that quantify activity to find effective mortality and birth rates for a particular strategy. A constant-value sleep function is taken to describe no sleep, whereas oscillations about this value are taken to reflect a sleeping strategy; the cost of higher activity at some times is offset by lower activity (sleep) at other times. We ensure, however, that over a sleep cycle the total amount of activity (defined as the integral over the sleep function) is the same. This way, when we compare the fitnesses of a sleeping and non-sleeping strategy, we are able to evaluate comparable activity strategies. We stress that the period of these cycles need not necessarily correspond to one day. The cave dwelling A. mexicanus, for example, has sleep bouts in the order of 2-5 minutes during the night [18].
Our analyses show that when birth or mortality rates are non-constant, there is always a sleep strategy that achieves a fitness higher than the no sleep strategy. Indeed, we show that in a heterogeneous environment the evolution of sleep is inevitable. Further, contrary to the major objection of the adaptive view of sleep, one should only expect to find an organism that does not sleep in a purely constant environment. That is, in the wild we should in fact not expect to find organisms that have evolved to forgo sleep. Interestingly, it suggests that we may be able to evolve them in the lab.
The rest of this paper is organized as follows: In the next section we explain the model and assumptions. Following this, we present analytic calculations of population growth rate, which we use as a measure of fitness [19,20]. We then go on to compare sleeping and non-sleeping strategies under constant and non-constant mortality and birth rates. We additionally consider different sleeping environments where sleeping is assumed to either increase or decrease mortality. Finally, we summarize our findings and suggest future work.

Model
We start by defining n(t, τ, x) the population density of organisms employing a given strategy at time t, time they last consumed food τ, and age x. We say that a population has a different strategy if it has a different sleep function s(t) that quantifies how active an organism is at any time t. We take large values of s(t) to represent highly active periods and values approaching zero to represent inactive periods. In this way, if we let α(t) be the baseline foraging success rate then α(t)s(t) will quantify the foraging success rate for a strategy with sleep function s(t). With this form, an organism that is active (high s) when the resources or prey it consumes are plentiful (high α) will be more successful than one that is inactive (low s) at the same time.
Similarly, we denote the basal mortality rate γ(t) which we weight more generally by a function f(s), giving an effective mortality of γ(t)f(s). The functional form of f will change depending on the particular ecological scenario under consideration. In particular, this will alter depending on if we assume sleeping increases or decreases predation rates.
The rate of change of the population density with sleep strategy s can now be written as Successful foraging appears to reduce population size here because if resources are found, then the time they last consumed food, τ, is reset to zero. To be clear, individuals are not lost but are transferred to the boundary so that when τ = 0 we have where d is the maximum time an organism can live without food. If we denote the birth rate by β(t), then similarly when x = 0 we have where m is the maximum life span. In (3), we assume that activity levels affect effective birth rates as they do foraging successes-an organism that is sleeping while potential mates are available will enjoy less success than those that are awake. Using the chain rule on the right-hand-side of (1) this becomes @n @t þ @n @t þ @n @x where, being in the same units, we have taken dτ/dt = 1 and dx/dt = 1. Finally, we close this hyperbolic system (2)-(4) with the initial condition

Population growth rate
To compare different strategies we will eventually use population growth rate as a measure of fitness. To get us there, we start by integrating the left-hand-side of (4) with respect to τ. Doing so gives by the Fundamental Theorem of Calculus. As d is the maximum time an organism can survive without food, such that n(t, d, x) = 0 and n(t, 0, x) is given by (2), we can express the righthand-side of (6) as If we define N(t) such that which is the total population at any time and integrate the left-hand-side of (6) and (7) with respect to x we obtain by assuming n is sufficiently smooth so we can change the order of integration. As m is the maximum life span n(t, τ, m) = 0 and as n(t, τ, 0) is given by (3) we can write (9) as Finally, performing the same integrations, but on the right hand side of (4), and equating to the right hand side of (10), we find that the dynamics of N are described by which has solution Hence the growth of any population with strategy s(t) will be characterized by

Constant birth & mortality rate
For the moment, we assume that γ(ρ) = Γ is constant and f(s) = 1 so that mortality is unaffected by sleep. We start by comparing the fitness of organisms with different sleep functions when the birth rate has the constant value β(ρ) = B. We denote the fitness of an organism with constant activity (s(ρ) = 1) by r 1 which, from (13), is given by We take the simple function s(ρ) = 1 + cos ρ as an example sleep function. This way, the activity of this phenotype oscillates about the awake case of s(ρ) = 1, benefiting from higher activity levels at some times at the cost of lower activity at others (as in Fig 1). We do not expect that this form will coincide with the sleep pattern of any organism in particular. It is a convenient fiction that aids the demonstration of a principle. We denote the fitness of this phenotype by r 2 which, again by (13), is given by Note that r 2 oscillates about r 1 so that on average neither phenotype will have a higher fitness than the other. In other words, sleeping is selectively neutral.

Variable birth rate & constant mortality rate
We now consider a birth rate that oscillates about the constant case. This variation may arise for a variety of reasons, and may include availability of resources or availability of mates. In particular, we take β(ρ) = B(1 + cos ρ). In this case, we find r 1 to be given by whereas r 2 is given by Oscillations aside, observe that the coefficient of t is larger in r 2 than in r 1 so that for almost all t Hence, subject to a constant mortality rate and oscillating birth rate one should expect an organism that sleeps to have a greater fitness than one that does not.

Constant birth rate & variable mortality rates
In the case where birth rate and activity are constant but mortality is variable such that γ(ρ) = Γ(1 + cos ρ), again from (13), we find that

Sleep in a vulnerable environment
We now consider the case where f(s) = max s − s, is a decreasing function of s. This way, if an organism is sleeping (low s) it increases its mortality rate. This we take to model the situation of an organism sleeping in an open environment or non-socially so that the vulnerability associated with sleep increases predation. So in the case of our simple sleep function we have f(s) = 1 − cos ρ. We continue to assume that birth rates are unaffected by sleep. In this instance, we denote the associated fitness by r 2v which, by (13), takes the value

Sleep in a safe environment
In a safe environment whereby sleeping would be expected to decrease predation, we take f(s) = s. This may occur primarily for two reasons. First, it may be that an organism does not sleep openly but burrows or climbs away from predation. Second, an organism may sleep socially gaining the benefit of being alerted to predators by conspecifics. In this case, we choose the sleep function such that s(ρ) = 1 − cos ρ. We let the fitness under these conditions be given by r 2s , which is found to be Clearly, for almost all t we then have the following inequalities: In other words, when birth rates are constant but mortality rates oscillate there exists a sleep function in both safe and vulnerable environments such that an organism that sleeps enjoys a higher fitness than one that does not (again see Fig 3 for a typical example). Intuitively, in the vulnerable case it is best to stay most active during periods with the highest mortality. Whereas in the safe environment it is more beneficial to shift activity such that the peaks occur when mortality is lowest.

Variable birth & mortality rates
We now consider the most general case where both birth and mortality are non-constant and affected by activity. We take the mortality function as before so that γ(ρ) = Γ(1 + cos ρ). As there is no particular reason to assume that birth rates will be in phase with mortality rates, we now take β(ρ) = B(1 + cos(ρ − g)), for a constant g 2 [0, 2π). Again by (13), we find for the awake strategy s(ρ) = 1, the fitness given by

Sleep in a safe environment II
Recall that in a safe environment f(s) = s, so that sleeping reduces mortality. In this case, we take the general form s(ρ) = 1 + cos(ρ − q), where q 2 [0, 2π) is a constant phase shift. This way, we can quantify the fitness of a sleep strategy that is possibly out of phase by q, in an environment where the birth rate is possibly out of phase by g. This time we present only the part of the fitness that is not oscillatory, which for long times is sufficient to compare fitnesses. We do however, present the full value and details of the calculation in the Appendix. We find the non-oscillating fitness under the above conditions to be given by

Sleep in a vulnerable environment II
As before, in a vulnerable environment we take f(s) = max s − s. Hence, for the general sleep function s(ρ) = 1 + cos(ρ − w) we find that f(s) = 1 − cos(ρ − w), where w is another constant phase shift. Here we also only present the non-oscillatory part of the fitness, which is given by Observe that the non-oscillatory part of r 1 is given by (B − Γ)t, which appears in both r 2s and r 2v . Notice that if for any given g we pick ð27Þ then the extra terms in (25) are always positive. Similarly in (26), the same is true if for any given g we pick While these sleeping strategies may not be the most optimal, we have nonetheless shown that in both environment types, with any degree of asynchrony between birth and mortality rates, there always exists a sleeping strategy that enjoys a higher fitness than constant activity. As before, we provide a typical example of this case in Fig 4.

Results & discussion
Here we have developed a tractable model to investigate when, if at all, sleep as a behavior may be adaptive. This model allowed demographic parameters such as birth rate and mortality rate to (potentially) oscillate through time about basal values. We then defined individual sleep strategies or functions, s(t), that quantified the activity of an organism through time. We took s(t) = 1 to model an organism that remains awake indefinitely, whereas sinusoidal oscillations about this value modelled sleep. The cost of higher activity at some times was lower activity (sleep) at other times. These functions were then used as weights to find effective demographic values for an organism employing a given strategy. Again, we stress that the period of these oscillations need not correspond to one day. Further, the baseline demographic rates are permitted to be any size relative to each other. In other words, birth, death and foraging can occur at vastly different timescales. With this set-up, we were then able to compare the fitness (defined as population growth rate) of sleeping and non-sleeping strategies under an array of conditions. More accurately defined, sleep involves not just inactivity but also lowered arousal thresholds. While our model does not deal with this problem directly, we discuss how it has been addressed elsewhere (see below) [14]. When birth rates were allowed to vary but mortality kept constant, we found that a sleeping strategy achieved a higher fitness than remaining active indefinitely. We then kept birth rates constant and instead allowed mortality to vary. This split into the two cases of when sleeping would increase or decrease mortality. In both instances however, the sleeping strategy had a higher fitness. Intuitively, in a safe sleeping environment it was best to be most active when mortality was lowest. Whereas in a vulnerable sleeping environment, the converse was found to be true.
Both mortality rates and birth rates were then allowed to vary at the same time, potentially out of phase. Yet again, we found that in both environment types, there is always a sleep strategy that trumps staying awake indefinitely. Note that the sleep strategies we found in this case were not necessarily the most optimal. However, if there are strategies that are more optimal they must be of the sleeping type.
The only instance where constant activity has a fitness as good as sleeping was found to be when birth and mortality rates are constant. However, organisms do not exist in a constant world. This result nonetheless highlights that the adaptive theory of sleep is testable. Indeed, in a recent study on Drosophila, sleep duration was observed to change adaptively in response to environmental change [21]. Amongst others, this suggests that model organisms such as Drosophila have the potential for testing evolutionary and ecological theories of sleep. Designing experiments where demographic variability can be controlled and hence environmental constancy might be approximated quite well is a challenge for future work. However, instances of short-term environmental constancy coupled with almost sleeplessness have recently been observed. In periods where predation and mating rates are practically zero, and foraging constant, great frigatebirds (Fregata minor) were found to sleep very little viewed both from the physiological and behavioral definitions of sleep [22].
If the adaptive value of sleep relates to the efficient use of energy in variable environments, then why not simply evolve a state of rest? As described in other studies [9], we suggest that sleep and other quiescent states are in fact best viewed on a continuum. For instance, there is growing evidence that the dormancy in animals and plants evolves in response to varying environmental cues. A recent study argues that seed dormancy emerged at the inception of seed plants due to environmental variability [23]. While in animals, such as mosquitoes, dormancy and diapause are intimately associated with critical photoperiod length and latitudinal variation [24]. However, in general, the evolution of these periods of inactivity are best broadly viewed as adaptations towards the evolution of risk-averse strategies in fluctuating environments [25].
Nonetheless, sleep can be distinguished behaviorally from other states by significantly reduced environmental awareness. This issue is more fully treated in a separate study [14]. The relevant point here is that if an organism enters a period of certainty (with respect to the pressures that mould a certain trait), then they should not collect information about those pressures. This arises due to the costliness of information collection [14]. To be more concrete, if it is such that temporarily an organism will not be preyed upon, say, then it is in the interest of the organism to not collect information about this. However, if an organism is not collecting information then they are necessarily less aware of their environment. Now, consider for example, our simple case of sleep in a vulnerable environment (the other cases are similar). When the effective mortality rate s Á γ goes to zero, it should be that the probability (as in [14]) of being preyed upon also goes to zero. However, this always occurs when activity is lowest. In other words, when activity is lowest, from [14], we should also expect that organisms will have lowered arousal thresholds. In this way, both characterizations of behavioral sleep are covered.
Our analyses have hence shown that the evolution of sleep and sleep-like states is inevitable in sinusoidal environments (a good first approximation to changes in many ecologies). Sleep as a behavior is, in and of itself, valuable. While much research has been done to find vital functions that explain why organisms sleep [1][2][3][4]6], here we have provided broad ecological reasons applicable to diverse taxa. This is not to say that these vital functions do not exist. Undeniably some of them do. However, they are not initially needed for sleep to evolve. Indeed, our analyses plausibly suggest that sleep first evolved simply because activity-inactivity cycles are adaptive in a non-constant world.
Given a certain ecological context we showed that there is always a sleeping strategy that gained a higher fitness than not sleeping. All of these strategies, however, changed only the amount of activity at given times. In reality, organisms change the frequency of their sleeping cycles and the length of inactive periods. In future work, it will be interesting to investigate this diversity. In particular, can we specify demographic and ecological parameters and generate optimal sleep patterns for those values?
Hence, to calculate I 1 we need, in fact, to calculate We focus attention first on G 1 . As cos 2 r ¼ 1 2 1 þ cos2r ð Þ, from standard double angle formula, we find that Using integration by parts to calculate G 2 we find that Putting this all together we find I 1 ¼ Bðt þ sin tðcos g þ cos qÞ À cos tðsin g þ sin qÞ þ sin g þ sin q t sin q sin g þ 1 2 cosðg þ qÞ t þ 1 2 sin 2t þ 1 2 sinðg þ qÞ sin 2 tÞ: ð39Þ Recall that, in a safe sleeping environment we took f(s) = s and γ(ρ) = Γ(1 + cos ρ). Hence, to calculate I 2 we simply need to replace B with Γ and set g = 0 in (39). It follows then that I 2 ¼ Gðt þ sin tð1 þ cos qÞ À cos t sin q þ sin q þ 1 2 cos q t þ 1 2 sin 2t þ 1 2 sin q sin 2 tÞ: Finally, if we take the difference of (39) and (40) the non-oscillatory parts are as in (25) in the main text, if the Bt 2 cosðg þ qÞ term is expanded once more.