In this tutorial we explore the different options of RegularInCodimension (and related functions) on some cone singularities. For the most part we will not talk about the Strategy option, we have a separate tutorial for that FastMinorsStrategyTutorial.
We begin with the following ideal.



It is the cone over $P^2 \times E$ where $E$ is an elliptic curve. We have embedded it with a Segre embedding inside $P^8$. In particular, this example is even regular in codimension 3.


We try to verify that $S/J$ is regular in codimension 1 or 2 by computing the ideal made up of a small number of minors of the Jacobian matrix. In this example, instead of computing all relevant 1465128 minors to compute the singular locus, and then trying to compute the dimension of the ideal they generate, we instead compute a few of them. regularInCodimension returns true if it verified that the ring is regular in codim 1 or 2 (respectively) and null if not. Because of the randomness that exists in terms of selecting minors, the execution time can actually vary quite a bit. Let's take a look at what is occurring by using the Verbose option. We go through the output and explain what each line is telling us.

MaxMinors. The first output says that we will compute up to 452.9 minors before giving up. We can control that by setting the option MaxMinors.

There are other finer ways to control the MaxMinors option, but they will not be discussed in this tutorial. See regularInCodimension.
Selecting submatrices of the Jacobian. We also see output like: ``Choosing LexSmallest'' or ``Choosing Random''. This is saying how we are selecting a given submatrix. For instance, we can run:

and only random submatrices are chosen. We discuss strategies for choosing submatrices much more generally in the FastMinorsStrategyTutorial. Regardless, after a certain number of minors have been looked at, we see output lines like: ``Loop step, about to compute dimension. Submatrices considered: 7, and computed = 7''. We only compute minors we haven't considered before. So as we compute more minors, there can be a distinction between considered and computed.
Computing minors vs considering the dimension of what has been computed. Periodically we compute the codimension of the partial ideal of minors we have computed so far. There are two options to control this. First, we can tell the function when to first compute the dimension of the working partial ideal of minors.

MinMinorsFunction. We pass MinMinorsFunction a function which sends the minimum number of minors needed to verify that something is regular in codimension $n$ (which is always $n+1$) to the number of minors to compute before computing the dimension of the partial ideal of minors for the first time. You can see that three minors were computed in the above example before we attempt to compute codimension.
CodimCheckFunction. The option CodimCheckFunction controls how frequently the dimension of the partial ideal of minors is computed. For instance, setting CodimCheckFunction => t > t/5 will say it should compute dimension after every 5 minors are examined. In general, after the output of the CodimCheckFunction increases by an integer we compute the codimension again. The default function has the space between computations grow exponentially.

isCodimAtLeast and dim. We see the lines about the ``isCodimAtLeast failed''. This means that isCodimAtLeast was not enough on its own to verify that our ring is regular in codimension 1. After this, ``partial singular locus dimension computed'' indicates we did a complete dimension computation of the partial ideal defining the singular locus. How isCodimAtLeast is called can be controlled via the options SPairsFunction and PairLimit, which are simply passed to isCodimAtLeast. You can force the function to only use isCodimAtLeast and not call dimension by setting UseOnlyFastCodim => true.

This can be useful if the function is hanging when trying to compute the dimension, but you may wish increase PairLimit.
Summary. If you expect that finding a submatrix or computing a minor is relatively costly from a time perspective, then it makes sense to compute the codimension more frequently. If computing the codimension is relatively costly we recommend computing the codimension less frequently, or using the UseOnlyFastCodim => true with a high PairLimit. For example, if using StrategyPoints, then choosing a submatrix can be quite slow, however each submatrix is very ``valuable'', in that adding it to the ideal of minors so far is quite likely to reduce the dimension of the singular locus.
One may also change how minors (determinants of the Jacobian submatrix) are computed by using the DetStrategy option.
The object RegularInCodimensionTutorial is a symbol.