fix: isPartialOrder in grind order (#10601)

This PR fixes a panic in `grind order` when order is not a partial
order.
This commit is contained in:
Leonardo de Moura 2025-09-27 19:19:29 -07:00 committed by GitHub
parent 6881177e38
commit 8637bd296e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 23 additions and 0 deletions

View file

@ -156,6 +156,7 @@ associated with `(u, v)` IF
/-- Equality propagation. -/
def checkEq (u v : NodeId) (k : Weight) : OrderM Unit := do
if (← isPartialOrder) then
if !k.isZero then return ()
let some k' ← getDist? v u | return ()
if !k'.isZero then return ()

View file

@ -18,3 +18,25 @@ example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearPreorder α] [CommRi
example (p : Prop) (a b c : Int) : (p ↔ b ≤ a) → (p ↔ c ≤ b) → ¬ p → c ≤ a + 1 → False := by
grind -linarith -cutsat (splits := 0)
/--
error: `grind` failed
case grind
α : Type u_1
inst : LE α
inst_1 : Std.IsPreorder α
a b c : α
h : a ≤ b
h_1 : b ≤ c
h_2 : c ≤ a
h_3 : ¬a = c
⊢ False
-/
#guard_msgs in
example [LE α] [Std.IsPreorder α]
(a b c : α) : a ≤ b → b ≤ c → c ≤ a → a = c := by
grind -linarith -verbose
example [LE α] [Std.IsPartialOrder α]
(a b c : α) : a ≤ b → b ≤ c → c ≤ a → a = c := by
grind -linarith -verbose