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]
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
theorem
function.surjective.nonempty
{α : Type u_1}
{β : Type u_2}
[h : nonempty β]
{f : α → β}
(hf : function.surjective f) :
nonempty α