Skip to content

Conversation

@leodemoura
Copy link
Member

This PR adds support for Nat.cast in grind linarith. It now uses Grind.OrderedRing.natCast_nonneg. Example:

open Lean Grind Std
attribute [instance] Semiring.natCast

variable [Lean.Grind.CommRing R] [LE R] [LT R] [LawfulOrderLT R] [IsLinearOrder R] [OrderedRing R]

example (a : Nat) : 0 ≤ (a : R) := by grind
example (a b : Nat) : 0 ≤ (a : R) + (b : R) := by grind
example (a : Nat) : 02 * (a : R) := by grind
example (a : Nat) : 0 ≥ -3 * (a : R) := by grind

This PR adds support for `Nat.cast` in `grind linarith`.
It now uses `Grind.OrderedRing.natCast_nonneg`. Example:
```lean
open Lean Grind Std
attribute [instance] Semiring.natCast

variable [Lean.Grind.CommRing R] [LE R] [LT R] [LawfulOrderLT R] [IsLinearOrder R] [OrderedRing R]

example (a : Nat) : 0 ≤ (a : R) := by grind
example (a b : Nat) : 0 ≤ (a : R) + (b : R) := by grind
example (a : Nat) : 0 ≤ 2 * (a : R) := by grind
example (a : Nat) : 0 ≥ -3 * (a : R) := by grind
```
@leodemoura leodemoura added the changelog-tactics User facing tactics label Dec 14, 2025
@leodemoura leodemoura enabled auto-merge December 14, 2025 08:51
@leodemoura leodemoura added this pull request to the merge queue Dec 14, 2025
Merged via the queue into master with commit 799c6b5 Dec 14, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants