Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346<Chapter> <Heading> Regular Languages of Sets of Permutations </Heading>12This chapter is dedicated to the different sets of permutations with the same properties.34<Section><Heading> Inversions in Permutations </Heading>5An inversion in a permutation <M>\tau=\tau_{1}\ldots\tau_{n}</M> is a pair <M>(i,j)</M> such that <M>1\leq i<j\leq n</M> and6<M>\tau_{i}>\tau_{j}</M> <Cite Key="UpBndStanWilf1324"/>.7<ManSection>8<Func Name="InversionAut" Arg="k"/>9<Returns>An automaton that accepts all permutations with exactly <C>k</C> inversions.</Returns>10<Description>11The rational language of all permutations with a given number , <C>k</C>, of inversions is computed by <C>InversionAut</C>.12<Example><![CDATA[13gap> a:=InversionAut(1);14< deterministic automaton on 2 letters with 4 states >15gap> AutToRatExp(a);16a*baa*17gap> Spectrum(a);18[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]19gap> b:=InversionAut(5);20< deterministic automaton on 6 letters with 14 states >21gap> AutToRatExp(b);22((a*ba*bUa*c)a*bUa*ba*cUa*d)a*(ba*baa*Ucaaa*)U(a*ba*bUa*c)a*(ca*baa*Udaaaa*)U(\23a*ba*daUa*eaa)a*baa*Ua*ba*(dbUeaa)aaa*U(a*eabUa*(ebUfaa)a)aaa*24gap> Spectrum(b);25[ 0, 0, 0, 3, 22, 71, 169, 343, 628, 1068, 1717, 2640, 3914, 5629, 7889 ]26gap> ]]></Example>2728</Description>29</ManSection>303132<ManSection>33<Func Name="InversionAutOfClass" Arg="aut,inv"/>34<Returns>An automaton accepting all permutations of a class with <C>inv</C> inversions.</Returns>35<Description>36<C>InversionAutOfClass</C> intersects the rational pattern class with the rational language containing all permutations37under the rank encoding that have exactly <C>inv</C> inversions.38<Example><![CDATA[39gap> a:=MinimalAutomaton(GraphToAut(Seqstacks(2,2),1,6));40< deterministic automaton on 3 letters with 3 states >41gap> Spectrum(a);42[ 1, 2, 6, 18, 54, 162, 486, 1458, 4374, 13122, 39366, 118098, 354294,431062882, 3188646 ]44gap> b:=InversionAutOfClass(a,4);45< deterministic automaton on 5 letters with 23 states >46gap> Spectrum(b);47[ 0, 0, 0, 3, 13, 35, 75, 140, 238, 378, 570, 825, 1155, 1573, 2093 ]48gap> ]]></Example>4950</Description>51</ManSection>52</Section>5354555657<Section> <Heading> Plus- and Minus-(In)Decomposablilty </Heading>5859<ManSection>60<Func Name="PlusDecomposableAut" Arg="aut"/>61<Returns>An automaton that accepts the subset of the class <C>aut</C> containing the62plus-decomposable permutations of <C>aut</C>.</Returns>63<Description>64The <C>PlusDecomposableAut</C> automaton accepts the language of all65plus-decomposable permutations of the encoded class accepted by <C>aut</C>.66<!-- EXAMPLE !!!!!!!! -->67<Example><![CDATA[68gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));69< deterministic automaton on 4 letters with 9 states >70gap> Spectrum(xa);71[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,7217633432, 68368135 ]73gap> a:=PlusDecomposableAut(xa);74< deterministic automaton on 4 letters with 16 states >75gap> Spectrum(a);76[ 0, 1, 3, 11, 47, 196, 808, 3306, 13433, 54265, 218145, 873303, 3483654,7713853682, 54945158 ]78gap> ]]></Example>7980</Description>81</ManSection>8283<ManSection>84<Func Name="PlusIndecomposableAut" Arg="aut"/>85<Returns>An automaton that accepts all permutations of <C>aut</C> that are not86plus-decomposable.</Returns>87<Description>88The <C>PlusIndecomposableAutomaton</C> automaton accepts the language of all89plus-indecomposable permutations of the encoded class accepted by aut, by rejecting90every rank encoding that in the original automaton would have entered and left91the accept state before the last letter in the rank encodedpermutation.92<!-- EXAMPLE !!!!!!!! -->93<Example><![CDATA[94gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));95< deterministic automaton on 4 letters with 9 states >96gap> Spectrum(xa);97[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,9817633432, 68368135 ]99gap> a:=PlusIndecomposableAut(xa);100< deterministic automaton on 4 letters with 11 states >101gap> Spectrum(a);102[ 1, 1, 3, 12, 42, 149, 530, 1883, 6689, 23759, 84384, 299690, 1064319,1033779750, 13422977 ]104gap> ]]></Example>105106</Description>107</ManSection>108109110<ManSection>111<Func Name="MinusDecomposableAut" Arg="aut"/>112<Returns>An automaton that accepts the subset of the class <C>aut</C> containing the113minus-decomposable permutations of <C>aut</C>.</Returns>114<Description>115The <C>MinusDecomposableAut</C> automaton accepts the language of all116minus-decomposable permutations of the rank encoded class accepted by <C>aut</C>.117<!-- EXAMPLE !!!!!!!! -->118<Example><![CDATA[119gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));120< deterministic automaton on 4 letters with 9 states >121gap> Spectrum(xa);122[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,12317633432, 68368135 ]124gap> a:=MinusDecomposableAut(xa);125< deterministic automaton on 4 letters with 12 states >126gap> Spectrum(a);127[ 0, 1, 3, 10, 24, 64, 180, 520, 1524, 4504, 13380, 39880, 119124, 356344,1281066980 ]129gap> ]]></Example>130131</Description>132</ManSection>133134<ManSection>135<Func Name="MinusIndecomposableAut" Arg="aut"/>136<Returns>An automaton that accepts all permutations of <C>aut</C> that are not137minus-decomposable.</Returns>138<Description>139The <C>MinusIndecomposableAut</C> automaton accepts the language of all140minus-indecomposable permutations of the encoded class accepted by aut,141which is the complement set of the set of minus-decomposable permutations142within the class.143<!-- EXAMPLE !!!!!!!! -->144<Example><![CDATA[145gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));146< deterministic automaton on 4 letters with 9 states >147gap> Spectrum(xa);148[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,14917633432, 68368135 ]150gap> a:=MinusIndecomposableAut(xa);151< deterministic automaton on 4 letters with 17 states >152gap> Spectrum(a);153[ 1, 1, 3, 13, 65, 281, 1158, 4669, 18598, 73520, 289149, 1133113, 4428849,15417277088, 67301155 ]155gap> ]]></Example>156157</Description>158</ManSection>159160</Section>161162163<Section> <Heading> Language of all non-simple permutations </Heading>164The regular language of all non-simple rank encoded permutations with highest rank <M>k</M> is165described by the following equation,166<Display Mode="M">167E(NS_{k}) = E(\Omega_{k})168\cap ( \bigcup_{l=1}^{k-1} P_{l} \bigcup_{m=l}^{k-1} E(\hat{\Omega}_{k-m})^{+m}169\cup170\bigcup_{j=1}^{k-1} E(\hat{\Omega}_{k-j})^{+j}171\cup172</Display>173<Display Mode="M">174\cup175\bigcup_{a=2}^{k-1} \bigcup_{b=0}^{k-1-a} Q_{a,b} \bigcup_{i=0}^{a-2} (E(\hat{\Omega}_{k-(b+i)})^{+b+i})^{(a-i)} ) \Sigma^{*}176\cup177E(\mathcal{D}_{P}(\Omega_{k}))178</Display>179where180<M>\Sigma</M> is the alphabet <M>\{1,\ldots,k\}</M>, <M>k\in\mathbb{N}</M>, <M>k \geq 3</M>.<P/>181<M>P_{l}</M> is the language of prefixes of rank encoded permutations, where the prefix ends with the total sum of gap sizes to be equal to <M>l</M>. <P/>182<M>Q_{i,j}</M> is the language of prefixes of rank encoded permutations, where the prefix ends with a gap of size <M>i</M> and the sum of the sizes of gaps below equals to <M>j</M>. <P/>183<M>E(\Omega_{k-i})^{+i}</M> is the language of <M>E(\Omega_{k-i})</M> <M>i \in \mathbb{N}</M>, with the alphabet shifted upwards by <M>i</M>.<P/>184<M>E(\Omega_{k})^{(i)}</M> is the sublanguage of <M>E(\Omega_{k})</M> containing the words of length <M>\leq i</M>, <M>i \in \mathbb{N}</M>.<P/>185<M>E(\hat{\Omega}_{k})</M> is the sublanguage of <M>E(\Omega_{k})</M> excluding the words of length <M>\leq 1</M>.<P/>186<M>E(\mathcal{D}_{P}(\Omega_{k}))</M> is the language of all plus-decomposable permutations as described in <Cite Key="RegLangPlusMinPerms"/>.187188189<ManSection>190<Func Name="LengthBoundAut" Arg="aut,min,i,k"/>191<Returns>The subautomaton of <C>aut</C> that accepts words between (and including) the lengths <C>min</C> and <C>i</C>.</Returns>192<Description>193We are taking the automaton <C>aut</C> and it's alphabet <C>k</C>, and find the automaton that accepts all words of <C>aut</C> of length between (and including) <C>min</C> and <C>i</C>.194<Example><![CDATA[195gap> a:=BoundedClassAutomaton(4);196< deterministic automaton on 4 letters with 4 states >197gap> Spectrum(a);198[ 1, 2, 6, 24, 96, 384, 1536, 6144, 24576, 98304, 393216, 1572864, 6291456,19925165824, 100663296 ]200gap> LengthBoundAut(a,4,8,4);201< deterministic automaton on 4 letters with 22 states >202gap> Spectrum(last);203[ 0, 0, 0, 24, 96, 384, 1536, 6144, 0, 0, 0, 0, 0, 0, 0 ]204gap> ]]></Example>205</Description>206</ManSection>207208209<ManSection>210<Func Name="ShiftAut" Arg="i,k"/>211<Returns>The automaton <M>\Omega_{k-i}^{+i}</M>.</Returns>212<Description>213We are shifting the alphabet of <M>\Omega_{k-i}</M> in their values by <M>i</M> to expand to the alphabet <M>\{1,\ldots,k\}</M>, but keeping the automaton structure of <M>\Omega_{k-i}</M>.214<Example><![CDATA[215gap> ShiftAut(2,4);216< non deterministic automaton on 4 letters with 4 states >217gap> Display(last);218| 1 2 3 4219-----------------------------------220a |221b |222c | [ 2 ] [ 4 ] [ 4 ] [ 4 ]223d | [ 3 ] [ 3 ] [ 3 ] [ 3 ]224Initial state: [ 1 ]225Accepting state: [ 4 ]226gap> ShiftAut(1,4);227< non deterministic automaton on 4 letters with 5 states >228gap> Display(last);229| 1 2 3 4 5230-------------------------------------------231a |232b | [ 2 ] [ 5 ] [ 5 ] [ 3 ] [ 5 ]233c | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]234d | [ 4 ] [ 4 ] [ 4 ] [ 4 ] [ 4 ]235Initial state: [ 1 ]236Accepting state: [ 5 ]237gap> ]]></Example>238</Description>239</ManSection>240241<ManSection>242<Func Name="NextGap" Arg="gap,rank"/>243<Returns>A list of gap sizes.</Returns>244<Description>245Knowing the current available gap sizes <C>gap</C>, which are the number of available spaces in a permutation plot. These gaps are separated by blocks where there are already points inserted. We determine where the next point (known to us as its <C>rank</C>) is being placed and what the next gap sizes are.246<Example><![CDATA[247gap> NextGap([1,1],2);248[ 1 ]249gap> NextGap([1],3);250[ 1, 1 ]251gap> NextGap([2,1],4);252[ 2, 1 ]253gap> ]]></Example>254</Description>255</ManSection>256257258259260<ManSection>261<Func Name="GapAut" Arg="k"/>262<Returns>The non-deterministic automaton accepting the rank encoded language of <M>\Omega_{k}</M> and the list of all possible gap sizes.</Returns>263<Description>264The automaton accepts the rank encoded permutations of <M>\Omega_{k}</M>, but the automaton is slightly extended through having each state corresponding to a gap size and the start state being the emptyset of gap sizes. The transitions of the automaton are determined through the knowledge of the available spaces and the rank. This is calculated in <C>NextGap</C>.265Please note that the index of the gap sizes in the list corresponds to the state of the automaton.266<Example><![CDATA[267gap> GapAut(3);268[ < non deterministic automaton on 3 letters with 5 states >,269[ [ ], [ 0 ], [ 1 ], [ 2 ], [ 1, 1 ] ] ]270gap> Display(last[1]);271| 1 2 3 4 5272-------------------------------------------273a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]274b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]275c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]276Initial state: [ 1 ]277Accepting states: [ 1, 2 ]278gap> ]]></Example>279</Description>280</ManSection>281282283<ManSection>284<Func Name="SumAut" Arg="sum,k"/>285<Returns>The automaton accepting the language <M>P_{sum}</M>.</Returns>286<Description>287This automaton is based on the <C>GapAut</C> where the accept states are chosen by their gap sizes, namely if the total sum of gap sizes equal to <C>sum</C>.288289<Example><![CDATA[290gap> SumAut(2,3);291< non deterministic automaton on 3 letters with 5 states >292gap> Display(last);293| 1 2 3 4 5294-------------------------------------------295a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]296b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]297c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]298Initial state: [ 1 ]299Accepting states: [ 4, 5 ]300gap> ]]></Example>301</Description>302</ManSection>303304305<ManSection>306<Func Name="GapSumAut" Arg="gap,sum,k"/>307<Returns>The automaton accepting the language <M>Q_{gap,sum}</M>.</Returns>308<Description>309This automaton is based on the <C>GapAut</C> where the accept states are chosen by their gap sizes, namely if there is a gap size <C>gap</C> and the gap sizes before have a total sum of <C>sum</C>.310311<Example><![CDATA[312gap> GapSumAut(1,0,3);313< non deterministic automaton on 3 letters with 5 states >314gap> Display(last);315| 1 2 3 4 5316-------------------------------------------317a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]318b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]319c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]320Initial state: [ 1 ]321Accepting states: [ 3, 5 ]322gap> ]]></Example>323</Description>324</ManSection>325326327<ManSection>328<Func Name="NonSimpleAut" Arg="k"/>329<Returns>The automaton accepting all rank encoded non-simple permutations with rank encoding <C>k</C>.</Returns>330<Description>331We find the language of all non-simple permutations of the set of all <M>k</M> rank encoded permutations <M>\Omega_{k}</M> using the above equation.332333<Example><![CDATA[334gap> a:=NonSimpleAut(3);335< deterministic automaton on 3 letters with 9 states >336gap> Display(a);337| 1 2 3 4 5 6 7 8 9338--------------------------------339a | 1 3 1 5 3 1 6 3 3340b | 3 3 3 3 9 9 3 9 3341c | 2 2 2 2 4 4 2 7 4342Initial state: [ 8 ]343Accepting state: [ 1 ]344gap> ]]></Example>345</Description>346</ManSection>347</Section>348349350<Section> <Heading> Simplicity </Heading>351The set of simple permutations of a class is the complement set of the class with the non-simple permutations. We are working in the rank encoding and so in language terms our set of simple permutations <M>S_{k}</M> will be the subset of <M>\Omega_{k}</M>352<Display Mode="M">353E(S_{k}) = E(\Omega_{k}\setminus NS_{k}) = E(\Omega_{k}) \setminus E(NS_{k}) = E(\Omega_{k}) \cap E(NS_{k})^{C}354</Display>355<ManSection>356<Func Name="SimplePermAut" Arg="k"/>357<Returns>The automaton accepting all rank encoded simple permutations with highest rank encoding <C>k</C>.</Returns>358<Description>359We find the language of all simple permutations of the set of all <M>k</M> rank encoded permutations <M>\Omega_{k}</M> using the above equation.360361<Example><![CDATA[362gap> SimplePermAut(3);363< deterministic automaton on 3 letters with 8 states >364gap> Display(last);365| 1 2 3 4 5 6 7 8366-----------------------------367a | 2 2 1 1 7 2 1 6368b | 2 2 4 2 2 4 4 2369c | 2 2 8 5 2 5 5 2370Initial state: [ 3 ]371Accepting states: [ 1, 3 ]372gap> ]]></Example>373</Description>374</ManSection>375</Section>376377378379<Section><Heading>Exceptionality</Heading>380A permutation is said to be exceptional if it is of one of the following forms,381<Display Mode="M">3822 4 6 \ldots (2m) 1 3 5 \ldots (2m-1)383</Display>384<Display Mode="M">385(2m-1) (2m-3) \ldots 1 (2m) (2m-2) \ldots 2386</Display>387<Display Mode="M">388(m+1) 1 (m+2) 2 (m+3) 3 \ldots (2m) m389</Display>390<Display Mode="M">391m (2m) (m-1) (2m-1) \ldots 1 (m+1)392</Display>393where <M>m \geq 2</M> <Cite Key="SimpPermsPoset"/>.394395396<ManSection>397<Func Name="IsExceptionalPerm" Arg="perm"/>398<Returns><C>True</C> if <C>perm</C> is exceptional, <C>False</C> otherwise.</Returns>399<Description>400The functions checks whether <C>perm</C> is one of the 4 types of exceptional permutations, that are described above.401<Example><![CDATA[402gap> IsExceptionalPerm([1,2,5,3,4]);403false404gap> IsExceptionalPerm([1,1,3,1,1]);405false406gap> IsExceptionalPerm([2,4,6,1,3,5]);407true408gap> IsExceptionalPerm([2,3,4,1,1,1]);409true410gap> ]]></Example>411</Description>412</ManSection>413414415416<ManSection>417<Func Name="ExceptionalBoundedAutomaton" Arg="k"/>418<Returns>The automaton which accepts all exceptional permutations with highest rank encoding <C>k</C>.</Returns>419<Description>420The language of <C>k</C> rank encoded exceptional permutations will be finite, and so it regular.421<Example><![CDATA[422gap> ExceptionalBoundedAutomaton(8);423< deterministic automaton on 8 letters with 41 states >424gap> Spectrum(last,20);425[ 0, 2, 0, 2, 0, 4, 0, 4, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0 ]426gap> ExceptionalBoundedAutomaton(5);427< deterministic automaton on 5 letters with 21 states >428gap> Spectrum(last);429[ 0, 2, 0, 2, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0 ]430gap> ]]></Example>431</Description>432</ManSection>433434</Section>435</Chapter>436437438