%
\Chapter{Nearrings}
%

A *(left) nearring* is an algebra $(N,+,*)$, where
$(N,+)$ is a (not necessarily abelian) group,
$(N,*)$ is a semigroup, and 
the distributive law $x*(y+z) = x*y+x*z$ 
holds.
Such nearrings are called *left nearrings*.
A typical example is constructed as follows:
take a group $(G,+)$ (not necessarily abelian), and
take the set $M(G)$ of all mappings from $G$ to $G$.
Then we define $+$ on $M(G)$ as pointwise addition of
mappings, and $*$ by $m * n (\gamma) := n (m (\gamma))$.
The multiplication looks more natural if we write
functions right of their arguments. Then the definition
reads $(\gamma) m * n = ((\gamma)m)n$.

Textbooks on nearrings are \cite{meldrum85:NATLWG}, \cite{Clay:Nearrings},
\cite{Ferrero:Nearrings}. They all use *left nearrings*.
The book \cite{Pilz:Nearrings} uses *right nearrings*; these are 
the algebras that arise if we claim the right distributive law
 $(x + y) * z = x*z + y*z$ instead of the left distributive law
given above. 

SONATA uses *left* nearrings throughout.
     
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\Section{Entering nearrings into the system}


*The problem:* Input the nearring given in the example
of page 406 of \cite{Pilz:Nearrings}
into SONATA.

This nearring is given by an explicit multiplication table.
The function `ExplicitMultiplicationNearRing' can be 
used to do the job.
But first, let's get the additive group, which is
Klein's four group:
\beginexample
    gap> G := GTW4_2;
    4/2
\endexample
Now we have to establish a correspondence between
the elements `0', `a', `b', `c' of the group in the example
and GAP's representation of the group elements.
\beginexample
    gap> AsSortedList( G );
    [ (), (3,4), (1,2), (1,2)(3,4) ]
\endexample
Ok, let's map `0' to `()', `a' to `(3,4)', `b' to `(1,2)'
and `c' to `(1,2)(3,4)'

\beginexample
    gap> SetSymbols( G, [ "0", "a", "b", "c" ] );
    gap> PrintTable( G );
    Let:
    0 := ()
    a := (3,4)
    b := (1,2)
    c := (1,2)(3,4)

      +  | 0 a b c     
      ------------    
      0  | 0 a b c     
      a  | a 0 c b     
      b  | b c 0 a     
      c  | c b a 0     

\endexample

Now for entering the nearring multiplication:
We will use the function `NrMultiplicationByOperationTable'.
This function requires as one of its arguments a matrix
of integers representing the operation table:
We choose the entries of `table' according to the
positions of the elements of `G' in
`AsSortedList( G )':
\beginexample
    gap> table := [ [ 1, 1, 1, 1 ],                 
    >               [ 1, 1, 2, 2 ],
    >               [ 1, 2, 4, 3 ],
    >               [ 1, 2, 3, 4 ] ];
    [ [ 1, 1, 1, 1 ], [ 1, 1, 2, 2 ], [ 1, 2, 4, 3 ], [ 1, 2, 3, 4 ] ]
\endexample

Now we are in position to define a nearring multiplication:
\beginexample
    gap> mul:=NearRingMultiplicationByOperationTable(                        
    >             G, table, AsSortedList(G) );
    function( x, y ) ... end
\endexample

And finally, we can define the nearring:
\beginexample
    gap> N := ExplicitMultiplicationNearRing( G, mul );
    ExplicitMultiplicationNearRing ( 4/2 , multiplication )
\endexample
We get no error message, which means that we have 
indeed defined a nearring multiplication on `G'.
Now let's take a look at it:
\beginexample
    gap> PrintTable( N );
    Let:
    0 := (())
    a := ((3,4))
    b := ((1,2))
    c := ((1,2)(3,4))

      +  | 0  a  b  c  
      ---------------
      0  | 0  a  b  c  
      a  | a  0  c  b  
      b  | b  c  0  a  
      c  | c  b  a  0  

      *  | 0  a  b  c  
      ---------------
      0  | 0  0  0  0  
      a  | 0  0  a  a  
      b  | 0  a  c  b  
      c  | 0  a  b  c  
\endexample
The symbols used for the elements of the group are also used for the
elements of the nearring. Of course, it is still possible to redefine the 
symbols.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\Section{Some simple questions about the nearring}


Now, that the nearring is in the system, let's ask
some questions about it. A nearring is a nearfield if
it has more than one element and its nonzero elements are
a group with respect to multiplication. A textbook
on nearfields is \cite{Waehling:Fastkoerper}. They are interesting
structures, closely connected to sharply $2$-transitive permutation
groups and fixedpointfree automorphism groups of groups.

\beginexample
    gap> IsNearField( N );
    false
    gap> IsIntegralNearRing( N );
    false
    gap> IsNilpotentNearRing( N );
    false
\endexample
\cite{Pilz:Nearrings} is correct ... Well at least in this case.`;-))'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
\Section{Entering the nearring with less typing}


Certainly, everybody has immediately seen, that this
nearring is a transformation nearring on `GTW4_2'
which is generated by the transformations
`0' to `0', `a' to `a', `b' to `c', `c' to `b', and
the identity transformation, so

\beginexample
    gap> t := GroupGeneralMappingByImages(                    
    >           G, G, AsSortedList(G), AsSortedList(G){[1,2,4,3]} );
    [ (), (3,4), (1,2), (1,2)(3,4) ] -> [ (), (3,4), (1,2)(3,4), (1,2) ]
    gap> id := IdentityMapping( G );
    IdentityMapping( 4/2 )
    gap> T := TransformationNearRingByGenerators( G, [t,id] );
    TransformationNearRingByGenerators(
    [ [ (), (3,4), (1,2), (1,2)(3,4) ] -> [ (), (3,4), (1,2)(3,4), (1,2) ], 
      IdentityMapping( 4/2 ) ])
\endexample

Let's see what we've got:

\beginexample
    gap> PrintTable(T);
    Let:
    n0 := <mapping: 4/2 -> 4/2 >
    n1 := <mapping: 4/2 -> 4/2 >
    n2 := <mapping: 4/2 -> 4/2 >
    n3 := <mapping: 4/2 -> 4/2 >

       +  | n0  n1  n2  n3  
      --------------------
      n0  | n0  n1  n2  n3  
      n1  | n1  n0  n3  n2  
      n2  | n2  n3  n0  n1  
      n3  | n3  n2  n1  n0  

       *  | n0  n1  n2  n3  
      --------------------
      n0  | n0  n0  n0  n0  
      n1  | n0  n0  n1  n1  
      n2  | n0  n1  n2  n3  
      n3  | n0  n1  n3  n2  
\endexample

Obviously, we've got the correct nearring.
Let's make for sure:

\beginexample
    gap> IsIsomorphicNearRing( N, T );
    true
\endexample

However, `N' and `T' are certaily not equal:

\beginexample
    gap> N = T;
    false
\endexample


%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "manual"
%%% End: 
