import qiskit.quantum_info as qi
from qiskit.circuit.library import FourierChecking
from qiskit.visualization import plot_histogram

f = [1, -1, -1, -1]
g = [1, 1, -1, -1]
# FourierChecking() : How our Fourier Transform of F is correlated with G.
# if p(f,g) <= 0.01
# p(f, g) > 0.05 Fourier Exits between f and g

qc = FourierChecking(f=f, g=g)
qc.draw(output='mpl')

zero = qi.Statevector.from_label('00')
sv = zero.evolve(qc)
probs = sv.probabilities_dict()
plot_histogram(probs)

# We are only interested in 00 qubit thus our function f is correlated in 00 state to g with probabilites of 25%