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: port LinearAlgebra.SesquilinearForm #2607

Closed
wants to merge 15 commits into from

Conversation

ocfnash
Copy link
Contributor

@ocfnash ocfnash commented Mar 3, 2023


Open in Gitpod

@ocfnash ocfnash added WIP Work in progress mathlib-port This is a port of a theory file from mathlib. labels Mar 3, 2023
/-- A set of vectors `v` is orthogonal with respect to some bilinear form `B` if and only
if for all `i ≠ j`, `B (v i) (v j) = 0`. For orthogonality between two elements, use
`bilin_form.is_ortho` -/
def IsOrthoCat (B : M₁ →ₛₗ[I₁] M₁ →ₛₗ[I₁'] R) (v : n → M₁) : Prop :=
Copy link
Contributor Author

@ocfnash ocfnash Mar 3, 2023

Choose a reason for hiding this comment

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

Unfortunately the original Mathlib3 source commits the sin of having two definitions with names distinguished only by case:

  • linear_map.is_ortho
  • linear_map.is_Ortho

It seems Mathport deals with this by naming them LinearMap.IsOrtho and LinearMap.IsOrthoCat respectively. I'm not sure if we should first rename in Mathlib3 or just rename on the fly.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have taken the liberty of simply renaming these on the fly to LinearMap.IsOrtho and LinearMap.IsOrthoᵢ so as to match other things that have binary and indexed versions (like sup and supᵢ or union and unionᵢ).

@ocfnash ocfnash added help-wanted The author needs attention to resolve issues and removed WIP Work in progress labels Mar 4, 2023
@semorrison semorrison added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Mar 13, 2023
@j-loreaux
Copy link
Collaborator

@ocfnash The errors here are definitely caused by lean4#2074 because the file compiles with set_option synthInstance.etaExperiment true. However, I had trouble finding a complete set of workarounds.

  1. The failure to find the AddCommMonoid instance can be fixed by attribute [-instance] Ring.toNonAssocRing (although that caused the proof to fail if I used etaExperiment, so maybe it's not a good approach).
  2. The Module K₁ V₁ instance is a bit tricky, because it can be found as a standalone instance without issue. One solution for this is the _ vs (_) hack. So @Submodule.orthogonalBilin _ _ _ _ _ _ (_) _ _ (K₁ ∙ x) B succeeds.

Unfortunately I have to stop working on this for now though. I didn't push any fixes yet, just wanted to document them here.

ocfnash and others added 14 commits March 21, 2023 16:08
Mathbin -> Mathlib

fix certain import statements

move "by" to end of line

add import to Mathlib.lean
That's is for today
This is horrible. I think it's better to wait and see if we solve these issues
more generally before putting more time into this file.
I still need `set_option synthInstance.etaExperiment true` to get things
to work but hopefully we can solve this next.
With these changes, this will now build provided we add:
`set_option synthInstance.etaExperiment true`
Unfortunately I haven't found a way to avoid using this yet.
@j-loreaux j-loreaux force-pushed the port/LinearAlgebra.SesquilinearForm branch from 8d478b1 to 4811df5 Compare March 21, 2023 21:10
@j-loreaux j-loreaux added awaiting-review The author would like community review of the PR and removed help-wanted The author needs attention to resolve issues merge-conflict The PR has a merge conflict with master, and needs manual merging. labels Mar 21, 2023
Copy link
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

@semorrison semorrison added ready-to-merge This PR has been sent to bors. and removed awaiting-review The author would like community review of the PR labels Mar 22, 2023
bors bot pushed a commit that referenced this pull request Mar 22, 2023
Co-authored-by: Moritz Firsching <firsching@google.com>
Co-authored-by: Jireh Loreaux <loreaujy@gmail.com>
@bors
Copy link

bors bot commented Mar 22, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat: port LinearAlgebra.SesquilinearForm [Merged by Bors] - feat: port LinearAlgebra.SesquilinearForm Mar 22, 2023
@bors bors bot closed this Mar 22, 2023
@bors bors bot deleted the port/LinearAlgebra.SesquilinearForm branch March 22, 2023 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mathlib-port This is a port of a theory file from mathlib. ready-to-merge This PR has been sent to bors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants