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.h(0)
qc.s(0)
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}