{'fraction_non_alphanumeric': 0.036282816002431516, 'fraction_numerical': 0.007940427795296532, 'mean_word_length': 4.397621244745206, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Non equivalence of dynamical ensembles and emergent non ergodicity

Dynamical ensembles have been introduced to study constrained stochastic processes. In the microcanonical ensemble, the value of a dynamical observable is constrained to a given value. In the canonical ensemble a bias is introduced in the process to move the mean value of this observable. The equivalence between the two ensembles means that calculations in one or the other ensemble lead to the same result. In this paper, we study the physical conditions associated with ensemble equivalence and the consequences of non-equivalence. For continuous time Markov jump processes, we show that ergodicity guarantees ensemble equivalence. For non-ergodic systems or systems with emergent ergodicity breaking, we adapt a method developed for equilibrium ensembles to compute asymptotic probabilities while caring about the initial condition. We illustrate our results on the infinite range Ising model by characterizing the fluctuations of magnetization and activity. We discuss the emergence of non ergodicity by showing that the initial condition can only be forgotten after a time that scales exponentially with the number of spins.


I. INTRODUCTION
Ensemble equivalence offers a convenient way of computing equilibrium potentials (entropy, free energy, grand potential, etc) by choosing the ensemble in which calculations are easier. Then, a Legendre transform provides the appropriated potential according to the environmental constraints on the system (isolated, thermostatted, chemostated, etc) [1]. Ensemble equivalence holds in many cases, but it breaks down for systems with long range interactions between system constituents [2][3][4] or in the presence of a phase transition treated at the mean field level [5,6]. The equivalence of equilibrium ensemble has been studied in detail [2-4, 7, 8], including in the framework of large deviation theory [9,10].
More recently, different dynamical ensembles have been used by many authors to study stochastic processes [11][12][13][14][15][16][17][18] and the question of their equivalence has been an active field of research. Equilibrium and dynamical ensembles differ qualitatively in nature: the first one is made of states and the second of succession of states (either continuous or discrete) called trajectories. Then, the probabilities on the ensembles are also different, a state probability for the former and a probability of trajectories for the latter. Dynamical ensembles must be used when the considered variables are time-integrated observables (like work, irreversible heat exchanges or activity) because their statistics can only be computed using trajectory probabilities. Based on a choice of dynamical observable and of a stochastic process defining bare trajectory probabilities, one can define two dynamical ensembles: the microcanonical and the canonical ensembles. Within the first ensemble, the trajectories are filtrated on the value of the chosen dynamical observable. Within the second ensemble, the probability of trajectories are exponentially biased. This canonical ensemble is also called the s-ensemble [19], the driven, biased or tilted ensemble [13] or Esscher transform [20]. The last ensemble has been used to study glass transition [19,[21][22][23][24][25][26][27][28] or as a numerical tool to evaluate rare event probabilities [29,30]. As indicated by their names, the way one introduces dynamical ensembles is in clear analogy with the way ensembles are defined in equilibrium statistical physics.
When two ensembles are equivalent, the mean value of the dynamical observable is the same in the two ensembles. Like for equilibrium ensembles, it is more convenient to make calculations (or simulations) within the canonical ensemble motivating the determination of the conditions for ensemble equivalence. Large deviation theory allows to conclude on this point from the convexity of the large deviation function (LDF) or from the differentiability of the cumulant generating function (CGF) [11,12]. Whenever ensembles are equivalent, LDF and CGF encode the same information and are related by Legendre transform.
In this paper, we aim in the first place at exploring the physical constraints associated with equivalence of microcanonical and canonical dynamical ensembles. In the second place, when ensemble equivalence does not hold, we provide a method to compute non-convex LDFs from the (moment) generating functions.
We identify that ergodicity and additivity are crucial for the ensemble equivalence. Ergodicity guaranties that the system can switch from any state to another in a reasonable time allowing to concatenate pieces of trajectories. Thanks to additivity, the probability of the dynamical observable on a trajectory made of two pieces is connected to a weighted average of the pieces probabilities (based on their duration) constraining the dynamical observable probability to ensure ensemble equivalence. In section II, we review results on ensemble equivalence and show for Markov jump processes that ergodicity implies the equivalence of dynamical ensembles for any additive observable. The contraposition says that non-ergodicity is required (but may not be sufficient) to break ensemble equivalence, and thus to obtain non-convex LDF. In section III, we illustrate our results with a simple non-ergodic system and derive the non-convex LDF for the system activity. For this system, non-ergodicity is imposed by construction because the transition rate matrix is reducible. The non-ergodicity impacts the LDF since it may change according to the probability of the initial state. Beyond this case, we look at the magnetization and activity of an infinite range Ising model for which ergodicity is broken in the thermodynamic limit. We show how to compute the non-convex LDF from the propagator of the generating function for the chosen observable(s) by adapting a method developed by Touchette in Ref. [31,32] for equilibrium ensembles. Applying this to the Ising model, we notice that the non equivalence of equilibrium ensembles is tightly connected to the non equivalence of the dynamical ensembles. Since the non-ergodicity of the Ising model is an emergent feature, the order of the thermodynamic and long time limits determines which of the convex or non-convex LDF is more appropriated. In section IV, we prove that the time to relax from the initial condition grows exponentially with the number of spins. In practice, this means that for time shorter than this relaxation time the system is not ergodic and one must use the non-convex LDF. For longer times of observation, the system is ergodic and one must use the convex LDF. Such arguments are conventional in the framework of equilibrium ensembles: we adapt them for dynamical ensembles and illustrate them precisely using the Ising model.

II. MICROCANONICAL AND CANONICAL DYNAMICAL ENSEMBLES
In this section, we review for time-homogeneous jump processes some results on dynamical ensembles equivalence, see Refs. [11,12] and references therein for more general Markov processes.
A. Definitions: stochastic process and dynamical ensembles The Markov jump process X t takes values in the finite state space Ω at all time t ∈ [0, T ]. The probability that X t = x ∈ Ω at time t, denoted p(x, t), is the solution of the time-homogeneous master equation where K(x, y) are the components of the Markov operator K, i.e. the probability per unit time of the transition from y to x. The Markov jump process is said to be irreducible if for any pair of states x = y it exists a path that connects x to y (and y to x), i.e. every transitions along the path have non-vanishing transition rates. On the opposite, the process is reducible when at least two subsets of states in Ω cannot be connected. Then, the process is non-ergodic. As a consequence, the ensemble average does not produce the same result as the time average since the process cannot explore the whole state space. Alternatively, one may use the path-integral formalism to characterize the process X t . In this case, we denote by P [x] the path probability, where [x] is the short notation for a realization of the process X t over the time interval [0, T ].
We aim at computing the statistics of a dynamical observable O. The mean value of this observable O follows from where D[x] denotes the sum over all possible paths. For simplicity, we consider an observable of the form where f (x) and g(x, y) are arbitrary functions and the discrete sum is on the time t at which the system changes of state, i.e. ∆X t ≡ X t + − X t − = 0. The f dependent part enables to study the time average of a state function, and the g dependent part the time average of jump quantities, like currents. For example, choosing f (x) = 0 and g(x, y) = 1 will lead to the global activity of the system, i.e. the number of jumps per unit time in the trajectory. The microcanonical ensemble is defined by filtering the trajectory ensemble with a condition on an observable, e.g. O = o where o is a possible value of the stochastic variable O such that its probability verifies P T (O = o) > 0. We write the path probability of these trajectories This path probability is normalized by construction.

B. Path ensemble equivalence
To discuss the dynamical ensemble equivalence, one needs to define when two path probabilities P and Q are equivalent. They do when almost everywhere with respect to P . This means that P and Q are equal up to subexponential terms in T for almost all paths. As a consequence, the mean value at large time of any observable will be the same if computed with any one of the two equivalent path ensembles. Assuming a large deviation principle for O [10], the LDF function I(o) provides the rate of decay of the probability density function P T (O = o) in the limit T → +∞ such that A LDF indicates the rate at which the probability density function of a time extensive observable concentrates in its most likely value when time goes by. Assuming a large deviation principle, Chetrite and Touchette have shown that the convexity of I(o) determines whether the microcanonical and canonical path ensembles are equivalent [11], in such a case P o and P γ satisfy Eq. (6). They distinguished three cases: is a stricly convex function at o, then there exists a unique γ ∈ R such that P o and P γ are equivalent.
(Non equivalence) If I(o) is a non-convex function at o, then there are no γ such that P o and P γ are equivalent.
(Partial equivalence) If I(o) is a convex function but not strictly convex function at o, then numerous values of o correspond to the same γ: It may correspond to linear parts in a convex function or to a point of a non-convex function at which the slope is not unique.
The convexity of the LDF I(o) is connected to the differentiability of the CGF. The CGF φ(γ) is defined as The CGF is the highest eigenvalue of the titled matrix K γ of elements [33] The CGF is also the Legendre-Fenchel transform of the LDF Conversely, we define I * * (o) as the Legendre-Fenchel transform of the CGF with γ(o) the value of γ realizing the maximum. The Gärtner-Ellis theorem states that if φ(γ) is a differentiable function then I(o) = I * * (o). The properties of the Legendre-Fenchel transform implies that I * * (o) is a convex function. The strict convexity of the LDF and the differentiability of the CGF are then dual conditions. Therefore we have the three following cases:   Hence, the non-equivalence of ensembles prevents to compute the LDF from the CGF since I * * (o) is only the convex hull of I(o). In Ref. [11], the authors conjectured a connection between non equivalences and non ergodicity. We support this idea in the following by confirming that non-ergodicity is required to observe a non equivalence of ensemble, but it is not a sufficient condition.
C. Proof of ensemble equivalence for ergodic process The proof of ensemble equivalence amounts to determine the convexity of a LDF function. In this section, we show how the LDF for observable O can be determined from the convex LDF of more general observables, and how the convexity property may be inherited in the process.
Whenever a stochastic variable depends of a set of other stochastic variables, one can infer the LDF of the former from the LDF of the latters. This operation is called a contraction. For instance, the observable O of Eq. (48) is a function of the empirical occupation ratio R and the jump rate C The occupation ratio is defined as the relative time spent in each state, say x here where δ is an indicator function being 1 if the condition is satisfied and 0 otherwise. The jump rate C(x, y) counts the number of transitions between two states (from y to x) per unit time The occupation ratios and the jump rates have a joint probability for R = r and C = c that satisfies a large deviation principle defining the large deviation function I(r, c), also called the level 2.5 LDF [34][35][36]. Then, the contraction leads to the LDF for the observable O. In general terms, a contraction corresponds to the minimization of a multivariate LDF under a condition encoding how the stochastic variables are related [10]. Since ensemble equivalence for a stochastic variable relies on the convexity of the corresponding LDF, it is crucial to determine (i) whether the LDF I(r, c) is convex and (ii) whether the convexity can be inherited upon contraction. The following theorem appearing in Ref. [37] provides an answer to point (ii) when the new variable is additive: Theorem (Contraction). Let h(x, z) be a convex function and U (z) an additive function, i.e. a function verifying then is a convex function.
We now address the point (i) about the convexity of the LDF I(r, c). This level 2.5 LDF is explicitly known for ergodic Markov jump processes in continuous-time [34][35][36] I(r, c) = x,y =x r(y)K(x, y) − c(x, y) + c(x, y) ln c(x, y) r(y)K(x, y) . (19) It is convex since it writes as the sum of a linear part x,y =x [r(y)K(x, y) − c(x, y)] and a Kullback-Leibler divergence between c and Kr This Kullback-Leibler divergence is convex as a consequence of the log-sum inequality (or Jensen's inequality) [38].
Using the previous theorem with z = (r, c), the convexity of the level 2.5 LDF and the additivity of O for both the occupation ratio and the jump rate, we conclude the contracted LDF I(o) is also convex: The ensemble equivalence holds for ergodic Markov jump processes. In particular, the ensemble equivalence holds for irreducible finite size Markov jump processes since they are always ergodic. Alternatively, one can prove heuristically the ensemble equivalence using the differentiability of the CGF, that is the dual condition with respect to the LDF convexity. To determine the CGF differentiability, one consider the CGF as the highest eigenvalues of the titled matrix K γ defined in Eq.(65). From Perron-Fröbenius theorem for irreducible finite size matrices like K γ , the highest (real) eigenvalue is unique: Its multiplicity is always one independently of the value of the counting field and no crossing between the two highest eigenvalues can occur. Moreover, the components of the tilted matrix are differentiable yielding that the CGF is itself differentiable. By duality, the LDF is strictly convex.
From this analysis, we conclude that the non-equivalence between the microcanonical and canonical ensembles based on observables like O may only happen when the Markov operator is reducible or of infinite dimension. Then, the LDF of the variable O may not be convex.
We emphasize that we made no assumption on the definition of dynamical rates, hence the system may be in or out of equilibrium. We used simple graph Markov processes, but the discussion can be transposed to include multiple channel transitions.

III. EXPLICIT LDF CALCULATION FOR NON-ERGODIC SYSTEMS
In this section, we adapt the method developed in Ref. [31] for equilibrium ensembles to compute non-convex LDF from their corresponding generating function. First, we explain how to compute a non-convex LDF from the propagator of the generating function for a simple non-ergodic system. We then apply the same method to infinite range Ising model for which the non-ergodicity emerges in the thermodynamic limit.

A. A four state model with non-convex LDF of activity
Let's consider a four state system made of two subsystems with two states (1, 2) and (3,4). The four state system evolves according to the master equation The Markov operator is reducible yielding to a non ergodic process. We aim at computing the system activity assuming that one cannot distinguish in which subsystem a transition occurs. The activity rate A is the total number of jumps per unit time: It is given by Eq. (48) when f (x) = 0 and g(x, y) = 1 for all (x, y). By definition of the Markov operator in the right hand side of Eq. (21), the activity probability distribution of each subsystem is a Poisson distribution of mean value T for the subsystem (1, 2) and 2T for the subsytem (3, 4), because there is 1 and 2 jumps per unit time in each subsystem respectively. The probability distribution of the total number of jumps is the sum of Poisson distributions weighted by the initial probability p i,n to start in state n. The probability of having aT jumps after a time T is For T large enough, P T (A = a) will be bimodal, and the microcanonical LDF reads where we have used Stirling formula and chosen the minimum of the two LDF corresponding to each Poisson distribution. The above microcanonical LDF of activity is shown in Fig. 1b. It is crucial to note that the initial condition plays a fundamental role here: if the system never starts in states 1 or 2, i.e. p i,1 = p i,2 = 0, the LDF will include the branch corresponding to the second line of Eq. (23) only. The non-ergodicity impacts the long time statistics of the dynamical observables through the choice of initial conditions. For the four state model, it is straightforward to determine the probability density function of activity, but for other systems or observables this task may be more challenging: one must often compute the CGF instead. Let's derive the result of Eq. (23) in this way using the propagator for the generating function of the activity defined by G(x f , x i , γ) = e T γA x f ,xi , where the subscripts x i and x f denote respectively the initial and final states of the trajectories appearing in the average. Using standard approach [10,39], the propagator is obtained from the biased operator as the components of its matrix exponential [exp( . Using eigenvalues and eigenvectors decomposition of K γ , we make explicit the matrix exponential The orthogonal basis of eigenvectors has normalized right eigenvectors, and the scalar products of the left and right eigenvectors associated to the same eigenvalue are all equal to 1. We notice that the eigenvectors separate in two sets whose supports are disjoints and correspond to each subsystem respectively. We remark also that the above propagator should be norm conserving when γ = 0, but the two terms in the second line of Eq. (25) do not fulfill this requirement. We do not consider then as physical and keep only the two first terms in Eq. (25). Then, the activity LDF is recovered from this propagator by first summing over the initial and final states second, applying an inverse Laplace transform, and finally by taking the limit T → ∞. For ergodic systems, this procedure leads to the same LDF whatever the order of these operations. On the contrary, the order matters for non-ergodic systems. For our 4 state model, the generating function writes Its inverse Laplace transform yields the probability density function of activity given in Eq. (22). However, first computing the long time limit of the generating function leads to the CGF T ln as long as p i (x) > 0 for all x. Noticing that the limit T → +∞ enables to use a saddle-point method to approximate the inverse Laplace transform into a Legendre-Fenchel transform, the asymptotic probability of activity follows from its corresponding LDF that is not the one of Eq. (23). The above LDF is convex because a Legendre-Fenchel transform only yields convex functions by definition, while the LDF of Eq. (23) is not convex. Alternatively, one may obtain the microcanonical LDF by taking the long time limit on the propagator of the generating function of Eq. (25), and not on the generating function itself, yielding The Legendre-Fenchel conjugate of these two branches associated to different initial states are precisely the two branches of the microcanonical LDF in Eq. (23): The summation over initial and final conditions is now carried out using an asymptotic approximation, which can be written heuristically as explaining why a minimum on the branches of Eq. (31) appears in the final microcanonical LDF of Eq. (23). To summarize, from the Legendre-Fenchel conjugate of all the eigenvalues appearing in the biased operator of Eq. (24), we determined the partial LDFs. The minimum among these partial LDFs produces the microcanonical LDF. We illustrate this procedure in Fig. 1. From this figure, we conclude on the ensemble equivalence for this model: it holds for a ∈ [0, 1[ ]2, +∞[, but the equivalence is partial at a = 1, 2 and there is no equivalence for a ∈]1, 2[. Remark that when the mean activities of each subsystem are the same, the two branches of the LDF merge toward a convex shape. Therefore, in this case non-ergodicity is not sufficient to observe ensemble non-equivalence associated to non-convexity of the LDF.

B. General framework
In the above example, we have seen that one can determine the asymptotic fluctuations of a physical observable by switching from one dynamical ensemble to another as long as the LDFs are piecewise-convex. In this section, we develop this approach for the more general framework of section II. In practice, this amounts to express the inverse Laplace transform as a Legendre-Fenchel transform, using the saddle point method and taking care of the initial condition appropriately.
By definition, for b ∈ R, the microcanonical LDF for O writes in term of the initial probability p i (x i ) and of the propagator G(x f , x i , γ) = e T γO x f ,xi that generates the moments of O under given initial and final conditions. The argument of the logarithm in Eq. (33) is exactly the probability distribution function of O. Since solely the most probable events contribute to the LDF, we can focus on the initial conditions leading to the minimal value of the LDF (as seen in section III A): Finally, the complex integral for the inverse Laplace conjugate follows from the saddle point method: Alternatively, the convex hull of I mc (o) is the Legendre-Fenchel conjugate of the CGF for the observable O, namely T ln As seen in section III A, the propagator G may have an eigendecomposition for which the terms contributing to the CGF in the limit T → ∞ depend on the initial or final condition. Hence, a maximum on x f and x i must appear to select the dominant asymptotic behavior in the limit T → ∞. In view of comparing with Eq. (35), the maximization is modified into a minimization through the commutation with the minus sign: In the end, the difference between the LDF I mc (o) and its convex hull I c (o) comes from the non commutation of max γ and min x f ,xi as a consequence of the dependence on the initial conditions, i.e. of the non-ergodicity. Of course, if the LDF were convex, the ordering of these extremization would not matter. The eigendecomposition of the propagator G involves the eigenvalues of the biased matrix of Eq. (65). For nonergodic systems or when the state space is infinite, the assumption of the Perron-Frobenius theorem does not hold and several eigenvalues may cross each other. To compute exactly the microcanonical LDF, one needs all the branches corresponding to each eigenvalue that becomes the highest eigenvalue for at least one γ. Only those branches matters, and other eigenvalues will not contribute, so as can be understood from the following argument: Be two eigenvalues φ 1 (γ) and φ 2 (γ) such that φ 1 (γ) > φ 2 (γ) for all γ. Since γo − φ 1 (γ) < γo − φ 2 (γ), we have The last minimization in Eq. (35) on the partial LDFs will withdraw the contribution coming from the eigenvalue φ 2 (γ) if it is smaller that φ 1 (γ). Physically speaking, we study a rare event in a system that has several independent subparts. We assume that the initial probability cannot be zero in all states of a subsytem, otherwise this subsystem shall be ignored. Each subpart of the system has its own probability to realize the rare event at stake. The subpart for which the event is the most likely will determine the event probability. This will be so if the rare event corresponds to a fluctuation of a time average quantity on a sufficiently long time so as to neglect the role of the initial state probability.
Mathematically speaking, when dealing with reducible biased operators whose highest eigenvalue is the CGF of interest, we must divide the operator into irreducible sub-operators for which holds the ensemble equivalence. For every sub-operators we proceed normally using the ensemble equivalence to determine the partial LDFs of the chosen observable from the Legendre-Fenchel transform of the highest eigenvalue of the sub-operator. The final LDF for the total system is then given by the minimum over all partial LDFs. This explains why the final LDF is piecewise convex.

C. Mean-field Ising model
Using the results of sec. III B, we study the activity and magnetization of an infinite range Ising model. This model is ergodic when considering a finite number of spins, but breaks ergodicity in the thermodynamics limit. In the following, we first introduce the model and its mean field (MF) treatment. Second, we provide the propagator of the generating function for magnetization and activity, and next use it to determine the CGF and both the canonical and microcanonical LDFs.

Model description and thermodynamics limit
We consider the fully connected Ising model made of N interacting spins {s} = (s 1 , . . . , s N ). Each spin s i can hop between states +1 and −1 by exchanging heat with a thermostat at inverse temperature β. The interaction energy between two spins is V /N when the spins are not aligned and vanishes for parallel spins. The interaction energy is independent of the distance between spins. Beside the spin-spin interaction, each spin has a potential energy −s i E due to the presence of an external magnetic field. We introduce the free energy F (n) ≡ U (n) − S int (n)/β of the mesostate n = N i=1 s i in term of the total energy given (up to a constant) by and of the internal entropy We chose the transition rate from n to n + 2ǫ (with ǫ = ±1) to be In the following we chose Γ = 1 and β = 1 to set the time and energy scales respectively. The system is in thermal equilibrium and the transition rates satisfy the detail balance equation The probability of state n at time t, denoted p n = p n (t) evolves according to the master equatioṅ whereṗ n is the time derivative of p n . The stationnary probability π(n) is the equilibrium probability The time-averaged stochastic magnetization is obtained from Eq. (48) by chosing the state dependent function f (n) = n/N and a vanishing function g(n, n ′ ) = 0 for all (n, n ′ ): where n(t) is the mesostate at time t. We denote by m some real value that can be achieved by the stochastic variable M . The mean magnetization in the stationary state writes The activity is obtained from Eq. (48) by chosing g(n, n ′ ) = 1/N and f (n) = 0 for all (n, n ′ ): The activity rate is thus a time-symmetric observable : the number of spin flips per unit time and per spin are identical in a trajectory and its time reversal. We denote by a some real value that can be achieved by the stochastic variable A. The mean activity in the stationary state writes In the thermodynamic limit, when taking the continuous limit for the mesostate x ≡ n/N ∈ [−1, 1], the system energy changes by for a transition from n to n + 2ǫ. Accordingly, the transition rates are in the same limit In this case, the master equation Eq. (44) can be transformed into an evolution equation for x in the mean field (MF) approximation The steady state solution of this equation is the mean field magnetization x = m mf verifying Using Eq. (51), the previous equation is equivalent to the transcendental equation The MF activity follows from the mean-field magnetization: The MF magnetization and activity are shown in the bifurcation diagram of Fig.2. At a critical value of the interaction energy, three MF magnetizations appear instead of a unique one, due to the well studied ferromagnetic transition in the Ising model. This bifurcation also affects the system activity as shown on the Fig.2b and as expected from Eq. (55) since a mf is a function of m mf . We remark that for E = 0 the system activity is an even function of the magnetization and hence the bifurcation diagram for activity has two branches only. We also notice that the MF activity is higher for the branch that does not break the system symmetry.

Propagator of the generating function for magnetization and activity
Like in the four state model of section III A, we look for the propagator of the generating function for the activity and magnetization: where as before the subscripts indicate a conditioning on the initial and final states, respectively x i = n i /N and x f = n f /N . From a path integral approach, see Appendices A and B, an asymptotic expression of the propagator reads where L is the Lagrangian with The propagator of Eq. (57) is almost explicit: the path [x] starting in x i and ending in x f must be determined using the Euler-Lagrange equation The propagator of the generating function is so determined by the initial and final conditions. As explained in sec. III B, we now vary initial and final conditions to obtain the dominant contributions to the generating function. As the large size and long time limit of the propagator is evaluated with large size limit first and then long time limit, the system is non-ergodic. Due to this non-ergodicity, the dominant contributions are obtained from stationary trajectories, i.e. element of the propagator G(x * , x * , κ, γ) such that ∂L ∂x (x * , 0, κ, γ) = 0.
and we denote x * (κ, γ) the various solutions of this equation. These constant trajectories are the only ones that will dominate for at least one value of (κ, γ). Following sec. III B, we can restrain the extremization over initial and final conditions to these stationary trajectories.
We provide an heuristic argument for the choice of stationary trajectories: Dominant trajectories correspond to long-time behavior of the tilted system. We expect the tilted system to be in a stationary state at long-time, as we study an equilibrium system. Neglecting the boundary terms due to long time limit, we restrain to trajectories starting and ending into a stationary state. The system being non-ergodic, the state space is divided into various subpart each associated to different x * and we forbid trajectories that start and end into different subpart of the state space. This approach is confirmed by numerical computation of the CGF in the next section.

CGF of magnetization and activity
We now use the propagator of Eq. (57) to derive the CGF of magnetization and activity. This CGF proceeds from the leading elements of the propagator of the generating function φ(κ, γ) = lim = max As explained above, we can focus on stationary trajectories that solve Eq. (61). Then, solving for x amounts to find the extrema of L(x, 0, κ, γ). Assuming that p i (x) > 0 for all x, one can safely drop the initial probability p i in Eq. (62) ending with Unfortunately, the determination of x * (κ, γ) involves a transcendental equation. We solved this equation numerically to provide the CGFs before and after the bifurcation in Fig 3d and 3c respectively. Cross-sections of the CGF in the plane κ = 0 and γ = 0 are shown in Fig 3a-b. After the bifurcation for V = 1.5, the CGF is clearly not differentiable. The left and right partial derivatives at (κ, γ) = (0, 0) lead to different mean magnetization and activity in agreement with the bifurcation diagram of Fig 2 of the mean-field framework. We notice on Fig 3d that before the transition the CGF has a non differentiability not located at the origin of the (γ, κ) plane. Hence the mean magnetization and activity are unique, but their fluctuations are impacted by the phase transition. We confirm our results by computing numerically the CGF as the highest eigenvalue of the biased matrix for systems with N = 10 and N = 25 spins. As explained in Sec II C, the CGFs of finite size systems are everywhere differentiable. Then, they only approach gradually the non-differentiable CGF when N → ∞.

Canonical LDF of magnetization and activity
The canonical LDF I c (m, a) shown in Fig. 4c-d is the Legendre-Fenchel conjugate of the CGF At low interaction energy V , we observe a smooth function whose unique minimum is given by the mean-field solution of Eqs. (54-55). However at higher interaction energy, a plateau appears in the LDF between the MF solutions. This plateau, in association with the non-differentiability of the CGF, indicates a phase transition. As emphasized before, we always have ergodicity within the canonical ensemble, and this plateau is the result of a "temporal coexistence" of MF states are shown in Fig. 4a-b, together with the LDFs for the finite size systems obtained from the Legendre transform of their corresponding CGFs in Fig. 3. For V = 1.5, the latter LDFs converge towards the plateau with a speed that is lower for the activity LDF than for the magnetization LDF in agreement with the fact that the plateau for the LDF of activity lies between a stable MF solution and an unstable MF solution, while the plateau for the magnetization lies between two stable solutions.

Microcanonical LDF of magnetization and activity
As explain in sec. III B, the microcanonical LDF follows from the Legendre-Fenchel transform of the elements of the propagator of the generating function. Therefore Eq. (35) yields Each stationary solution of Eq. (61) denoted x * defines a partial LDF If the initial magnetization is in the same subpart of the state space than x * , the system's fluctuations are best described by I x * (m, a). When ensemble averaging on the initial condition, we look for the minimum on the stationary trajectories to obtain the microcanonical LDF I mc (m, a) = min From the fact that I c is the convex hull of I mc , we get the following inequality between the two LDFs: The microcanonical LDF I mc (m, a) is shown after the bifurcation on Fig. 5c, We also provide in Fig. 5a-b the partial LDF for activity and magnetization (after contraction) and their convex hulls. As expected, the microcanonical LDF is not convex: the ensemble equivalence does not hold (in a specific interval of magnetization and activity) for our model in the thermodynamics limit, due to lack of ergodicity. Comparing the canonical LDF obtained from Eqs. (67) and the microcanonical LDF, we notice that the former is as expected the convex hull of the latter.

IV. NON CONVEX LDF AND DIVERGENT MIXING TIME
In the previous sections, we have obtained the LDF of activity and magnetization for the canonical and microcanonical ensembles. In the thermodynamic limit, the ensemble equivalence is broken at high interaction even though it holds at finite size. We now explore the transition from equivalence to non-equivalence when increasing the size of the system, putting the emphasis on the order of the large size and long time limits in the computation of the statistics of magnetization and activity.
In this section, we point out the existence of a mixing time t mix that depends on the system size. For systems of finite size, the mixing time governs the fluctuation regime. First, we define the mixing time from the spectral gap of the finite size operator K. Second, we give an estimate of the mixing time for the Ising model and prove that it diverges when N → ∞. This means that it is impossible to fully relax from the initial condition when the system includes too many spins, leading to an ergodicity breaking. Finally, we explore the different regime of fluctuations at finite size and time with numerical simulations, enlightening the coherence of our previous results.
For the numerical simulations of this section, the magnetic field is non zero (E = 0.2) in order to break the up-down symmetry of the Ising model. Thanks to the magnetic field there exists two different stable magnetizations associated to different stable activities. Then, the activity probability density function will be bimodal as it is beyond numerical reach (at large N ) to detect the third unstable magnetization and its associated activity. Without the magnetic field, just the unique stable activity would appear on the numerical simulations and the activity probability density function would be unimodal. For magnetization, we would observe only bimodal probability density function for symmetry reasons.

A. Gap at finite size
We come back to the continuous-time process of Eq. (1) of Markov operator K. We assume that K is diagonalizable. The eigenvalues are {λ i } i=1,N , where λ 1 = 0 and all other eigenvalues are negative. Its set of eigenvectors is {l i , r i } i=1,N where l 1 is an uniform vector and r 1 = π is the stationnary probability. The spectral gap ∆λ of the operator k is the difference between the largest eigenvalue λ 1 and the real part of its second eigenvalues λ 2 .
Considering the initial probablity p 0 , the probability is a formal solution to Eq. (1). Since the spectral gap ∆λ of the operator K is positive, the probability p(x, t) converges towards π. The mixing time t mix (ε) is used to quantify the time that the system takes to relax to the stationary probability [40]. By definition, the mixing time t mix (ε) is the minimal time for which starting from any initial probability the system is at most at a distance ε of the stationary probability. Formally, the mixing time is where the distance is the total variation distance defined as u T V = sup A u(A). A common choice for ε is e −1 , such that t mix ≡ t mix (e −1 ). The mixing time quantifies the time needed to reach stationary probability, whatever is the initial probability. In particular, an infinite mixing time is a feature of non-ergodic systems. When considering large deviations statistics, we must formally take long time limit. We emphasize that for times longer than the mixing time, the large deviation statistics is approximately valid. The mixing time of Eq. (74) is a maximization over all initial probability, therefore looking at e tK p i − π T V for an uniform initial probability p i = 1 underestimates the mixing time. We plot on the Fig. 6c, the evolution of this distance for various sizes. First, we observe an exponential scaling of the total variation distance with time. When comparing with Eq. (76), we expect the mixing time to be connected with the spectral gap. Indeed we have for any Markov process [40] where p min i = min x p i (x) and ∆λ is the spectral gap. Second, at very short time, the evolution of total variation distance has a different scaling. This short time behavior is due to the other eigenvalues whose influence on the probability p(x, t) disappears quickly. Finally, the evolution of the total variation distance with system size reveals the strong dependencies of the mixing time on the system size allowing for longer and longer transient behavior.
At finite time, the fluctuations critically differ if T ≫ t mix or if T ≪ t mix . On Fig. 6a and 6b we show the empirical density probability for activity and magnetization for a system of N = 60 spins and for different durations T , with t mix ≃ 100. And on Fig. 6d, we plot the empirical probability density of activity for a system size N = 200 where t mix ≃ 10 5 .
For T ≫ t mix , the long time probabilities of magnetization and activity are those of an ergodic systems (the system has enough time to switch between MF states). The asymptotic probability is then given by the convex LDF of sec. III C 4. The convergence toward the plateau for these LDFs is discussed in the next section. Notice that the added small magnetic field is responsible of the unimodality of the probability density functions, see Fig. 6a and 6b at T = 300.
Otherwise when the second eigenvalue is well separated from the others, i.e. when ∆λ ≪ |λ 0 − λ 3 |, the probability It contains a term coming from the second eigenvalue. This second term induces the secondary peak on the probability density function. Therefore, for intermediate times before the mixing time, the system behaves as an effective nonergodic system with fluctuations around each MF states (the system lacks of time to switch between states). We have a transient behavior where the probabilities of magnetization and activity are then bimodal, see Fig. 6d, and are linked with the microcanonical LDF of sec. III C 5.

B. Estimation of the gap for systems with detailed balance
We now determine the scaling of the mixing time with the system size. To do so, we find an upper bound on the spectral gap of systems with detailed balance which, combined with the inequality of Eq. (75), estimates the mixing time scaling.
For Markov processes with detailed balance, we can estimate the spectral gap from the Cheeger bound [41]. Indeed, in this case the Markov operator is symmetrizable, and we can use known results on the gap of symmetric matrices. We introduce the matrix D √ π as the diagonal matrix with elements D √ π (n, n) ≡ √ π n , then the matrix D √ π M D −1 √ π is symmetric if the Markov matrix K respects detailed balance. We introduce the Cheeger constant as where Ξ is any subset of the set of state of our system Ω such that π(Ξ) = x∈Ξ π(x) < 1/2 and, is the sum of probability flow from the subset Ξ to the complementary of Ξ, denoted Ξ c . From Ref. [41] ∆λ 2Φ  Computing the Cheeger constant is difficult in general, but it is possible to bound it. For a subset Ξ, the probability flow from Ξ to Ξ c is bounded by where N b is the number of edge connecting Ξ and Ξ c and the edge supporting the biggest probability flow from Ξ to Ξ c . Denoting thenx the most probable state in Ξ, we have Since we are mainly interested in the large size limit of the mixing time, we now assume that the stationary probability satisfies a large deviation principle We consider a connected subset of state Ξ such that the state x mf with I(x mf ) = 0 is not in Ξ. For large enough N , the probability of Ξ is surely less than 1/2. Using the bound (82) on the Cheeger constant, we find a large deviation estimate as Therefore, if it exists Ξ such that the LDF I(x) has a local minimumx ∈ Ξ that is not a global minimum, we will have I(x) − I(x) < 0. Then, if the product N b K(ý,x) is not diverging exponentially, we have bounded the spectral gap by something going to 0 as N → +∞. Hence, the mixing time diverges with the system size, and the divergence is even exponential. In our case, we consider the subset of state Ξ − = {x|x 0}, if E 0 it has a stationary probability less than 1/2, otherwise if E < 0, we consider the subset Ξ + = {x|x 0}. We have then N b = 1,x = 0 − andý = 0 + , the lower and upper closest states to 0. The stationary probability respects a large deviation principle, with a local minimum appearing after the phase transition, see Fig.7b. Therefore, the mixing time is diverging after the phase transition, but not before.
These results are confirmed by numerical computation of the spectral gap. On Fig. 7a, we plot the spectral gap as a function of the system size N and of the interaction energy V . Before the phase transition, the spectral gap remains finite and so does the mixing time. After the phase transition, the spectral gap goes to zero when increasing N . The speed of convergence of the spectral gap is well catched by the bounds (84) as indicates the exponential decay with increasing N shown on Fig. 7c. The mixing time is so at least diverging exponentially with the system size.

C. Mixing time as a criteria to study fluctuations
From the previous results, we are now able to explain the effective transition from non-ergodicity to ergodicity as the observation time becomes longer than the mixing time. At the level of the dynamical ensembles, this corresponds to a transition from non-equivalence to equivalence of ensembles. The fluctuations differ before and after the mixing time that in addition is diverging with the system size N . In a first place, if we take the long time limit before large size limit, we overcome the mixing time and the system stays ergodic. As the equivalence remains valid, the fluctuations are correctly given by the canonical LDF. In a second place, if the large size limit is taken first, the mixing time is infinite such that we stay in the regime of fluctuations before the mixing time, the system is not ergodic and the LDF is likely to be non convex. Large deviation theory aims at describing asymptotic fluctuations, but the limits should not be understood strictly: it is fundamental to distinguish the mixing time and its dependency on the system size to interpret them correctly and use this framework for real experimental systems or numerical simulations.

V. DISCUSSION AND CONCLUSION
Like for equilibrium ensembles, ergodicity breaking is fundamental to understand the non-equivalence of dynamical ensembles. Considering the connection between state variables and dynamical observables, equilibrium systems without equivalence of equilibrium ensembles will also exhibit non equivalence of dynamical ensembles. We have provided general arguments supporting that ergodicity is required, but may not be sufficient to observe non-equivalence between the microcanonical and canonical dynamical ensembles. We have considered a system without ergodicity (by construction) and one with an emergent non ergodicity. In both cases we have obtained LDFs with an explicit dependency in the initial condition, the so-called partial LDF. From this partial LDF, the microcanonical LDF follows from minimizing on the initial condition. For systems with emergent ergodicity breaking we have discussed the physical meaning of both the microcanonical (non-convex) and canonical (convex) LDFs. We did so by comparing the observation time and the mixing time after which the initial condition can be forgotten.
At a different level of large deviation, one may investigate the structure of the trajectories corresponding to the null minima of the LDF and the relative weight of these minima. When the system is not ergodic and the LDF is non-convex, we observe separate zeros of the LDF that can be associated to the most probable values of the dynamical observable. In this case, trajectories remain in a subpart of the state space given by the initial condition. For the fully connected Ising model, the most probable states are the MF magnetizations and their relative probabilities are determined from the initial probability to start within each subpart of the state space.
On the contrary, when the system is ergodic and the LDF convex, we observe a whole continuous set of magnetizations and activities for which the LDF is zero, e.g. the triangle region in Fig. 4c. These values corresponds to trajectories where the system spends a fraction of time around one MF state and another fraction around another MF state. Then, the final value of the observables is the time average on these trajectories. The move between MF states is allowed thanks to ergodicity. These trajectories are instantons of the Lagrangian, i.e. trajectories going from a stationary solution of Euler-Lagrange equations to another [42][43][44]. In this paper, we did not take instantons into account for the minimization of Eq. (62). However, taking them into account does not modify the canonical LDF, but gives instead another LDF at a different large deviation speed [45].
In our framework, we have assumed that it is always possible to find at least one stationary stochastic process (called driven process) that reproduces a fluctuation of the dynamical observables as a typical event. Ensemble equivalence means that this driven process is unique and does not depend on the initial condition. In our framework, ensemble non-equivalence means that there are several driven processes according to the initial conditions. We did not consider the case where no stationary driven process exists. This may happen for diffusive processes for which the state space is non-compact and the system relaxes while never reaching a stationary state [46,47].
Model of glasses are known to have large relaxation time scales that are beyond numerical and experimental reach. The characterization of their fluctuations during this relaxation is an active field of research. Since we characterized fluctuations before and after mixing time, we expect that our framework could be useful to study metastable states of glasses. We look for an expression of the propagator of the generating function G(x f , x i , κ, γ) = e N T (κm+γa) x f ,xi as a path integral over all trajectories for the system state n. We use the discrete time t k = kdt corresponding to the k's time step of duration dt, with the final time T = t L = Ldt. We write the system state n t k = n k for short. This state at time t k changes by n k − n k−1 = 2ǫ k = −2, 0 or 2 when a spin jumps from up to down, does'nt jump or jumps from down to up. The sum over all paths for a given initial condition is (A1) Since jump probabilities depends on the magnetization, the path integration should include a sum on the system state n k for all k with the condition that one spin at most jumps at each time step. In the above sums, the index n goes from −N to N . All in all, the propagator of the generating function writes with p(n k |n k−1 ) the probability of the transition n k−1 → n k . Let's use the Laplace representation of the Dirac distribution for every integer k between 1 and L to get G(n i , n f , κ, γ) = [n k ,ǫ k ] L k=1 dp k 2π L k=1 p(n k |n k−1 )e ip k (n k −n k−1 −2ǫ k−1 )+κn k−1 dt+γ .
In the next step, we sum over [ǫ k ] to obtain G(n i , n f , κ, γ) = [n k ] L k=1 dp k 2π e ip k (n k −n k−1 ) L k=1 p(n k−1 |n k−1 ) + ǫ=±1 p(n k−1 + ǫ|n k−1 )e −2ip k ǫ+γ e κn k−1 dt . (A6) The propagator when staying in the same state during a time step is p(n k |n k ) = 1 − ( ǫ=±1 K n k +2ǫ,n k )dt, and when changing of state writes p(n k + ǫ|n k ) = K n k +2ǫ,n k dt. Exponentiating the product yields G(n i , n f , κ, γ) = The propagator of the generating function becomes in the continuous limit where D[x] (resp. D[p]) is a short notation for the integral on the paths of density (resp. momentum) with given initial and final values. Finally, the path integral expression of the generating function is given by This function is the representation in the continuous limit of a tridiagonal Metzler matrix, whose spectrum is real [48]. As a consequence, ip is a real number in the following.
In this case, the saddle point calculation is equivalent to the WKB approximation of quantum mechanics. The propagator of the generating function will be given by the paths maximizing the action, i.e. the classical paths starting at x i and ending at x f . These paths solve the Hamilton's equations iẋ t = ∂ p H(x t , p t , κ, γ), (B3) iṗ t = − ∂ x H(x t , p t , κ, γ). (B4) The propagator of the generating function can be written as where (x, p) correspond to the solutions of Eq. (B3-B4) with initial and final conditions x i and x f . Moreover the Hamiltonian (A11) is time independent, and is hence a conserved quantity along the trajectory. Maupertuis' action where p(x) can be obtained by inverting Eq. (A11). We observe that Maupertuis' action is always negative in view of the clockwise motion along the orbits that can be justified by inspection of Eq. (B3).
In this large size limit, we can also use a saddle point integration on p to switch to the Lagrangian framework. To do so, we look for the solution of Eq. (B3). We derive a quadratic equation either for e ips or for e −ips whose solutions are e ±2ips = ∓ẋ s + ẋ s 2 + ϕ(x s , γ) with ϕ(x, γ) defined in Eq. (59). Inserting this into Eq. (A9) leads to the propagator of the generating function of Eq. (57) with Lagangian (58).