The algorithm used in the Arith tactic cannot solve general sets of linear inequalities over the integers, though such problems are abundant (for example when doing array bounds checking). Solving linear inequalities over the integers is a strictly harder problem than over the rationals: polynomial time algorithms are known for the solving linear inequalities over the rationals, but integer linear programming is NP complete .
The SupInf tactic is uses the Sup-Inf method of Bledsoe [1] for solving integer inequalities. While method is only complete for the rationals, not the integers, it does work well in practice for the integers. Todd Wilson [6] has written a reference version of SupInf.
The basic algorithm considers a conjunction of inequalities
where the
are linear
expressions over the rationals in variables
and
determines whether or not there exists an assignment of values to the
that satisfies the conjunction. The algorithm works by
determining upper and lower bounds for each of the variables in turn
--- hence the name `sup-inf'. The bound calculations are always
conservative, so that if some upper bound is strictly below some lower
bound, then the conjunction is unsatisfiable.
Shostak [5] showed that the calculated bounds are the best possible, and hence that the algorithm is complete for the rationals. He proposed a simple modification that made the algorithm return an explicit satisfying assignment when the conjunction is satisfiable.
When used over the integers, the Sup-Inf algorithm is sound, but not complete; if there is no satisfying assignment over the rationals, then there is also none over the integers. However, there are cases when the algorithm finds a rational-valued satisfying assignment even though none exists that is integer valued. There are standard techniques for restoring completeness, but it has been both Shostak's and our experiences to date that examples for which the algorithm is incomplete are rare in practice.
The procedure implemented currently does the following:
![]()
where the
are all instances of the
relations
over the integers
involving expressions over the integer variables
,
then
has form
![]()
The inference of arithmetic properties from typing and from property lemmas greatly increases the procedure's usefulness.
Unlike most other tactics, but like the arith rule which
SupInf largely supercedes, SupInf's inferences are not refined down to primitive rule level, so Nuprl's soundness now depends on the soundness of a core part of SupInf's implementation.