# simplify

### simplify(mapper_fn)

Wraps a mapper function so that it simplifies the operator it returns.

Simplifying merges duplicate Pauli terms and, as a side effect, sorts the terms into a canonical
order. That order is worth asking for explicitly in two situations:

1. The term order an unsimplified mapper produces is **not** guaranteed to be stable between runs,
   because the operators of the Rust core do not preserve the order their terms were added in. A
   product formula synthesizes the terms in the order it receives them, so an unsimplified mapper
   can yield a different (though equally valid) circuit each time. Simplifying pins it.
2. It merges terms that map to the same Pauli string, which shortens the synthesized circuit when a
   mapper produces such duplicates.

Use it to wrap any `MapperFunction`:

```default
MapperFnEvolutionSynthesis(simplify(jordan_wigner))
```

* **Parameters:**
  **mapper_fn** ([*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable) *[* *[*[*OperatorTrait*](qiskit_fermions.operators.OperatorTrait.html.md#qiskit_fermions.operators.OperatorTrait) *,* [*int*](https://docs.python.org/3/builtins/functions.html#int) *]* *,* [*SparseObservable*](https://quantum.cloud.ibm.com/docs/api/qiskit/qiskit.quantum_info.SparseObservable) *]*) – the mapper function to wrap.
* **Returns:**
  A mapper function that simplifies whatever `mapper_fn` returns.
* **Return type:**
  [*Callable*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[*OperatorTrait*](qiskit_fermions.operators.OperatorTrait.html.md#qiskit_fermions.operators.OperatorTrait), [int](https://docs.python.org/3/builtins/functions.html#int)], [*SparseObservable*](https://quantum.cloud.ibm.com/docs/api/qiskit/qiskit.quantum_info.SparseObservable)]
