Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  chap37.html   Sprache: HTML

 
 products/sources/formale Sprachen/GAP/doc/ref/chap37.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 (ref) - Chapter 37: Associative Words</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="chap37"  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="chap5.html">5</a>  <a href="chap6.html">6</a>  <a href="chap7.html">7</a>  <a href="chap8.html">8</a>  <a href="chap9.html">9</a>  <a href="chap10.html">10</a>  <a href="chap11.html">11</a>  <a href="chap12.html">12</a>  <a href="chap13.html">13</a>  <a href="chap14.html">14</a>  <a href="chap15.html">15</a>  <a href="chap16.html">16</a>  <a href="chap17.html">17</a>  <a href="chap18.html">18</a>  <a href="chap19.html">19</a>  <a href="chap20.html">20</a>  <a href="chap21.html">21</a>  <a href="chap22.html">22</a>  <a href="chap23.html">23</a>  <a href="chap24.html">24</a>  <a href="chap25.html">25</a>  <a href="chap26.html">26</a>  <a href="chap27.html">27</a>  <a href="chap28.html">28</a>  <a href="chap29.html">29</a>  <a href="chap30.html">30</a>  <a href="chap31.html">31</a>  <a href="chap32.html">32</a>  <a href="chap33.html">33</a>  <a href="chap34.html">34</a>  <a href="chap35.html">35</a>  <a href="chap36.html">36</a>  <a href="chap37.html">37</a>  <a href="chap38.html">38</a>  <a href="chap39.html">39</a>  <a href="chap40.html">40</a>  <a href="chap41.html">41</a>  <a href="chap42.html">42</a>  <a href="chap43.html">43</a>  <a href="chap44.html">44</a>  <a href="chap45.html">45</a>  <a href="chap46.html">46</a>  <a href="chap47.html">47</a>  <a href="chap48.html">48</a>  <a href="chap49.html">49</a>  <a href="chap50.html">50</a>  <a href="chap51.html">51</a>  <a href="chap52.html">52</a>  <a href="chap53.html">53</a>  <a href="chap54.html">54</a>  <a href="chap55.html">55</a>  <a href="chap56.html">56</a>  <a href="chap57.html">57</a>  <a href="chap58.html">58</a>  <a href="chap59.html">59</a>  <a href="chap60.html">60</a>  <a href="chap61.html">61</a>  <a href="chap62.html">62</a>  <a href="chap63.html">63</a>  <a href="chap64.html">64</a>  <a href="chap65.html">65</a>  <a href="chap66.html">66</a>  <a href="chap67.html">67</a>  <a href="chap68.html">68</a>  <a href="chap69.html">69</a>  <a href="chap70.html">70</a>  <a href="chap71.html">71</a>  <a href="chap72.html">72</a>  <a href="chap73.html">73</a>  <a href="chap74.html">74</a>  <a href="chap75.html">75</a>  <a href="chap76.html">76</a>  <a href="chap77.html">77</a>  <a href="chap78.html">78</a>  <a href="chap79.html">79</a>  <a href="chap80.html">80</a>  <a href="chap81.html">81</a>  <a href="chap82.html">82</a>  <a href="chap83.html">83</a>  <a href="chap84.html">84</a>  <a href="chap85.html">85</a>  <a href="chap86.html">86</a>  <a href="chap87.html">87</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="chap36.html">[Previous Chapter]</a>    <a href="chap38.html">[Next Chapter]</a>   </div>

<p id="mathjaxlink" class="pcenter"><a href="chap37_mj.html">[MathJax on]</a></p>
<p><a id="X78C56A0A87CE380E" name="X78C56A0A87CE380E"></a></p>
<div class="ChapSects"><a href="chap37.html#X78C56A0A87CE380E">37 <span class="Heading">Associative Words</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X7AB546CB7B929253">37.1 <span class="Heading">Categories of Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7FA8DA728773BA89">37.1-1 IsAssocWord</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X82E7EA7F7FD31EC3">37.2 <span class="Heading">Free Groups, Monoids and Semigroups</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8215999E835290F0">37.2-1 <span class="Heading">FreeGroup</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8601654A7C4AF1E7">37.2-2 IsFreeGroup</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X814203E281F3272E">37.2-3 AssignGeneratorVariables</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X8405BECB7AC4EB61">37.3 <span class="Heading">Comparison of Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8206153078E97B90"><code>37.3-1 \=</code></a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7BB12B9D7F990899"><code>37.3-2 \<</code></a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X805C519682B0A7ED">37.3-3 IsShortLexLessThanOrEqual</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X84875E08847B39E1">37.3-4 IsBasicWreathLessThanOrEqual</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X79AF6C757A3547BD">37.4 <span class="Heading">Operations for Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X87CD4C6978A7936A">37.4-1 Length</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7F5ED4357A9C12E6">37.4-2 ExponentSumWord</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X82CC92C17AF6FFA0">37.4-3 Subword</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8509A0A4851981BB">37.4-4 PositionWord</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X79186218787C224A">37.4-5 <span class="Heading">SubstitutedWord</span></a>
</span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8486BFE1844CFE59">37.4-6 EliminatedWord</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X7D357E047ABD2C6B">37.5 <span class="Heading">Operations for Associative Words by their Syllables</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X842D0B547CE93CF2">37.5-1 NumberSyllables</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7E91575F848F4526">37.5-2 ExponentSyllable</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7F2A8CFD811C73B1">37.5-3 GeneratorSyllable</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7B4F7A167E844FA5">37.5-4 SubSyllables</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X80A9F39582ED296E">37.6 <span class="Heading">Representations for Associative Words</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7E3612247B3E241B">37.6-1 IsLetterAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7E36F7897D82417F">37.6-2 IsLetterWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7C84789D7BB161E9">37.6-3 IsBLetterAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8719E7F27CDA1995">37.6-4 IsBLetterWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7886F8BD83CD8081">37.6-5 IsSyllableAssocWordRep</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7869716C84EA9D81">37.6-6 IsSyllableWordsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X83F669828481FC32">37.6-7 Is16BitsFamily</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7BD7647C7B088389">37.6-8 LetterRepAssocWord</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7AC8EC757CFB9A51">37.6-9 AssocWordByLetterRep</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X7934D3D5797102EC">37.7 <span class="Heading">The External Representation for Associative Words</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X7DC99E4284093FBB">37.8 <span class="Heading">Straight Line Programs</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7F69FF3F7C6694CB">37.8-1 IsStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7AECA57280DA3195">37.8-2 StraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X81A8AFC47F8E4B91">37.8-3 LinesOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X820A592881D57802">37.8-4 NrInputsOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7847D32B863E822F">37.8-5 ResultOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8098EAAF7D344466">37.8-6 StringOfResultOfStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8274C7948248C053">37.8-7 CompositionOfStraightLinePrograms</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7A582FA97C786640">37.8-8 IntegratedStraightLineProgram</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7C9CABD17BE4850F">37.8-9 RestrictOutputsOfSLP</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7EF202F17DCA5D1C">37.8-10 IntermediateResultOfSLP</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X8085CF79856B2889">37.8-11 IntermediateResultOfSLPWithoutOverwrite</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X873244F37FAA717A">37.8-12 IntermediateResultsOfSLPWithoutOverwrite</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X837101F982C35035">37.8-13 ProductOfStraightLinePrograms</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X84C83CE98194FD03">37.8-14 SlotUsagePattern</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap37.html#X8188799182D82A92">37.9 <span class="Heading">Straight Line Program Elements</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X85A5838482944FA5">37.9-1 IsStraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X78889E5B7E1B3BFF">37.9-2 StraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X81BC263A7E45E775">37.9-3 StraightLineProgGens</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7BEAE8AC809B27DC">37.9-4 EvalStraightLineProgElm</a></span>
<span class="ContSS"><br /><span class="nocss">  </span><a href="chap37.html#X7D85D1DF84DC68E3">37.9-5 StretchImportantSLPElement</a></span>
</div></div>
</div>

<h3>37 <span class="Heading">Associative Words</span></h3>

<p><a id="X7AB546CB7B929253" name="X7AB546CB7B929253"></a></p>

<h4>37.1 <span class="Heading">Categories of Associative Words</span></h4>

<p>Associative words are used to represent elements in free groups, semigroups and monoids in <strong class="pkg">GAP</strong> (see <a href="chap37.html#X82E7EA7F7FD31EC3"><span class="RefLink">37.2</span></a>). An associative word is just a sequence of letters, where each letter is an element of an alphabet (in the following called a <em>generator</em>) or its inverse. Associative words can be multiplied; in free monoids also the computation of an identity is permitted, in free groups also the computation of inverses (see <a href="chap37.html#X79AF6C757A3547BD"><span class="RefLink">37.4</span></a>).</p>

<p>Different alphabets correspond to different families of associative words. There is no relation whatsoever between words in different families.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:= FreeGroup( "a""b""c" );</span>
<free group on the generators [ a, b, c ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">gens:= GeneratorsOfGroup(f);</span>
[ a, b, c ]
<span class="GAPprompt">gap></span> <span class="GAPinput">w:= gens[1]*gens[2]/gens[3]*gens[2]*gens[1]/gens[1]*gens[3]/gens[2];</span>
a*b*c^-1*b*c*b^-1
<span class="GAPprompt">gap></span> <span class="GAPinput">w^-1;</span>
b*c^-1*b^-1*c*b^-1*a^-1
</pre></div>

<p>Words are displayed as products of letters. The letters are usually printed like <code class="code">f1</code>, <code class="code">f2</code>, <span class="SimpleMath">...</span>, but it is possible to give user defined names to them, which can be arbitrary strings. These names do not necessarily identify a unique letter (generator), it is possible to have several letters –even in the same family– that are displayed in the same way. Note also that <em>there is no relation between the names of letters and variable names</em>. In the example above, we might have typed</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">a:= f.1;; b:= f.2;; c:= f.3;;</span>
</pre></div>

<p>(<em>Interactively</em>, the function <code class="func">AssignGeneratorVariables</code> (<a href="chap37.html#X814203E281F3272E"><span class="RefLink">37.2-3</span></a>) provides a shorthand for this.) This allows us to define <code class="code">w</code> more conveniently:</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w := a*b/c*b*a/a*c/b;</span>
a*b*c^-1*b*c*b^-1
</pre></div>

<p>Using homomorphisms it is possible to express elements of a group as words in terms of generators, see <a href="chap39.html#X7E19F92284F6684E"><span class="RefLink">39.5</span></a>.</p>

<p><a id="X7FA8DA728773BA89" name="X7FA8DA728773BA89"></a></p>

<h5>37.1-1 IsAssocWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsAssocWord</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsAssocWordWithOne</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsAssocWordWithInverse</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p><code class="func">IsAssocWord</code> is the category of associative words in free semigroups, <code class="func">IsAssocWordWithOne</code> is the category of associative words in free monoids (which admit the operation <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>) to compute an identity), <code class="func">IsAssocWordWithInverse</code> is the category of associative words in free groups (which have an inverse). See <code class="func">IsWord</code> (<a href="chap36.html#X843F5C3A82239398"><span class="RefLink">36.1-1</span></a>) for more general categories of words.</p>

<p><a id="X82E7EA7F7FD31EC3" name="X82E7EA7F7FD31EC3"></a></p>

<h4>37.2 <span class="Heading">Free Groups, Monoids and Semigroups</span></h4>

<p>Usually a family of associative words will be generated by constructing the free object generated by them. See <code class="func">FreeMonoid</code> (<a href="chap51.html#X79FA3FA978CA2E43"><span class="RefLink">51.2-9</span></a>), <code class="func">FreeSemigroup</code> (<a href="chap51.html#X7C72E4747BF642BB"><span class="RefLink">51.1-10</span></a>) for details.</p>

<p><a id="X8215999E835290F0" name="X8215999E835290F0"></a></p>

<h5>37.2-1 <span class="Heading">FreeGroup</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">rank</var>[, <var class="Arg">name</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">‣ FreeGroup</code>( [<var class="Arg">wfilt</var>][,] [<var class="Arg">name1</var>[, <var class="Arg">name2</var>[, <var class="Arg">...</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">‣ FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">names</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">‣ FreeGroup</code>( [<var class="Arg">wfilt</var>, ]<var class="Arg">infinity</var>[, <var class="Arg">name</var>][, <var class="Arg">init</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="code">FreeGroup</code> returns a free group. The number of generators, and the labels given to the generators, can be specified in several different ways. Warning: the labels of generators are only an aid for printing, and do not necessarily distinguish generators; see the examples at the end of <code class="func">FreeSemigroup</code> (<a href="chap51.html#X7C72E4747BF642BB"><span class="RefLink">51.1-10</span></a>) for more information.</p>


<dl>
<dt><strong class="Mark">
    1: For a given rank, and an optional generator name prefix
  </strong></dt>
<dd><p>Called with a nonnegative integer <var class="Arg">rank</var>, <code class="func">FreeGroup</code> returns a free group on <var class="Arg">rank</var> generators. The optional argument <var class="Arg">name</var> must be a string; its default value is <code class="code">"f"</code>.</p>

<p>If <var class="Arg">name</var> is not given but the <code class="code">generatorNames</codeoption is, then this option is respected as described in Section <a href="chap50.html#X7D0FFDA4793995FC"><span class="RefLink">50.1-16</span></a>.</p>

<p>Otherwise, the generators of the returned free group are labelled <var class="Arg">name</var><code class="code">1</code>, ..., <var class="Arg">name</var><code class="code">k</code>, where <code class="code">k</code> is the value of <var class="Arg">rank</var>.</p>

</dd>
<dt><strong class="Mark">2: For given generator names</strong></dt>
<dd><p>Called with various nonempty strings, <code class="func">FreeGroup</code> returns a free group on as many generators as arguments, which are labelled <var class="Arg">name1</var>, <var class="Arg">name2</var>, etc.</p>

</dd>
<dt><strong class="Mark">3: For a given list of generator names</strong></dt>
<dd><p>Called with a finite list <var class="Arg">names</var> of nonempty strings, <code class="func">FreeGroup</code> returns a free group on <code class="code">Length(<var class="Arg">names</var>)</code> generators, whose <code class="code">i</code>-th generator is labelled <var class="Arg">names</var><code class="code">[i]</code>.</p>

</dd>
<dt><strong class="Mark">
    4: For the rank <code class="keyw">infinity</code>,
       an optional default generator name prefix,
       and an optional finite list of generator names
  </strong></dt>
<dd><p>Called in the fourth form, <code class="func">FreeGroup</code> returns a free group on infinitely many generators. The optional argument <var class="Arg">name</var> must be a string; its default value is <code class="code">"f"</code>, and the optional argument <var class="Arg">init</var> must be a finite list of nonempty strings; its default value is an empty list. The generators are initially labelled according to the list <var class="Arg">init</var>, followed by <var class="Arg">name</var><code class="code">i</code> for each <code class="code">i</code> in the range from <code class="code">Length(<var class="Arg">init</var>)+1</code> to <code class="keyw">infinity</code>.</p>

</dd>
</dl>
<p>If the optional first argument <var class="Arg">wfilt</var> is given, then it must be either <code class="code">IsSyllableWordsFamily</code>, <code class="code">IsLetterWordsFamily</code>, <code class="code">IsWLetterWordsFamily</code>, or <code class="code">IsBLetterWordsFamily</code>. This filter specifies the representation used for the elements of the free group (see <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a>). If no such filter is given, a letter representation is used.</p>

<p>(For interfacing to old code that omits the representation flag, use of the syllable representation is also triggered by setting the option <code class="code">FreeGroupFamilyType</code> to the string <code class="code">"syllable"</code>; this is overwritten by the optional first argument if it is given.)</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(5);</span>
<free group on the generators [ f1, f2, f3, f4, f5 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(4, "gen");</span>
<free group on the generators [ gen1, gen2, gen3, gen4 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(3 : generatorNames := "ack");</span>
<free group on the generators [ ack1, ack2, ack3 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(2 : generatorNames := ["u""v""w"]);</span>
<free group on the generators [ u, v ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup();</span>
<free group of rank zero>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup("a""b""c");</span>
<free group on the generators [ a, b, c ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(["x""y"]);</span>
<free group on the generators [ x, y ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(infinity);</span>
<free group with infinity generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">F := FreeGroup(infinity, "g", ["a""b"]);</span>
<free group with infinity generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfGroup(F){[1..4]};</span>
[ a, b, g3, g4 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfGroup(FreeGroup(infinity, "gen")){[1..3]};</span>
[ gen1, gen2, gen3 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">FreeGroup(IsSyllableWordsFamily, 50);</span>
<free group with 50 generators>
</pre></div>

<p><a id="X8601654A7C4AF1E7" name="X8601654A7C4AF1E7"></a></p>

<h5>37.2-2 IsFreeGroup</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsFreeGroup</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Any group consisting of elements in <code class="func">IsAssocWordWithInverse</code> (<a href="chap37.html#X7FA8DA728773BA89"><span class="RefLink">37.1-1</span></a>) lies in the filter <code class="func">IsFreeGroup</code>; this holds in particular for any group created with <code class="func">FreeGroup</code> (<a href="chap37.html#X8215999E835290F0"><span class="RefLink">37.2-1</span></a>), or any subgroup of such a group.</p>

<p>Also see Chapter <a href="chap47.html#X7AA982637E90B35A"><span class="RefLink">47</span></a>.</p>

<p><a id="X814203E281F3272E" name="X814203E281F3272E"></a></p>

<h5>37.2-3 AssignGeneratorVariables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AssignGeneratorVariables</code>( <var class="Arg">G</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>If <var class="Arg">G</var> is a group, whose generators are represented by symbols (for example a free group, a finitely presented group or a pc group) this function assigns these generators to global variables with the same names.</p>

<p>The aim of this function is to make it easy in interactive use to work with (for example) a free group. It is a shorthand for a sequence of assignments of the form</p>


<div class="example"><pre>
var1:=GeneratorsOfGroup(G)[1];
var2:=GeneratorsOfGroup(G)[2];
...
varn:=GeneratorsOfGroup(G)[n];
</pre></div>

<p>However, since overwriting global variables can be very dangerous, <em>it is not permitted to use this function within a function</em>. (If –despite this warning– this is done, the result is undefined.)</p>

<p>If the assignment overwrites existing variables a warning is given, if any of the variables is write protected, or any of the generator names would not be a proper variable name, an error is raised.</p>

<p><a id="X8405BECB7AC4EB61" name="X8405BECB7AC4EB61"></a></p>

<h4>37.3 <span class="Heading">Comparison of Associative Words</span></h4>

<p><a id="X8206153078E97B90" name="X8206153078E97B90"></a></p>

<h5><code>37.3-1 \=</code></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ \=</code>( <var class="Arg">w1</var>, <var class="Arg">w2</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Two associative words are equal if they are words over the same alphabet and if they are sequences of the same letters. This is equivalent to saying that the external representations of the words are equal, see <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a> and <a href="chap36.html#X852C815F85DBE4BD"><span class="RefLink">36.2</span></a>.</p>

<p>There is no <q>universal</q> empty word, every alphabet (that is, every family of words) has its own empty word.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:= FreeGroup( "a""b""b" );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">gens:= GeneratorsOfGroup(f);</span>
[ a, b, b ]
<span class="GAPprompt">gap></span> <span class="GAPinput">gens[2] = gens[3];</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">x:= gens[1]*gens[2];</span>
a*b
<span class="GAPprompt">gap></span> <span class="GAPinput">y:= gens[2]/gens[2]*gens[1]*gens[2];</span>
a*b
<span class="GAPprompt">gap></span> <span class="GAPinput">x = y;</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">z:= gens[2]/gens[2]*gens[1]*gens[3];</span>
a*b
<span class="GAPprompt">gap></span> <span class="GAPinput">x = z;</span>
false
</pre></div>

<p><a id="X7BB12B9D7F990899" name="X7BB12B9D7F990899"></a></p>

<h5><code>37.3-2 \<</code></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ \<</code>( <var class="Arg">w1</var>, <var class="Arg">w2</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>The ordering of associative words is defined by length and lexicography (this ordering is called <em>short-lex</em> ordering), that is, shorter words are smaller than longer words, and words of the same length are compared w.r.t. the lexicographical ordering induced by the ordering of generators. Generators are sorted according to the order in which they were created. If the generators are invertible then each generator <var class="Arg">g</var> is larger than its inverse <var class="Arg">g</var><code class="code">^-1</code>, and <var class="Arg">g</var><code class="code">^-1</code> is larger than every generator that is smaller than <var class="Arg">g</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:= FreeGroup( 2 );;  gens:= GeneratorsOfGroup( f );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">a:= gens[1];;  b:= gens[2];;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">One(f) < a^-1;  a^-1 < a;  a < b^-1;  b^-1 < b; b < a^2;  a^2 < a*b;</span>
true
true
true
true
true
true
</pre></div>

<p><a id="X805C519682B0A7ED" name="X805C519682B0A7ED"></a></p>

<h5>37.3-3 IsShortLexLessThanOrEqual</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsShortLexLessThanOrEqual</code>( <var class="Arg">u</var>, <var class="Arg">v</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns <code class="code">IsLessThanOrEqualUnder(<var class="Arg">ord</var>, <var class="Arg">u</var>, <var class="Arg">v</var>)</code> where <var class="Arg">ord</var> is the short less ordering for the family of <var class="Arg">u</var> and <var class="Arg">v</var>. (This is here for compatibility with <strong class="pkg">GAP</strong> 4.2.)</p>

<p><a id="X84875E08847B39E1" name="X84875E08847B39E1"></a></p>

<h5>37.3-4 IsBasicWreathLessThanOrEqual</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsBasicWreathLessThanOrEqual</code>( <var class="Arg">u</var>, <var class="Arg">v</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns <code class="code">IsLessThanOrEqualUnder(<var class="Arg">ord</var>, <var class="Arg">u</var>, <var class="Arg">v</var>)</code> where <var class="Arg">ord</var> is the basic wreath product ordering for the family of <var class="Arg">u</var> and <var class="Arg">v</var>. (This is here for compatibility with <strong class="pkg">GAP</strong> 4.2.)</p>

<p><a id="X79AF6C757A3547BD" name="X79AF6C757A3547BD"></a></p>

<h4>37.4 <span class="Heading">Operations for Associative Words</span></h4>

<p>The product of two given associative words is defined as the freely reduced concatenation of the words. Besides the multiplication <code class="func">\*</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>), the arithmetical operators <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>) (if the word lies in a family with identity) and (if the generators are invertible) <code class="func">Inverse</code> (<a href="chap31.html#X78EE524E83624057"><span class="RefLink">31.10-8</span></a>), <code class="func">\/</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>),<code class="func">\^</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>), <code class="func">Comm</code> (<a href="chap31.html#X80761843831B468E"><span class="RefLink">31.12-3</span></a>), and <code class="func">LeftQuotient</code> (<a href="chap31.html#X7A37082878DB3930"><span class="RefLink">31.12-2</span></a>) are applicable to associative words, see <a href="chap31.html#X7A2914307963E370"><span class="RefLink">31.12</span></a>.</p>

<p>See also <code class="func">MappedWord</code> (<a href="chap36.html#X7EC17930781D104A"><span class="RefLink">36.3-1</span></a>), an operation that is applicable to arbitrary words.</p>

<p>See Section <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a> for a discussion of the internal representations of associative words that are supported by <strong class="pkg">GAP</strong>. Note that operations to extract or act on parts of words (letter or syllables) can carry substantially different costs, depending on the representation the words are in.</p>

<p><a id="X87CD4C6978A7936A" name="X87CD4C6978A7936A"></a></p>

<h5>37.4-1 Length</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Length</code>( <var class="Arg">w</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var>, <code class="func">Length</code> returns the number of letters in <var class="Arg">w</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f := FreeGroup("a","b");; gens := GeneratorsOfGroup(f);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">a := gens[1];; b := gens[2];;w := a^5*b*a^2*b^-4*a;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput"> w; Length( w );  Length( a^17 );  Length( w^0 );</span>
a^5*b*a^2*b^-4*a
13
17
0
</pre></div>

<p><a id="X7F5ED4357A9C12E6" name="X7F5ED4357A9C12E6"></a></p>

<h5>37.4-2 ExponentSumWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ExponentSumWord</code>( <var class="Arg">w</var>, <var class="Arg">gen</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var> and a generator <var class="Arg">gen</var>, <code class="func">ExponentSumWord</code> returns the number of times <var class="Arg">gen</var> appears in <var class="Arg">w</var> minus the number of times its inverse appears in <var class="Arg">w</var>. If both <var class="Arg">gen</var> and its inverse do not occur in <var class="Arg">w</var> then <span class="SimpleMath">0</span> is returned. <var class="Arg">gen</var> may also be the inverse of a generator.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  ExponentSumWord( w, a );  ExponentSumWord( w, b );</span>
a^5*b*a^2*b^-4*a
8
-3
<span class="GAPprompt">gap></span> <span class="GAPinput">ExponentSumWord( (a*b*a^-1)^3, a );  ExponentSumWord( w, b^-1 );</span>
0
3
</pre></div>

<p><a id="X82CC92C17AF6FFA0" name="X82CC92C17AF6FFA0"></a></p>

<h5>37.4-3 Subword</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Subword</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var> and two positive integers <var class="Arg">from</var> and <var class="Arg">to</var>, <code class="func">Subword</code> returns the subword of <var class="Arg">w</var> that begins at position <var class="Arg">from</var> and ends at position <var class="Arg">to</var>. Indexing is done with origin 1.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  Subword( w, 3, 7 );</span>
a^5*b*a^2*b^-4*a
a^3*b*a
</pre></div>

<p><a id="X8509A0A4851981BB" name="X8509A0A4851981BB"></a></p>

<h5>37.4-4 PositionWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PositionWord</code>( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">w</var> and <var class="Arg">sub</var> be associative words, and <var class="Arg">from</var> a positive integer. <code class="func">PositionWord</code> returns the position of the first occurrence of <var class="Arg">sub</var> as a subword of <var class="Arg">w</var>, starting at position <var class="Arg">from</var>. If there is no such occurrence, <code class="keyw">fail</code> is returned. Indexing is done with origin 1.</p>

<p>In other words, <code class="code">PositionWord( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var> )</code> is the smallest integer <span class="SimpleMath">i</spanlarger than or equal to <var class="Arg">from</var> such that <code class="code">Subword( <var class="Arg">w</var>, </code><span class="SimpleMath">i</span><code class="code">,</code> <span class="SimpleMath">i</span><code class="code">+Length( <var class="Arg">sub</var> )-1 ) =</code> <var class="Arg">sub</var>, see <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>).</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  PositionWord( w, a/b, 1 );</span>
a^5*b*a^2*b^-4*a
8
<span class="GAPprompt">gap></span> <span class="GAPinput">Subword( w, 8, 9 );</span>
a*b^-1
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionWord( w, a^2, 1 );</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionWord( w, a^2, 2 );</span>
2
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionWord( w, a^2, 6 );</span>
7
<span class="GAPprompt">gap></span> <span class="GAPinput">PositionWord( w, a^2, 8 );</span>
fail
</pre></div>

<p><a id="X79186218787C224A" name="X79186218787C224A"></a></p>

<h5>37.4-5 <span class="Heading">SubstitutedWord</span></h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SubstitutedWord</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var>, <var class="Arg">by</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">‣ SubstitutedWord</code>( <var class="Arg">w</var>, <var class="Arg">sub</var>, <var class="Arg">from</var>, <var class="Arg">by</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">w</var> be an associative word.</p>

<p>In the first form, <code class="func">SubstitutedWord</code> returns the associative word obtained by replacing the subword of <var class="Arg">w</var> that begins at position <var class="Arg">from</var> and ends at position <var class="Arg">to</var> by the associative word <var class="Arg">by</var>. <var class="Arg">from</var> and <var class="Arg">to</var> must be positive integers, indexing is done with origin 1. In other words, <code class="code">SubstitutedWord( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var>, <var class="Arg">by</var> )</code> is the product of the three words <code class="code">Subword( <var class="Arg">w</var>, 1, <var class="Arg">from</var>-1 )</code>, <var class="Arg">by</var>, and <code class="code">Subword( <var class="Arg">w</var>, <var class="Arg">to</var>+1, Length( <var class="Arg">w</var> ) )</code>, see <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>).</p>

<p>In the second form, <code class="func">SubstitutedWord</code> returns the associative word obtained by replacing the first occurrence of the associative word <var class="Arg">sub</var> of <var class="Arg">w</var>, starting at position <var class="Arg">from</var>, by the associative word <var class="Arg">by</var>; if there is no such occurrence, <code class="keyw">fail</code> is returned.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  SubstitutedWord( w, 3, 7, a^19 );</span>
a^5*b*a^2*b^-4*a
a^22*b^-4*a
<span class="GAPprompt">gap></span> <span class="GAPinput">SubstitutedWord( w, a, 6, b^7 );</span>
a^5*b^8*a*b^-4*a
<span class="GAPprompt">gap></span> <span class="GAPinput">SubstitutedWord( w, a*b, 6, b^7 );</span>
fail
</pre></div>

<p><a id="X8486BFE1844CFE59" name="X8486BFE1844CFE59"></a></p>

<h5>37.4-6 EliminatedWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EliminatedWord</code>( <var class="Arg">w</var>, <var class="Arg">gen</var>, <var class="Arg">by</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For an associative word <var class="Arg">w</var>, a generator <var class="Arg">gen</var>, and an associative word <var class="Arg">by</var>, <code class="func">EliminatedWord</code> returns the associative word obtained by replacing each occurrence of <var class="Arg">gen</var> in <var class="Arg">w</var> by <var class="Arg">by</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  EliminatedWord( w, a, a^2 );  EliminatedWord( w, a, b^-1 );</span>
a^5*b*a^2*b^-4*a
a^10*b*a^4*b^-4*a^2
b^-11
</pre></div>

<p><a id="X7D357E047ABD2C6B" name="X7D357E047ABD2C6B"></a></p>

<h4>37.5 <span class="Heading">Operations for Associative Words by their Syllables</span></h4>

<p>For an associative word <var class="Arg">w</var> <span class="SimpleMath">= x_1^{n_1} x_2^{n_2} ⋯ x_k^{n_k}</span> over an alphabet containing <span class="SimpleMath">x_1, x_2, ..., x_k</span>, such that <span class="SimpleMath">x_i ≠ x_{i+1}^{± 1}</span> for <span class="SimpleMath">1 ≤ i ≤ k-1</span>, the subwords <span class="SimpleMath">x_i^{e_i}</span> are uniquely determined; these powers of generators are called the <em>syllables</em> of <span class="SimpleMath">w</span>.</p>

<p><a id="X842D0B547CE93CF2" name="X842D0B547CE93CF2"></a></p>

<h5>37.5-1 NumberSyllables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NumberSyllables</code>( <var class="Arg">w</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="func">NumberSyllables</code> returns the number of syllables of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7E91575F848F4526" name="X7E91575F848F4526"></a></p>

<h5>37.5-2 ExponentSyllable</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ExponentSyllable</code>( <var class="Arg">w</var>, <var class="Arg">i</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">ExponentSyllable</code> returns the exponent of the <var class="Arg">i</var>-th syllable of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7F2A8CFD811C73B1" name="X7F2A8CFD811C73B1"></a></p>

<h5>37.5-3 GeneratorSyllable</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorSyllable</code>( <var class="Arg">w</var>, <var class="Arg">i</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">GeneratorSyllable</code> returns the number of the generator that is involved in the <var class="Arg">i</var>-th syllable of the associative word <var class="Arg">w</var>.</p>

<p><a id="X7B4F7A167E844FA5" name="X7B4F7A167E844FA5"></a></p>

<h5>37.5-4 SubSyllables</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SubSyllables</code>( <var class="Arg">w</var>, <var class="Arg">from</var>, <var class="Arg">to</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">SubSyllables</code> returns the subword of the associative word <var class="Arg">w</var> that consists of the syllables from positions <var class="Arg">from</var> to <var class="Arg">to</var>, where <var class="Arg">from</var> and <var class="Arg">to</var> must be positive integers, and indexing is done with origin 1.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w;  NumberSyllables( w );</span>
a^5*b*a^2*b^-4*a
5
<span class="GAPprompt">gap></span> <span class="GAPinput">ExponentSyllable( w, 3 );</span>
2
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorSyllable( w, 3 );</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">SubSyllables( w, 2, 3 );</span>
b*a^2
</pre></div>

<p><a id="X80A9F39582ED296E" name="X80A9F39582ED296E"></a></p>

<h4>37.6 <span class="Heading">Representations for Associative Words</span></h4>

<p><strong class="pkg">GAP</strong> provides two different internal kinds of representations of associative words. The first one are <q>syllable representations</q> in which words are stored in syllable (i.e. generator,exponent) form. (Older versions of <strong class="pkg">GAP</strong> only used this representation.) The second kind are <q>letter representations</q> in which each letter in a word is represented by its index number. Negative numbers are used for inverses. Unless the syllable representation is specified explicitly when creating the free group/monoid or semigroup, a letter representation is used by default.</p>

<p>Depending on the task in mind, either of these two representations will perform better in time or in memory use and algorithms that are syllable or letter based (for example <code class="func">GeneratorSyllable</code> (<a href="chap37.html#X7F2A8CFD811C73B1"><span class="RefLink">37.5-3</span></a>) and <code class="func">Subword</code> (<a href="chap37.html#X82CC92C17AF6FFA0"><span class="RefLink">37.4-3</span></a>)) perform substantially better in the corresponding representation. For example when creating pc groups (see <a href="chap46.html#X7EAD57C97EBF7E67"><span class="RefLink">46</span></a>), it is advantageous to use a syllable representation while calculations in free groups usually benefit from using a letter representation.</p>

<p><a id="X7E3612247B3E241B" name="X7E3612247B3E241B"></a></p>

<h5>37.6-1 IsLetterAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLetterAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>A word in letter representation stores a list of generator/inverses numbers (as given by <code class="func">LetterRepAssocWord</code> (<a href="chap37.html#X7BD7647C7B088389"><span class="RefLink">37.6-8</span></a>)). Letter access is fast, syllable access is slow for such words.</p>

<p><a id="X7E36F7897D82417F" name="X7E36F7897D82417F"></a></p>

<h5>37.6-2 IsLetterWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A letter word family stores words by default in letter form.</p>

<p>Internally, there are letter representations that use integers (4 Byte) to represent a generator and letter representations that use single bytes to represent a character. The latter are more memory efficient, but can only be used if there are less than 128 generators (in which case they are used by default).</p>

<p><a id="X7C84789D7BB161E9" name="X7C84789D7BB161E9"></a></p>

<h5>37.6-3 IsBLetterAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsBLetterAssocWordRep</code>( <var class="Arg">obj</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">‣ IsWLetterAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>these two subrepresentations of <code class="func">IsLetterAssocWordRep</code> (<a href="chap37.html#X7E3612247B3E241B"><span class="RefLink">37.6-1</span></a>) indicate whether the word is stored as a list of bytes (in a string) or as a list of integers).</p>

<p><a id="X8719E7F27CDA1995" name="X8719E7F27CDA1995"></a></p>

<h5>37.6-4 IsBLetterWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsBLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsWLetterWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>These two subcategories of <code class="func">IsLetterWordsFamily</code> (<a href="chap37.html#X7E36F7897D82417F"><span class="RefLink">37.6-2</span></a>) specify the type of letter representation to be used.</p>

<p><a id="X7886F8BD83CD8081" name="X7886F8BD83CD8081"></a></p>

<h5>37.6-5 IsSyllableAssocWordRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSyllableAssocWordRep</code>( <var class="Arg">obj</var> )</td><td class="tdright">( representation )</td></tr></table></div>
<p>A word in syllable representation stores generator/exponents pairs (as given by <code class="func">ExtRepOfObj</code> (<a href="chap79.html#X8542B32A8206118C"><span class="RefLink">79.8-1</span></a>). Syllable access is fast, letter access is slow for such words.</p>

<p><a id="X7869716C84EA9D81" name="X7869716C84EA9D81"></a></p>

<h5>37.6-6 IsSyllableWordsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSyllableWordsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A syllable word family stores words by default in syllable form. There are also different versions of syllable representations, which compress a generator exponent pair in 8, 16 or 32 bits or use a pair of integers. Internal mechanisms try to make this as memory efficient as possible.</p>

<p><a id="X83F669828481FC32" name="X83F669828481FC32"></a></p>

<h5>37.6-7 Is16BitsFamily</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Is16BitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Is32BitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsInfBitsFamily</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Regardless of the internal representation used, it is possible to convert a word in a list of numbers in letter or syllable representation and vice versa.</p>

<p><a id="X7BD7647C7B088389" name="X7BD7647C7B088389"></a></p>

<h5>37.6-8 LetterRepAssocWord</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LetterRepAssocWord</code>( <var class="Arg">w</var>[, <var class="Arg">gens</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>The <em>letter representation</em> of an associated word is as a list of integers, each entry corresponding to a group generator. Inverses of the generators are represented by negative numbers. The generator numbers are as associated to the family.</p>

<p>This operation returns the letter representation of the associative word <var class="Arg">w</var>.</p>

<p>In the call with two arguments, the generator numbers correspond to the generator order given in the list <var class="Arg">gens</var>.</p>

<p>(For words stored in syllable form the letter representation has to be computed.)</p>

<p><a id="X7AC8EC757CFB9A51" name="X7AC8EC757CFB9A51"></a></p>

<h5>37.6-9 AssocWordByLetterRep</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AssocWordByLetterRep</code>( <var class="Arg">Fam</var>, <var class="Arg">lrep</var>[, <var class="Arg">gens</var>] )</td><td class="tdright">( operation )</td></tr></table></div>
<p>takes a letter representation <var class="Arg">lrep</var> (see <code class="func">LetterRepAssocWord</code> (<a href="chap37.html#X7BD7647C7B088389"><span class="RefLink">37.6-8</span></a>)) and returns an associative word in family <var class="Arg">fam</var> corresponding to this letter representation.</p>

<p>If <var class="Arg">gens</var> is given, the numbers in the letter representation correspond to <var class="Arg">gens</var>.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w:=AssocWordByLetterRep( FamilyObj(a), [-1,2,1,-2,-2,-2,1,1,1,1]);</span>
a^-1*b*a*b^-3*a^4
<span class="GAPprompt">gap></span> <span class="GAPinput">LetterRepAssocWord( w^2 );</span>
[ -1, 2, 1, -2, -2, -2, 1, 1, 1, 2, 1, -2, -2, -2, 1, 1, 1, 1 ]
</pre></div>

<p>The external representation (see section <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a>) can be used if a syllable representation is needed.</p>

<p><a id="X7934D3D5797102EC" name="X7934D3D5797102EC"></a></p>

<h4>37.7 <span class="Heading">The External Representation for Associative Words</span></h4>

<p>The external representation of the associative word <span class="SimpleMath">w</span> is defined as follows. If <span class="SimpleMath">w = g_{i_1}^{e_1} * g_{i_2}^{e_2} * ⋯ * g_{i_k}^{e_k}</span> is a word over the alphabet <span class="SimpleMath">g_1, g_2, ...</span>, i.e., <span class="SimpleMath">g_i</span> denotes the <span class="SimpleMath">i</span>-th generator of the family of <span class="SimpleMath">w</span>, then <span class="SimpleMath">w</span> has external representation <span class="SimpleMath">[ i_1, e_1, i_2, e_2, ..., i_k, e_k ]</span>. The empty list describes the identity element (if exists) of the family. Exponents may be negative if the family allows inverses. The external representation of an associative word is guaranteed to be freely reduced; for example, <span class="SimpleMath">g_1 * g_2 * g_2^{-1} * g_1</span> has the external representation <code class="code">[ 1, 2 ]</code>.</p>

<p>Regardless of the family preference for letter or syllable representations (see <a href="chap37.html#X80A9F39582ED296E"><span class="RefLink">37.6</span></a>), <code class="code">ExtRepOfObj</code> and <code class="code">ObjByExtRep</code> can be used and interface to this <q>syllable</q>-like representation.</p>


<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">w:= ObjByExtRep( FamilyObj(a), [1,5,2,-7,1,3,2,4,1,-2] );</span>
a^5*b^-7*a^3*b^4*a^-2
<span class="GAPprompt">gap></span> <span class="GAPinput">ExtRepOfObj( w^2 );</span>
[ 1, 5, 2, -7, 1, 3, 2, 4, 1, 3, 2, -7, 1, 3, 2, 4, 1, -2 ]
</pre></div>

<p><a id="X7DC99E4284093FBB" name="X7DC99E4284093FBB"></a></p>

<h4>37.8 <span class="Heading">Straight Line Programs</span></h4>

<p><em>Straight line programs</em> describe an efficient way for evaluating an abstract word at concrete generators, in a more efficient way than with <code class="func">MappedWord</code> (<a href="chap36.html#X7EC17930781D104A"><span class="RefLink">36.3-1</span></a>). For example, the associative word <span class="SimpleMath">ababbab</span> of length <span class="SimpleMath">7</span> can be computed from the generators <span class="SimpleMath">a</span>, <span class="SimpleMath">b</span> with only four multiplications, by first computing <span class="SimpleMath">c = ab</span>, then <span class="SimpleMath">d = cb</span>, and then <span class="SimpleMath">cdc</span>; Alternatively, one can compute <span class="SimpleMath">c = ab</span>, <span class="SimpleMath">e = bc</span>, and <span class="SimpleMath">aee</span>. In each step of these computations, one forms words in terms of the words computed in the previous steps.</p>

<p>A straight line program in <strong class="pkg">GAP</strong> is represented by an object in the category <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)) that stores a list of <q>lines</q> each of which has one of the following three forms.</p>

<ol>
<li><p>a nonempty dense list <span class="SimpleMath">l</span> of integers,</p>

</li>
<li><p>a pair <span class="SimpleMath">[ l, i ]</span> where <span class="SimpleMath">l</span> is a list of form 1. and <span class="SimpleMath">i</span> is a positive integer,</p>

</li>
<li><p>a list <span class="SimpleMath">[ l_1, l_2, ..., l_k ]</span> where each <span class="SimpleMath">l_i</span> is a list of form 1.; this may occur only for the last line of the program.</p>

</li>
</ol>
<p>The lists of integers that occur are interpreted as external representations of associative words (see Section  <a href="chap37.html#X7934D3D5797102EC"><span class="RefLink">37.7</span></a>); for example, the list <span class="SimpleMath">[ 1, 3, 2, -1 ]</span> represents the word <span class="SimpleMath">g_1^3 g_2^{-1}</span>, with <span class="SimpleMath">g_1</span> and <span class="SimpleMath">g_2</span> the first and second abstract generator, respectively.</p>

<p>For the meaning of the list of lines, see <code class="func">ResultOfStraightLineProgram</code> (<a href="chap37.html#X7847D32B863E822F"><span class="RefLink">37.8-5</span></a>).</p>

<p>Straight line programs can be constructed using <code class="func">StraightLineProgram</code> (<a href="chap37.html#X7AECA57280DA3195"><span class="RefLink">37.8-2</span></a>).</p>

<p>Defining attributes for straight line programs are <code class="func">NrInputsOfStraightLineProgram</code> (<a href="chap37.html#X820A592881D57802"><span class="RefLink">37.8-4</span></a>) and <code class="func">LinesOfStraightLineProgram</code> (<a href="chap37.html#X81A8AFC47F8E4B91"><span class="RefLink">37.8-3</span></a>). Another operation for straight line programs is <code class="func">ResultOfStraightLineProgram</code> (<a href="chap37.html#X7847D32B863E822F"><span class="RefLink">37.8-5</span></a>).</p>

<p>Special methods applicable to straight line programs are installed for the operations <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>), <code class="func">IsInternallyConsistent</code> (<a href="chap12.html#X7F6C5C3287E8B816"><span class="RefLink">12.8-4</span></a>), <code class="func">PrintObj</code> (<a href="chap6.html#X815BF22186FD43C9"><span class="RefLink">6.3-5</span></a>), and <code class="func">ViewObj</code> (<a href="chap6.html#X815BF22186FD43C9"><span class="RefLink">6.3-5</span></a>).</p>

<p>For a straight line program <var class="Arg">prog</var>, the default <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>) method prints the interpretation of <var class="Arg">prog</var> as a sequence of assignments of associative words; a record with components <code class="code">gensnames</code> (with value a list of strings) and <code class="code">listname</code> (a string) may be entered as second argument of <code class="func">Display</code> (<a href="chap6.html#X83A5C59278E13248"><span class="RefLink">6.3-6</span></a>), in this case these names are used, the default for <code class="code">gensnames</codeis <code class="code">[ g1, g2, </code><span class="SimpleMath">...</span><code class="code"> ]</code>, the default for <code class="code">listname</code> is <span class="SimpleMath">r</span>.</p>

<p><a id="X7F69FF3F7C6694CB" name="X7F69FF3F7C6694CB"></a></p>

<h5>37.8-1 IsStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsStraightLineProgram</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Each straight line program in <strong class="pkg">GAP</strong> lies in the category <code class="func">IsStraightLineProgram</code>.</p>

<p><a id="X7AECA57280DA3195" name="X7AECA57280DA3195"></a></p>

<h5>37.8-2 StraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ StraightLineProgram</code>( <var class="Arg">lines</var>[, <var class="Arg">nrgens</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">‣ StraightLineProgram</code>( <var class="Arg">string</var>, <var class="Arg">gens</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">‣ StraightLineProgramNC</code>( <var class="Arg">lines</var>[, <var class="Arg">nrgens</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">‣ StraightLineProgramNC</code>( <var class="Arg">string</var>, <var class="Arg">gens</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>In the first form, <var class="Arg">lines</var> must be a nonempty list of lists that defines a unique straight line program (see <code class="func">IsStraightLineProgram</code> (<a href="chap37.html#X7F69FF3F7C6694CB"><span class="RefLink">37.8-1</span></a>)); in this case <code class="func">StraightLineProgram</code> returns this program, otherwise an error is signalled. The optional argument <var class="Arg">nrgens</var> specifies the number of input generators of the program; if a line of form 1. (that is, a list of integers) occurs in <var class="Arg">lines</var> except in the last position, this number is not determined by <var class="Arg">lines</var> and therefore <em>must</em> be specified by the argument <var class="Arg">nrgens</var>; if not then <code class="func">StraightLineProgram</code> returns <code class="keyw">fail</code>.</p>

<p>In the second form, <var class="Arg">string</var> must be a nonempty string describing an arithmetic expression in terms of the strings in the list <var class="Arg">gens</var>, where multiplication is denoted by concatenation, powering is denoted by <code class="code">^</code>, and round brackets <code class="code">(</code>, <code class="code">)</code> may be used. Each entry in <var class="Arg">gens</var> must consist only of uppercase or lowercase letters (i.e., letters in <code class="func">IsAlphaChar</code> (<a href="chap27.html#X84634DF67A431D26"><span class="RefLink">27.5-4</span></a>)) such that no entry is an initial part of another one. Called with this input, <code class="func">StraightLineProgram</code> returns a straight line program that evaluates to the word corresponding to <var class="Arg">string</var> when called with generators corresponding to <var class="Arg">gens</var>.</p>

<p>The <code class="code">NC</code> variant does the same, except that the internal consistency of the program is not checked.</p>

<p><a id="X81A8AFC47F8E4B91" name="X81A8AFC47F8E4B91"></a></p>

<h5>37.8-3 LinesOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LinesOfStraightLineProgram</code>( <var class="Arg">prog</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a straight line program <var class="Arg">prog</var>, <code class="func">LinesOfStraightLineProgram</code> returns the list of program lines. There is no default method to compute these lines if they are not stored.</p>

<p><a id="X820A592881D57802" name="X820A592881D57802"></a></p>

<h5>37.8-4 NrInputsOfStraightLineProgram</h5>

<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrInputsOfStraightLineProgram</code>( <var class="Arg">prog</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>For a straight line program <var class="Arg">prog</var>, <code class="func">NrInputsOfStraightLineProgram</code> returns the number of generators that are needed as input.</p>

--> --------------------

--> maximum size reached

--> --------------------

100%


¤ Dauer der Verarbeitung: 0.98 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge