<p>Rational languages are conveniently represented through rational expressions. These are finite expressions involving letters of the alphabet; <code class="code">concatenation</code>, corresponding to the <em>product</em>; the symbol <code class="code">U</code>, corresponding to the <em>union</em>; and the symbol <code class="code">*</code>, corresponding to the Kleene's star.
<p>The expressions <code class="code">@</code> and <code class="code">"empty\_set"</code> are used to represent the empty word and the empty set respectively.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RationalExpression</code>( <var class="Arg">expr</var>[, <var class="Arg">alph</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>A rational expression can be created using the function <code class="code">RationalExpression</code>. <var class="Arg">expr</var> is a string representing the desired expression literally and <var class="Arg">alph</var> (may or may not be present) is the alphabet of the expression. Of course <var class="Arg">alph</var> must not contain the symbols '@', '(', ')', '*' nor 'U'. When <var class="Arg">alph</var> is not present, the alphabet of the rational expression is the set of symbols (other than '"', etc...) occurring in the expression. (The alphabet is then ordered with the alphabetical order.)</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RatExpOnnLetters</code>( <var class="Arg">n</var>, <var class="Arg">operation</var>, <var class="Arg">list</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This is another way to construct a rational expression over an alphabet. The user may specify the alphabet or just give the number <span class="SimpleMath">n</span> of letters (in this case the alphabet <span class="SimpleMath">{a,b,c,...}</span> is considered). <var class="Arg">operation</var> is the name of an operation, the possibilities being: <code class="code">product</code>, <code class="code">union</code> or <code class="code">star</code>. <var class="Arg">list</var> is a list of rational expressions, a rational expression in the case of ``star'', or a list consisting of an integer when the rational expression is a single letter. The empty list <code class="code">[ ]</code> and <code class="code">empty\_set</code> are other possibilities for <code class="code">list</code>. An example follows</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomRatExp</code>( <var class="Arg">arg</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Given the number of symbols of the alphabet and (possibly) a factor <span class="SimpleMath">m</span> which is intended to increase the randomality of the expression, returns a pseudo random rational expression over that alphabet.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SizeRatExp</code>( <var class="Arg">r</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns the size, i.e. the number of symbols of the alphabet, of the rational expression <var class="Arg">r</var>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AlphabetOfRatExp</code>( <var class="Arg">R</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns the number of symbols in the alphabet of the rational expression <code class="code">R</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AlphabetOfRatExpAsList</code>( <var class="Arg">R</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns the alphabet of the rational expression <code class="code">R</code> always as a list. If the alphabet of the rational expression is given by means of an integer less than 27 it returns the list <code class="code">"abcd...."</code>, otherwise returns <code class="code">[ "a1", "a2", "a3", "a4", ... ]</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CopyRatExp</code>( <var class="Arg">R</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns a new rational expression, which is a copy of <code class="code">R</code>.</p>
<h4>3.2 <span class="Heading">Comparison of rational expressions</span></h4>
<p>The way two rational expressions <code class="code">r1</code> and <code class="code">r2</code> are compared through the < operator is the following: the empty set is lesser than everything else; if r1 and r2 are letters, then the lesser is taken from the order in the alphabet; if r1 is a letter an r2 a product, union or star, then r1 is lesser than r2; a star expression is considered to be lesser than a product or union expression and a product lesser than a union; to compare two star expressions we compare the expressions under the stars; to compare two product or union expressions we compare the subexpressions of each expression from left to right;</p>
<h4>3.3 <span class="Heading">Operations with rational languages</span></h4>
<p>Only operations with rational languages over the same alphabet are allowed.</p>
<p>We may compute expressions for the <code class="code">product</code>, <code class="code">union</code> and <code class="code">star</code> (i.e., submonoid generated by) of rational sets. In some cases, simpler expressions representing the same set are returned. Note that that two simplifications are always made, namely, rU"empty_set" = r and r@ = r . Of course, these operations may be used to construct more complex expressions. For rational expressions we have the functions <codeclass="code">UnionRatExp</code>, <code class="code">ProductRatExp</code>, <code class="code">StarRatExp</code>, that return respectively rational expressions for the <em>union</em> and <em>product</em> of the languages given by the rational expressions <code class="code">r</code> and <code class="code">s</code> and the <code class="code">star</code> of the language given by the rational expression <code class="code">r</code>.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ StarRatExp</code>( <var class="Arg">r</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>The expression <code class="code">(a(aUb))*</code> may be produced in the following way</p>
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.