Cooper resolution: small solutions to boundedness and divisibility constraints. #
Given a solution x to a divisibility constraint a ∣ b * x + c,
then x % d is another solution as long as (a / gcd a b) | d.
See dvd_emod_add_of_dvd_add for the specialization with b = 1.
Given a solution x to a divisibility constraint a ∣ x + c,
then x % d is another solution as long as a | d.
See dvd_mul_emod_add_of_dvd_mul_add for a more general version allowing a coefficient with x.
There is an integer solution for x to the system
p ≤ a * x
b * x ≤ q
d | c * x + s
(here a, b, d are positive integers, c and s are integers,
and p and q are integers which it may be helpful to think of as evaluations of linear forms),
if and only if there is an integer solution for k to the system
0 ≤ k < lcm a (a * d / gcd (a * d) c)
b * k + b * p ≤ a * q
a | k + p
a * d | c * k + c * p + a * s
Note in the new system that k has explicit lower and upper bounds
(i.e. without a coefficient for k, and in terms of a, c, and d only).
This is a statement of "Cooper resolution" with a divisibility constraint, as formulated in "Cutting to the Chase: Solving Linear Integer Arithmetic" by Dejan Jovanović and Leonardo de Moura, DOI 10.1007/s10817-013-9281-x
See cooper_resolution_left for a simpler version without the divisibility constraint.
This formulation is "biased" towards the lower bound, so it is called "left Cooper resolution".
See cooper_resolution_dvd_right for the version biased towards the upper bound.
When p ≤ a * x, we can realize resolve_left as a natural number.
Equations
- Int.Cooper.resolve_left' a c d p x h₁ = (Int.add_of_le h₁).val % a.lcm (a * d / ↑((a * d).gcd c))
Instances For
resolve_left is nonnegative when p ≤ a * x.
resolve_left is bounded above by lcm a (a * d / gcd (a * d) c).
Equations
- Int.Cooper.resolve_left_inv a p k = (k + p) / a
Instances For
Left Cooper resolution of an upper and lower bound with divisibility constraint.
Right Cooper resolution of an upper and lower bound with divisibility constraint.