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/matrix/basic): dependently-typed block diagonal #7068

Closed
wants to merge 6 commits into from

Conversation

eric-wieser
Copy link
Member

@eric-wieser eric-wieser commented Apr 6, 2021

This allows constructing block diagonal matrices whose blocks are different sizes. A notable example of such a matrix is the one from the Jordan Normal Form.

This duplicates all of the API for block_diagonal from this file. Most of the proofs copy across cleanly, but the proof for block_diagonal_mul' required lots of hand-holding that simp could solve by itself for the non-dependent case.


Open in Gitpod

For reviewers: Should I prove all the non-dependent lemmas by rewriting along block_diagonal'_eq_block_diagonal?

Zulip thread

Comment on lines 1309 to 1324
{ subst h,
convert (fintype.sum_eq_single k (λ i hi, _)).symm,
{ congr' 1,
ext x,
simp, },
simp [dif_neg hi, dif_neg hi.symm], },
{ symmetry,
apply fintype.sum_eq_zero,
intro i,
apply fintype.sum_eq_zero,
intro x,
rcases decidable.em (k = i) with rfl | hki,
{ simp [dif_neg h] },
rcases decidable.em (i = k') with rfl | hik',
{ simp [dif_neg h] },
{ simp [dif_neg hki, dif_neg hik'] } }
Copy link
Member Author

Choose a reason for hiding this comment

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

simp [h] could close this for the non-dependent form :(

@eric-wieser eric-wieser added the awaiting-review The author would like community review of the PR label Apr 6, 2021
@Vierkantor Vierkantor self-requested a review April 7, 2021 07:47
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 d+

src/data/matrix/basic.lean Outdated Show resolved Hide resolved
src/data/matrix/basic.lean Outdated Show resolved Hide resolved
src/data/matrix/basic.lean Outdated Show resolved Hide resolved
src/data/matrix/basic.lean Outdated Show resolved Hide resolved
src/data/matrix/basic.lean Outdated Show resolved Hide resolved
@bors
Copy link

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

@Vierkantor Vierkantor 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 Apr 7, 2021
@eric-wieser
Copy link
Member Author

@Vierkantor, thoughts on writing the unprimed version in terms of the primed one?

@Vierkantor
Copy link
Collaborator

@Vierkantor, thoughts on writing the unprimed version in terms of the primed one?

I don't have a strong opinion: if it saves duplicate lines and the dependentness doesn't leak through the API, then it should be a good idea. Otherwise I don't expect that the two copies really cause too much duplication: the first thing I would do is to define a Σ-indexed from_blocks first, and implementing block_diagonal' in terms of that one.

eric-wieser and others added 3 commits April 7, 2021 09:44
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@eric-wieser
Copy link
Member Author

the first thing I would do is to define a Σ-indexed from_blocks first, and implementing block_diagonal' in terms of that one.

That's a good idea - I'll leave that and my suggestion to merge the non-dependent one for a follow-up.

@eric-wieser
Copy link
Member Author

bors r+

@github-actions github-actions bot added the ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) label Apr 7, 2021
bors bot pushed a commit that referenced this pull request Apr 7, 2021
This allows constructing block diagonal matrices whose blocks are different sizes. A notable example of such a matrix is the one from the Jordan Normal Form.

This duplicates all of the API for `block_diagonal` from this file. Most of the proofs copy across cleanly, but the proof for `block_diagonal_mul'` required lots of hand-holding that `simp` could solve by itself for the non-dependent case.
@bors
Copy link

bors bot commented Apr 7, 2021

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/matrix/basic): dependently-typed block diagonal [Merged by Bors] - feat(data/matrix/basic): dependently-typed block diagonal Apr 7, 2021
@bors bors bot closed this Apr 7, 2021
@bors bors bot deleted the eric-wieser/block-diagonal-sigma branch April 7, 2021 19:04
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

2 participants