Eine aufbereitete Darstellung der Quelle

 
     
 
 
rahmenlose Ansicht  |   Verzeichnis aufwärts  |   Normalansicht  |   Mathematik  |   Moral  |   Übersicht  |   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
##
     java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 22
    java.lang.StringIndexOutOfBoundsException: Range [14, 1) out of bounds for length 60

      line                :0123456789java.lang.StringIndexOutOfBoundsException: Range [64, 63) out of bounds for length 73
    NewTypejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
              
                                   


#############################################################################
##
#F  StraightLineProgram( <lines>[, <nrgens>] )
#F  StraightLineProgram( <string>, <gens> )
#F  StraightLineProgramNC( <lines>[, <nrgens>] )
#F  StraightLineProgramNC( <string>, <gens> )
##
stallGlobalFunctionStraightLineProgramj=lenthen
    local result;
if    elif Length( arg ) (arg =then
    if     not IsStraightLineProgram{[  .len},script ) java.lang.StringIndexOutOfBoundsException: Range [70, 71) out of bounds for length 70
       or not                 j: Length script ) + Length( gens );
ObjectifyWithAtt( prog  ,[ [, 1, )java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 65
    else
    return result;
end );SetNrInputsOfStraightLineProgram( prog,java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0


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

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

    # Get the arguments.  +Lengthgens );
    if##
      ];
    functionstring,gens,                         {[ +1.  }gens   then
                          (rg[]  
      lines:= [];
      if java.lang.StringIndexOutOfBoundsException: Range [14, 1) out of bounds for length 17
        java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 17
      fi;
      :=Length( Add(script,[[ ,1,slen,1],java.lang.StringIndexOutOfBoundsException: Range [49, 15) out of bounds for length 15
    elif              '
      lines  :=fi;
      nrgens := arg[2];
    else
java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 0
    fi;

          ;
    ObjectifyWithAttributes( prog, StraightLineProgramsDefaultType,
                       ,lines ;
    if IsBound( nrgens ) and IsPosInt( nrgens ) then
      SetNrInputsOfStraightLineProgram )
    ;

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


        pos:= First( [ 1 .. len ], i -> string{ [ 1 .. i ] } in gens );
##
#F  StringToStraightLineProgram( <string>, <gens>, <script> )
##
InstallGlobalFunction( StringToStraightLineProgram,
    function( string, gens, script )
    local pos,
                  java.lang.StringIndexOutOfBoundsException: Range [72, 1) out of bounds for length 72
          len,
                  java.lang.StringIndexOutOfBoundsException: Range [0, 11) out of bounds for length 2
  ,
          sign,sign: ;
          slen,
          n
          i j;

    # If the string contains `*' signs then remove them.=-
    if
      string     localdefined    
    fijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

    # Split the string according to brackets `(' and `)'
    pos:= Position( string, '            pos: pos+;
     pos=failjava.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 22

#
      extrep: ;
       fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        :string[os len]}java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 od
        if pos local needed   ( )
              needed:= Difference(line{  1  .Length( line )- 1 ]}java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
        pos:= java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        if pos < len java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
p:= ;
          sign:= 1;
          pos:= pos + 1;
          if pos <=len and  defined)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 37
            sign:=
            pos:= pos + 1;
      fi;
                j:=        needed:=(java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 39
xinput needed;
            pos i
          fi;
          exp: sign * exp;
        else
          exp    # Inspect the lines.
        fi;
       Append( extrep java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
      ;

      if <>java.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 55
      
      ;
      return true;

    java.lang.StringIndexOutOfBoundsException: Range [11, 8) out of bounds for length 21

      # Split before the bracket.
      if not for i in [ 2 ..len
         [1. pos1  ,,cript )then
open: open+;
      fi;
      j:= Length( scriptelifstring )java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 22
      if java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
                 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        return false;
      fi;
      slen Length script )+
      if j < slen then
        Add(               jjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 23
      fi;
      return truejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    

      # Find the corresponding closing bracket.
      open:= 0
:(                j:= j +
      forifjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
                  java.lang.StringIndexOutOfBoundsException: Range [23, 22) out of bounds for length 29
          openslen=;
        elif string[i] = ')' then
               newjava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
                          j= 
          else

            # The bracket may be powered or be multiplied.
     ]

  exp=0java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
              =+;
              sign:= 1;
                              j:  )+ gens)
                :=-1java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                j:= j+1;
              fi    r:=ShallowCopy gens
              ( string[j])do
                exp:= 10 *                         string{ [ 2.i-   respos:;
                :j+1;
              od;
               not(
                         string [2 ..i- ] } gens, script )then
                return false;
              fi;
              slen:= Length( script ) + Length( gens ) + 1;
Add script,[[slen  1,sign *exp ,  ] ;
              if j <= len then
                      elif 2 <= Lefi
                                         :() (ensjava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
                   falsejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
                fi;
j ()Lengthgens ;
                
              fi

            else

              if not StringToStraightLineProgram(
                               java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
                return
              fi;
                  return r[ r ]
      if StringToStraightLineProgram(
                         string{ [ i+1 .. len ] }, gens, script ) then
                return false;
              fi;
              slen:= Length(#M  Display( <prog> )
              if j#
                Add java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 30
              fi;
            fi;
                        

    end ;
        fi;
      od;
       java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19

    fi;
end )


#############################################################################
##
#M  NrInputsOfStraightLineProgram( <prog> )
##
##  If no lines of type 1. occur then the number of generators can be
##  read off from the lines;
##  it is equal to the maximum of positions such that in a step of the
##  program the entry is accessed but the position has not been assigned
##  before.
##
od NrInputsOfStraightLineProgram
    "or java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    [ if IsBoundgensnames ) then
 java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

    local  if not IsEmpty needed )
          maxinput,   current maximum of input neededi>( "g",String  )         ifmaxinput <needed then
          lines      # lines of `prog'
          
           endjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
          ,      # one line of the program
          i j;# loop over the java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    defined:= [];
    maxinput:= 0;
    lines:= LinesOfStraightLineProgramif ForAll(line, IsInt )thenfor j in[2 4 . Length(line )2]do
    len:= Length( lines );

     function  )
      local needed;
      needed:= Difference(          (java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
                           defined );
 )then
        needed:= MaximumList( needed );
        if maxinput < java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 22
          maxinput:= needed;
        fi;
      fi;
    end;

    # Inspect the lines.
    od;

      line:= lines[i];
      if ForAll( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        if i = len     (" input:n");
          adjust( line );
        else
          ##
        fi;

      elif Length( line ) =( ResultOfLineOfStraightLineProgram",

        java.lang.StringIndexOutOfBoundsException: Range [26, 15) out of bounds for length 26
        AddSet( defined, line[2] );

      eliflenfor in46 .(line  java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42

        for j in line do
          adjust(else


      fi;

  java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 7

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


#############################################################################
##
#M  ResultOfStraightLineProgram( <prog>, <gens> )
##
BindGlobal "esultOfLineOfStraightLineProgram",
    function(line r )

    local          respos,    position of the current intermediate result of `prog'

    new:=r[line[] ;
    if linejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      new=new^^line[2;
    fi;
    for i in [ 4, 6 .. Length( linelen: len  1
      if line[i] = 1 then
new=new *[line[ i1]]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
      else
        new=new    notIsEmpty )and java.lang.StringIndexOutOfBoundsException: Range [42, 40) out of bounds for length 56
      fi;
    od
    return new;
end )        Add(r ResultOfLineOfStraightLineProgram(         : (line ;

        for [1.len 1]
    "for       elif =  )  IsInt java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 24
    [ IsStraightLineProgram,         r[line[2]]:=ResultOfLineOfStraightLineProgram  len ] )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
    function

    r         
          respos,    # position of the current intermediate result of `prog'
          line;      # loop over the lines

    # Initialize the list of intermediate results.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 2

    # Loop over the program.##
    for line          

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

        # The line describes a word to be appended.
        Addjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 19
        respos 

 2 ( IsInt] java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56

        # The line describes a word that shall replace.
        r[ line    ;
        respos:= line[       java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31

      else

        # The line describes a list of words to be returned.          linesjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
              ;

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

          =recordgensnames;

    # Return the result.      gensnames       ( )
    return r    java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    end )java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10


#############################################################################
##
#M  Display( <prog> )
#M  Display( <prog>, <record> )
##
  i   ;
    "for
    java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
    function       not IsList      2   java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 46
    ( ( ;
    end );

java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0
  f astraight  ,anda "java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    [ IsStraightLineProgram, IsRecord        if not         fi;
    ( prog,record )
mes,
          listname,
          PrintLinefi;
        AddSet( defined       0< 
          lines,
          len,
line,
jjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12

    # Get and check the arguments.
    if
      gensnames:= record.gensnames        if not (     Print( "# input:\n" );
    else
      gensnames:=List  1 .  NrInputsOfStraightLineProgram  ) ]
fi
    ;
          1 ;
      listname:= java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 7
            (  java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 r
    fi;

    java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 33
               (,java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 40
or
 r" [j1] ]java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        line]>1 
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        Print( "*" )java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      od;
      = ############################################################################
      0   
java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
       linej    ajava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 34
          Print( "^",     java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11

    len:len +1java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

    # Print the initialisation.
     "n )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
:= [";
    if not IsEmpty( gensnames )   ;
      Print( gensnames
    fi;
                  len
     (",[#
    od;
";")

 java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 26
:  ;
    len    end )          (line[len ] );
        Print
     iin [      

      line:= lines[i];
      if   Length( java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 9
                              andjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 0
        PrintLine( line[1] );
        Print( ";\n" );
f   2] i=java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 52
          len:= , .  
        fi;

      elif not IsEmpty(          ,

        len:= len + 1;
 Print("[ len, ]=  )java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
        PrintLine(line )
        ("\");

      elif ForAll        ;

         values\[")
        : Length      =NrInputsOfStraightLineProgram)
        for j  [ 1  . len -1  
         l[j java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
          Print , " ;
        od;
        if0<len 
          PrintLine if   2< 0
        fi;
        Print( " ]\java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
        return;

      fi;

    od

 value\[,len,"\ ;
    end );


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

    local lines,
          ,
          defined,
          testline,
          lenifLength(arg)=2and IsStraightLineProgram [] )
          i,
          line;

    lines:= LinesOfStraightLineProgram( prog
    ifnot ( lines )or java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
alsejava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
    fi;

    if HasNrInputsOfStraightLineProgram( prog ) then
      nrgens:= NrInputsOfStraightLineProgramelif  )=          return falsejava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
      : [  .nrgens ;
    else
      defined:= [];
    fi;

    testline:= function( line         if not  (line) (line[1, ))then
      local java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 11

       external          return false
      len:=Length( line);
      if len mod 2 <> 0 then
        return false;
      fi;

      # and the generator numbers are stored at odd positions.
      gens:= line{ [ 1, 3 . 1 ]}java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
      if not ForAll(        return ForAll( ,testline )
        return false;
      fi;

      # If the number of generators is stored then check
      # that only defined positions are accessed.
      returnod;
    end;

    len: Length(lines)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
    for i in [ 1 .. len ] do

      line:= lines[i];

      if   not IsList( line ) then

        java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 21

      elif (line   ForAll(line,  )then

        if not testline( line ) or ( i < len and not IsBound(            ( prog));
          return false;
        fi;
        AddSet(defined Length( defined ) + 1 );

      elif Length( line ) = 2         a[ respos ]  )

        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          return false;
        fi;
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          return false;
       fi;
             IsStraightLineProgram ,

      elif i=len                               java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
                                          and ForAll( x, IsInt ) ) then

        return ForAll( line, testline );

      else

        # The syntax of the line is not correct.
        return false;

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

    od;

    return true;
    end );


#############################################################################
##
#M  PrintObj( <prog> )
##
InstallMethod( PrintObj,
    "for a straight         not java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
    [ IsStraightLineProgram  java.lang.StringIndexOutOfBoundsException: Range [0, 10) out of bounds for length 7
    function( prog )
    Print( "traightLineProgram(         if not java.lang.StringIndexOutOfBoundsException: Range [29, 23) out of bounds for length 43
           LinesOfStraightLineProgram(end );
    if HasNrInputsOfStraightLineProgram
      Print
    fi;
    Print            { )java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 10


#############################################################################
##
#M  ViewObj( <prog> )
##
(ViewObj,
    "for
    [ IsStraightLineProgram ],
    function( prog )
    Print( "<straight line    local lines, ,lastline, inp2, max, i, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    end );


#############################################################################
##
#F  StringOfResultOfStraightLineProgram( <prog>, <gensnames>[, \"LaTeX\"] )
##
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
    function(

    local newjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    new:      =false;
    java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
     java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 9
        Append( new, r[ line[ i-1 ] ] );
     
        if not isatomic[ line[ i-1 ] ] then
          Add( new, '(' );
        fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        Append( new, r[ line[ i-1 ] ] );
        if not isatomic[ java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 25
          Add( new, 'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        ror("      Error( "usage
^)
        if LaTeX then
          Add( new, '{' );
              Unbijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        Append( new, String( line[i] )  fori in lastlinensnames )java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
        if LaTeX then
          Add( new, '}' );
        fi
      fi line in (   do
    od;
    return ;
end );

( StringOfResultOfStraightLineProgram, function( arg )

    local                     ,a, ))java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
          gensnames,        a[ respos]=false;
          LaTeX,
          r,
          
          if inp2  java.lang.StringIndexOutOfBoundsException: Range [23, 24) out of bounds for length 23
          line,
          result,
          l        [java.lang.StringIndexOutOfBoundsException: Range [19, 17) out of bounds for length 28

    # Get and check the arguments.
    java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 22
                           and IsList( arg[2]          ]> java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32

      prog:= arg[1];
      gensnames:= arg[2];
            LaTeX

    elif Length( arg ) = 3 and IsStraightLineProgram( java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 27
                           java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
                           and IsString( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                            java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 34

      : ]
      gensnames:= arg[2];


    else
      Error#F  java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
             <>,"\  java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
    fi (  ,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

#java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    r:= ShallowCopy( )
    a:= ListWithIdenticalEntries( java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 27
    java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 19

    # Loop over the program.
    for line in LinesOfStraightLineProgram( prog ) do

      if   not IsEmpty(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

        # The line describes a word to be appended.
        Add( r, java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 2
                    r, a, LaTeX ) );
        respos:##  If a program overwrites some of the original generators then we first
max=

                = ;

        # The line describes a word that shall replace.
=2];
r :  n,          # number of inputs of all in `listofprogs
                          r, a, LaTeX );
        a[ respos ]:= false;

      else

        # The line describes a list of words to be returned.Add ,    ,          ,java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
        result:= "
        for l  do
          Appendj; utputsjava.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 74
                  java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 22
                       Length           java.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 32
,"java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
        od;
        if"java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 43
          Remove  ifjava.lang.StringIndexOutOfBoundsException: Range [21, 19) out of bounds for length 32
                   Remove(result );
        fi;
        Append( result, " ]" );
        return result;

      fi;

    od;

    return r[ respos ];
end );


#############################################################################
##
#F  CompositionOfStraightLinePrograms( <prog2>, <prog1> )
##
    # Append the lines of `prog2'.
    java.lang.StringIndexOutOfBoundsException: Range [28, 12) out of bounds for length 28

        for lineproglines= prog ;

    lines:= ShallowCopy( LinesOfStraightLineProgram( prog1 ) );
    len: Length(lines );
    lastline:= lines[ len ];
    : NrInputsOfStraightLineProgram );

    if ForAll( lastline, IsList ) then

      # Check that the programs fit together.
      shiftgens: falsejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 inputs <>");
      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:= NrInputsOfStraightLineProgram( prog1 );
      for i in[       Append , List [ .n]  >  i 1 ] i+offset ]  )
        if IsList( lines[i][1] ) then
          max     
        else
          max:= max + 1;
        fi;
      od;
      Unbind( java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 9
      pos:= max;
      for i in lastline do
        max:= max + 1;
        Addlines, [i max ]);
      od;
      for i in [ 1 .. Length( lastline )##  copy the generators.
    Add lines [[pos +ijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      od;

    else

# java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
> 1 then
        Error( "outputs of <prog1>results    # results line of the result program
      ;

      if Length( lastline ) = 2 and IsList( lastline[1] ) then

        # The last line is a pair of the external representation of an assoc.
#
        # Copy the word to position 1 if necessary.
        if lastline[2] <> 1 then
          Add( lines, [ [ lastline[2], 1 ], 1 ] );
        fi;

      else

 The  line  externalrepresentation  anassoc.word.
        # Store it at position 1.
[ Length(ogs>ustbenonempty  ,

      fi;

    fi    : NrInputsOfStraightLineProgram [1])

    # Append the lines of `prog2'.
    # (Rewrite lines of type 1.)
    max= ;
    for line in LinesOfStraightLineProgram( prog2 ) do
      if ForAll( line, IsList ) then
 Add lines,line )
            fi
        max:= max + 1; of lines,the  line,and  offset.
        Add( lines, [ line, max ] );
      else
     Loop over the programs, and add the results to `results'.
        , line );
      fi;
    od;

    # Construct and return the new program.
     #
                                  NrInputsOfStraightLineProgram( prog1 ) );
    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.
##
    (lines    .(  )-  
    function( listofprogs )

    local n,          # number of inputs of all in `listofprogs'
          lines,      # list of lines of the result program        offset:= offset - n;
          results,    # results line of the result program
          nextoffset, # maximal position used up to now
          prog         over `'
           proglines,  # list of lines of `prog'
          offset,     # maximal position used before the current program
          shiftgens,
          i,line,    # loop over `proglines'
          newline,    # line with shifted source positions
          ;# loop over the odd positions in `newline'

    # Check the input.
    if    not           # (Increase
       newline=ShallowCopy  )java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
       or not ForAll( listofprogs,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      Error( "<listofprogs> must be a nonempty list ",
             "of straight line programs" );
    fi;          od
    n:= NrInputsOfStraightLineProgram( 
    if not ForAll( listofprogs,
                   prog ->#M  StraightLineProgElmType(<fam>)
      Error( "all2 (  IsIntjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    fi

#
]java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
    results:= [];
    sr:=rec(seeds:=eeds)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

   ((java.lang.StringIndexOutOfBoundsException: Range [53, 52) out of bounds for length 75
            =java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 52

      proglines:= LinesOfStraightLineProgram( prog );

            # Set the positions used up to here.
      offset= nextoffset;

      # If necessary protect the original generators from being replaced,
      # and work with a shifted copy.
      shiftgens:= false
       ForAny   >Length ) 2
            and IsList(line[1]
                                    and line[2] in [ 1 .. n ] ) java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 43
        Append( lines, List( [ 1 .. n ], i -> [ [                  n j java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
        nextoffset;
shiftgens: ;
                (   ;
        offset:= java.lang.StringIndexOutOfBoundsException: Range [0, 23) out of bounds for length 5
      fi;

      # Loop over the program.
      for ijava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 0

        line:= proglines[iPrint")java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13

        if   not IsEmpty(     # Construct and return the new program.

          # The line describes a word to be appended.
          # (Increase the positions by `offset'.)
          
##  2. Functions for elements represented by straight line programs#############################################################################
            if shiftgens #M  OneOp(<slpel>)
              newline[j]:= newlineInstallMethod(OneOp,straight line program #################################
            fi;
          odjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
          if(FamilyObj(slp)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
            
          else
            Add( lines, newline )#
            nextoffset:= nextoffset + 1;
          fi;

        elif ##

          # The line describes a word that shall replace.
          ,(prog
          localjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
          for j in [ 1, 3 .. Length( java.lang.StringIndexOutOfBoundsException: Range [0, 44) out of bounds for length 0
            if shiftgens or  
                  sr:=rec(seeds:rec(eeds:=eeds);
            fi;
          od;  fi;
          if i = Length(return Objectify(traightLineProgElmTypejava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 0
            Add
          else
            newline:= [ newline, line[2] + offset ];
            Add( lines, ##
            if  [IsStraightLineProgElm]0,nverseSLPElm);
              java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0
            fijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
          fi;

        else

          # The line describes a list of words to be returned.
          line:= List( line, ShallowCopy );
          for newline in line do
            for j in [ 1, 3 .. Length( newline )-1 ##
              if shiftgens or n < newline[j] then
                newline[j]:= newline[j] + offset;
              fi;
            od;
          od;
          Append( results, line );

        fi;

      od;

    od;

 Add the results  line.
Add lines,resultsend;

    # Construct and return the new program.
   return StraightLineProgramNC lines, n )java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
    end );


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


#############################################################################
##
#M  StraightLineProgElmType(<fam>)
##
""true[],0,
function(fam)
  if IsOnereturn;fi
;

#############################################################################
  Print(">");
#F  StraightLineProgElm(<seed>,<prog>)
##
InstallGlobalFunction(StraightLineProgElm,BindGlobal""function,#
local sr;

  if IsRecord(seeds) java.lang.StringIndexOutOfBoundsException: Range [0, 25) out of bounds for length 2
    sr:=seeds;
    seeds:sr.
  else
    sr:=rec(seeds:=seeds);
  fi
  return Objectify(StraightLineProgElmType(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 5
end);

#############################################################################
##
#F  EvalStraightLineProgElm(<slpel>)
##
InstallGlobalFunction(EvalStraightLineProgElm,# an SLP.
  return ResultOfStraightLineProgram(slp![2],slp![1].seeds);
end);

#############################################################################
##
#F  StraightLineProgGens(<gens>)
##
InstallGlobalFunction      laa,lba,  # last entries absolute
local gens,sgens,seed;
  gens:=arg[1];
  sgens:=Set(gens);
  :recs:sgens);
  if Length(arg)>1 and end )
    seed.base:=arg[2];
  fi;
  return List([1..Length# -- so we must duplicate the installation here as well
StraightLineProgramNCjava.lang.StringIndexOutOfBoundsException: Range [26, 23) out of bounds for length 23
end);      

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

#############################################################################
##
#M  OneOp(<slpel>)
##
InstallMethod(function(slp,x];
  [IsStraightLineProgElm],0,
function(slp)
  return One(FamilyObj(slp));
end);

#############################################################################
##
#M  InverseOp(<slpel>)
##
BindGlobal( "InverseSLPElm", function(slp)
local l,n;
  l:=LinesOfStraightLineProgram(slp![2]);
  l:=ShallowCopy(l);
  n:=Length(l);
  # invert last
[n]);

  return StraightLineProgElm(slp![1],
           java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 8
 ;

# words in fp elements have separate methods for `Inverse' and `InverseOp'
# -- so we must duplicate the installation here as well
     IsBound(    if IsBound(a.base
  [IsStraightLineProgElm],0,InverseSLPElm);

InstallMethod([IsStraightLineProgElmIsStraightLineProgElm]0,
  [sStraightLineProgElm],0,InverseSLPElm    :=ist(.seedsi-(seed.eedsi);

#############################################################################
##
#M  Order(<slpel>)
##
("linejava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 58
  
   # we have to be better than specialized methods
  10,
function(,,# ditto new
  return Order(EvalStraightLineProgElm(slp)) ,,   
end);

#############################################################################
##
#M  \*
##
\*"line program with ,true,
  [IsStraightLineProgElm,IsMultiplicativeElement],0,
function(lp,)
  if IsOne(x) then return slp;fi;
  return EvalStraightLineProgElm(*x;
end);

InstallMethod(\*#bleu,# corresponding ble
  [IsMultiplicativeElement,IsStraightLineProgElm],0,
function(x,slp)
  if IsOne(x) then return slp;fi;
  return *EvalStraightLineProgElmslp)
end);

#T this would be better recoded as variant of the substring algorithm in
#T steps of 2
BindGlobal(PosSublOdd,(,)
local p;
  p:=PositionSublist(a,b);
whileIsInt()   if IsIdenticalObj(seedjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 32
    p:PositionSublista,,)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  od;
  return p;
end);

InstallMethod(\*,"ta=1.]  translation of the numbers  the numbers
  [,IsStraightLineProgElm,,
function(aob  IsSubsetbseeds,seedseeds)
# this multiplication routine tries to find duplicate patterns. It
# implicitly assumes, however that the input is in some way ``reduced'' as
# an SLP.
local a,    seed:=:=;
      aep,fi
      ta     l[Length(l)]:=e;
      tal,tbl,  # up to this index, old and new indices are the same
lalb,# lengths
      laa,lba,  # last entries absolute
      ap,bp,    # processing indices old
      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
      i,j,k,    # index
      seed,     # seed

   
      ei,       # inverse
     ,# bs-entries that have been taken earlier
      bleu,     # corresponding ble
         # substring found?
           # flag when dealing with the last elements.
      # position

  seed:=aob![1];
  asn:=    :tbl1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
  aep:=Lengthseed.seeds);
  b:=bob![1];
  bep:Length(.seeds);
  bsn:Length(b.seeds);
  if IsIdenticalObj(seed,b) then
    # identical seeds -- easiest case
  :java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    tb:=[1..bep];
  (seedseeds,.seeds)then
    # b is a subset of a
    ta:=[1..aep]; # translation of the numbers
,->osition(java.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 48
  elif IsSubset(b.seeds,seed.seeds) then
    # a is a subset of b
    ist(.eedsiPosition(bjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
    tb:[.bep]
    seed:=b;

    # none is a subset of the other
   a=;
    seed:=rec(seeds:=Union forj()=[(]b];
    if IsBound(a.lmp) and IsBound(b.lmp) then
edaximumlmp,.p;
    fie=od
    if IsBound(.base)and IsBound(.ase)then
      .ase:Uniona.,b);
    fi;
    :(a.seeds,-Positionseed,));
    tb:=List(b.seeds,i->Position(seed.seeds,i));
  fi;
  =seed.eeds;
  tal:=First([1..Length(ta)],i->ta[i]<>i);
  if tal=fail then
    tal:=Length(ta);
  else
    tal:=tal-1;
  fi;
  tbl:=First([1..Length    else
  if tbl=fail then
    tbl:=Length(tb);
se
    tbl:=tbl-1;
  fi;

  :=(ob!)
  b:=LinesOfStraightLineProgram(bob![2]);
  l:=[];
  la      in 1.() java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
  lb:=Length(b)-1;

#java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
if0Length([) java.lang.StringIndexOutOfBoundsException: Range [33, 34) out of bounds for length 33
    a:[]java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
    l:=ShallowCopy(b);
    # translate
    Append(tb,seen+[1..Length(b)]);
    for i in [1..        
      e:=ShallowCopy(l[i]);
     Length-][b1]then
              eLengthe):e[Length()+[2]
      java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
      l[i]:=e;
    od;
    e:=l[Length(l)];
    if e[]ta    if e[1]=ta[a
      e[2]:=e[    ;
      if e[2]=0 then
        e: d
      fi
    else;
      e:=Concatenation([ta[a[1]],java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 10
    fi;
    l
  elif lb=0 and Length(b[1])=2 then
    b:=b[1];
    l:=ShallowCopy(a);
    # translate
    Append(ta,java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 16
for  1L(l]do
      e:=ShallowCopy(l[i]);
      for j in [1,3..Length(e)-1] do
        e        as:=[.-]}
      od;
      l[i]:=e;
    od;
    e=[Length(l];
    if e[Length(e)-1]=tb[b
eLength(]:[Length()+[]java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
      if e[e]0then
        e={1L-2}
      fi;
    else
      e:=Concatenation(e,[tb[b[1]        ;
    fi;
    l[Length(l)##
###  Copyright of GAP belongs to its developers, whose names are too numerous

    ap:=1##
    #############################################################################
    tjava.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 55
    ble:[;#bCDATA,3,)(1#  ( (##  gap> hom:=GroupHomomorphismByImages(g,g,GeneratorsOfGroup(g),

    laro             ##
    java.lang.StringIndexOutOfBoundsException: Range [26, 9) out of bounds for length 26
##  Let <M>U</M> be the image of <A>epi</A>.
      ##  <M>g</M
#Print(">",ap,",",bp,"\n");
        # how many ap's do use up to generator aep;
        anp:=ap##  ^(1,2,3)
whileanp= ForAllanp{13.aa]-]i>=ep 
          anp:=anp+1;
        od;
        as:=              ##

        # translate the generator numbers
        if aep>tal ##  If <A>homs</A> is empty, it computes all subgroups.
          for i##  Group([ (1,2,3), (4,5,6), (7,8,9) ])
            if p>##  [ Group([ (7,8,9), (4,5,6), (1,2,3) ]),
in[13.ength()-]do
              
              ##
                # inverse
                e[j]:##  a list [<A>subspaces</A>,<A>action</A>], where <A>subspaces</A> is a list of all the
                e[j+1]:=-e[j+1];
              fi;
            od;
            #F  SubgroupsSolvableGroup(<G>[,<opt>])##
          od;
        fi##  using the homomorphism principle.

        # how many bp's do use up to generator bep;
        bnp
        ##  explicit test for the desired properties (which is not done by default, as
          bnp:=bnp+1;
        od;#  must be a list of automorphisms of <A>G</A>. If given, only groups;
        bs:=ns</C> (defined               :[1 

        # translate the generator numbers
        if bep>tbl##  <Item>
          for i in [1..Length(bs)] do
            e:=ShallowCopy p 
 [1,##  relation <M>F \geq C > A > N > B > M</M>.1,
              j##  in <M>F/N</M>.
              if            else
                # inverse
                [##  If it returns <K>false</K> then
                e[j#                   Add,bs[j]);
              fi;
            od;
            bs[#ameterisused permit calculations of some subgroups if the
          od;
        fi;

        bpre:=[];
        bleu:=[];
        # add the as
        for##  of subgroups but also a corresponding list <C>norms</C> of normalizers
          e:=as[i];
          repeat
            # search substring in recorded b-parts
            found:=false;
            j:=1;
##  is an elementary abelian series of <A>G</A> which will be used for
              p:PosSublOdde##  <Item>
              found:=p<>fail;
##  gap> g:=Group((1,2,3),(1,2),(4,5,6),(4,5),(7,8,9),(7,8));
            java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
            if##  gap> l:=SubgroupsSolvableGroup(g,rec(actions:=[hom]));;
              j:=ble[j-1]+1; # the other case will always add 1.
            else
              # search substring in bsDeclareGlobalFunction"";
              j:#F  SizeConsiderFunction(<size>)   returns `consider' function
              while            
                              
eijava.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 35
                  :#  > consider:=SizeConsiderFunction(6)));;
                  if not j in bpre then
                     record thisbs  l
                    Add(l,bs[j]);
                    AddSet(bleu,##  </Description>
                    (bprej);#  this one is                     AddSet(bpre,j); #  this one is taken
                    java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 0
                    j##
                  ##  <Func Name="ExactSizeConsiderFunction" Arg='size'/>
                    # we stored it already
                    j:=                    
                  ;
                fi;
;
              lter It is guaranteed that allsubgroups fulfilling the
            ion>
                                DeclareGlobalFunction("                    =;
              # the subentry starts at index p
              # j is the l-index of the entry which is sub+1
ncatenation({[.p-1]}[+seen-,]
[j-1])..ength()]};
            else
              # search substring in recorded b-parts (inverse)
java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
              j:              found>                        k:=Positio,bs]
              while found=false andjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
pP(lj])
                found:=p<>fail;
                j:=j+1;
              od;
              if found=true then
                j:=ble[j- od
              else
                # search substring in bs
                j:=1;
                while found=false and j<Lengthbse=e1ength(+--lj-]]}
                                 j+een-1,1,
                  if p<>fail then
                    found ei=)
                    if not j in bpre then
                      AddSet(bpre              [++-1:Length( 
                      # record this bs in l
                      if bs[j] in l then
                        # happens to be coincidence.
                        k:fi
                        tb[bsn+bp+j-1]:            if e inl then
                        j:=k; # position of the l-entry that is sub              # the replacement could rarely produce duplicates
          
                        Add(
                        AddSet(bleu,  laro then
                        tb[bsn+bp+j-1]:=Length(l)+seen; # store the index
                        j:=Length(l); # position of the l-entry that is sub
                =java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 43
                    else
                      # we stored it already
                      j:=Position(l,bs[j]);
                    fi
                  fi;
                  j:j            
                od;
              fi;
              found> then
                # the subentry starts at index p in the inverse
e=e[1.Lengthjava.lang.StringIndexOutOfBoundsException: Range [46, 47) out of bounds for length 31
                                 [              ;
                                 found:p>;

                ei:=RepAssWorInv(;
              fi;
            fi;

          until   # the subentry starts at index p in the inverse

          # finally store, unless trivial and not the last one
          if Length(e)>2 or AbsInt(e[# search substring in recorded a-parts
            if e in l then
#  
taasn                while fjava.lang.StringIndexOutOfBoundsException: Range [38, 37) out of bounds for length 55
            else
              (le)
              if not laro then
                # do not add in the last step -- this might confuse b
                AddSet(ale,Length java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 63
              fi;
              ta[asn+ap+i-1]:=Length(l)+seen;
            fi;
          else
            # complete replacement
            ta[else
          fi;
                od;:)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
        AddSet(java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 38
        # add the bs
        for i in [1..Length(bs)] do
          if# complete replacement
                          [bsn++i1]:e2]*[]java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
            repeat
              # search substring in recorded a-parts
              found:                tb[+bp1]=le)
              j:=1;
              while found=false and j<=Length(ale) do
                p:=PosSublOdd(e,l[ale[j]]);
                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:=java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 11
                e:# finally multiply the last entries.
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
              else
                # search substring in recorded a-parts
                found:=false;
                j:=1;
       ensureslast  arelast
                while f andale) do
                  p:=PosSublOdd(e,l[ale[j]]);
                  found:=java.lang.StringIndexOutOfBoundsException: Range [0, 26) out of bounds for length 7
                  j:=j+1;
                od;
                if         e:=l[Length(l)1]java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
                  # the subentry starts at index p in the inverse
                  
                  j:=ale[j-1]Add([a1,b1);
                  e:=oncatenation(e{[1.;
                                  [j+seen-1,-1],
                                  e{[Length(e)-p+2..java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 46
                  Remove
                fi;
              fi;
            until found=false; # several substrings might occur
            # finally store
            if Length(e)>2 or java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 24
              if e in l then
               
-1]:(,)     
              else
                Add(l,e);
                java.lang.StringIndexOutOfBoundsException: Range [0, 22) out of bounds for length 12
                tb[          
              ;
            else
              # complete replacement
              tb[#java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
            ;
          fi;
        od;

       java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        bp:=bnp;
        aep:=aep+;
        bep:=bep+1;

      od;
java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
1
      lb:else
      laro:=#  Print("case3\n");
    od;

    # finally multiply the last entries.

    # get the indices in l of the corresponding last entries
    # the -1 in the argument only undoes the +1 at the end of the `while' loop
    la=[asn]java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
    lb:=tb[lb+bsn-1];#    ForAny([1..Length(l)],i->ForAny([1..i-1],j->PositionSublist(l[i],l[j])<>fail)));
    laa:=AbsInt(la);
    lba:=AbsInt(lb);


    if2java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 71
      # last a is in the but last position
      if   
#  Print("case1\n");
        # last b is in the last position: combine last two
        e:=l[Length(l)-1];
        j:=l[Length(l)];

        # does b refer to a?
        if ForAny([1#fi;
          Add(l,[la,1,lb,1]);
        else
         lL()-:Ejava.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 13
    :S(seed,(l,een)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        fi;
      else
        Error("spurious last entry");
      fi;

      # last a is not in the but last position
      if lb=Length(l)+seen then
#  Print("case2\n");
        
        od([la],l[ength(l))java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58

        # last b is not in the last position:
        if L(l+seen then
#  Print("case3\n");
          # but a is: change a in last position
          InstallMethreturn a;
        else
#  Print("case4\n");
          # last b is not in the last position or inverses used: Add another
          Add(l,;
        fi;
      fi;
    fi;

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

  if Length(l[Length(l)])=0 then
     (aob;
  else
#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(  I,java.lang.StringIndexOutOfBoundsException: Range [52, 48) out of bounds for length 52
    l:=traightLineProgElmseed,StraightLineProgramNC(l,seen));
    Assert(2,EvalStraightLineProgElm(aob)*EvalStraightLineProgElm(bob)=
             end;
    return l;
  fi
end);

InstallMethod(\^,"power straight line program elements",true,
  [IsStraightLineProgElm,IsInt],0e)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
functiona,
local l,n;
  if e=0 then
    java.lang.StringIndexOutOfBoundsException: Range [16, 10) out of bounds for length 18
  elif e=1fa)
    return a;
  elif e=-1 then
    return Inverse(a);
  fi;
  l:=e:=EvalStraightLineProgElm(a);
  n:=Length(a![1].seeds)s=niona![1InstallMethodjava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 79
  if Length(l)=1 and Length(l[1])=2 then
    # special case: generators
    l:=[[l[1][1],l[1][2]*e]];
  else
    fi;
    Add(,[Length(l)ne);
  fi;
  return StraightLineProgElm(a![1],StraightLineProgramNC(l,n));
end);

allMethod=, program element "I,
I,java.lang.StringIndexOutOfBoundsException: Range [50, 48) out of bounds for length 52
java.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 21
  return EvalStraightLineProgElm(slp)=x;
end)

InstallMethod(\,"traightline program element with x",IsIdenticalObj,
  [IsStraightLineProgElm     a!]basethen
java.lang.StringIndexOutOfBoundsException: Range [44, 15) out of bounds for length 44
  return EvalStraightLineProgElm(slp)<x;
end);

InstallMethod(a2#java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
  [IsMultiplicativeElement,IsStraightLineProgElm],0,
function(x,slp)
  return x<EvalStraightLineProgElm(slp);
end);

#############################################################################
##
#O  StretchImportantSLPElement(<elm>)
##
InstallMethod(x,slp)
  [  java.lang.StringIndexOutOfBoundsException: Range [11, 8) out of bounds for length 40
Ignore);

nstallMethod(," line program "true,
  [IsStraightLineProgElm],0,
functionajava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
local ,sr
  e:=LinesOfStraightLineProgram(a![2]);
  if Product(e,i->Sum(List(i{[2,4..Length(i)]},AbsInt)))>200 then
    e=EvalStraightLineProgElm(a);
    s:=Union(a![1].seeds,[e]);
    e:=Position(s,e);
    r:=rec(      else
    if java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
e:=l[n-m];
      .:a!];
    fi;
    if IsBound(a![1].base) then
      # transfer base information for perms.
      r.base else
    fi;
    a[]rjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    a![2java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  fi;
end);

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

InstallMethod(\=,"x with straight line program element",IsIdenticalObj,
  [IsMultiplicativeElement,IsStraightLineProgElm],0,
     else
  return x :l-]java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
end  ei].1 

BindGlobal("ImgElmSLP",function(x,slp,pre)
local s,m,l,trace;
   # trace through
   trace:=function(y,n)
   local ,i,j;
     if n<0 then
      n:=-n;
      if n<=m           forj  [.e[+1] 
        return y/s[n];

        ejava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
        for  :!1.
          if e[i+1]<0 then
            for j in [e[i+1]..-1] do
                 if pre then
            od;
se
            for j in [1..e[i+1]] do
              y:=trace(y,-e[i]) return(x-(engthl)m)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
            od;nd);
          fi;
        od;
      fi;

     elif n
       return y^[]java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
     else
       e:ln-]java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
       iin 13.java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 0
         if e[i+1]<0 then
           for j in [e[i+1]..-1] do
             y:=trace(y,-e[java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 8
l[;
         else
           forlocals,l,tackpos,row,ndstep,cntve,isp,ae;
           :trace(,e[]);
           od;
         fi;
       od;
     fi;

     return y;
   end;

   s:=slp![1].seeds;
   m:=Length(s)row:l[];
   l:=LinesOfStraightLineProgram(slp![2]);
   if pre then
     # preimage!
     return trace(x    ind:1;
   else
     return trace(x,-(Length(l)+m));
   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.
BindGlobalx=[]java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
local s,m,l,stack,pos,row,ind,step,cnt,v,e,i,spex=x^[]java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
  s:=slp![1].seeds;
  m:=Length(s);
  l:=LinesOfStraightLineProgram(slp![2]);
  stack:=[];
  sp:0java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
  pos:=Length(l);
  row:=l[pos];

  if npre then
    ind:=1;
    step:=2;
  else
gthrow-java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
    step:=-2;
  fijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  cnt:=0;

  repeat
    v:=row[ind];
    e:=row[ind+1];
    ae:=AbsInt(e);
    if not npre then
      e:=-e;
    fi;
    if v<=m then
      # do the most simple cases themselves
      if e=-1 then
        x:x/[v]
      elif e=1 then
        x:=x^s[v];
      elif e>0 then
        for i in [1..e] do
          x:=^[;
        od;
      else
        for i        if  sp then
          x:xs[v];
        od;
      fi;
      cnt:=ae; # did all
    else
      #push
      sp:=sp+1;
      stack[sp]:=[pos,ind,step,cnt];
      pos:=v-m;
      row:=l[pos];
      npre=>;
      if npre then
        ind:=1;
        step: AbsIntr[ind+1;
      else
        ind:=Length(row)-1;
        step:=-2;
      fi;
      cnt:=0; # we just started

    fi;

    while cnt>=ae do
      :ind+tepjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
      cnt:=0;
ind>row  ind< 
        # pop
        if sp=0 then
          # through!
          return x;
        fi;
        row:=stack[sp];
        sp:=sp-1;
        =;
        ind:=row[2];
        step:=row[3]java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        npre:=tep0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        cnt:=row[4]+1; # +1 since we did one
        row:=l[os]java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        :=bsInt(owi+];
      fi;
    od;
  until false; # we will stop by returning the result
end)java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

InstallOtherMethodod(^" withstraight ,,
  [IsInt,IsStraightLineProgElm and IsPerm],0,
function(x,slp)
  # do not use for straight line elements!
  if IsStraightLineProgElm(x) then
    TryNextMethod();
  fi;
  return ImgElmSLP(x,slp,true);
end);

InstallOtherMethod(\/,"x with straight line perm",true,
  IsPosInt,sStraightLineProgElmIsPerm,0,
(x,)
  return ImgElmSLP(x,slp,false);
end);

# takes a seed record and fetches/adds a largest moved point entry
BindGlobal("LMPSLPSeed    :p100;
  if not IsBound(r.lmp) then
    r.lmp:=LargestMovedPoint
  fi;
  return r.lmp;
end);

InstallMethod(LargestMovedPoint,"straight line program permutation[and IsPerm,]0,
  [IsStraightLineProgElm and IsPerm],0,
function()
local p,q;
  p:=LMPSLPSeed(slp![1]);    return(slp;
  if p    
    q:=p-100;
  else
    q:=0;
  fi;
  while p>q and ImgElmSLP(p,slp,true)=p do  fi;
    p:=p    # the element seems to be the identity. Expand!
  od

  if p>then
    return p;
  elif q=0 then
    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!
    q:=EvalStraightLineProgElmfunctionperm
    return LargestMovedPoint(q);
  fi;

end);

(=,straight  program element with perm",IsIdenticalObj,
  [IsStraightLineProgElm and IsPerm,IsPerm],0,
function(slp,perm)
local r;
  r:=LargestMovedPoint(perm);
  if r=0 then
    return IsOne(slp);
  else
     r^perm<>mgElmSLP((r,slp,,true)then
      return false;
    fi;
  fi;
  if IsBoundslp![].base) then
    return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i^perm)
          and<s![]);
  fi;           and<=LMPSLPSeed(lp[1];
  return EvalStraightLineProgElm(slp)=perm;
end);

InstallMethod(\=,"perm with straight line program element",IsIdenticalObj,
  [IsPerm,IsStraightLineProgElm and IsPerm],0,
function(perm,slp)
local r;
  r:=LargestMovedPoint(perm);
  if r=0 then
    return IsOne(slp);
else
    if r^perm<>ImgElmSLP(r,slp,true) then
      return false;
    fi;
  fi;
  if IsBound(slp![1].base) then
   ForAllslp[1]basei>ImgElmSLP(,slp,true)=^)
           and r<=LMPSLPSeed(slp![1]);
  fijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
  return perm=EvalStraightLineProgElm(slp);
end);

(\,straight lineprogramperms,IsIdenticalObj,
 IsStraightLineProgElm and IsPerm,IsStraightLineProgElm        false;
function(a,b)
local l,;
  if not IsIdenticalObj(a![1],b![1]) then
    l:=Maximum  if 1000then
      m:0;
    l:=LMPSLPSeed(a![1]);
  fi;
  if IsBound(a![1].base) and java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 13
    return
    ForAll(Union(a![1].base,b![1].base),
           i->ImgElmSLP(i,a,true)=ImgElmSLP(i,b,true));
  fi;
  if l<1000 thenfi;
    m=0;
  else
    m:=l-100;
  fi;
   > do
    java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
      return false;
    fi;
    l:=l-1
  od;
  if l=0 then
    return true;
  fi;
  # the elements look very similar, but there are a lot of points.
  return EvalStraightLineProgElm(a)=EvalStraightLineProgElm(b);
end);    :l[sStraightLineProgElm and IsPermsStraightLineProgElm IsPerm,,

InstallMethod(\<,"straight line program perms",IsIdenticalObj,
  [IsStraightLineProgElm and IsPerm,IsStraightLineProgElm and IsPerm],0,
function(a,b)
local l,m,x,y;
  :1
  if not IsIdenticalObj(a![1],b![1]) then
    m:=Maximum(LMPSLPSeed(a![1]),LMPSLPSeed(b![1]));
  else
    m:=LMPSLPSeed(a   the elements look very similar, but there are a lot of points.
  ;
  if m>1000 then
    m:=1000;
  fi;
  while l<m do
    x:=    x:=ImgElmSLP:ImgElmSLPl,true)
    y:=y:=ImgElmSLP)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    if x<y then return true;
    elif yx then return ;
    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  ;
  [  while l do
function(slp)

java.lang.StringIndexOutOfBoundsException: Range [5, 4) out of bounds for length 31
    return ForAll(slp![1].base,i->ImgElmSLP(i,slp,true)=i);
  fi;
  l:=LMPSLPSeed(slp![1]);
  if l<1000   [IsStraightLin and,0java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
    m:=0;
  else
    m:=l-100;
  fi;
  while l>m do
    if ImgElmSLP(l,slp,true)<>l then
      return false;
    fi;
    l:=l-1;
  od;
  if l=0 then
    return true;
  fi;
  return IsOne( EvalStraightLineProgElm(slp) );
end);

InstallOtherMethod( CycleLengthOp, "straight line program perms", true,
  [ IsPerm and IsStraightLineProgElm, IsInt ],1,
function(p,e)
local,f;
  i:=0;
  f:=e;
 repeat
   f: return false;
    i:=i    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
  until f=e;
  return i;
end);

InstallOtherMethod( CycleOp, "straight line program perms", true  IsOneEvalStraightLineProgElm))java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
  [ IsPerm and IsStraightLineProgElm, IsInt ],e
function(p,e)
local c,i,f;
  i:=0;
  f:=e;
  c:=[];
  repeat
   Add(,);
    f:=f^plocal ,f
    i:=i+1;
  untiljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  return c;
end)

InstallOtherMethod( CycleStructurePerm, "straight c,i,;
  [ IsPerm and IsStraightLineProgElm ],1,
function(p)
  return CycleStructurePerm);
end);

InstallOtherMethod( SignPerm, "straight line program java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 11
  [java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
function(p)
  return SignPerm(EvalStraightLineProgElm());
)

InstallOtherMethod( RestrictedPermNC, "straight line program perms", true,
  [ IsPerm and IsStraightLineProgElm,IsList ],1,
function(p,l)
EvalStraightLineProgElmljava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
end);

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

#############################################################################
##
#M  ExtRepOfObj
##
InstallMethod(ExtRepOfObj,"for a straight line program word",true,
  [IsAssocWord and IsStraightLineProgElm],0,
function
  return ExtRepOfObj(  return RestrictedPermNC(EvalStraightLineProgElm
ExtRepOfObj,for java.lang.StringIndexOutOfBoundsException: Range [41, 37) out of bounds for length 49

#############################################################################
##
#M  LetterRepAssocWord
##
nstallMethod(java.lang.StringIndexOutOfBoundsException: Range [34, 32) out of bounds for length 73
  [IsAssocWord and IsStraightLineProgElm],0,
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5
  return LetterRepAssocWord(EvalStraightLineProgElm(slp));
end);

#############################################################################
##
#M  NumberSyllables
##
InstallMethod(NumberSyllables,"for a straight line program word"#M  GeneratorSyllable
InstallMethod(,"for a straight line java.lang.StringIndexOutOfBoundsException: Range [60, 60) out of bounds for length 5
function(slp)
  return NumberSyllables(EvalStraightLineProgElm(slp));
end);

#############################################################################
##
#M  GeneratorSyllable
##
InstallMethod(GeneratorSyllable,"for a straight line program word",true,
  [ andIsStraightLineProgElm,IsPosInt],0,
function(returnjava.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
  return GeneratorSyllable(EvalStraightLineProgElm(slp#M  GeneratorSyllable
end);

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

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

#############################################################################
##
#M  Subword
##
InstallOtherMethod(Subword,"for a straight line program word",true,
  [IsAssocWord and IsStraightLineProgElm,IsInt,IsInt],0,
function(slp,a#M  ExponentSumWord
  return InstallMethodExponentSumWord"a  programword,  Subword
end);

#############################################################################
##
#M  MappedWord
##
InstallMethod(MappedWord,"for a java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  IsElmsCollsX,
  [ ##
java.lang.StringIndexOutOfBoundsException: Range [22, 8) out of bounds for length 23
  # evaluate in mapped generators
  return ResultOfStraightLineProgram(slp![2],List(slp![1].seeds
    i->MappedWord(i,gens,imgs)) # images of the roots
    ;
end)

#############################################################################
##
#M  ExponentSumWord
##
InstallMethod(ExponentSumWord,"for a straight line program word",
  IsIdenticalObj, [IsAssocWord and   local ,yj;
function(slp,e)
  return ExponentSumWord(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 32
    EvalStraightLineProgElm(e));


# 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
TreeRepresentedWordfunction,xj)
local z,d,l,count        ;
z=engtht])
  b:=Length(r);
  if n<=b then
    return StraightLineProgElm(r,StraightLineProgramNC([[n,1]]f<
fijava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5

  # which elements are referred to ? set count negative
  :(,)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  count:=function(i)
    if i>b((t[][]);
      if d[i]=0 then
        count(AbsInt(t[1][i]));
        count(AbsInt(t[2][i]));
      fi;
      d[]=d[]1
    fi;
  end;

  count(n);

  # now we will collect in d slp entries (or indices in l by positive numbers)
  l:=[];
  d[n]:=-2; # this will force element n to be stored as word (and it will be
            # at the end of l)
  count:=function(i)
  local e,f,x,y,j;
    if i<=b then
      return i;
    elif not (IsInt(d[i]) and d[i]<0) then
       d[]
    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    ;
           if =f then
        if x+y=0 then
          Error( ;
        
          ejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        fi;
      else
        e:=[e,x,f,y];
      fi;
    else
      # take care of inverses
      if IsList(e) and x<1 then
        x:=[]; #revert
        for j in [Length(e)-1,Length(e)-3..1] do
          Add(x,j);
          Add(x,+1)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
        od;
        e:=e{x};
        x:=[2,4..Length(e#F  SLPChangesSlots( <l>, <nrinputs> )
        e{x}:=-e{x};
      fi;
fand< 
        y:=[]; #revert
        for j in [Length(f)-##  appended to the list, namely the number of the biggest slot used.
          Add(y,j);
          Add(y,j+1);
        od;
        f=f{y};
        y:=[2,4..Length(f)]; # exponent indices
        f{y}:=-f{y};
      fi;

      if IsInt(e) then
        e:=Concatenation([e,x],f);
      elif IsInt(f) then
        e:=Concatenation(e,[f,y]);
      else

f=)
        while Length(e)>        {}:=e            Add(ch(changes,ne2)
          # same variables: reduce
          [2]+[engthe]java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
          if f[2]=0 then
f=f{[..ength(f)];
          ;
          e:=e{[1            ( "  slp:java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
        od;
        e:=Concatenation(e,f);
      fi;

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

    d[i]:=e; # store
    return e;
  end;
  count(n);

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


#############################################################################
##
##  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.
##
InstallGlobalFunction( SLPChangesSlots,
  function(l,nrinps)
    local biggest,changes,i,line;
     line of the slp,which
                     # says, which element is changed
    biggest := nrinps;
    for i in [1..java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 13
        line := l[i]fijava.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
        if IsInt(line[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            biggest : biggest +1;
            Add(changes,biggest);
        elif Length(line) = 2 and IsInt(line[2])        i : i-1java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
            # the second case, provided that we have not been in the first
            Add(changes,line[2]);
            if line[2] > #F  SLPReversedRenumbered( <ll>,<slotsused>,<nrinps>,<invtab> )
                biggest := line[2];
            fi;
        elif i < Length(l) then
           ("  slp " ;
        else
            Add(changes,0);
            # the last line does not change anything in this case
        fi;
    od;
    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,
  functionl,,rinps,changes,slotsusedll)
    local j,line;
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 19
        if IsBound(fi;
            AddSet(slotsused,        IsIntine] then   # the first case
needed[[# as this line overwrites it,
             
            line := l[i];
            if IsInt(line[1]) then
                Add(ll,[ShallowCopy(line),changes[i]]);
            else
                Add(ll,[ShallowCopy(line[1]),line[2]]);   # copy the line
                line := line[1];
            fi;
            for j in [1##  k. The argument
                needed[line[j        else
            
        fi;
        i := i - 1;
    od;
  end);

##
#F  SLPReversedRenumbered( <ll>,<slotsused>,<nrinps>,<invtab> )
##
##  Internally used function.
##
InstallGlobalFunction( SLPReversedRenumbered#F  SLPOnlyNeededLinesBackward( <l>,<i>,<nrinps>,<changes>,<needed>,
  function(ll,slotsused,nrinps,invtab)
    # invtab must be an empty list and is modified!
    local##  l is a list of lines of an slp, nrinps the number of inputs.
    for i in##  i is the number of the last line, that is not a line of type 3 (results).
        invtab[slotsused[i]] := i;
    od;
    lll := [];  # here we collect the final program
    biggest := nrinps;
    for i in [Length(ll),Length(ll)-1 ..     else
        resultslot := invtab[llfi;
        if resultslot = biggest+1 then   # we can use a type 1 line
            ##  This functions goes backwards through the slp and adds exactly those
            for##  result (in backward order). All lines are transformed into type 2
                Add(kl,invtab[ll[i][1][kk]]);
                Add(kl,ll[i][1][kk+1##
            od;
              functionli,rinps,changes,needed,slotsused,ll)
            biggest := biggest + 1;
        else
            kl := [];
            forkkin[1 whilei=  do
Addklinvtab[][            lotsused,hanges[];  
(kl[]][1)
            od;
            Add(lll            line = l[];
             >biggest then
                biggest : resultslot;
            fi;
        fi;
   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( java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
  function:;
    local forin[rom1ength]:
          needed,nrinps,slotsused;

    if IsInt(k) then
        klist : [];
    else
        klist := k;
    fi;

      IsStraightLineProgramslp)then
        l :=                 Add(kl,invtab[j
        nrinps := java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 21
    else
        l := slp[1];
nrinps: slp[2]java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    fi;
    # The following has to be done, because the SLP might overwrite its
    # intermediate results:
    changes := biggest := resultslotreturn StraightLineProgramNC[(]nrinps;
    biggest := changes[java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 15
    ll := [];   # Here we collect the lines of the result, but reversed
      ;
    needed := [];  # here we mark the needed entries for the rest of the prog.
    i 
    ##  Returns a new slp that calculates only the value of slot <k>
        if Length##  slp must be a straight line program returning a tuple
            Error("slp does not have result number ",k);
        fi;
        ##  If you know that your SLP does not overwrite slots, please use
        for j in ##  in the original output tuple.
            needed[word[j]] := true;
        od;
        if Length(word) > 2 then
            [1 : [ShallowCopy,biggest+1];
            AddSet(slotsused,biggest+1);

        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:
        lastline := [];  # Here we collect results
        for         =slp1]
            word := l]n]java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
            for j in [1,3..Length(word)-1] do
                needed[word[j]] := true;
            od
            Add(lastline,ShallowCopy(word));
        od;
    fi;

    SLPOnlyNeededLinesBackwardli-,,,s,l);
    # 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 : SLPReversedRenumbered         : slp[]
   lastline< failthen
        # Add the results line:ifLengthll)=0 (  slotsused) then
        kkl := [];
    # intermediate results:
            kl := [];
       kkin[,3.Length
                Add(    java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
                Add(j+1];
            od;
            Add(kkl,kl);
        od
        Add(lll,kkl);
    fi;
  # One of the original generators!
#k          fijava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
        # also, word must be of length 2 and second component equal to 1
        return StraightLineProgramNC##
    else
       return StraightLineProgramNC(lll, nrinps);
    fi;
  end);

##
#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(slp,k)
    local changes,i,invtab,l,ll,lll,needed,nrinps,slotsused;

    if IsStraightLineProgram(slp) then
        l := java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 28
        (slp ;
    else
        l := slp[1];
        nrinps := slp[2];
    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 allAdd(line);
    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
    i := Length(l);
    if changes[i] = 0 then   # we are not interested in a result line
        i := i - 1;
    fi;
    SLPOnlyNeededLinesBackward(l,i,nrinps,changes,needed,slotsused,ll);
    if Length(ll) = 0 or not(k in slotsused) then
        # the slot was never assigned!
        Error("Slot not used in SLP!");
    fi;
    # 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 := [];
     (java.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 61
    return StraightLineProgramNC(lll, nrinps);
    #  TO BE DEBUGGED HERE
  end);

##
#F  IntermediateResultsOfSLPWithoutOverwriteInner( ... )
##
##  Internal function.
##
InstallGlobalFunction(         od;
  function    ;
    # Only used internally.
,needed,

    if IsStraightLineProgram(slp) then
        l := LinesOfStraightLineProgram( slp );
        nrinps := NrInputsOfStraightLineProgram( slp );
    else
        [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
               kk [,3.(-1 
    while Length(needed) > 0 do
        i := Remove(needed);
        if i > nrinps then
            Add(slotsused,i);   # this slot is used
            line := l[i-nrinps];
            # We know that all lines are plain lists of integers!
                java.lang.StringIndexOutOfBoundsException: Range [66, 1) out of bounds for length 66
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 23
                L-  
                AddSet(needed,line[j]);
            od;
fi
    od;
            k,ll[]k]:  ;
    # during that calculation are in slotsused. We want to renumber
    # them from [1..Length(slotsused)]:
    if Length(slotsused) > 0 then
invtab : slotsused
    else
        invtab := [];
    fi;
    nrslotsused := Length(slotsused);
    for i in [1..nrslotsused] do
invtab[lotsused[] =nrinps+nrslotsused+  ( <>, <k )
    od;
    for ##  in the list k.
        invtab[i] := i;
    java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
    lll := [];  # here we collect the final program:=Length()
for   java.lang.StringIndexOutOfBoundsException: Range [29, 26) out of bounds for length 69
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
        for kk injava.lang.StringIndexOutOfBoundsException: Range [4, 1) out of bounds for length 7
            Add(kl,    Lengthll)=0  ]java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
            Add(kl,ll[i][kk+1]);
        od;
        Add(lll,kl);
    od;
    return [nrinps,invtab,            Addline,[0);
  endjava.lang.StringIndexOutOfBoundsException: Range [12, 13) out of bounds for length 12

##
#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,
  ,)
    local i,function(slp,k

     Call the real code:
    r := IntermediateResultsOfSLPWithoutOverwriteInner(slp,k);
    nrinps := r[1];
    invtab := r[2];
    lll := r[3];

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

    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.
##
InstallGlobalFunction( IntermediateResultOfSLPWithoutOverwrite
  (slp,)
    local r;
    java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
    if k = 0 then
        return StraightLineProgramNCinvtab =[  ;
    elif k <= r[1] then   # a generator
        StraightLineProgramNC[k], [1)
    else
        return StraightLineProgramNC(r[3], r[1]);
    fi##  number of inputs. This function constructs an slp that returns the result
  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.
##
InstallGlobalFunction( ProductOfStraightLinePrograms,
  (s2
    bjava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 71
          newline,nrinps;

    l1 := ShallowCopy(LinesOfStraightLineProgram(s1));
=java.lang.StringIndexOutOfBoundsException: Range [39, 36) out of bounds for length 41
    nrinps := NrInputsOfStraightLineProgram            (ll[[             =changes2[(]
    if nrinps <> NrInputsOfStraightLineProgram(s2) then
        Error("s1 and s2 do not have the same      First we make a copy of the original generators:
    fi;

     1.java.lang.StringIndexOutOfBoundsException: Range [29, 26) out of bounds for length 31
    biggest := changes[Length(changes)];
    changes2 := SLPChangesSlots(l2,            newline :=[ShallowCopy(),[java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    biggest2 := java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 2
    biggest3 := Maximum(biggest,biggest2);
    # First we make a copy of the original generators:
    l3 :    ;
for in1. do
        dd,1,java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 35
    od;
    # Now make a copy of l1, we have to use lines of type 2:
 
        line := l1[i];
        if IsInt(line[1]) then   # a line without overwriting
            newline := [ShallowCopy                = [;
        else   # a line with overwriting
                j;
        fi;
        Add(l3,newline    line := []
    od;
    # Copy result up:
    Add(l3,[[ if= 0 
    # Now append the second program, change low slots to high ones:
    fori[.()]
        line := l2[i];
        if notjava.lang.StringIndexOutOfBoundsException: Range [20, 20) out of bounds for length 12
            line := line[1];
        fi;
        newline := [];
        java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
            if line[j] > nrinps then
               newline,ine[)
                
                Addj+;
                java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
Addnewline,,[j+])
        od;
        if changes2[i] <= nrinps then
            Add(l3,[newline,changes2[i]+biggest3]);
        else
            Add(l3,[newline,changes2
        fi;
    od;
    # the result of s2 is now in slot results2
    if changes2[Length(l2)] <= nrinps then
        Add(l3,[biggest3+##  The prospective inputs are already standing java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 2
    else
        ,hanges2[(]#
    fi;
    return StraightLineProgramNC(l3,nrinps);
  end##  without result line so far. <lsu> must be the largest used slot of the

##
#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( TranslateAssocWord := function(assocword
function(s,l,lsu,inputs,tabuslots)
  local     for i in [1,3.(java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 42
        nextnew,nrinps,oldwrite,res,results    ;

  FindNextNew := function(nextnew)
    repeat
      nextnew := nextnew + 1;
    until nextnewintabuslots nextnew  inputs;
    return nextnew;
  end;

  TranslateAssocWord: (fi;
    local i,new;
new  )java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    for i in [1,3..Length(assocword   : java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 16
       i =i]java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
    od;
    return new;
  end;

  li := LinesOfStraightLineProgram(s);
  nrinps = rInputsOfStraightLineProgram(s);
  if nrinps <> Length(inputs) then
      Error("inputs must be a list of the     biggest2          oldwrite :=max1;
      return fail;
      elif ()=2and IsInt(line[]) then
  tabuslots := Set(tabuslots);
  trans := ShallowCopy(inputs);   # we start with this translation
  max := nrinps;
  nextnew := FindNextNew(0);
  results := [0];

  for i in [1..Length(li)] do
      line := li[i];
      if IsInt(line[1]) then   # a line without a writing position
          newline := TranslateAssocWord(line);
         java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 28
          max := max + 1;
      elif (line =t line we writetothe nextfew freeentries:
          # a line with a writing position
          newline := TranslateAssocWordelse  # a line with overwriting
          oldwrite : line[2]];
          if line[2] > max                  : FindNextNew)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
              max := line[2];
          fi;
      else
          # First see whether the result line just has powers 1:
          if ForAll(line,x->Length(x) = 2 and x[2]                      lsu:= lsu +1java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
               := List(inex->[x[ for  in[.Length()do
          else
              # the result line, we write to the next few free entries:
              for j in [1..Length(                      fi
                  res := TranslateAssocWord(line[j]);
                  ;
      for j in [1,3.()-]do
                  results[j] := newwrite;
                  if newwrite 
   Addlres)      
lsu: lsu 1;
                  else
                      Add(l,[res,newwrite]                           : nextnew
                      if newwrite > lsu then
                           : newwrite;
                      fi;
                  fi;
                    Addnewline,line[j+];
          fi;
          break;  # do not do the rest of the loop
      fi;
            else
ifnotIsBound([oldwrite])  []  tabuslotsthen
          trans[ldwrite :=nextnew;
          newwrite := nextnew;
          nextnew := FindNextNew(nextnew);
      else
          newwrite := trans[oldwrite];
      fi;
      results[1] := newwrite;
      if newwrite = lsu+1 then
          Add(l,newline);
          lsu := lsu + 1;
      else
          Add(l,[newline,newwrite]);
          if newwrite > lsu then
              lsu := newwrite;
          fi;
      fi;
od
  (=lresults: lsu : java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
end;

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

##
#F  NewProductOfStraightLinePrograms( <s2>, <s1> )
##
##  A new implementation of "ProductOfStraightLinePrograms" using
##  "RewriteStraightLineProgram".
##
(,
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
   >  nr2>java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 58
  # 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.
  local nr1,nr2,x,y;
  nr1 := NrInputsOfStraightLineProgram(s1)
  nr2 := NrInputsOfStraightLineProgram(s2);
  if nr1 <> Length(inputs1) or nr2 <> Length(inputs2)##
      Error("inputs1 and inputs2 must have the right number of entries");
      return fail;
  fi##  <Description>
  x := RewriteStraightLineProgram(s1,[],0,inputs1,inputs2);
  y := RewriteStraightLineProgram(s2,x.##  is known: First of all,
  Add(y.l,[x.results[1],1,y.results[1],1]);
  return ##  the last time in this SLP, it is discarded. The latter leads to
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>
sagePattern for anslp",
  [ IsStraightLineProgram ],
  function( slp )
    local deletions,i,j,l,len,             :   1java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
          uses,w,writes;
    m(lp;
    len :maxslot=java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 46
    nr := NrInputsOfStraightLineProgram(slp);

    # First determine to which slot each line writes:
    writes := EmptyPlist    ;
    maxslot := nr;
    res := 0;
    for step in [1..    #   (1) Determine unnecessary steps (because result is not needed later)
        
        if not(IsEmpty(li)) and IsInt(li[1]) then # line without overwrite res >   [] : ;
             :=maxslot 1;
            writes[ =maxslot;
            res := maxslot;
        elif Length(li) = 2 and IsInt(li[2]) then         li : l;
            writes[step]if>0 [)
            maxslot := 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:
 result is notneeded later)
    #   (2) Remember that a slot can be deleted after its last usage
    needed := BlistList([1..maxslot],[]);
    if res <> 0                   [.(]do
    unnecessary := BlistList([1..step],[]);
    deletions := EmptyPlist(step);
    for step in [len,len-1..1                
        li := l[step];
        w := writes[step];
        if w <> 0 and not(needed[w]) thenifdjava.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 57
            unnecessary[step] := true;
        else
            # Determine needed slots for this step:
            if not(IsEmpty(li)) and IsInt(li[1]) then # line without overwrite
                uses := Set(li{[1,3..Length(li)-1]});
            elif Length(li) = 2 and IsInt(li[2]                w]:false
                uses := Set(li        ;
            else   # a return line
                uses := [];
                for i in [1..Length(li)] do
                    for j in [1,3..Length(li );
                        AddSet(uses,li[i][j]);
                    od;
                od;

            for u in uses do
                if needed[u] = false then
                    local ,li,inemaxnrslotsnrslotsr,,,up,;
                        deletions[step] := [u];
                    else
                        AddSet(deletions[step],u);
                    fi;
                    needed[u] := true;
                fi;
            od;
            if w <> 0 and not(w in uses) then
                needed[w] := false;
            fi;
        fi;
    od;
    return rec( largestused := maxslot, writes := writes,
                unnecessary := unnecessary, deletions := deletions,
                resultslot := res );
  end );

java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 11
  "for a             # Line with overwrite:
  [ IsStraightLineProgram and HasSlotUsagePattern, IsHomogeneousList ],
  function( prog, gens )
    local i,li,line,maxnrslots,nrslots,r, #The describes a  of  to returned.

   # Initialize the list of intermediate results.
    r:                 InfoLevel(InfoSLP)>= 2 and  =1then
    res:= false;
           fi
    step := 1;
    nrslots : Length()java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
    maxnrslots := nrslots;

    # Loop over the program.
    for line in LinesOfStraightLineProgram(          
      if not(sup.unnecessary[step]) then
          if   not IsEmpty( line ) and IsInt( line[1] ) then
            # Normal line without overwrite:
            li := line;
          elif 2 <= Length( line ) and IsInt( line[2] ) then
            # Line with overwrite:
            li := line[1];
          else
            # The line describes a list of words to be returned.
            res := 0*[1..Length(line)];
    else
                res[i] := ResultOfLineOfStraightLineProgram(line[i],r);
                if InfoLevel(InfoSLP) >= 2 and i = 1 then
                                  for i in sup iin.deletionsstep do
               java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
                Info(InfoSLP,2,"Have computed result ",i," of ",
                     Length(line),".");
##  The purpose of this function is the following: Append the slp <s> to
            return res;
          fi;

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

          # Delete unused stuff:
          if IsBound(sup.deletions[step]) then
              for i in sup.deletions[step      step:= step+1
    od;
                  nrslots := nrslots-1;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
          fi;
          if InfoLevel(InfoSLP) >= 2 then
              Print("Step ",step," of ",
               Length(LinesOfStraightLineProgram(prog))," done, used slots: ",
               nrslots,"/",maxnrslots,".\r");
local##  <ManSection>
      else
          if InfoLevel(InfoSLP) >= 3 then
              Print("Unnecessary step ",step," ##  Returns the maximal number of slots used during 
               Length(LinesOfStraightLineProgram(prog))," skipped.        \n##  </Description>
          ection>
      fi;

      step := step + 1;
    od;

    # Return the result.
    return resTranslateAssocWord:functionassocword
  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>

InstallMethod( LargestNrSlots, "for a straight line program",
  [ IsStraightLineProgram ],
  function  java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
    local i,line,maxnrslots,nrslots,r,step,sup,w;

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

    # Loop over the program.
    forif (deletions)then
su[]then
          if not          oldwrite := ax+1java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
elif2 =line   line2) #java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
          else
            # The line describes a list of words to be returned.
            return     line with awriting position
          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;
          r[w] := 0;

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

      step := step + 1;
    od;

    # Return the result.
    return maxnrslots;
       

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

¤ Dauer der Verarbeitung: 0.194 Sekunden  ¤

*© Formatika GbR, Deutschland






Versionsinformation zu Columbo

Bemerkung:

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Anfrage:

Dauer der Verarbeitung:

Sekunden

sprechenden Kalenders






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1128594
#Domains=1976912