chore: simplify the connection between HasFresh and Infinite#303
Merged
fmontesi merged 1 commit intoleanprover:mainfrom Jan 30, 2026
Merged
chore: simplify the connection between HasFresh and Infinite#303fmontesi merged 1 commit intoleanprover:mainfrom
HasFresh and Infinite#303fmontesi merged 1 commit intoleanprover:mainfrom
Conversation
ctchou
approved these changes
Jan 30, 2026
| fresh_notMem s := s.finite_toSet.infinite_compl.nonempty.choose_spec | ||
| This, in conjunction with `HasFresh.to_infinite`, characterizes `HasFresh`. -/ | ||
| noncomputable instance HasFresh.of_infinite (α : Type u) [Infinite α] : HasFresh α where | ||
| fresh s := Infinite.exists_notMem_finset s |>.choose |
Contributor
There was a problem hiding this comment.
I really don't know what the preferred style is: should there be a space between |> and .?
Collaborator
Author
There was a problem hiding this comment.
These are semantically different:
|>.chooseis projecting from the pipe (Lean.Parser.Term.pipeProj) and resolves toExists.choose|> .chooseis piping to Lean.Parser.Term.dotIdent, which cannot infer the meaning of.choosein this case becauseClassical.choosealso exists
Contributor
There was a problem hiding this comment.
In this case, I wonder if (Infinite.exists_notMem_finset s).choose is actually clearer.
Collaborator
Author
There was a problem hiding this comment.
I am fairly ambivalent, but I think this is a common enough core syntax to not be considered obfuscatory. I wrote it without thinking, not as a golfing attempt.
fmontesi
approved these changes
Jan 30, 2026
chenson2018
added a commit
that referenced
this pull request
Jan 30, 2026
This PR adds an instance directly showing that `HasFresh` implies `Infinite`. This replaces `HasFresh.not_of_finite` which triggered a linter and is now equivalent to just `not_finite`. `HasFresh.of_infinite` is also changed to an instance with a slightly more direct definition.
arademaker
pushed a commit
to arademaker/cslib
that referenced
this pull request
Feb 2, 2026
…nprover#303) This PR adds an instance directly showing that `HasFresh` implies `Infinite`. This replaces `HasFresh.not_of_finite` which triggered a linter and is now equivalent to just `not_finite`. `HasFresh.of_infinite` is also changed to an instance with a slightly more direct definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an instance directly showing that
HasFreshimpliesInfinite. This replacesHasFresh.not_of_finitewhich triggered a linter and is now equivalent to justnot_finite.HasFresh.of_infiniteis also changed to an instance with a slightly more direct definition.