The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V06. Rings, fields and ordered algebra

Mathlib.Algebra.Order.Nonneg.Basic

45 declarations and 1 deprecated aliases. Mathlib docs · Source

abbrev Nonneg E1 #

(α : Type u_2) → [Zero α] → [LE α] → Type (max 0 u_2)

The subtype of nonnegative elements.

TODO: Nonneg could be converted to a one-field or two-field structure, as discussed on Zulip: https://leanprover.zulipchat.com/#narrow/channel/113488-general/topic/backward.2EisDefEq.2ErespectTransparency/near/585745328

instance Nonneg.inhabited E0 #

{α : Type u_1} → [inst : Preorder α] → {a : α} → Inhabited { x // a ≤ x }

instance Nonneg.zero E0 #

{α : Type u_1} → [inst : Zero α] → [inst_1 : Preorder α] → Zero (Nonneg α)

theorem Nonneg.coe_zero E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : Preorder α], ↑0 = 0

theorem Nonneg.mk_eq_zero E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : Preorder α] {x : α} (hx : 0 ≤ x), ⟨x, hx⟩ = 0 ↔ x = 0

instance Nonneg.add E0 #

{α : Type u_1} → [inst : AddZeroClass α] → [inst_1 : Preorder α] → [AddLeftMono α] → Add (Nonneg α)

theorem Nonneg.mk_add_mk E0 #

∀ {α : Type u_1} [inst : AddZeroClass α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] {x y : α} (hx : 0 ≤ x)
  (hy : 0 ≤ y), ⟨x, hx⟩ + ⟨y, hy⟩ = ⟨x + y, ⋯⟩

theorem Nonneg.coe_add E0 #

∀ {α : Type u_1} [inst : AddZeroClass α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] (a b : Nonneg α),
  ↑(a + b) = ↑a + ↑b

instance Nonneg.instIsLeftCancelAdd E0 #

∀ {α : Type u_1} [inst : AddZeroClass α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] [IsLeftCancelAdd α],
  IsLeftCancelAdd (Nonneg α)

instance Nonneg.instIsRightCancelAdd E0 #

∀ {α : Type u_1} [inst : AddZeroClass α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] [IsRightCancelAdd α],
  IsRightCancelAdd (Nonneg α)

instance Nonneg.instIsCancelAdd E0 #

∀ {α : Type u_1} [inst : AddZeroClass α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] [IsCancelAdd α],
  IsCancelAdd (Nonneg α)

instance Nonneg.nsmul E0 #

{α : Type u_1} → [inst : AddMonoid α] → [inst_1 : Preorder α] → [AddLeftMono α] → SMul ℕ (Nonneg α)

theorem Nonneg.nsmul_mk E0 #

∀ {α : Type u_1} [inst : AddMonoid α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] (n : ℕ) {x : α} (hx : 0 ≤ x),
  n • ⟨x, hx⟩ = ⟨n • x, ⋯⟩

theorem Nonneg.coe_nsmul E0 #

∀ {α : Type u_1} [inst : AddMonoid α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] (n : ℕ) (a : Nonneg α),
  ↑(n • a) = n • ↑a

instance Nonneg.one E0 #

{α : Type u_1} → [inst : Zero α] → [inst_1 : One α] → [inst_2 : LE α] → [ZeroLEOneClass α] → One (Nonneg α)

theorem Nonneg.coe_one E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : LE α] [inst_3 : ZeroLEOneClass α], ↑1 = 1

theorem Nonneg.mk_eq_one E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : One α] [inst_2 : LE α] [inst_3 : ZeroLEOneClass α] {x : α} (hx : 0 ≤ x),
  ⟨x, hx⟩ = 1 ↔ x = 1

instance Nonneg.mul E0 #

{α : Type u_1} → [inst : MulZeroClass α] → [inst_1 : Preorder α] → [PosMulMono α] → Mul (Nonneg α)

theorem Nonneg.coe_mul E0 #

∀ {α : Type u_1} [inst : MulZeroClass α] [inst_1 : Preorder α] [inst_2 : PosMulMono α] (a b : Nonneg α),
  ↑(a * b) = ↑a * ↑b

theorem Nonneg.mk_mul_mk E0 #

∀ {α : Type u_1} [inst : MulZeroClass α] [inst_1 : Preorder α] [inst_2 : PosMulMono α] {x y : α} (hx : 0 ≤ x)
  (hy : 0 ≤ y), ⟨x, hx⟩ * ⟨y, hy⟩ = ⟨x * y, ⋯⟩

instance Nonneg.addMonoid E0 #

{α : Type u_1} → [inst : AddMonoid α] → [inst_1 : Preorder α] → [AddLeftMono α] → AddMonoid (Nonneg α)

def Nonneg.coeAddMonoidHom E1 #

{α : Type u_1} → [inst : AddMonoid α] → [inst_1 : Preorder α] → [inst_2 : AddLeftMono α] → Nonneg α →+ α

Coercion Nonneg α → α as an AddMonoidHom.

theorem Nonneg.coeAddMonoidHom_apply E0 #

∀ {α : Type u_1} [inst : AddMonoid α] [inst_1 : Preorder α] [inst_2 : AddLeftMono α] (self : { x // 0 ≤ x }),
  Nonneg.coeAddMonoidHom self = ↑self

instance Nonneg.addCommMonoid E0 #

{α : Type u_1} → [inst : AddCommMonoid α] → [inst_1 : Preorder α] → [AddLeftMono α] → AddCommMonoid (Nonneg α)

instance Nonneg.addCancelCommMonoid E0 #

{α : Type u_1} →
  [inst : AddCancelCommMonoid α] → [inst_1 : Preorder α] → [AddLeftMono α] → AddCancelCommMonoid (Nonneg α)

instance Nonneg.natCast E0 #

{α : Type u_1} →
  [inst : AddMonoidWithOne α] → [inst_1 : PartialOrder α] → [AddLeftMono α] → [ZeroLEOneClass α] → NatCast (Nonneg α)

theorem Nonneg.coe_natCast E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] [inst_1 : PartialOrder α] [inst_2 : AddLeftMono α]
  [inst_3 : ZeroLEOneClass α] (n : ℕ), ↑↑n = ↑n

theorem Nonneg.mk_natCast E0 #

∀ {α : Type u_1} [inst : AddMonoidWithOne α] [inst_1 : PartialOrder α] [inst_2 : AddLeftMono α]
  [inst_3 : ZeroLEOneClass α] (n : ℕ), ⟨↑n, ⋯⟩ = ↑n

instance Nonneg.addMonoidWithOne E0 #

{α : Type u_1} →
  [inst : AddMonoidWithOne α] →
    [inst_1 : PartialOrder α] → [AddLeftMono α] → [ZeroLEOneClass α] → AddMonoidWithOne (Nonneg α)

instance Nonneg.pow E0 #

{α : Type u_1} →
  [inst : MonoidWithZero α] → [inst_1 : Preorder α] → [ZeroLEOneClass α] → [PosMulMono α] → Pow (Nonneg α) ℕ

theorem Nonneg.coe_pow E0 #

∀ {α : Type u_1} [inst : MonoidWithZero α] [inst_1 : Preorder α] [inst_2 : ZeroLEOneClass α] [inst_3 : PosMulMono α]
  (a : Nonneg α) (n : ℕ), ↑(a ^ n) = ↑a ^ n

theorem Nonneg.mk_pow E0 #

∀ {α : Type u_1} [inst : MonoidWithZero α] [inst_1 : Preorder α] [inst_2 : ZeroLEOneClass α] [inst_3 : PosMulMono α]
  {x : α} (hx : 0 ≤ x) (n : ℕ), ⟨x, hx⟩ ^ n = ⟨x ^ n, ⋯⟩

instance Nonneg.semiring E0 #

{α : Type u_1} →
  [inst : Semiring α] →
    [inst_1 : PartialOrder α] → [ZeroLEOneClass α] → [AddLeftMono α] → [PosMulMono α] → Semiring (Nonneg α)

instance Nonneg.monoidWithZero E0 #

{α : Type u_1} →
  [inst : Semiring α] →
    [inst_1 : PartialOrder α] → [ZeroLEOneClass α] → [AddLeftMono α] → [PosMulMono α] → MonoidWithZero (Nonneg α)

def Nonneg.coeRingHom E1 #

{α : Type u_1} →
  [inst : Semiring α] →
    [inst_1 : PartialOrder α] →
      [inst_2 : ZeroLEOneClass α] → [inst_3 : AddLeftMono α] → [inst_4 : PosMulMono α] → Nonneg α →+* α

Coercion Nonneg α → α as a RingHom.

instance Nonneg.commSemiring E0 #

{α : Type u_1} →
  [inst : CommSemiring α] →
    [inst_1 : PartialOrder α] → [ZeroLEOneClass α] → [AddLeftMono α] → [PosMulMono α] → CommSemiring (Nonneg α)

instance Nonneg.commMonoidWithZero E0 #

{α : Type u_1} →
  [inst : CommSemiring α] →
    [inst_1 : PartialOrder α] → [ZeroLEOneClass α] → [AddLeftMono α] → [PosMulMono α] → CommMonoidWithZero (Nonneg α)

def Nonneg.toNonneg E1 #

{α : Type u_1} → [inst : Zero α] → [inst_1 : SemilatticeSup α] → α → Nonneg α

The function a ↦ max a 0 of type α → Nonneg α.

theorem Nonneg.coe_toNonneg E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : SemilatticeSup α] {a : α}, ↑(Nonneg.toNonneg a) = a ⊔ 0

theorem Nonneg.toNonneg_of_nonneg E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : SemilatticeSup α] {a : α} (h : 0 ≤ a), Nonneg.toNonneg a = ⟨a, h⟩

theorem Nonneg.toNonneg_coe E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : SemilatticeSup α] {a : Nonneg α}, Nonneg.toNonneg ↑a = a

theorem Nonneg.toNonneg_le E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : SemilatticeSup α] {a : α} {b : Nonneg α}, Nonneg.toNonneg a ≤ b ↔ a ≤ ↑b

instance Nonneg.sub E0 #

{α : Type u_1} → [inst : Zero α] → [inst_1 : SemilatticeSup α] → [Sub α] → Sub (Nonneg α)

theorem Nonneg.mk_sub_mk E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : SemilatticeSup α] [inst_2 : Sub α] {x y : α} (hx : 0 ≤ x) (hy : 0 ≤ y),
  ⟨x, hx⟩ - ⟨y, hy⟩ = Nonneg.toNonneg (x - y)

theorem Nonneg.toNonneg_lt E0 #

∀ {α : Type u_1} [inst : Zero α] [inst_1 : LinearOrder α] {a : Nonneg α} {b : α}, a < Nonneg.toNonneg b ↔ ↑a < b

Deprecated aliases

NameNew nameSince
Nonneg.nsmul_coeNonneg.coe_nsmul2026-11-16