Documentation

Mathlib.Logic.Nontrivial.Defs

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.

Basic results about nontrivial types are in Mathlib.Logic.Nontrivial.Basic.

class Nontrivial (α : Type u_3) :

Predicate typeclass for expressing that a type is not reduced to a single element. In rings, this is equivalent to 0 ≠ 1. In vector spaces, this is equivalent to positive dimension.

  • exists_pair_ne : ∃ (x : α), ∃ (y : α), x y

    In a nontrivial type, there exists a pair of distinct terms.

Instances
    theorem nontrivial_iff {α : Type u_1} :
    Nontrivial α ∃ (x : α), ∃ (y : α), x y
    theorem exists_pair_ne (α : Type u_3) [Nontrivial α] :
    ∃ (x : α), ∃ (y : α), x y
    theorem Decidable.exists_ne {α : Type u_1} [Nontrivial α] [DecidableEq α] (x : α) :
    ∃ (y : α), y x
    theorem exists_ne {α : Type u_1} [Nontrivial α] (x : α) :
    ∃ (y : α), y x
    theorem nontrivial_of_ne {α : Type u_1} (x y : α) (h : x y) :
    theorem nontrivial_iff_exists_ne {α : Type u_1} (x : α) :
    Nontrivial α ∃ (y : α), y x
    @[instance 500]
    instance Nontrivial.to_nonempty {α : Type u_1} [Nontrivial α] :

    See Note [lower instance priority]

    Note that since this and instNonemptyOfInhabited are the most "obvious" way to find a nonempty instance if no direct instance can be found, we give this a higher priority than the usual 100.

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

    A type is either a subsingleton or nontrivial.

    theorem Function.Surjective.nontrivial {α : Type u_1} {β : Type u_2} [Nontrivial β] {f : αβ} (hf : Function.Surjective f) :

    Pullback a Nontrivial instance along a surjective function.