This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Quantum search in a dictionary based on fingerprinting-hashing

Farid Ablayev    Nailya Salikhova    Marat Ablayev
Abstract

In this work, we present a quantum query algorithm for searching a word of length mm in an unsorted dictionary of size nn. The algorithm uses O(n)O(\sqrt{n}) queries (Grover operators), like previously known algorithms.

What is new is that the algorithm is based on the quantum fingerprinting-hashing technique, which (a) provides a first level of amplitude amplification before applying the sequence of Grover amplitude amplification operators and (b) makes the algorithm more efficient in terms of memory use — it requires O(logn+logm)O(\log n+\log m) qubits. Note that previously developed algorithms by other researchers without hashing require O(logn+m)O(\log n+m) qubits.

1 Introduction

The problems of information retrieval in databases are well known in theoretical and applied computer science. The problem is an enumeration problem, which classically requires an enumeration of all possible options. The well-known classical unsorted list search is a sequential search query algorithm. Such algorithms, for our convenience, can be described as follows. We need to solve a Boolean equation f(x)=1f(x)=1, where ff is a Boolean function on xVx\in V, V={w0,,wn1:wi{0,1}m}V=\{w_{0},\dots,w_{n-1}:w_{i}\in\{0,1\}^{m}\}. It is assumed that the function ff is given as an oracle. In the query model, one can ask the oracle only a question like: “what is ff given xx?”, and use the answer in further computations. The number of queries is a characteristic of the complexity (time) of such a query algorithm.

The above problem of solving the equation f(x)=1f(x)=1 is a general form of the iteration problem, which classically requires successive iteration over all elements of VV for the case where VV is unsorted. The quantum algorithm finds some root of the equation using π4|V|\frac{\pi}{4}\sqrt{|V|} calls to the function ff.

Such a quantum search, which accelerates search by a quadratic factor compared to classical algorithms, was proposed by L. Grover in 1996 [1] and has been modified in a number of subsequent works (see, the paper [2], lecture notes [3] and the book [4] for more information and citations). The development of quantum algorithms for information retrieval in databases continues. For example, see reviews of [5, 6].

Search for a word in the text.

Searching for a word in a text, as a task of searching for information in a database, has been considered in many works and has some specific features. First, the oracle fwf_{w}, defined by the task, is used to find the occurrence of the word ww in the dictionary VV. Namely, fw(x)=1f_{w}(x)=1 if and only if w=xw=x. Secondly, for searching for a word in a text to speed up search in the 1970s and 1980s, hashing-based algorithms were proposed. The Knuth-Morris-Pratt (KMP) algorithm [7] and the Rabin-Karp algorithm [8] solve the problem in linear number of comparisons (in linear time), with O(n+m)O(n+m) complexity.

It is clear that quantum algorithms for this task, based on Grover’s idea, provide a quadratic saving in the number of calls to the oracle. Note that to describe Grover’s algorithm, we first need to specify an efficient oracle circuit for fwf_{w} for such algorithm. A number of similar studies in recent decades in the field of developing algorithms for searching for occurrences of a word ww in a text VV (in an unsorted dictionary VV constructed from the text) were devoted to the construction of efficient oracles fwf_{w}. A number of constructions of such oracles in terms of quantum circuits were proposed and the complexity of such circuits was studied: Practical Implementation of a Quantum String Matching Algorithm [9], Algorithm of Ramesh, Hariharan, and Vinay [10] (2003). Montanaro [11] (2017). Soni and Rasool [12] (2020).

Note that all of these listed results require O(logn+m)O(\log n+m) qubits to search for a word ww of length mm in a dictionary VV of size nn.

The idea of using hashing methods for quantum information retrieval in an unordered database was realized in 2024 [13]. In [13], a hybrid classical-quantum (probabilistic-quantum) algorithm is proposed for searching a word ww of length mm in a dictionary VV of size nn.

The key idea of the hybrid classical-quantum algorithm is as follows: (a) choose a universal hash family \cal F of hash functions, (b) uniformly randomly choose a hash function hh\in{\cal F}, (c) hash the elements of VV with the hash function hh, and (d) apply the quantum amplification technique to search for the hash image h(w)h(w) of the word ww in the hashed dictionary h(V)h(V). It has been proven that using hashing methods can exponentially reduce the number of qubits required. Specifically, logn+logm\log n+\log m qubits are sufficient when using hashing, instead of logn+m\log n+m qubits in algorithms without hashing.

Quantum fingerprinting-hashing.

The quantum fingerprinting-hashing technique (quantum fingerprinting-hashing technique or quantum hashing technique for short) is a key component of the algorithms considered in this paper. The quantum fingerprinting was formalized as a method of quantum information compression in 2001 by Burman et al. [14]. The quantum fingerprinting function presented in [14] was built on error-correcting codes. Various designs of quantum hash functions and their cryptographic properties were discussed in [15]. See also the book [16]. The quantum hash function ψ:Σm(2)s\psi:\Sigma^{m}\to({\mathcal{H}}^{2})^{\otimes s} maps words of length mm to ss qubit states. Such a map has the following important (for our algorithms) properties: (a) the map is contractive, i.e. s<ms<m (for example for fingerprinting function [14] s=logms=\log m), (b) the resulting quantum states are highly distinguishable, and (c) the function ψ\psi is invertible.

Our contribution.

In this work, we make a further step in applying hashing technique for finding a specific word of length mm from an unordered collection (vocabulary) of nn words, each of which has length mm.

The quantum search algorithm works as follows. The vocabulary VV is represented as a quantum state |V,ψ{\left|{V,\psi}\right\rangle}, whose elements are hashed by the quantum hash function ψ\psi. The search for an occurrence of the word ww is performed in two stages as follows. In the first stage, the quantum state is quantum-parallel inverted by the mapping ψ1(w)\psi^{-1}(w) determined by ww. This stage provides the first level of amplitude amplification. Then, in the second stage, a known sequence of Grover amplitude amplification operators is applied. Finally, the resulting quantum state is measured, and the algorithm produces the result.

The high probability of the correct result is based on properties (b) and (c) of the quantum hash function — they provides a first level of amplitude amplification before applying the sequence of Grover amplitude amplification operators

The quantum hash function is memory efficient: searching for a word ww of length mm in a dictionary VV of size nn requires O(logn+s)O(\log n+s) qubits. The number of oracle calls is O(n)O(\sqrt{n}).

Note that, as in the previous work [13], we present the algorithm in terms of the quantum query model. This level of representation is sufficient to demonstrate the efficiency of memory use by the algorithm. We leave the issues of efficient implementation of the oracle scheme for further consideration.

The paper is organized as follows. In Section 2, we describe the quantum fingerprinting function and the necessary operators for its further implementation. In Section 3, we present a dictionary search algorithm based on the quantum fingerprinting function in technical detail. In Section 4, we formulate and prove theorems analyzing the operation of the algorithm and its complexity characteristics.

In Section 5.2, we generalize the specific construction of the algorithm from Section 3 to the general case of constructing 𝒜{\cal A} algorithms based on the quantum hashing technique in terms of an arbitrary ϵ\epsilon-collision-resistant quantum hash function ψ\psi. More precisely, in Section 5 we present a group of algorithms that can differ depending on which quantum hash function (see Section 5.1) we use.

In Section 6, we present its characteristics. We conclude Section 6 with a discussion of the features of the algorithm.

2 Quantum fingerprinting-hashing

The quantum function ψ\psi, defined in this section, is considered in the paper [17]. The authors called their function “quantum fingerprinting function”. The ψ\psi function is defined based on a binary error-correcting code.

Error Correcting Codes.

The error-correcting code is defined by the mapping

E:ΣmΣlE:\Sigma^{m}\to\Sigma^{l}

with the following condition: for any different words

w,wΣm,w,w^{\prime}\in\Sigma^{m},

their maps

E(w),E(w)ΣlE(w),E(w^{\prime})\in\Sigma^{l}

satisfy the condition that the Hamming distance d(E(w),E(w))d(E(w),E(w^{\prime})) between them is at least dd.

Such a code EE is called an (l,m,d)(l,m,d)-code. A binary code is one in which Σ={0,1}\Sigma=\{0,1\}.

For arbitrary d>1d>1, there exists an (l,m,d)(l,m,d)-error-correcting code EE with l=cml=cm, c>1c>1.

Function ψE\psi_{E} generated by error correcting code.

The function ψE\psi_{E} generated by the binary (l,m,d)(l,m,d)-error-correcting code EE defined as follows.

For s=logls=\log l the function

ψE:{0,1}m(2)(s+1)\psi_{E}:\{0,1\}^{m}\to({\cal H}^{2})^{\otimes{(s+1)}}

is defined by the condition

|ψE(w)=12si=02s1|i|Ei(w),{\left|{\psi_{E}(w)}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(w)}\right\rangle}, (1)

where Ei(w)E_{i}(w) is the ii-th bit of the codeword E(w)E(w).

In content: a word ww with length mm is mapped to a (logm+const)(\log m+const)-qubit quantum state |ψE(w){\left|{\psi_{E}(w)}\right\rangle}. This state |ψE(w){\left|{\psi_{E}(w)}\right\rangle} represents the encoding E(w)E(w) of the original word ww. The state |ψE(w){\left|{\psi_{E}(w)}\right\rangle} is a superposition over s+1=logm+consts+1=\log m+const qubits.

Realization of the quantum fingerprinting function ψE\psi_{E}.

Let |𝟎=|0(s+1){\left|{\bf 0}\right\rangle}={\left|{0}\right\rangle}^{\otimes{(s+1)}}.

The transformation

UψE:|𝟎𝑤(2)(s+1)U_{\psi_{E}}:{\left|{\bf 0}\right\rangle}\xrightarrow{w}({\mathcal{H}}^{2})^{\otimes(s+1)} (2)

acts on (s+1)(s+1)-qubits. We define the transformation UψE(w)=UE(w)(HsI)U_{\psi_{E}}(w)=U_{E}(w)(H^{\otimes s}\otimes I). It is defined by a 2s+1×2s+12^{s+1}\times 2^{s+1} unitary matrix. It is a composition of the Hadamard transformation HsH^{\otimes s}, the identity transformation II and the transformation UEU_{E}. It is convenient to define the UEU_{E} transformation by describing its action on the 2s+12^{s+1} vectors |k{\left|{k}\right\rangle} of the computational basis B={(0,,1),,(1,,0)}B=\{(0,\dots,1),\dots,(1,\dots,0)\} of the (2)(s+1)({\mathcal{H}}^{2})^{\otimes(s+1)} space. The arguments of the transformation UEU_{E} are words w{0,1}mw\in\{0,1\}^{m}:

UE:|k𝑤|k.{U_{E}}:{\left|{k}\right\rangle}\xrightarrow{w}{\left|{k^{\prime}}\right\rangle}.

UE{U_{E}} is defined by the codeword E(w)E(w), which has a length of l=2sl=2^{s}. In terms of content, the transformation UEU_{E} “changes” the last (s+1)(s+1)-st qubit |a{\left|{a}\right\rangle} in the basis state |k=|i|a{\left|{k}\right\rangle}={\left|{i}\right\rangle}\otimes{\left|{a}\right\rangle} to |k=|i|aEi(w){\left|{k^{\prime}}\right\rangle}={\left|{i}\right\rangle}\otimes{\left|{a\oplus E_{i}(w)}\right\rangle}.

Property 1

Transformation UψE(w)=UE(w)(HsI)U_{\psi_{E}}(w)={U_{E}}(w)(H^{\otimes s}\otimes I) defines the function ψE\psi_{E}. Namely, for any word w{0,1}mw\in\{0,1\}^{m} the following is true

|ψE(w)=UψE(w)|𝟎.{\left|{\psi_{E}(w)}\right\rangle}=U_{\psi_{E}}(w){\left|{\bf 0}\right\rangle}.

Proof. The transformation HsIH^{\otimes s}\otimes I, transforms the basis state |0(s+1){\left|{0}\right\rangle}^{\otimes{(s+1)}} into an equal-amplitude superposition of the first ss qubits (Hadamard transformation HsH^{\otimes s} of the first ss qubits)

|𝟎=|0(s+1)HsI|ψ0=12si=02s1|i|0.{\left|{\bf 0}\right\rangle}={\left|{0}\right\rangle}^{\otimes{(s+1)}}\xrightarrow{H^{\otimes s}\otimes I}{\left|{\psi_{0}}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum\limits_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}\otimes{\left|{0}\right\rangle}.

Next, the transformation UE(w){U_{E}}(w) transforms the state |ψ0{\left|{\psi_{0}}\right\rangle} to the state |ψE(w){\left|{\psi_{E}(w)}\right\rangle}:

12si=02s1|i|0UE(w)|ψE(w)=12si=02s1|i|0Ei(w)=12si=02s1|i|Ei(w).\frac{1}{\sqrt{2^{s}}}\sum\limits_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}\otimes{\left|{0}\right\rangle}\xrightarrow{{U_{E}}(w)}{\left|{\psi_{E}(w)}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{0\oplus E_{i}(w)}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(w)}\right\rangle}.

\Box
Next, we also need the transformation

UψE1:(2)(s+1)𝑤(2)(s+1),U^{-1}_{\psi_{E}}:({\mathcal{H}}^{2})^{\otimes(s+1)}\xrightarrow{w}({\mathcal{H}}^{2})^{\otimes(s+1)},

given by words w{0,1}mw\in\{0,1\}^{m}, and it is the inverse of the transformation UψEU_{\psi_{E}} in the following sense

UψE1:|ψE(w)𝑤|𝟎.U^{-1}_{\psi_{E}}:{\left|{\psi_{E}(w)}\right\rangle}\xrightarrow{w}{\left|{\bf 0}\right\rangle}.
Property 2

The transformation UψE1(w)=(HsI)UE(w)U^{-1}_{\psi_{E}}(w)=(H^{\otimes s}\otimes I)\otimes U_{E}(w) is the inverse of the transformation UψE(w)U_{\psi_{E}}(w).

Proof. Indeed, for an arbitrary word w{0,1}mw\in\{0,1\}^{m}, for a (s+1)(s+1)-qubit state |ψE(w){\left|{\psi_{E}(w)}\right\rangle} it is true that UψE1(w)|ψE(w)=|𝟎U^{-1}_{\psi_{E}}(w){\left|{\psi_{E}(w)}\right\rangle}={\left|{\bf 0}\right\rangle}:

12si=02s1|i|Ei(w)UE(w)12si=02s1|i|Ei(w)Ei(w)=12si=02s1|i|0HsI|0s+1.\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(w)}\right\rangle}\xrightarrow{U_{E}(w)}\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(w)\oplus E_{i}(w)}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum\limits_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}\otimes{\left|{0}\right\rangle}\xrightarrow{H^{\otimes s}\otimes I}{\left|{0}\right\rangle}^{\otimes{s+1}}.

\Box

3 Algorithm 𝒜{\cal A}.

Problem

Given an unordered set VV composed of nn binary sequences wkw_{k}, each of length mm.

V={w0,,wn1},V=\{w_{0},\dots,w_{n-1}\},

where wk={0,1}mw_{k}=\{0,1\}^{m} for 0kn10\leq k\leq n-1.

Given a binary string ww of length mm, where m<nm<n. It is required to find the index of the occurrence of ww in the sequence VV. Namely, it is required to find an index kk such that w=wkw=w_{k}.

Note that this is essentially a database search problem.

Algorithm

The algorithm 𝒜{\cal A} consists of two parts:

  1. 1.

    First part: preparing the initial state based on the sequence VV.

  2. 2.

    Second part: reading the search word ww and searching for its position in the sequence.

Note that the algorithm 𝒜{\cal A} takes different input data in the two parts: VV and ww, respectively.

Description of the algorithm 𝒜{\cal A}.

Input data:

For the first part: the sequence V={w0,,wn1}V=\{w_{0},\dots,w_{n-1}\} of binary words with a length of mm.

For the second part: a binary string ww with length mm.

Output data: The index kk, which denotes the number of an element in the sequence, such that w=wkw=w_{k}.

Thus, the algorithm 𝒜{\cal{A}} implements the mapping

𝒜:V,wk.{\cal{A}}:V,w\longmapsto k.
  1. 1.

    The first part of the algorithm (Initialization of hashed vocabulary) involves preparing the initial state |V,ψE{\left|{V,\psi_{E}}\right\rangle}.

    The initial state is

    |ψ0=1nj=0n1|j|𝟎|1.{\left|{\psi_{0}}\right\rangle}=\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\otimes{\left|{\bf 0}\right\rangle}\otimes{\left|{1}\right\rangle}.

    Here, |𝟎{\left|{\bf 0}\right\rangle} – is the zero state of s+1s+1 qubits. According to this sequence VV, based on the transformation UψEU_{\psi_{E}}, which defines the quantum function ψE\psi_{E}, the state |0{\left|{0}\right\rangle} is converted into the initial state:

    |V,ψE=1nj=0n1|j|ψE(wj)|1.{\left|{V,\psi_{E}}\right\rangle}=\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\otimes{\left|{\psi_{E}(w_{j})}\right\rangle}\otimes{\left|{1}\right\rangle}.

    Recall that

    |ψE(wj)=12si=02s1|i|Ei(wj),{\left|{\psi_{E}(w_{j})}\right\rangle}=\frac{1}{\sqrt{2^{s}}}\sum_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(w_{j})}\right\rangle}, (3)
  2. 2.

    The second part of the algorithm 𝒜{\cal{A}} consists of reading the searched word ww and searching for a position kk, such that w=wkw=w_{k}.

    The search procedure consists of applying the amplitude amplification method presented in the paper [2] and described in the book [4].

    • Conversion hash transformation

      The IlognUψE1(w)II^{\otimes\log{n}}\otimes U_{\psi_{E}}^{-1}(w)\otimes I operator is applied to the state |V,ψE{\left|{V,\psi_{E}}\right\rangle},

      |V,ψE,w\displaystyle{\left|{V,\psi_{E},w}\right\rangle} =\displaystyle= 1nj=0n1|j(12si=02s1|i|Ei(ωj)Ei(ω))|1\displaystyle\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\left(\frac{1}{\sqrt{2^{s}}}\sum\limits_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}{\left|{E_{i}(\omega_{j})\oplus E_{i}(\omega)}\right\rangle}\right){\left|{1}\right\rangle}
      =\displaystyle= 1nj=0n1|j(12si=02s1|i(i:Ei(ωj)=Ei(ω)|0+i:Ei(ωj)Ei(ω)|1))|1\displaystyle\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\left(\frac{1}{\sqrt{2^{s}}}\sum\limits_{i=0}^{2^{s}-1}{\left|{i}\right\rangle}\left(\sum\limits_{i:E_{i}(\omega_{j})=E_{i}(\omega)}{\left|{0}\right\rangle}+\sum\limits_{i:E_{i}(\omega_{j})\neq E_{i}(\omega)}{\left|{1}\right\rangle}\right)\right){\left|{1}\right\rangle}
      =\displaystyle= 1nj=0n1|j|ϕE(wj,w)|1,\displaystyle\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}{\left|{\phi_{E}(w_{j},w)}\right\rangle}{\left|{1}\right\rangle},

      where |ϕE(wj,w)=UψE1(w)|ψE(wj){\left|{\phi_{E}(w_{j},w)}\right\rangle}=U^{-1}_{\psi_{E}}(w){\left|{\psi_{E}(w_{j})}\right\rangle} for j{0,,n1}j\in\{0,\dots,n-1\}.

    • Amplification

      The amplification procedure of the amplitudes of basic states |j|0s+1|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}^{\otimes s+1}{\left|{1}\right\rangle} (“good states” as they are called in [4]) is applied to state |V,ψE,w{\left|{V,\psi_{E},w}\right\rangle}.

      The amplitude amplification procedure consists in the use of Grover macro steps according to the description in [4].

    • Measurement

      The first logn+s+1\log{n}+s+1 qubits of the final state are measured in a computational basis. If the last s+1s+1 qubits are all zero, then the result of measuring the first logn\log n qubits is the position of element wkw_{k}, where wk=ww_{k}=w.

3.1 Characteristics of the 𝒜{\cal A} algorithm.

The characteristics of a quantum algorithm include: the probability of error, the number of queries made to the analyzed data, and the amount of memory used.

The probability of success. We denote by Prsuccess(𝒜)Pr_{success}({\cal A}) the probability of a successful outcome of the algorithm 𝒜{\cal A}.

Query complexity. The number of queries Q(𝒜)Q({\cal A}) (the number of requests to the oracle) is the query complexity of the quantum algorithm 𝒜{\cal A}.

Memory complexity. The number S(𝒜)S({\cal A}) of used qubits is a measure of the memory complexity of quantum algorithm 𝒜{\cal A}.

4 Analysis of the 𝒜{\cal A} algorithm.

In this section, we define the theorem 2 and present its proof. The main states result is that the algorithm 𝒜{\cal A} provides the correct result quickly with high probability and low memory complexity. Informally, this result is presented in theorem 1.

Denote by Prsuccess(𝒜)Pr_{success}({\cal A}) the probability of the event that the result of algorithm 𝒜{\cal A} is a number kk, such that wk=ww_{k}=w.

Meaningfully, the algorithm 𝒜\cal A has the following characteristics.

Theorem 1

For the algorithm 𝒜{\cal A} which searches for an occurrence of an element with length mm in a sequence of nn elements, the following is true

Prsuccess(𝒜)1,Q(𝒜)=O(n) and S(𝒜)=O(logn+logm).Pr_{success}({\cal A})\approx 1,\quad Q({\cal A})=O(\sqrt{n})\quad\mbox{ and }\quad S({\cal A})=O(\log n+\log m).

The Theorem 1 is based on the following formal statement.

Theorem 2

Let c>0c>0, t=O(n)t=O(\sqrt{n}) and a=sin2((2t+1)θ)a=\sin^{2}((2t+1)\theta) , where sin(θ)(1/n,1/n+c]sin(\theta)\in\left(\sqrt{1/n},\sqrt{1/n+c}\right].

Prsuccess(𝒜)a11+c,Q(𝒜)=O(n) and S(𝒜)2logn+logm+const.Pr_{success}({\cal A})\geq a\frac{1}{1+c},\quad Q({\cal A})=O(\sqrt{n})\quad\mbox{ and }\quad S({\cal A})\leq 2\log n+\log m+const.

We present the proof of Theorem 2 in the next section. We conclude that section by demonstrating that parameters aa and cc can be selected to make Prsuccess(𝒜)Pr_{success}({\cal A}) close to 1.

4.1 Proof of the theorem 2.

In this section, we present a proof of the estimates for Theorem 2. For convenience, the evaluation of each characteristic has been presented in its own section.

4.1.1 Estimation of the probability Prsuccess(𝒜)Pr_{success}({\cal A}) of the algorithm success and query complexity Q(𝒜)Q({\cal A})

The following Property 3 is key to the assertion of the Lemma 1. This Lemma 1, in turn, is key to proving the high probability of correct operation of the algorithm.

Property 3

Let the function ψE\psi_{E} (3) generated by a binary error correcting (l,m,d)(l,m,d)-code EE with d(1ϵ)ld\geq(1-\epsilon)l for some ϵ(0,1)\epsilon\in(0,1). Then for an arbitrary pair of different words w,w{0,1}mw,w^{\prime}\in\{0,1\}^{m} the following is true

|ψE(w)|ψE(w)|ϵ.\left|\langle{\psi_{E}(w)}|{\psi_{E}(w^{\prime})}\rangle\right|\leq\epsilon.

Proof. See [17] and the book [16] for the proof. \Box

In this case, it is natural to say that the states |ψE(w){\left|{\psi_{E}(w)}\right\rangle} and |ψE(w){\left|{\psi_{E}(w^{\prime})}\right\rangle} are ϵ\epsilon-orthogonal.

Lemma 1

Let the function ψE\psi_{E} (3) generated by a binary error correcting (l,m,d)(l,m,d)-code EE with d(1ϵ)ld\geq(1-\epsilon)l for some ϵ(0,1)\epsilon\in(0,1). Then for the state |ϕE(wj,w)=UψE1(w)|ψE(wj){\left|{\phi_{E}(w_{j},w)}\right\rangle}=U^{-1}_{\psi_{E}}(w){\left|{\psi_{E}(w_{j})}\right\rangle}

|ϕE(wj,w)=α0|0+α1|1++α2l1|2s1{\left|{\phi_{E}(w_{j},w)}\right\rangle}=\alpha_{0}{\left|{0}\right\rangle}+\alpha_{1}{\left|{1}\right\rangle}+\dots+\alpha_{2^{l}-1}{\left|{2^{s}-1}\right\rangle}

the following is true. If wj=ww_{j}=w, then α0=1\alpha_{0}=1. If wjww_{j}\not=w, then α0ϵ\alpha_{0}\leq\epsilon.

Proof. The transformation UE1(w)U^{-1}_{E}(w) is the inverse of UE(w)U_{E}(w). UE1(w)U^{-1}_{E}(w) is applied to state |ψE(wj){\left|{\psi_{E}(w_{j})}\right\rangle} to get |ϕE(wj,w){\left|{\phi_{E}(w_{j},w)}\right\rangle}. Therefore, for the word wk=ww_{k}=w

|ϕE(wk,w)=|0=1|0+0|1++0|2s1.{\left|{\phi_{E}(w_{k},w)}\right\rangle}={\left|{0}\right\rangle}=1{\left|{0}\right\rangle}+0{\left|{1}\right\rangle}+\dots+0{\left|{2^{s}-1}\right\rangle}.

For all other words wj{0,1}mw_{j}\in\{0,1\}^{m}, their function values |ψE(wk){\left|{\psi_{E}(w_{k})}\right\rangle} and |ψE(wj){\left|{\psi_{E}(w_{j})}\right\rangle} are pairwise ϵ\epsilon-orthogonal (due to the Property 3).

|ψE(wk)|ψE(wj)|ϵ.\left|\langle{\psi_{E}(w_{k})}|{\psi_{E}(w_{j})}\rangle\right|\leq\epsilon.

Unitary transformation UE1(w)U^{-1}_{E}(w) of states |ψE(wk){\left|{\psi_{E}(w_{k})}\right\rangle} and |ψE(wj){\left|{\psi_{E}(w_{j})}\right\rangle} saves the scalar product. This means that all states |ϕE(wj,w)=UE1(w)|ψE(wj){\left|{\phi_{E}(w_{j},w)}\right\rangle}=U^{-1}_{E}(w){\left|{\psi_{E}(w_{j}}\right\rangle}) for wjww_{j}\not=w, wj{0,1}mw_{j}\in\{0,1\}^{m} are pairwise ϵ\epsilon-orthogonal

|ϕE(wk,w)|ϕE(wj,w)|ϵ.\left|\langle{\phi_{E}(w_{k},w)}|{\phi_{E}(w_{j},w)}\rangle\right|\leq\epsilon.

Therefore, for states

|ϕE(wj,w)=α0|0+α1|1++α2l1|2s1{\left|{\phi_{E}(w_{j},w)}\right\rangle}=\alpha_{0}{\left|{0}\right\rangle}+\alpha_{1}{\left|{1}\right\rangle}+\dots+\alpha_{2^{l}-1}{\left|{2^{s}-1}\right\rangle}

for wjww_{j}\not=w it is true that |α0|=ϵjϵ|\alpha_{0}|=\epsilon_{j}\leq\epsilon. The latter proves the statement of the lemma. \Box

Amplification.

The amplification procedure corresponds to the one presented in the article [2]. For convenience, we will follow the description and notations of the procedure in chapter 8 of the book [4].

The amplification procedure is implemented by repeatedly applying the unitary operator QQQQ to the state |V,ψE,w{\left|{V,\psi_{E},w}\right\rangle}. In the text below, for simplicity, we will use |ψ{\left|{\psi}\right\rangle} to indicate the state of |V,ψE,w{\left|{V,\psi_{E},w}\right\rangle}.

To prove the theorem, we first divide the vector |ψ{\left|{\psi}\right\rangle} into two parts |ψ0{\left|{\psi_{0}}\right\rangle} and |ψ1{\left|{\psi_{1}}\right\rangle}.

|ψ=|ψ0+|ψ1,{\left|{\psi}\right\rangle}={\left|{\psi_{0}}\right\rangle}+{\left|{\psi_{1}}\right\rangle},

which, according to the Lemma 1

|ψ0=1n(|k|0|1+j=0,jkn1ϵj|j|0|1){\left|{\psi_{0}}\right\rangle}=\frac{1}{\sqrt{n}}\left({\left|{k}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle}+\sum_{j=0,j\not=k}^{n-1}\epsilon_{j}{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle}\right) (4)

and the vector |ψ1{\left|{\psi_{1}}\right\rangle} consists of the remaining components of the state |ψ{\left|{\psi}\right\rangle}. Let’s denote

pgood=1n(1+j=0,jkn1ϵj2)and pbad=1pgood.p_{good}=\frac{1}{n}\left(1+\sum_{j=0,j\not=k}^{n-1}\epsilon_{j}^{2}\right)\quad\mbox{and }\quad p_{bad}=1-p_{good}.

pgoodp_{good} is the probability of measuring nn basic states |j|0|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle} for j{0,n1}j\in\{0,\dots n-1\}. We will call these basic states good states, and the probability of obtaining them good probability pgoodp_{good}. We will call other basic states |j|i|1{\left|{j}\right\rangle}{\left|{i}\right\rangle}{\left|{1}\right\rangle} bad states, with the probability of obtaining them being called bad probability pbadp_{bad}. We renormalize components |ψ0{\left|{\psi_{0}}\right\rangle} and |ψ1{\left|{\psi_{1}}\right\rangle} and get the following states

|ψgood=1pgood|ψ0and |ψbad=1pbad|ψ1.{\left|{\psi_{good}}\right\rangle}=\frac{1}{\sqrt{p_{good}}}{\left|{\psi_{0}}\right\rangle}\quad\mbox{and }\quad{\left|{\psi_{bad}}\right\rangle}=\frac{1}{\sqrt{p_{bad}}}{\left|{\psi_{1}}\right\rangle}. (5)

Then we can record

|ψ=pgood|ψgood+pbad|ψbad,{\left|{\psi}\right\rangle}=\sqrt{p_{good}}{\left|{\psi_{good}}\right\rangle}+\sqrt{p_{bad}}{\left|{\psi_{bad}}\right\rangle},

or

|ψ=sin(θ)|ψgood+cos(θ)|ψbad,{\left|{\psi}\right\rangle}=\sin(\theta){\left|{\psi_{good}}\right\rangle}+\cos(\theta){\left|{\psi_{bad}}\right\rangle},

where θ(0,π2)\theta\in\left(0,\frac{\pi}{2}\right) defined by equality sin2(θ)=pgood\sin^{2}(\theta)=p_{good}.

We define the search iteration operator QQ=UψUfQQ=U_{\psi}^{\perp}U_{f} as follows.

For an arbitrary real number θ\theta, the operation UfU_{f} acts as follows:

Uf(sin(θ)|ψgood+cos(θ)|ψbad)=sin(θ)|ψgood+cos(θ)|ψbadU_{f}(\sin(\theta){\left|{\psi_{good}}\right\rangle}+\cos(\theta){\left|{\psi_{bad}}\right\rangle})=-\sin(\theta){\left|{\psi_{good}}\right\rangle}+\cos(\theta){\left|{\psi_{bad}}\right\rangle}

and thus, UfU_{f} performs reflection relative to the axis defined by the vector |ψbad{\left|{\psi_{bad}}\right\rangle}.

More precisely, the operator UfU_{f} changes the amplitude sign for the basic states of the form |j|0|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle}.

Let’s denote the state

|ψ¯=cos(θ)|ψgoodsin(θ)|ψbad{\left|{\overline{\psi}}\right\rangle}=\cos(\theta){\left|{\psi_{good}}\right\rangle}-\sin(\theta){\left|{\psi_{bad}}\right\rangle}

which is orthogonal to |ψ{\left|{\psi}\right\rangle}.

{|ψgood,|ψbad}\{{\left|{\psi_{good}}\right\rangle},{\left|{\psi_{bad}}\right\rangle}\}

and

{|ψ¯,|ψ}\{{\left|{\overline{\psi}}\right\rangle},{\left|{\psi}\right\rangle}\}

are orthonormal bases for the same 2-dimensional space.

Uf|ψ=sin(θ)|ψgood+cos(θ)|ψbad=cos(2θ)|ψsin(2θ)|ψ¯U_{f}{\left|{\psi}\right\rangle}=-\sin(\theta){\left|{\psi_{good}}\right\rangle}+\cos(\theta){\left|{\psi_{bad}}\right\rangle}=\cos(2\theta){\left|{\psi}\right\rangle}-\sin(2\theta){\left|{\overline{\psi}}\right\rangle}

The operator UψU_{\psi}^{\perp} acts as follows:

Uψ(sin(θ)|ψ+cos(θ)|ψ¯)=sin(θ)|ψcos(θ)|ψ¯U_{\psi}^{\perp}(\sin(\theta){\left|{\psi}\right\rangle}+\cos(\theta){\left|{\overline{\psi}}\right\rangle})=\sin(\theta){\left|{\psi}\right\rangle}-\cos(\theta){\left|{\overline{\psi}}\right\rangle}

and thus, UψU_{\psi}^{\perp} performs reflection relative to an axis defined by a vector |ψ{\left|{\psi}\right\rangle}.

Indeed,

UψUf|ψ=Uψ(sin(θ)|ψgood+cos(θ)|ψbad)=cos(2θ)|ψ+sin(2θ)|ψ¯U_{\psi}^{\perp}U_{f}{\left|{\psi}\right\rangle}=U_{\psi}^{\perp}(-\sin(\theta){\left|{\psi_{good}}\right\rangle}+\cos(\theta){\left|{\psi_{bad}}\right\rangle})=\cos(2\theta){\left|{\psi}\right\rangle}+\sin(2\theta){\left|{\overline{\psi}}\right\rangle}

and can be described in the basis

{|ψgood,|ψbad}\{{\left|{\psi_{good}}\right\rangle},{\left|{\psi_{bad}}\right\rangle}\}

as

UψUf|ψ=sin(3θ)|ψgood+cos(3θ)|ψbadU_{\psi}^{\perp}U_{f}{\left|{\psi}\right\rangle}=\sin(3\theta){\left|{\psi_{good}}\right\rangle}+\cos(3\theta){\left|{\psi_{bad}}\right\rangle}

Repeating the application of the operator QQQQ tt once brings the initial state |ψ{\left|{\psi}\right\rangle} to

|ψt=QQt|ψ=sin((2t+1)θ)|ψgood+cos((2t+1)θ)|ψbad{\left|{\psi^{t}}\right\rangle}=QQ^{t}{\left|{\psi}\right\rangle}=\sin((2t+1)\theta){\left|{\psi_{good}}\right\rangle}+\cos((2t+1)\theta){\left|{\psi_{bad}}\right\rangle} (6)

Let a=sin2((2t+1)θ)a=\sin^{2}((2t+1)\theta). Note that for small θ\theta: sin(θ)θδ\sin(\theta)\geq\theta-\delta for small δ\delta (sin(θ)θ\sin(\theta)\approx\theta). In particular, in our case

sin(θ)=1n(1+j=0,jkn1ϵj2)\sin(\theta)=\sqrt{\frac{1}{n}\left(1+\sum_{j=0,j\not=k}^{n-1}\epsilon_{j}^{2}\right)}

and sin(θ)(1/n,1/n+c]sin(\theta)\in\left(\sqrt{1/n},\sqrt{1/n+c}\right], for small c>0c>0. We choose tt such that (2t+1)θπ2(2t+1)\theta\approx\frac{\pi}{2}, meaning tΩ(n)t\in\Omega(\sqrt{n}) (tΩ(1θ)t\in\Omega(\frac{1}{\theta})). Choosing tt provides a1a\approx 1.

Prsuccess(𝒜)Pr_{success}(\cal{A}) is the probability of measuring a unique basic state |k|0|1{\left|{k}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle} among all basic states |j|0|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle}, j{0,n1}j\in\{0,\dots n-1\} of the part sin((2t+1)θ)|ψgood\sin((2t+1)\theta){\left|{\psi_{good}}\right\rangle} of the state |ψt{\left|{\psi^{t}}\right\rangle} (6). From this and from (4), (5) it follows that

Prcussess(𝒜)=a1pgood1n=a1(1n)(1+j,jkϵj2)na11+(n1)ϵ2a11+c(ϵ).Pr_{cussess}({\cal{A}})=a\frac{1}{p_{good}}\frac{1}{n}=a\frac{1}{\left(\frac{1}{n}\right)\left(1+\sum_{j,j\not=k}\epsilon_{j}^{2}\right)n}\geq a\frac{1}{1+(n-1)\epsilon^{2}}\geq a\frac{1}{1+c(\epsilon)}.

Thus, selecting tΩ(n)t\in\Omega(\sqrt{n}) and choosing c>0c>0 close to 0( chosen according to ϵ\epsilon respectively) provides Prcussess(𝒜)1Pr_{cussess}({\cal{A}})\approx 1.

4.1.2 Estimation of the memory S(𝒜)S({\cal A})

The dimension S(𝒜)S({\cal A}) of the algorithm 𝒜{\cal A} is defined as the total number of qubits used in the state |V,ψE{\left|{V,\psi_{E}}\right\rangle}. So we have

S(𝒜)=logn+s+2.S({\cal A})=\log n+s+2.

For some selected c>0c>0 and ϵ=c/(n1)\epsilon=\sqrt{c/(n-1)} we have

S(𝒜)\displaystyle S({\cal A}) =\displaystyle= logn+logm+log(ϵ2(n1))+2\displaystyle\log n+\log m+\log{(\epsilon^{2}(n-1))}+2
=\displaystyle= logn+logm+logϵ2+log(n1)+2\displaystyle\log n+\log m+\log{\epsilon^{2}}+\log(n-1)+2
\displaystyle\leq 2logn+logm+const\displaystyle 2\log{n}+\log m+const
Comment 1

Recall that ϵ\epsilon is a parameter of the error-correcting code EE, and the code EE defines the quantum fingerprinting function ψE\psi_{E}. The value of ϵ\epsilon plays an important role in determining the pairwise “almost” orthogonality (ϵ\epsilon-orthogonality) of the values of ψE\psi_{E}. This is essential for proving the high probability of a correct result from the algorithm.

5 Algorithm 𝒜2{\cal A}2 based on quantum hashing

In this section, we present a generalization 𝒜2{\cal A}2 of the algorithm 𝒜{\cal A}. The generalization is based on the application of quantum functions called “ϵ\epsilon-stable”.

5.1 Quantum ϵ\epsilon-stable functions

Let’s define an ϵ\epsilon-stable quantum function following [15] (see also the monograph [16]).

Definition 1

(ϵ\epsilon-stable function) The quantum function

ψ:Σm(2)s,\psi:\Sigma^{m}\to({\mathcal{H}}^{2})^{\otimes s},

that maps words of length mm in the finite alphabet Σ\Sigma to a set of ss-qubit states will be called ϵ\epsilon-stable, if for all words wj{0,1}mw_{j}\in\{0,1\}^{m} their quantum images |ψ(wk){\left|{\psi(w_{k})}\right\rangle} and |ψ(wj){\left|{\psi(w_{j})}\right\rangle} are pairwise ϵ\epsilon-orthogonal

|ψ(wk)|ψ(wj)|ϵ.\left|\langle{\psi(w_{k})}|{\psi(w_{j})}\rangle\right|\leq\epsilon.
Definition 2

((mm,ϵ\epsilon,ss)-quantum hash function) The quantum function

ψ:Σm(2)s,\psi:\Sigma^{m}\to({\mathcal{H}}^{2})^{\otimes s},

that maps words of length mm in the finite alphabet Σ\Sigma to a set of ss-qubit states will be called (mm,ϵ\epsilon,ss)-quantum hash function if quantum function ψ\psi is ϵ\epsilon-stable and

sm.s\ll m.

The requirement of ϵ\epsilon-stable property of the ψ\psi function imposes restrictions on the compression ratio. The following lower bound for ss is was presented in [18].

Theorem 3

Let ψ:Σm(2)s\psi:\Sigma^{m}\rightarrow({\mathcal{H}}^{2})^{\otimes s} be a (mm,ϵ\epsilon,ss)-quantum hash function. Then

slogmloglog(1+2/(1ϵ))1.s\geq\log{m}-\log{\log{(1+\sqrt{2/(1-\epsilon)})}}-1.

Proof. The proof is given in the work [18] and the monograph [16]. \Box

Transformations UψU_{\psi} and Uψ1U^{-1}_{\psi}.

The algorithm 𝒜2{\cal A}2 uses the unitary transformation UψU_{\psi} on the space (2)s({\mathcal{H}}^{2})^{\otimes s} and its inverse Uψ1U^{-1}_{\psi}.

The UψU_{\psi} transformation is an implementation of the (mm,ϵ\epsilon,ss)-function ψ\psi . For the UψU_{\psi} transformation, the following must be true

Uψ:|0𝑤|ψ(w).U_{\psi}:{\left|{0}\right\rangle}\xrightarrow{w}{\left|{\psi(w)}\right\rangle}.

Accordingly, for the inverse transformation Uψ1U^{-1}_{\psi}, the following must be true

Uψ1:|ψ(w)𝑤|0.U^{-1}_{\psi}:{\left|{\psi(w)}\right\rangle}\xrightarrow{w}{\left|{0}\right\rangle}.

An example of such a function ψ\psi is the fingerprinting function ψE\psi_{E} based on the error-correcting code EE. The corresponding transformations UψEU_{\psi_{E}} and UψE1U^{-1}_{\psi_{E}}, which are described in Properties 1 and 2, are also given.

5.2 Algorithm 𝒜2{\cal A}2

The algorithm 𝒜2{\cal A}2 is a generalization of the quantum algorithm 𝒜{\cal A} in terms of an arbitrary (mm,ϵ\epsilon,ss)-quantum hash function ψ\psi.

The algorithm 𝒜2{\cal A}2 consists of two parts:

  1. 1.

    First part: preparing the initial state based on sequence VV.

  2. 2.

    Second part: reading the search word ww and searching for its position in the sequence.

Note that the algorithm 𝒜2{\cal A}2 has different input data for the two parts: VV and the word ww, respectively.

Description of the algorithm 𝒜2{\cal A}2.

Input data:

For the first part: sequence V={w0,,wn1}V=\{w_{0},\dots,w_{n-1}\} of binary words with length mm.

For the second part: Binary word ww with length mm.

Output data: The index kk, which denotes the word number kk such that w=wkw=w_{k}.

Thus, the algorithm 𝒜2{\cal A}2 implements the mapping

𝒜2:V,wk.{\cal A}2:V,w\longmapsto k.
  1. 1.

    The first part of the algorithm consists of preparing the initial state.

    According to this sequence VV, using the transformation UψU_{\psi}, which defines the (mm,ϵ\epsilon, ss)-quantum hash function ψ\psi, a state is prepared:

    |V,ψ=1nj=0n1|j|ψ(wj)|1,{\left|{V,\psi}\right\rangle}=\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\otimes{\left|{\psi(w_{j})}\right\rangle}\otimes{\left|{1}\right\rangle},
  2. 2.

    The second part of the algorithm 𝒜2{\cal A}2 – amplification consists of reading a word to be searched for, ww, and finding a number kk such that w=wkw=w_{k}.

    1. (a)

      Conversion hash transformation – first level of amplification

      The operator IlognUψ1(w)II^{\otimes\log{n}}\otimes U^{-1}_{\psi}(w)\otimes I is applied to the state |V,ψ{\left|{V,\psi}\right\rangle},

      where Uψ1(w)U^{-1}_{\psi}(w) is the inverse transformation controlled by the searched word ww. We get the state

      |V,ψ,w=1nj=0n1|j|ϕ(wj,w)|1,{\left|{V,\psi,w}\right\rangle}=\frac{1}{\sqrt{n}}\sum\limits_{j=0}^{n-1}{\left|{j}\right\rangle}\otimes{\left|{\phi(w_{j},w)}\right\rangle}\otimes{\left|{1}\right\rangle},

      where |ϕ(wj,w)=U1(w)|ψ(wj){\left|{\phi(w_{j},w)}\right\rangle}=U^{-1}(w){\left|{\psi(w_{j})}\right\rangle} for j{0,,n1}j\in\{0,\dots,n-1\}.

    2. (b)

      Amplification

      The amplification of basic states |j|0s|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}^{\otimes s}{\left|{1}\right\rangle} – “good states” is applied to state |V,ψ,w{\left|{V,\psi,w}\right\rangle}. The procedure is described in [2], and is also discussed in the book [4].

    3. (c)

      Measurement

      The first logn+s\log{n}+s qubits of the final state are measured in a computational basis. If the last ss qubits are all zero, then the measurement result kk of the first logn\log n qubits is declared as the index of the word wkw_{k} in the sequence VV, for which wk=ww_{k}=w.

6 Analysis of the algorithm 𝒜2{\cal A}2

Meaningfully, the algorithm 𝒜2{\cal A}2 has the following characteristics.

Theorem 4

For the algorithm 𝒜2{\cal A}2, which searches for the occurrence of an element with length mm in an unordered sequence of nn elements, the following is true

Prsuccess(𝒜2)1,Q(𝒜2)=O(n) and S(𝒜2)=logn+s,Pr_{success}({\cal A}2)\approx 1,\quad Q({\cal A}2)=O(\sqrt{n})\quad\mbox{ and }\quad S({\cal A}2)=\log n+s,

where ss is the number of qubits allocated to the (mm,ϵ\epsilon,ss) - quantum hash function value.

6.1 Proof of the Theorem 4.

The rest (main) two parts of the proof of the statement of the Theorem 4 a) space complexity of the algorithm and b) the proof of the correctness of the algorithm are completely determined by properties of (m,ϵ,s)(m,\epsilon,s)-quantum hash function ψ\psi.

6.1.1 Estimation of the probability Prsuccess(𝒜2)Pr_{success}({\cal A}2) of the algorithm success and query complexity Q(𝒜2)Q({\cal A}2)

The proof of the correctness of the algorithm that is, the proof of the high probability Prsuccess(𝒜2)Pr_{success}({\cal{A}}2) of the success of the algorithm follows the proof of the Theorem 2 with one modification.

We replace here the Property 3 and the Lemma 1 by the following Property.

Property 4

Let the function ψ\psi be an ϵ\epsilon-stable function. Then for the state |ϕ(wj,w)=Uψ1(w)|ψ(wj){\left|{\phi(w_{j},w)}\right\rangle}=U^{-1}_{\psi}(w){\left|{\psi(w_{j})}\right\rangle}

|ϕ(wj,w)=α0|0+α1|1++α2l1|2s1{\left|{\phi(w_{j},w)}\right\rangle}=\alpha_{0}{\left|{0}\right\rangle}+\alpha_{1}{\left|{1}\right\rangle}+\dots+\alpha_{2^{l}-1}{\left|{2^{s}-1}\right\rangle}

the following is true: If wj=ww_{j}=w, then α0=1\alpha_{0}=1. If wjww_{j}\not=w, then α0ϵ\alpha_{0}\leq\epsilon.

The proof of the Property 4 repeats the proof of the Lemma 1 with the simplification that we do not need to prove the ϵ\epsilon-orthogonality (ϵ\epsilon-stable) property of function ψ\psi. Remind that such the ϵ\epsilon-stability of the function ψE\psi_{E} is essential point in the proof of Lemma 1. But here we have such property (ϵ\epsilon-stability) from the definition of (mm,ϵ\epsilon,ss)-quantum hash function ψ\psi.

Query complexity Q(𝒜2)=O(n)Q({\cal{A}}2)=O(\sqrt{n}) of the algorithm is determined by the number of applications of Grover iterations to search for occurrences of the word ww in a dictionary VV consisting of nn words. The implementation of the “query” part of the algorithm 𝒜2{\cal A}2 is described in the section 2b and in fact repeats the proof for the presented characteristics in Theorem 2.

We present only the final calculations from the proof.

Let a=sin2((2t+1)θ)a=\sin^{2}((2t+1)\theta) is the probability of measuring one of the states |j|0|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle} after applying all Grover iterations. Note that for small θ\theta: sin(θ)θδ\sin(\theta)\geq\theta-\delta for small δ\delta (sin(θ)θ\sin(\theta)\approx\theta). In particular, in our case

sin(θ)=1n(1+j=0,jkn1ϵj2).\sin(\theta)=\sqrt{\frac{1}{n}\left(1+\sum_{j=0,j\not=k}^{n-1}\epsilon_{j}^{2}\right)}.

We choose tt such that (2t+1)θπ2(2t+1)\theta\approx\frac{\pi}{2}, meaning tΩ(n)t\in\Omega(\sqrt{n}) (tΩ(1θ)t\in\Omega(\frac{1}{\theta})). Choosing tt provides a1a\approx 1.

Prsuccess(𝒜2)Pr_{success}({\cal{A}}2) is the probability of measuring a unique basic state |k|0|1{\left|{k}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle} among all basic states |j|0|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}{\left|{1}\right\rangle}, j{0,n1}j\in\{0,\dots n-1\} of the part sin((2t+1)θ)|ψgood\sin((2t+1)\theta){\left|{\psi_{good}}\right\rangle} of the state |ψt{\left|{\psi^{t}}\right\rangle} (6). From this and from (4), (5) it follows that

Prcussess(A)=a1pgood1n=a1(1n)(1+j,jkϵj2)na11+(n1)ϵ2.Pr_{cussess}(A)=a\frac{1}{p_{good}}\frac{1}{n}=a\frac{1}{\left(\frac{1}{n}\right)\left(1+\sum_{j,j\not=k}\epsilon_{j}^{2}\right)n}\geq a\frac{1}{1+(n-1)\epsilon^{2}}.

Thus, selecting tΩ(n)t\in\Omega(\sqrt{n}) and choosing ϵ\epsilon close to 0 provides Prcussess(𝒜2)1Pr_{cussess}({\cal{A}}2)\approx 1.

Comment 2

Here we would like to comment on the second part of the algorithm (amplification) and its stages as follows. We call (following the [4]) the basic states in the form |j|0s|1{\left|{j}\right\rangle}{\left|{0}\right\rangle}^{\otimes s}{\left|{1}\right\rangle} as “good states”, which are states whose amplitudes we amplify using well-known quantum amplification procedure. The remaining basic states are called “bad states”.

Note that there are nn good basic states

Good={|𝟎|0s|1,,|𝐧𝟏|0s|1}Good=\left\{{\left|{\bf 0}\right\rangle}{\left|{0}\right\rangle}^{\otimes s}{\left|{1}\right\rangle},\dots,{\left|{\bf n-1}\right\rangle}{\left|{0}\right\rangle}^{\otimes s}{\left|{1}\right\rangle}\right\}

and only (some of them) states |k|0s|1{\left|{k}\right\rangle}{\left|{0}\right\rangle}^{\otimes s}{\left|{1}\right\rangle} for which wk=ww_{k}=w among the “good states” are “correct”. The necessary distinction between correct and incorrect states among the “good states” is implemented by means of the reverse hash transformation. This is the first level of amplification, and it works as follows.

Reverse hashing with a given word ww creates a state that is divided into two sets: a set of good states and a set of bad states. The set of good states is further divided into correct states and incorrect states. Reverse hashing operates such that the amplitudes of incorrect states is reduced from the initial value of 1/n1/\sqrt{n} to ϵ/n\epsilon/\sqrt{n}, while remaining amplitudes remain at 1/n1/\sqrt{n}. This is the first step in amplitude amplification. Subsequent O(n)O(\sqrt{n}) steps of Grover’s algorithm amplify the amplitude of both correct and incorrect good states, such that the probability of finding correct states approaches 1, while the probability for incorrect states does not grow significantly.

6.1.2 Estimation of the memory S(𝒜2)S({\cal A}2)

The space complexity S(𝒜2)=logn+s+1S({\cal A}2)=\log n+s+1 is determined by the number of qubits representing the initial state |V,ψ{\left|{V,\psi}\right\rangle} and its transformations. The essential component of logn+s+1\log n+s+1 here is ss — the compression ratio achieved by the hash function ψ\psi.

Upper bound for ss depends on the type of the (m,ϵ,sm,\epsilon,s)-quantum hash function.

7 Conclusion

In conclusion, we note that the algorithm 𝒜2{\cal{A}}2 is based on the application of a (m,ϵ,s)(m,\epsilon,s)-quantum hash function.

We will call a (mm,ϵ\epsilon,ss)-quantum hash function “good” if it is highly compressive (that is, the number of qubits allocated for the value of the hash function should be close to the lower bound defined in Theorem 3). Otherwise, we will consider the (mm,ϵ\epsilon,ss)-quantum hash function to be “bad”.

Choosing a “good” (m,ϵ,s)(m,\epsilon,s)-quantum hash function allows you to achieve a significant reduction in the number of qubits required for the algorithm to work.

The fingerprinting function described in Section 3, which is based on error-correcting codes, is a (mm,ϵ\epsilon,ss)-quantum hash function. In addition, it is a good hash function: the estimate of ss is defined as s=O(logm)s=O(\log{m}).

Another function, that is also a (m,ϵ,sm,\epsilon,s)-quantum function, is based on Freivald’s fingerprinting. This technique was proposed in the 1970s and has a long history of various applications. In particular, for quantum computations it has been used to construct efficient quantum automata [19] and quantum branching programs [20].

Freivald’s fingerprinting also defines a (m,ϵ,sm,\epsilon,s)-quantum function (for the construction, see, e.g., [18] and the book [16]). In the content of this work, such the (m,ϵ,sm,\epsilon,s)-quantum function is also “good”, i.e. s=O(log(cm))s=O(\log(cm)) for c>1c>1 and with ϵ\epsilon equal to almost 1/c1/c.

So, the above two (mm,ϵ\epsilon,ss)-quantum hash functions are “good”. That is they use ss qubits which are exponentially less than the length of a word from the dictionary.

An example of a “bad” (m,ϵ,sm,\epsilon,s)-quantum hash function is one based on the universal family of linear hash functions [18], see also the book [16]. This hash function is not asymptotically optimal in terms of the number of qubits required for construction.

The study of various (m,ϵ,sm,\epsilon,s)- quantum hash functions, problems of their efficient implementation and development of algorithms based on them continues.

References

  • [1] Lov K. Grover. A fast quantum mechanical algorithm for database search. In Gary L. Miller, editor, Proceedings of the Twenty-Eighth Annual ACM Symposium on the Theory of Computing, Philadelphia, Pennsylvania, USA, May 22-24, 1996, pages 212–219. ACM, 1996.
  • [2] Gilles Brassard, Peter Hoyer, Michele Mosca, and Alain Tapp. Quantum amplitude amplification and estimation. Contemporary Mathematics, 305:53–74, 2002.
  • [3] Ronald de Wolf. Quantum computing: Lecture notes. CoRR, abs/1907.09415, 2019.
  • [4] Phillip Kaye, Raymond Laflamme, and Michele Mosca. An Introduction to Quantum Computing. Oxford University Press, 2006.
  • [5] Farid M. Ablayev, Marat Ablayev, Joshua Zhexue Huang, Kamil Khadiev, Nailya Salikhova, and Dingming Wu. On quantum methods for machine learning problems part I: quantum tools. Big Data Min. Anal., 3(1):41–55, 2020.
  • [6] Farid M. Ablayev, Marat Ablayev, Joshua Zhexue Huang, Kamil Khadiev, Nailya Salikhova, and Dingming Wu. On quantum methods for machine learning problems part II: quantum classification algorithms. Big Data Min. Anal., 3(1):56–67, 2020.
  • [7] Knuth, Donald E and Morris, Jr, James H and Pratt, Vaughan R. Fast pattern matching in strings. SIAM journal on computing, 6(2):323–350, 1977.
  • [8] RM Karp. Efficient randomized pattern-matching algorithms, the ibm journal of research and development. http://www. research. ibm. com/journal/rd/312/ibmrd3102P. pdf, 31, 1987.
  • [9] Francesco Pio Marino, Simone Faro, and Antonio Scardace. Practical implementation of a quantum string matching algorithm. In Proceedings of the 2024 Workshop on Quantum Search and Information Retrieval, pages 17–24, 2024.
  • [10] Hariharan Ramesh and V Vinay. String matching in o (n+ m) quantum time. Journal of Discrete Algorithms, 1(1):103–110, 2003.
  • [11] Ashley Montanaro. Quantum pattern matching fast on average. Algorithmica, 77(1):16–39, 2017.
  • [12] Kapil Kumar Soni and Akhtar Rasool. Pattern matching: a quantum oriented approach. Procedia Computer Science, 167:1991–2002, 2020.
  • [13] Farid Ablayev, Nailya Salikhova, and Marat Ablayev. Hybrid classical–quantum text search based on hashing. Mathematics, 12(12):1858, 2024.
  • [14] Harry Buhrman, Richard Cleve, John Watrous, and Ronald De Wolf. Quantum fingerprinting. Physical Review Letters, 87(16):167902, 2001.
  • [15] Farid M. Ablayev, Marat Ablayev, Alexander Vasiliev, and Mansur Ziatdinov. Quantum fingerprinting and quantum hashing. computational and cryptographical aspects. Balt. J. Mod. Comput., 4(4), 2016.
  • [16] Ablayev F.and Ablayev M. and Vasiliev A. Quantum hashing: effective constructions (in Russian). Lamport, 2023.
  • [17] Harry Buhrman, Richard Cleve, John Watrous, and Ronald de Wolf. Quantum fingerprinting. Phys. Rev. Lett., 87(16):167902, 2001.
  • [18] Farid Ablayev and Marat Ablayev. Quantum hashing via classical ϵ\epsilon-universal hashing constructions. arXiv preprint arXiv:1404.1503, 2014.
  • [19] Andris Ambainis and Rusins Freivalds. 1-way quantum finite automata: strengths, weaknesses and generalizations. In Proceedings 39th Annual Symposium on Foundations of Computer Science (Cat. No. 98CB36280), pages 332–341. IEEE, 1998.
  • [20] Farid Ablayev and Alexander Vasiliev. Algorithms for quantum branching programs based on fingerprinting. arXiv preprint arXiv:0911.2317, 2009.