gap> mult := function( x, y ) return (x+y) mod 6; end;
gap> Q := RightQuasigroupByFunction([0..5], mult );
<right quasigroup of size 6>
gap> Elements( Q );
[ r0, r1, r2, r3, r4, r5 ]
gap> A := Subrightquasigroup( Q, [2] );
<right quasigroup of size 3>
gap> Elements( A );
[ r0, r2, r4 ]
# recall A = [0,2,4] in [0..5]
gap> Parent( A ) = Q;
true
gap> ParentInd(A);
[ 1, 3, 5 ]
gap> [ Elements( A )[ 3 ], A.3, A[4] ];
[ r4, r2, r4 ]
gap> Display( CayleyTable( A ) ); # based on the underlying set
[ [ 0, 2, 4 ],
[ 2, 4, 0 ],
[ 4, 0, 2 ] ]
gap> Display( MultiplicationTable( A ) ); # based on parent indices
[ [ 1, 2, 3 ],
[ 2, 3, 1 ],
[ 3, 1, 2 ] ]
gap> ConstructorStyle( true, false );
rec( checkArguments := false, indexBased := true )
gap> SetDefaultConstructorStyle( false, false );
true
gap> ncs := ConstructorStyle( false, false );;
gap> P := ProjectionRightQuasigroup( [0..100000], ncs ); # x*y = x
<associative quandle of size 100001>
gap> P[5]*P[100000];
r5;
gap> HasMultiplicationTable( P );
false
gap> mult := MultiplicationFunction( P );
function( x, y ) ... end
gap> mult(5,100000);
5
gap> Q := RightQuasigroupByFunction( GF( 9 ), \+, ncs );
<right quasigroup of size 9>
gap> IsIndexBased( Q );
false
gap> F := FamilyObj( Q.1 ); # will provide access to inner workings
<Family: "RightQuasigroupFam">
gap> [ IsBound( F!.mult ), IsBound( F!.rdiv ), IsBound( F!.ldiv ) ];
[ true, true, false ]
gap> [ IsBound( F!.multTable ), IsBound( F!.rdivTable ), IsBound( F!.ldivTable ) ];
[ false, false, false ]
gap> MultiplicationFunction( Q );
<Operation "+">
gap> RightDivisionFunction( Q );
function( x, y ) ... end
gap> Q := RightQuasigroupByFunction( GF( 9 ), \+, ncs );;
gap> R := IndexBasedCopy( Q );; IsIndexBased( R );
true
gap> UnderlyingSet( R );
[ 0*Z(3), Z(3)^0, Z(3), Z(3^2), Z(3^2)^2, Z(3^2)^3, Z(3^2)^5, Z(3^2)^6, Z(3^2)^7 ]
gap> F := FamilyObj( R.1 );;
gap> [ IsBound( F!.mult ), IsBound( F!.rdiv ), IsBound( F!.ldiv ) ];
[ true, true, false ]
gap> [ IsBound( F!.multTable ), IsBound( F!.rdivTable ), IsBound( F!.ldivTable ) ];
[ true, false, false ]
gap> R.1/R.1;;
gap> [ IsBound( F!.multTable ), IsBound( F!.rdivTable ), IsBound( F!.ldivTable ) ];
[ true, true, false ]
gap> Q := RightQuasigroupByFunction( GF( 9 ), \+, ncs );;
gap> R := IndexBasedCopy( Q );;
gap> IsCanonical( R );
false
gap> C := CanonicalCopy( Q );;
gap> UnderlyingSet( C );
[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
(more later)
gap> M := MagmaByMultiplicationTable( [ [1,1], [2,2] ] );;
gap> IsRightQuasigroupMagma( M ); # test of math properties
true
gap> R := AsRightQuasigroup( M );
<right quasigroup of size 2>
gap> G := Group((1,2,3));;
gap> L := AsLoop( G ); # multiplicative group
<associative loop of size 3>
gap> Elements( L );
[ l(), l(1,2,3), l(1,3,2) ]
gap> AsRightQuasigroup(GF(7)^2); # additive group
<associative right quasigroup of size 49>
gap> ct := [
[ "red", "white", "white" ],
[ "blue", "blue", "red" ],
[ "white", "red", "blue" ] ];;
gap> Q := RightQuasigroupByCayleyTable( ct );
<right quasigroup of size 3>
gap> Elements( Q );
[ rblue, rred, rwhite ]
gap> PrintArray( CayleyTable( Q ) );
[ [ red, white, white ],
[ blue, blue, red ],
[ white, red, blue ] ]
gap> S := GF(5);;
gap> mult := function( x, y ) return x+2*y; end;;
gap> IsQuasigroupFunction( S, mult );
true
gap> QuasigroupByFunction( S, mult );
<quasigroup of size 5>
gap> rdiv := function( x, y ) return x-2*y; end;;
gap> ldiv := function( x, y ) return (y-x)/2; end;;
gap> IsQuasigroupFunction( S, mult, rdiv, ldiv );
true
gap> QuasigroupByFunction( S, mult, rdiv, ldiv );
<quasigroup of size 5>