mathlib documentation

logic.​nontrivial

logic.​nontrivial

Nontrivial types

A type is nontrivial if it contains at least two elements. This is useful in particular for rings (where it is equivalent to the fact that zero is different from one) and for vector spaces (where it is equivalent to the fact that the dimension is positive).

We introduce a typeclass nontrivial formalizing this property.

theorem nontrivial_iff {α : Type u_1} :
nontrivial α ∃ (x y : α), x y

theorem exists_pair_ne (α : Type u_1) [nontrivial α] :
∃ (x y : α), x y

theorem exists_ne {α : Type u_1} [nontrivial α] (x : α) :
∃ (y : α), y x

theorem nontrivial_of_ne {α : Type u_1} (x y : α) :
x ynontrivial α

@[instance]
def nontrivial.​to_nonempty {α : Type u_1} [nontrivial α] :

Equations
def nontrivial_psum_unique (α : Type u_1) [inhabited α] :

An inhabited type is either nontrivial, or has a unique element.

Equations
theorem subsingleton_iff {α : Type u_1} :
subsingleton α ∀ (x y : α), x = y

theorem subsingleton_or_nontrivial (α : Type u_1) :

A type is either a subsingleton or nontrivial.

@[instance]
def nontrivial_prod_left {α : Type u_1} {β : Type u_2} [nontrivial α] [nonempty β] :
nontrivial × β)

Equations
@[instance]
def nontrivial_prod_right {α : Type u_1} {β : Type u_2} [nontrivial α] [nonempty β] :
nontrivial × α)

Equations
@[instance]
def option.​nontrivial {α : Type u_1} [nonempty α] :

Equations
@[instance]
def function.​nontrivial {α : Type u_1} {β : Type u_2} [nonempty α] [nontrivial β] :
nontrivial (α → β)

Equations
theorem function.​injective.​nontrivial {α : Type u_1} {β : Type u_2} [nontrivial α] {f : α → β} :

Pushforward a nontrivial instance along an injective function.

theorem function.​surjective.​nontrivial {α : Type u_1} {β : Type u_2} [nontrivial β] {f : α → β} :

Pullback a nontrivial instance along a surjective function.