\Chapter{AllDiffsets and OneDiffset}

This chapter contains a number of examples as a very quick
introduction to a few brute-force methods which can be used to find
all (or just one) relative difference sets in a small group.  Full
documentation of these functions including all parameters can be found
in section "RDS:Brute force methods".

Do not expect too much from these methods alone! If
you want to find examples of relative difference sets in larger
groups, you should familiarize with the notion of coset signatures by
also reading the next chapter.

The functions "AllDiffsets" and "OneDiffset" present the
easiest way to calculate relative difference sets.

For a quick start, try this:
\beginexample
gap> LoadPackage("rds");;
gap> G:=CyclicGroup(7);
<pc group of size 7 with 1 generators>
gap> AllDiffsets(G);
[ [ f1, f1^3 ], [ f1, f1^5 ], [ f1^2, f1^3 ], [ f1^2, f1^6 ], [ f1^4, f1^5 ], 
  [ f1^4, f1^6 ] ]
gap> OneDiffset(G);    
[ f1, f1^3 ]
\endexample

The first is the set of all ordinary difference sets of order $2$ in
the cyclic group of order $7$. Ok, they look too small (recall that
the order of a difference set is the number $k$ of elements it
contains minus the multiplicity $\lambda$). Here is the reason:

Without loss of generality, every difference set contains the identity
element of the group it lives in. {\package{RDS}} knows this and
assumes it implicitly. So difference sets of length $n$ are
represented by lists of length $n-1$. 

We can calculate all ordinary difference sets in $G$ which contain the
last element using "AllDiffsetsNoSort". Observe, that "AllDiffsets"
calculates partial difference sets by adding elements to the given
list which are lexicographically larger than the last one of this
list:

\beginexample
gap> AllDiffsetsNoSort([Set(G)[7]],G);
[ [ f1^6, f1^2 ], [ f1^6, f1^4 ] ]
gap> AllDiffsets([Set(G)[7]],G);      
[  ]
\endexample

You can also generate relative difference sets. Here we must give a
partial difference set to start with (the empty list is ok) and a
forbidden set. Notice that a forbidden subgroup cannot be input as a
*group*. It has to be converted to a set.

\beginexample
gap> G:=ElementaryAbelianGroup(81);
<pc group of size 81 with 4 generators>
gap> N:=Subgroup(G,GeneratorsOfGroup(G){[1,2]});
Group([ f1, f2 ])
gap> OneDiffset([],Set(N),G);
[ f3, f4, f1*f3^2, f2*f3*f4, f1^2*f4^2, f2*f3^2*f4^2, f1*f2^2*f3^2*f4, 
  f1^2*f2^2*f3*f4^2 ]
\endexample

If the parameter $\lambda$ is not given, it is set to $1$.
Of course, we can also find difference sets with $\lambda>1$. Here is a $(12,2,12,6)$ difference set in $SL(2,3)$:

\beginexample
gap> G:=SmallGroup(24,3);                      
<pc group of size 24 with 4 generators>
gap> N:=First(NormalSubgroups(G),i->Size(i)=2);
Group([ f4 ])
gap> OneDiffset([],Set(N),G,6); 
[ f1, f2, f3, f1^2, f1*f2, f1*f3, f2*f3, f1*f2*f3, f1^2*f2*f4, f1^2*f3*f4, 
  f1^2*f2*f3*f4 ]
\endexample

To test if a set is a relative difference set, "IsDiffset" can be used:

\beginexample
gap> a:=(1,2,3,4,5,6,7);
(1,2,3,4,5,6,7)
gap> IsDiffset([a,a^3],Group(a));  #an ordinary difference set
true
gap> IsDiffset([a,a^2,a^4],Group(a));  #no ordinary difference set
false
gap> IsDiffset([a,a^2,a^4],Group(a),2);   #diffset with <lambda>=2
true
\endexample

In some cases, "AllDiffsets" and "OneDiffset" will refuse to work. A
solution for this is to calculate `IsomorphismPermGroup' for your
group and then work with the image under this isomorphism.

 See "RDS:Brute force methods" for details.
