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(analysis/inner_product_space/adjoint): matrix and linear map adjoints agree #11551

Closed
wants to merge 2 commits into from

Conversation

hrmacbeth
Copy link
Member


Open in Gitpod

@hrmacbeth hrmacbeth added the awaiting-review The author would like community review of the PR label Jan 19, 2022
Comment on lines 303 to 308
/-- The adjoint of the linear map associated to a matrix is the linear map associated to the
conjugate transpose of that matrix. -/
lemma conj_transpose_eq_adjoint (A : matrix m n 𝕜) :
(id (to_lin' A.conj_transpose) : euclidean_space 𝕜 m →ₗ[𝕜] euclidean_space 𝕜 n) =
linear_map.adjoint (id (to_lin' A) : euclidean_space 𝕜 n →ₗ[𝕜] euclidean_space 𝕜 m) :=
begin
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment explaining why the id is needed here? Is this a pattern used anywhere else?

I think this is equivalent but the motivation is slightly clearer:

Suggested change
/-- The adjoint of the linear map associated to a matrix is the linear map associated to the
conjugate transpose of that matrix. -/
lemma conj_transpose_eq_adjoint (A : matrix m n 𝕜) :
(id (to_lin' A.conj_transpose) : euclidean_space 𝕜 m →ₗ[𝕜] euclidean_space 𝕜 n) =
linear_map.adjoint (id (to_lin' A) : euclidean_space 𝕜 n →ₗ[𝕜] euclidean_space 𝕜 m) :=
begin
/-- The adjoint of the linear map associated to a matrix is the linear map associated to the
conjugate transpose of that matrix. -/
lemma conj_transpose_eq_adjoint (A : matrix m n 𝕜) :
(show euclidean_space 𝕜 m →ₗ[𝕜] euclidean_space 𝕜 n, from to_lin' A.conj_transpose) =
linear_map.adjoint (show euclidean_space 𝕜 n →ₗ[𝕜] euclidean_space 𝕜 m, from to_lin' A) :=
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 had thought the id was a fairly common pattern for forcing something to be interpreted as a defeq but not syntactically equal type ... perhaps not.

I'm not really a fan of the show idiom, I think it suggests a proof to the casual user where no such proof exists. But I've replaced it with a third option, where linear_map.adjoint has some of its implicit arguments filled in explicitly.

Copy link
Member

Choose a reason for hiding this comment

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

I had thought the id was a fairly common pattern for forcing something to be interpreted as a defeq but not syntactically equal type ... perhaps not.

I'd argue that show is better, as it's more of a flag in the goal view that something weird is going on with the types. id just makes it look like you've managed to simplify something away.

I think it suggests a proof to the casual user where no such proof exists

If you read show as "the next statement will have this type" then there's no mention of proofs specifically, but I can see how a casual user might be confused.

But I've replaced it with a third option, where linear_map.adjoint has some of its implicit arguments filled in explicitly.

I think this new version is probably worse, as it doesn't work well with rw - both id and show ought to be better in this regard. Note also that your original version had different implicit arguments to the eq too.

Probably the cleanest thing to do would be add a variant of matrix.to_lin for euclidean_space, as:

/-- `matrix.to_lin'`, with the domain and codomain living in `euclidean_space` -/
def to_lin'_euclid (A : matrix m n 𝕜) : euclidean_space 𝕜 n →ₗ[𝕜] euclidean_space 𝕜 m :=
A.to_lin'

/-- The adjoint of the linear map associated to a matrix is the linear map associated to the
conjugate transpose of that matrix. -/
lemma conj_transpose_eq_adjoint (A : matrix m n 𝕜) :
  (A.conj_transpose.to_lin'_euclid) = (linear_map.adjoint A.to_lin'_euclid) :=
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'm afraid I don't like this! We would have to duplicate all the API of to_lin', and this seems really unfortunate.

Shall we discuss on Zulip?

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps we could go so far as to demote our current metric_space_pi instance to a def, allowing for a locale in which pi_Lp 2 is the default instance.

Copy link
Member

Choose a reason for hiding this comment

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

I went ahead with this in #18574, since we already have an ad-hoc implementation of to_lin'_euclid inside another lemma statement.

Copy link
Collaborator

@dupuisf dupuisf 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!

One thought (not necessarily for this PR): what do you think about creating a typeclass has_standard_basis ι 𝕜 E to express the fact that a space E has a standard basis indexed by ι? Having to specify the type constantly as is done here doesn't seem sustainable.

@hrmacbeth
Copy link
Member Author

Hmm, I'm not sure. I almost never work with bases, though, so maybe I'm not the best qualified to have an opinion!

@jcommelin
Copy link
Member

Thanks 🎉

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 Jan 25, 2022
bors bot pushed a commit that referenced this pull request Jan 25, 2022
@bors
Copy link

bors bot commented Jan 25, 2022

Build failed (retrying...):

bors bot pushed a commit that referenced this pull request Jan 25, 2022
@bors
Copy link

bors bot commented Jan 25, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat(analysis/inner_product_space/adjoint): matrix and linear map adjoints agree [Merged by Bors] - feat(analysis/inner_product_space/adjoint): matrix and linear map adjoints agree Jan 25, 2022
@bors bors bot closed this Jan 25, 2022
@bors bors bot deleted the adjoint_matrix_linear_map branch January 25, 2022 22:24
ericrbg pushed a commit that referenced this pull request Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

None yet

4 participants