{'fraction_non_alphanumeric': 0.035604183870079825, 'fraction_numerical': 0.007555739058629232, 'mean_word_length': 4.462822344184648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Universal Method for Analysing Copolymer Growth

Polymers consisting of more than one type of monomer, known as copolymers, are vital to both living and synthetic systems. Copolymerisation has been studied theoretically in a number of contexts, often by considering a Markov process in which monomers are added or removed from the growing tip of a long copolymer. To date, the analysis of the most general models of this class has necessitated simulation. We present a general method for analysing such processes without resorting to simulation. Our method can be applied to models with an arbitrary network of sub-steps prior to addition or removal of a monomer, including non-equilibrium kinetic proofreading cycles. Moreover, the approach allows for a dependency of addition and removal reactions on the neighbouring site in the copolymer, and thermodynamically self-consistent models in which all steps are assumed to be microscopically reversible. Using our approach, thermodynamic quantities such as chemical work; kinetic quantities such as time taken to grow; and statistical quantities such as the distribution of monomer types in the growing copolymer can be derived either analytically or numerically directly from the model definition.


I. INTRODUCTION
Copolymers are polymers consisting of more than one type of monomeric unit; the order of these monomers in the chain defines the copolymer sequence. Broadly, copolymerisation mechanisms can be classified into two main categories: free copolymerisation that does not rely on a template 1 , as shown in figure 1(a); and templated copolymerisation, in which a template (usually another copolymer) is used to bias the distribution of sequences produced, as shown in figure 1(b) and figure 1(c). Polymers produced via both types of mechanism are of relevance to both biological and industrial systems. In living systems, O-glycans are sequences of monosaccharides that grow by free copolymerisation from serine or threonine amino acids 2 . They play a key role as a physical protective barrier for cells from pathogens, as well as participating in other cellular processes 2,3 . Free copolymerisation is also a common method for producing plastics and rubbers in commercial and industrial systems 4,5 . Additionally, there have been recent experimental designs for free copolymerisation systems to produce specific products utilising DNAnanotechnology-based reaction schemes 6,7 .
Templated copolymerisation is the mechanism by which DNA, RNA and polypeptides are produced in DNA replication, RNA transcription, and protein translation, respectively. These processes are at the heart of the central dogma of molecular biology 8 and are the basis of the informational and biochemical complexity of life. In DNA replication, DNA templates the production of copies of itself; in transcription, DNA templates the production of RNA; and, in translation, mRNA is the template for the production of a polypeptide 9 . Inspired by these biological templated copolymerisation mechanisms, there has been recent interest in designing synthetic systems that can produce other sequence-controlled molecules via templated copolymerisation [10][11][12][13][14][15][16] .
Free polymerisation can be modelled as a Markovian growth process under which monomers bind to the end of a growing polymer at a certain rate. Early free copolymerisation models [17][18][19] built on this framework to allow for copolymerisation via the incorporation of multiple types of monomeric unit, as shown in figure 1(a), albeit with irreversible polymerisation reactions. In particular, Mayo and Lewis 19 emphasised that in polymerisation models, if the monomer binding events are irreversible and their rates are conditional on the terminal monomer type, then intra-sequence correlations are generated within the copolymer.
Although the use of models with irreversible transitions is reasonable in many contexts, thermodynamically selfconsistent models require all transitions to be microscopically reversible. 20 Specifically, if a transition from state A to state B is possible, then transitions from B to A must also be possible. Models with fully microscopically reversible polymerisation reactions, as in figure 1(a), are more challenging to analyse but can be interpreted in a thermodynamic sense. 1,21,22 Templates can affect the rate at which monomers are added or removed from a growing copolymer, and hence templated copolymerisation models can be more complex than free copolymerisation models. When the template consists of just one type of templating monomer (homopolymer), a templated copolymerisation process can be mapped onto a free copolymerisation model. Further, if one assumes some symmetries regarding interactions between monomers in the growing copolymer and those in the template (such as all complementary bonds have equal strength and all non-complementary bonds have equal strength), models of sequence-bearing templates may be mapped onto models with homopolymeric templates, and hence to models of free copolymerisation [23][24][25][26][27] .
Templated copolymerisation models can be further divided into two main categories: templated self-assembly ( (a) shows free copolymerisation, (b) templated self assembly, and (c) templated copolymerisation with autonomous separation. In (b) and (c) the template is shown with squares and the growing polymer with circles. (d) An example of a more detailed reaction scheme used to select the next monomer. In each of these sub-figures, different colours represent different monomer types, with bonds coloured accordingly when their strength might depend on the monomer. In (d), different activation states of the monomer undergoing incorporation are represented by different shapes. The dashed bubble indicates how the arbitrary set of reactions in (d) may replace the simple reaction surrounded by a dashed bubble in (c) for a more complex model. ure 1(c) 23,24,39 . Templated self-assembly models are those in which all the monomers in the growing copolymer remain bound to the template. In autonomously-separating models, the growing copolymer detaches as it extends [23][24][25] . There has been recent interest in explicitly modelling autonomous separation in templated growth in an attempt to understand models that give a better description of transcription or translation [23][24][25] . In autonomously-separating models, the simultaneous growth and separation of the copolymer and template mean that the copy-template interactions are not permanent, and therefore free energy released from such interactions cannot be part of the driving force of polymerisation. Additionally, since these copy-template bonds are temporary, they cannot stabilise the accurate copy directly in the long time limit. Further, an ensemble of accurate polymers is a lower entropy state than an ensemble of random polymers. These conditions mean that non-equilibrium driving is required to generate accurate copies of the template if the copies are to spontaneously detach 39 . Moreover, the separation of the lagging tail from the template as the copolymer grows naturally causes intra-sequence correlations within the product. 23 The models described above are maximally coarse-grained, in that they treat the binding of monomers to the growing tip of the copolymer as a simple, usually single-step, process. However, more generally, one may wish to study models in which polymerisation occurs via a more detailed series of steps, as in figure 1(d). For instance, in order to explain the high accuracy observed in biological polymer copying systems, Hopfield 40 and Ninio 41 independently introduced the concept of kinetic proofreading: a reaction motif in which a monomer undergoes a free energy consuming activation reaction before it is polymerised into the copolymer. The introduction of kinetic proofreading reaction motifs presaged the investigation of more complex copolymerisation mechanisms 35,42 .
In summary, models that allow for multiple monomer types, intra-sequence correlations, reversible reactions, and general, multi-step monomer inclusion reactions represent a wide class of copolymerisation processes.
In this paper we present a universal method for studying this large class of copolymerisation models. Drawing on the work of Gaspard and Andrieux 49 for analysing linear copolymerisation processes, and Hill 50,51 for analysing absorbing Markov processes, we present analytical methods for extracting: explicit expressions for the probability of inclusion of a given monomer; the growth rate of a copolymerisation process; and the chemical work done by the process. Our method removes the need to extract the same features by simulation and often produces simple, analytic results.
In section II A, we review and refine methods relating to absorbing Markov chains that are crucial to understanding our approach. In section II B 1 we present our method. In section III, we apply the method to a few example processes to demonstrate its use and power when considering models with certain features. First, we apply the method to models for which the rate of adding new monomers only depends on the monomer type being added. Next we apply the method to templated copolymerisation systems with autonomous-separation that do not have non-equilibrium kinetic proofreading cycles. Finally, we solve a generalised version of Hopfield's kinetic proofreading model applied to a templated copolymerisation system with an autonomously separating product.

A. Absorbing Markov Chains
We begin by reviewing and adapting some diagrammatic techniques introduced by Hill to analyse absorbing Markov chains 50,51 . An absorbing Markov chain is a Markov chain for which any trajectory through its state space with arbitrary initial conditions will reach an absorbing state in finite time almost surely 52 . We can decompose the state space of an absorbing Markov chain into absorbing states, A , and transient states, X , such that the state space is V = A ∪ X . Let us denote the rate function that describes the chain as K : V × V → R + , such that K(x, y) is the rate of the transition from state x to state y. Then we denote a Markov process as the tuple, (V, K).
Throughout this section, we shall refer to the absorbing Markov chain given in figure 2(a), which possesses two absorbing states and non-trivial cycles, for illustrative purposes.
1. Expectations of an absorbing process are steady-state averages of a "closed process" We will derive expressions for four main quantities: the probabilities of reaching certain absorbing states, the expected time taken to absorption, the expected net number of times traversing a given edge before absorption and the expected number of times that a trajectory goes round a cycle before absorption. These quantities depend on the starting (transient) state σ ∈ X and can be found in terms of the "closed" process 51 . The closed process is a modified version of an absorbing Markov chain in which transitions to the absorbing states are redirected to the starting state. Figure 2(b) shows the closed process starting at state 1 of our example absorbing chain of figure 2(a). The closed process for a Markov process (X ∪ A , K) starting at state σ is a new Markov process (X , K σ ) with a rate function given by: for x ∈ X and agreeing with K on X × X /{σ }.
The closed process has a unique stationary distribution for the following reasons. From the definition of an absorbing Markov chain, there exists a path from any state to an ab-sorbing state, taking finite time. Thus, in the closed process, there is a path from any state to the starting state, taking finite time. The set of states including the starting state and all those that may be reached from the starting state is therefore positive recurrent and further, this set is the only recurrent set of states and will be reached from any other state. Since there is only one recurrent set of states, there is a unique stationary distribution 52 .
Expected quantities of an absorbing Markov chain, such as the expected probability that a particular absorbing state is reached, can be found in terms of steady state quantities in the closed process. Whenever a trajectory of the original process reaches an absorbing state, in the closed process that same trajectory would have been reset back to the starting state. Hence, running the closed process for long times is equivalent to generating many independent trajectories to absorption for the original chain. Thus, averaging quantities in the steady state of the closed process is equivalent to taking expectations over independent trials of quantities in the absorbing chain. It is worth noting that the dependence of expected quantities on the starting state is encoded in the definition of the closed process. Finally, we can see that the definition of the closed process may permit self-transitions, σ → σ , which, for continuous time Markov processes, have little meaning. However, for the purposes of calculating steady state probabilities of the closed process they may be ignored.
2. Steady State averages of the closed process are calculated using the Markov chain tree theorem Given that we can turn the calculation of expectations of absorbing processes into steady-state averages over closed processes, we can make use of tools developed for analysing the steady state of Markov processes, such as the Markov chain tree theorem (MCTT) 53 . The MCTT states that the steady state distribution of a Markov chain with a unique stationary distribution may be found by summing over rooted spanning trees of the process, where the transition rates are taken as weights on the edges of the graph. Explicitly, let G be a directed weighted graph, with weight K(e) for an edge e of G . A spanning tree of G , rooted at a vertex, ν, is a subgraph of G with no cycles that connects all the vertices of G and for which the out degree of every vertex, except ν, is one. The sets of spanning trees rooted at nodes 3 and 4 of the closed process, figure 2(b), are shown in figure 3. Denote by T (x) the set of all spanning trees rooted at x. The MCTT states that the steady state probability to be in state x, π(x), is given by: with e ∈ T representing the edges of the tree. The denominator here is simply a normalisation constant. We can define steady state currents from the steady state distribution of the closed process that corresponds to expected currents of the absorbing chain. Let a subscript σ denote quantities in the closed process starting at state σ . Then π σ is the steady state probability distribution and K σ the rate function. The current along a given edge, e = x → y, is given by the probability to be in state x, π σ (x), multiplied by the rate along said edge. We can, therefore, write the steady state current along all edges that originally led to absorbing states as: where, as before, X is the set of transient states and A , the set of absorbing states. J Tot (σ ) is the expected total current to absorbing states from state σ , and, therefore, its reciprocal is the expected time to absorption. For the example process shown in figure 2, we present the spanning trees of the corresponding closed process rooted at node 3 and 4 in figure 3. Given the spanning trees, we can directly write down the total current to absorbing states as: where N is the normalisation term, given in appendix B. The terms multiplied by k A are the partial current to absorbing state A, i.e. the current along transition 3 → A, coming from the trees rooted at node 3, and equivalently for k B with state B, i.e. the current along transition 4 → B, coming from trees rooted at node 4.

Absorbing probabilities
Given a Markov chain with multiple absorbing states, we can ask for the probability of absorption in each absorbing state in the long time limit. The probability that a trajectory eventually ends in a specific absorbing state can be calculated from the closed process, by dividing the expected current along transitions that originally led to the absorbing state in question by J Tot (σ ) (eqn. 3). Therefore the absorption probabilities can be written using the notation P[σ → A] to denote probability of being absorbed to A given that the trajectory started in state σ . It is worth noting here that given that this quantity is a ratio of currents, there is a factor of π σ in both the denominator and the numerator of the expression. In practice, we see that the normalisation factor from the MCTT (eqn. 2) cancels out, which simplifies the quantities in the calculation. For our example process shown in figure 2, we can use the partial currents to absorbing states A and B to write down the (a) Spanning trees rooted at node 3. , with nodes labelled in the first spanning tree and all other trees following the same positioning. The spanning trees have been arranged in terms of the self-avoiding walk between nodes 1 and 3 for the trees rooted at node 3 and arranged in terms of the self-avoiding walks between nodes 1 and 4 for the trees rooted at node 4. More details on the relationship between self avoiding walks and spanning trees are given in appendix A.
The normalisation factor, N , propagated through from eqn. 2, conveniently cancels out with the 1/N implicit in J tot .

Counting edge and cycle transitions
In this subsection, we shall calculate the expected net number of times traversing a given edge of an absorbing Markov process before absorption. Additionally, we shall calculate the expected number of times a non-recurrent cycle of an absorbing Markov process is traversed before absorption. Both of these will be of use later in defining a notion of chemical work.
To calculate the net number of times crossing a given edge we find the expected current along the transition, x y, between states x and y of an absorbing process, (X ∪ A , K), as in section II A. The expected current through this edge, denoted J x y (σ ), given starting in state σ ∈ X , can be calculated from the closed process, (X , K σ ), as in eqn. 1, as the difference between the steady state probability to be in state x multiplied by the rate from x → y and the steady state probability to be in state y multiplied by the rate from y → x, J x y (σ ) = π σ (x)K(x, y) − π σ (y)K(y, x).
The net number of times traversing this edge (number of observed transitions x → y -number of observed transitions y → x) before absorption is then just the ratio between this current and total current to absorbing states: The current, eqn. 7, is intimately linked to the notion of cycles as pointed out by Wachtel et al. 54 and detailed in appendix C. Thus, we also wish to find the expected number of times traversing a non-recurrent cycle. We define a non-recurrent cycle for a Markov chain to be a cycle of states, where each state, aside from the originating state, does not appear more than once in the cycle. For example, the cycle A→B→C→D→A is non-recurrent, but A→B→C→D→B→A is recurrent. Note that the originating state is arbitrary, and so A→B→C→D→A is equivalent to B→C→D→A→B. For a stationary process, the expected frequency with which a cycle is completed can be calculated from the one-way cycle current 51,55 , which is the probability current going around the cycle. For a chosen non-recurrent cycle, the one-way cycle current can be calculated diagrammatically from three terms. First, a cycle term given by the product of rates around the cycle in the chosen direction. Second, a spanning tree term that can be found by collapsing the nodes in the cycle into a single node (in figure 2c, the cycle 1 → 2 → 3 → 1 has been collapsed in this way) and finding the sum of spanning trees of this new graph rooted at the collapsed cycle node. Finally, there is a normalisation factor, which is the same normalisation factor as for the current, N . Explicitly, consider an absorbing Markov chain, G = (X ∪ A , K) and its closed process starting at σ ∈ X , G σ = (X , K σ ). Let C denote both the set of edges and set of nodes of a cycle in the closed process. To calculate the spanning tree term for the one-way cycle current, construct a new Markov chain, the cycle process, is the set of transient states of the original process with the states in the cycle replaced by the single node, c, and K σ ,C is given by: for x ∈ X /C and agreeing with K σ elsewhere. The cycle process for the cycle C = 1231 (or C = 1321) of the example system in figure 2(a) is shown in figure 2(c). Let T σ (x), T C (x) be the sets of spanning trees rooted at x of the closed process, G σ , and cycle process, G σ ,C , respectively. Then, the cycle current is given by 55 : Note for the cycle term, the edges are taken from the original process rather than the closed process. Given the cycle current for the closed process, the expected number of circulations of the cycle before absorption, N Cyc (σ ,C), is the ratio of the cycle current to the total current to absorbing states: For our example process, the expected number of circulations of C = 1231 is with the same implicit cancellation of normalisation as before, since J Tot ∝ 1 N . For an absorbing process starting at a given state, we may divide the cycles into internal and external cycles. External cycles are those which appear in the closed process and involve edges which were absorbing edges in the original process. The set of all cycles, sorted into internal and external, for the example process fig 2, is shown in appendix D. The external cycles correspond to the pathways from the starting state to an absorbing state. Therefore, the expected number of times traversing an external cycle before absorption will be at most one and corresponds to the probability of following a given path to absorption. Further, the sum of eqn. 11 over all external cycles will be one.

Philosophy of coarse-graining complex underlying copolymerisation reactions networks
Armed with the techniques for solving absorbing Markov chains, here we set out the method for the analysis of copolymerisation processes. Consider a growing copolymer with M monomer types, which are assumed to be present in the environment at fixed concentrations. At a coarse grained level, we can define a a state space of finite length sequences {x 1 x 2 · · · x l | x i ∈ {1, 2, · · · M}, l ≥ 0}, where l is the length of the sequence. Let us refer to the coarse-grained states in this state space as completed states. On this coarsegrained level, a sequence of length l may increase in length by one unit by polymerising one of M units at the growing tip (x 1 x 2 · · · x l → x 1 x 2 · · · x l x l+1 ), or it may decrease in length by one unit (x 1 x 2 · · · x l → x 1 x 2 · · · x l−1 ). Such a coarse grained model is depicted in figure 1(a,b,c) for free polymerisation, templated self-assembly and templated polymerisation with simultaneous separation.
Gaspard and Andrieux 49 presented a method to analyse Markov processes defined on this coarse-grained state space, assuming long polymers. We shall present a method for mapping more complex models for the individual polymerisation step onto this coarse-grained limit. In general, copolymerisation processes may be best described by models in which the underlying copolymerisation reaction networks are complex, featuring multiple sub-steps in arbitrarily complex networks connecting the completed states, as suggested in figure 1d. Hence, overall, we could consider a copolymerisation process as having a tree-like structure with networks of reactions connecting completed states, as in figure 4. Such a class of models is wide-reaching, with many examples from the literature included in this class [17][18][19]22,23,27,28,[30][31][32][33][34][35][42][43][44][45][46][47][48] .
We will perform this mapping by defining a Markov process at the level of the coarse-grained completed states description that preserves probabilities of transitions between the completed states of the fine-grained process, and therefore preserve the statistics of the sequences produced. The coarsegrained Markov process does not preserve the distribution of transition times between completed states implied by the fine-grained model, which will in general be non-Markovian. Moreover, it does not provide fine-grained information on trajectories between the coarse-grained completed states. However, temporal details and information about the fine-grained dynamics can be added back in at a later stage, once statistics have been analysed at the coarse-grained level.

Identifying propensities in the coarse-grained model
We find the transition rates of the coarse-grained model (hereafter labelled propensities to avoid confusion with the underlying rates of the fine-grained process) by considering first passage problems between completed states. From a given completed state, there are M + 1 completed states that may be reached, corresponding to the M possible additions of a monomer and the removal of the monomer currently at the tip of the copolymer. For a first passage problem, we can convert each of these reachable completed states into an absorbing state by removing the transitions out of said states, as in figure 4(a), in the same vein as Cady and Qian 56 . Let us refer to this absorbing Markov process as the step-wise process and define step to mean the addition/removal of a monomer.
We shall work with the assumption that the transition rates depend on the two monomers at the growing tip of the copolymer, following 1,[17][18][19][21][22][23][36][37][38]49,57 . There will therefore be M 2 flavours of this process corresponding to the combinations of the two terminal monomers of the copolymer, the central state &xy (here & represents an arbitrary sequence). We wish to find the absorbing probabilities, P[&xy → &xyz], z ∈ {1, · · · M}, P[&xy → &x] given an initial condition of the central state, &xy. As outlined in the previous section, eqn. 5, we can find these probabilities by constructing the closed process and finding sums over spanning trees rooted at different states. The step-wise process has M + 1 petal-like graphs each connected to the central state, but disconnected from each other. Due to this structure, any sums over spanning trees of the full process will factorise into a product of sums over spanning trees of the petals. Thus, we find that the absorbing probabilities take the following form: Here z ∈ {1, · · · M}, N is the normalisation factor from eqn. 2; Λ + (z, y) is the sum over spanning trees of the petal connecting states monomers &xy and &xyz, rooted at the forward completed state, &xyz; Λ − (y, x) is the sum over spanning trees of the petal connecting states monomers &x and &xy, rooted at the backwards completed state, &x, figure 4(b); and Q(y, x) is the sum over spanning trees of the petal connecting states &x and &xy, linked back to the central state and rooted at the central state, i.e. with edges redirected to the starting state as in the closed process, as in figure 4(c). Since Q is a sum over spanning trees rooted at the node to which edges have been redirected, the sum takes the same form for both the forwards and backwards petals, only depending on which two completed states it is connecting. From these probabilities, we see that choosing propensities ω ±yx for the transitions &x ω +yx − −− → &xy and &xy not only preserves the ratios of probabilities of transitions to completed states, but also ensures that ω ±yx only depends on monomers x and y.

Solving the coarse-grained model
We now use the methods developed by Gaspard and Andrieux 49 to solve the coarse-grained Markov model over the completed states, with propensities, ω ±yx . Gaspard and Andrieux's approach considers a frame of reference that is comoving with the tip of the growing polymer, and assumes that the state of the tip and nearby monomers reaches a stationary distribution, to derive quantities at this steady state, such as the set of tip incorporation velocities, v x (the rates of adding monomers to a copolymer &x), the tip probabilities, µ(x) (the probability at a given time that the growing polymer is in state &x), and the pair tip probabilities, µ(x, y) (the probability of being in state &xy). However, we note that the time-dependent information is not physical at this stage due to the coarse-graining process. The above quantities are found from solving the following equations 49 : Using µ and v, we can calculate the statistics of the copolymer sequence far behind the growing tip 49 . We note that the distribution of monomers at the tip, µ(x), is different from the distribution of monomers at sites behind the tip; we assume that this distribution reaches some limit far behind the growing tip, in the bulk of the copolymer. This limiting distribution describes the probability that a monomer in the bulk of the copolymer takes a value x. Using ε(x) to denote the frequency of monomer x in the bulk of the copolymer, 49 We may similarly define ε(x, y) as the probability that a sequential pair of monomers take the values x, y in the bulk of the copolymer. ε(x) and ε(x, y) fully characterise the statistics of the bulk copolymer since under our assumptions -transitions only depend on the two monomers at the tip -the completed copolymer sequence is itself a Markov chain 23 .

Extracting properties of the fine-grained model from the solution of the coarse-grained model
The easiest quantities to extract are the frequencies of monomers in the bulk of the copolymer. These quantities are identical in the coarse-grained and fine-grained models, since FIG. 4: a) The step-wise process for an arbitrary model with 3 monomer types. This step-wise process is for a copolymer &xy. The edges coloured red are the completion edges. The flower like structure of the step-wise process can be seen with 4 petals each connected at the starting state, &xy. b) One of the petals of the step-wise process, which we use to define Λ ± (z, y). Λ + (z, y) is defined as the sum of spanning trees rooted at the rightmost state, &xyz and Λ − (z, y) the sum of trees rooted at the leftmost state, &xy. c) One of the petals (connecting &xy to &xyz, as in b)) which has been linked back to the starting state.
This graph is used to define Q(z, y) as the sum of spanning trees rooted at the leftmost state, &xy.
the coarse-graining preserves the statistical distribution of sequences produced. Therefore ε(x) as defined in eqn. 18 and ε(x, y) apply directly to the fine-grained process. However, the tip probabilities calculated in the coarsegrained model, µ, depend on the time spent in each tip state. Since the propensities of eqn. 14 calculated by coarse graining the underlying process are not scaled correctly in time, we form a new tip distribution, ξ , which quotients out the time dependence of µ.
τ(x, y) = 1 Hence ξ (x, y) is the frequency that a given pair of monomers x, y is observed at the tip of the growing copolymer in the sequence of transitions. This distribution, ξ (x, y), applies to both the coarse-grained model and the sequence of completed states visited in the full fine-grained model. It can therefore be used to find averages of key dynamic properties. For example, we can calculate the probability, P, that a growing copolymer increases in length at each step of the stepwise process. P is calculated by averaging the probability of adding a monomer over the possible states &xy: Upon averaging out the sequence information we may treat the growth of a polymer as a random walk with probability P of stepping forwards and 1 − P of stepping back. We can find the expected number of monomer inclusion/removal steps per net forward step as 1 /(2P−1) (for proof see appendix E). A number of quantities scale with the total number of steps rather than the net number of steps, making the number of steps per net forward step a necessary quantity. For example in order to find the expected time taken per net forward step, one can find the expected time to absorption for the step-wise process, figure 4(a), T (x, y), for a copolymer in state &xy by calculating 1/J Tot (&xy) for the step-wise process using eqn. 3. The expected time per net forward step is then 1/τ step is therefore the physical average growth rate of the copolymer in the fine-grained model. We may also calculate the chemical work done by the system in producing the copolymer. In a purely chemical sys-tem, with no time-varying externally applied protocols, the entropy increase of the universe is given by the decrease in the generalised free energy of the chemical system, including any coupled reservoirs of fuel molecules. 20 . Since the total free energy must decrease, any increase in one contribution must be paid for by a decrease of at least the same magnitude in another contribution. It is common to describe the latter subsystem as doing work on the former.
For the polymerisation systems analysed here, the generalised free energy can be split into a term corresponding to the chemical free energy of the system, averaged over the uncertain state of the system, and a term related to the entropy arising due to the uncertainty of the state occupied. 58 where we use natural units such that k B T = 1. Here, a is a chemical state of the system as a whole, G chem (a) is the chemical free energy of state a, and p(a) is the probability that the system occupies the state a. G chem (a) = − ln Z a , where Z a is the partition function of the system (explicitly including any large chemical buffers) restricted to the chemical state a, and represents the contribution of concentrations and bond strength to the favourability of a molecular state. The principle of detailed balance 20 states that the chemical free energy change associated with a transition from a to b is given by The second term in eqn. 23 is information theoretic in character; it is equal to the negative of the Shannon entropy associated with the distribution over chemical states. For the systems studied here, in which we consider infinitely long copolymers that have reached steady state growth, the only relevant contribution to this term is the increase in Shannon entropy of the copolymer sequence produced as the polymer gets longer. Since the copolymer sequence is itself a discrete time Markov chain 23 the additional entropy per net forward step (the entropy rate) can be readily calculated 59 : with x, y representing the monomer types. Since the purpose of a copolymerisation system is often to produce a low entropy (or "accurate") sequence, it is reasonable to think of the chemical free-energy decrease per net forward step as the chemical work done to reduce the information entropy of eqn. 25 below that of a uniform, random polymer. Extending the definition provided by Poulton et al. 23 , we may define the efficiency of copolymerisation as: ln M is the entropy per monomer (or entropy rate) of a uniform, random copolymer with M monomer types, and W chem is the average decrease in chemical free energy per net forward step. This efficiency is then ratio between the entropy drop due to the accuracy of the copolymer compared to a random one (ln M − H) and the chemical work used to drive the system (W chem ) above that required to make a random copolymer in equilibrium (-ln M) 60 . The expected work done during a transition adding or removing a monomer given starting in completed state &xy can be calculated by summing the contribution from eqn. 24 multiplied by the expected net current along the edge a b prior to absorption over all edges in the step-wise process: where N a b (&xy) is the expected net number of times traversing edge a b before absorption giving starting in the central state of the step-wise process, &xy, as in eqn. 8. This sum will also require contributions from edges which lead to absorbing states. For such edges, the rate for the reverse transition in the logarithm of eqn. 28 is the rate from the full process. Equivalently, however, as outlined in appendix C, we may find this chemical work by considering the non-recurrent cycles of the process 54 . For a given internal cycle, C, we may define the affinity 20 , where the sum is over the edges, e, composing the cycle and C is the cycle with edges in revered direction. For external cycles, we may define the affinity in the same way, inferring the rate for the reversed edge of the transition to absorbing states from the full process. The expected work done before absorption of the cycle, C, given starting in the state &xy is Averaging w chem (x, y) with ξ and multiplying by the expected number of steps per net forward step gives the expected chemical work done per net forward step, Further, the forms of eqns. 22 and 32 may be applied to an arbitrary quantity for which one can find the expected value in the step-wise process starting in state &xy. Let this arbitrary quantity be A(x, y). One can then average this using the distribution, ξ , to obtain the expected value of the quantity per step. Then, if appropriate, multiplying by 1 /(2P−1), gives the expected value of the quantity per net forward step. In practice, as shall be seen in section III C, since the quantities we wish to calculate may be written in terms of sums over spanning trees, the quantities for the step-wise process may be written as a sum over the terms per petal, with the quantity for a given petal factorising into some quantity which depends on the petal multiplied by Q's for the other petals.

Stalled growth
Explicit simulation of copolymer growth is particularly challenging in regimes where P 0.5, since many backward and forwards steps are taken per net forwards step. At P = 0.5, then the process will not reliably produce copolymers; for P < 0.5 polymers will tend to shrink. In general, for P = 0.5, we can say the model has stalled. Our approach is particularly beneficial in this case; indeed, it is possible to check whether a model is at the stall point by considering an M × M dimensional matrix of the ratios of forward to backwards propensities 49 The model is at the stall point if and only if: where 1 M is the M × M identity matrix, and shrinking if negative. Since Z gives the ratios of adding a monomer to removing one, this condition essentially says that models will stall if the total rate of adding a monomer is less than the total rate of removing one.
In a typical model, there exists at least one parameter that controls the driving. Often this parameter is related to the backbone strength of the polymer produced: e.g. the free energy drop associated with the formation of a generic backbone bond, ∆G pol . This parameter will be present in the rates of each external cycle so that by tuning it, the model can be moved all the way from stalling to irreversible driving, whereby monomers cannot be removed once polymerised. If such a parameter exists, we may rephrase the stall condition, eqn. 33, in terms of this parameter. For example, for the case of the parameter being ∆G pol , we may find some threshold value Γ such that the model will stall for ∆G pol = Γ.

Limiting behaviour
We shall note two limits for which we may give analytic expressions for the frequency of monomer types in the copolymer bulk for all models. First, consider the case that the system is at the stall point (eqn. 33). In general, entropy production can still occur within cycles in the step-wise process; therefore, these frequencies cannot be determined from equilibrium arguments and are non-trivial. Nonetheless, at the stall point, we may express the monomer frequencies in the bulk relatively simply. The frequency of monomer x, ε stall (x), is proportional (up to normalisation) to the cofactor of the diagonal element (corresponding to monomer x) of the matrix (1 M − Z), as proven in appendix F. For example, for M = 2, and for M = 3, we have On the other end of the spectrum, we can also solve for monomer bulk frequencies in the irreversible limit, where ω −yx = 0 for all x, y. Intuitively, we could consider the Markov process on the state space {1, · · · , M} representing copolymers with a given monomer at its tip, and transitions between those states with rates, K irrev (x → y) = ω +yx . The steady state of this process will give the time dependent frequencies of having a given monomer at the tip of the copolymer. Therefore, dividing by the time spent in each state will give the bulk frequencies. A nice way to write out these frequencies in the style of the methods described thus far is as a sum over the spanning trees on the complete graph on M vertices with rate functions K irrev (x, y) = ω +yx . Explicitly, we may write these frequencies (up to normalisation) as: where T (x) is the set of spanning trees of the complete graph on M vertices. This expression is derived formally in appendix G. For example, with M = 2,

Simplification for factorisable propensities
The presented method applies to arbitrary complex copolymerisation models obeying the structure of figure 4. However, if we make some further common assumptions, much of the analysis simplifies. For example, consider the case in which the ratios of propensities may be factored: where Y is a function of monomer y only and X is a function of monomer x only. Intuitively, such a condition holds in the cases where there is no direct, type-dependent interactions between monomers in the growing polymer, such as when monomers only interact with a template 1,23,24,27-38 . Under such an assumption, multiple calculations simplify, see appendix H. For example, the stall condition becomes simply that the model will stall at Bulk frequencies at stall are just:

III. EXAMPLE APPLICATIONS
We shall now consider some exemplar classes of models to: provide examples of how to utilise the methods; validate their accuracy; and to show the types of quantities and information that may be extracted.
A useful initial classification of models is into those which we shall call balanced. We shall refer to a model as being balanced if its petals (see figure 4(b)) are detailed balanced. Such models are useful baseline checks as their cycles all have zero affinity, meaning no chemical work is done internally and hence the only contributions to chemical work are from external cycles. Further, these models exhibit a proper equilibrium at the stall point, and as such allow for equilibrium arguments to validate the method at this point. It is worth noting that although related to the notion of detailed balanced, the full model with its infinite state space is not detailed balanced.

A. Stalling behaviour in a polymerisation model with no neighbour-neighbour interactions
We shall start with the simplest case, where the propensities in the coarse-grained model only depend on the monomer type being added/removed: ω ±yx = ω ±y , such as in a simple model for templated self assembly, figure 1(b). Assume there exists a backbone free energy, ∆G pol controlling the driving as in section II B 5. Any spanning tree in Λ ± must involve at least one incidence of ∆G pol , since it appears in every external cycle. Therefore, we can split the ratio of propensities as follows: where ∆G y encompasses the rest of the details about the models. We note in general, ∆G y may be a function of ∆G pol , however in many cases, it is not. These cases include when there is only one completion reaction (highlighted in red in figure 4(a)) that contains the dependence on ∆G pol or if the model is balanced. We may then interpret −∆G y as an effective binding free energy of monomer y. If we think of ∆G pol as the free energy drive of the model away from stall, we look for a threshold value ∆G pol = Γ above which the model will not stall. Using eqn. 39, we see that where Z is the partition function for a system with one state for each monomer type, each state labelled by y and with free energy −∆G y . Furthermore, using eqn. 40, the bulk frequencies at the stall point may be written: which is the probability of selecting a state y, with free energy, −∆G y as predicted by equilibrium statistical mechanics. In these results, −∆G y looks like the equilibrium contribution to free energy, and the results follow fairly directly in equilibrium. However, these results hold even if the process involves fuel-consuming cycles: entropy may still be being produced at stall. In such cases, the effect of breaking equilibrium will be to change the effective free energies of selecting a given monomer type.
B. Balanced models of templated polymerisation with autonomous separation Next we shall consider a class of models where the ratio of propensities may be written: As before, ∆G pol , coming from the polymerisation reactions represents the driving of this process. Such a class of models includes, most notably, balanced models of templated polymerisation with autonomous separation, 23 . In these cases the breaking of the previous copy-template bond every time a new bond is formed enforces the structure in eqn. 44. We shall assume, as in Ref. 23, that ∆G y is independent of ∆G pol . Using eqn. 39 and eqn. 40, we find the stall point to be ∆G pol = Γ = − ln M and bulk frequencies at stall, ε stall (y) = 1 M , where M the number of monomer types. Physically, we can understand these results by considering balanced models of templated polymerisation with autonomous separation. For such models, by definition there is no entropy production in internal cycles and therefore, the stall point must be thermodynamic equilibrium. In such models, the only driving comes from the polymerisation, ∆G pol , and the entropic effect having M monomers to choose. These two effect balance at equilibrium. 60 Next let us consider the limit that the completion reactions highlighted in red in figure 4 (a) are much slower than the other reactions. Explicitly, let k be some rate constant at the same order of magnitude of the rates of the process that are not the rates for the completion transitions indicated in red in figure 4 (a). Write the completion rates as k com R + com (y, x), where k com k is a rate constant controlling the overall speed of the completion reactions and R + com (y, x) provides any sequence dependence. Similarly, the reverse transitions along the completion edges have the rate k com R − com (y, x). Further, let there be n com such completion reactions in a given petal of the step-wise process (we shall assume this number is the same for all pairs of monomers, x, y) Assume for simplicity that all completion reactions, R ± com (y, x), take the same form in a given petal. Then, we can write the sum over spanning trees, Q(y, x) as since Λ − (y, x) has first order terms in k com /k. This fact can be seen from noting that the leading order terms in Q(y, x) are the trees with no completion reactions and the leading order terms in Λ − (y, x) are those same leading order trees of Q(y, x), except with one completion reaction added in. There are n com such completion reactions and each adds the same leading order term to Λ − (y, x). With Q(y, x) taking this form, and remembering eqn. 44, the propensities take the following form: The n com k com term cancels in ratios of ω ±yx variables, and therefore does not affect the sequence statistics. Thus, in the slow completion limit, such models are only affected by the binding free energy differences (∆G y − ∆G x ), the driving (∆G pol ), and the nature of the final completion step (R − com ). Therefore, the fine details do not affect the statistics of the polymers.
Assuming that all completion edges are associated with the same free energy change −∆G pol , so that R − com (y, x) = e −∆G pol , we may solve for the statistics explicitly. For the case of two monomer types, M = 2, we find the bulk frequency to be (appendix I): where DG = ∆G 1 −∆G 2 . This expression is plotted in figure 5 for DG = 4. From this expression, we can confirm explicitly by substituting in the stall driving, ∆G pol = − ln 2, that the bulk frequency indeed becomes ε(1) = 1 2 . Further, taking the irreversible limit, ∆G pol → ∞, we find the bulk frequency becomes: the equilibrium statistical mechanics probability of choosing state 1 with free energy −∆G 1 , given state 2 has free energy −∆G 2 . Since the completion reactions are slow and irreversible, in this limit, the process selecting the monomers is allowed to equilibriate. Therefore, copolymerisation is simply sampling from the equilibrium distribution of this process, and hence tends to the result predicted by equilibrium statistical mechanics. Eqn.46 shows that in the slow completion limit, the fine details of the reaction network leading to selection of a specific monomer become unimportant and the models collapse onto a single accuracy curve determined by DG, ∆G pol and R − com . Conversely, if we fix all parameters except k com , we seem to see that the bulk frequencies will tend monotonically to their limits as k com /k → 0, either from above or below.
We can use this fact to compare bulk frequencies for certain types of model. For example, we may compare on-rate discrimination, 26 where incorrect monomers bind more slowly, to off-rate discrimination, 26 where incorrect monomers unbind more quickly. An example model comparing on-rate and off-rate discrimination is plotted in figure 5 for FIG. 5: Plots of the frequency of the less stably-bound (incorrect) monomer with smallest binding free energy, labelled 2 for on-and off-rate discrimination balanced models with k com = 100 and k com → 0. The binding free-energy difference for these models is DG = ∆G 1 − ∆G 2 = 4. The models are topologically the Hopfield model as in figure 6a, with ∆G act = 0 and M in = M act = 1. However, for the on-rate discrimination, the free-energy terms are in the binding reactions instead of the unbinding ones. The specific models are given in appendix J. a model defined in appendix J. Consider the bulk frequency of an incorrect monomer. On-rate discrimination benefits from fast polymerisation and therefore tends to its slow polymerisation limit from below, whereas off-rate discrimination benefits from allowing the process selecting monomers to equilibriate and hence tends to its slow copolymerisation limit from above. This fact sets up a hierarchy for a given set of parameters, and moderate or strong driving, for the bulk frequency of incorrect monomers, off-rate discrimination > slow copolymerisation > on-rate discrimination. This observation is consistent with the results of Sartori and Pigolotti 26 and Poulton et al. 23 for kinetic (on-rate) and energetic (off-rate) discrimination.

C. Hopfield's Kinetic Proofreading in a model of templated copying with autonomous separation
For our final example, we shall consider an explicit model of copolymerisation, with Hopfield's kinetic proofreading mechanism incorporated into a templated copolymerisation system with autonomously separating product in a thermodynamically valid way. From this setup, we can provide a fully worked example of an explicit model, as well as demonstrating the power of the method for analysing sequences of models with recursive structures as we look at a generalised version of Hopfield's proofreading incorporated into a model of templated polymerisation with autonomous separation.
Explicitly, we first consider the one-loop model of kinetic proofreading shown in figure 6 (a). There are two monomer types, the right ones x = r and wrong ones x = w. Note that we have already transformed the model so that the sequence of the copy is defined relative to that of the template 35 . These monomer types exist in inactive and active states with concentrations M in and M act , respectively, relative to some reference concentration, with each monomer type having the same concentration. As previously, we shall assume the environment is sufficiently large such that these concentrations remain constant.
The monomers may bind to the template either in an active or inactive state with binding free energies −∆G x for monomer type x. Inactive monomers may be activated on the template with a free-energy change of ∆G act . Finally, active monomers may be polymerised into the copolymer chain, with free-energy change −∆G pol . Subsequently, the penultimate monomer of the copolymer unbinds from the template. Each of these reactions is assigned a forwards and reverse reaction rate consistent with the thermodynamic model; the full model is illustrated in figure 6 (a). Conceptually, the proofreading motif functions by providing two opportunities to re-ject the unwanted monomer w: first, when the un-activated monomer binds, and second, after it has been activated. To be effective, a non-zero affinity is required to drive the system around the cycle of states in the correct order: unbound template site → unactivated monomer bound → activated monomer bound. 20,40 We emphasise that this model differs from Hopfield's original description in two important ways: firstly, we consider a full, microscopically reversible polymerisation process, rather than a single incorporation step with irreversible polymerisation; and secondly, we embed the proofreading motif into a non-trivial polymerisation process involving autonomous detachment from the template.
Given the model as described in figure 6 (a), we first identify the propensities ω xy connecting completed states. Due to the petal-like structure, we can follow eqn. 13 and simply consider spanning trees of the petal sub-processes illustrated in figure 6; Λ − (y, x) rooted at &x, Λ + (y, x) rooted at &xy, and Q(y, x), for a petal connecting &x and &xy. Explicitly writing out the sums of spanning trees, we obtain: Here, we add a subscript 1 to denote these as for the simple, "1-loop", Hopfield model, which we shall extend to allow more loops later. We note that the ratio, Λ + (y, x)/Λ − (y, x) factorises as eqn. 38 and so we can easily write down the stall condition as ∆G pol = Γ with Note that setting M in = M act = 1, ∆G act = 0, in eqn. 52, Γ collapses to − ln 2 as these conditions reduce the system to a balanced one with a stall point at equilibrium, as in Section III B. The frequency of right and wrong monomers, ε(x = r, w) may be calculated from eqn. 18 (the calculation is implemented in the supporting information). We plot copying error, as represented by ε(w), in figure 7 (a), and demonstrate that it agrees well with the results found from a Gillespie simulation 61 of the same model. We also compare to a "0-loop" version of the model, in which the inactivated monomers and the inactivated monomer bound state are omitted. As can be seen, the proofreading motif generally improves accuracy when driven above its stall point ∆G pol = Γ. Indeed, we may write down expressions for the bulk frequency in the irreversible limit (∆G pol → ∞) using eqn. 36. In this irreversible limit, we recover Hopfield's classic argu-ment by taking some further limits consistent with his analysis. Namely, letting M act , k act , k pol → 0, we find ε(w)/ε(r) = e 2(∆G w −∆G r ) . In this limit, the ratio of incorrect monomers to correct ones involves the square of the binding free energy difference, reflecting the fact that two steps of discrimination have occurred.
We may also write down expressions for the expected chemical work done per net step of the process. This quantity will involve the total current to absorbing states of the step-wise process for starting with a copolymer &xy, which we may write as: where N is a normalisation factor that will cancel out of calculations. In order to track each of the terms here, we shall break down the contributions to the chemical work done into three parts, one for each of the petals present in the step-wise process. These three petals correspond to adding a monomer type r, adding a monomer type w or removing a monomer type y. Let us label each of these contributions to the chemical work with a subscript, G r (y, x) for the transition &xy → &xyr, G w (y, x) for the transition &xy → &xyw, and G q (y, x) for the transition &xy → &x. From the r petal, we have: FIG. 6: Reaction rates of the (a) 1-loop and (b) N-loop Hopfield kinetic proofreading models implemented in a templated polymerisation model with autonomous separation system. Each of these subfigures represents a single petal of the step-wise process as in figure 4, going from completed state &x → &xy. In both cases, the template is represented by red squares. In (a) the inactive monomer is represented by a white circle and the activated monomers by a dark blue circle. In (b), different levels of activation are represented by increasingly dark shades of blue circles. Further, in (b) the numbers by the states represent the activation level of the monomer. In each case, the desired pathway is highlighted with red arrows.
The first line of eqn. 54 corresponds to the chemical work associated with the internal cycle (inactive monomer binds, gets activated, and activated monomer unbinds). The second line corresponds to an external cycle: an inactive monomer binds to the template, is activated and is polymerised into the chain with the previous monomer, y, detaching from the tem-plate. The third line corresponds to the alternative external cycle: an active monomer binds to the template and is polymerised with monomer y unbinding from the template. We may similarly write down G w (y, x) as eqn. 54, except swapping r and w. Finally, the contribution to the chemical work from the petal for removing monomer y may be written: Here, only external cycles are possible. The first line corresponds to monomer x rebinding to the template, monomer y being depolymerised, this monomer being deactivated and an inactive monomer y unbinding from the template; and the second line to x rebinding, y being depolymerised and active monomer y unbinding from the template. The distribution, ξ (y, x) may be calculated from eqn. 20 and P from eqn. 21 (both demonstrated in the supporting information), letting the chemical work done per net step of the the 1-loop model be written: This chemical work done is plotted for a certain set of parameters in figure 7 (b) and is also compared both to the results of direct simulation and the simpler "0-loop" model which has chemical work, ∆G pol . The free-energy cost of the proofreading mechanism diverges as ∆G pol → Γ since there will be a finite chemical work done per monomer addition/removal step due to the proofreading internal cycle, and the number of addition/removal steps per net step diverges. Further, for large ∆G pol , the work tends to be dominated by ∆G pol , albeit very slowly, as shown by the orange line gradually approaching ∆G pol (the blue line) in figure 7(b).
Additionally, we can find an expression for the time taken per net step forwards, eqn. 22. For this quantity, we need the explicit expression for the normalisation, N . Similarly to the chemical work, we can split this term into contributions from the petal adding an r, N r (y, x); from the petal adding a w, N w (y, x); from the petal removing monomer y, N q (y, x) and a contribution from the central node. These normalisation terms come from the sums of spanning trees directed to the individual nodes in the closed step-wise process. We see that with a similar result for N w (y, x) except swapping r and w.
Finally, for the monomer removal petal, we have: The total normalisation is then: with the last term being the contribution from the starting, central node. This normalisation can be used in eqn. 53 to give the current to absorbing states, which can be used in eqn. 22 to find the expected time per net step. This time is plotted in figure 7 (c), alongside a simulation of the same model and the simplified 0-loop model for comparison. Like the chemical work in figure 7 (b), the time per net step diverges as ∆G pol → Γ, since each monomer addition/removal step will take finite time, but the number of such steps required for a net forwards step diverges. Unsurprisingly, the time taken for a given driving for the Hopfield model is longer than that of the simple model, due to the proofreading cycle. Hopfield's model for proofreading may be naturally extended to include N activation stages instead of just one. 45,47 We shall call these extensions the N-loop Hopfield models. These models can be solved recursively to write down expressions for the sums over spanning trees, Λ ± N (y, x), Q N (y, x), as a function of the number of loops, N. We shall consider the model as in figure 6 (b). A detailed derivation of the sums over spanning trees is given in appendix K. From these sums over spanning trees, we calculate the bulk frequencies, the time taken per net step and the chemical work done per net step using recursive relations (see appendix K).
For simplicity, we shall discuss the case where the monomer binding free energy is only dependent on monomer type, not on activation stage; each activation stage is associated with a free energy change of ∆G act ; each active monomer is present in the environment at a concentration M act except the inactive monomers at concentration M in ; and the overall rate constants are k 1 for binding of inactive monomer, k KP for binding of active monomers, k act for activation of monomers. Under these assumptions, the corresponding rates are given in appendix K.
To reduce the frequency of incorrect monomers in the product, we wish to have a low concentration M act of active monomers in solution to force the system into utilising the proofreading cycles. Indeed, the bulk error probability in the irreversible limit (calculated using eqn. 36  However, for finite driving strength ∆G pol , we cannot allow this concentration to be arbitrarily small. To see why, consider the stall point, Γ(N), derived in appendix K and plotted for a certain set of parameters in figure 8 (b). It is observed that the stall point driving increases monotonically with N, and that this increase is faster and tends to a higher limit for smaller M act . We find that the limiting Γ scales approximately linearly with − ln(M act ). Intuitively, introducing more monomer states at low concentration in the environment destabilises the polymer. For small M act and driving ∆G pol , the depolymerisation of the polymer into these activated states competes with its tendency to grow by binding to and activating the inactive monomers.
One drawback of proofreading with a large number of loops is therefore that the tendency to disassemble the growing polymer increases. A second effect is a tendency to introduce errors by alternate pathways if M act is non-zero. Specifically, for M act = 0, we observe in figure 8 (a) a minimum in ε irrev (w) for a relatively small value of N. This minimum can be explained by splitting the pathways by which a monomer can go from solution to being incorporated into the polymer into two, either starting from a fully inactive monomer or from a partially activated one. The pathway starting with an inactive monomer will have the highest discrimination between right and wrong monomers and will improve exponentially with more loops, as demonstrated by the exponential decrease in error for M act = 0. However, the probability that a monomer, taking this path, will reach polymerisation falls exponentially with loop number at the same time. On the other hand, the pathway from partially active monomers will give an error that reaches some non-zero limit as the number of loops, N, increases. Further, the rate with which activated monomers bind to an available template site and subsequently get incorporated into the polymer will also tend to a constant. As such, the error will initially decrease exponentially with N, but for non-zero M act will eventually become dominated by the less discriminating, partially active monomer pathways through which monomers are more likely to be incorporated into the polymer.
Having calculated the error probability ε(w) at finite driving, plotted in figure 9 (a); used ε(x, y) to calculate the entropy rate; and calculated ∆G ; we can evaluate the efficiency η, as in eqn. 26 (see supporting information for demonstrations). This efficiency is plotted in figure 9 for N = 0, 1, 5, 10 and a certain set of parameters. Although accuracy is generally increased above the stall point, we see that in this particular model kinetic proofreading requires much more work than the minimum required to generate information and as such are inefficient. Additionally, the gradient of the efficiency at minimum driving, Γ N , is zero for N > 0, reflecting how at minimum driving, the number of monomer addition/removal steps diverges, but the chemical work done per such step remains finite.  figure 7, as a function of driving ∆G pol . Proofreading is observed to generally increase accuracy above its stall point, but in a thermodynamically inefficient way. The enhanced plot in the second graph shows the efficiencies near the stall point for each of the loop numbers on a non-logarithmic scale to emphasise the decreasing gradient at stall.

IV. CONCLUSION
We have presented a method for analysing copolymerisation models with complex networks of reactions leading to the incorporation or removal of monomers. By coarse graining, a model may be transformed into a simpler model which may be solved and then afterwards, information from the finegrained process may be put back into the model to extract thermodynamic or kinetic quantities such as chemical work done, molecule exchange or time taken. The approach allows for complex incorporation motifs to be considered alongside nearest neighbour interactions in a thermodynamically welldefined model of polymerisation with microscopic reversibility. We note that all of these features were present in the kinetic proofreading example in Section III C. Moreover, phenomena such as the shift in stall point with loop number and the non-monotonicity of error rate with loop number rely on these features being present in the model.
In general, this method provides a way to extract model predictions numerically quickly and without the need for simulations. Doing so is particularly useful when simulating polymer growth is slow, either due to the details of the incorporation process or because the polymer is near its stall point. Additionally, the approach makes screening of a large parameter space for a given model topology feasible.
In addition to the numerical performance, the approach allows for analytic results in simpler models or those with helpful symmetries, as well as in certain limits for more complex models. The process of summing over spanning trees is particularly well suited to identifying the structure of the process and providing simplified results.
Moving forwards, it is an open question as to whether components of the techniques developed here can be applied outside of the context of infinitely long polymers whose tips have reached steady state. An obvious goal would be a simplified way to analyse finite-length "oligomers". 24 . More generally, we believe the key equation of this paper, eqn. 14, may be applied more generally for the coarse graining of Markov processes. Specifically, that if a set of states are enclosed between two boundary states, in the sense that any path from one of the trapped states to outside must pass through one of the boundary states, then this set of states may be replaced by a pair of edges analogously to eqn. 14 which shall preserve steady state properties of the Markov process.

SUPPLEMENTARY INFORMATION
The Zenodo supplementary information contains a C++ script implementing the Gillespie algorithm that reproduces the data for the 1-loop Hopfield kinetic proofreading model presented in figure 7, and a MATLAB script for numerically calculating quantities of the 1-Loop and N-Loop Hopfield kinetic proofreading models presented in section III C and shown in the solid lines of figure 7, the points of figure 8 and figure 9.
where S (x, y) is the set of SAWs from node x to node y; N is the normalisation as in eqn. 2, and e is the edge in the opposite direction, i.e. if e = x → y, e = y → x; and the last bracketed term is the spanning tree part for SAW, S, as in eqn. A1. One of the SAWs from y to x will simply be the single transition x → y, however, this term will cancel out from the sum leaving just the non-trivial SAWs. Taking a non-trivial SAW from y to x and multiplying by the rate K(x, y) gives a cycle containing the edge x → y. Therefore, the current may be written as a sum over cycle currents, as in section II A 4, of cycles which contain the edge x → y minus those which contain y → x. Each of the edges contains a contribution to chemical work ln K(x,y) K(y,x) . The total chemical work before absorption is the sum over all edges of these contributions: Since, in this sum the J x y may be split up as a sum over cycles, we may collect the parts of this corresponding to given cycles and convert the sum over edges into a sum over cycles. Doing so we find the contribution to the chemical work from cycle, C, to be ln A(C) A(C ) , i.e. the affinities as we might expect. Hence, the sum over cycles is equivalent to the sum over edges.
From this, the expected number of steps before absorption is: By utilising the formulae for finite geometric series, we can find the expected number of steps to be: Most of this expression is sub-linear in L, and as such: which is the net number of steps per net forward step.
Appendix F: The frequency at stall is given by the diagonal cofactors of a matrix We wish to show that, at stall, the frequency with which a monomer appears in the bulk of the copolymer is proportional to the cofactor of the corresponding diagonal element of a matrix: where A i j is the cofactor of element i, j of the matrix 1 − Z. To show this relation we will rely on the relationship between cofactors and vectors of the nullspace of a matrix. Let M be an arbitrary matrix with a one dimensional nullspace, and let A be its matrix of cofactors. Recall that Thus, any column of A T is in the nullspace of M. In anticipation, let − → µ be a vector in the nullspace of M and − → v be a vector in the nullspace of M T . Since M has a one dimensional nullspace, then for some arbitrary i. Similarly, for arbitrary j.
Looking at eqns. 15, 16, noting that near the stall point, v z << ω ±y,x , we see that, the tip probabilities, µ(x), form a vector in the nullspace of 1 M − Z and the tip velocities, v x , form a vector in the nullspace of 1 M − Z T . Hence, we have that for arbitrary i, j. Thus, we may choose j = y and i = x leading to cancellation such that we get the required result.
The sum over spanning trees of the N-loop model can be written in terms of sums over spanning trees of the lower loop number models. We label the reaction rates for the N-loop process as shown in figure 6. The N-loop model has one more node and two more edges than the N − 1-loop model. Let a subscript, N, denote the sums over spanning trees for the N-loop models. Tracking the spanning trees, we see, with initial conditions The sum-product can be eliminated by subtracting terms proportional to Λ ± N−1 , Q N−1 , leaving just: with the same initial conditions as above. This system of recursion relations may be used to generate the terms of the spanning tree sums quickly. In certain simple cases eqns. K5, K6, K7 can be solved as a function of N. For example, when the reaction rates are not a function of N, such as: for n ∈ {1, · · · N}, for the step-wise process with monomer tip &xy, where k i are some overall rates, M in , M act represent the concentrations of inactive or active monomers, ∆G act represents the chemical work upon moving a monomer up one activation stage. The rates in eqn. K8 are used for the numeric results in figures 8 and 9. In this case, the sums over spanning trees are: Λ + N (y, x) = k pol e −∆G x k N act k 1 M in − k 1 M act + k act e ∆G y M act (e ∆G act − 1) + k KP M act e −∆G y ∆ (k 1 λ + + k act (k KP − k 1 )) (λ + − k act ) 2 λ N+1 Λ − N (y, x) = k pol e −∆G pol e −∆G y ∆ (k 1 λ + + k act (k KP − k 1 )) λ N + − (k 1 λ − + k act (k KP − k 1 )) λ N − , where λ ± = 1 2 k act + k KP e −∆G y + k act e ∆G act ± ∆ , (K12) ∆ = k act + k KP e −∆G y + k act e ∆G act 2 − 4(k act ) 2 e ∆G act .
From eqns. K9, K10 we may write the stall condition. Noting that, Λ + (y, x) is independent of ∆G pol and Λ − (y, x) is proportional to e −∆G pol , we may write the stall point as Γ(N) = − ln Λ + N (r, r) e ∆G pol Λ − N (r, r) such that the dependence on ∆G pol in the logarithm is cancelled out.