If I'm not mistaken, the $\{H,T,CNOT\}$ set of gates is universal in the sense that any unitary can be approximated arbiratrily close by a combination of these gates.

The transpile function of Qiskit allows to decompose a quantum circuit into a universal set of gates. But it seems that it fails to do so for basic circuits:

from qiskit.circuit import QuantumCircuit
from qiskit import transpile

qc = QuantumCircuit(2)
qc.cx(0, 1)

basis_gates = ["h", "t", "cx", "id"]

qc_transpiled = transpile(qc, basis_gates=basis_gates)

This code results in a TranspilerError: "Unable to translate the operations in the circuit: ['h', 's', 'cx'] to the backend's (or manually specified) target basis: ['reset', 'cx', 'delay', 'barrier', 't', 'snapshot', 'h', 'measure', 'id']. This likely means the target basis is not universal or there are additional equivalence rules needed in the EquivalenceLibrary being used..

This is neither the same problem as in this question, since I've added the "id" gate to my set, nor as this one since this gate set is supposed to approximate any unitary.

Is there something I can do to help Qiskit transpile this circuit? Of course, the one I've linked as an example is easy enough, but I'd like it to transpile more complex gates, like arbitrary $RX$ gates for instance.

If it helps, the version of Qiskit I'm using is:

{'qiskit': '0.45.1', 'qiskit-aer': '0.13.0', 'qiskit-ignis': None, 'qiskit-ibmq-provider': None, 'qiskit-nature': None, 'qiskit-finance': None, 'qiskit-optimization': None, 'qiskit-machine-learning': None}

1 Answer 1


Solovay-Kitaev algorithm is implemented in SolovayKitaev class. You can use it by transpiling your circuit using

basis_gates = ["u", "cx"]

Then run SolovayKitaev on the transpiled circuit:

from qiskit.transpiler.passes.synthesis import SolovayKitaev

skd = SolovayKitaev()
discretized = skd(qc_transpiled)

The result will be

enter image description here

Note: according to the documentation, SolovayKitaevSynthesis is invoked by transpile() method when the unitary_synthesis_method parameter is set to "sk". However, it didn't work with me.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.