Skip to content

Commit db8dc84

Browse files
committed
feat: Monotonicity of multiplication by positive rationals (#15328)
From LeanAPAP
1 parent 99914c5 commit db8dc84

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,7 @@ import Mathlib.Algebra.Order.Module.Algebra
591591
import Mathlib.Algebra.Order.Module.Defs
592592
import Mathlib.Algebra.Order.Module.OrderedSMul
593593
import Mathlib.Algebra.Order.Module.Pointwise
594+
import Mathlib.Algebra.Order.Module.Rat
594595
import Mathlib.Algebra.Order.Module.Synonym
595596
import Mathlib.Algebra.Order.Monoid.Basic
596597
import Mathlib.Algebra.Order.Monoid.Canonical.Defs
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/-
2+
Copyright (c) 2024 Yaël Dillies. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Yaël Dillies
5+
-/
6+
import Mathlib.Algebra.Order.Module.Defs
7+
import Mathlib.Data.Rat.Cast.Order
8+
9+
/-!
10+
# Monotonicity of the action by rational numbers
11+
-/
12+
13+
variable {α : Type*}
14+
15+
section LinearOrderedAddCommGroup
16+
variable [LinearOrderedAddCommGroup α]
17+
18+
@[simp] lemma abs_nnqsmul [DistribMulAction ℚ≥0 α] [PosSMulMono ℚ≥0 α] (q : ℚ≥0) (a : α) :
19+
|q • a| = q • |a| := by
20+
obtain ha | ha := le_total a 0 <;>
21+
simp [*, abs_of_nonneg, abs_of_nonpos, smul_nonneg, smul_nonpos_of_nonneg_of_nonpos]
22+
23+
@[simp] lemma abs_qsmul [Module ℚ α] [PosSMulMono ℚ α] (q : ℚ) (a : α) :
24+
|q • a| = |q| • |a| := by
25+
obtain ha | ha := le_total a 0 <;> obtain hq | hq := le_total q 0 <;>
26+
simp [*, abs_of_nonneg, abs_of_nonpos, smul_nonneg, smul_nonpos_of_nonneg_of_nonpos,
27+
smul_nonpos_of_nonpos_of_nonneg, smul_nonneg_of_nonpos_of_nonpos]
28+
29+
end LinearOrderedAddCommGroup
30+
31+
section LinearOrderedSemifield
32+
variable [LinearOrderedSemifield α]
33+
34+
instance LinearOrderedSemifield.toPosSMulStrictMono_rat : PosSMulStrictMono ℚ≥0 α where
35+
elim q hq a b hab := by
36+
rw [NNRat.smul_def, NNRat.smul_def]; exact mul_lt_mul_of_pos_left hab $ NNRat.cast_pos.2 hq
37+
38+
end LinearOrderedSemifield
39+
40+
section LinearOrderedField
41+
variable [LinearOrderedField α]
42+
43+
instance LinearOrderedField.toPosSMulStrictMono_rat : PosSMulStrictMono ℚ α where
44+
elim q hq a b hab := by
45+
rw [Rat.smul_def, Rat.smul_def]; exact mul_lt_mul_of_pos_left hab $ Rat.cast_pos.2 hq
46+
47+
end LinearOrderedField

0 commit comments

Comments
 (0)