Skip to content

[Merged by Bors] - refactor(LinearAlgebra/Matrix/BilinearForm): Derive BilinearForm results from SesquilinearForm#9485

Closed
mans0954 wants to merge 23 commits intomasterfrom
mans0954/matrix-bilin-refactor
Closed

[Merged by Bors] - refactor(LinearAlgebra/Matrix/BilinearForm): Derive BilinearForm results from SesquilinearForm#9485
mans0954 wants to merge 23 commits intomasterfrom
mans0954/matrix-bilin-refactor

Conversation

@mans0954
Copy link
Copy Markdown
Collaborator

@mans0954 mans0954 commented Jan 6, 2024

Give definitions in LinearAlgebra/Matrix/BilinearForm in terms of the equivalent definitions in LinearAlgebra/Matrix/SesquilinearForm and derive the BilinearForm results as effectively special cases of the equivalent results in SesquilinearForm. This reduces the length of LinearAlgebra/Matrix/BilinearForm by over 100 lines.

The aim is to:

  • Clarify how results in BilinearForm relate to results in SesquilinearForm
  • Reduce duplication of argument between the two files
  • Validate that the results in SesquilinearForm are sufficiently general to provide the results in BilinearForm in their existing form - in fact, some loosening of the hypothesis in SesquilinearForm is required. Further loosening was already applied in [Merged by Bors] - refactor(LinearAlgebra) : Remove unused commutativity hypothesis #9475

This PR partially superceeds #8256

Open in Gitpod

@mans0954 mans0954 added the WIP Work in progress label Jan 6, 2024
@mans0954 mans0954 force-pushed the mans0954/matrix-bilin-refactor branch from 5725d00 to a652e30 Compare January 6, 2024 21:45
@mans0954 mans0954 marked this pull request as ready for review January 6, 2024 22:00
@mans0954 mans0954 added awaiting-review and removed WIP Work in progress labels Jan 6, 2024
@mans0954
Copy link
Copy Markdown
Collaborator Author

mans0954 commented Jan 6, 2024

!bench

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit a652e30.
There were significant changes against commit 87ffb36:

  Benchmark                                        Metric         Change
  ======================================================================
- ~Mathlib.LinearAlgebra.Matrix.BilinearForm       instructions    22.9%
+ ~Mathlib.LinearAlgebra.Matrix.SesquilinearForm   instructions    -9.5%

@jcommelin
Copy link
Copy Markdown
Member

The diff looks really good!

But these benchmark results are a bit surprising... @mattrobball do you have a clue what's going on?

@mattrobball
Copy link
Copy Markdown
Contributor

Were there timeouts in this area of the library? Why all the (R₂ := R₂)? Lean is spending too much time turning BilinForm.toLin and LinearMap.toBilin into functions.

@mattrobball
Copy link
Copy Markdown
Contributor

Performance is fixed by @Vierkantor with leanprover-community/mathlib@Vierkantor/unbundled-FunLike-testings

Actually greatly improved :)

Copy link
Copy Markdown
Contributor

@mattrobball mattrobball left a comment

Choose a reason for hiding this comment

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

I think merging in advance of the pending FunLike refactor is a good plan.

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.

Thanks 🎉

bors merge

@ghost ghost added ready-to-merge This PR has been sent to bors. and removed awaiting-review labels Jan 8, 2024
mathlib-bors bot pushed a commit that referenced this pull request Jan 8, 2024
…lts from SesquilinearForm (#9485)

Give definitions in `LinearAlgebra/Matrix/BilinearForm` in terms of the equivalent definitions in `LinearAlgebra/Matrix/SesquilinearForm` and derive the `BilinearForm` results as effectively special cases of the equivalent results in `SesquilinearForm`. This reduces the length of  `LinearAlgebra/Matrix/BilinearForm` by over 100 lines.

The aim is to:

* Clarify how results in `BilinearForm` relate to results in `SesquilinearForm`
* Reduce duplication of argument between the two files
* Validate that the results in `SesquilinearForm` are sufficiently general to provide the results in `BilinearForm` in their existing form - in fact, some loosening of the hypothesis in `SesquilinearForm` is required. Further loosening was already applied in #9475



Co-authored-by: Christopher Hoskin <[email protected]>
Co-authored-by: Christopher Hoskin <[email protected]>
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Jan 8, 2024

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title refactor(LinearAlgebra/Matrix/BilinearForm): Derive BilinearForm results from SesquilinearForm [Merged by Bors] - refactor(LinearAlgebra/Matrix/BilinearForm): Derive BilinearForm results from SesquilinearForm Jan 8, 2024
@mathlib-bors mathlib-bors bot closed this Jan 8, 2024
@mathlib-bors mathlib-bors bot deleted the mans0954/matrix-bilin-refactor branch January 8, 2024 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants