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] - refactor(algebra/algebra/basic): change submodule.restrict_scalars to use is_scalar_tower #6745

Closed
wants to merge 2 commits into from

Conversation

eric-wieser
Copy link
Member


Open in Gitpod

I'm not 100% certain that this actually weakens the requirements in a meaningful way; but it definitely allows both R and S to be non-commutative, which previously they were not.

@eric-wieser eric-wieser force-pushed the eric-wieser/submodule.restrict_scalars' branch from c1122fe to 51c2e1b Compare March 17, 2021 23:39
@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Mar 18, 2021
@@ -1449,54 +1449,72 @@ restrict_scalars.is_scalar_tower R A V

end type_synonym

/-! TODO: The following lemmas no longer involve `algebra` at all, and could be moved elsewhere. -/
Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree with the TODO: could you put them in algebra/module/submodule.lean? (It looks like there is no import needed to make the definitions work there.)

Copy link
Member Author

Choose a reason for hiding this comment

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

ker and range don't exist yet in that file, as they're defined in linear_algebra/basic.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's annoying. I guess they can stay here, with a TODO to move them once ker and range are moved somewhere else in the hierarcjy.

variables (R A M N : Type*) [comm_semiring R] [semiring A] [algebra R A]
variables [add_comm_monoid M] [semimodule R M] [semimodule A M] [is_scalar_tower R A M]
variables [add_comm_monoid N] [semimodule R N] [semimodule A N] [is_scalar_tower R A N]
variables (S R M N : Type*) [semiring S] [semiring R] [has_scalar S R]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is mildly irritating that there is a has_scalar S R instance here, where usually we assume has_scalar R S (or algebra R S), see e.g. monoid_algebra.lean, linear_algebra/matrix.lean, algebra/tower.lean, finsupp.smul_comm_class, ...

If we're going to move the definitions anyway, it will blow away the history anyway, so there is no need to preserve the previous variable names.

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking here was to have the "main" submodule continue to be a submodule R M, rather than switching to submodule S M here.

I can use R' instead of S if that's less objectionable?

Copy link
Member Author

Choose a reason for hiding this comment

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

it will blow away the history anyway

My intent in modifying these in place was to not blow away history and change type-class paths in the same PR; just in case this breaks someone and they end up having to bisect.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My thinking here was to have the "main" submodule continue to be a submodule R M, rather than switching to submodule S M here.

I have to admit I don't see why this is important, but has_scalar R' R is fine to me as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My intent in modifying these in place was to not blow away history and change type-class paths in the same PR; just in case this breaks someone and they end up having to bisect.

When I find the PR that breaks my code in bisection, I look at the discussion on github. So as long as the change happens in multiple commits in the PR, I can figure out what happened. But I see how this can be annoying to do.

How about this: change the TODO: move this comment to something like TODO: move this to a suitable file once linear_map.keris split fromlinear_algebra/basic.lean`, so that we can tell in the future if we can do the move yet.

@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 Mar 18, 2021
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-author A reviewer has asked the author a question or requested changes labels Mar 18, 2021
bors bot pushed a commit that referenced this pull request Mar 18, 2021
@bors
Copy link

bors bot commented Mar 18, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(algebra/algebra/basic): change submodule.restrict_scalars to use is_scalar_tower [Merged by Bors] - refactor(algebra/algebra/basic): change submodule.restrict_scalars to use is_scalar_tower Mar 18, 2021
@bors bors bot closed this Mar 18, 2021
@bors bors bot deleted the eric-wieser/submodule.restrict_scalars' branch March 18, 2021 19:27
b-mehta pushed a commit that referenced this pull request Apr 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants