{'fraction_non_alphanumeric': 0.052786480584828634, 'fraction_numerical': 0.017785372954840343, 'mean_word_length': 4.058428045461822, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
How best can finite-time social distancing reduce epidemic final size?

Highlights • Social distancing is able to reduce optimally epidemic final size for SIR model.• Unique optimal policy applies maximal intensity lockdown on a time interval.• Optimal lockdown onset can be computed by simple algorithm.• Best policy amounts to stopping the disease as close as possible from herd immunity.• Theory and tabulated numerical results show significant final size reduction.


Introduction
The current outbreak of Covid-19 and the entailed implementation of social distancing on an unprecedented scale, leads to a renewed interest in modelling and analysis of the non-pharmaceutical intervention strategies to control infectious diseases. In contrast to the remotion of susceptible individuals (by vaccination) or infectious individuals (by isolation or quarantine) from the process of disease transmission, the term "social distancing" refers to attempts to directly reduce the infecting contacts within the population. Such actions may be obtained through voluntary actions, possibly fostered by government information campaigns, or by mandatory measures such as partial or total lockdown. Notice that, when no vaccine or therapy is available, such containment strategies constitute probably the only mid-term option.
Optimal control approaches have been abundantly explored in the past in the framework of control of transmissible diseases, see e.g. [12,20] and bibliographical references in [4]. Optimal control of social distancing (possibly coupled with vaccination, treatment or isolation) is usually considered through the minimization of a finite-time integral cost linear in the state, and quadratic in the input control variables or jointly bilinear in the two signals [3,22,11,13,1,7]. The authors of [18] study the optimal control allowing to minimize the maximal value taken by the infected population. The integral of the deviation between the natural infection rate and its effective value due to confinement is used as a cost in [16], together with constraints on the maximal number of infected. Optimal public health interventions as a complement to vaccination campaigns have been studied in [6,5]; see also [15] for more material on behavioral epidemiology.
The magnitude of the outbreak, usually called the epidemic final size, is another important characteristic. It is defined as the total number of initially susceptible individuals that become infected during the course of the epidemic. Abundant literature exists concerning this quantity, since Kermack and Mc Kendrick's paper from 1927 [9]; see [14,2,8,17] for important contributions to its computation in various deterministic settings. Recently, optimal control approach has been introduced to minimize the final size by temporary reduction of the contact rate on a given time interval [0, D], D > 0. This issue has been considered in [10], with total lockdown and added integral term accounting for control cost; and in [4], where partial lockdown is considered as well. The corresponding optimal control is bang-bang, with maximal distancing intensity applied on a subinterval [T * 0 , D], for some unique T * 0 ∈ [0, D) depending of the initial conditions, and no action otherwise.
In a population in which a large proportion of individuals is immune, either after vaccination or after having been infected, the infection is more likely to be disrupted. The herd immunity threshold is attained when the number of infected individuals begins to decrease over time. While the epidemic final size is always smaller than this value, a significant proportion of susceptible individuals may still be infected until the epidemic is over. In this perspective, minimizing the epidemic final size can be seen as an attempt to stop the outbreak as close as possible after passing the herd immunity threshold.
While distancing enforcement cannot last for a long time, there is indeed no reason in practice why it should be restricted to start at a given datetypically "right now". Elaborating on [4], we consider in the present paper a more general optimal control problem, achieved through social distancing during a given maximal time duration D > 0, but without prescribing the onset of this measure. A key result below (Theorem 1) shows the existence of a unique time T * , which depends upon the initial conditions, for which the optimal control corresponds to applying maximal distancing intensity on the interval [T * , T * + D]: this more natural setting yields a more efficient control strategy.
The paper is organized as follows. We introduce in Section 2 the precise setting of the problem under study and formulate the three main results: Theorem 1 demonstrates the existence and uniqueness of the optimal policy and provides a constructive characterization; Theorem 2 studies its dependence upon the lockdown intensity and duration; Theorem 3 shows that above a certain critical lockdown intensity, optimal social distancing on a sufficiently long period approaches herd immunity arbitrarily close. Section 3 provides extensive numerical essays. The proof of Theorem 1 is the subject of Section 4. Concluding remarks are given in Section 5. Comments on the numerical implementation of the optimum search method and the related algorithms are provided in A.

Problem description and main results
Consider the systemṠ t 0 complemented with nonnegative initial data S(0) = S 0 , I(0) = I 0 such that S 0 + I 0 1. The input u, taking on values in [0, 1], models the effect of a social distancing policy: u(t) = 1 corresponds to absence of restrictions, while u(t) = 0, corresponding to complete lockdown, prohibits any contact and thus any transmission. In the sequel, we call uncontrolled system the system corresponding to u ≡ 1, and generally speaking restrict u ∈ L ∞ (0, +∞) to be such that α u(t) 1 for a given constant α ∈ [0, 1) and for almost any t 0. The constant α, called here the maximal lockdown intensity 1 determines the most intense achievable social distancing.
We assume in all the sequel that the basic reproduction number R 0 of the uncontrolled system fulfils: This constant fully characterizes the dynamics of this system. For any u as above, one defines for (S, I) the solution to (1). The quantity 1 − S ∞ (u) is the proportion of retired individuals after the outbreak. It is called the attack ratio, or the epidemic final size when numbers of individuals are considered instead of proportions. This notion plays a central role in the sequel. For the uncontrolled model (1) (with u ≡ 1), the herd immunity is Any equilibrium (S equi , 0), 0 S equi 1, of this system is stable if 0 S equi S herd , unstable if S herd < S equi , so that the disease prospers if introduced in the population with S 0 > S herd (before it finally fades away), and dies out otherwise. Coherently with this observation, if u(t) equals 1 after a finite time, then one has In this optic, attempting to reduce the epidemic final size by finite-time intervention is equivalent to try to stop as closely as possible from the herd immunity threshold.
For any 0 < T T ′ and α ∈ [0, 1), let U α,T,T ′ be defined by We also consider the set of those functions u T,T ′ of U α,T,T ′ defined by where the notation 1 · denotes characteristic functions 2 , and denote 1 the function of L ∞ (0, +∞) equal to 1 (almost) everywhere. The main result of the paper is now given. It indicates how to optimally implement distancing measures, in order to minimize the epidemic final size. To state this result, introduce first the function ψ given by where (S T , I T ) denotes the solution to (1) with u = u T,T +D defined in (3).
For any α ∈ [0, 1) and D > 0, the optimal control problem admits a unique solution. The optimal control is equal to the function u T * ,T * +D defined in (3), where the value T * 0 is characterized by the fact that; • if ψ(0) 0, then T * = 0; 2 That is e.g.
• if ψ(0) < 0, then T * is the unique solution to Moreover, if T * > 0, then S(T * ) > S herd if α > 0, and S(T * ) = S herd if α = 0. Last, fixing S 0 ∈ (S herd , 1), it holds For subsequent use, we denote (S * , I * ) the optimal solution, and S * ∞ the value function of problem (P α,D ), that is by definition: Theorem 1 establishes that, among all intervention strategies carried out on a time interval of length D with an intensity located at each time instant between α and 1, a single one minimizes the epidemic final size. The corresponding control is bang-bang and consists in enforcing the most intense social distancing level α on the time interval [T * , T * + D], where T * 0 is uniquely assessed in the statement. The value of T * depends upon the initial value (S 0 , I 0 ) through the solution (S T , I T ) of System (1) appearing in the expression (4).
Assessing the value of ψ(T ) for given T 0 amounts to solve the ordinary differential equation (1) and to evaluate the quantity in (4) -tasks routinely achieved by standard scientific computational environments. It is shown in the proof of Theorem 1 (Section 4.4) that, if ψ(0) < 0, then ψ is negative on (0, T * ) and positive on (T * , ∞). This remark permits implementation of an efficient bisection algorithm to assess the optimal value T * ; see more details on the implementation aspects in A.
We continue with some properties characterizing the dependence of the value function with respect to the parameters. Theorem 2. The value function S * ∞ is increasing with respect to the parameter D > 0 and decreasing with respect to the parameter α ∈ [0, 1).
The statement of Theorem 2 corresponds to the intuition whereby longer or more intense interventions result in greater reduction of the epidemic final size.
Theorem 2 leads to the following question: what is the benefit of increasing indefinitely the lockdown duration D, and is it possible by this mean to stop the disease spread arbitrarily close to the herd immunity? The next result answers tightly this issue.
Theorem 3 establishes that, provided that the lockdown is sufficiently strong (more precisely, that α α), then long enough lockdown stops the disease propagation arbitrarily close after passing the herd immunity level. On the contrary, if the lockdown is too moderate (α > α), the power of such an action is intrinsically limited. This phenomenon is clearly apparent in the simulations provided in Section 3.
Proof of Theorem 3. One sees easily that α > 0, due to the fact that S 0 > S herd . On the other hand, Assume now that α α. [4, Theorem 1] establishes that, for any ε > 0, there Due to the fact that S * ∞ is increasing with respect to D, as demonstrated by Theorem 2, and that S * ∞ S herd for any D, one gets (8). Suppose now α > α. In such conditions, [4,Theorem 1] shows that, for any D > 0 and u ∈ U α,0,D , On the other hand, the value of S * ∞ increases with D (Theorem 2), while S ∞ (α1) is the limit of S ∞ (α1 [0,D] ) for D → +∞. This yields (9) and achieves the proof of Theorem 3.

Numerical illustrations
We show in this Section the results of several numerical tests. The algorithms designed to solve Problem (P α,D ) are shown in A. A case study is first presented in Section 3.1, based on estimated conditions of circulation of the SARSCoV2 in France before and during the confinement enforced between March 17th and May 11th, 2020. This example is chosen merely for its illustrative value, without claiming to a realistic description of the outburst.
The results provided and commented in Section 3.2 give a broader view. They show the maximal final size reduction that may be obtained for a comprehensive set of basic reproduction numbers R 0 , and for various realistic values of the maximal lockdown intensity α and duration D.

Optimal lockdown in conditions of Covid-19 circulation in
France, March-May 2020 The parameters used in the simulations of the present section are given in Table 1.
We assume that, on the total number N = 6.7 × 10 7 of individuals corresponding to the French population, there were initially no recovered individuals (R 0 = 0). The initial number of infected individuals is taken equal to 1000, a level crossed on March 8th [21], so that I 0 = 1 × 10 3 /6.7 × 10 7 ≈ 1.49 × 10 −5 . Estimates of the infection rate β, of the recovery rate γ and of the containment coefficient α lock in France between March 17th and May 11th 2020, are borrowed from [19]. They yield the following values for the basic reproduction number and the herd immunity: With the initial conditions chosen here, the critical lockdown intensity defined in (7) is The optimal solution (S * , I * , R * , u * ) of Problem (P α,D ) for a containment duration of 30 days (top), 60 days (middle) and 90 days (bottom) is shown in Fig.  1, when total lockdown is allowed (α = 0). The evolution of the proportions of susceptible, infected and removed cases is shown on the left, the optimal control Initial proportion of removed cases 0 Table 1: Value of the parameters used in the simulations for system (1) (see [19]) on the right. The optimal dates for starting the enforcement are given in Table  2, together with the optimal asymptotic proportion of susceptible cases.  Table 2: Characteristics of the optimal solutions computed with the parameters of Table 1, with lockdown intensity α = 0 and duration D = 0 (no lockdown), 30, 60 and 90 days. The starting dates are computed from the epidemic initial time on March 8th, where the cumulative number of infected exceeded 1000 cases. See the curves in Figure 1, and explanations in text.
As unveiled by close observation, one recovers the fact, established in Theorem 1, that S(T * ) = S herd : when α = 0, the optimal confinement starts exactly when the herd immunity threshold is crossed. Also, the optimal value S * ∞ is larger when D is larger (Theorem 2), and it is known from Theorem 3 that this value converges towards S herd when D goes to infinity. It is indeed already indistinguishable from this value for D = 60 and 90 days. Fig. 2 shows the same numerical experiments than Fig. 1, with α = α lock ≈ 0.231 < α ≈ 0.56. Optimal starting dates and asymptotic proportions of susceptible are given in Table 3. The results are qualitatively similar to Fig. 1. One sees that the lockdown begins earlier in the previous case, and the achieved S * ∞ are smaller.
The optimal starting dates given by the numerical resolution constitute an evident difference with the effective implementation that took place during the Spring 2020 epidemic outburst: they are located in May, essentially at the time when, after two months of lockdown, first relaxation of the measures were introduced! This should not be a surprise: the rationale behind this policy was  Table 3: Similar to Table 2, with lockdown intensity α = α lock ≈ 0.231. See corresponding curves in Figure 2.
not aimed at reaching herd immunity, but at reducing infections, in order to avoid overwhelming health systems and to be able to implement contact tracing on a tractable scale. On the contrary, the results in Fig. 1 and 2 show a peak of infected cases almost equal to 30% of the population -about twenty million people-, demonstrating that the strategy consisting of reaching herd immunity without considering other factors would not be sustainable, even if achieved under the optimal policy analyzed here.

Maximal final size reduction under given epidemic and lockdown conditions
Once the optimal solution u * is computed, one may easily determine numerically, thanks to Lemma 2 below, the optimal value S * ∞ , by solving the equation where, as said before, (S * , I * ) is the optimal solution. Taking advantage of this principle, one may compute the optimal final size reduction corresponding to any epidemic and lockdown conditions. To fix the ideas, the value γ = 0.1 day −1 is considered in this Section, corresponding to a mean recovery time of 10 days. The general case is obtained by scaling: for (1) with different γ, the values of S * ∞ and T * are obtained as where S ′ * ∞ , T ′ * are the optimal cost and starting date obtained for the normalized system defined by the parameters γ ′ := 0.1 day −1 and  Table 2 and comments in the text.  Table 3. Fig. 3 shows, for an assortment of values of R 0 ranging from 1.5 to 10, the optimal final size value S * ∞ /S herd as a function of the duration D, for several values of the lockdown intensity α ranging from 0 to 0.8. For D tending to 0, all curves meet at a common value that corresponds to the final size attained in absence of lockdown. One observes that the optimal value S * ∞ /S herd increases as a function of the lockdown duration D, and decreases as a function of its maximal intensity α, as announced in Theorem 2. For 0 < α < α, the optimal value S * ∞ converges towards S herd (the best value one can expect) when D increases indefinitely; while for α < α 1, the optimal value is strictly smaller, and decreases with respect to α, as predicted by Theorem 3. Observe that the value of α decreases when R 0 increases, making social distancing less efficient for diseases with larger basic reproduction number. One sees that, depending upon the initial conditions, the optimal lockdown policy may induce a significant increase of the final size.
For the same assortment of values of R 0 , we represent in Fig. 4 the dependency of S * ∞ /S herd with respect to the parameter α, for values of D corresponding to 1, 2, 4 and 8 months. For α tending to 1, the value of S * ∞ /S herd goes to the value achieved without control.
In the same way that Fig. 3 and 4 revealed the dependence of S * ∞ /S herd respectively upon D and α, Fig. 5 and 6 show the dependence of T * with respect to these parameters. Fig. 5 shows the variation of T * with respect to D, for the same values of α than Fig. 3. The value of T * decreases as a function of D and of α. One observes that for D close to 0, the optimal intervention begins at the time where herd immunity is crossed, for every value of α. It converges to a positive limit when α > α, while it converges to 0 when α < α. Notice that the value of T * highly depends upon R 0 , ranging from more than 200 days for R 0 = 1.5 to less than 10 days for R 0 = 10. Fig. 6 shows the variation of T * with respect to α, for the same values of D than Fig. 4. The value of T * also decreases with respect to α. When α = 0, the optimal starting point is at the crossing of the immunity threshold.

Proof of Theorem 1
The proof is organized as follows. We first recall in Section 4.1 results obtained in [4] for the optimal control problem considered on intervention intervals of the type [0, D], D > 0. Using these results, one shows in Section 4.2 that any solution of problem (P α,D ) is of type (3) and may be determined by solving a 2D optimization problem. It is subsequently shown in Section 4.3 that the latter problem may be simplified to a 1D optimization problem, whose study is achieved in Section 4.4. Last, the property on the limit of T * is demonstrated in Section 4.5.

Optimal control on a finite horizon [0, D]
After introducing some notations, we recall here optimal control results from [4]. For any 0 t t ′ , any input u, and any admissible initial condition X 0 = (S 0 , I 0 ), one denotes X(t ′ , t; X 0 ; u) := (S(t ′ , t; X 0 ; u), I(t ′ , t; X 0 ; u)) the value at time t ′ of the solution of (1) departing at time t from X 0 , with the control input u.
This extended notation will be simplified when clear from the context. Also, introduce the function Φ R defined for any R > 0 by: along any trajectory of system (1). In particular, if u is constant on a non-empty, possibly unbounded, interval, then the function t → Φ R 0 u (S(t), I(t)) is constant on this interval along any trajectory of system (1).
The proof of Lemma 1 is straightforward and may be found in [4]. This result allows to characterize the epidemic final size resulting from the use of an input control in U α,T,T ′ , as stated now, see details and proof in [4, Lemma 3.2].
Lemma 2. Let 0 T < T ′ and u ∈ U α,T,T ′ . For any trajectory of (1), S ∞ (u) is the unique solution in [0, S herd ] of the equation where Φ R 0 is given by (10).
Due to the fact that any control input u ∈ U α,T,T +D is equals to 1 on [T + D, +∞), the map t → Φ R 0 (X(t, 0; X 0 ; u)) is constant on that interval. On the other hand, the map S → Φ R 0 (S, 0) is decreasing on the interval [0, S herd ], so arguing as in [4], one deduces that solving problem (P α,D ) is equivalent to solve This property is central to our approach: it transforms (P α,D ), which consists in maximizing the limit of S at infinity, into an optimal control problem on a finite time horizon. This reduction procedure is at the basis of the arguments in [10] and [4]. Based on the latter one obtains the following result. See details in [4,Theorem 2.3].
admits a unique solution. Moreover the optimal control, denoted u * 0,D (X 0 ), is equal to the function u T * 0 ,D defined in (3), for some uniquely defined T * 0 ∈ [0, D).
Theorem 4 shows that the optimal control is bang-bang with at most two switches: a first one possibly at some time T * 0 ∈ [0, D), and a second one at time D. Moreover, the value of T * 0 appears as the result of a 1D optimization problem, as sup

Reduction to a 2D optimization problem
Consider now, for any 0 T < T ′ , the general problem The problem (P α,0,D ) is equivalent to (13), which is the subject of Theorem 4.
The following result shows that problem (P α,T,T ′ ), under its equivalent form (12), benefits from this result.
Proposition 1. Let 0 T < T ′ . There exists a unique optimal control u * T,T ′ (X 0 ) ∈ U α,T,T ′ for problem (P α,T,T ′ ) and it verifies: Formula (14) and the fact that u * T,T ′ (X 0 ) ∈ U α,T,T ′ imply that u * T,T ′ (X 0 ) is equal to 1 on [0, T ] ∪ [T ′ , +∞), so this function is uniquely defined on the whole [0, +∞) by the statement. Proposition 1 says that the optimal control for problem (P α,T,T ′ ) with initial value X 0 is equal to the optimal control for problem (P α,0,T −T ′ ) with initial value X(T, 0; X 0 ; 1), delayed from the time duration T and completed by 1 on the interval [0, T ]. In turn, the point X(T, 0; X 0 ; 1) is the value at time T of the solution of (1) departing at time 0 from X 0 with input equal to 1. Therefore, solving (P α,T,T ′ ) with initial condition X 0 amounts to solve (P α,0,T ′ −T ) with initial condition X(T, 0; X 0 ; 1).
Before going further, let us prove the previous result.
Proof of Proposition 1. One may define a canonical bijection C : U α,0,T ′ −T → U α,T,T ′ by for any u ∈ U α,0,T ′ −T . By the semi-group property deduced from the fact that system (1) is stationary, one has for any u ∈ U α,T,T ′ and any t ∈ [T, T ′ ], Applying this formula with t = T ′ yields Therefore, for any u ∈ U α,T,T ′ , and this correspondence permits to achieve the demonstration.
Using the qualitative properties of the solutions of problem (12) recalled above, we deduce from Proposition 1 that, for any T 0, the problem inf u∈U α,T,T +D admits a unique solution of the type u T +ε T,D ,T +D , for some ε T,D ∈ [0, D). We thus have proved so far that problem (P α,D ) is equivalent to the 2D optimization problem inf Φ R 0 (X(T + D, 0; X 0 ; u T +ε,T +D )).

Reduction to a 1D optimization problem
In this section, we further reduce the complexity of the optimal control problem under study. We first show that the problem (P α,D ) admits a solution. This indeed amounts to show that no unbounded maximizing sequence of times {T k } k∈N is to be found. • the map t → Φ R 0 (X(t)) is constant on [0, +∞); • the map t → Φ R 0 (XT (t)) is constant on [0,T ] and on [T + D, +∞); • the value of Φ R 0 (XT (t)) on [0,T ] is smaller than the value on [T + D, +∞), because (11) implies that this map cannot increase on [T ,T + D].
We now show in the next result that every possible optimal solution for problem (15) corresponds to ε = 0. In other terms, any optimal policy consists in applying the more intense lockdown intensity during a duration exactly equal to D, not less. Φ R 0 (X(T + D, 0; X 0 ; u T,T +D )). (16) This achieves the announced reduction to a 1D optimization problem.

Solving the 1D optimization problem (16)
We now achieve the demonstration of Theorem 1, through the study of problem (16), establishing in particular uniqueness of the optimum control. Denote T * an optimal solution of (16).
Step 1: necessary first order optimality conditions Let u = u T,T +D be an optimal control for problem (P α,D ). Let us introduce the criterion j given by where, as done in the definition of ψ in (4), (S T , I T ) is the solution corresponding to the control u T,T +D . For sake of simplicity, we will usually omit these subscripts in the sequel. With this notation, (16) simply writes By using Lemma 2, one has for the solution (S T , I T ): where c 0 := I 0 + S 0 − γ β ln S 0 . Eliminating I(t) from (1) with u = u T,T +D , thanks to (18), we infer that S solves the systeṁ with the initial value S(0) = S 0 . Using (18), one gets so that the cost function reads We point out that this expression depends upon T through the arguments T and T + D at which the function S T is considered; but also through the value of the function S T itself, which depends upon T through the input u T,T +D . Special care is therefore needed to compute the derivative j ′ of j with respect to T . This constitutes the subject of the following technical lemma, whose proof is postponed to the end of the section, for sake of clarity. For simplicity, we denote in the sequel S(T + D), S(T ) and S(t) the derivatives of the functions S T (T + D), S T (T ) and S T (t) with respect to T , that is: Thanks to identities (20a)-(20b), one may compute We deduce that j ′ (T ) = 0 is equivalent to for the function ψ defined in (4).
Step 2: Zeros of j ′ and uniqueness of the optimal time T * Integrating the second equation in (1) On the one hand, S decreases along the trajectory, so S(T + D) − S(T + t) < 0 for any t ∈ [0, D). On the other hand, S(t) < 0, see formula (20c). One then deduces that both terms in the addition in the previous formula are positive. The function ψ is thus increasing on (0, ∞).
Step 3: The case α > 0 Assume now that α > 0. Then, for any T large enough in such a way that S T (T ) < S herd , one has αβS T (t)−γ < αβS herd −γ = γ(α−1) for any t ∈ (T, T + D), because the function S T is decreasing along every trajectory.
For such a sufficiently large T , one has and thus Therefore, the function ψ being increasing, if ψ(0) > 0, then (21) has no solution.
Equivalently there is no T such that j ′ (T ) = 0, and thus T * = 0. Conversely, if ψ(0) 0, then (21) admits a unique solution T * , which is the unique critical point of j. In the particular case where ψ(0) = 0, one has T * = 0.
Remark 1. Notice that the function j is decreasing on (0, T * ) and increasing on (T * , ∞). This observation will be useful for the numerical implementation.
The fact that S(T * ) > S herd if T * > 0 comes as a byproduct of the previous considerations. Indeed, it has been shown that ψ(T ) > 0 if S T (T ) < S herd . Therefore, if T * > 0, then ψ(T * ) = 0 and S(T * ) S herd . Noticing that the inequality in (22) is strict for any t ∈ (T, T + D) yields the strict inequality S(T * ) > S herd .
Step 4: The case α = 0 In the case α = 0, the solution S T corresponding to u T,T +D is constant on (T, T + D), and we deduce that We conclude using the fact that I(T ) is maximal when S(T ) = S herd , therefore T * is such that S(T * ) = S herd .
To terminate the work done in Section 4.4, it now remains to prove Lemma 3.
Proof of Lemma 3. Using the notation S T previously defined, one has (see (19b)) on (T, T + D) and at time T , S T (T ) is defined thanks to (19a) by By differentiating (23) with respect to T , one infers that is (20b). Furthermore, using (19b), one has S T (T +D) Differentiating this relation with respect to T yields Let us simplify this latter identity. Observe first that, because of (18), one has for each t ∈ (T, T + D). By using at the same time the change of variable v = S(t) and the expression of I T (t), t ∈ (T, T + D), extracted from this identity, we infer that Combining all these facts leads to and we arrive at (20a). Similar arguments allow for the computation of S(t). This achieves the proof of Lemma 3.

Limit behaviour of T * when I 0 vanishes
To complete the demonstration of Theorem 1, it now remains to prove the last property of the statement. The following result is instrumental for this purpose.
where ψ defined in (4) depends upon I 0 through the initial value of (S T , I T ).

Conclusion
Voluntarily ignoring many features important in the effective handling of a human epidemic (unmodeled sources of heterogeneity in the spread of the disease, limited hospital capacity, imprecise epidemiological data, partial respect of the enforcement measures. . . ), we investigated here the effects of social distancing on a simple SIR model. In this simplified setting, we have shown that it is possible to exactly answer the following question: given maximal social distancing intensity and duration (but without prescribed starting date), how can one minimize the epidemic final size, that is the total number of individuals infected during the outbreak? Our contribution is threefold: we have proved the existence of a unique optimal policy, shown some of its key properties, and demonstrated how to determine it numerically by an easily tractable algorithm. As an outcome, this provides the best possible policy, in the worst case where no vaccine or therapy exists. Numerical computations have been provided that exemplify the theoretical results and allowed to tabulate the maximal gain attainable in terms of cumulative number of infected during the outbreak, under various experimental conditions. It is somewhat intuitive that the best policy achievable by imposing a lockdown of possibly time-varying, but limited, intensity on a time interval of which only the duration is restricted, is reached by enforcing the strictest distancing during the whole time interval. However, up to our knowledge this had not been proved or conjectured so far. Moreover, our results show that the onset of the lockdown is uniquely determined as the unique solution of a numerically tractable equation.
The fact that the optimal control does not begin from the earliest possible time is only an apparent paradox. As a matter of fact, epidemics behave somehow as wildfires -the propellant being the susceptible individuals. On the one hand, attempting to contain the spread too early is pointless, as essentially the same amount of propellant will be present after the end of the intervention, leading ultimately to the same epidemic final size. On the other hand, acting too late is also useless, as in this case most of the stock of propellant will have been already consumed at the time of the intervention. The best time to proceed lies in between, somewhere around the peak of the epidemic when the herd immunity threshold is crossed -typically some weeks after the beginning of the epidemics-, with larger or more intense intervention inducing larger mitigation effect. The results provided allow to determine precisely what is the best time to initiate social distancing.
As a last remark, notice that in the simplified setting considered here, limited hospital capacity or deaths caused by supplementary mortality are ignored. Among other extensions, we plan to address in the future the issue of minimization of the epidemic final size under adequate constraints.