mqt.qecc.circuit_synthesis.exact.symmetry¶
Symmetry-breaking constraint builders for exact synthesis.
Functions¶
|
Compute the flat index of CZ(i, j) in the cz_vars list. |
|
Add symmetry-breaking constraints for Clifford gate-count encoding. |
|
Add symmetry-breaking constraints for Clifford depth encoding. |
|
Add symmetry-breaking constraints for CSS CNOT depth encoding. |
|
Add symmetry-breaking constraints for CSS CNOT gate-count encoding. |
Module Contents¶
- cz_pair_idx(i: int, j: int, n: int) int[source]¶
Compute the flat index of CZ(i, j) in the cz_vars list.
cz_vars are ordered as [(i, j) for i in range(n) for j in range(i+1, n)], giving n*(n-1)//2 entries. Callers may pass either ordering; the function normalises to i < j.
- add_clifford_gate_count_symmetry_breaking(solver: z3.Solver, max_gates: int, enc: CliffordGateCountVars) None[source]¶
Add symmetry-breaking constraints for Clifford gate-count encoding.
For every self-inverse gate, adjacent identical applications with the same qubit arguments are forbidden (since the two gates would cancel). This applies to single-qubit gates (same alpha) and two-qubit gates (same alpha and beta). Non-self-inverse gates (e.g. S) are left unconstrained because consecutive applications are not redundant.
- Parameters:
solver – Z3 solver instance.
max_gates – Maximum gate count bound.
enc – Variable container returned by
encode_clifford_gate_count().
- add_clifford_depth_symmetry_breaking(solver: z3.Solver, max_depth: int, enc: CliffordDepthVars) None[source]¶
Add symmetry-breaking constraints for Clifford depth encoding.
Two classes of constraints are added:
Adjacent identical gate cancellation — for every self-inverse gate, the same gate at the same qubit/pair index cannot appear in two consecutive layers.
Left alignment — if both qubits involved in a potential two-qubit gate are idle (identity) in layer
ell, that gate is forbidden in layerell+1. Additionally, if a qubit is idle in layerell, no single-qubit gate (H or S) may target it in layerell+1.- Parameters:
solver – Z3 solver instance.
max_depth – Maximum depth bound.
enc – Variable container returned by
encode_clifford_depth().
- add_css_depth_symmetry_breaking(solver: z3.Solver, n: int, max_depth: int, cx_vars: list[list[z3.BoolRef]], id_vars: list[list[z3.BoolRef]]) None[source]¶
Add symmetry-breaking constraints for CSS CNOT depth encoding.
Constraints: - Adjacent identical CNOT cancellation - Left alignment for CNOTs
- Parameters:
solver – Z3 solver instance.
n – Number of qubits.
max_depth – Maximum depth bound.
cx_vars – CNOT gate variables [depth][cx_idx] where cx_idx = ctrl*(n-1)+(tgt if tgt<ctrl else tgt-1).
id_vars – Identity variables [depth][qubit].
- add_css_gate_count_symmetry_breaking(solver: z3.Solver, max_gates: int, alpha_vars: list[z3.BitVecRef], beta_vars: list[z3.BitVecRef]) None[source]¶
Add symmetry-breaking constraints for CSS CNOT gate-count encoding.
Constraints: - Adjacent identical CNOT cancellation
- Parameters:
solver – Z3 solver instance.
max_gates – Maximum gate count bound.
alpha_vars – CNOT control index variables [slot].
beta_vars – CNOT target index variables [slot].