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(linear_algebra/basis) remove several [nontrivial R] #7642

Closed
wants to merge 6 commits into from

Conversation

riccardobrasca
Copy link
Member

We remove some unnecessary nontrivial R.


Open in Gitpod

@riccardobrasca riccardobrasca added the awaiting-review The author would like community review of the PR label May 17, 2021
def reindex_range [nontrivial R] : basis (range b) R M :=
b.reindex (equiv.of_injective b b.injective)
def reindex_range : basis (range b) R M :=
begin
Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure it is OK to use tactic mode in a def.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I'm not sure this is a good idea. It would be nice if we can avoid by_cases in this definition.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let me see if there is a better proof.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine. The lemmas below show that you can still reason about the value of this definition. You could also use or.by_cases in term mode, but you will probably end up with the same / a similar term.

Copy link
Member

Choose a reason for hiding this comment

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

Personally, I would prefer if for definitions:

if h : nontrivial R then
  by exactI
  ...
else
  by haveI : subsingleton R := ...; exact
  ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the if! I have the impression we have to reason by cases, in a way or another: the two proofs are really different. Indeed if R is trivial this is true just because anything is a basis (and the rank is not well defined!).

b.reindex_range ⟨b i, h⟩ = b i :=
by rw [reindex_range, reindex_apply, equiv.apply_of_injective_symm b b.injective, subtype.coe_mk]
begin
by_cases htr : nontrivial R,
Copy link
Collaborator

Choose a reason for hiding this comment

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

You might be able to use the nontriviality tactic to automatically do the not-nontrivial case for you.

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.

Looks good to me otherwise, thank you!

bors d+

@bors
Copy link

bors bot commented May 17, 2021

✌️ riccardobrasca 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 delegated The PR author may merge after reviewing final suggestions. and removed awaiting-review The author would like community review of the PR labels May 17, 2021
riccardobrasca and others added 3 commits May 17, 2021 22:08
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@riccardobrasca
Copy link
Member Author

bors r+

@fpvandoorn
Copy link
Member

bors r-

This has a merge conflict with #7634, and bors has randomly chosen to try #7634 first.

@bors
Copy link

bors bot commented May 18, 2021

Canceled.

@github-actions github-actions bot added the merge-conflict Please `git merge origin/master` then a bot will remove this label. label May 18, 2021
@github-actions github-actions bot removed the merge-conflict Please `git merge origin/master` then a bot will remove this label. label May 18, 2021
@riccardobrasca
Copy link
Member Author

bors r+

bors bot pushed a commit that referenced this pull request May 18, 2021
We remove some unnecessary `nontrivial R`.
@bors
Copy link

bors bot commented May 19, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(linear_algebra/basis) remove several [nontrivial R] [Merged by Bors] - feat(linear_algebra/basis) remove several [nontrivial R] May 19, 2021
@bors bors bot closed this May 19, 2021
@bors bors bot deleted the trivial_ring_basis branch May 19, 2021 01:16
Vierkantor pushed a commit that referenced this pull request May 19, 2021
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants