Download Solving Linear Diophantine Equations Using the Geometric

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Quartic function wikipedia , lookup

Quadratic equation wikipedia , lookup

Linear algebra wikipedia , lookup

Elementary algebra wikipedia , lookup

Polynomial greatest common divisor wikipedia , lookup

Factorization of polynomials over finite fields wikipedia , lookup

Invariant convex cone wikipedia , lookup

History of algebra wikipedia , lookup

Equation wikipedia , lookup

System of linear equations wikipedia , lookup

System of polynomial equations wikipedia , lookup

Transcript
Solving Linear Diophantine Equations Using the
Geometric Structure of the Solution Space
Ana Paula Tomás and Miguel Filgueiras
LIACC, Universidade do Porto, Portugal
email: {apt,mig}@ncc.up.pt
Abstract. In the development of algorithms for finding the minimal
solutions of systems of linear Diophantine equations, little use has been
made (to our knowledge) of the results by Stanley using the geometric
properties of the solution space. Building upon these results, we present
a new algorithm, and we suggest the use of geometric properties of the
solution space in finding bounds for searching solutions and in having a
qualitative evaluation of the difficulty in solving a given system.
1
Introduction
The problem of finding the set of the minimal solutions of the monoid of nonnegative integral solutions of (1), also called Hilbert Basis,
AX = 0, A a m × n integral matrix,
(1)
has been investigated by Elliott [4] and MacMahon [9] in the beginning of this
century, and more recently by several other researchers ([7, 8, 2, 1, 12, 10, 3, 6, 5])
when it was found to be related to areas such as AC-unification, word problems,
or combinatorics.
In terms of the development of algorithms for solving this problem, little use
has been made (to our knowledge) of the results by Stanley using the geometric
properties of the solution space [14, 15], in particular, his characterization of the
generating function of the solutions monoid.
Building upon these results, we present a new algorithm, which is a reformulation of the Slopes Algorithm we described previously for solving a single
equation [6], and we suggest the use of geometric properties of the solution space
in finding bounds for searching solutions and in having a qualitative evaluation
of the difficulty in solving a given system. We also note that, as a direct consequence of Stanley’s results, the algorithm by Domenjoud [3] can be improved.
2
Triangulating the Cone of Nonnegative Real Solutions
The set of nonnegative real solutions of a system of linear homogeneous Diophantine equations is a pointed convex polyhedral cone, to which we shall refer
as the solution cone. The main definitions and results about polyhedral convex
cones may be found for instance in [13]. We briefly recall those that are needed
in the sequel. In the real Euclidean space Rn , any set C which is the intersection
of finitely many linear half-spaces is called a convex polyhedral cone. A cone C
is said to be pointed if for all nonnull v ∈ C, −v ∈
/ C. It is known that each
pointed convex polyhedral cone is the convex hull of its extremal rays, which are
finitely many. Extremal rays are the 1-dimensional faces of C, each face being the
intersection of C with some hyperplane H such that C lies entirely on one of the
half-spaces determined by H. The dimension of a face F, denoted by dim F, is
the dimension of the linear subspace of Rn spanned by F. If C is p-dimensional,
then any p − 1 dimensional face of C is called a facet. The set of faces, including
the improper face C, ordered by inclusion is a lattice, so-called the face lattice.
Given x = (x1 , . . . , xn ) ∈ Rn , the xi ’s being the coordinates of x wrt the canonical basis of Rn , the support of x, denoted by supp x, is {i | xi 6= 0}. If X ⊆ Rn ,
then by definition supp X = ∪x∈X supp x. The face lattice and the lattice of
the supports of the faces of the cone of real nonnegative solutions of a system
of linear homogeneous Diophantine equations are isomorphic, each extremal ray
being defined by a minimal nonnegative integral solution of minimal1 support.
Moreover, each minimal solution of minimal support is the minimum positive
integral solution of some subsystem of the given system, having at most m + 1
nonnull components, where m is the rank of the system matrix. Without loss
of generality, the matrix may certainly be assumed of full row rank. There are
other methods to compute such minimal solutions, for instance by relating them
to
Pnthe vertices of the polytope obtained by intersecting C with the hyperplane
i=1 xi = 1. Some bibliographical references to methods for enumerating the
vertices of a polytope, based on the Simplex algorithm, may be found in [13].
Example 1 The system AX = 0 where


3 −1 0 −2 3 −2 −1 −3
 2 −2 0 0 2 1 −2 −1 

A=
 1 1 1 −3 3 2 −3 0 
