Repository: Qiskit/qiskit

Issue:
`transpile` function with `basis_gates=['u', 'cx']` fails with any circuit with an `id` gate
### Environment

- **Qiskit Terra version**: 0.22.3
- **Python version**: 3.9.15


### What is happening?

Suppose I am given an arbitrary quantum circuit and I want to transpile it by using only the gate $U(\theta, \phi, \lambda)$ (single-qubit rotation) and the gate $CX$ (creating entanglement), knowing that they form a universal set of gates for quantum computation.
In Qiskit this should be possible calling the `transpile` function and passing the argument `basis_gates=['u', 'cx']`. This works fine in almost any case but fails for every circuit with an identity `id` gate (or more than one).

### How can we reproduce the issue?

```
from qiskit import QuantumCircuit, transpile

qc = QuantumCircuit(1)
qc.id(0)
tqc = transpile(qc, basis_gates=['u', 'cx'])
```

`QiskitError: "Cannot unroll the circuit to the given basis, ['u', 'cx']. Instruction id not found in equivalence library and no rule found to expand."`

### What should happen?

I would expect the transpiler not to raise any error and to complete the circuit transpilation correctly.

### Any suggestions?

To solve this problem, it should be enough to add $I = U(0,0,0)$ to the Qiskit equivalence library, so that the transpiler runs successfully and returns the circuit
![ugate](https://user-images.githubusercontent.com/71086758/215528945-bf95bf79-9369-4edc-93e2-7e0daf934e39.png)


Discussion:

Resolving patch:
diff --git a/qiskit/circuit/library/standard_gates/equivalence_library.py b/qiskit/circuit/library/standard_gates/equivalence_library.py
--- a/qiskit/circuit/library/standard_gates/equivalence_library.py
+++ b/qiskit/circuit/library/standard_gates/equivalence_library.py
@@ -73,6 +73,7 @@
     ECRGate,
     ZGate,
     CZGate,
+    IGate,
     CCZGate,
     XXPlusYYGate,
     XXMinusYYGate,
@@ -170,6 +171,27 @@
 def_r.append(U3Gate(theta, phi - pi / 2, -phi + pi / 2), [q[0]])
 _sel.add_equivalence(RGate(theta, phi), def_r)
 
+# IGate
+q = QuantumRegister(1, "q")
+def_id = QuantumCircuit(q)
+def_id.append(UGate(0, 0, 0), [q[0]])
+_sel.add_equivalence(IGate(), def_id)
+
+q = QuantumRegister(1, "q")
+def_id_rx = QuantumCircuit(q)
+def_id_rx.append(RXGate(0), [q[0]])
+_sel.add_equivalence(IGate(), def_id_rx)
+
+q = QuantumRegister(1, "q")
+def_id_ry = QuantumCircuit(q)
+def_id_ry.append(RYGate(0), [q[0]])
+_sel.add_equivalence(IGate(), def_id_ry)
+
+q = QuantumRegister(1, "q")
+def_id_rz = QuantumCircuit(q)
+def_id_rz.append(RZGate(0), [q[0]])
+_sel.add_equivalence(IGate(), def_id_rz)
+
 # RCCXGate
 #
 #      ┌───────┐


Test patch:
diff --git a/test/python/transpiler/test_basis_translator.py b/test/python/transpiler/test_basis_translator.py
--- a/test/python/transpiler/test_basis_translator.py
+++ b/test/python/transpiler/test_basis_translator.py
@@ -928,22 +928,19 @@ def test_cx_bell_to_ecr(self):
         in_dag = circuit_to_dag(bell)
         out_dag = BasisTranslator(std_eqlib, ["ecr", "u"]).run(in_dag)
 
-        #         ┌────────────┐   ┌─────────────┐┌──────┐┌──────────┐
-        # q_0: ───┤ U(π/2,0,π) ├───┤ U(0,0,-π/2) ├┤0     ├┤ U(π,0,π) ├
-        #      ┌──┴────────────┴──┐└─────────────┘│  Ecr │└──────────┘
-        # q_1: ┤ U(-π/2,-π/2,π/2) ├───────────────┤1     ├────────────
-        #      └──────────────────┘               └──────┘
-
         qr = QuantumRegister(2, "q")
         expected = QuantumCircuit(2)
         expected.u(pi / 2, 0, pi, qr[0])
         expected.u(0, 0, -pi / 2, qr[0])
-        expected.u(-pi / 2, -pi / 2, pi / 2, qr[1])
+        expected.u(pi, 0, 0, qr[0])
+        expected.u(pi / 2, -pi / 2, pi / 2, qr[1])
         expected.ecr(0, 1)
-        expected.u(pi, 0, pi, qr[0])
         expected_dag = circuit_to_dag(expected)
 
         self.assertEqual(out_dag, expected_dag)
+        self.assertEqual(
+            Operator.from_circuit(bell), Operator.from_circuit(dag_to_circuit(out_dag))
+        )
 
     def test_cx_bell_to_cp(self):
         """Verify we can translate a CX bell to CP,U."""