On the Taylor expansion of $\lambda$-terms and the groupoid structure of their rigid approximants

We show that the normal form of the Taylor expansion of a $\lambda$-term is isomorphic to its B\"ohm tree, improving Ehrhard and Regnier's original proof along three independent directions. First, we simplify the final step of the proof by following the left reduction strategy directly in the resource calculus, avoiding to introduce an abstract machine ad hoc. We also introduce a groupoid of permutations of copies of arguments in a rigid variant of the resource calculus, and relate the coefficients of Taylor expansion with this structure, while Ehrhard and Regnier worked with groups of permutations of occurrences of variables. Finally, we extend all the results to a nondeterministic setting: by contrast with previous attempts, we show that the uniformity property that was crucial in Ehrhard and Regnier's approach can be preserved in this setting.

1. Introduction 1.1. Quantitative semantics. The field of quantitative semantics, in the sense originally introduced by Girard [Gir88], is currently very lively within the linear logic community and beyond. The basic idea is to interpret λ-terms as generalized power series, associated with analytic maps -instead of continuous maps, à la Scott. The concept predates linear logic, and in fact it provided the foundations for it, via its simpler, qualitative counterpart: coherence spaces [Gir87]. It was later revisited, e.g. by Lamarche [Lam92] and Hasegawa [Has02], to provide a denotational interpretation of linear logic proofs as matrices; but the current momentum originates in the more recent introduction by Ehrhard [Ehr05] of models of linear logic, based on a particular class of topological vector spaces, and thus accommodating differentiation.
In that setting, the analytic maps associated with λ-terms are also smooth maps, i.e. they are infinitely differentiable. This led to the differential extensions of λ-calculus [ER03] and linear logic [ER06b] by Ehrhard and Regnier. The keystone of this line of work is an analogue of the Taylor expansion formula, which allows to translate terms (or proofs) into infinite linear combinations of finite approximants [ER08]: in the case of λ-calculus, those approximants are the terms of a resource calculus, in which the copies of arguments of a function must be provided explicitly, and then consumed linearly, instead of duplicated or discarded during reduction.
This renewed approach to quantitative semantics served as the basis of a considerable amount of recent work: either as a framework for denotational models accommodating linear combinations of maps [LMMP13,Lai16,TAO17,Ong17,etc.], possibly in contexts where sums are constrained to a particular form, such as the probabilistic setting [DE11, TAO18,etc.]; or as a tool for characterizing computational properties of programs via those of their approximants [MP11, PTV16a, LL19, BM20,etc.].
Indeed, by contrast with denotational semantics, resource approximants retain a dynamics, albeit very simple and finitary: the size of terms is strictly decreasing under reduction. The seminal result relating the reduction of λ-terms with that of their approximants is the commutation between Taylor expansion and normalization: Ehrhard and Regnier have shown that the Taylor expansion M * of a λ-term M can always be normalized, and that its normal form is nothing but the Taylor expansion of the Böhm tree BT (M ) of M [ER08,ER06a]. In particular, the normal form of Taylor expansion defines a proper denotational semantics. Step 4: If s is uniform, i.e. s¨s, and t is in the support of N F (s) (the normal form of s, which is a finite sum of resource terms) then m(t) divides m(s) and the coefficient of t in N F (s) is m(s) m(t) .
Step 5: By Step 1, BT (M ) * = t∈T (BT (M )) 1 m(t) t. To deduce the identity BT (M ) * = NF (M * ) from the previous results, it is then sufficient to prove that t ∈ T (BT (M )) iff there exists s ∈ T (M ) such that t is in the support of N F (s). The first two steps are easy consequences of the definitions. For Step 3, it is sufficient to follow a well chosen normalization strategy, and check that it preserves coherence and that if two coherent terms share a reduct then they are equal [ER08, Section 3].
Step 4 relies on a careful investigation of the combinatorics of substitution in the resource calculus: this involves an elaborate argument about the structure of particular subgroups of the group of permutations of variable occurrences [ER08,Section 4]. Finally, Ehrhard and Regnier establish Step 5 by relating Taylor expansion with execution in an abstract machine [ER06a].
In the present work, we propose to revisit this seminal result, along three directions. (i) We largely simplify Step 5, relying on a technique introduced by the second author [Vau17]. We consider the hereditary head reduction strategy (a slight variant of Vol. 18:1 TAYLOR EXP. OF λ-TERMS AND THE GROUPOID OF RIGID APPROXIMANTS 1:3 leftmost reduction, underlying the construction of Böhm trees) and show that it can be simulated directly in the resource calculus, through Taylor expansion. We thus avoid the intricacies of an abstract machine with resource state. (ii) We extend all the results to a model of nondeterminism, introduced as a formal binary choice operator in the calculus. By contrast with previous proposals to nondeterminism from Ehrhard [Ehr10], or Pagani, Tasson and Vaux Auclair [PTV16b,Vau17], we show that uniformity can still be relied upon, provided one keeps track of choices in the resource calculus: the coherence associated with nondeterministic choice is then that of the with connective (&) of linear logic. (iii) We analyse coefficients in the Taylor expansion by introducing a groupoid whose objects are rigid resource terms, i.e. resource terms in which multisets of arguments are replaced with lists, and whose isomorphisms are permutation terms, i.e. terms equipped with permutations that act on lists of arguments. This is more in accordance with the intuition that m(s) is the number of permutations of arguments that leave s (or rather, any rigid representation of s) invariant: Ehrhard and Regnier rather worked on permutations of variable occurrences, which allowed them to consider groups rather than a groupoid.
Although we implement all three contributions together, they are essentially independent of each other. Indeed, the simplification of Step 5 brought by our contribution (i) only concerns the compatibility of Taylor expansion with normalization at the level of support sets, which does not involve coefficients; and it does not rely on uniformity, so its extension to nondeterministic superpositions is straightforward. Moreover, while our contribution (ii) enables us to enforce the uniformity condition of Steps 2 to 4 in presence of a choice operator, it also ensures that distinct branches of a choice have disjoint supports in the Taylor expansion. This treatment of nondeterminism makes it completely transparent in the computation of coefficients. In particular, one could straightforwardly extend all steps of Ehrhard and Regnier's proof in this setting, ceterit paribus.
Our contribution (iii) is thus not needed for that endeavour: it only offers an alternative viewpoint on the combinatorics of substitution and normalization in the resource calculus, in a uniform setting. Nonetheless, we consider it to be the main contribution of the paper, precisely because of the new light it sheds on this dynamics, which in turn reveals possible connections with other approaches.
1.3. Scope and related works. Our contribution (i) establishes that, although it is interesting in itself, Ehrhard and Regnier's study of the relationship between elements in the Taylor expansion of a term and its execution in an abstract machine is essentially superfluous for proving the commutation theorem.
Barbarossa and Manzonetto have independently proposed another technique which amounts to show that any reduction from an element of T (M ) can be completed into a sequence of reductions simulating a β-reduction step [BM20, Section 4.1]. The strength of our own proposal is that, rather than a mere simulation result, we establish a commutation on the nose: hereditary head reduction commutes with Taylor expansion, at the level of supports. Moreover, the Böhm tree of a λ-term is the limit of its hereditary head reducts, which ensures that this commutation extends to normalization (Step 5). The same path was followed by Dal Lago and Leventis [LL19] for the probabilistic case. Let us mention that the commutation with hereditary head reduction actually holds not only at the level of supports, but also taking coefficients into account [Vau17], in the more general setting of the algebraic λ-calculus [Vau09] and without any additional condition: then, whenever the convergence of the sum defining the normal form of Taylor expansion is assured, the main commutation theorem ensues directly. This offers an alternative to the method of Ehrhard and Regnier that is the focus of the present paper.
As stated before, our proposal (ii) to restore uniformity in a nondeterministic setting is valid only because the resource calculus keeps a syntactic track of choices. The corresponding constructors are exactly those used by Tsukada, Asada and Ong [TAO17] who were interested in identifying equivalent execution paths of nondeterministic programs, but those authors do not mention, nor rely upon any coherence property: this forbids Steps 1 to 4 and, instead, they depend on infinite sums of arbitrary coefficients to be well defined. By contrast, Dal Lago and Leventis have independently proposed nearly the same solution as ours [LL19, Section 2.2], with only a minor technical difference in the case of sums.
The previous two proposals (i) and (ii) may be considered as purely technical improvements of the state of the art in the study of Taylor expansion. What we deem to be the most meaningful contribution of the present paper is our study of the groupoid of rigid resource terms. This provides us with a new understanding of the coefficients in the Taylor expansion of a term, in which we can recast the proof of the commutation theorem, especially Step 4: apart from this change of focus, the general architecture of our approach does not depart much from that of Ehrhard and Regnier, but we believe the obtained combinatorial results are closer to the original intuition behind the definition of m. In fact, a notable intermediate result (Lemma 5.11, p.24) is that the function that maps each permutation term to the permutation it induces on the occurrences of a fixed variable is functorial: one might understand Ehrhard and Regnier's proof of Step 4 as the image of ours through that functor. Moreover, our study suggests interesting connections with otherwise independent approaches to denotational semantics based on generalized species of structures [FGHW08,TAO17] and rigid intersection type systems [MPV18].
It is indeed most natural to compare our proposals to the line of work of Tsukada, Asada and Ong [TAO17,TAO18]. On the one hand, Tsukada et al. thrive to develop an abstract understanding of reduction paths in a nondeterministic λ-calculus. They are led to consider a polyadic calculus à la Mazza [Maz12,MPV18] with syntactic markers for nondeterministic choice, moreover obeying linearity, typing and η-expansion constraints: in particular, in that polyadic setting, λ-abstractions bind lists of variables, each bound variable occurring exactly once. Then, to each simple type, they associate a groupoid of intersection types: an isomorphism in this groupoid acts on polyadic rigid terms by permuting variables bound in abstractions and lists of arguments in applications, in such a way that terms in its source intersection type yield terms in its target. They show that the obtained collection of groupoids form a bicategorical model of the simply typed λY-calculus, the interpretation being given by a polyadic rigid variant of Taylor expansion. This interpretation is moreover isomorphic to the one obtained in generalized species of structures [FGHW08].
On the other hand, our contribution (ii) shows that Ehrhard and Regnier's technique can already be adapted to the same kind of nondeterminism as the one considered by Tsukada et al., without introducing any new concept. Also, besides having markers for nondeterministic choice, the only difference between our rigid terms and the ordinary resource terms is that arguments are linearly ordered: we do not consider a polyadic version. In fact, the same rigid terms were already used by Tsukada  A natural follow-up to the present work would thus be to explore possible variations on our groupoid of permutation terms, and in particular adapt it to a polyadic setting, also taking free variables into account. We expect this study to yield a bicategorical model of the pure, untyped λ-calculus, similarly induced by rigid Taylor expansion à la Tsukada-Asada-Ong. Then potential connexions between the obtained model and the construction of various reflexive objects in the bicategory of generalized species of structures [FGHW08, Section 6.2] should be investigated.
Another possible route to the untyped setting, actively developed by the first author, is to construct a category satisfying a domain-like equation in the model of generalized species [Oli20]. The objects in this category are very much like intersection types, except that the usual identities between types (commutativity and, possibly, idempotency) are made explicit as morphisms, which allows to develop a bicategorical treatment of intersection type systems.
1.4. Structure of the paper. In the very brief Section 2, we review some results from group theory that will be useful later.
In Section 3 we extend the ordinary untyped λ-calculus with a generic nondeterministic choice operator, and present its operational semantics, inspired from that of the algebraic λ-calculus, as well as the corresponding notion of (non extensional) Böhm trees.
Section 4 recalls and adapts the definitions of the resource calculus and Taylor expansion. We obtain Step 2 as a straightforward consequence of the definitions and Step 5 by showing that the support of Taylor expansion is compatible with hereditary head reduction -this is our contribution (i). We moreover complete Step 1, making prominent the rôle played by permutations acting on lists of resource terms.
Section 5 is the core of the paper, developing our main contribution (iii): we introduce the rigid version of resource terms, and the isomorphisms between them, given by permutation terms; then we explore the relationship between the groupoid thus formed and the combinatorics of Taylor expansion. We first show that the coefficient m(s) is nothing but the cardinality of the group of automorphisms of any rigid version of s. Then we study the structure of permutation terms between substitutions, first in the general case, then in the uniform case -which is allowed in our nondeterministic setting thanks to our contribution (ii). We leverage the obtained results to determine the coefficient of any resource term in the symmetric multilinear substitution associated with a reduction step issued from a uniform redex.
The final Section 6 builds on the study of rigid resource terms and permutation terms to achieve Steps 3 and 4. We conclude the paper with the commutation theorem.

Some basic facts on groups and group actions
Let G be a group, X be a set, and write (g, a) ∈ G × X → [g]a ∈ X for a left action of G on X. If a ∈ X, then the stabilizer of a under this action is St(a) := {g ∈ G | [g]a = a}, which is a subgroup of G (also called the isotropy group of a); and the orbit of a is the set [G]a := {[g]a | g ∈ G} ⊆ X. If H, K ⊆ G, we write HK : Observe that neither the definition of terms nor that of reduction make the choice operator commutative, associative nor idempotent: e.g., x ⊕ y and y ⊕ x are two distinct normal forms. It is possible to extend the reduction relation to validate the structural properties associated with various kinds of superpositions (plain nondeterministic choice, probabilistic choice or a more general quantitative superposition) while retaining good rewriting properties: we refer the reader to the work of Leventis [Lev19] for an extensive study of this approach.
By contrast, for our purposes, it is essential to keep ⊕ as a free binary operator: following Tsukada, Asada and Ong [TAO17], we keep track of the branching structure of choices along the reduction. This information will be reflected in the Taylor expansion to be introduced in Section 4: this is the key to recover the uniformity property while allowing for nondeterministic superpositions of terms.
In fact we will not really consider the reduction relation → in the present paper, and rather focus on the hereditary head reduction strategy obtained by defining the function L : Λ ⊕ → Λ ⊕ inductively as follows: Observe that this definition is exhaustive because any term in Λ ⊕ is either of the form M ⊕ N or of the form λ x.λy.(M ⊕ N ) or of the form λ x.RQ 1 · · · Q k with R = (λy.M )N or R = (M ⊕ N )P or R = y. 2 In fact, only the rule (M ⊕N )P → M P ⊕N P is really necessary in order to enable the potential redexes that can occur if M or N is an abstraction: in the setting of quantitative semantics, term application is left-linear. The other reduction rule can be derived in case one admits extensionality in the models or the η-rule in the calculus (here we don't, though): having it in the calculus means that we follow a call-by-name interpretation of nondeterministic evaluation, which amounts to λ-abstraction being linear [ADCP + 14]. The results of the paper could be developed similarly without it. We chose to keep it nonetheless, because it simplifies the underlying theory of Böhm trees and allows us to obtain Ehrhard and Regnier's results [ER08,ER06a] as a particular case of our own. It should be clear that M → * L(M ) and that L(M ) = M whenever M is normal 3 but the converse does not necessarily hold. It can moreover be shown that any normalizable term M reaches its normal form by repeatedly applying the function L, for instance by adapting the standardization techniques of Leventis [Lev16,Lev19], but this is not the focus of the present paper. Indeed, we are only interested in the construction of Böhm trees, and we rely on the fact that the Böhm tree of a term M can be understood as the limit of the sequence (L n (M )) n∈N , in a sense that we detail below. In particular, M and L(M ) have the same Böhm tree (Lemma 3.3).

Böhm trees.
We first define the set Λ ⊥ ⊕ of term approximants as follows: then we consider the least partial order ≤ ⊆ Λ ⊥ ⊕ × Λ ⊥ ⊕ that is compatible with syntactic constructs and such that ⊥ ≤ M for each M ∈ Λ ⊥ ⊕ . Formally, ≤ is defined inductively by the rules of Figure 2.
The set N ⊂ Λ ⊥ ⊕ of elementary Böhm trees is the least set of approximants such that: • λ x.xN 1 · · · N n ∈ N as soon as N 1 , . . . , N n ∈ N ; 4 and • N 1 ⊕ N 2 ∈ N as soon as N 1 , N 2 ∈ N . For each λ ⊕ -term M , we construct an elementary Böhm tree N (M ) as follows: in all other cases.
Hence for a fixed λ ⊕ -term M , the sequence (N (L n (M ))) n∈N is increasing, and we call its downwards closure in N the Böhm tree of M , which we denote by BT (M ): i.e. we set BT (M ) := {N ∈ N | ∃n ∈ N, N ≤ N (L n (M ))}.
3 If one considers ⊕ as a nondeterministic choice operator, normalizability is meant in its must flavour here. Indeed, we do not perform the choice within the reduction relation itself, so M ⊕ N is normal iff M and N both are. 4 Here the sequence λ x of abstractions can be empty, and we can have n = 0, in which case the body of the term is just the head variable.
It could be shown that Böhm trees define a denotational semantics: if M → M then BT (M ) = BT (M ). 5 Here we just observe that Böhm trees are invariant under hereditary head reduction, which follows directly from the definition: It will be sufficient to follow this strategy in order to establish Step 5, i.e. the qualitative version of the commutation between normalization and the Taylor expansion of λ ⊕ -terms, to be defined in the next section.

Taylor expansion in a uniform nondeterministic setting
In order to define Taylor expansion, we need to introduce an auxiliary language: the resource calculus.
4.1. Resource terms. We call resource expressions the elements of ∆ ⊕ ∪ ∆ ! ⊕ , where the set ∆ ⊕ of resource terms and the set ∆ ! ⊕ of resource monomials are defined by mutual induction as follows: 6 and, in addition to α-equivalence, we consider resource expressions up to permutations of terms in monomials, so that [s 1 , . . . , s n ] denotes a multiset of terms. We give precedence to application and abstraction over − ⊕ • and • ⊕ −, and we write s t 1 · · ·t n for · · · s t 1 · · · t n , so that we may write λx. s tū ⊕ • for (λx.( s t ū)) ⊕ •. We write λ x.s for a term of the form λx 1 . · · · λx n .s. We moreover writes ·t for the multiset union ofs andt, and ifs = [s 1 , . . . , s n ] then we write |s| := n for the size ofs; in particular |s| = 0 iffs is the empty multiset [], which is neutral for multiset union. If X is a set, we write N[X] for the freely generated commutative monoid over X: formally, this is the same as the set of finite multisets of elements of X but we choose to consider its elements as finite linear combinations of elements of X with coefficients in N. In the following, we write ∆ : when we consider a sum E of resource expressions, we always require E to be a sum of terms or a sum of monomials, ⊕ for the support set of E, which is finite. We extend the syntactic constructs of the resource calculus to finite sums of resource expressions by linearity, so that: 5 Again, this would require the adaptation of standardization techniques to λ⊕, similar to those developed by Leventis for the probabilistic λ-calculus [Lev19]. 6 Recall that the cartesian product of vector spaces is given by the disjoint union of bases: this is the intuition behind the operators − ⊕ • and • ⊕ −, which will serve in the Taylor expansion of the operator ⊕ of Λ⊕. Again, we leave the exact computational behavior of ⊕ unspecified, and we treat it generically as a pairing operator (without projections): in this we follow Tsukada et al. [TAO17]. ⊕ ] ofū for the variable x in e, which is informally defined as follows: Formally, ∂ x e ·ū is defined by induction on e, setting: where Q k (n) denotes the set of k-tuples (I 1 , . . . , I k ) of (possibly empty) pairwise disjoint subsets of {1, . . . , n} such that k j=1 I j = {1, . . . , n}, 8 and we writeū {i 1 ,...,i j } : The reduction of the resource calculus is the relation from resource expressions to finite formal sums of resource expressions induced by the rules of Figure 3: the first rule is the counterpart of β-reduction in the resource calculus; the next four rules implement the commutation of ⊕ with abstraction and application to a monomial; the final six rules ensure 7 Enumerating the occurrences of x in e only makes sense if we fix an ordering of each monomial in e: the rigid resource calculus to be introduced later in the paper will allow us to give a more formal account of this intuitive presentation. For now we stick to the alternative definition given in the next paragraph.
8 Note that this data is equivalent to a function {1, . . . , n} → {1, . . . , k}. ⊕ ] by setting e + F → ∂ E + F whenever e → ∂ E . As in the case of the original resource calculus [ER08], the reduction relation → ∂ is confluent and strongly normalizing. Confluence may be proved following the same technique as for the original resource calculus [Vau17, Section 3.4]: we do not provide any detail, because we will soon focus on a reduction strategy, which is functional. For strong normalization, slightly more care is needed, because the size of expressions does not necessarily decrease under reduction: ⊕ , we write n λ (e) ∈ N (resp. n ⊕ (e) ∈ N) for the number of abstractions (resp. of ⊕) occurring in e. Let # ⊕ (e) denote the multiset of natural numbers containing a value n ⊕ (s) for each occurrence of a subterm λx.s or s t in e. Formally: where we use the same notations for multisets as for monomials. We first establish that, for all e ∈ ∆ (!) ⊕ ,t ∈ ∆ ! ⊕ and e ∈ supp(∂ x e ·t), we have n λ (e ) = n λ (e) − 1: the proof is by a straightforward induction on e.
We write NF (E) for the unique normal form of E ∈ N[∆ (!) ⊕ ], which is a linear operator: As stated before, we do not focus on the reduction relation itself, and we rather consider the hereditary head reduction strategy obtained by defining the function L : ∆ L(λ x. λy.s tū 1 · · ·ū k ) := λ x. ∂ y s ·t ū 1 · · ·ū k extended to sums of resource expressions by linearity, setting L( k i=1 e i ) := k i=1 L(e i ). Again, it should be clear that e → * ∂ L(e): if e contains a redex (i.e. the left-hand side of any of the first five rules of Figure 3) in head position, then L(e) is obtained by firing this redex; otherwise each term in a monomial argument of the head variable is reduced, following the same strategy inductively. Moreover, e = L(e) iff e is normal: we obtain an equivalence because → ∂ is strongly normalizing on sums of resource expressions and, if e is not normal, L(e) is obtained by firing at least one redex in e.
Due to the definition of → ∂ on sums and the linearity of L, these properties extend directly: it is a sum of normal expressions). It moreover follows that L is normalizing:

4.2.
Taylor expansion of λ ⊕ -terms. The Taylor expansion of a λ ⊕ -term will be an infinite linear combination of resource terms: to introduce it, we first need some preliminary notations and results.
If X is a set, we write Q + X for the set of possibly infinite linear combinations of elements of X with non negative rational coefficients (in fact we could use any commutative semifield): equivalently, Q + X is the set of functions from X to the set of non negative rational numbers. We write A = a∈X A a a ∈ Q + X and then the support set of A is All the syntactic constructs of resource expressions are extended to infinite linear combinations, componentwise: • and if S 1 , . . . , S n ∈ Q + ∆ ⊕ then Observe indeed that each of these infinite sums is finite in each component: e.g., for each s ∈ ∆ ! ⊕ , there are finitely many tuples (s 1 , . . . , s n ) ∈ ∆ n ⊕ such thats = [s 1 , . . . , s n ]. Similarly we extend syntactic constructs to sets of resource expressions: • and if S 1 , . . . , S n ⊆ ∆ ⊕ then Let S ∈ Q + ∆ ⊕ . We define S n ∈ Q + ∆ ! ⊕ by induction on n: S 0 = [] and S n+1 = [S]·S n . Then we define the promotion of S as the series S ! = ∞ n=0 1 n! S n : because the supports of S n and S p are disjoint when n = p, this sum is componentwise finite. If S ⊆ ∆ ⊕ is a set of terms, we may also write S ! = {[s 1 , . . . , s n ] | s 1 , . . . , s n ∈ S} for the set of monomials of terms in S, so that supp(S ! ) = supp(S) ! for any S ∈ Q + ∆ ⊕ .
We define the Taylor expansion M * ∈ Q + ∆ ⊕ of M ∈ Λ ⊕ inductively as follows: Note that this definition follows the one for the ordinary λ-calculus given by Ehrhard and Regnier [ER08], in the form described in their Lemma 18. We extend it to ⊕ by encoding the pair of vectors (P * , Q * ) as the sum vector (P * ⊕ •) + (• ⊕ Q * ). 9 Example 4.2. We have ( Observe that the relation¨is automatically symmetric, but not reflexive: e.g., [s, t] [ s, t] when s ¨t. We say a resource expression e is uniform if e¨e, so that uniform 9 Note that the original notion of Taylor expansion for nondeterministic λ-terms (considered as algebraic λ-terms without coefficients) interprets nondeterministic choice directly as a sum, setting (M ⊕ N ) * = M * + N * [Ehr10, PTV16b,Vau17]. Following Tsukada, Asada and Ong [TAO17], we can recover this notion, by erasing the markers − ⊕ • and • ⊕ −, with one caveat: in general, this might yield infinite sums of coefficients, because a single resource term without markers may be obtained from infinitely many terms with markers. Define for instance x ⊕ n• by analogy with Example 3.2: x ⊕ 0• = x and x ⊕ (n + 1)• = (x ⊕ n•) ⊕ •. Then forgetting markers in the sum ∞ i=0 x ⊕ n• yields ∞ i=0 x. And it turns out that normalizing the Taylor expansion of nondeterministic terms does yield such sums: see Example 4.6. expressions form a coherence space in the usual sense. 10 We call clique any set E of resource expressions such that e¨e for all e, e ∈ E. In particular, the elements of a clique are necessarily uniform.
We obtain the expected result by a straightforward induction on λ ⊕ -terms: Given any set X and n ∈ N, we consider the left action of the group S n of all permutations of {1, . . . , n} on the set X n of n-tuples, defined as follows: if a = (a 1 , . . . , a n ) and σ ∈ S n then [σ] a = (a σ −1 (1) , . . . , a σ −1 (n) ). Writing [σ] a = (a 1 , . . . , a n ), we obtain a σ(i) = a i . Let us recall that if a ∈ X n , then the stabilizer of a is St( a) = {σ ∈ S n | [σ] a = a}.
If s = (s 1 , . . . , s n ) ∈ ∆ n ⊕ and S ∈ Q + ∆ ⊕ , we write S s = n i=1 S s i : observe that this does not depend on the ordering of the s i 's, so ifs = [s 1 , . . . , s n ] ∈ ∆ ! ⊕ , we may as well write Ss = S (s 1 ,...,sn) . We obtain:  Proof. The only interesting case is that of an application: M = P Q. Assume s ∈ T (M ); then ) by Lemma 4.4. By the induction hypothesis applied to P and Q, we obtain 1/P * u = m(u) and 1/Q We can as well obtain Step 4 following Ehrhard and Regnier's study of permutations of variables occurrences, but here we choose to depart from their approach. At this point, indeed, we hope the reader will share our opinion that the combinatorics of Taylor expansion is more intimately connected with the action of permutations on the enumerations of monomials occurring in resource expressions.
In the upcoming Section 5, we propose to flesh out this viewpoint, and to recast resource expressions as equivalence classes of their rigid (i.e. non-commutative) representatives, up to the isomorphisms of a groupoid of permutation terms inductively defined on the syntactic structure.
The other remaining Steps 3 and 5 are purely qualitative properties of the Taylor support. We choose to treat also Step 3 in the rigid setting, to be introduced later, because it is essentially a property of rigid reduction. On the other hand, the commutation of Step 5 can be established directly.
We shall achieve Step 5 by showing that the parallel left strategy in Λ ⊕ can be simulated in the support of Taylor expansion, and that T (BT (M )) is formed by accumulating the normal forms reached from T (M ) by this strategy.
First, we extend the operations ∂ x − ·−, L(−) and NF (−) to sets of resource expressions in the following way:   Conversely, if s ∈ T (M ) and s is normal, then either M = N ⊕ P and s = t ⊕ • or s = • ⊕ u with t ∈ T (N ) or u ∈ T (P ); or M = λ x.xQ 1 · · · Q k and s = λ x. x q 1 · · ·q k withq i ∈ T (Q i ) ! for 1 ≤ i ≤ k. We obtain inductively t ∈ T (N (N )) or u ∈ T (N (P )) or q i ∈ T (N (Q i )) ! for 1 ≤ i ≤ k, and then s ∈ T (N (M )).
Step 5 then follows, using the fact that BT (M ) is the downwards closure of {N (L n (M )) | n ∈ N}: Theorem 4.10 (Step 5). Let M ∈ Λ ⊕ . Then T (BT (M )) = NF (T (M )). 11 In contrast with the case of syntactic constructors in Section 4.2, extending these operations to infinite linear combinations rather than sets requires some work.
In the case of ∂x − ·−, we can show that each expression e is in the support of finitely many sums of the shape ∂xe ·t, by observing that the size of the antecedents e andt is at most that of e [Vau17, Lemma 3.7]. Then one can exploit the fact that the redexes fired in the reduction from e to L(e) are pairwise independent, to deduce that each e is in the support of finitely many sums of the shape L(e): this is a particular case of a result established by the second author for parallel reduction [Vau17, Section 6.2].
The case of NF (−) is even more intricate because, given an infinite linear combination S of resource terms, the sum s∈∆ ⊕ SsNF (s) is not well defined in general -indeed, it is easy to find an infinite family of resource terms, all having the same nonzero normal form. Uniformity is one solution to this issue: if the support of S is a clique then the summands NF (s) for s ∈ supp(S) have pairwise disjoint supports. This result is the main ingredient of Step 3: it will be our Theorem 6.8 below. For a survey of alternative approaches we refer to the study of this subject by the second author [Vau17]. a 1 t 1 · · · a n t n (a 1 , . . . , a n ) [t 1 , . . . , t n ] , and then by Lemma 4.8 t ∈ T (N (L n (M ))). By Lemma 4.9, t is normal and t ∈ T (L n (M )). By Lemma 4.7, t ∈ L n (T (M )), hence there exists s ∈ T (M ) such that t ∈ supp(L n (s)). Since t is normal, t ∈ supp(NF (s)).
(⊇) If t ∈ NF (T (M )) we can fix s ∈ T (M ) such that t ∈ supp(NF (s)). Then there exists n ∈ N such that NF (s) = L n (s), hence t ∈ s∈T (M ) supp(L n (s)) = L n (T (M )). By Lemma 4.7, t ∈ T (L n (M )) and since t is normal, Lemma 4.9 entails that t ∈ T (N (L n (M ))). Rigid resource terms are considered up to renaming of bound variables: the only difference with resource terms is that rigid monomials are ordered lists rather than finite multisets. We write |(a 1 , . . . , a n )| := n, and (a 1 , . . . , a n ) :: (a n+1 , . . . , a n+m ) := (a 1 , . . . , a n+m ). We write D (!) for either D or D ! and call rigid resource expression any rigid term or rigid monomial. Again, for any r ∈ D (!) , we write n x (r) for the number of free occurrences of the variable x in r, and we use notations and priority conventions similar to those for non rigid expressions: e.g., we may write λ x. a b c ⊕ • for (λx 1 . . . . .λx n .( a b c)) ⊕ •.
As we have already stated, rigid resource expressions are nothing but resource expressions for which the order of terms in monomials matter. To make this connexion formal, consider the representation relation ⊆ D (!) × ∆ ⊕ has at least one rigid representation r e. Moreover observe that, if a t and | a| = n then for any σ ∈ S n , [σ] a t , i.e. [σ] a = a .
We say ∈ D (!) maps r ∈ D (!) to r ∈ D (!) if the statement : r ∼ = r is derivable from the rules of Figure 6. We then write r ∼ = r if there exists some ∈ D (!) such that : r ∼ = r . As a direct consequence of the definitions, we obtain that ∼ = is nothing but the equivalence kernel of the function r ∈ D (!) → r ∈ ∆ (!) ⊕ : The equivalence classes for ∼ = are thus exactly the sets of rigid representations of each resource expression. We can moreover organize the permutation expressions witnessing this equivalence relation into a groupoid, whose objects are resource expressions. Observe indeed that, for each ∈ D (!) there is exactly one pair (r, r ) of rigid expressions such that : r ∼ = r . Given r, r ∈ D (!) , the set of morphisms from r to r is then D (!) (r, r ) = { | : r ∼ = r }. The composition ∈ D (!) (r, r ) of ∈ D (!) (r, r ) and ∈ D (!) (r , r ) is defined by induction on the syntax of rigid resource expressions in the obvious way: the only interesting case is that of permutation monomials, for which we set (σ , α 1 , . . . , α n )(σ, α 1 , . . . , α n ) := (σ σ, α σ(1) α 1 , . . . , α σ(n) α n ). And the identity id r on r is the same as r, with each variable occurrence x replaced with id x , and with the identity permutation attached with each monomial. Inverses are also defined inductively, the key case of monomials being: (σ, α 1 , . . . , α n ) −1 : = (a 1 , . . . , a n ) and a = (a 1 , . . . , a n ), we set D( a, a ) := n i=1 D(a i , a i ): with rigid monomials as objects, we obtain a groupoid D, which is the free strict monoidal category over D. Moreover, D ! ( a, a ) = σ∈Sn D( a, [σ −1 ] a ): D ! is the free symmetric strict monoidal category over D. We call quasi-stabilizer of a the subgroup of S n defined by Observe that St∼ = ( a) = St(( a 1 , . . . , a n )) and σ ∈ St∼ = ( a) iff D( a, Proof. Since D (!) is a groupoid, for any morphism : r ∼ = r , postcomposition by defines a bijection from D (!) (r) to D (!) (r, r ). It follows that D ! ( a) = σ∈Sn D( a, D( a). We are then able to formalize the interpretation of the multiplicity of a resource term s as the number of permutations of monomials in s leaving any of its writings a s unchanged:

Rigid substitution.
For any r ∈ D (!) and b ∈ D ! such that | b| = n x (r) = n, we define the n-linear substitution r[ b/x] of b for x in r inductively as follows: (a 1 , . . . , a n )[ b 1 :: · · · :: b n /x] := (a 1 [ b 1 /x], . . . , a n [ b n /x]}) where we assume that Observe that this substitution is only partially defined. In order to deal with the general case, we will use the nullary sum of rigid expressions 0 ∈ N[D (!) ]: again, we consider all the syntactic constructs to be linear so that we may write, e.g., λx.a for a ∈ D ∪ {0} with λx.0 = 0. We call partial rigid expressions the elements of D (!) ∪ {0}: we generally use the same typographic conventions for partial expressions as for regular ones. To prove that this coincides with the inductive definition of ∂ x e ·ū, we need to study how the elements of b are routed to subexpressions of r in the substitution r For this, we will rely on the following constructions on permutations. First, if σ ∈ S n and τ ∈ S p , we define the concatenation σ ⊗ τ ∈ S n+p by: and (σ ⊗ τ )(n + j) := n + τ (j) for 1 ≤ i ≤ n and 1 ≤ j ≤ p. This operation is associative and, more generally, we obtain τ 1 ⊗ · · · ⊗ τ n ∈ S k 1 +···+kn whenever τ 1 ∈ S k 1 , . . . , τ n ∈ S kn . The tensor product notation is justified since, in the category P of natural numbers and permutations, the concatenation of permutations defines a tensor product (which is the sum of natural numbers on objects). Moreover, for each (I 1 , . . . , I n ) ∈ Q n (k), writing I j = {i j 1 , . . . , i j k j } with i j 1 < · · · < i j k j , we set γ I 1 ,...,In (i j l ) := l + j−1 r=1 k r : then γ I 1 ,...,In is the unique permutation γ ∈ S k such that the map (j, l) → γ(i j l ) is strictly increasing, considering the lexicographic order on pairs. Given a weak n-composition of k, i.e. a tuple (k 1 , . . . , k n ) ∈ N n such that k = n j=1 k j , we write Q k 1 ,...,kn n (k) for the set of those (I 1 , . . . , I n ) ∈ Q n (k) such that Card (I i ) = k i for 1 ≤ i ≤ n. We obtain: Lemma 5.4. For any weak n-composition (k 1 , . . . , k n ) of k, the function Q k 1 ,...,kn n (k) × n j=1 S k j → S k ((I 1 , . . . , I n ), (σ 1 , . . . , σ n )) → (σ 1 ⊗ · · · ⊗ σ n )γ I 1 ,...,In is bijective.
Now we can show that the two definitions of symmetric multilinear substitution coincide: Lemma 5.5. If r e and b t then n x (r) = n x (e) and | b| = |t|.
Proof. The first two identities follow directly from the definitions. If n x (r) = | b| then both sides of the third identity are 0. Otherwise, it is proved by induction on r.
Let us treat the case of a monomial: write r = (a 1 , . . . , a n ) and e = [s 1 , . . . , s n ] with a i s i for 1 ≤ i ≤ n. Then [∂ x s 1 ·t I 1 , . . . , ∂ x s n ·t In ] where we write k i = n x (s i ) for 1 ≤ i ≤ n. Informally, everything thus works out as if [s 1 , . . . , s n ] = σ∈Sn (s 1 , . . . , s n ), which is to be related with the 1 n! coefficient in the Taylor expansion, cancelling out the cardinality of S n . Forgetting about coefficients, we obtain: Corollary 5.6. If r e and b t with n x (e) = |t|, then supp(∂ Conversely, any rigid representative of a symmetric substitution is obtained as a rigid substitution: Lemma 5.7. If r e ∈ supp(∂ x e ·t) then n x (e) = |t| and there exist r e and b t such that r = r[ b/x].
Proof. By induction on e. If e = x thent = [t] for some t ∈ ∆ ⊕ and e = t. If r e = t then we can set r = x and b = (r ). If e = y = x thent = [] and we can set r = y and b = (). The abstraction and sum cases follow immediately from the induction hypothesis.
Then e = s v with s ∈ supp(∂ x s ·t I 1 ) andv ∈ supp(∂ xv ·t I 2 ) for some (I 1 , I 2 ) ∈ Q 2 (n). It follows that r = a d with a s and d v . By induction hypothesis, we obtain c 1 s, Then we conclude by setting r = c 1 c 2 s v = e and b = b 1 :: b 2 t I 1 ·t I 2 =t. The case of monomials is similar.

Substitution for permutation expressions. The key intermediate result for
Step 4 is the fact that if e¨e and e ∈ supp(∂ x e ·t) then (∂ x e ·t) e = m(e)m(t) m(e ) : this will be established in Lemma 5.20, which concludes the present section. With that goal in mind, and having characterized m(e) as the cardinality of the group D (!) (r) for any r e, it becomes essential to study how the automorphisms of r e ∈ supp(∂ x e ·t) are related with those of some r e and b t : by Lemma 5.7, we can choose r and b such that r = r[ b/x]. Then it seems natural to consider some form of substitution for permutation expressions, following the structure of rigid substitution.
The action of multiplexed permutations on sequences is as follows: Proof. Again, we detail the proof only in case the result is not obvious from the categorical presentation. Set , we can write p = i−1 j=1 k σ −1 (j) + l with i ∈ {1, . . . , n} and l ∈ {1, . . . , k σ −1 (i) }. Then, by Lemma 5.9, (σ · (τ 1 , . . . , τ n )) −1 (p) = σ −1 (i)−1 j=1 We can now define the restriction x ∈ S nx(r) of ∈ D (!) (r, r ) to the occurrences of x in r, by induction on : where we assume x = y. Intuitively x is the permutation induced by on the occurrences x 1 , . . . , x nx(r) of x in r, taken from left to right.
We recall that P denotes the category of finite cardinals and permutations. For any variable x, we define an application F x from D (!) to P as follows: F x (r) := n x (r) and F x (α) := α x .
Lemma 5.11. F x is a functor from D (!) to P.
In particular, the restriction of F x to the automorphism group of some rigid expression r is a group homomorphism from D (!) (r) to S nx(r) : its image D (!) (r) x is thus a subgroup of S nx(r) . This homomorphism will play a crucial rôle in Section 5.4.
This operator allows us to describe the image of [ β/x] as follows: Proof. By induction on the structure of r. The interesting case is the list case. Assume r = (a 1 , . . . , a n ), r = (a 1 , . . . , a n ), = (σ, α 1 , . . . , α n ) and β = β 1 :: · · · :: β n , with α i : a i ∼ = a σ(i) , b = b 1 :: · · · :: b n , b = b 1 :: · · · :: b n , | β i | = n x (a i ) and . . , α n [ β n /x]). Since α i : a i ∼ = a σ(i) , we obtain We obtain Observe that, in the above example, a ¨ a . Indeed, in the following, we will establish that coherence allows to restore a precise correspondence between the permutation expressions on a substitution r[(b 1 , . . . , b n )/x] and the (1 + n)-tuples of permutation expressions on r and each of the b i 's respectively. It will be useful to consider the coherence relation defined on rigid expressions by the rules of Figure 8, so that r¨r iff r ¨ r . Then we obtain: Lemma 5.15. Let r, r ∈ D (!) and b, b ∈ D ! with | b| = n x (r) and | b | = n x (r ). If r¨r then for all φ ∈ D (!) (r Proof. By induction on the structure of r: the coherence hypothesis r¨r induces that r and r are of the same syntactic nature. If r = x then r = x and we can write b = (b), b = (b ) with φ : b ∼ = b . Then we set = id x and β = (φ). If r = y = x then r = y and φ = id y , and we set = id y and β = (). The abstraction, application and sum cases follow straightforwardly from the induction hypotheses. We detail the list case.
Lemma 5.19. Let r ∈ D (!) and b ∈ D ! with r¨r and | b| = n x (r). Then Proof. Write k = n x (r). We know that St∼ = ( b) and D (!) (r) x are subgroups of S k . Lemma 5.17 and Fact 2.2 entail that Using Lemma 5.18, it will thus be sufficient to prove: Lemma 5.20. Let e ∈ ∆ (!) ⊕ be such that e¨e and lett ∈ ∆ ! ⊕ . If e ∈ supp(∂ x e ·t) then (∂ x e ·t) e = m(e)m(t) m(e ) .
Proof. Let r e and k = n x (e). By Lemma 5.7 there exists r e and b t such that Then, by Lemma 5.5, r, b)). Then we conclude by Lemmas 5.19 and 5.3.

Normalizing the Taylor expansion
In this final section we leverage our results on the groupoid of rigid expressions and permutation expressions in order to achieve Steps 3 and 4. This allows us to complete the proof of commutation between Taylor expansion and normalization.
6.1. Normalizing resource expressions in a uniform setting. Lemma 5.20 is almost sufficient to obtain Step 4, as it fixes the coefficients in a hereditary head reduction step from a uniform expression: Proof. By induction on the structure of e applying Lemma 5.20 in the redex case: observe indeed that if e = λ x. λy.s tū 1 · · ·ū k then e = λ x. v ū 1 · · ·ū k with v ∈ supp(∂ y s ·t), and then (L(e)) e = (∂ y s ·t) v = m(s)m(t) m(v) and we conclude since m(e) m(e ) = m(s)m(t) m(v) . All the other cases follow directly from the induction hypothesis by multilinearity.
To iterate Lemma 6.1 along the reduction sequence to the normal form, we first need to show that uniformity is preserved by L. As before, we prefer to focus on the rigid setting first, and we will only consider the hereditary head reduction defined as follows: L(λ x. a ⊕ • b c 1 · · · c k ) := λ x. a b ⊕ • c 1 · · · c k L(λ x. • ⊕ a b c 1 · · · c k ) := λ x. • ⊕ a b c 1 · · · c k L(λ x. y a 1 · · · a k ) := λ x. y L( a 1 ) · · · L( a k ) L((a 1 , . . . , a k )) := (L(a 1 ), . . . , L(a k )) L(λ x. λy.a b c 1 · · · c k ) := λ x. a[ b/y] c 1 · · · c k 12 Note that the reduction from λx.a b to a[ b/x] is not well behaved in general: its contextual extension is not even confluent, because it forces the order in which variable occurrences are substituted. Consider for instance the term (λx. λy. y (x) (x))(z1, z2) which has two distinct normal forms: z1 z2 and z2 z1. This rigid calculus is thus not very interesting per se, and we only consider it as a tool to analyze the dynamics of the resource calculus. extended to partial rigid expressions by setting L(0) := 0. By an analogue of Lemma 4.1, for any r ∈ D (!) , there exists k ∈ N such that L k (r) is normal, and then we write NF (r) = L k (r). Moreover, r is in normal form iff L(r) = r.
Proof. We first prove that r e ∈ supp(L(e)) iff there exists r e with r = L(r), which gives the first result: this is done by a straightforward induction on the structure of e, using Corollary 5.6 for the β-redex case. Now fix k ∈ N such that NF (e) = L k (e): by iterating the previous result, we obtain r e ∈ supp(NF (e)) iff there exists r e with r = L k (r). Then we conclude, observing that if r e , then r is in normal form iff e is. Proof. By a straightforward induction on the derivation of r¨r .
Proof. The first item is easily established by induction on r, using Lemma 6.3 in the case of a β-redex. Having fixed k such that both NF (r) = L k (r) and NF (r ) = L k (r ), the second item follows by iterating the first one.
We have thus established that L preserves coherence of rigid expressions. It follows that L preserves cliques of resource expressions: ⊕ is a clique, then both L(E) and NF (E) are cliques. Proof. As a direct consequence of Lemmas 6.2 and 6.4, we obtain that: if e¨e then, for all e 0 ∈ supp(L(e)) and e 0 ∈ supp(L(e )) (resp. e 0 ∈ supp(NF (e)) and e 0 ∈ supp(NF (e ))), we have e 0¨e 0 . The result follows straightforwardly.
Step 3 amounts to the fact that distinct coherent expressions have disjoint normal forms. In other words, if the normal forms of two coherent expressions intersect on a common element, then they must coincide. This result will follow from the following rigid version, which states that coherent rigid expressions with isomorphic normal forms are isomorphic: Example 6.7. Consider a = λx. x (x) (y ⊕ •, • ⊕ z) and a = λx. x (x) (• ⊕ z, y ⊕ •). We have a¨a and a ∼ = a but NF (a) = L(a) = y⊕• (•⊕z) and NF (a ) = L(a ) = •⊕z (y⊕•), hence NF (a) ∼ = NF (a ).

6.2.
Commutation. By assembling all our previous results, we obtain the desired commutation theorem: