Compare commits

...

1 Commits

Author SHA1 Message Date
Leonardo de Moura
7a58c45e16 fix: assertNatCast in grind
This PR fixes the bridge between `Nat` and `Int` in `grind cutsat`.

Closes #9467
2025-07-22 14:45:17 -07:00
2 changed files with 10 additions and 0 deletions

View File

@@ -109,6 +109,8 @@ def assertNatCast (e : Expr) (x : Var) : GoalM Unit := do
let_expr instNatCastInt := inst | return ()
if a.isAppOf ``OfNat.ofNat then return () -- we don't want to propagate constraints such as `2 ≥ 0`
if ( get').natDef.contains { expr := a } then return ()
-- Ensure `a` is marked as a `Nat` variable. This can happen when the `natCast` was introduced by the user.
discard <| mkNatVar a
let p := .add (-1) x (.num 0)
let c := { p, h := .ofNatNonneg a : LeCnstr}
c.assert

View File

@@ -0,0 +1,8 @@
example (x y : Nat) : (x : Int) - (y : Int) = 0 x = y := by
grind
example (x y : Nat) : (x : Int) - (y : Int) 0 (x : Int) - (y : Int) 0 x = y := by
grind
example (x y : Nat) : (x : Int) = (y : Int) x = y := by
grind