blob: 6ff9074d7665cc8b3a64e8b5fcb80a41d99a7124 [file]
/-!
Regression test for issue #13572: `lia` produced a kernel type mismatch in `eq_def` proofs
when internalizing an integer expression whose syntactic structure differs from the structure
of its polynomial representation (e.g., a trailing `+ 0` that `Poly.denote'` collapses).
The third example needs `+mbtc`: its contradiction requires propagating the cutsat
equality `x5 + 1 = x6` to the core so that congruence closure can merge the nonlinear
monomials `x1 * (x5 + 1)` and `x1 * x6`. `lia` does not enable model-based theory
combination by default. The final copy without `+mbtc` shows that `lia` now fails
cleanly instead of producing the kernel error.
-/
-- MWE for lia regression generated by the new canonicalizer
example (n : Nat) (i : Fin (n + 1 + 1)) (_h : n + 1 + 1 ≤ ↑i + ↑i + 1) :
↑i + ↑i + 1 - (n + 1 + 1) < n + 1 + 1 := by
lia
-- Issue #13572: trailing `+ 0` caused `eq_def` proof to fail with kernel type mismatch
example : ∀ (x1 x2 x3 : Int), x3 = x1 * x2 → x2 > 0 → ¬(x1 + 0) * x2 = x1 * x2 → False := by
lia
example : ∀ (x1 x2 x3 x4 x5 x6 x7 : Int),
(0 ≤ 2 → True → 0 ≤ x2) →
(0 < 2 → 0 ≤ x7 → 0 < x2) →
0 < x3 ∧ x6 = x3 ∨ x3 ≤ 0 ∧ x6 = 0 →
0 ≤ x5 →
x6 ≤ x5 + 1 + 0 →
x1 * (x5 + 1 + 0) > x2 →
x5 + 1 = x6 →
(x1 = 0 → x4 = x2) →
(x1 = 0 → x3 = 0) →
(0 < x1 → 0 ≤ x4 ∧ x4 < x1) →
(¬x1 = 0 → x2 = x1 * x3 + x4) → x1 < x2 → 0 ≤ x1 → x1 < x2 → 0 ≤ x1 → ¬False → False := by
lia +mbtc
/--
error: `lia` has failed, use `+verbose` to obtain diagnostic information
-/
#guard_msgs in
example : ∀ (x1 x2 x3 x4 x5 x6 x7 : Int),
(0 ≤ 2 → True → 0 ≤ x2) →
(0 < 2 → 0 ≤ x7 → 0 < x2) →
0 < x3 ∧ x6 = x3 ∨ x3 ≤ 0 ∧ x6 = 0 →
0 ≤ x5 →
x6 ≤ x5 + 1 + 0 →
x1 * (x5 + 1 + 0) > x2 →
x5 + 1 = x6 →
(x1 = 0 → x4 = x2) →
(x1 = 0 → x3 = 0) →
(0 < x1 → 0 ≤ x4 ∧ x4 < x1) →
(¬x1 = 0 → x2 = x1 * x3 + x4) → x1 < x2 → 0 ≤ x1 → x1 < x2 → 0 ≤ x1 → ¬False → False := by
lia -verbose