Context-free grammars for several polynomials associated with Eulerian polynomials

In this paper, we present grammatical descriptions of several polynomials associated with Eulerian polynomials, including q-Eulerian polynomials, alternating run polynomials and derangement polynomials. As applications, we get several convolution formulas involving these polynomials.


Introduction
For an alphabet A, let Q[[A]] be the rational commutative ring of formal power series in monomials formed from letters in A. Following [6], a context-free grammar over A is a function Many combinatorial structures can be generated by using context-free grammars, such as set partitions [6], permutations [12,16,18], Stirling permutations [8,20], increasing trees [8,12], rooted trees [13] and perfect matchings [17]. In this paper, we shall use a grammatical labeling introduced by Chen and Fu [8] to study several polynomials associated with Eulerian polynomials.
Proposition 2 ([17, Theorem 10]). If A = {x, y} and G = {x → xy 2 , y → x 2 y}, then for n ≥ 1, The q-Eulerian polynomials of types A and B are respectively defined by where cyc (π) is the number of cycles in π and N (π) = #{i ∈ [n] : π(i) < 0}. Following [11,[157][158][159][160][161][162] and [24,Theorem 4.3.3], the alternating run polynomials of types A and B can be respectively defined by Following [3,Proposition 5] and [9,Theorem 3.2], the derangement polynomials of types A and B can be respectively defined by The purpose of this paper is to explore grammatical descriptions of the q-Eulerian polynomials, the alternating run polynomials and the derangement polynomials.

q-Eulerian polynomials
According to [5,Proposition 7.2], the polynomials A n (x; q) satisfy the recurrence relation with the initial condition A 0 (x; q) = 1. In [4,Theorem 3.4], Brenti showed that the polynomials B n (x; q) satisfy the recurrence relation with the initial condition B 0 (x; q) = 1. The polynomials A n (x; q) and B n (x; q) have been extensively studied (see [2,19] for instance).

2.1.
Context-free grammar for A n (x; q).
A standard cycle decomposition of π ∈ S n is defined by requiring that each cycle is written with its smallest element first, and the cycles are written in increasing order of their smallest element. In the following discussion, we write π in standard cycle decomposition. We say that the index i ∈ [n] is an anti-excedance of π if π(i) ≤ i. Denote by aexc (π) the number of anti-excedances of π. It is clear that exc (π) + aexc (π) = n. We now give a labeling of π as follows: (i) Put a superscript label z right after each excedance; (ii) Put a superscript label y right after each anti-excedance; (iii) Put a superscript label q before each cycle of π; (iv) Put a superscript label x at the end of π For example, the permutation (1, 3, 4)(2)(5, 6) can be labeled as q (1 z 3 z 4 y ) q (2 y ) q (5 z 6 y ) x . The weight of π is the product of its labels.
In this case, the insertion of n + 1 corresponds to the operation y → yz.
By induction, we get the following result.
Proof. Using the Leibniz's formula, we get Combining Proposition 1 and Theorem 3, we obtain Recall that A n (x) are symmetric, i.e., x n A n 1 x = xA n (x) for n ≥ 1. Thus we get the desired result.

2.2.
Context-free grammar for B n (x; q).
For a permutation π ∈ B n , we define an ascent to be a position i ∈ {0, 1, 2 . . . , n − 1} such that π(i) < π(i + 1). Let asc B (π) be the number of ascents of π ∈ B n . As usual, denote by i the negative element −i. We shall show that the following grammar can be used to generate permutations of B n . Now we give a labeling of π ∈ B n as follows.
(L 1 ) If i is an ascent and π(i + 1) > 0, then put a superscript label z and a subscript x right after π(i); (L 2 ) If i is a descent and π(i + 1) > 0, then put a superscript label y and a subscript u right after π(i); (L 3 ) If i is an ascent and π(i + 1) < 0, then put a superscript label z and a subscript qx right after π(i); (L 4 ) If i is a descent and π(i + 1) < 0, then put a superscript label y and a subscript qu right after π(i); (L 5 ) Put a superscript label y and a subscript x at the end of π.
The weight of π is defined by It is clear that the sum of weights of 01 and 01 is given by D(xy), since B 1 = {0 z x 1 y x , 0 y qu 1 y x } and D(xy) = x 2 yz + qxy 2 u. To illustrate the relation between the action of the formal derivative D of the grammar (4) and the insertion of n + 1 or n + 1 into a permutation π ∈ B n , we give the following example. Let π = 0214657 8 ∈ B 8 . The labeling of π is given by If we insert 9 after 0, the resulting permutation is given below, Thus the insertion of 9 after 0 corresponds to applying the rule z → yzu to the label z associated with 0. If we insert 9 after 0, the resulting permutation is given below, The insertion of 9 after 0 corresponds to applying the rule x → qxyu to the label x associated with 0. If we insert 9 after 2, the resulting permutation is given below, The insertion of 9 after 2 corresponds to applying the rule y → xyz to the label x associated with 2. If we insert 9 after 2, the resulting permutation is given below, The insertion of 9 after 2 corresponds to applying the rule u → qxzu to the label u associated with 2. In general, the insertion of n + 1 (resp. n + 1) into π corresponds to the action of the formal derivative D on a superscript label (resp. subscript label). By induction, we get the following result.
Theorem 5. If D is the formal derivative with respect to the grammar (4), then
By comparing (10) with (8), we see that the numbers T (n, k) satisfy the same recurrence relation and initial conditions as T (n, k), so they agree.
It follows from the Leibniz's formula that So the following corollary is immediate.
In particular, setting y = e = 1, z = 0 in (11), we get D n (e)| y=e=1,z=0 = d n (x). In [4], Brenti introduced a definition of type B weak excedance. Let π ∈ B n . We say that i ∈ [n] is a type B weak excedance of π if π(i) = i or π(|π(i)|) > π(i). Let wexc (π) be the number of weak excedances of π. It follows from [4, Theorem 3.15] that A fixed point of π ∈ B n is an index i ∈ [n] such that π(i) = i. A derangement of type B is a signed permutation π ∈ B n with no fixed points. Let D B n be the set of derangements of B n . Following [9], the type B derangement polynomials d B n (x) are defined by x wexc (π) for n ≥ 1.
The first few of the polynomials d B n (x) are given as follows:
In the following discussion, we always write π by using its standard cycle decomposition, in which each cycle is written with its largest entry last and the cycles are written in ascending order of their last entry. For example, 351726 4 ∈ D B 7 can be written as (6)(7, 4)(3, 1)(2, 5). Let (c 1 , c 2 , . . . , c i ) be a cycle in standard cycle decomposition of π. We say that c j is an ascent in the cycle if c j < c j+1 , where 1 ≤ j < i. We say that c j is a descent in the cycle if c j > c j+1 , where 1 ≤ j ≤ i and c i+1 = c 1 . As pointed out by Chow [9, p. 819], if π ∈ D B n with no singletons, then wexc (π) equals the sum of the number of ascents in each cycle and aexc (π) equals the sum of the number of descents in each cycle. Let d(n, i, j) be the number of derangements of type B with i weak excedances and j anti-excedances.
We can now conclude the fourth main result of this paper from the discussion above.
Theorem 10. Let A = {x, y, z, e} and Then D n (e) = e π∈D B n x 2wexc (π) y 2aexc (π) z 4single (π) . Equivalently, Setting y = z = 1 in (14), we get Proof. Now we give a labeling of π ∈ D B n as follows. (L 1 ) If i is a singleton, then put a superscript label z 4 right after i; (L 2 ) If c i is an ascent in a cycle, then put a superscript label x 2 right after c i ; (L 3 ) If c i is a descent in a cycle, then put a superscript label y 2 right after c i ; (L 4 ) Put a superscript label e in the front of π.
), e (2 To illustrate the relation between the action of the formal derivative D of the grammar (13) and the insertion of n + 1 or n + 1 into a permutation π ∈ D B n , we give the following example. Let π = (6)(7, 4)(3, 1)(2, 5) ∈ D B 7 . Then π can be labeled as We distinguish the following four cases: (c 1 ) If we insert 8 as a new cycle, then the resulting permutation is given below, This case corresponds to applying the rule e → ez 4 to the label e.
(c 2 ) If we insert 8 or 8 into the cycle (6), then the resulting permutations are given below, It should be noted that in the latter two permutations, we need to replace 6 by 6. This case corresponds to applying the rule z → x 2 y 2 z −3 to the label z 4 , since D(z 4 ) = 4x 2 y 2 . (c 3 ) If we insert 8 or 8 right after 7, then the resulting permutations are given below, This case corresponds to applying the rule x → xy 2 to the label x 2 , since D(x 2 ) = 2x 2 y 2 . (c 4 ) If we insert 8 or 8 right after 4, then the resulting permutations are given below, This case corresponds to applying the rule y → x 2 y to the label y 2 , since D(y 2 ) = 2x 2 y 2 .
Hence the insertion of n + 1 or n + 1 into π ∈ D B n corresponds to the action of the formal derivative D on a superscript label. It can be easily checked that grammar (13) generates all of the type B derangements.
Note that Combining (15) and Theorem 10, we get the following corollary. Moreover, from (14), the following result is immediate.
In the proof of Theorem 10, if we further put a superscript label q before each cycle of π ∈ D B n , then we get the following result.