Nonempty types #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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
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
theorem
function.surjective.nonempty
{α : Sort u_1}
{β : Sort u_2}
[h : nonempty β]
{f : α → β}
(hf : function.surjective f) :
nonempty α