Replies: 1 comment 3 replies
-
Not generally possible - imagine a program that swaps two qubits depending on a measurement. In theory the compiler could fail only when such a proof isn't possible and accept the dagger otherwise. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Assignment, being non-reversible, is not supported in a dagger context. However given how this will impact the use of ancilla in programs I thought it was worth making a discussion about two main approaches to using ancilla given that this will determine how guppy-algorithms moves forwards.
The first is that this is just managed at the program level, so unitaries never allocate and always take in ancilla that are assumed to be in$\ket{0}$ , and leave them back in the $\ket{0}$ state.
Another option is that alternative/argument for$\ket{0}$
discardis added which acts as a promise to the compiler that the discarded qubits are inFor example, the following function should not compile as the final ancilla state is unknown.
but when replacing
discard(a)with "discard(a, zero=True)" (which the compiler of course cannot verify is the case) it is now at least in theory possible to tell that this is reversible, (although I do not know how hard matching up allocations and deallocations will be in general).I would be interested to hear any thoughts on this, apologies if it has already been discussed elsewhere.
Beta Was this translation helpful? Give feedback.
All reactions