Monotonicity of scalar multiplication by positive elements #
This file defines typeclasses to reason about monotonicity of the operations
b ↦ a • b, "left scalar multiplication"a ↦ a • b, "right scalar multiplication"
We use eight typeclasses to encode the various properties we care about for those two operations. These typeclasses are meant to be mostly internal to this file, to set up each lemma in the appropriate generality.
Less granular typeclasses like IsOrderedAddMonoid and IsOrderedModule should be enough for most
purposes, and the system is set up so that they imply the correct granular typeclasses here.
If those are enough for you, you may stop reading here! Else, beware that what
follows is a bit technical.
Definitions #
In all that follows, α and β are orders which have a 0 and such that α acts on β by scalar
multiplication. Note however that we do not use lawfulness of this action in most of the file. Hence
• should be considered here as a mostly arbitrary function α → β → β.
We use the following four typeclasses to reason about left scalar multiplication (b ↦ a • b):
PosSMulMono: Ifa ≥ 0, thenb₁ ≤ b₂impliesa • b₁ ≤ a • b₂.PosSMulStrictMono: Ifa > 0, thenb₁ < b₂impliesa • b₁ < a • b₂.PosSMulReflectLT: Ifa ≥ 0, thena • b₁ < a • b₂impliesb₁ < b₂.PosSMulReflectLE: Ifa > 0, thena • b₁ ≤ a • b₂impliesb₁ ≤ b₂.
We use the following four typeclasses to reason about right scalar multiplication (a ↦ a • b):
SMulPosMono: Ifb ≥ 0, thena₁ ≤ a₂impliesa₁ • b ≤ a₂ • b.SMulPosStrictMono: Ifb > 0, thena₁ < a₂impliesa₁ • b < a₂ • b.SMulPosReflectLT: Ifb ≥ 0, thena₁ • b < a₂ • bimpliesa₁ < a₂.SMulPosReflectLE: Ifb > 0, thena₁ • b ≤ a₂ • bimpliesa₁ ≤ a₂.
Furthermore, in a module, i.e. a group acted on by a ring, PosSMulMono and SMulPosMono are
equivalent (they are both the same as ∀ r ≥ 0, ∀ m ≥ 0, 0 ≤ r • m),
and similarly for PosSMulStrictMono and SMulPosStrictMono.
To avoid dangerous instances going both, we have the extra two typeclasses:
IsOrderedModule: Conjunction ofPosSMulMonoandSMulPosMonoIsStrictOrderedModule: Conjunction ofPosSMulStrictMonoandSMulPosStrictMono.
Constructors #
The four typeclasses about nonnegativity can usually be checked only on positive inputs due to their
condition becoming trivial when a = 0 or b = 0. We therefore make the following constructors
available: PosSMulMono.of_pos, PosSMulReflectLT.of_pos, SMulPosMono.of_pos,
SMulPosReflectLT.of_pos
Implications #
As α and β get more and more structure, those typeclasses end up being equivalent. The commonly
used implications are:
- When
α,βare partial orders: - When
βis a linear order:PosSMulStrictMono → PosSMulReflectLEPosSMulReflectLT → PosSMulMono(not registered as instance)SMulPosReflectLT → SMulPosMono(not registered as instance)PosSMulReflectLE → PosSMulStrictMono(not registered as instance)SMulPosReflectLE → SMulPosStrictMono(not registered as instance)
- When
αis a linear order: - When
αis an ordered ring,βan ordered group and also anα-module: - When
αis an linear ordered semifield,βis anα-module: - When
αis a semiring,βis anα-module withNoZeroSMulDivisors:PosSMulMono → PosSMulStrictMono(not registered as instance)
- When
αis a ring,βis anα-module withNoZeroSMulDivisors:SMulPosMono → SMulPosStrictMono(not registered as instance)
Further, the bundled non-granular typeclasses imply the granular ones like so:
IsOrderedModule → PosSMulMonoIsOrderedModule → SMulPosMonoIsStrictOrderedModule → PosSMulStrictMonoIsStrictOrderedModule → SMulPosStrictMono
Unless otherwise stated, all these implications are registered as instances, which means that in practice you should not worry about these implications. However, if you encounter a case where you think a statement is true but not covered by the current implications, please bring it up on Zulip!
Implementation notes #
This file uses custom typeclasses instead of abbreviations of CovariantClass/ContravariantClass
because:
- They get displayed as classes in the docs. In particular, one can see their list of instances,
instead of their instances being invariably dumped to the
CovariantClass/ContravariantClasslist. - They don't pollute other typeclass searches. Having many abbreviations of the same typeclass for
different purposes always felt like a performance issue (more instances with the same key, for no
added benefit), and indeed making the classes here abbreviation previous creates timeouts due to
the higher number of
CovariantClass/ContravariantClassinstances. SMulPosReflectLT/SMulPosReflectLEdo not fit in the framework since they relate≤on two different types. So we would have to generaliseCovariantClass/ContravariantClassto three types and two relations.- Very minor, but the constructors let you work with
a : α,h : 0 ≤ ainstead ofa : {a : α // 0 ≤ a}. This actually makes some instances surprisingly cleaner to prove. - The
CovariantClass/ContravariantClassframework is only useful to automate very simple logic anyway. It is easily copied over.
In the future, it would be good to make the corresponding typeclasses in
Mathlib/Algebra/Order/GroupWithZero/Unbundled.lean custom typeclasses too.
Typeclass for monotonicity of scalar multiplication by nonnegative elements on the left,
namely b₁ ≤ b₂ → a • b₁ ≤ a • b₂ if 0 ≤ a.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
smul_le_smul_of_nonneg_leftinstead.
Instances
Typeclass for strict monotonicity of scalar multiplication by positive elements on the left,
namely b₁ < b₂ → a • b₁ < a • b₂ if 0 < a.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
smul_lt_smul_of_pos_leftinstead.
Instances
Typeclass for strict reverse monotonicity of scalar multiplication by nonnegative elements on
the left, namely a • b₁ < a • b₂ → b₁ < b₂ if 0 ≤ a.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
lt_of_smul_lt_smul_leftinstead.
Instances
Typeclass for reverse monotonicity of scalar multiplication by positive elements on the left,
namely a • b₁ ≤ a • b₂ → b₁ ≤ b₂ if 0 < a.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
le_of_smul_le_smul_leftinstead.
Instances
Typeclass for monotonicity of scalar multiplication by nonnegative elements on the left,
namely a₁ ≤ a₂ → a₁ • b ≤ a₂ • b if 0 ≤ b.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
smul_le_smul_of_nonneg_rightinstead.
Instances
Typeclass for strict monotonicity of scalar multiplication by positive elements on the left,
namely a₁ < a₂ → a₁ • b < a₂ • b if 0 < b.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
smul_lt_smul_of_pos_rightinstead.
Instances
Typeclass for strict reverse monotonicity of scalar multiplication by nonnegative elements on
the left, namely a₁ • b < a₂ • b → a₁ < a₂ if 0 ≤ b.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
lt_of_smul_lt_smul_rightinstead.
Instances
Typeclass for reverse monotonicity of scalar multiplication by positive elements on the left,
namely a₁ • b ≤ a₂ • b → a₁ ≤ a₂ if 0 < b.
You should usually not use this very granular typeclass directly, but rather a typeclass like
IsOrderedModule.
Do not use this. Use
le_of_smul_le_smul_rightinstead.
Instances
An ordered module is a module with a partial order such that scalar multiplication by a nonnegative scalar and of a nonnegative vector are both monotone.
Instances
An ordered module is a module with a partial order such that scalar multiplication by a positive scalar and of a positive vector are both strictly monotone.
Instances
Alias of lt_of_smul_lt_smul_left.
Alias of le_of_smul_le_smul_left.
Alias of lt_of_smul_lt_smul_right.
Alias of le_of_smul_le_smul_right.
A constructor for PosSMulMono requiring you to prove b₁ ≤ b₂ → a • b₁ ≤ a • b₂ only when
0 < a
A constructor for PosSMulReflectLT requiring you to prove a • b₁ < a • b₂ → b₁ < b₂ only
when 0 < a
A constructor for SMulPosMono requiring you to prove a₁ ≤ a₂ → a₁ • b ≤ a₂ • b only when
0 < b
A constructor for SMulPosReflectLT requiring you to prove a₁ • b < a₂ • b → a₁ < a₂ only
when 0 < b
Constructor for PosSMulMono when the semimodule is in fact a group.
Constructor for IsOrderedModule when the semimodule is in fact a module.
Right scalar multiplication as an order isomorphism.
Equations
- OrderIso.smulRight ha = { toEquiv := Equiv.smulRight ⋯, map_rel_iff' := ⋯ }
Instances For
Binary rearrangement inequality.
Binary rearrangement inequality.
Binary strict rearrangement inequality.
Binary strict rearrangement inequality.
Alias of the reverse direction of smul_pos_iff_of_neg_left.