=Paper=
{{Paper
|id=Vol-3754/paper03
|storemode=property
|title=Some applications of Chinese Remainder Theorem codes with error-correction
|pdfUrl=https://ceur-ws.org/Vol-3754/paper03.pdf
|volume=Vol-3754
|authors=Jesse Elliott,Eric Schost
|dblpUrl=https://dblp.org/rec/conf/sycss/ElliottS24
}}
==Some applications of Chinese Remainder Theorem codes with error-correction==
Some Applications of Chinese Remainder Theorem
Codes with Error-Correction
Jesse Elliott1 , Γric Schost1
1
University of Waterloo, David R. Cheriton School of Computer Science, Waterloo, Ontario, Canada
Abstract
Modular techniques with rational reconstruction improve complexity when computing over a ground
field such as β by controlling the growth of intermediate expressions. Working modulo a single prime
π β β, one can solve the problem modulo π and lift the solution to β€/π π β€ for sufficiently large π π using
π-adic lifting techniques, when applicable. Alternatively, computations can be done modulo several
small primes π1 , β¦ , ππ . One can then obtain a solution modulo their product π1 β― ππ using the Chinese
remainder theorem. We say primes π are βunluckyβ when the procedure modulo π is not well-defined
or returns a result that is different from the modulo π reduction of the rational output. Otherwise
we say primes are βlucky.β For some applications (solving zero-dimensional polynomial systems, for
instance), testing if a prime is lucky may be prohibitively expensive. However, it is often possible to
bound the number of unlucky primes by proving the existence of a nonzero π β β€ with all unlucky
primes dividing π, and bounding the height of π. Using π-adic lifting requires the initial prime to be
lucky, with a high probability of success that is determined by an upper bound on π. On the other
hand, the Chinese remainder theorem requires that all primes are lucky, and to guarantee this with high
probability usually requires larger primes. We report on work-in-progress that uses error correction
techniques with Chinese remaindering that allows us to tolerate a few unlucky primes. Our hope is to
then guarantee a high probability of success while using primes of moderate size.
We base our work on independent results from BΓΆhm, Decker, Fieker and Pfister [1, 2] and Pernet [3].
To our knowledge, the consequences we derive, while relatively straightforward, are new. We give
explicit sufficient conditions on the number of primes and their size to guarantee an arbitrary probability
of success, assuming we can pick primes uniformly at random in a given interval. We also describe a
number of applications.
Keywords
Chinese remainder theorem codes, polynomial system solving, modular algorithms
1. Background and previous work
Solving algebraic problems over a ground field such as β, considering only algebraic complexity
(the number of base field operations) is hardly a good predictor of practical runtime: a precise
analysis should take into account the size of the coefficients in the output, and the number of
boolean operations throughout the execution of the algorithm.
One major challenge in such algorithms is the growth of coefficients. In many situations,
we can give reasonably sharp a priori bounds on the bit size of the coefficients in the output
SCSS 2024: 10th International Symposium on Symbolic Computation in Software Science, August 28β30, 2024, Tokyo,
Japan
Envelope-Open jakellio@uwaterloo.ca (J. Elliott); eschost@uwaterloo.ca (Γ. Schost)
GLOBE https://uwaterloo.ca/scholar/jakellio/home (J. Elliott); https://cs.uwaterloo.ca/~eschost/ (Γ. Schost)
Β© 2024 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
CEUR
Workshop
Proceedings
http://ceur-ws.org
ISSN 1613-0073
CEUR Workshop Proceedings (CEUR-WS.org)
CEUR
ceur-ws.org
Workshop ISSN 1613-0073
Proceedings
13
(a typical recipe being understanding them as determinants built from the input problem).
Precisely, we will assume below that we know an upper bound π» on the height of all rational
numbers appearing in the output, where in this note the height β(π) of a rational number π is
the maximum of the base-2 logarithms of the absolute values of its minimal numerator and
denominator. However, such insight should not be expected for intermediate results of our
algorithm. As the algorithm progresses, the size of these coefficients may increase, before
possibly collapsing when we reach the end result.
Modular techniques are used to avoid intermediate expression swell. They involve performing
computations modulo one or several small primes (ideally, machine primes), thereby avoiding
intermediate coefficient growth, the objective being to compute the requested output (typically,
a set of polynomials, or a matrix thereof) modulo a certain large integer π. If π is large enough
(precisely, if log2 (π) β₯ π» + 1), rational reconstruction can then be applied coefficient-wise, in
order to recover an output with rational coefficients.
On one end of the spectrum, one can consider working modulo a single prime π, solve the
problem modulo π and lift the solution to β€/πβ€, for π = π π large enough, by means of Newton
/ Hensel techniques, if applicable. The obvious alternative is to compute modulo sufficiently
many βsmallβ primes (ππ )1β€πβ€π and use the Chinese remainder theorem to obtain a solution
modulo π = π1 β― ππ .
For most problems of interest, there exist primes π for which the procedure modulo π is
not well-defined, or returns a result that differs from the modulo π reduction of the rational
output; we will call these primes unlucky, and lucky otherwise. In the problems we have in
mind, such as solving systems of polynomial equations, testing whether a prime is lucky may be
prohibitively expensive. However, it is often possible to bound the number of unlucky primes:
this is usually done by proving the existence of a nonzero π β β€ such that all unlucky primes
divide π, and bounding the height of π.
Using π-adic lifting techniques, we need to ensure that the initial prime π is lucky; knowing
the upper bound on π, we can determine what interval to pick π from in order to guarantee a
high probability of success, say at least 1 β π for a given tolerance π. For Chinese remaindering
algorithms, though, the direct approach requires all primes being lucky, and guaranteeing that
this is the case with probability 1 β π usually requires us to use larger primes (we discuss this
further below). In this short note, we report on work-in-progress that uses error correction
techniques (very loosely speaking, analogues of Reed-Solomon decoding, but for rational number
reconstruction), where we tolerate that a few primes return wrong results (or no results at all).
Our hope is then to be able to guarantee high probability of success, while using primes of
moderate size.
We base our work on recent (independent) introductions of this idea, by BΓΆhm, Decker,
Fieker and Pfister [1, 2] and Pernet [3], the former in the context of algorithms for algebraic
geometry, and the latter mentioning applications to linear algebra. The decoding algorithms and
the sufficient conditions for success given in these two families of references are distinct, but
similar; both follow an iterative reduction procedure, stated as a variant of Euclidβs algorithm
in Pernetβs work, and as a variant of Gaussian lattice reduction by BΓΆhm et al. Our presentation
will follows Pernetβs.
The core of our discussion concerns the reconstruction of a single rational number. We
also point out that in the contexts we are interested in, algorithms usually return several such
14
numbers (typically as coefficients of polynomials), and we can often predict that all these
rationals admit a small common denominator. Taking this specificity into account would lead us
toward error-tolerant vector rational number reconstruction; ideally, we could hope to reduce
the number of primes by up to two, but as of now, this appears to be quite challenging.
2. Our contribution
Let us first review the key result regarding Chinese remaindering for rational reconstruction in
the presence of errors. We consider a sequence of prime moduli π1 , β¦ , ππ and a rational number
π = π /π, with π > 0. The goal is to recover π from a vector (ππ )1β€πβ€π , where ππ = π mod ππ for a
certain number of lucky primes ππ . We tolerate a number of errors or missing values (e.g., for
which ππ divides π), for which we write ππ = β, for a new symbol β; the corresponding primes
are unlucky. Consider the following integers:
π
β’ π = βπ=1 log2 (ππ )
β’ πΏ = β1β€πβ€π,ππ unlucky prime log2 (ππ ).
β’ π» is a given upper bound on the height of π, that is, log2 (|π |), log2 (π) β€ π»
Then, Pernet proved in [3, Lemma 2.5.4] that if πΏ < (π β 2π» + 1)/2, one can reconstruct π given
the ππ βs [3, Algorithm 2 p.38]. BΓΆhm et al. proved similar results.
Although these statements are well-established, to our knowledge, the following conse-
quences, while relatively straightforward, are new. We provide a quantitative analysis which
gives explicit sufficient conditions on the number of primes and their size to guarantee an
arbitrary probability of success, in a model where we assume we can pick primes uniformly at
random in a given interval.
Stating this result requires us to take all primes into consideration. Thus, π and the upper
bound π» are as above, and to each prime π β β corresponds a value π(π) (possibly β); π is called
lucky when π(π) = π mod π and unlucky otherwise. We assume that there are finitely many
unlucky primes and let π be their product. In addition to the output size bound π», we then
need a bound πΆ such that log2 (π ) β€ πΆ. Both π» and πΆ are problem-dependent (we discuss a few
examples in the next section); once bounds on π» and πΆ are available, the following propositions
apply.
In what follows, for simplicity, given an interval Ξ£ = {π , β¦ , 2π }, we assume that we can
sample π primes in Ξ£ uniformly without replacement, as long as this interval is known to
contain at least π primes.
Proposition 1. Let π, π» , πΆ be as above. For π > 0, let π and π be integers such that π β₯
max(16, 16πΆ
π
, 16π» ) and π = β log4π»(π) β. Select pairwise distinct primes π1 , β¦ , ππ independently
2
and uniformly at random from the set Ξ£ = {π , β¦ , 2π }. Then, with probability at least 1 β π, given
(π(π1 ), β¦ , π(ππ )), one can reconstruct π.
Proof. Let π denote the set {π β£ π β Ξ£ and π mod π = 0}, and notice that the product βπβπ π
also divides π, so that in particular βπβπ π β€ π. Each prime in Ξ£ is at least equal to π, so that
15
#π β€ logπΆ(π) . On the other hand, the number of primes in Ξ£ is at least 2 logπ (π) [4, Ex. 18.18], so
2 2
(πΆ/ log (π))
that for a prime π chosen at random in Ξ£, β(π|π ) β€ (π/(2 log2 (π))) = 2πΆ
π
.
2
Now, we choose π distinct primes π1 , β¦ , ππ uniformly at random in Ξ£, and for π = 1, β¦ , π, we
let ππ be the indicator variable defined as
1 if ππ β£ π
ππ = {
0 otherwise,
π
so that πΌ[ππ ] = β(ππ = 1) β€ 2πΆ/π. Define further π = βπ=1 ππ , so that πΌ[π ] β€ 2ππΆ/π. Now,
for any choice of π distinct primes (ππ ) in Ξ£, the quantities π and πΏ defined above satisfy
π
π = βπ=1 log2 (ππ ) β₯ π log2 (π ) and πΏ = β1β€πβ€π,ππ unlucky prime log2 (ππ ) β€ log2 (2π )π. From [3,
Lemma 2.5.4] as cited above, we know that the error-tolerant rational reconstruction algorithm
succeeds as soon as πΏ β€ (π β 2π» + 1)/2, and in particular as soon as log2 (2π )π β€ Ξ =
(π log2 (π) β 2π» + 1)/2. We will point out below that for our choice of π, Ξ is positive.
Then, the probability of failure is at most β (log2 (2π )π > Ξ) = β (π > Ξ/ log2 (2π )), which
by Markovβs inequality is at most πΌ[π ]/ (Ξ/ log2 (2π )). We deduce
2ππΆ 2 log2 (2π ) 8πΆ π log2 (π ) 8πΆ 1
β(fail) β€ ( )( )β€ = .
π π log2 (π ) β 2π» + 1 π π log2 (π ) β 2π» π 1 β 2π»
π log2 (π)
Now, take π = β4π»/log2 (π )β, so that in particular π β₯ 4π» /log2 (π ), and thus 2π» /(π log2 (π )) β€
1/2, in which case the right-most factor in the inequality above is at most 2. Besides, this
choices ensures Ξ > 0. To summarize, in this case, we have β(fail) β€ 16πΆ/π, and this can be
made less than π as soon as π β₯ 16πΆ/π.
It remains to verify that our interval Ξ£ contains at least π primes. We know that there are
at least π /2 log2 (π ) such primes, and that π is at most 4π» / log2 (π ) + 1, and one checks that if
π β₯ 16 and π β₯ 16π», this is indeed less than or equal to π /2 log2 (π ).
Remark 2. In the context of a modular algorithm, the most important component in the cost
analysis is the total time spent solving the problem modulo the primes ππ . In rough approximation,
one can assume that each such execution takes π operations modulo ππ , where π is independent of π.
It follows that the total boolean cost is softly-linear in π β1β€πβ€π log2 (ππ ) β Ξ(π π log(π )).
In our construction, we have π log2 (π ) β€ ( log4π»(π) + 1) log2 (π ) = 4π» + log2 (π ). In other words,
2
the boolean cost involves both the output size π», which is as expected, together with log2 (π ), which
will increase if we take π close to zero.
Remark 3. Assume that we do not use error-correction. In this case, in order to be able to reconstruct
π, we need all primes to be lucky. With notation as in the proposition, we saw that the probability
that a single prime is unlucky is at most 2πΆ/π, so when choosing π primes, the probability that at
least one of them is unlucky is at most
2πΆ π 2ππΆ
1 β (1 β ( )) β€ .
π π
16
Assuming we choose π as above, let us derive a bound on π that ensures 2ππΆ/π < π. We proceed
informally and take π = 4π»/log2 (π ), so our inequality is satisfied when 8πΆπ»/(π log2 (π )) < π.
Hence we require that π log2 (π ) β₯ 8π» πΆ/π; this gives π β₯ π
(8π» πΆ/π), where π
is the reciprocal
function of π₯ β¦ π₯ log2 (π₯). This function grows like π₯/ ln(π₯), for π₯ β β, which gives asymptotically
π β₯ 8π» πΆ/(π ln(8π» πΆ/π)). As expected, this is inferior to the bound given in the previous proposition.
3. Applications
We end this note with a quick description of possible use cases of this work.
Computing Hermite forms over β[π₯]. In [5], Storjohann gives a modular algorithm to
compute Hermite forms for matrices with entries in β[π₯], together with bounds π» on the output
size and πΆ on the unlucky primes. Our work applies directly to this situation. We are not aware
of alternative methods that would rely on Newton iteration.
Computing lexicographic GrΓΆbner bases in β[π₯, π¦]. In [6], St-Pierre and Schost provide
similar bounds π» and πΆ for the computation of bivariate GrΓΆbner bases; again, our work applies
directly. In this case, an alternative approach based on Newton iteration exists, but has rather
high complexity.
Solving zero-dimensional systems in β[π₯1 , β¦ , π₯π ]. The main application we have in mind
is the solution of zero-dimensional polynomial systems (by means of a data-structure known as
a zero-dimensional parametrization, see [7] for a definition and references). When the complex
solutions have multiplicity one, a simple form of Newton iteration is applicable [8], but without
this assumption, lifting techniques are complex to analyze. In this case, a bound π» on the output
size is available by means of the arithmetic BΓ©zout theorem, but the unlucky primes are harder
to describe. The reference [9] quantifies primes π for which the number of solutions changes
modulo π, but further arguments are needed to control other possible degeneracies.
References
[1] J. BΓΆhm, W. Decker, C. Fieker, G. Pfister, The use of bad primes in rational reconstruction,
Math. Comput. 84 (2012) 3013β3027.
[2] J. BΓΆhm, W. Decker, C. Fieker, S. Laplagne, G. Pfister, Bad primes in computational algebraic
geometry, in: Mathematical Software β ICMS 2016, Springer, 2016, pp. 93β101.
[3] C. Pernet, High Performance and Reliable Algebraic Computing, HDR, UniversitΓ© Joseph
Fourier, Grenoble 1, 2014. URL: https://theses.hal.science/tel-01094212.
[4] J. von zur Gathen, J. Gerhard, Modern Computer Algebra, third ed., Cambridge University
Press, 2013.
[5] Storjohann, A., Computation of Hermite and Smith Normal Forms of Matrices, Masterβs
thesis, University of Waterloo, 1994.
[6] E. Schost, C. St-Pierre, p-adic algorithm for bivariate grΓΆbner bases, in: ISSACβ23, ACM,
2023, p. 508β516. doi:10.1145/3597066.3597086 .
17
[7] E. Schost, M. S. E. Din, Bit complexity for multi-homogeneous system solving application
to polynomial minimization, Journal of Symbolic Computation 87 (2018) 176β206.
[8] W. Trinks, On improving approximate results of buchbergerβs algorithm by newtonβs
method, SIGSAM Bull. 18 (1984) 7β11.
[9] C. DβAndrea, A. Ostafe, I. Shparlinski, M. Sombra, Reductions modulo primes of systems of
polynomial equations and algebraic dynamical systems, Trans. Amer. Math. Soc. 371 (2019)
1169β1198.
18