tqecd.match_utils.cover.find_exact_cover_sat#

find_exact_cover_sat(target: PauliString, sources: list[PauliString]) list[int] | None[source]#

Try to find a set of pauli strings from sources that generate exactly target.

The Pauli strings returned (via indices over the provided sources), once multiplied together, should be exactly equal to target. In particular, the following post-condition should hold:

If multiple valid covers exist, the covers involving the lowest number of PauliString instances from sources are listed, and a random cover is picked from that list.

target = None     # to replace
sources = [None]  # to replace
cover_indices = find_exact_cover_sat(target, sources)
resulting_pauli_string = PauliString({})
for i in cover_indices:
    resulting_pauli_string = resulting_pauli_string * sources[i]
assert resulting_pauli_string == target, "Should hold"
Parameters:
  • target – the stabilizers to cover with stabilizers from sources.

  • sources – stabilizers that can be used to cover target.

Returns:

Either a list of indices over sources that, when combined, cover exactly the provided target, or None if such a list could not be found.