|
19 | 19 | public interface IntegerFormulaManager
|
20 | 20 | extends NumeralFormulaManager<IntegerFormula, IntegerFormula> {
|
21 | 21 |
|
22 |
| - /** Create a term representing the constraint {@code number1 == number2 (mod n)}. */ |
| 22 | + /** |
| 23 | + * Create a term representing the constraint {@code number1 == number2 (mod n)}. Note: this is not |
| 24 | + * formally defined by the SMTLib standard, but supported by many solvers. Please consult the |
| 25 | + * documentation of the used solver for details. |
| 26 | + */ |
23 | 27 | BooleanFormula modularCongruence(IntegerFormula number1, IntegerFormula number2, BigInteger n);
|
24 | 28 |
|
25 |
| - /** Create a term representing the constraint {@code number1 == number2 (mod n)}. */ |
| 29 | + /** |
| 30 | + * Create a term representing the constraint {@code number1 == number2 (mod n)}. Note: this is not |
| 31 | + * formally defined by the SMTLib standard, but supported by many solvers. Please consult the |
| 32 | + * documentation of the used solver for details. |
| 33 | + */ |
26 | 34 | BooleanFormula modularCongruence(IntegerFormula number1, IntegerFormula number2, long n);
|
27 | 35 |
|
28 | 36 | /**
|
29 | 37 | * Create a formula representing the modulo of two operands according to Boute's Euclidean
|
30 |
| - * definition. The quotient (div numerator denominator) of the internal modulo calculation is |
31 |
| - * floored for positive denominators and rounded up for negative denominators. |
| 38 | + * definition (DOI: 10.1145/128861.128862). The quotient (division of numerator by denominator) of |
| 39 | + * the modulo calculation (numerator - quotient * denominator = remainder, with remainder being |
| 40 | + * the result of this operation) is floored for positive denominators and rounded up for negative |
| 41 | + * denominators. |
32 | 42 | *
|
33 | 43 | * <p>If the denominator evaluates to zero (modulo-by-zero), either directly as value or
|
34 | 44 | * indirectly via an additional constraint, then the solver is allowed to choose an arbitrary
|
35 |
| - * value for the result of the modulo operation (cf. SMTLIB standard for the division operator in |
36 |
| - * Ints or Reals theory). |
| 45 | + * value for the result of the modulo operation (cf. SMTLib standard version 2.6 for the division |
| 46 | + * operator in Int or Real theory). The details of this are implementation specific and may change |
| 47 | + * solver by solver. |
37 | 48 | *
|
38 | 49 | * <p>Examples:
|
39 | 50 | *
|
40 | 51 | * <ul>
|
41 |
| - * <li>10 % 5 == 0 |
42 |
| - * <li>10 % 3 == 1 |
43 |
| - * <li>10 % (-3) == 1 |
44 |
| - * <li>-10 % 5 == 0 |
45 |
| - * <li>-10 % 3 == 2 |
46 |
| - * <li>-10 % (-3) == 2 |
| 52 | + * <li>modulo(10, 5) == 0 |
| 53 | + * <li>modulo(10, 3) == 1 |
| 54 | + * <li>modulo(10, -3) == 1 |
| 55 | + * <li>modulo(-10, 5) == 0 |
| 56 | + * <li>modulo(-10, 3) == 2 |
| 57 | + * <li>modulo(-10, -3) == 2 |
47 | 58 | * </ul>
|
48 | 59 | *
|
49 | 60 | * <p>Note: Some solvers, e.g., Yices2, abort with an exception when exploring a modulo-by-zero
|
|
0 commit comments