Skip to content

Conversation

mpharrigan
Copy link
Collaborator

Quantum information cannot be destroyed, but during a computation we may produce intermediate values that we wish to discard. We can "uncompute" these values by running the computation in reverse. The ordinary uncomputation strategy requires paying the cost of the computation twice, but Halving the cost of quantum addition. Gidney 2017 shows how measurement in the X basis can effectively discard a bit without expensive uncomputation. The consequence is that the remaining states of the system will pick up phases depending on the random measurement result. Verifying Measurement Based Uncomputation. Gidney 2019 provides more detail about these phases. It also describes a proceedure for using a phased-classical simulator to "fuzz test" measurement-based uncomputation circuits.

Here, we show how Qualtran can be used to verify measurement based uncomputation circuits following Gidney's proposal.

@mpharrigan mpharrigan requested a review from dstrain115 August 26, 2025 21:57
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copy link
Contributor

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

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

LGTM modulo a few nits.

"source": [
"# Verifying Measurement-Based Uncomputation\n",
"\n",
"Quantum information cannot be destroyed, but during a computation we may produce intermediate values that we wish to discard. We can \"uncompute\" these values by running the computation in reverse. The ordinary uncomputation strategy requires paying the cost of the computation twice, but [*Halving the cost of quantum addition.* Gidney 2017](https://arxiv.org/abs/1709.06648) shows how measurement in the X basis can effectively discard a bit without expensive uncomputation. The consequence is that the remaining states of the system will pick up phases depending on the random measurement result. [*Verifying Measurement Based Uncomputation.* Gidney 2019](https://algassert.com/post/1903) provides more detail about these phases. It also describes a proceedure for using a phased-classical simulator to \"fuzz test\" measurement-based uncomputation circuits.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think there should be a comma after "during a computation"

"\n",
"and_dag = And(uncompute=True)\n",
"for q1, q2 in itertools.product(range(2), repeat=2):\n",
" trg = int(q1==1 and q2 == 1)\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

what is 'trg'? I would probably use a better name.
It took me a while to realize this means "target". I would use that name here and below.

Avoid abbreviations: https://google.github.io/styleguide/pyguide.html#316-naming

" trg = int(q1==1 and q2 == 1)\n",
" print(f'{q1=}, {q2=}, {trg=}', end=' ')\n",
" (q1o, q2o), = and_dag.call_classically(ctrl=[q1,q2], target=trg)\n",
" assert q1o == q1\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid abbreviations: https://google.github.io/styleguide/pyguide.html#316-naming

I would use q1_output.

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

Successfully merging this pull request may close these issues.

2 participants