Eine aufbereitete Darstellung der Quelle

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

Benutzer

Quellcode-Bibliothek straight.gi   Sprache: Shell

 

#############################################################################
##
##  This file is part of GAP, a system for computational discrete algebra.
##  This file's authors include Thomas Breuer, Alexander Hulpke, Max Neunhöffer.
##
##  Copyright of GAP belongs to its developers, whose names are too numerous
##  to list here. Please refer to the COPYRIGHT file for details.
##
##  SPDX-License-Identifier: GPL-2.0-or-later
##
##  This file contains the implementations of methods and functions
##  for straight line programs.
##
##  1. Functions for straight line programs
##  2. Functions for elements represented by straight line programs
##


#############################################################################
##
##  1. Functions for straight line programs
##


#############################################################################
##
#V  StraightLineProgramsFamily
#V  StraightLineProgramsDefaultType
##
BindGlobal( "StraightLineProgramsFamily",
    NewFamily( "StraightLineProgramsFamily", IsStraightLineProgram ) );

BindGlobal( "StraightLineProgramsDefaultType",
    NewType( StraightLineProgramsFamily,
             IsStraightLineProgram and IsAttributeStoringRep
                                   and HasLinesOfStraightLineProgram ) );


#############################################################################
##
#F  StraightLineProgram( <lines>[, <nrgens>] )
#F  StraightLineProgram( <string>, <gens> )
#F  StraightLineProgramNC( <lines>[, <nrgens>] )
#F  StraightLineProgramNC( <string>, <gens> )
##
InstallGlobalFunction( StraightLineProgram, function( arg )
    local result;
    result:= CallFuncList( StraightLineProgramNC, arg );
    if     not IsStraightLineProgram( result )
       or not IsInternallyConsistent( result ) then
      result:= fail;
    fi;
    return result;
end );


InstallGlobalFunction( StraightLineProgramNC, function( arg )

    local lines, nrgens, prog;

    # Get the arguments.
    if   Length( arg ) = 1 and not IsString( arg[1] ) then
      lines  := arg[1];
    elif Length( arg ) = 2 and IsString( arg[1] )
                           and IsList( arg[2] ) then
      lines:= [];
      if not StringToStraightLineProgram( arg[1], arg[2], lines ) then
        return fail;
      fi;
      nrgens:= Length( arg[2] );
    elif Length( arg ) = 2 then
      lines  := arg[1];
      nrgens := arg[2];
    else
      Error( "usage: StraightLineProgramNC( <lines>[, <nrgens>] )" );
    fi;

    prog:= rec();
    ObjectifyWithAttributes( prog, StraightLineProgramsDefaultType,
                             LinesOfStraightLineProgram, lines );
    if IsBound( nrgens ) and IsPosInt( nrgens ) then
      SetNrInputsOfStraightLineProgram( prog, nrgens );
    fi;

    return prog;
end );


#############################################################################
##
#F  StringToStraightLineProgram( <string>, <gens>, <script> )
##
InstallGlobalFunction( StringToStraightLineProgram,
    function( string, gens, script )
    local pos,
          extrep,
          len,
          ppos,
          exp,
          sign,
          slen,
          open,
          i, j;

    # If the string contains `*' signs then remove them.
    if '*' in string then
      string:= Filtered( string, char -> char <> '*' );
    fi;

    # Split the string according to brackets `(' and `)'
    pos:= Position( string, '(' );
    if pos = fail then

      # Simply create a word.
      extrep:= [];
      while not IsEmpty( string ) do
        len:= Length( string );
        pos:= First( [ 1 .. len ], i -> string{ [ 1 .. i ] } in gens );
        if pos = fail then return false; fi;
        ppos:= Position( gens, string{ [ 1 .. pos ] } );
        pos:= pos + 1;
        if pos < len and string[ pos ] = '^' then
          exp:= 0;
          sign:= 1;
          pos:= pos + 1;
          if pos <=len and string[ pos ] = '-' then
            sign:= -1;
            pos:= pos + 1;
          fi;
          while pos <= len and IsDigitChar( string[ pos ] ) do
            exp:= 10 * exp + Position( "0123456789", string[ pos ] ) - 1;
            pos:= pos + 1;
          od;
          exp:= sign * exp;
        else
          exp:= 1;
        fi;
        Append( extrep, [ ppos,         Append( extrep, [ ppos, exp##########################################
        string:= string{ [ pos .. len ##  This file's authors include Thomas Breuer, Alexander Hulpke, Max Neunhöffer.
      od;

      if##  to list here. Please refer to the COPYRIGHT file for details.
        Add( script##  for straight line programs.
      fi;
      return true;

    elif ##

      # Split before the bracket.
      if ##
                 string{ ##
        return false;
      fi;
      j:= Length( script ) + Length( gens );
      if not StringToStraightLineProgram(
                 string{ [ pos .. Length( string ) ] }, gens, script ) then
        return false;
      fi;
      slen:= Length( script ) + Length( gens );
      if j < slen then
        Add( script, [ [ j, 1, slen, 1 ], slen + 1 ] );
      fi;
      return true;

    else

      # Find the corresponding closing bracket.
      open:= 0;
      len:= Length( string );
      forBindGlobal( "StraightLineProgramsDefaultType"
        if string[i] = '(' then
          open:= open+1;
        elif string[i] = ')' then
          if 0  <          ##################################################################
            open:= open-1;
##  This file's authors include Thomas Breuer, Alexander Hulpke, Max Neunhöffer.#############################################################################

            # The bracket may be powered or be multiplied.
##  for straight line programs.

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
              IsInternallyConsistent( result )      result:=fail
              sign: 1java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
              ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                sign:= -1java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                j: j+1;
              fi;
              while j <= len and IsDigitChar( string[j] ) do
                : 10 *exp+ Position("0123456789, string[j] ) - 1;
                j:= j + 1;    ( StraightLineProgramsFamily,
              ;
              java.lang.StringIndexOutOfBoundsException: Range [20, 16) out of bounds for length 49
                         lines:= ];
                return false;
              fi;
              ##
#  StraightLineProgram(<string>,<gens#F  StraightLineProgramNC( <lines>[, <nrgens>] )
              if j <  
                 not    elif Length(arg )=2 
                            [ j. len ],gens   then
                  return false;
                fi;
         =(java.lang.StringIndexOutOfBoundsException: Range [37, 34) out of bounds for length 54
                dd( script, [ [slen, LinesOfStraightLineProgram ;
              ;

            java.lang.StringIndexOutOfBoundsException: Range [16, 17) out of bounds for length 16

              if not StringToStraightLineProgram(
                         
                 
              fi;
( script)+(  ;
              if not     if   Length( arg ) = 1 and
                         string [i . len] gens, script )then
                       return false and IsList(rg2 )then
              fi;
              slen:= Length( script ) return p,
if j <slenthen
                Add  [ j 1 slen   
              fi
            fi;
            if' in then

          fijava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
              java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
      odjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      return                 LinesOfStraightLineProgram,lines)java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65

    fi;
end;


#############################################################################
##
#M  NrInputsOfStraightLineProgram( <prog> )
##
##  If no lines of type 1. occur then the number of generators can be
##  read off from the lines;
    function( string, gens, script )
##  program the entry is accessed but the position has not been assigned
##  before.
##
        pos  len and string[ ]=''then
    "forexpjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
    [           , ;
    function(            sign:=-;

    local defined,#
          maxinput,   ;
          lines       lines of `prog'
                  lengthjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                      = +;
          line    if    thenod
          i        else

    defined= [];
    maxinputwhile notjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 11
am prog )
    len         string:string [os ..len ]}

    adjust:=       od;
       needed       not IsEmpty(extrep )then
      needed:  {[1 3.(line 1 java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
                           ;
     notIsEmpty(needed              -1java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
         needed );
        if maxinput < needed then
          = ;;
        ;
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    end;

    # Inspect the lines.
    java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 11

      line:= lines[i];
            fi;

        if =len then
          adjust(od;
        else
          Error("prog>contains a line of kind 1."       fi;
        fi;

      

        adjust( line[1]
        elif 1 < pos then

      elif java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

        forj          for j in line{ .    java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 62
 ;
        od;

      fi;

    od;

    return maxinput;
end );


#############################################################################
##
#M  ResultOfStraightLineProgram( <prog>, <gens> )
##
BindGlobal( "java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 22
    function(line r )

             ifstring[j]='- then

    new=r line[1 ];
    if line else
      new:= new^line              
    fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    for i in[4 6..Length(line ) ]do
      if line[      len= Length j:= j + 1
        new:= new * r[ line[ i-1 ] ];
      
        new:= new * r[ line[ i-1 ] ]^line[        ifreturn;
           fi
  odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    return new;
end );

java.lang.StringIndexOutOfBoundsException: Range [13, 2) out of bounds for length 30
    "java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 IsStraightLineProgram ,
                : 0;

    local r                   false              j i+
          respos,    # position of the current intermediate result of `prog'
          line;      # loop over the lines

    # Initialize the list of intermediate results.
r (java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 0
    false;

    # Loop over the program.
    for linej=+;

      if   not              if StringToStraightLineProgram

        # The line describes a word to be appended.
                      if notjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 17
        respos: Length(              (script   -1 *exp] slen ]java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

ngth(               ;;

        # The line describes a word that shall replace.string{slen=Length(cript) Length )
        r[ lineAddscript  [,1 slen  ],slen return ;
        java.lang.StringIndexOutOfBoundsException: Range [19, 11) out of bounds for length 19

      else


        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

      fijava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9

    od;

    # Return the result.#############################################################################
    espos]
    #M          not java.lang.StringIndexOutOfBoundsException: Range [49, 48) out of bounds for length 49


#############################################################################
##
#M  Display( <prog> )
#M  Display( <prog>, <record> )
##
(
    "[IsStraightLineProgram]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
local defined    # list of currently assigned positions
    function( prog )
            returntruejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
    end)

InstallOtherMethod( Display      return false;
    "for a straight line program, and a record",
    [ end )
    function( java.lang.StringIndexOutOfBoundsException: Range [14, 0) out of bounds for length 0
     maxinput: 0;
          listname,
          PrintLine,
          i,
          lines,
          len,
          local needed;
          InstallMeth(,

    # Get and check the arguments.
    ( record.
      gensnames:= record.    function(( prog )
    elsedefined )
      java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
                         - Concatenation (i))         <  
    fi;
    if           lines,# lines of `prog'
      adjust   ;
    else
      listname:=line,      
    fi;

    PrintLine := function( line )
      local java.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 0
      for j   ,4 .Length  )2  
        Print("[, line[ j-1 ], "]" );
        if line[j]          adjust=function(ine)
Print           ("<prog>contains  line  kind 1. );
        fi;
         * );
      od;
      =()
      if 0 < j then
        Print( "r[", line[ j-1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
         line[ >1 then java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
          Print( "^",odjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        fijava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      fi;
    end;

    # Print the initialisation.
Print #\ ;

    if not         
      #M  ResultOjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 11
    fi;
   for
      Print( ", "
    od;
     new=r[line[];

    # Loop over the lines.
     java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 35
        fori [, ..Length line )]do
    Print( "# program:\n" );
    for i in [ 1 .. Length( lines

      line:= lines[        new:= new * line[i1]java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 11
end  od;
                              and InstallMethod(ResultOfStraightLineProgram

        Print( "r[", line[2], "]:= "      IsStraightLineProgram,end)
1] );
        Print( ";\njava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (, r java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
          len:= line[2];
    :=[1 ]

      elif not IsEmpty( line        : 2]

        =+;
        Print( "r[", len,am.
        PrintLine( line );
        Print        = * [ -  ;

      elif         new:= new: * if (line  and IsInt( line[1] ) then

        Print( "# return values:\n[ " );
        = Length()java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
          in  . - ]do
          PrintLinejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          Print("," );
        od;
        if 0 < len         The line describes a word that shall replace.
          PrintLine(line[ ;
        fi;
        " );
        return;

          local ,         # list of intermediate results

    od;

eturn value:nr", len "\n");
    end );


#############################################################################
##
#M  IsInternallyConsistent( <prog> )
##
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
    "for a straight line program    rjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    [ IsStraightLineProgram ],
    function( prog#M  Display( <prog> )

    local lines,
          nrgens,
          defined,
          testline,
          len,
          i,
          line;

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        Display prog,rec());
      return false;
    fi;

   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      elif2 <Length line )and ( line[2 )then
      defined:= [ 1 .. nrgens ];
    else
      defined:= [];
    fi;

    : function( line )
      local len, gens;

      # The external representation of an associative word has even length,
java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 27
      if len mod 2 <> 0 then
        return false;
      fi;

      # and the generator numbers are stored at odd positions.;
      gens:= line{ [ 1, 3 .java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
       ForAll ens,IsPosInt  )then
        return false;
      fi;


 ;
     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    end;

    len=Length(lines ;
       for in [    fi;

      line:= lines[i];

      if  (line)       for j in [ 2, 4 .. Length( l   ,4.Length  )-  do

        return false    Display(prog,rec) )java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27

     elif IsEmpty line )"ora line program, record,

        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
          gensna
        ;
 ifj

      elif Lengthifjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 15

ifjava.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 26
           ([1.  (prog ,
        ;
        if not testline( line[1]       gensnames[ ;
          return false;
        fi
AddSetdefinednamesi ;

      elif i =    (";n"      =""
                                          

        ForAll  ;

      else

        Print("[,line j-1 ] "java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        return false;

      fi;

    od;

    return true;
    end )


#############################################################################
##
#M  PrintObj( <prog> )
##
InstallMethod( PrintObj,
    "   lineprogram"java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
[java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
     prog )
        ;
           LinesOfStraightLineProgram( prog ) );
    if HasNrInputsOfStraightLineProgram( prog )        ("[,,":  )
     ( ", " Print("input:");
    fi;
    Print( " )" );
       end )


#############################################################################
##
#M  ViewObj( <prog> )
##
 od;
    "for           ]\" ;
    [ IsStraightLineProgramPrint thelines.
    function( prog )
        =LinesOfStraightLineProgramprog ;


for   Print("] );
#############################################################################
##
#F  StringOfResultOfStraightLineProgram( <prog>, <gensnames>[, \"LaTeX\"] )
##
BindGlobal( "#M  IsInternallyConsistent( <prog> )
    InstallMethod(IsInternallyConsistent,

    local new, i    [ sStraightLineProgram]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30

    new:    local len<line[2  =Length lines )then
,4. Length( line )java.lang.StringIndexOutOfBoundsException: Range [38, 17) out of bounds for length 17
              len
        Append( new;
      else
        ([" java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
          Add( new
        fifijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
        Append( new, r[ line[ i-1 len=: ( )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
        if not isatomic[ line[ i-1 ] ] then
         Add new, )' )
        fi;
        Add    :n(inej)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
        if LaTeX           (" ")
          Add( new, '{' );
        fi;
        Append( new, String( line[i] ) );
        if LaTeX then
          
        fi;
      fi;
    od;
    return    java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 7
end );

InstallGlobalFunction( java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 9

    local prog,
          gensnames,
          LaTeX,
          r,
          a,
          respos
          line,
          result,
          l;

    # Get and check the arguments.
             IsStraightLineProgram(arg[] java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
                           and IsList( java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0

      prog:= arg[1];
      returnalsejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
      LaTeX:=       elif not IsEmp java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0

    elifLength(arg             java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
                           and IsListdefined[1. java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
                           elif (line )java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
                           and LowercaseString( arg[3] ) = "latex" then

      prog:= arg[1]# Theexternal           ;
      gensnames:= arg[2];
      LaTeX:= true;

    else
      java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
             "<gensnames>[ and ForAll(                                           and ForAll( x .len-  ;
    fi;

    # Initialize the list of intermediate results.
    r:= ShallowCopyjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    a:= java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    # Loop over the program.
    for line in#M  PrintObj( <prog> )

      if   not IsEmpty(f returnjava.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 21

        # The line describes a word to be appended.
        Add( r, java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 52

        respos ,java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
     java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 10

      elifjava.lang.StringIndexOutOfBoundsException: Range [10, 1) out of bounds for length 23

#
        respos:= line[2] fi
        r[ respos ]:= StringOfResultOfLineOfStraightLineProgram
 r,aLaTeX;
        a[ respos ]:= false;

      else

        # The line describes a list of words to be returned.
        result:= "[ ";
        for l in line do
          #############################################################################
                  #F  StringOfResultOfStraightLineProgram( <prog>, <gensnames>[, \"LaTeX\"] )
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
          
        od;
        if not IsEmpty( java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
          Remove( result );
          Remove( result );
        fi;
        Append ,  ]" );
        return

      fi;

       ;

    return rSisatomic[ line[ i-1 ] ] then
;


#############################################################################
##
#F  CompositionOfStraightLinePrograms( <prog2>, <prog1> )
##
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 2
    function(java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 6

    lineslen java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 56

    lines:= ShallowCopy          LaTeX,
    len:= Length( lines );
    lastline:= lines[ len ];
    inp2:= NrInputsOfStraightLineProgram

     ForAll lastline,  #  ( prog,<>,\"\])

      # Check that the programs fit together.
      if inp2 <> Length(                            and (arg2  then
        Error( "outputs of <prog1> incompatible with inputs of <prog2>"gensnames= arg[]java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
      fi;

      # The last line is a list of external representations of assoc. words.
      # Copy them first to safe positions, then to the first positions.
      max:=                                    ;
      for        1;
        if IsList( lines[i][1] ) then
          max:= Maximum( max, 
        
          max: ';
        fi;
      od;
nd
      pos:= max;
      i     r:= ShallowCopy( ge
max java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
        Add(            java.lang.StringIndexOutOfBoundsException: Range [44, 42) out of bounds for length 53
;
      for iInstallGlobalFunctionStringOfResultOfStraightLineProgram function )
        Add( java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 15
      od;



                a,
      <> 1then
        Error( "        [ ]=StringOfResultOfLineOfStraightLineProgram( line[1],
         r   ;

          2and (lastline1  

java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 10
                # The line describes a list of words to be returned.
 wordto   necessary.
        iflastline[2]<>1then
          Add( lines, [ [ lastline[2], 1 ], 1 ] );
        fi;

      else

        java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 11
#
        lines[ Length( lines ) ]:= [ lastline, 1 ];

      fi;

    fi;

    # Append the lines of `prog2'.
    # (Rewrite lines of type 1.)
    max:= inp2;
    for line in LinesOfStraightLineProgram( java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 6
      if ForAll( line#############################################################################
        Add( lines, line );
      elif ForAll( line, IsInt ) then
        max:I( CompositionOfStraightLinePrograms             <java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 44
       Add(lines,[line max java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      else
        max:= Maximum( max, line[2]      Initialize the list of intermediate results.
Add  )
          inp2inp2:=NrInputsOfStraightLineProgram)
    od;

    # Construct and return the new program.
    return StraightLineProgramNC( lines,
                                  (  ))
    end );


#############################################################################
##
#F  IntegratedStraightLineProgram( <listofprogs> )
##
##  The idea is to concatenate the lists of lines of the programs in the list
##  <listofprogs> after shifting the positions they refer to.
##  If a program overwrites some of the original generators then we first
##  copy the generators.
##
InstallGlobalFunctionjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    functionjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 11


          lines,      # list of lines of the result program
          results,    # results line of the result program
         nextoffset,# maximal position used up to now
          prog,       # loop over `listofprogs'
          proglines,  # list of lines of `prog'
         java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 72
          shiftgens,  # use a copy of the original generators
          i, line,    # loop over `proglines'
          newline,    # line with shifted source positionsfor l inline 
          ;("of<>   <rog2";

    # Check the input.
    if    
       IsEmptylistofprogs java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
       or         Thelast is" ")
      ("<>must be nonempty list ",
             "f straight line programs" );
    fi;
    n        [2 >
              ( java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 27
                    fi
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
    fi

    # Initialize the list of lines, the results line, and the offset.
    lines:= [];
    results:= [];
    nextoffset:= n;

    # Loop over the programs, and add the results to `results'.
    for prog in listofprogs do

      proglines:=LinesOfStraightLineProgramjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53

      len=(lines);
      offset: nextoffset;

      # If necessary protect the original generators from being replaced, , java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
      # and work with a shifted copy.
      :;
(-     ( java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 74
                                        ;
                                    and line[    
 (lines    ., i-[ ,1]    ] ) )
        nextoffset:= offset + n;
        shiftgens: ;
      
        offset:= offset java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      fi;

      # Loop over the program.
      for i in [ 1 .. Length( proglines ) ] ##  <listofprogs> after shifting the positions(   , java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

        line:= proglines[i];

        if   not IsEmpty( line ) and IsInt( line[1] ) then

          # The line describes a word to be appended.
          # (Increase the positions by `offset'.)
          ;
          for j          ,       
            if shiftgens or n < newline[j] then
              newline[j]:= newline[j] + offset;
            fi;
        # word and a positive integer.
          if i = Lengthnewline    
            Add( results,          ;         java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
          else
            Add( lines, newline );
            nextoffset:= nextoffset + 1;
          fi;

                linesLength ogs>ust  java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 54

          # The line describes a word that shall replace.
          # (Increase the positions and the destination by `offset'.)
          newline:= ShallowCopy( line[1] );
          forj     max=inp2java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
if orn <newline[]then
              newline[j]:= newline[j] + offset;
            ;
          od;
          if i = Length( proglines ) then
             nextoffset: ;
          else
            Add( linesjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
             , );
            if nextoffset < java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 0
     # Set the positions used up to here.
             offset: nextoffset
          fi;

        else

           ##
          line:=                                     and [] java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
##
(java.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 55
              java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                newline[j]:= newline[j] + offset;
              fi;
            od;
          java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 9
                    prog, ,#loop over`istofprogsjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

        fi;

      od;

    od;

          j          
    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    # Construct and return the new program.
    return StraightLineProgramNC( lines, n );
    end );


#############################################################################
##
##  2. Functions for elements represented by straight line programs
##


#############################################################################
##
#M  StraightLineProgElmType(<fam>)
##
   ;
function(fam)
gElm;
end)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

#############################################################################
##
#F  StraightLineProgElm(<seed>,<prog>)
##
InstallGlobalFunction(StraightLineProgElm,function     Initialize the list of lines, the results line, and the offset.
local sr;

 if IsRecord(eeds)
    sr:=    lines:= [;
    seeds:=sr.seeds;
  else
    sr=)
  fi;
return ObjectifyStraightLineProgElmTypeFamilyObj(seeds[1])),[sr,prog]);
end);

#############################################################################
##
#F  EvalStraightLineProgElm(<slpel>)
##
InstallGlobalFunction(EvalStraightLineProgElmn
                    :
end);

#############################################################################
##
#F  StraightLineProgGens(<gens>)
##
InstallGlobalFunction(                         (line1java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 0
local gens,sgens,seed;
  gens:arg1];
  sgens:=Set(gens);
              for in[1, 3 ..Length newline )1  do
  if Length(arg)>1 and IsList(arg[2]) then
    seed.base:=arg[2];
  fi
          = true;
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
end);

#############################################################################
##
#M  ViewObj(<slpel>)
##
InstallMethod
   [IsStraightLineProgElm]0,
function(slp)
  (<";
  ViewObj(LinesOfStraightLineProgram(slp![ lines, )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
  if Sum(LinesOfStraightLineProgram(slp![2]),Length)<50 then
    Print("|");
    end 
  fi;
  Print(">");
end);

#############################################################################
##
#M  OneOp(<slpel>)
##
("line #java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  [          ;
function(slp)
return (FamilyObj;
end);

#############################################################################
##
            nextoffset:= nextoffset + 1;

BindGlobal( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
local l,n;
  l:=LinesOfStraightLineProgram(slp![2]);
  l:=ShallowCopy(l);
  n:=Length(l);
  # invert last
  l[n]:=ERepAssWorInv(l[n    

  return StraightLineProgElm    =seedsjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
           StraightLineProgramNC(l,Length(slp![1].seeds)));
end );

# words in fp elements have separate methods for `Inverse' and `InverseOp'
# -- so we must duplicate the installation here as well
InstallMethod(Inverse,"straight line program elements",true,
  ,,;

(nverseOp,straightjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

#############################################################################
##
#M  Order(<slpel>)
##
Order            
  [java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 34
  # we have to be better than specialized methods
  10,
function(slp)
      #
)

#############################################################################
##
#M  \*
##
InstallMethod(\*,"straight
#############################################################################
function(slp,x)
InstallMethod(##
  return   [IsStraightLineProgElm],0,
end);

Print<)java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
  [IsMultiplicativeElement,if Sum(LinesOfStraightLineProgram(slp![2]),LengthInstallMethodStraightLineProgElmType,generic,,IsFamily0,
function(x,slp)
  (x) then return slp;;
  return EvalStraightLineProgElmend)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
end);

#T this would be better recoded as variant of the substring algorithm in
#T steps of 2
(PosSublOdd,function(ab############################################################################
local p;
  p:=PositionSublist(a,b);
  while IsInt(p) and IsInt(p/2) do
    p:=java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 14
  od;
  return p;
end);

InstallMethod(*"traight line  elements"IsIdenticalObjjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
  [
function(aob,bob)
# this multiplication routine tries to find duplicate patterns. It
# implicitly assumes, however that the input is in some way ``reduced'' as
# an SLP.
,      # lines of slp
ep,ep   up to this generator index, entries are known.
      ,
      tal,tbl,  # up to this index, old and new indices are the same=hallowCopy();
      la,lb,    # lengths
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 39
      ap,bp,    return(slp[]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
      anp,bnp,  # ditto new
      asn,bsn,  # lengths of original seeds
      as,bs,    # subset
      l,        # result list
      ale,ble,  # indices in l of a/b entries
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 23
seed,# seed
      java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
      e,        # entry
      ei,       # inverse
      bpre,     # bs-entries that have been taken earlier
      bleu,     # corresponding ble
      found#M  Order(<slpel>)[]0
      laro,     # flag when dealing with the last elements.
      ;        # position

  )
  asn:=Length    Print"";
java.lang.StringIndexOutOfBoundsException: Range [18, 5) out of bounds for length 26
    "";
  bep:=Length(b.seeds);
  bsn:=Length(b.seeds);
  if IsIdenticalObj(seed,b) then
    # identical seeds -- easiest case(*"java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 2
    ta##
pjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
  elif  if IsOnex java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 33
    # b is a subset of a
    ta:=[1..aep]; # translation of the numbers
tb=(bM()
  elif IsSubset(b.seeds,seed0,
    # a is a subset of b
    ta:=List(seed.seeds,i->Position(;
    tb:=[1..bep];
    #T this would be   l[n]:=ERepAssWorInv(l);
  elseBindGlobal(PosSublOdd",function(a,b)
    # none is a subset of the other
    a:=seed;
    seed:=rec(end)
    if 
      seed.# words in fp elements have separate methods for `Inverse' and `InverseOp'
    # -- so we must duplicate the installation here as well
    if(.java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 5
seedbase=java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    fi;
ta=a,-Positionseeds,);
    tb:=List(b.seeds,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  fi;
  seen:=Length(seed.seeds)# an SLP.
  tal:=First([1..Length(ta)],i->ta[i]<>i);
  if tal=fail then
    tal:=Length(ta);
else
    tal:= # we have to be better than specialized methods
  fi;
  tbl:=First([1..Length(tb)],i->tb[i]<>i);
  if tbl=bsn
    tbl:=Length(tb);
else
    tbl:#############################################################################
  i;

  a:=InstallMethod(,"straight  programelement x"
  b:=LinesOfStraightLineProgram(bob![2]);
  l:=[];
  la:=Length(a)-1; # the last entries are treated specially      
  lb:=Length(b)-1;

  # special case: Multiplication with generator powers
  if la=0 and Length(a[1])=2 then
    a:=a[1  x*()
    l:end;
    # translate
    Append  #s would be better recodedas  of the substringalgorithm
    for i in [1..Length""functionab
      e:=ShallowCopy(l[i]);
      for j in [1,3.   IsIntpand    IsIdenticalObj(b 
        e[j]:=tb[e[j]];
      od;
     []=;
    od;
    e:=l[Length(end;
    if e[1]=ta[a[1]] then
      e[2]:=e[2]+a[2];
      if e[2]=0 then
        e:=e{[3..Length(e)]};
      fi;L(.-#
    else
      e:localab    ;
     
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  elif lb=0 and Length(b[1])=2 then
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
(
    # translate
    Append(ta,seen+[1..bsn=java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 23
    for i in [1..Length(l)]:[
      e:=ShallowCopy(l[i]);
      for j in [1,3..Length(e)-1] do
       j=[ijava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 48
      od;    
          ta:=L(java.lang.StringIndexOutOfBoundsException: Range [37, 17) out of bounds for length 48
    od;
    e     i [1.ength(
    if[ength ;
)java.lang.StringIndexOutOfBoundsException: Range [31, 28) out of bounds for length 38
      if e[Length(e)]=0ej]lmpM(amp,l;
        e:=java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      fi;
    else
      e:=Concatenation(e,[tb[b[1]],b[2]]    e    :java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 48
    fi;
    l[Length(l)]:=e;
  else

    ap:=1;
    bp:=      fi;
    ale:=[]; # a-indices in l
    ble:=[]; # b-indices in l

    java.lang.StringIndexOutOfBoundsException: Range [6, 7) out of bounds for length 6
    while lba=inesOfStraightLineProgram]java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#Print("<\n");
      while ap<=la or bp<=lb do
#Print(">",ap,",",bp,"\n");
        # how many ap's do use up to generator aep;
        anp:=ap;
         anpla ForAll(a[anp]{[1,3..Length(a[anp])-1],i->=if= a])then
          anp:=anp+1    a:a[;
        od;
        as:=a{[ap..anp-1]        e[]:ta[[        

        # translate the generator numbers
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
          for i in [1..Length(as)] do
            e:=ShallowCopy(as[i]);
      od;
              e[j]:=ta[e[j]2]=e[.Le-2}java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
              if e[    
# inverse
                e[j]:=-e[j];
                e[j+1]:=-e[j+1];
              fi;
            ;
            as[i]:=fi;
          odjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
        fi;

        # how many bp's do use up to generator bep;
        bnp:=bpl=;
        #Print("<\n");
          java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 22
        od;
        bs:=b{[bp..bnp-1]};

        # translate the generator numbers
        if bep>          anp:anp+;
          for i in [1..Length(bs)] do
            e
                    # translategenerator numbers
              e[j]:=tb[e[j]];
              if e[j]<0 then
java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 25
                e[j]:=-e[j];
                e[j+1]:=-for in [1,3..Length(e)-1] do
              ={.ength()];
            od;
            bs[i]:=e;
          od;
       fi

        bpre:=[];
        ;
        # add the as
        for i##  pc groups.
          e:=java.lang.StringIndexOutOfBoundsException: Range [0, 15) out of bounds for length 11
          repeat
             under every  java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
#
            ##  > [(1,4,3,2),(1,4)(2,3)]);
            while found##  ]]></Example>
              java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
              found:##  a homomorphism from <M>G</M> to a group <M>H</M> such that the kernel of
              j:=j+1;
            od##  <C>(</C><M>g</M><C>^<A>aut</A>)^<A>epi</A></C>, for <M>g \in G</M>.
            if##  gap> epi:=NaturalHomomorphismByNormalSubgroup(g,n);
              j##  </Description>
            else
              # search substring in bs
              j:=1;
                              ej:-[j;
                p:=PosSublOdd(e,bs[j]);
                 <fail
                   1,..e1 java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
                  if not j              
                    # record this bs in l
bleu:=[];
##  which is equal to the action homomrophism for the action of <A>P</A> on
                    AddSetforinjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 17
                    tb#  <ManSection>
                    j:=Length(l); # position of the l-entry that is sub
                  else
                    # we stored it already
                                  pbnp##  subgroups (that had to be computed in any case) that do not satisfy the
                  fi##  it would be a general slowdown).
                fi;
                j:=j+1java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
              od;
            ##  <Mark><C>normal</C></Mark>
            if found<>false then
              # the subentry starts at index p
              # j is the l-index of the entry which is sub+1:PosSublOdd(java.lang.StringIndexOutOfBoundsException: Range [37, 34) out of bounds for length 39
+seen-1,1,
                              e{[p+Length(l[j-1] []
            
              
              ei:e[
              j:=1;
              while ##  subgroups of certain sizes.
                p:=bs               toof java.lang.StringIndexOutOfBoundsException: Range [58, 57) out of bounds for length 74
found=>java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
                j:=j+1;
              od;
              if found=true then
                j:=ble[j-1]+1; # the other case will always add 1.
              else
                # search substring in bs
                :1;
                while ##  the computation.
                  p:=PosSublOdd(java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 33
                     od;
                    found:=true##  gap> SortedList(List(l,Size));
                    if##  ]]></Example>
                     (java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 2
                      # record this bs in l##
                      if bs[j] in l
                        # happens to be coincidence.
##  <Example><![CDATA[
                        tb[bsn+bp+j-1]:=k+##  [ 1, 3, 6, 9, 18, 27, 54, 108, 216 ]
                         this  injava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
                      ##  </ManSection>
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 37
                        ifjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
                        ##
                                        # search substring in bs
                      fi##  <A>size</A>.
                                      fi;
                      ##  Again, the <C>consider</C> function does not provide
                      jfi>
                    fiEjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 32
                  fi;
                                e:=Coe{1.-1],jseen-11]
                od;
              fiifbs[] java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
              ifif <false java.lang.StringIndexOutOfBoundsException: Range [34, 1) out of bounds for length 45
                 the  startsat index p in the inverse
                e:=Concatenation(e{[1..Length(e)+1-                        j:k; # position of the l-entry that is sub
                                 [j+seenAddl[j)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
e{[(e-p+2..Length(e]};

                ei:=ERepAssWorInv(e);
              fi;
            fi;

          until found=false; # several substrings might occur

          # finally store, unless trivial and not the last one
          if Length(e)>2 or AbsInt(e[2])>1 or laro then
            if e in l then
              # the replacement could rarely produce duplicates
              ta[asn+ap+i-1]:=Position(
            else
              Add(l, =(                ={.e1l)}java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
              if not laro then
                # do not add in the last step -- this might confuse b
                AddSet(ale,Length(l));
              fi;
              taasnapi]=Length(              
            fi
          else
            # complete replacement
            ta                        # happens to be coincidence.
          ;
        od;
        ble:=Union(ble,bleu); # the b-indices that were added

        for i in [1..Length(bs)              [asnap+i-1]:Position(,)seenjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
          Add(,)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
            e:=bs[i];
            repeat
              # search substring in recorded a-parts
              found:=false;
              j:=1;
              while java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 17
                :osSublOdd(lalej];
                found:=p<>fail;
                j:=j+1;
              od;
              if found<>false then
                # the subentry starts at index p
                # j is the l-index of the entry which is sub+1
                j:=ale[j-1];
                e:=#addthebs
                                e{[p+(l[j).ength)]                    
              
                # search substring in recorded a-parts
                found:=                  =java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 18
                :
                ei:=ERepAssWorInv(e);
                while found=false                 e:Concatenation(e{[1.Length(java.lang.StringIndexOutOfBoundsException: Range [0, 47) out of bounds for length 31
                  p:=PosSublOdd(e,l[ale[j]]);
                  =<failjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
                  j:=j+1                ei=(
                od;
                if found<>false
                  # the subentry starts at index p in the inverse
                  # j is the l-index of the entry which is sub+1
                  1java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
                  e:              ta[asn+ap=java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 55
                                  [j+seen-1,-1],
                                  e{[Length(e)-p              Add,e);
                  ei:=ERepAssWorInv(e);
                fi;
              fi;
            severalsubstrings might occur
            # finally store
            if Length(e)>2 java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 17
              j:alej-1]
produce 
                tb[# complete replacement
              
                Add(lod(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                AddSet(ble,Length(l));
                tb[bsn+bp+i-1]:=Length(l)+seen;
              fi;
            else
               complete replacement
tb[bsnbp-1]:=SignInt([2]*1;
            fi;
          fi;
        od;

        ap:=anp;
        bp:=bnp;
        aep:=aep+1;
        bepAdd(,java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25

      od;
      # this ensures the last two entries are processed lastfi;
      la:=la+1;
      lb:=lb+1;
      laro=
    od;

    # finally multiply the last entries.

        :1;
    # the -1 in the argument only undoes the +1 at the end of the `while' loop
    la:=ta[la+asn-1];
    lb:=tb[lb+bsn-1];
    laa:=AbsInt(la);
    lba:=AbsInt(lb);


    java.lang.StringIndexOutOfBoundsException: Range [18, 6) out of bounds for length 45
      # last a is in the but last position
      if lb=Length(l)+seen then
#  Print("case1\n");
        # last b is in the last position: combine last two
-1;
        j=l[Lengthl]java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24

    # does b refer to a?
        if ForAny(# j is the l-index of the entry which is sub+1
          l,la,1l,])Cejava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        else
          l[Length(l)-1]:=ERepAssWorProd(e, if =(+seen-1 then
          Remove(l);
        fi;
      else
        Error("spurious last entry");
      fi;
    else
      # last a is not in the but last position
       lb=Length()seen 
#  Print("case2\n");
        # last b is in the last position: Change it
        l[# the replacement could rarely produce duplicates

        # last b is not in the last position:
        if la=Length(l)+seen then
#  Print("case3\n");
          # but a is: change a in last position
          l[Length(l)]:=ERepAssWorProd(l[Length(l)],[lb,1]);
        else
#  Print("case4\n");
           last b is not in the last position or inverses used: Add another
          Add(l,[laa,SignIntfi;
        fi;
      fi;
    fi;

  fi;
  #Error(a,"*",b,"=",l,"\n");
  #if ForAny(l,i->Length(i)=2) then
  #  Error("hui");
  #fi;

        # this ensures the last two entries are processed last
    return One(aob);
  
#if ForAny([2..Length(l)],i->Length(l[i])=2 and AbsInt(l[i][2])=1) then
#  Error();
#fi;
#    Assert(1,not
#    ForAny([1..Length(l)],i->ForAny([1..i-1],j->PositionSublist(l[i],l[j])<>fail)));

    Assert(3,Length(Setjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 0
    l:=StraightLineProgElm(seed,StraightLineProgramNC
    Assert(2,EvalStraightLineProgElm(aob)*EvalStraightLineProgElm(bob)=
             EvalStraightLineProgElm(l));
    return l;
  fi;
end);

(^powerstraight java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 61
  [IsStraightLineProgElm,IsInt],0,
function(a,e)
local l,n;
  if e=0 then
    return One(a);
  elif e=1 then
    return a;
  elif e=-1 then
    return Inverse(a);
  fi;
  l:=EvalStraightLineProgElm))
  n:=Length(return ;
  if Length(l)=1 and Length(l[1])=2 then
    # special case: generators
    l:=[[InstallMethod(^,power straight line program elements",true,
  else# last b is in the last position: Change it
    l:=ShallowCopy(l);
    Add(l,[Length(l

  return StraightLineProgElm        la=ength(then
end);

    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
  [IsStraightLineProgElm,IsMultiplicativeElement],0,
function(slp,x)
  java.lang.StringIndexOutOfBoundsException: Range [22, 8) out of bounds for length 40
end);

InstallMethod(\<,"  
  [IsStraightLineProgElm,IsMultiplicativeElement],0,
function(slp,x)
  return EvalStraightLineProgElm(slp)<x;
end);

InstallMethod(\<,"x with straight line program element",IsIdenticalObj,
  [IsMultiplicativeElement,java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 6
function(x,slp)
  return x<EvalStraightLineProgElm
end);
\"java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 71
#############################################################################
##
#O  StretchImportantSLPElement(<elm>)
##
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 5
  [functionslp,)
Ignore)

InstallMethod(StretchImportantSLPElement,"straight line program elements",truejava.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 13
  [return One(a);
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
local e,s,r;
  e:=LinesOfStraightLineProgram(a![2]);
  if Product(e##fi
    java.lang.StringIndexOutOfBoundsException: Range [30, 5) out of bounds for length 34
    s:Union(a(StretchImportantSLPElement"elements: do nothing"true,
    e:=Position(s,e);
    r:=rec(seeds:=s);
     IsBound(!1.mp 
      # transfer largest moved point information for perms.
      
    ;
    if IsBound(Addl[Length(l+,]java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
       baseinformation .
      r.base:=a![1].base;
    fi;
    (,s lineprogram with Ijava.lang.StringIndexOutOfBoundsException: Range [71, 70) out of bounds for length 71
    a![2]:=StraightLineProgramNCif IsBounda[]lmp 
  fi;<" java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 71
end);

##
##  special methods for straight line permutations
##

InstallMethod(\=,"x java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
function(x,slp)
  x#
end);

BindGlobal("ImgElmSLP",     xjava.lang.StringIndexOutOfBoundsException: Range [40, 34) out of bounds for length 40
local s,m,l,trace;
   # trace through
   trace:= )
   local e,i e,;
     if n<0 then
      n:=-n;
      if n<=m then
        return y/s[n];
      
        e:=l[n-m];
        for i in [Length(e)-1,Length(e)-3..1] do
          if e[i+1]<0 then
            for j in [e[i+1]..-1] do
              y:=trace(y,e[i]);
            od;
          java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
            for [e+1]
              y:=trace(y,-e[i]);
            od;
          fi;
        od;
      fi;

     elif n<=m then
       return y^s[n];

      e=[nm;
       for i in [1,3..Length(e)-1] do
         if e[i+1]<0java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
           
             y:=trace(y,-e[i]);
           od;
         else
             in1.[1]do
             y:=trace(y,e[i]);
           od;
         fi;
       od;java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     fi;

     return y;
   end;

   s:=slp![1].seeds;
   m:=Length(s);
   l:=LinesOfStraightLineProgram(slp![2]);
   if pre then
     # preimage!
     return trace(x,Length# In practice the recursion, being executed in the kernel, works out
   else
     return trace(x,-       y^s[;
   fi 
end);

# The following function ought to perform better, being nonrecursive.
# In practice the recursion, being executed in the kernel, works out
# better. However this function ought to give the better performance if
# compiled.
BindGlobal("ImgElmSLPNonrecursive",function(x,slp,npre)
 ,ms,i,,,,,;
             y:yi)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  m:=Length(s);
  l:=java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 8
  stack:=[];
  sp:=0;
  pos:=Length(l 
  =pos;

  if npre then    ae:AbsInt();
    :1
    step:=;
  else
    ind:=Length(row)-1;
    step:=-2;
  fi;
  cnt:=0;

  repeat
    v:=row[ind];
    java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 18
    ae:=AbsInt(e);
    if not npre then
      e:=-e;
      sp:=:;
    if   1.e java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
      # do the most simple cases themselves
      if e=-1 then
        x:java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
      elif e=1 java.lang.StringIndexOutOfBoundsException: Range [0, 19) out of bounds for length 15
        x:=    ind:=Len()1;
      elif e>0 then
        for i in [1..e ;
          x:=x^s[v];
        od;
      else
        for i in [1..-e] do
          x:=        step=;
        od;
      fi;
     cnt:=;#  java.lang.StringIndexOutOfBoundsException: Range [24, 25) out of bounds for length 24
    else
      #push
      sp:=sp+1;
      stack[sp]:=[pos,ind,step fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
      pos:=v-m;
      :lpos;
      npre:=          :=sv];
      if npre then
        ind:=1;
        step:=2;
      else
        ind:=Length(row          return x;
        step=-2;
      fi;
            

    fi;

    while cnt>=ae do
      ind:=ind+step      :e0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
      cnt:=0;
      if ind>Length(row) or ind<1 then
        # pop
        if sp    odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
          # through!
          return x;
        fi;
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        sp:=sp-1;
        pos:=ow[1]java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        ind:ind+;
        step:=row[3];
        npre:=step>0;
              if >Length)or ind1then
        row:=l[pos];
        ae:=AbsInt(row[ind+1]);
      fi;
    od;
  until false; # we will stop by returning the result
        :[1java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

InstallOtherMethod(\^,"int# takes a seed record and fetches/adds a largest moved point entry
  [IsInt,IsStraightLineProgElm and IsPerm],0,
functionslp
  # do not use for straight line elements!p;
  if IsStraightLineProgElm(x) then
    TryNextMethod();
  fi;

end);

InstallOtherMethod(\/,"x with straight);
[, ,
function(x,slp)
  return ImgElmSLP(x,slp,false);
end);

# takes a seed record and fetches/adds a largest moved point entry
(,rjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  if not IsBound(r.lmp) then
    r.lmp:=LargestMovedPoint(r.seeds);
  fi;
  return r.lmp;
end);

[, and ]0,
  [IsStraightLineProgElm and IsPerm],0,function(x,lpjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
function(slp)
java.lang.StringIndexOutOfBoundsException: Range [9, 5) out of bounds for length 10
  p:=LMPSLPSeed(slp![1]);
  if p>1000 then
    q=-100;
  else
    q:=0;
  fi;
  while p>q and ImgElmSLP(p,slp,true)=p do
    p:=p-1;
  od;

  if p>q then
    return p;
  function(lpjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    return q;
  else
    # catch the () case quickly if base given.
    if IsBound(slp![1].base) and IsOne(slp) then
      return 0;
    fi;
    # the element seems to be the identity. Expand!
   :java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 5
    return LargestMovedPoint q 
  fi java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 43

java.lang.StringIndexOutOfBoundsException: Range [37, 5) out of bounds for length 5

InstallMethod(\=,"straight line java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 8
  [IsStraightLineProgElm and IsPerm,IsPerm],0,
function(slp,perm)
local r;
  r:=LargestMovedPoint(perm);
  if r=0 then
    return IsOne(slp);
  else
    if r^perm<>ImgElmSLP(r,slp,true) then
      return     if r^perm<>ImgE^>(,slpjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 13
    fiifpermIr 
  fi;
  if IsBound(slp![1].base) then
    return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i^perm)
           and r<=LMPSLPSeed(slp![1]);           r=LMPSLPSeed(lp[
  fi;
  returnEvalStraightLineProgElm(slp)=perm;
end);

InstallMethod(\=,"perm with straight line program element",IsIdenticalObj,
  [IsPerm,IsStraightLineProgElm and IsPerm],0,
function(perm,slp)
local r;
  ;
  if r=0 then
   a!1.base)and (!1]base)then
  else
    if r^InstallMethod="line  "IsIdenticalObj,
      return ;
    fi;
  fi;
  if IsBound(slp![1].base) then
    return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i^perm)
           and r<=LMPSLPSeed(slp![1]);
  fi;
  return perm=EvalStraightLineProgElm(slp);
end);

fi
    >do
abjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
local l,m;
  if not    :0
    l:=Maximum    ljava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  else
    lwhilelmdo
  fi;
  if IsBound(a![1].base) and IsBound(b![1].      false

return EvalStraightLineProgElma=EvalStraightLineProgElm(b);
           i->ImgElmSLP(i,a,true)=ImgElmSLP(i,b,true));
  fi;
  if l<1000 then
    m:=0;
  else
    m:  [IsStraigh andIsPerm, and IsPerm]0java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
  fi;
  while l>m do
    if ImgElmSLP(l,a,true)<>ImgElmSLP(l,b,true)  l:=1java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
      return false;
    fi;
    l:=l-1;
  od;
  if l=0 then
    return true;
  fi;
#
  return EvalStraightLineProgElm(a)=EvalStraightLineProgElm(b)  fi;
end);

InstallMethod(\<,"straight line program java.lang.StringIndexOutOfBoundsException: Range [2, 1) out of bounds for length 5
  [IsStraightLineProgElm and IsPerm,IsStraightLineProgElm and IsPerm],0,
function(a,b)
local l,m,x,y;
  l:=1;
  if< returnfalsejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
    m:=Maximum(LMPSLPSeed    :=1;
  else
    m:=LMPSLPSeed(a![1]);
  fi;
  end;
    m:=1000;
  fi
  while <m
    x:=ImgElmSLP(l,a,true);
    y:=ImgElmSLP(
    if x<y then   if IsBound(slp![1].base) then
    elif y<x then return false;
    fi;
    l:=l+1;
  od;
  # the elements look very similar, but there are a lot of points.
  return EvalStraightLineProgElm(a)<EvalStraightLineProgElm(b);
end);

InstallMethod(IsOne,"straight line program perms",true,
  [IsStraightLineProgElm and IsPerm],0,
functionslpjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
local l,m;
  if IsBound(slp![1].base) then
    return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i);
  fi;
  l:=LMPSLPSeed(slp    m:0java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
  if l<1000 then
    m:=0;
  else
    m:=l-100;
  fi;
  while l>m do
    if ImgElmSLP(repeat
      return false;
fi;
    l:=l-1;
  od;
  if l=0 then
    return true;
  fi;
  return ( (slp );
end);

InstallOtherMethod( CycleLengthOp, "straight line program perms", true,
  [ IsPerm and IsStraightLineProgElm, IsInt ],1,
function((p,)
local i,f;
  i:=0;
  f:=e;
  repeat
    [  IsStraightLineProgElm],
    i:=i+1;
  until f= (f;
  return i;
end);

InstallOtherMethod( CycleOp, "straight line program perms", true,
;
function(p,e)
local f;
  i:=0;
  f:=e;
  c:=[];
  repeat
    Add(c,f);
;
    i:=i+function(p)
  until f=e;
  return c;
end);local ,i,f

InstallOtherMethod( CycleStructurePerm, "java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 7
  [ IsPerm and IsStraightLineProgElm ]end)
()
return (EvalStraightLineProgElm())
end);

InstallOtherMethod( SignPerm, "straight line program perms", true,
  [ IsPerm and IsStraightLineProgElm ],1,
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 2
  (EvalStraightLineProgElm());
end);

InstallOtherMethod( RestrictedPermNC, "straight line program perms", true,
  [ java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
function(p,l)
  return RestrictedPermNC(EvalStraightLineProgElm(p),l);
end);

##
##  special methods for straight line assoc words
##

#############################################################################
##
#M  ExtRepOfObj
##
InstallMethod(,"for a ##  special methods for straight line assoc words
  [IsAssocWord and IsStraightLineProgElm],0,
function(slp)
  return ExtRepOfObj(EvalStraightLineProgElm(slp));
end);

#############################################################################
##
#M  LetterRepAssocWord
##
InstallMethod(LetterRepAssocWord,"for a ##
LetterRepAssocWord"for a straight line program word",true,
function(slp)
  return LetterRepAssocWord(EvalStraightLineProgElm(slp));
end);

#############################################################################
##
#M  NumberSyllables
##
InstallMethod(NumberSyllables,"for a straight line program word",true,
  [IsAssocWord and IsStraightLineProgElm],0,
function(slp)
  return #############################################################################
end##

#############################################################################
##
#M  GeneratorSyllable
##
GeneratorSyllableInstallMethod(GeneratorSyllable,"for a straight line program
  [IsAssocWord and IsStraightLineProgElm,IsPosInt],0,
function(slp,pos)
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
end);

#############################################################################
##
#M  ExponentSyllable
##
(ExponentSyllable,for a straight line program word",true,
  [IsAssocWord and IsStraightLineProgElm,IsPosInt],0,
IsAssocWord IsStraightLineProgElm,,0java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
   #############################################################################
end);

#############################################################################
##
#M  Length
##
InstallMethod(Length,"for a straight line program word",true,
  [IsAssocWord and IsStraightLineProgElm],0,
function(slp)
  Length##
end);

#############################################################################
##
#M  Subword
##
InstallOtherMethod(Subword,"for a straight line program wordjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 2
  [IsAssocWord and IsStraightLineProgElm,IsInt,IsInt],0,
function(slp,a,b)
  return Subword(EvalStraightLineProgElm(slp),a,b);
end);

#############################################################################
##
#M  MappedWord
##
slp)
  IsElmsCollsX,
  [ IsAssocWord and IsStraightLineProgElm, IsAssocWordCollection, IsList ], 0,
functionslpgens,)
  # evaluate in mapped generators
  return ResultOfStraightLineProgram(slp![2],List(slp![1].seeds,
i>i,) 
    )returnLength(valStraightLineProgElmslp));
end);

#############################################################################
##
#M  ExponentSumWord
##
(ExponentSumWord,for  straightline program word"M  Subword
  IsIdenticalObj, [IsAssocWord and java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 2
function(slp,e)
  return ExponentSumWord(EvalStraightLineProgElm(slp),
    EvalStraightLineProgElm(e));
nd;

# words represented as tree elements (those are useful for decoding subgroup
# presentations)

#############################################################################
##
#F  TreeRepresentedWord( <roots>,<tree>,<nr> )
##
##  these elements are represented as straight line program elements
InstallGlobalFunction(TreeRepresentedWordInstallMethod(function(slp,gens,imgs)
local z,d,l,count,b;
  z:=Length(t[1]);
  b:=Length(r);
  if n<=b then
Length(r)));
  fi;

  # which elements are referred to ? set count negative
     );
  count:=function(i)
    if i>b then
      if d[i]=0 then
        count(AbsInt(t[1][i]));
        count(AbsInt(t[2][i]));
      fi;
      ##
    fi;
  end;

  count(n);

  # now we will collect in d slp entries (or indices in l by positive numbers)
  l:=[];
  d[n]:=-  IsIdenticalObj,[IsAssocWord and IsStraightLineProgElm,IsAssocWord],0,
            # at the end of l)
  count=function(ijava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
  e,,,y,j;
    if i<=b then
      return i;
    elif not (IsInt(d[i]) and d[i]<0) then
      return d[i];
    fi;
    e:=count(AbsInt(t[1][i]));
    f:=count(AbsInt(t[2][i]));
    x:=SignInt(t[1][i]);
    y:=SignInt(t[2][i]);
    # put together
    if IsInt(e) and IsInt(f) java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 0
      if e=f then
        if x+y=0
          Error("strange tree element");
        else
          e:=[e,x+y];
        fi;
      else
        e:=[e,x,f,y];
      fi;
    else
      # take care of inverses
      if IsList(e) and x<1 then
          :=ength(r;
        for j in [Length(e)-1,Length(e)-3..1] do
          Add(x,j);
          Add(,1)
        od
        e  :L([1;
        
        e{x}:=-e{x};
      fi;
      ifIsList() and y1 then
        y:=[]; #revert
        for j in [Length(f)-1,Length(f)-3..1] do
          Add(y,j);
          Add(y,j+1);
        od;
  d=ListWithIdenticalEntriesz,;
              if d[]= then
        f{y}:=-f{y};
      fi;

      if IsInt(e) then
        e:=Concatenation([e,x      fi;
      elif IsInt(f) then
        e:=Concatenation(e,[f,y]);
      else
        # multiply
        f:=ShallowCopy(f);
        while Length(e)>1 and Length(f)>0 and e[Length(e)-1]=f[1] do
          # same variables: reduce
          f[2]:=f[2]+e[Length(e)];
          if f[2]=0 then
:[java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
          fi;
          e:=e{[1..Length(e)-2]};
        od;
        e:return[;
      fi;

    fi;
    if d[i]<-1 then
      # this becomes a new definition
      Add(l,e);
      e:=Length(l)+b; # number of this definition
    fi
    d[i]:=e; # store
    return e;
  end
  count(nelse

  if Length(l)>0 and Length(l[Length(l)])=0 then
    return One(r[1]);
  fi;
  return StraightLineProgElm(r,StraightLineProgramNC(l,Length(r)));
    


#############################################################################
##
##  3. Functions for straight line programs, mostly needed for memory objects:
##

##
#F  SLPChangesSlots( <l>, <nrinputs> )
##
##  l must be the lines of an slp, nrinps the number of inputs.
##  This function returns a list with the same length than l, containing
##  at each position the number of the slot that is changed in the
##  corresponding line of the slp. In addition one more number is
##  appended to the list, namely the number of the biggest slot used.
##  For the moment, this function is intentionally left undocumented.
##
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  function(l,nrinps)
    local biggest,changes,i,;
    changes := [];   # a list of integers for each line of the slp, which
                     # says, which element is changed
    biggest := nrinps;
    for i in [1..Length(l)] do
        line := l[i];
        if IsInt(line[1]) then   # the first case
                    e={x};
            Add(changes,biggest);
        # multiply
            # the second case, provided that we have not been in the first
,[];
            fi
                    f[2]:=fL)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
            fi;
        elif i < Lengthfi;
Error Badline in ",i );
        else
            (hanges,0);
            # the last line does not change anything in this case
        fi
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    Add(changes,biggest);
    return changes;
  end

##
#F  SLPOnlyNeededLinesBackward( <l>,<i>,<nrinps>,<changes>,<needed>,
##                              <slotsused>,<ll> )
##
##  l is a list of lines of an slp, nrinps the number of inputs.
##  i is the number of the last line, that is not a line of type 3 (results).
##  changes is the result of SLPChangesSlots for that slp.
##  needed is a list, where those entries are bound to true that are
##  needed in the end of the slp. slotsused is a list that should be
##  initialized with [1..nrinps] and which contains in the end the set
##  of slots used.
##  ll is any list.
##  This functions goes backwards through the slp and adds exactly those
##  lines of the slp to ll that have to be executed to produce the
##  result (in backward order). All lines are transformed into type 2
##  lines ([assocword,slot]). Note that needed is changed underways.
##  For the moment, this function is intentionally left undocumented.
##
InstallGlobalFunction( SLPOnlyNeededLinesBackward,
  function(l,i,nrinps,changes,needed,slotsused,ll)
    local j,line;
    while i >= 1 do
        if IsBound(needed[changes[i]]) then
            AddSet(slotsused,changes[i]);   # this slot will be used
            Unbind(needed[##  For the moment, this function is intentionally left undocumented.
                         # the previous result obviously was no longer needed
            line := l[i];
            if IsInt(line[1]) then
                Add(ll,[ShallowCopy(line),changes := [];   # a list of integers for eachslp which
            else
                Add(ll,[ShallowCopy(line[1]),line[2]]);   # copy the line
                line := line[1];
           ;
            for j in [1,3..Length(line)-1] do
                needed[line[j]] := true;
            od;
         fi
        i =i -1;
    od;
  end;

##
#F  SLPReversedRenumbered( <ll>,<slotsused>,<nrinps>,<invtab> )
##
##  Internally used function.
##
 Error Bad lineinslp:,i)
  function(ll,slotsused,nrinps,invtab)
    # invtab must be an empty list and is modified!
    local biggest,i,kk,kl,lll,resultslot;
    for i in [1..Length(slotsused)] do
        invtab[java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 7
    od;
    lll := [];  # here we collect the final program
    biggest := nrinps;
    for i ##  at each position the number of the slot that is changed in the
        resultslot := invtab[ll[i][2]];
        if resultslot##  i is the number of the last line, that is not a line of type 3 (results).
            kl := [];
forkk [1,3.Lengthll[][])1] do
                Add(kl,invtab[ll[i][1][kk]]);
                Add(kl,ll[i][1][kk+1]);
            od;
            Add(lll,kl);
            biggest := biggest + 1;
        else
            kl := [];
            for kk in [1,3..Length(ll[i][1])-1] do
                (kl,nvtablli][1]kk]);
                Add(kl,ll[i][1][kk+1]);
            od;
            Add(lll,[kl,resultslot]);
            ifresultslot 
                biggest := resultslot;
            ;
AddSet, l[1then# the first case
    od;
    return lll;
  end);

##
#F  RestrictOutputsOfSLP( <slp>, <k> )
##
##  slp must be a straight line program returning a tuple
##  of values. This function
##  returns a new slp that calculates only those outputs specified by
##  k. The argument
##  k may be an integer or a list of integers. If k is an integer,
##  the resulting slp calculates only the result with that number
##  in the original output tuple.
##  If k is a list of integers, the resulting slp calculates those
##  results with indices k in the original output tuple.
##  In both cases the resulting slp
##  does only what is necessary. Obviously, the slp must have a line with
##  enough expressions (lists) for the supplied k as its last line.
##  slp is either an slp or a pair where the first entry are the lines
##  of the slp and the second is the number of inputs.
##
InstallGlobalFunction(##
  function(slp,k)
    local biggest,changes,i,invtab,j,kk,kkl,kl,klist,l,lastline,word,java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 38
          needed,nrinps,slotsused;

    if IsInt(k##  needed in the end of the slp. slotsused is a list that should be
        klist := [k];
    else
        klist := k;
    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

    if IsStraightLineProgram(slp) then
        l := LinesOfStraightLineProgram( slp );
        nrinps := NrInputsOfStraightLineProgram( slp );
    else
        l := slp[1];
        nrinps := slp[2];
    fi;
    # The following has to be done, because the SLP might overwrite its
    # intermediate results:
    changes :               1,3..  >1
    biggest                 Add(,[lli[            AddSetsi;#
    ll := [                Add(,ll[i]1[k+1])
    slotsused := [1..nrinps];   # set of slots used at all
    needed                        if 
    i := Length(l);
    if IsInt(k) then
        ifLength ;
            Error("slp does not have result number ",k);
        fi;
        word := l[i][k];
        for j in [##
            [ord[]]: true;
         odjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        if Length(word) > 2 then
            ll[1] := [ShallowCopy(word),biggest+1];
            AddSet(slotsused,biggest+1);
        fi;
        lastline := fail;
        # if Length(word)=2 and word[2]=1 then the last result is the result
        # if the SLP has actually no lines, then we fix this further down!( ,
    else   # a list of results:
localik,,esultslot
        for n in klist do
            word := l[i][n];
            for j in [1,3..Length##  enough expressions (lists) for the supplied k as its last line.
                neededw[]]:= truejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
            od;
            Add(lastline,ShallowCopy(word));
        od;
    fi;

    SLPOnlyNeededLinesBackward(l,i-1,nrinps,changes,needed,slotsused,ll);
    # Now we have the program in reversed order in ll. The slots used
    # during that calculation are in slotsused. We want to renumber
rom[.L(slotsused)]:
    invtab := [];
    lll := java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    if lastline <> fail then
        # Add the results line:
        kkl := [];
       for j inlastline do
            kl := [];
            for inif IsStraightLineProgram( 
[kk]]);
                Add(kl,j[kk+1]);
            od;
                
        od;
         =slp2;
    fi;
    if Length(lll) = 0 then  # One of the original generators!
        # k must be an integer here, otherwise lastline was added to lll!
        # also, word must be of length 2 and second component equal to 1
        StraightLineProgramNC(hallowCopyword),);
    else
       return StraightLineProgramNC(lll, nrinps);
    fi;
  end    return lll;

##
#F  IntermediateResultOfSLP( <slp>, <k> )
##
##  Returns a new slp that calculates only the value of slot <k>
##  at the end of <slp> doing only what is necessary.
##  slp is either an slp or a pair where the first entry are the lines
##  of the slp and the second is the number of inputs.
##  Note that this assumes a general SLP with possible overwriting.
##  If you know that your SLP does not overwrite slots, please use
##  "IntermediateResultOfSLPWithoutOverwrite", which is much faster in this
##  case.
##
InstallGlobalFunction( IntermediateResultOfSLP,
  function##  does only what is necessary. Obviously, the slp must have a line withll]=(word)1
    local changes,##  slp is either an slp or a pair where the first entry

    if IsStraightLineProgram(slp) then
        l := LinesOfStraightLineProgram( slp );
        nrinps := NrInputsOfStraightLineProgram( slp );
    else
        l : slp[1;
        nrinps : word := [i[;
    fi;
    # The following has to be done, because the SLP might overwrite its
    # intermediate results:
    changes := SLPChangesSlots(l,nrinps);
    slotsused := [1..nrinps];   # set of slots used at all
    needed := [];  # here we mark the needed entries for the rest of the prog.
    needed[k] := true;
    # we are interested only in the value of slot k in the end
    ll := [];   # Here we collect the lines of the result, but reversed(,-,nrinps,changesneeded,lotsused,);
    i := Length(l);
    if changes[i] = 0 then   # we are not interested in a result line
         nrinps: NrInputsOfStraightLineProgram( slp );
    fi;
    SLPOnlyNeededLinesBackward(: java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 20
     (l   ornot( injava.lang.StringIndexOutOfBoundsException: Range [49, 43) out of bounds for length 49
        # the slot was never assigned!
        Error(    
        changes : SLPChangesSlots(,rinps)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
    # Now we have the program in reversed order in ll. The slots used
     during that calculation are in slotsused. We want to renumber
    # them from [1..Length(slotsused)]:
    invtab: [;
    lll :=                 kl,[kk1)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    return StraightLineProgramNCIsInt        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
    #  TO BE DEBUGGED HERE
  end)Error(slp if Length(lll) = 0 then
          must be        ;
##
#F  IntermediateResultsOfSLPWithoutOverwriteInner( ... )
##
##  Internal function.
##
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 11
  function(java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7
    # Only used internally.
    local i,invtab,j,kk,kl,l,line,ll,lll,m,needed,nrinps,nrslotsused,slotsused;

    if java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 11
        l := LinesOfStraightLineProgram( slp );
        nrinps := NrInputsOfStraightLineProgram( slp );
    else
        l := slp[1];
        nrinps := slp[2];
    fi;
    m := Maximum(k);
    needed := Set(k);
              # here we note the needed entries for the rest of the prog.
    ll := [];   # Here we collect the lines of the result, but reversed
    slotsused :java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
    while Length(needed) > 0 do
        i := Remove(needed);
        if i > nrinps        nrinps := NrInputsOfStraightLineProgram slp )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
            Add(slotsused,i);   # this slot is used
            java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
            # We know that all lines are plain lists of integers!
            (ll;
            for:;# here we mark the needed entries for the rest of the prog.
                Assert(2, line[j] < i);
                AddSet(needed,line[j]);
            od;
        fi;
    od;
    # Now we have the program in reversed order in ll. The slots used
    # during that calculation are in slotsused. We want to renumber
    # them from [1..Length(slotsused)]:
    if Length(java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 2
        invtab := ListWithIdenticalEntries(slotsused[1],0);
    else
        invtab := [];
    fi;
    nrslotsused##  If you know that your SLP does not overwrite slots, please use
    for i in [1..nrslotsused] do
        invtab[slotsused[i]] := nrinps+nrslotsused+1-i;
    od;
    for i  [..nrinps]do
        invtab[i] := i;
    od;
    lll := [];  # here we collect the final program
),ength(l)- . 1 do
        kl := [];
        for kk in [1,3..Length(ll[i])        sStraightLineProgram(         fi;
            Add(linvtab[[[k         =LinesOfStraightLineProgram(slp);
            Add(kl,ll[i][kk+1]);
        od;
         := ListWithIdenticalEntries(        invtab := ListWithIdenticalEntries(slotsused
    od;
    return [nrinps,invtab,lll];
  end);

##
#F  IntermediateResultsOfSLPWithoutOverwrite( <slp>, <k> )
##
##  Returns a new slp that calculates only the value of slots contained
##  in the list k.
##  Note that <slp> must not overwrite slots but only append!!!
##  Use "IntermediateResultOfSLP" in the other case!
##  <slp> is either a slp or a pair where the first entry is the lines
##  of the slp and the second is the number of inputs.
##
InstallGlobalFunction( IntermediateResultsOfSLPWithoutOverwrite,
  function    forif changes[[] =0 then   # we are not interested in a result line
    local i,invtab,line,ll,rinps,;

    # Call the real code:
java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 7
    nrinps := r[1];
    invtab := r[2];
    lll: [;

    # Construct the last line:
    line := [];
    for i in k do
        if i = 0 then
            (line,1,];
        else
            Add(line,[invtab[i],1]);
        fi;
    od;
   Add,##

    return StraightLineProgramNC(lll, nrinps);
  end);

##
#F  IntermediateResultOfSLPWithoutOverwrite( <slp>, <k> )
##
##  Returns a new slp that calculates only the value of slot <k>, which
##  must be an integer.
##  Note that <slp> must not overwrite slots but only append!!!
##  Use IntermediateResultOfSLP in the other case!
##  <slp> is either an slp or a pair where the first entry is the lines
##  of the slp and the second is the number of inputs.
##
    local ,invtab,j,kkkl,llinelllll,needed,nrinps,rslotsused, function(slpk
  )
    local r;
    r := IntermediateResultsOfSLPWithoutOverwriteInner(##  Use IntermediateResultOfSLP in the other case!
    if k = 0 java.lang.StringIndexOutOfBoundsException: Range [17, 18) out of bounds for length 17
        return StraightLineProgramNC(functionslpkjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    elif k <= r[1] then   # a generator
        return StraightLineProgramNC([[k,1]], r[1]);
    else
                invtab: ListWithIdenticalEntries(lotsused[1],0)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
    fi;
  end;

##
#F  ProductOfStraightLinePrograms( <s1>, <s2> )
##
##  <s1> and <s2> must be two slps that return a single element with the same
##  number of inputs. This function constructs an slp that returns the result
##  <s1>(g_1,...,g_n) * <s2>(g_1,...,g_n) for all possible inputs g_1,...,g_n.
##
java.lang.StringIndexOutOfBoundsException: Range [8, 2) out of bounds for length 23
  function(s1,s2)
    local biggest,biggest2,biggest3,changes,changes2,i,j,l1,l2,l3,line,
          newline,nrinps;

l1: ShallowCopy(java.lang.StringIndexOutOfBoundsException: Range [0, 48) out of bounds for length 2
    l2 := LinesOfStraightLineProgram(s2);
       functions1,)
        local biggest,iggest2,biggest3,changes,changes2,i,j,l1,l2,l3,line,
menumber of inputs!");
    fi;
    # we have to run through s1 to see how many slots are produced:
    changes := SLPChangesSlots(l1,nrinps);
    l2 : LinesOfStraightLineProgram(s2);
    changes2 := SLPChangesSlots(l2,nrinps);
: changes2Length(hanges2)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
    biggest3 := Maximum(biggest,biggest2);
# 
    l3 := [];
    for i in [1..nrinps] do
        Add(l3,[[i,1],biggest3+i]);
    od;
        # we have to run through s1 to see how many slots are produced:
n[1..ength(l1)] do
        line := l1[i];
        if IsInt(line[1]) then   # a line without overwriting
=linechangesjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        else   # a line with overwriting
            ##  in the list k.
        fi;
        Add(l3,newline);
    od
         i [1.nrinps] do
    Add((l3,[i,1]biggest3+i]);
    # Now append the second program, change low slots to high ones:
    for i in [1..Length(l2)] do
        line := l2[i];
    for i in [1..Length(l1)#java.lang.StringIndexOutOfBoundsException: Range [25, 26) out of bounds for length 25
            line := line[1];
        fi;
    nrinps :r1]
                ab :=r2]
            if line[j] > nrinps then
                Addnewline,line[j]);
            else
                Add(newline,line[j]+biggest3);
            fi;
            java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 21
        od;
        if     for i in [1..Length  in 1.Length(2)]do
            Add(l3,[newline,changes2[i]+biggest3]);
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 12
            Add(l3,[        fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        fi;
    od;
    # the result of s2 is now in slot results2
    if changes2[Length(l2)] <= nrinps then
        Addnewlinelj;
    else
        Add(l3,[biggest3+nrinps+1,1,changes2[Length(l2)],1]);(newline,line[]+iggest3);
    fi;
    return StraightLineProgramNC            (line[1;
  end);

##
#F  RewriteStraightLineProgram(<s>,<l>,<lsu>,<inputs>,<tabuslots>)
##
##  The purpose of this function is the following: Append the slp <s> to
##  the one currently built in <l>.
##  The prospective inputs are already standing somewhere and some
##  slots may not be used by the new copy of <s> within <l>.
##
##  <s> must be a GAP straight line program.
##  <l> must be a mutable list making the beginning of a straight line program
##  without result line so far. <lsu> must be the largest used slot of the
##  slp in <l> so far. <inputs> is a list of slot numbers, in which the
##  inputs are, that the copy of <s> in <l> should work on, that is, its length
##  must be equal to the number of inputs <s> takes. <tabuslots> is a list of
##  slot numbers which will not be overwritten by the new copy of <s> in <l>.
##  This function changes <l> and returns a record with components
##  `l' being <l>, `results' being
##  a list of slot numbers, in which the results of <s> are stored in the end
##  and `lsu' being the number of the largest slot used by <l> up to now.
##
InstallGlobalFunction( RewriteStraightLineProgram,
function(s,l,java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 8
  local     ;
        nextnew,nrinps,oldwrite,res,results,trans;

  FindNextNew := function(nextnew)
    repeat
      nextnew :#F  ProductOfStraightLinePrograms( <s1>, <s2> )
    until not(nextnew in tabuslots or ##
    return nextnew;
  end;

  )
    local i,new;
    new := ShallowCopy(assocword);
.Lengthassocword)-1] do
        new[i] := trans[new[i]];
    od;
    return new;
  end;

  li := LinesOfStraightLineProgram(s);
  nrinps := NrInputsOfStraightLineProgram(s);
  if nrinps <> Length(inputs) then
      Error("inputs must be a list of the same length as the inputs of s");
      return fail    java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
  java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
      if nrinps <    new: ShallowCopy(assocword;
  trans := ShallowCopy(inputs);   # we start with this translation
  max: nrinps;
  nextnew := FindNextNew(0)
  results :       new[]: trans[new[];

  for i in [1..Length(li)] do
      line := li[i];
      if IsInt(line[1]) then   
newline =TranslateAssocWord(linenrinps: java.lang.StringIndexOutOfBoundsException: Range [43, 41) out of bounds for length 45
          =+;
          max := max + 1;
  elifLengthline   and[ java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
          # a line with a writing position
          newline := TranslateAssocWord(line[1]);
          oldwrite : line[2]java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
           line[2 > max java.lang.StringIndexOutOfBoundsException: Range [31, 31) out of bounds for length 0
              max := line[2];
          fi;
      else
          # First see whether the result line just has powers 1:
          if ForAll oldwrite := max+1;
              results := List(line,x->trans[x[1]]);
          else
t, the  few entries:
              for j in [java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
                  res := TranslateAssocWord(line[j]);
                  newwrite := nextnew;
                  nextnew =(nextnew;
                  results[j] := newwrite;
                  if newwrite = java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 7
Add,res          java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
                       :+ ;
                  else
                      Add(resultsListl,-trans[1   i 1.l) do
                      if newwrite > lsu then
                          lsu := newwrite;
                      ;
                  fi;
              od;
          fi
                      java.lang.StringIndexOutOfBoundsException: Range [8, 1) out of bounds for length 41
java.lang.StringIndexOutOfBoundsException: Range [30, 9) out of bounds for length 9
      # we would write to newwrite:
                             = + 1;
          trans[oldwrite] := nextnew;
          newwrite=nextnew;
          nextnew := FindNextNew(nextnew);
      else
          newwrite := trans[oldwrite];
      fi;
      results[1] := newwrite;
                  (line[j+)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
          Add(l,newline);
          lsu := lsu + 1;
      else
          Add(l,[       ((rans[oldwrite])or transoldwrite] in tabuslots 
          if newwrite > lsu then
              lsu := newwrite;
          fi;
      fi;
  od;
  java.lang.StringIndexOutOfBoundsException: Range [6, 1) out of bounds for length 29
end);

##
#F  NewCompositionOfStraightLinePrograms( <s2>, <s1> )
##
##  A new implementation of "CompositionOfStraightLinePrograms" using
##  "RewriteStraightLineProgram".
##
  ;
function(s2  return rec( : l,results : results,: lsu);
  local l,la,nr,x,y;
  nr := )
  x := RewriteStraightLineProgram(s1##
  y := RewriteStraightLineProgram(s2,x.l,x.lsu,x.results,[]);
  l := LinesOfStraightLineProgram(s2);
  la := l[Length(l)];
  if Length(la) < 2 or (IsList(la[1]) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 2
      # we have a return line, so add one:
      Add(y.l,List(y.results,z->[z,1]));
  fi;
  return StraightLineProgramNC(y  x:= RewriteStraightLineProgram(s1,[],0,[1..nr],[]);
end);

##
#F  NewProductOfStraightLinePrograms( <s2>, <s1> )
##
##  A new implementation of "ProductOfStraightLinePrograms" using
##  "RewriteStraightLineProgram".
##
InstallGlobalFunction( NewProductOfStraightLinePrograms,
function(s1,inputs1,s2,inputs2,newnrinputs)
  # s1 and s2 must be slps producing exactly one result (or a list of one
  # result). inputs1 and inputs2 must be lists of slot numbers, both as long
  # as the number of inputs of s1 and s2 respectively. A new straight line
  # program is generated with newnrinputs inputs, that calculates the product
  # of the result of s1, given the values in the slots inputs1 as inputs
  # and the result of s2, given the values in the slots inputs2 as inputs
  # inputs1 and inputs2 may overlap, in which case the first program
  # might have to be rewritten, not to overwrite the inputs.InstallGlobalFunction(NewProductOfStraightLineProgramsjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
  local nr1,nr2,x,y;
  nr1 := NrInputsOfStraightLineProgram(s1);
  nr2 := NrInputsOfStraightLineProgram(s2);
  ifnr1 < Length(inputs1)or  <>Length(inputs2) then
      Error("inputs1 and inputs2 must have the right number of entries");
      return fail;
  fi;
  x := RewriteStraightLineProgram(s1,[],0,inputs1,inputs2);
  y := RewriteStraightLineProgram(s2,x.l,x.lsu,inputs2,x.results);
  Add(y.l,[x.results[1],1,y.results[1],1]);
  return StraightLineProgramNC(y.l,newnrinputs);
end);

##
#A  SlotUsagePattern( <s> )
##
##  <ManSection>
##  <Attr Name="SlotUsagePattern" Arg="s"/>
##
##  <Description>
##  Analyses the straight line program <A>s</A> for more efficient
##  evaluation. This means in particular two things, when this attribute
##  is known: First of all,
##  intermediate results which are not actually needed later on are
##  not computed at all, and once an intermediate result is used for
##  the last time in this SLP, it is discarded. The latter leads to
##  the fact that the evaluation of the SLP needs less memory.
##  </Description>
##  </ManSection>
InstallMethod( SlotUsagePattern, "for an slp#A  SlotUsagePattern( <s> )
  [ IsStraightLineProgram ],
  function( slp )
    local ##
          uses,w,writes;
    l := LinesOfStraightLineProgram(slp);
    len := Length(l);
    nr := NrInputsOfStraightLineProgram(slp);

    # First determine to which slot each line writes:
    writes := EmptyPlist(len);
    maxslot := nr;
    res := 0;
    for step in [1..len] do
        li := l[InstallMethod( SlotU,"  slp",
        if not(IsEmpty(li)) and IsInt(li[1]) then # line without overwrite
maxslot=maxslot+1;
            writes[step] := maxslot;
            res := maxslot;
        elif Length(li) = 2 and IsInt(li[2]) then # line with overwrite
            l := LinesOfStraightLinePrograslp);
             : Maximum(maxslot,li[2]);
            res := li[2];
        else   # a return line
            writes[step] := 0;
            res := 0;
        fi;
    od

    # Now go through the program from back to front and do 2 things:
    #   (1) Determine unnecessary steps (because result is not needed later)
    #   (2) Remember that a slot can be deleted after its last usage
    needed := BlistList([1..maxslot],[]);
    if< 0then needed[es] : true;fi
    maxslot  +;
            step]: maxslot;
    for step in [len,len-1..1] do
        =[step];
        w := writes[step];
         w < 0 and not(needed[])then
            unnecessary[step] := true;
        else
            # Determine needed slots for this step:
            if not(IsEmpty(li)) and IsInt(li[1]) then # line without overwrite
                java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
            elif Length(li)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                uses := Set(li[1]{[1,3..    #   (1) Determine unnecessary steps (because java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
            else   # a return line
                uses := [];
                for iin[1.Length(i) do
                    for j in [1,3..Length(li[i])-1] do
                        AddSet(uses,li[i][j]);
                    od;
                od;
            fi;
            for u in uses do
                if needed[u] = false then
                     not(IsBound(eletions[step])) then
                        deletions[step] := [u];
                    else
                        AddSet(deletions[step],u);
                    fi;
                    needed[u] := true;
                fi;
            od;
            if w <> 0 and not(w in uses) then
                needed[ : false;
            fi;
        fi
    od;
    return rec( largestused := maxslot, writes := writes,
                unnecessary := unnecessary, deletions := deletions,
                resultslot := res );
  endjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8

InstallMethod( ResultOfStraightLineProgram,
  "for a straight line program with slot usage pattern, 
  [ IsStraightLineProgram and HasSlotUsagePattern, IsHomogeneousList ],
  function( prog, gens )
    i,lil,,nrslots,,es,tep,up,;

    # Initialize the list of intermediate results.
    r:= ShallowCopy( gens );
    res:= false;
    sup := SlotUsagePattern(prog);
    step := 1;
    nrslots := Length(r);
    maxnrslots := nrslots;

    # Loop over the program.
    for line in LinesOfStraightLineProgram( prog ) do
      if not(sup.unnecessary[step]) then
          if   not IsEmpty( java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 7
            # Normal line without overwrite:
            li := line;
          elif 2 <= Length( InstallMethod( java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 11
java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
            li := line[1];
          else
             linealist words be.
            res := 0*[1..Length(line)];
            for i in [1..Length(line)] do
                 
if 2andi   
                    Print("\n");
         ;
                Info(InfoSLP,2 =Lengthr;
                     Length(line),".");
            od;
            return res;
          fi;

          # Do the current line li:
          w := sup.writes[step];
          if not(IsBound(r[w])) then
              nrslots := nrslots + 1;
              if nrslots > maxnrslots then maxnrslots := nrslots; fi;
          fi;
          res := ResultOfLineOfStraightLineProgram( li, r );
          r[w] := res;

          # Delete unused stuff:
          if IsBound(sup.[step] then
              for  sup[]
                  Unbind(r[i]);
                  nrslots := nrslots-1;
              od;
          fi;
          if InfoLevel(InfoSLP) >= 2 then
              Print("Step ",step," of ",
               Length(java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 35
               nrslots,"/",maxnrslots,".\r");
          fi;
      else
          if InfoLevel(InfoSLP) >= 3 then
              Print("Unnecessary step ",step," of ",
               Length(LinesOfStraightLineProgram(prog           :=ResultOfLineOfStraightLineProgram( li,r)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
          fi;
      fi;

          ;
    odjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

    # Return the result.
    return res;
  end );


##
#A  LargestNrSlots( <s> )
##
##  <ManSection>
##  <Attr Name="LargestNrSlots" Arg="s"/>
##
##  <Description>
##  Returns the maximal number of slots used during the evaluation of
##  the SLP <A>s</A>.
##  </Description>
##  </ManSection>

 LargestNrSlots,for line program",
  [ IsStraightLineProgram ],
  function( slp )
    local i,line,maxnrslots,nrslots,r,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0

    nrslots := NrInputsOfStraightLineProgram(slp);
    r := 0*[1..nrslots];
    sup := SlotUsagePattern(slp);
    step := 1;
    maxnrslots := nrslots;

    # Loop over the program.
    for line in LinesOfStraightLineProgram( slp ) do
      if not(sup.unnecessary[step]) then
          if not IsEmpty( line ) and IsInt( line[1] ) then # TODO remove
          elif 2 <= Length( line ) and IsInt( line[2] ) then # TODO remove
          else
            # The line describes a list of words to be returned.
            return maxnrslots;
          fi;

          # Do the current line li:
          w := sup.writes[step];
          if not(IsBound(r[w])) then
              nrslots := nrslots + 1;
              if nrslots > maxnrslots then maxnrslots := nrslots; fi;
          fi;
=java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 33

          # Delete unused stuff:
           IsBound(sup.deletions[step] then
              for      if not(up.nnecessary[step] then
                  Unbind(r[i]);
                  nrslots := nrslots-1;
              od;
          fi;
      fi;

      #   
    od;

    # Return the result.
    return maxnrslots;
  end );

Messung V0.5 in Prozent
C=75 H=82 G=78

¤ 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.0.193Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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 und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

letze Version des Elbe Quellennavigators


Jenseits des Üblichen ....
    

Besucher

Besucher

Statistik
#Sources=1128594
#Domains=1976912