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/set_like): remove repeated boilerplate from subobjects #6768

Closed
wants to merge 80 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Mar 19, 2021

This just scratches the surface, and removes all of the boilerplate that is just a consequence of the injective map to a set.
Already this trims more than 150 lines.

For every lemma of the form set_like.* added in this PR, the corresponding submonoid.*, add_submonoid.*, sub_mul_action.*, submodule.*, subsemiring.*, subring.*, subfield.*, subalgebra.*, and intermediate_field.* lemmas have been removed.
Often these lemmas only existed for one or two of these subtypes, so this means that we have lemmas for more things not fewer.

Note that while the ext_iff, ext', and ext'_iff lemmas have been removed, we still need the ext lemma as set_like.ext cannot directly be tagged @[ext].


Open in Gitpod

@eric-wieser eric-wieser added the WIP Work in progress label Mar 19, 2021
@Vierkantor
Copy link
Collaborator

I think this is a very good idea! One note, in category theory terms, coe here is exactly the forgetful functor subobject -> subset. It might make sense to give it as an order preserving map subobject -> subset rather than "just" a function. (But you define the order in terms of coe, so that might be too confusing.)

Did you already consider how this would integrate with subobjects that use galois_insertion to define their lattice structure? E.g. intermediate_field.complete_lattice? This should give a complete lattice structure for free on everything with a "free subobject".

@eric-wieser
Copy link
Member Author

But you define the order in terms of coe, so that might be too confusing.

The duplication I'm trying to eliminate always picks an order that matches coe; I think exposing an order-embedding as part of the API is sensible, but I don't think it should be part of the construction of the structure

Did you already consider how this would integrate with subobjects that use galois_insertion to define their lattice structure? E.g. intermediate_field.complete_lattice? This should give a complete lattice structure for free on everything with a "free subobject".

I was thinking about this, yes; but I figured I'd try and keep the scope of this PR somewhat constrained for now. I think my intent with this PR is to just propagate the lemma removals and see if typeclass resolution gets stuck anywhere. There's almost certainly a more powerful generalization to be made, but that will be much easier to build on top of the weak generalization with half the lemmas already deduplicated.

@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Mar 19, 2021
@eric-wieser eric-wieser force-pushed the eric-wieser/has_injective_coe_set branch from 1c66c71 to 5ff2867 Compare March 28, 2021 10:29
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label Mar 28, 2021
@eric-wieser
Copy link
Member Author

I had a quick go with affine_subspace, but the whole API seems to be centered around expressions of the form a ∈ ↑b instead of a ∈ b, so I think it makes sense to try and fix that separately.

@eric-wieser
Copy link
Member Author

I fear this will go stale quite quickly, as PRs seem to appear that use the mem_coe lemmas all the time.

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.

Thanks! 🎉

bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Mar 29, 2021
bors bot pushed a commit that referenced this pull request Mar 29, 2021
This just scratches the surface, and removes all of the boilerplate that is just a consequence of the injective map to a `set`.
Already this trims more than 150 lines.

For every lemma of the form `set_like.*` added in this PR, the corresponding `submonoid.*`, `add_submonoid.*`, `sub_mul_action.*`, `submodule.*`, `subsemiring.*`, `subring.*`, `subfield.*`, `subalgebra.*`, and `intermediate_field.*` lemmas have been removed.
Often these lemmas only existed for one or two of these subtypes, so this means that we have lemmas for more things not fewer.

Note that while the `ext_iff`, `ext'`, and `ext'_iff` lemmas have been removed, we still need the `ext` lemma as `set_like.ext` cannot directly be tagged `@[ext]`.
@bors
Copy link

bors bot commented Mar 29, 2021

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Mar 29, 2021
This just scratches the surface, and removes all of the boilerplate that is just a consequence of the injective map to a `set`.
Already this trims more than 150 lines.

For every lemma of the form `set_like.*` added in this PR, the corresponding `submonoid.*`, `add_submonoid.*`, `sub_mul_action.*`, `submodule.*`, `subsemiring.*`, `subring.*`, `subfield.*`, `subalgebra.*`, and `intermediate_field.*` lemmas have been removed.
Often these lemmas only existed for one or two of these subtypes, so this means that we have lemmas for more things not fewer.

Note that while the `ext_iff`, `ext'`, and `ext'_iff` lemmas have been removed, we still need the `ext` lemma as `set_like.ext` cannot directly be tagged `@[ext]`.
@bors
Copy link

bors bot commented Mar 29, 2021

Build failed:

@bryangingechen bryangingechen added awaiting-author A reviewer has asked the author a question or requested changes delegated The PR author may merge after reviewing final suggestions. and removed ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) labels Mar 29, 2021
@Vierkantor
Copy link
Collaborator

Let's try it again:

bors merge
bors d+

@bors
Copy link

bors bot commented Mar 30, 2021

✌️ eric-wieser 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 ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-author A reviewer has asked the author a question or requested changes labels Mar 30, 2021
bors bot pushed a commit that referenced this pull request Mar 30, 2021
This just scratches the surface, and removes all of the boilerplate that is just a consequence of the injective map to a `set`.
Already this trims more than 150 lines.

For every lemma of the form `set_like.*` added in this PR, the corresponding `submonoid.*`, `add_submonoid.*`, `sub_mul_action.*`, `submodule.*`, `subsemiring.*`, `subring.*`, `subfield.*`, `subalgebra.*`, and `intermediate_field.*` lemmas have been removed.
Often these lemmas only existed for one or two of these subtypes, so this means that we have lemmas for more things not fewer.

Note that while the `ext_iff`, `ext'`, and `ext'_iff` lemmas have been removed, we still need the `ext` lemma as `set_like.ext` cannot directly be tagged `@[ext]`.
@bors
Copy link

bors bot commented Mar 30, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/set_like): remove repeated boilerplate from subobjects [Merged by Bors] - feat(data/set_like): remove repeated boilerplate from subobjects Mar 30, 2021
@bors bors bot closed this Mar 30, 2021
@bors bors bot deleted the eric-wieser/has_injective_coe_set branch March 30, 2021 17:12
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
This just scratches the surface, and removes all of the boilerplate that is just a consequence of the injective map to a `set`.
Already this trims more than 150 lines.

For every lemma of the form `set_like.*` added in this PR, the corresponding `submonoid.*`, `add_submonoid.*`, `sub_mul_action.*`, `submodule.*`, `subsemiring.*`, `subring.*`, `subfield.*`, `subalgebra.*`, and `intermediate_field.*` lemmas have been removed.
Often these lemmas only existed for one or two of these subtypes, so this means that we have lemmas for more things not fewer.

Note that while the `ext_iff`, `ext'`, and `ext'_iff` lemmas have been removed, we still need the `ext` lemma as `set_like.ext` cannot directly be tagged `@[ext]`.
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. ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants