h$te]K      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                                   # Safe-Inferredwcombinat-compat Number of cycles (of partitions) combinat-compatNumber of leaves (of trees) combinat-compatNumber of nodes (of trees)combinat-compat"Shape (of tableaux, skew tableaux)combinat-compat&Duality (of partitions, tableaux, etc)combinat-compat%Weight (of partitions, tableaux, etc)combinat-compatNumber of partscombinat-compat Emptyness   None.^combinat-compatThe Rand monad transformercombinat-compat,A simple random monad to make life suck less/combinat-compatThe boolean argument will True only for the last element2combinat-compat8extend lines with spaces so that they have the same lineFcombinat-compatThis may be occasionally usefulGcombinat-compat9Puts a standard-conforming random function into the monad. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJ. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJNone)-Ncombinat-compatOrder of elements in a matrixQcombinat-compatVertical separatorRcombinat-compatempty separatorScombinat-compatn spacesTcombinat-compat$some custom list of characters, eg. " - "5 (the characters are interpreted as below each other)Ucombinat-compatHorizontal separatorVcombinat-compatempty separatorWcombinat-compatn spacesXcombinat-compatsome custom string, eg. " | "[combinat-compatVertical alignment_combinat-compatHorizontal alignmentccombinat-compat1A type class to have a simple way to draw things ecombinat-compatThe type of a (rectangular) ASCII figure. Internally it is a list of lines of the same length plus the size.Note: The Show instance is pretty-printing, so that it's convenient in ghci.icombinat-compatAn empty (0x0) rectangletcombinat-compat4Horizontal append, centrally aligned, no separation.ucombinat-compat2Vertical append, centrally aligned, no separation.vcombinat-compat4Horizontal concatenation, top-aligned, no separationwcombinat-compat7Horizontal concatenation, bottom-aligned, no separationxcombinat-compat3Vertical concatenation, left-aligned, no separationycombinat-compat4Vertical concatenation, right-aligned, no separationzcombinat-compat General horizontal concatenation{combinat-compatGeneral vertical concatenation|combinat-compatHorizontally pads with the given number of spaces, on both sides}combinat-compatVertically pads with the given number of empty lines, on both sides~combinat-compatPads by single empty lines vertically and two spaces horizontallycombinat-compatExtends an ASCII figure with spaces horizontally to the given width. Note: the alignment is the alignment of the original picture in the new bigger picture!combinat-compatExtends an ASCII figure with spaces vertically to the given height. Note: the alignment is the alignment of the original picture in the new bigger picture!combinat-compat4Extend horizontally with the given number of spaces.combinat-compat7Extend vertically with the given number of empty lines.combinat-compatHorizontal indentationcombinat-compatVertical indentationcombinat-compatCuts the given number of columns from the picture. The alignment is the alignment of the picture, not the cuts.%This should be the (left) inverse of .combinat-compatCuts the given number of rows from the picture. The alignment is the alignment of the picture, not the cuts.%This should be the (left) inverse of .combinat-compatPastes the first ASCII graphics onto the second, keeping the second one's dimension (that is, overlapping parts of the first one are ignored). The offset is relative to the top-left corner of the second picture. Spaces at treated as transparent.Example: tabulate (HCenter,VCenter) (HSepSpaces 2, VSepSpaces 1) [ [ caption (show (x,y)) $ pasteOnto (x,y) (filledBox '@' (4,3)) (asciiBox (7,5)) | x <- [-4..7] ] | y <- [-3..5] ]combinat-compatPastes the first ASCII graphics onto the second, keeping the second one's dimension. The first argument specifies the transparency condition (on the first picture). The offset is relative to the top-left corner of the second picture.combinat-compat A version of  where we can specify the corner of the second picture to which the offset is relative: &pasteOntoRel (HLeft,VTop) == pasteOntocombinat-compat0Tabulates the given matrix of pictures. Example: tabulate (HCenter, VCenter) (HSepSpaces 2, VSepSpaces 1) [ [ asciiFromLines [ "x=" ++ show x , "y=" ++ show y ] | x<-[7..13] ] | y<-[98..102] ]combinat-compat)Automatically tabulates ASCII rectangles.combinat-compat4Adds a caption to the bottom, with default settings.combinat-compat"Adds a caption to the bottom. The Bool flag specifies whether to add an empty between the caption and the figurecombinat-compat&An ASCII border box of the given size combinat-compat/An "rounded" ASCII border box of the given sizecombinat-compat,A box simply filled with the given charactercombinat-compatA box of spacescombinat-compat An integercombinat-compattransparency conditioncombinat-compat=0 : signedBinomial n k == binomial n k for any n,k : signedBinomial n k == signedBinomial n (n-k) for k >= 0 : signedBinomial (-n) k == (-1)^k * signedBinomial (n+k-1) k,Note: This is compatible with Mathematica's Binomial function.combinat-compatA given row of the Pascal triangle; equivalent to a sequence of binomial numbers, but much more efficient. You can also left-fold over it. +pascalRow n == [ binomial n k | k<-[0..n] ]combinat-compatCatalan numbers. OEIS:A000108.combinat-compat(Catalan's triangle. OEIS:A009766. Note: catalanTriangle n n == catalan n catalanTriangle n k == countStandardYoungTableaux (toPartition [n,k])combinat-compatRows of (signed) Stirling numbers of the first kind. OEIS:A008275. Coefficients of the polinomial (x-1)*(x-2)*...*(x-n+1),. This function uses the recursion formula.combinat-compat(Signed) Stirling numbers of the first kind. OEIS:A008275. This function uses &, so it shouldn't be used to compute many Stirling numbers.Argument order: signedStirling1st n kcombinat-compat3(Unsigned) Stirling numbers of the first kind. See .combinat-compatStirling numbers of the second kind. OEIS:A008277. This function uses an explicit formula.Argument order: stirling2nd n kcombinat-compatBernoulli numbers. bernoulli 1 == -1%2 and bernoulli k == 0 for k>2 and odd. This function uses the formula involving Stirling numbers of the second kind. Numerators: A027641, denominators: A027642.combinat-compatBell numbers (Sloane's A000110) from B(0) up to B(n). B(0)=B(1)=1, B(2)=2, etc. %The Bell numbers count the number of set partitions of a set of size nSee (http://en.wikipedia.org/wiki/Bell_numbercombinat-compatThe n-th Bell number B(n), using the Stirling numbers of the second kind. This may be slower than using . NoneGcombinat-compat choose_ k n' returns all possible ways of choosing k disjoint elements from [1..n] choose_ k n == choose k [1..n]combinat-compatAll possible ways to choose k elements from a list, without repetitions. "Antisymmetric power" for lists. Synonym for .combinat-compat A version of * which also returns the complementer sets. choose k = map fst . choose' kcombinat-compatAnother variation of . This satisfies choose'' k == map (\(xs,ys) -> (map fst xs, map snd ys)) . choose' kcombinat-compatAnother variation on  which tags the elements based on whether they are part of the selected subset ( ) or not (): &choose k = map rights . chooseTagged kcombinat-compatAll possible ways to choose k elements from a list, with repetitions*. "Symmetric power" for lists. See also Math.Combinat.Compositions. TODO: better name?combinat-compatA synonym for .combinat-compat*"Tensor power" for lists. Special case of : 2tuplesFromList k xs == listTensor (replicate k xs) See also Math.Combinat.Tuples. TODO: better name?combinat-compat"Tensor product" for lists.combinat-compatSublists of a list having given number of elements. Synonym for .combinat-compat# = binom { n } { k }.combinat-compatAll sublists of a list.combinat-compat# = 2^n.combinat-compatrandomChoice k n& returns a uniformly random choice of k elements from the set [1..n]Example: do cs <- replicateM 10000 (getStdRandom (randomChoice 3 7)) mapM_ print $ histogram cs None?e3combinat-compat;Disjoint cycle notation for permutations. Internally it is [[Int]].4The cycles are to be understood as follows: a cycle [c1,c2,...,ck] means the permutation '( c1 c2 c3 ... ck ) ( c2 c3 c4 ... c1 )combinat-compatA permutation. Internally it is an (unboxed) array of the integers [1..n]#, with indexing range also being (1,n). If this array of integers is [p1,p2,...,pn]?, then in two-line notations, that represents the permutation '( 1 2 3 ... n ) ( p1 p2 p3 ... pn )That is, it is the permutation sigma! whose (right) action on the set [1..n] is  sigma(1) = p1 sigma(2) = p2 ...((NOTE: this changed at version 0.2.8.0!)combinat-compatNote: this is slower than combinat-compat7Assumes that the input is a permutation of the numbers [1..n].combinat-compatNote: Indexing starts from 1.combinat-compat9Checks whether the input is a permutation of the numbers [1..n].combinat-compat9Checks whether the input is a permutation of the numbers [1..n].combinat-compatChecks the input.combinat-compatReturns n2, where the input is a permutation of the numbers [1..n]combinat-compat:Checks whether the permutation is the identity permutationcombinat-compat Synonym for combinat-compatThe standard two-line notation, moving the element indexed by the top row into the place indexed by the corresponding element in the bottom row.combinat-compatThe inverse two-line notation, where the it's the bottom line which is in standard order. The columns of this are a permutation of the columns .Remark: the top row of inverseTwoLineNotation perm$ is the same as the bottom row of twoLineNotation (inverse perm).combinat-compat(Two-line notation for any set of numberscombinat-compat#Convert to disjoint cycle notation. This is compatible with Maple's convert(perm,'disjcyc') and also with Mathematica's PermutationCycles[perm]6Note however, that for example Mathematica uses the top row/ to represent a permutation, while we use the  bottom row8 - thus even though this function looks identical, the meaning, of both the input and output is different!combinat-compatPlus 1 or minus 1.combinat-compatAn  inversion of a permutation sigma is a pair (i,j) such that i sigma(j).6This functions returns the inversion of a permutation.combinat-compat!Returns the number of inversions: 2numberOfInversions perm = length (inversions perm) Synonym for combinat-compatReturns the number of inversions, using the merge-sort algorithm. This should be  O(n*log(n))combinat-compatReturns the number of inversions, using the definition, thus it's O(n^2).combinat-compatBubble sorts breaks a permutation into the product of adjacent transpositions: multiplyMany' n (map (transposition n) $ bubbleSort2 perm) == permNote that while this is not unique, the number of transpositions equals the number of inversions.combinat-compat)Another version of bubble sort. An entry i1 in the return sequence means the transposition (i,i+1): multiplyMany' n (map (adjacentTransposition n) $ bubbleSort perm) == permcombinat-compatThe permutation [n,n-1,n-2,...,2,1](. Note that it is the inverse of itself.combinat-compatChecks whether the permutation is the reverse permutation @[n,n-1,n-2,...,2,1].combinat-compat)A transposition (swapping two elements). transposition n (i,j) is the permutation of size n which swaps i'th and j 'th elements.combinat-compatProduct of transpositions. transpositions n list == multiplyMany [ transposition n pair | pair <- list ]combinat-compatadjacentTransposition n k swaps the elements k and (k+1).combinat-compat#Product of adjacent transpositions. adjacentTranspositions n list == multiplyMany [ adjacentTransposition n idx | idx <- list ]combinat-compat5The permutation which cycles a list left by one step: ,permuteList (cycleLeft 5) "abcde" == "bcdea"Or in two-line notation: ( 1 2 3 4 5 ) ( 2 3 4 5 1 )combinat-compat6The permutation which cycles a list right by one step: -permuteList (cycleRight 5) "abcde" == "eabcd"Or in two-line notation: ( 1 2 3 4 5 ) ( 5 1 2 3 4 )combinat-compat&Multiplies two permutations together: p  q, means the permutation when we first apply p , and then q& (that is, the natural action is the right action) See also  for our conventions. combinat-compatThe inverse permutation.combinat-compat&The identity (or trivial) permutation.combinat-compatMultiply together a  non-empty list of permutations (the reason for requiring the list to be non-empty is that we don't know the size of the result). See also .combinat-compatMultiply together a (possibly empty) list of permutations, all of which has size ncombinat-compatRight action of a permutation on a set. If our permutation is encoded with the sequence [p1,p2,...,pn](, then in the two-line notation we have '( 1 2 3 ... n ) ( p1 p2 p3 ... pn ).We adopt the convention that permutations act  on the right (as in Knuth): permute pi2 (permute pi1 set) == permute (pi1 `multiply` pi2) set Synonym to combinat-compat"Right action on lists. Synonym to permuteListRightcombinat-compat5The right (standard) action of permutations on sets.  permuteRight pi2 (permuteRight pi1 set) == permuteRight (pi1 `multiply` pi2) set3The second argument should be an array with bounds (1,n)(. The function checks the array bounds.combinat-compatThe right (standard) action on a list. The list should be of length n. 4fromPermutation perm == permuteRightList perm [1..n]combinat-compat4The left (opposite) action of the permutation group. permuteLeft pi2 (permuteLeft pi1 set) == permuteLeft (pi2 `multiply` pi1) setIt is related to  via: permuteLeft pi arr == permuteRight (inverse pi) arr permuteRight pi arr == permuteLeft (inverse pi) arrcombinat-compatThe left (opposite) action on a list. The list should be of length n. permuteLeftList perm set == permuteList (inverse perm) set fromPermutation (inverse perm) == permuteLeftList perm [1..n]combinat-compatA synonym for combinat-compatAll permutations of [1..n]) in lexicographic order, naive algorithm.combinat-compat# = n!combinat-compatA synonym for .combinat-compatA synonym for .combinat-compat,Generates a uniformly random permutation of [1..n] . Durstenfeld's algorithm (see  *http://en.wikipedia.org/wiki/Knuth_shuffle).combinat-compatGenerates a uniformly random cyclic permutation of [1..n]. Sattolo's algorithm (see  *http://en.wikipedia.org/wiki/Knuth_shuffle).combinat-compatGenerates all permutations of a multiset. The order is lexicographic. A synonym for combinat-compat3# = \frac { (sum_i n_i) ! } { \prod_i (n_i !) } combinat-compatGenerates all permutations of a multiset (based on "algorithm L" in Knuth; somewhat less efficient). The order is lexicographic.  7 None/combinat-compatWhich orientation to draw the Ferrers diagrams. For example, the partition [5,4,1] corrsponds to:In standard English notation:  @@@@@ @@@@ @= p in the dominance order of partitions (this is partial ordering on the set of partitions of n).See ,http://en.wikipedia.org/wiki/Dominance_ordercombinat-compat+Lists all partitions of the same weight as lambda and also dominated by lambda0 (that is, all partial sums are less or equal): dominatedPartitions lam == [ mu | mu <- partitions (weight lam), lam `dominates` mu ]combinat-compat+Lists all partitions of the sime weight as mu and also dominating mu3 (that is, all partial sums are greater or equal): dominatingPartitions mu == [ lam | lam <- partitions (weight mu), lam `dominates` mu ]combinat-compatLists partitions of n into k parts. sort (partitionsWithKParts k n) == sort [ p | p <- partitions n , numberOfParts p == k ]Naive recursive algorithm.combinat-compatPartitions of n with only odd partscombinat-compatPartitions of n with distinct parts.Note: length (partitionsWithDistinctParts d) == length (partitionsWithOddParts d)combinat-compatReturns True of the first partition is a subpartition (that is, fit inside) of the second. This includes equalitycombinat-compat7This is provided for convenience/completeness only, as: .isSuperPartitionOf q p == isSubPartitionOf p qcombinat-compat:Sub-partitions of a given partition with the given weight: sort (subPartitions d q) == sort [ p | p <- partitions d, isSubPartitionOf p q ]combinat-compat'All sub-partitions of a given partitioncombinat-compatcombinat-compat3A tableau is simply represented as a list of lists.combinat-compatASCII diagram of a tableaucombinat-compatThe shape of a tableaucombinat-compatNumber of entriescombinat-compatThe dual of the tableau is the mirror image to the main diagonal.combinat-compatThe content of a tableau is the list of its entries. The ordering is from the left to the right and then from the top to the bottomcombinat-compat An element (i,j) of the resulting tableau (which has shape of the given partition) means that the vertical part of the hook has length i, and the horizontal part j. The  hook length is thus i+j-1. Example: > mapM_ print $ hooks $ toPartition [5,4,1] [(3,5),(2,4),(2,3),(2,2),(1,1)] [(2,4),(1,3),(1,2),(1,1)] [(1,1)]combinat-compatThe row word of a tableau is the list of its entry read from the right to the left and then from the top to the bottom.combinat-compat Semistandard3 tableaux can be reconstructed from their row wordscombinat-compatThe  column word of a tableau is the list of its entry read from the bottom to the top and then from the left to the rightcombinat-compatStandard tableaux can be reconstructed from either their column or row wordscombinat-compat4Checks whether a sequence of positive integers is a  lattice word, which means that in every initial part of the sequence any number i) occurs at least as often as the number i+1combinat-compat A tableau is  semistandard if its entries are weekly increasing horizontally and strictly increasing verticallycombinat-compatSemistandard Young tableaux of given shape, "naive" algorithm combinat-compat+Stanley's hook formula (cf. Fulton page 55)combinat-compat A tableau is standard2 if it is semistandard and its content is exactly [1..n] , where n is the weight.combinat-compatStandard Young tableaux of a given shape. Adapted from John Stembridge,  ?http://www.math.lsa.umich.edu/~jrs/software/SFexamples/tableaux.combinat-compathook-length formulaNone˲combinat-compatA plane partition encoded as a tablaeu (the "Z" heights are the numbers)combinat-compat9Throws an exception if the input is not a plane partitioncombinat-compatThe XY projected shape of a plane partition, as an integer partitioncombinat-compat!The Z height of a plane partitioncombinat-compatStacks layers of partitions into a plane partition. Throws an exception if they do not form a plane partition.combinat-compatStacks layers of partitions into a plane partition. This is unsafe in the sense that we don't check that the partitions fit on the top of each other.combinat-compat0The "layers" of a plane partition (in direction Z). We should have ,unsafeStackLayers (planePartLayers pp) == ppcombinat-compat"Plane partitions of a given weight  None combinat-compatA Gelfand-Tstetlin tableaucombinat-compatKostka numbers (via counting Gelfand-Tsetlin patterns). See for example *http://en.wikipedia.org/wiki/Kostka_numberK(lambda,mu)==0 unless lambda dominates mu: [ mu | mu <- partitions (weight lam) , kostkaNumber lam mu > 0 ] == dominatedPartitions lamcombinat-compatVery naive (and slow) implementation of Kostka numbers, for reference.combinat-compat$Lists all (positive) Kostka numbers  K(lambda,mu) with the given lambda: kostkaNumbersWithGivenLambda lambda == Map.fromList [ (mu , kostkaNumber lambda mu) | mu <- dominatedPartitions lambda ]It's much faster than computing the individual Kostka numbers, but not as fast as it could be.combinat-compat$Lists all (positive) Kostka numbers  K(lambda,mu) with the given mu: kostkaNumbersWithGivenMu mu == Map.fromList [ (lambda , kostkaNumber lambda mu) | lambda <- dominatingPartitions mu ]This function uses the iterated Pieri rule, and is relatively fast.combinat-compatGenerates all Kostka-Gelfand-Tsetlin tableau, that is, triangular arrays like /[ 3 ] [ 3 , 2 ] [ 3 , 1 , 0 ] [ 2 , 0 , 0 , 0 ]with both rows and column non-increasing such that the top diagonal read lambda (in this case  lambda=[3,2]>) and the diagonal sums are partial sums of mu (in this case  mu=[2,1,1,1])The number of such GT tableaux is the Kostka number K(lambda,mu).combinat-compat-This returns the corresponding Kostka number: countKostkaGelfandTsetlinPatterns lambda mu == length (kostkaGelfandTsetlinPatterns lambda mu)combinat-compat Computes the Schur expansion of h[n1]*h[n2]*h[n3]*...*h[nk] via iterating the Pieri rule. Note: the coefficients are actually the Kostka numbers; the following is true: Map.toList (iteratedPieriRule (fromPartition mu)) == [ (lam, kostkaNumber lam mu) | lam <- dominatingPartitions mu ]This should be faster than individually computing all these Kostka numbers.combinat-compatIterating the Pieri rule, we can compute the Schur expansion of %h[lambda]*h[n1]*h[n2]*h[n3]*...*h[nk]combinat-compat Computes the Schur expansion of e[n1]*e[n2]*e[n3]*...*e[nk] via iterating the Pieri rule. Note: the coefficients are actually the Kostka numbers; the following is true: Map.toList (iteratedDualPieriRule (fromPartition mu)) == [ (dualPartition lam, kostkaNumber lam mu) | lam <- dominatingPartitions mu ]This should be faster than individually computing all these Kostka numbers. It is a tiny bit slower than .combinat-compatIterating the Pieri rule, we can compute the Schur expansion of %e[lambda]*e[n1]*e[n2]*e[n3]*...*e[nk]None>pcombinat-compatSet of (i,j) pairs with i>=j>=1.combinat-compatTriangular arrayscombinat-compatGenerates all tableaux of size k. Effective for k<=6.combinat-compat;Note: This is slow (it actually generates all the tableaux)combinat-compatA skew tableau is represented by a list of offsets and entriescombinat-compatThe shape of a skew tableau combinat-compatThe weight of a tableau is the weight of its shape, or the number of entriescombinat-compatThe dual of a skew tableau, that is, its mirror image to the main diagonalcombinat-compat A tableau is  semistandard if its entries are weekly increasing horizontally and strictly increasing verticallycombinat-compat A tableau is standard2 if it is semistandard and its content is exactly [1..n] , where n is the weight.combinat-compat8All semi-standard skew tableaux filled with the numbers [1..n]combinat-compathttp://www.math.lsa.umich.edu/~jrs/software/SFexamples/LR_rule lrRule (mkSkewPartition (lambda,nu)) == Map.fromList list where muw = weight lambda - weight nu list = [ (mu, coeff) | mu <- partitions muw , let coeff = lrCoeff lambda (mu,nu) , coeff /= 0 ] combinat-compat_lrRule lambda mu4 computes the expansion of the skew Schur function  s[lambda/mu]$ via the Littlewood-Richardson rule.combinat-compatlrCoeff lam (mu,nu) computes the coressponding Littlewood-Richardson coefficients. This is also the coefficient of  s[lambda] in the product  s[mu]*s[nu]%Note: This is much slower than using  or 3 to compute several coefficients at the same time!combinat-compatlrCoeff (lam/nu) mu computes the coressponding Littlewood-Richardson coefficients. This is also the coefficient of s[mu] in the product  s[lam/nu]%Note: This is much slower than using  or 3 to compute several coefficients at the same time!combinat-compat!lrScalar (lambda/mu) (alpha/beta)> computes the scalar product of the two skew Schur functions  s[lambda/mu] and  s[alpha/beta]$ via the Littlewood-Richardson rule.+Adapted from John Stembridge Maple code: >http://www.math.lsa.umich.edu/~jrs/software/SFexamples/LR_rulecombinat-compat;Computes the expansion of the product of Schur polynomials  s[mu]*s[nu] using the Littlewood-Richardson rule. Note: this is symmetric in the two arguments.Based on the wikipedia article 8https://en.wikipedia.org/wiki/Littlewood-Richardson_rule lrMult mu nu == Map.fromList list where lamw = weight nu + weight mu list = [ (lambda, coeff) | lambda <- partitions lamw , let coeff = lrCoeff lambda (mu,nu) , coeff /= 0 ]  Safe-Inferredcombinat-compatGenerates graphviz .dot file from a forest. The first argument tells whether to make the individual trees clustered subgraphs; the second is the name of the graph.combinat-compatGenerates graphviz .dot file from a tree. The first argument is the name of the graph.combinat-compat-make the individual trees clustered subgraphscombinat-compat#reverse the direction of the arrowscombinat-compatname of the graphcombinat-compat"reverse the direction of the arrowcombinat-compatname of the graphNone>combinat-compatA binary tree with leaves and internal nodes decorated with types a and b, respectively.combinat-compat.A binary tree with leaves decorated with type a.combinat-compat*The monadic join operation of binary treescombinat-compatEnumerates the leaves a tree, starting from 0, ignoring old labelscombinat-compatEnumerates the leaves a tree, starting from zero, and also returns the number of leavescombinat-compat0Enumerates the leaves a tree, starting from zerocombinat-compat+Convert a binary tree to a rose tree (from  Data.Tree)combinat-compat8Generates all sequences of nested parentheses of length 2n in lexigraphic order. Synonym for .combinat-compat Synonym for .combinat-compat Synonym for .combinat-compatGenerates all sequences of nested parentheses of length 2n. Order is lexicographical (when right parentheses are considered smaller then left ones). Based on "Algorithm P" in Knuth, but less efficient because of the "idiomatic" code.combinat-compatGenerates a uniformly random sequence of nested parentheses of length 2n. Based on "Algorithm W" in Knuth.combinat-compatNth sequence of nested parentheses of length 2n. The order is the same as in #. Based on "Algorithm U" in Knuth.combinat-compat Generates all binary trees with n- nodes. At the moment just a synonym for .combinat-compat9# = Catalan(n) = \frac { 1 } { n+1 } \binom { 2n } { n }.This is also the counting function for forests and nested parentheses.combinat-compat=Generates all binary trees with n nodes. The naive algorithm.combinat-compat1Generates an uniformly random binary tree, using .combinat-compatGrows a uniformly random binary tree. "Algorithm R" (Remy's procudere) in Knuth. Nodes are decorated with odd numbers, leaves with even numbers (from the set [0..2n]"). Uses mutable arrays internally.combinat-compat3Draws a binary tree in ASCII, ignoring node labels.Example: autoTabulate RowMajor (Right 5) $ map asciiBinaryTree_ $ binaryTrees 4combinat-compatncombinat-compat!N; should satisfy 1 <= N <= C(n) 4 4 None> !combinat-compatA lattice path is a path using only the allowed steps, never going below the zero level line y=0. Note that if you rotate such a path by 45 degrees counterclockwise, you get a path which uses only the steps (1,0) and (0,1), and stays above the main diagonal (hence the name, we just use a different convention).combinat-compatA step in a lattice pathcombinat-compat the step (1,1)combinat-compat the step (1,-1)combinat-compat5Draws the path into a list of lines. For example try: =autotabulate RowMajor (Right 5) (map asciiPath $ dyckPaths 4)combinat-compat=A lattice path is called "valid", if it never goes below the y=0 line.combinat-compat;A Dyck path is a lattice path whose last point lies on the y=0 linecombinat-compat Maximal height of a lattice pathcombinat-compat.Endpoint of a lattice path, which starts from (0,0).combinat-compatReturns the coordinates of the path (excluding the starting point (0,0), but including the endpoint)combinat-compatCounts the up-stepscombinat-compatCounts the down-stepscombinat-compat'Counts both the up-steps and down-stepscombinat-compat2Number of peaks of a path (excluding the endpoint)combinat-compat-Number of points on the path which touch the y=00 zero level line (excluding the starting point (0,0), but including the endpoint; that is, for Dyck paths it this is always positive!).combinat-compatNumber of points on the path which touch the level line at height h (excluding the starting point (0,0), but including the endpoint).combinat-compat dyckPaths m lists all Dyck paths from (0,0) to (2m,0). Remark: Dyck paths are obviously in bijection with nested parentheses, and thus also with binary trees.!Order is reverse lexicographical: +sort (dyckPaths m) == reverse (dyckPaths m)combinat-compat dyckPaths m lists all Dyck paths from (0,0) to (2m,0).  .sort (dyckPathsNaive m) == sort (dyckPaths m) *Naive recursive algorithm, order is ad-hoccombinat-compatThe number of Dyck paths from (0,0) to (2m,0)# is simply the m'th Catalan number.combinat-compatThe trivial bijectioncombinat-compat,The trivial bijection in the other directioncombinat-compatboundedDyckPaths h m lists all Dyck paths from (0,0) to (2m,0) whose height is at most h. Synonym for .combinat-compatboundedDyckPathsNaive h m lists all Dyck paths from (0,0) to (2m,0) whose height is at most h. sort (boundedDyckPaths h m) == sort [ p | p <- dyckPaths m , pathHeight p <= h ] sort (boundedDyckPaths m m) == sort (dyckPaths m) "%combinat-compat#A completely unlabelled binary treecombinat-compatA (strict) binary tree with labelled leaves (but unlabelled nodes)combinat-compatA tree diagram, consisting of two binary trees with the same number of leaves, representing an element of the group F.combinat-compat.combinat-compat8Adds unique labels to the nodes (including leaves) of a combinat-compat8Adds unique labels to the nodes (including leaves) of a .combinat-compatregularNaryTrees d n' returns the list of (rooted) trees on n$ nodes where each node has exactly d0 children. Note that the leaves do not count in n. Naive algorithm.combinat-compatTernary trees on n nodes (synonym for regularNaryTrees 3)combinat-compatWe have length (regularNaryTrees d n) == countRegularNaryTrees d n == \frac {1} {(d-1)n+1} \binom {dn} {n}combinat-compat %# = \frac {1} {(2n+1} \binom {3n} {n}combinat-compat All trees on n nodes where the number of children of all nodes is in element of the given set. Example: autoTabulate RowMajor (Right 5) $ map asciiTreeVertical $ map labelNChildrenTree_ $ semiRegularTrees [2,3] 2 [ length $ semiRegularTrees [2,3] n | n<-[0..] ] == [1,2,10,66,498,4066,34970,312066,2862562,26824386,...](The latter sequence is A027307 in OEIS: https://oeis.org/A027307Remark: clearly, we have .semiRegularTrees [d] n == regularNaryTrees d ncombinat-compat:Vertical ASCII drawing of a tree, without labels. Example: autoTabulate RowMajor (Right 5) $ map asciiTreeVertical_ $ regularNaryTrees 2 4Nodes are denoted by @ , leaves by *.combinat-compatPrints all labels. Example: asciiTreeVertical $ addUniqueLabelsTree_ $ (regularNaryTrees 3 9) !! 666Nodes are denoted by (label) , leaves by label.combinat-compat9Prints the labels for the leaves, but not for the nodes.combinat-compatThe leftmost spine (the second element of the pair is the leaf node)combinat-compat(The leftmost spine without the leaf nodecombinat-compat.The length (number of edges) on the left spine 0leftSpineLength tree == length (leftSpine_ tree)combinat-compat is leaf,  is nodecombinat-compat> None/] combinat-compat,A unique normal form for braids, called the left-greedy normal form. It looks like  Delta^i*P, where Delta is the positive half-twist, i is an integer, and P> is a positive word, which can be further decomposed into non-Delta permutation words; these words themselves are not unique, but the permutations they realize are unique.This will solve the word problem relatively fast, though it is not the fastest known algorithm.combinat-compatthe exponent of Deltacombinat-compatthe permutationscombinat-compat/A braid word representing the given normal formcombinat-compatComputes the normal form of a braid. We apply free reduction first, it should be faster that way.combinat-compatThis function does not apply free reduction before computing the normal formcombinat-compatThis one uses the naive inverse replacement method. Probably somewhat slower than .combinat-compatThe  starting set( of a positive braid P is the subset of [1..n-1] defined by S(P) = [ i | P = sigma_i * Q , Q is positive ] = [ i | (sigma_i^-1 * P) is positive ] This function returns the starting set a positive word, assuming it is a permutation braid (see Lemma 2.4 in [2])combinat-compatThe  finishing set( of a positive braid P is the subset of [1..n-1] defined by F(P) = [ i | P = Q * sigma_i , Q is positive ] = [ i | (P * sigma_i^-1) is positive ] This function returns the finishing set, assuming the input is a permutation braidcombinat-compatThis satisfies permutationStartingSet p == permWordStartingSet n (_permutationBraid p)combinat-compatThis satisfies permutationFinishingSet p == permWordFinishingSet n (_permutationBraid p)  &'(&')&')*+,*+-*+.*+/*+0123456789:;<=>?@ABCDEFFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                                                                                                                                                                  /                 &&&*+*+*+*+*+*+*+*+*+*+*+.combinat-compat-0.2.8.2-1JwigQPmDqoEXxOXVRneGoMath.Combinat.TypeLevelMath.Combinat.Trees.BinaryMath.Combinat.ClassesMath.Combinat.HelperMath.Combinat.ASCIIMath.Combinat.Numbers.PrimesMath.Combinat.Partitions.Vector!Math.Combinat.Partitions.MultisetMath.Combinat.SignMath.Combinat.NumbersMath.Combinat.SetsMath.Combinat.Permutations Math.Combinat.Partitions.IntegerMath.Combinat.Partitions.SkewMath.Combinat.Partitions.SetMath.Combinat.Numbers.SeriesMath.Combinat.CompositionsMath.Combinat.Groups.FreeMath.Combinat.TableauxMath.Combinat.Partitions.Plane%Math.Combinat.Tableaux.GelfandTsetlin*Math.Combinat.Tableaux.GelfandTsetlin.ConeMath.Combinat.Tableaux.Skew+Math.Combinat.Tableaux.LittlewoodRichardsonMath.Combinat.Trees.NaryMath.Combinat.Trees.GraphvizMath.Combinat.LatticePaths$Math.Combinat.Partitions.NonCrossingMath.Combinat.Groups.Thompson.FMath.Combinat.TuplesMath.Combinat.Groups.BraidMath.Combinat.Groups.Braid.NFSystemRandomMath.Combinat.PartitionsMath.Combinat.Trees Math.Combinatbase Data.Proxy asProxyTypeOfProxycontainers-0.6.2.1 Data.Tree subForest rootLabelNodeTreeForestHasNumberOfCyclesnumberOfCyclesHasNumberOfLeavesnumberOfLeavesHasNumberOfNodes numberOfNodesHasShapeshape HasDualitydual HasWeightweight HasHeightheightHasWidthwidthHasNumberOfParts numberOfParts CanBeEmptyisEmptyemptyRandTRanddebugswappairs pairsWithsum'equatingreverseOrderingreverseCompare reverseSort groupSortBynubOrdisWeaklyIncreasingisStrictlyIncreasingisWeaklyDecreasingisStrictlyDecreasing mapWithLast mapWithFirstmapWithFirstLastmkLinesUniformWidthmkBlocksUniformHeightmkUniformBlocks hConcatLines vConcatLinescount histogramfromJust intToBool boolToIntnestunfold1unfold unfoldEitherunfoldM mapAccumM longZipWithrunRand flipRunRandrunRandT flipRunRandTrandrandRoll randChoose randProxy1$fFunctorRandT$fApplicativeRandT $fMonadRandT MatrixOrderRowMajorColMajorVSep VSepEmpty VSepSpaces VSepStringHSep HSepEmpty HSepSpaces HSepString AlignmentAlignVAlignVTopVCenterVBottomHAlignHLeftHCenterHRight DrawASCIIasciiASCII asciiSize asciiLines emptyRect asciiXSize asciiYSize asciiString printASCIIasciiFromLinesasciiFromStringhSepSize hSepStringvSepSize vSepString|||===hCatTophCatBotvCatLeft vCatRighthCatWithvCatWithhPadvPadpad hExtendTo vExtendTo hExtendWith vExtendWithhIndentvIndenthCutvCut pasteOnto pasteOnto' pasteOntoRel pasteOntoRel'tabulate autoTabulatecaptioncaption'asciiBoxroundedAsciiBox filledBoxtransparentBox asciiNumber asciiShow $fShowASCII$fEqMatrixOrder$fOrdMatrixOrder$fShowMatrixOrder$fReadMatrixOrder $fShowVSep $fShowHSep $fEqVAlign $fShowVAlign $fEqHAlign $fShowHAlignprimes primesSimple primesTMWEgroupIntegerFactorsintegerFactorsTrialDivision integerLog2 ceilingLog2isSquareintegerSquareRootceilingSquareRootintegerSquareRoot'integerSquareRootNewton'powerModmillerRabinPrimalityTestisProbablyPrimeisVeryProbablyPrime IntVectorvectorPartitions_vectorPartitionsfasc3B_algorithm_MpartitionMultisetSignPlusMinusisPlusisMinus signValuesigned paritySignparitySignValue negateIfOdd oppositeSignmulSignproductOfSigns $fRandomSign $fMonoidSign$fSemigroupSign$fEqSign $fOrdSign $fShowSign $fReadSign factorialdoubleFactorialbinomialsignedBinomial pascalRow multinomialcatalancatalanTrianglesignedStirling1stArraysignedStirling1stunsignedStirling1st stirling2nd bernoullibellNumbersArray bellNumberchoose_choosechoose'choose'' chooseTaggedcombinecomposetuplesFromList listTensor kSublistscountKSublistssublists countSublists randomChoiceDisjointCycles PermutationfromPermutationpermutationUArraypermutationArraytoPermutationUnsafeuarrayToPermutationUnsafe isPermutationmaybePermutation toPermutationpermutationSizeisIdentityPermutationasciiPermutationasciiDisjointCyclestwoLineNotationinverseTwoLineNotationgenericTwoLineNotationfromDisjointCyclesdisjointCyclesUnsafedisjointCyclesToPermutationpermutationToDisjointCyclesisEvenPermutationisOddPermutationsignOfPermutationsignValueOfPermutationisCyclicPermutation inversionsnumberOfInversionsnumberOfInversionsMergenumberOfInversionsNaive bubbleSort2 bubbleSortreversePermutationisReversePermutation transpositiontranspositionsadjacentTranspositionadjacentTranspositions cycleLeft cycleRightmultiplyinverseidentity multiplyMany multiplyMany'permute permuteList permuteRightpermuteRightList permuteLeftpermuteLeftList permutations _permutationspermutationsNaive_permutationsNaivecountPermutationsrandomPermutation_randomPermutationrandomCyclicPermutation_randomCyclicPermutationrandomPermutationDurstenfeldrandomCyclicPermutationSattolopermuteMultisetcountPermuteMultisetfasc2B_algorithm_L$fHasNumberOfCyclesPermutation$fHasWidthPermutation$fDrawASCIIPermutation$fReadPermutation$fShowPermutation!$fHasNumberOfCyclesDisjointCycles$fDrawASCIIDisjointCycles$fEqDisjointCycles$fOrdDisjointCycles$fShowDisjointCycles$fReadDisjointCycles$fEqPermutation$fOrdPermutationPartitionConventionEnglishNotationEnglishNotationCCWFrenchNotationPair Partition mkPartitiontoPartitionUnsafe toPartition isPartitionisEmptyPartitionemptyPartition fromPartitionpartitionHeightpartitionWidth heightWidthpartitionWeight dualPartition_dualPartition_dualPartitionNaive diffSequenceelements _elementstoExponentialForm_toExponentialFormfromExponentialFromcountAutomorphisms_countAutomorphisms partitions _partitionscountPartitionscountPartitionsNaivepartitionCountListpartitionCountListNaive allPartitionsallPartitionsGroupedallPartitions'allPartitionsGrouped'countAllPartitions'countAllPartitions _partitions' partitions'countPartitions'randomPartitionrandomPartitions dominatesdominatedPartitions_dominatedPartitionsdominatingPartitions_dominatingPartitionspartitionsWithKPartscountPartitionsWithKPartspartitionsWithOddPartspartitionsWithDistinctPartsisSubPartitionOfisSuperPartitionOf subPartitions_subPartitionsallSubPartitions_allSubPartitionssuperPartitions_superPartitions pieriRule dualPieriRuleasciiFerrersDiagramasciiFerrersDiagram'$fDrawASCIIPartition$fHasDualityPartition$fHasWeightPartition$fHasWidthPartition$fHasHeightPartition$fCanBeEmptyPartition$fHasNumberOfPartsPartition$fEqPartitionConvention$fShowPartitionConvention $fEqPartition$fOrdPartition$fShowPartition$fReadPartition SkewPartitionmkSkewPartitionsafeSkewPartitionskewPartitionWeightnormalizeSkewPartitionfromSkewPartitionouterPartitioninnerPartitiondualSkewPartitionskewPartitionsWithOuterShapeallSkewPartitionsWithOuterShapeskewPartitionsWithInnerShapeasciiSkewFerrersDiagramasciiSkewFerrersDiagram'$fDrawASCIISkewPartition$fHasDualitySkewPartition$fHasWeightSkewPartition$fEqSkewPartition$fOrdSkewPartition$fShowSkewPartition SetPartition_standardizeSetPartitionfromSetPartitiontoSetPartitionUnsafetoSetPartition_isSetPartitionsetPartitionShape setPartitionssetPartitionsWithKPartssetPartitionsNaivesetPartitionsWithKPartsNaivecountSetPartitionscountSetPartitionsWithKParts$fHasNumberOfPartsSetPartition$fEqSetPartition$fOrdSetPartition$fShowSetPartition$fReadSetPartition unitSeries zeroSeries constSeriesidSeries powerTerm addSeries sumSeries subSeries negateSeries scaleSeries mulSeriesproductOfSeriesconvolve convolveManyreciprocalSeriesintegralReciprocalSeries composeSeries substitute lagrangeCoeffintegralLagrangeInversionlagrangeInversion expSeries cosSeries sinSeries coshSeries sinhSeries log1Series dyckSeries coinSeries coinSeries'convolveWithCoinSeriesconvolveWithCoinSeries'productPSeriesproductPSeries'convolveWithProductPSeriesconvolveWithProductPSeries'pseriesconvolveWithPSeriespseries'convolveWithPSeries' signedPSeriesconvolveWithSignedPSeries Composition compositions'countCompositions'allCompositions1allCompositions' compositionscountCompositions compositions1countCompositions1randomCompositionrandomComposition1Word GeneratorGenInvgenIdxgenSign genSignValueabsGenshowGenshowWord inverseGen inverseWordallWords allWordsNoInvrandomGeneratorrandomGeneratorNoInv randomWordrandomWordNoInv multiplyFreeequivalentFreereduceWordFreereduceWordFreeNaivecountIdentityWordsFreecountWordReductionsFree multiplyZ2 multiplyZ3 multiplyZm equivalentZ2 equivalentZ3 equivalentZm reduceWordZ2 reduceWordZ3 reduceWordZmreduceWordZ2NaivereduceWordZ3NaivereduceWordZmNaivecountIdentityWordsZ2countWordReductionsZ2countIdentityWordsZ3NoInv$fFunctorGenerator $fEqGenerator$fOrdGenerator$fShowGenerator$fReadGeneratorTableau asciiTableau _tableauShape tableauShape tableauWeight dualTableautableauContenthooks hookLengthsrowWordrowWordToTableau columnWordcolumnWordToTableau isLatticeWordisSemiStandardTableausemiStandardYoungTableauxcountSemiStandardYoungTableauxisStandardTableaustandardYoungTableauxcountStandardYoungTableaux$fHasDuality[] $fHasWeight[]$fHasShape[]Partition $fDrawASCII[]$fCanBeEmpty[] PlanePart fromPlanePartisValidPlanePart toPlanePartplanePartShapeplanePartZHeightplanePartWeight singleLayer stackLayersunsafeStackLayersplanePartLayersplanePartitions$fHasWeightPlanePart$fCanBeEmptyPlanePart $fEqPlanePart$fOrdPlanePart$fShowPlanePartGT kostkaNumberkostkaNumberReferenceNaivekostkaNumbersWithGivenLambdakostkaNumbersWithGivenMuasciiGTkostkaGelfandTsetlinPatternskostkaGelfandTsetlinPatterns'!countKostkaGelfandTsetlinPatternsiteratedPieriRuleiteratedPieriRule'iteratedPieriRule''iteratedDualPieriRuleiteratedDualPieriRule'iteratedDualPieriRule''TriunTriTriangularArraytriangularArrayUnsafefromTriangularArrayasciiTriangularArraygtSimplexContent_gtSimplexContentgtSimplexTableaux_gtSimplexTableauxcountGTSimplexTableauxinvertGTSimplexTableau_invertGTSimplexTableau$fIxTri$fDrawASCIIArray$fEqHole $fOrdHole $fShowHole$fEqTri$fOrdTri $fShowTri SkewTableauskewTableauShapeskewTableauWeightdualSkewTableauisSemiStandardSkewTableauisStandardSkewTableausemiStandardSkewTableauxasciiSkewTableauasciiSkewTableau'skewTableauRowWordskewTableauColumnWordfillSkewPartitionWithRowWordfillSkewPartitionWithColumnWordskewTableauRowContent$fDrawASCIISkewTableau$fHasDualitySkewTableau$fHasWeightSkewTableau"$fHasShapeSkewTableauSkewPartition$fFunctorSkewTableau$fEqSkewTableau$fOrdSkewTableau$fShowSkewTableau lrRuleNaivelrRule_lrRulelrCoefflrCoeff'lrScalar _lrScalarlrMultBinTree'Branch'Leaf'BinTreeBranchLeafaddUniqueLabelsForest_addUniqueLabelsTree_addUniqueLabelsForestaddUniqueLabelsTreeDotgraphvizDotBinTreegraphvizDotBinTree'graphvizDotForestgraphvizDotTreeParen LeftParen RightParenleafgraftforgetNodeDecorationsenumerateLeaves_enumerateLeaves'enumerateLeaves toRoseTree toRoseTree'parenthesesToStringstringToParenthesesforestToNestedParenthesesforestToBinaryTreenestedParenthesesToForestnestedParenthesesToForestUnsafenestedParenthesesToBinaryTree#nestedParenthesesToBinaryTreeUnsafebinaryTreeToNestedParenthesesbinaryTreeToForestnestedParenthesesrandomNestedParenthesesnthNestedParenthesescountNestedParenthesesfasc4A_algorithm_Pfasc4A_algorithm_Wfasc4A_algorithm_U binaryTreescountBinaryTreesbinaryTreesNaiverandomBinaryTreefasc4A_algorithm_RasciiBinaryTree_$fDrawASCIIBinTree$fMonadBinTree$fApplicativeBinTree$fTraversableBinTree$fFoldableBinTree$fFunctorBinTree$fHasNumberOfLeavesBinTree$fHasNumberOfNodesBinTree$fHasNumberOfLeavesBinTree'$fHasNumberOfNodesBinTree' $fEqParen $fOrdParen $fShowParen $fReadParen $fEqBinTree' $fOrdBinTree'$fShowBinTree'$fReadBinTree' $fEqBinTree $fOrdBinTree $fShowBinTree $fReadBinTree LatticePathStepUpStepDownStep asciiPath isValidPath isDyckPath pathHeight pathEndpointpathCoordinatespathNumberOfUpStepspathNumberOfDownStepspathNumberOfUpDownStepspathNumberOfPeakspathNumberOfZeroTouchespathNumberOfTouches' dyckPathsdyckPathsNaivecountDyckPathsnestedParensToDyckPathdyckPathToNestedParensboundedDyckPathsboundedDyckPathsNaive latticePathslatticePathsNaivecountLatticePathstouchingDyckPathstouchingDyckPathsNaivecountTouchingDyckPathspeakingDyckPathspeakingDyckPathsNaivecountPeakingDyckPathsrandomDyckPath $fHasWidth[] $fHasHeight[]$fEqStep $fOrdStep $fShowStep NonCrossing_isNonCrossing_isNonCrossingUnsafe_standardizeNonCrossingfromNonCrossingtoNonCrossingUnsafe toNonCrossingtoNonCrossingMaybesetPartitionToNonCrossingdyckPathToNonCrossingPartition#dyckPathToNonCrossingPartitionMaybenonCrossingPartitionToDyckPath$_nonCrossingPartitionToDyckPathMaybenonCrossingPartitionsnonCrossingPartitionsWithKPartscountNonCrossingPartitions$countNonCrossingPartitionsWithKPartsrandomNonCrossingPartition$fHasNumberOfPartsNonCrossing$fEqNonCrossing$fOrdNonCrossing$fShowNonCrossing$fReadNonCrossingTTDiag_width_domain_rangeX1X0CtBrLfmkTDiagmkTDiagDontReduce isValidTDiag isPositive isReducedx0x1xkpositive equivalentreduce treeCaretList removeCaretscomposeDontReduceextensionToCommonTree subdivision1 subdivision2 listGraftbranchcarettreeNumberOfLeaves treeWidth enumerate_ enumerate rightVineleftVineflipTree toBinTree fromBinTreeasciiTasciiT' asciiTLabels asciiTLabels' asciiTDiag$fHasWidthTree$fHasNumberOfLeavesTree$fDrawASCIITree$fHasWidthTDiag$fDrawASCIITDiag $fEqTDiag $fOrdTDiag $fShowTDiag$fEqTree $fOrdTree $fShowTree $fFunctorTreeregularNaryTrees ternaryTreescountRegularNaryTreescountTernaryTreessemiRegularTreesasciiTreeVertical_asciiTreeVerticalasciiTreeVerticalLeavesOnly leftSpine rightSpine leftSpine_ rightSpine_leftSpineLengthrightSpineLengthclassifyTreeNode isTreeLeaf isTreeNode isTreeLeaf_ isTreeNode_treeNodeNumberOfChildrencountTreeNodescountTreeLeavescountTreeLabelsWithcountTreeNodesWithlabelDepthTreelabelDepthForestlabelDepthTree_labelDepthForest_labelNChildrenTreelabelNChildrenForestlabelNChildrenTree_labelNChildrenForest_ derivTrees$fHasNumberOfNodesTreetuples'tuples1' countTuples' countTuples1'tuplestuples1 countTuples countTuples1 binaryTuplesSome proxyUndefproxyOfproxyOf1proxyOf2asProxyTypeOf1typeArgiTypeArgwithSome withSomeM selectSome selectSomeM withSelected withSelectedM SomeBraidBraidBrGenSigmaSigmaInvbrGenIdx brGenSign brGenSignIdxinvBrGennumberOfStrands someBraid withSomeBraidmkBraid withBraid braidWordbraidWordLengthextendfreeReduceBraidWordsigmasigmaInv doubleSigma positiveWord halfTwist _halfTwisttheGarsideBraidtautauPerm composeMany isPureBraidbraidPermutation_braidPermutationisPositiveBraidWordisPermutationBraid_isPermutationBraidpermutationBraid_permutationBraid_permutationBraid' linkingMatrix_linkingMatrix strandLinking bronfmanHbronfmanHsListexpandBronfmanHhorizBraidASCIIhorizBraidASCII'allPositiveBraidWords allBraidWords_allPositiveBraidWords_allBraidWordsrandomBraidWordrandomPositiveBraidWordrandomPerturbBraidWordwithRandomBraidWordwithRandomPositiveBraidWord_randomBraidWord_randomPositiveBraidWord$fDrawASCIIBraid $fShowBraid $fEqBrGen $fOrdBrGen $fShowBrGenBraidNF _nfDeltaExp_nfPerms nfReprWordbraidNormalFormbraidNormalForm'braidNormalFormNaive'permWordStartingSetpermWordFinishingSetpermutationStartingSetpermutationFinishingSet$fEqXGen $fShowXGen $fEqBraidNF $fOrdBraidNF $fShowBraidNF Data.EitherRightLeft GHC.MaybeNothingunfoldForestM_BFunfoldTreeM_BF unfoldForestM unfoldTreeM unfoldForest unfoldTreefoldTreelevelsflatten drawForestdrawTreeghc-prim GHC.TypesTrueFalse