Two functions that can be quite handy when synthesizing oracles. They
take as input a BoolFunction and synthesize it to either a bitflip or a
phaseflip circuit implementation of the function.
from tweedledum.bool_function_compiler import BitVec, BoolFunction, phaseflip_circuit
def f(v0, v1, v2, v3 : BitVec(1)) -> BitVec(1):
return (v0 != v1) and (v2 != v3) and (v0 != v2) and (v1 != v3)
oracle_func = BoolFunction(f)
oracle_circuit = phaseflip_circuit(oracle_func, 'pkrm')
Description
Two functions that can be quite handy when synthesizing oracles. They take as input a BoolFunction and synthesize it to either a bitflip or a phaseflip circuit implementation of the function.
Result:
Suggested changelog entry: