pith. machine review for the scientific record. sign in

arxiv: 2604.05776 · v1 · submitted 2026-04-07 · 🪐 quant-ph

Recognition: no theorem link

A Nested Amplitude Amplification Protocol for the Binary Knapsack Problem

Authors on Pith no claims yet

Pith reviewed 2026-05-10 18:51 UTC · model grok-4.3

classification 🪐 quant-ph
keywords amplitude amplificationknapsack problemGrover adaptive searchquantum optimizationnested protocolNISQ algorithmscombinatorial optimizationquantum tree generator
0
0 comments X

The pith

A nested amplitude amplification protocol reduces the quantum cost of improving solutions to the binary knapsack problem relative to standard Grover Adaptive Search.

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The paper splits the knapsack decision tree at a chosen depth so that an inner amplitude amplification step biases the superposition over the first variables before a full Grover Adaptive Search runs on the remaining space. An Inner Iteration Finder chooses the number of rotations that maximizes the amplitude of feasible marked states, and the resulting biased state becomes the starting point for the outer amplification. Simulations using the Quantum Tree Generator for state preparation and classical amplitude tracking show lower total cost to improve an incumbent solution, especially on one class of instances. This matters because shorter effective circuits could bring quantum optimization closer to the capabilities of near-term hardware for problems such as supply-chain planning.

Core claim

We propose a nested Amplitude Amplification protocol for the binary knapsack problem that splits the decision tree at a tunable depth, performing a partial amplification on the first variables before executing a global GAS on the full search space. The partial amplification is implemented by an Inner Iteration Finder that selects the rotation count maximizing marked-subspace amplitude. The resulting biased superposition serves as the initial state for the outer Amplitude Amplification. Using the Quantum Tree Generator for feasible-state preparation and an efficient classical amplitude-tracking scheme, we simulate the protocol on knapsack instances of sizes intractable by statevector simulat

What carries the argument

The nested Amplitude Amplification protocol, which splits the search at tunable depth and uses an Inner Iteration Finder to select rotation counts that maximize marked-subspace amplitude, thereby supplying a biased initial state to the outer global Grover Adaptive Search.

If this is right

  • The total quantum cost to improve an incumbent solution decreases for a specific subset of knapsack instances.
  • Circuit depth is reduced relative to plain GAS while preserving the ability to prepare feasible states via the Quantum Tree Generator.
  • Classical amplitude tracking combined with the inner finder allows simulation of instances beyond statevector limits.
  • The approach targets domains such as semiconductor supply-chain planning where combinatorial scale grows rapidly.

Where Pith is reading between the lines

These are editorial extensions of the paper, not claims the author makes directly.

  • The same splitting idea could be tested on other combinatorial problems that admit a natural decision-tree ordering.
  • The biased initial state might be combined with different outer amplification schedules or hybrid classical-quantum heuristics.
  • Hardware experiments on near-term devices could measure whether the predicted cost reduction survives gate noise and connectivity constraints.
  • If the subset of instances that benefit is identifiable in advance, the method could be used selectively rather than universally.

Load-bearing premise

The Inner Iteration Finder reliably selects rotation counts that maximize marked-subspace amplitude so the resulting biased superposition improves the outer global Amplitude Amplification performance.

What would settle it

Simulate both the nested protocol and baseline GAS on a larger collection of knapsack instances; if the nested version does not show lower total quantum cost to reach a target solution quality on the reported subset or on average, the performance claim does not hold.

Figures

Figures reproduced from arXiv: 2604.05776 by Laurin Demmler, Maximilian Hess.

Figure 1
Figure 1. Figure 1: The action of including or excluding a single item in the superposition [PITH_FULL_IMAGE:figures/full_fig_p004_1.png] view at source ↗
Figure 2
Figure 2. Figure 2: The average of the relative cost differences for improving the greedy [PITH_FULL_IMAGE:figures/full_fig_p007_2.png] view at source ↗
Figure 3
Figure 3. Figure 3: The relative cost improvement of the nested approach is plotted over [PITH_FULL_IMAGE:figures/full_fig_p008_3.png] view at source ↗
Figure 4
Figure 4. Figure 4: The optimality with respect to the greedy solution is shown for the [PITH_FULL_IMAGE:figures/full_fig_p008_4.png] view at source ↗
Figure 5
Figure 5. Figure 5: The average of the relative cost differences for improving the greedy [PITH_FULL_IMAGE:figures/full_fig_p010_5.png] view at source ↗
Figure 6
Figure 6. Figure 6: The relative cost improvement of the nested approach is plotted over [PITH_FULL_IMAGE:figures/full_fig_p011_6.png] view at source ↗
read the original abstract

Amplitude Amplification offers a provable speedup for search problems, which is leveraged in combinatorial optimization by Grover Adaptive Search (GAS). The protocol demands deep circuits that are challenging with regards to NISQ capabilities. We propose a nested Amplitude Amplification protocol for the binary knapsack problem that splits the decision tree at a tunable depth, performing a partial amplification on the first variables before executing a global GAS on the full search space. The partial amplification is implemented by an Inner Iteration Finder that selects the rotation count maximizing marked-subspace amplitude. The resulting biased superposition serves as the initial state for the outer Amplitude Amplification. Using the Quantum Tree Generator for feasible-state preparation and an efficient classical amplitude-tracking scheme, we simulate the protocol on knapsack instances of sizes intractable by statevector simulation. Our results show that the nested approach reduces the cost of improving an incumbent solution compared to baseline GAS, particularly for a specific subset of knapsack instances. As combinatorial problems in domains such as semiconductor supply-chain planning grow in scale, methods that reduce circuit cost are an important step toward eventual quantum advantage for such applications.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, simulated authors' rebuttal, and a circularity audit. Tearing a paper down is the easy half of reading it; the pith above is the substance, this is the friction.

Referee Report

2 major / 2 minor

Summary. The paper proposes a nested amplitude amplification protocol for the binary knapsack problem. It splits the decision tree at a tunable depth, uses an Inner Iteration Finder (with classical amplitude-tracking) to select rotation counts that maximize marked-subspace amplitude for a partial amplification on initial variables, and feeds the resulting biased superposition as the initial state into an outer global Grover Adaptive Search (GAS). Simulations enabled by the Quantum Tree Generator for feasible-state preparation on instances too large for statevector methods report that the nested protocol reduces the cost of improving an incumbent solution relative to baseline GAS, especially on a subset of knapsack instances.

Significance. If the reported cost reductions are reproducible and attributable to the biased initial state rather than other implementation details, the work could provide a practical route to lowering circuit depth and iteration counts in quantum combinatorial optimization, which is relevant for scaling to applications such as supply-chain planning. The classical amplitude-tracking scheme that permits simulation beyond statevector limits is a methodological strength that allows evaluation on realistically sized instances.

major comments (2)
  1. [Results] The central claim that the nested protocol reduces cost versus baseline GAS rests on overall simulation outcomes, yet the manuscript provides no isolated comparison of outer GAS trajectories (marked amplitude growth per iteration or required iteration count) when starting from the biased superposition versus a uniform superposition for the same oracles and instances. This verification is load-bearing for attributing any improvement to the Inner Iteration Finder.
  2. [Methods (Inner Iteration Finder)] The description of the Inner Iteration Finder and its classical amplitude-tracking scheme does not include sufficient detail on how rotation counts are selected when multiple local maxima exist or on numerical stability for large partial trees; without this, it is not possible to confirm that the selected counts reliably maximize marked-subspace amplitude and produce an effective biased initial state.
minor comments (2)
  1. [Abstract and Results] The abstract and results text refer to 'a specific subset of knapsack instances' without stating the selection criteria, total number of instances tested, or size range, which hinders assessment of the generality of the reported improvement.
  2. [Protocol Description] The tunable depth parameter is introduced without an explicit range, selection heuristic, or sensitivity analysis, leaving unclear how the splitting point is chosen in practice.

Simulated Author's Rebuttal

2 responses · 0 unresolved

We thank the referee for their constructive feedback on our manuscript. We have carefully considered the major comments and provide point-by-point responses below. Where revisions are needed, we have updated the manuscript accordingly.

read point-by-point responses
  1. Referee: [Results] The central claim that the nested protocol reduces cost versus baseline GAS rests on overall simulation outcomes, yet the manuscript provides no isolated comparison of outer GAS trajectories (marked amplitude growth per iteration or required iteration count) when starting from the biased superposition versus a uniform superposition for the same oracles and instances. This verification is load-bearing for attributing any improvement to the Inner Iteration Finder.

    Authors: We agree that isolating the effect of the biased initial state on the outer GAS performance is important for rigorously attributing the observed cost reductions. In the revised manuscript, we have added a dedicated subsection in the Results section that compares the outer GAS trajectories starting from the biased superposition produced by the Inner Iteration Finder versus a uniform superposition. Specifically, we plot the marked-subspace amplitude growth per iteration and the number of iterations required to reach a target amplitude for representative knapsack instances. These comparisons confirm that the biased state leads to faster amplitude growth and fewer iterations, supporting the central claim. revision: yes

  2. Referee: [Methods (Inner Iteration Finder)] The description of the Inner Iteration Finder and its classical amplitude-tracking scheme does not include sufficient detail on how rotation counts are selected when multiple local maxima exist or on numerical stability for large partial trees; without this, it is not possible to confirm that the selected counts reliably maximize marked-subspace amplitude and produce an effective biased initial state.

    Authors: We thank the referee for highlighting this gap in the methodological description. In the revised manuscript, we have expanded the description of the Inner Iteration Finder in the Methods section. Regarding the selection of rotation counts when multiple local maxima exist, the algorithm evaluates the marked-subspace amplitude for each possible rotation count up to the theoretical maximum and selects the count corresponding to the global maximum amplitude. In cases of ties, it chooses the smallest rotation count to minimize circuit depth. For numerical stability with large partial trees, we employ a recursive amplitude-tracking approach that avoids direct matrix exponentiation by updating amplitudes iteratively using the known rotation formulas, with floating-point precision maintained through double-precision arithmetic. We have also included pseudocode for the Inner Iteration Finder procedure to clarify the implementation. revision: yes

Circularity Check

0 steps flagged

No circularity: novel protocol evaluated via independent simulation

full rationale

The paper defines a new nested amplitude amplification construction that splits the decision tree, uses an Inner Iteration Finder (with classical amplitude tracking) to produce a biased initial state, and then applies outer GAS. All performance claims are obtained from explicit simulation of this defined protocol on knapsack instances using the Quantum Tree Generator; no equation, parameter, or result is defined in terms of its own output or reduced to a self-citation chain. The derivation chain is therefore self-contained and externally falsifiable through the reported simulations.

Axiom & Free-Parameter Ledger

1 free parameters · 1 axioms · 1 invented entities

The protocol rests on standard quantum amplitude amplification principles plus newly introduced algorithmic components and one tunable parameter; no independent evidence for the new components is provided in the abstract.

free parameters (1)
  • tunable depth
    Depth at which the decision tree is split for partial amplification; chosen to balance inner and outer loops.
axioms (1)
  • standard math Amplitude Amplification provides a quadratic speedup for unstructured search problems
    Foundational principle underlying both the inner partial amplification and the outer global GAS.
invented entities (1)
  • Inner Iteration Finder no independent evidence
    purpose: Selects the rotation count that maximizes marked-subspace amplitude for the partial amplification step
    New component introduced to implement the inner amplification; no independent evidence supplied.

pith-pipeline@v0.9.0 · 5483 in / 1446 out tokens · 68534 ms · 2026-05-10T18:51:57.090709+00:00 · methodology

discussion (0)

Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.

Reference graph

Works this paper leans on

48 extracted references · 48 canonical work pages · 1 internal anchor

  1. [1]

    A knapsack problem as a tool to solve the production planning problem in small foundries,

    V . C. Camargo, L. Mattiolli, and F. M. Toledo, “A knapsack problem as a tool to solve the production planning problem in small foundries,” Computers & Operations Research, vol. 39, no. 1, pp. 86–92, 2012

  2. [2]

    Op- timal scheduling of manufacturing processes across multiple production lines by polynomial optimization and bagged bounded binary knapsack,

    A. Legarretaetxebarria, M. Quartulli, I. Olaizola, and M. Serrano, “Op- timal scheduling of manufacturing processes across multiple production lines by polynomial optimization and bagged bounded binary knapsack,” International Journal on Interactive Design and Manufacturing (IJI- DeM), vol. 11, no. 1, pp. 83–91, 2017

  3. [3]

    The global supply chain is our new fab: Integration and automation challenges,

    H. Ehm, T. Ponsignon, and T. Kaufmann, “The global supply chain is our new fab: Integration and automation challenges,” in2011 IEEE/SEMI Advanced Semiconductor Manufacturing Conference. IEEE, 2011, pp. 1–6

  4. [4]

    Automated and optimized lot-to-order matching in 300 mm semicon- ductor facilities,

    C. Flechsig, J. Lohmer, R. Lasch, B. Zettler, G. Scheider, and D. Eberts, “Automated and optimized lot-to-order matching in 300 mm semicon- ductor facilities,” in2021 32nd Annual SEMI Advanced Semiconductor Manufacturing Conference (ASMC). IEEE, 2021, pp. 1–6

  5. [5]

    Where are the hard knapsack problems?

    D. Pisinger, “Where are the hard knapsack problems?”Computers & Operations Research, vol. 32, no. 9, pp. 2271–2284, 2005

  6. [7]

    Ibm releases first-ever 1,000-qubit quantum chip,

    D. Castelvecchiet al., “Ibm releases first-ever 1,000-qubit quantum chip,”Nature, vol. 624, no. 7991, pp. 238–238, 2023

  7. [8]

    Suppressing quantum errors by scaling a surface code logical qubit,

    G. Q. AI, “Suppressing quantum errors by scaling a surface code logical qubit,”Nature, vol. 614, no. 7949, pp. 676–681, 2023

  8. [9]

    Quantum approximate optimization algo- rithm (qaoa),

    R. Fakhimi and H. Validi, “Quantum approximate optimization algo- rithm (qaoa),” inEncyclopedia of Optimization. Springer, 2023, pp. 1–7

  9. [10]

    Vqe method: a short survey and recent developments,

    D. A. Fedorov, B. Peng, N. Govind, and Y . Alexeev, “Vqe method: a short survey and recent developments,”Materials Theory, vol. 6, no. 1, p. 2, 2022

  10. [11]

    Quantum annealing: A new method for minimizing multidimensional functions,

    A. Finnila, M. Gomez, C. Sebenik, C. Stenson, and J. Doll, “Quantum annealing: A new method for minimizing multidimensional functions,” Chemical Physics Letters, vol. 219, no. 5, pp. 343–348, 1994. [Online]. Available: https://www.sciencedirect.com/science/article/pii/ 0009261494001170

  11. [12]

    Evidence of scaling advantage for the quantum approximate optimization algorithm on a classically intractable problem,

    R. Shaydulin, C. Li, S. Chakrabarti, M. DeCross, D. Herman, N. Kumar, J. Larson, D. Lykov, P. Minssen, Y . Sunet al., “Evidence of scaling advantage for the quantum approximate optimization algorithm on a classically intractable problem,”Science Advances, vol. 10, no. 22, p. eadm6761, 2024

  12. [13]

    Scaling advantage in approximate optimization with quantum annealing,

    H. Munoz-Bauza and D. Lidar, “Scaling advantage in approximate optimization with quantum annealing,”Physical Review Letters, vol. 134, no. 16, p. 160601, 2025

  13. [14]

    A fast quantum mechanical algorithm for database search,

    L. K. Grover, “A fast quantum mechanical algorithm for database search,” inProceedings of the twenty-eighth annual ACM symposium on Theory of computing, 1996, pp. 212–219

  14. [15]

    Quantum Amplitude Amplification and Estimation

    G. Brassard, P. Hoyer, M. Mosca, and A. Tapp, “Quantum amplitude amplification and estimation,”arXiv preprint quant-ph/0005055, 2000

  15. [16]

    Grover adaptive search for constrained polynomial binary optimization,

    A. Gilliam, S. Woerner, and C. Gonciulea, “Grover adaptive search for constrained polynomial binary optimization,”Quantum, vol. 5, p. 428, 2021

  16. [17]

    Simulating quantum circuits using tree tensor networks,

    P. Seitz, I. Medina, E. Cruz, Q. Huang, and C. B. Mendl, “Simulating quantum circuits using tree tensor networks,”Quantum, vol. 7, p. 964, 2023

  17. [18]

    Tensor networks for quantum computing,

    A. Berezutskii, M. Liu, A. Acharya, R. Ellerbrock, J. Gray, R. Haghshenas, Z. He, A. Khan, V . Kuzmin, D. Lyakhet al., “Tensor networks for quantum computing,”Nature Reviews Physics, vol. 7, no. 10, pp. 581–593, 2025

  18. [19]

    Simulating quantum computation by contract- ing tensor networks,

    I. L. Markov and Y . Shi, “Simulating quantum computation by contract- ing tensor networks,”SIAM Journal on Computing, vol. 38, no. 3, pp. 963–981, 2008

  19. [20]

    Implementation of efficient quantum search algorithms on nisq computers,

    K. Zhang, P. Rao, K. Yu, H. Lim, and V . Korepin, “Implementation of efficient quantum search algorithms on nisq computers,”Quantum Information Processing, vol. 20, no. 7, p. 233, 2021

  20. [21]

    Grover Adaptive Search with Problem-Specific State Preparation,

    M. Hess, L. Palackal, A. Awasthi, P. J. Eder, M. Schnaus, L. Demmler, K. Wintersperger, and J. Doetsch, “Grover adaptive search with problem- specific state preparation,”arXiv preprint arXiv:2602.08418, 2026

  21. [22]

    Quantum search with advice,

    A. Montanaro, “Quantum search with advice,” inConference on Quan- tum Computation, Communication, and Cryptography. Springer, 2010, pp. 77–93

  22. [23]

    A quantum algorithm for the solution of the 0-1 knapsack problem,

    S. Wilkening, A.-I. Lefterovici, L. Binkowski, M. Perk, S. Fekete, and T. J. Osborne, “A quantum algorithm for the solution of the 0-1 knapsack problem,”arXiv preprint arXiv:2310.06623, 2023

  23. [24]

    Quantum tree generator improves qaoa state-of-the-art for the knap- sack problem,

    P. J. Christiansen, L. Binkowski, D. Ramacciotti, and S. Wilkening, “Quantum tree generator improves qaoa state-of-the-art for the knap- sack problem,” in2025 IEEE International Conference on Quantum Computing and Engineering (QCE), vol. 1. IEEE, 2025, pp. 1–10

  24. [25]

    Nested quantum search and structured problems,

    N. J. Cerf, L. K. Grover, and C. P. Williams, “Nested quantum search and structured problems,”Physical Review A, vol. 61, no. 3, p. 032303, 2000

  25. [26]

    Nested grover’s algorithm for tree search,

    A. Wichert, “Nested grover’s algorithm for tree search,”Entropy, vol. 28, no. 1, p. 24, 2025

  26. [27]

    Nested quantum walks with quantum data structures,

    S. Jeffery, R. Kothari, and F. Magniez, “Nested quantum walks with quantum data structures,” inProceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms. SIAM, 2013, pp. 1474– 1485

  27. [28]

    On the partition of numbers,

    G. B. Mathews, “On the partition of numbers,”Proceedings of the London Mathematical Society, vol. 1, no. 1, pp. 486–490, 1896

  28. [29]

    R. M. Karp,Reducibility among Combinatorial Problems. Boston, MA: Springer US, 1972, pp. 85–103

  29. [30]

    Knapsack problems,

    D. Pisinger and P. Toth, “Knapsack problems,” inHandbook of combi- natorial optimization: volume1–3. Springer, 1998, pp. 299–428

  30. [31]

    Introduction to np- completeness of knapsack problems,

    H. Kellerer, U. Pferschy, and D. Pisinger, “Introduction to np- completeness of knapsack problems,” inKnapsack problems. Springer, 2004, pp. 483–493

  31. [32]

    Algorithms for knapsack problems,

    S. Martello and P. Toth, “Algorithms for knapsack problems,”North- Holland Mathematics Studies, vol. 132, pp. 213–257, 1987

  32. [33]

    Quantum optimization heuristics with an application to knapsack problems,

    W. Van Dam, K. Eldefrawy, N. Genise, and N. Parham, “Quantum optimization heuristics with an application to knapsack problems,” in2021 IEEE International Conference on Quantum Computing and Engineering (QCE). IEEE, 2021, pp. 160–170

  33. [34]

    Quantum computing techniques for multi-knapsack problems,

    A. Awasthi, F. B ¨ar, J. Doetsch, H. Ehm, M. Erdmann, M. Hess, J. Klepsch, P. A. Limacher, A. Luckow, C. Niedermeieret al., “Quantum computing techniques for multi-knapsack problems,” inScience and information conference. Springer, 2023, pp. 264–284

  34. [35]

    Optimal solving of a binary knapsack problem on a d-wave quantum machine and its implementation in production systems,

    W. Bo ˙zejko, A. Burduk, J. Pempera, M. Uchro ´nski, and M. Wodecki, “Optimal solving of a binary knapsack problem on a d-wave quantum machine and its implementation in production systems,”Annals of Operations Research, pp. 1–16, 2024

  35. [36]

    arXiv preprint arXiv:2504.19934

    R. S. d. Carmo, M. Santana, F. F. Fanchini, V . H. C. de Albuquerque, and J. P. Papa, “Warm-starting qaoa with xy mixers: A novel approach for quantum-enhanced vehicle routing optimization,”arXiv preprint arXiv:2504.19934, 2025

  36. [37]

    Tight bounds on quan- tum searching,

    M. Boyer, G. Brassard, P. Høyer, and A. Tapp, “Tight bounds on quan- tum searching,”Fortschritte der Physik: Progress of Physics, vol. 46, no. 4-5, pp. 493–505, 1998

  37. [38]

    The use of confidence or fiducial limits illustrated in the case of the binomial,

    C. J. Clopper and E. S. Pearson, “The use of confidence or fiducial limits illustrated in the case of the binomial,”Biometrika, vol. 26, no. 4, pp. 404–413, 1934

  38. [39]

    Current numbers of qubits and their uses,

    T. Ichikawa, H. Hakoshima, K. Inui, K. Ito, R. Matsuda, K. Mitarai, K. Miyamoto, W. Mizukami, K. Mizuta, T. Moriet al., “Current numbers of qubits and their uses,”Nature Reviews Physics, vol. 6, no. 6, pp. 345– 347, 2024

  39. [40]

    Solving large-scale linear systems of equations by a quantum hybrid algorithm,

    M. Perelshtein, A. Pakhomchik, A. Melnikov, A. Novikov, A. Glatz, G. Paraoanu, V . Vinokur, and G. Lesovik, “Solving large-scale linear systems of equations by a quantum hybrid algorithm,”Annalen der Physik, vol. 534, no. 7, p. 2200082, 2022

  40. [41]

    Constrained Quantum Optimization at Utility Scale: Application to the Knapsack Problem,

    N. Mohseni, J.-P. Houle, I. Shehzad, G. Cortiana, C. O’Meara, and A. B. Watts, “Constrained quantum optimization at utility scale: Application to the knapsack problem,”arXiv preprint arXiv:2603.00260, 2026

  41. [42]

    Quantum hardware devices (qhds): opportunities and challenges,

    A. Oukaira, “Quantum hardware devices (qhds): opportunities and challenges,”IEEE Access, 2025

  42. [43]

    Scaleqsim: Highly scalable quantum circuit simulation framework for exascale hpc systems,

    C. Kim, E. Sohn, S. Kim, A. Sim, K. Wu, H. Tang, Y . Son, and S. Kim, “Scaleqsim: Highly scalable quantum circuit simulation framework for exascale hpc systems,”Proceedings of the ACM on Measurement and Analysis of Computing Systems, vol. 9, no. 3, pp. 1–28, 2025

  43. [44]

    Gurobi Optimizer Reference Manual,

    Gurobi Optimization, LLC, “Gurobi Optimizer Reference Manual,”

  44. [45]

    Available: https://www.gurobi.com

    [Online]. Available: https://www.gurobi.com

  45. [46]

    Core problems in knapsack algorithms,

    D. Pisinger, “Core problems in knapsack algorithms,”Operations Re- search, vol. 47, no. 4, pp. 570–575, 1999. APPENDIXA ORACLECONSTRUCTION Designing the oracle for binary knapsack problems proves to be straightforward, but should nevertheless be described here in some detail. As described in (13), the oracles both simply compare whether the value encoded ...

  46. [47]

    If˜p[j] = 0and ˜T[j] = 1, Thenp < T,

  47. [48]

    If˜p[j] = 1and ˜T[j]= 0, Thenp > T,

  48. [49]

    Since we only care about case 2, we control the phase operation on all qubitsj > kof the profit register, where ˜Tk = 0, in such a way that˜p j = ˜Tj∀j > kand˜p k = 1

    If no suchjis found, Thenp=T. Since we only care about case 2, we control the phase operation on all qubitsj > kof the profit register, where ˜Tk = 0, in such a way that˜p j = ˜Tj∀j > kand˜p k = 1. The cost of this oracle is of the order ofO(log 2T). The gate that is applied if the comparison is successful is an X-gate on a prepared flag register in initi...