A remark on continued fractions for permutations and D-permutations with a weight − 1 per cycle

We show that very simple continued fractions can be obtained for the ordinary generating functions enumerating permutations or D-permutations with a large number of independent statistics, when each cycle is given a weight − 1 . The proof is based on a simple lemma relating the number of cycles modulo 2 to the numbers of fixed points, cycle peaks (or cycle valleys)


Introduction
If (a n ) n⩾0 is a sequence of combinatorial numbers or polynomials with a 0 = 1, it is often fruitful to seek to express its ordinary generating function as a continued fraction of either Stieltjes type (S-fraction), Thron type (T-fraction), or Jacobi type (J-fraction), (Both sides of these expressions are to be interpreted as formal power series in the indeterminate t.)This line of investigation goes back at least to Euler [9,10], but it gained impetus following Flajolet's [11] seminal discovery that any S-fraction (resp.J-fraction) can be interpreted combinatorially as a generating function for Dyck (resp.Motzkin) paths with suitable weights for each rise and fall (resp.each rise, fall and level step).More recently, several authors [8,12,13,18,20] have found a similar combinatorial interpretation of the general T-fraction: namely, as a generating function for Schröder paths with suitable weights for each rise, fall and long level step.There are now literally dozens of sequences (a n ) n⩾0 of combinatorial numbers or polynomials for which a continued-fraction expansion of the type (1), (2) or ( 3) is explicitly known.In a recent paper, Zeng and one of us [21] ran this program in reverse: starting from a continued fraction in which the coefficients α (or β and γ) contain indeterminates in a nice pattern, we sought a combinatorial interpretation for the resulting polynomials a n -namely, as enumerating permutations, set partitions or perfect matchings according to some natural multivariate statistics.As a consequence, our results contained many previously obtained identities as special cases, providing a common refinement of all of them.In particular, we proved J-fractions enumerating permutations with 10, 18 or infinitely many statistics that implement the cycle classification of indices (cycle peak, cycle valley, cycle double rise, cycle double fall, fixed point) together with an index-refined count of crossings and nestings (these statistics will be defined in Section 2).
Subsequently, the two present authors [3] proved analogous results for D-permutations [14][15][16], which are a subclass of permutations of [2n] (defined in Section 5) that are counted by the Genocchi and median Genocchi numbers: our T-fractions enumerated D-permutations with 12, 22 or infinitely many statistics that implement the parity-refined cycle classification of indices (cycle peak, cycle valley, cycle double rise, cycle double fall, even fixed point, odd fixed point) together with an index-refined count of crossings and nestings.In both papers, we called these results our "first" continued fractions.
In both cases, it was natural to try to extend these results by taking account also of the number of cycles: that is, by including an additional weight λ cyc (σ) .However, it turned out that it was possible to do so only by renouncing some of the other statistics: for instance, by counting cycle valleys only with respect to crossings + nestings, rather than to crossings and nestings separately.We called these results our "second" continued fractions [21, Theorems 2.1(b), 2.4, 2.12, 2.14, 2.15] [3, Theorems 4.2, 4.7, 4.10].
Our purpose here is to make a simple but previously overlooked remark: that in addition to the trivial case λ = 1, there is one other case where one need not renounce counting any other statistics, namely, λ = −1.The reason for this is the following simple lemma, which relates the number of cycles modulo 2 to the number of fixed points, cycle peaks (or cycle valleys), and crossings: Lemma 1.Let σ ∈ S n be a permutation.Then the following identity holds: = fix + cval + ucross + lcross (mod 2) .
We will give a precise definition of ucross (number of upper crossings) and lcross (number of lower crossings) in Section 2.2, and then a proof of this lemma in Section 3.
Using Lemma 1, it is easy to obtain continued fractions for the case λ = −1 as simple corollaries of those for λ = 1.That is what we shall do in this paper.
The plan of this paper is as follows: In Section 2 we give some preliminary definitions concerning permutation statistics.In Section 3 we give two proofs of Lemma 1: one topological, and one combinatorial.Then, in Sections 4 and 5, we give our results for permutations and D-permutations, respectively. Throughout We will see later that our second example is a D-permutation.
the electronic journal of combinatorics 30 (2023), #P00 We remark that since Lemma 1 is a general fact concerning permutations, it can be applied to any result concerning any subclass of permutations in which the statistics fix, cpeak and ucross + lcross are handled.
As the reader will have noticed, the present paper builds directly on the ideas, techniques and intuitions of references [21] and [3].Some readers may therefore find it useful to consult those papers first.

Permutation statistics: The record-and-cycle classification
Clearly every index i belongs to exactly one of these three types; we call this the excedance classification.We also say that i is a weak excedance if i ⩽ σ(i), and a weak anti-excedance if i ⩾ σ(i).
A more refined classification is as follows: Clearly every index i belongs to exactly one of these five types; we refer to this classification as the cycle classification.Obviously, excedance = cycle valley or cycle double rise, and anti-excedance = cycle peak or cycle double fall.We write for the set of cycle peaks and for its cardinality, and likewise for the others.On the other hand, an index i ∈ [N ] is called a the electronic journal of combinatorics 30 (2023), #P00 • record (rec) (or left-to-right maximum) if σ(j) < σ(i) for all j < i [note in particular that the indices 1 and σ −1 (N ) are always records]; • antirecord (arec) (or right-to-left minimum) if σ(j) > σ(i) for all j > i [note in particular that the indices N and σ −1 (1) are always antirecords]; • exclusive record (erec) if it is a record and not also an antirecord; • exclusive antirecord (earec) if it is an antirecord and not also a record; • record-antirecord (rar) (or pivot) if it is both a record and an antirecord; • neither-record-antirecord (nrar) if it is neither a record nor an antirecord.
Every index i thus belongs to exactly one of the latter four types; we refer to this classification as the record classification.We stress that our records and antirecords are positions, not values.The record and cycle classifications of indices are related as follows: (a) Every record is a weak excedance, and every exclusive record is an excedance.
(b) Every antirecord is a weak anti-excedance, and every exclusive antirecord is an anti-excedance.
(c) Every record-antirecord is a fixed point.Clearly every index i belongs to exactly one of these 10 types; we call this the recordand-cycle classification.
When studying D-permutations, we will use the parity-refined record-and-cycle classification, in which we distinguish even and odd fixed points.
Next, we write out the cycle classification of σ: The statistics cpeak, cval, cdrise, cdfall and fix are simply the cardinalities of these sets, respectively.
Next, we write out the cycle classification of σ: Once again, the statistics cpeak, cval, cdrise, cdfall and fix are simply the cardinalities of these sets.

Permutation statistics: Crossings and nestings
We now define (following [21]) some permutation statistics that count crossings and nestings.
First we associate to each permutation σ ∈ S N a pictorial representation by placing vertices 1, 2, . . ., N along a horizontal axis and then drawing an arc from i to σ(i) above (resp.below) the horizontal axis in case σ(i) > i [resp.σ(i) < i]; if σ(i) = i we do not draw any arc.Each vertex thus has either out-degree = in-degree = 1 (if it is not a fixed point) or out-degree = in-degree = 0 (if it is a fixed point).Of course, the arrows on the arcs are redundant, because the arrow on an arc above (resp.below) the axis always points to the right (resp.left); we therefore omit the arrows for simplicity.See Figures 1  and 2 for our two running examples.
These are clearly degenerate cases of crossings and nestings, respectively.See Figure 3.Note that upsnest(σ) = lpsnest(σ) for all σ, since for each fixed point j, the number of pairs (i, l) with i < j < l such that l = σ(i) has to equal the number of such pairs with i = σ(l); we therefore write these two statistics simply as And of course ujoin = cdrise and ljoin = cdfall.We can further refine the four crossing/nesting categories by examining more closely the status of the inner index (j or k) whose outgoing arc belongs to the crossing or nesting: that is, j for an upper crossing or nesting, and k for a lower crossing or nesting:   the electronic journal of combinatorics 30 (2023), #P00 See Figure 4. Please note that for the "upper" quantities the distinguished index (i.e. the one for which we examine both σ and σ −1 ) is in second position (j), while for the "lower" quantities the distinguished index is in third position (k).
In fact, a central role in our work will be played (just as in [3,21]) by a yet further refinement of these statistics: rather than counting the total numbers of quadruplets i < j < k < l that form upper (resp.lower) crossings or nestings of the foregoing types, we will count the number of upper (resp.lower) crossings or nestings that use a particular vertex j (resp.k) in second (resp.third) position.More precisely, we define the indexrefined crossing and nesting statistics Note that ucross(j, σ) and unest(j, σ) can be nonzero only when j is an excedance (that is, a cycle valley or a cycle double rise), while lcross(k, σ) and lnest(k, σ) can be nonzero only when k is an anti-excedance (that is, a cycle peak or a cycle double fall).When j is a fixed point, we also define the analogous quantity for pseudo-nestings: (Here the two expressions are equal because σ is a bijection from [1, j) ∪ (j, n] to itself.) In [21, eq. (2.20)] this quantity was called the level of the fixed point j and was denoted lev(j, σ).

Proof of Lemma 1
We will give two proofs of Lemma 1: one topological, and one combinatorial.The topological proof is extremely satisfying from an intuitive point of view, but it requires some nontrivial results on the topology of the plane to make it rigorous.The combinatorial proof is simple and manifestly rigorous, but it relies on an identity for the number of inversions [5, Lemme 3.1] [19, eq. ( 40)] [21, Proposition 2.24] whose proof is elementary but not entirely trivial.Topological Proof.Draw the diagram representing the permutation σ (Figures 1  and 2) such that each arc is a C1 non-self-intersecting curve that has a vertical tangent at each cycle peak and cycle valley and a horizontal tangent at each cycle double rise and cycle double fall, and such that each pair of arcs intersects either zero times (if they do not represent a crossing) or once transversally (if they do represent a crossing), and the electronic journal of combinatorics 30 (2023), #P00 also such that each intersection point involves only two arcs (see Figures 5 and 6 for the examples of Figures 1 and 2, respectively, redrawn according to these rules).Then each cycle becomes a C 1 closed curve with a finite number of self-intersections, all of which are transversal double points; following Whitney [26, pp. 280-281], we call such a curve normal .The total number of intersections in the diagram is ucross + lcross.
Each fixed point is of course a cycle.So we focus henceforth on cycles of length ⩾ 2. We will prove the following two facts: (a) The number of self-intersections in a cycle is equal modulo 2 to the number of cycle peaks (or alternatively, cycle valleys) in that cycle, plus 1.
(b) The number of intersections between two distinct cycles is equal modulo 2 to zero.
Together these facts will prove Lemma 1.
Proof of (a).The rotation angle (or tangent winding angle) of a C 1 closed curve is the total angle through which the tangent vector turns while traversing the curve.
where N + (resp.N − ) is the number of positive (resp.negative) crossings, and µ is either +1 or −1. 2 It follows that the number of self-intersections in this cycle, namely Proof of (b).This is a general property of C 1 normal closed curves in the plane that have finitely many mutual intersections, all of which are transversal double points: in this situation the number of mutual intersections is even.This intuitively obvious fact goes back at least to Tait [23,statement III].For completeness we give a proof: Let C 1 and C 2 be C 1 normal closed curves in the plane; and suppose that C 1 and C 2 have finitely many intersections, all of which are all transversal double points.Consider  first the case in which C 1 is a simple closed curve, i.e. has no self-intersections.Then the Jordan Curve Theorem tells us that R 2 \ C 1 has two connected components, an interior and an exterior. 3We put an orientation on C 2 and traverse C 2 from some starting point.Each time C 2 intersects C 1 , it must either go from the interior to the exterior of C 1 or vice versa (because the intersections are transversal).Since C 2 returns to its starting point, the number of intersections between C 2 and C 1 must be even.When C 1 is not a simple closed curve but has finitely many self-intersections, we can write it as a union of finitely many simple closed curves C i 1 that are disjoint except for intersections at the self-intersection points of C 1 .(The graph whose vertices are the self-intersection points and whose edges are the arcs of C 1 between two successive selfintersections is an Eulerian graph; and an Eulerian graph can be written as the edgedisjoint union of cycles.)Then C 2 has an even number of intersections with each C i 1 , hence also with C 1 (since by hypothesis none of those intersections occur at the self-intersection points of C 1 ). 4 This completes the proof.This completes the proof of Lemma 1. □ Combinatorial Proof.Let cyc(σ) = k, and let p 1 , . . ., p k be the sizes of the k cycles of σ.Then Therefore (−1) n+k = (−1) #(cycles of σ of even length) .

Illustration with examples
We will verify the various components used in the combinatorial proof of Lemma 1 for both of our running examples.
Next we count the number of inversions of σ.We record the numbers ξ i = #{j < i : σ(j) > σ(i)}, which are sometimes called the inversion table of σ: Using these values we verify (32).
Next we count the number of inversions of σ.We record again the numbers ξ i = #{j < i : σ(j) > σ(i)}: Finally, we will verify equation (32).From ( 14) we obtain the values and from ( 23)/( 24) we obtain the values Using these values we verify (32).

Results for permutations
We find it convenient to start from the first "master" J-fraction for permutations [21, Theorem 2.9] and then to specialize.

Master J-fraction
Following [21, Section 2.7], we introduce five infinite families of indeterminates a = (a ℓ,ℓ , e = (e ℓ ) ℓ⩾0 and then define the polynomials e psnest(i,σ) . ( the electronic journal of combinatorics 30 (2023), #P00 (This is [21, eq.(2.77)] with a factor λ cyc(σ) included.)Then the first master J-fraction for permutations [21, Theorem 2.9] handles the case λ = 1: it states that the ordinary generating function of the polynomials P n (a, b, c, d, e, 1) has the J-type continued fraction with coefficients By Lemma 1, we obtain the case λ = −1 by inserting a factor −1 for each fixed point, for each cycle peak (or alternatively, cycle valley), and for each lower or upper crossing.We therefore have: with coefficients We now write out the monomials contributed by our running examples to the polynomial P n (a, b, c, d, e, λ) in equation (39) for n = 11 and n = 14, respectively.
To obtain the monomial contributed by σ in (39), we require the following data for each index i ∈ [11]: • The cycle type of i as per the cycle classification.This determines the letter a, b, c, d or e.We have already recorded this information in (10).
• The index-refined crossing and nesting statistics for i.This determines the subscripts ℓ and ℓ ′ .We have already recorded this information in Table 1.
We copy these data into the following table: We therefore see that the monomial contributed to P n (a, b, c, d, e, λ) by this particular permutation σ is (44)
To obtain the monomial contributed by σ in (39), we again copy the required data from equation ( 14) and Table 2: We therefore see that the monomial contributed to P n (a, b, c, d, e, λ) by this particular permutation σ is

p, q J-fraction
Consider now the polynomial [21, eq.(2.92)] where the various statistics have been defined in [ Making these specializations in Proposition 2 -or equivalently, attaching a minus sign to the variables x 1 , u 1 , p +1 , p +2 , p −1 , p −2 , w i in [21, Theorem 2.7] -we obtain: the electronic journal of combinatorics 30 (2023), #P00 Proposition 3 (p, q J-fraction for permutations, λ = −1).The ordinary generating function of the polynomials (46) at λ = −1 has the J-type continued fraction with coefficients We now write out the monomials contributed by our running examples to the polynomial 46) for n = 11 and n = 14, respectively.
To obtain the monomial contributed to (46) by σ, we require the following data for each index i ∈ [11]: • The cycle-and-record type of i as per the cycle-and-record classification.This determines the letter x, y, u or v along with the subscript 1 or 2. We have already recorded this information in (12).
We also require the total numbers of crossings and nestings refined according to cycle type.We have already recorded this information in (21)/ (22).Copying all these data together, we find that the monomial contributed to (46) by the permutation σ is

Simple J-fraction
And finally, we can obtain the polynomials without crossing and nesting statistics, by setting . Making this same specialization in Proposition 3 and observing that we obtain: Proposition 4 (Simple J-fraction for permutations, λ = −1).The ordinary generating function of the polynomials (52) at λ = −1 has the J-type continued fraction with coefficients

Corollary for cycle-alternating permutations
We recall [4,6,21] that a cycle-alternating permutation is a permutation of [2n] that has no cycle double rises, cycle double falls, or fixed points; Deutsch and Elizalde [6, Proposition 2.2] showed that the number of cycle-alternating permutations of [2n] is the secant number E 2n (see also Dumont [7,pp. 37,40] and Biane [2, section 6]).In this subsection, we will obtain continued fractions for cycle-alternating permutations at λ = −1 by specializing our master J-fraction (Proposition 2) to suppress cycle double rises, cycle double falls and fixed points, and then using [4,Lemma 4.2] to interpret the parity of cycle peaks and cycle valleys in terms of crossings and nestings.Let P n (a, b, λ) denote the polynomial (39) specialized to c = d = e = 0; it enumerates cycle-alternating permutations according to the index-refined crossing and nesting statistics associated to its cycle peaks and cycle valleys.Note that P n is nonvanishing only for even n.The J-fraction of Proposition 2 then becomes an S-fraction in the variable t 2 ; after changing t 2 to t, we have: We can use this master S-fraction to obtain a continued fraction that distinguishes cycle peaks and cycle valleys according to their parity.To do this, we use [4, Lemma 4.2]: Lemma 6 (Key lemma from [4]).If σ is a cycle-alternating permutation of [2n], then cycle valleys: ucross(i, σ) + unest(i, σ) = i − 1 (mod 2) (58a) cycle peaks: lcross(i, σ) + lnest(i, σ) = i (mod 2) (58b) Consider now the polynomials p the electronic journal of combinatorics 30 (2023), #P00 This proves the continued fraction that was conjectured in [4, eq.(A.6)].

Results for D-permutations
We recall [3,[14][15][16]] that a D-permutation is a permutation of is an example of a D-permutation.We proceed in the same way as in the preceding section, beginning with the "master" T-fraction and then obtaining the others by specialization.

Master T-fraction
Following [3, Section 3.4], we introduce six infinite families of indeterminates a the electronic journal of combinatorics 30 (2023), #P00 then define the polynomials with coefficients By Lemma 1, we obtain the case λ = −1 by inserting a factor −1 for each even or odd fixed point, for each cycle peak (or alternatively, cycle valley), and for each lower or upper crossing.We therefore have:
The monomial contributed by σ in (68) is almost the same as the monomial in (45); only the contribution of the fixed points is slightly different because we treat even and odd fixed points separately.Instead of as in (45), here the contribution is
The monomial contributed by σ in (75) is almost the same as the monomial in (51); the contribution of the fixed points is slightly different because we treat even and odd fixed points separately, and because (46) distinguished fixed points by level (subscripts on w), which we do not do here except to distinguish level 0 (rar) from level > 0 (nrfix).Therefore, instead of λ 6 x 2 1 x 2 2 y 3 1 y 2 u 1 u 2 v 2 w 2 0 w 2 p +1 p −2 q +2 q −1 q −2 s 2 (79) as in (51), here the contribution is λ 6 x 2 1 x 2 2 y 3 1 y 2 u 1 u 2 v 2 w o z e z o p +1 p −2 q +2 q −1 q −2 s 2 o . (80)

Figure 4 :
Figure 4: Refined categories of crossing and nesting.

)(
This is [3, eq.(3.30)] with a factor λ cyc(σ) included.)Then the first master T-fraction for D-permutations [3, Theorem 3.11] handles the case λ = 1: it states that the ordinary generating function of the polynomials Q n (a, b, c, d, e, 1) has the T-type continued fraction