Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Add Adj functor to AssertQubit #316

@msoeken

Description

@msoeken

Describe the bug

Not really a bug, but an inconsistency. AssertQubit does not have an Adj functor, but AssertAllZero, which uses AssertQubit, does have one (adjoint self).

To Reproduce

Consider the following operation:

operation ApplyAnd(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj {
  AssertQubit(Zero, target);
  CCNOT(control1, control2, target);
}

This does not compile because AssertQubit does not have an Adj functor.

Expected behavior

Operation should compile, and check in the adjoint call to ApplyAnd that target is released in state Zero.

Actual behavior

Operation does not compile, however, I can use the following alternative:

operation ApplyAnd(control1 : Qubit, control2 : Qubit, target : Qubit) : Unit is Adj {
  AssertAllZero([target]);
  CCNOT(control1, control2, target);
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions