Toffoli / U3 / CZ lowering¶
oracq.infrastructure.backends.basis
Lower the gate set within OriginIR DEF boundaries; module calls and QRAM declarations remain unexpanded.
- oracq.infrastructure.backends.basis.export_toffoli_u3_cz(program)[source]¶
Export an OriginIR-ext netlist over the Toffoli+U3+CZ gate set.
Equivalent to
lower_toffoli_u3_cz(export_originir(program)); module calls and QRAM declarations remain unexpanded.- Parameters:
program – The closed RIR program to compile.
- Returns:
The lowered netlist;
workspace_qubitsincludes the newly addedpb_workancilla bit indices.- Return type:
- oracq.infrastructure.backends.basis.lower_toffoli_u3_cz(artifact)[source]¶
Lower the gates of an OriginIR-ext netlist to Toffoli, U3 and CZ.
Multi-controlled X-type gates (CNOT included, SWAP expanded into three swaps) are implemented with a Toffoli ladder per the
mcxrecipe, and controlled single-qubit gates per thecontrolled_u3recipe; both share thepb_workancilla pool allocated by the maximum control count; pool bits are appended toQINIT,DEFformals andm_call lines.DAGGER, QRAM andCREGlines are kept verbatim.- Parameters:
artifact – The OriginIR-ext netlist produced by
export_originir.- Returns:
The lowered netlist;
workspace_qubitsappends the newly added ancilla bit indices, whileregistersandresourcespass through unchanged.- Return type:
- Raises:
ValidationError – A target gate unsupported by the parameter table was encountered.