Skip to content

[Feature]: Investigate using @expected_qubits hint to replace num_ancilla_qubits parameter #223

Description

@CalMacCQ

Problem Statement

The idea would be to provide a hint in the implementation function stating the expected number of qubits. This would mean that the num_ancilla_qubits is specified along with the implementation and not as a separate argument to check_clifford_semantics/check_stabilizer_state_semantics.

So instead of

@guppy
def implement_ft_zero_state() -> array[qubit, 7]:
    """Dummy fault-tolerant zero state preparation.

    Fig 1b from https://www.nature.com/articles/srep19578
    """
    block = implement_non_ft_zero_state()
    ancilla = implement_non_ft_zero_state()

    # Perform Steane-style flagging. This is very wasteful, but simple.
    implement_cx(block, ancilla)
    measure_array(ancilla)
    # For proper FT implementation, we would need to check that the XORing
    # that determines the Z stabilizer information is correct.

    return block

check_stabilizer_state_semantics(
        specify_zero_state,
        implement_ft_zero_state,
        code_definition=STEANE_DEF,
        num_ancilla_qubits=7,
    )

We would do

@guppy
@expected_qubits(14) # prepare a 7 qubit state with 7 ancillas
def implement_ft_zero_state() -> array[qubit, 7]:
    """Dummy fault-tolerant zero state preparation.

    Fig 1b from https://www.nature.com/articles/srep19578
    """
    block = implement_non_ft_zero_state()
    ancilla = implement_non_ft_zero_state()

    # Perform Steane-style flagging. This is very wasteful, but simple.
    implement_cx(block, ancilla)
    measure_array(ancilla)
    # For proper FT implementation, we would need to check that the XORing
    # that determines the Z stabilizer information is correct.

    return block


check_stabilizer_state_semantics(
        specify_zero_state,
        implement_ft_zero_state,
        code_definition=STEANE_DEF,
    )

Proposed Solution

No response

Component

No response

Effort Estimate

None

Additional Context

No response

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions