Introduction A numerical semigroup is a subset of the set {\mathbb N} of nonnegative integers that is closed under addition, contains 0 and whose complement in {\mathbb N} is finite. The smallest positive integer belonging to a numerical semigroup is its multiplicity.

Let S be a numerical semigroup and A be a subset of S. We say that A is a system of generators of S if S=\{ k_1 a_1+\cdots+ k_n a_n\ |\ n,k_1,\ldots,k_n\in{\mathbb N}, a_1,\ldots,a_n\in A\}. The set A is a minimal system of generators of S if no proper subset of A is a system of generators of S.

Every numerical semigroup has a unique minimal system of generators. This is a data that can be used in order to uniquely define a numerical semigroup. Observe that since the complement of a numerical semigroup in the set of nonnegative integers is finite, this implies that the greatest common divisor of the elements of a numerical semigroup is 1, and the same condition must be fulfilled by its minimal system of generators (or by any of its systems of generators).

Given a numerical semigroup S and a nonzero element s in it, one can consider for every integer i ranging from 0 to s-1, the smallest element in S congruent with i modulo s, say w(i) (this element exists since the complement of S in {\mathbb N} is finite). Clearly w(0)=0. The set {\rm Ap}(S,s)=\{ w(0),w(1),\ldots, w(s-1)\} is called the Apéry set of S with respect to s. Note that a nonnegative integer x congruent with i modulo s belongs to S if and only if w(i)\leq x. Thus the pair (s,{\rm Ap}(S,s)) fully determines the numerical semigroup S (and can be used to easily solve the membership problem to S). This set is in fact one of the most powerfull tools known for numerical semigroups, and it is used almost everywhere in the computation of components and invariants associated to a numerical semigroup. Usually the element s is taken to be the multiplicity, since in this way the resulting Apéry set is the smallest possible.

A gap of a numerical semigroup S is a nonnegative integer not belonging to S. The set of gaps of S is usually denoted by {\rm H}(S), and clearly determines uniquely S. Note that if x is a gap of S, then so are all the nonnegative integers dividing it. Thus in order to describe S we do not need to know all its gaps, but only those that are maximal with respect to the partial order induced by division in {\mathbb N}. These gaps are called fundamental gaps.

The largest nonnegative integer not belonging to a numerical semigroup S is the Frobenius number of S. If S is the set of nonnegative integers, then clearly its Frobenius number is -1, otherwise its Frobenius number coincides with the maximum of the gaps (or fundamental gaps) of S. The Frobenius number plus one is known as the conductor of the semigroup. In this package we refer to the elements in the semigroup that are less than or equal to the conductor as small elements of the semigroup. Observe that from the definition, if S is a numerical semigroup with Frobenius number f, then f+{\mathbb N}\setminus\{0\}\subseteq S. An integer z is a pseudo-Frobenius number of S if z+S\setminus\{0\}\subseteq S. Thus the Frobenius number of S is one of its pseudo-Frobenius numbers. The type of a numerical semigroup is the cardinality of the set of its pseudo-Frobenius numbers.

The number of numerical semigroups having a given Frobenius number is finite. The elements in this set of numerical semigroups that are maximal with respect to set inclusion are precisely those numerical semigroups that cannot be expressed as intersection of two other numerical semigroups containing them properly, and thus they are known as irreducible numerical semigroups. Clearly, every numerical semigroup is the intersection of (finitely many) irreducible numerical semigroups.

A numerical semigroup S with Frobenius number f is symmetric if for every integer x, either x\in S or f-x\in S. The set of irreducible numerical semigroups with odd Frobenius number coincides with the set of symmetric numerical semigroups. The numerical semigroup S is pseudo-symmetric if f is even and for every integer x not equal to f/2 either x\in S or f-x\in S. The set of irreducible numerical semigroups with even Frobenius number is precisely the set of pseudo-symmetric numerical semigroups. These two classes of numerical semigroups have been widely studied in the literature due to their nice applications in Algebraic Geometry. This is probably one of the main reasons that made people turn their attention on numerical semigroups again in the last decades. Symmetric numerical semigroups can be also characterized as those with type one, and pseudo-symmetric numerical semigroups are those numerical semigroups with type two and such that its pseudo-Frobenius numbers are its Frobenius number and its Frobenius number divided by two.

Another class of numerical semigroups that catched the attention of researchers working on Algebraic Geometry and Commutative Ring Theory is the class of numerical semigroups with maximal embedding dimension. The embedding dimension of a numerical semigroup is the cardinality of its minimal system of generators. It can be shown that the embedding dimension is at most the multiplicity of the numerical semigroup. Thus maximal embedding dimension numerical semigroups are those numerical semigroups for which their embedding dimension and multiplicity coincide. These numerical semigroups have nice maximal properties, not only (of course) related to their embedding dimension, but also by means of their presentations. Among maximal embedding dimension there are two classes of numerical semigroups that have been studied due to the connections with the equivalence of algebroid branches. A numerical semigroup S is Arf if for every x\geq y\geq z\in S, then x+y-z\in S; and it is saturated if the following condition holds: if s,s_1,\ldots,s_r\in S are such that s_i\leq s for all i\in \{1,\ldots,r\} and z_1,\ldots,z_r\in {\mathbb Z} are such that z_1s_1+\cdots+z_rs_r\geq 0, then s+z_1s_1+\cdots +z_rs_r\in S.

If we look carefully inside the set of fundamental gaps of a numerical semigroup, we see that there are some fulfilling the condition that if they are added to the given numerical semigroup, then the resulting set is again a numerical semigroup. These elements are called special gaps of the numerical semigroup. A numerical semigroup other than the set of nonnegative integers is irreducible if and only if it has only a special gap.

The inverse operation to the one described in the above paragraph is that of removing an element of a numerical semigroup. If we want the resulting set to be a numerical semigroup, then the only thing we can remove is a minimal generator.

Let a,b,c,d be positive integers such that a/b < c/d, and let I=[a/b,c/d]. Then the set {\rm S}(I)={\mathbb N}\cap \bigcup_{n\geq 0} n I is a numerical semigroup. This class of numerical semigroups coincides with that of sets of solutions to equations of the form A x \ mod\ B \leq C x with A,B,C positive integers. A numerical semigroup in this class is said to be proportionally modular.

A sequence of positive rational numbers a_1/b_1 < \cdots < a_n/b_n with a_i,b_i positive integers is a Bézout sequence if a_{i+1}b_i - a_i b_{i+1}=1 for all i\in \{1,\ldots,n-1\}. If a/b=a_1/b_1 < \cdots < a_n/b_n =c/d, then {\rm S}([a/b,c/d])=\langle a_1,\ldots,a_n\rangle. Bézout sequences are not only interesting for this fact, they have shown to be a major tool in the study of proportionally modular numerical semigroups.

If S is a numerical semigroup and k is a positive integer, then the set S/k=\{ x\in {\mathbb N} \ |\ kx\in S\} is a numerical semigroup, known as the quotient S by k.

Let m be a positive integer. A subadditive function with period m is a map f:{\mathbb N}\to {\mathbb N} such that f(0)=0, f(x+y)\leq f(x)+f(y) and f(x+m)=f(x). If f is a subadditive function with period m, then the set {\rm M}_f=\{ x\in {\mathbb N}\ |\ f(x)\leq x\} is a numerical semigroup. Moreover, every numerical semigroup is of this form. Thus a numerical semigroup can be given by a subadditive function with a given period. If S is a numerical semigroup and s\in S, s\not=0, and {\rm Ap}(S,s)=\{ w(0),w(1),\ldots, w(s-1)\}, then f(x)=w(x \ mod\ s) is a subadditive function with period s such that {\rm M}_f=S.

Let S be a numerical semigroup generated by \{n_1,\ldots,n_k\}. Then we can define the following morphism (called sometimes the factorization morphism) by \varphi: {\mathbb N}^k \to S,\ \varphi(a_1,\ldots,a_k)=a_1n_1+\cdots+a_kn_k. If \sigma is the kernel congruence of \varphi (that is, a\sigma b if \varphi(a)=\varphi(b)), then S is isomorphic to {\mathbb N}^k/\sigma. A presentation for S is a system of generators (as a congruence) of \sigma. If \{n_1,\ldots,n_p\} is a minimal system of generators, then a minimal presentation is a presentation such that none of its proper subsets is a presentation. Minimal presentations of numerical semigroups coincide with presentations with minimal cardinality, though in general these two concepts are not the same for an arbitrary commutative semigroup.

A set I of integers is an ideal relative to a numerical semigroup S provided that I+S\subseteq I and that there exists d\in S such that d+I\subseteq S. If I\subseteq S, we simply say that I is an ideal of S. If I and J are relative ideals of S, then so is I-J=\{z\in {\mathbb Z}\ |\ z+J\subseteq I\}, and it is tightly related to the operation ":" of ideals in a commutative ring.

In this package we have implemented the functions needed to deal with the elements exposed in this introduction.

Many of the algorithms, and the necessary background to understand them, can be found in the monograph . Some examples in this book have been illustrated with the help of this package. So the reader can also find there more examples on the usage of the functions implemented here.

This package was presented in . For a survey of the features of this package, see .