diff --git a/doc/gslp.xml b/doc/gslp.xml
index 00d40fa..27e4990 100644
--- a/doc/gslp.xml
+++ b/doc/gslp.xml
@@ -14,7 +14,7 @@
The functions described in this chapter have been written by Thomas Breuer,
they are available since Utils 0.94.
-Generalized straight line programs (in the following abbreviated
+Generalized straight line programs (abbreviated
as gslps) are a generalization of the straight line programs
that are described in the ⪆ library,
see .
@@ -43,7 +43,34 @@ are that
-A gslp in ⪆ is represented by an object in the category
+
+Recall, from the main library, that the simplest form of a straight line program
+defines a way of evaluating a word in a group. For example, a^4b^7a^5b^6
+may be evaluated as cbac where c=a^4b^6.
+The following listing shows how this may be encoded, where 1,2,3
+denote the three variables; [1,4,2,6] encodes a^4b^6,
+defining the new variable 3;
+[3,1,2,1,1,1,3,1] encodes cabc;
+and 2 is the number of generators.
+The result of this program is then evaluated using generators [x,y]
+and [(1,2,3),(2,3,4)].
+
+ f2 := FreeGroup( "x", "y" );;
+gap> genf2 := GeneratorsOfGroup( f2 );;
+gap> slp := StraightLineProgram( [ [[1,4,2,6],3], [3,1,2,1,1,1,3,1] ], 2 );;
+gap> ResultOfStraightLineProgram( slp, genf2 );
+x^4*y^7*x^5*y^6
+gap> ResultOfStraightLineProgram( slp, [(1,2,3),(2,3,4)] );
+(1,2,4)
+gap> LinesOfStraightLineProgram( slp );
+[ [ [ 1, 4, 2, 6 ], 3 ], [ 3, 1, 2, 1, 1, 1, 3, 1 ] ]
+]]>
+It is generalisations of these operations which this chapter describes.
+
+
+A generalized straight line program gslp in ⪆
+is represented by an object in the category
.
This object has exactly one of the following forms.
@@ -117,7 +144,7 @@ Label="for kind and list"/>.
Defining attributes for gslps are
and .
-The probably most interesting operation for gslps is
+Probably the most interesting operation for gslps is
.
Currently we do not intend to provide methods applicable to
@@ -136,12 +163,12 @@ and .
Functions for Generalized Straight Line Programs
-<#Include Label="IsGeneralizedStraightLineProgram">
<#Include Label="GeneralizedStraightLineProgram">
+<#Include Label="IsGeneralizedStraightLineProgram">
+<#Include Label="ResultOfGeneralizedStraightLineProgram">
<#Include Label="DataOfGeneralizedStraightLineProgram">
<#Include Label="NrInputsOfGeneralizedStraightLineProgram">
<#Include Label="NrOutputsOfGeneralizedStraightLineProgram">
-<#Include Label="ResultOfGeneralizedStraightLineProgram">
<#Include Label="EquivalentStraightLineProgram">
<#Include Label="IsInternallyConsistent_gslp">
diff --git a/lib/gslp.gd b/lib/gslp.gd
index 78c0a0b..69ee77a 100644
--- a/lib/gslp.gd
+++ b/lib/gslp.gd
@@ -32,13 +32,11 @@
## .
##
## gslp:= GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
-##
-## gap> IsGeneralizedStraightLineProgram( gslp );
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> IsGeneralizedStraightLineProgram( gslp3 );
## true
-## gap> slp:= StraightLineProgram( [[[1,2]]], 1 );
-##
+## gap> slp := StraightLineProgram( [[[1,2]]], 1 );;
## gap> IsGeneralizedStraightLineProgram( slp );
## true
## gap> IsGeneralizedStraightLineProgram( [ slp, slp ] );
@@ -75,10 +73,9 @@ InstallTrueMethod( IsGeneralizedStraightLineProgram, IsStraightLineProgram );
## There is no default method to compute the value if it is not stored.
##
## gslp:= GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
-##
-## gap> DataOfGeneralizedStraightLineProgram( gslp );
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> DataOfGeneralizedStraightLineProgram( gslp2 );
## [ "union", [ , ] ]
## ]]>
##
@@ -109,9 +106,9 @@ DeclareAttribute( "DataOfGeneralizedStraightLineProgram",
## gslp is constructed.
##
## NrInputsOfGeneralizedStraightLineProgram(
-## > GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] ) );
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> NrInputsOfGeneralizedStraightLineProgram( gslp2 );
## 1
## ]]>
##
@@ -143,14 +140,16 @@ DeclareSynonymAttr( "NrInputsOfGeneralizedStraightLineProgram",
## Note that the &GAP; library does not define a corresponding attribute
## for straight line programs.
##
+## In the examples, glsp2 outputs [p^2,p^3],
+## while glsp3 outputs p^6.
## NrOutputsOfGeneralizedStraightLineProgram(
-## > GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] ) );
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> NrOutputsOfGeneralizedStraightLineProgram( gslp2 );
## 2
-## gap> NrOutputsOfGeneralizedStraightLineProgram(
-## > GeneralizedStraightLineProgram( "compose",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] ) );
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> NrOutputsOfGeneralizedStraightLineProgram( gslp3 );
## 1
## ]]>
##
@@ -191,15 +190,23 @@ DeclareAttribute( "NrOutputsOfGeneralizedStraightLineProgram",
## Label="for a list of lines (and the number of generators)"/> and
## l returns a gslp.
##
+## In the examples p^2, [p^2,p^3] and (p^2)^3
+## are computed, with p=(1,2,3,4,5,6).
+##
## GeneralizedStraightLineProgram( [[[1,2]]], 1 );
+## gap> gslp1 := GeneralizedStraightLineProgram( [[[1,2]]], 1 );
##
-## gap> GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
-##
-## gap> GeneralizedStraightLineProgram( "compose",
+## gap> ResultOfStraightLineProgram( gslp1, [(1,2,3,4,5,6)] );
+## [ (1,3,5)(2,4,6) ]
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
##
+## gap> ResultOfStraightLineProgram( gslp2, [(1,2,3,4,5,6)] );
+## [ (1,3,5)(2,4,6), (1,4)(2,5)(3,6) ]
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> ResultOfStraightLineProgram( gslp3, [(1,2,3,4,5,6)] );
+## [ () ]
## ]]>
##
##
@@ -245,23 +252,24 @@ DeclareGlobalFunction( "GeneralizedStraightLineProgram" );
##
##
##
+## In order to avoid the introduction of unnecessary operations,
+## we define just as
+## a synonym of .
+##
## gens:= [ (1,2,3,4,5,6) ];;
-## gap> gslp:= GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
-##
-## gap> ResultOfGeneralizedStraightLineProgram( gslp, gens );
+## gap> gens := [ (1,2,3,4,5,6) ];;
+## gap> gslp := StraightLineProgram( [ [ [1,2] ] ], 1 );;
+## gap> ResultOfGeneralizedStraightLineProgram( gslp, gens );
+## [ (1,3,5)(2,4,6) ]
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> ResultOfGeneralizedStraightLineProgram( gslp2, gens );
## [ (1,3,5)(2,4,6), (1,4)(2,5)(3,6) ]
-## gap> gslp:= GeneralizedStraightLineProgram( "compose",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
-##
-## gap> ResultOfGeneralizedStraightLineProgram( gslp, gens );
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> ResultOfGeneralizedStraightLineProgram( gslp3, gens );
## [ () ]
## ]]>
-##
-## In order to avoid the introduction of unnecessary operations,
-## we define just as
-## a synonym of .
##
##
## <#/GAPDoc>
@@ -290,23 +298,23 @@ DeclareOperation( "ResultOfGeneralizedStraightLineProgram",
## output, for any list of input elements.
##
## gslp:= GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
##
-## gap> slp:= EquivalentStraightLineProgram( gslp );
+## gap> slp2 := EquivalentStraightLineProgram( gslp2 );
##
-## gap> Display( slp );
+## gap> Display( slp2 );
## # input:
## r:= [ g1 ];
## # program:
## # return values:
## [ r[1]^2, r[1]^3 ]
-## gap> gslp:= GeneralizedStraightLineProgram( "compose",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
##
-## gap> slp:= EquivalentStraightLineProgram( gslp );
+## gap> slp3 := EquivalentStraightLineProgram( gslp3 );
##
-## gap> Display( slp );
+## gap> Display( slp3 );
## # input:
## r:= [ g1 ];
## # program:
diff --git a/lib/gslp.gi b/lib/gslp.gi
index ef78548..45f937a 100644
--- a/lib/gslp.gi
+++ b/lib/gslp.gi
@@ -218,13 +218,13 @@ InstallMethod( String,
## compatible with the numbers of inputs and outputs of gslp.
##
## gslp:= GeneralizedStraightLineProgram( "union",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
-## gap> IsInternallyConsistent( gslp );
+## gap> gslp2 := GeneralizedStraightLineProgram( "union",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> IsInternallyConsistent( gslp2 );
## true
-## gap> gslp:= GeneralizedStraightLineProgram( "compose",
-## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
-## gap> IsInternallyConsistent( gslp );
+## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
+## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
+## gap> IsInternallyConsistent( gslp3 );
## true
## ]]>
##