aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/LWORD.ht
blob: 5d065a5779673120684d1880ba8898953180c386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\LyndonWordXmpTitle}{LyndonWord}
\newcommand{\LyndonWordXmpNumber}{9.48}
%
% =====================================================================
\begin{page}{LyndonWordXmpPage}{9.48 LyndonWord}
% =====================================================================
\beginscroll
Initialisations
\xtc{
}{
\spadpaste{a:Symbol :='a \bound{a}}
}
\xtc{
}{
\spadpaste{b:Symbol :='b \bound{b}}
}
\xtc{
}{
\spadpaste{c:Symbol :='c \bound{c}}
}
\xtc{
}{
\spadpaste{lword:= LyndonWord(Symbol) \bound{lword}}
}
\xtc{
}{
\spadpaste{magma := Magma(Symbol) \bound{magma}}
}
\xtc{
}{
\spadpaste{word   := OrderedFreeMonoid(Symbol) \bound{word}}
}
\xtc{
All Lyndon words of with a, b, c to order 3
}{
\spadpaste{LyndonWordsList1([a,b,c],3)$lword \free{lword} \free{a} \free{b} \free{c} }
}
\xtc{
All Lyndon words of with a, b, c to order 3 in flat list
}{
\spadpaste{LyndonWordsList([a,b,c],3)$lword \free{a} \free{b} \free{c} \free{lword}}
}
\xtc{
All Lyndon words of with a, b to order 5
}{
\spadpaste{lw := LyndonWordsList([a,b],5)$lword \free{a} \free{b} \free{lword} \bound{lw}}
}
\xtc{
}{
\spadpaste{w1 : word := lw.4 :: word \free{word} \free{lw} \bound{w1}}
}
\xtc{
}{
\spadpaste{w2 : word := lw.5 :: word \free{word} \free{lw} \bound{w2}}
}

Let's try factoring
\xtc{
}{
\spadpaste{factor(a::word)$lword \free{a word lword}}
}
\xtc{
}{
\spadpaste{factor(w1*w2)$lword \free{ w1 w2 lword}}
}
\xtc{
}{
\spadpaste{factor(w2*w2)$lword \free{w2 lword}}
}
\xtc{
}{
\spadpaste{factor(w2*w1)$lword \free{w1 w2 lword}}
}

Checks and coercions
\xtc{
}{
\spadpaste{lyndon?(w1)$lword \free{w1 lword}}
}
\xtc{
}{
\spadpaste{lyndon?(w1*w2)$lword \free{w1 w2 lword}}
}
\xtc{
}{
\spadpaste{lyndon?(w2*w1)$lword \free{w1 w2 lword}}
}
\xtc{
}{
\spadpaste{lyndonIfCan(w1)$lword \free{w1 lword}}
}
\xtc{
}{
\spadpaste{lyndonIfCan(w2*w1)$lword \free{w1 w2 lword}}
}
\xtc{
}{
\spadpaste{lyndon(w1)$lword \free{w1 lword}}
}
\xtc{
}{
\spadpaste{lyndon(w1*w2)$lword \free{w1 w2 lword}}
}
\endscroll
\autobuttons
\end{page}
%