Two first-order logics of permutations
TTwo first-order logics of permutations
Michael Albert, Mathilde Bouvel, Valentin Féray
Abstract
We consider two orthogonal points of view on finite permutations, seenas pairs of linear orders (corresponding to the usual one line representationof permutations as words) or seen as bijections (corresponding to thealgebraic point of view). For each of them, we define a correspondingfirst-order logical theory, that we call
TOTO (Theory Of Two Orders)and
TOOB (Theory Of One Bijection) respectively. We consider variousexpressibility questions in these theories.Our main results go in three different direction. First, we prove that,for all k ≥ , the set of k -stack sortable permutations in the sense of Westis expressible in TOTO , and that a logical sentence describing this set canbe obtained automatically. Previously, descriptions of this set were onlyknown for k (cid:54) . Next, we characterize permutation classes inside whichit is possible to express in TOTO that some given points form a cycle.Lastly, we show that sets of permutations that can be described both in
TOOB and
TOTO are in some sense trivial. This gives a mathematicalevidence that permutations-as-bijections and permutations-as-words aresomewhat different objects.
Keywords : permutations, patterns, first order logic, Eurenfest-Fraïssé games,sorting operators.
This paper being interested in permutations, it should start with a definitionof them. Some combinatorialists would say that a permutation of size n is abijection from [ n ] = { , , . . . , n } to itself. Others would say that a permutationof size n is a word (sometimes called the one-line representation of the permuta-tion) on the alphabet { , , . . . , n } containing each letter exactly once. Both areof course correct. The first definition is mostly popular among combinatorial-ists who view permutations as algebraic objects living in the permutation group S n . The second one is classical in the Permutation Patterns community, wherea permutation is also often – and equivalently – represented graphically by its permutation diagram which, for σ ∈ S n is the n × n grid containing exactly onedot per row and per column, at coordinates ( i, σ ( i )) i ∈ [ n ] .In the huge combinatorics literature on permutations, there are, to our knowl-edge, very few works that consider at the same time the algebraic and the1 a r X i v : . [ m a t h . C O ] S e p attern view point. Some of those we are aware of study the stability of per-mutation classes by composition of permutations, as in [16], while others areinterested in cycles exhibiting a particular pattern structure, see for example[5, 10] and references therein.Although the two (or three – but words and diagrams are essentially the samething, as will be clear later in this paper) definitions do define permutations, theydo not give the same point of view on these objects, as mirrored by the problemsof different nature that are considered on them. As remarked by Cameronduring his talk at PP2015, Galois even used two different names to accountfor these two definitions of permutations: in Galois’s terms, a permutation waswhat we described above as a permutation-as-a-word, while a substitution wasa permutation-as-a-bijection.In this paper, we wish to consider both these definitions of permutations. In-deed, these points of view on permutations are believed to be rather orthog-onal, and one purpose of our paper is to give mathematical evidence thatpermutations-as-words and permutations-as-bijections are really not the sameobject.To that effect, we use the framework of first-order logic. For each of these pointsof view, we define a first-order logical theory, whose models are the permutationsseen as bijections in one case, as words in the other case. We then investigatewhich properties of permutations are expressible in each of these theories. Whilethe two theories have appeared briefly in the literature – see [8, Example 7.6]for a - law for permutations-as-bijections, and [6] for the description of the so-called Fraïssé classes for permutations-as-words, it seems that the expressibilityof related concepts in the two logics has not been studied in details, nor has onebeen compared to the other.It is no surprise that the theory associated with permutations seen as bijections(called
TOOB – the Theory Of One Bijection) can express statements about thecycle decomposition of permutations, while the theory associated with permu-tations seen as words (called
TOTO – the Theory Of Two Orders) is designed toexpress pattern-related concepts. We will indeed justify in Section 3 that thecontainment/avoidance of all kinds of generalized patterns existing in the liter-ature is expressible in
TOTO . But we are also interested in describing whichproperties are not expressible in each of these theories. Simple examples ofsuch results that we prove are that
TOTO cannot express that an element of apermutation is a fixed point, while
TOOB cannot express that a permutationcontains the pattern .The results of this article can then be divided into three independent parts.Our first set of results are expressibility results for
TOTO : related to (general-ized) patterns, to the substitution decomposition, and most interestingly in thecontext of sorting operators . The study of sorting operators has been one of thehistorical motivation to study permutation patterns, after the seminal work of2nuth [17, Section 2.2.1]. He proved that those permutations sortable with astack are exactly those avoiding the pattern 231. This has inspired many sub-sequent papers considering various sorting operators (the bubble sort operator[1, 7], or queues in parallel [21]) or the composition of such sorting operators.Most notably, the permutations sortable by applying twice or three times thestack sorting operator S have been characterized [22, 24]. Each of these resultshas required a generalization of the definition of pattern in a permutation.In the present paper, we prove that, for each fixed integer k ≥ , it is possible toexpress in TOTO the property that a permutation is sortable by k iterations ofthe stack sorting operator (Corollary 19). Moreover, our proof is constructive(at least in principle) and yields a TOTO formula expressing this property. Thesame holds for iterations of the bubble sort operator or the queue-and-bypassoperator (or any combination of those; see Proposition 20).Since
TOTO is the natural logical framework related to patterns, our theoremgives a “meta-explanation” to the fact that many sets of sortable permutationsare described through patterns. It also suggests that
TOTO is a better frame-work than pattern-avoidance in this context, since it allows the description of k -sortable permutations for any fixed value of k , while the cases k = 2 and k = 3 had required the introduction of ad hoc notions of patterns which turn out tocorrespond to sets definable by certain particular types of formula in TOTO .Our second set of results deal with the (in-)expressibility of certain concepts in
TOTO . As mentioned earlier, it is rather easy to see that some simple propertieson the cycle structure of permutations are not expressible in
TOTO (e.g., theexistence of a fixed point – see Corollary 27). It is however possible that theybecome expressible when we restrict the permutations under consideration tosome permutation class C . As a trivial example, in the class C which consistsonly of the increasing permutations · · · n (for all n ) the sentence “true” isequivalent to the existence of a fixed point. In Theorem 33, we characterizecompletely the permutation classes C in which TOTO can express the fact thata permutation contains a fixed point (resp. that a given point of a permutationis a fixed point). We then consider longer cycles and characterize, for any fixed k , the permutation classes C in which TOTO can express that k given pointsform a cycle (Theorem 36). On the contrary, the characterization of permutationclasses C in which TOTO can express that a permutation contains a k -cycle (butnot specifying on which points) is left as an open problem.The Ehrenfeucht-Fraïssé theory, giving a game-theoretical characterization ofpermutations satisfying the same sentences (see Section 4), together with Erdős-Szekeres theorem on the existence of long monotone subsequences in permuta-tions, are the two key elements in the proof.Our final results focus on properties of permutations that are expressible both in TOTO and
TOOB . As explained above, the two points of view – permutations-as-bijection and permutations-as-diagrams – are believed to be mostly orthogo-nal, so that we expect that there are few such properties. We prove indeed (seeTheorem 43) that these properties are in some sense trivial, in that they are3erified by either all or no permutations with large support (the support of apermutation being its set of non-fixed points). This gives the claimed evidenceto the fact that permutations-as-words and permutations-as-bijections are dif-ferent objects. We also give a more precise, and constructive, characterization ofsuch properties (Theorem 44). Again, Ehrenfeucht-Fraïssé games play a centralrole in the proof of these results.This study is reminiscent of a result of Atkinson and Beals [3]. They considerpermutation classes such that, for each n , the permutations of size n in the classfrom a subgroup of S n . Such classes are proved to belong to a very restrictedlist. Again, we observe that asking that a set has some nice property relatedto patterns (being a class) and, at the same time, some nice property relatedto the group structure (being a subgroup), forces the set under consideration tobe somehow trivial. For a recent refinement of Atkinson-Beals’ result, we referto [18, 19].We finish this introduction by an open question, inspired by the importantamount of work on - and convergence laws in the random graph literature;see, e.g. [15, Chapter 10]. We also refer to [8, Example 7.6] for a - law forunlabeled models of TOOB . Question 1.
For each n ≥ , let σ n be a uniform random permutation of size n .Does it hold that, for all sentences φ in TOTO , the probability that σ n satisfies φ has a limit, as n tends to infinity? We note that there cannot be a - law for TOTO since for example the propertyof being a simple permutation is expressible in
TOTO and, as shown in [2], haslimiting probability /e . Note added in revision: a negative answer to the above question was announcedby Müller and Skerman during the 19th International Conference on RandomStructures and Algorithms (Zurich, July ’19).The article is organized as follows. In Section 2, we present the two first-orderlogical theories
TOTO and
TOOB corresponding to the two points of view onpermutations. We examine further the expressivity of
TOTO , the theory as-sociated to permutations-as-words, in Section 3. In particular, our results onsorting operators are presented in this section. Next, Section 4 presents thefundamental tool of Ehrenfeucht-Fraïssé games, and shows some first inexpress-ibility results for
TOTO . Then, Sections 5 and 6 go in different directions. Thefirst one explores how restricting
TOTO to permutation classes allows someproperties of the cycle structure of permutations to become expressible. Thesecond one describes which properties of permutations are expressible both in
TOTO and in
TOOB . Notation: the following notational convention for integer partitions is used inSections 3.4 and 6. Recall that an integer partition λ of n is a nonincreasinglist of positive integers of sum n ; equivalently, it is a finite multiset of positive4ntegers. We write ( k m ) for the partition consisting in m copies of k ; also if λ and µ are two partitions, λ ∪ µ is their disjoint union as multiset. In particular λ ∪ (1 k ) is obtained by adding k parts equal to to λ . We assume that the reader has some familiarity with the underlying concepts offirst-order logic. For a basic introduction, we refer the reader to the Wikipediapage on this topic. For a detailed presentation of the theory, Ebbinghaus-Flum’sbook on the topic is a good reference [9]. We will however try to present our twofirst-order theories (intended to represent the two points of view on permutationsdescribed in the introduction) so that they are accessible to readers with onlya passing familiarity with logic.
TOTO and
TOOB A signature is any set of relation and function symbols, each equipped with anarity (which represents the number of arguments that each symbol ‘expects’).The symbols in the signature will be used to write formulas. In this paper, weconsider two signatures, which both have the special property of containing onlyrelation symbols.The first one, S TO , consists of two binary relation symbols: < P and < V . It isthe signature used in TOTO , corresponding to viewing permutations as words,or diagrams, or more accurately as the data of two total orders indicating theposition and the value orders of its elements (with < P and < V respectively).The second signature, S OB , consists of a single binary relation symbol, R . It isthe signature used in TOOB , and a relation between two elements indicates thatthe first one is sent to the second one by the permutation viewed as a bijection.Of course, we intend that < P and < V represent strict total orders, and that R represents a bijection; this is however not part of the signature. It will beensured later, with the axioms of the two theories TOTO and
TOOB . To presentthem, we first need to recap basics about formulas and their models.In the special case of interest to us where there is no function symbol in the sig-nature, we can skip the definition of terms and move directly to atomic formulas .These are obtained from variables (taken from an infinite set { x, y, z, . . . } ) byputting them in relation using the relation symbols in the considered signature,or the equality symbol = . For example, x = z , x < P y and x < V x are atomicformulas on the signature S TO , while z = y , xRy and xRx are atomic formulason the signature S OB . As is usual for binary relations we write them infix asabove rather than the more proper < P ( x, y ) First-order formulas , usually denoted by Greek letters ( φ, . . . ) are then obtainedinductively from the atomic formulas, as combinations of smaller formulas using5he usual connectives of the first-order logic: negation ( ¬ ), conjunction ( ∧ ), dis-junction ( ∨ ), implication ( → ), equivalence ( ↔ ), universal quantification ( ∀ x φ ,for x a variable and φ a formula) and existential quantification ( ∃ x φ ). Note thatwe restrict ourselves to first-order formulas: quantifiers may be applied only tosingle variables (as opposed to sets of variables in second-order for instance).A sentence is a formula that has no free variable, that is to say in which allvariables are quantified. For example, φ = ∃ x ∃ y ( x < P y ∧ y < V x ) is asentence on the signature S TO and φ ( x ) = ∃ y xRy ∧ yRx is not a sentence buta formula with one free variable x on the signature S OB .The formulas themselves do not describe permutations. Instead, formulas canbe used to describe properties of permutations. Permutations are then called models of a formula.Generally speaking, given a signature S , a (finite) model is a pair M = ( A, I ) where A is any finite set, called the domain , and I describes an interpretationof the symbols in S on A . Formally, I is the data, for every relation symbol R (say, of arity k ) in the signature, of a subset I ( R ) of A k . Note that models withinfinite domains also exist; however, in this paper, we restrict ourselves to finitemodels. This makes sense since models are intended to represent permutationsof any finite size.Two models M = ( A, I ) and M (cid:48) = ( A (cid:48) , I (cid:48) ) are isomorphic when there existsa bijection f from A to A (cid:48) such that for every relation symbol R (say, of arity k ) in the signature, for all k -tuples ( a , . . . , a k ) of elements of A , ( a , . . . , a k ) is in I ( R ) if and only if ( f ( a ) , . . . , f ( a k )) is in I (cid:48) ( R ) (together with a similarcondition for function symbols, if the signature contains some).For example, on the signature S TO , a model is M TO = (cid:32) { a, b, c, d, e } , (cid:40) < P (cid:55)→≺ P < V (cid:55)→≺ V (cid:33) , where ≺ P (resp. ≺ V ) is the strict total order defined on A = { a, b, c, d, e } by a ≺ P b ≺ P c ≺ P d ≺ P e (resp. c ≺ V e ≺ V a ≺ V d ≺ V b ). This model isisomorphic to M (cid:48) TO = (cid:32) { , , , , } , (cid:40) < P (cid:55)→≺ (cid:48) P < V (cid:55)→≺ (cid:48) V (cid:33) , where ≺ (cid:48) P and ≺ (cid:48) V are the strict total orders defined on { , , , , } by ≺ (cid:48) P ≺ (cid:48) P ≺ (cid:48) P ≺ (cid:48) P and ≺ (cid:48) V ≺ (cid:48) V ≺ (cid:48) V ≺ (cid:48) V , the underlying bijection f being a (cid:55)→ , . . . , e (cid:55)→ .As we will explain in more details later (see Section 2.2), M TO and M (cid:48) TO bothrepresent the permutation σ which can be written in one-line notation as σ =35142 . This same permutation, which decomposes into a product of cycles as σ = (1 , , , can of course also be represented by a model on the signature S OB : for example M OB = ( { , , , , } , R ) where the only pairs in R are R , R , R , R and R . 6ote that we have been careful above to use different notations for the relationsymbols ( < P , < V , R ) and their interpretations ( ≺ P , ≺ V , R ); in the following,we may be more flexible and use the same notation for both the relation symboland its interpretation.Finally, a model M = ( A, I ) is said to satisfy a sentence φ when the truth valueof φ is “True" when interpreting all symbols in φ according to I . We also saythat M is a model of φ , and denote it by M | = φ . For example, it is easilychecked that M TO above is a model of our earlier example formula φ (since, forinstance, evaluating x to a and y to e makes the inner formula x < P y ∧ y < V x true).In the special case of interest to us where all models are finite two models satisfythe same sentences if and only if they are isomorphic.The definition of satisfiability above applies only to sentences, which do nothave free variables. It can however be extended to formulas with free variables,provided that the free variables are assigned values from the domain. We usuallywrite φ ( x ) a formula with free variables x = ( x , . . . , x k ) , and, given M = ( A, I ) a model and a = ( a , . . . , a k ) ∈ A k , we say that ( M , a ) satisfies φ ( x ) (written ( M , a ) | = φ ( x ) ) if the truth value of φ ( x ) is “True” when every x i is interpretedas a i and relations symbols are interpreted according to I . Getting back to ourexamples ( M OB , (1)) | = ∃ y ( xRy ∧ yRx ) since we can witness the existential quantifier with y = 3 and it is the case that R and R .Formally speaking, a theory is then just a set of sentences, which are called the axioms of the theory. A model of a theory is any model that satisfies all axiomsof the theory.The axioms of a theory can be seen as ensuring some properties of the modelsconsidered, or equivalently as imposing some conditions of the interpretationsof the relation symbols. In our case, the axioms of TOTO (the Theory Of TwoOrders) ensure that < P and < V are indeed strict total orders, while the axiomsof TOOB (the Theory Of One Bijection) indicate that R is a bijection. The factthat these properties can be described by first-order sentences (to be taken thenas the axioms of our theories) is an easy exercise that is left to the reader. Thiscompletes the definition of our two theories TOTO and
TOOB . TOTO and
TOOB
We now turn to explaining more precisely how permutations can be encoded asmodels of
TOTO and
TOOB .We start with
TOOB . Given a permutation σ of size n , the model of TOOB that we associate to it is ( A σ , R σ ) , where A σ = { , , . . . , n } and R σ is definedby iR σ j if and only if σ ( i ) = j . 7t should be noticed that the total order on { , , . . . , n } is not at all captured bythe model ( A σ , R σ ) . TOOB is on the contrary designed to describe properties ofthe cycle decomposition of permutations. For instance, the existence of a cycleof a given size is very easy to express with a sentence of
TOOB : the existenceof a fixed point is expressed by ∃ x xRx ; while the existence of a cycle of size is expressed by ∃ x, y ( x (cid:54) = y ∧ xRy ∧ yRx ) ; and the generalization to cycles of greater size is obvious. It should also be notedthat TOOB can only express “finite” statements: for any given k , it is expressiblethat a permutation has size k and is a k -cycle (using k + 1 variables), but it isnot possible to express that a permutation consists of a single cycle (of arbitrarysize).Although not all models of TOOB are of the form ( A σ , R σ ) for a permutation σ , the following proposition shows that it is almost the case. Proposition 2.
For any model ( A, R ) of TOOB , there exists a permutation σ such that ( A, R ) and ( A σ , R σ ) are isomorphic. In this case, we say that σ is apermutation associated with ( A, R ) .Proof. Let ( A, R ) be a model of TOOB , and denote by n the cardinality of A . Consider any bijection f between A and { , , . . . , n } , and let σ be thepermutation such that σ ( i ) = j if and only if f − ( i ) Rf − ( j ) . Clearly, ( A, R ) and ( A σ , R σ ) are isomorphic.It is already visible in the above proof that the permutation associated to agiven model of TOOB is not uniquely defined. The next proposition describesthe relation between all such permutations. Recall that the cycle-type of apermutation of size n is the partition λ = ( λ , . . . , λ k ) of n such that σ canbe decomposed as a product of k disjoint cycles, of respective sizes λ , . . . , λ k .Recall also that two permutations are conjugate if and only if they have the samecycle-type. The following proposition follows easily from the various definitions. Proposition 3.
Two models of
TOOB are isomorphic if and only if the per-mutations associated with them are conjugate.
For finite models, being isomorphic is equivalent to satisfying the same set ofsentences. In particular, the models corresponding to conjugate permutationssatisfy the same sentences. This proves our claim of the introduction that theavoidance of is not expressible in
TOOB , since and are conjugateand of course one of them contains while the other doesn’t! This shows aweakness of the expressivity of
TOOB . In particular, the containment of a givenpattern is in general not expressible in
TOOB (unlike in
TOTO , as we discussin Section 3.1). In fact, it is easy to check that, for | π | ≥ , it is not possible toexpress the avoidance of π in TOOB .We now move to
TOTO . As we shall see, the focus on permutations is different:
TOTO considers the relative order between the elements of the permutations8nd does not capture the cycle structure (see Corollary 27 and the more involvedTheorem 36).To represent a permutation σ of size n as a model of TOTO , we do the following.We consider the domain A σ = { ( i, σ ( i )) : 1 (cid:54) i (cid:54) n } of cardinality n , and weencode σ by the triple ( A σ , < σP , < σV ) where < σP (resp. < σV ) ) is the strict totalorder on A σ defined by the natural order on the first (resp. second) componentof the elements of A σ . When it is clear from the context (as for instance inProposition 4), we may denote the model ( A σ , < σP , < σV ) of TOTO simply by σ .Representing a permutation σ by ( A σ , < σP , < σV ) as above is very close to the rep-resentation of permutations by their diagrams. When considering permutations via their diagrams, it is often observed that the actual coordinates of the pointsdo not really matter, but only their relative positions. Hence, a property thatwe would like to hold is that two isomorphic models of TOTO should representthe same permutation. To make this statement precise, we need to define thepermutation that is associated with a model of
TOTO .Let ( A, < P , < V ) be any model of TOTO . First, for any strict total order < on A , we define the rank of a ∈ A as rank ( a ) = card { b ∈ A : b < a } + 1 . Notethat when a runs over A and A is of cardinality n , rank ( a ) takes exactly onceeach value in { , , . . . , n } . Then, we write A = { a , a , . . . , a n } where each a i has rank i for < P , and we let r i be the rank of a i for < V , for each i . Thepermutation σ is the one whose one-line representation is r r . . . r n .It is obvious that ( A, < P , < V ) and ( A σ , < σP , < σV ) are isomorphic. Moreover, iftwo models of TOTO are isomorphic, then the permutations associated withthem are equal. We therefore have the following analogue in
TOTO of Proposi-tion 3 for
TOOB . Proposition 4.
Two models of
TOTO are isomorphic and, hence, satisfy thesame set of sentences if and only if the permutations associated with them areequal.
Comparing Propositions 3 and 4, we immediately see that
TOTO allows todescribe a lot more details than
TOOB . Indeed, while formulas of
TOTO allowto discriminate all permutations among themselves, formulas of
TOOB do notdistinguish between permutations of the same cycle-type. The expressivity of
TOTO (and to a lesser extent, of
TOOB ) will be further discussed in the rest ofthe paper.
TOTO
As we explained earlier,
TOTO has been designed to express pattern-relatedconcepts in permutations. In this section, we illustrate this fact with numerousexamples. • In Section 3.1, we consider containment/avoidance of various kind of gen-9ralized patterns. • In Section 3.2, we investigate some properties linked to the substitutiondecomposition, namely being ⊕ / (cid:9) indecomposable and being simple. • Section 3.3 considers expressibility results in the context of sorting oper-ators. It contains in particular our first main result, on the expressibilityof the set of k -stack sortable permutations, in the sense of West. • Section 3.4 shows some properties related to the cycle structure which arenevertheless expressible in
TOTO . This is a preparation for Section 6.
We assume that the reader is familiar with basic concepts related to patternsin permutations. Let us only recall a couple of very classical definitions. A per-mutation σ = σ (1) σ (2) . . . σ ( n ) contains the permutation π = π (1) π (2) . . . π ( k ) as a (classical) pattern if there exist indices i < i < · · · < i k between and n such that π ( j ) < π ( h ) if and only if σ ( i j ) < σ ( i h ) . In this case we also saythat π is a pattern of σ . The sequence ( i , i , . . . , i k ) is called an occurrence of π in σ . If σ does not contain π then we say that σ avoids π . A permutationclass is a set C of permutations such that, if σ ∈ C and π is a pattern of σ ,then π ∈ C . We note that “contains” is a partial order on the set of all finitepermutations. Equivalently, permutation classes can be characterized as thosesets of permutations that avoid some (possibly infinite) family B of patternswhich we write C = Av( B ) . If no permutation of B contains any other as apattern, then this determines B uniquely from C and B is called the basis of C . Other classical definitions about permutations and their patterns have beenconveniently summarized in Bevan’s brief presentation [4] prepared for the con-ference Permutation Patterns 2015 . The goal of this section is to illustrate thatall notions of patterns that we have found in the literature are expressible in
TOTO . Note that, when defining that ( i , i , . . . , i k ) is an occurrence of π in σ , we re-quest the indices i j to be increasing. It could also be natural to consider any per-mutation of ( i , i , . . . , i k ) as an occurrence of π , but this is not what we are do-ing here. Also, in our framework, if a sequence ( i , i , . . . , i k ) of indices gives anoccurrence of π , it is convenient to write that (cid:0) ( i , σ ( i )) , ( i , σ ( i )) , . . . , ( i k , σ ( i k )) (cid:1) is an occurrence of π in σ . The same remarks apply to more general types ofpatterns, discussed in Section 3.1.2. Proposition 5.
Let π be any permutation of size k . There exists a formula ψ π ( x , . . . , x k ) of TOTO to express the property that k elements a , . . . , a k of permutation σ form an occurrence of the pattern π (in the classical sense);more precisely, for any permutation σ and elements a , . . . , a k in σ , ( a , . . . , a k ) is an occurrence of π in σ ⇔ ( σ, a , . . . , a k ) | = ψ π ( x , . . . , x k ) . For example, the pattern corresponds to the formula ψ ( x, y, z ) := ( x < P y < P z ) ∧ ( z < V x < V y ) . Proof.
Clearly, generalizing the above example, it is enough to take the followingformula, where k is the size of π : ψ π ( x , . . . , x k ) = ( x < P x < P · · · < P x k ) ∧ ( x π − (1) < V x π − (2) < V · · · < V x π − ( k ) ) . Corollary 6.
The containment of a given pattern is a property expressible in
TOTO .Proof.
Let π be a given pattern of size k . The containment of π simply corre-sponds to the formula ∃ x , . . . , x k ψ π ( x , . . . , x k ) . Taking negations and conjunctions, Corollary 6 immediately gives the following.
Corollary 7.
The avoidance of a given pattern, and membership of any finitely-based permutation class, are properties expressible in
TOTO .Remark . From a formula expressing that some sequence of elements in somepermutation forms a given pattern π , we can always write a sentence to expressthe existence of an occurrence of π (by introducing existential quantifiers). Thishas been used in Corollary 6 above in the case of classical patterns, but appliesjust as well to all other notions of patterns below. Therefore, we will only statethe next results for specific occurrences (i.e., the analogue of Proposition 5),leaving the existence of occurrences (i.e., the analogue of Corollary 6) to thereader. Several generalizations of the notion of classical patterns exist. The most com-mon ones are recorded in [4], and an overview with more such generalizationscan be found in [22, Figure 3]. In the following, we use the notation (and someexamples) of [22], and refer to this paper for the formal definitions.Among the earliest generalizations of patterns, some (like vincular or bivincu-lar patterns) indicate that some of the elements forming an occurrence of theunderlying classical pattern must be consecutive (for < P or for < V ). This isfurther generalized by the notion of mesh patterns; to form an occurrence of amesh pattern, elements must 11 first form an occurrence of the corresponding classical pattern; • in addition, some of the regions determined by these elements (whose setis recorded in a list R ) should be empty (see example below).Such constraints are easily expressible in TOTO . Proposition 9.
Let ( π, R ) be any mesh pattern, with π of size k . There existsa formula ψ ( π,R ) ( x , . . . , x k ) of TOTO to express the property that elements ( a , . . . , a k ) of a permutation σ form an occurrence of the mesh pattern ( π, R ) . For instance, the formula corresponding to occurrences of the mesh pattern (132 , { (0 , , (1 , , (2 , } ) = is ψ ( x, y, z ) ∧ ¬∃ t ( t < P x ∧ z < V t < V y ) ∧ ¬∃ t ( x < P t < P y ∧ z < V t < V y ) ∧ ¬∃ t ( y < P t < P z ∧ z < V t < V y ) . Proof.
The idea of the previous example generalizes immediately as follows: ψ ( π,R ) ( x , . . . , x k ) = ψ π ( x , . . . , x k ) ∧ (cid:94) ( i,j ) ∈ R ¬∃ t ( x i < P t < P x i +1 ∧ x π − ( j ) < V t < V x π − ( j +1) ) , where the possible comparisons with x , x k +1 , x π − (0) or x π − ( k +1) in the lastpart of the formula are simply dropped.Mesh patterns can be further generalized, as decorated patterns. This is oneof the three most general types of patterns that appear in the overview of [22,Figure 3], the other two being barred patterns and “grid classes”. We refer to [22]for the definition of barred patterns and to [23, Section 4.3] for the definitionof grid classes (called generalized grid classes therein). It is easy to generalizethe ideas of the previous proofs to show that all properties of containing suchpatterns are expressible in TOTO , although it becomes notationally more painfulto write it in full generality. We therefore only record the following results,without proof, but illustrated with examples.
Proposition 10.
Let ( π, C ) be any decorated pattern. There exists a TOTO for-mula with k = | π | free variables to express the property that elements ( a , . . . , a k ) of a permutation σ form an occurrence of ( π, C ) . For instance, an occurrence of the decorated pattern dec = (21 , { ((1 , , } ) = is an occurrence ( a, b ) of the classical pattern such that the middleregion delimited by a and b does not contain a pattern . This corresponds tothe TOTO formula ψ ( x, y ) ∧ ¬ (cid:16) ∃ t ∃ u (cid:2) ( a < P t, u < P b ) ∧ ( b < V t, u < V a ) (cid:3) ∧ ψ ( t, u ) (cid:17) . ( a < P t, u < P b ) is a short notation for ( a < P t < P b ) ∧ ( a < P u < P b ) .We will use similar abbreviations in the following. Proposition 11.
Let π be any barred pattern. There exists a TOTO formula,whose number k of free variables is the number of unbarred elements in π , toexpress the property that elements ( a , . . . , a k ) of a permutation σ form an oc-currence of π . Consider for instance the barred pattern ¯13¯24 (which has been chosen since itcannot be expressed using decorated patterns, see [22]). Informally, an occur-rence of ¯13¯24 is a pair ( b, d ) of two elements in increasing order (i.e., in the orderinduced by the unbarred elements), which cannot be extended to a quadruple ( a, b, c, d ) that is an occurrence of .It is easy to see that the following formula expresses occurrences of the barredpattern ¯13¯24 : ψ ( x, y ) ∧ ¬ (cid:16) ∃ u ∃ t ψ ( u, x, t, y ) (cid:17) . Proposition 12.
Let M be a matrix whose entries are finitely-based permu-tation classes. There exists a TOTO sentence φ M to express the property ofmembership to the grid class Grid( M ) . For instance, consider the grid class
Grid( M ) for the matrix M = (cid:18) Av(123) ∅ Av(21) Av(12) (cid:19) . Informally a permutation σ is an element of Grid( M ) if its diagram can be splitin 4 regions (by one vertical and one horizontal lines that do not cross any dots)such that • the NW (resp. SW, resp. SE) region does not contain any occurrence of (resp. , resp. ); • the NE corner is empty.It is easy to see that the following sentence ˜ φ M indicates the membership to Grid( M ) with SW-non-trivial decomposition (i.e. there is at least one point onthe left of the vertical line and below the horizontal line that appear in theabove definition). Modifying it to get a sentence φ M that indicates membershipto Grid( M ) is a straightforward exercise. ˜ φ M = ∃ (cid:96) v ∃ (cid:96) h ¬ (cid:16) ∃ x ∃ y ∃ z (cid:2) ( x, y, z (cid:54) P (cid:96) v ) ∧ ( x, y, z > V (cid:96) h ) (cid:3) ∧ ψ ( x, y, z ) (cid:17) ∧ ¬ (cid:16) ∃ x ∃ y (cid:2) ( x, y (cid:54) P (cid:96) v ) ∧ ( x, y (cid:54) V (cid:96) h ) (cid:3) ∧ ψ ( x, y ) (cid:17) ∧ ¬ (cid:16) ∃ x ∃ y (cid:2) ( x, y > P (cid:96) v ) ∧ ( x, y (cid:54) V (cid:96) h ) (cid:3) ∧ ψ ( x, y ) (cid:17) ∧ ¬ (cid:16) ∃ x (cid:2) ( x > P (cid:96) v ) ∧ ( x > V (cid:96) h ) (cid:3)(cid:17) . , , ,
12] = 132 12 = = 2438715621 1
Figure 1: An example of inflation.The variables (cid:96) v and (cid:96) h correspond to the vertical and horizontal lines in thedefinition of grid classes. Since we cannot quantify on lines that do not crossany dot, (cid:96) v (resp. (cid:96) h ) is the rightmost dot on the left of the vertical line (resp.the highest dot below the horizontal line). Note that, by definition, both dotsexist in SW-non-trivial decompositions. Remark . Consider a matrix M such that each entry M i,j is a set of per-mutations for which membership is expressible by a TOTO sentence (e.g. con-taining/avoiding any given generalized pattern). Then membership to the set
Grid( M ) is expressible by a TOTO sentence.These generalized grid sets (they are not permutation classes anymore) do notseem to have been introduced in the literature. However, we want to point outthat they provide a framework which generalizes both grid classes and avoidanceof barred/decorated patterns and which still fits in the expressivity range of
TOTO . Substitution decomposition is an approach to the study of permutations andpermutation classes which has proved very useful, in particular, but not only, forenumeration results. We refer to [23, Section 3.2] for a survey on this technique.In this section, we prove that standard concepts related to it are expressible in
TOTO . We will also use the inflation operation defined below later in the paper.Given π a permutation of size k and k permutations σ , . . . , σ k , the permutation π [ σ , . . . , σ k ] (called inflation of π by σ , . . . , σ k ) is the one whose diagram isobtained from that of π by replacing each point ( i, π ( i )) by the diagram of σ i (which is then referred to as a block). An example is given in Fig. 1.A permutation that can be written as π [ σ , . . . , σ k ] is called π -decomposable .When π is increasing (resp. decreasing), we may write ⊕ (resp. (cid:9) ) instead of π . Proposition 14.
There exists a
TOTO sentence φ ⊕ to express the propertythat any given permutation is ⊕ -decomposable. Obviously, the same holds for (cid:9) -decomposable permutations. The proof actuallyalso easily extends to show that being an inflation of π , for any given π , is14xpressible by a TOTO sentence.
Proof.
It is enough to take φ ⊕ to be the following sentence φ ⊕ = ∃ (cid:96) v ∃ (cid:96) h (cid:16) ∃ x [ x > P (cid:96) v ] (cid:17) ∧ (cid:16) ∀ x (cid:2) ( x (cid:54) P (cid:96) v ) ↔ ( x (cid:54) V (cid:96) h ) (cid:3)(cid:17) . Note that the part ( ∃ x [ x > P (cid:96) v ]) in the above sentence ensures that the sec-ond block in the ⊕ -decomposition is not empty. (For the first block, this isautomatically ensured by the existence of (cid:96) v , for instance). We could have usedequivalently ( ∃ x [ x > V (cid:96) h ]) . Remark . This is a variant of the statement and proof on grid classes (Propo-sition 12), where the decomposition has to be non trivial.Simple permutations, i.e. permutations that cannot be obtained as a non-trivialinflation, play a particularly important role in substitution decomposition. Theycan be alternatively characterized as permutations which do not contain a non-trivial interval, an interval being a range of integers sent to another range ofintegers by the permutation. They can also be described in
TOTO . Proposition 16.
There exists a
TOTO sentence φ simple to express the propertythat any given permutation is simple.Proof. We simply take φ simple = ¬ φ int , where φ int indicates the existence of anon-trivial interval and is given as follows φ int := ∃ (cid:96) v, ∃ (cid:96) v, ∃ (cid:96) h, ∃ (cid:96) h, [( (cid:96) v, < P (cid:96) v, ) ∧ (cid:16) ∃ y [ y < P (cid:96) v, ] ∨ [ (cid:96) v, < P y ] (cid:17) ∧ (cid:16) ∀ x (cid:2) ( (cid:96) v, (cid:54) P x (cid:54) P (cid:96) v, ) ↔ ( (cid:96) h, (cid:54) V x (cid:54) V (cid:96) h, ) (cid:3)(cid:17) . Indeed, the second line indicates that there is an interval in the permutationbetween the horizontal lines (cid:96) h, and (cid:96) h, and the vertical lines (cid:96) v, and (cid:96) v, (thedots corresponding to all these lines being included in the interval). The firstline then indicates that the interval is non-trivial.Note that Proposition 16 can also be seen as a corollary of Proposition 9, sincebeing simple is expressible by the avoidance of a finite set of mesh patterns(see [22, Proposition 2.1]). Broadly speaking a sorting operator is nothing more than a function S fromthe set of all permutations to itself that preserves size. We denote by I the set { . . . n, n ≥ } of increasing monotone permutations. The S -sortable permuta-tions are just the permutations whose image under S is an increasing permuta-tion, i.e., S − ( I ) . More generally, for a positive integer k we call the set S − k ( I ) S - k -sortable permutations . Of course if we are interested in actually using S as an effective method of sorting it should be the case that we can guaranteethat every permutation σ is S - k -sortable for some k . One sufficient conditionfor this that frequently holds (and which could be taken as part of the definitionof sorting operator) is that the set of inversions of S ( σ ) should be a subset ofthose of σ with the inclusion being strict except on I . Alternatively one couldsimply require that the number of inversions of S ( σ ) should be less than thenumber of inversions of σ .Suppose that S is a sorting operator and, just for example, that S (42531) =24135 . What has really happened is that the positional order, ≺ P , of the originalpermutation ( ≺ P ≺ P ≺ P ≺ P , where we take the value order tobe ≺ V · · · ≺ V ) has been replaced by a new one, ≺ S ( P ) , where ≺ S ( P ) ≺ S ( P ) ≺ S ( P ) ≺ S ( P ) (keeping ≺ V unchanged). So, another view of sortingoperators is that they simply change the positional order of a permutation, i.e.,that they are isomorphism-preserving maps taking permutations ( X, ≺ P , ≺ V ) to other permutations ( X, ≺ S ( P ) , ≺ V ) .We will be particularly interested in the case where ≺ S ( P ) can be expressed by aformula in TOTO . We say that a sorting operator S is TOTO -definable if there isa
TOTO formula φ SP ( x, y ) with two free variables such that for all permutations σ = ( X, ≺ P , ≺ V ) and all a, b ∈ X , a ≺ S ( P ) b if and only if ( σ, a, b ) | = φ SP ( x, y ) .Similarly, we say that a set T of permutations is definable in TOTO when thereexists a
TOTO sentence whose models are exactly the permutations in T . Proposition 17.
Suppose that a sorting operator, S , is TOTO -definable. Then,for any set of permutations T definable in TOTO , S − ( T ) is also definable in TOTO . In particular, for any fixed k , there exists a TOTO sentence whosemodels are exactly the S - k -sortable permutations.Proof. Let T be a set of permutations definable in TOTO and take any sentence φ T that defines T . Replacing every occurrence of x < P y in φ T by φ SP ( x, y ) (forany variables x and y ), we get a new sentence φ S T . Then ( X, ≺ P , ≺ V ) | = φ S T if and only if ( X, ≺ S ( P ) , ≺ V ) | = φ T , i.e., if and only if ( X, ≺ P , ≺ V ) ∈ S − ( T ) .This shows that S − ( T ) is definable in TOTO .The second statement of Proposition 17 follows since I is definable in TOTO bythe sentence: ∀ x ∀ y ( x < P y ↔ x < V y ) . We start with the stack sorting operator S , which has been considered most oftenin the permutation patterns literature. This operator S takes a permutation σ and passes it through a stack, which is a Last In First Out data structure.The contents of the stack are always in increasing order (read from top tobottom) i.e., an element can only be pushed onto the stack if it is less than thetopmost element of the stack. So, when a new element of the permutation is16rocessed either it is pushed onto the stack if possible, or pops are made fromthe stack until it can be pushed (which might not be until the stack is empty).When no further input remains, the contents of the stack are flushed to output.The ordered sequence of output elements that results when a permutation σ isprocessed is the permutation S ( σ ) . For instance, for σ ∈ S , S ( σ ) = 123 exceptfor σ = 231 . Indeed, S (231) = 213 because 2 is pushed onto the stack and thenpopped to allow 3 to be pushed, then 1 is pushed, and then the stack is flushed. Proposition 18.
The stack sorting operator S is TOTO -definable.
It follows immediately from Proposition 17 that
Corollary 19.
For any k ≥ the set of permutations sortable by S k is describedby a sentence in TOTO .Proof of Proposition 18.
To see that S is TOTO -definable we should consider,for a and b elements of some permutation σ = ( X, ≺ P , ≺ V ) , when a ≺ S ( P ) b . • If a ≺ P b and a ≺ V b then certainly a ≺ S ( P ) b . Indeed, at the time b is considered for pushing onto the stack, either a will already have beenpopped, or a will have to be popped to allow b to be pushed. • If a ≺ P b and b ≺ V a then a ≺ S ( P ) b if and only if a must be popped fromthe stack before b is considered i.e., if and only if there is some c with a ≺ P c ≺ P b and a ≺ V c (that is, acb which occur in that positional orderin σ , form the pattern ). • If b ≺ P a then a ≺ S ( P ) b happens exactly when the two following condi-tions hold: a ≺ V b and, for no c positionally between b and a is it the casethat b ≺ V c .Just from the language used in the descriptions above it should be clear that ≺ S ( P ) can be expressed by a TOTO formula. For the record, its definition canbe taken to be: x < S ( P ) y ⇔ ( x < P y ∧ ( x < V y ∨ ∃ z ( x < P z < P y ∧ x < V z ))) ∨ ( y < P x ∧ x < V y ∧ ¬∃ z ( y < P z < P x ∧ y < V z )) . It is important to note that the proofs of Propositions 17 and 18 are construc-tive. Therefore, for any k , a TOTO sentence whose models are exactly the S - k -sortable permutations can be easily (and automatically) derived from thoseproofs. The formulas so obtained can be compared to the characterization of S - k -sortable permutations by means of pattern-avoidance known in the literature[17, 22, 24]. We explain below how to recover Knuth’s result that S -sortablepermutations are those avoiding . With a little more effort, West’s char-acterization of S - -sortable permutations can be recovered in the same way.However, we were not able to “read” the characterization of S - -sortable per-mutations given by Ulfarsson on the obtained formula.17y definition, S fails to sort a permutation σ = ( X, ≺ P , ≺ V ) if and only if thereare a, b ∈ X with b ≺ S ( P ) a but a ≺ V b . From the formula describing x < S ( P ) y given at the end of the proof of Proposition 18, this is equivalent to the existenceof a and b such that a ≺ V b , b ≺ P a , and there exists a c with b ≺ P c ≺ P a and b ≺ V c . This says exactly that a permutation is stack-sortable if and onlyif it avoids the pattern . So, we have recovered in a rather round-about wayKnuth’s original characterization of stack-sortability. We consider briefly two more sorting operators: bubble sort ( B ), and sortingwith a queue and bypass ( Q ). We show that both are TOTO -definable, hencefrom Proposition 17, that for any k , B - k - and Q - k -sortable permutations aredescribed by a TOTO sentence.The bubble sort operator can be thought of as sorting with a one element buffer.When an element a of the permutation is processed we: • place a in the buffer if the buffer is empty (this only occurs for the firstelement of the permutation), • output a directly if the buffer is occupied by a value larger than a , • output the element in the buffer and place a in the buffer if the elementin the buffer is smaller than a .When the whole permutation has been processed we output the element remain-ing in the buffer. The result of sorting σ with this mechanism is denoted B ( σ ) .It is easy to see that: x < B ( P ) y ⇔ ( x < P y ∧ ∃ z ( z (cid:54) P y ∧ x < V z )) ∨ ( y < P x ∧ ¬∃ z ( z (cid:54) P x ∧ y < V z )) The first clause captures the situation where x precedes y and is either outputimmediately (because the buffer is occupied by some larger element z when x is processed), or caused to be output by some such z (possibly equal to y ) upto the point when y is processed. The second clause captures the only way thattwo elements can exchange positional order. The first must be able to enter thebuffer (so there can be no larger preceding element) and must remain there up toand including the point at which the second arrives. As in the stack sorting caseit is possible to use this definition to characterize the B -sortable permutationsas those that avoid the patterns 231 and 321.In sorting with a queue and bypass, we maintain a queue (First In First Outdata structure) whose elements are in increasing order. When an element isprocessed it: • is added to the queue if it is greater than the last element of the queue,18 is output directly if it is less than the first element of the queue, • causes all lesser elements of the queue to be output and is then added tothe queue (if it is now empty), or output (if greater elements still remainin the queue).It can easily be seen that being sortable by this algorithm is equivalent to beingsortable by two queues in parallel, which is one of the models studied by Tarjanin [21].Note that any element which is preceded (not necessarily immediately) by agreater element is output immediately (possibly after some elements have beenremoved from the queue), while any element which has no preceding greaterelement is added to the queue. For convenience let φ ( x, y ) = x < P y ∧ x < V y,φ ( x, y ) = x < P y ∧ y < V x,φ R ( x ) = ¬∃ z φ ( z, x ) ,φ out ( x, y ) = ∃ z, w ( φ ( z, w ) ∧ x (cid:54) P w (cid:54) P y ) . The first three of these capture natural definitions ( φ R corresponding to being aleft-to-right maximum). The fourth expresses the idea that “ x didn’t enter thequeue or was removed from the queue by the arrival of some element w before(or including) y ”. Then it is easy to see that: x < Q ( P ) y ⇔ φ ( x, y ) ∨ φ out ( x, y ) ∨ ( φ R ( y ) ∧ ¬ φ out ( y, x ) ∧ φ ( y, x )) . The first two clauses capture how a precedes b in Q ( σ ) if a ≺ P b . Namely, either ab forms a pattern or a never enters the queue at all, or it does but is causedto leave the queue by a subsequent addition to the queue (up to the arrival of b ). The final clause covers the situation where b ≺ P a but a ≺ Q ( P ) b . For thisto occur it must be the case that b enters the queue and is not caused to leavebefore a arrives (and then a ≺ V b is also needed otherwise a would either enterthe queue as well or cause b to be released from the queue).Despite the apparent complexity of the definition of ≺ Q ( P ) , it is easy to inferthat the Q -sortable permutations are precisely those that avoid the pattern 321,recovering a result in [21].We summarize our findings in the following proposition Proposition 20.
The sorting operators S (stack sorting), B (bubble sort) and Q (queue and bypass) are all TOTO -definable. As a consequence, for any com-position F of these sorting operators, the set F − ( I ) is definable in TOTO .Remark . There is a pleasant coincidence here: a permutation is B -sortableif and only if it is both S - and Q -sortable. This is perhaps not unexpected since19he only way to operate a queue or a stack without being able to determinewhich one is being used is to ensure that there is never more than one elementstored (i.e., use it as a single element buffer), but we don’t pretend to say thatthis should automatically follow on a logical basis! Although
TOTO is designed to express some pattern-related concepts, someinformation on the cycle decomposition of permutations is expressible in
TOTO .We start by an easy observation.
Proposition 22.
For any partition λ , there exists a TOTO formula expressingthat a permutation is of cycle-type λ .Proof. There are a finite number of permutations of cycle-type λ . So we cansimply take the disjunction, over all permutations σ of cycle-type λ , of the TOTO formula whose only model is σ (see Proposition 4).Here is a more surprising result along these lines. Recall that λ ∪ (1 k ) is obtainedby adding k parts equal to to λ (see the end of the introduction). Proposition 23.
For any partition λ , there exists a TOTO formula expressingthat a permutation is of cycle-type λ ∪ (1 k ) , for some value of k ≥ .Proof. As usual, for a partition λ = ( λ , . . . , λ q ) , we denote by | λ | = (cid:80) qi =1 λ i its size. Being of cycle-type λ ∪ (1 k ) for some value of k can be translated asfollows: there are | λ | distinct elements which forms a pattern of cycle-type λ and all other elements are fixed points. This is illustrated in Fig. 2, which showsa schematic representation of a permutation with cycle-type (3 , ∪ (1 k ) .This does not immediately imply that being of cycle-type λ ∪ (1 k ) is expressiblein TOTO , since
TOTO cannot a priori express fixed points. However, this allowsto translate the property of being of cycle-type λ ∪ (1 k ) in a language that TOTO can speak.Namely, for a permutation σ and a subset X = { x , . . . , x | λ | } of size | λ | of A σ = { ( i, σ ( i )) : 1 (cid:54) i (cid:54) n } , we consider the following properties:(P1) the pattern π induced by σ on the set X has cycle-type λ ;(P2) the value and position orders coincide outside X ;(P3) for each element y outside X there are as many elements of X below y inthe value order as in the position order.We claim that for a permutation σ , the existence of a set X of size | λ | withproperties (P1), (P2) and (P3) is equivalent to being of cycle-type λ ∪ (1 k ) .This will be proved later. For the moment, we focus on explaining why the20 • • • • Figure 2: A schematic representation of a permutation σ with cycle-type (3 , ∪ (1 k ) . The vertical and horizontal dotted lines indicate the positions and valuesof elements in the support of σ . The black points representing elements of thesupport form a pattern of cycle-type (3 , . The diagonal lines represent anarbitrary number of points, placed in an increasing fashion, which are fixedpoints.existence of such a set X with the above three properties is indeed expressiblein TOTO .Recall that
TOTO is a first-order theory, so that we can only quantify on vari-ables and not on sets. However, since X has a fixed size | λ | , quantifying on X or on variables x , . . . , x | λ | is the same. It is therefore sufficient to check thateach of the properties (P1), (P2) and (P3) are expressible in TOTO by some
TOTO formula in the free variables x , . . . , x | λ | .For the first property, we take as before the disjunction over all patterns π with cycle-type λ . The second property writes naturally in terms of value andposition orders and is therefore trivially expressible in TOTO . For the third one,we have to be a bit more careful since sentences of the kind “there are as manyelements . . . as” are in general not expressible in first-order logic. But we arecounting elements of X with given properties and X has a fixed size ( | X | = | λ | ).So, we can rewrite (P3) as a finite disjunction over j (cid:54) | λ | and over all pairsof subsets X P and X V of X of size j of properties “the elements of X below y in the position order are exactly those of X P and the elements of X below y in the value order are exactly those of X V ”. This shows that the existence of aset X of size | λ | such that properties (P1), (P2) and (P3) hold is expressible in TOTO .We now prove our claim that, for a permutation σ , the existence of a set X ofsize | λ | with properties (P1), (P2) and (P3) is equivalent to being of cycle-type λ ∪ (1 k ) , for any value of k ≥ .First take a permutation σ of cycle-type λ ∪ (1 k ) . We consider its support (i.e.the set of non fixed points), denoted I s . And if λ has m parts equal to , we21hoose arbitrarily a set I f of m fixed points of σ . This gives a set I = I s (cid:93) I f such that σ ( I ) = I and such that the restriction of σ to I has cycle-type λ . Weset X = { ( i, σ ( i )) , i ∈ I } . In particular, σ induces a pattern π of cycle-type λ on X , so that (P1) is satisfied. Property (P2) is also satisfied since all pointsoutside X are fixed points for the permutation σ . Consider property (P3). Wetake x = ( i, σ ( i )) in X and y outside X . Since y is a fixed point i.e. y = ( j, j ) for some j , the relation x < V y is equivalent to σ ( i ) < j . Besides, by definition, x < P y means i < j . But σ ( I ) = I so that there are as many i in I such that i < j as i in I such that σ ( i ) < j . This proves that X also satisfies property(P3).Conversely, we consider a permutation σ and we assume that there is a subset X of elements of σ satisfying (P1), (P2) and (P3). We want to prove that σ hascycle-type λ ∪ (1 k ) .Let I be such that X = { ( i, σ ( i )) , i ∈ I } . We first prove that σ ( I ) = I . Considerthe smallest element x = ( i , σ ( i )) of X in the position order and its smallestelement y = ( j , σ ( j )) in the value order. By property (P3), an element y outside X is below x in the position order if and only if it is below y in thevalue order. Therefore the rank of x in the position order (which is i ) is thesame as the rank of y in the value order (which is σ ( j ) ), so that σ ( j ) = i .Similarly, if x k = ( i k , σ ( i k )) (resp. y k = ( j k , σ ( j k )) ) is the k -th smallest elementof X in the position (resp. value) order, then σ ( j k ) = i k , which proves σ ( I ) = I .We now claim that elements y outside X are fixed points for σ . To do that, weshould prove that there are as many elements z below y in the position orderas in the value order. Property (P3) says that this holds when restricting toelements z of X . But property (P2) tells us that an element z in the complement X c of X is below y in the position order if and only if it is below y in the valueorder, so that there is the same number of elements z of X c below y in bothorders. We can thus conclude that y is a fixed point for σ .By (P1), the pattern induced by σ on I has cycle-type λ . Moreover, since σ ( I ) = I , the restriction of σ to I is a union of cycles of σ , so that σ has cycle-type λ ∪ µ for some µ . On the other hand, we have proved that elements outside I are fixed points for σ . Therefore µ = (1 | X c | ) and σ has cycle-type λ ∪ (1 k ) , aswanted. As we have seen above with many examples, proving that a property of per-mutations is expressible in
TOTO is easy, at least in principle: it is enough toprovide a
TOTO formula expressing it. But how to prove that a property is not expressible in
TOTO ? To this end, we present a technique – that of Ehrenfeucht-Fraïssé games – to show inexpressibility results in
TOTO . This method is very22lassical, although its application in the context of permutations seems to benew.
Ehrenfeucht-Fraïssé, or Duplicator-Spoiler games are a fundamental tool inproving definability and non-definability results. We give a brief introductionto them in the context of the permutations as models of
TOTO below, but alsorefer the reader to [12–14, 20] for various presentations with differing emphases.Let α and β be two permutations (or more generally any two models of the sametheory), and let k be a positive integer. The Ehrenfeucht-Fraïssé (EF) game oflength k played on α and β is a game between two players (named Duplicator and
Spoiler ) according to the following rules: • The players alternate turns, and Spoiler moves first. • The game ends when each player has had k turns. • At his i th turn, ( (cid:54) i (cid:54) k ) Spoiler chooses either an element a i ∈ α oran element b i ∈ β . In response, at her i th turn, Duplicator chooses anelement of the other permutation. Namely, if Spoiler has chosen a i ∈ α ,then Duplicator chooses an element b i ∈ β , and if Spoiler has chosen b i ∈ β , then Duplicator chooses a i ∈ α . • At the end of the game if the map a i (cid:55)→ b i for all i (cid:54) k preserves bothposition and value orders, then Duplicator wins (more generally, she winsif the map a i (cid:55)→ b i defines an isomorphism between the submodels of α and β consisting of { a i , (cid:54) i (cid:54) k } and { b i , (cid:54) i (cid:54) k } , respectively).Otherwise, Spoiler wins.We assume that the players play in the best possible way, i.e. we say that Dupli-cator wins if she has a winning strategy. Put briefly for the case of permutations,Duplicator wins if she can at every turn, choose a point which corresponds tothe point just chosen by Spoiler in the other permutation, in the sense that itcompares in the same way to all previously chosen points, both for the valueand the position orders. If Duplicator wins the k -move EF game on α and β wewrite α ∼ k β . It is easy to check that ∼ k is an equivalence relation for each k .Based on the recursive definitions of formulas we can define the quantifier depth , qd( ψ ) , of a formula ψ in an obvious way. If ψ is an atomic formula then qd( ψ ) = 0 . Otherwise: qd( ¬ ψ ) = qd( ψ ) , qd( ψ ∨ θ ) = qd( ψ ∧ θ ) = max(qd( ψ ) , qd( θ )) , qd( ∃ x ψ ) = qd( ∀ x ψ ) = qd( ψ ) + 1 . α ∼ k β if and only if α and β satisfy the same set of sentences ofquantifier depth k or less.One way to use this result is to establish when two models satisfy the same setof sentences (of all quantifier depths). However, this is not so interesting in thefinite context where this is equivalent to isomorphism. Instead, we are interestedin its application in proving inexpressibility results. Consider some property, P ,of permutations (or of models over some other signature). We would like toknow if P is expressible in TOTO , that is whether or not there is some
TOTO sentence ψ such that α is a model of ψ if and only if α has property P . To showthat this is impossible it suffices to demonstrate, for each positive integer k , thatthere are permutations (resp. models) α and β such that Duplicator wins the k -move EF game on α and β , and α satisfies P but β does not.We begin with a simple but illustrative example which uses a well-known resultabout EF games for finite linear orders (see, e.g., Theorem 2.3.20 of [12]). Weinclude the proofs as they capture the flavour of what is to follow. Proposition 24.
Let a positive integer k be given. If X and Y are finite linearorders and | X | , | Y | ≥ k − , then Duplicator wins the k -move EF game playedon ( X, Y ) .Proof. After the r -th move, r elements have been chosen in X and this defines r + 1 intervals I , . . . , I r , where I i consists of the elements of X that are greaterthan exactly i out of the r elements chosen so far. Similarly, elements chosen in Y define r + 1 intervals J ,. . . , J r .The basic idea of the proof is simple. For a fixed integer parameter a call asubinterval of a finite linear order consisting of at least a − elements a -long .The following claim is easily proved by iteration on r (from to k ): regardlessof Spoilers’ moves, Duplicator can always arrange that after r moves, for any s in { , . . . , r } either I s and J s are both ( k − r ) -long, or have exactly the samelength.Applying this strategy on the k -move EF game played on ( X, Y ) , the subordersof X and Y induced by the chosen elements are clearly isomorphic, proving ourproposition. Corollary 25.
There is no first-order sentence to express that a finite linearorder contains an even number of elements.Proof.
The proof is by contradiction. Assume such a sentence φ would exist.It would have a specific quantifier depth, k . Consider X and Y two linearorders with | X | = 2 k and | Y | = 2 k − . Of course, X | = φ while Y (cid:54)| = φ . Butfrom Proposition 24, we have X ∼ k Y , which brings a contradiction to thefundamental theorem of Ehrenfeucht and Fraïssé.24 .2 Some consequences for permutations From now on, for any integer n , let us denote by ι n = 12 . . . n (resp. δ n = n . . . ) the increasing (resp. decreasing) permutation of size n . Proposition 26.
Let n , m and k be positive integers with n, m ≥ k − . Thenwe have ι m ∼ k ι n and δ m ∼ k δ n .Proof. In an increasing permutation, position and value order coincide. There-fore the EF game on ι m and ι n can be played as if it was played on linearorders of m and n elements respectively. We conclude by Proposition 24 thatDuplicator wins the k -move Duplicator-Spoiler game.The same is true for decreasing permutations δ m and δ n since in this case, thevalue order is just the opposite of the position order. Corollary 27.
The property of having a fixed point is not expressible by asentence in
TOTO . In other words, there does not exist a sentence ψ in TOTO such that σ | = ψ if and only if σ has a fixed point.Proof. Consider the monotone decreasing permutation δ n on n elements. If n is odd, then δ n has a fixed point, while if it is even, it does not. Suppose thata sentence ψ of TOTO defined “having a fixed point” and had quantifier depth k . Then, from Proposition 26, either both δ k − and δ k would satisfy ψ orneither would. However, one has a fixed point and the other does not, whichcontradicts the supposed property of ψ .We will use the underlying idea of the previous argument in a number of differentcontexts in what follows. Specifically, we will generally construct permutations α and β which are similar enough that Duplicator wins the EF game of a certainlength, but are different enough that one has the property under considerationwhile the other does not. Frequently this ‘similarity’ will involve some embeddedmonotone subsequences, and we will use notation as inflations, sums and skew-sums to describe such situations in a uniform way.The following proposition is the key ingredient in most of the arguments in thenext section. Proposition 28.
Let α ∈ S n and for (cid:54) i (cid:54) n suppose that σ i ∼ k τ i . Then α [ σ , σ , . . . , σ n ] ∼ k α [ τ , τ , . . . , τ n ] .Proof. It is easy to demonstrate a winning strategy for Duplicator in the EFgame of length k on α [ σ , σ , . . . , σ n ] and α [ τ , τ , . . . , τ n ] . She simply keepstrack of n EF games, one in each of the pairs σ i and τ i . Whenever Spoilermakes a move, she notes the corresponding σ i or τ i , and responds in that game(and the corresponding part of α ), according to the winning strategy guaranteedby σ i ∼ k τ i . Since the relationships between different σ s and τ s are fixed, hermove maintains an isomorphism, and since she is never required to move morethan k times in any particular σ i or τ i she wins at the end.25here is a corresponding result when the inflated permutations are only relatedby ∼ , and when we inflate all points by the same permutation. Proposition 29.
Let α ∈ S n and β ∈ S m and suppose that α ∼ k β . Take anarbitrary permutation σ . Then α [ σ, σ, . . . , σ ] ∼ k β [ σ, σ, . . . , σ ] .Proof. By construction, the elements of α [ σ, σ, . . . , σ ] are partitioned into | α | copies of the diagram of σ , each copy corresponding to one element ( i, α ( i )) (or α ( i ) for short) of the diagram of α . In this proof, we will refer to the copycorresponding to α ( i ) as the σ -inflation of α ( i ) . We use a similar terminologyfor β [ σ, σ, . . . , σ ] .This time Duplicator needs to follow the winning strategy which is guaranteedfrom α ∼ k β . Whenever Spoiler makes a move, Duplicator first notes theelement α ( i ) or β ( i ) such that Spoiler’s move has been done in the σ -inflationof α ( i ) or β ( i ) ; Duplicator then responds in the σ -inflation of the β ( j ) or α ( j ) given by the winning strategy for the game on ( α, β ) . Within this copy of σ ,Duplicator chooses the same element as Spoiler has chosen in his copy.We note that at the end of the game, there can be several marked elements inthe same copy of σ . That relations between elements in different copies of σ arethe same in α [ σ, σ, . . . , σ ] and β [ σ, σ, . . . , σ ] is ensured by Duplicator following awinning strategy for the game on ( α, β ) . Since relations inside a single copy of σ are the same on both sides, Duplicator’s moves always maintain an isomorphismand she will triumph. In the sequel we will also want to prove results about the (in)expressibility ofcertain properties of elements of permutations (as opposed to properties of thepermutations themselves). Recall that expressing such a property in
TOTO means representing it by a formula φ ( x ) having one or more free variables, x .And for a sequence a of elements from a permutation σ , the property would besatisfied by a in σ if and only if ( π, a ) | = φ ( x ) .There is a standard modification of EF games that allows one to demonstrateinexpressibility in this case as well. Similarly to the previous case, for twopermutations α and β , each equipped with a sequence of “marked” elements a and b of the same size, say r , we write ( α, a ) ∼ k ( β, b ) if both pairs satisfy thesame formulas with r free variables and quantifier-depth at most k . Writing a = ( a , . . . , a r ) and b = ( b , . . . , b r ) , the modified EF game with k rounds onsuch a pair ( α, a ) and ( β, b ) goes as follows: for each i (cid:54) r , at round i , Spoilermust choose a i and Duplicator b i ; then, k additional rounds are played, as ina classical EF game. The usual isomorphism criterion (on sequences of r + k chosen elements) determines the winner. It can be proved that ( α, a ) ∼ k ( β, b ) if and only if Duplicator has a winning strategy in this game.We illustrate this method of proof with Proposition 30 below.26 roposition 30. The property that a given element of a given permutation isa fixed point is not expressible by a formula in
TOTO . In other words, theredoes not exist a formula φ ( x ) such that ( σ, a ) | = φ ( x ) if and only if a is a fixedpoint of σ . Of course, it should be noticed that Proposition 30 is also an immediate conse-quence of Corollary 27. Indeed, if such a formula φ ( x ) were to exist, quantifyingexistentially over x would provide a sentence (namely, ∃ x φ ( x ) ) expressing theexistence of a fixed point in TOTO , therefore contradicting Corollary 27.
Proof.
Recall that ι n denotes the monotone increasing permutation on n ele-ments, and let π m,n = ι m (cid:9) (cid:9) ι n = 321[ ι m , , ι n ] . Denote by a m,n the “central”element of π m,n , that is to say the one which inflates the in . Clearly, a m,n is a fixed point of π m,n if and only if m = n .Now, assume that there exists a formula φ ( x ) expressing the property that x isa fixed point, and denote by k its quantifier depth. Taking n = 2 k − , it holdsthat ( π n,n , a n,n ) ∼ k ( π n,n +1 , a n,n +1 ) . This follows indeed from Propositions 26and 28. On the other hand, a n,n is a fixed point of π n,n whereas a n,n +1 is nota fixed point of π n,n +1 , bringing a contradiction to the fundamental theorem ofEhrenfeucht and Fraïssé. TOTO to permu-tation classes
As we discussed in the introduction,
TOTO is not designed to express propertiesrelated to the cycle structure of permutations. And indeed, in general,
TOTO cannot express such properties. We have seen already with Corollary 27 andProposition 30 that the simplest statements of “having a fixed point” or “a givenelement is a fixed point” are not expressible in
TOTO . We will see later withTheorem 36 that
TOTO is also unable to express that a sequence of elementsforms a cycle.In this section, we consider restrictions of
TOTO and ask whether some prop-erties of the cycle structure of permutations (like containing a fixed point or acycle of a given size) become expressible in such restricted theories. We focuson the restricted theories
TOTO ( C ) : the signature is the same as in TOTO ,but
TOTO ( C ) has additional axioms, to ensure that the models considered areonly the permutations belonging to some permutation class C . Recall that apermutation class is a set of permutations that is closed downward by extrac-tion of patterns, and that every permutation class can be characterized by theavoidance of a (possibly infinite) set of classical patterns [4].Our goal is a complete characterization of the permutation classes C for which TOTO ( C ) can express the fixed point (resp. longer cycle) property.27e actually consider two versions of this problem. With the “sentence” version,we are interested in finding (or proving the existence of) sentences expressing theexistence of a fixed point (resp. of a certain cycle). For the “formula” version ofthe problem, given an element (resp. a sequence of elements) of a permutation,we ask whether there is a formula with free variable(s) expressing the propertythat this element is a fixed point (resp. this sequence of elements is a cycle).Of course, a positive answer to the “formula” problem implies a positive an-swer to the “sentence” problem, simply by quantifying existentially over all freevariables of the formula. But a priori the converse need not be true. A pos-teriori , we will see that in the case of fixed point the converse does hold (seeTheorem 33): there exists a sentence expressing the existence of fixed points in
TOTO ( C ) if and only if there exists a formula expressing that a given elementis a fixed point in TOTO ( C ) . This does not however generalize to larger cycles. In the simplest case of fixed points, we have seen with Corollary 27 and Propo-sition 30 that there is neither a formula nor a sentence expressing the propertyof being/the existence of a fixed point in the unrestricted theory
TOTO .Taking a closer look at the proofs of these statements, we actually know alreadyof some necessary conditions for a class C to be such that fixed points areexpressible in TOTO ( C ) . First, the proof of Corollary 27 shows that if C containsall the permutations δ m then the existence of a fixed point is not expressible inthe models belonging to C . Put formally, we have the following. Lemma 31.
If there exists a sentence in
TOTO ( C ) expressing the existence ofa fixed point, then C must avoid at least one decreasing permutation δ k . A similar statement along these lines is the following.
Lemma 32.
If there exists a sentence in
TOTO ( C ) expressing the existence ofa fixed point, then C must avoid at least one permutation of the form π m,n =321[ ι m , , ι n ] .Proof. The essential argument is in the proof of Proposition 30. Assume thatthere exists such a sentence, of quantifier depth k . Assume in addition thatall permutations π m,n belong to C . Let n = 2 k − , and remark that π n,n and π n,n +1 both belong to C . Combining Propositions 26 and 28, we get π n,n ∼ k π n,n +1 . On the other hand, remark that π n,n has a fixed point while π n,n +1 does not, bringing a contradiction to the fundamental theorem of Ehrenfeuchtand Fraïssé.We can conclude that if C permits the definition of fixed points in the sentencesense, then C must not contain all the permutations ι m , , ι n ] , in additionto not containing all decreasing permutations. In fact, we shall prove that theseconditions are sufficient. 28 heorem 33. Let C be a permutation class. The following are equivalent.1. There exists a sentence ψ ∈ TOTO ( C ) that expresses the existence of fixedpoints in C ; namely, for σ in C , σ | = ψ if and only if σ has a fixed point.2. There exists a formula φ ( x ) ∈ TOTO ( C ) that expresses the fact that a is afixed point of σ ; namely, for σ in C and a an element of σ , ( σ, a ) | = φ ( x ) if and only if a is a fixed point of σ .3. There exist positive integers k , m and n such that δ k and ι m , , ι n ] do not belong to the class C . Before starting the proof, we recall for the reader’s convenience a famous resultof Erdős and Szekeres [11], which is used in several proofs throughout thissection: any permutation of size at least ab + 1 contains either an increasingsubsequence of size a + 1 or a decreasing one of size b + 1 . Proof.
As mentioned earlier, 2 trivially implies 1 (by existential quantificationover x ). We have also seen in Lemmas 31 and 32 that, if there exists a sen-tence expressing the existence of a fixed point in C , then C must exclude onepermutation δ k and one permutation of the form ι m , , ι n ] ; in other words 1implies 3. Finally, we prove that 3 implies 2. Suppose that there exist positiveintegers k , m and n such that δ k / ∈ C and ι m , , ι n ] / ∈ C . Let σ ∈ C be givenand consider a point a in the domain A σ of σ (recall from Section 2.2 that, in TOTO , A σ = { ( i, σ ( i )) , (cid:54) i (cid:54) n } ). We consider U = { y ∈ A σ : y < P a and y > V a } V = { y ∈ A σ : y > P a and y < V a } . Clearly, a is a fixed point if and only if | U | = | V | .Assume now that a is a fixed point. We will show that there is a bound on | U | ,uniform on all fixed points of all permutations σ in C (but depending on C ).Suppose without loss of generality that m ≥ n . If | U | = | V | > ( m − k − then the subpermutations of σ on U and V must both contain either δ k − or ι m by the Erdős-Szekeres theorem. But if either contained δ k − then σ wouldcontain δ k , while if both contained ι m then σ would contain ι m , , ι n ] . Since C is a class, contains σ but contains neither δ k nor ι m , , ι n ] , in all cases wereach a contradiction.So, if a is a fixed point then necessarily | U | , | V | (cid:54) ( m − k − . Now, usingthe above characterization of fixed points, it is easy to see how to construct aformula (with one free variable x ) that expresses that a is a fixed point: namely,we take the (finite) disjunction over i (cid:54) ( m − k − of “there exist exactly i points in U and exactly i points in V ”. Remark . The following fact was used implicitly in the above proof, andwill also be in subsequent proofs. Let φ ( x ) and φ ( x ) be formulas in TOTO .29or a fixed k , the property “there exists exactly k elements x satisfying φ ” isexpressible in TOTO (and similarly with φ ). Simply write ∃ y . . . ∃ y k (cid:0) y (cid:54) = y ∧ · · · ∧ y (cid:54) = y k ∧ · · · ∧ y k − (cid:54) = y k (cid:1) ∧ (cid:0) φ ( x ) ↔ ( x = y ∨ · · · ∨ x = y k ) (cid:1) It is however not in full generality possible to express the fact that there are asmany elements satisfying φ as elements satisfying φ . Therefore, being able tobound the number of elements in U and V in the above proof is key. Remark . In preparation of the next section, it is helpful to notice that, in theproof of Theorem 33, the Erdős-Szekeres theorem can also be used to identify theobstructions δ k and ι m , , ι n ] . Indeed, consider σ ∈ C , a ∈ A σ and supposethat a is a fixed point of σ . Consider U and V as defined in the above proof,and assume that | U | and | V | are “large”, namely at least ( m − + 1 . Then,using the Erdős-Szekeres theorem, in each of those two regions we can choosea monotone subsequence of length m , and deleting all elements other than a and those subsequences we see that C contains at least one of the following fourpermutations: α ,m α ,m α ,m α ,m where in each case both the monotone segments contain m points. Since C is aclass, it holds that if C contains α i,m , then C also contains all the permutationsof the same general shape but with the two monotone sequences of arbitrarylength at most m . Assuming that there is no bound on | U | and | V | , the usualEF game argument based on Proposition 26 shows that there is no formulaexpressing the property of being a fixed point in TOTO ( C ) (as done in the proofof Lemma 32). So, for fixed points to be definable, for each i , C must avoidsome α i,m . Note though that avoiding α ,m already implies avoiding α , m +1 and α , m +1 so we can ignore the middle two configurations thus obtaining ournecessary obstructions δ k and ι m , , ι n ] , which can next be proved to besufficient for expressibility of fixed points. After describing the classes C where fixed points are expressible by a formula in TOTO ( C ) , we wish to similarly describe classes in which we can express that agiven sequence of elements is a cycle. This is achieved with Theorem 36 below,the notation E ( π, i , X ) used in this theorem being defined later in this section.The classes I and D are the classes of monotone increasing and decreasingpermutations, respectively. Theorem 36.
Let C be a permutation class, and k be an integer. The followingare equivalent. . There is a formula φ ( x ) of TOTO ( C ) with free variables x = ( x , . . . , x k ) such that for all σ ∈ C and all sequences a = ( a , . . . , a k ) of elements of σ , ( σ, a ) | = φ ( x ) if and only if a is a cycle of σ .2. For each k -cycle π , for each non-trivial cycle i of distinct elements from [ k + 1] , and for each sequence X of the same length as i , consisting of I sand D s, the class C avoids at least one permutation in each class of theform E ( π, i , X ) . Several remarks about this theorem should be made. First, in the case of trans-positions, the second condition takes a neater form, similar to the one we foundfor fixed points. Next, note that it characterizes the classes C for which thereexists a formula (with free variables) expressing that a given sequence of ele-ments is a cycle, but it does not characterize the classes where the existence ofa cycle could be expressed by a sentence in TOTO ( C ) . We have not been able toprovide such a characterization. Finally, the main theorem that we shall provein this section is not exactly Theorem 36, but a variant of it (see Theorem 40),involving the notion of stable subpermutation .For π ∈ S k and σ ∈ S n , we say that π is a stable subpermutation of σ if thereis some k -element subset Σ ⊆ [ n ] such that σ maps Σ to Σ , and the pattern of σ on Σ equals π . We call the set Σ (or a sequence consisting of its elements) a stable occurrence of π in σ . That is, the stable subpermutations that σ containsare just the subpermutations (or patterns) defined on unions of the cycles of σ .For example, is a stable subpermutation of σ if and only if σ has a fixed point,and the fixed points of σ are precisely the stable occurrences of 1 in it. Orconsider π = 231 . The permutation σ = 2413 contains π in the sense of patterncontainment since the pattern of is . But π is not a stable subpermutationof σ since σ is a four-cycle so in fact its only stable permutations are the emptypermutation and itself. On the other hand σ = 4356712 does contain as astable subpermutation since (1 , , is a cycle of σ and the pattern of that cycleis .We now wish to consider the question: given π ∈ S k , in which permutationclasses C is there a formula of φ ( x ) ∈ TOTO ( C ) with k free variables such thatfor σ ∈ C , ( σ, a ) | = φ ( x ) if and only if a is a stable occurrence of π in σ ? To answer this question, we extend some ideas already presented in the fixedpoint case (in the proof of Theorem 33 and in Remark 35). The argumentsbeing however more complicated, we first present an intermediate case: that oftranspositions, i.e. stable occurrences of . About transpositions, we prove the following statement.
Theorem 37.
Let C be a permutation class. The following are equivalent. . There exists a formula φ ( x, y ) ∈ TOTO ( C ) that expresses the fact that ( a, b ) is a transposition in σ ; namely, for σ in C and ( a, b ) a pair ofelements of σ , ( σ, ( a, b )) | = φ ( x, y ) if and only if ( a, b ) is a transpositionof σ .2. There exist integers k ≥ , m ≥ and n ≥ such that δ k and ι m (cid:9) ι n do not belong to the class C . The strategy to prove Theorem 37 is the same as in the fixed point case. Givena transposition ( a, b ) of a permutation σ , we identify subsets of elements of σ whose cardinality must satisfy some constraints (like | U | = | V | in the fixedpoint case). Then, as in Remark 35, we determine necessary conditions on apermutation class C for TOTO ( C ) to possibly express that a given pair of pointsis a transposition. And finally, we prove as in Theorem 33 that these conditionsare also sufficient.Consider a permutation σ where two points a and b forming an occurrence of have been identified. The designated copy of splits the remaining elementsof σ into nine regions forming a × grid, as in σ = . For (cid:54) i, j (cid:54) , we denote a i,j the number of elements in the region in the i -throw and j -th column (indexing rows from bottom to top). Call A ( σ, ( a, b )) =( a i,j ) the corresponding × matrix. The designated points form a stable occurrence of (i.e., a transposition) if and only if • the number of other points of σ in the first column equals those in the firstrow, i.e. a , + a , = a , + a , (we simplified a summand a , , appearingon each side); • and likewise for the second and third columns and rows, i.e. a , + a , = a , + a , and a , + a , = a , + a , .These equalities are the analogue of the characterization | U | = | V | of fixedpoints, used in the previous section. Note that the elements lying in any diagonalcell contribute equally to the corresponding sums, and are therefore irrelevant.We claim that a nonnegative matrix A satisfies the above equality if and onlyif it is a nonnegative linear combination (cid:80) i =1 c i A ( i ) , where (indexing matrixrows from bottom to top): A (1) = , A (2) = , A (3) = , A (4) = A (5) = , A (6) = , A (7) = , A (8) = a , + a , = a , + a , , a , + a , = a , + a , and a , + a , = a , + a , , the existence of such a decomposition is not hard toprove “greedily”, i.e. choosing, for increasing i , each c i as large as possible.Details are skipped here since it actually follows as a particular case of thecoming Lemma 39. Proof of Theorem 37 (1. implies 2.)
Let C be a permutation class. For each σ in C and pairs ( a, b ) of elements of σ forming an inversion, we consider thecorresponding matrix A ( σ, ( a, b )) and its above decomposition.Assume that this yields arbitrarily large coefficients c . This means that entries a , and a , of A ( σ, ( a, b )) can be simultaneously both arbitrary large. Putdifferently, the class contains permutations of the form τ , , τ , witharbitrary large permutations τ and τ . Then, using Erdős-Szekeres theorem asin Remark 35, C contains arbitrarily large permutations of one of the followingfour types ( n and m denoting the sizes of the monotone segments): α ,n,m α ,n,m α ,n,m α ,n,m .If this is the case, an EF-game argument using Propositions 26 and 28 showsthat transpositions are not definable in C . Indeed, we simply consider a largepermutation σ as above with both segments representing monotone sequences ofthe same size and the permutation σ (cid:48) obtained by adding a point in one of thismonotone sequence. Then if ( a, b ) and ( a (cid:48) , b (cid:48) ) denote the elements correspondingto the marked elements (i.e., the black dots) in σ and σ (cid:48) respectively, Duplicatorwins the EF-games in k rounds on ( σ, ( a, b )) and ( σ (cid:48) , ( a (cid:48) , b (cid:48) )) , but ( a, b ) is atransposition in σ , while ( a (cid:48) , b (cid:48) ) is not in σ (cid:48) . Therefore, for 1. to hold, for each i (cid:54) , the class C must avoid a permutation α i,n,m for some n and m . For i = 1 ,this implies that there exists n , and m such that ι n (cid:9) ι m does not belong to C .The same argument looking at the coefficient c where the large permutationsare taken to be decreasing implies the existence of a k such that δ k does notbelong to C . Proof of Theorem 37 (2. implies 1.)
Suppose that there exists k ≥ , n ≥ and m ≥ such δ k and ι n (cid:9) ι m do not belong to C . Suppose w.l.o.g. that m ≥ n . Let σ ∈ C and let ( a, b ) be a pair of elements of σ forming a transposition. We recallthat the matrix A ( σ, ( a, b )) then writes as a linear combination (cid:80) i =1 c i A ( i ) . Wewill prove that we can bound the possible values of the coefficients c , c , . . . , c .If c > ( m − k − , we have min( a , , a , ) > ( m − k − and by theErdős-Szekeres theorem, the corresponding regions of σ contain either δ k or ι m .Since δ k is not in C , they should both contain ι m . This is however impossible33ince then C would contain ι n (cid:9) ι m . We conclude that c (cid:54) ( m − k − . Thesame argument shows that max( c , . . . , c ) (cid:54) ( m − k − . This does howevernot apply to the coefficients c , c and c .We conclude that, when ( a, b ) forms a transposition, the non-diagonal coeffi-cients of A ( σ, ( a, b )) are all bounded by m − k − . Recall that an inversion ( a, b ) is a transposition if and only if a , + a , = a , + a , , a , + a , = a , + a , , a , + a , = a , + a , (1)A formula expressing that ( a, b ) is a transposition can therefore be obtained as aconjunction of two formulas. The first one simply says that ( a, b ) is an inversion.The second one is a big disjunction over lists ( a , , a , , a , , a , , a , , a , ) in { , , , . . . , m − k − } satisfying Eq.(1) of the fact that • there are exactly a , elements smaller than a and b in value order (i.e. inthe first row of A ( σ, ( a, b )) ) and between a and b in position order (i.e. inthe second column of A ( σ, ( a, b )) ). • and similar conditions involving a , , a , , a , , a , and a , .This example illustrates that the distinction between “formulas that recognizecycles/stable occurrences” and “sentences satisfied if a cycle/stable occurrenceexists” is a real one. Namely, in the class D of all monotone decreasing permu-tations there is no formula that recognizes transpositions, but it is easy to writea sentence that is satisfied if and only if a transposition exists – specifically thatthe permutation contain at least two points. We now generalize Theorem 37 to subpermutations of larger size. Let a permu-tation π ∈ S k be given. Our general goal is to characterize those classes C forwhich there is a formula with k free variables expressing that k given points ofa permutation, σ , form a stable occurrence of π .We start by generalizing the partition of the elements of σ in regions presentedin the transposition case. Suppose that σ is a permutation and s is a specificoccurrence of π in σ . Then s partitions σ \ s into ( k + 1) regions – or cells – where two elements of σ \ s belong to the same cell if their positional andvalue relationships to the elements of s are identical. These cells are naturallyarranged in a ( k + 1) × ( k + 1) grid where the elements of two cells in the samerow share the same value relationships with s while elements of two cells in thesame column share the same positional relationships with s . We associate tothe pair ( σ, s ) a matrix of non-negative integers A ( σ, s ) whose entry in row i andcolumn j is the number of elements of σ \ s belonging to the cell in row i andcolumn j . A specific example is shown in Figure 3. As above, we index matrixrows from bottom to top, to maintain a geometric correspondence between thesematrices and the diagrams of the corresponding permutations.34 Figure 3: An occurrence of 231 in a permutation of S together with the corre-sponding matrix of cell sizes. The occurrence is not stable since correspondingrow and column sums are not all equal.An m × m matrix A = ( a ij ) with non-negative integer entries will be said tohave matching row and column marginals if, for each (cid:54) i (cid:54) m , m (cid:88) j =1 a ij = m (cid:88) j =1 a ji , i.e., the sum of entries in each row is equal to the sum of entries in the cor-responding column. As in the case of transpositions, we have the followingcharacterization of stable occurrences of π . Observation 38.
An occurrence s of π in a permutation σ is stable if and onlyif the matrix A ( σ, s ) has matching row and column marginals. Let m be a positive integer, and let i = ( i , i , . . . , i r ) be a sequence of distinctelements belonging to [ m ] . Let A i be the m × m matrix whose entries in positions ( i t , i t +1 ) for (cid:54) t < r and ( i r , i ) are 1 and whose other entries are 0. Thatis, A i is the adjacency matrix of the directed cycle i → i → · · · → i r → i .We will call a matrix of this type a cycle matrix . Note that if r = 1 then A i contains a single element on the diagonal and we consider these to be trivial cycle matrices (and the corresponding sequences i will also be called trivial). Lemma 39. If A = ( a ij ) is an m × m matrix with non-negative integer entriesand matching row and column marginals, then it can be written as a linearcombination with non-negative integer coefficients of cycle matrices.Proof. Such a matrix A is the adjacency graph (with multiplicities) of a directedmultigraph (possibly including loops) on the vertex set { , , . . . , m } where thereare a ij directed edges from i to j (for each (cid:54) i, j (cid:54) m ). The matching marginalcondition implies that the indegree of each vertex is equal to its outdegree (loopscontribute to both the indegree and outdegree of a vertex). It is clear that everysuch graph contains a directed cycle, and removing such a cycle leaves a graph35 Figure 4: Left: the matrix A (1 , , . Right: the diagram of the permutation E (2413 , (1 , , , enlightning the stable occurrence s of 2413 suchthat A (7416253 , s ) = A (1 , , .of the same type. By induction, such graphs are unions of directed cycles, whichyields to the claimed result.For π ∈ S k and i a sequence of r distinct elements from [ k + 1] we define the expansion of π by i , E ( π, i ) to be that permutation of length k + r containing astable occurrence, s of π and for which A ( E ( π, i ) , s ) = A i . An example is givenin Figure 4. Given a sequence of r permutations Θ = ( θ , θ , . . . , θ r ) we furtherdefine the inflation of π by Θ on i to be the permutation, E ( π, i , Θ) , obtained byinflating those points of E ( π, i ) corresponding to the elements of i in left to rightorder by the permutations θ , θ , . . . , θ r . This naturally extends to inflationby permutation classes: if X = ( X , X , . . . , X r ) is a sequence of permutationclasses, then we define the inflation of π by X on i to be the permutation class, E ( π, i , X ) , consisting of all the subpermutations of permutations in E ( π, i , Θ) where for (cid:54) t (cid:54) r , θ t ∈ X t .We can now state the following generalization of Theorem 37. Note that theanalogue of Theorem 37 is actually only the equivalence between . and . , butit is proved by showing that . ⇔ . ⇔ . , hence the third condition below. Theorem 40.
Let π be a permutation of size k , and let C be a permutationclass. The following are equivalent.1. There exists a formula φ ( x , . . . , x k ) ∈ TOTO ( C ) that expresses the factthat a sequence s = ( s , . . . , s k ) is a stable occurrence of π in σ .2. For each non-trivial cycle i of distinct elements from [ k + 1] and eachsequence X consisting of I s and D s of the same length as i the class C does not contain E ( π, i , X ) , i.e., it avoids at least one permutation in eachsuch class. . There is a positive integer M such that if σ ∈ C and s is a stable occurrenceof π in σ then the sum of the non-diagonal entries of A ( σ, s ) is at most M . As in the case of transposition, the key point of the proof is to bound thenon-diagonal entries in the matrices A ( σ, s ) , when s is a stable occurrence of π . Proof.
That . implies . is easy and similar to the transposition case. Namelywe build φ ( x , . . . , x k ) as a conjunction of two formulas. The first one simplyindicates that the chosen points of σ form an occurrence of π . The second(and main) one will indicate that this occurrence is stable. It is obtained asfollows. From the assumption in . and Observation 38, this second part of φ ( x , . . . , x k ) can be taken as a disjunction, over finitely many matrices, offormulas asserting that the number of entries in each (non-diagonal) cell relativeto the purported occurrence of π is given by the corresponding element of thematrix. The matrices that need to be considered are those of size ( k +1) × ( k +1) with matching row and column marginals, non-negative integer entries, zeroentries on the diagonal, and such that the sum of all entries is at most M .Suppose now that . fails. For each positive integer M choose a permutation σ M ∈ C and a stable occurrence s M of π in σ M such that the sum of the non-diagonal entries of A M := A ( σ M , s M ) is greater than M . (W.l.o.g., since C is aclass, we assume that the diagonal entries of A M are all .) For each M , A M satisfies the conditions of Lemma 39 and so we can choose a representation of itas a linear combination with non-negative integer coefficients of matrices A i fornon-trivial cycles i of distinct elements from [ k + 1] ( k + 1 being independentof M ). Let i M be that cycle for which the coefficient of A i in the chosenrepresentation is maximized. Note that, when M grows to infinity, the coefficientof A i M also goes to infinity.The sequence ( i M ) M taking its values in a finite set, it contains an infinitesubsequence whose elements are all equal to a single i . Consider E ( π, i ) , theexpansion of π by i . Since the coefficient of A i is unbounded in the consideredsubsequence of ( A M ) we conclude that, for every n there exists a permutation θ n ∈ C which is the inflation of π on i by permutations of size at least ( n − + 1 . Now take a monotone subsequence of length n in each of these inflatingpermutations. Passing to a subsequence again if necessary we can assume thatfor each i j , the type of the monotone subsequence by which we inflate i j doesnot depend on n .In other words there is a sequence X consisting of I s and D s such that C contains the class E ( π, i , X ) . But now we can apply Proposition 28 to concludethat there can be no formula of TOTO ( C ) expressing stable occurrences of π ,thus showing that . fails. Namely, for any k we can now construct two ∼ k equivalent permutations in C each with a marked occurrence of π such that inone the occurrence is stable and in the other it is not. For the one where itis stable, we simply take monotone sequences all of the same sufficiently greatlength (e.g., length k ) of the required types and form the inflation of π on i by37hose sequences. For the other we take basically the same inflation but add asingle point to any one of the sequences.We are left with proving that . and . are equivalent. Obviously if C contains aclass E ( π, i , X ) then . fails. So suppose that C contains none of these (finitelymany) classes.This implies the existence of a positive integer m such that for every i and everysequence Θ of the same length as i consisting of monotone (either increasing ordecreasing) permutations of size m , the permutation E ( π, i , Θ) does not belongto C . Let C be the total number of non-trivial cycles on [ k + 1] and take M = C ( k +1)(( m − +1) . We claim that if σ ∈ C contains a stable occurrence s of π then the sum of the non-diagonal entries of A ( σ, s ) is bounded aboveby M . Suppose this were not the case, and choose a counterexample ( σ, s ) .Using Lemma 39 write A ( σ, s ) as a non-negative linear combination of A i . Inthis decomposition of A ( σ, s ) , at most C non-trivial A i occur. Moreover, thenumber of (necessarily non-diagonal) entries of each such A i is at most k + 1 .Since the sum of the non-diagonal entries of A ( σ, s ) is greater than M , thisimplies that there is some non-trivial cycle i such that the coefficient of A i isat least ( m − + 1 . In other words σ contains a subpermutation which is aninflation of π on i by permutations of size at least ( m − + 1 . Again from thethe Erdős-Szekeres theorem, each of these permutations contains a monotonesubsequence of length m , so σ contains a permutation E ( π, i , Θ) where Θ is asequence of monotone permutations each of length m – and that contradicts thechoice of m . Deducing the announced Theorem 36 from Theorem 40 is easy. Fix a permuta-tion class C and an integer k .Assume first that the second statement of Theorem 36 holds. This means thatthe second statement of Theorem 40 holds for any k -cycle π . For each such π , Theorem 40 ensures the existence of a formula φ π ( x ) of TOTO ( C ) with freevariables x = ( x , . . . , x k ) that expresses that k distinguished elements of apermutation σ form a stable occurrence of π . A formula φ ( x ) expressing that k distinguished elements of a permutation σ form a cycle is simply obtained asthe disjunction of the φ π ( x ) over all k -cycles π , proving that the first statementin Theorem 36 holds.Conversely, assume that the first statement Theorem 36 holds, that is to saythat there exists a formula φ ( x ) of TOTO ( C ) expressing that k distinguishedelements of a permutation σ form a cycle. Fix a k -cycle π . It follows fromSection 3.1 that there exists a formula ψ π ( x ) expressing that k distinguishedelements of a permutation σ form an occurrence of the pattern π . Therefore,that k distinguished elements of a permutation σ form a stable occurrence of thepattern π is simply expressed by ψ π ( x ) ∧ φ ( x ) . From Theorem 40, we deduceimmediately the second statement of Theorem 36.38e note that the above proof extends verbatim to yield the following statement. Theorem 41.
Let C be a permutation class, and k be an integer. The followingare equivalent.1. There is a formula φ ( x ) of TOTO ( C ) with free variables x = ( x , . . . , x k ) such that for all σ ∈ C and all sequences a = ( a , . . . , a k ) of elements of σ , ( σ, a ) | = φ ( x ) if and only if a is a union of cycles of σ .2. For each permutation π of size k , for each non-trivial cycle i of distinctelements from [ k + 1] , and for each sequence X of the same length as i ,consisting of I s and D s, the class C avoids at least one permutation ineach class of the form E ( π, i , X ) . TOTO and
TOOB
The goal of this section is to characterize completely the properties of permu-tations which can be expressed both in
TOTO and in
TOOB . In other words,we want to identify the subsets of S = ∪ n S n for which there exist a sentence φ TOTO of TOTO and a sentence φ TOOB of TOOB whose models are exactly thepermutations in this set.We start by introducing some terminology.
Definition . A TO ( TO + OB ) set is a set E of permutations such that thereexist a sentence φ TOTO of TOTO and a sentence φ TOOB of TOOB whose modelsare exactly the permutations in E .Recall that the support of a permutation is the set of its non-fixed points. Ourfirst result is the following. Theorem 43.
Any TO ( TO + OB ) set E either contains all permutations withsufficiently large support, or there is a bound on the size of the support of per-mutations in E . Informally, this says that a property which can be described by a sentencein each of the two theories is, in some sense, trivial. Namely, it is either eventually true or eventually false, where eventually means “for all permuta-tions with sufficiently large support”. Note, however, that a property that canbe expressed in both theories may be true for some, but not all, permuta-tions with arbitrary large size . This is for instance demonstrated by the set E = { · · · n, n ≥ } (which have empty support), which is the set of modelsof the sentences φ TOTO = ∀ x ∀ y ( x < P y ↔ x < V y ) and φ TOOB = ∀ x xRx of TOTO and
TOOB respectively. 39here is a more precise version of the theorem, which characterizes completely TO ( TO + OB ) sets E . To state it, we introduce some notation. For a partition λ , we denote by C λ the set of permutations of cycle-type λ . We also denote D λ = (cid:93) k ≥ C λ ∪ (1 k ) . (2)(See the end of the introduction for the notation on integer partitions.) Finally,we recall that the Boolean algebra generated by a family F of subsets of Ω isthe smallest collection of subsets of Ω containing F and stable by finite unions,finite intersections and taking complements. Here, the role of Ω is played by theset S of all permutations (of all sizes). Theorem 44.
A set E of permutations is a TO ( TO + OB ) set if and only if itbelongs to the Boolean algebra generated by all C λ and D λ (where λ runs overall partitions). Theorems 43 and 44 are proved in Sections 6.2 and 6.3, respectively.
Remark . We observe that Theorem 44 is indeed more precise than Theo-rem 43, in the sense that it is rather easy to deduce Theorem 43 from Theo-rem 44. Indeed, for any λ , the sets C λ and D λ clearly have a bound, namely | λ | , on the size of the supports of permutations they contain. Moreover, theproperty“Either E contains all permutations with sufficiently large support,or there is a bound on the size of the support of permutations in E .”is stable by taking finite unions, finite intersections and complements. There-fore, all sets in the Boolean algebra generated by the C λ ’s and D λ ’s satisfy thisproperty and Theorem 44 implies Theorem 43, as claimed. TO ( TO + OB ) sets are trivial The goal of this section is to prove Theorem 43. We consider a TO ( TO + OB ) set E . On one hand, E is the set of models of a sentence of TOTO , whose quantifierdepth is denoted (cid:96) . On the other hand, E is the set of models of a sentence in TOOB . In particular, from Proposition 3, for any given partition λ , it containseither all or none of the permutations of cycle-type λ . To keep that in mind,everywhere in this section, we write “ E contains one/all permutation(s) of type λ ”.The general strategy of the proof is the following: we identify a number ofpairs of permutations ( σ , σ ) , on which Duplicator wins the (cid:96) -move Duplicator-Spoiler game. We call such permutations σ , σ (cid:96) -indistinguishable (or just indistinguishable , (cid:96) being fixed throughout the proof). For such a pair, σ is in E if and only if σ is in E . As a consequence, if E contains one/all permutation(s)conjugate to σ , it contains one/all permutation(s) conjugate to σ .40e can say even more: Lemma 46.
If there exist two permutations of cycle-types µ and ν that areindistinguishable, then for any fixed partition λ there exists two permutations ofcycle-types λ ∪ µ and λ ∪ ν that are indistinguishable.Proof. Let σ be an arbitrarily chosen permutation of cycle-type λ and π and π be two permutations of cycle-types µ and ν that are indistinguishable. Weconsider σ, π ] and σ, π ] . From Proposition 28, they are indistinguishableand have cycle-type λ ∪ µ and λ ∪ ν , respectively.In particular, under the assumption of the lemma, our chosen TO ( TO + OB ) set E contains one/all permutation(s) of cycle-type λ ∪ µ if and only if it containsone/all permutation(s) of cycle-type λ ∪ ν .In the following few lemmas, we exhibit some pairs of indistinguishable permu-tations with specific cycle-type, to which we will apply Lemma 46. This servesas preparation for the proof of Theorem 43.We denote ct( σ ) the cycle-type of a permutation σ . Lemma 47.
Let n , n ≥ (cid:96) . There exist indistinguishable permutations σ and σ with ct( σ ) = ( n ) and ct( σ ) = ( n ) .Proof. Consider the permutations σ = 2 3 . . . n and σ = 2 3 . . . n . Theyare clearly cyclic permutations of size n and n , respectively. Moreover, theywrite as σ = 21[ ι n − , and σ = 21[ ι n − , . Of course, ι n − and ι n − areindistinguishable (see Proposition 26), and then Proposition 28 ensures that σ and σ are indistinguishable.With Lemma 46, a consequence of Lemma 47 for our TO ( TO + OB ) set E is: Corollary 48.
Let λ be a partition and n , n ≥ (cid:96) . Then E contains one/allpermutation(s) of cycle-type λ ∪ ( n ) , if and only if it contains one/all permu-tation(s) of cycle-type λ ∪ ( n ) . We now play the same game with other pairs of permutations/cycle-types.
Lemma 49.
Let k and m be non-negative integers with ( k − m ≥ (cid:96) . Thereexist indistinguishable permutations σ and σ with ct( σ ) = ( km + 1) and ct( σ ) = ( k m ) .Proof. Consider the permutations σ and σ whose one-line representations are σ = m +1 m +2 · · · km km +1 1 2 · · · m ; σ = m +1 m +2 · · · km · · · m. σ = (cid:0) m +1 2 m +1 · · · km +1 m m · · · kmm − m − · · · km − · · · m +2 · · · ( k − m +2 (cid:1) ; σ = (cid:0) m +1 · · · ( k − m +1 (cid:1) (cid:0) m +2 · · · ( k − m +2 (cid:1) · · · (cid:0) m m · · · km (cid:1) , so that ct( σ ) = ( km + 1) and ct( σ ) = ( k m ) as wanted. Moreover we can write σ = 21[ ι ( k − m +1 , ι m ] and σ = 21[ ι ( k − m , ι m ] , which proves using Proposi-tion 28 that σ and σ are indistinguishable.From Lemma 49 and Lemma 46, we obtain: Corollary 50.
Let λ be a partition and k, m as above. Then E contains one/allpermutation(s) of cycle-type λ ∪ ( km + 1) , if and only if it contains one/allpermutation(s) of cycle-type λ ∪ ( k m ) . Lemma 51.
Let n ≡ be an integer at least equal to (cid:96) + 1) and let k ≥ . There exist indistinguishable permutations σ k and σ k whose cycle-typesare ct( σ k ) = ( n − , k ) and ct( σ k ) = ( n + k − . In the above lemma, note that ( n − , k ) is not strictly speaking a partition, sinceit is not known how k compares to n − . Here and everywhere, we thereforeidentify a partition with all its rearrangements. Proof.
We first look at the case k = 1 . Set h = n/ , which is an odd integer.Consider the permutations σ of size n − and σ of size n given in one-linenotation by σ = h +1 h +2 · · · n − h · · · h − σ = h +2 h +3 · · · n h +1 2 3 · · · h . Their diagrams are represented on Fig. 5. In cyclic notation, using that h isodd in the case of σ , we get: σ = (cid:0) h (cid:1) (cid:0) h +1 2 h +2 3 · · · h − n − (cid:1) ; σ = (1 h +2 3 h +4 5 · · · n − h h +1 2 h +3 4 · · · n − h − n (cid:1) , so that ct( σ ) = ( n − , and ct( σ ) = ( n ) as wanted. Moreover we can write σ = 4321[ ι h − , , ι h − , , while σ = 4321[ ι h − , , ι h − , . Proposition 28proves that σ and σ are indistinguishable as soon as h − ≥ (cid:96) − or equiv-alently n ≥ (cid:96) + 1) .For larger values of k , we introduce an operator gr h on permutations: by defini-tion, for a permutation σ of size M , the permutation gr h ( σ ) has size M + 1 andis obtained from the word notation of σ by replacing σ ( h ) with a new maximalelement M + 1 and by appending the former value of σ ( h ) to the right of σ . For42 •••• • hh • •••• • hh + • ••••• • hh • •••••• • hh Figure 5: From left to right: the permutations σ , σ , σ := gr h ( σ ) and σ := gr h ( σ ) (we write h + := h +1 ).an example, see Fig. 5. In cycle notation, this simply amounts to saying that gr h ( σ ) is obtained from σ by inserting M + 1 after h in the cycle containing h .In particular, the size of the cycle containing h is increased by , while sizes ofother cycles are left unchanged.We then set σ ki = gr k − h ( σ i ) (for i = 1 , ). Because of the above discussion onthe effect of the operator gr h on the cycle structure, it is clear that ct( σ k ) =( n − , k ) and ct( σ k ) = ( n + k − , as wanted. Moreover, if k ≥ , then σ k = 462135[ ι h − , , ι h − , , , ι k − ] , while σ k = 462135[ ι h − , , ι h − , , , ι k − ] .Proposition 28 ensures that they are indistinguishable as soon as n ≥ (cid:96) +1) . Corollary 52.
Let λ be a partition, n, k be integers with k ≥ and n ≥ (cid:96) + 2 .Then E contains one/all permutation(s) of cycle-type λ ∪ ( n − , k ) , if and onlyif it contains one/all permutation(s) of cycle-type λ ∪ ( n + k − .Proof. For n satisfying n ≡ and n ≥ (cid:96) + 1) , the result follows fromLemmas 46 and 51. We fix such a value n of n .For a general n ≥ (cid:96) + 2 , using the above case and twice Corollary 48, we have: E contains one/all permutation(s) of cycle-type λ ∪ ( n − , k ) if and only if it contains one/all permutation(s) of cycle-type λ ∪ ( n − , k ) ,if and only if it contains one/all permutation(s) of cycle-type λ ∪ ( n + k − ,if and only if it contains one/all permutation(s) of cycle-type λ ∪ ( n + k − .We can now proceed to the proof of the first main result of this section. Proof of Theorem 43.
Let M = (cid:96) − (cid:88) k =2 k · (cid:96) k − . Throughout the proof, we fix a cyclic permutation ζ of size at least (cid:96) .Recall that for a partition λ = ( λ , . . . , λ q ) , we denote by | λ | = (cid:80) qi =1 λ i its size.In addition, we denote by (cid:96) ( λ ) = q its number of parts.43 laim 1. Let τ be a permutation having a cycle of size at least (cid:96) . Then E contains τ if and only if it contains ζ . Proof of Claim 1.
By assumption, the cycle-type of τ is ( n ) ∪ λ for some integer n ≥ (cid:96) and some partition λ . From Corollaries 48 (applied with an empty λ )and 52, it follows that E contains ζ ⇔ E contains one/all permutation(s) of cycle-type ( n + | λ | + (cid:96) ( λ )) ⇔ E contains one/all permutation(s) of cycle-type ( n + | λ | + (cid:96) ( λ ) − λ − , λ ) ⇔ E contains one/all permutation(s) of cycle-type ( n + | λ | + (cid:96) ( λ ) − λ − λ − , λ , λ ) . . . ⇔ E contains one/all permutation(s) of cycle-type ( n ) ∪ λ ⇔ E contains τ ,proving Claim 1. Claim 2.
Let τ be a permutation such that there exists k between and (cid:96) − such that τ has m cycles of size k with ( k − m ≥ (cid:96) . Then E contains τ ifand only if it contains ζ . Proof of Claim 2.
By assumption, the cycle-type of τ is ( k m ) ∪ λ for someintegers k, m with ( k − m ≥ (cid:96) and some partition λ . From Corollary 50, τ isin E if and only if E contains one/all permutation(s) of cycle-type λ ∪ ( k m + 1) .Since k m + 1 ≥ (cid:96) , we deduce from our first claim that this happens exactlywhen E contains ζ , proving Claim 2.We come back to the proof of the theorem. • Assume first that E contains ζ . We show that E contains all permutationswhose support has size at least M . Let τ be any permutation whosesupport has size at least M .We consider first the case when τ contains a cycle of size at least (cid:96) . Since E contains ζ , it follows from our first claim that E contains τ .We now consider the case when τ does not contain any cycle of size at least (cid:96) . Denoting m k the number of cycles of size k of τ , since the support of τ is of size at least M , we have (cid:80) (cid:96) − k =2 k m k ≥ M . Because of the choiceof M , this implies the existence of a k such that m k ≥ (cid:96) k − . And because ζ belongs to E , it follows from Claim 2 that τ belongs to E . • Assume now that E does not contain ζ . From Claims 1 and 2, we knowthat for any permutation τ in E , – τ does not have a cycle of size (cid:96) or more; – for each k with (cid:54) k (cid:54) (cid:96) − , the number of cycles of size k in τ isless than (cid:96) k − .Then the support of any permutation τ in E is smaller than M , concludingthe proof of Theorem 43. 44 .3 Characterization of TO ( TO + OB ) sets The goal of this section is to prove Theorem 44. Recall that C λ (resp. D λ )denotes the set of permutations that have cycle-type λ (resp. λ ∪ (1 k ) for some k ).We have seen in Section 3.4 with Lemmas 22 and 23 that, for any partition λ ,the property of belonging to C λ (resp. D λ ) is expressible in TOTO . Moreover, C λ is a conjugacy class, so being in C λ is clearly expressible in TOOB . Finally,being in D λ can be translated as follows: there are | λ | distinct elements whichforms a subpermutation of cycle-type λ , and all other elements are fixed points,i.e. satisfy xRx . With this formulation, it is clear that being in D λ is expressiblein TOOB .It follows that
Lemma 53.
For any partition λ , C λ and D λ are TO ( TO + OB ) sets.Proof of Theorem 44. Call B the Boolean algebra generated by the C λ ’s andthe D λ ’s. That the elements of B are TO ( TO + OB ) sets is easy. It followsfrom Lemma 53, since the family of TO ( TO + OB ) sets is closed by taking finiteunions, finite intersections and complementsConversely, consider a TO ( TO + OB ) set E . We want to prove that E is in B . Byassumption, there exists a TOTO sentence, whose quantifier depth we denoteby (cid:96) , of which E is the set of models.From Theorem 43, possibly replacing E by its complement, we can assume thatthere is a bound M on the size of the support of permutations in E . In otherwords the cycle-type of a permutation in E writes µ ∪ (1 k ) with | µ | (cid:54) M and k ≥ . From Proposition 3, two conjugate permutations are either both in E orboth outside E , so that E is a (disjoint) union of conjugacy classes: E = (cid:93) λ ∈ Λ C λ , (3)for some subset Λ of { µ ∪ (1 k ) , | µ | (cid:54) M and k ≥ } . Note that Eq. (3) does notprove that E is in B , since the union may be infinite.Observe that the decomposition λ = µ ∪ (1 k ) is unique if we require that µ has no parts equal to (which we write as m ( µ ) = 0 ). Thus Eq. (3) can berewritten as E = (cid:93) µ s.t. | µ | (cid:54) M, m µ )=0 E µ , where E µ := (cid:93) k ≥ µ ∪ (1 k ) ∈ Λ C µ ∪ (1 k ) . (4)The set of partitions µ with | µ | (cid:54) M is finite, so that it is enough to prove thateach E µ lies in B . For this, it is enough that I µ = { k ≥ s.t. µ ∪ (1 k ) ∈ Λ } is finite or co-finite (then giving that E µ is a finite union of C µ ∪ (1 k ) or theset-difference of D µ with a finite union of C µ ∪ (1 k ) ).45e claim that if k, k (cid:48) ≥ (cid:96) , then k ∈ I µ if and only if k (cid:48) ∈ I µ . Proving this claimwill conclude our proof of Theorem 44. Recall that by definition, k ∈ I µ if andonly if E contains one/all permutation(s) of cycle-type µ ∪ (1 k ) . We know (seeProposition 26) that the identity permutations of size k and k (cid:48) , whose cycle-types are (1 k ) and (1 k (cid:48) ) respectively, are (cid:96) -indistinguishable. From Lemma 46,there exist (cid:96) -indistinguishable permutations σ and σ (cid:48) with cycle-type µ ∪ (1 k ) and µ ∪ (1 k (cid:48) ) , respectively. Then σ is in E if and only if σ (cid:48) is in E proving that k ∈ I µ if and only if k (cid:48) ∈ I µ . Acknowledgements
The authors are thankful to Marc Noy for insightful discussions on the topic. Inparticular, VF’s first contact with first-order logic and expressibility questionswas through a talk given by Marc Noy on logic and random graphs in theworkshop “Recent Trends in Algebraic and Geometric Combinatorics” in Madridin November ’13.MB is partially supported by the Swiss National Science Foundation, undergrant number 200021-172536.
References [1] M. Albert, M. Atkinson, M. Bouvel, A. Claesson, and M. Dukes. On the inverse imageof pattern classes under bubble sort.
J. Combin.
J. Integer Seq.
Quarterly J. Math.
Permutation patterns: basic definitions and notation . ArXiv preprint1506.06673, 2015.[5] M. Bona and M. Cory.
Cyclic permutations avoiding pairs of patterns of length three .ArXiv preprint 1805.05196, 2018.[6] P. J Cameron. Homogeneous permutations.
Elec. J. Combin.
Eur. J. Combin.
31 (7):1853 –1867, 2010.[8] K. J. Compton. A logical approach to asymptotic combinatorics: I. first order properties.
Advances in Mathematics
Finite model theory . Springer Monographs in Mathemat-ics. Springer, 1999. 2nd edn.[10] S. Elizalde and J. Troyka.
Exact and asymptotic enumeration of cyclic permutationsaccording to descent set . ArXiv preprint 1710.05103, 2017.[11] P. Erdös and G. Szekeres. A combinatorial problem in geometry.
Compositio Math.
Finite model theory and its applications . Texts in Theoretical Computer Science.An EATCS Series. Springer, Berlin, 2007.
13] W. Hodges.
A shorter model theory . Cambridge University Press, Cambridge, 1997.[14] N. Immerman.
Descriptive complexity . Graduate Texts in Computer Science. Springer-Verlag, New York, 1999.[15] S. Janson, T. Łuczak, and A. Ruciński.
Random graphs . Wiley Series in Discrete Math-ematics and Optimization, vol. 45. Wiley-Interscience, 2000.[16] M. Karpilovskij.
Composability of permutation classes . ArXiv preprint 1703.03487, 2017.[17] D. Knuth.
The art of computer programming, volume 1 . Edited by Addison-Wesley, 1968.[18] E. Lehtonen.
Permutation groups arising from pattern involvement . ArXiv preprint1605.05571, 2016.[19] E. Lehtonen and R. Pöschel. Permutation groups, pattern involvement, and Galois con-nections.
Acta Scientiarum Mathematicarum
83 (3-4):355–375, 2017.[20] J. G. Rosenstein.
Linear orderings . Pure and Applied Mathematics, vol. 98. AcademicPress, Inc. [Harcourt Brace Jovanovich, Publishers], New York-London, 1982.[21] R. Tarjan. Sorting using networks of queues and stacks.
J. ACM
19 (2):341–346, 1972.[22] H. Ulfarsson. Describing West-3-stack-sortable permutations with permutation patterns.
Séminaire Lotharingien de Combinatoire
67, 2012.[23] V. Vatter.
Permutation classes, Chapter 12 of the Handbook of Enumerative Combina-torics . Edited by Miklós Bóna. Chapman-Hall and CRC Press, 2015.[24] J. West. Sorting twice through a stack.
Theoretical Computer Science
117 (1-2):303–313,1993.
MA: Department of Computer Science, University of Otago, Owheo Building,133 Union Street East, Dunedin 9016, New [email protected], VF: Institut für Mathematik, Universität Zürich, Winterthurerstrasse 190,8057 Zürich, Switzerland. { mathilde.bouvel,valentin.feray }}