#############################################################################
##
#W  xmod_manual.g             XMOD example files                Chris Wensley
#W                                                                & Murat Alp
##
#H  $Id: xmod_manual.g,v 2.007 2006/07/05 gap Exp $
##
#Y  Copyright (C) 1999,2001 University of St. Andrews, North Haugh,
#Y                          St. Andrews, Fife KY16 9SS, Scotland
##
#############################################################################

Print("\nXMod test file xmod_manual.g (version 05/07/06) :-");
Print("\ntesting constructions of crossed modules and cat1-groups.\n\n");

## Chapter 2,  Section 2.1.3

Print("\nSection 2.1.3\n\n");

c5 := Group( (5,6,7,8,9) );
SetName( c5, "c5" );
X1 := XModByAutomorphismGroup( c5 );
Print( X1, "\n");
Display( X1 );
Print( Size(X1), "\n" );
Print( RepresentationsOfObject(X1), "\n\n" );
Print( KnownPropertiesOfObject(X1), "\n" );
Print( KnownAttributesOfObject(X1), "\n" );

Print("\nSection 2.2.1\n\n");

c := (11,12,13,14,15,16,17,18);;  d := (12,18)(13,17)(14,16);;
d16 := Group( c, d );
gend16 := GeneratorsOfGroup( d16 );
sk4 := Subgroup( d16, [ c^4, d ] );
gensk4 := GeneratorsOfGroup( sk4 );
SetName( d16, "d16" );  SetName( sk4, "sk4" );
f16 := GroupHomomorphismByImages( d16, sk4, gend16, gensk4 );
P16 := PreXModByCentralExtension( f16 );
Print("\n",P16,"\n");

Print("\nSection 2.2.2\n\n");

P := PeifferSubgroup( P16 );
Print( "\n", P, "\n" );
X16 := XModByPeifferQuotient( P16 );
Print("\n", X16, "\n" );
Display( X16 );
iso16 := IsomorphismPermGroup( Source( X16 ) );;
S16 := Image( iso16 );
Print("\n", S16, "\n\n" );

Print("\nSection 2.3.2\n\n");

s3 := SymmetricGroup(IsPcGroup,3);;   SetName(s3,"s3");
gens3 := GeneratorsOfGroup(s3);;
pc4 := CyclicGroup(4);;  SetName( pc4, "pc4" );
s3c4 := DirectProduct( s3, pc4 );;  SetName( s3c4, "s3c4" );  
gens3c4 := GeneratorsOfGroup( s3c4 );;
a := gens3[1];;  b := gens3[2];;  one := One(s3);;
t2 := GroupHomomorphismByImages( s3c4, s3, gens3c4, [a,b,one,one] );
Print( t2, "\n" );
e2 := Embedding( s3c4, 1 );;
Print( e2, "\n" );
C2 := Cat1( t2, t2, e2 );;
Display( C2 );
Print( IsPcCat1(C2), "\n" );
Print( Size(C2), "\n" );

Print("\nSection 2.3.3\n\n");

SetName( Kernel(t2), "ker(t2)" );
X2 := XModOfCat1( C2 );
Display( X2 );

Print("\nSection 2.4.1\n\n");

L18 := Cat1Select( 18 ); 
Print( "Groups of size 18 known to Cat1Select :-\n", L18, "\n" );
Print( "Cat1Select( 18, 4 )  provides a list of cat1-structures for this group:\n" );
L18_4 := Cat1Select( 18, 4 );
Print( "Cat1Select( 18, 4, 4 )  constructs the chosen cat1-group:\n" );
C4 := Cat1Select( 18, 4, 4 );
Display( C4 );
XC4 := XModOfCat1( C4 );
Print( "Here is the corresoponding crossed module:\n" );
Display( XC4 ); 
Print( "\n\n" );

## Chapter 3, 

Print("\nSection 3.1\n\n");

sigma1 := GroupHomomorphismByImages( c5, c5, [(5,6,7,8,9)], [(5,9,8,7,6)] );
#rho1 := InclusionMappingGroups( Range(X1), Range(X1) );
rho1 := IdentityMapping( Range(X1) );
mor1 := XModMorphism( X1, X1, sigma1, rho1 );
Print( mor1, "\n");
Display( mor1 );
Print( IsAutomorphism2dObject(mor1), "\n" );
#  ( IsEndomorphism2dObject(mor1) and IsBijective(mor1) ), "\n");
Print( Order(mor1), "\n\n");
Print( RepresentationsOfObject(mor1), "\n\n" );
Print( KnownPropertiesOfObject(mor1), "\n\n" );
Print( KnownAttributesOfObject(mor1), "\n\n" );

Print("\nSection 3.2\n\n");

iso2 := IsomorphismPermObject( C2 );
PC2 := Range( iso2 );
Display( iso2 );

Print("\nSection 3.3\n\n");

Print( "\n", GeneratorsOfGroup( d16 ), "\n" );
d8 := Subgroup( d16, [ c^2, d ] );
c4 := Subgroup( d8, [ c^2 ] );
SetName( d8, "d8" );  SetName( c4, "c4" );
X16 := XModByNormalSubgroup( d16, d8 );
Print( X16, "\n" ); 
X8 := SubXMod( X16, c4, d8 );
Print( X8, "\n" );
Print( IsSubXMod( X16, X8 ), "\n" );
inc8 := InclusionMorphism2dObjects( X16, X8 );
Print( inc8, "\n" );
rho := GroupHomomorphismByImages( d16, d16, [c,d], [c,d^(c^2)] );
sigma := GroupHomomorphismByImages( d8, d8, [c^2,d], [c^2,d^(c^2)] );
mor := XModMorphismByHoms( X16, X16, sigma, rho );
Print( mor, "\n" );
comp := inc8 * mor;
Print( comp, "\n" );
Print( comp = CompositionMorphism(mor,inc8), "\n" );
c2 := Group( (19,20) );;
i2 := Subgroup( c2, [()] );;
X9 := XModByNormalSubgroup( c2, i2 );;
Print( "Crossed module X9 :-\n" );
Display( X9 );
sigma9 := GroupHomomorphismByImages( c4, i2, [c^2], [()] );;
rho9 := GroupHomomorphismByImages( d8, c2, [c^2,d], [(),(19,20)] );;
mor9 := XModMorphism( X8, X9, sigma9, rho9 );
Print( "Morphism mor9 from X8 to X9 :-\n" );
Display( mor9 );
K9 := Kernel( mor9 );
Print( "\nThis morphism has a non-trivial kernel:\n" );
Display( K9 );

## Chapter 4

Print("\nSection 4.1\n\n");

g18 := Group( (1,2,3), (4,5,6), (2,3)(5,6) );;
SetName( g18, "g18" );
gen18 := GeneratorsOfGroup( g18 );;
g1 := gen18[1];;  g2 := gen18[2];;  g3 := gen18[3];;
s3 := Subgroup( g18, gen18{[2..3]} );;
SetName( s3, "s3" );;
t := GroupHomomorphismByImages( g18, s3, gen18, [g2,g2,g3] );;
h := GroupHomomorphismByImages( g18, s3, gen18, [(),g2,g3] );;
e := GroupHomomorphismByImages( s3, g18, [g2,g3], [g2,g3] );;
C3 := Cat1( t, h, e );
Print( C3, "\n" );
SetName( Kernel(t), "c3" );;
X3 := XModOfCat1( C3 );;
Display( X3 );

imchi := [ (1,2,3)(4,6,5), (1,2,3)(4,6,5) ];;
chi := DerivationByImages( X3, imchi );
Print( "\n", chi, "\n");
xi := SectionByDerivation( chi );
Print("\n", xi, "\n" );

Print("\nSection 4.2\n\n");

all3 := AllDerivations( X3 );;
imall3 := ImagesList( all3 );; Display( imall3 );
Print( "\n", KnownAttributesOfObject( all3 ), "\n\n" );
Display( ImagesTable( all3 ) );
 
reg3 := RegularDerivations( X3 );;
imder3 := ImagesList( reg3 );;
chi4 := DerivationByImages( X3, imder3[4] );
Print("\n", chi4, "\n" );
chi5 := DerivationByImages( X3, imder3[5] );
Print("\n", chi5, "\n" );
im4 := ImagePositions( chi4 );
Print("\n", im4, "\n" );
im5 := ImagePositions( chi5 );
Print("\n", im5, "\n" );
chi45 := chi4 * chi5;
Print("\n", chi45, "\n" );
im45 := ImagePositions( chi45 );
Print("\n", im45, "\n" );
pos := Position( imder3, GeneratorImages( chi45 ) );
Print("\n", pos, "\n\n" );

wgt3 := WhiteheadGroupTable( X3 );; Display( wgt3 );
wpg3 := WhiteheadPermGroup( X3 );
Print("\n", wpg3, "\n\n" );
wmt3 := WhiteheadMonoidTable( X3 );; Display( wmt3 );
wtm3 := WhiteheadTransMonoid( X3 );
Print("\n", wtm3, "\n" );

## Chapter 5

Print("\nChapter 5\n\n");

Print(X3,"\n");
WGX3 := WhiteheadPermGroup( X3 );
Print("\n",WGX3,"\n");
APX3 := AutomorphismPermGroup( X3 );
Print("\n",APX3,"\n");
WX3 := WhiteheadXMod( X3 );; 
Display( WX3 );
LX3 := LueXMod( X3 );;
Display( LX3 );
NX3 := NorrieXMod( X3 );; 
Display( NX3 );
AX3 := ActorXMod( X3 );; 
Display( AX3);
IAX3 := InnerActorXMod( X3 );;  
Display( IAX3 );
IMX3 := InnerMorphism( X3 );; 
Display( IMX3 );
Print("\n", IsInjective( IMX3 ), "\n");
ZX3 := Centre( X3 );;
Print("\n", ZX3, "\n\n" );

## Chapter 6

Print("\nChapter 6\n\n");

s4gens := [ (1,2), (2,3), (3,4) ];
s4 := Group( s4gens ); SetName(s4,"s4");
a4gens := [ (1,2,3), (2,3,4) ];
a4 := Subgroup( s4, a4gens );  SetName( a4, "a4" );
s3 := Group( (5,6),(6,7) );  SetName( s3, "s3" );
epi := GroupHomomorphismByImages( s4, s3, s4gens, [(5,6),(6,7),(5,6)] );
X4 := XModByNormalSubgroup( s4, a4 );
indX4 := SurjectiveInducedXMod( X4, epi );
Print( "\n", indX4, "\n" );
Display( indX4 );
morX4 := MorphismOfInducedXMod( indX4 );
Print( "\n", morX4, "\n" );

incd8 := RangeHom( inc8 );
Print( [ Source(incd8), Range(incd8), IsInjective(incd8) ], "\n" );
indX8 := InducedXMod( X8, incd8 );
Print( "\n", indX8, "\n" );
Display( indX8 );
morX8 := MorphismOfInducedXMod( indX8 );
Print( "\n", morX8, "\n" );
Display( morX8 );

s3b := Subgroup( s4, [ (2,3), (3,4) ] );;  SetName( s3b, "s3b" );
indX3 := InducedXMod( s4, s3b, s3b );
Print( "\n", indX3, "\n" );
isoX3 := IsomorphismGroups( Source( indX3 ), GeneralLinearGroup(2,3) );
Print( "\n", isoX3, "\n" );

## Chapter 7

Print("\n\nChapter 7,   Section 7.1.1\n\n");

c := (11,12,13,14,15,16);
d := (12,16)(13,15);
cd := c*d;
d12 := Group( [ c, d ] );
s3a := Subgroup( d12, [ c^2, d ] );
s3b := Subgroup( d12, [ c^2, cd ] );
c3 := Subgroup( d12, [ c^2 ] );
SetName( d12, "d12");  SetName( s3a, "s3a" );
SetName( s3b, "s3b" );  SetName( c3, "c3" );
XSconj := XSqByNormalSubgroups( d12, s3b, s3a, c3 );
Print( "Crossed square with normal subgroups of d12, XSconj\n" );
Print( XSconj, "\n" );
name := Name( XSconj );
Print( "XSconj has name: ", name, "\n" );
XStrans := Transpose3dObject( XSconj );
Print( "Transposed crossed square, XStrans\n" );
Print( XStrans, "\n" );

X12 := XModByNormalSubgroup( d12, s3a );
XSact := ActorXSq( X12 );
Print( "Actor crossed square for d12\n" );
Print( XSact, "\n" );

Print("\nSection 7.1.3\n\n");

Print( "XSconj has Up2dObject: ", Up2dObject( XSconj ), "\n" );
Print( "XSact has Right2dObject: ",  Right2dObject( XSact ), "\n" );
xpconj := XPair( XSconj );;
Print( "crossed pairing in XSconj maps [ (1,6)(2,5)(3,4), (2,6)(3,5) ]\n",
   "to ", ImageElmXPair( xpconj, [ (1,6)(2,5)(3,4), (2,6)(3,5) ] ), "\n" );
diag := DiagonalAction( XSact );
Print( "the diagonal action in XSact is:\n", diag, "\n" );

Print("\nSection 7.2.2\n\n");

