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

Commit f95c01e

Browse files
urkudmergify[bot]
authored andcommitted
feat(algebra/ordered_*): add three simple lemmas (#1731)
1 parent f86abc7 commit f95c01e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/algebra/ordered_field.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,8 @@ end
242242
lemma div_nonneg' {a b : α} (ha : 0 ≤ a) (hb : 0 ≤ b) : 0 ≤ a / b :=
243243
(lt_or_eq_of_le hb).elim (div_nonneg ha) (λ h, by simp [h.symm])
244244

245+
lemma div_le_div_of_le_of_nonneg {a b c : α} (hab : a ≤ b) (hc : 0 ≤ c) :
246+
a / c ≤ b / c :=
247+
mul_le_mul_of_nonneg_right hab (inv_nonneg.2 hc)
248+
245249
end

src/algebra/ordered_ring.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ mul_pos ha hb
1919
section linear_ordered_semiring
2020
variable [linear_ordered_semiring α]
2121

22+
/-- `0 < 2`: an alternative version of `two_pos` that only assumes `linear_ordered_semiring`. -/
23+
lemma zero_lt_two : (0:α) < 2 :=
24+
by { rw [← zero_add (0:α), bit0], exact add_lt_add zero_lt_one zero_lt_one }
25+
2226
@[simp] lemma mul_le_mul_left {a b c : α} (h : 0 < c) : c * a ≤ c * b ↔ a ≤ b :=
2327
⟨λ h', le_of_mul_le_mul_left h' h, λ h', mul_le_mul_of_nonneg_left h' (le_of_lt h)⟩
2428

@@ -157,6 +161,10 @@ decidable.le_iff_le_iff_lt_iff_lt.2 $ mul_lt_mul_right h
157161

158162
end decidable_linear_ordered_semiring
159163

164+
-- The proof doesn't need commutativity but we have no `decidable_linear_ordered_ring`
165+
@[simp] lemma abs_two [decidable_linear_ordered_comm_ring α] : abs (2:α) = 2 :=
166+
abs_of_pos $ by refine zero_lt_two
167+
160168
@[priority 100] -- see Note [lower instance priority]
161169
instance linear_ordered_semiring.to_no_top_order {α : Type*} [linear_ordered_semiring α] :
162170
no_top_order α :=

0 commit comments

Comments
 (0)