mqt.qecc.circuit_synthesis.exact.encoding_gate_count

Gate-count encoding builders for exact synthesis.

Functions

encode_clifford_gate_count(target, k, max_gates[, ...]) → mqt.qecc.circuit_synthesis.exact.vars.CliffordGateCountVars

Encode Clifford isometry synthesis with gate-count optimization.

encode_css_gate_count(target, k, m_x, max_gates[, ...]) → tuple[z3.Solver, list[z3.BitVecRef], list[z3.BitVecRef]]

Encode CSS CNOT isometry synthesis with gate-count optimization.

Module Contents

encode_clifford_gate_count(target: StabilizerTableau, k: int, max_gates: int, allow_qubit_permutation: bool = True, gate_set: dict[str, type[SymbolicGateOperation]] | None = None) → CliffordGateCountVars[source]

Encode Clifford isometry synthesis with gate-count optimization.

Parameters:
  • target – Target stabilizer tableau (2k+m rows, where m=n-k stabilizers).

  • k – Number of logical qubits.

  • max_gates – Maximum number of gates.

  • allow_qubit_permutation – Allow final qubit permutation.

  • gate_set – Gate set to use. If None, uses standard {H, S, CX, ID}. Pass a gate set containing "CZ" to enable CZ gates.

Returns:

A CliffordGateCountVars container holding the solver and all SAT variables. The gate_sel dict has one entry per gate type (excluding "ID"); alpha and beta hold per-slot qubit-index variables.

encode_css_gate_count(target: CheckMatrix, k: int, m_x: int, max_gates: int, gate_set: dict[str, type[SymbolicGateOperation]] | None = None) → tuple[z3.Solver, list[z3.BitVecRef], list[z3.BitVecRef]][source]

Encode CSS CNOT isometry synthesis with gate-count optimization.

Supports both X-type and Z-type check matrices. For X-type targets, CNOT(ctrl, tgt) adds column ctrl to column tgt (X propagates ctrl→tgt). For Z-type targets, CNOT(ctrl, tgt) adds column tgt to column ctrl (Z propagates tgt→ctrl), so the pivot columns of the reduced matrix are the qubits initialized in |0⟩.

Uses the provided gate set to dynamically support registered CSS gates. Defaults to {CX} if no gate set is provided.

Parameters:
  • target – Target CSS matrix [L; H] (X-type or Z-type).

  • k – Number of logical qubits.

  • m_x – Number of stabilizer rows (rank of the stabilizer block).

  • max_gates – Maximum number of gates.

  • gate_set – Optional custom gate set. If None, uses standard {CX, ID}.

Returns:

Tuple of (solver, alpha_vars, beta_vars).