Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit a2810d9

Browse files
committed
feat(data/int/basic): coercion subtraction inequality (#10054)
Adding to simp a subtraction inequality over coercion from int to nat Co-authored-by: cocohearts <41932135+cocohearts@users.noreply.github.com>
1 parent 35d574e commit a2810d9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/data/int/basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ not_congr coe_nat_eq_zero
140140

141141
@[simp] lemma coe_nat_nonneg (n : ℕ) : 0 ≤ (n : ℤ) := coe_nat_le.2 (nat.zero_le _)
142142

143+
lemma le_coe_nat_sub (m n : ℕ) :
144+
(m - n : ℤ) ≤ ↑(m - n : ℕ) :=
145+
begin
146+
by_cases h: m ≥ n,
147+
{ exact le_of_eq (int.coe_nat_sub h).symm },
148+
{ simp [le_of_not_ge h] }
149+
end
150+
143151
lemma coe_nat_ne_zero_iff_pos {n : ℕ} : (n : ℤ) ≠ 00 < n :=
144152
⟨λ h, nat.pos_of_ne_zero (coe_nat_ne_zero.1 h),
145153
λ h, (ne_of_lt (coe_nat_lt.2 h)).symm⟩

0 commit comments

Comments
 (0)