<!-- ********************crossed******************** -->

<Chapter Label="Crossed">
<Heading>Crossed products and their elements</Heading>

The package &Wedderga; 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 <Ref Sect="CrossedProd" /> for definitions). This can be done
using the function <Ref Func="CrossedProduct" />.<P/>

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 &Wedderga;
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.
 
<Section Label="CrossedConstruction">
<Heading>Construction of crossed products</Heading>
            
<ManSection>
   <Attr Name="CrossedProduct" 
         Arg="R G act twist"  
         Comm="" />
   <Returns>
         Ring in the category <C>IsCrossedProduct</C>.
   </Returns>
   <Description>
         The input should be formed by: <P/>
         
         * an associative ring <A>R</A>, <P/> 
         
         * a group <A>G</A>, <P/>
         
         * a function <A>act(RG,g)</A> of two arguments: 
           the crossed product <A>RG</A> and an element 
           <A>g</A> in <M>G</M>.
           It must return a mapping from <A>R</A> to <A>R</A> 
           which can be applied via the "<C>\^</C>" operation, 
           and <P/>
            
         * a function <A>twist(RG,g,h)</A> of three arguments: 
           the crossed product <A>RG</A> and a pair of elements 
           of <A>G</A>. 
           It must return an invertible element of <A>R</A>. <P/> <P/>
         
         Returns the crossed product of <A>G</A> over the ring <A>R</A> 
         with action <A>act</A> and twisting <A>twist</A>. <P/>
         
         The resulting crossed product belongs to the category
         <Index Key="IsCrossedProduct"><C>IsCrossedProduct</C></Index>
         <C>IsCrossedProduct</C>, which is defined as a subcategory of 
         <C>IsFLMLORWithOne</C>.
         <P/>
         
An example of the trivial action:
<Log> 
act := function(RG,a)
    return IdentityMapping( LeftActingDomain( RG ) );
end;
</Log>
and the trivial twisting:
<Log>
twist := function( RG , g, h )
    return One( LeftActingDomain( RG ) );
end;
</Log>	

Let <M>n</M> be a positive integer and <M>\xi_n</M> an <M>n</M>-th complex primitive 
root of unity. The natural action of the group of units of <M>&ZZ;_n</M>, 
the ring of integers modulo <M>n</M>, on <M>&QQ; (\xi_n)</M> can be defined 
as follows:

<Log> 
act := function(RG,a)
    return ANFAutomorhism( LeftActingDomain( RG ) , Int( a ) );
end;
</Log>

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 <M>&QQ; (i)=GaussianRationals</M>. One realizes the cyclic 
group of order 2 as the group of units of <M>&ZZ; / 4 &ZZ;</M> and one uses the natural 
isomorphism <M>&ZZ; / 4 &ZZ; \rightarrow Gal( &QQ; (i)/ &QQ; )</M> 
to describe the action. 
<P/>

<Example>
<![CDATA[
gap> R := GaussianRationals;
GaussianRationals
gap> G := Units( ZmodnZ(4) );
<group of size 2 with 1 generators>
gap> act := function(RG,g)
> return ANFAutomorphism( LeftActingDomain(RG), Int(g) );
> end;
function( RG, g ) ... end
gap> twist1 := function( RG, g, h )
> if IsOne(g) or IsOne(h) then
>    return One(LeftActingDomain(RG));
> else
>    return -One(LeftActingDomain(RG));
> fi;
> end;
function( RG, g, h ) ... end
gap> RG := CrossedProduct( R, G, act, twist1 );
<crossed product over GaussianRationals of a group of size 2>
gap> i := E(4) * One(G)^Embedding(G,RG); 
(ZmodnZObj( 1, 4 ))*(E(4))
gap> j := ZmodnZObj(3,4)^Embedding(G,RG); 
(ZmodnZObj( 3, 4 ))*(1)
gap> i^2;
(ZmodnZObj( 1, 4 ))*(-1)
gap> j^2;
(ZmodnZObj( 1, 4 ))*(-1)
gap> i*j+j*i;  
<zero> of ...
]]>
</Example>

One can construct the following generalized quaternion algebra 
with the same action and a different twisting

<Display>
&QQ; (i,j|i^2=-1,j^2=-3,ji=-ij)
</Display> 

<Example>
<![CDATA[
gap> twist2:=function(RG,g,h)
> if IsOne(g) or IsOne(h) then
>     return One(LeftActingDomain( RG ));
> else
>     return -3*One(LeftActingDomain( RG ));
> fi;
> end;
function( RG, g, h ) ... end
gap> RG := CrossedProduct( R, G, act, twist2 );  
<crossed product over GaussianRationals of a group of size 2>
gap> i := E(4) * One(G)^Embedding(G,RG); 
(ZmodnZObj( 1, 4 ))*(E(4))
gap> j := ZmodnZObj(3,4)^Embedding(G,RG);  
(ZmodnZObj( 3, 4 ))*(1)
gap> i^2;                           
(ZmodnZObj( 1, 4 ))*(-1)
gap> j^2;                                
(ZmodnZObj( 1, 4 ))*(-3)
gap> i*j+j*i;                       
<zero> of ...
]]>
</Example>

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.


<Example>
<![CDATA[
gap> C2 := CyclicGroup(2);
<pc group of size 2 with 1 generators>
gap> G := DirectProduct(C2,C2);
<pc group of size 4 with 2 generators>
gap> act := function(RG,a)
>     return IdentityMapping( LeftActingDomain(RG));
> end;
function( RG, a ) ... end
gap> twist := function( RG, g , h )
> local one,g1,g2,h1,h2,G;
> G := UnderlyingMagma( RG );
> one := One( C2 );
> g1 := Image( Projection(G,1), g );
> g2 := Image( Projection(G,2), g );
> h1 := Image( Projection(G,1), h );
> h2 := Image( Projection(G,2), h );
> if g = One( G ) or h = One( G ) then return 1;
>   elif IsOne(g1) and not IsOne(g2) and not IsOne(h1) and not IsOne(h2)
>     then return 1;
>   elif not IsOne(g1) and IsOne(g2) and IsOne(h1) and not IsOne(h2)
>     then return 1;
>   elif not IsOne(g1) and not IsOne(g2) and not IsOne(h1) and IsOne(h2)
>     then return 1;
>   else return -1;
> fi;
> end;
function( RG, g, h ) ... end
gap> HQ := CrossedProduct( Rationals, G, act, twist );
<crossed product over Rationals of a group of size 4>
]]>
</Example>

Changing the rationals by the integers as coefficient ring one can construct the Hamiltonian quaternion ring.

<Example>
<![CDATA[
gap> HZ := CrossedProduct( Integers, G, act, twist );
<crossed product over Integers of a group of size 4>
gap> i := GeneratorsOfGroup(G)[1]^Embedding(G,HZ); 
(f1)*(1)
gap> j := GeneratorsOfGroup(G)[2]^Embedding(G,HZ);
(f2)*(1)
gap> i^2;
(<identity> of ...)*(-1)
gap> j^2; 
(<identity> of ...)*(-1)
gap> i*j+j*i;                                      
<zero> of ...
]]>
</Example>

One can extract the arguments used for the construction of the
crossed product using the following attributes: <P/>

* <Index Key="LeftActingDomain"><C>LeftActingDomain</C></Index> <C>LeftActingDomain</C> for the coefficient ring. <P/>

* <Index Key="UnderlyingMagma"><C>UnderlyingMagma</C></Index> <C>UnderlyingMagma</C> for the underlying group. <P/>

* <Index Key="ActionForCrossedProduct"><C>ActionForCrossedProduct</C></Index> <C>ActionForCrossedProduct</C> for the action. <P/>

* <Index Key="TwistingForCrossedProduct"><C>TwistingForCrossedProduct</C></Index> <C>TwistingForCrossedProduct</C> for the twisting.

<Example>
<![CDATA[
gap> LeftActingDomain(HZ);
Integers
gap> G:=UnderlyingMagma(HZ);
<pc group of size 4 with 2 generators>
gap> ac := ActionForCrossedProduct(HZ);
function( RG, a ) ... end
gap> List( G , x -> ac( HZ, x ) );
[ IdentityMapping( Integers ), IdentityMapping( Integers ),
  IdentityMapping( Integers ), IdentityMapping( Integers ) ]
gap> tw := TwistingForCrossedProduct( HZ );
function( RG, g, h ) ... end
gap> List( G, x -> List( G , y -> tw( HZ, x, y ) ) );
[ [ 1, 1, 1, 1 ], [ 1, -1, -1, 1 ], [ 1, 1, -1, -1 ], [ 1, -1, 1, -1 ] ]  
]]>
</Example>
  
Some more examples of crossed products arise from the 
<E>Wedderburn decomposition</E> (<Ref Sect="WedDec" />)
of group algebras.  

<Example>
<![CDATA[
gap> G := SmallGroup(32,50);
<pc group of size 32 with 5 generators>
gap> A := SimpleAlgebraByCharacter( GroupRing(Rationals,G), Irr(G)[17]) ;
( <crossed product with center Rationals over GaussianRationals of a group of \
size 2>^[ 2, 2 ] )
gap> SimpleAlgebraByCharacterInfo( GroupRing(Rationals,G), Irr(G)[17]) ;
[ 2, Rationals, 4, [ 2, 3, 2 ] ]
gap> B := LeftActingDomain(A);
<crossed product with center Rationals over GaussianRationals of a group of si\
ze 2>
gap> L := LeftActingDomain(B);
GaussianRationals
gap> H := UnderlyingMagma( B );
<group of size 2 with 2 generators>
gap> Elements(H);
[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ]
gap> i := E(4) * One(H)^Embedding(H,B);
(ZmodnZObj( 1, 4 ))*(E(4))
gap> j := ZmodnZObj(3,4)^Embedding(H,B);
(ZmodnZObj( 3, 4 ))*(1)
gap> i^2;
(ZmodnZObj( 1, 4 ))*(-1)
gap> j^2;
(ZmodnZObj( 1, 4 ))*(-1)
gap> i*j+j*i;
<zero> of ...
gap> ac := ActionForCrossedProduct( B );
function( RG, a ) ... end
gap> tw := TwistingForCrossedProduct( B );
function( RG, a, b ) ... end
gap> List( H , x -> ac( B, x ) );
[ IdentityMapping( GaussianRationals ), ANFAutomorphism( GaussianRationals,
    3 ) ]
gap> List( H , x -> List( H , y -> tw( B, x, y ) ) );
[ [ 1, 1 ], [ 1, -1 ] ]
]]>
</Example>


<Example>
<![CDATA[
gap> QG:=GroupRing( Rationals, SmallGroup(24,3) );;
gap> WedderburnDecomposition(QG);
[ Rationals, CF(3), ( Rationals^[ 3, 3 ] ),
  <crossed product with center Rationals over GaussianRationals of a group of \
size 2>, <crossed product with center CF(3) over AsField( CF(3), CF(
    12) ) of a group of size 2> ]
gap> R:=WedderburnDecomposition( QG )[4];
<crossed product with center Rationals over GaussianRationals of a group of si\
ze 2>
gap> IsCrossedProduct(R);
true
gap> IsAlgebra(R);
true
gap> IsRing(R);       
true
gap> LeftActingDomain( R );
GaussianRationals
gap> AsList( UnderlyingMagma( R ) );
[ ZmodnZObj( 1, 4 ), ZmodnZObj( 3, 4 ) ]
gap> Print( ActionForCrossedProduct( R ) ); Print("\n");
function ( RG, a )
    local  cond, redu;
    cond := OperationRecord( RG ).cond;
    redu := OperationRecord( RG ).redu;
    return
     ANFAutomorphism( CF( cond ), Int( PreImagesRepresentative( redu, a ) ) );
end
gap> Print( TwistingForCrossedProduct( R ) ); Print("\n");                     
function ( RG, a, b )
    local  orderroot, cocycle;
    orderroot := OperationRecord( RG ).orderroot;
    cocycle := OperationRecord( RG ).cocycle;
    return E( orderroot ) ^ Int( cocycle( a, b ) );
end
gap> IsAssociative(R);
true
gap> IsFinite(R);           
false
gap> IsFiniteDimensional(R);
true
gap> AsList(Basis(R));
[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ] 
gap> GeneratorsOfLeftOperatorRingWithOne(R);
[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ]
gap> One(R);
(ZmodnZObj( 1, 4 ))*(1)
gap> Zero(R);
<zero> of ...
gap> Characteristic(R);
0
gap> CenterOfCrossedProduct(R);
Rationals
]]>
</Example>

The next example shows how one can use <Ref Attr="CrossedProduct" /> to produce generalized quaternion
algebras. Note that one can construct quaternion algebras using the &GAP; function <C>QuaternionAlgebra</C>.
<Index>Quaternion algebra</Index>

<Example>
<![CDATA[
gap> Quat := function(R,a,b)
> local G,act,twist;
> if not(a in R and b in R and a <> Zero(R) and b <> Zero(R) ) then
> Error("<a>  and <b> must be non zero elements of <R>!!!");
> fi;
> G := SmallGroup(4,2);
> act := function(RG,a)
>     return IdentityMapping( LeftActingDomain(RG));
> end;
> twist := function( RG, g , h )
> local one,g1,g2;
> one := One(G);
> g1 := G.1;
> g2 := G.2;
> if   g = one or h = one then
>   return One(R);
> elif g = g1 then
>   if h = g2 then
>     return One(R);
>   else
>     return a;
>   fi;
> elif g = g2 then
>   if h = g1 then
>     return -One(R);
>   elif h=g2 then
>     return b;
>   else
>     return -b;
>   fi;
> else
>   if h = g1 then
>     return -b;
>   elif h=g2 then
>     return b;
>   else
>     return -a*b;
>   fi;
> fi;
> end;
> return CrossedProduct(R,G,act,twist);
> end;
function( R, a, b ) ... end
gap> HQ := Quat(Rationals,2,3);
<crossed product over Rationals of a group of size 4>
gap> G := UnderlyingMagma(HQ);
<pc group of size 4 with 2 generators>
gap> tw := TwistingForCrossedProduct( HQ );
function( RG, g, h ) ... end
gap> List( G, x -> List( G, y -> tw( HQ, x, y ) ) );
[ [ 1, 1, 1, 1 ], [ 1, 3, -1, -3 ], [ 1, 1, 2, 2 ], [ 1, 3, -3, -6 ] ]
]]>
</Example>

   </Description>
</ManSection>  


</Section>

<Section Label="CrossedElements">
<Heading>Crossed product elements and their properties</Heading>

<ManSection>
   <Prop Name="ElementOfCrossedProduct" 
         Arg="Fam zerocoeff coeffs elts"  
         Comm="" />
   <Description>
         Returns the element <M>m_1*c_1 + ... + m_n*c_n</M> of a crossed product, 
         where <A>elts</A> <M> = [ m_1, m_2, ..., m_n ]</M> is a list of magma elements,
         <A>coeffs</A> <M> = [ c_1, c_2, ..., c_n ]</M> is a list of coefficients.
         The output belongs to the crossed product whose elements lie in the 
         family <A>Fam</A>. The second argument <A>zerocoeff</A> must be 
         the zero element of the coefficient ring containing coefficients
         <M>c_i</M>, and will be stored in the attribute 
         <Index Key="ZeroCoefficient"><C>ZeroCoefficient</C></Index><C>ZeroCoefficient</C>
         of the crossed product element.
         <P/>  
         
         The output will be in the category <Index Key="IsElementOfCrossedProduct">
         <C>IsElementOfCrossedProduct</C></Index><C>IsElementOfCrossedProduct</C>, 
         which is a subcategory of <C>IsRingElementWithInverse</C>. It will have the 
         presentation <Index Key="IsCrossedProductObjDefaultRep">
         <C>IsCrossedProductObjDefaultRep</C></Index>
         <C>IsCrossedProductObjDefaultRep</C>.
         <P/>
         
         Similarly to magma rings, one can obtain the list of coefficients and
         elements with <C>CoefficientsAndMagmaElements</C> 
         <Index>CoefficientsAndMagmaElements</Index>.
         <P/>
         
         Also note from the example below and several other examples in this 
         chapter that instead of <C>ElementOfCrossedProduct</C> one can use 
         <Index Key="Embedding"><C>Embedding</C></Index><C>Embedding</C>
         to embed elements of the coefficient ring 
         and of the underlying magma into the crossed product.

<Example>
<![CDATA[
gap> QG := GroupRing( Rationals, SmallGroup(24,3) );
<algebra-with-one over Rationals, with 4 generators>
gap> R := WedderburnDecomposition( QG )[4];
<crossed product with center Rationals over GaussianRationals of a group of si\
ze 2>
gap> H := UnderlyingMagma( R );;
gap> fam := ElementsFamily( FamilyObj( R ) );;
gap> g := ElementOfCrossedProduct( fam, 0, [ 1, E(4) ], AsList(H) );
(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))
gap> CoefficientsAndMagmaElements( g );    
[ ZmodnZObj( 1, 4 ), 1, ZmodnZObj( 3, 4 ), E(4) ]
gap> t := List( H, x -> x^Embedding( H, R ) );
[ (ZmodnZObj( 1, 4 ))*(1), (ZmodnZObj( 3, 4 ))*(1) ]
gap> t[1] + t[2]*E(4);  
(ZmodnZObj( 1, 4 ))*(1)+(ZmodnZObj( 3, 4 ))*(E(4))
gap> g = t[1] + E(4)*t[2];
false
gap> g = t[1] + t[2]*E(4);
true
gap> h := ElementOfCrossedProduct( fam, 0, [ E(4), 1 ], AsList(H) );     
(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)
gap> g+h;
(ZmodnZObj( 1, 4 ))*(1+E(4))+(ZmodnZObj( 3, 4 ))*(1+E(4))
gap> g*E(4);
(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(-1)
gap> E(4)*g;     
(ZmodnZObj( 1, 4 ))*(E(4))+(ZmodnZObj( 3, 4 ))*(1)
gap> g*h;
(ZmodnZObj( 1, 4 ))*(2*E(4))
]]>
</Example>

   </Description>
</ManSection>

</Section>

</Chapter>
