\begin{patch}{LyndonWordXmpPagePatch1}
\begin{paste}{LyndonWordXmpPageFull1}{LyndonWordXmpPageEmpty1}
\pastebutton{LyndonWordXmpPageFull1}{\hidepaste}
\tab{5}\spadcommand{a:Symbol :='a\bound{a }}
\indentrel{3}\begin{verbatim}
   (1)  a
                                           Type: Symbol
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty1}
\begin{paste}{LyndonWordXmpPageEmpty1}{LyndonWordXmpPagePatch1}
\pastebutton{LyndonWordXmpPageEmpty1}{\showpaste}
\tab{5}\spadcommand{a:Symbol :='a\bound{a }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch2}
\begin{paste}{LyndonWordXmpPageFull2}{LyndonWordXmpPageEmpty2}
\pastebutton{LyndonWordXmpPageFull2}{\hidepaste}
\tab{5}\spadcommand{b:Symbol :='b\bound{b }}
\indentrel{3}\begin{verbatim}
   (2)  b
                                           Type: Symbol
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty2}
\begin{paste}{LyndonWordXmpPageEmpty2}{LyndonWordXmpPagePatch2}
\pastebutton{LyndonWordXmpPageEmpty2}{\showpaste}
\tab{5}\spadcommand{b:Symbol :='b\bound{b }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch3}
\begin{paste}{LyndonWordXmpPageFull3}{LyndonWordXmpPageEmpty3}
\pastebutton{LyndonWordXmpPageFull3}{\hidepaste}
\tab{5}\spadcommand{c:Symbol :='c\bound{c }}
\indentrel{3}\begin{verbatim}
   (3)  c
                                           Type: Symbol
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty3}
\begin{paste}{LyndonWordXmpPageEmpty3}{LyndonWordXmpPagePatch3}
\pastebutton{LyndonWordXmpPageEmpty3}{\showpaste}
\tab{5}\spadcommand{c:Symbol :='c\bound{c }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch4}
\begin{paste}{LyndonWordXmpPageFull4}{LyndonWordXmpPageEmpty4}
\pastebutton{LyndonWordXmpPageFull4}{\hidepaste}
\tab{5}\spadcommand{lword:= LyndonWord(Symbol)\bound{lword }}
\indentrel{3}\begin{verbatim}
   (4)  LyndonWord(Symbol)
                                             Type: Type
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty4}
\begin{paste}{LyndonWordXmpPageEmpty4}{LyndonWordXmpPagePatch4}
\pastebutton{LyndonWordXmpPageEmpty4}{\showpaste}
\tab{5}\spadcommand{lword:= LyndonWord(Symbol)\bound{lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch5}
\begin{paste}{LyndonWordXmpPageFull5}{LyndonWordXmpPageEmpty5}
\pastebutton{LyndonWordXmpPageFull5}{\hidepaste}
\tab{5}\spadcommand{magma := FreeMagma(Symbol)\bound{magma }}
\indentrel{3}\begin{verbatim}
   (5)  FreeMagma(Symbol)
                                             Type: Type
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty5}
\begin{paste}{LyndonWordXmpPageEmpty5}{LyndonWordXmpPagePatch5}
\pastebutton{LyndonWordXmpPageEmpty5}{\showpaste}
\tab{5}\spadcommand{magma := FreeMagma(Symbol)\bound{magma }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch6}
\begin{paste}{LyndonWordXmpPageFull6}{LyndonWordXmpPageEmpty6}
\pastebutton{LyndonWordXmpPageFull6}{\hidepaste}
\tab{5}\spadcommand{word := FreeMonoid(Symbol)\bound{word }}
\indentrel{3}\begin{verbatim}
   (6)  FreeMonoid(Symbol)
                                             Type: Type
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty6}
\begin{paste}{LyndonWordXmpPageEmpty6}{LyndonWordXmpPagePatch6}
\pastebutton{LyndonWordXmpPageEmpty6}{\showpaste}
\tab{5}\spadcommand{word := FreeMonoid(Symbol)\bound{word }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch7}
\begin{paste}{LyndonWordXmpPageFull7}{LyndonWordXmpPageEmpty7}
\pastebutton{LyndonWordXmpPageFull7}{\hidepaste}
\tab{5}\spadcommand{LyndonWordsList1([a,b,c],3)$lword\free{lword }\free{a }\free{b }\free{c }}
\indentrel{3}\begin{verbatim}
   (7)
   [[[a], [b], [c]], [[a b], [a c], [b c]],

        2      2        2                         2
     [[a b], [a c], [a b ], [a b c], [a c b], [a c ],
        2        2
      [b c], [b c ]]
     ]
    Type: OneDimensionalArray(List(LyndonWord(Symbol)))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty7}
\begin{paste}{LyndonWordXmpPageEmpty7}{LyndonWordXmpPagePatch7}
\pastebutton{LyndonWordXmpPageEmpty7}{\showpaste}
\tab{5}\spadcommand{LyndonWordsList1([a,b,c],3)$lword\free{lword }\free{a }\free{b }\free{c }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch8}
\begin{paste}{LyndonWordXmpPageFull8}{LyndonWordXmpPageEmpty8}
\pastebutton{LyndonWordXmpPageFull8}{\hidepaste}
\tab{5}\spadcommand{LyndonWordsList([a,b,c],3)$lword\free{a }\free{b }\free{c }\free{lword }}
\indentrel{3}\begin{verbatim}
   (8)
                                          2      2
   [[a], [b], [c], [a b], [a c], [b c], [a b], [a c],
        2                         2     2        2
    [a b ], [a b c], [a c b], [a c ], [b c], [b c ]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty8}
\begin{paste}{LyndonWordXmpPageEmpty8}{LyndonWordXmpPagePatch8}
\pastebutton{LyndonWordXmpPageEmpty8}{\showpaste}
\tab{5}\spadcommand{LyndonWordsList([a,b,c],3)$lword\free{a }\free{b }\free{c }\free{lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch9}
\begin{paste}{LyndonWordXmpPageFull9}{LyndonWordXmpPageEmpty9}
\pastebutton{LyndonWordXmpPageFull9}{\hidepaste}
\tab{5}\spadcommand{lw := LyndonWordsList([a,b],5)$lword\free{a }\free{b }\free{lword }\bound{lw }}
\indentrel{3}\begin{verbatim}
   (9)
                       2        2     3      2 2
   [[a], [b], [a b], [a b], [a b ], [a b], [a b ],
        3     4      3 2     2          2 3           2
    [a b ], [a b], [a b ], [a b a b], [a b ], [a b a b ],
        4
    [a b ]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty9}
\begin{paste}{LyndonWordXmpPageEmpty9}{LyndonWordXmpPagePatch9}
\pastebutton{LyndonWordXmpPageEmpty9}{\showpaste}
\tab{5}\spadcommand{lw := LyndonWordsList([a,b],5)$lword\free{a }\free{b }\free{lword }\bound{lw }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch10}
\begin{paste}{LyndonWordXmpPageFull10}{LyndonWordXmpPageEmpty10}
\pastebutton{LyndonWordXmpPageFull10}{\hidepaste}
\tab{5}\spadcommand{w1 : word := lw.4 :: word\free{word }\free{lw }\bound{w1 }}
\indentrel{3}\begin{verbatim}
          2
   (10)  a b
                               Type: FreeMonoid(Symbol)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty10}
\begin{paste}{LyndonWordXmpPageEmpty10}{LyndonWordXmpPagePatch10}
\pastebutton{LyndonWordXmpPageEmpty10}{\showpaste}
\tab{5}\spadcommand{w1 : word := lw.4 :: word\free{word }\free{lw }\bound{w1 }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch11}
\begin{paste}{LyndonWordXmpPageFull11}{LyndonWordXmpPageEmpty11}
\pastebutton{LyndonWordXmpPageFull11}{\hidepaste}
\tab{5}\spadcommand{w2 : word := lw.5 :: word\free{word }\free{lw }\bound{w2 }}
\indentrel{3}\begin{verbatim}
            2
   (11)  a b
                               Type: FreeMonoid(Symbol)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty11}
\begin{paste}{LyndonWordXmpPageEmpty11}{LyndonWordXmpPagePatch11}
\pastebutton{LyndonWordXmpPageEmpty11}{\showpaste}
\tab{5}\spadcommand{w2 : word := lw.5 :: word\free{word }\free{lw }\bound{w2 }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch12}
\begin{paste}{LyndonWordXmpPageFull12}{LyndonWordXmpPageEmpty12}
\pastebutton{LyndonWordXmpPageFull12}{\hidepaste}
\tab{5}\spadcommand{factor(a::word)$lword\free{a word lword }}
\indentrel{3}\begin{verbatim}
   (12)  [[a]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty12}
\begin{paste}{LyndonWordXmpPageEmpty12}{LyndonWordXmpPagePatch12}
\pastebutton{LyndonWordXmpPageEmpty12}{\showpaste}
\tab{5}\spadcommand{factor(a::word)$lword\free{a word lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch13}
\begin{paste}{LyndonWordXmpPageFull13}{LyndonWordXmpPageEmpty13}
\pastebutton{LyndonWordXmpPageFull13}{\hidepaste}
\tab{5}\spadcommand{factor(w1*w2)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
            2     2
   (13)  [[a b a b ]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty13}
\begin{paste}{LyndonWordXmpPageEmpty13}{LyndonWordXmpPagePatch13}
\pastebutton{LyndonWordXmpPageEmpty13}{\showpaste}
\tab{5}\spadcommand{factor(w1*w2)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch14}
\begin{paste}{LyndonWordXmpPageFull14}{LyndonWordXmpPageEmpty14}
\pastebutton{LyndonWordXmpPageFull14}{\hidepaste}
\tab{5}\spadcommand{factor(w2*w2)$lword\free{w2 lword }}
\indentrel{3}\begin{verbatim}
              2       2
   (14)  [[a b ], [a b ]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty14}
\begin{paste}{LyndonWordXmpPageEmpty14}{LyndonWordXmpPagePatch14}
\pastebutton{LyndonWordXmpPageEmpty14}{\showpaste}
\tab{5}\spadcommand{factor(w2*w2)$lword\free{w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch15}
\begin{paste}{LyndonWordXmpPageFull15}{LyndonWordXmpPageEmpty15}
\pastebutton{LyndonWordXmpPageFull15}{\hidepaste}
\tab{5}\spadcommand{factor(w2*w1)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
              2     2
   (15)  [[a b ], [a b]]
                         Type: List(LyndonWord(Symbol))
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty15}
\begin{paste}{LyndonWordXmpPageEmpty15}{LyndonWordXmpPagePatch15}
\pastebutton{LyndonWordXmpPageEmpty15}{\showpaste}
\tab{5}\spadcommand{factor(w2*w1)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch16}
\begin{paste}{LyndonWordXmpPageFull16}{LyndonWordXmpPageEmpty16}
\pastebutton{LyndonWordXmpPageFull16}{\hidepaste}
\tab{5}\spadcommand{lyndon?(w1)$lword\free{w1 lword }}
\indentrel{3}\begin{verbatim}
   (16)  true
                                          Type: Boolean
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty16}
\begin{paste}{LyndonWordXmpPageEmpty16}{LyndonWordXmpPagePatch16}
\pastebutton{LyndonWordXmpPageEmpty16}{\showpaste}
\tab{5}\spadcommand{lyndon?(w1)$lword\free{w1 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch17}
\begin{paste}{LyndonWordXmpPageFull17}{LyndonWordXmpPageEmpty17}
\pastebutton{LyndonWordXmpPageFull17}{\hidepaste}
\tab{5}\spadcommand{lyndon?(w1*w2)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
   (17)  true
                                          Type: Boolean
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty17}
\begin{paste}{LyndonWordXmpPageEmpty17}{LyndonWordXmpPagePatch17}
\pastebutton{LyndonWordXmpPageEmpty17}{\showpaste}
\tab{5}\spadcommand{lyndon?(w1*w2)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch18}
\begin{paste}{LyndonWordXmpPageFull18}{LyndonWordXmpPageEmpty18}
\pastebutton{LyndonWordXmpPageFull18}{\hidepaste}
\tab{5}\spadcommand{lyndon?(w2*w1)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
   (18)  false
                                          Type: Boolean
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty18}
\begin{paste}{LyndonWordXmpPageEmpty18}{LyndonWordXmpPagePatch18}
\pastebutton{LyndonWordXmpPageEmpty18}{\showpaste}
\tab{5}\spadcommand{lyndon?(w2*w1)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch19}
\begin{paste}{LyndonWordXmpPageFull19}{LyndonWordXmpPageEmpty19}
\pastebutton{LyndonWordXmpPageFull19}{\hidepaste}
\tab{5}\spadcommand{lyndonIfCan(w1)$lword\free{w1 lword }}
\indentrel{3}\begin{verbatim}
           2
   (19)  [a b]
                    Type: Union(LyndonWord(Symbol),...)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty19}
\begin{paste}{LyndonWordXmpPageEmpty19}{LyndonWordXmpPagePatch19}
\pastebutton{LyndonWordXmpPageEmpty19}{\showpaste}
\tab{5}\spadcommand{lyndonIfCan(w1)$lword\free{w1 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch20}
\begin{paste}{LyndonWordXmpPageFull20}{LyndonWordXmpPageEmpty20}
\pastebutton{LyndonWordXmpPageFull20}{\hidepaste}
\tab{5}\spadcommand{lyndonIfCan(w2*w1)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
   (20)  "failed"
                              Type: Union("failed",...)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty20}
\begin{paste}{LyndonWordXmpPageEmpty20}{LyndonWordXmpPagePatch20}
\pastebutton{LyndonWordXmpPageEmpty20}{\showpaste}
\tab{5}\spadcommand{lyndonIfCan(w2*w1)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch21}
\begin{paste}{LyndonWordXmpPageFull21}{LyndonWordXmpPageEmpty21}
\pastebutton{LyndonWordXmpPageFull21}{\hidepaste}
\tab{5}\spadcommand{lyndon(w1)$lword\free{w1 lword }}
\indentrel{3}\begin{verbatim}
           2
   (21)  [a b]
                               Type: LyndonWord(Symbol)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty21}
\begin{paste}{LyndonWordXmpPageEmpty21}{LyndonWordXmpPagePatch21}
\pastebutton{LyndonWordXmpPageEmpty21}{\showpaste}
\tab{5}\spadcommand{lyndon(w1)$lword\free{w1 lword }}
\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPagePatch22}
\begin{paste}{LyndonWordXmpPageFull22}{LyndonWordXmpPageEmpty22}
\pastebutton{LyndonWordXmpPageFull22}{\hidepaste}
\tab{5}\spadcommand{lyndon(w1*w2)$lword\free{w1 w2 lword }}
\indentrel{3}\begin{verbatim}
           2     2
   (22)  [a b a b ]
                               Type: LyndonWord(Symbol)
\end{verbatim}
\indentrel{-3}\end{paste}\end{patch}

\begin{patch}{LyndonWordXmpPageEmpty22}
\begin{paste}{LyndonWordXmpPageEmpty22}{LyndonWordXmpPagePatch22}
\pastebutton{LyndonWordXmpPageEmpty22}{\showpaste}
\tab{5}\spadcommand{lyndon(w1*w2)$lword\free{w1 w2 lword }}
\end{paste}\end{patch}

