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

centrosymmetric matrices #2003

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Jun 30, 2024

In this PR we define centrosymmetric matrices which are matrices which are symmetric about their center. Unlike symmetric and skew-symmetric matrices, these form a subring of the ring of matrices.

@Alizter Alizter force-pushed the ps/rr/centrosymmetric_matrices branch from fe208ee to c57fa3c Compare June 30, 2024 14:16
Signed-off-by: Ali Caglayan <[email protected]>
@Alizter Alizter force-pushed the ps/rr/centrosymmetric_matrices branch from c57fa3c to e1feb0b Compare June 30, 2024 14:17
theories/Algebra/Rings/Matrix.v Outdated Show resolved Hide resolved
Comment on lines 1046 to 1047
Definition exchange_matrix_square {R : Ring} {n : nat}
: matrix_mult (exchange_matrix R n) (exchange_matrix R n) = identity_matrix R n.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This also follows from the claim above that (exchange_matrix R n) * M reverses the order of the rows of M. I wonder if this claim is a bit easier to prove?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've factored out that part of the proof, but it is still a little tricky. I might be missing something but I'll have to take another look when I have more time.

Comment on lines 1130 to 1132
Global Instance iscentrosymmetric_rng_op {R : Ring@{i}} {n : nat} (M : Matrix R n n)
`{!IsCentrosymmetric M}
: IsCentrosymmetric (R := rng_op R) M.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is trivial if you know that being centrosymmetric is equivalent to the (i,j) entry being equal to the (n-1-i, n-1-j) entry, since this condition doesn't involve the ring structure at all. And if the claim about how the exchange matrix multiple other matrices is proven, this characterization would be easy. Just a thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This may work out, however I found it quite awkward to write the condition as we need Coq to infer that n - 1 - i < n and I couldn't find a way to do this easily.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't work to define a (possibly Local) instance stating this inequality?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or maybe it helps to write it as n - (i.+1) < n?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I made a couple of minor changes. If i <= pred n can be inferred from i < n with some kind of hint, then with the new style we should be able to simply remove the auto with nat lines. (I also added a comment explaining the set t, which confused me at first.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I figured out how to add hints for i <= pred n and pred n - i < n, which makes some things smoother. I also factored out a different characterization of the entries of the exchange matrix. Maybe with these ideas you can further simplify a few things, e.g. giving the equivalent characterization of centrosymmetric matrices?

Comment on lines +1153 to +1155
Global Instance iscentrosymmetric_matrix_transpose {R : Ring@{i}} {n : nat}
(M : Matrix R n n) {H : IsCentrosymmetric M}
: IsCentrosymmetric (matrix_transpose M).
Copy link
Collaborator

Choose a reason for hiding this comment

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

This might also be easier with the equivalent characterization?

theories/Algebra/Rings/Matrix.v Outdated Show resolved Hide resolved
theories/Algebra/Rings/Matrix.v Outdated Show resolved Hide resolved
Alizter and others added 2 commits July 1, 2024 15:29
Signed-off-by: Ali Caglayan <[email protected]>
@Alizter
Copy link
Collaborator Author

Alizter commented Jul 3, 2024

@jdchristensen I've tried to make progress on this but haven't been able to. I tried to characterize centrosymmetric matrices using the equivalent definition however getting Coq to find pred n - i <= n automatically hasn't been easy. I've tried to use lets to do this, but it complicated the proofs later on. I think I would prefer to keep it this way for now. Have you got any other suggestions for improvement?

@Alizter
Copy link
Collaborator Author

Alizter commented Jul 5, 2024

@jdchristensen Thanks a lot for the improvements. I would like to spend some more time thinking about this and see if I can improve things further. I will have another go at defining centrosymmetric matrices using the alternative characterisation.

@Alizter
Copy link
Collaborator Author

Alizter commented Jul 5, 2024

@jdchristensen I got further than before but I run into issues with showing the identity matrix is centrosymmetric. Overall it seems the index approach might be more general, but it greatly complicates even basic things like this. Would you like to have a look at the WIP commit to see the difficulty I am running into.

@jdchristensen
Copy link
Collaborator

I'm busy for a few days, but I'll try to take a look at this when I'm free.

@Alizter
Copy link
Collaborator Author

Alizter commented Jul 7, 2024

Alright, no rush. This is a relatively low priority PR anyway and should be the last of my matrix backlog. I'm going to be focusing on abelian groups and modules some more.

@jdchristensen
Copy link
Collaborator

Overall it seems the index approach might be more general, but it greatly complicates even basic things like this.

I tried a few more things in the file, and many got easier (including some that were much easier). (See my last commit.) So I definitely think we want to have the index version around.

I got further than before but I run into issues with showing the identity matrix is centrosymmetric.

I don't think that particular goal looks that tricky. But I'm also ok with using the exchange matrix approach when it is more convenient, as in cases like this. So I suggest one of two approaches:

  • Change the definition is IsCentroSymmetric back to the exchange matrix definition. Keep the lemma that says that the index version implies the exchange matrix version, and use that lemma to prove that many things are centrosymmetric using indices. (And we can drop the merely if we go this route.)

  • Keep the definition of IsCentroSymmetric using indices, and add a lemma saying that the exchange matrix definition implies the index definition. Then, we use this new lemma when it makes things easier, like for the identity matrix.

@Alizter Alizter marked this pull request as draft August 31, 2024 19:04
@Alizter
Copy link
Collaborator Author

Alizter commented Aug 31, 2024

I'm converting this to a draft for now as we can come back to it when we have the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants