The type of nonnegative elements #
This file defines instances and prove some properties about the nonnegative elements
{x : α // 0 ≤ x}
of an arbitrary type α
.
Currently we only state instances and states some simp
/norm_cast
lemmas.
When α
is ℝ
, this will give us some properties about ℝ≥0
.
Main declarations #
{x : α // 0 ≤ x}
is aCanonicallyLinearOrderedAddCommMonoid
ifα
is aLinearOrderedRing
.
Implementation Notes #
Instead of {x : α // 0 ≤ x}
we could also use Set.Ici (0 : α)
, which is definitionally equal.
However, using the explicit subtype has a big advantage: when writing an element explicitly
with a proof of nonnegativity as ⟨x, hx⟩
, the hx
is expected to have type 0 ≤ x
. If we would
use Ici 0
, then the type is expected to be x ∈ Ici 0
. Although these types are definitionally
equal, this often confuses the elaborator. Similar problems arise when doing cases on an element.
The disadvantage is that we have to duplicate some instances about Set.Ici
to this subtype.
This instance uses data fields from Subtype.partialOrder
to help type-class inference.
The Set.Ici
data fields are definitionally equal, but that requires unfolding semireducible
definitions, so type-class inference won't see this.
Equations
- Nonneg.orderBot = let __src := Set.Ici.orderBot; OrderBot.mk ⋯
Equations
- ⋯ = ⋯
Equations
- Nonneg.semilatticeSup = Set.Ici.semilatticeSup
Equations
- Nonneg.semilatticeInf = Set.Ici.semilatticeInf
Equations
- Nonneg.distribLattice = Set.Ici.distribLattice
Equations
- ⋯ = ⋯
If sSup ∅ ≤ a
then {x : α // a ≤ x}
is a ConditionallyCompleteLinearOrder
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If sSup ∅ ≤ a
then {x : α // a ≤ x}
is a ConditionallyCompleteLinearOrderBot
.
This instance uses data fields from Subtype.linearOrder
to help type-class inference.
The Set.Ici
data fields are definitionally equal, but that requires unfolding semireducible
definitions, so type-class inference won't see this.
Equations
- Nonneg.conditionallyCompleteLinearOrderBot a = let __src := Nonneg.orderBot; let __src_1 := Nonneg.conditionallyCompleteLinearOrder; ConditionallyCompleteLinearOrderBot.mk ⋯ ⋯
Instances For
Equations
- Nonneg.orderedAddCommMonoid = Function.Injective.orderedAddCommMonoid (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.linearOrderedAddCommMonoid = Function.Injective.linearOrderedAddCommMonoid (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.orderedCancelAddCommMonoid = Function.Injective.orderedCancelAddCommMonoid (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.linearOrderedCancelAddCommMonoid = Function.Injective.linearOrderedCancelAddCommMonoid (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Coercion {x : α // 0 ≤ x} → α
as an AddMonoidHom
.
Equations
- Nonneg.coeAddMonoidHom = { toZeroHom := { toFun := Subtype.val, map_zero' := ⋯ }, map_add' := ⋯ }
Instances For
Equations
- Nonneg.one = { one := { val := 1, property := ⋯ } }
Equations
- Nonneg.addMonoidWithOne = let __src := Nonneg.one; let __src_1 := Nonneg.orderedAddCommMonoid; AddMonoidWithOne.mk ⋯ ⋯
Equations
- Nonneg.orderedSemiring = Function.Injective.orderedSemiring (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.strictOrderedSemiring = Function.Injective.strictOrderedSemiring (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.orderedCommSemiring = Function.Injective.orderedCommSemiring (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.strictOrderedCommSemiring = Function.Injective.strictOrderedCommSemiring (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.monoidWithZero = inferInstance
Equations
- Nonneg.commMonoidWithZero = inferInstance
Equations
- Nonneg.semiring = inferInstance
Equations
- Nonneg.commSemiring = inferInstance
Equations
- ⋯ = ⋯
Equations
- Nonneg.linearOrderedSemiring = Function.Injective.linearOrderedSemiring (fun (a : { x : α // 0 ≤ x }) => ↑a) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- Nonneg.linearOrderedCommMonoidWithZero = let __src := Nonneg.linearOrderedSemiring; let __src_1 := Nonneg.orderedCommSemiring; LinearOrderedCommMonoidWithZero.mk ⋯ ⋯ ⋯
Equations
- Nonneg.canonicallyOrderedAddCommMonoid = let __src := Nonneg.orderedAddCommMonoid; let __src_1 := Nonneg.orderBot; CanonicallyOrderedAddCommMonoid.mk ⋯ ⋯
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
The function a ↦ max a 0
of type α → {x : α // 0 ≤ x}
.
Equations
- Nonneg.toNonneg a = { val := max a 0, property := ⋯ }
Instances For
Equations
- Nonneg.sub = { sub := fun (x y : { x : α // 0 ≤ x }) => Nonneg.toNonneg (↑x - ↑y) }
Equations
- ⋯ = ⋯