mqt.qecc.circuit_synthesis.exact.extraction

Circuit extraction from SAT models.

Functions

extract_clifford_gate_count_circuit(model, n, ...[, ...]) → mqt.qecc.circuit_synthesis.circuits.CliffordIsometry

Extract Clifford circuit from gate-count SAT model.

extract_clifford_depth_circuit(model, n, max_depth, enc, k) → mqt.qecc.circuit_synthesis.circuits.CliffordIsometry

Extract Clifford circuit from depth SAT model.

extract_cnot_gate_count_circuit(model, n, max_gates, ...) → mqt.qecc.circuit_synthesis.circuits.CNOTCircuit

Extract CNOT circuit from gate-count SAT model.

extract_cnot_depth_circuit(model, n, max_depth, ...) → mqt.qecc.circuit_synthesis.circuits.CNOTCircuit

Extract CNOT circuit from depth SAT model.

Module Contents

extract_clifford_gate_count_circuit(model: z3.ModelRef, n: int, max_gates: int, enc: CliffordGateCountVars, k: int, pivot_qubits: list[int] | None = None) → CliffordIsometry[source]

Extract Clifford circuit from gate-count SAT model.

The synthesis builds the circuit in reverse (reducing target to identity), so we invert and reverse the gate sequence using each gate class’s inverse_stim_gate().

Parameters:
  • model – Z3 model from satisfiable formula.

  • n – Number of qubits.

  • max_gates – Maximum number of gates.

  • enc – Variable container returned by encode_clifford_gate_count().

  • k – Number of logical qubits.

  • pivot_qubits – Qubits to reset (stabilizer/ancilla qubits). Determined from the satisfying model; defaults to range(k, n) if not provided.

Returns:

Extracted CliffordIsometry circuit.

extract_clifford_depth_circuit(model: z3.ModelRef, n: int, max_depth: int, enc: CliffordDepthVars, k: int, pivot_qubits: list[int] | None = None) → CliffordIsometry[source]

Extract Clifford circuit from depth SAT model.

The synthesis builds the circuit in reverse (reducing target to identity), so we invert and reverse the layer sequence.

The variable index structure recorded in enc.gate_vars is decoded by inspecting the number of booleans per layer:

  • n entries → single-qubit gate; the index equals the qubit.

  • n*(n-1) entries → ordered two-qubit gate (CX-like); the pair (ctrl, tgt) is decoded from ctrl*(n-1) + (tgt if tgt < ctrl else tgt-1).

  • n*(n-1)//2 entries → symmetric two-qubit gate (CZ-like); the pair (i, j) with i < j is decoded from i*(2n-i-1)//2 + (j-i-1).

Parameters:
  • model – Z3 model from satisfiable formula.

  • n – Number of qubits.

  • max_depth – Maximum depth.

  • enc – Variable container returned by encode_clifford_depth().

  • k – Number of logical qubits.

  • pivot_qubits – Qubits to reset (stabilizer/ancilla qubits). Determined from the satisfying model; defaults to range(k, n) if not provided.

Returns:

Extracted CliffordIsometry circuit.

extract_cnot_gate_count_circuit(model: z3.ModelRef, n: int, max_gates: int, alpha_vars: list[z3.BitVecRef], beta_vars: list[z3.BitVecRef], init_x: list[int], init_z: list[int]) → CNOTCircuit[source]

Extract CNOT circuit from gate-count SAT model.

The synthesis builds the circuit in reverse (reducing target to identity), so we need to reverse the CNOT sequence.

Parameters:
  • model – Z3 model from satisfiable formula.

  • n – Number of qubits.

  • max_gates – Maximum number of gates.

  • alpha_vars – Control qubit index variables.

  • beta_vars – Target qubit index variables.

  • init_x – Qubits initialized in |+⟩ state.

  • init_z – Qubits initialized in |0⟩ state.

Returns:

Extracted CNOTCircuit.

extract_cnot_depth_circuit(model: z3.ModelRef, n: int, max_depth: int, cx_vars: list[list[z3.BoolRef]], init_x: list[int], init_z: list[int]) → CNOTCircuit[source]

Extract CNOT circuit from depth SAT model.

The synthesis builds the circuit in reverse (reducing target to identity), so we need to reverse the layer sequence.

Parameters:
  • model – Z3 model from satisfiable formula.

  • n – Number of qubits.

  • max_depth – Maximum depth.

  • cx_vars – CNOT gate variables [layer][cx_idx].

  • init_x – Qubits initialized in |+⟩ state.

  • init_z – Qubits initialized in |0⟩ state.

Returns:

Extracted CNOTCircuit.