feat: grind_pattern natCast_nonneg (#11574)

This PR adds a lemma that the cast of a natural number into any ordered
ring is non-negative. We can't annotate this directly for `grind`, but
will probably add this to `grind`'s linarith interrnals.
This commit is contained in:
Kim Morrison 2025-12-11 10:10:26 +11:00 committed by GitHub
parent f88e503f3d
commit 124e34ef5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -151,6 +151,9 @@ theorem natCast_le_natCast_of_le (a b : Nat) : a ≤ b → (a : R) ≤ (b : R) :
simp [Semiring.natCast_add, Semiring.natCast_one]
exact OrderedAdd.add_le_left_iff _ |>.mp ih
theorem natCast_nonneg {a : Nat} : 0 ≤ (a : R) := by
simpa [Semiring.natCast_zero] using natCast_le_natCast_of_le (R := R) _ _ (Nat.zero_le a)
theorem natCast_lt_natCast_of_lt (a b : Nat) : a < b → (a : R) < (b : R) := by
induction a generalizing b <;> cases b <;> simp
next n =>