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

Fix Qsimpl hanging on goals with adjoint _ #44

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Conversation

wjbs
Copy link
Collaborator

@wjbs wjbs commented Jul 15, 2024

A recent change (1.4.0?) phased out *_sa (id_sa, hadamard_sa, etc.) in favor of *_hermitian. However, trying to rewrite with a lemma whose statement is hermitian _ hangs. As a result, Qsimpl (which is autorewrite with Q_db) would hang in situations where one of these lemmas could be rewritten. Any goal with (σx) † should demonstrate this issue. This is a hotfix that removes the *_hermitian lemmas from Q_db and adds corresponding lemmas *_hermitian_rw back to Q_db.

I believe this to be the cause of VOQC not compiling on QuantumLib 1.4.0+, as I have found an instance in VOQC where Qsimpl hangs. I will test this and update with the results. (There is also a place in SQIR with a trivial missing Import issue brought on by recent updates, which I believe is unrelated.)

As rewriting with the *_hermitian lemmas fails, it is a question whether we want to stick with them or return to the *_sa-style variants, which unfold the definition of hermitian to explicitly state adjoint A = A. There are other, more complicated automation solutions that could be pursued to keep around hermitian. For instance, I could create hermitian_db to show a matrix is hermitian, including the *_hermitian variants as well as any other lemmas we want to include (like kron_hermitian), then write custom Ltac to try to replace any adjoint A in the goal with A using hermitian_db. That's a larger conversation, though - this hotfix should address the basic issue.

@wjbs wjbs added the bug Something isn't working label Jul 15, 2024
@wjbs wjbs requested a review from adrianleh July 15, 2024 22:40
Copy link
Member

@adrianleh adrianleh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@adrianleh adrianleh left a comment

Choose a reason for hiding this comment

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

Sorry, updating review. Please update the version numbers in the opam and dune files

@adrianleh adrianleh merged commit ec1987d into main Jul 29, 2024
4 checks passed
@adrianleh adrianleh deleted the fix_hermitian_rw branch July 29, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants