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] - feat(data/list/lemmas): Range of foldr #13328

Closed
wants to merge 11 commits into from

Conversation

vihdzp
Copy link
Collaborator

@vihdzp vihdzp commented Apr 11, 2022

Mathlib4 pair: leanprover-community/mathlib4#1870


These lemmas may seem super specific, but trust me, I do make use of them.

I don't believe there's a foldl analog to these lemmas, but I might be wrong.

Open in Gitpod

@vihdzp vihdzp added the awaiting-review The author would like community review of the PR label Apr 11, 2022
@@ -2229,6 +2229,22 @@ begin
apply hl _ (list.mem_cons_self _ _) }
end

lemma foldr_range_subset_of_range_subset {f : α → γ → γ} {g : β → γ → γ}
(hfg : set.range f ⊆ set.range g) (a) : set.range (foldr f a) ⊆ set.range (foldr g a) :=
Copy link
Member

Choose a reason for hiding this comment

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

Is it the case that set.range (foldr f a) = ↑(submonoid.closure (range f) : submonoid (function.End γ))?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can't get this statement to typecheck in Lean. But yes, set.range (foldr f a) is the union of g a for every g in the monoid generated by the indexed family f.

Should I prove this?

Copy link
Member

Choose a reason for hiding this comment

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

It probably makes the dependencies difficult, so fine to do another time (if ever). It might be useful for your actual use-case though.

@YaelDillies
Copy link
Collaborator

There is definitely a foldl version in virtue of list.foldl_reverse, but I'm not sure it's interesting.

Copy link
Collaborator

@Vierkantor Vierkantor left a comment

Choose a reason for hiding this comment

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

Could you address Eric's suggestions?

@Vierkantor Vierkantor added awaiting-author A reviewer has asked the author a question or requested changes and removed awaiting-review The author would like community review of the PR labels May 6, 2022
@eric-wieser
Copy link
Member

bors d+

@bors
Copy link

bors bot commented Nov 17, 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.

@github-actions github-actions bot added the delegated The PR author may merge after reviewing final suggestions. label Nov 17, 2022
@vihdzp
Copy link
Collaborator Author

vihdzp commented Jan 26, 2023

bors r+

bors bot pushed a commit that referenced this pull request Jan 26, 2023


Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@bors
Copy link

bors bot commented Jan 26, 2023

Build failed:

@YaelDillies YaelDillies added the modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR. label Jan 26, 2023
@YaelDillies
Copy link
Collaborator

This has been ported in the meantime. Could you open a matching mathlib4 PR?

@vihdzp vihdzp changed the title feat(data/list/basic): Range of foldr feat(data/list/lemmas): Range of foldr Jan 26, 2023
@vihdzp
Copy link
Collaborator Author

vihdzp commented Jan 26, 2023

This has been moved to the lemmas file, as have other lemmas formerly in data/list/basic that involved set.range. The PR is unchanged otherwise.

bors r+

bors bot pushed a commit that referenced this pull request Jan 26, 2023
Mathlib4 pair: leanprover-community/mathlib4#1870



Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@bors
Copy link

bors bot commented Jan 27, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/list/lemmas): Range of foldr [Merged by Bors] - feat(data/list/lemmas): Range of foldr Jan 27, 2023
@bors bors bot closed this Jan 27, 2023
@bors bors bot deleted the foldr_range branch January 27, 2023 01:10
bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Mar 17, 2023
Mathlib3 pair: leanprover-community/mathlib#13328



Co-authored-by: Jon Eugster <eugster.jon@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-author A reviewer has asked the author a question or requested changes delegated The PR author may merge after reviewing final suggestions. modifies-synchronized-file This PR touches a files that has already been ported to mathlib4, and may need a synchronization PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants