refactor: move Classical.choice and Nonempty to Prelude

This commit is contained in:
Leonardo de Moura 2022-01-14 13:06:27 -08:00
parent 9ab5f0376e
commit 83b69bc340
3 changed files with 11 additions and 11 deletions

View file

@ -13,8 +13,6 @@ universe u v
namespace Classical
axiom choice {α : Sort u} : Nonempty αα
noncomputable def indefiniteDescription {α : Sort u} (p : α → Prop) (h : ∃ x, p x) : {x // p x} :=
choice <| let ⟨x, px⟩ := h; ⟨⟨x, px⟩⟩

View file

@ -460,15 +460,6 @@ instance : Inhabited Prop where
deriving instance Inhabited for NonScalar, PNonScalar, True, ForInStep
class inductive Nonempty (α : Sort u) : Prop where
| intro (val : α) : Nonempty α
protected def Nonempty.elim {α : Sort u} {p : Prop} (h₁ : Nonempty α) (h₂ : α → p) : p :=
h₂ h₁.1
instance {α : Sort u} [Inhabited α] : Nonempty α :=
⟨arbitrary⟩
theorem nonempty_of_exists {α : Sort u} {p : α → Prop} : Exists (fun x => p x) → Nonempty α
| ⟨w, h⟩ => ⟨w⟩

View file

@ -196,6 +196,17 @@ theorem ne_true_of_eq_false : {b : Bool} → Eq b false → Not (Eq b true)
class Inhabited (α : Sort u) where
mk {} :: (default : α)
class inductive Nonempty (α : Sort u) : Prop where
| intro (val : α) : Nonempty α
axiom Classical.choice {α : Sort u} : Nonempty αα
protected def Nonempty.elim {α : Sort u} {p : Prop} (h₁ : Nonempty α) (h₂ : α → p) : p :=
h₂ h₁.1
instance {α : Sort u} [Inhabited α] : Nonempty α :=
⟨Inhabited.default⟩
constant arbitrary [Inhabited α] : α :=
Inhabited.default