  
  [1X5 Crossed products[0X
  
  The package [5XWedderga[0m provides functions to construct crossed products over a
  group  with  coefficients in an associative ring with identity, and with the
  multiplication  determined  by  a  given  action  and  twisting (see [14X7.6[0m for
  definitions). This can be done using the function [2XCrossedProduct[0m ([14X5.1-1[0m).
  
  Note  that  this function does not check the associativity conditions, so in
  fact  it  is the NC-version of itself, and its output will be always assumed
  to  be  associative.  For  all  crossed  products  that  appear  in [5XWedderga[0m
  algorithms  the  associativity  follows  from  theoretical arguments, so the
  usage  of  the  NC-method  in  the  package is safe. If the user will try to
  construct  a crossed product with his own action and twisting, he/she should
  check  the  associativity  conditions  himself/herself to make sure that the
  result is correct.
  
  
  [1X5.1 Construction of crossed products[0X
  
  [1X5.1-1 CrossedProduct[0m
  
  [2X> CrossedProduct( [0X[3XR, G, act, twist[0X[2X ) ______________________________[0Xattribute
  [6XReturns:[0X  Ring in the category [10XIsCrossedProduct[0m.
  
  The input should be formed by:
  
  * an associative ring [3XR[0m,
  
  * a group [3XG[0m,
  
  *  a  function  [3Xact(RG,g)[0m  of  two  arguments: the crossed product [3XRG[0m and an
  element  [3Xg[0m  in  G. It must return a mapping from [3XR[0m to [3XR[0m which can be applied
  via the "[10X\^[0m" operation, and
  
  *  a function [3Xtwist(RG,g,h)[0m of three arguments: the crossed product [3XRG[0m and a
  pair of elements of [3XG[0m. It must return an invertible element of [3XR[0m.
  
  Returns  the  crossed  product  of  [3XG[0m  over  the  ring [3XR[0m with action [3Xact[0m and
  twisting [3Xtwist[0m.
  
  The  resulting  crossed  product  belongs  to the category [10XIsCrossedProduct[0m,
  which is defined as a subcategory of [10XIsFLMLORWithOne[0m.
  
  An example of the trivial action:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xact := function(RG,a)[0X
    [4X    return IdentityMapping( LeftActingDomain( RG ) );[0X
    [4Xend;[0X
  [4X------------------------------------------------------------------[0X
  
  and the trivial twisting:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xtwist := function( RG , g, h )[0X
    [4X    return One( LeftActingDomain( RG ) );[0X
    [4Xend;[0X
  [4X------------------------------------------------------------------[0X
  
  Let  n  be  a  positive  integer  and xi_n an n-th complex primitive root of
  unity. The natural action of the group of units of ℤ_n, the ring of integers
  modulo n, on ℚ (xi_n) can be defined as follows:
  
  [4X---------------------------  Example  ----------------------------[0X
    [4Xact := function(RG,a)[0X
    [4X    return ANFAutomorhism( LeftActingDomain( RG ) , Int( a ) );[0X
    [4Xend;[0X
  [4X------------------------------------------------------------------[0X
  
  In  the  following example one constructs the Hamiltonian quaternion algebra
  over  the rationals as a crossed product of the group of units of the cyclic
  group of order 2 over ℚ (i)=GaussianRationals. One realizes the cyclic group
  of  order  2  as  the  group  of  units  of ℤ / 4 ℤ and one uses the natural
  isomorphism ℤ / 4 ℤ -> Gal( ℚ (i)/ ℚ ) to describe the action.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> R := GaussianRationals;[0X
    [4XGaussianRationals[0X
    [4Xgap> G := Units( ZmodnZ(4) );[0X
    [4X<group with 1 generators>[0X
    [4Xgap> act := function(RG,g)[0X
    [4X> return ANFAutomorphism( LeftActingDomain(RG), Int(g) );[0X
    [4X> end;[0X
    [4Xfunction( RG, g ) ... end[0X
    [4Xgap> twist1 := function( RG, g, h )[0X
    [4X> if IsOne(g) or IsOne(h) then[0X
    [4X>    return One(LeftActingDomain(RG));[0X
    [4X> else[0X
    [4X>    return -One(LeftActingDomain(RG));[0X
    [4X> fi;[0X
    [4X> end;[0X
    [4Xfunction( RG, g, h ) ... end[0X
    [4Xgap> RG := CrossedProduct( R, G, act, twist1 );[0X
    [4X<crossed product over GaussianRationals of a group of size 2>[0X
    [4Xgap> i := E(4) * One(G)^Embedding(G,RG); [0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))[0X
    [4Xgap> j := ZmodnZObj(3,4)^Embedding(G,RG); [0X
    [4X(ZmodnZObj( 3, 4 ))*(1)[0X
    [4Xgap> i^2;[0X
    [4X(ZmodnZObj( 1, 4 ))*(-1)[0X
    [4Xgap> j^2;[0X
    [4X(ZmodnZObj( 1, 4 ))*(-1)[0X
    [4Xgap> i*j+j*i;  [0X
    [4X<zero> of ...[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  One can construct the following generalized quaternion algebra with the same
  action and a different twisting
  
  
       ℚ (i,j|i^2=-1,j^2=-3,ji=-ij)
  
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> twist2:=function(RG,g,h)[0X
    [4X> if IsOne(g) or IsOne(h) then[0X
    [4X>     return One(LeftActingDomain( RG ));[0X
    [4X> else[0X
    [4X>     return -3*One(LeftActingDomain( RG ));[0X
    [4X> fi;[0X
    [4X> end;[0X
    [4Xfunction( RG, g, h ) ... end[0X
    [4Xgap> RG := CrossedProduct( R, G, act, twist2 );  [0X
    [4X<crossed product over GaussianRationals of a group of size 2>[0X
    [4Xgap> i := E(4) * One(G)^Embedding(G,RG); [0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))[0X
    [4Xgap> j := ZmodnZObj(3,4)^Embedding(G,RG);  [0X
    [4X(ZmodnZObj( 3, 4 ))*(1)[0X
    [4Xgap> i^2;                           [0X
    [4X(ZmodnZObj( 1, 4 ))*(-1)[0X
    [4Xgap> j^2;                                [0X
    [4X(ZmodnZObj( 1, 4 ))*(-3)[0X
    [4Xgap> i*j+j*i;                       [0X
    [4X<zero> of ...[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  The  following  example  shows  how  to construct the Hamiltonian quaternion
  algebra  over  the rationals using the rationals as coefficient ring and the
  Klein group as the underlying group.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> C2 := CyclicGroup(2);[0X
    [4X<pc group of size 2 with 1 generators>[0X
    [4Xgap> G := DirectProduct(C2,C2);[0X
    [4X<pc group of size 4 with 2 generators>[0X
    [4Xgap> act := function(RG,a)[0X
    [4X>     return IdentityMapping( LeftActingDomain(RG));[0X
    [4X> end;[0X
    [4Xfunction( RG, a ) ... end[0X
    [4Xgap> twist := function( RG, g , h )[0X
    [4X> local one,g1,g2,h1,h2,G;[0X
    [4X> G := UnderlyingMagma( RG );[0X
    [4X> one := One( C2 );[0X
    [4X> g1 := Image( Projection(G,1), g );[0X
    [4X> g2 := Image( Projection(G,2), g );[0X
    [4X> h1 := Image( Projection(G,1), h );[0X
    [4X> h2 := Image( Projection(G,2), h );[0X
    [4X> if g = One( G ) or h = One( G ) then return 1;[0X
    [4X>   elif IsOne(g1) and not IsOne(g2) and not IsOne(h1) and not IsOne(h2)[0X
    [4X>     then return 1;[0X
    [4X>   elif not IsOne(g1) and IsOne(g2) and IsOne(h1) and not IsOne(h2)[0X
    [4X>     then return 1;[0X
    [4X>   elif not IsOne(g1) and not IsOne(g2) and not IsOne(h1) and IsOne(h2)[0X
    [4X>     then return 1;[0X
    [4X>   else return -1;[0X
    [4X> fi;[0X
    [4X> end;[0X
    [4Xfunction( RG, g, h ) ... end[0X
    [4Xgap> HQ := CrossedProduct( Rationals, G, act, twist );[0X
    [4X<crossed product over Rationals of a group of size 4>[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  Changing the rationals by the integers as coefficient ring one can construct
  the Hamiltonian quaternion ring.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> HZ := CrossedProduct( Integers, G, act, twist );[0X
    [4X<crossed product over Integers of a group of size 4>[0X
    [4Xgap> i := GeneratorsOfGroup(G)[1]^Embedding(G,HZ); [0X
    [4X(f1)*(1)[0X
    [4Xgap> j := GeneratorsOfGroup(G)[2]^Embedding(G,HZ);[0X
    [4X(f2)*(1)[0X
    [4Xgap> i^2;[0X
    [4X(<identity> of ...)*(-1)[0X
    [4Xgap> j^2; [0X
    [4X(<identity> of ...)*(-1)[0X
    [4Xgap> i*j+j*i;                                      [0X
    [4X<zero> of ...[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  One  can  extract  the  arguments  used  for the construction of the crossed
  product using the following attributes:
  
  * [10XLeftActingDomain[0m for the coefficient ring.
  
  * [10XUnderlyingMagma[0m for the underlying group.
  
  * [10XActionForCrossedProduct[0m for the action.
  
  * [10XTwistingForCrossedProduct[0m for the twisting.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X  [0X
    [4Xgap> LeftActingDomain(HZ);[0X
    [4XIntegers[0X
    [4Xgap> G:=UnderlyingMagma(HZ);[0X
    [4X<pc group of size 4 with 2 generators>[0X
    [4Xgap> ac := ActionForCrossedProduct(HZ);[0X
    [4Xfunction( RG, a ) ... end[0X
    [4Xgap> List( G , x -> ac( HZ, x ) );[0X
    [4X[ IdentityMapping( Integers ), IdentityMapping( Integers ),[0X
    [4X  IdentityMapping( Integers ), IdentityMapping( Integers ) ][0X
    [4Xgap> tw := TwistingForCrossedProduct( HZ );[0X
    [4Xfunction( RG, g, h ) ... end[0X
    [4Xgap> List( G, x -> List( G , y -> tw( HZ, x, y ) ) );[0X
    [4X[ [ 1, 1, 1, 1 ], [ 1, -1, -1, 1 ], [ 1, 1, -1, -1 ], [ 1, -1, 1, -1 ] ]  [0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  Some   more   examples   of  crossed  products  arise  from  the  [13XWedderburn
  decomposition[0m ([14X7.3[0m) of group algebras.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> G := SmallGroup(32,50);[0X
    [4X<pc group of size 32 with 5 generators>[0X
    [4Xgap> A := SimpleAlgebraByCharacter( GroupRing(Rationals,G), Irr(G)[17]) ;[0X
    [4X( <crossed product with center Rationals over GaussianRationals of a group of \[0X
    [4Xsize 2>^[ 2, 2 ] )[0X
    [4Xgap> SimpleAlgebraByCharacterInfo( GroupRing(Rationals,G), Irr(G)[17]) ;[0X
    [4X[ 2, Rationals, 4, [ 2, 3, 2 ] ][0X
    [4Xgap> B := LeftActingDomain(A);[0X
    [4X<crossed product with center Rationals over GaussianRationals of a group of si\[0X
    [4Xze 2>[0X
    [4Xgap> L := LeftActingDomain(B);[0X
    [4XGaussianRationals[0X
    [4Xgap> H := UnderlyingMagma( B );[0X
    [4X<group of size 2 with 2 generators>[0X
    [4Xgap> Elements(H);[0X
    [4X[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ][0X
    [4Xgap> i := E(4) * One(H)^Embedding(H,B);[0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))[0X
    [4Xgap> j := ZmodnZObj(3,4)^Embedding(H,B);[0X
    [4X(ZmodnZObj( 3, 4 ))*(1)[0X
    [4Xgap> i^2;[0X
    [4X(ZmodnZObj( 1, 4 ))*(-1)[0X
    [4Xgap> j^2;[0X
    [4X(ZmodnZObj( 1, 4 ))*(-1)[0X
    [4Xgap> i*j+j*i;[0X
    [4X<zero> of ...[0X
    [4Xgap> ac := ActionForCrossedProduct( B );[0X
    [4Xfunction( RG, a ) ... end[0X
    [4Xgap> tw := TwistingForCrossedProduct( B );[0X
    [4Xfunction( RG, a, b ) ... end[0X
    [4Xgap> List( H , x -> ac( B, x ) );[0X
    [4X[ IdentityMapping( GaussianRationals ), ANFAutomorphism( GaussianRationals,[0X
    [4X    3 ) ][0X
    [4Xgap> List( H , x -> List( H , y -> tw( B, x, y ) ) );[0X
    [4X[ [ 1, 1 ], [ 1, -1 ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> QG:=GroupRing( Rationals, SmallGroup(24,3) );;[0X
    [4Xgap> WedderburnDecomposition(QG);[0X
    [4X[ Rationals, CF(3), ( Rationals^[ 3, 3 ] ),[0X
    [4X  <crossed product with center Rationals over GaussianRationals of a group of \[0X
    [4Xsize 2>, <crossed product with center CF(3) over AsField( CF(3), CF([0X
    [4X    12) ) of a group of size 2> ][0X
    [4Xgap> R:=WedderburnDecomposition( QG )[4];[0X
    [4X<crossed product with center Rationals over GaussianRationals of a group of si\[0X
    [4Xze 2>[0X
    [4Xgap> IsCrossedProduct(R);[0X
    [4Xtrue[0X
    [4Xgap> IsAlgebra(R);[0X
    [4Xtrue[0X
    [4Xgap> IsRing(R);       [0X
    [4Xtrue[0X
    [4Xgap> LeftActingDomain( R );[0X
    [4XGaussianRationals[0X
    [4Xgap> AsList( UnderlyingMagma( R ) );[0X
    [4X[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ][0X
    [4Xgap> Print( ActionForCrossedProduct( R ) ); Print("\n");[0X
    [4Xfunction ( RG, a )[0X
    [4X    local  cond, redu;[0X
    [4X    cond := OperationRecord( RG ).cond;[0X
    [4X    redu := OperationRecord( RG ).redu;[0X
    [4X    return[0X
    [4X     ANFAutomorphism( CF( cond ), Int( PreImagesRepresentative( redu, a ) ) );[0X
    [4Xend[0X
    [4Xgap> Print( TwistingForCrossedProduct( R ) ); Print("\n");                     [0X
    [4Xfunction ( RG, a, b )[0X
    [4X    local  orderroot, cocycle;[0X
    [4X    orderroot := OperationRecord( RG ).orderroot;[0X
    [4X    cocycle := OperationRecord( RG ).cocycle;[0X
    [4X    return E( orderroot ) ^ Int( cocycle( a, b ) );[0X
    [4Xend[0X
    [4Xgap> IsAssociative(R);[0X
    [4Xtrue[0X
    [4Xgap> IsFinite(R);           [0X
    [4Xfalse[0X
    [4Xgap> IsFiniteDimensional(R);[0X
    [4Xtrue[0X
    [4Xgap> AsList(Basis(R));[0X
    [4X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ] [0X
    [4Xgap> GeneratorsOfLeftOperatorRingWithOne(R);[0X
    [4X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ][0X
    [4Xgap> One(R);[0X
    [4X(ZmodnZObj( 1, 4 ))*(1)[0X
    [4Xgap> Zero(R);[0X
    [4X<zero> of ...[0X
    [4Xgap> Characteristic(R);[0X
    [4X0[0X
    [4Xgap> CenterOfCrossedProduct(R);[0X
    [4XRationals[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  The next example shows how one can use [2XCrossedProduct[0m to produce generalized
  quaternion  algebras.  Note that one can construct quaternion algebras using
  the [5XGAP[0m function [10XQuaternionAlgebra[0m.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> Quat := function(R,a,b)[0X
    [4X>[0X
    [4X> local G,act,twist;[0X
    [4X>[0X
    [4X> if not(a in R and b in R and a <> Zero(R) and b <> Zero(R) ) then[0X
    [4X> Error("<a>  and <b> must be non zero elements of <R>!!!");[0X
    [4X> fi;[0X
    [4X>[0X
    [4X> G := SmallGroup(4,2);[0X
    [4X>[0X
    [4X> act := function(RG,a)[0X
    [4X>     return IdentityMapping( LeftActingDomain(RG));[0X
    [4X> end;[0X
    [4X>[0X
    [4X> twist := function( RG, g , h )[0X
    [4X> local one,g1,g2;[0X
    [4X> one := One(G);[0X
    [4X> g1 := G.1;[0X
    [4X> g2 := G.2;[0X
    [4X> if   g = one or h = one then[0X
    [4X>   return One(R);[0X
    [4X> elif g = g1 then[0X
    [4X>   if h = g2 then[0X
    [4X>     return One(R);[0X
    [4X>   else[0X
    [4X>     return a;[0X
    [4X>   fi;[0X
    [4X> elif g = g2 then[0X
    [4X>   if h = g1 then[0X
    [4X>     return -One(R);[0X
    [4X>   elif h=g2 then[0X
    [4X>     return b;[0X
    [4X>   else[0X
    [4X>     return -b;[0X
    [4X>   fi;[0X
    [4X> else[0X
    [4X>   if h = g1 then[0X
    [4X>     return -b;[0X
    [4X>   elif h=g2 then[0X
    [4X>     return b;[0X
    [4X>   else[0X
    [4X>     return -a*b;[0X
    [4X>   fi;[0X
    [4X> fi;[0X
    [4X> end;[0X
    [4X> return CrossedProduct(R,G,act,twist);[0X
    [4X> end;[0X
    [4Xfunction( R, a, b ) ... end[0X
    [4Xgap> HQ := Quat(Rationals,2,3);[0X
    [4X<crossed product over Rationals of a group of size 4>[0X
    [4Xgap> G := UnderlyingMagma(HQ);[0X
    [4X<pc group of size 4 with 2 generators>[0X
    [4Xgap> tw := TwistingForCrossedProduct( HQ );[0X
    [4Xfunction( RG, g, h ) ... end[0X
    [4Xgap> List( G, x -> List( G, y -> tw( HQ, x, y ) ) );[0X
    [4X[ [ 1, 1, 1, 1 ], [ 1, 3, -1, -3 ], [ 1, 1, 2, 2 ], [ 1, 3, -3, -6 ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X5.2 Crossed product elements and their properties[0X
  
  [1X5.2-1 ElementOfCrossedProduct[0m
  
  [2X> ElementOfCrossedProduct( [0X[3XFam, zerocoeff, coeffs, elts[0X[2X ) __________[0Xproperty
  
  Returns the element m_1*c_1 + ... + m_n*c_n of a crossed product, where [3Xelts[0m
  =  [  m_1, m_2, ..., m_n ] is a list of magma elements, [3Xcoeffs[0m = [ c_1, c_2,
  ...,  c_n  ]  is  a  list of coefficients. The output belongs to the crossed
  product  whose elements lie in the family [3XFam[0m. The second argument [3Xzerocoeff[0m
  must  be  the  zero  element of the coefficient ring containing coefficients
  c_i,  and  will  be  stored  in the attribute [10XZeroCoefficient[0m of the crossed
  product element.
  
  The  output  will  be  in the category [10XIsElementOfCrossedProduct[0m, which is a
  subcategory  of  [10XIsRingElementWithInverse[0m.  It  will  have  the presentation
  [10XIsCrossedProductObjDefaultRep[0m.
  
  Similarly  to  magma  rings,  one  can  obtain  the list of coefficients and
  elements with [10XCoefficientsAndMagmaElements[0m .
  
  Also  note from the example below and several other examples in this chapter
  that  instead  of  [10XElementOfCrossedProduct[0m  one  can  use [10XEmbedding[0m to embed
  elements  of  the  coefficient  ring  and  of  the underlying magma into the
  crossed product.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> QG := GroupRing( Rationals, SmallGroup(24,3) );[0X
    [4X<algebra-with-one over Rationals, with 4 generators>[0X
    [4Xgap> R := WedderburnDecomposition( QG )[4];[0X
    [4X<crossed product with center Rationals over GaussianRationals of a group of si\[0X
    [4Xze 2>[0X
    [4Xgap> H := UnderlyingMagma( R );;[0X
    [4Xgap> fam := ElementsFamily( FamilyObj( R ) );;[0X
    [4Xgap> g := ElementOfCrossedProduct( fam, 0, [ 1, E(4) ], AsList(H) );[0X
    [4X(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))[0X
    [4Xgap> CoefficientsAndMagmaElements( g );    [0X
    [4X[ ZmodnZObj( 1, 4 ), 1, ZmodnZObj( 3, 4 ), E(4) ][0X
    [4Xgap> t := List( H, x -> x^Embedding( H, R ) );[0X
    [4X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ][0X
    [4Xgap> t[1] + t[2]*E(4);  [0X
    [4X(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))[0X
    [4Xgap> g = t[1] + E(4)*t[2];[0X
    [4Xfalse[0X
    [4Xgap> g = t[1] + t[2]*E(4);[0X
    [4Xtrue[0X
    [4Xgap> h := ElementOfCrossedProduct( fam, 0, [ E(4), 1 ], AsList(H) );     [0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)[0X
    [4Xgap> g+h;[0X
    [4X(ZmodnZObj( 1, 4 ))*(1+E(4))+(ZmodnZObj( 3, 4 ))*(1+E(4))[0X
    [4Xgap> g*E(4);[0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(-1)[0X
    [4Xgap> E(4)*g;     [0X
    [4X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)[0X
    [4Xgap> g*h;[0X
    [4X(ZmodnZObj( 1, 4 ))*(2*E(4))[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