0 0 −1 0 0 2 3 0
has 6 minimal solutions of minimal support, namely
s1 = ( 1 2 0 2 1 0 0 0 )
s2 = ( 33 35 8 28 0 4 0 0 )
s3 = ( 13 11 0 8 0 0 0 4 )
s4 = ( 0 0 3 1 1 0 1 0 )
s5 = ( 31 0 121 21 0 8 35 0 )
s6 = ( 15 0 33 5 0 0 11 8 )
which determine a 4-dimensional solution cone. The cone has five facets,
two of which are 3-dimensional simplicial cones, their cross-sections being
represented schematically as follows.
s5
1
||
||
|
|
||
s4
s6
s2
||
||
|
|
||
Not taking ∅ into account.
s1
s1
s4
s2
s3
s1
s4
s3
s2
s5
s5
s6
s3
s6
The faces and their supports are the following.
4-dimensional face (solution cone)
{1, 2, 3, 4, 5, 6, 7, 8}: cone{s1 , s2 , s3 , s4 , s5 , s6 }
3-dimensional faces (facets)
{1, 3, 4, 5, 6, 7, 8}: cone{s4 , s5 , s6 }
{1, 2, 3, 4, 6, 7, 8}: cone{s2 , s3 , s5 , s6 }
{1, 2, 3, 4, 5, 6, 8}: cone{s1 , s2 , s3 }
{1, 2, 3, 4, 5, 7, 8}: cone{s1 , s3 , s4 , s6 }
{1, 2, 3, 4, 5, 6, 7}: cone{s1 , s2 , s4 , s5 }
2-dimensional faces
{1, 3, 4, 6, 7, 8}: cone{s5 , s6 } {1, 3, 4, 5, 7, 8}: cone{s4 , s6 }
{1, 2, 3, 4, 7, 8}: cone{s3 , s6 } {1, 3, 4, 5, 6, 7}: cone{s4 , s5 }
{1, 2, 3, 4, 6, 7}: cone{s2 , s5 } {1, 2, 3, 4, 5, 7}: cone{s1 , s4 }
{1, 2, 3, 4, 6, 8}: cone{s2 , s3 } {1, 2, 4, 5, 8}: cone{s1 , s3 }
{1, 2, 3, 4, 5, 6}: cone{s1 , s2 }
1-dimensional faces (extremal rays)
{1, 2, 4, 5}: cone{s1 }
{1, 2, 3, 4, 6}: cone{s2 }
{1, 2, 4, 8}: cone{s3 }
{3, 4, 5, 7}: cone{s4 }
{1, 3, 4, 6, 7}: cone{s5 } {1, 3, 4, 7, 8}: cone{s6 }
A simplicial cone is a p-dimensional cone with p extremal rays, that is whose
n
extremal rays are linearly independent. The cone generated
Pk by r1 , . . . , rk ∈ R ,
say cone{r1 , . . . , rk }, is given by cone{r1 , . . . , rk } = { i=1 αi ri | αi ≥ 0}.
We call a finite set Γ = {σ1 , . . . , σt } of simplicial cones a triangulation of C if
C = ∪σi and the intersection σi ∩ σj of σi and σj , is a common face of σi and
σj . This definition differs from that given by Stanley in [15], which requires in
addition that every face of σi is also in Γ , for all i.
A relevant result about triangulations of pointed convex polyhedral
cones, which does not hold for general polyhedra, may be found in [15], and
asserts that “a pointed convex polyhedral cone C possesses a triangulation Γ
whose extremal rays (i.e. 1-dimensional cones in Γ ) are the extremal rays of
C.” Let C be the solution cone of AX = 0. It follows from Stanley’s proof
that when C is not already simplicial such a triangulation may be constructed by selecting (non-deterministically) one extremal ray, say rj , then proceed
recursively to triangulate the facets of C intersecting rj only at 0 (i.e., such
that rj is not one of their extremal rays), and obtaining as a triangulation
(in our sense) of C, the set of simplicial cones that are convex hulls of rj
with each of the simplicial cones in the triangulation of such facets. Thus,
if Γfacets = {coneGi }i then Γ = {cone(Gi ∪ {rj })}i . In the example above,
{cone{s1 , s4 , s5 , s6 }, cone{s1 , s2 , s3 , s6 }, cone{s1 , s2 , s5 , s6 }} is a triangulation
of the solution cone. Actually, first we choose s1 , and the facets of C not containing s1 are cone{s4 , s5 , s6 } and cone{s2 , s3 , s5 , s6 }. The former is simplicial.
The latter is decomposed into {cone{s2 , s3 , s6 }, cone{s2 , s5 , s6 }} by selecting
s2 . The facets of cone{s2 , s3 , s5 , s6 } not containing s2 being cone{s3 , s6 } and
cone{s5 , s6 }, which are simplicial. When s1 is the first selection, yet another
triangulation is {cone{s1 , s4 , s5 , s6 }, cone{s1 , s2 , s3 , s5 }, cone{s1 , s3 , s5 , s6 }}.
Having found the face lattice of C, it is not difficult to compute triangulations like these ones. The face lattice may be easily obtained from the minimal
solutions of minimal support, say s1 , . . . , sp . The algorithms we included in our
implementation in C are based on the following properties. Each face of C is
a pointed convex polyhedral cone whose extremal rays are extremal rays of C.
Since φ(F) = supp F, for all F, is an isomorphism from the face lattice onto the
supports’ lattice, {0} =
6 F = cone{si1 , . . . , sik } is a face if and only if there exists
no other sik+1 such that supp F = supp{si1 , . . . , sik } = supp{si1 , . . . , sik , sik+1 }.
The set of 1-dimensional faces is {cone{si } | 1 ≤ i ≤ p}. If F 0 is a d-dimensional
face that precedes immediately F (thus F 0 is a facet of F), dim F = d + 1.
Domenjoud’s Algorithm revisited In 1991, Domenjoud remarked that the
minimal solutions of (1) whose supports are not minimal are linear rational
nonnegative combinations with coefficients < 1 of linearly independent minimal
solutions of minimal support. Based on this, Domenjoud proposed an algorithm
[3] for finding the minimal solutions which computes the solutions generated by
each maximal independent set of minimal solutions of minimal support. In other
words, the algorithm is seeking for solutions in all possible maximal dimensional
simplicial subcones whose extremal rays are extremal rays of the solution cone
C. The algorithm is significantly improved if instead of that only those subcones
making a triangulation of C are taken into account, thus avoiding much redundancy. This is a straightforward corollary of Stanley’s results. For instance, if C
is 3-dimensional with p extremal rays only p − 2 subcones have to be considered,
instead of p!/(3! (p − 3)!). Work in this direction is also described in [11].
3
The Slopes Algorithm – Solving a Single Equation
A few years ago, we proposed algorithms for solving a single homogeneous Diophantine equation – Slopes Algorithm [16] and Rectangles Algorithm [5]. A complete description of Slopes is given in [6]. We showed that the (nonnull) solutions
of (2) that are minimal in a component-wise ordering may be computed directly.
ax = by + cz + v,
a, b, c > 0, v ∈ ZZ, x, y, z ∈ N
(2)
The Basic Slopes Algorithm, which applies to (2), yields the minimal solutions
in z-increasing order by computing the starting solution and a set of spacings
from which the remaining solutions may be derived. We shall refer to this set of
spacings as the basic spacings. Given a solution s, the next solution is obtained by
adding a suitable spacing to s. The basic spacings {(−δyk , δzk )}k in δz increasing
order, correspond to the minimal solutions of an homogeneous linear equation in
three unknowns, which we present as a congruence (3), in the variables δy and u
1
δy u + (ymax − 1)δy ≡ 0 (mod ymax )
(3)
δz = δz1 u
where u is some new auxiliary unknown, and (−δy1 , δz1 ), the so-called minimum
spacing is given by
δy1 =
c
mb mod ymax
gcd(a, b, c)
δz1 =
gcd(a, b)
,
gcd(a, b, c)
being mb the inverse of b/ gcd(a, b) modulo ymax , with ymax = a/ gcd(a, b). The
two trivial solutions of (2) when v = 0 are (ymax , 0) and (0, zmax ), where zmax =
a/ gcd(a, c). In the case v = 0, we deduced expressions that give the minimal
solutions and the suitable spacings, based on a geometric view of the solution
space. If s = (y, z) is a minimal solution and (−δyk , δzk ) is the current spacing, then
the next minimal solution is s0 = s + (−δyk , δzk ), provided that y ≥ δyk . Otherwise,
s0 = dδyk /yes+(−δyk , δzk ) and the spacing is replaced by s0 −s. Initially, the starting
solution is (ymax , 0) and the first spacing is (−δy1 , δz1 ). Recently, we noticed that
MacMahon [9] had already given a method to compute the minimal solutions of
ax = by + cz, when c = 1, by relating them to the continued fraction convergents
to a/b. The algorithm we designed has strong similarities to the method proposed
by MacMahon, although he seems not to have been aware that his method could
still be applied when c 6= 1. Nevertheless, our method is more general.
Provided that gcd(a, b, c) divides v, (2) is satisfiable, the starting solution
being (y0 + k0 ymax , z0 ), where k0 = max{0, d(−by0 − cz0 − v)/(bymax )e} and
z0 =
−vMc
mod δz1
gcd(a, b, c)
y0 =
(−v − z0 c)mb
mod ymax .
gcd(a, b)
(4)
Here, Mc is any integer satisfying bMb + cMc + aMa = gcd(a, b, c), for some
integers Ma , and Mb , and ymax , δz1 , and mb are as defined above. The output of
mod is the nonnegative remainder of the division. All gcd’s are positive.
Pn
Pm
To solve a problem in more than three unknowns i=1 ai xi = j=1 bj yj
ai , bj > 0, we proposed Slopes Algorithm, which computes the set of minimal
solutions by solving a family of subproblems in positive integers. Each subproblem is obtained by setting some of the unknowns to zero and requiring that the
remaining are positive. In geometric terms each subproblem consists in finding
solutions in the interior of a given face of the solution cone. The faces are explored in increasing order of dimension. In this way, whenever a solution is found
its minimality is decided by comparing it with the minimal solutions previously computed. For each subproblem in more than three unknowns, the values
of all but three of them (say all but x1 , y1 , y2 ) are enumerated under known
bounds, and for each fixed tuple, a problem as (2) is solved by the Basic Slopes
Algorithm.
4
Extending the Slopes Algorithm to Solve Systems
The Basic Slopes Algorithm still applies to systems AX = 0 whose solution
space is on a plane. That is the case, for instance, of systems whose number of
unknowns exceeds in two the rank of A. By Property 1 below, we see that when
the solution cone is 2-dimensional, solving the system is equivalent to solving
a k × (k + 2) subsystem, the k equations being independent. By considering
the geometric structure of the faces of the solution cone, Slopes Algorithm has
been almost straightforwardly adapted to solve systems of equations. Basically,
we remarked that any system with more than one minimal solution may be
rewritten into a form that is rather appropriate to apply Slopes Algorithm.
Example 2 Consider the system of the previous example. By rewriting
it relatively to cone{s4 , s5 , s6 } whose support is {1, 3, 4, 5, 6, 7, 8}, and
leaving x6 , x8 , x5 free, as well as x2 , we conclude that the given system
is equivalent to

8x1
= 31x6 + 15x8
+ 4x2



8x3
= 121x6 + 33x8 + 24x5 − 12x2
8x4
= 21x6 + 5x8 + 8x5 + 4x2



8x7 = 35x6 + 11x8 + 8x5 − 4x2
We see that all the components of the first three right-hand side columns
are nonnegative. The fact that the system is rewritten with respect to
a face which is a 3-dimensional simplicial cone, together with the choice
of the three first free unknowns, implies the nonnegativity of those three
columns. The criterion for selecting x6 , x8 , and x5 is the following, its correctness resulting from the proof of Proposition 1, below. Given
a face F that is a p-dimensional simplicial cone, let F be spanned by
{si1 , . . . , sip }. Then, p unknowns are selected, say xkj , 1 ≤ j ≤ p, such
that kj ∈ supp sij \supp ({si1 , . . . , sip }\{sij }). The subsystem whose solutions are on F, may be rewritten in a solved form where the p columns
associated to xkj ’s, the right-hand side columns, are nonnegative.
4.1
Giving the system an appropriate form
Given a system of linear Diophantine equations A1 x1 +. . .+An xn = 0, which we
shall write as AX = 0, each Ai denoting the ith column of A, we suppose, without
loss of generality, that A is a full row rank m×n integral matrix. Let S0 (A) denote
the set of minimal solutions of minimal support, and L(S0 (A)) denote the linear
space spanned by them, that is, the real space generated by the nonnegative
solutions of the system. The following property gives the relationship between
the dimension of the solution cone and supp S0 (A).
Property 1 If S0 (A) 6= ∅, and λ denotes the number of components that are
null in all the solutions in S0 (A), then dim L(S0 (A)) = n−λ−rank(Ai1 , . . . , Ain−λ ),
where [ Ai1 . . . Ain−λ ] is the submatrix obtained from A by removing the
λ columns corresponding to the components that are null. In other words, if
supp S0 (A) = {i1 , . . . , in−λ }, then dim L(S0 (A)) = n−λ−rank(Ai1 , . . . , Ain−λ ).
Thus, when dim L(S0 (A)) < n − m, the solutions may be found by solving a
subsystem of the one given, namely the one whose matrix is [Ai1 . . . Ain−λ ]. For
this reason, in the sequel we assume that supp S0 (A) = {1, . . . , n}. Property 2
follows immediately from Property 1 and the definition of simplicial cone.
Property 2 If A is a full row rank m × n matrix, and such that supp S0 (A) =
{1, . . . , n}, the number of minimal solutions of minimal support is n − m if and
only if the solution cone is simplicial.
Using the fact that each i-dimensional face of a simplicial cone is also a
simplicial cone, we shall prove the following result, which will be useful when
extending Slopes Algorithm to solve systems.
Proposition 1 If A is a full row rank m × n matrix, such that supp S0 (A) =
{1, . . . , n} and the number of minimal solutions of minimal support is n − m,
the system AX = 0 may be written in solved form as
d xik = αik 1 xim+1 + . . . + αik n−m xin , 1 ≤ k ≤ m
all coefficients being nonnegative integers, d > 0.
Since the minimal positive solutions of minimal support are in this case linearly
independent, the equivalent system may be seen as a parametric representation
of the solution space based on such minimal solutions. In matricial terms, Proposition 1 asserts that when the solution cone is simplicial, the system is equivalent
to dX0 = A11 X1 with d > 0 and A11 ∈ Nm×(n−m) , the set of variables being
partitioned into {X0 , X1 }, X0 ∈ Nm , X1 ∈ Nn−m .
Corollary 1.1 Let A be a full row rank m × n matrix, such that supp S0 (A) =
{1, . . . , n}. Let C denote the solution cone of AX = 0, and F be a face of C. If
F is a p-dimensional simplicial cone, then the system may be given the form
dX0 = A11 X1 + A12 X2
dX3 =
A22 X2
all coefficients being integral, A11 ∈ Nr×p where r = rank{Ai | i ∈ suppF},
d > 0, the set of variables being decomposed into {X0 , X1 , X2 , X3 } (with possibly
X2 or X3 empty), and supp F = {i | xi in X0 or X1 }.
Noting that, when dim L(S0 (A)) ≥ 2 there exists a 2-dimensional face, and
that any 2-dimensional face is necessarily simplicial, Corollary 1.1 justifies that
any system having at least two minimal solutions can be written as
axik = bk1 xim+1 + bk2 xim+2 +
n−m
X
bkj xim+j , 1 ≤ k ≤ m
(5)
j=3
with all coefficients integral, a > 0, and bkj ≥ 0 for j = 1, 2. As we will see, the
fact that a system can be given this particular form makes the generalization of
Slopes Algorithm to solve systems quite straightforward.
Before going on, we shall present an example that illustrates the results stated
above, while motivating the following ones.
Example 3 Let us consider the system AX = 0 where A is given by


2 0 −1 0 −2 0 2 0
 0 1 −2 0 1 −2 −2 2 



A=
 1 2 −2 0 −1 1 0 0 
 2 1 −2 −1 −2 2 0 2 
2 −1 2 −2 1 0 1 0
which can be found to have six minimal support solutions, namely
s1
s2
s3
s4
s5
s6
= ( 15 22 30 34 0 1 0 20 )
= ( 27 0 10 48 22 15 0 14 )
= ( 4 10 12 12 0 0 2 9 )
= ( 8 0 0 22 18 10 10 11 )
= ( 0 30 28 24 4 0 18 29 )
= ( 0 8 0 26 30 14 30 25 )
{{
{{
s3 C
CC
C
s1
s5
s2 C
CC
C
s6
{{
{{
s4
A cross-section of the 3-dimensional solution cone is drawn schematically on the right. The 2-dimensional facet cone{s1 , s2 } has support
{1, 2, 3, 4, 5, 6, 8}. To give the system the form described in Corollary
1.1, we note that 2 ∈
/ supp s2 , and 5 ∈
/ supp s1 , so that we solve the
system with respect to the components in {1, 3, 4, 6, 8}, leaving the 2nd
and 5th free, as well as the 7th, obtaining

22x1
= 15x2 + 27x5 − 31x7




22x
= 30x2 + 10x5 − 18x7

3
22x4
= 34x2 + 48x5 − 38x7


22x6
= x2 + 15x5 − 5x7



22x8 = 20x2 + 14x5 − x7
Hence, apart from non-redundant positivity constraints, which reduce to
x2 , x5 , x7 ≥ 0, 15x2 + 27x5 − 31x7 ≥ 0, 30x2 + 10x5 − 18x7 ≥ 0, and
x2 + 15x5 − 5x7 ≥ 0, solutions satisfy the system of congruences (6).

15x2 + 5x5 + 13x7 ≡ 0 (mod 22)




 8x2 + 10x5 + 4x7 ≡ 0 (mod 22)
12x2 + 4x5 + 6x7 ≡ 0 (mod 22)
(6)


x2 + 15x5 + 17x7 ≡ 0 (mod 22)



20x2 + 14x5 + 21x7 ≡ 0 (mod 22)
Furthermore, we remark that in order to compute the solutions in the
2-dimensional cone{s1 , s2 } only need we to find minimal (x2 , x5 ) solving
(6) for x7 = 0. In this case, (6) is equivalent to x2 +15x5 ≡ 0 (mod 22),
as deduced from Property 3 below, and so the Basic Slopes Algorithm can
be used to solve the problem. Indeed, even in the general case, solving
a two column system as this one, may be reduced to solving a single
congruence, and henceforth Basic Slopes applies. In this example, the
basic spacings for the subsystem are
δx1 δx3 δx4 δx6 δx8 −δx2 δx5
−15 −30 −34 −1 −20 −22 0
−9 −20 −21 0 −13 −15 1
−3 −10 −8 1 −6
−8 2
3
0
5 2
1
−1 3
27 10 48 15 14
0 22
which are determined by the basic spacings (−δx2 , δx5 ) obtained to the
single equation. Consequently, the minimal solutions with x7 = 0 are
x1 x3 x4 x6
15 30 34 1
6 10 13 1
9 10 18 3
12 10 23 5
15 10 28 7
x8
20
7
8
9
10
x1 x3 x4 x6 x8
18 10 33 9 11
21 10 38 11 12
24 10 43 13 13
27 10 48 15 14
x2 x5
22 0
7 1
6 4
5 7
4 10
x2
3
2
1
0
x5
13
16
19
22
Although we have also given the values of x1 , x3 , x4 , x6 and x8 , Slopes
is actually driven only by those of x2 and x5 , for no additional constraints are imposed by nonnegativity, in this case. The values of those
unknowns become important when we want to find the solutions with
x7 6= 0 by using Slopes techniques. Firstly, we can simplify the system
of congruences, rewriting it equivalently as
x2 + 15x5 + 6x7 ≡ 0
(mod 22)
∧
11x7 ≡ 0 (mod 22)
so that, by setting x7 as 2x07 , we find that x2 + 15x5 ≡ 10x07 (mod 22).
Upper bounds on the values of x7 can be deduced from triangulations of
the solution cone. Being each simplicial subcone a pointed convex polyhedral cone, the minimal solutions in each subcone are rational nonnegative combination (being the coefficients < 1) of the minimal solutions of
minimal support that define the extremal rays of the subcone. Thus, by
considering the triangulation illustrated by the following diagram, each
label containing the value of x7 in the corresponding minimal solution
we conclude that x7 < 48 in any minimal solution, and thus x07 < 24.
0:s1 U 0:s2
u 8 U U U JJJJ
u
u
U UJ
8
uu
8
2:s3 I
10:s4
8
III tt
t
8
I
t
t
18:s5
30:s6
By enumerating on the values of x07 , we find the candidates to minimal
solutions. For instance, when x7 = 2x07 = 2, the following candidate
solutions are found, which, in this case, are actually minimal.
x1
4
1
4
7
x3 x4 x6
12 12 0
2 4 1
2 9 3
2 14 5
x8
9
3
4
5
x2 x5
10 0
2 2
1 5
0 8
x7
2 (the starting solution)
2
2
2
When x7 = 4, the starting solution is (8, 24, 24, 0, 18, 20, 0, 4). Because
x1 = 8, the spacing that first applies is (−3, −10, −8, 1, −6, −8, 2, 0), the
components being in the same order as on the table above. None of the
candidate solutions obtained in this case is minimal.
4.2
When dim C ≤ 2
Being planar the solution space of (7)
a xi = bi y + ci z, 1 ≤ i ≤ m, a > 0, bi ≥ 0, ci ≥ 0
(7)
the Basic Slopes algorithm may be used to compute its minimal solutions. All
we need is to obtain the minimum spacing for the system, and the bounds ymax
and zmax . As for the case of a single equation, (X0 , y0 , z0 ) solves (7) for some
X0 ∈ Nm if and only if (y0 , z0 ) solves the system of congruences
bi y + ci z ≡ 0
(mod a), 1 ≤ i ≤ m
(8)
We shall denote (7) also by aX = By + Cz. In order to compute the minimum
spacing between solutions of (7), we reduce the system matrix of (8) to a Hermite
normal form2 by performing elementary transformations on rows. If M is a
matrix, Mi denotes the ith row of M .
Property 3 (Hermite Normal Form) Let M be a m × n integral matrix of full
column rank. There exist a unique unimodular m × m matrix U , and a unique
upper triangular n × n matrix T = (tij ), with 0 ≤ tij < tjj , and such that
(U M )i = Ti , for 1 ≤ i ≤ n, and (U M )i = 0, for n < i ≤ m. Moreover,
provided Ui V ≡ 0 for n < i ≤ m, the system M X ≡ V (mod a) is equivalent
to T X ≡ [U1 V . . . Un V ]t (mod a). Otherwise, the system is unsatisfiable.
Consequently, the set of minimal solutions of system (7) corresponds to the
set of minimal solutions of a single equation, as stated in Proposition 2.
Proposition 2 (y0 , z0 ) is a minimal solution of (7) if and only if (y0 , w0 ) is a
minimal solution of ax = t11 y+t12 a/ gcd(t22 , a)w, being z0 = a/ gcd(t22 , a) w0 ,
and T = (tij ) is obtained from M = (B C) as defined in Property 3.
Each basic spacing between solutions of the given system determines, and is
determined by, a basic spacing between solutions of the associated equation
ax = t11 y + t12 a/ gcd(t22 , a)w. The Basic Slopes algorithm can be used to
k
)}0≤k≤L , in δw -increasing order, as
compute these latter spacings, say {(−δyk , δw
k
k
mentioned in section 3. Let δz = a/ gcd(a, t22 )δw
, and δxk i = (−bi δyk + ci δzk )/a.
Definition 1 The set of basic spacings to (7), in δz -increasing order, is denoted
by {∆k }0≤k≤L and defined as { (δxk 1 , . . . , δxk m , −δyk , δzk ) }0≤k≤L .
In all cases, ∆0 is defined by (−ymax , 0) with ymax = lcmi {a/ gcd(a, bi )} =
a/ gcd(a, t11 ), and ∆L is given by (0, zmax ), where zmax = a/ gcd(a, t12 , t22 ) =
lcmi {a/ gcd(a, ci )}. As before, we denote the spacing in y by −δy instead of δy
to emphasize solutions being computed in y-decreasing order.
2
In the common usage of the term (e.g., in [13]), the reduced matrix is actually the
Hermite normal form of the transpose of the system matrix.
4.3
Solving a system by Slopes Algorithm
To find the minimal solutions of AX = 0, the Slopes algorithm first computes the
set of minimal solutions of minimal support and the face lattice of the solution
cone C. Then, the idea is to find all the candidate solutions in the interior of
each face F of dimension p, for all 2 ≤ p ≤ dim C, faces being explored in
increasing order of dimension. As before, the solutions in distinct faces of the
same dimension are not comparable. To decide whether a solution in F is minimal
it is sufficient to compare it with the minimal solutions found previously in F
and in subfaces of F.
When p = dim F = 2, the subsystem associated to F is given the form of (7)
and the Basic Slopes Algorithm is used to directly find all its minimal solutions
as discussed in the previous subsection. When p > 2, the subsystem is given
the form (9), as described before (cf. (5)), with r = rank{Ai | i ∈ supp F}, all
coefficients being integral, a > 0, and bi1 ≥ 0, bi2 ≥ 0.
axi = bi1 xr+1 + bi2 xr+2 +
p
X
bij xr+j , 1 ≤ i ≤ r
(9)
j=3
Upper bounds on the values of the unknowns, as for instance, bounds deduced
from the minimal solutions of minimal support generating F may, up to some
extent, be taken into account to choose the free unknowns xr+3 , . . . , xr+p , whose
values are enumerated under those bounds. It must also be guaranteed that the
system may be rewritten in form (9), in which all the coefficients of the two other
free unknowns are nonnegative. The latter condition, is required by Slopes and
holds if and only if supp F except the indices of the p − 2 selected unknowns,
includes the support of a 2-dimensional face of F (or equivalently, of C).
To simplify the notation, let us rename xr+1 and xr+2 as y and z, respectively.
After we have fixed a tuple (xr+3 , . . . , xr+p ), to obtain the values of the remaining
unknowns only have we to
(x1 , . . . , xr , y, z) that satisfy a system of the type
Pfind
p
of (10) below, with vi = j=3 bij xr+j .
a xi = bi1 y + bi2 z + vi , 1 ≤ i ≤ r, a > 0, bij ≥ 0, vi integer,
(10)
Since our goal is to compute minimal solutions, we only search for solutions of
(10) that are minimal in component-wise order. In the following subsection, we
show how the Basic Slopes algorithm is adapted to compute these solutions.
4.4
Solving aX = By + Cz + V by the Basic Slopes Algorithm
Apart from positivity restrictions, solutions of (11), i.e., of aX = By + Cz + V ,
a xi = bi y + ci z + vi , 1 ≤ i ≤ m, a > 0, bi ≥ 0, ci ≥ 0, vi ∈ ZZ
(11)
have naturally to satisfy bi y + ci z ≡ −vi (mod a), 1 ≤ i ≤ m, which, by
Property 3 above, may be rewritten as
t11 y + t12 z ≡ −U1 V (mod a)
(12)
t22 z ≡ −U2 V (mod a)
provided that Ui V ≡ 0 (mod a) holds3 , for all 3 ≤ i ≤ m, where Ui stands for
the ith row of the unimodular matrix of transformations, and V = [v1 . . . vm ]t .
We may suppose that all the coefficients have been reduced modulo a, although
that does not really make any change, other than possibly that of decreasing
the coefficients magnitude. Conventioning that gcd(0, α) = α, whatever α is,
and provided that gcd(t22 , a) divides U2 V , otherwise (12) is inconsistent, we
compute the least nonnegative zµ satisfying the 2nd equation, which is given by
zµ = −U2 V / gcd(t22 , a) (t22 / gcd(t22 , a))−1 mod a/ gcd(t22 , a),
where the inverse is modulo a/ gcd(t22 , a). Since z ≡ zµ (mod a/ gcd(a, t22 ))
and z ≥ zmin = max(0, {d−vi /ci e | bi = 0 ∧ ci 6= 0}), we set z = zµ0 +
a/ gcd(a, t22 ) w, with zµ0 = zµ +a/ gcd(a, t22 ) max(0, d(zmin −zµ ) gcd(a, t22 )/ae),
and further simplify (12) deriving the congruence
t11 y + t12 a/ gcd(a, t22 ) w ≡ −U1 V − t12 zµ0
(mod a),
(13)
that is satisfiable if and only if gcd(a, t11 , t12 a/ gcd(a, t22 )) divides −U1 V −t12 zµ0 .
Clearly, if (11) is satisfiable, y ≥ ymin = max(0, {d−vi /bi e | ci = 0 ∧ bi 6= 0}).
Now, to solve (11) using Slopes Algorithm techniques, we shall compute the
starting solution (the one with the least z) and the set of basic spacings. Similarly
to the case of a single equation, when vi < 0, for some i, nonnegative solutions
of (13) may lead to a negative xi . When finding the appropriate spacing to move
from a minimal solution to the following one, not only the values of −δy and
δz are relevant, but those of δxi . The starting solution (y0 + k0 ymax , z0 ) of (11)
is obtained from the nonnegative solution (y0 , w0 ) of (13) having the least w,
defined as in (4). Here k0 = max(0, {d(−bi y0 − ci z0 − vi )/(bi ymax )e | bi 6= 0}).
The interesting aspect is that the results stated in [6] for the case of a single
equation can be trivially generalized, all the proofs being adapted trivially. Due
to the fact that bi ≥ 0, ci ≥ 0, the sequence of basic spacings with respect to xi
is either strictly increasing, as previously, or null (being bi = ci = 0). This was
the key of the previous proofs. The spacing that must be added to the current
minimal solution of (11) to move to the following one is either the basic spacing
with the least δz and such that when added to the current solution yields a
nonnegative minimal solution, or when there exists none that can be applied,
some composite spacing is obtained. In a more formal way, we deduce Lemma
1, Proposition 3, and Corollaries 3.1 and 3.2, which are the extensions of results
proved in [6]. Due to linearity, the possible spacings are the same as for the
homogeneous case. The basic spacings are as in Definition 1.
Lemma 1 Let s = (xs1 , . . . , xsm , y s , z s ) be a minimal solution of (11) such that
y s − ymin ≥ δyL−1 = min{δyi | δyi 6= 0}, with δyi as defined previously. Then, the
minimum t such that some spacing ∆k , with k < L, can be added to s + t∆L is
t0 = max 0, maxi −(xsi + δxL−1
)/δxL i | δxL i 6= 0 .
i
q
Moreover, ∆q = (δxq 1 , . . . , δxq m , −δyq , δz ) is the first spacing that can be added,
where q = min{k | δyk ≤ y s − ymin , and xsi + t0 δxL i + δxk i ≥ 0 for all i}.
3
This condition may be used while generating the values of the enumerated unknowns.
Proposition 3 The spacings required to solve the family of problems
{aX = By + Cz + V }V ∈ZZm , a > 0, B, C ∈ Nm
(14)
result from the spacings {∆k }0≤k≤L as follows. Let s = (xs1 , . . . , xsm , y s , z s ) be a
minimal solution of (14) for fixed V ∈ ZZm . If y s − ymin ≥ δyL−1 then the spacing
that must be added to s to obtain the next minimal solution is
t0 ∆L + ∆q + r0 ∆0
q
q
with r0 = min{b(y s −ymin −δy )/ymax c, mini {b−(xsi +t0 δxL i +δxi )/δx0 i c | δx0 i 6= 0}},
and q and t0 as defined in Lemma 1. If y s − ymin < δyL−1 , there are no more
minimal solutions.
Corollary 3.1 The spacings required to solve the family of problems
{aX = By + Cz + V }V ≥0 , a > 0, B, C ∈ Nm
(15)
are the basic spacings {∆k }0≤k≤L . Given s = (xs1 , . . . , xsm , y s , z s ), a minimal
solution of (15) for fixed V ∈ Nm , let q = min{k | δyk ≤ y s }. The next minimal
solution is obtained by adding ∆q = (δxq 1 , . . . , δxq m , −δyq , δzq ) to s, provided δyq 6= 0.
Otherwise, there are no more minimal solutions.
Corollary 3.2 Under the conditions of Proposition 3, and provided L ≥ 2,
– if for some k < L, we have δxk i ≥ 0 for all i, then ∆L is never added, that is
t0 = 0 for all s;
– if δx1 i ≤ 0 for all i, then ∆0 is never added, i.e. q 6= 0 and r0 = 0 for all s.
5
About the Difficulty in Solving a Given Problem
Theoretical bounds on the minimal solutions have been given for instance by
Domenjoud [3] and Pottier [12]. Being expressed in terms of the entries or the
minors of the system matrix, the estimated bounds may be distinct for equivalent systems. Furthermore, their use in controlling and pruning the search may
be much less effective than the minimal solutions of minimal support. In particular, we are investigating bounds determined by different triangulations of
the solution cone for a given problem. A simple heuristic to obtain a fairly good
triangulation is to select first the extremal ray having the least value for the
sum of components. A somewhat more elaborate criterion, not so easy to implement, is to minimize the bounds that are derived in the end for some selected
components.
On the other hand, we consider the structure of the solution cone in conjunction with bounds on the minimal solutions to decide how to solve a given
problem. We have a non-optimized implementation in C of our algorithm. Although no extensive comparison to other algorithms has yet been made, there
are obvious speed-ups in some cases, confirming our belief that it would perform
quite efficiently when the solution cone is either simplicial or has simplicial faces
of high dimensions, as it was the case with the version for single equations [6]. In
fact, when the solution cone is simplicial, to check whether a solution is minimal
only the values of the free unknowns need to be inspected, which speeds up the
test. Moreover, bounds on the components may be dynamically obtained from
the minimal solutions to effectively prune the search, without much overhead.
Example 4 (Example 1 continued.) By inspecting the minimal solutions
of minimal support generating each facet, we conclude that there is no
minimal solution in the interior of the facets but for cone{s2 , s3 , s5 , s6 },
for which there are also the bounds x6 < 12 ∧ x8 < 12.
s5
||
||
|
|
||
s4
s6 s2
x5 <1
||
||
|
|
||
x5 <1
s1
s3
s1
|
|
|
|
s4
s2 B
B
s3
B
B
s1
|
|
|
|
s4
s3
s6
s5
s5
s6
s2
x7 <1 ∨ x5 <1 x6 <4 ∨ x8 <8 x7 <1 ∨ x5 <1
For any minimal solution in the interior of the solution cone, 1 ≤ x3 < 3
due to s4 = (0, 0, 3, 1, 1, 0, 1, 0). Also, 1 ≤ x5 < 2, and 1 ≤ x2 < 48. By
contrast, the theoretical bound [3, 12] on ||s||∞ for minimal solutions
s ∈ cone{s4 , s5 , s6 } is at least 3 × 121 = 363. And, in the interior of the
solution cone it is at least 4 × 121 = 484.
Example 5 Let us consider for instance 537x1 + 3x2 = 22x3 + 235x4 .
s1
s2
s3
s4
= ( 22 0 537 0 )
= ( 235 0 0 537 )
= ( 0 22 3 0 )
= ( 0 235 0 3 )
s1
s2
x2 < 22 k k k
k k
k k
k
x3 < 3
s3 k
s4
The theoretical upper bounds on x2 and x3 are 235 and 537 respectively. To find the minimal solutions in the interior of the cone by Slopes
Algorithm, instead of solving 537x1 = 22x3 + 235x4 − 3x2 , x2 < 235,
we would rather solve 235x4 = 537x1 + 3x2 − 22x3 , x3 < 3 (wrt face
{s2 , s4 }) and 537x1 = 22x3 + 235x4 − 3x2 , x2 < 22 ∧ x3 ≥ 3 (wrt face
{s1 , s2 }). Similar ideas apply when solving any system, whose solution
cone is 3-dimensional with 4 extremal rays.
6
Conclusions
We presented a new algorithm for solving a system of linear Diophantine equations which is a generalization of algorithms we described previously for a
single equation. It explores the geometric structure of the solution space. We
also showed how to use this structure in deriving bounds on the components of
minimal solutions, these bounds being independent from the particular form in
which the system is given and in general being better than the theoretical ones
known to date. In conclusion, we are convinced that it is worth while to consider
the geometric structure of the solution space when dealing with problems as
such.
Acknowledgements We are grateful to the anonymous referees for their constructive comments.
References
1. Boudet, A., Contejean E., and Devie, H.: A new AC Unification algorithm with an
algorithm for solving systems of Diophantine equations. In Proceedings of the 5th
Conference on Logic and Computer Science, IEEE, 289–299, 1990.
2. Clausen, M., and Fortenbacher, A.: Efficient solution of linear Diophantine equations. J. Symbolic Computation, 8, 201–216, 1989.
3. Domenjoud, E.: Outils pour la Déduction Automatique dans les Théories
Associatives-Commutatives. Thése de doctorat, Université de Nancy I, 1991.
4. Elliott, E. B.: On linear homogenous Diophantine equations. Quart. J. Pure Appl.
Math., 34, 348–377, 1903.
5. Filgueiras, M., and Tomás, A. P.: Fast Methods for Solving Linear Diophantine
Equations. In M. Filgueiras, L. Damas (eds.) Progress in Artificial Intelligence —
6th Portuguese Conference on Artificial Intelligence, Lecture Notes in Artificial
Intelligence 727, Springer-Verlag, 297–306, 1993.
6. Filgueiras, M., and Tomás, A. P.: A Fast Method for Finding the Basis of Nonnegative Solutions to a Linear Diophantine Equation. J. Symbolic Computation,
19, 507–526, 1995.
7. Huet, G.: An algorithm to generate the basis of solutions to homogeneous linear
Diophantine equations. Information Processing Letters, 7(3), 1978.
8. Lambert, J.-L.: Une borne pour les générateurs des solutions entières positives
d’une équation diophantienne linéaire. Comptes Rendus de l’Académie des Sciences
de Paris, t. 305, série I, 39–40, 1987.
9. MacMahon, P.: Combinatory Analysis, 2. Chelsea Publishing Co., 1918.
10. Moulinet-Ossola, C.: Algorithmique des Réseaux et des Systèmes Diophantiens
Linéaires. Thése de doctorat, Université de Nice Sophia-Antipolis, 1995.
11. Petitjean, E.: Résolution Parallèle de Contraintes Linéaires sur les Entiers Naturels. Mémoire de DEA, Université de Nancy I, 9/1996.
12. Pottier, L.: Minimal solutions of linear diophantine systems: bounds and algorithms. In R. V. Book (ed.), Proceedings of the 4th International Conference on
Rewriting Techniques and Applications, Lecture Notes in Computer Science 488,
Springer-Verlag, 162–173, 1991.
13. A. Schrijver, Theory of Linear and Integer Programming, Wiley-Interscience, 1986.
14. Stanley, R.P.: Linear homogeneous Diophantine equations and magic labelings of
graphs. Duke Math. J., 40, 607–632, 1973.
15. Stanley, R.P.: Enumerative Combinatorics, Vol I, The Wadsworth & Brooks/Cole
Mathematics Series, 1986.
16. Tomás, A. P. and Filgueiras, M.: A new method for solving linear constraints on the
natural numbers. In P. Barahona, L. Moniz Pereira, A. Porto (eds.), Proceedings of
the 5th Portuguese Conference on Artificial Intelligence, Lecture Notes in Artificial
Intelligence 541, Springer-Verlag, 30–44, 1991.
17. Tomás, A. P.: On Solving Linear Diophantine Constraints. Tese de Doutoramento,
submitted to Faculdade de Ciências da Universidade do Porto, 1997.
Proof. (Proposition 1)
Let S0 (A) = {s1 , . . . , sn−m }. Let C be the solution cone. Since C is simplicial,
each facet of C is obtained by removing one extremal ray. Let then, Fj be the facet
whose extremal rays are S0 (A)\{sj }. Thus, supp Fj ⊂ supp C = supp S0 (A),
there existing qj ∈ supp sj such that qj ∈
/ supp Fj . This means that qj ∈
/
supp sp , for all p 6= j. Let {i1 , . . . , im } = {1, . . . , n}\{q1 , . . . , qn−m }. Necessarily
|Ai1 . . . Aim | 6= 0, otherwise rank(A) < m. Furthermore, if we rename qj as im+j ,
it follows that
(xi1 , . . . , xim , xim+1 , . . . , xin ) = xim+1 /sim+1 1 (si1 1 , . . . , sim 1 , sim+1 1 , 0, . . . , 0) +
. . . + xin /sin n−m (si1 n−m , . . . , sim n−m , 0, 0, . . . , sin n−m )
and so, xik = sik 1 /sim+1 1 xim+1 + . . . + sik n−m /sin n−m xin , 1 ≤ k ≤ m. Thus,
0 ≤ sik j /sim+j j = |Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Aim |/|Ai1 . . . Aim | = αik j /d,
which completes the proof.
Proof. (Corollary 1.1)
F is the cone of real nonnegative solutions of the subsystem
Ai1 xi1 + . . . + Air xir + Aim+1 xim+1 + . . . + Aim+p xim+p = 0.
From Property 1, p = dim F = (r + p) − rank(Ai1 . . . Air Aim+1 . . . Aim+p ).
Hence r = rank(Ai1 . . . Air Aim+1 . . . Aim+p ), and the indices may be rearranged
if necessary, so that Ai1 , . . . , Air are linearly independent. If r < m, we may find
{ir+1 , . . . , im } ⊆ {1, . . . , n}\supp F, such that Ai1 , . . . , Air , Air+1 , . . . , Aim are
linearly independent. Consequently, AX = 0 may be given the form
|Ai1 . . . Aim |xik =
n−m
X
|Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Aim |xim+j , 1 ≤ k ≤ m.
j=1
For all 1 ≤ j ≤ p and 1 ≤ k ≤ r, we may write |Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Aim |
as
|Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Air | i1
|A . . . Aim |
|Ai1 . . . Air |
and being F simplicial, |Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Air |/|Ai1 . . . Air | ≥ 0 by
Proposition 1. Finally, if k ≥ r + 1, then |Ai1 . . . Aik−1 −Aim+j Aik+1 . . . Aim | = 0,
for all 1 ≤ j ≤ p, since Aim+j is a linear combination of Ai1 , . . . , Air . This leads to
the conclusion that the system may be given the form described in the corollary.
Proof. (Proposition 2) Almost immediate from Property 3. Just a brief note:
when rank(B) = 1, bi2 = αbi1 for some rational α, thus t12 = αt11 and t22 = 0.
By convention, gcd(α, 0) = α.
Proof. (Lemma 1)
When bi1 = bi2 = 0, the value of xsi does not matter, since δxk i = 0, for all
k. When bi1 6= 0 ∨ bi2 6= 0, the sequence {δxk i }k is strictly increasing. Indeed,
from δyk+1 < δyk and δzk+1 > δzk , it follows aδxk+1
= bi1 (−δyk+1 ) + bi2 δzk+1 >
i
k
k
k
L−1
k
bi1 (−δy ) + bi2 δz = aδxi . Hence, δxi ≥ δxi for all k < L. If δxL i = 0 then bi2 = 0,
since δyL = 0 ∧ δzL = zmax . But, then xsi + δxL−1
≥ 0, otherwise y s + δyL−1 < ymin ,
i
which contradicts the hypothesis on s. As a result, ∆k can be added to s + t0 ∆L
only if ∆L−1 can be. Thus, t0 is given as in the Lemma.
Proof. (Proposition 3)
If y s − ymin < δyL−1 , there is no minimal solution following s because δyL−1 is
the minimum positive spacing in y between integral solutions.
If y s − ymin ≥ δyL−1 then there exists k ≥ 0 such that s + ∆L−1 + k∆L
is a positive solution, that is not comparable with s. Thus, s is not the last
minimal solution. Then, let s0 = (x01 , . . . , x0m , y 0 , z 0 ) be the minimal solution
following immediately s, and let (δx1 , . . . , δxm , −δy , δz ) be the spacing applied,
that is (δx1 , . . . , δxm , −δy , δz ) = (x01 , . . . , x0m , y 0 , z 0 ) − (xs1 , . . . , xsm , y s , z s ). Clearly,
we may write (δx1 , . . . , δxm , −δy , δz ) in terms of ∆L = (δxL 1 , . . . , δxL m , 0, zmax ) as
follows
δz
(δx1 , . . . , δxm , −δy , δz ) =
∆L + (δx0 1 , . . . , δx0 m , −δy , δz mod zmax )
zmax
where δx0 i = δxi − bδz /zmax cδxL i . We are going to show that
bδz /zmax c = t0
(16)
(δx0 1 , . . . , δx0 m , −δy , δz mod zmax ) = ∆q + r0 ∆0 .
(17)
and that
Because (δy , δz mod zmax ) is a solution of the equation defining the basic spacings, whose minimal solutions are defined by {(δyk , δzk )}k , there are integers
αk ≥ 0 such that
(δx0 1 , . . . , δx0 m , −δy , δz mod zmax ) =
L−1
X
αk ∆k
(18)
k=0
By definition of t0 , we have t0 6= 0 only if for some p such that bp2 6= 0,
δxk p < 0 holds for all k < L. Hence, from (18) if t0 6= 0 then δx0 p ≤ δxL−1
< 0.
p
Moreover δy ≥ δyL−1 . Then, as (δx0 1 , . . . , δx0 m , −δy , δz mod zmax ) can be added to
s + bδz /zmax c∆L , so does ∆L−1 . This implies that bδz /zmax c ≥ t0 , and thus
bδz /zmax c = t0 . Otherwise, s + t0 ∆L + ∆L−1 is a solution that contradicts the
assumption that s0 immediately follows s.
On the other hand, t0 = 0 implies that at least ∆L−1 can be added to s. If
bδz /zmax c =
6 0 = t0 then s + ∆L−1 is a solution that contradicts s0 immediately
following s for δzL−1 < zmax . Therefore (16) holds.
Now we prove (17) using the fact that (16) holds. From (16) and the definition of q given by Lemma 1 it follows that δz mod zmax = δzq . If not, there
would be a positive solution whose z component, say z 00 , verifies z s < z 00 =
z s + t0 zmax + δzq < z 0 , contradicting the fact that s0 immediately follows s. As a
result, we may write
(δx0 1 , . . . , δx0 m , −δy , δz mod zmax ) = ∆q + (δx0 1 − δxq 1 , . . . , δx0 m − δxq m , −δy + δyq , 0).
Replacing δx0 i by their definition, and as (−δy + δyq , 0) must be of the form
r(−ymax , 0), it is not difficult now to conclude that (17) holds. In fact, it follows
q
q
that δxi = bδz /zmax cδxL i + δxi + rδx0 i = t0 δxL i + δxi + rδx0 i , and r0 was defined so
that the solution s + t0 ∆L + ∆q + r0 ∆0 is nonnegative and as smaller as possible.
Proof. (Corollary 3.1)
When vi ≥ 0, the definition of q can be simplified, since in this case, axi =
bi1 (y s − δyk ) + bi2 (z s + δzk ) + vi ≥ 0, if y s ≥ δyk .
Proof. (Corollary 3.2)
The first statement follows trivially from the definition of t0 . As to the second,
note that if the solutions were computed in y-increasing order the spacings would
just be the symmetrics of the ones we are using now. In that case −∆0 would
have the same role as ∆L is having now, and therefore the second statement is
just a reformulation of the first.
This article was processed using the LATEX macro package with LLNCS style.