#############################################################################
##
#W  example3.g               XMOD example files                 Chris Wensley
#W                                                                & Murat Alp
##
#H  $Id: example3.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
##
#############################################################################

if not IsBound( s3c4 ) then
    Error( "please read in the file  example1.g  before reading this" );
fi;

Print("\nXMod example file example3.g (version 05/07/06) :-");
Print("\ntesting constructions of cat1-groups\n");
Print("\nFirst, a permutation group example:\n\n");

t2 := GroupHomomorphismByImages( s3c4, s3, gens3c4, [(1,2),(2,3),()] );
e2 := InclusionMappingGroups( s3c4, s3 );
C2 := Cat1( t2, t2, e2 );
Print("cat1-group C2 = ",C2,"\n" );
Display( C2 );
XC2 := XModByCat1( C2 );
Print("associated crossed module is XC2 = ", XC2, "\n" );
Display( XC2 );

Print("\nSecondly, the PcGroup version:\n\n");
ps3 := SymmetricGroup(IsPcGroup,3);;   SetName(ps3,"ps3");
genps3 := GeneratorsOfGroup(ps3);
pc4 := CyclicGroup(4);;  SetName( pc4, "pc4" );
ps3c4 := DirectProduct( ps3, pc4 );;  SetName( ps3c4, "ps3c4" );  
genps3c4 := GeneratorsOfGroup( ps3c4 );
a := genps3[1];;  b := genps3[2];;  one := One(ps3);;
pt2 := GroupHomomorphismByImages( ps3c4, ps3, genps3c4, [a,b,one,one] );
Print("\npt2 = ", pt2, "\n" );
SetName( Kernel(pt2), "ker(pt2)" );
pe2 := Embedding( ps3c4, 1 );
Print("\npe2 = ", pe2, "\n" );
pC2 := Cat1( pt2, pt2, pe2 );
Display( pC2 );
Print("IsPcCat1( pC2 ) ? ", IsPcCat1(pC2), "\n" );
Print("\npC2 has size ", Size(pC2), "\n" );
pX2 := XModOfCat1( pC2 );
Display( pX2 );

Print("==============================================================\n\n");

CX1 := Cat1ByXMod( X1 );
Print("cat1-group associated to X1 is CX1 = \n", CX1, "\n" );
Display( CX1 );

hol20 := Group( (5,6,7,8,9), (6,7,9,8) );
SetName( hol20, "hol20" );
gen20 := GeneratorsOfGroup( hol20 );
c4 := Subgroup( hol20, [ (6,7,9,8) ] );
SetName( c4, "c4" );
im20 := [ (), (6,7,9,8) ];
h20 := GroupHomomorphismByImages( hol20, c4, gen20, im20 );
t20 := h20;
e20 := InclusionMappingGroups( hol20, c4 );
C20 := Cat1( t20, h20, e20 );
Print("cat1-group C20 = ",C20,"\n" );
Display( C20 );

Print("Properties; Attributes; Representations of C20 :-\n");
Print( KnownPropertiesOfObject(C20), "\n" );
Print( KnownAttributesOfObject(C20), "\n" );
Print( RepresentationsOfObject(C20), "\n" );
Print("C20 has size ", Size(C20), "\n\n" );

c5 := Subgroup( hol20, [ (5,6,7,8,9) ] );
SetName( c5, "c5" );
X20 := XModByNormalSubgroup( hol20, c5 );
Print("normal inclusion crossed module X20 = ",X20,"\n" );
Display( X20 );
CX20 := Cat1ByXMod( X20 );
Print("associated cat1-group CX20 = ",CX20,"\n" );
Display( CX20 );
G20 := Source( CX20 );
Print("CX20 has source ",G20,", with Properties, Attributes:\n");
Print(KnownPropertiesOfObject(G20),"\n");
Print(KnownAttributesOfObject(G20),"\n");
sdp20 := SemidirectProductInfo(G20);
Print("The SemidirectProductInfo of G20 is:\n",sdp20,"\n");

Print("\nSelecting from data file cat1data.g :-\n" );
Print("(1) Listing groups of given order:\n");
L18 := Cat1Select( 18 );
Print("\n(2) Listing cat1-structures for a given group:\n");
L18_4 := Cat1Select( 18, 4 );
Print("\n(3) Selecting one structure in particular:");
C4 := Cat1Select( 18, 4, 4 );
Display( C4 );
XC4 := XModOfCat1( C4 );
Display( XC4 ); 
