File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed
src/Lean/Meta/Tactic/Grind/Order Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -239,9 +239,14 @@ def assertIneqFalse (c : Cnstr NodeId) (e : Expr) (he : Expr) : OrderM Unit := d
239239 else
240240 ``Grind.Order.lt_of_not_le_k
241241 let h' ← mkLinearOrdRingPrefix declName
242- let k' := -c.k
243- let h := mkApp6 h' (← getExpr c.u) (← getExpr c.v) (toExpr c.k) (toExpr k') eagerReflBoolTrue h
244- addEdge c.v c.u { k := k', strict := c.kind matches .le } h
242+ let mut k' := -c.k
243+ let mut h := mkApp6 h' (← getExpr c.u) (← getExpr c.v) (toExpr c.k) (toExpr k') eagerReflBoolTrue h
244+ let mut strict := c.kind matches .le
245+ if (← isInt) && strict then
246+ h := mkApp6 (mkConst ``Grind.Order.int_lt) (← getExpr c.v) (← getExpr c.u) (toExpr k') (toExpr (k'-1 )) eagerReflBoolTrue h
247+ k' := k' - 1
248+ strict := !strict
249+ addEdge c.v c.u { k := k', strict } h
245250 else if c.kind matches .lt then
246251 let h' ← mkLeLtLinearPrefix ``Grind.Order.le_of_not_lt
247252 let h := mkApp3 h' (← getExpr c.u) (← getExpr c.v) h
Original file line number Diff line number Diff line change @@ -66,4 +66,7 @@ def isLinearPreorder : OrderM Bool :=
6666def hasLt : OrderM Bool :=
6767 return (← getStruct).lawfulOrderLTInst?.isSome
6868
69+ def isInt : OrderM Bool :=
70+ return isSameExpr (← getStruct).type (← getIntExpr)
71+
6972end Lean.Meta.Grind.Order
Original file line number Diff line number Diff line change @@ -15,3 +15,6 @@ example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearPreorder α] [CommRi
1515example [LE α] [LT α] [Std.LawfulOrderLT α] [Std.IsLinearPreorder α] [CommRing α] [OrderedRing α]
1616 (a b c d : α) : a - b ≤ 5 → ¬ (c < b) → ¬ (d ≤ c + 2 ) → d ≤ a - 8 → False := by
1717 grind -linarith (splits := 0 )
18+
19+ example (p : Prop ) (a b c : Int) : (p ↔ b ≤ a) → (p ↔ c ≤ b) → ¬ p → c ≤ a + 1 → False := by
20+ grind -linarith -cutsat (splits := 0 )
You can’t perform that action at this time.
0 commit comments