Observing the complex behaviour of the COVID-19 [6, 7, 9, 10, 13, 1] reveals the importance of the population heterogeneity in the dynamics of an outbreak. Inspired by this question, but in contrast with recent papers aiming at reproducing the dynamics of the pandemic observed through various data, we adopt here an abstract point of view and investigate issues related to the concepts of epidemic final size and herd immunity in an ample setting.
Before explaining in more details the context and contribution, we present the system under study. We consider here the general SEIR epidemic model (1) , which describes the spread of a disease in a heterogeneous population characterized by a "trait" x ∈ Ω, for a given open subset Ω ⊂ R d . The underlying structure described by this trait can be very varied, typical examples being one or several of the following characteristics: propensity to have social contacts and hazardousness of the latter (in the sense of the transmission disease), susceptibility, infectivity, characteristics of the immunological response, age, spatial location, etc.
∂ t S(t, x) = −S(t, x) Ω β(x, y)I(t, y) dy, S(0, x) = S 0 (x) (1a)
∂ t E(t, x) = S(t, x) Ω β(x, y)I(t, y) dy − α(x)E(t, x),
∂ t I(t, x) = α(x)E(t, x) − γ(x)I(t, x),
∂ t R(t, x) = γ(x)I(t, x),
Classical notations are used : S denotes the proportion of susceptible individuals, E the proportion of those who have been exposed to the disease, I the proportion of infected individuals, R the proportion of removed individuals. The component β(x, y) of the so-called (infinite-dimensional) contact matrix β is the product of the average contact rate between individuals of traits x and y and average transmission probability from an individual with trait y to individual with trait x. The force of infection Ω β(x, y)I(t, y) dy that applies to the individuals of trait x thus obeys the law of mass-action. The average incubation rate is denoted α(x) and the average recovery rate is denoted γ(x): both quantities may depend upon the trait x.
As can be seen, the dynamics of the outbreak is assumed to be sufficiently fast to neglect the effects of the demography in the population. A particular case of system (1) is when the parameters α, β, γ are independent of the trait: the classical ("homogeneous") SEIR model, which readṡ S = −βSI,Ė = βSI − αE,İ = αE − γI (2) is then recovered after integration over Ω. A variant of (1) with diffusion operator in the infected compartment capable to account for possible mutations or spatial displacement of the infected population is also considered, see equation (7) below. For an epidemic model where the effects of demography are neglected, the number of exposed and infected individuals is expected to go to zero after reaching an epidemic peak (if the initial proportion of susceptible is sufficient). An important question is then to determine what will be the so-called epidemic final size, that is the cumulative number (or proportion) of individuals infected, and thus ultimately removed, during the outbreak. For the homogeneous SEIR model (2) , the answer to this question is well-known. Indeed, due to the invariance of the function S(t) + E(t) + I(t) − γ β ln S(t) along the trajectory, the asymptotic value S ∞ of S(t) is necessarily a root of the equation
Indeed, one may show that it is the unique root of this equation smaller than the so-called herd immunity threshold γ β -the value of S below which the number E + I of exposed and infected necessarily decreases.
The study of the final size of an epidemic has been addressed in several works since its appearance in early contributions [17, 4] . Reference [19] was among the first papers to unveil the generality of this concept, extending it to models with several distinct infectious stages, or with arbitrarily distributed mean contact rate, or again having spatially heterogeneous contact structures. Multiple susceptible classes were considered in [3] . Reference [5] established final size equation for age-of-infection model.
Distributed susceptibility or distributed infectivity has been studied in [22] , and [2] studied an epidemic model within a population of n different groups. Analysis in a general framework was presented in [21] , establishing sufficient conditions under which epidemic final size equation exists. Sharp estimates and bounds are obtained in [15] for general model with heterogeneous susceptibility. Also, the case of a two-group SIR model has been studied in [20] .
An important quantity to describe the dynamics of an epidemic is the basic reproduction number R 0 . From a biological point of view, the latter represents the expected number of secondary cases directly generated by an individual in a completely susceptible population during its entire period of infectiousness. A famous threshold property states that the disease can invade (in the sense that it will spread and reach an epidemic peak) if R 0 > 1 and the initial number of susceptible is sufficient, whereas it cannot if R 0 < 1. Mathematically, this number has been defined in full generality in the seminal paper [8] as the dominant eigenvalue of the so-called next-generation operator.
Our aim in the present paper is to extend some of these previous results and completely characterize the final size of an epidemic in a heterogeneous population whose dynamics is governed by the general systems (1) or (7) . On this occasion, we revisit and present in a unified setting the notions of herd immunity and basic reproductive number, and demonstrate the centrality and powerfulness of the concept of next-generation operator.
The ouline of this work is the following. We present in Section 2 the assumptions used in the sequel, and provide the key results, Theorems 2.1 and 2.2. They correspond respectively to epidemic spreading without and with diffusion. Their proof is given in Sections 3 and 4. Section 5 shows how the present framework includes several examples previously considered in the literature.
Heterogeneous populations without diffusion. To begin with, we investigate the final size of an epidemic in a heterogeneous population whose dynamics is modelled by system (1). Denote L ∞ + (Ω) the set of measurable functions which are bounded and nonnegative a.e. on Ω, and assume that α ∈ L ∞ + (Ω) and α := inf x∈Ω α(x) > 0 β ∈ L ∞ + ∩ L 2 (Ω × Ω), and β > 0, γ ∈ L ∞ + (Ω) and γ := inf x∈Ω γ(x) > 0.
In order for the disease to start, we assume also that the initial proportions of susceptible individuals, and of infected and exposed individuals, are nonzero :
The normalization assumption contained in the last identity materializes the fact that the variables constitute proportions of a given population whose overall value is conserved along time.
The first result concerns system (1).
Theorem 2.1 Assume that assumptions (3) and (4) hold, then for the solution of problem (1), t → S(t, ·) is a decreasing function and there exists S ∞ ∈ L ∞ + (Ω) ∩ L 1 (Ω) such that, for a.e. x ∈ Ω, lim t→+∞ S(t, x) = S ∞ (x), and lim t→+∞
with exponential rates. Moreover, S ∞ is the unique solution such that S ∞ ≤ S 0 of the final size equation
An alternative form of (6), useful in the sequel, may be expressed as follows:
The proof of Theorem 2.1 is the subject of Section 3. The main difficulty in this demonstration is to prove uniqueness of the solution of the final size equation (6) , in the set of those S at most equal to the initial condition S 0 . It uses as central tool an irreducibility property related to the assumption β > 0. It is possible to relax this hypothesis by only assuming that the next-generation operator (defined in (13) below) is strongly positive -this is indeed the case if β > 0. On the contrary, β ≥ 0 is not sufficient to deduce uniqueness, see a counterexample at the end of the present Section.
Heterogeneous populations with diffusion. Diffusion is introduced in the infected compartment for the second result, allowing to consider possible additional natural phenomenon as mutations or spatial diffusion of infected individuals. There is a long history on this problem, in particular to study the effect of diffusion on the basic reproduction number, the spread or extinction of the epidemic and the existence of propagating waves, see [16, 23, 11, 12] and the references therein. Here, we are interested in characterizing the final size of the epidemic in a bounded domain.
The corresponding system reads, for t ≥ 0, x ∈ Ω,
With the initial data, one can build the solution of
Essentially the same assumptions than Theorem 2.1 allow to obtain the similar result.
Theorem 2.2 Assume that (3) and (4) hold. Assume moreover that Ω is a smooth, bounded open set. Then, for the solution of (7), t → S(t, ·) is a nondecreasing function and there exists S ∞ ∈ L ∞ + (Ω) ∩ L 1 (Ω) such that (5) holds for a.e. x ∈ Ω, with exponential rates. Moreover, S ∞ is characterized by
Equation (9) constitutes, together with (8), the final size equation for equation (7) . It appears analogous to (6) when ignoring the diffusion term. It may also be written as
Again, we can relax the hypothesis β > 0 by only assuming that the modified next-generation operator (defined in (25) blow ) is strongly positive, which is of course true when β > 0. Another possible set of assumption guaranteeing this strong positivity, and thus the availability of Theorem 2.2, is β ≥ 0 and Ω connected. In that case, even if β = 0 in some parts of Ω, the diffusion ensures that the infection reaches such parts. If β is not positive and Ω is not connected, it is easy to construct counter-examples where a connected part of Ω is invaded whereas another is not.
Finally, we mention that these results may be adapted straightforwardly when the exposed compartment is neglected, that is for the heterogeneous SIR model. Also they may be extended to other operators than the diffusion, as the fractional Laplacian or integral operators, as long as a standard spectral theory is available. Last, diffusion could be included on the Exposed compartment with the same results and methods.
Nonuniqueness and positivity of β In order to illustrate the necessity of assumption β > 0 in (3), we provide a simple example for the discrete case with piecewise constant coefficient. More precisely, assume that for some disjoint sets Ω 1 , Ω 2 for which Ω = Ω 1 ∪ Ω 2 , and some positive constants α k , β k , γ k , k = 1, 2 and β 12 , the coefficients verify:
Then, denoting
for k = 1, 2, system (1) implies (after integration in space) thaṫ
, and so on). Denoting S k∞ the limit of S k (t) when t → +∞, k = 1, 2, the final state is characterized, in this particular setting, by the system of two scalar identities
If E 0 2 + I 0 2 = 0, then (10b) admits two solutions, namely S 0 2 (corresponding to absence of disease in Ω 2 ), and another solution, denoted S 2 , which is strictly smaller than S 0 2 (corresponding to a spread of the epidemic in Ω 2 ). If now E 0 1 + I 0 1 > 0, for each of these solutions, solving (10a) for S 1∞ ≤ S 0 1 yields a unique solution. We thus obtain two distinct solutions of equation (10), smaller or equal to (S 1 0 , S 2 0 ). Notice that, for any initial condition of (6) constant on each of the two sets Ω 1 , Ω 2 , the solution itself retains this property. The previous considerations thus allows to exhibit for such a choice of initial condition, two distinct solutions of the final size equation (6) . As a conclusion, the uniqueness property stated in Theorem 2.1 may not hold if β > 0.
3 General contact matrices in absence of diffusion We investigate here system (1). After introducing some adequate notions and results, Theorem 2.1 is proved. Some conserved quantities are first studied in Section 3.1. The notions of basic reproduction number and herd immunity domain are then introduced in this general setting in Section 3.2, based on the next-generation operator. The limit behaviour is established in Section 3.3, together with the properties of the solution of the final size equation, formally achieving the proof of Theorem 2.1. Section 3.4 then exploits the tools introduced during this section to disentangle the link between herd immunity and equilibrium stability.
A central role in the dynamics is played by the integral quantity
extending a similar and standard quantity for the SIR model. (3), the solution of (1) verifies that, for a.e. x ∈ Ω, the quantities S(t, x) + E(t, x) + I(t, x) + R(t, x) and ln S(t, x) − Φ(t, x) are constant with respect to time.
Proof. Firstly, adding the equations in (1) provides directly the conservation of S + E + I + R with respect to time. Secondly, we compute
We thus deduce the conservation relation
and Lemma 3.1 is proved.
Lemma 3.2 Assume that (3) and (4) hold. Then the solution of (1) verifies : there exists S ∞ ∈ L ∞ + (Ω), S ∞ ≤ S 0 such that, for a.e. x ∈ Ω, (5) holds.
Proof. We deduce easily from (1) that for a.e. x ∈ Ω, t → S(t, x) is decreasing. Being bounded from below by 0, it admits a limit as t goes to +∞. By the same token, S(·, x) + E(·, x) and S(·, x) + E(·, x) + I(·, x) admit similarly a limit. As S(·, x) admits a limit, we deduce that E(·, x) and I(·, x) equally converge when t → +∞. Passing to the limit into system (1), one concludes that these two limits are null, which achieves the demonstration of (5), and thus of Lemma 3.2.
Recall that (3) and (4) have been assumed. Following the idea in [8] , we define now a key notion.
Definition 1 For any S(·) ∈ L 1 ∩ L ∞ + (Ω), we call next-generation operator K S(·) associated to (1), the operator defined over L 2 (Ω) by:
Under assumptions (3) and (4), we know that, for any t ≥ 0, the solution S(t, ·) of (1) belongs to L ∞ + (Ω) ∩ L 1 (Ω). The operator K S(t,·) is thus well-defined and it is a positive and compact operator over L 2 (Ω). This permits to define its norm and its spectral radius in the usual way recalled now.
The spectral radius r(K S(t,·) ) of K S(t,·) is defined by
As β is irreducible thanks to (3) and using Krein-Rutman theory [18, 26] , we can identify the spectral radius r(K S(t,·) ) of K S(t,·) with its principal eigenvalue. The latter is simple, and defined as the unique eigenvalue associated to a positive eigenfunction. We denote ϕ S(t,·) this eigenfunction, so that by definition,
We also know that r(K S(t,·) ) = r(K ⋆ S(t,·) ), where K ⋆ S(t,·) is the adjoint operator, defined by
We let ψ S(t,·) be the associated normalized adjoint eigenfunction, defined by
We are now in position to define for (1) the key notions of basic reproduction number and herd immunity, based on the definition of next-generation operator in (13) . (3) and (4), we define:
• basic reproduction number R 0 the spectral radius of the operator K S 0 (·) , i.e., R 0 = r(K S 0 (·) );
• herd immunity domain the set of those elements S of L ∞ + (Ω) ∩ L 1 (Ω) such that r(K S(·) ) ≤ 1.
In contrast to the homogeneous SEIR system where herd immunity is reached for a uniquely defined proportion of the variable S, here the boundary of the herd immunity domain is a set of functions corresponding to various susceptible population distributions. It is hard to determine in which point of the boundary the trajectory will enter this domain, but this necessarily takes place after a certain time, as stated now. (3) and (4) hold, and that r(K S 0 (·) ) > 1. Then, t → r(K S(t,·) ) is decreasing and continuous with lim t→+∞ r(K S(t,·) ) < 1, (15) and there exists a unique T 0 > 0 such that r(K S(T 0 ,·) ) = 1. As a consequence S(t, ·) belongs to the herd immunity domain iff t ≥ T 0 .
Proof. We first establish that t → r(K S(t,·) ) is non-increasing and continuous. This is a consequence of the fact that for a.e. x ∈ Ω, t → S(t, x) is decreasing and continuous. Indeed, by definition (13), for any φ ∈ L 2 (Ω), and any n ∈ N * , t → K S(t,·) n [φ] is decreasing and continuous. Hence, t → K S(t,·) n 1/n is decreasing and continuous for any n ∈ N * . The result follows by passing to the limit n → +∞.
Secondly, since r(K S 0 (·) ) > 1, we are left to prove that (15) holds. From Lemma 3.2, we may use the fact that S ∞ (x) is the limit of S(t, x) when t → +∞, for a.e. x ∈ Ω. Denote simply K ∞ := K S∞(·) the associated next-generation operator, and by ψ ∞ the principal eigenfunction associated to the adjoint operator K ⋆ ∞ . Adding the second and third equations in (1), multiplying the result by ψ ∞ and integrating, one obtains from (14) taken at the limit,
Hence, arguing by contradiction, if r(K ⋆ ∞ ) ≥ 1, then, on the one hand t → x ψ ∞ (x) E(t, x) + I(t, x) dx is non-decreasing. On the other hand, we have seen in Lemma 3.2 that lim t→+∞ E(t, x)+ I(t, x) = 0. It is a contradiction. Thus, r(K ⋆ ∞ ) < 1 and by continuity there exists T 0 such that r(K S(T 0 ,·) ) = 1. This achieves the proof of Lemma 3.3.
As is the case for the homogenous SEIR model, there exists a tight relation between herd immunity and stability of the equilibrium points of (1). This link is elucidated in Section 3.4 below.
We are now in position to prove Theorem 2.1.
Step 1. Existence of limits. In Lemma 3.2 we already proved the decay of t → S(t, x) and existence of limits for all variables S, E, I, R. We are left to identify the limit S ∞ .
Integrating (12) between t and +∞, we deduce that the limit S ∞ (x) satisfies necessarily
[S(t, y) + E(t, y) + I(t, y)] dy,
for any t ≥ 0. Taking t = 0, we obtain that S ∞ is solution of (6).
Step 2. Exponential rate of convergence. From the above formula, and using the dominated convergence theorem, we have ln
Therefore, for all ε > 0 there is a T ε such that S(t) ≤ (1 + ε)S ∞ for t ≥ T ε . We also introduce θ ∈ (0, 1), to be chosen later, and compute
where α > 0 has been defined in (3) . Multiplying again by ψ ∞ , the principal eigenfunction associated to the adjoint operator K ⋆ ∞ = K ⋆ S∞(·) introduced in the proof of Lemma 3.3, and using (14), we find
Since we know from Lemma 3.3 that r(K ∞ ) < 1, it remains to choose θ sufficiently close to 1 and ε small enough such that 1 > θ > (1 + ε)r(K ∞ ), in such a way that
We obtain
and, applying Gronwall lemma, we find exponential decay to 0 with rate λ for I(t, x) and E(t, x). Finally, using the fact that S(t, x) decreases along time, equation (7a) tells us that
Step 3. Contraction property for t large enough. From Lemma 3.3, there exists T > 0 such that r(K S(T,·) ) < 1. From the first line of equation (16), we deduce the expression for S ∞
where we use the notation (11) . Injecting this expression into the second line of (16), yields the following fixed point problem for the function Φ ∞ :
Notice that since t → S(t, x) is decreasing from (1a), we deduce that S ∞ ≤ S(T, ·) and Φ ∞ ≤ Φ(T, ·). Introduce
in such a way that the fixed point problem (18) reads Φ ∞ = F(Φ ∞ ). Let us denote
Clearly, K is stable by F (using the definition of Φ in (11)), and we may prove that F is a contraction on the set K. Indeed, we compute, for any u, v in K,
where the last inequality is a consequence of the definition of K and of the fact that the exponential is 1-Lipschitz in the set of nonpositive real numbers. At this stage, we introduce on the set K the norm
where, as defined in (14), ψ S(T,·) is the principal eigenfunction of the adjoint K ⋆ S(T,·) . Multiplying by ψ S(T,·) and S(T, ·), we get with the help of (19) , that
β(x, y) γ(y) S(T, x)S(T, y)|u(y) − v(y)| dydx = r(K S(T,·) ) Ω ψ S(T,·) (y)S(T, y)|u − v|(y)dy = r(K S(t,·) ) u − v T , by definition of the norm · T . As r(K S(T,·) ) < 1, we deduce that F is a contraction on K. Hence, using Banach contraction mapping principle, there exists a unique solution S ∞ to (18) in K.
Step 4. Uniqueness below S 0 . It remains to extend the uniqueness result to all function smaller or equal to S 0 . We make use of the following result.
Lemma 3.4 Among the functions S ≤ S 0 , there is a solution S of (6) which is larger than all sub-solutions of (6), and S ∞ = S.
Indeed, we deduce from Lemma 3.4 that any other solution S of (6) satisfies S ≤ S ∞ . Therefore it also satisfies S ≤ S(T ) for T large enough. Thus by the contraction property of Step 3 it is equal to S ∞ . This achieves the demonstration of Theorem 2.1, with the exception of the proof of Lemma 3.4, which we now complete. Proof. [Proof of Lemma 3.4] We first build a sequence S k (x) departing from the initial condition S 0 , by iterating for k ≥ 0:
Obviously, we have
And iterating, if we know that S k < S k−1 , we find
which gives S k+1 < S k . As a consequence S k is a decreasing sequence which converges to a solution S of (6). Secondly, let S ≤ S 0 be a sub-solution of (6). We have
therefore S ≤ S 1 , and iterating the argument S ≤ S k for all k ∈ N and thus S ≤ S. In particular we have S ∞ ≤ S. Thirdly, we prove that S ≤ S ∞ . We know that S < S 0 and we are going to prove that S < S(t) for all t ≥ 0 from which we conclude, by definition of S ∞ , that S ≤ S ∞ and thus that S ∞ = S. To prove this, we consider, by contradiction, the first time t 0 when S(t 0 ) touches S, i.e., S ≤ S(t 0 ) and for some x 0 ∈ Ω, S(x 0 ) = S(t 0 , x 0 ). We conclude that
a contradiction. This achieves the demonstration of Lemma 3.4.
Before closing Section 3 and the study of system (1), we analyze in the following result the link between herd immunity and the stability of the equilibria of this system. (3) and (4) hold. The equilibrium points of system (1) are exactly the configurations (S * , 0, 0, R * ) that fulfil (4). Moreover each of them is stable if r(K S * (·) ) < 1, unstable if r(K S * (·) ) > 1,
Proof. The equilibria for (1) are any configuration (S * , E * , I * , R * ) such that, for a.e. x ∈ Ω,
We deduce from the last two equations that (E * , I * ) = (0, 0). This condition is also sufficient to have an equilibrium, provided that it fulfils (4).
The stability of such an equilibrium is related to the stability of the linearized system 
Notice that (20) admits a block-triangular structure: the evolution of (e, i) is independent of the other two components s and r; while the evolution of s and r only depends upon i. Assume first that r(K S * (·) ) < 1. Let ψ S * (·) be the principal adjoint eigenvector of the nextgeneration operator K S * (·) associated to S * . Mimicking the computation achieved in Step 2 of Section 3.3, one finds that, for any θ ∈ (0, 1) and a.e. x ∈ Ω,
Taking θ ∈ (r(K S * (·) ), 1) then yields (through application of Gronwall's lemma) exponential decrease of Ω ψ S * (·) (x)[e(t, x) + θi(t, x)] dx when t → +∞. One sees easily that the subsystem in (e, i) of (20) is a monotone system. The eigenfunction ψ S * (·) being positive, the functional (e(·), i(·)) → Ω ψ S * (·) (x)[e(·) + θi(t·)] dx is thus a Lyapunov functional for this subsystem, and the origin of the latter is asymptotically stable. Due to the block-triangular structure mentioned earlier, the complete system (20) is (simply) stable.
Assume now that r(K S * (·) ) > 1. Denoting ϕ S * (·) the principal eigenvector of K S * (·) , define e * (x) := r(K S * (·) ) + 1 2
Let us evaluate the value of the right-hand sides corresponding to ∂e ∂t and ∂i ∂t at the point (e * , i * ). Then, for any x ∈ Ω,
The subsystem describing the evolution of the components (e, i) being a monotone system, this condition is sufficient to ensure that any trajectory of this subsystem departing from a point (e 0 , i 0 ) ≥ λ(e * , i * ), λ > 0, is increasing. This shows the instability of the origin of (20) , and achieves the proof of Lemma 3.5.
We now come to system (7) where diffusion is included, and prove Theorem 2.2. We adapt for this the methodology developed in Section 3.
Let us introduce the solution of the nonlinear elliptic equation
where n is the outward normal unit at the boundary of Ω. (3), the solution of (7) verifies that, for a.e. x ∈ Ω, the quantities Ω (S(t, x)+E(t, x)+I(t, x)+R(t, x)) dx and ln S(t, x)− Ω β(x, y)Φ(t, y) dy are constant with respect to time.
Proof. The first conservation relation is obtained straightforwardly by adding and integrating on Ω the equations in (7) . For the second, we compute, as usual,
Secondly
Therefore, the uniqueness being ensured by the fact that γ > 0, see (3), we obtain
Inserting this expression of I in equation (22) 
This achieves the proof of Lemma 4.1.
As before, we may deduce existence of limits from the previous result, as stated now. (3) and (4) hold. Then the solution of (7) verifies : there exists S ∞ ∈ L ∞ + (Ω), S ∞ ≤ S 0 , such that, for a.e. x ∈ Ω, (5) holds. Moreover, for a.e. x ∈ Ω, Φ(t, x) converges to Φ ∞ (x) as t goes to +∞ where
Proof. As above, for a.e. x ∈ Ω, since t → S(t, x) is decreasing, it has a limit S ∞ (x), and because t → S(t, x) + E(t, x) is decreasing, t → E(t, x) has a limit which vanishes as can be seen adding from (7a)-(7b). Inserting this information in equation (7c), we conclude that, for a.e. x ∈ Ω, I(t, x) → 0 as t → +∞ too. Finally, we pass to the limit in equation (21) to get the limit Φ ∞ of Φ.
Following the approach of Section 3, we define the next-generation operator.
Definition 4 For any t ≥ 0 and S(t, ·) ∈ L 1 ∩ L ∞ + (Ω) solution of (7), we call next-generation operator K S(t,·) associated to (7), the operator defined over L 2 (Ω) by
with Neumann boundary conditions. Its adjoint is defined as
also with Neumann boundary conditions.
The existence of a principal eigenvalue for the next-generation operator is established in the next result, whose proof is postponed to Appendix A.1.
The operator K ∆ S(·) admits a principal eigenvalue, that is, there exists r(K ∆ S(·) ) > 0 and functions ϕ S(·) ∈ L 2 + (Ω) and ψ S(·) ∈ L 2 + (Ω) such that
in Ω, ∂ n ϕ S(·) = 0, on ∂Ω,
in Ω, ∂ n ψ S(·) = 0, on ∂Ω.
The basic reproduction number and the herd immunity domain may then be defined as in Definition 3. Notice that an analogue of Lemma 3.5, which links herd immunity and stability, may also be written when diffusion is present.
From Lemma 4.2, there exists S ∞ ∈ L 1 ∩ L ∞ (Ω), which is the limit of S(t, ·). We use the shorthand notation K ∆ ∞ := K ∆ S∞(·) and K ∆ * ∞ := K ∆ * S∞(·) ; its principal eigenvalue is denoted r ∆ ∞ := r(K ∆ S∞(·) ) and the associated eigenfunctions are respectively ϕ ∞ := ϕ S∞(·) and ψ ∞ := ψ S∞(·) . The properties described in Lemma 3.3 still hold in this framework:
Lemma 4.4 Assume that (3), (4) hold, and that r(K ∆ S 0 (·) ) > 1. Then, t → r(K ∆ S(t,·) ) is decreasing, continuous; lim t→+∞ r(K ∆ S(t,·) ) < 1 and there exists a unique T 0 > 0 such that r(K ∆ S(T 0 ,·) ) = 1. Proof. The first point follows exactly the proof of Lemma 3.3. For the existence of T 0 , as above, we multiply (7b) and (7c) by ψ ∞ , and integrating, one finds
As in the proof of Lemma 3.3, this proves that there is T 0 > 0 such that herd immunity is reached, that is r(K ∆ S(T 0 ,·) ) = 1.
We have now the material to prove Theorem 2.2. We follow and adapt to the case at hand the proof in Section 3.
Step 1. Existence of limits. The long time convergence has been studied in Lemma 3.3. Then, integrating (23) between t and +∞, we get
It may be rewritten straightforwardly y) ) dy , for a.e. x ∈ Ω, t ≥ 0.
Injecting this identity into the equation for Φ ∞ , and taking t = 0, we deduce that the long time limit is characterized by (9b).
Step 2. Exponential rate of decay. This also follows as in Section 3, we just indicate the main steps. Firstly, from (27), and because Φ(t, x) converges to Φ ∞ (x) almost everywhere, we conclude that for all ε and for t ≥ T ε , we have S(t, x) ≤ (1 + ε)S ∞ (x). Secondly, adapting formula (17) to the present setting and using the definition of the adjoint operator K ∆ * S(t,·) given in (26), we compute, for θ < 1 but close to 1
Taking t > T 0 in such a way that r(K ∆ S(t,·) ) < 1, choosing ε > 0 small enough and 0 < θ < 1 close enough to 1 to have 1 + ε − θ < 0, and using the fact (assumed in (3)) that inf x∈Ω α(x) and inf x∈Ω γ(x) are positive together with the positivity of the principal eigenvector ψ ∞ , allows to use again Gronwall lemma, and to conclude to the exponential rate of convergence of E and I. Exponential convergence of S is then obtained as in Section 3.
Step 3. Uniqueness for t large enough. From Lemma 4.4 we may choose T > 0 large enough such that r(K ∆ S(T,·) ) < 1. From (28) and (24), we deduce
complemented with Neumann boundary conditions. Recall that Φ(t, ·) is defined for any t by (21) . We notice that since t → S(t, x) is decreasing, we have S ∞ ≤ S(T ) and by the maximum principle applied to (21) , we deduce also that Φ ∞ ≤ Φ(T ). Let us consider the problem
We show the uniqueness of a solution of this problem in the set {0 ≤ u ≤ γΦ(T, ·) a.e.}. Let us assume that there are two solutions u and v. We have as in Section 3.3, using the fact that the exponential is 1-Lipschitz in the set of nonpositive real numbers,
From Kato's inequality [14] , we deduce
We recall that, from Lemma 4.3, there exists ψ S(T,·) such that
∆ψ S(T,·) (y) = r(K ∆ S(T,·) )ψ S(T,·) (y).
We use the norm u T := Ω ψ S(T,·) (x)|u(x)| dx.
Multiplying (30) by ψ S(T,·) and integrating, we get
Since r(K ∆ S(T,·) ) < 1, we conclude to the uniqueness of the solution of (29) in the set {0 ≤ u ≤ γΦ(T, ·)}, and thus to the uniqueness of Φ ∞ , obtained by dividing by γ, in the set {0 ≤ Φ ≤ Φ(T, ·)}.
Step 4. Uniqueness below Φ 0 . It remains to extend the uniqueness result to all functions smaller than Φ 0 . Analogously to the argument conducted in Section 3, we make use of the following result.
Lemma 4.5 Among the functions Φ ≤ Φ 0 , there is a solution Φ of (9b) which is larger than all subsolutions of (9b), and Φ ∞ = Φ. Lemma 4.5 implies that any other solution Φ of (9b) satisfies Φ ≤ Φ ∞ , then obviously Φ ≤ Φ(T, ·), but by the uniqueness result below Φ(T, ·) obtained in Step 3, we deduce that Φ = Φ ∞ . To achieve the proof of Theorem 2.2, it now only remains to prove the previous lemma.
Proof. [Proof of Lemma 4.5] The proof follows closely the proof of Lemma 3.4 in Section 3.3. For the sake of completeness, we repeat the argument in this framework. Firstly, we build a sequence Φ k (x) departing from Φ 0 and defined by induction by, for k ≥ 0, Φ k+1 (x) is a solution to −∆Φ k+1 + γΦ k+1 = S 0 exp Ω β(x, y)(Φ k (y) − Φ 0 (y)) dy ,
Clearly, from (8) and the maximum principle, we deduce that Φ 1 ≤ Φ 0 on Ω. Then iterating we deduce that Φ k+1 ≤ Φ k for any k ≥ 0. Hence (Φ k ) k is a non-increasing sequence which converges to a solution of (9b) denoted by Φ.
Secondly, if Φ is a subsolution of (9b) which verifies Φ ≤ Φ 0 . We have
By the maximum principle, we deduce that Φ ≤ Φ 1 . Iterating, we deduce that Φ ≤ Φ k for any k ≥ 0. Thus Φ ≤ Φ. In particular, we have Φ ∞ ≤ Φ. Thirdly, we prove that Φ ≤ Φ ∞ . We have Φ ≤ Φ 0 . Let us show that Φ ≤ Φ(t) for all t ≥ 0. By contradiction, if it is not true, there exists a first time t 0 for which Φ(t 0 ) touches Φ, i.e. Φ ≤ Φ(t 0 ) and for some x 0 ∈ Ω, Φ(x 0 ) = Φ(t 0 , x 0 ). Then, ∆Φ(x 0 ) ≤ ∆Φ(t 0 , x 0 ) and we have
Moreover, from (23), we deduce
It is a contradiction which concludes the proof of Lemma 4.5 and thus of uniqueness of Φ ∞ .
The results of Section 2 apply to finite rank contact matrices which have been studied widely with several applications as distributed susceptibility, [25, 24] . We show in Section 5.1 that for rank-1 contact matrices, the general formulas previously found may be simplified. An alternative approach is presented in Section 5.2 in the case where γ is constant, and generalized to finite rank matrices in Section 5.3.
The case of rank-1 contact matrices refers to matrices β(x, y) which we may be split into β(x, y) = β(x)p(y).
Then system (1) readṡ S(t, x) = −β(x)S(t, x) Ω p(y)I(t, y) dy, S(0, x) = S 0 (x), (31a)
where α and γ satisfy assumptions (3), β and p are bounded and positive, and the initial data are given non-negative functions satisfying the conditions in (4) . The result in Theorem 2.1 applies. We can identify explicitly the next-generation operator K S(t,·) in (13) as
It is worth noticing that, for this operator, the principal eigenelements are (up to normalisation)
Indeed, both ϕ S(t,·) and ψ S(t,·) are positive and satisfy the eigenvalue property
Hence, in this case, the basic reproduction number introduced in Definition 3 just reads:
and the herd immunity domain is reached for distributions S such that
Lastly, the computation of the final size reduces to
In the simpler case of the SIR system with finite rank contact matrices, another method can be used to study the final size. We begin with rank-1 matrices, for which the formulas are simpler, and assume that γ(x) is constant. Analogously to (31), the system readṡ S(t, x) = −β(x)S(t, x) Ω p(y)I(t, y) dy,
I(t, x) = β(x)S(t, x) Ω p(y)I(t, y) dy − γI(t, x),
In that case, one can reduce the system to a single ODE by introducing the quantity m(t) := t 0 Ω p(y)I(s, y) dyds.
As a matter of fact, the equation for S(t, x) can be solved as ln S(t, x) = ln S 0 (x) − β(x)m(t).
Inserting expression (34) in the equation (33b) for I, and integrating against the weight p(·), we find
Integrating once, one finds, sinceṁ(t = 0) = Ω p(y)I 0 (y) dy,
Herd immunity is reached whenṁ = 0, that is when
which, for any I 0 > 0 has a single root m H > 0 which is attractive. Indeed, F is a smooth and convex function on R + such that F (0) < Ω p(x)[I 0 + S 0 ](x) dx and lim m→+∞ F (m) = +∞. For I 0 small, m H may be close or far from S 0 depending on the stability of I ≡ 0 which is determined by R 0 = 1 − F ′ (0) γ .
The reduction to a single equation for rank-1 matrices can be extended to rank-N contact matrices, i.e., which may be written β(x, y) = N i=1 β i (x)p i (y).
Following the above construction, we introduce the matrix M defined by
This matrix has positive coefficients and thus we can define its principal eigenvalue λ and the associated eigenvector X = (X i ) i∈{1,...,N } , with X i > 0 for all i = 1, ..., N . Proof. For the given expression of φ S 0 (·) , we compute
S 0 (x)β i (x) y p i (y) γ(y) β j (y)X j dy
which proves the result for φ S 0 (·) , the same calculation can be performed for ψ S 0 (·) .
Notice that the characterization of R 0 given in the statement extends (32).
For rank-N matrices, it is also noticeable that one can also reduce the SIR system to N differential equations as we did in the rank-1 case. We assume that γ is independent of x and define for j = 1, ..., N , m j (t) = 
Notice that (36) extends (35). Conceptually, this is a system of N differential nonlinear equations, which can be computed at least numerically.
We considered an epidemic in a heterogeneous population modelled by a SEIR system with a continuous structure variable and a general contact matrix. We investigated question of the final size of the epidemic both with and without diffusion. In this general framework, our main contribution is to prove uniqueness results for the equation characterizing the final size of the epidemic. The proof combines a contraction property close to the steady state with a monotonicity argument which localized roughly the final state. Although we presented our results for a SEIR model, they can be extended to other compartmental models, like the SIR model and to more general equations than the simple diffusion.
The main limitation comes from the specific form of the SEIR model excluding birth and loss of immunity. In those models, up to our knowledge, proving merely convergence to a steady state is an open problem.