blob: 1876426ea8a38e50a880eb7375358e2577ab05b5 (
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
110
111
112
113
|
% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\MagmaXmpTitle}{Magma}
\newcommand{\MagmaXmpNumber}{9.49}
%
% =====================================================================
\begin{page}{MagmaXmpPage}{9.49 Magma}
% =====================================================================
\beginscroll
Initialisations
\xtc{
}{
\spadpaste{x:Symbol :='x \bound{x}}
}
\xtc{
}{
\spadpaste{y:Symbol :='y \bound{y}}
}
\xtc{
}{
\spadpaste{z:Symbol :='z \bound{z}}
}
\xtc{
}{
\spadpaste{word := OrderedFreeMonoid(Symbol) \bound{word}}
}
\xtc{
}{
\spadpaste{tree := Magma(Symbol) \bound{tree}}
}
Let's make some trees
\xtc{
}{
\spadpaste{a:tree := x*x \free{x tree} \bound{a}}
}
\xtc{
}{
\spadpaste{b:tree := y*y \free{y tree} \bound{b}}
}
\xtc{
}{
\spadpaste{c:tree := a*b \free{a b tree} \bound{c}}
}
Query the trees
\xtc{
}{
\spadpaste{left c \free{c}}
}
\xtc{
}{
\spadpaste{right c \free{c}}
}
\xtc{
}{
\spadpaste{length c \free{c}}
}
\xtc{
Coerce to the monoid
}{
\spadpaste{c::word \free{c word}}
}
Check ordering
\xtc{
}{
\spadpaste{a < b \free{a b}}
}
\xtc{
}{
\spadpaste{a < c \free{a c}}
}
\xtc{
}{
\spadpaste{b < c \free{b c}}
}
Navigate the tree
\xtc{
}{
\spadpaste{first c \free{c}}
}
\xtc{
}{
\spadpaste{rest c \free{c}}
}
\xtc{
}{
\spadpaste{rest rest c \free{c}}
}
Check ordering
\xtc{
}{
\spadpaste{ax:tree := a*x \free{a x tree} \bound{ax}}
}
\xtc{
}{
\spadpaste{xa:tree := x*a \free{a x tree} \bound{xa}}
}
\xtc{
}{
\spadpaste{xa < ax \free{ax xa}}
}
\xtc{
}{
\spadpaste{lexico(xa,ax) \free{ax xa}}
}
\endscroll
\autobuttons
\end{page}
%
|