A Farey symbol is a compact and useful way to represent a subgroup of finite index in \(SL_2(ℤ)\) from which one can deduce independent generators for this subgroup. It consists of two components, namely a so-called generalised Farey sequence (`gfs`) and an ordered list of labels, giving additional structure to the `gfs`.

A generalised Farey sequence (g.F.S.) is an ordered list of the form \({ -infinity, x_0, x_1, ... , x_n, infinity }\), where

1. the \(x_i = a_i/b_i\) are rational numbers in reduced form arranged in increasing order for \(i = 0, ... , n\);

2. \(x_0, ... , x_n \in Z\), and some \(x_i = 0\);

3. we define \(x_{-1}=-infinity=-1/0\) and \(x_{n+1}=infinity=1/0\);

4. \(a_{i+1}b_{i}-a_{i}b_{i+1}=1\) for \(i=-1, ... ,n\).

The ordered list of labels of a Farey symbol gives an additional structure to the `gfs`. The labels correspond to each consecutive pair of \(x_i\)'s and are of the following types:

1. even,

2. odd,

3. a natural number, which occurs in the list of labels exactly twice or not at all.

Note that the actual values of numerical labels are not important; it is the pairing of two intervals that matters.

The package **Congruence** provides functions to construct Farey symbols by the given generalised Farey sequence and corresponding list of labels. The returned Farey symbol will belong to the category `IsFareySymbol`

and will have the representation `IsFareySymbolDefaultRep`

.

`‣ FareySymbolByData` ( gfs, labels ) | ( function ) |

This constructor creates the Farey symbol with the given generalized Farey sequence and list of labels. It also checks conditions from the definition of Farey symbol and returns an error if they are not satisfied. The data used to create the Farey symbol are stored as its attributes `GeneralizedFareySequence`

(3.2-1) and `LabelsOfFareySymbol`

(3.2-4).

gap> fs:=FareySymbolByData([infinity,0,1,2,infinity],[1,2,2,1]); [ infinity, 0, 1, 2, infinity ] [ 1, 2, 2, 1 ]

`‣ IsValidFareySymbol` ( fs ) | ( function ) |

This function is used in `FareySymbolByData`

(3.1-1) to validate its output.

gap> IsValidFareySymbol(fs); true

`‣ GeneralizedFareySequence` ( fs ) | ( attribute ) |

Returns the generalized Farey sequence `gfs` of the Farey symbol.

gap> GeneralizedFareySequence(fs); [ infinity, 0, 1, 2, infinity ]

`‣ NumeratorOfGFSElement` ( gfs, i ) | ( function ) |

Returns: integer

Returns the numerator of the i-th term of the generalised Farey sequence `gfs`: for the 1st infinite entry returns -1, for the last one returns 1, for all other entries returns the usual numerator.

gap> List([1..5], i -> NumeratorOfGFSElement(GeneralizedFareySequence(fs),i)); [ -1, 0, 1, 2, 1 ]

`‣ DenominatorOfGFSElement` ( gfs, i ) | ( function ) |

Returns: integer

Returns the denominator of the i-th term of the generalised Farey sequence `gfs`: for both infinite entries returns 0, for the other ones returns the usual denominator.

gap> List([1..5], i -> DenominatorOfGFSElement(GeneralizedFareySequence(fs),i)); [ 0, 1, 1, 1, 0 ]

`‣ LabelsOfFareySymbol` ( fs ) | ( attribute ) |

Returns the list of labels of the Farey symbol. This list has "odd", "even" and paired integers as entries.

gap> LabelsOfFareySymbol(fs); [ 1, 2, 2, 1 ]

generated by GAPDoc2HTML