Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

[Merged by Bors] - feat(data/matrix): matrix and vector notation#2656

Closed
Vierkantor wants to merge 5 commits intomasterfrom
matrix_notation
Closed

[Merged by Bors] - feat(data/matrix): matrix and vector notation#2656
Vierkantor wants to merge 5 commits intomasterfrom
matrix_notation

Conversation

@Vierkantor
Copy link
Copy Markdown
Collaborator

@Vierkantor Vierkantor commented May 11, 2020

This PR adds notation for matrices and vectors as discussed on Zulip a couple of months ago, so that ![![a, b], ![c, d]] constructs a 2x2 matrix with rows ![a, b] : fin 2 -> α and ![c, d]. It also adds corresponding simp lemmas for all matrix operations defined in data.matrix.basic. These lemmas should apply only when the input already contains ![...].

To express the simp lemmas nicely, I defined a function dot_product : (v w : n -> α) -> α which returns the sum of the entrywise product of two vectors. IMO, this makes the definitions of matrix.mul, matrix.mul_vec and matrix.vec_mul clearer, and it allows us to share some proofs. I could also inline dot_product (restoring the old situation) if the reviewers prefer.

@Vierkantor Vierkantor added the awaiting-review The author would like community review of the PR label May 11, 2020
@gebner
Copy link
Copy Markdown
Member

gebner commented May 11, 2020

Why is there still boilerplate in the PR description? I thought that we've removed it already? In any case, please remove the part after and including "Make sure you have" as this would be included in the commit message.

@Vierkantor
Copy link
Copy Markdown
Collaborator Author

Why is there still boilerplate in the PR description? I thought that we've removed it already? In any case, please remove the part after and including "Make sure you have" as this would be included in the commit message.

Ah, my bad! I thought GitHub was having issues (the interactive buttons didn't work), so I copied the old template manually.

Copy link
Copy Markdown
Member

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

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

Nice work! Thanks 🎉

Looks pretty good to me.

Co-authored-by: Johan Commelin <johan@commelin.net>
@jcommelin
Copy link
Copy Markdown
Member

bors merge

@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 May 12, 2020
bors bot pushed a commit that referenced this pull request May 12, 2020
This PR adds notation for matrices and vectors [as discussed on Zulip a couple of months ago](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20matrices.20and.20vectors), so that `![![a, b], ![c, d]]` constructs a 2x2 matrix with rows `![a, b] : fin 2 -> α` and `![c, d]`. It also adds corresponding `simp` lemmas for all matrix operations defined in `data.matrix.basic`. These lemmas should apply only when the input already contains `![...]`.

To express the `simp` lemmas nicely, I defined a function `dot_product : (v w : n -> α) -> α` which returns the sum of the entrywise product of two vectors. IMO, this makes the definitions of `matrix.mul`, `matrix.mul_vec` and `matrix.vec_mul` clearer, and it allows us to share some proofs. I could also inline `dot_product` (restoring the old situation) if the reviewers prefer.

Co-authored-by: Vierkantor <Vierkantor@users.noreply.github.com>
Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
@bors
Copy link
Copy Markdown

bors bot commented May 12, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(data/matrix): matrix and vector notation [Merged by Bors] - feat(data/matrix): matrix and vector notation May 12, 2020
@bors bors bot closed this May 12, 2020
@bors bors bot deleted the matrix_notation branch May 12, 2020 18:35
@bryangingechen
Copy link
Copy Markdown
Collaborator

It's too late for this PR, but it looks like something goes wrong in the data/matrix/all.lean file generated by scripts/mk_all.sh: https://github.com/leanprover-community/mathlib/pull/2656/checks?check_run_id=666886653#step:14:12

@gebner
Copy link
Copy Markdown
Member

gebner commented May 12, 2020

What could possibly go wrong if you name a file notation? 🤷

butterthebuddha pushed a commit to butterthebuddha/mathlib that referenced this pull request May 15, 2020
)

This PR adds notation for matrices and vectors [as discussed on Zulip a couple of months ago](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20matrices.20and.20vectors), so that `![![a, b], ![c, d]]` constructs a 2x2 matrix with rows `![a, b] : fin 2 -> α` and `![c, d]`. It also adds corresponding `simp` lemmas for all matrix operations defined in `data.matrix.basic`. These lemmas should apply only when the input already contains `![...]`.

To express the `simp` lemmas nicely, I defined a function `dot_product : (v w : n -> α) -> α` which returns the sum of the entrywise product of two vectors. IMO, this makes the definitions of `matrix.mul`, `matrix.mul_vec` and `matrix.vec_mul` clearer, and it allows us to share some proofs. I could also inline `dot_product` (restoring the old situation) if the reviewers prefer.

Co-authored-by: Vierkantor <Vierkantor@users.noreply.github.com>
Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
butterthebuddha pushed a commit to butterthebuddha/mathlib that referenced this pull request May 16, 2020
)

This PR adds notation for matrices and vectors [as discussed on Zulip a couple of months ago](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20matrices.20and.20vectors), so that `![![a, b], ![c, d]]` constructs a 2x2 matrix with rows `![a, b] : fin 2 -> α` and `![c, d]`. It also adds corresponding `simp` lemmas for all matrix operations defined in `data.matrix.basic`. These lemmas should apply only when the input already contains `![...]`.

To express the `simp` lemmas nicely, I defined a function `dot_product : (v w : n -> α) -> α` which returns the sum of the entrywise product of two vectors. IMO, this makes the definitions of `matrix.mul`, `matrix.mul_vec` and `matrix.vec_mul` clearer, and it allows us to share some proofs. I could also inline `dot_product` (restoring the old situation) if the reviewers prefer.

Co-authored-by: Vierkantor <Vierkantor@users.noreply.github.com>
Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
cipher1024 pushed a commit to cipher1024/mathlib that referenced this pull request Mar 15, 2022
)

This PR adds notation for matrices and vectors [as discussed on Zulip a couple of months ago](https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Notation.20for.20matrices.20and.20vectors), so that `![![a, b], ![c, d]]` constructs a 2x2 matrix with rows `![a, b] : fin 2 -> α` and `![c, d]`. It also adds corresponding `simp` lemmas for all matrix operations defined in `data.matrix.basic`. These lemmas should apply only when the input already contains `![...]`.

To express the `simp` lemmas nicely, I defined a function `dot_product : (v w : n -> α) -> α` which returns the sum of the entrywise product of two vectors. IMO, this makes the definitions of `matrix.mul`, `matrix.mul_vec` and `matrix.vec_mul` clearer, and it allows us to share some proofs. I could also inline `dot_product` (restoring the old situation) if the reviewers prefer.

Co-authored-by: Vierkantor <Vierkantor@users.noreply.github.com>
Co-authored-by: Rob Lewis <Rob.y.lewis@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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.

5 participants