!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~MThis yields user interface functions for human readable printing of objects.  The idea is to use ( instances for marshalling of data, and  for  user interaction. :5A shuffle is a special kind of sequence of integers.  ^Using the path sequence, the leaf orders and order reversal, we can get 8 different orderings ' from one paradigm. These are given by , , ,   for the d variations giving (possibly reversed) path sequence comparison precedence over (possibly reversed) , leaf permutations; additionally, there are  , ,   and  2 for the variations with the opposite precedence. DThe type class that parametrizes types implementing tree orderings. PMonomial orderings on the free operad requires us to choose an ordering for the D trees. These are parametrized by types implementing the type class , Q and this is a data type for a tree carrying its comparison type. We call these   ordered trees. RThis is the fundamental datatype of the whole project. Monomials in a free operad T are decorated trees, and we build a type for decorated trees here. We require our M trees to have Int labels, limiting us to at most 2 147 483 647 leaf labels. QThe fundamental tree data type used. Leaves carry labels - most often integral - ] and these are expected to control, e.g., composition points in shuffle operad compositions. X The vertices carry labels, used for the ordering on trees and to distinguish different $ basis corollas of the same arity.  The arity of a corolla !Apply a function f: to all the internal vertex labels of a PreDecoratedTree. "ZIf a tree has trees as labels for its leaves, we can replace the leaves with the roots of V those label trees. Thus we may glue together trees, as required by the compositions. #Building an ordered tree with PathLex! ordering from a decorated tree. $5Extracting the underlying tree from an ordered tree. %5Finding the path sequences. cf. Dotsenko-Khoroshkin. &BReordering the path sequences to mirror the actual leaf ordering. '"Changes direction of an ordering. (`Build a single corolla in a decorated tree. Takes a list for labels for the leaves, and derives e the arity of the corolla from those. This, and the composition functions, form the preferred method  to construct trees. )Build a single leaf. *&Check whether a given root is a leaf. +)Check whether a given root is a corolla. ,DChange the leaves of a tree to take their values from a given list. -;Find the permutation the leaf labeling ordains for inputs. .1Find the minimal leaf covering any given vertex. /ICompute the number of leaves of the entire tree covering a given vertex. 00 is one less than /. 13We need to recognize sorted sequences of integers. 2EThis tests whether a given sequence of integers really is a shuffle. 3DThis tests whether a given sequence of integers is an (i,j)-shuffle 4dThis tests whether a given sequence of integers is admissible for a specific composition operation. 5KThis applies the resulting permutation from a shuffle to a set of elements 6#Apply the permutation inversely to 5. 75Generate all subsets of length k from a given list. 8Applies f only at the nth place in a list. 9,Picks out the last nonzero entry in a list. :3Generates shuffle permutations by filling buckets. ;(Generates all shuffles from Sh_i(p,q). UMonomial ordering for trees. We require this to be a total well-ordering, compatible ! with the operadic compositions. 9  !"#$%&'()*+,-./0123456789:;9    !"#$%&'()*+,-./0123456789:;<VThe type carrying operadic elements. An element in an operad is an associative array E with keys being labeled trees and values being their coefficients. =>?HExtracting the internal structure of the an element of the free operad. @%Scalar multiplication in the operad. A>Apply a function to each monomial tree in the operad element. B_Fold a function over all monomial trees in an operad element, collating the results in a list. CXGiven a list of (tree,coefficient)-pairs, reconstruct the corresponding operad element. DGGiven an operad element, extract a list of (tree, coefficient) pairs. EjConstruct an element in the free operad from its internal structure. Use this instead of the constructor. FKConstruct a monomial in the free operad from a tree and a tree ordering. It's coefficient will be 1. GXConstruct a monomial in the free operad from a tree, a tree ordering and a coefficient. HYReturn the zero of the corresponding operad, with type appropriate to the given element. E Can be given an appropriately casted undefined to construct a zero. I)Check whether an element is equal to 0. JDExtract the leading term of an operad element as an operad element. K0Extract the leading term of an operad element. LDExtract the ordered tree for the leading term of an operad element. M<Extract the tree for the leading term of an operad element. N6Extract the leading coefficient of an operad element. O=Extract all occurring monomial trees from an operad element. Arithmetic in the operad. <=>?@ABCDEFGHIJKLMNO<==>?@ABCDEFGHIJKLMNO@P[Data type to move the results of finding an embedding point for a subtree in a larger tree c around. The tree is guaranteed to have exactly one corolla tagged Nothing, the subtrees on top of f that corolla sorted by minimal covering leaf in the original setting, and the shuffle carried around F is guaranteed to restore the original leaf labels before the search. Q+The number of internal vertices of a tree. RIA list of operation degrees occurring in the terms of the operad element S4The maximal operation degree of an operadic element T5Check that an element of a free operad is homogenous U"Composition in the shuffle operad V>Composition in the non-symmetric operad. We compose s o_i t. W$Composition in the symmetric operad X8Non-symmetric composition in the g(s;t1,...,tk) style. Y_Verification for a shuffle used for the g(s;t1,..,tk) style composition in the shuffle operad. Z Sanity check for permutations. [2Shuffle composition in the g(s;t1,...,tk) style. \4Symmetric composition in the g(s;t1,...,tk) style. ]&Returns True if there is a subtree of t isomorphic to s, respecting leaf orders. ^&Returns True if there is a subtree of t isomorphic to s7, respecting leaf orders, and not located at the root. _-Returns True if there is a rooted subtree of t isomorphic to s, respecting leaf orders. `9Finds all ways to embed s into t respecting leaf orders. aHelper function for b. beFinds all ways to embed s into t, respecting leaf orders and mapping the root of s to the root of t. cChecks a tree for planarity. dWReturns True if s and t divide u, with different embeddings and t sharing root with u. e Interchanges Left to Right and Right to Left for types  Either a a fProjects the type  Either a a onto the type a in the obvious manner. gApplies  flipEither% to the root vertex label of a tree. hSProjects vertex labels and applies leaf labels to a tree with internal labeling in  Either a a. i Strips the Either# layer from internal vertex labels jNAcquires lists for resorting leaf labels according to the algorithm found for 8 constructing small common multiples with minimal work. k'Locates the first vertex tagged with a Right$ constructor in a tree labeled with  Either a b. l$Equivalent to listToMaybe . reverse mnRecursive algorithm to figure out correct leaf labels for a reconstructed small common multiple of two trees. n2Finds rooted small common multiples of two trees. oNFinds structural small common multiples, disregarding leaf labels completely. pNFinds small common multiples of two trees bounding internal operation degree. q/Finds all small common multiples of two trees. rWFinds all small common multiples of two trees, bounding the internal operation degree. sConstructs embeddings for s and t in SCM(s,t) and returns these. t>Relabels a tree in the right order, but with entries from [1..] u$Removes vertex type encapsulations. v"Adds vertex type encapsulations. wZVerifies that two integer sequences correspond to the same total ordering of the entries. xGReturns True if any of the vertices in the given tree has been tagged. y_The function that mimics resubstitution of a new tree into the hole left by finding embedding,  called m_alpha,bPeta in Dotsenko-Khoroshkin. This version only attempts to resubstitute the tree + at the root, bailing out if not possible. z_The function that mimics resubstitution of a new tree into the hole left by finding embedding,  called m_alpha,bLeta in Dotsenko-Khoroshkin. This version recurses down in the tree in order @ to find exactly one hole, and substitute the tree sub into it. {qApplies the reconstruction map represented by em to all trees in the operad element op. Any operad element that q fails the reconstruction (by having the wrong total arity, for instance) will be silently dropped. We recommend [ you apply this function only to homogenous operad elements, but will not make that check. |>Finds all S polynomials for a given list of operad elements. }EFinds all S polynomials for which the operationdegree stays bounded. ~bFinds all S polynomials for a given pair of operad elements, keeping a bound on operation degree. Non-symmetric version of }. Non-symmetric version of ~. ?Reduce g with respect to f and the embedding em: lt f -> lt g. Reduce the leading monomial of op with respect to gb. Reduce all terms of op with respect to gbn. iPerform one iteration of the Buchberger algorithm: generate all S-polynomials. Reduce all S-polynomials. . Return anything that survived the reduction. iPerform one iteration of the Buchberger algorithm: generate all S-polynomials. Reduce all S-polynomials. ] Return anything that survived the reduction. Keep the occurring operation degrees bounded. Non-symmetric version of . mPerform the entire Buchberger algorithm for a given list of generators. Iteratively run the single iteration  from & until no new elements are generated. rDO NOTE: This is entirely possible to get stuck in an infinite loop. It is not difficult to write down generators o such that the resulting Groebner basis is infinite. No checking is performed to catch this kind of condition. Non-symmetric version of . pPerform the entire Buchberger algorithm for a given list of generators. This iteratively runs single iterations  from & until no new elements are generated. Non-symmetric version of . [Reduces a list of elements with respect to all other elements occurring in that same list. DAll trees composed from the given generators of operation degree n. ;Generate basis trees for a given Groebner basis for degree  maxDegree. divisors is expected 9 to contain the leading monomials in the Groebner basis. ^Change the monomial order used for a specific tree. Use this in conjunction with mapMonomials B in order to change monomial order for an entire operad element. @PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@PQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ The element m2(m2(1,2),3) The element m2(m2(1,3),2) The element m2(1,m2(2,3)) The element m2(1,2) The element m3(1,2,3)  The element m2(m2(1,2),m2(3,4)) *The list of operad elements consisting of 'm12_3'-'m13_2'-'m1_23'. This generates the ( ideal of relations for the operad Lie.   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~><=?@ABCDEFGHIJKLMNO !"#$%&'  ()*+,-./0123456789:;QRSTUVWXYZ[\P]^_`abcdefghijklmnopqrstuvwxyz{|}~          !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~C Operads-1.0 Math.OperadMath.Operad.PPrintMath.Operad.OrderedTreeMath.Operad.MapMath.Operad.MapOperadMath.Operad.OperadGBPPrintpppPShuffle RPermRPath RPermPath PermRPathPermPath RPathRPerm PathRPerm RPathPermPathPerm TreeOrdering treeComparecomparePathSequenceordering OrderedTreeOT DecoratedTreePreDecoratedTreeDTVertex vertexTypesubTreesDTLeaf vertexArity vertexMap glueTreesotdt pathSequenceorderedPathSequence reverseOrdercorollaleafisLeaf isCorolla relabelLeaves leafOrder minimalLeafnLeaves arityDegreeisSorted isShuffle isShuffleIJ isShuffleIPQ applyPerm invApplyPermkSubsetsapplyAt lastNonzero allShPerm allShuffles OperadElementOE MonomialMap extractMap.*. mapMonomials foldMonomialsfromListtoListoeoetoekzeroisZero leadingOTerm leadingTermleadingOMonomialleadingMonomialleadingCoefficientgetTrees EmbeddingoperationDegreeoperationDegreesmaxOperationDegree isHomogenousshuffleCompose nsComposesymmetricCompose nsComposeAllcheckShuffleAll isPermutationshuffleComposeAllsymmetricComposeAlldivides dividesHigh dividesRootedfindAllEmbeddingsfindUnsortedRootedEmbeddingfindRootedEmbedding planarTreedividesDifferent flipEither stripEitherflipEitherRootfuseTree stripTree leafOrdersfindFirstRight maybeLast leafLabels findRootedSCMfindNonSymmetricSCMfindBoundedSCM findAllSCMfindAllBoundedSCMscmToEmbedding rePackLabels fromJustTree toJustTreeequivalentOrderssubTreeHasNothingreconstructNodereconstructTreeapplyReconstructionfindAllSPolynomialsfindInitialSPolynomialsfindSPolynomialsfindNSInitialSPolynomialsfindNSSPolynomialsreduceOE reduceInitialreduceCompletelystepOperadicBuchbergerstepNSOperadicBuchbergerstepInitialOperadicBuchbergerstepNSInitialOperadicBuchbergeroperadicBuchbergernsOperadicBuchbergerstreamOperadicBuchbergerstreamNSOperadicBuchberger reduceBasisallTrees basisElements changeOrder FreeOperadTreem12_3m13_2m1_23m2m3yTreelgbbaseGHC.ShowShow$fOrdOrderedTreeMapTM StoredTreeSTsotdotfilter foldWithKey fromListWithintersectionWithkeysmap mapKeysWithmaxViewWithKeynull unionWith$fNumOperadElementlo1lo2lo3