Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 32 additions & 5 deletions doc/gslp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
The functions described in this chapter have been written by Thomas Breuer,
they are available since <Package>Utils</Package> 0.94.
<P/>
<E>Generalized straight line programs</E> (in the following abbreviated
<E>Generalized straight line programs</E> (abbreviated
as <E>gslps</E>) are a generalization of the straight line programs
that are described in the &GAP; library,
see <Ref Sect="Straight Line Programs" BookName="ref"/>.
Expand Down Expand Up @@ -43,7 +43,34 @@ are that
</Item>
</List>
<P/>
A gslp in &GAP; 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, <M>a^4b^7a^5b^6</M>
may be evaluated as <M>cbac</M> where <M>c=a^4b^6</M>.
The following listing shows how this may be encoded, where <M>1,2,3</M>
denote the three variables; <M>[1,4,2,6]</M> encodes <M>a^4b^6</M>,
defining the new variable <M>3</M>;
<M>[3,1,2,1,1,1,3,1]</M> encodes <M>cabc</M>;
and <M>2</M> is the number of generators.
The result of this program is then evaluated using generators <M>[x,y]</M>
and <M>[(1,2,3),(2,3,4)]</M>.
<P/>
<Example><![CDATA[
gap> 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 ] ]
]]></Example>
It is generalisations of these operations which this chapter describes.

<P/>
A generalized straight line program gslp in &GAP;
is represented by an object in the category
<Ref Filt="IsGeneralizedStraightLineProgram"/>.
This object has exactly one of the following forms.
<P/>
Expand Down Expand Up @@ -117,7 +144,7 @@ Label="for kind and list"/>.
Defining attributes for gslps are
<Ref Attr="NrInputsOfGeneralizedStraightLineProgram"/>
and <Ref Attr="DataOfGeneralizedStraightLineProgram"/>.
The probably most interesting operation for gslps is
Probably the most interesting operation for gslps is
<Ref Oper="ResultOfGeneralizedStraightLineProgram"/>.
<P/>
Currently we do not intend to provide methods applicable to
Expand All @@ -136,12 +163,12 @@ and <Ref Oper="String" BookName="ref"/>.
<Section Label="sec-gslp">
<Heading>Functions for Generalized Straight Line Programs</Heading>

<#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">

Expand Down
98 changes: 53 additions & 45 deletions lib/gslp.gd
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@
## <Ref Filt="IsStraightLineProgram" BookName="ref"/>.
## <P/>
## <Example><![CDATA[
## gap> gslp:= GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## <generalized straight line program>
## gap> IsGeneralizedStraightLineProgram( gslp );
## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
## gap> IsGeneralizedStraightLineProgram( gslp3 );
## true
## gap> slp:= StraightLineProgram( [[[1,2]]], 1 );
## <straight line program>
## gap> slp := StraightLineProgram( [[[1,2]]], 1 );;
## gap> IsGeneralizedStraightLineProgram( slp );
## true
## gap> IsGeneralizedStraightLineProgram( [ slp, slp ] );
Expand Down Expand Up @@ -75,10 +73,9 @@ InstallTrueMethod( IsGeneralizedStraightLineProgram, IsStraightLineProgram );
## There is no default method to compute the value if it is not stored.
## <P/>
## <Example><![CDATA[
## gap> gslp:= GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## <generalized straight line program>
## gap> DataOfGeneralizedStraightLineProgram( gslp );
## gap> gslp2 := GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
## gap> DataOfGeneralizedStraightLineProgram( gslp2 );
## [ "union", [ <straight line program>, <straight line program> ] ]
## ]]></Example>
## </Description>
Expand Down Expand Up @@ -109,9 +106,9 @@ DeclareAttribute( "DataOfGeneralizedStraightLineProgram",
## <A>gslp</A> is constructed.
## <P/>
## <Example><![CDATA[
## gap> NrInputsOfGeneralizedStraightLineProgram(
## > GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] ) );
## gap> gslp2 := GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
## gap> NrInputsOfGeneralizedStraightLineProgram( gslp2 );
## 1
## ]]></Example>
## <P/>
Expand Down Expand Up @@ -143,14 +140,16 @@ DeclareSynonymAttr( "NrInputsOfGeneralizedStraightLineProgram",
## Note that the &GAP; library does not define a corresponding attribute
## for straight line programs.
## <P/>
## In the examples, glsp2 outputs <M>[p^2,p^3]</M>,
## while glsp3 outputs <M>p^6</M>.
## <Example><![CDATA[
## gap> 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
## ]]></Example>
## </Description>
Expand Down Expand Up @@ -191,15 +190,23 @@ DeclareAttribute( "NrOutputsOfGeneralizedStraightLineProgram",
## Label="for a list of lines (and the number of generators)"/> and
## <C>l</C> returns a gslp.
## <P/>
## In the examples <M>p^2, [p^2,p^3]</M> and <M>(p^2)^3</M>
## are computed, with <M>p=(1,2,3,4,5,6)</M>.
## <P/>
## <Example><![CDATA[
## gap> GeneralizedStraightLineProgram( [[[1,2]]], 1 );
## gap> gslp1 := GeneralizedStraightLineProgram( [[[1,2]]], 1 );
## <straight line program>
## gap> GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## <generalized straight line program>
## 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 ] ] );
## <generalized straight line program>
## 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)] );
## [ () ]
## ]]></Example>
## </Description>
## </ManSection>
Expand Down Expand Up @@ -245,23 +252,24 @@ DeclareGlobalFunction( "GeneralizedStraightLineProgram" );
## </Item>
## </List>
## <P/>
## In order to avoid the introduction of unnecessary operations,
## we define <Ref Oper="ResultOfGeneralizedStraightLineProgram"/> just as
## a synonym of <Ref Oper="ResultOfStraightLineProgram" BookName="ref"/>.
## <P/>
## <Example><![CDATA[
## gap> gens:= [ (1,2,3,4,5,6) ];;
## gap> gslp:= GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## <generalized straight line program>
## 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 ] ] );
## <generalized straight line program>
## gap> ResultOfGeneralizedStraightLineProgram( gslp, gens );
## gap> gslp3 := GeneralizedStraightLineProgram( "compose",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );;
## gap> ResultOfGeneralizedStraightLineProgram( gslp3, gens );
## [ () ]
## ]]></Example>
## <P/>
## In order to avoid the introduction of unnecessary operations,
## we define <Ref Oper="ResultOfGeneralizedStraightLineProgram"/> just as
## a synonym of <Ref Oper="ResultOfStraightLineProgram" BookName="ref"/>.
## </Description>
## </ManSection>
## <#/GAPDoc>
Expand Down Expand Up @@ -290,23 +298,23 @@ DeclareOperation( "ResultOfGeneralizedStraightLineProgram",
## output, for any list of input elements.
## <P/>
## <Example><![CDATA[
## gap> gslp:= GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## gap> gslp2 := GeneralizedStraightLineProgram( "union",
## > [ [ [[[1,2]]], 1 ], [ [[[1,3]]], 1 ] ] );
## <generalized straight line program>
## gap> slp:= EquivalentStraightLineProgram( gslp );
## gap> slp2 := EquivalentStraightLineProgram( gslp2 );
## <straight line program>
## 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 ] ] );
## <generalized straight line program>
## gap> slp:= EquivalentStraightLineProgram( gslp );
## gap> slp3 := EquivalentStraightLineProgram( gslp3 );
## <straight line program>
## gap> Display( slp );
## gap> Display( slp3 );
## # input:
## r:= [ g1 ];
## # program:
Expand Down
12 changes: 6 additions & 6 deletions lib/gslp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ InstallMethod( String,
## compatible with the numbers of inputs and outputs of <A>gslp</A>.
## <P/>
## <Example><![CDATA[
## gap> 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
## ]]></Example>
## </Description>
Expand Down