pprop.propagator.evolve module

This module handles the core evolution of Pauli words through a list of gates via the Heisenberg picture.

pprop.propagator.evolve.heisenberg(gates, paulidict, k1, k2, opt=False, debug=False)[source]

Evolve a PauliDict backwards through a list of gates (Heisenberg picture).

Each gate is applied in reverse order so that the observable is propagated from the measurement end of the circuit back to the input. After all gates have been applied, to_expectation() extracts the symbolic expectation value expression as a CoeffTerms list.

Parameters:
  • gates (list[pprop.gates.Gate]) – Ordered list of gates as they appear in the circuit (will be iterated in reverse).

  • paulidict (PauliDict) – Initial observable represented as a mapping of PauliOp -> CoeffTerms.

  • k1 (int or None) – Pauli weight cutoff. Evolved terms whose Pauli weight exceeds k1 are discarded. None disables this truncation.

  • k2 (int or None) – Frequency cutoff. Evolved terms whose total trigonometric frequency exceeds k2 are discarded. None disables this truncation.

  • opt (bool, optional) – If True, use optimized pruning strategy. Defaults to False.

  • debug (bool, optional) – If True, print the gate, pre-evolution, and post-evolution state at each step. Defaults to False.

Returns:

  • paulidict (PauliDict) – The fully evolved observable after all gates have been applied.

  • expectation (CoeffTerms) – Flat list of CoeffTerm tuples encoding the symbolic expectation value \(\langle 0 | U^\dagger O U | 0 \rangle\).

Return type:

Tuple[PauliDict, list[tuple[float, list[int], list[int]]]]

pprop.propagator.evolve.to_expectation(paulidict)[source]

Extract the expectation value expression from a propagated PauliDict.

In the \(|0\rangle^{\otimes n}\) computational basis state, only Pauli words composed entirely of \(Z\) and \(I\) operators have non-zero expectation:

\[\langle 0 | I | 0 \rangle = 1, \quad \langle 0 | Z | 0 \rangle = 1, \quad \langle 0 | X | 0 \rangle = 0, \quad \langle 0 | Y | 0 \rangle = 0\]

This function iterates over all Pauli words in paulidict, keeps only those that satisfy the zero-bracket condition (i.e. only \(Z\)/\(I\) on every qubit), and concatenates their CoeffTerms into a single flat list representing the full expectation value expression.

Parameters:

paulidict (PauliDict) – Mapping of PauliOp -> CoeffTerms after Heisenberg evolution.

Returns:

Flat list of CoeffTerm tuples whose sum gives the expectation value \(\langle 0 | O | 0 \rangle\).

Return type:

CoeffTerms