Quellverzeichnis chap2.html
Sprache: HTML
|
|
| products/Sources/formale Sprachen/GAP/pkg/kbmag/doc/chap2.html |
 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (kbmag) - Chapter 2: The Knuth-Bendix program on semigroups, monoids and groups</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap2" onload="jscontent()">
<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap1.html">[Previous Chapter]</a> <a href="chap3.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap2_mj.html">[MathJax on]</a></p>
<p><a id="X86F080117DE22242" name="X86F080117DE22242"></a></p>
<div class="ChapSects"><a href="chap2.html#X86F080117DE22242">2 <span class="Heading">The Knuth-Bendix program on semigroups, monoids and groups</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7F474DEE787325CD">2.1 <span class="Heading">Creating a rewriting system</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8722C57284F51940">2.1-1 KBMAGRewritingSystem</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X85BFCE4B79A782D0">2.2 <span class="Heading">Elementary functions on rewriting systems</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X879AEB2885DB4988">2.2-1 IsKBMAGRewritingSystemRep</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8006790B86328CE8">2.2-2 IsConfluent</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X832A66088276451E">2.2-3 SemigroupOfRewritingSytem</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8643F8C480036EC6">2.2-4 ExternalWordToInternalWordOfRewritingSystem</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7CF67C5E7F31F19A">2.2-5 Alphabet</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X833EAA8C86356F42">2.2-6 Rules</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7AB017987DAE15E7">2.2-7 ResetRewritingSystem</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7BDD01C183CD3234">2.3 <span class="Heading">Setting the ordering</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7E89CFE87973DD14">2.3-1 SetOrderingOfKBMAGRewritingSystem</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7BB411528630D4E9">2.4 <span class="Heading">Control parameters</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X80C0185D8035B7F8">2.4-1 InfoRWS</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7C1BF15280B3CE5B">2.4-2 OptionsRecordOfKBMAGRewritingSystem</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X830D97B5805251E0">2.5 <span class="Heading">The Knuth-Bendix program</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8412C40B7B2DC8E0">2.5-1 KnuthBendix</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7ED0190D7BDA74D7">2.5-2 ReductionAutomaton</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X8786DA3679BA75C8">2.6 <span class="Heading">The automatic groups program</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X828FA0177E4C5733">2.6-1 AutomaticStructure</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X82CAA53A7926DA74">2.6-2 WordAcceptor</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X807029A8841FCAF3">2.7 <span class="Heading">Word reduction</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X84A3462B826AD47C">2.7-1 IsReducedWord</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7A5773A77C6BAC3F">2.7-2 ReducedWord</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7B8F6EBC87AF42C6">2.8 <span class="Heading">Counting and enumerating irreducible words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X858ADA3B7A684421">2.8-1 Size</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X84F59A2687C62763">2.8-2 Order</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7CD646CD7AA2B718">2.8-3 EnumerateReducedWords</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7981EA28835C7A46">2.8-4 GrowthFunction</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap2.html#X7E98CC0078047A36">2.9 <span class="Heading">Rewriting System Examples</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X8388E29680F31ABD">2.9-1 <span class="Heading">Example 1</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7A18778D836BC971">2.9-2 <span class="Heading">Example 2</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X7D680484821C7835">2.9-3 <span class="Heading">Example 3</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X848E4DDE845A6EE9">2.9-4 <span class="Heading">Example 4</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap2.html#X83FE3ED7852DDFAD">2.9-5 <span class="Heading">Example 5</span></a>
</span>
</div></div>
</div>
<h3>2 <span class="Heading">The Knuth-Bendix program on semigroups, monoids and groups</span></h3>
<p><a id="X7F474DEE787325CD" name="X7F474DEE787325CD"></a></p>
<h4>2.1 <span class="Heading">Creating a rewriting system</span></h4>
<p>First the user should be aware of a technicality. The words in a rewriting system created in <strong class="pkg">GAP</strong> for use by <strong class="pkg">KBMag</strong> are defined over an alphabet that consists of the generators of a free monoid, called the <em>word-monoid</em> of the system. Suppose, as before, that the rewriting system is defined from the semigroup, monoid or group <span class="SimpleMath">G</span> which is a quotient of the free structure <span class="SimpleMath">F</span>. Then the generators of this alphabet will be in one-one correspondence with the generators (or, when <span class="SimpleMath">G</span> is a group, the generators and their inverses) of <span class="SimpleMath">F</span>, but will not be identical to them. This feature was necessary for technical reasons. Most of the user-level functions take and return words in <span class="SimpleMath">F</span> rather than the alphabet, but they do this by converting from one to the other and back.</p>
<p>User-level functions have also been provided to carry out this conversion explicitly if required.</p>
<p>The user should also be aware of a peculiarity in the way that rewriting systems are displayed, which is really a hangover from the <strong class="pkg">GAP</strong>3 interface. They are displayed nicely as a record, which gives a useful description of the system, but it does not correspond at all to the way that they are actually stored internally!</p>
<p><a id="X8722C57284F51940" name="X8722C57284F51940"></a></p>
<h5>2.1-1 KBMAGRewritingSystem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ KBMAGRewritingSystem</code>( <var class="Arg">G</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>This operation constructs and returns a rewriting system <span class="SimpleMath">R</span> from a finitely presented semigroup, monoid or group <span class="SimpleMath">G</span>. When <span class="SimpleMath">G</span> is a group, the alphabet members of <span class="SimpleMath">R</span> correspond to the generators of <span class="SimpleMath">F</span> together with inverses for those generators which are not obviously involutory in <span class="SimpleMath">G</span>.</p>
<p><a id="X85BFCE4B79A782D0" name="X85BFCE4B79A782D0"></a></p>
<h4>2.2 <span class="Heading">Elementary functions on rewriting systems</span></h4>
<p><a id="X879AEB2885DB4988" name="X879AEB2885DB4988"></a></p>
<h5>2.2-1 IsKBMAGRewritingSystemRep</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsKBMAGRewritingSystemRep</code>( <var class="Arg">rws</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p><code class="code">IsKBMAGRewritingSystemRep</code> returns <code class="code">true</code> if <span class="SimpleMath">rws</span> is a rewriting system created by <code class="func">KBMAGRewritingSystem</code> (<a href="chap2.html#X8722C57284F51940"><span class="RefLink">2.1-1</span></a>). The function <code class="func">IsRewritingSystem</code> (<a href="../../../doc/ref/chap38_mj.html#X842C0ED87986F7AA"><span class="RefLink">Reference: IsRewritingSystem</span></a>) will also return <code class="code">true</code> on such a system. (The function <code class="code">IsKnuthBendixRewritingSystem</code> has been considered for inclusion, but is not currently declared.)</p>
<p><a id="X8006790B86328CE8" name="X8006790B86328CE8"></a></p>
<h5>2.2-2 IsConfluent</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsConfluent</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>This library property returns <code class="code">true</code> if <span class="SimpleMath">rws</span> is a rewriting system that is known to be confluent.</p>
<p><a id="X832A66088276451E" name="X832A66088276451E"></a></p>
<h5>2.2-3 SemigroupOfRewritingSytem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SemigroupOfRewritingSytem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ FreeStructureOfSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ WordMonoidOfRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>The first two library functions return, respectively, the semigroup, monoid or group <span class="SimpleMath">G</span>, and the free structure <span class="SimpleMath">F</span>. The third returns the word-monoid of the rewriting system, as defined in section <a href="chap2.html#X7F474DEE787325CD"><span class="RefLink">2.1</span></a>.</p>
<p><a id="X8643F8C480036EC6" name="X8643F8C480036EC6"></a></p>
<h5>2.2-4 ExternalWordToInternalWordOfRewritingSystem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ExternalWordToInternalWordOfRewritingSystem</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ InternalWordToExternalWordOfRewritingSystem</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>These are the functions for converting between <em>external words</em>, which are those defined over the free structure <span class="SimpleMath">F</span> of <span class="SimpleMath">rws</span>, and the <em>internal words</em>, which are defined over the word-monoid of <span class="SimpleMath">rws</span>.</p>
<p><a id="X7CF67C5E7F31F19A" name="X7CF67C5E7F31F19A"></a></p>
<h5>2.2-5 Alphabet</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Alphabet</code>( <var class="Arg">rws</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>This is an ordered list of the generators of the word-monoid of <span class="SimpleMath">rws</span>. It will not necessarily be in the normal order of these generators, and it can be re-ordered by the function <code class="func">ReorderAlphabetOfKBMAGRewritingSystem</code> (<a href="chap2.html#X7E89CFE87973DD14"><span class="RefLink">2.3-1</span></a>).</p>
<p><a id="X833EAA8C86356F42" name="X833EAA8C86356F42"></a></p>
<h5>2.2-6 Rules</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Rules</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>This library function returns a list of the <em>reduction rules</em> of <span class="SimpleMath">rws</span>. Each rule is a two-element list containing the left and right hand sides of the rule, which are words in the alphabet of <span class="SimpleMath">rws</span>.</p>
<p><a id="X7AB017987DAE15E7" name="X7AB017987DAE15E7"></a></p>
<h5>2.2-7 ResetRewritingSystem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ResetRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function resets the rewriting system <span class="SimpleMath">rws</span> back to its form as it was before the application of <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) or <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>). However, the current ordering and values of control parameters will not be changed. The normal form and reduction algorithms will be unavailable after this call.</p>
<p><a id="X7BDD01C183CD3234" name="X7BDD01C183CD3234"></a></p>
<h4>2.3 <span class="Heading">Setting the ordering</span></h4>
<p><a id="X7E89CFE87973DD14" name="X7E89CFE87973DD14"></a></p>
<h5>2.3-1 SetOrderingOfKBMAGRewritingSystem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SetOrderingOfKBMAGRewritingSystem</code>( <var class="Arg">rws</var>, <var class="Arg">ordering</var>[, <var class="Arg">list</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ReorderAlphabetOfKBMAGRewritingSystem</code>( <var class="Arg">rws</var>, <var class="Arg">p</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ OrderingOfKBMAGRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ OrderingOfRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p><code class="code">SetOrderingOfKBMAGRewritingSystem</code> changes the ordering on the words of the rewriting system <span class="SimpleMath">rws</span> to <strong class="button">ordering</strong>. <span class="SimpleMath">rws</span> is reset when the ordering is changed, so any previously calculated results will be destroyed. <strong class="button">ordering</strong> must be one of the strings <strong class="button">shortlex</strong>, <strong class="button">recursive</strong>, <strong class="button">wtlex</strong> and <strong class="button">wreathprod</strong>. The default is <strong class="button">shortlex</strong>, and this is the ordering of rewriting systems returned by <code class="func">KBMAGRewritingSystem</code> (<a href="chap2.html#X8722C57284F51940"><span class="RefLink">2.1-1</span></a>). The orderings <strong class="button">wtlex</strong> and <strong class="button">wreathprod</strong> require the third parameter, <code class="code">list</code>, which must be a list of positive integers in one-one correspondence with the alphabet of <span class="SimpleMath">rws</span> in its current order. They have the effect of attaching weights or levels to the alphabet members, in the cases <strong class="button">wtlex</strong> and <strong class="button">wreathprod</strong>, respectively.</p>
<p>Each of these orderings depends on the order of the alphabet. The current ordering of generators is displayed under the <code class="code">generatorOrder</code> field when <span class="SimpleMath">rws</span> is viewed. This ordering can be changed by the function <code class="func">ReorderAlphabetOfKBMAGRewritingSystem</code> . The second parameter <span class="SimpleMath">p</span> to this function should be a permutation that moves at most <span class="SimpleMath">ng</span> points, where <span class="SimpleMath">ng</span> is the number of generators. This permutation is applied to the current list of generators.</p>
<p><code class="func">OrderingOfKBMAGRewritingSystem</code> merely prints out a description of the current ordering.</p>
<p>In the <strong class="button">shortlex</strong> ordering, shorter words come before longer ones, and, for words of equal length, the lexicographically smaller word comes first, using the ordering of the alphabet. The <strong class="button">wtlex</strong> ordering is similar, but instead of using the length of the word as the first criterion, the total weight of the word is used; this is defined as the sum of the weights of the generators in the word. So <strong class="button">shortlex</strong> is the special case of <strong class="button">wtlex</strong> in which all generators have the same nonzero weight.</p>
<p>The <strong class="button">recursive</strong> ordering is the special case of <strong class="button">wreathprod</strong> in which the levels of the <span class="SimpleMath">ng</span> generators are <span class="SimpleMath">1,2,...,ng</span>, in the order of the alphabet. We shall not attempt to give a complete definition of these orderings here, but refer the reader instead to pages 46--50 of <a href="chapBib.html#biBSims94">[Sim94]</a>. The <strong class="button">recursive</strong> ordering is the one appropriate for a power-conjugate presentation of a polycyclic group, but where the generators are ordered in the reverse order from the usual convention for polycyclic groups. The confluent presentation will then be the same as the power-conjugate presentation. For example, for the Heisenberg group <span class="SimpleMath">⟨ x,y,z ~|~ [x,z]=[y,z]=1, [y,x]=z ⟩</span>, a good ordering is <strong class="button">recursive</strong> with the order of generators <span class="SimpleMath">[z^-1,z,y^-1,y,x^-1,x]</span>. This example is included as Example 3 in <a href="chap2.html#X7D680484821C7835"><span class="RefLink">2.9-3</span></a> below.</p>
<p>Finally, a method is included for the attribute <code class="func">OrderingOfRewritingSystem</code> which returns the appropriate <strong class="pkg">GAP</strong> ordering on the elements of the word-monoid of <span class="SimpleMath">rws</span>. The standard <strong class="pkg">GAP</strong> ordering functions, such as <code class="func">IsLessThanUnder</code> (<a href="../../../doc/ref/chap34_mj.html#X87F51D737C695D41"><span class="RefLink">Reference: IsLessThanUnder</span></a>) can then be used.</p>
<p><a id="X7BB411528630D4E9" name="X7BB411528630D4E9"></a></p>
<h4>2.4 <span class="Heading">Control parameters</span></h4>
<p><a id="X80C0185D8035B7F8" name="X80C0185D8035B7F8"></a></p>
<h5>2.4-1 InfoRWS</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ InfoRWS</code></td><td class="tdright">( info class )</td></tr></table></div>
<p>This `Info' variable can be set to 0,1,2 or 3 to control the level of diagnostic output.
<p>The Knuth-Bendix procedure is unusually sensitive to the settings of a number of parameters that control its operation. In some examples, a small change in one of these parameters can mean the difference between obtaining a confluent rewriting system fairly quickly on the one hand, and the procedure running on until it uses all available memory on the other hand.</p>
<p>Unfortunately, it is almost impossible to give even very general guidelines on these settings, although the <strong class="button">wreathprod</strong> orderings appear to be more sensitive than the <strong class="button">shortlex</strong> and <strong class="button">wtlex</strong> orderings. The user can only acquire a feeling for the influence of these parameters by experimentation on a large number of examples.</p>
<p>The control parameters are defined by the user by setting values of certain fields of the <em>options record</em> of a rewriting system.</p>
<p><a id="X7C1BF15280B3CE5B" name="X7C1BF15280B3CE5B"></a></p>
<h5>2.4-2 OptionsRecordOfKBMAGRewritingSystem</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ OptionsRecordOfKBMAGRewritingSystem</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns the options record <code class="code">OR</code> of the rewriting system <span class="SimpleMath">rws</span>. The fields of <code class="code">OR</code> listed below can be set by the user. Be careful to spell them correctly, because otherwise they will have no effect!</p>
<ul>
<li><p><code class="code">OR.maxeqns</code><br /> A positive integer specifying the maximum number of rewriting rules allowed in <span class="SimpleMath">rws</span>. The default is <span class="SimpleMath">32767</span>. If this number is exceeded, then <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) or <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>) will abort.</p>
</li>
<li><p><code class="code">OR.tidyint</code><br /> A positive integer, <span class="SimpleMath">100</span> by default. During the Knuth-Bendix procedure, the search for overlaps is interrupted periodically to tidy up the existing system by removing and/or simplifying rewriting rules that have become redundant. This tidying is done after finding <code class="code">OR.tidyint</code> rules since the last tidying.</p>
</li>
<li><p><code class="code">OR.confnum</code><br /> A positive integer, <span class="SimpleMath">500</span> by default. If <code class="code">OR.confnum</code> overlaps are processed in the Knuth-Bendix procedure but no new rules are found, then a fast test for confluence is carried out. This saves a lot of time if the system really is confluent, but usually wastes time if it is not.</p>
</li>
<li><p><code class="code">OR.maxstoredlen</code><br /> This is a list of two positive integers, <code class="code">maxlhs</code> and <code class="code">maxrhs</code>; the default is that both are infinite. Only those rewriting rules for which the left hand side has length at most <code class="code">maxlhs</code> and the right hand side has length at most <code class="code">maxrhs</code> are stored; longer rules are discarded. In some examples it is essential to impose such limits in order to obtain a confluent rewriting system. Of course, if the Knuth-Bendix procedure halts with such limits imposed, then the resulting system need not be confluent. However, the confluence can then be tested be re-running <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) with the limits removed. (To remove the limits, unbind the field.)</p>
</li>
<li><p><code class="code">OR.maxoverlaplen</code><br /> This is a positive integer, which is infinite by default (when not set). Only those overlaps of total length <code class="code">OR.maxoverlaplen</code> are processed. Similar remarks apply to those for <code class="code">OR.maxstoredlen</code>.</p>
</li>
<li><p><code class="code">OR.sorteqns</code><br /> This should be <code class="code">true</code> or <code class="code">false</code>, and <code class="code">false</code> is the default. When it is <code class="code">true</code>, the rewriting rules are output in order of increasing length of left hand side. (The default is that they are output in the order that they were found.)</p>
</li>
<li><p><code class="code">OR.maxoplen</code><br /> This is an integer, which is infinite by default (when not set). When it is set, the rewriting rules are output in order of increasing length of left hand side (as if <code class="code">OR.sorteqns</code> were <code class="code">true</code>), and only those rules having left hand sides of length up to <code class="code">OR.maxoplen</code> are output at all. Again, similar remarks apply to those for <code class="code">OR.maxstoredlen</code>.</p>
</li>
<li><p><code class="code">OR.maxreducelen</code><br /> A positive integer, <span class="SimpleMath">32767</span> by default. This is the maximum length that a word is allowed to have during the reduction process. It is only likely to be exceeded when using the <strong class="button">wreathprod</strong> or <strong class="button">recursive</strong> ordering.</p>
</li>
<li><p><code class="code">OR.maxstates</code>, <code class="code">OR.maxwdiffs</code><br /> These are positive integers, controlling the maximum number of states of the word-reduction automaton used by <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>), and the maximum number of word-differences allowed when running <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>), respectively. These numbers are normally increased automatically when required, so it unusual to want to set these flags. They can be set when either it is desired to limit these parameters (and prevent them being increased automatically), or (as occasionally happens), the number of word-differences increases too rapidly for the program to cope - when this happens, the run is usually doomed to failure anyway.</p>
</li>
</ul>
<p><a id="X830D97B5805251E0" name="X830D97B5805251E0"></a></p>
<h4>2.5 <span class="Heading">The Knuth-Bendix program</span></h4>
<p><a id="X8412C40B7B2DC8E0" name="X8412C40B7B2DC8E0"></a></p>
<h5>2.5-1 KnuthBendix</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ KnuthBendix</code>( <var class="Arg">rws</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MakeConfluent</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>These two functions do the same thing, namely to run the external Knuth-Bendix program on the rewriting system <span class="SimpleMath">rws</span>. <code class="func">KnuthBendix</code> returns <code class="code">true</code> if it finds a confluent rewriting system and otherwise <code class="code">false</code>. In either case, if it halts normally, then it will update the list of the rewriting rules of <span class="SimpleMath">rws</span>, and also store a finite state automaton <code class="code">ReductionAutomaton(rws)</code> that can be used for word reduction, and the counting and enumeration of irreducible words.</p>
<p>All control parameters (as defined in the preceding section) should be set before calling <code class="func">KnuthBendix</code>. <code class="func">KnuthBendix</code> will halt either when it finds a finite confluent system of rewriting rules, or when one of the control parameters (such as <code class="code">OR.maxeqns</code>) requires it to stop. The program can also be made to halt and output manually at any time by hitting the interrupt key (normally `ctrl-C') once. (Hitting it twice has unpredictable consequences, since GAP may intercept the signal.)
<p>A method is installed to make the library operation <code class="code">MakeConfluent</code> run the <code class="code">KnuthBendix</code> operation.</p>
<p>If <code class="func">KnuthBendix</code> halts without finding a confluent system, but still manages to output the current system and update <span class="SimpleMath">rws</span>, then it is possible to use the resulting rewriting system to reduce words, and count and enumerate the irreducible words; it cannot be guaranteed that the irreducible words are all in normal form, however. It is also possible to re-run <code class="func">KnuthBendix</code> on the current system, usually after altering some of the control parameters. In fact, in some more difficult examples, this seems to be the only means of finding a finite confluent system.</p>
<p><a id="X7ED0190D7BDA74D7" name="X7ED0190D7BDA74D7"></a></p>
<h5>2.5-2 ReductionAutomaton</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ReductionAutomaton</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns the reduction automaton of <span class="SimpleMath">rws</span>. Only expert users will wish to see this explicitly. See the section on finite state automata below for general information on functions for manipulating automata.</p>
<p><a id="X8786DA3679BA75C8" name="X8786DA3679BA75C8"></a></p>
<h4>2.6 <span class="Heading">The automatic groups program</span></h4>
<p><a id="X828FA0177E4C5733" name="X828FA0177E4C5733"></a></p>
<h5>2.6-1 AutomaticStructure</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AutomaticStructure</code>( <var class="Arg">rws</var>[, <var class="Arg">large</var>, <var class="Arg">filestore</var>, <var class="Arg">diff1</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function runs the external automatic groups program on the rewriting system <span class="SimpleMath">rws</span>. It returns <code class="code">true</code> if successful and <code class="code">false</code> otherwise. If successful, it stores three finite state automata <code class="code">FirstWordDifferenceAutomaton(rws)</code>, <code class="code">SecondWordDifferenceAutomaton(rws)</code> and <code class="code">WordAcceptor(rws)</code>: see <code class="func">WordAcceptor</code> (<a href="chap2.html#X82CAA53A7926DA74"><span class="RefLink">2.6-2</span></a>) below. The first two of these are used for word-reduction, and the third for counting and enumeration of irreducible words (i.e. words in normal form).</p>
<p>The three optional parameters to <code class="func">AutomaticStructure</code> are all boolean, and <code class="code">false</code> by default. Setting <code class="code">large</code> to be <code class="code">true</code> results in some of the control parameters (such as <code class="code">maxeqns</code> and <code class="code">tidyint</code>) being set larger than they would be otherwise. This is necessary for examples that require a large amount of space. Setting <code class="code">filestore</code> to be <code class="code">true</code> results in more use being made of temporary files than would be otherwise. This makes the program run slower, but it may be necessary if you are short of core memory. Setting <code class="code">diff1</code> to be <code class="code">true</code> is a more technical option, which is explained more fully in the documentation for the stand-alone <strong class="pkg">KBMag</strong> package. It is not usually necessary or helpful, but it enables one or two examples to complete that would otherwise run out of space.</p>
<p>The <strong class="button">ordering</strong> field of <span class="SimpleMath">rws</span> will usually be set to <strong class="button">shortlex</strong> for <code class="func">AutomaticStructure</code> to be applicable. However, it is now possible to use some procedures written by Sarah Rees that work when the ordering is <strong class="button">wtlex</strong> or <strong class="button">wreathprod</strong>. In the latter case, each generator must have the same level as its inverse.</p>
<p>The only control parameters for <span class="SimpleMath">rws</span> that are likely to be relevant are <code class="code">maxeqns</code> and <code class="code">maxwdiffs</code>.</p>
<p><a id="X82CAA53A7926DA74" name="X82CAA53A7926DA74"></a></p>
<h5>2.6-2 WordAcceptor</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ WordAcceptor</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ FirstWordDifferenceAutomaton</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SecondWordDifferenceAutomaton</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneralMultiplier</code>( <var class="Arg">rws</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>These functions return, respectively, the word acceptor, the first and second word-difference automata, and the general multiplier automaton of <span class="SimpleMath">rws</span>. They can only be called after a successful call of <code class="code">AutomaticStructure(rws)</code>. All except the word acceptor are <span class="SimpleMath">2</span>-variable automata that read pairs of words in the alphabet of <span class="SimpleMath">rws</span>. Note that the general multiplier has its states labeled, where the different labels represent the accepting states for the different letters in the alphabet of <span class="SimpleMath">rws</span>.</p>
<p><a id="X807029A8841FCAF3" name="X807029A8841FCAF3"></a></p>
<h4>2.7 <span class="Heading">Word reduction</span></h4>
<p><a id="X84A3462B826AD47C" name="X84A3462B826AD47C"></a></p>
<h5>2.7-1 IsReducedWord</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsReducedWord</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsReducedForm</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>These two functions do the same thing, namely to test whether the word <span class="SimpleMath">w</span> in the generators of the freestructure <code class="code">FreeStructure(rws)</code> of the rewriting system system <span class="SimpleMath">rws</span> is reduced or not, and return <code class="code">true</code> or <code class="code">false</code>.</p>
<p><code class="func">IsReducedWord</code> can only be used after <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) or <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>) has been run successfully on <span class="SimpleMath">rws</span>. In the former case, if <code class="code">KnuthBendix</code> halted without a confluent set of rules, then irreducible words are not necessarily in normal form (but reducible words are definitely not in normal form). If <code class="code">KnuthBendix</code> completes with a confluent rewriting system or <code class="code">AutomaticStructure</code> completes successfully, then it is guaranteed that all irreducible words are in normal form.</p>
<p><a id="X7A5773A77C6BAC3F" name="X7A5773A77C6BAC3F"></a></p>
<h5>2.7-2 ReducedWord</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ReducedWord</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ReducedForm</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Reduce the word <span class="SimpleMath">w</span> in the generators of the freestructure <code class="code">FreeStructure(rws)</code> of the rewriting system <span class="SimpleMath">rws</span> (or, equivalently, in the generators of the underlying group of <span class="SimpleMath">rws</span>), and return the result.</p>
<p><code class="func">ReducedForm</code> can only be used after <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) or <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>) has been run successfully on <span class="SimpleMath">rws</span>. In the former case, if <code class="code">KnuthBendix</code> halted without a confluent set of rules, then the irreducible word returned is not necessarily in normal form. If <code class="code">KnuthBendix</code> completes with a confluent rewriting system or <code class="code">AutomaticStructure</code> completes successfully, then it is guaranteed that all irreducible words are in normal form.</p>
<p><a id="X7B8F6EBC87AF42C6" name="X7B8F6EBC87AF42C6"></a></p>
<h4>2.8 <span class="Heading">Counting and enumerating irreducible words</span></h4>
<p><a id="X858ADA3B7A684421" name="X858ADA3B7A684421"></a></p>
<h5>2.8-1 Size</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Size</code>( <var class="Arg">rws</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns the number of irreducible words in the rewriting system <span class="SimpleMath">rws</span>.</p>
<p><code class="func">Size</code> can only be used after <code class="func">KnuthBendix</code> (<a href="chap2.html#X8412C40B7B2DC8E0"><span class="RefLink">2.5-1</span></a>) or <code class="func">AutomaticStructure</code> (<a href="chap2.html#X828FA0177E4C5733"><span class="RefLink">2.6-1</span></a>) has been run successfully on <span class="SimpleMath">rws</span>. In the former case, if <code class="code">KnuthBendix</code> halted without a confluent set of rules, then the number of irreducible words may be greater than the number of words in normal form (which is equal to the order of the underlying group, monoid or semigroup <span class="SimpleMath">G</span> of <span class="SimpleMath">rws</span>). If <code class="code">KnuthBendix</code> completes with a confluent rewriting system or <code class="code">AutomaticStructure</code> completes successfully, then it is guaranteed that <code class="func">Size</code> will return the correct order of <span class="SimpleMath">G</span>.</p>
<p><a id="X84F59A2687C62763" name="X84F59A2687C62763"></a></p>
<h5>2.8-2 Order</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Order</code>( <var class="Arg">rws</var>, <var class="Arg">w</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>The order of the element <span class="SimpleMath">w</span> of the free structure <code class="code">FreeStructure(rws)</code> of <span class="SimpleMath">rws</span> as an element of the group or monoid from which <span class="SimpleMath">rws</span> was defined.</p>
<p><code class="func">Order</code> can only be used after <code class="func">KnuthBendix</code> (<a href= | |