Skip to content

vstd/iter: Add spec for Iterator::find#2480

Open
ziqiaozhou wants to merge 3 commits into
mainfrom
iter-find
Open

vstd/iter: Add spec for Iterator::find#2480
ziqiaozhou wants to merge 3 commits into
mainfrom
iter-find

Conversation

@ziqiaozhou
Copy link
Copy Markdown
Collaborator

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

Signed-off-by: Ziqiao Zhou <ziqiaozhou@microsoft.com>
@ziqiaozhou ziqiaozhou marked this pull request as ready for review May 23, 2026 04:52
@ziqiaozhou ziqiaozhou requested a review from parno May 23, 2026 22:09
Copy link
Copy Markdown
Collaborator

@parno parno left a comment

Choose a reason for hiding this comment

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

Thanks this will be quite helpful. Similar to my suggestion on #2479, could you please add a few examples of using this to the test suite? It would be great to have examples that show find returning Some and examples showing it returning None.

Comment thread source/vstd/std_specs/iter.rs Outdated
final(self).obeys_prophetic_iter_laws() ==> (old(self).decrease() is Some <==> final(self).decrease() is Some),
// The final remaining elements are a subsequence of the old remaining.
final(self).obeys_prophetic_iter_laws() ==> {
&&& old(self).remaining().len() >= final(self).remaining().len()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we could omit the comment and simplify this to:

final(self).remaining().is_suffix_of(old(self).remaining())

Comment thread source/vstd/std_specs/iter.rs Outdated
Comment thread source/vstd/std_specs/iter.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants