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

[Merged by Bors] - chore(data/seq/seq): use terminates predicate in to_list_or_stream #15826

Closed
wants to merge 3 commits into from

Conversation

vihdzp
Copy link
Collaborator

@vihdzp vihdzp commented Aug 3, 2022

We already have a canonical way to spell out that a sequence terminates, so we don't need to spell it in full.


Open in Gitpod

@vihdzp vihdzp added easy < 20s of review time. See the lifecycle page for guidelines. awaiting-review The author would like community review of the PR awaiting-CI The author would like to see what CI has to say before doing more work. labels Aug 3, 2022
@vihdzp vihdzp requested a review from digama0 August 3, 2022 00:54
@github-actions github-actions bot removed the awaiting-CI The author would like to see what CI has to say before doing more work. label Aug 3, 2022
Comment on lines 451 to +452
this is not constructively possible.) -/
def to_list_or_stream (s : seq α) [decidable (∃ n, ¬ (nth s n).is_some)] :
list α ⊕ stream α :=
if h : ∃ n, ¬ (nth s n).is_some
def to_list_or_stream (s : seq α) [decidable s.terminates] : list α ⊕ stream α :=
Copy link
Member

Choose a reason for hiding this comment

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

It might be worth providing an instance along the lines of

instance [decidable (∃ n, ¬ (nth s n).is_some)] : decidable s.terminates :=

but I guess if nothing uses this function anyway it's may best to leave it until an actual example appears.

Copy link
Collaborator Author

@vihdzp vihdzp Aug 3, 2022

Choose a reason for hiding this comment

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

Yes, this is currently unused.

src/data/seq/seq.lean Outdated Show resolved Hide resolved
Copy link
Member

@eric-wieser eric-wieser left a comment

Choose a reason for hiding this comment

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

bors d+

@bors
Copy link

bors bot commented Aug 3, 2022

✌️ vihdzp can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-bot-assistant leanprover-community-bot-assistant added delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels Aug 3, 2022
vihdzp and others added 2 commits August 3, 2022 07:35
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@vihdzp
Copy link
Collaborator Author

vihdzp commented Aug 3, 2022

bors r+

bors bot pushed a commit that referenced this pull request Aug 3, 2022
#15826)

We already have a canonical way to spell out that a sequence terminates, so we don't need to spell it in full.
@bors
Copy link

bors bot commented Aug 3, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title chore(data/seq/seq): use terminates predicate in to_list_or_stream [Merged by Bors] - chore(data/seq/seq): use terminates predicate in to_list_or_stream Aug 3, 2022
@bors bors bot closed this Aug 3, 2022
@bors bors bot deleted the seq_terminates branch August 3, 2022 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated The PR author may merge after reviewing final suggestions. easy < 20s of review time. See the lifecycle page for guidelines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants