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.
Using Classical.choice, lifts a (Prop-valued) Nonempty instance to a (Type-valued)
Inhabited instance. Classical.inhabited_of_nonempty already exists, in
Init/Classical.lean, but the assumption is not a type class argument,
which makes it unsuitable for some applications.
Equations
- Classical.inhabited_of_nonempty' = { default := Classical.choice h }
Instances For
@[reducible, inline]
Using Classical.choice, extracts a term from a Nonempty type.
Equations
- h.some = Classical.choice h
Instances For
@[reducible, inline]
Using Classical.choice, extracts a term from a Nonempty type.
Equations
Instances For
theorem
Function.Surjective.nonempty
{α : Sort u_1}
{β : Sort u_2}
[h : Nonempty β]
{f : α → β}
(hf : Function.Surjective f)
:
Nonempty α