ad12 := GroupHomomorphismByImages( d12, d12, [c,d], [c,d^c] );;
as3a := GroupHomomorphismByImages( s3a, s3a, [c^2,d], [c^2,d^c] );;
as3b := GroupHomomorphismByImages( s3b, s3b, [c^2,cd], [c^2,cd^c] );;
idc3 := IdentityMapping( c3 );;
upconj := Up2dObject( XSconj );;
leftconj := Left2dObject( XSconj );; 
downconj := Down2dObject( XSconj );; 
rightconj := Right2dObject( XSconj );; 
up := XModMorphismByHoms( upconj, upconj, idc3, as3b );
left := XModMorphismByHoms( leftconj, leftconj, idc3, as3a );
down := XModMorphismByHoms( downconj, downconj, as3a, ad12 );
right := XModMorphismByHoms( rightconj, rightconj, as3b, ad12 );
autoconj := XSqMorphism( XSconj, XSconj, up, left, down, right );; 
ord := Order( autoconj );;
Print( "constructing automorphism of XSconj, conjugating all groups by c\n" );
Display( autoconj );
Print( "the known properties of the crossed square morphism autoconj are:\n" );
Print( KnownPropertiesOfObject( autoconj ), "\n" );
Print( "autoconj is an automorphism? ", 
       IsAutomorphism3dObject( autoconj ), "\n" );


## Chapter 8

Print("\nSection 8.1\n\n");

Print( incd8, "\n" );
imd8 := Image( incd8 );
resd8 := RestrictionMappingGroups( incd8, c4, imd8 );
Print("\n", resd8, "\n" );
Print("\n", Source( resd8 ), "\n" );
Print( Range( resd8 ), "\n" );
Print("\n", MappingToOne( c4, imd8 ), "\n" );


Print("\nSection 8.2\n\n");

end8 := EndomorphismClasses( d8, 1 );
Print( Length( end8 ), "\n" );
e4 := end8[4];
Print( "\n", e4, "\n" );
Print( "\n", EndoClassNaturalHom( e4 ), "\n" );
Print( "\n", EndoClassIsomorphism( e4 ), "\n" );
Print( "\n", EndoClassConjugators( e4 ), "\n" );
Print( "\n", AutoGroup( e4 ), "\n" );

L := List( end8, e->Length(EndoClassConjugators(e))*Size(AutoGroup(e)) );
Print( "\n", L, "\n", Sum(L), "\n" );

autd8 := AutomorphismGroup( d8 );;
innd8 := InnerAutomorphismsByNormalSubgroup( d8, d8 );
Print( "\n", GeneratorsOfGroup( innd8 ), "\n" );
Print( "\n", IsGroupOfAutomorphisms( innd8 ), "\n" );

Print("\nSection 8.3\n\n");

x := (6,7)(8,9);;  y := (6,8)(7,9);;  z := (6,9)(7,8);;
k4 := Group( x, y );  SetName( k4, "k4" );
s3 := Group( (1,2), (2,3) );;  SetName( s3, "s3" );
alpha := GroupHomomorphismByImages( k4, k4, [x,y], [y,x] );
beta := GroupHomomorphismByImages( k4, k4, [x,y], [x,z] );
aut := Group( alpha, beta );
act := GroupHomomorphismByImages( s3, aut, [(1,2),(2,3)], [alpha,beta] );
abmod := AbelianModuleObject( k4, act );
Print("\n", abmod, "\n" );
Xabmod := XModByAbelianModule( abmod );
Print("\n", Xabmod, "\n" );
Display( Xabmod );


Print("\nSection 8.4\n\n");

J := [ [1,2,3], [3,4], [3,4], [1,2,4] ];
Print( J, "\n" );
Print( "\n", DistinctRepresentatives( J ), "\n" );
K := [ [3,4], [1,2], [2,3], [2,3,4] ];
Print( "\n", K, "\n" );
Print( "\n", CommonRepresentatives( J, K ), "\n" );
Print( "\n", CommonTransversal( d16, c4 ), "\n\n" );

autd8 := AutomorphismGroup( d8 );;
innd8 := InnerAutomorphismsByNormalSubgroup( d8, d8 );
Print( "\n", GeneratorsOfGroup( innd8 ), "\n" );
Print( "\n", IsGroupOfAutomorphisms( innd8 ), "\n" );

#############################################################################
##
#E  xmod_manual.g . . . . . . . . . . . . . . . . . . . . . . . . . ends here
