verify¶
Functions to verify correctness of logical Clifford gadgets with tableaux comparison.
Supported features¶
Verifying Cliffords with valid_clifford_implementation()
Works for \(k>1\) codes
Works for operations on a single code block or between two code blocks
Works for non-CSS codes (e.g. the \([[5, 1, 3]]\) code)
Ancilla qubits can be used in the implementation
The same features are available for valid_stabilizer_state_preparation().
Steane code example¶
from guppylang import guppy
from guppylang.std.builtins import array
from guppylang.std.quantum import qubit, h
from guppyft.code_def import StabilizerCode
from guppyft.verify import valid_clifford_implementation
STEANE_DEF = StabilizerCode.from_python_strings(
num_physical_qubits=7,
num_logical_qubits=1,
distance=3,
generators=["XXXXIII", "IXXIXXI", "IIXXIXX", "ZZZZIII", "IZZIZZI", "IIZZIZZ"],
x_logicals=["XXXXXXX"],
z_logicals=["ZZZZZZZ"],
)
@guppy
def steane_specify_h(qs: array[qubit, 1]) -> None:
h(qs[0])
@guppy
def steane_impl_h(block: array[qubit, 7]) -> None:
for i in range(len(block)):
h(block[i])
# True => implementation is valid
assert valid_clifford_implementation(steane_specify_h, steane_impl_h, STEANE_DEF)
Functions
|
Checks whether impl_function is a valid implementation of semantic_function. |
|
Checks whether impl_function prepares the state specified by semantic function. |