Fix Qsimpl hanging on goals with adjoint _
#44
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ishermitian _
hangs. As a result,Qsimpl
(which isautorewrite 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 fromQ_db
and adds corresponding lemmas*_hermitian_rw
back toQ_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 ofhermitian
to explicitly stateadjoint A = A
. There are other, more complicated automation solutions that could be pursued to keep aroundhermitian
. For instance, I could createhermitian_db
to show a matrix is hermitian, including the*_hermitian
variants as well as any other lemmas we want to include (likekron_hermitian
), then write custom Ltac to try to replace anyadjoint A
in the goal withA
usinghermitian_db
. That's a larger conversation, though - this hotfix should address the basic issue.