1<!-- ------------------------------------------------------------------- -->
2<!--                                                                     -->
3<!--  intro.xml            KBMag documentation               Derek Holt  -->
4<!--                                                                     -->
5<!--  Copyright (C) 1997, Derek Holt                                     -->
6<!--                                                                     -->
7<!-- ------------------------------------------------------------------- -->
8
9<Chapter Label="chap-intro">
10
11<Heading>Introduction</Heading>
12
13<Index Key="kbmag"> <Package>kbmag</Package> </Index>
14
15&KBMAG;  (pronounced ``Kay-bee-mag'') stands  for
16<E>Knuth--Bendix on Monoids, and Automatic Groups</E>.
17It  is a stand-alone package  written in `C', for use under UNIX,
18with an interface to &GAP;.
19Chapters <Ref Chap="chap-rws"/> and <Ref Chap="chap-cosets"/>
20describe its use as  an external library from within &GAP;.
21There are interfaces for the use of &KBMAG; with finitely
22presented groups, monoids and semigroups defined within &GAP;.
23The package also contains a collection of routines for manipulating
24finite state automata, which can be accessed via the &GAP; interface.
25Chapter <Ref Chap="chap-standalone"/>
26lists the functions in the stand-alone package.
27<P/>
28To use  this  package effectively, some  knowledge  of the underlying
29theory  and algorithms  is  advisable.
30The  Knuth-Bendix algorithm is described in various places in the literature.
31Good general references that deal with the applications to groups and monoids
32are <Cite Key="LeC86"/> and  the  first few  chapters of <Cite Key="Sims94"/>.
33For the  theory of automatic   groups  see  the   multi-author book
34<Cite Key="ECHLPT92"/>.
35The algorithms employed by &KBMAG; are described more  specifically  in
36<Cite Key="EHR91"/> and <Cite Key="Holt94"/>.
37<P/>
38The manual for the stand-alone &KBMAG; package (which can be found in the
39<File>standalone/doc</File> directory of the package) provides more detailed
40information on the external `C' programs that  are called  from &GAP;.
41<P/>
42Suppose that <M>G</M> is a finitely presented semigroup, monoid or group
43defined as a quotient of the free structure <M>F</M>.
44The overall  objective of &KBMAG; is  to construct a  normal form for
45the elements of  <M>G</M> in terms of the generators of <M>F</M>,
46together with  a word reduction algorithm for  calculating
47the normal form representative  of an element in  <M>G</M>, given by a word
48in the generators of <M>F</M>.
49If this can be achieved,  then it is also possible
50to enumerate the words  in normal form up to   a given length,  and to
51determine the order  of <M>G</M>, by counting  the number of words in
52normal  form. In most  serious  applications,  this will be  infinite,
53since (for example) finite groups are (with some  exceptions) usually
54handled better by Todd-Coxeter related methods.
55In fact a  finite state automaton <M>W</M>
56is  calculated  that accepts precisely the   language of words  in the
57monoid  generators of <M>F</M> that are in normal form,  and <M>W</M>  is used for the
58enumeration  and counting  functions.
59<P/>
60The  normal form of an element  <M>g \in G</M> is defined  to be the least
61word in the generators of <M>F</M> (and their inverses) that represents
62<M>g</M>, with respect to  a specified ordering on the  set of all
63words in the generators of <M>F</M>.
64The available  orderings are described in section <Ref Sect="sec-set-order"/>.
65<P/>
66&KBMAG; offers two possible means of achieving these objectives.
67The first is to apply the Knuth-Bendix algorithm to the
68presentation, with one of the  available orderings on words, and  hope
69that the algorithm will complete with a finite confluent presentation.
70(If <M>G</M> is finite, then it is  guaranteed to complete eventually
71but,  like the  Todd-Coxeter procedure, it  may  take a long  time, or
72require more space  than  is  available.)
73The second  is  to  use the automatic group program,
74which is only applicable to groups (not to monoids or semigroups).
75This  also uses the Knuth-Bendix procedure as
76one component of the algorithm, but  it aims to compute certain finite
77state  automata rather  than to obtain   a  finite confluent rewriting
78system, and it completes successfully on many  examples for which such
79a finite system does not exist.
80In the current stand-alone implementation, its use is  restricted to the
81&shortlex; ordering  on words.  That is,
82words are
83ordered first by increasing length, and then words of equal length are
84ordered lexicographically,   using the    specified ordering  of   the
85generators. However, there are now some &GAP; procedures available
86in the package written by Sarah Rees that enable it be used also for the
87&wtlex; ordering, and the &wreathprod; ordering.
88See section <Ref Sect="sec-set-order"/> for further details of these orderings.
89<P/>
90For both of the above procedures, the first step is to create a &GAP;
91object   known as  a  <E>Knuth-Bendix rewriting  system</E>  <M>R</M>
92from the finitely presented structure <M>G</M>.
93There are functions available that can be used to
94specify  the input parameters  for the external  programs, such as the
95ordering on words to be used by the Knuth-Bendix procedure. One of the
96two  external programs is then run  on  <M>R</M>. If successful, it updates
97<M>R</M>, which  can then be  used to reduce words in
98the generators of <M>F</M> to normal form, and  to count and  enumerate the
99words in normal form.
100<P/>
101There are also now some routines available for performing
102corresponding operations with the cosets of a specified subgroup
103<M>H</M> of the group <M>G</M>. (These are not currently available for semigroups or
104monoids.) The words in normal form then correspond to minimal
105representatives under the ordering of the system of the right
106cosets of <M>H</M> in <M>G</M>.
107If successful, the index of <M>H</M> in <M>G</M> can be determined.
108The Knuth-Bendix routines also allow a confluent
109rewriting system for <M>H</M> to be computed, whereas the automatic groups
110routines allow a presentation of <M>H</M> to be computed (although not yet on
111a user-specified generating set).
112<P/>
113In the descriptions of the  functions that follow,  it is important to
114distinguish between  irreducible words, and  words in normal form.  As
115already stated, a word is in normal form if it is the least word under
116the ordering of the  rewriting system that  defines a particular group
117element or coset.  So  there is always  a unique word in  normal form
118for each group element or coset,  and it is  determined by the  group
119generators and the
120ordering on words  in  the group   generators. A word  in a  rewriting
121system is said to be <E>irreducible</E> if it  does not contain the left hand
122side of any of the reduction  rules in the  system as a subword. Words
123in normal form are always irreducible, but the converse is true if and
124only   if  the rewriting system  is   confluent.  The automatic groups
125programs provide a  method of  reducing  words to normal  form without
126obtaining a  finite  confluent rewriting  system  (which may  not even
127exist).
128<P/>
129Various levels of diagnostic  output  from the &GAP;  procedures   can
130be turned on  by
131setting the Info variable  <C>InfoRWS</C>  to <M>1, 2</M> or <M>3</M>.
132<P/>
133In the descriptions that follow functions declared in the main &GAP;
134library, for which additional methods are implemented, are referred to
135as <E>library functions</E>.
136<P/>
137</Chapter>
138