catalyst.passes.ppr_to_mbqc

ppr_to_mbqc(qnode)[source]

Specify that the MLIR compiler pass for lowering Pauli Product Rotations (PPR) and Pauli Product Measurements (PPM) to a measurement-based quantum computing (MBQC) style circuit will be applied.

This pass replaces QEC operations (qec.ppr and qec.ppm) with a gate-based sequence in the Quantum dialect using universal gates and measurements that supported as MBQC gate set. For details, see the Figure 2 of [Measurement-based Quantum Computation on cluster states](https://arxiv.org/abs/quant-ph/0301052).

Conceptually, each Pauli product is handled by:

  • Mapping its Pauli string to the Z basis via per-qubit conjugations (e.g., H for X; specialized RotXZX sequences for Y).

  • Accumulating parity onto the first qubit with a right-to-left CNOT ladder.

  • Emitting the kernel operation: - PPR: apply an RZ with an angle derived from the rotation kind. - PPM: perform a measurement and return an i1 result.

  • Uncomputing by reversing the CNOT ladder and the conjugations.

  • Conjugating the qubits back to the original basis.

Note

This pass expects PPR/PPM operations to be present. In practice, use it after to_ppr() and/or commute_ppr() and/or merge_ppr_ppm().

Parameters:

fn (QNode) – QNode to apply the pass to.

Returns:

~.QNode

Example

Convert a simple Clifford+T circuit to PPRs, then lower them to an MBQC-style circuit. Note that this pass should be applied before ppr_to_ppm() since it requires the actual PPR/PPM operations.

import pennylane as qml
from catalyst import qjit, measure
from catalyst.passes import to_ppr, ppr_to_mbqc

pipeline = [("pipe", ["enforce-runtime-invariants-pipeline"])]

@qjit(pipelines=pipeline, keep_intermediate=True, target="mlir")
@ppr_to_mbqc
@to_ppr
@qml.qnode(qml.device("null.qubit", wires=2))
def circuit():
    qml.H(0)
    qml.CNOT([0, 1])
    return measure(1)

print(circuit.mlir_opt)

Example MLIR excerpt (structure only):