quantum_queries/pytest/bounds.py

16 lines
684 B
Python

import adversary
from math import sqrt
prover = adversary.Prover(
"= (ham x) k", "= (ham y) (+ k 1)", "= ham (^ x y) p").hint_symmetric()
bounds = prover.find_bounds(16, 5, 8)
lower_bound = sqrt(bounds.min_x_relations *
bounds.min_y_relations / bounds.max_joint_relations)
print("m =", bounds.min_x_relations)
print(f"From x={bounds.single_bounding_x:b}")
print("m' =", bounds.min_y_relations)
print(f"From y={bounds.single_bounding_y:b}")
print("ℓ·ℓ' =", bounds.max_joint_relations)
print(f"From x={bounds.joint_bounding_x:012b} and y={bounds.joint_bounding_y:012b} and window={bounds.bounding_window:012b}")
print(f"Query lower bounds = {lower_bound}")