doc: Classical.choice (#3871)

Co-authored-by: Mario Carneiro <di.gama@gmail.com>
This commit is contained in:
Sebastian Ullrich 2024-04-22 08:36:56 +02:00 committed by GitHub
parent 46f42cc9ba
commit 5e313e98d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,13 @@ namespace Classical
noncomputable def indefiniteDescription {α : Sort u} (p : α → Prop) (h : ∃ x, p x) : {x // p x} :=
choice <| let ⟨x, px⟩ := h; ⟨⟨x, px⟩⟩
/--
Given that there exists an element satisfying `p`, returns one such element.
This is a straightforward consequence of, and equivalent to, `Classical.choice`.
See also `choose_spec`, which asserts that the returned value has property `p`.
-/
noncomputable def choose {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : α :=
(indefiniteDescription p h).val