Repository: Qiskit/qiskit

Issue:
Add translation to RX(X) basis to equivalence library 
### What is the expected enhancement?

Allow using `RX` and `RXX` as basis gates by adding appropriate entries to the equivalence library: 

* `RZ = H RX H` (and `RZZ = HH RXX HH`)
* `RY = Sdg RX S` (and equivalently for 2 qubits)

Currently this translation is not supported:

```python
>>> from qiskit import QuantumCircuit, transpile
>>> qc = QuantumCircuit(1)
>>> qc.ry(0.1, 0);
>>> transpile(qc, basis_gates=["rx", "h", "s", "sdg"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/compiler/transpiler.py", line 319, in transpile
    circuits = parallel_map(_transpile_circuit, list(zip(circuits, transpile_args)))
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/tools/parallel.py", line 132, in parallel_map
    return [task(values[0], *task_args, **task_kwargs)]
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/compiler/transpiler.py", line 407, in _transpile_circuit
    circuit, callback=transpile_config["callback"], output_name=transpile_config["output_name"]
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/passmanager.py", line 216, in run
    return self._run_single_circuit(circuits, output_name, callback)
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/passmanager.py", line 272, in _run_single_circuit
    result = running_passmanager.run(circuit, output_name=output_name, callback=callback)
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/runningpassmanager.py", line 123, in run
    dag = self._do_pass(pass_, dag, passset.options)
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/runningpassmanager.py", line 154, in _do_pass
    dag = self._run_this_pass(pass_, dag)
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/runningpassmanager.py", line 166, in _run_this_pass
    new_dag = pass_.run(dag)
  File "/Users/jul/Qiskit/qiskit-terra/qiskit/transpiler/passes/basis/basis_translator.py", line 114, in run
    "over library {}.".format(source_basis, target_basis, self._equiv_lib)
qiskit.transpiler.exceptions.TranspilerError: "Unable to map source basis {('ry', 1)} to target basis {'reset', 'snapshot', 's', 'delay', 'barrier', 'h', 'measure', 'sdg', 'rx'} over library <qiskit.circuit.equivalence.EquivalenceLibrary object at 0x7f9058c20a90>."
```


Discussion:
`basis_gates=["rx", "rz"]` works. 

So I agree that it should be enough to add the equivalence relations you have highlighted. 

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
@@ -354,6 +354,13 @@
 def_ry.append(RGate(theta, pi / 2), [q[0]], [])
 _sel.add_equivalence(RYGate(theta), def_ry)
 
+q = QuantumRegister(1, "q")
+ry_to_rx = QuantumCircuit(q)
+ry_to_rx.sdg(0)
+ry_to_rx.rx(theta, 0)
+ry_to_rx.s(0)
+_sel.add_equivalence(RYGate(theta), ry_to_rx)
+
 # CRYGate
 #
 # q_0: ────■────      q_0: ─────────────■────────────────■──
@@ -451,6 +458,20 @@
     ryy_to_rzz.append(inst, qargs, cargs)
 _sel.add_equivalence(RYYGate(theta), ryy_to_rzz)
 
+# RYY to RXX
+q = QuantumRegister(2, "q")
+theta = Parameter("theta")
+ryy_to_rxx = QuantumCircuit(q)
+for inst, qargs, cargs in [
+    (SdgGate(), [q[0]], []),
+    (SdgGate(), [q[1]], []),
+    (RXXGate(theta), [q[0], q[1]], []),
+    (SGate(), [q[0]], []),
+    (SGate(), [q[1]], []),
+]:
+    ryy_to_rxx.append(inst, qargs, cargs)
+_sel.add_equivalence(RYYGate(theta), ryy_to_rxx)
+
 # RZGate
 #                  global phase: -ϴ/2
 #    ┌───────┐        ┌───────┐
@@ -474,6 +495,13 @@
 rz_to_sxry.sxdg(0)
 _sel.add_equivalence(RZGate(theta), rz_to_sxry)
 
+q = QuantumRegister(1, "q")
+rz_to_rx = QuantumCircuit(q)
+rz_to_rx.h(0)
+rz_to_rx.rx(theta, 0)
+rz_to_rx.h(0)
+_sel.add_equivalence(RZGate(theta), rz_to_rx)
+
 # CRZGate
 #
 # q_0: ────■────     q_0: ─────────────■────────────────■──
@@ -588,7 +616,6 @@
     rzz_to_ryy.append(inst, qargs, cargs)
 _sel.add_equivalence(RZZGate(theta), rzz_to_ryy)
 
-
 # RZXGate
 #
 #      ┌─────────┐


Test patch: