Nonempty types #
This file proves a few extra facts about nonempty, which is defined in core Lean.
Main declarations #
nonempty.some: Extracts a witness of nonemptiness using choice. Takesnonempty αexplicitly.classical.arbitrary: Extracts a witness of nonemptiness using choice. Takesnonempty αas an instance.
@[simp]
@[simp]
@[simp]
@[simp]
Using classical.choice, lifts a (Prop-valued) nonempty instance to a (Type-valued)
inhabited instance. classical.inhabited_of_nonempty already exists, in
core/init/classical.lean, but the assumption is not a type class argument,
which makes it unsuitable for some applications.
Equations
@[protected, reducible]
Using classical.choice, extracts a term from a nonempty type.
Equations
- h.some = classical.choice h
@[protected]
@[protected]
theorem
nonempty.elim_to_inhabited
{α : Sort u_1}
[h : nonempty α]
{p : Prop}
(f : inhabited α → p) :
p
@[protected, instance]
def
pi.nonempty
{ι : Sort u_1}
{α : ι → Sort u_2}
[∀ (i : ι), nonempty (α i)] :
nonempty (Π (i : ι), α i)
theorem
function.surjective.nonempty
{α : Type u_1}
{β : Type u_2}
[h : nonempty β]
{f : α → β}
(hf : function.surjective f) :
nonempty α