Skip to content

refactor: Rising and lowering indices with notation#1348

Open
jstoobysmith wants to merge 8 commits into
leanprover-community:masterfrom
jstoobysmith:ElabRiseLower
Open

refactor: Rising and lowering indices with notation#1348
jstoobysmith wants to merge 8 commits into
leanprover-community:masterfrom
jstoobysmith:ElabRiseLower

Conversation

@jstoobysmith

Copy link
Copy Markdown
Member

Define toDualAtIndex which rises or lowers a given index of a tensor.
Use the elaborator to enable the notation u | α τ(β) for e.g. rising the second index.
Add some test cases, and some explicit examples.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for this PR, which will now be reviewed. If submitting to ./Physlib or ./QuantumInfo, please see our review guidelines if you are not familiar with the process. You should expect a back and forth with a reviewer before your PR is merged. See also that link for how to add appropriate labels to your PR. The PR will also go through a number of automated checks. You can learn more about these here, including how to run them locally.

If you are submitting to ./PhyslibAlpha there will be a lighter review process, though your PR must still pass the automated checks.

If you want to bring attention to this PR, please write a message on this thread of the Lean Zulip.

Important: If a reviewer adds an awaiting-author label to your PR, once you have addressed the review comments, please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

@nateabr nateabr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The changes look great to me, only one minor change would help.

Comment thread Physlib/Relativity/Tensors/Reindexing.lean
jstoobysmith and others added 2 commits July 2, 2026 08:14
Co-authored-by: nateabr <135662056+nateabr@users.noreply.github.com>
@jstoobysmith

Copy link
Copy Markdown
Member Author

Many thanks for reviewing @nateabr! I've incorporated your suggestion. I also made some structural changes to the Elab.lean file to make things hopefully more manifest. Would you mind taking another look?

@nateabr nateabr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This refactor overall is fantastic!

I learned alot about Lean metaprogramming just working this refactor and the new TensorExpressionOperator type.

I had a small question regarding the refactor that I've placed as a comment.

throwError "Unsupported tensor expression syntax in getIndicesRightEq: {stx}"

/-!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the index signature logic is being ported through TensorExpressionOperator, are the index tree scanning functions above still required?

From my understanding this was required with the previous design, so maybe the above could be deleted?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Awesome! Yep they can be removed - done :).

@nateabr

nateabr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

awaiting-author

@github-actions github-actions Bot added the awaiting-author A reviewer has asked the author a question or requested changes label Jul 2, 2026
@nateabr

nateabr commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

t-relativity

@github-actions github-actions Bot added the t-relativity Relativity label Jul 2, 2026
@jstoobysmith

Copy link
Copy Markdown
Member Author

Addressed comment + fixed linters

  • awaiting-author

@github-actions github-actions Bot removed the awaiting-author A reviewer has asked the author a question or requested changes label Jul 2, 2026
@jstoobysmith

Copy link
Copy Markdown
Member Author

-awaiting-author

@nateabr nateabr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Amazing, I humbly submit my first approval to physlib ahahaha.

(I hope this helps you merge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-relativity Relativity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants