Skip to content

Commit 124e34e

Browse files
authored
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.
1 parent f88e503 commit 124e34e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Init/Grind/Ordered/Ring.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ theorem natCast_le_natCast_of_le (a b : Nat) : a ≤ b → (a : R) ≤ (b : R) :
151151
simp [Semiring.natCast_add, Semiring.natCast_one]
152152
exact OrderedAdd.add_le_left_iff _ |>.mp ih
153153

154+
theorem natCast_nonneg {a : Nat} : 0 ≤ (a : R) := by
155+
simpa [Semiring.natCast_zero] using natCast_le_natCast_of_le (R := R) _ _ (Nat.zero_le a)
156+
154157
theorem natCast_lt_natCast_of_lt (a b : Nat) : a < b → (a : R) < (b : R) := by
155158
induction a generalizing b <;> cases b <;> simp
156159
next n =>

0 commit comments

Comments
 (0)