|
| 1 | +module |
| 2 | +set_option warn.sorry false |
| 3 | + |
| 4 | +/-! |
| 5 | +Tests the `liaSteps` threshold that interrupts the cutsat model search. |
| 6 | +
|
| 7 | +The "tight rhombus" example below requires enumerating thousands of cases during |
| 8 | +Cooper conflict resolution. Without the threshold, `grind` used to spend a long time |
| 9 | +searching and then produce a proof term so large that the kernel failed with a |
| 10 | +deep-recursion error. With the default configuration, `grind` must fail quickly. |
| 11 | +-/ |
| 12 | + |
| 13 | +example (x : Int) (y : Int) |
| 14 | + (h0 : ((0 <= ((27300 * x) - (24501 * y))) ∧ (((27300 * x) - (24501 * y)) <= 99) ∧ |
| 15 | + (1 <= ((27301 * x) - (24500 * y))) ∧ (((27301 * x) - (24500 * y)) <= 100))) : False := by |
| 16 | + fail_if_success grind |
| 17 | + sorry |
| 18 | + |
| 19 | +/-! |
| 20 | +Checks that the `liaSteps` configuration option is wired: this example is solvable with |
| 21 | +the default budget, but not with `liaSteps := 1`. |
| 22 | +-/ |
| 23 | + |
| 24 | +example (x y : Int) : |
| 25 | + 27 ≤ 11*x + 13*y → |
| 26 | + 11*x + 13*y ≤ 45 → |
| 27 | + -10 ≤ 7*x - 9*y → |
| 28 | + 7*x - 9*y ≤ 4 → False := by |
| 29 | + fail_if_success grind (liaSteps := 1) |
| 30 | + grind |
| 31 | + |
| 32 | + |
| 33 | +/-- |
| 34 | +error: `grind` failed |
| 35 | +case grind |
| 36 | +x y : Int |
| 37 | +h0 : 0 ≤ 27300 * x - 24501 * y ∧ 27300 * x - 24501 * y ≤ 99 ∧ 1 ≤ 27301 * x - 24500 * y ∧ 27301 * x - 24500 * y ≤ 100 |
| 38 | +⊢ False |
| 39 | +[grind] Goal diagnostics |
| 40 | + [facts] Asserted facts |
| 41 | + [prop] -9100 * x + 8167 * y ≤ 0 ∧ |
| 42 | + 9100 * x + -8167 * y + -33 ≤ 0 ∧ -27301 * x + 24500 * y + 1 ≤ 0 ∧ 27301 * x + -24500 * y + -100 ≤ 0 |
| 43 | + [eqc] True propositions |
| 44 | + [prop] -27301 * x + 24500 * y + 1 ≤ 0 ∧ 27301 * x + -24500 * y + -100 ≤ 0 |
| 45 | + [prop] 9100 * x + -8167 * y + -33 ≤ 0 ∧ -27301 * x + 24500 * y + 1 ≤ 0 ∧ 27301 * x + -24500 * y + -100 ≤ 0 |
| 46 | + [prop] -9100 * x + 8167 * y ≤ 0 ∧ |
| 47 | + 9100 * x + -8167 * y + -33 ≤ 0 ∧ -27301 * x + 24500 * y + 1 ≤ 0 ∧ 27301 * x + -24500 * y + -100 ≤ 0 |
| 48 | + [prop] -27301 * x + 24500 * y + 1 ≤ 0 |
| 49 | + [prop] 9100 * x + -8167 * y + -33 ≤ 0 |
| 50 | + [prop] 27301 * x + -24500 * y + -100 ≤ 0 |
| 51 | + [prop] -9100 * x + 8167 * y ≤ 0 |
| 52 | + [limits] Thresholds reached |
| 53 | + [limit] maximum number of steps performed by the `lia` solver has been reached, threshold: `(liaSteps := 1)` |
| 54 | +-/ |
| 55 | +#guard_msgs in |
| 56 | +example (x : Int) (y : Int) |
| 57 | + (h0 : ((0 <= ((27300 * x) - (24501 * y))) ∧ (((27300 * x) - (24501 * y)) <= 99) ∧ |
| 58 | + (1 <= ((27301 * x) - (24500 * y))) ∧ (((27301 * x) - (24500 * y)) <= 100))) : False := by |
| 59 | + grind (liaSteps := 1) |
0 commit comments