h*SN      !"#$%&'()*+,-./0123456789:;<=>?@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~           0.14.0 Safe-Inferred.Anders Claesson 2013-2016+Anders Claesson  Safe-Inferred sym An array of ssym+Construct an array from a list of elements.symThe list of elements.symSlice a  into contiguous segments of the given sizes. Each segment size must be positive and they must sum to the size of the array. symw `at` i is the value of w at i, where i is in  [0..size w-1]. symLike   but without range checking. symThe indices of all elements equal to the query element, in ascending order. symNone !symLexicographically, the next bitmask with the same Hamming weight.symones k m< is the set / subsequence of indices whose bits are set in m. Default implementation: :ones m = fromListN (popCount m) $ filter (testBit m) [0..]symA SubSeq is represented by an increasing array of non-negative integers.sym n `choose` k is the list of subsequences of [0..n-1] with k elements.symLexicographically, the next  with the same Hamming weight.sym onesCLong m) gives the indices whose bits are set in m.symLexicographically, the next integral number with the same Hamming weight.   Anders Claesson 2014+Anders Claesson  Safe-Inferred sym3The list of minimal sets with respect to inclusion.sym3The list of maximal sets with respect to inclusion.sym1A list of all k element subsets of the given set.sym'A list of all subsets of the given set.symSort and remove duplicates.Anders Claesson 2013-2016+Anders Claesson  Safe-InferredH symA permutation is just a '. By convention a permutation of size n& is understood to be a permutation of [0..n-1].sym#The unique permutation length zero.sym"The unique permutation length one. symThe identity permutation.!sym(The reverse of the identity permutation."symConstruct a permutation from a list of elements. As opposed to : this is a safe function in the sense that the output of  mkPerm xs& is guaranteed to be a permutation of [0..length xs-1] . E.g., #mkPerm "baxa" == fromList [2,0,3,1].#symThe rank of the given permutation, where the rank is defined as in [W. Myrvold and F. Ruskey, Ranking and Unranking Permutations in Linear Time, Information Processing Letters, 79 (2001) 281-284].$symThe permutation of size n whose rank is r, where the rank is defined as in [W. Myrvold and F. Ruskey, Ranking and Unranking Permutations in Linear Time, Information Processing Letters, 79 (2001) 281-284].%sym!All permutations of a given size.    !"#$%  !"#$%Anders Claesson 2013+Anders Claesson  Safe-Inferredp&sym7The Simion-Schmidt bijection from Av(123) onto Av(132).'symThe inverse of the Simion-Schmidt bijection. It is a function from Av(132) to Av(123).&'&'Anders Claesson 2013+Anders Claesson  Safe-Inferredy(sym+Ration by 0 degrees, i.e. the identity map.)symRation by 90 degrees clockwise.*sym'Ration by 2*90 = 180 degrees clockwise.+sym'Ration by 3*90 = 270 degrees clockwise.,sym2Reflection through a horizontal axis (also called 8).-sym0Reflection through a vertical axis (also called 7)..sym2Reflection through the main diagonal (also called 6)./sym%Reflection through the anti-diagonal.0symThe dihedral group of order 8 (the symmetries of a square); that is, %d8 = [r0, r1, r2, r3, s0, s1, s2, s3]1symThe Klein four-group (the symmetries of a non-equilateral rectangle); that is, klein4 = [r0, r2, s0, s1]2sym orbit fs x is the orbit of x under the group of function fs. E.g., 4orbit klein4 "2314" == ["1423","2314","3241","4132"]3symsymmetryClasses fs xs= is the list of equivalence classes under the action of the group of functions fs.4sym$Symmetry classes with respect to D8.5sym'Symmetry classes with respect to Klein46sym"The group theoretical inverse: if  v = inverse u then v `at` (u `at` i) = i.7sym)The reverse of the given permutation: if  v = reverse u then v `at` i = u `at` (n-1-i).8sym,The complement of the given permutation: if v = complement u then v `at` i = n - 1 - u `at` i.9sym rotate = r1 = inverse . reverse()*+,-./0123459876()*+,-./0123459876Anders Claesson 2013-2016+Anders Claesson  Safe-Inferred:symThe list of (plus) components.;sym:The list of skew components, also called minus components.<symFor each position, left-to-right, records the largest value seen thus far.=symFor each position, left-to-right, records the smallest value seen thus far.>symFor each position,  right-to-left+, records the largest value seen thus far.?symFor each position,  right-to-left,, records the smallest value seen thus far.:;<=>?:;<=>? Anders Claesson 2013+Anders Claesson  Safe-InferredI@symThe product/composition of u and v: if w = u @ v then w `at ` i = v `at` (u `at` i).Asym.The (left) group action of Perm on itself: if w = u A v then w `at ` (u `at` i) = v `at` i.@A@A Anders Claesson 2017+Anders Claesson  Safe-InferredBCEDFGIHJKLMONBCEDFGIHJKLMON Anders Claesson 2014-2016+Anders Claesson  Safe-Inferred< TsymA box is represented by the coordinates of its southwest corner.Usym1A mesh is a, possibly empty, set of shaded boxes.sym match p w m# determines whether the subword in w specified by m is an occurrence of p.bsym copiesOf p w. is the list of sets that represent copies of p in w.csymw c p is a predicate determining if w contains the pattern p.dsymw d p is a predicate determining if w avoids the pattern p.esymw e ps is a predicate determining if w avoids the patterns ps.fsymavoiders ps ws is the list of permutations in ws avoiding the patterns in ps.PQRSUTVWXYZ[\]bcdef^_`aPQRSUTVWXYZ[\]bcdef^_`a Anders Claesson 2013+Anders Claesson None% ksym)Pattern is just an alias for permutation.lsym ordiso u v m# determines whether the subword in v specified by m is order isomorphic to u.msym copiesOf p w. is the list of sets that represent copies of p in w.nsymw n p is a predicate determining if w contains the pattern p.osymw o p is a predicate determining if w avoids the pattern p.psymw p ps is a predicate determining if w avoids the patterns ps.qsymavoiders ps ws is the list of permutations in ws avoiding the patterns in ps.rsymThe set of minimal elements with respect to containment. FIX: Poor implementationssymThe set of maximal elements with respect to containment. FIX: Poor implementationtsym coeff f v is the coefficient of v+ when expanding the permutation statistic f as a sum of permutations/patterns. See Petter Brndn and Anders Claesson: Mesh patterns and the expansion of permutation statistics as sums of permutation patterns, The Electronic Journal of Combinatorics 18(2) (2011),  http://www.combinatorics.org/ojs/index.php/eljc/article/view/v18i2p5. klmnopqrst klmnopqrst Anders Claesson 2013-2016+Anders Claesson  Safe-Inferred( wsym&A pair of Semistandard Young Tableaux.{symA !Semistandard Young Tableau (SSYT): the entries weakly increase along each row and strictly increase down each column.|symA Generalized Permutation is a lexicographically sorted list of pairs of non-negative integers.}sym"An entry is a non-negative integer~symA pair of empty Young tableaux.sym2Check if a given pair of Young tableaux are empty.sym0Produce a string for pretty printing SSYT pairs.sym-The Robinson-Schensted-Knuth (RSK) algorithm.sym!The Robinson-Schensted algorithm.sym6The inverse of the Robinson-Schensted-Knuth algorithm.sym0The inverse of the Robinson-Schensted algorithm.|}{wxyzuv~|}{wxyzuv~Anders Claesson 2013+Anders Claesson None)symIs the permutation simple?Anders Claesson 2013+Anders Claesson  Safe-Inferred*QsymOne pass of stack-sort.symOne pass of bubble-sort.Anders Claesson 2013-2016+Anders Claesson None8wsymThe number of ascents. An ascent in w is an index i such that  w[i] < w[i+1].symThe number of descents. A descent in w is an index i such that  w[i] > w[i+1].symThe number of  excedances : positions i such that w[i] > i.symThe number of  fixed points : positions i such that  w[i] == i.symThe number of strong fixed points% (also called splitters): positions i such that w[j] < i for j < i and w[j] > i for j > i.symThe number of cycles7: orbits of the permutation when viewed as a function.symThe number of  inversions : pairs i,j such that i < j and  w[i] > w[j].symThe major index is the sum of descents.symThe co-major index is the sum of descents.symThe number of peaks : positions i such that  w[i-1] < w[i] and  w[i] > w[i+1].symThe number of valleys : positions i such that  w[i-1] > w[i] and  w[i] < w[i+1].symThe number of double ascents : positions i such that w[i-1] < w[i] < w[i+1].symThe number of double descents : positions i such that w[i-1] > w[i] > w[i+1].symThe number of left-to-right minima : positions i such that  w[i] < w[j] for all j < i.symThe number of left-to-right maxima : positions i such that  w[i] > w[j] for all j < i.symThe number of right-to-left minima : positions i such that  w[i] < w[j] for all j > i.symThe number of right-to-left maxima : positions i such that  w[i] > w[j] for all j > i.sym=The first (left-most) element in the standardization. E.g., (head "231" = head (fromList [1,2,0]) = 1.sym=The last (right-most) element in the standardization. E.g., (last "231" = last (fromList [1,2,0]) = 0.sym0Length of the left-most increasing run: largest i such that w[0] < w[1] < ... < w[i-1].sym0Length of the left-most decreasing run: largest i such that w[0] > w[1] > ... > w[i-1].sym1Length of the right-most increasing run: largest i such that w[n-i] < ... < w[n-2] < w[n-1].sym1Length of the right-most decreasing run: largest i such that w[n-i] > ... > w[n-2] > w[n-1].sym The number of components. E.g., [2,0,3,1,4,6,7,5] has three components:  [2,0,3,1], [4] and [6,7,5].sym%The number of skew components. E.g., [5,7,4,6,3,1,0,2] has three skew components:  [5,7,4,6], [3] and [1,0,2].symThe rank as defined by Elizalde and Pak [Bijections for refined restricted permutations, J. Comb. Theory, Ser. A, 2004]: 6maximum [ k | k <- [0..n-1], w[i] >= k for all i < k ]symThe dimension of a permutation is defined as the largest non-fixed-point, or zero if all points are fixed.symThe number of small ascents. A  small ascent in w is an index i such that w[i] + 1 == w[i+1].sym The number of small descents. A  small descent in w is an index i such that w[i] == w[i+1] + 1.sym#The longest increasing subsequence.sym#The longest decreasing subsequence.Anders Claesson 2013+Anders Claesson  Safe-Inferred;symA permgram consists of a permutation together with a label for each index of the permutation.symThe underlying permutation.sym$The assignment of labels to indices.symThe purpose of this data type is to assign labels to the indices of a given permutation.symConstruct a permgram from an underlying permutation and a list of labels.symThe inverse permgram. It's obtained by mirroring the permgram in the x=y diagonal.symThe size of a permgram is the size of the underlying permutation.Anders Claesson 2013+Anders Claesson  Safe-Inferred>isymThe  direct sum of two permutations.sym)The direct sum of a list of permutations.symThe skew sum of two permutations.sym'The skew sum of a list of permutations.sym inflate w vs is the  inflation of w by vs#. It is the permutation of length sum (map size vs)# obtained by replacing each entry w!i, by an interval that is order isomorphic to vs!i; in such a way that the intervals are order isomorphic to w. In particular, u /+/ v == inflate (mkPerm "12") [u,v] u \-\ v == inflate (mkPerm "21") [u,v]66Anders Claesson 2013+Anders Claesson  Safe-InferredEsym%The class of increasing permutations.sym%The class of decreasing permutations.symAv(1)symAv(12)symAv(21)symAv(123)symAv(132)symAv(213)sym6Av(231); also know as the stack sortable permutations.symAv(312)symAv(321)symAv(1243)symAv(1324)symAv(2134)symAv(s) where s is a string of one or more patterns, using space as a seperator.symThe V-class is Av(132, 231). It is so named because the diagram of a typical permutation in this class is shaped like a V.symThe D-class is Av(213, 312). It is so named because the diagram of a typical permutation in this class is shaped like a D.symThe >-class is Av(132, 312). It is so named because the diagram of a typical permutation in this class is shaped like a >.symThe <-class is Av(213, 231). It is so named because the diagram of a typical permutation in this class is shaped like a <.sym The union of , ,  and .symThe class of separable permutations; it is identical to Av(2413,3142).sym'The class of layered permutations with k layers.sym"The class of layered permutations.sym)The class of Fibonacci permutations with k layers. A Fibonacci permutation? is a layered permutation whose layers are all of size 1 or 2.sym'The class of Fibonacci permutations. A Fibonacci permutation? is a layered permutation whose layers are all of size 1 or 2.Anders Claesson 2013+Anders Claesson  Safe-InferredEk  :@% !"#$;<=>?A&'lmnopqrst Anders Claesson 2013+Anders Claesson  Safe-InferredN sym8The class of permutations. Minimal complete definition: ,  and  . The default implementation of  can be somewhat slow, so you may want to implement it as well.symThe standardization map. If there is an underlying linear order on a then st8 is determined by the unique order preserving map from [0..] to that order. In any case, the standardization map should be equivariant with respect to the group action defined below; i.e., it should hold that st (u `act` v) == u `act` st vsym A (left)  group action of  on a.. As for any group action it should hold that (u `act` v) `act` w == u `act` (v `act` w) && idperm n `act` v == vwhere v,w::a and u::Perm are of size n.symThe size of a permutation. The default implementation derived from size == size . st%This is not a circular definition as  on 9 is implemented independently. If the implementation of  is slow, then it can be worth while to override the standard definiton; any implementation should, however, satisfy the identity above.sym+The identity permutation of the given size.sym2The group theoretical inverse. It should hold that inverse == unst . inverse . st'and this is the default implementation.symPredicate determining if two permutations are order-isomorphic. The default implementation uses u `ordiso` v == u == st vEquivalently, one could use 6u `ordiso` v == inverse u `act` v == idperm (size u)symThe inverse of . It should hold that #unst w == w `act` idperm (P.size w)'and this is the default implementation.sym/The list of all permutations of the given size.symLifts a function on s to one on any permutations.symLike $ but for functions of two variables.symA String viewed as a permutation of its characters. The alphabet is ordered as #['1'..'9'] ++ ['A'..'Z'] ++ ['a'..]   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~      y z { | } / 0                     Y]abcMX7M<  sym-0.14.0-hUkRczxH8W2yJN8wo3HDVSym.Internal.SizeSym.Internal.CLongArraySym.Internal.SubSeqSym.Internal.UtilSym.PermSym.Perm.Bijection Sym.Perm.D8Sym.Perm.ComponentSym.Perm.GroupSym.Perm.ListStatSym.Perm.MeshPatternSym.Perm.Pattern Sym.Perm.SSYTSym.Perm.Simple Sym.Perm.Sort Sym.Perm.Stat Sym.PermgramSym.Perm.ConstructionsSym.Perm.ClassSymsym Sym.Perm.MetaSizesize $fSizeMaybe $fSizeSet $fSizeList CLongArrayfromListtoListslicesatunsafeAt elemIndicesimapizipWith unsafeNew unsafeWith$fShowCLongArray$fSizeCLongArray$fOrdCLongArray$fEqCLongArraySubSeqchoose$fBitmaskInteger$fBitmaskCLongminimamaximakSubsetspowersetnubSortPerm emptypermoneidpermebbmkPermrankunrankperms simionSchmidtsimionSchmidt'r0r1r2r3s0s1s2s3d8klein4orbitsymmetryClasses d8Classes klein4Classesinversereverse complementrotate componentsskewComponents leftMaxima leftMinima rightMaxima rightMinimacomposeactascascIxascBotsascTopsdesdesIxdesBotsdesTopsexcfpdes0des0Ixdes0Botsdes0Tops MeshPatternMPgetPermgetMeshBoxMesh mkPatternpatternmeshcolsrowscolrowbox kVincularvincular bivincular meshPatternscopiesOfcontainsavoids avoidsAllavoiders$fSizeMeshPattern$fShowMeshPattern$fEqMeshPattern$fOrdMeshPatternPatternordisocoeffShapeshapeSSYTPairinsertionTableaurecordingTableauSSYTGeneralizedPermEntryemptynulldisplayfromGeneralizedPermfromPermtoGeneralizedPermtoPerm$fShowSSYTPair$fShapeSSYTPair $fShapeList $fEqSSYTPairsimple stackSort bubbleSortsfpcycinvmajcomajpeakvalldascddeslminlmaxrminrmaxheadlastlirldrrirrdrcompscompepdimasc0lisldsPermgrampermlabelLabelpermgram$fMonadPermgram$fApplicativePermgram$fFunctorPermgram $fOrdPermgram $fEqPermgram$fShowPermgram/+/ directSum\-\skewSuminflateincdecav1av12av21av123av132av213av231av312av321av1243av1324av2134avveecaretgtltwedges separableskLayeredlayered kFibonacci fibonacci Permutationstunstliftlift2$fPermutationSSYTPair$fPermutationList$fPermutationCLongArraybaseForeign.C.TypesCLongnextones nextCLong onesCLong nextIntegralmatch