lean4-htt/tests/lean/run/lia_order_bug.lean
Kim Morrison c1ad6aa0db
fix: disable order and funCC modules in NoopConfig (#11744)
This PR fixes a bug where `lia` was incorrectly solving goals involving
ordered types like `Rat` that it shouldn't handle. The `lia` tactic is
intended for linear integer arithmetic only.

The fix adds `order := false` and `funCC := false` to `NoopConfig`,
which is the base configuration for `CutsatConfig` (used by `lia`).

Closes
https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/releases.20of.20new.20Lean.20versions/near/564688881

🤖 Prepared with Claude Code

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-13 20:41:12 +00:00

38 lines
1.1 KiB
Text

/-!
# Test that `lia` does not use the order module
The `lia` tactic is for linear integer arithmetic only.
It should not solve rational number inequalities that require the order module.
-/
-- This should fail: lia should not handle rational inequalities
/--
error: `grind` failed
case grind
k : Rat
hk : 2 ≤ k
h : ¬1 ≤ k
⊢ False
[grind] Goal diagnostics
[facts] Asserted facts
[prop] 2 ≤ k
[prop] ¬1 ≤ k
[eqc] True propositions
[prop] 2 ≤ k
[eqc] False propositions
[prop] 1 ≤ k
[limits] Thresholds reached
[limit] maximum number of E-matching rounds has been reached, threshold: `(ematch := 0)`
-/
#guard_msgs in
example (k : Rat) (hk : 2 ≤ k) : 1 ≤ k := by lia
example (k : Rat) (hk : 2 ≤ k) : 1 ≤ k := by lia +order
example (k : Rat) (hk : 2 ≤ k) : 1 ≤ k := by grind_order
-- This should still work: natural number inequalities are handled by lia
example (k : Nat) (hk : 2 ≤ k) : 1 ≤ k := by lia
-- This should still work with explicit -order flag (no change in behavior)
example (k : Nat) (hk : 2 ≤ k) : 1 ≤ k := by lia -order