Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Classical.choice #3871

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Init/Classical.lean
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I stumbled a bit over "returns" here, which sounds very much like computation to me! I don't have a suggestion for a better word off the top of my head, though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

denotes? selects?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chooses? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

represents?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is logically equivalent to an arbitrary such element

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the last two suggestions a lot here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about:

Suggested change
Given that there exists an element satisfying `p`, returns one such element.
Given that there exists an element of ` that satisfies `p`, the result of `choose` is logically equivalent to an
arbitrary such element.

This makes the non-computational nature of it very apparent. We're also out in ultra-nitpick land here :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure "the result of choose is logically equivalent to an arbitrary such element" is a well formed thing to say. I think I know the theorem it's alluding to but this is a really misleading way to say it. I think you might want to get some mathematician eyes on this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to have the slight odor of computation than to write something that's incorrect :) I think that the discussion on this has now exceeded the very minor downsides of the word "returns", and am supportive of a merge as-is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using "logically equivalent" that way is sketchy and doesn't quite make sense for the technical meaning of logical equivalence. I like: "Given that there exists an element of α satisfying p, choose p denotes an otherwise arbitrary such element."


This is a straightforward consequence of, and equivalent to, `Classical.choice`.
Kha marked this conversation as resolved.
Show resolved Hide resolved
-/
noncomputable def choose {α : Sort u} {p : α → Prop} (h : ∃ x, p x) : α :=
(indefiniteDescription p h).val

Expand Down
Loading