  
  [1X5 [33X[0;0YCrossed products and their elements[133X[101X
  
  [33X[0;0YThe package [5XWedderga[105X 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 [14X9.6[114X for
  definitions). This can be done using the function [2XCrossedProduct[102X ([14X5.1-1[114X).[133X
  
  [33X[0;0YNote  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[105X
  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.[133X
  
  
  [1X5.1 [33X[0;0YConstruction of crossed products[133X[101X
  
  [1X5.1-1 CrossedProduct[101X
  
  [33X[1;0Y[29X[2XCrossedProduct[102X( [3XR[103X, [3XG[103X, [3Xact[103X, [3Xtwist[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YRing in the category [10XIsCrossedProduct[110X.[133X
  
  [33X[0;0YThe input should be formed by:[133X
  
  [33X[0;0Y* an associative ring [3XR[103X,[133X
  
  [33X[0;0Y* a group [3XG[103X,[133X
  
  [33X[0;0Y*  a  function  [3Xact(RG,g)[103X  of  two  arguments: the crossed product [3XRG[103X and an
  element  [3Xg[103X  in  [22XG[122X. It must return a mapping from [3XR[103X to [3XR[103X which can be applied
  via the "[10X\^[110X" operation, and[133X
  
  [33X[0;0Y*  a function [3Xtwist(RG,g,h)[103X of three arguments: the crossed product [3XRG[103X and a
  pair of elements of [3XG[103X. It must return an invertible element of [3XR[103X.[133X
  
  [33X[0;0YReturns  the  crossed  product  of  [3XG[103X  over  the  ring [3XR[103X with action [3Xact[103X and
  twisting [3Xtwist[103X.[133X
  
  [33X[0;0YThe  resulting  crossed  product  belongs  to the category [10XIsCrossedProduct[110X,
  which is defined as a subcategory of [10XIsFLMLORWithOne[110X.[133X
  
  [33X[0;0YAn example of the trivial action:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28Xact := function(RG,a)[128X[104X
    [4X[28X    return IdentityMapping( LeftActingDomain( RG ) );[128X[104X
    [4X[28Xend;[128X[104X
  [4X[32X[104X
  
  [33X[0;0Yand the trivial twisting:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28Xtwist := function( RG , g, h )[128X[104X
    [4X[28X    return One( LeftActingDomain( RG ) );[128X[104X
    [4X[28Xend;[128X[104X
  [4X[32X[104X
  
  [33X[0;0YLet [22Xn[122X be a positive integer and [22Xξ_n[122X an [22Xn[122X-th complex primitive root of unity.
  The natural action of the group of units of [22Xℤ_n[122X, the ring of integers modulo
  [22Xn[122X, on [22Xℚ (ξ_n)[122X can be defined as follows:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28Xact := function(RG,a)[128X[104X
    [4X[28X    return ANFAutomorhism( LeftActingDomain( RG ) , Int( a ) );[128X[104X
    [4X[28Xend;[128X[104X
  [4X[32X[104X
  
  [33X[0;0YIn  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 [22Xℚ (i)=GaussianRationals[122X. One realizes the cyclic group
  of  order  2  as  the  group  of  units  of [22Xℤ / 4 ℤ[122X and one uses the natural
  isomorphism [22Xℤ / 4 ℤ → Gal( ℚ (i)/ ℚ )[122X to describe the action.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XR := GaussianRationals;[127X[104X
    [4X[28XGaussianRationals[128X[104X
    [4X[25Xgap>[125X [27XG := Units( ZmodnZ(4) );[127X[104X
    [4X[28X<group of size 2 with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27Xact := function(RG,g)[127X[104X
    [4X[25X>[125X [27Xreturn ANFAutomorphism( LeftActingDomain(RG), Int(g) );[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( RG, g ) ... end[128X[104X
    [4X[25Xgap>[125X [27Xtwist1 := function( RG, g, h )[127X[104X
    [4X[25X>[125X [27Xif IsOne(g) or IsOne(h) then[127X[104X
    [4X[25X>[125X [27X   return One(LeftActingDomain(RG));[127X[104X
    [4X[25X>[125X [27Xelse[127X[104X
    [4X[25X>[125X [27X   return -One(LeftActingDomain(RG));[127X[104X
    [4X[25X>[125X [27Xfi;[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( RG, g, h ) ... end[128X[104X
    [4X[25Xgap>[125X [27XRG := CrossedProduct( R, G, act, twist1 );[127X[104X
    [4X[28X<crossed product over GaussianRationals of a group of size 2>[128X[104X
    [4X[25Xgap>[125X [27Xi := E(4) * One(G)^Embedding(G,RG); [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))[128X[104X
    [4X[25Xgap>[125X [27Xj := ZmodnZObj(3,4)^Embedding(G,RG); [127X[104X
    [4X[28X(ZmodnZObj( 3, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27Xi^2;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xj^2;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xi*j+j*i;  [127X[104X
    [4X[28X<zero> of ...[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YOne can construct the following generalized quaternion algebra with the same
  action and a different twisting[133X
  
  
  [24X[33X[0;6Yℚ (i,j|i^2=-1,j^2=-3,ji=-ij)[133X
  
  [124X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xtwist2:=function(RG,g,h)[127X[104X
    [4X[25X>[125X [27Xif IsOne(g) or IsOne(h) then[127X[104X
    [4X[25X>[125X [27X    return One(LeftActingDomain( RG ));[127X[104X
    [4X[25X>[125X [27Xelse[127X[104X
    [4X[25X>[125X [27X    return -3*One(LeftActingDomain( RG ));[127X[104X
    [4X[25X>[125X [27Xfi;[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( RG, g, h ) ... end[128X[104X
    [4X[25Xgap>[125X [27XRG := CrossedProduct( R, G, act, twist2 );  [127X[104X
    [4X[28X<crossed product over GaussianRationals of a group of size 2>[128X[104X
    [4X[25Xgap>[125X [27Xi := E(4) * One(G)^Embedding(G,RG); [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))[128X[104X
    [4X[25Xgap>[125X [27Xj := ZmodnZObj(3,4)^Embedding(G,RG);  [127X[104X
    [4X[28X(ZmodnZObj( 3, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27Xi^2;                           [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xj^2;                                [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-3)[128X[104X
    [4X[25Xgap>[125X [27Xi*j+j*i;                       [127X[104X
    [4X[28X<zero> of ...[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  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.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XC2 := CyclicGroup(2);[127X[104X
    [4X[28X<pc group of size 2 with 1 generators>[128X[104X
    [4X[25Xgap>[125X [27XG := DirectProduct(C2,C2);[127X[104X
    [4X[28X<pc group of size 4 with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xact := function(RG,a)[127X[104X
    [4X[25X>[125X [27X    return IdentityMapping( LeftActingDomain(RG));[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( RG, a ) ... end[128X[104X
    [4X[25Xgap>[125X [27Xtwist := function( RG, g , h )[127X[104X
    [4X[25X>[125X [27Xlocal one,g1,g2,h1,h2,G;[127X[104X
    [4X[25X>[125X [27XG := UnderlyingMagma( RG );[127X[104X
    [4X[25X>[125X [27Xone := One( C2 );[127X[104X
    [4X[25X>[125X [27Xg1 := Image( Projection(G,1), g );[127X[104X
    [4X[25X>[125X [27Xg2 := Image( Projection(G,2), g );[127X[104X
    [4X[25X>[125X [27Xh1 := Image( Projection(G,1), h );[127X[104X
    [4X[25X>[125X [27Xh2 := Image( Projection(G,2), h );[127X[104X
    [4X[25X>[125X [27Xif g = One( G ) or h = One( G ) then return 1;[127X[104X
    [4X[25X>[125X [27X  elif IsOne(g1) and not IsOne(g2) and not IsOne(h1) and not IsOne(h2)[127X[104X
    [4X[25X>[125X [27X    then return 1;[127X[104X
    [4X[25X>[125X [27X  elif not IsOne(g1) and IsOne(g2) and IsOne(h1) and not IsOne(h2)[127X[104X
    [4X[25X>[125X [27X    then return 1;[127X[104X
    [4X[25X>[125X [27X  elif not IsOne(g1) and not IsOne(g2) and not IsOne(h1) and IsOne(h2)[127X[104X
    [4X[25X>[125X [27X    then return 1;[127X[104X
    [4X[25X>[125X [27X  else return -1;[127X[104X
    [4X[25X>[125X [27Xfi;[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( RG, g, h ) ... end[128X[104X
    [4X[25Xgap>[125X [27XHQ := CrossedProduct( Rationals, G, act, twist );[127X[104X
    [4X[28X<crossed product over Rationals of a group of size 4>[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YChanging the rationals by the integers as coefficient ring one can construct
  the Hamiltonian quaternion ring.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XHZ := CrossedProduct( Integers, G, act, twist );[127X[104X
    [4X[28X<crossed product over Integers of a group of size 4>[128X[104X
    [4X[25Xgap>[125X [27Xi := GeneratorsOfGroup(G)[1]^Embedding(G,HZ); [127X[104X
    [4X[28X(f1)*(1)[128X[104X
    [4X[25Xgap>[125X [27Xj := GeneratorsOfGroup(G)[2]^Embedding(G,HZ);[127X[104X
    [4X[28X(f2)*(1)[128X[104X
    [4X[25Xgap>[125X [27Xi^2;[127X[104X
    [4X[28X(<identity> of ...)*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xj^2; [127X[104X
    [4X[28X(<identity> of ...)*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xi*j+j*i;                                      [127X[104X
    [4X[28X<zero> of ...[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YOne  can  extract  the  arguments  used  for the construction of the crossed
  product using the following attributes:[133X
  
  [33X[0;0Y* [10XLeftActingDomain[110X for the coefficient ring.[133X
  
  [33X[0;0Y* [10XUnderlyingMagma[110X for the underlying group.[133X
  
  [33X[0;0Y* [10XActionForCrossedProduct[110X for the action.[133X
  
  [33X[0;0Y* [10XTwistingForCrossedProduct[110X for the twisting.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XLeftActingDomain(HZ);[127X[104X
    [4X[28XIntegers[128X[104X
    [4X[25Xgap>[125X [27XG:=UnderlyingMagma(HZ);[127X[104X
    [4X[28X<pc group of size 4 with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xac := ActionForCrossedProduct(HZ);[127X[104X
    [4X[28Xfunction( RG, a ) ... end[128X[104X
    [4X[25Xgap>[125X [27XList( G , x -> ac( HZ, x ) );[127X[104X
    [4X[28X[ IdentityMapping( Integers ), IdentityMapping( Integers ),[128X[104X
    [4X[28X  IdentityMapping( Integers ), IdentityMapping( Integers ) ][128X[104X
    [4X[25Xgap>[125X [27Xtw := TwistingForCrossedProduct( HZ );[127X[104X
    [4X[28Xfunction( RG, g, h ) ... end[128X[104X
    [4X[25Xgap>[125X [27XList( G, x -> List( G , y -> tw( HZ, x, y ) ) );[127X[104X
    [4X[28X[ [ 1, 1, 1, 1 ], [ 1, -1, -1, 1 ], [ 1, 1, -1, -1 ], [ 1, -1, 1, -1 ] ]  [128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YSome   more   examples   of  crossed  products  arise  from  the  [13XWedderburn
  decomposition[113X ([14X9.3[114X) of group algebras.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(32,50);[127X[104X
    [4X[28X<pc group of size 32 with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27XA := SimpleAlgebraByCharacter( GroupRing(Rationals,G), Irr(G)[17]) ;[127X[104X
    [4X[28X( <crossed product with center Rationals over GaussianRationals of a group of \[128X[104X
    [4X[28Xsize 2>^[ 2, 2 ] )[128X[104X
    [4X[25Xgap>[125X [27XSimpleAlgebraByCharacterInfo( GroupRing(Rationals,G), Irr(G)[17]) ;[127X[104X
    [4X[28X[ 2, Rationals, 4, [ 2, 3, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XB := LeftActingDomain(A);[127X[104X
    [4X[28X<crossed product with center Rationals over GaussianRationals of a group of si\[128X[104X
    [4X[28Xze 2>[128X[104X
    [4X[25Xgap>[125X [27XL := LeftActingDomain(B);[127X[104X
    [4X[28XGaussianRationals[128X[104X
    [4X[25Xgap>[125X [27XH := UnderlyingMagma( B );[127X[104X
    [4X[28X<group of size 2 with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XElements(H);[127X[104X
    [4X[28X[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ][128X[104X
    [4X[25Xgap>[125X [27Xi := E(4) * One(H)^Embedding(H,B);[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))[128X[104X
    [4X[25Xgap>[125X [27Xj := ZmodnZObj(3,4)^Embedding(H,B);[127X[104X
    [4X[28X(ZmodnZObj( 3, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27Xi^2;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xj^2;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27Xi*j+j*i;[127X[104X
    [4X[28X<zero> of ...[128X[104X
    [4X[25Xgap>[125X [27Xac := ActionForCrossedProduct( B );[127X[104X
    [4X[28Xfunction( RG, a ) ... end[128X[104X
    [4X[25Xgap>[125X [27Xtw := TwistingForCrossedProduct( B );[127X[104X
    [4X[28Xfunction( RG, a, b ) ... end[128X[104X
    [4X[25Xgap>[125X [27XList( H , x -> ac( B, x ) );[127X[104X
    [4X[28X[ IdentityMapping( GaussianRationals ), ANFAutomorphism( GaussianRationals,[128X[104X
    [4X[28X    3 ) ][128X[104X
    [4X[25Xgap>[125X [27XList( H , x -> List( H , y -> tw( B, x, y ) ) );[127X[104X
    [4X[28X[ [ 1, 1 ], [ 1, -1 ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XQG:=GroupRing( Rationals, SmallGroup(24,3) );;[127X[104X
    [4X[25Xgap>[125X [27XWedderburnDecomposition(QG);[127X[104X
    [4X[28X[ Rationals, CF(3), ( Rationals^[ 3, 3 ] ),[128X[104X
    [4X[28X  <crossed product with center Rationals over GaussianRationals of a group of \[128X[104X
    [4X[28Xsize 2>, <crossed product with center CF(3) over AsField( CF(3), CF([128X[104X
    [4X[28X    12) ) of a group of size 2> ][128X[104X
    [4X[25Xgap>[125X [27XR:=WedderburnDecomposition( QG )[4];[127X[104X
    [4X[28X<crossed product with center Rationals over GaussianRationals of a group of si\[128X[104X
    [4X[28Xze 2>[128X[104X
    [4X[25Xgap>[125X [27XIsCrossedProduct(R);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsAlgebra(R);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsRing(R);       [127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XLeftActingDomain( R );[127X[104X
    [4X[28XGaussianRationals[128X[104X
    [4X[25Xgap>[125X [27XAsList( UnderlyingMagma( R ) );[127X[104X
    [4X[28X[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ][128X[104X
    [4X[25Xgap>[125X [27XPrint( ActionForCrossedProduct( R ) ); Print("\n");[127X[104X
    [4X[28Xfunction ( RG, a )[128X[104X
    [4X[28X    local  cond, redu;[128X[104X
    [4X[28X    cond := OperationRecord( RG ).cond;[128X[104X
    [4X[28X    redu := OperationRecord( RG ).redu;[128X[104X
    [4X[28X    return[128X[104X
    [4X[28X     ANFAutomorphism( CF( cond ), Int( PreImagesRepresentative( redu, a ) ) );[128X[104X
    [4X[28Xend[128X[104X
    [4X[25Xgap>[125X [27XPrint( TwistingForCrossedProduct( R ) ); Print("\n");                     [127X[104X
    [4X[28Xfunction ( RG, a, b )[128X[104X
    [4X[28X    local  orderroot, cocycle;[128X[104X
    [4X[28X    orderroot := OperationRecord( RG ).orderroot;[128X[104X
    [4X[28X    cocycle := OperationRecord( RG ).cocycle;[128X[104X
    [4X[28X    return E( orderroot ) ^ Int( cocycle( a, b ) );[128X[104X
    [4X[28Xend[128X[104X
    [4X[25Xgap>[125X [27XIsAssociative(R);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsFinite(R);           [127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsFiniteDimensional(R);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XAsList(Basis(R));[127X[104X
    [4X[28X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ] [128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfLeftOperatorRingWithOne(R);[127X[104X
    [4X[28X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ][128X[104X
    [4X[25Xgap>[125X [27XOne(R);[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27XZero(R);[127X[104X
    [4X[28X<zero> of ...[128X[104X
    [4X[25Xgap>[125X [27XCharacteristic(R);[127X[104X
    [4X[28X0[128X[104X
    [4X[25Xgap>[125X [27XCenterOfCrossedProduct(R);[127X[104X
    [4X[28XRationals[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe next example shows how one can use [2XCrossedProduct[102X to produce generalized
  quaternion  algebras.  Note that one can construct quaternion algebras using
  the [5XGAP[105X function [10XQuaternionAlgebra[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XQuat := function(R,a,b)[127X[104X
    [4X[25X>[125X [27Xlocal G,act,twist;[127X[104X
    [4X[25X>[125X [27Xif not(a in R and b in R and a <> Zero(R) and b <> Zero(R) ) then[127X[104X
    [4X[25X>[125X [27XError("<a>  and <b> must be non zero elements of <R>!!!");[127X[104X
    [4X[25X>[125X [27Xfi;[127X[104X
    [4X[25X>[125X [27XG := SmallGroup(4,2);[127X[104X
    [4X[25X>[125X [27Xact := function(RG,a)[127X[104X
    [4X[25X>[125X [27X    return IdentityMapping( LeftActingDomain(RG));[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[25X>[125X [27Xtwist := function( RG, g , h )[127X[104X
    [4X[25X>[125X [27Xlocal one,g1,g2;[127X[104X
    [4X[25X>[125X [27Xone := One(G);[127X[104X
    [4X[25X>[125X [27Xg1 := G.1;[127X[104X
    [4X[25X>[125X [27Xg2 := G.2;[127X[104X
    [4X[25X>[125X [27Xif   g = one or h = one then[127X[104X
    [4X[25X>[125X [27X  return One(R);[127X[104X
    [4X[25X>[125X [27Xelif g = g1 then[127X[104X
    [4X[25X>[125X [27X  if h = g2 then[127X[104X
    [4X[25X>[125X [27X    return One(R);[127X[104X
    [4X[25X>[125X [27X  else[127X[104X
    [4X[25X>[125X [27X    return a;[127X[104X
    [4X[25X>[125X [27X  fi;[127X[104X
    [4X[25X>[125X [27Xelif g = g2 then[127X[104X
    [4X[25X>[125X [27X  if h = g1 then[127X[104X
    [4X[25X>[125X [27X    return -One(R);[127X[104X
    [4X[25X>[125X [27X  elif h=g2 then[127X[104X
    [4X[25X>[125X [27X    return b;[127X[104X
    [4X[25X>[125X [27X  else[127X[104X
    [4X[25X>[125X [27X    return -b;[127X[104X
    [4X[25X>[125X [27X  fi;[127X[104X
    [4X[25X>[125X [27Xelse[127X[104X
    [4X[25X>[125X [27X  if h = g1 then[127X[104X
    [4X[25X>[125X [27X    return -b;[127X[104X
    [4X[25X>[125X [27X  elif h=g2 then[127X[104X
    [4X[25X>[125X [27X    return b;[127X[104X
    [4X[25X>[125X [27X  else[127X[104X
    [4X[25X>[125X [27X    return -a*b;[127X[104X
    [4X[25X>[125X [27X  fi;[127X[104X
    [4X[25X>[125X [27Xfi;[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[25X>[125X [27Xreturn CrossedProduct(R,G,act,twist);[127X[104X
    [4X[25X>[125X [27Xend;[127X[104X
    [4X[28Xfunction( R, a, b ) ... end[128X[104X
    [4X[25Xgap>[125X [27XHQ := Quat(Rationals,2,3);[127X[104X
    [4X[28X<crossed product over Rationals of a group of size 4>[128X[104X
    [4X[25Xgap>[125X [27XG := UnderlyingMagma(HQ);[127X[104X
    [4X[28X<pc group of size 4 with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xtw := TwistingForCrossedProduct( HQ );[127X[104X
    [4X[28Xfunction( RG, g, h ) ... end[128X[104X
    [4X[25Xgap>[125X [27XList( G, x -> List( G, y -> tw( HQ, x, y ) ) );[127X[104X
    [4X[28X[ [ 1, 1, 1, 1 ], [ 1, 3, -1, -3 ], [ 1, 1, 2, 2 ], [ 1, 3, -3, -6 ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X5.2 [33X[0;0YCrossed product elements and their properties[133X[101X
  
  [1X5.2-1 ElementOfCrossedProduct[101X
  
  [33X[1;0Y[29X[2XElementOfCrossedProduct[102X( [3XFam[103X, [3Xzerocoeff[103X, [3Xcoeffs[103X, [3Xelts[103X ) [32X property[133X
  
  [33X[0;0YReturns the element [22Xm_1*c_1 + ... + m_n*c_n[122X of a crossed product, where [3Xelts[103X
  [22X=  [  m_1, m_2, ..., m_n ][122X is a list of magma elements, [3Xcoeffs[103X [22X= [ c_1, c_2,
  ...,  c_n  ][122X  is  a  list of coefficients. The output belongs to the crossed
  product  whose elements lie in the family [3XFam[103X. The second argument [3Xzerocoeff[103X
  must  be  the  zero  element of the coefficient ring containing coefficients
  [22Xc_i[122X,  and  will  be  stored  in the attribute [10XZeroCoefficient[110X of the crossed
  product element.[133X
  
  [33X[0;0YThe  output  will  be  in the category [10XIsElementOfCrossedProduct[110X, which is a
  subcategory  of  [10XIsRingElementWithInverse[110X.  It  will  have  the presentation
  [10XIsCrossedProductObjDefaultRep[110X.[133X
  
  [33X[0;0YSimilarly  to  magma  rings,  one  can  obtain  the list of coefficients and
  elements with [10XCoefficientsAndMagmaElements[110X .[133X
  
  [33X[0;0YAlso  note from the example below and several other examples in this chapter
  that  instead  of  [10XElementOfCrossedProduct[110X  one  can  use [10XEmbedding[110X to embed
  elements  of  the  coefficient  ring  and  of  the underlying magma into the
  crossed product.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XQG := GroupRing( Rationals, SmallGroup(24,3) );[127X[104X
    [4X[28X<algebra-with-one over Rationals, with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XR := WedderburnDecomposition( QG )[4];[127X[104X
    [4X[28X<crossed product with center Rationals over GaussianRationals of a group of si\[128X[104X
    [4X[28Xze 2>[128X[104X
    [4X[25Xgap>[125X [27XH := UnderlyingMagma( R );;[127X[104X
    [4X[25Xgap>[125X [27Xfam := ElementsFamily( FamilyObj( R ) );;[127X[104X
    [4X[25Xgap>[125X [27Xg := ElementOfCrossedProduct( fam, 0, [ 1, E(4) ], AsList(H) );[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))[128X[104X
    [4X[25Xgap>[125X [27XCoefficientsAndMagmaElements( g );    [127X[104X
    [4X[28X[ ZmodnZObj( 1, 4 ), 1, ZmodnZObj( 3, 4 ), E(4) ][128X[104X
    [4X[25Xgap>[125X [27Xt := List( H, x -> x^Embedding( H, R ) );[127X[104X
    [4X[28X[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ][128X[104X
    [4X[25Xgap>[125X [27Xt[1] + t[2]*E(4);  [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))[128X[104X
    [4X[25Xgap>[125X [27Xg = t[1] + E(4)*t[2];[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27Xg = t[1] + t[2]*E(4);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xh := ElementOfCrossedProduct( fam, 0, [ E(4), 1 ], AsList(H) );     [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27Xg+h;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(1+E(4))+(ZmodnZObj( 3, 4 ))*(1+E(4))[128X[104X
    [4X[25Xgap>[125X [27Xg*E(4);[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(-1)[128X[104X
    [4X[25Xgap>[125X [27XE(4)*g;     [127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)[128X[104X
    [4X[25Xgap>[125X [27Xg*h;[127X[104X
    [4X[28X(ZmodnZObj( 1, 4 ))*(2*E(4))[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
