# The Quantum Decoding Problem

André Chailloux, Jean-Pierre Tillich

► To cite this version:

André Chailloux, Jean-Pierre Tillich. The Quantum Decoding Problem. Theory of Quantum Computation, Communication and Cryptography (TQC 2024), Sep 2024, Okinawa, Japan. pp.14, 10.4230/LIPIcs.TQC.2024.6 . hal-04277154

HAL Id: hal-04277154

https://inria.hal.science/hal-04277154v1

Submitted on 9 Nov 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons CC BY 4.0 - Attribution - International License
# The Quantum Decoding Problem

André Chailloux¹ and Jean-Pierre Tillich¹

Inria de Paris, {andre.chailloux,jean-pierre.tillich}@inria.fr

## Abstract

One of the founding results of lattice based cryptography is a quantum reduction from the Short Integer Solution problem to the Learning with Errors problem introduced by Regev. It has recently been pointed out by Chen, Liu and Zhandry that this reduction can be made more powerful by replacing the learning with errors problem with a quantum equivalent, where the errors are given in quantum superposition. In the context of codes, this can be adapted to a reduction from finding short codewords to a quantum decoding problem for random linear codes.

We therefore consider in this paper the quantum decoding problem, where we are given a superposition of noisy versions of a codeword and we want to recover the corresponding codeword. When we measure the superposition, we get back the usual classical decoding problem for which the best known algorithms are in the constant rate and error-rate regime exponential in the codelength. However, we will show here that when the noise rate is small enough, then the quantum decoding problem can be solved in quantum polynomial time. Moreover, we also show that the problem can in principle be solved quantumly (albeit not efficiently) for noise rates for which the associated classical decoding problem cannot be solved at all for information theoretic reasons.

We then revisit Regev's reduction in the context of codes. We show that using our algorithms for the quantum decoding problem in Regev's reduction matches the best known quantum algorithms for the short codeword problem. This shows in some sense the tightness of Regev's reduction when considering the quantum decoding problem and also paves the way for new quantum algorithms for the short codeword problem.
# Contents

<table><tr><td>1</td><td>Introduction</td><td>3</td></tr><tr><td>1.1</td><td>General context</td><td>3</td></tr><tr><td>1.2</td><td>Regev's quantum reduction and follow-up work</td><td>5</td></tr><tr><td>1.3</td><td>Contributions</td><td>7</td></tr><tr><td>1.3.1</td><td>Using USD as a means of improving quantum algorithms for QDP</td><td>8</td></tr><tr><td>1.3.2</td><td>Determining exactly the tractability of the quantum decoding problem</td><td>10</td></tr><tr><td>1.3.3</td><td>Using our algorithms in Regev's reduction</td><td>11</td></tr><tr><td>2</td><td>Preliminaries</td><td>13</td></tr><tr><td>2.1</td><td>Notations and basic probabilities</td><td>13</td></tr><tr><td>2.2</td><td>Random linear codes</td><td>13</td></tr><tr><td>2.2.1</td><td>Basic properties</td><td>13</td></tr><tr><td>2.2.2</td><td>Classical and quantum decoding problems</td><td>14</td></tr><tr><td>2.2.3</td><td>Punctured codes and Prange's algorithm</td><td>16</td></tr><tr><td>2.3</td><td>Distinguishing quantum states</td><td>16</td></tr><tr><td>2.4</td><td>The classical and quantum Fourier transform on $\mathbb{F}_q^n$</td><td>17</td></tr><tr><td>3</td><td>Algorithms for the binary quantum decoding problem</td><td>21</td></tr><tr><td>3.1</td><td>Quantum polynomial time algorithm using unambiguous state discrimination</td><td>21</td></tr><tr><td>3.2</td><td>Reduction between quantum decoding problems in the binary setting</td><td>22</td></tr><tr><td>3.2.1</td><td>Partial unambiguous state discrimination</td><td>23</td></tr><tr><td>3.2.2</td><td>Proof of Theorem 5</td><td>24</td></tr><tr><td>3.2.3</td><td>Interpretation of the above as changing the noise model</td><td>24</td></tr><tr><td>4</td><td>Polynomial time algorithm for QDP in the q-ary setting</td><td>25</td></tr><tr><td>4.1</td><td>Unambiguous state discrimination in the q-ary setting</td><td>25</td></tr><tr><td>4.2</td><td>Quantum polynomial time algorithm for QDP in the q-ary setting</td><td>29</td></tr><tr><td>5</td><td>(In)tractability of the quantum decoding problem</td><td>31</td></tr><tr><td>5.1</td><td>Computing the PGM associated to the quantum decoding problem</td><td>32</td></tr><tr><td>5.2</td><td>(In)tractability results</td><td>34</td></tr><tr><td>5.2.1</td><td>First computations and probabilistic arguments on random codes</td><td>34</td></tr><tr><td>5.2.2</td><td>Tractability</td><td>35</td></tr><tr><td>5.2.3</td><td>Intractability</td><td>37</td></tr><tr><td>6</td><td>From the quantum decoding problem to the short codeword problem</td><td>39</td></tr><tr><td>6.1</td><td>Regev's reduction for codes</td><td>39</td></tr><tr><td>6.2</td><td>The quantum reduction with unambiguous state discrimination</td><td>41</td></tr><tr><td>6.3</td><td>The Quantum reduction with the Pretty Good Measurement</td><td>42</td></tr><tr><td>6.3.1</td><td>A counterexample that shows complete failure</td><td>44</td></tr><tr><td>6.3.2</td><td>A measurement that works</td><td>45</td></tr><tr><td>A</td><td>General phases</td><td>51</td></tr></table>
# 1 Introduction

## 1.1 General context

Error correcting codes which appeared first as the fundamental tool to transmit information reliably through a noisy channel [Sha48] have found their way outside this kind of applications, such as for instance in average case complexity [Lev87], or when locally testable codes were found to be the combinatorial core for probabilistically checkable proofs (PCP) [Din07]. Another important application domain for error correction is cryptography with Shamir's secret sharing scheme [Sha79], authentication protocols [Ste93], pseudorandom generators [FS96], signature schemes [Ste93], or public-key encryption schemes [McE78, Ale11, MTSB12]. Contrarily to the applications in reliable communication, data storage, or application in complexity theory where finding suitable families of structured codes is the problem that has to be addressed, many of these applications in cryptography deal with random linear codes, and more precisely take advantage of the hardness of decoding a generic linear code.

The decoding problem corresponds to decoding the k-dimensional vector space $\mathcal{C}$ (i.e., the code) generated by the rows of a randomly generated $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ (which is called a generating matrix of the code):

$$ \mathcal{C} \triangleq \{\mathbf{u}\mathbf{G}: \mathbf{u} \in \mathbb{F}_q^k\}. \qquad (1) $$

Here $\mathbb{F}_q$ denotes the finite field with $q$ elements. In the decoding problem, we are given the noisy codeword $\mathbf{c} + \mathbf{e}$ where $\mathbf{c}$ belongs to $\mathcal{C}$ and we are asked to find the original codeword $\mathbf{c}$.

**Problem 1 (DP($q, n, k, f$)).** The decoding problem with positive integer parameters $q, n, k$ and a probability distribution $f$ on $\mathbb{F}_q^n$ is defined as:

* Input: $(\mathbf{G}, \mathbf{c} + \mathbf{e})$ where $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ and $\mathbf{u} \in \mathbb{F}_q^k$ are sampled uniformly at random over their domain - which generates a random codeword $\mathbf{c} = \mathbf{u}\mathbf{G}$ - and $\mathbf{e}$ is sampled from the distribution $f$.

* Goal: from $(\mathbf{G}, \mathbf{c} + \mathbf{e})$, find $\mathbf{c}$.

This problem for random codes has been studied for a long time and despite many efforts on this issue, the best algorithms are exponential in the codelength $n$ for natural noise distributions $f$ in the regime where $k$ is linear in $n$ and the rate $R \triangleq \frac{k}{n}$ bounded away from 0 and 1 [Pra62, Ste88, Dum89, MMT11, BJMM12, MO15, CDMT22].

The most common noise distribution studied in this context is the uniform distribution over the errors of fixed Hamming weight $t$, but there are also other distributions, like in the binary case ($q = 2$) the i.i.d Bernoulli distribution model which is frequently found in the Learning Parity with Noise problem (LPN) [GGR98]. When the number of samples of the LPN problem is fixed, this is exactly the decoding problem defined above where $n$ is equal to the number of available LPN samples. When the number of samples in LPN is unlimited, this can be viewed as a decoding problem where we might add on the fly as many columns in $\mathbf{G}$ as we need (and as many corresponding positions in $\mathbf{u}\mathbf{G} + \mathbf{e}$). The LWE problem in its standard form [Reg05] is a slight variation on the input alphabet, it is $\mathbb{Z}_q$ rather than the finite field $\mathbb{F}_q$ and as in LPN, the number of samples is often assumed to be unlimited. The noise distribution is frequently the discrete Gaussian distribution in this case.

The fact that in LPN, $n$ can grow unlimited with a fixed value of $k$ and a fixed noise distribution can only make the problem simpler than the decoding problem. Interestingly enough, there are now algorithms solving the LPN problem like the Blum-Kalai-Wasserman algorithm [BKW03] which solve the problem with only subexponential complexity of the form $2^{O(\frac{k}{\log k})}$ whereas no algorithm with such a complexity is known for $n = O(k)$ (all known algorithms have exponential
complexity in this case). Note that as soon as $n = \Omega(k^{1+\epsilon})$ for any absolute constant $\epsilon > 0$, the best known algorithm [Lyu05] is somewhat in between, namely $2^{O(\frac{k}{\log \log k})}$ and consists in building many new LPN samples from the original pool of samples. In terms of the decoding problem given above, this consists in adding artificially new columns to the generator matrix $\mathbf{G}$ given above by summing a small number of columns of $\mathbf{G}$ (together with the relevant positions of $\mathbf{u}\mathbf{G} + \mathbf{e}$) to artificially enlarge the value of $n$ and then solve the new decoding problem for this larger matrix. In our work, we will only be interested in the linear regime setting i.e. $k = \Theta(n)$.

It should be added here that the LWE problem has proved much more versatile than LPN for building cryptographic primitives. Indeed, it does not only allow to build cryptosystems from it [Reg05], but also allows to obtain advanced cryptographic functionalities such as fully homomorphic encryption [BV11] or attribute-based encryption [GVW13] for instance. It should also be mentioned that three out of the four signature schemes, public key encryption schemes or key establishment protocols supposed to resist to a quantum computer which were selected by the NIST for standardization are based on the hardness of this problem (see https://csrc.nist.gov/Projects/post-quantum-cryptography/selected-algorithms-2022).

While the security of many code-based cryptosystems relies on the hardness of the decoding problem, it can also be based on finding a “short” codeword (as in [MTSB12] or in [AHI+17, BLVW19, YZW+19] to build collision resistant hash functions), a problem which is stated as follows.

**Problem 2 (SCP(q, n, k, w))**. The short codeword problem with parameters $q, n, k, w \in \mathbb{N}$ is defined as:

* Given: $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ which is sampled uniformly at random,

* Find: $\mathbf{c} \in \mathbb{F}_q^n \setminus \{\mathbf{0}\}$ such that $\mathbf{H}\mathbf{c}^\top = \mathbf{0}$ and the weight $|\mathbf{c}|$ of $\mathbf{c}$ satisfies $|\mathbf{c}| \le w$.

Here we are looking for a non-zero codeword $\mathbf{c}$ of weight $\le w$ in the $k$-dimensional code $\mathcal{C}$ defined by the so-called parity-check matrix $\mathbf{H}$, namely<fnref n="1" />:

$$ \mathcal{C} \triangleq \{\mathbf{c} \in \mathbb{F}_q^n : \mathbf{H}\mathbf{c}^\top = \mathbf{0}\}. $$

The weight function which is generally used here is the Hamming weight, i.e. for a vector $\mathbf{x} = (x_1, \dots, x_n) \in \mathbb{F}_q^n$, its Hamming weight is defined as

$$ |\mathbf{x}| \triangleq \#\{i \in [1, n] : x_i \neq 0\}. $$

We will only deal with this weight here. The lattice version of this problem is called the Short Integer Solution (SIS) problem. It consists in replacing the finite field $\mathbb{F}_q$ by $\mathbb{Z}_q$ and using as weight function the euclidean weight $\sqrt{\sum_{i=1}^n x_i^2}$ (and by representing the elements in $\mathbb{Z}_q$ as $\{-[(q-1)/2], \dots, 0, \dots, [(q-1)/2]\}$). It was introduced in the seminal work [Ajt96] and used there to build a family of one-way functions based on the difficulty of this problem. What made this problem so attractive is that it was shown there to be as hard on average as a worst case short lattice vector problem.

Decoding and looking for short codewords are problems that have been conjectured to be extremely close. They have been studied for a long time, and the best algorithms for solving these two problems are the same, namely Information Set Decoding algorithms [Pra62, Ste88, Dum89, MMT11, BJMM12, MO15, BM17]. A reduction from decoding to the problem of finding short

<footnote n="1">¹The short codeword problem is usually defined by picking a random parity-check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ and not a random generating matrix $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ but the differences are minor (see for example [Deb23]) and one could also define this problem via the generating matrix of a code as we did for the decoding problem.</footnote>
codewords is known but in an LPN context [AHI$^{+}$17, BLVW19, YZW$^{+}$19, DR22]. However, until recently and even in an LPN context, no reduction was known in the other direction before [DRT23] which gave a quantum reduction from SCP to DP which followed the path of the breakthrough result of [Reg05] which reduced the problem of sampling short lattice vectors to LWE. Note that the reduction [Reg05] was not classical but quantum. Later on, it was shown in [SSTX09] that the quantum reduction technique of Regev allows to reduce quantumly SIS to LWE, and this kind of reduction also applies to structured versions of these problems, namely Ideal-SIS can be reduced to Ideal-LWE.

There is a fundamental difficulty of reducing the search of low weight codewords to decoding a linear code which is due to the fact that the nature of these two problems is very different. Decoding concentrates on a region of parameters where there is typically just one solution, whereas finding low weight codewords concentrates on a region of parameters where there are many solutions (and typically an exponential number of solutions). This makes these problems inherently very different. This was also the case for the reduction of SIS to LWE and the fact that we can have a reduction from one to another by looking for quantum reductions instead of classical reductions was really a breakthrough at that time.

It is also worthwhile to notice that all these problems, DP, LPN, LWE, SCP, SIS are all widely believed to be hard also for a quantum computer. The best quantum algorithms for solving these problems have not changed much the picture, the complexity exponent gets essentially only reduced by a constant factor when compared to the best classical algorithms achieving this task, see for instance [Ber10, BJLM13, KT17, LMvdP15, Laa16, CL21]. Indeed, as explained above, most public-key cryptosystems and digital signature schemes that are being standardized right now by the NIST are based on the presumed hardness of LWE, and there are also alternate fourth round finalists of the competition [ABC$^{+}$22, AAB$^{+}$22b, AAB$^{+}$22a] which are based on the hardness of binary DP.

## 1.2 Regev's quantum reduction and follow-up work

Regev's quantum reduction [Reg05] is at the core of complexity reductions for these problems, which with [Ajt96] essentially started lattice-based cryptography. His approach when rephrased in the coding context is based on the following observation. Suppose that we were able to construct a quantum superposition $\sqrt{\frac{1}{Z}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |c+e\rangle$ of noisy codewords of a code $C$ of dimension $k$ over $\mathbb{F}_q$, for a normalization factor $Z$. If we would apply the quantum Fourier transform on such a state, then because of the periodicity property of such a state we would get a superposition concentrating solely on the codewords of the dual $C^{\perp}$ of $C$, that is $\frac{1}{\sqrt{Z}} \sum_{c^{\perp} \in C^{\perp}} \sqrt{f(c^{\perp})} |c^{\perp}\rangle$. Here $\hat{f}$ is the (classical) Fourier transform of $f$ that we will properly define in the technical part of the paper. Recall that the dual code is defined as

**Definition 1** (dual code). Let $C$ be a linear code over $\mathbb{F}_q$, i.e. a $k$-dimensional subspace of $\mathbb{F}_q^n$ for some $k$ and $n$. The dual code $C^{\perp}$ is an $(n-k)$ dimensional subspace of $\mathbb{F}_q^n$ defined by

$$C^{\perp} \triangleq \{d \in \mathbb{F}_q^n : d \cdot c = 0, \forall c \in C\},$$

where $x \cdot y = \sum_i x_i y_i$ stands for the inner product between the vectors $x$ and $y$.

Now, we can expect that if $f$ concentrates on fairly small weights, then $\hat{f}$ would also concentrate on rather small weights and therefore we would have a way of sampling low weight (dual) codewords and solve SCP for the dual code. The point is now that $\sqrt{\frac{1}{Z}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |c+e\rangle$ could be obtained by solving the DP problem on states that are easy to construct. This is the main idea of Regev's reduction. More precisely, the whole algorithm works as follows
**Step 1.** Creation of the tensor product of a uniform superposition of codewords and a quantum superposition of noise

$$|\phi_1\rangle = \sqrt{\frac{1}{q^k}} \sum_{c \in \mathcal{C}} |c\rangle \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |e\rangle.$$

**Step 2.** Entangling the codeword with the noise by adding the first register to the second one and then swapping the two registers

$$|\phi_2\rangle = \sqrt{\frac{1}{q^k}} \sum_{c \in \mathcal{C}} \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |c + e\rangle |c\rangle.$$

**Step 3.** Disentangling the two registers by decoding $c + e$ and therefore finding $c$ which allows to erase the second register

$$|\phi_2\rangle = \sqrt{\frac{1}{Z}} \sum_{c \in \mathcal{C}} \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |c + e\rangle |0\rangle.$$

(The different normalizing factor $Z$ arises when the above decoding procedure is imperfect and we condition on measuring $0$ in the last register.)

**Step 4.** Applying the quantum Fourier transform on the first register and get

$$\frac{1}{\sqrt{Z}} \sum_{d \in \mathcal{C}^{\perp}} \sqrt{\hat{f}(d)} |d\rangle |0\rangle$$

**Step 5.** Measure the first register and get some $d$ in $\mathcal{C}^{\perp}$.

This approach is at the heart of the quantum reductions obtained in [Reg05, SSTX09, DRT23]. It is also a crucial ingredient in the paper [YZ22] proving verifiable quantum advantage by constructing - among other things - one-way functions that are even collision resistant against classical adversaries but are easily invertible quantumly. In [Reg05, SSTX09, DRT23], the crucial erasing/disentangling step is performed with the help of a classical decoding algorithm. Indeed any (classical or quantum) algorithm that can recover $c$ from $c + e$ can be applied coherently to erase the last register in step 3².

A key insight observed in [CLZ22] is that it is actually enough to recover $|c\rangle$ from the state $\sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)}|c + e\rangle$ so we are given a superposition of all the noisy codewords $c + e$ and not a fixed one. This means we have to solve the following problem

**Problem 3 (QDP($q, n, k, f$)).** The quantum decoding problem with positive integer parameters $q, n, k$ and a probability distribution $f$ on $\mathbb{F}_q^n$ is defined as:

* Input: Take $G \in \mathbb{F}_q^{k \times n}$ and $u \in \mathbb{F}_q^k$ sampled uniformly at random over their domain. Let $c = uG$ and $|\psi_c\rangle \triangleq \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)}|c + e\rangle$. The (quantum) input to this problem is $(G, |\psi_c\rangle)$.

* Goal: given $(G, |\psi_c\rangle)$, find $c$.

<footnote n="2">²Indeed, having such an algorithm means we can construct the unitary $U: |c + e\rangle|0\rangle \rightarrow |c + e\rangle|c\rangle$. Applying the inverse of this unitary will give the erasure operation.</footnote>
It's not clear a priori whether this is helpful or not. If one measures the state $|\psi_c\rangle$ then one recovers a noisy codeword and we are back to the classical decoding problem.

However, having improvements by directly solving the (LWE variant of the) above problem has been proposed in [CLZ22] where a polynomial time quantum algorithm based on Regev's approach solving SIS is proposed for the $l_\infty$ norm (and not the euclidean norm as is standard there) for extremely high rate codes. Here the decoding problem is obtained by measuring the qudits in an appropriate basis allowing to rule out certain values for the code-symbols, and then they use the Arora-Ge algorithm [AG11] for recovering completely the codeword by solving an algebraic system which for the parameters that are considered there, is of polynomial complexity. Despite the fact that the parameters of the SIS problem are highly degenerate, no efficient classical algorithm performing this task is known. This paper puts forward the S-LWE and the C-LWE problems. Informally the first problem is the one we solve in Step 3 above and the second one is just to create directly the uniform superposition of noisy codewords obtained at Step 3.

## 1.3 Contributions

Our work has 2 starting points. First, the quantum reduction of [DRT23] between the short codeword problem and the decoding problem in the regime relevant for code-based cryptography i.e. a constant code rate $\frac{k}{n}$ and constant error rate. Then, the key insight of [CLZ22] that one requires to solve the quantum decoding problem in the above reduction which can make it more efficient. Instead on focusing too much on the reduction, our aim is first to study here the quantum decoding problem for its own sake. Indeed, the problem is already interesting as a quantum generalization of the decoding problem and the fact it is used in the above reduction creates strong motivation for studying it.

In this work, we focus only on the Bernoulli noise of parameter $p$. This means we consider the error function

$$f(e) = (1-p)^{n-|e|} \left( \frac{p}{q-1} \right)^{|e|}.$$

which in turn means that for any $c = (c_1, \dots, c_n) \in \mathbb{F}_q^n$, we can rewrite

$$|\psi_c\rangle \triangleq \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)} |c + e\rangle = \bigotimes_{i=1}^n \left( \sqrt{1-p}|c_i\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{p}{q-1}} |c_i + \alpha\rangle \right).$$

For this Bernoulli noise with parameter $p$, the associated quantum decoding problem is written QDP($q, n, k, p$). We show that indeed, the complexity of the quantum decoding problem significantly differs from its classical counterpart. Our contributions can be summarized as

**A polynomial time algorithm for QDP when the noise is low enough (but still of constant rate).**

We will show that the quantum problem QDP defined here is probably much easier than its classical counterpart DP. Indeed, for fixed rate $R \triangleq \frac{k}{n}$ only exponential-time algorithms are known for DP for natural noise models, for instance the Bernoulli i.i.d model where $q = 2$, $\Pr(e_i = 1) = p$ for which all algorithms solving it are exponential for $p$ in $(0, 1)$. This is not the case for the associated QDP problem, where we will show that by using Unambiguous State Discrimination (USD) together with linear algebra we can solve the problem in polynomial time up to some limiting value of $p$ which is strictly between 0 and 1 for a fixed rate $R$. We generalize this result for any $q$ by generalizing existing bounds on USD and also present an algorithm for partial binary unambiguous state discrimination which could be of independent interest.
**A problem which can be solved above capacity.** There is an information theoretic limit for any algorithm solving classically or quantumly the classical decoding problem DP. When the rate exceeds the capacity of the noisy channel specified by $f$ (and if this is an i.i.d. noise) then above the capacity of the noisy channel it is just impossible to solve with say polynomial error probability the decoding problem just because there are exponentially many candidates at least as likely as the right candidate. The problem becomes intractable just because of this reason. For instance in the Bernoulli model above, the rate $R = k/n$ has to be smaller than $1 - h(p)$ where $h(x)$ is the binary entropy function, $h(x) = -x \log_2(x) - (1-x) \log_2(1-x)$. Somewhat surprisingly, it turns out that we can go above the Shannon capacity for the QDP problem. Moreover, with the help of the Pretty Good Measurement (PGM) we can fully characterize the noise range where the problem is tractable.

**Applying QDP solvers in Regev's reduction.** Both algorithms (the one using USD and the other one based on PGM) can be applied to sample small weight dual codewords and solve SCP. By applying the quantum reduction steps above, together with our polynomial time solving QDP we obtain non-zero codewords of relative weight $\omega \triangleq w/n$ satisfying $\omega \le \frac{(q-1)(1-R)}{q}$. Interestingly enough, this is precisely the smallest weight that can be reached by the best known polynomial time algorithm, namely a minor variant of the Prange algorithm [Pra62]. On the other hand, we will show that there is no hope to have a proper general reduction of SCP to QDP, by providing examples showing that we can solve QDP in a certain noise regime and still get nothing useful for SCP after using it in Regev's reduction. However, we can adapt the PGM to still have some small codewords up to the tractability bound. Our examples really show that we have to analyze properly the state that we have at Step 3. of the reduction on a case by case basis.

We now perform a detailed description of our contributions.

### 1.3.1 Using USD as a means of improving quantum algorithms for QDP

**The binary setting.** Our first idea, which extends naturally the work of [CLZ22] is to apply USD for the quantum decoding problem. We first consider the binary setting, i.e. $q = 2$. This means the states $|\Psi_c\rangle = \sum_{e \in \mathbb{F}_2^n} \sqrt{f(e)}|c+e\rangle$ for which we want to recover $c$ are of the form

$$|\Psi_c\rangle = \bigotimes_{i=1}^{n} \sqrt{1-p}|c_i\rangle + \sqrt{p}|1-c_i\rangle.$$

Consider a fixed coordinate $i$ for which we have the state $\sqrt{1-p}|c_i\rangle + \sqrt{p}|1-c_i\rangle$ which we call $|\psi_{c_i}^p\rangle$. By measuring this state in the computational basis we get $c_i$ wp. $1-p$ and $1-c_i$ wp. $p$. This measurement is actually the measurement that distinguishes best $|\psi_0\rangle$ and $|\psi_1\rangle$.

Another measurement of interest is unambiguous state discrimination. Here, the goal is not to distinguish optimally between $|\psi_0^p\rangle$ and $|\psi_1^p\rangle$ but to make sure that our guess is always correct but allowing for some abort. In this setting, we have the following

**Proposition 1 (Unambiguous state discrimination).** For any $p \in [0, 1]$, there exists a quantum measurement that on input $|\psi_{c_i}^p\rangle$ outputs $c_i$ wp. $1 - 2\sqrt{p(1-p)}$ and outputs $\perp$ otherwise.

Using this measurement, the probability of guessing correctly $c_i$ is always smaller than $1-p$ for $p \le \frac{1}{2}$. However, we know exactly when we succeed in guessing $c_i$. This will be extremely useful for decoding. Indeed, if we recover $k$ values of $c_i$ we recover the complete codeword $c$ with good probability by linear algebra by using the fact that $c = mG$ with $G \in \mathbb{F}_2^{k \times n}$. This will lead to
**Theorem 1.** Let $R \in [0, 1]$. For any $p < (\frac{R}{2})^{\perp}$, there exists a quantum algorithm that solves QDP$(2, n, \lfloor Rn \rfloor, p)$ wp. $1 - 2^{-\Omega(n)}$ in time poly$(n)$. Here for a real number $x \in [0, 1]$, $x^{\perp}$ stands for $\frac{1-2\sqrt{x(1-x)}}{2}$.

**Interpretation as changing the noise channel and partial unambiguous state discrimination.** A nice interpretation of the above algorithm is that when the error is in quantum superposition, one can use quantum measurements to change the noise model. For example in the above, if we are given $|\psi_{c_i}\rangle = \sqrt{1-p}|c_i\rangle + \sqrt{p}|1-c_i\rangle$ then

* One can measure in the computational basis to obtain $c_i$ that has been flipped wp. p.

* One can use unambiguous state discrimination in which case $c_i$ has been erased wp. $2\sqrt{p(1-p)}$.

What we show in Theorem 1 is that the second strategy is actually much more powerful for recovering the codeword $c$. A natural question to ask is whether this can further be generalized to other measurements.

In this work, we actually generalize Unambiguous State Discrimination as follows: given $|\psi_{c_i}\rangle$, the measurement will sometimes output $\perp$ but it can also fail with some small probability. We prove the following

**Proposition 2 (Partial Unambiguous State Discrimination).** Let $p, s \in [0, \frac{1}{2})$ with $s \le p$ and let $u = \frac{p^{\perp}}{s^{\perp}}$. There exists a quantum measurement that when applied to $|\psi_{c_i}\rangle = \sqrt{1-p}|c_i\rangle + \sqrt{p}|1-c_i\rangle$ outputs $c_i$ wp. $u(1-s)$, $(1-c_i)$ wp. us and $\perp$ wp. $1-u$.

Notice that this generalizes both the standard measurement (by taking $s = p$) and unambiguous state discrimination (by taking $s = 0$ which gives $u = 2p^{\perp}$). This seems a very natural way of generalizing Unambiguous State Discrimination but is not something we have found in the literature and could be of independent interest. We can use this measurement not to provide new polynomial time algorithm but rather to give a reduction between different Quantum Decoding problems, which we detail in the full text.

**The general setting.** The unambiguous state discrimination approach works in the $q$-ary setting as well. A difficulty here is that optimal unambiguous state discrimination is not known in general for more than 2 states, but in certain situations where we have a symmetric set of states [CB98] we know how to perform optimal USD. This would apply in our case where $q$ is prime. We have generalized slightly the approach of [CB98] to be able to apply it to any finite field size $q$. We get finally a result very similar to the binary case

**Theorem 2.** Let $R \in [0, 1]$. For any $p < (\frac{(q-1)R}{q})^{\perp}$, there exists a quantum algorithm that solves QDP$(q, n, \lfloor Rn \rfloor, p)$ wp. $1 - 2^{-\Omega(n)}$ in time poly$(n)$.

Here we have used a notation which “generalizes” the $p^{\perp}$ notation used in the binary setting.

**Notation 1.** For a real number $x \in [0, 1]$, $x^{\perp}$ stands for $\frac{(\sqrt{(1-x)(q-1)} - \sqrt{x})^2}{q}$.

This quantity depends on $q$ which will be clear from the context. Note that when $q = 2$ we get $\frac{1-2\sqrt{x(1-x)}}{2}$ which coincides with the one given in the binary case.
### 1.3.2 Determining exactly the tractability of the quantum decoding problem

We are now interested in the tractability of QDP($q, n, k, p$) meaning when is it possible from an information theoretic perspective to solve this problem. In order to study this problem, a fundamental quantity is $\delta_{\min}(R)$ defined below, sometimes referred to as the Gilbert-Varshamov distance

**Notation 2.** Let $R \in [0, 1]$. We define $\delta_{\min}(R) \triangleq h_q^{-1}(1-R)$, where $h_q(x) \triangleq -(1-x)\log_q(1-x) - x\log_q(\frac{x}{q-1})$. $h_q$ is a bijection from $x \in [0, \frac{q-1}{q}]$ to $[0, 1]$ and we define $h_q^{-1} : [0, 1] \to [0, \frac{q-1}{q}]$ st. $h_q^{-1}(h_q(x)) = x$ for $x \in [0, \frac{q-1}{q}]$.

For the classical setting, it is well understood that DP($q, n, k, p$) is not tractable when $p > \delta_{\min}(\frac{k}{n})$, meaning that even an unbounded algorithm will solve the problem $wp. o(1)$.

We would like now to understand what happens in the quantum setting. Techniques based on (partial) unambiguous state discrimination will not work in the regime $p > \delta_{\min}(R)$. Since we are only interested in the tractability of the problem, we can consider optimal quantum algorithms for discriminating between the states $|\Psi_c\rangle = \sum_{e \in \mathbb{F}_q^n} \sqrt{f(e)}|c+e\rangle$ where $f$ accounts for the Bernoulli noise of parameter $p$. This problem can be addressed by using the *Pretty Good Measurement* (PGM) which has turned out to be a very useful tool in quantum information. If we define $P_{PGM}$ as the probability that the pretty good measurement succeeds in solving our problem and define $P_{OPT}$ as the maximal probability that any measurement succeeds, we have [BK02, Mon06]

$$P_{OPT}^2 \leq P_{PGM} \leq P_{OPT}.$$

This means that if the problem is tractable then $P_{OPT} = \Omega(1)$ which implies $P_{PGM} = \Omega(1)$. On the other hand, if the problem is intractable then $P_{OPT} = o(1)$ which implies $P_{PGM} = o(1)$. In conclusion, in order to study the tractability of the quantum decoding problem, it is enough to look at the PGM associated with the problem of distinguishing the states $\{|\Psi_c\rangle\}$. We show the following

**Theorem 3.** Let $R \in (0, 1)$.

* For $p < (\delta_{\min}(1-R))^{\perp}$, QDP($q, n, \lfloor Rn \rfloor, p$) can be solved using the PGM $wp. P_{PGM} = \Omega(1)$ hence the problem is tractable.

* For $p > (\delta_{\min}(1-R))^{\perp}$, QDP($q, n, \lfloor Rn \rfloor, p$), the probability that the PGM solves this problem is $P_{PGM} = o(1)$ hence the problem is intractable.

The pretty good measurement associated to this distinguishing problem actually has a lot of structure. It is actually a projective measurement on an orthonormal basis corresponding which can be seen as a Fourier basis involving the shifted dual codes of the code $\mathcal{C}$ we are working on.

**Comparing the complexity of the decoding problem and the quantum decoding problem** With this full characterization, we compare the hardness, and tractability of the classical and quantum decoding problems. For $p = 0$, we have of course a polynomial time algorithm to solve DP($q, n, \lfloor Rn \rfloor, 0$). For $0 < p \le \delta_{\min}(R)$, the problem is tractable and the best known classical or quantum algorithms run in time $2^{\Omega(n)}$. For $p > \delta_{\min}(R)$, we know the problem is intractable. In the quantum setting, we obtain a very different picture. A comparison of these results is presented in Figures 1 and 2 where we use the following terminology

* Easy: there exists an algorithm that runs in time $\text{poly}(n)$.

* Hard: the best known algorithm runs in time $2^{\Omega(n)}$, but there could potentially be more efficient algorithms.
* Intractable: we know that any (even unbounded) algorithm can solve the problem $wp$. at most $o(1)$.

<figure><img src="image_2.png" /><figcaption>Figure 2: Hardness and tractability of the quantum decoding problem $QDP(q, n, \lfloor Rn \rfloor, p)$, for any fixed $R \in [0, 1]$, as a function of $p$.</figcaption></figure>

<figure><img src="image_3.png" /></figure>

This gives a proper characterization of the difficulty of the Quantum Decoding Problem. In our next contribution, we will apply them in Regev's quantum reduction in order to derive some results for the short codeword problem. As we will show, the results from Figure 2 will match exactly our knowledge for the short codeword problem.

### 1.3.3 Using our algorithms in Regev's reduction

We are now interested in solving the short codeword problem using Regev's reduction and the algorithms we described in the previous section. The known hardness of the short codeword problem is summarized in the figure below

<figure><img src="image_4.png" /><figcaption>Figure 3: Hardness and tractability of the short codeword problem $SCP(q, n, \lfloor Rn \rfloor, p)$ for a fixed $R \in (0, 1)$, as a function of $p$.</figcaption></figure>

For our coding context, the only known reduction is the following

**Proposition 3** ([DRT23], informal). Fix integers $n, q \ge 2$ as well as parameters $R, p \in (0, 1)$ st. $p \le \delta_{\min}(R)$. From any quantum algorithm that solves $DP(q, n, \lfloor (1-R)n \rfloor, p)$ with high probability, there exists a quantum algorithm that solves $SCP(q, n, \lfloor Rn \rfloor, p^{\perp})$ with high probability where recall that $p^{\perp} = \frac{(\sqrt{(1-p)(q-1)} - \sqrt{p})^2}{q}$.

How can we characterize the efficiency of this reduction? Let us consider the best algorithms for $DP(q, n, \lfloor (1-R)n \rfloor, p^{\perp})$ and see what algorithms does it give for $SCP(q, n, \lfloor Rn \rfloor, p)$. We obtain the following result, summarized in Figure 4. We can see that the obtained algorithm for the short decoding problem is significantly worse<fnref n="3" /> than best known algorithm for this problem (see Figure 3). But in the light of our previous results, this is understandable, Regev's reduction actually requires

<footnote n="3">³One can check that we always have $(\delta_{\min}(1-R))^{\perp} \ge \delta_{\min}(R)$.</footnote>
to solve the quantum decoding problem and we just showed that it is much simpler than the decoding problem. If we could directly use the above proposition with our algorithms, we would obtain the following results, summarized in Figure 5.

<figure><img src="image_5.png" /><figcaption>Figure 5: On the top, our quantum algorithms for $QDP(q, n, ⌈(1-R)n⌋, p)$. On the bottom, complexity of a quantum algorithm for $SCP(q, n, ⌈Rn⌋, p)$ that would use our algorithms $QDP(q, n, ⌈(1-R)n⌋, p)$ and then Proposition 3 when applicable</figcaption></figure>

<figure><img src="image_6.png" /></figure>

Here, if we could apply Proposition 3 with our algorithms, we would recover exactly the same complexities as the best known algorithms for $SCP^4$. However, it's not clear whether this is the case. What we do is that for each of our algorithms, we try to perform Regev's reduction and see what we obtain. We show the following:

* If we take our polynomial time algorithms involving unambiguous state discrimination for the quantum decoding problem in Regev's reduction, we can find in quantum polynomial time small codewords down to Prange's bound, i.e. down to $\frac{(1-R)(q-1)}{q}$ (the Easy zone in Figure 3). The bound $\left(\frac{(1-q)(1-R)}{q}\right)^{\perp}$ comes from bounds on quantum unambiguous state discrimination and it is quite remarkable that after the quantum reduction, it corresponds exactly to Prange's bound where the short codeword problem is easy.

* If we use our algorithm involving the Pretty Good Measurement in Regev's reduction, the following happens:

<footnote n="4">⁴We say we recover the same complexities only in the sense that we recover the areas which are easy, hard, intractable. We're not claiming that within these areas, the running times are exactly the same.</footnote>
1. If we apply the PGM directly, we will most often be in regimes where we measure **0** in the final step so we will not be able to solve the Short Codeword problem.

2. We can slightly tweak the PGM so that we can solve the corresponding short codeword problem for all the regimes where it is tractable (the Hard zone in Figure 3).

3. We also show another example where we can slightly tweak the PGM but where the reduction utterly fails, meaning that the state we obtain after Step 4 is $|\perp\rangle$, so measuring will give absolutely no information about a small dual codeword. This shows that there is no hope to perform a generic reduction (i.e. a generalization of Proposition 3) between the quantum decoding problem and the short codeword problem with this method.

These results show that, while it is impossible to have a generic reduction from QDP to SCP with this method, it is - at least for our examples - possible to find algorithms for QDP that will give results according to Figure 5, and recover the areas where the problem is easy and where it is tractable. This can be seen as quite a surprise since our bounds on QDP essentially come from information theory and best known bounds on SCP comes from classical coding theory and seem unrelated at first.

# 2 Preliminaries

## 2.1 Notations and basic probabilities

**Sets, finite field.** The finite field with $q$ elements is denoted by $\mathbb{F}_q$. $\mathbb{Z}_q$ denotes the ring of integers modulo $q$. The cardinality of a finite set $\mathcal{E}$ is denoted by $|\mathcal{E}|$. The set of integers $\{a, a+1, \dots, b\}$ between the integers $a$ and $b$ is denoted by $\llbracket a, b \rrbracket$. For a positive integer $n$, $[n]$ denotes $\llbracket 1, n \rrbracket$. $x \leftarrow S$ means that $x$ is sampled uniformly from the set $S$.

**Vector and matrices.** For a Hermitian matrix $\mathbf{M}$ we write that $\mathbf{M} \succeq 0$ when $\mathbf{M}$ is positive semi-definite. Vectors are row vectors as is standard in the coding community and $\mathbf{x}^\top$ denotes the transpose of a vector or a matrix. In particular, vectors will always be denoted by bold small letters and matrices with bold capital letters. For a subset $J \subseteq [n]$ of positions of the vector $\mathbf{x} = x_1, \dots, x_n$, $\mathbf{x}_J = (x_j)_{j \in J}$ denotes the vector formed by the entries indexed by $J$. For a matrix $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ and a subset of columns $J \subseteq [n]$, $\mathbf{G}_J \in \mathbb{F}_q^{k \times |J|}$ denotes the submatrix formed by its columns indexed by $J$.

**Lemma 1 (Hoeffding's inequality).** Let $X_1, \dots, X_n$ be independent random Bernoulli variables with parameter $p$. We have

$$ \Pr\left[\sum_{i=1}^{n} X_i \le pn - \alpha\sqrt{n} \le 2^{-2\alpha^2}\right]. $$

## 2.2 Random linear codes

### 2.2.1 Basic properties

For a vector $\mathbf{x} = x_1, \dots, x_n \in \mathbb{F}_q^n$, we define the Hamming weight $|\mathbf{x}| = |\{i : x_i \neq 0\}|$. For $q, n, w \in \mathbb{N}^*$ with $q \ge 2$, we define the (Hamming) sphere of radius $w$ as $S_w^{q,n} = \{\mathbf{x} \in \mathbb{F}_q^n : |\mathbf{x}| = w\}$. A code $\mathcal{C}$ can be specified by a generating matrix $\mathbf{G} \in \mathbb{F}_q^{k \times n}$, in which case $\mathcal{C} = \{\mathbf{u}\mathbf{G} : \mathbf{u} \in \mathbb{F}_q^k\}$ or via a parity-check matrix $\mathbf{H} \in \mathbb{F}_q^{n \times (n-k)}$, in which case $\mathcal{C} = \{\mathbf{y} : \mathbf{H}\mathbf{y}^\top = \mathbf{0}\}$.

(André: Si ces quantités suivantes ne sont pas utilisées ici, peut-être les mettre directement dans la section correspondante aux propriétés avancées sur les codes aléatoires.)
**Definition 2 (q-ary entropy).** We define the q-ary entropy $h_q: [0, 1] \to [0, 1]$ s.t. $h(x) = -x \log\left(\frac{x}{q-1}\right) - (1-x) \log(1-x)$ if $x \in (0, 1)$ and $h_q(0) = h_q(1) = 0$.

$h_q$ is increasing for $x \in [0, \frac{q-1}{q}]$ and decreasing for $x \in [\frac{q-1}{q}, 1]$. Moreover, $h_q(\frac{q-1}{q}) = 1$.

**Definition 3 (Inverse q-ary entropy).** $h_q$ is a bijection from $[0, \frac{q-1}{q}]$ to $[0, 1]$ and we define $h_q^{-1}: [0, 1] \to [0, \frac{q-1}{q}]$ s.t. $h_q^{-1}(h_q(x)) = x$ for $x \in [0, \frac{q-1}{q}]$.

**Definition 4 (Relative Gilbert-Varshamov distance).** The (relative) Gilbert-Varshamov distance for q-ary codes $\delta_{\min}(R, q)$ corresponding to the rate $R$ is defined as $\delta_{\min}(R, q) = h_q^{-1}(1 - R)$.

**Definition 5 (Relative maximum weight).** The (relative) maximum weight for q-ary code $\delta_{\max}(R, q)$ is defined as the unique solution $x$ in $[\frac{q-1}{q}, 1]$ of $h_q(x) = R$ if it exists. If such an $x$ does not exist, we just write $\delta_{\max}(R, q) = \perp$.

$\delta_{\min}(R, q)$ corresponds to the typical asymptotic relative minimum distance of a random linear code over $\mathbb{F}_q$ of rate $R$, whereas the second quantity (when it is not $\perp$) is equal to the typical asymptotic relative maximum distance. Generally $q$ will be clear from the context and we will drop the dependency in $q$ and simply write $\delta_{\min}(R)$ and $\delta_{\max}(R)$.

**Definition 6 (Inverse of a full rank matrix).** Let $k < n$ and $G \in \mathbb{F}_q^{k \times n}$ be a matrix of full rank $k$. We define the pseudo-inverse $G^{-1} \in \mathbb{F}_q^{n \times k}$ as a matrix satisfying $\forall u \in \mathbb{F}_q^k$, $(uG) \cdot G^{-1} = u$. [jp: Cette matrice n'est pas unique, j'ai changé "inverse" en "pseudo-inverse" et "the" par "a".]

**Proposition 4.** Let $m \ge k$ and let $G \leftarrow \mathbb{F}_q^{k \times m}$. We have

$$ \Pr[\mathrm{rank}(G) = k] \ge 1 - q^{k-m}. $$

**Proposition 5.** Let $c = sG$ for some $s \in \mathbb{F}_q^k$ and $G \in \mathbb{F}_q^{k \times n}$. Let $J \subseteq [n]$ s.t. $G_J$ is of rank $k$. Then we have $c = c_J G_J^{-1} G$.

*Proof.* Notice that $c_J = sG_J$. If $G_J$ is of full rank $k$ then $G_J^{-1}$ is well defined and $c_J G_J^{-1} = sG_J G_J^{-1} = s$. From there, we conclude $c_J G_J^{-1} G = sG = c$. $\square$

### 2.2.2 Classical and quantum decoding problems

Before defining our coding problem, we define the Bernoulli error distributions that we will use.

**Definition 7.** For $q \in \mathbb{N}^*$, with $q \ge 2$ and $\omega \in [0, 1]$, we define the Bernoulli probability function $b_q: F_q \to \mathbb{R}$ satisfying $b_q(0) = 1 - w$ and $b_q(i) = \frac{w}{q-1}$ for $i \ne 0$.

**Definition 8.** For $q \in \mathbb{N}^*$, with $q \ge 2$ and $\omega \in [0, 1]$ we define the distribution $\mathcal{B}(q, \omega)$ sampled as follows: pick $x$ w.p. $b_q(x)$, return $x$.

We now define the Bernoulli distribution on vectors on $F_q^n$ where each coordinate is taken according to $\mathcal{B}(q, \omega)$.

**Definition 9.** For $q, n \in \mathbb{N}^*$, $\omega \in [0, 1]$, with $q \ge 2$ we define the distribution $\mathcal{B}(q, n, \omega)$ sampled as follows: for $i \in \{1, \dots, n\}$, $x_i \leftarrow \mathcal{B}(q, \omega)$, return $x = x_1, \dots, x_n$. Notice that sampling from $\mathcal{B}(q, n, \omega)$ is equivalent to the following sampling procedure: pick $x$ w.p. $(\frac{\omega}{q-1})^{|x|} (1-\omega)^{n-|x|}$, return $x$.
What we are interested here is the decoding problem as it arises in cryptography, but we will describe it here by using the language of information theory. We have a message $\mathbf{m} \in F_q^k$ which is encoded via a generating matrix $\mathbf{G} \in F_q^{k \times n}$. The encoded message $\mathbf{m}\mathbf{G}$ is sent through a channel and an error $\mathbf{e}$ occurs. The receiver gets the message $\mathbf{m}\mathbf{G} + \mathbf{e}$ and his goal is to recover $\mathbf{m}$. Notice that the receiver also knows the generating matrix $\mathbf{G}$ so his goal is, given $\mathbf{G}$ and $\mathbf{y} = \mathbf{m}\mathbf{G} + \mathbf{e}$, to recover $\mathbf{m}$.

The way we model the error is that $\mathbf{e}$ is sampled from the Bernoulli distribution $\mathcal{B}(q, n, \omega)$ for some chosen $\omega$. Note that there are other choices for the error model that can be of interest that we discuss in the next section. We first define the distribution of input/solution to our decoding problem.

**Definition 10.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$, for $\omega \in [0, 1]$, we define the distribution $\mathcal{D}(q, n, k, \omega)$ sampled as follows: $\mathbf{G} \leftarrow \{0, 1\}^{k \times n}$, $\mathbf{m} \leftarrow \mathbb{F}_q^{k}$, $\mathbf{c} = \mathbf{m}\mathbf{G}$, $\mathbf{e} \leftarrow \mathcal{B}(q, n, \omega)$, $\mathbf{y} = \mathbf{c} + \mathbf{e}$, return $(\mathbf{G}, \mathbf{y}, \mathbf{c})$.

We can now define our classical decoding problem

**Definition 11.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$, for $\omega \in [0, 1]$, the decoding problem $\mathcal{DP}(q, n, k, \omega)$ is the following. We sample $(\mathbf{G}, \mathbf{y}, \mathbf{c}) \leftarrow \mathcal{D}(q, n, k, \omega)$ and the goal is, given only $(\mathbf{G}, \mathbf{y})$, to recover $\mathbf{c}$.

Another problem of interest is finding short codewords.

**Definition 12.** For $q, n, k \in \mathbb{N}$ with $q \ge 2$ and $\omega \in (0, 1)$, the short codeword problem $\mathcal{SCP}(q, n, k, \omega)$ is the following. We sample $\mathbf{H} \leftarrow \mathbb{F}_q^{n \times (n-k)}$ and the goal is, given $\mathbf{H}$, to find $\mathbf{c} \in \mathbb{F}_q^n \setminus \{\mathbf{0}\}$ st. $\mathbf{H}\mathbf{c}^\top = \mathbf{0}$ and $|\mathbf{c}| \le \omega n$.

We now consider the quantum decoding problem. Now, instead of choosing a random error $\mathbf{e}$ from $\mathcal{B}(q, n, \omega)$ and constructing $\mathbf{y} = \mathbf{c} + \mathbf{e}$, we construct a quantum state that is a superposition of all these noisy codewords. This motivates the following definition for the input/solution distribution.

**Definition 13.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$ and $\omega \in [0, 1]$, we define the distribution $\mathcal{D}_Q(q, n, k, \omega)$ sampled as follows: $\mathbf{G} \leftarrow \{0, 1\}^{k \times n}$, $\mathbf{m} \leftarrow \mathbb{F}_q^k$, $\mathbf{c} = \mathbf{m}\mathbf{G}$, $|\psi_c\rangle = \sum_{e \in F_q^n} \sqrt{\omega^{|e|}(1-\omega)^{n-|e|}}|\mathbf{c} + \mathbf{e}\rangle$, return $(\mathbf{G}, |\psi_c\rangle, \mathbf{c})$.

From there, we define our quantum decoding problem.

**Definition 14.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$, for $\omega \in [0, 1]$, the decoding problem $\mathcal{QDP}(q, n, k, \omega)$ is the following. We sample $(\mathbf{G}, |\psi_c\rangle, \mathbf{c}) \leftarrow \mathcal{D}_Q(q, n, k, \omega)$ and the goal is, given only $(\mathbf{G}, |\psi_c\rangle)$, to recover $\mathbf{c}$.

The above definition can be generalized to any probability function $P: \mathbb{F}_q^n \to \mathbb{R}$ by considering the state $|\psi_c\rangle = \sum_{e \in F_q^n} \sqrt{P(e)}|\mathbf{c} + \mathbf{e}\rangle$. Moreover, and this is specific to the quantum setting, this can be generalized to any function $f: \mathbb{F}_q^n \to \mathbb{C}$ with $\|f\|_2 = 1$ by considering the state $|\psi_c\rangle = \sum_{e \in F_q^n} f(e)|\mathbf{c} + \mathbf{e}\rangle$. This is what motivates the following definitions.

**Definition 15.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$, for $f: \mathbb{F}_q^n \to \mathbb{C}$ with $\|f\|_2 = 1$, we define the distribution $\mathcal{D}_Q(q, n, k, f)$ sampled as follows: $\mathbf{G} \leftarrow \{0, 1\}^{k \times n}$, $\mathbf{m} \leftarrow \mathbb{F}_q^k$, $\mathbf{c} = \mathbf{m}\mathbf{G}$, $|\psi_c\rangle = \sum_{e \in F_q^n} f(e)|\mathbf{c}+\mathbf{e}\rangle$, return $(\mathbf{G}, |\psi_c\rangle, \mathbf{c})$.

**Definition 16.** For $q, n, k \in \mathbb{N}^*$, with $q \ge 2$, for $f: \mathbb{F}_q^n \to \mathbb{C}$ with $\|f\|_2 = 1$, the decoding problem $\mathcal{QDP}(q, n, k, f)$ is the following. We sample $(\mathbf{G}, |\psi_c\rangle, \mathbf{c}) \leftarrow \mathcal{D}_Q(q, n, k, f)$ and the goal is, given only $(\mathbf{G}, |\psi_c\rangle)$, to recover $\mathbf{c}$.
### 2.2.3 Punctured codes and Prange's algorithm

We will use in what follows the notion of punctured and shortened code.

**Definition 17 (Punctured and shortened code).** Let $\mathcal{C} \subseteq \mathbb{F}_q^n$ be a linear code over $\mathbb{F}_q$ of length $n$. Let $J \subseteq [n]$ be a subset of code positions. The punctured code $\mathcal{C}_J$ with respect to $J$ is defined as $\mathcal{C}_J = \{\mathbf{c}_J : \mathbf{c} \in \mathcal{C}\}$. The shortened code $\mathcal{C}^J$ with respect to $J$ is defined as $\mathcal{C}^J = \{\mathbf{c}_J : \mathbf{c} \in \mathcal{C}, \mathbf{c}_{[n]\setminus J} = \mathbf{0}\}$ (i.e. the set of codewords of $\mathcal{C}$ where we keep only the positions in $J$ and which are zero outside $J$).

It is readily seen that these two operations commute when taking the dual

**Lemma 2.** For any linear code $\mathcal{C}$ and any subset $J$ of positions of this code

$$ (\mathcal{C}_J)^\perp = (\mathcal{C}^\perp)^J \\ (\mathcal{C}^J)^\perp = (\mathcal{C}^\perp)_J. $$

**A variation of the Prange algorithm.** We recall here a result which is essentially folklore in coding theory, namely that there is a probabilistic polynomial time algorithm for finding short codewords in a random linear code of dimension $k$ and length $n$ over $\mathbb{F}_q$ which produces short codewords of weight $\lfloor \frac{(q-1)(n-k)}{q} \rfloor$. It simply uses linear algebra. For this, consider a parity-check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ of $\mathcal{C}$ and run $\Theta(\sqrt{n})$ times the following procedure

1. Choose uniformly at random subset $J$ of $k$ positions of $\mathcal{C}$. Let $\bar{J} = [n] \setminus J$.

2. If $\mathbf{H}_J$ is not of rank $n-k$, abort and else choose $\mathbf{c}$ on $J$ as a random vector of Hamming weight 1.

3. Find the remaining entries of $\mathbf{c}$ by solving the linear system

$$ \mathbf{H}_J \mathbf{c}_J^\top = - \mathbf{H}_J \mathbf{c}_J $$

4. If $|\mathbf{c}| = \lfloor \frac{(q-1)(n-k)}{q} \rfloor$ output $\mathbf{c}$.

The rationale behind this algorithm is that the expected weight of such a $\mathbf{c}$ is $1 + \frac{(q-1)(n-k)}{q}$ and that it can be proved that it takes the right weight with probability $\Omega(\frac{1}{\sqrt{n}})$. Note that all the known (be they classical or quantum) algorithms that produce asymptotically relative weights $\omega < \frac{(1-q)(1-R)}{q}$ where $R = \frac{k}{n}$ is the code rate have exponential complexity.

## 2.3 Distinguishing quantum states

**Proposition 6 (Helstrom's measurement).** Let $|\psi_0\rangle, |\psi_1\rangle$ be 2 quantum pure states s.t. $|\langle\psi_0|\psi_1\rangle| = u$. There exists a quantum projective measurement $\Pi = \{\Pi_0, \Pi_1\}$ s.t. $\forall c \in \{0,1\}$, $\text{tr}(\Pi_c|\psi_c\rangle\langle\psi_c|) = \frac{1}{2} + \frac{\sqrt{1-u^2}}{2}$.

In the above measurement, the measurement gives the correct answer w.p. $\frac{1}{2} + \frac{\sqrt{1-u^2}}{2}$ and gives the opposite answer w.p. $\frac{1}{2} - \frac{\sqrt{1-u^2}}{2}$. Another measurement of interest is the one arising in the context of unambiguous state discrimination. Here we allow the measurement to answer “I don't know” (which corresponds to outcome 2). What we require from the measurement is that if the measurement does not answer 2 then it always answers the correct value. The optimal unambiguous measurement is given by the proposition below.
**Proposition 7 (Unambiguous State Discrimination).** Let $|\psi_0\rangle, |\psi_1\rangle$ be 2 quantum pure states s.t. $|\langle\psi_0|\psi_1\rangle| = u$. There exists a POVM $F = \{F_0, F_1, F_2\}$ s.t. $\forall c \in \{0, 1\}$, $\text{tr}(F_c|\psi_c\rangle\langle\psi_c|) = 1 - u$ and $\text{tr}(F_2|\psi_c\rangle\langle\psi_c|) = u$.

The optimal unambiguous measurement is not known when there are more than 2 states. We present a detailed analysis of USD with $q$ states in Section 4.1, where we give known results and also provide some new ones.

The final measurement of interest is the Pretty Good Measurement, which is a generic measurement to distinguish $n$ quantum states.

**Definition 18 (Pretty Good Measurement).** Consider an ensemble $\{|\psi_i\rangle\}_{i \in [n]}$ of $n$ quantum pure states. The Pretty Good Measurement associated to this ensemble is the POVM $\{M_i\}_{i \in [n]}$ with

$$M_i = \rho^{-\frac{1}{2}} |\psi_i\rangle\langle\psi_i| \rho^{-\frac{1}{2}} \quad \text{given} \quad \rho = \sum_{i \in [n]} |\psi_i\rangle\langle\psi_i|.$$

One can easily check that each $M_i \ge 0$ and that $\sum_i M_i = \rho^{-\frac{1}{2}} \rho \rho^{-\frac{1}{2}} = I$.

**Proposition 8.** [BK02, Mon06] Consider an ensemble $\{|\psi_i\rangle\}_{i \in [n]}$ of $n$ quantum pure states and $\{M_i\}_{i \in [n]}$ the associated pretty good measurement. We consider the setting where $i$ is chosen at random and we want to recover $i$ from $|\psi_i\rangle$. Let $P_{PGM}$ be the probability of success using the PGM and $P_{OPT}$ be the optimal success probability. This means

$$P_{PGM} = \frac{1}{n} \sum_{i} \text{tr}(|\psi_i\rangle\langle\psi_i|M_i) \\ P_{OPT} = \max_{\{N_i\}} \frac{1}{n} \sum_{i} \text{tr}(|\psi_i\rangle\langle\psi_i|N_i)$$

where the maximum is over all POVMs $\{N_i\}_{i \in [n]}$. We have

$$P_{PGM} \le P_{OPT} \le \sqrt{P_{PGM}}.$$

## 2.4 The classical and quantum Fourier transform on $\mathbb{F}_q^n$

In this article, we will use the quantum Fourier transform on $\mathbb{F}_q^n$ where $\mathbb{F}_q$ is the finite field $\mathbb{F}_q$.

**Definition and basic properties.** It is based on the characters of the group $(\mathbb{F}_q^n, +)$ which are defined as follows (for more details see [LN97, Chap 5, S1], in particular a description of the characters in terms of the trace function is given in [LN97, Ch. 5, S1, Th. 5.7]).

**Definition 19.** Fix $q = p^s$ for a prime integer $p$ and an integer $s \ge 1$. The characters of $\mathbb{F}_q$ are the functions $\chi_y : \mathbb{F}_q \to \mathbb{C}$ indexed by elements $y \in \mathbb{F}_q$ defined as follows

$$\chi_y(x) \triangleq e^{\frac{2i\pi \text{tr}(x \cdot y)}{p}}, \quad \text{with} \\ \text{tr}(a) \triangleq a + a^p + a^{p^2} + \dots + a^{p^{s-1}}.$$

where the product $x \cdot y$ corresponds to the product of elements in $\mathbb{F}_q$. We extend the definition to vectors $x, y \in \mathbb{F}_q^n$ as follows:

$$\chi_y(\mathbf{x}) \triangleq \prod_{i=1}^{n} \chi_{y_i}(x_i).$$
When $q$ is prime, we have $\chi_y(x) = e^{\frac{2i\pi xy}{q}}$. In the case where $q$ is not prime, the above definition is not necessarily easy to handle for computations. Fortunately, characters have many desirable properties that we can use for our calculations.

**Proposition 9.** The characters $\chi_y : \mathbb{F}_q^n \to \mathbb{C}$ have the following properties

1. (Group Homomorphism). $\forall \mathbf{y} \in \mathbb{F}_q^n$, $\chi_y$ is a group homomorphism from $(\mathbb{F}_q^n, +)$ to $(\mathbb{C}, \cdot)$ meaning that $\forall \mathbf{x}, \mathbf{x}' \in \mathbb{F}_q^n$, $\chi_y(\mathbf{x} + \mathbf{x}') = \chi_y(\mathbf{x}) \cdot \chi_y(\mathbf{x}')$.

2. (Symmetry). $\forall \mathbf{x}, \mathbf{y} \in \mathbb{F}_q^n$, $\chi_y(\mathbf{x}) = \chi_x(\mathbf{y})$

3. (Orthogonality of characters). The characters are orthogonal functions meaning that $\forall \mathbf{x}, \mathbf{x}' \in \mathbb{F}_q^n$, $\sum_{\mathbf{y} \in \mathbb{F}_q^n} \chi_y(\mathbf{x})\chi_{y'}(\mathbf{x}') = q^n \delta_{\mathbf{x},\mathbf{x}'}$. In particular $\sum_{\mathbf{y} \in \mathbb{F}_q^n} |\chi_y(\mathbf{x})|^2 = q$ and $\forall \mathbf{x} \in \mathbb{F}_q^n \setminus \{0\}, \sum_{\mathbf{y} \in \mathbb{F}_q^n} \chi_y(\mathbf{x}) = 0$.

Notice that these imply some other properties on characters. For instance $\chi_y(0) = 1$ or $|\chi_y(\mathbf{x})| = 1$ for any $\mathbf{x}, \mathbf{y} \in \mathbb{F}_q^n$. The orthogonality of characters, allows to define a unitary transform which is nothing but the classical or the quantum Fourier transform on $\mathbb{F}_q^n$.

**Definition 20.** For a function $f : \mathbb{F}_q^n \to \mathbb{C}$, we define the (classical) Fourier transform $\hat{f}$ as

$$ \hat{f}(\mathbf{x}) = \frac{1}{\sqrt{q^n}} \sum_{\mathbf{y} \in \mathbb{F}_q^n} \chi_x(\mathbf{y}) f(\mathbf{y}). $$

The quantum Fourier transform QFT on $\mathbb{F}_q^n$ is the quantum unitary satisfying $\forall \mathbf{x} \in \mathbb{F}_q^n$,

$$ \text{QFT} |\mathbf{x}\rangle = \frac{1}{\sqrt{q^n}} \sum_{\mathbf{y} \in \mathbb{F}_q^n} \chi_x(\mathbf{y}) |\mathbf{y}\rangle. $$

We will also write $|\hat{\psi}\rangle \triangleq \text{QFT}|\psi\rangle$.

Note that when $|\psi\rangle = \sum_{\mathbf{x} \in \mathbb{F}_q^n} f(\mathbf{x})|\mathbf{x}\rangle$ we have

$$ |\hat{\psi}\rangle = \sum_{\mathbf{x} \in \mathbb{F}_q^n} \hat{f}(\mathbf{x})|\mathbf{x}\rangle. $$

The Fourier transform can also be viewed as expressing the coefficients of a state in the Fourier basis $\{|\hat{x}\rangle, \mathbf{x} \in \mathbb{F}_q^n\}$ as shown by

**Fact 1.** Let $|\psi\rangle = \sum_{\mathbf{y} \in \mathbb{F}_q^n} f(\mathbf{y})|\mathbf{y}\rangle$, then

$$ |\psi\rangle = \sum_{\mathbf{x} \in \mathbb{F}_q^n} \hat{f}(-\mathbf{x})|\hat{x}\rangle. $$

This follows on the spot from the fact that if $|\psi\rangle = \sum_{\mathbf{x} \in \mathbb{F}_q^n} c_\mathbf{x}|\hat{x}\rangle$, then

$$ c_{\mathbf{x}} = \langle \hat{x} | \psi \rangle = \frac{1}{\sqrt{q^n}} \sum_{\mathbf{y} \in \mathbb{F}_q^n} \overline{\chi_{\mathbf{x}}(\mathbf{y})} f(\mathbf{y}) = \hat{f}(-\mathbf{x}). $$
**Translations amount to multiplication by a phase in the Fourier basis.** It will be convenient for what follows to bring in the shift and phase operators which are defined by

**Definition 21** (shift and phase operators). For $b$ in $\mathbb{F}_q^n$, let $X_b$ be the shift operator $X_b|x\rangle = |x+b\rangle$ and $Z_b$ be the phase operator $Z_b = \chi_x(b)|x\rangle$.

The main properties of the Fourier transform follow from the fact that the characters are the common eigenbasis of all shift operators (and therefore all convolution operators). In the quantum setting, this amounts to the fact that the quantum states $\{|\hat{x}\rangle, x \in \mathbb{F}_q^n\}$ form an eigenbasis of the shift operators as shown by

**Proposition 10.** We have for all $b$ in $\mathbb{F}_q^n$ that $|\hat{x}\rangle$ is an eigenstate of $X_b$ associated to the eigenvalue $\chi_x(-b)$ and

$$X_b \cdot \text{QFT} = \text{QFT} \cdot Z_{-b} \qquad (2)$$

$$\text{QFT} \cdot X_b = Z_b \cdot \text{QFT}. \qquad (3)$$

*Proof.* Let $x \in \mathbb{F}_q^n$. We observe that

$$\begin{aligned}
X_b \cdot \text{QFT}|x\rangle &= \frac{1}{\sqrt{q^n}} \sum_{y \in \mathbb{F}_q^n} \chi_x(y)|y+b\rangle \\
&= \frac{1}{\sqrt{q^n}} \sum_{y \in \mathbb{F}_q^n} \chi_x(y-b)|y\rangle \\
&= \chi_x(-b) \frac{1}{\sqrt{q^n}} \sum_{y \in \mathbb{F}_q^n} \chi_x(y)|y\rangle \\
&= \text{QFT} \cdot Z_{-b}|x\rangle.
\end{aligned}$$

This computation shows that $|\hat{x}\rangle = \text{QFT}|x\rangle$ is an eigenstate of the shift operator $X_b$ associated to the eigenvalue $\chi_x(-b)$. The other equality follows from this and the symmetry property 2 of Proposition 9 which implies that

$$\text{QFT}^{\dagger} = \overline{\text{QFT}} \qquad (4)$$

where by $\overline{M}$ we mean the (complex) conjugate operator of the operator $M$ which is defined by $\overline{M} \triangleq \sum_{x,y} \overline{M_{x,y}}|x\rangle\langle y|$ when $M = \sum_{x,y} M_{x,y}|x\rangle\langle y|$. (2) namely implies that

$$\text{QFT}^{\dagger} \cdot X_b^{\dagger} = Z_{-b}^{\dagger} \cdot \text{QFT}^{\dagger}$$

This in turn means that

$$\overline{\text{QFT}} \cdot X_{-b} = Z_b \cdot \overline{\text{QFT}},$$

or equivalently

$$\overline{\overline{\text{QFT}} \cdot X_{-b}} = Z_b \cdot \overline{\overline{\text{QFT}}}$$

which gives

$$\text{QFT} \cdot X_{-b} = Z_{-b} \cdot \text{QFT},$$

and therefore proving (3). $\square$

We will focus on the following quantum states $|\psi\rangle = \sqrt{1-\tau}|0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{\tau}{q-1}}|\alpha\rangle$ associated to a $q$-ary channel of crossover probability $\tau$. Indeed, when we measure such a quantum state, we namely get an element of $\mathbb{F}_q$ which can be viewed as a sample of an error output by such a channel. The quantum Fourier transform applied to such states yields a state of the same form, since it is readily verified that
**Lemma 3.** Let $\tau \in [0, \frac{q-1}{q}]$ and $|\psi\rangle = \sqrt{1-\tau}|0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{\tau}{q-1}}|\alpha\rangle$. We have

$$ \text{QFT} |\psi\rangle = \sqrt{1 - \tau^{\perp}} |0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{\tau^{\perp}}{q-1}} |\alpha\rangle $$

$$ \text{with } \tau^{\perp} = \frac{(\sqrt{(q-1)(1-\tau)} - \sqrt{\tau})^2}{q}. $$

*Proof.* We write

$$ \begin{aligned} \text{QFT} |\psi\rangle &= \sqrt{\frac{1-\tau}{q}} \sum_{y \in \mathbb{F}_q} |y\rangle + \sqrt{\frac{\tau}{q(q-1)}} \sum_{y \in \mathbb{F}_q} \sum_{\alpha \in \mathbb{F}_q^*} \chi_{\alpha}(y) |y\rangle \\ &= \left( \sqrt{\frac{1-\tau}{q}} + \sqrt{\frac{q\tau}{q-1}} \right) |0\rangle + \sum_{y \in \mathbb{F}_q^*} \left( \sqrt{\frac{1-\tau}{q}} - \sqrt{\frac{\tau}{q(q-1)}} \right) |y\rangle \end{aligned} $$

where in the last equality we used the fact that for $y \neq 0$, we have $\sum_{\alpha \in \mathbb{F}_q} \chi_{\alpha}(y) = \sum_{\alpha \in \mathbb{F}_q} \chi_y(\alpha) = 0$ (by using first the symmetry property and then the orthogonality property of characters of Proposition 9). This implies that $\sum_{\alpha \in \mathbb{F}_q^*} \chi_{\alpha}(y) = -\chi_0(y) = -1$. In order to conclude, notice that

$$ \sqrt{\frac{\tau^{\perp}}{q-1}} = \frac{\sqrt{(q-1)(1-\tau)} - \sqrt{\tau}}{\sqrt{q(q-1)}} = \sqrt{\frac{1-\tau}{q}} - \sqrt{\frac{\tau}{q(q-1)}} $$

$$ \text{which means we can rewrite } \text{QFT } |\psi\rangle = \sqrt{1-\tau^{\perp}}|0\rangle + \sum_{y \in \mathbb{F}_q^*} \sqrt{\frac{\tau^{\perp}}{q-1}}. \quad \square $$

We will also need to describe how the quantum Fourier transform acts on shifts of $|\psi\rangle$

**Lemma 4.** Let $\tau \in [0, \frac{q-1}{q}]$, $b \in \mathbb{F}_q$ and denote by $|\psi_b\rangle$ the state $X_b|\psi\rangle$ where $|\psi\rangle \stackrel{\Delta}{=} \sqrt{1-\tau}|0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{\tau}{q-1}}|\alpha\rangle$. We have

$$ |\psi_b\rangle = \sqrt{1-\tau}|b\rangle + \sum_{\alpha \neq b} \sqrt{\frac{\tau}{q-1}}|\alpha\rangle $$

$$ \text{QFT } |\psi_b\rangle = \sqrt{1 - \tau^{\perp}} |0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \chi_{\alpha}(b) \sqrt{\frac{\tau^{\perp}}{q-1}} |\alpha\rangle. $$

*Proof.* The first point follows right away from the definition of these quantities, whereas the second point follows on the spot from Fact 10 and the previous lemma:

$$ \begin{aligned} \text{QFT } |\psi_b\rangle &= \text{QFT} \cdot X_b |\psi\rangle \\ &= Z_b \cdot \text{QFT} |\psi\rangle \quad (\text{by Fact 10}) \\ &= Z_b \left( \sqrt{1 - \tau^{\perp}} |0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \sqrt{\frac{\tau^{\perp}}{q-1}} |\alpha\rangle \right) \quad (\text{by Lemma 3}) \\ &= \sqrt{1 - \tau^{\perp}} |0\rangle + \sum_{\alpha \in \mathbb{F}_q^*} \chi_{\alpha}(b) \sqrt{\frac{\tau^{\perp}}{q-1}} |\alpha\rangle. \end{aligned} \quad \square $$
**Applying the quantum Fourier transform on periodic states.** Regev's reduction applies to states which are periodic. In our case, they will be of the form $\frac{1}{\sqrt{Z}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle$ where $Z$ is some normalizing constant, $C$ some linear code of length $n$ over $\mathbb{F}_q$ and $f$ some function from $\mathbb{F}_q^n$ to $\mathbb{C}$. This state can be written as $\frac{1}{\sqrt{Z}} \sum_{x \in \mathbb{F}_q^n} g(x)|x\rangle$ where $g(x) = \sum_{c \in C} f(x-c)$. We clearly have in this case $g(x+c) = g(x)$ for any $x \in \mathbb{F}_q^n$ and any $c \in C$. For such states, we have the following

**Proposition 11.** Consider a function $f: \mathbb{F}_q^n \to \mathbb{C}$. We have for all linear codes $C \subseteq \mathbb{F}_q^n$:

$$ \mathrm{QFT} \left( \frac{1}{\sqrt{Z}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} f(e) |c+e\rangle \right) = \frac{|C|}{\sqrt{Z}} \sum_{\mathbf{y} \in C^{\perp}} \hat{f}(\mathbf{y}) |\mathbf{y}\rangle $$

where $Z$ is some normalizing constant.

*Proof.* The proposition follows from the following computation

$$ \begin{aligned} \mathrm{QFT} \left( \frac{1}{\sqrt{Z}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} f(e) |c+e\rangle \right) &= \frac{1}{\sqrt{Z}} \sum_{e \in \mathbb{F}_q^n} f(e) \sum_{c \in C} \sum_{x \in \mathbb{F}_q^n} \chi_y(c+e) |y\rangle \\ &= \frac{1}{\sqrt{Z}} \sum_{e \in \mathbb{F}_q^n} f(e) \sum_{\mathbf{y} \in \mathbb{F}_q^n} \chi_y(e) |\mathbf{y}\rangle \sum_{c \in C} \chi_y(c) \\ &= \frac{|C|}{\sqrt{Z}} \sum_{e \in \mathbb{F}_q^n} \chi_y(e) f(e) \sum_{\mathbf{y} \in C^{\perp}} |\mathbf{y}\rangle \tag{5} \\ &= \frac{|C|}{\sqrt{Z}} \sum_{\mathbf{y} \in C^{\perp}} \hat{f}(\mathbf{y}) |\mathbf{y}\rangle \end{aligned} $$

where (5) follows from a slight generalization of (3) of Proposition 9, namely that

$$ \begin{aligned} \sum_{c \in C} \chi_y(c) &= |C| \quad \text{if } \mathbf{y} \in C^{\perp} \\ &= 0 \quad \text{otherwise,} \end{aligned} $$

which follows by a similar reasoning by noticing that $C^{\perp}$ can be viewed as the set of trivial characters acting on $C$:

$$ \{\mathbf{y} \in \mathbb{F}_q^n : \chi_y(\mathbf{c}) = 1, \forall \mathbf{c} \in C\} = C^{\perp}. $$

□

# 3 Algorithms for the binary quantum decoding problem

## 3.1 Quantum polynomial time algorithm using unambiguous state discrimination

We present our first quantum algorithm that directly uses unambiguous state discrimination.

**Theorem 4.** Let $R \in (0,1)$. For any $\omega < (\frac{R}{2})^{\perp} \triangleq \frac{1}{2} - \sqrt{\frac{R}{2}(1-\frac{R}{2})}$, there exists a quantum algorithm that solves QDP(2, n, ⌊Rn⌋, ω) w.p. $1 - 2^{-\Omega(n)}$.
Proof. We fix $R, \omega$, as well as $n \in \mathbb{N}$ and $k = \lfloor Rn \rfloor$. We consider an instance of QDP(2, $R, k, \omega$) so we have a random matrix $\mathbf{G} \leftarrow \{0, 1\}^{k \times n}$, $\mathbf{c} = \mathbf{m}\mathbf{G}$ for a randomly chosen $\mathbf{m} \leftarrow \{0, 1\}^k$ and the state $|\Psi_c\rangle = \bigotimes_{i=1}^n |\psi_{c_i}^\omega\rangle$ where $|\psi_{c_i}^\omega\rangle = \sqrt{1-\omega}|c_i\rangle + \sqrt{\omega}|1-c_i\rangle$. We consider the following algorithm for solving our Quantum Decoding Problem

Quantum algorithm for QDP using USD

1. Start from $|\Psi_c\rangle = \bigotimes_{i=1}^n |\psi_{c_i}^\omega\rangle$. Notice that $|\langle\psi_0^\omega|\psi_1^\omega\rangle| = 2\sqrt{\omega(1-\omega)}$.

2. Perform the optimal unambiguous measurement from Proposition 7 on each qubit of $|\Psi_c\rangle$ in order to guess $c_i$, which can be done w.p. $p = 1 - |\langle\psi_0^\omega|\psi_1^\omega\rangle| = 1 - 2\sqrt{\omega(1-\omega)} \triangleq 2\omega^\perp$. Let $J \subseteq [n]$ be the set of indices where this measurement succeeds. The algorithm recovers here $c_J$.

3. If $G_J \in \{0, 1\}^{k \times |J|}$ is of rank $k$, recover $\mathbf{c}$ from $c_J$ by computing $c_J G_J^{-1} G$.

Let $p = 2\omega^\perp$. Since $\omega < (R/2)^\perp$, we have $2\omega^\perp > R$ and there exists an absolute constant $\gamma > 0$ s.t. $p = R + \gamma$. Let $X_i$ be the random variable s.t. $X_i(i \in J) = 1$ and $X_i(i \notin J) = 0$. The $X_i$ are independent random Bernoulli variables with parameter $p$. Using Hoeffding's inequality, we first compute

$$P_1 = \Pr \left[ |J| \ge k + \frac{\gamma n}{2} \right] \ge \Pr \left[ \sum_{i=1}^{n} X_i \ge pn - \frac{\gamma n}{2} \right] \ge 1 - 2^{-\frac{\gamma^2 n}{2}}$$

Then, using Proposition 4 we compute

$$P_2 = \Pr \left[ \text{rank}(G_J) = k \mid |J| \ge k + \frac{\gamma n}{2} \right] \ge 1 - 2^{-\gamma n}.$$

Notice that the algorithm recovers $c_J$ so from Proposition 5, if $\text{rank}(G_J) = k$ then the algorithm successfully recovers $\mathbf{c}$. If we define $P_{\text{Succ}}$ to be the probability of success of the algorithm, we therefore have

$$P_{\text{Succ}} \ge \Pr[\text{rank}(G_J) = k] \ge P_1 P_2 \ge 1 - 2^{-\Omega(n)}.$$

<figure><img src="image_7.png" /></figure>

**Using complex phases.** It is also possible to put complex phases in front of the error. This means we consider the states

$$|\Psi_c\rangle = \bigotimes_{i=1}^{n} \sqrt{1-\omega}|c_i\rangle + \sqrt{\omega}e^{i\theta}|1-c_i\rangle.$$

Interesting phenomena appear and we refer to Appendix A for a full analysis.

## 3.2 Reduction between quantum decoding problems in the binary setting

The above algorithm is interesting as it presents an polynomial time algorithm for the quantum decoding problem in a regime where its classical counterpart requires - with our current knowledge - an exponential classical or quantum algorithm. However, it completely fails when $\omega > (R/2)^\perp$ and the best algorithm for QDP(2, $n$, $\lfloor Rn \rfloor$, $\omega$) is still by first measuring and then solving DP(2, $n$, $\lfloor Rn \rfloor$, $\omega$). Is there a way to improve the best algorithms QDP(2, $n$, $\lfloor Rn \rfloor$, $\omega$) by using ideas of the previous section? The answer is yes. Instead of using USD, we use what we call partial Unambiguous State Discrimination. Our measurement will still abort with some probability but
when it does not abort, we still allow a small probability failure but which will typically be smaller than if we used Helstrom's measurement. With this technique we can actually show a general reduction theorem for QDP.

**Theorem 5.** Let $R \in (0, 1)$. Let $\omega \in [0, \frac{1}{2})$ and $\omega' \in [0, \frac{1}{2})$ satisfying: $\omega' \le \omega$ and $\frac{\omega}{(\omega')^{\perp}} > R$. Let any $p > \frac{\omega^{\perp}}{(\omega')^{\perp}}$. Let also $k = \lfloor Rn \rfloor$. Then QDP$(2, n, k, \omega) \ll QDP(2, \lfloor pn \rfloor, k, \omega')$ meaning that if we have an algorithm that solves QDP$(2, \lfloor pn \rfloor, k, \omega')$, we can use it to solve QDP$(2, n, k, \omega)$.

In order to prove our theorem, we first present our partial unambiguous state discrimination protocol. As a special case, we obtain our previous algorithm by taking $\omega' = 0$ (the theorem can then be applied when $R < 2\omega^{\perp}$).

### 3.2.1 Partial unambiguous state discrimination

We define $|\psi_0^\omega\rangle = \sqrt{1-\omega}|b\rangle + \sqrt{\omega}|1-b\rangle$. Recall that $\langle\psi_0^\omega|\psi_1^\omega\rangle = 2\sqrt{\omega(1-\omega)} = 1-2\omega^{\perp}$. Fix $\omega, \omega' \in (0, \frac{1}{2})$ with $\omega' \le \omega$. We use the following lemma

**Lemma 5.** Let $\alpha = \sqrt{\frac{\omega^{\perp}}{(\omega')^{\perp}}} \text{ and } \beta = \sqrt{1-\alpha^2}$. There exists a unitary $U$ operation acting on $\text{span}\{|0\rangle, |1\rangle, |2\rangle\}$ s.t.

$$U|\psi_0^\omega\rangle = \alpha|\psi_0^{\omega'}\rangle + \beta|2\rangle$$

$$U|\psi_1^\omega\rangle = \alpha|\psi_1^{\omega'}\rangle + \beta|2\rangle$$

*Proof. [jp: J'enleve le proof sketch, la preuve en appendice est trop longue et n'est pas plus convainante que le calcul ici.]* With the choice of $\alpha$ that was made the hermitian product $\langle\psi_0^\omega|\psi_1^\omega\rangle$ and their image is preserved. As a matter of fact

$$\langle\psi_0^\omega|\psi_1^\omega\rangle = 2\sqrt{\omega(1-\omega)} = 1-2\omega^{\perp}. \qquad (6)$$

Now, if we let $|\psi'_b\rangle \triangleq \alpha|\psi_b^{\omega'}\rangle + \beta|2\rangle$ for $b \in \{0, 1\}$, then we have

$$\begin{aligned}
\langle\psi'_0|\psi'_1\rangle &= |\alpha|^2\langle\psi'_0|\psi'_1\rangle + |\beta|^2 \\
&= |\alpha|^2(1 - 2(\omega')^{\perp}) + |\beta|^2 \quad (\text{by (6)}) \\
&= 1 - 2|\alpha|^2(\omega')^{\perp} \quad (\text{by using } |\beta|^2 = 1 - |\alpha|^2) \\
&= 1 - 2\omega^{\perp} \quad (\text{with our choice of } \alpha).
\end{aligned}$$

By definition of $\beta$, $|\psi'_0\rangle$ and $|\psi'_1\rangle$ are both of norm 1. This together with the equality $\langle\psi_0^\omega|\psi_1^\omega\rangle = \langle\psi'_0|\psi'_1\rangle$ we just proved shows that $U$ as defined above preserves the hermitian product on $\text{span}\{\psi_0^\omega, \psi_1^\omega\} = \text{span}\{|0\rangle, |1\rangle\}$. It suffices to choose $U|2\rangle$ of norm 1 and orthogonal to both $|\psi'_0\rangle$ and $|\psi'_1\rangle$ to obtain a unitary transform since by construction it preserves the hermitian product on $\text{span}\{|0\rangle, |1\rangle, |2\rangle\}$. $\square$

**Proposition 12.** Let $\omega, \omega' \in (0, \frac{1}{2})$ with $\omega' < \omega$. There exists a quantum measurement s.t. when it is applied on $|\psi_b^\omega\rangle$, the resulting state is $|\psi_b^{\omega'}\rangle$ w.p. $\frac{\omega^{\perp}}{(\omega')^{\perp}}$ and $|2\rangle$ w.p. $1 - \frac{\omega^{\perp}}{(\omega')^{\perp}}$.

*Proof.* Start from $|\psi_b^\omega\rangle$ and apply the unitary $U$ from Lemma 5. Then, perform the two outcomes projective measurement $\{|0\rangle\langle 0| + |1\rangle\langle 1|\rangle, |2\rangle\langle 2|\rangle$ on the state $U|\psi_b^\omega\rangle = \alpha|\psi_b^{\omega'}\rangle + \beta|2\rangle$. We obtain the first outcome w.p. $|\alpha|^2 = \frac{\omega^{\perp}}{(\omega')^{\perp}}$ and the resulting state is $|\psi_b^{\omega'}\rangle$ and the second outcome w.p. $|\beta|^2$ and the resulting outcome is $|2\rangle$. $\square$

Unambiguous state discrimination can be seen as a special case of this operation by taking $\omega' = 0$, which gives $\alpha = \sqrt{2\omega^{\perp}}$ and the probability of success is $\alpha^2 = 2\omega^{\perp} = 1 - \langle\psi_0^\omega|\psi_1^\omega\rangle$.
### 3.2.2 Proof of Theorem 5

In order to prove Theorem 5, one can just apply the algorithm of Section 3.1 in a similar fashion. We take any $\omega, \omega' \in (0, \frac{1}{2})$ with $\omega' \le \omega$ and $\frac{\omega}{(\omega')^{\perp}} > R$. We also fix $p > \frac{\omega}{(\omega')^{\perp}}$.

We want to solve QDP(2, n, k, ω) using an algorithm that solves QDP(2, ⌊pn⌋, k, ω'). We start from $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ as well as $|\psi_c\rangle = \bigotimes_{i=1}^n |\psi_{c_i}^\omega\rangle$. We consider the following algorithm

Quantum algorithm for QDP using partial USD

1. Perform the quantum measurement of Proposition 12 on each register of $|\psi_c\rangle$. Let $J \subseteq [n]$ be the set of indices where this measurement succeeds i.e. where we obtain $|\psi_{c_i}^{\omega'}\rangle$. By discarding the indices not in $J$, we obtain

$$|\phi_{c_J}\rangle = \bigotimes_{i \in J} |\psi_{c_i}^{\omega'}\rangle.$$

2. Notice that $c_J \in C_J$ and recovering $c_J$ from $|\phi_{c_J}\rangle$ is a quantum decoding problem on $C_J$, more precisely an instance of QDP(2, $|J|$, k, $\omega'$). As long as $|J| \ge \lfloor pn \rfloor$, we use our QDP($q, n, \lfloor pn \rfloor, \omega'$) (by potentially removing excess coordinates if necessary if $|J| > \lfloor pn \rfloor$) to recover $c_J$.

3. We recover $c$ from $c_J$ by computing $c_J \mathbf{G}_J^{-1} \mathbf{G}$.

By definition, we recover $c_J$. We just have to bound the probability to recover $c$. Notice that in Step 1, we have from Proposition 12 that the measurement will succeed w.p. $\frac{\omega}{(\omega')^{\perp}} > p > R$ for each index. As in Section 3.1, this implies that with overwhelming probability, $|J| \ge \lfloor pn \rfloor$ which in turn implies that we can recover $c$ from $c_J$ with overwhelming probability.

### 3.2.3 Interpretation of the above as changing the noise model

In this section, we show how performing (partial) unambiguous state discrimination on a state $|\psi_b\rangle = \sqrt{1-\omega}|b\rangle + \sqrt{\omega}|1-b\rangle$ can be seen as a way to change the noise model applied on the bit $b$. We first define different notions of noisy channels in the binary setting.

**Definition 22.** For a bit $b$, an error probability $\omega$ and abort probability $p$, we define the distributions of the Binary Symmetric Channel BSC($b, \omega$), of the Binary Erasure Channel BEC($b, p$) and of the Binary Symmetric with Errors and Erasures Channel BSEEC($b, \omega, p$) sampled as follows:

$$\text{BSC}(b, \omega) : \text{ return } b \text{ wp. } (1-\omega) \text{ and } (1-b) \text{ wp. } \omega.$$

$$\text{BEC}(b, p) : \text{ return } b \text{ wp. } (1-p) \text{ and } \perp \text{ wp. } p.$$

$$\text{BSEEC}(b, \omega, p) : \text{ return } b \text{ wp. } (1-p)(1-\omega), (1-b) \text{ wp. } (1-p)\omega \text{ and } \perp \text{ wp. } p.$$

For a bit $b$, flipping it w.p. $\omega$ can be seen as passing $b$ through a binary symmetric channel BSC($\omega$). Having this error in superposition means that we have access to the quantum state. Our results can be interpreted as follows

**Proposition 13.** *From $|\psi_b\rangle = \sqrt{1-\omega}|b\rangle + \sqrt{\omega}|1-b\rangle$ it is possible to:*

1. Generate $y \leftarrow \text{BSC}(b, \omega)$ simply by measuring $|\psi_b\rangle$.
2. Generate $y \leftarrow BEC(b, 1 - 2\omega^{\perp})$ by performing unambiguous state discrimination on $|\psi_b\rangle$.

3. Generate $y \leftarrow BSEEC(b, (\frac{\omega^{\perp}}{1-p})^{\perp}, p)$ for any abort probability $p \in [0, 1 - 2\omega^{\perp}]$, by performing partial unambiguous state discrimination on $|\psi_b\rangle$.

Notice that the third case generalizes the 2 first cases by respectively taking $p = 0$ and $p = 1 - 2\omega^{\perp}$. This shows the advantage of having the noise in quantum superposition. It is possible to change the noise from the one coming from a Binary Symmetric Channel to the one coming from a Binary Erasure Channel or a Binary Symmetric with Errors and Erasures Channel.

# 4 Polynomial time algorithm for QDP in the q-ary setting

As we saw in the previous section, unambiguous state discrimination is crucial for polynomial time algorithm for QDP. While this task is very well understood in the binary case, we do not have any general formula in the q-ary setting. Fortunately, the states we consider will have enough structure so that we can fully characterize the optimal unambiguous state discrimination algorithm. We first present this characterization, which is essentially a generalization of the work of [CB98]. We then use this unambiguous state discrimination in the q-ary setting to derive our quantum algorithm for QDP in the q-ary setting, in the same spirit as what we did in Section 3.1.

## 4.1 Unambiguous state discrimination in the q-ary setting

**Definition 23.** An unambiguous state discrimination measurement associated to some states $|\psi_0\rangle, \dots, |\psi_{N-1}\rangle$ is a POVM $\{E_0, \dots, E_{N-1}, E_F\}$ (where $E_F$ stands for the failure outcome) s.t.

$$ \forall i, j \neq i \in [0, N-1], \text{ tr}(E_i|\psi_j\rangle\langle\psi_j|) = 0. $$

To such a POVM, we associate the quantities $P_j \triangleq \text{tr}(E_j|\psi_j\rangle\langle\psi_j|)$ (the probability of correctly guessing j when given $|\psi_j\rangle$, as well as the average success probability $\overline{P_D} \triangleq \frac{1}{N} \sum_{j=0}^{N-1} P_j$.

The optimal unambiguous measurement is not known when there are more than 2 states, however it is known in a case where the states we want to distinguish are linearly independent, have the same a priori probabilities and are symmetric in the following sense [BKMH97]

**Definition 24** (symmetric states). A set $\{|\psi_0\rangle, \dots, |\psi_{N-1}\rangle\}$ in a Hilbert space $\mathcal{H}$ of dimension $N$ is symmetric if and only if there exists a unitary transformation $U$ of order $N$ on $\mathcal{H}$ such that for any $i$ and $j$ in $[0, N-1]$ we have $|\psi_j\rangle = U^{j-i}|\psi_i\rangle$.

In such a case, the optimal unambiguous measurement is known [CB98]

**Proposition 14** (Unambiguous State Discrimination of Symmetric States). Let $\{|\psi_0\rangle, \dots, |\psi_{N-1}\rangle\}$ be a set of $N$ symmetric states associated to a unitary transform $U$. Let $\{E_0, \dots, E_{N-1}, E_F\}$ be any unambiguous state discrimination measurement associated to these states and let $P_j$ and $\overline{P_D}$ be the associated success probabilities. $\overline{P_D}$ always satisfies

$$ \overline{P_D} \le N \min_{r \in [0, N-1]} |c_r|^2, \qquad (7) $$

where $c_r$ are the coordinates of $|\psi_0\rangle$ in the eigenbasis $\{|\gamma_r\rangle, r \in [0, N-1]\}$ of $U$, i.e. $|\psi_0\rangle = \sum_{i=0}^{N-1} c_r |\gamma_r\rangle$. There is a POVM which meets (7) with equality.
A corollary of this result is obtained by taking the Hilbert space of dimension a prime number $p$ and take $U$ as the shift operator $U|x\rangle = |x+1\rangle$ where addition is performed in $\mathbb{F}_p$. It is easy to verify that in this case, the maximal average probability of discrimination $\overline{P}_D^{\text{max}}$ is given by

$$ \overline{P}_D^{\text{max}} = p \min_{r \in \mathbb{F}_p} |\hat{f}(r)|^2 $$

when $|\psi_0\rangle = \sum_{e \in \mathbb{F}_p} f(e)|e\rangle$. This is a consequence of the fact that an eigenbasis of $U$ is given by $\{|\hat{x}\rangle, x \in \mathbb{F}_p\}$ (this is implied by Proposition 10) and from

$$ |\psi_0\rangle = \sum_{x \in \mathbb{F}_p} \hat{f}(-x)|\hat{x}\rangle. $$

The last equation follows from Fact 1. We will actually use and prove a slightly more general result, where in particular the dimension of the Hilbert space is not prime anymore (in which case we can not apply Proposition 14).

**Proposition 15.** Let $|\psi\rangle = \sum_{y \in \mathbb{F}_q^n} f(y)|y\rangle$ for some function $f : \mathbb{F}_q^n \to \mathbb{C}$ s.t. $\|f\|_2 = 1$ and for $b \in \mathbb{F}_q^n$, let $|\psi_b\rangle \triangleq X_b|\psi\rangle$. When the states $|\psi_b\rangle$ are all linearly independent, unambiguous state discrimination of the states $\{|\psi_b\rangle, b \in \mathbb{F}_q^n\}$ is possible and has a maximal average probability of discrimination given by

$$ \overline{P}_D^{\text{max}} = q^n \min_{x \in \mathbb{F}_q^n} |\hat{f}(x)|^2. $$

The proof of this statement borrows many ideas from [CB98]. Before giving it, we have to recall a few points (see [CB98, S II] for more details) about unambiguous state discrimination.

**Unambiguous state discrimination of linearly independent states.** Let $\mathcal{H}$ be the Hilbert space spanned by the $|\psi_b\rangle$'s for $b$ ranging over $\mathbb{F}_q^n$. An optimal (leading to the maximal average probability of discrimination) POVM $\{E_b, b \in \mathbb{F}_q^n\} \cup \{E_F\}$ distinguishing unambiguously all the $|\psi_b\rangle$, where $E_b$ detects unambiguously $|\psi_b\rangle$ for all $b$ in $\mathbb{F}_q^n$, can be chosen of the form

$$ E_b = \frac{P_b}{|\langle \psi_b^\perp | \psi_b \rangle|^2} |\psi_b^\perp\rangle \langle \psi_b^\perp| \qquad (8) $$

where $P_b$ is the probability of detecting $|\psi_b\rangle$ given that the input state was of this form and the $\{|\psi_b^\perp\rangle, b \in \mathbb{F}_q^n\}$ are the reciprocal states of the $|\psi_b\rangle$'s. $|\psi_b^\perp\rangle$ is the state (unique up to an irrelevant phase) which belongs to $\mathcal{H}$ and is orthogonal to all other $|\psi_a\rangle$ for $a$ ranging over $\mathbb{F}_q^n \setminus \{b\}$. The average probability of discrimination is then

$$ \overline{P}_D = \frac{1}{q^n} \sum_{b \in \mathbb{F}_q^n} P_b. $$

Let

$$ E_D \triangleq \sum_{b \in \mathbb{F}_q^n} E_b $$

Since $E_D + E_F = 1$ and $E_F$ should be a positive semi-definite operator, it is readily verified that an optimum POVM (i.e. one that gives the maximum average probability of discrimination) has necessarily its maximum eigenvalue $\lambda_{\text{max}}(E_D)$ equal to 1. From these considerations, we see that if we bring in $\mathbf{A}_b \triangleq \frac{1}{|\langle \psi_b^\perp | \psi_b \rangle|^2} |\psi_b^\perp\rangle \langle \psi_b^\perp|$ then the problem of maximizing $\overline{P}_D$ is nothing but the problem of maximizing $\frac{1}{q^n} \sum_{b \in \mathbb{F}_q^n} P_b$ given that $0 \le P_b \le 1$ for all $b$ in $\mathbb{F}_q^n$ and $1 - \sum_{b \in \mathbb{F}_q^n} P_b \mathbf{A}_b \ge 0$
(i.e. is a positive semi-definite matrix). No general solution to this problem is known, with the notable exception of the symmetric states case given above and our case given in Proposition 15. An averaging argument can be used in such a case to show that actually in the optimal solution all the $P_j$ can be chosen to be equal which makes the optimization trivial.

**An averaging argument.** The proof of Proposition 14 of [CB98] relies essentially on an averaging argument which is used to show that there is an optimal POVM that satisfies a certain kind of invariance relation and whose individual discrimination probabilities are all the same. We show that a similar result also holds in our case

**Lemma 6.** Assume that an optimal POVM is $\{E_b, b \in \mathbb{F}_q^n\} \cup \{E_F\}$. Denote by $\overline{P}_D^{\text{max}}$ its average probability of discrimination. Define for all $b$ in $\mathbb{F}_q^n$, $E_b^{\text{ave}} \triangleq \frac{1}{q^n} \sum_{a \in \mathbb{F}_q^n} X_a E_b X_{-a}$. We also let $E_D^{\text{ave}} \triangleq \sum_{b \in \mathbb{F}_q^n} E_b^{\text{ave}}$ and $E_F^{\text{ave}} \triangleq 1 - E_D^{\text{ave}}$. Then $\{E_b^{\text{ave}}, b \in \mathbb{F}_q^n\} \cup \{E_F^{\text{ave}}\}$ is also an optimal POVM that satisfies for all $a$ in $\mathbb{F}_q^n$ the invariance relation $X_a E_b^{\text{ave}} X_{-a} = E_b^{\text{ave}}$. Moreover for this new POVM, the discrimination probability $P_b^{\text{ave}} \triangleq \langle \psi_b | E_b^{\text{ave}} | \psi_b \rangle$ of $|\psi_b\rangle$ is equal to the maximal average discrimination probability $\overline{P}_D^{\text{max}}$ for all $b$ in $\mathbb{F}_q^n$.

*Proof.* Clearly for all $a$ in $\mathbb{F}_q^n$, the POVM $\{X_a E_b X_{-a}, b \in \mathbb{F}_q^n\} \cup \{X_a E_F X_{-a}\}$ gives an unambiguous discrimination for the set of states $\{|\psi_b\rangle, b \in \mathbb{F}_q^n\}$. We call this POVM, the original POVM shifted by $a$. However now the operator $X_a E_b X_{-a}$ detects the state $|\psi_{a+b}\rangle$. Let $P_b$ be the discrimination probability of $|\psi_b\rangle$ by the operator $E_b$, that is $P_b = \langle \psi_b | E_b | \psi_b \rangle$ and $P_b^a$ be the discrimination probability of the same state, but this time by the POVM $\{X_a E_b X_{-a}, b \in \mathbb{F}_q^n\} \cup \{X_a E_F X_{-a}\}$. Since $|\psi_b\rangle$ is now detected by $X_a E_b X_{-a}$, we have for all $b$ and $a$ in $\mathbb{F}_q^n$

$$P_b^a = P_{b-a}. \qquad (9)$$

From these considerations, we clearly see that $E_b^{\text{ave}} = \frac{1}{q^n} \sum_{a \in \mathbb{F}_q^n} X_a E_b X_{-a}$ detects $|\psi_b\rangle$ with probability $P_b^{\text{ave}} = \frac{1}{q^n} \sum_{a \in \mathbb{F}_q^n} P_{b-a} = \overline{P}_D$. However, we also have to show that $\{E_b^{\text{ave}}, b \in \mathbb{F}_q^n\} \cup \{E_F^{\text{ave}}\}$ defines a POVM. All the $E_b^{\text{ave}}$ are clearly positive semi-definite, it remains to check that $E_F^{\text{ave}} \triangleq 1 - E_D^{\text{ave}}$ is also positive semi-definite. For this, we observe that

$$\begin{aligned}
E_D^{\text{ave}} &\triangleq \sum_{b \in \mathbb{F}_q^n} E_b^{\text{ave}} \\
&= \frac{1}{q^n} \sum_{b \in \mathbb{F}_q^n} \sum_{a \in \mathbb{F}_q^n} X_a E_b X_{-a} \\
&= \frac{1}{q^n} \sum_{b \in \mathbb{F}_q^n} \sum_{a \in \mathbb{F}_q^n} X_a E_b X_{-a} \\
&= \frac{1}{q^n} \sum_{a \in \mathbb{F}_q^n} X_a E_D X_{-a}
\end{aligned}$$

where $E_D \triangleq \sum_{b \in \mathbb{F}_q^n} E_b$. By convexity of the maximum eigenvalue on the space of Hermitian operators on $\mathcal{H}$ we have

$$\lambda_{\max}(E_D^{\text{ave}}) \le \frac{1}{q^n} \sum_{a \in \mathbb{F}_q^n} \lambda_{\max}(E_D^a) \qquad (10)$$

where $E_D^a = \sum_{b \in \mathbb{F}_q^n} X_a E_D X_{-a}$. The shifted POVM by $a$ is indeed a POVM and we have therefore $\lambda_{\max}(E_D^a) \le 1$. This together with (10) shows that $\lambda_{\max}(E_D^{\text{ave}}) \le 1$ and that therefore $E_F^{\text{ave}} = 1 - E_D^{\text{ave}}$ is indeed positive semi-definite. $\square$
**Choosing the appropriate basis.** The appropriate basis which simplifies a lot the computation is the common diagonalization basis of all the $X_b$'s. It is given by the “character” basis $\{|\hat{x}\rangle, x \in \mathbb{F}_q^n\}$ (see Proposition 10) and we have

$$X_b|\hat{x}\rangle = \chi_x(-b)|\hat{x}\rangle. \qquad (11)$$

From this, we deduce that for all $b$ in $\mathbb{F}_q^n$ we have

$$X_b = \sum_{x \in \mathbb{F}_q^n} \chi_x(-b)|\hat{x}\rangle\langle\hat{x}| \qquad (12)$$

If we express $|\psi_0\rangle$ in this basis, we obtain

$$|\psi_0\rangle = \sum_{x \in \mathbb{F}_q^n} c_x|\hat{x}\rangle$$

then all the other ones are given by

$$|\psi_b\rangle = X_b|\psi_0\rangle = \sum_{x \in \mathbb{F}_q^n} c_x \chi_x(-b)|\hat{x}\rangle. \qquad (13)$$

It is readily verified that the reciprocal states are given by

$$|\psi_{\hat{b}}^{\perp}\rangle = \frac{1}{\sqrt{Z}} \sum_{x \in \mathbb{F}_q^n} \frac{1}{c_x} \chi_x(-b)|\hat{x}\rangle \qquad (14)$$

where $Z = \sum_{x \in \mathbb{F}_q^n} |c_x|^{-2}$. Indeed, we observe that for any $a$ and $b$ in $\mathbb{F}_q^n$ we have

$$\langle\psi_a^{\perp}|\psi_b\rangle = \frac{1}{\sqrt{Z}} \sum_{x \in \mathbb{F}_q^n} \overline{\chi_x(-a)}\chi_x(-b) = \frac{1}{\sqrt{Z}} \sum_{x \in \mathbb{F}_q^n} \chi_x(a-b) = \frac{q^n}{\sqrt{Z}}\delta(a, b) \qquad (15)$$

where $\delta(x, y)$ is the Kronecker function which is equal to 1 iff $x = y$ and to 0 otherwise. We have now all the tools we need to prove Proposition 15.

*Proof of Proposition 15.* From Lemma 6 we can choose the $E_b$ of the optimal POVM as

$$E_b = \frac{\overline{P_D}}{|\langle\psi_{\hat{b}}^{\perp}|\psi_b\rangle|^2} |\psi_{\hat{b}}^{\perp}\rangle\langle\psi_{\hat{b}}^{\perp}|. \qquad (16)$$

By (15) we know that $|\langle\psi_{\hat{b}}^{\perp}|\psi_b\rangle|^2 = \frac{q^{2n}}{Z}$, and therefore by plugging this expression in (16) and using (13) and (14) we obtain

$$\begin{align*}
E_b &= \frac{Z}{q^{2n}} \frac{\overline{P_D}}{Z} \sum_{\substack{x \in \mathbb{F}_q^n \\ y \in \mathbb{F}_q^n}} \frac{1}{c_x c_y} \chi_x(-b) \overline{\chi_y(-b)} |\hat{x}\rangle\langle\hat{y}| \\
&= \frac{\overline{P_D}}{q^{2n}} \sum_{\substack{x \in \mathbb{F}_q^n \\ y \in \mathbb{F}_q^n}} \frac{1}{c_x c_y} \chi_b(-x) \chi_b(y) |\hat{x}\rangle\langle\hat{y}| \\
&= \frac{\overline{P_D}}{q^{2n}} \sum_{\substack{x \in \mathbb{F}_q^n \\ y \in \mathbb{F}_q^n}} \frac{1}{c_x c_y} \chi_b(y - x) |\hat{x}\rangle\langle\hat{y}|
\end{align*}$$
From this we infer that

$$
\begin{align*}
E_D &= \sum_{b \in \mathbb{F}_q^n} E_b \\
&= \frac{\overline{P_D}}{q^{2n}} \sum_{b \in \mathbb{F}_q^n} \sum_{\substack{x \in \mathbb{F}_q^n \\ y \in \mathbb{F}_q^n}} \frac{1}{c_x c_y} \chi_b(y - x) |\hat{x}\rangle\langle\hat{y}| \\
&= \frac{\overline{P_D}}{q^{2n}} \sum_{\substack{x \in \mathbb{F}_q^n \\ y \in \mathbb{F}_q^n}} \sum_{b \in \mathbb{F}_q^n} \frac{1}{c_x c_y} \chi_b(y - x) |\hat{x}\rangle\langle\hat{y}| \\
&= \frac{\overline{P_D}}{q^n} \sum_{x \in \mathbb{F}_q^n} \frac{1}{|c_x|^2} |\hat{x}\rangle\langle\hat{x}|,
\end{align*}
$$

where in the last line we used that $\sum_{b \in \mathbb{F}_q^n} \chi_b(y - x) = q^n \delta(x, y)$ by Proposition 9. Since the $|\hat{x}\rangle\langle\hat{x}|$'s form an orthonormal set of projectors we have that $\lambda_{\max}(E_D) = \frac{\overline{P_D}}{q^n \min_{x \in \mathbb{F}_q^n} |c_x|^2}$. From the fact that we should have $\lambda_{\max}(E_D) \le 1$ in order $E_F$ to be positive semi-definite, we have

$$ \overline{P_D} \le q^n \min_{x \in \mathbb{F}_q^n} |c_x|^2. $$

Clearly the optimum is attained when we have equality here and therefore

$$
\begin{align*}
\overline{P_D}^{\max} &= q^n \min_{x \in \mathbb{F}_q^n} |c_x|^2 \\
&= q^n \min_{x \in \mathbb{F}_q^n} |\hat{f}(x)|^2
\end{align*}
$$

where we used Fact 1 for the last point which gives $c_x = \hat{f}(-x)$. $\square$

<figure><img src="image_8.png" /></figure>

**Remark 1.** It is readily seen that the two crucial ingredients of the proof are that (i) we can take an “average” of an optimal solution to show that there is an optimal solution where all states are discriminated with the same probability, (ii) a basis which simplifies the computation. (i) holds in a more general case where the set of states is of the form $\{U|\psi\rangle, U \in G\}$ where G is a finite group of unitaries. On top of that, (ii) holds for instance if the group G is Abelian, the nice basis is then provided by the common diagonalization basis of the U's. It other words, it is straightforward to generalize Proposition 14 in the case where the set of states is of the form $\{U|\psi\rangle, U \in G\}$ where G is a finite Abelian group.

## 4.2 Quantum polynomial time algorithm for QDP in the q-ary setting

The goal of the previous subsection was to extend unambiguous state discrimination to our q-ary setting. When we apply Proposition 15 in our case we obtain

**Proposition 16** (Unambiguous state discrimination, q-ary case). Let $\omega \le \frac{q-1}{q}$. For each $a \in \mathbb{F}_q$, we define $|\psi_a\rangle = \sqrt{1-\omega}|a\rangle + \sum_{b \ne a} \sqrt{\frac{\omega}{q-1}}|b\rangle$. There exists a POVM $\{\{E_a\}_{a \in \mathbb{F}_q}, E_F\}$ s.t.

$$
\begin{align*}
\forall a \in \mathbb{F}_q, \quad \mathrm{tr}(E_a |\psi_a\rangle\langle\psi_a|) &\triangleq P_{\mathrm{usd}} = \frac{q \cdot \omega^{\perp}}{q-1} \\
\forall a, b \ne a \in \mathbb{F}_q, \quad \mathrm{tr}(E_b |\psi_b\rangle\langle\psi_b|) &= 0
\end{align*}
$$
Notice that since $\{\{E_a\}_{a \in \mathbb{F}_q}, E_F\}$ is a POVM, this implies for each $a \in \mathbb{F}_q \text{ tr}(E_F|\psi_a\rangle\langle\psi_a|) = 1 - P_{\text{usd}} = 1 - \frac{q \cdot \omega^{\perp}}{q-1}$

*Proof.* We define $|\psi\rangle = \sum_{x \in \mathbb{F}_q} f(x)|x\rangle$ with $f(0) = \sqrt{1-\omega}$ and $f(x) = \sqrt{\frac{\omega}{q-1}}$ for $x \in \mathbb{F}_q^*$. With this definition, $|\psi_a\rangle = X_a|\psi\rangle$. As computed in Lemma 3, we have

$$ \hat{f}(0) = \sqrt{1 - \omega^{\perp}} \quad ; \quad \hat{f}(y) = \sqrt{\frac{\omega^{\perp}}{q-1}} \quad \text{for } y \in \mathbb{F}_q^* $$

with $\omega^{\perp} = \frac{(\sqrt{(q-1)(1-\omega)} - \sqrt{\omega})^2}{q}$. One can check that for $\omega \in [0, \frac{q-1}{q}]$, we have $\hat{f}(0) \ge \hat{f}(y)$ for $y \in \mathbb{F}_q^*$. We use Proposition 15 with $n=1$ to immediately get

$$ P_{\text{usd}} = q \cdot \min_{y} |\hat{f}(y)|^2 = \frac{q \cdot \omega^{\perp}}{q-1} $$

<figure><img src="image_9.png" /></figure>

It also turns that this operation can be implemented efficiently in poly-log time (in $q$) as shown by

**Proposition 17.** Consider the unitary $U$ acting on $|\psi_a\rangle|0\rangle$ as

$$ \begin{aligned} U|0\rangle|0\rangle &= |0\rangle\left(u|0\rangle + \sqrt{1-u^2}|1\rangle\right) & \text{with } u &= \sqrt{\frac{\omega^{\perp}}{(1-\omega^{\perp})(q-1)}} \\ U|\hat{\alpha}\rangle|0\rangle &= |\hat{\alpha}\rangle|0\rangle & \forall \alpha \in \mathbb{F}_q^* \end{aligned} $$

With our choice of function $f$, the above unambiguous state discrimination quantum measurement can be done by applying $U$ on $|\psi_\alpha\rangle|0\rangle$ and then measuring the output state in the computational basis. This can be done in time $O(\text{polylog}(q))$.

*Proof.* Let us start the proof by writing $|\psi_\alpha\rangle$ in the Fourier basis $\{\hat{x}, x \in \mathbb{F}_q\}$. This can be done by observing that

$$ \begin{aligned} |\psi_\alpha\rangle &= X_\alpha |\psi\rangle \\ &= X_\alpha \cdot \text{QFT} \cdot \text{QFT}^\dagger |\psi\rangle \\ &= X_\alpha \cdot \text{QFT} \left( \sqrt{1-\omega^\perp} |0\rangle + \sum_{\gamma \in \mathbb{F}_q^*} \sqrt{\frac{\omega^\perp}{q-1}} |\gamma\rangle \right) \quad (\text{by Lemma 3 and } (\omega^\perp)^\perp = \omega) \\ &= \text{QFT} \cdot Z_{-\alpha} \left( \sqrt{1-\omega^\perp} |0\rangle + \sum_{\gamma \in \mathbb{F}_q^*} \sqrt{\frac{\omega^\perp}{q-1}} |\gamma\rangle \right) \quad (\text{by Lemma 4}) \\ &= \text{QFT} \left( \sqrt{1-\omega^\perp} |0\rangle + \sum_{\gamma \in \mathbb{F}_q^*} \chi_{-\alpha}(\gamma) \sqrt{\frac{\omega^\perp}{q-1}} |\gamma\rangle \right) \\ &= \sqrt{1-\omega^\perp} |0\rangle + \sum_{\gamma \in \mathbb{F}_q^*} \chi_{-\alpha}(\gamma) \sqrt{\frac{\omega^\perp}{q-1}} |\hat{\gamma}\rangle. \end{aligned} $$
Applying $U$ on $|\psi_\alpha\rangle|0\rangle$, we obtain

$$|\phi'_\alpha\rangle := U|\Psi_\alpha\rangle|0\rangle = \left( u\sqrt{1-\omega^\perp}|0\rangle + \sum_{\gamma \in \mathbb{F}_q^*} \chi_{-\alpha}(\gamma)\sqrt{\frac{\omega^\perp}{q-1}}|\hat{\gamma}\rangle \right) |0\rangle + \sqrt{1-u^2}\sqrt{1-\omega^\perp}|0\rangle|1\rangle.$$

Notice that $u\sqrt{1-\omega^\perp} = \sqrt{\frac{\omega^\perp}{q-1}}$ and that $|\alpha\rangle = \frac{1}{\sqrt{q}}\sum_{\gamma \in \mathbb{F}_q} \chi_{-\alpha}(\gamma)|\hat{\gamma}\rangle$ (by Fact 1). From there, we can rewrite

$$|\phi'_\alpha\rangle = \sqrt{\frac{q\omega^\perp}{q-1}}|\alpha\rangle|0\rangle + \sqrt{1-u^2}\sqrt{1-\omega^\perp}|0\rangle|1\rangle.$$

We now measure all the qubits in the computational basis. If the last qubit is 0, the measurement outputs the value $\alpha$ in the first register. If the last qubit is 1, we output Fail. The measurement succeeds and outputs the correct value $\alpha$ w.p. $\frac{q\omega^\perp}{q-1}$. The time to perform $U$ is essentially the time to perform two Quantum Fourier Transforms so $U$ can be efficiently computed in time $O(\text{polylog}(q))$, the whole measurement can be done in time $O(\text{polylog}(q))$. $\square$

We can now present our polynomial time algorithm in the $q$-ary setting:

**Theorem 6.** Let $R > 0$ and $\omega \in (0, \frac{q-1}{q})$ satisfying $\frac{q\omega^\perp}{q-1} > R$. There exists a quantum algorithm that solves QDP$(q, n, \lfloor Rn \rfloor, \omega)$ in time $\text{poly}(n, \log(q))$.

*Proof.* We fix $R > 0, k = \lfloor Rn \rfloor$ and $\omega \in (0, \frac{q-1}{q})$ satisfying $\frac{q\omega^\perp}{q-1} > R$. We are given a random generating matrix $G \in \mathbb{F}_q^{k \times n}$ with associated code $C$ as well as a state $|\psi_c\rangle = \bigotimes_{i=1}^n |\psi_{c_i}\rangle$ for a randomly chosen $c \in C$, where

$$|\psi_{c_i}\rangle = \sqrt{1-\omega}|c_i\rangle + \sum_{x \neq c_i} \sqrt{\frac{\omega}{q-1}}|x\rangle.$$

As in Section 3.1, we consider the following algorithm.

Quantum algorithm for QDP using $q$-ary USD

1. Perform the optimal unambiguous measurement given in Proposition 16 from Proposition 7 on each register $i$ in order to guess $c_i$, which can be done w.p. $P_{\text{usd}} = \frac{q\omega^\perp}{q-1}$. Let $J \subseteq [n]$ be the set of indices where this measurement succeeds. The algorithm recovers here $c_J$.

2. If $G_J \in \mathbb{F}_q^{k \times |J|}$ is of rank $k$, recover $c$ from $c_J$ by computing $c_J G_J^{-1} G$.

By our choice of $\omega$, we have $P_{\text{usd}} > R$ which means that there exists an absolute constant $\gamma > 0$ s.t. $P_{\text{usd}} = R + \gamma$. This in turn implies that the success probability of this algorithm is $1-o(1)$, using the same arguments as in Section 3.1. $\square$

# 5 (In)tractability of the quantum decoding problem

In this section we provide a full characterization of the tractability of QDP$(q, n, k, \omega)$. We show that the problem is tractable i.e. there exists a quantum algorithm that solves the problem w.p. $1-o(1)$ (as $n \to +\infty$ and $q = \Omega(1)$) for any absolute constant $\omega < (\delta_{\min}(q, 1-k/n))^\perp$. We will
simplify the notation as alluded in Subsection 2.1 and write from now on just $\delta_{\min}(1-k/n)$ instead of $\delta_{\min}(q, 1-k/n)$. Moreover, $R$ denotes in the whole section the rate $\frac{k}{n}$ of the code we decode:

$$R \triangleq k/n.$$

Notice here that we do not put here any restriction on the running time of the algorithm. On the other hand, we show that the problem is intractable i.e. all quantum algorithms solve the problem w.p. at most $o(1)$ for any absolute constant $\omega > (\delta_{\min}(1-R))^{\perp}$.

In order to prove our results, we will focus on a single quantum algorithm: the one that performs a pretty good measurement. Recall that in the quantum decoding problem, we have to recover $c$ from $|\psi_c\rangle = \sum_e \sqrt{(-\frac{\omega}{q-1})^{|e|}(1-\omega)^{n-|e|}}|c+e\rangle$. In order to prove our results, we will focus on a single quantum algorithm performing the pretty good measurement on the Fourier transforms of these states. For the tractability result, we show that the PGM recovers $c$ w.p. $1-o(1)$. For the intractability result, we show that the PGM recovers $c$ w.p. $o(1)$. But we know from Proposition 8 that this implies that any quantum algorithm will recover $c$ w.p. $o(1)$ hence the intractability result.

We first study the PGM for any error function $f$ and then apply our results to $f(e) = \sqrt{(-\frac{\omega}{q-1})^{|e|}(1-\omega)^{n-|e|}}$ in order to show our (in)tractability results.

## 5.1 Computing the PGM associated to the quantum decoding problem

We fix a generating matrix $G$ and an associated code $C$. In order to study our PGM, we define the shifted dual codes of $C$

$$C_s^{\perp} \triangleq \{x \in \mathbb{F}_q^n : Gx^T = s\}$$

Notice that $C_0^\perp = C^\perp$ where $C^\perp$ is the dual code of $C$. For each shifted dual code $C_s^\perp$, we fix an element $u_s \in C_s^\perp$. We have $C_s^\perp = \{u_s + d : d \in C^\perp\}$. This means that for all $c$ in $C$ and all $y$ in $C_s^\perp$

$$\chi_c(y) = \chi_c(u_s)$$

Moreover, for any $s, s'$ in $\mathbb{F}_q^k$ s.t. $s' \neq s$, since $u_s + u_{s'} \notin C^\perp$, we have

$$\sum_{c \in C} \chi_c(u_s + u_{s'}) = 0 \qquad (17)$$

Now fix any error function $f: \mathbb{F}_q^n \to \mathbb{C}$ s.t. $\|f\|_2 = 1$, and consider the states $|\psi_c\rangle = \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle$. The goal is to recover $c$. Actually, we will start from $|\tilde{\psi}_c\rangle = \text{QFT}|\psi_c\rangle$ instead of $|\psi_c\rangle$ and apply the Pretty Good Measurement on the ensemble of states $\{|\tilde{\psi}_c\rangle\}$. The distinguishing problem is equivalent since applying QFT is a unitary operation. We first define the states

$$|W_s\rangle \triangleq \sum_{y \in C_s^\perp} \hat{f}(y)|y\rangle \quad (\text{not normalized})$$

$$|\tilde{W}_s\rangle \triangleq \frac{|W_s\rangle}{|||W_s\rangle||}$$

as well as $n_s \triangleq |||W_s\rangle|| = \sqrt{\sum_{y \in C_s^\perp} |\hat{f}(y)|^2}$. We first write $|\tilde{\psi}_c\rangle$ in the $\{|W_s\rangle\}$ basis.

**Lemma 7.** $|\tilde{\psi}_c\rangle = \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s)|W_s\rangle$.
Proof. We write

$$
\begin{align*}
|\widehat{\psi_c}\rangle &= \frac{1}{\sqrt{q^n}} \sum_{\mathbf{y},e \in \mathbb{F}_q^n} \chi_{c+e}(\mathbf{y}) f(e) |\mathbf{y}\rangle \\
&= \frac{1}{\sqrt{q^n}} \sum_{s \in \mathbb{F}_q^k} \sum_{\mathbf{x} \in \mathcal{C}_s^\perp} \chi_c(\mathbf{x}) \sum_{e \in \mathbb{F}_q^n} \chi_e(\mathbf{x}) f(e) |\mathbf{x}\rangle \\
&= \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s) \sum_{\mathbf{x} \in \mathcal{C}_s^\perp} \hat{f}(\mathbf{x}) |\mathbf{x}\rangle = \sum_{s \in \mathcal{C}_s^\perp} \chi_c(u_s) |W_s\rangle.
\end{align*}
$$

□

We can now explicit the PGM associated to the states $|\widehat{\psi}_c\rangle$.

**Proposition 18.** The PGM associated to the ensemble of states $\{|\widehat{\psi}_c\rangle\}_{c \in C}$ is the projective measurement $\{|Y_c\rangle\langle Y_c|\}_{c \in C}$ where $|Y_c\rangle = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s) |\widetilde{W}_s\rangle$.

Proof. We write the PGM $\{M_c\}$ associated to the states $|\widehat{\psi}_c\rangle$ using Definition 18.

$$
M_c = \rho^{-1/2} |\widehat{\psi}_c\rangle\langle\widehat{\psi}_c| \quad \text{given } \rho = \sum_{c \in \mathbb{F}_q^k} |\widehat{\psi}_c\rangle\langle\widehat{\psi}_c|
$$

We now write

$$
\rho = \sum_{c \in \mathcal{C}} |\widehat{\psi}_c\rangle\langle\widehat{\psi}_c| = \sum_{c \in \mathcal{C}} \sum_{s, s' \in \mathbb{F}_q^k} \chi_c(u_s - u_{s'}) |W_s\rangle\langle W_{s'}| = q^k \sum_{s \in \mathbb{F}_q^k} |W_s\rangle\langle W_s|
$$

where we use Equation 17 as well as $\chi_c(\mathbf{0}) = 1$ for the last equality. Using the fact that the $|W_s\rangle$ are pairwise orthogonal (since they have disjoint support in the computational basis), the $|\widetilde{W}_s\rangle\langle\widetilde{W}_s|$'s are pairwise orthogonal projectors and we have

$$
\rho = q^k \sum_{s \in \mathbb{F}_q^k} n_s^2 |\widetilde{W}_s\rangle\langle\widetilde{W}_s| \quad \text{hence} \quad \rho^{-1/2} = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \frac{1}{n_s} |\widetilde{W}_s\rangle\langle\widetilde{W}_s|
$$

and

$$
\rho^{-1/2} |\widehat{\psi}_c\rangle = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s) |\widetilde{W}_s\rangle := |Y_c\rangle. \quad (18)
$$

Here $|Y_c\rangle$ is a pure state of norm 1. Also, notice that these states are pairwise orthogonal. So
$M_c = |Y_c\rangle\langle Y_c|$ and the PGM is just the projective measurement $\{|Y_c\rangle\langle Y_c|\}_{c \in C}$.
□

Finally, we can explicit the probability that the PGM succeeds on the states $|\widehat{\psi}_c\rangle$.

**Proposition 19.** The PGM succeeds to recover $\mathbf{c}$ from $|\widehat{\psi}_c\rangle$ w.p. $\frac{1}{q^k} \left( \sum_{s \in \mathbb{F}_q^k} n_s \right)^2$.

Proof. From the previous proposition, the PGM we use is the projective measurement $\{|Y_c\rangle\langle Y_c|\}_{c \in C}$ with $|Y_c\rangle = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s) |\widetilde{W}_s\rangle$. For each $\mathbf{c} \in \mathcal{C}$, we write using Lemma 7 as well as the expression of $|Y_c\rangle$ the probability $p_c$ that this measurement succeeds

$$
p_c \triangleq |\langle Y_c | \widehat{\psi}_c \rangle|^2 = \frac{1}{q^k} \left| \sum_s \langle \widetilde{W}_s | W_s \rangle \right|^2 = \frac{1}{q^k} \left( \sum_{s \in \mathbb{F}_q^k} n_s \right)^2 \quad (19)
$$

which immediately gives us the result.
□
**Remark 2.** Since $|\hat{\psi}_c\rangle$ is of norm 1, we have immediately from Lemma 7 that $\sum_{s \in \mathbb{F}_q^k} n_s^2 = 1$. In the case where all the norms are equal, we have $n_s = \sqrt{q^{-k}}$ which gives indeed $P_{PGM} = 1$. On the other hand, if these norms are highly unbalanced the probability that the PGM succeeds is very low.

## 5.2 (In)tractability results

### 5.2.1 First computations and probabilistic arguments on random codes

We go back to our quantum decoding problem. Our error function corresponds to the q-ary symmetric channel so $f(e) = (\sqrt{1-\omega})^{n-|e|} (\sqrt{\frac{\omega}{q-1}})^{|e|}$ we have (see Lemma 3)

$$ \hat{f}(\mathbf{y}) = (\sqrt{1 - \omega^{\perp}})^{n - |\mathbf{y}|} \left( \sqrt{\frac{\omega^{\perp}}{q-1}} \right)^{|\mathbf{y}|}, $$

with $\omega^{\perp} = \frac{(\sqrt{(q-1)(1-\omega)-\sqrt{\omega}})^2}{q}$. For a fixed $\mathbf{G} \in \mathbb{F}_q^{k \times n}$ and associated code $\mathcal{C}$ (we will not make this dependency explicit in the notation to simplify it), we define

$$ \begin{aligned} n_{s, \mathcal{C}} &\triangleq \| \sum_{\mathbf{y} \in \mathcal{C}_s^{\perp}} \hat{f}(\mathbf{y}) |\mathbf{y}\rangle \| \\ a_{s, \mathcal{C}}(t) &\triangleq |\{\mathbf{y} \in \mathcal{C}_s^{\perp} : |\mathbf{y}| = t\}| \end{aligned} $$

We also define $S(t) \triangleq \frac{(q-1)^t \binom{n}{t}}{q^k}$. Notice that $n_{s, \mathcal{C}}$ corresponds exactly to $n_s$ defined in the previous section but we made the dependency in $\mathcal{C}$ explicit. Our goal is to compute the success probability of the PGM on average on $\mathbf{G}$ so using Proposition 19, we want to bound the quantity

$$ P_{PGM} = E_{\mathbf{G}} \left[ \frac{1}{q^k} \left( \sum_{s \in \mathbb{F}_q^k} n_{s, \mathcal{C}} \right)^2 \right]. $$

We first write

$$ n_{s, \mathcal{C}}^2 = \sum_{\mathbf{y} \in \mathcal{C}_s^{\perp}} |\hat{f}(\mathbf{y})|^2 = \sum_{t=0}^{n} a_{s, \mathcal{C}}(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} \quad (20) $$

and recall from Remark 2 that $\sum_{s \in \mathbb{F}_q^k} n_{s, \mathcal{C}}^2 = 1$. We see that to compute $P_{PGM}$, we have to say something about the terms $a_s(t, \mathcal{C})$. We first have the following, which was proven for example in [Deb23]:

**Proposition 20.** $\forall t \neq 0$, $E_G[a_s(t, \mathcal{C})] = S(t)$.

But the expected value will not be enough. We will need concentration bounds coming from the second moment technique

**Proposition 21** (Second moment technique, Proposition 3 from [Deb23]). Fix any $s \in \mathbb{F}_q^k$ and $t \in [1, n]$. For any $\varepsilon > 0$, we have

$$ \Pr_G [ |a_{s, \mathcal{C}}(t) - S(t)| \geq \varepsilon S(t) ] \leq \frac{q-1}{\varepsilon^2 S(t)}. $$
In particular, take $\epsilon = S(t)^{-1/3}$, we have

$$ \mathrm{Pr}_{G} \left[ a_{s,C}(t) \le S(t) \left(1 - \frac{1}{S(t)^{1/3}}\right) \right] \le \frac{q-1}{S(t)^{1/3}}. $$

We can now observe two things

1. From the above proposition combined with Equation 20, we have that when $S(t)$ is exponential, which happens when $t = \gamma n$ with $\gamma \in (\delta_{\min}(1-R), \delta_{\max}(1-R))$

$$ n_{s,C}^2 \approx \sum_{t=\lfloor \delta_{\min}(1-R)n \rfloor}^{\lfloor \delta_{\max}(1-R)n \rfloor} S(t) \left( \frac{\omega^{\perp}}{q-1} \right)^t (1-\omega^{\perp})^{n-t}. \quad (21) $$

2. In order to estimate the above sum, first notice that

$$ \sum_{t=0}^{n} S(t) \left( \frac{\omega^{\perp}}{q-1} \right)^{t} (1-\omega^{\perp})^{n-t} = \frac{1}{q^k} \sum_{t=0}^{n} \binom{n}{t} (\omega^{\perp})^{t} (1-\omega^{\perp})^{n-t} = \frac{1}{q^k}. \quad (22) $$

But the above sum is actually the cumulative sum of the binomial distribution with parameters $n$ and $\omega^{\perp}$. It concentrates around the weight $n\omega^{\perp}$. This is formalized by the following proposition

**Proposition 22.** For any absolute constant $\epsilon > 0$,

$$ \sum_{t=\lfloor (\omega^{\perp} - \epsilon)n \rfloor}^{\lfloor (\omega^{\perp} + \epsilon)n \rfloor} S(t) \left( \frac{\omega^{\perp}}{q-1} \right)^t (1-\omega^{\perp})^{n-t} = \frac{1}{q^k} (1-o(1)). \quad (23) $$

We now have all the tools for our (in)tractability proofs. The main idea is the following: when $t = \omega n$ with $\omega < \delta_{\min}(1-R)^{\perp}$, we have $\omega^{\perp} \in (\delta_{\min}(1-R), \delta_{\max}(1-R))$ and so we can combine Equations 21,23 to show that for most $G$, $n_{s,C}^2 = \frac{1}{q^k}(1-o(1))$. On the other hand, when $\omega > \delta_{\min}(1-R)^{\perp}$, we have $\omega^{\perp} \notin (\delta_{\min}(1-R), \delta_{\max}(1-R))$ and so we can combine Equations 21,22,23 to show that for most $G$, $n_{s,C}^2 = o(1)$. The next sections will make these arguments formal and show how this allows us to conclude.

### 5.2.2 Tractability

We use the notations previously defined in Section 5.2.1. $\omega$ will be considered as a fixed constant in $(0, 1)$. Our main claim is the following

**Proposition 23.** If $\omega < (\delta_{\min}(1-R))^{\perp}$ then $P_{PGM} = \frac{1}{q^k} E_G \left[ \left( \sum_{s \in \mathbb{F}_q^k} n_{s,C} \right)^2 \right] = 1 - o(1)$.

*Proof.* Using (20) we know that $n_{s,C}^2 = \sum_{t=0}^n a_{s,C}(t) \left( \frac{\omega^{\perp}}{q-1} \right)^t (1-\omega^{\perp})^{n-t}$. Since $\omega < (\delta_{\min}(1-R))^{\perp}$, we have $\omega^{\perp} > \delta_{\min}(1-R)$ so we fix $\delta > 0$ s.t. $\omega^{\perp} - \delta > \delta_{\min}(1-R)$. We therefore write

$$ n_{s,C}^2 \ge \sum_{t=\lfloor (\omega^{\perp} - \delta)n \rfloor}^{\lfloor (\omega^{\perp} + \delta)n \rfloor} a_{s,C}(t) \left( \frac{\omega^{\perp}}{q-1} \right)^t (1-\omega^{\perp})^{n-t}. $$
We define $t_0 = \lfloor(\omega^{\perp} - \delta)n\rfloor$ and $t_1 = \lfloor(\omega^{\perp} + \delta)n\rfloor$. Recall that $a_{s,C}(t)$ is typically close to $S(t)$ as shown by Lemma 21. This gives for $t \in (\lfloor(\omega^{\perp} - \delta)n\rfloor, \lfloor(\omega^{\perp} + \delta)n\rfloor]$

$$ \begin{aligned} \Pr_G \left[ a_{s,C}(t) \le S(t) \left(1 - \frac{1}{S(t_0)^{1/3}}\right) \right] &\le \Pr_G \left[ a_{s,C}(t) \le S(t) \left(1 - \frac{1}{S(t)^{1/3}}\right) \right] \\ &\le \frac{q-1}{S(t)^{1/3}} \le \frac{q-1}{S(t_0)^{1/3}}. \end{aligned} $$

and

$$ \Pr_G \left[ \forall t \in [t_0, t_1], a_{s,C}(t) \ge S(t) \left(1 - \frac{1}{S(t_0)^{1/3}}\right) \right] \ge 1 - \frac{(q-1)(t_1 - t_0 + 1)}{S(t_0)^{1/3}} $$

This implies

$$ \Pr_G \left[ n_{s,C}^2 \ge \sum_{t=t_0}^{t_1} S(t) (1 - S(t_0)^{-1/3}) \left( \frac{\omega^{\perp}}{q-1} \right)^t (1 - \omega^{\perp})^{n-t} \right] \ge 1 - \frac{(q-1)(t_1 - t_0 + 1)}{S(t_0)^{1/3}}. \quad (24) $$

We have

$$ \begin{aligned} \sum_{t=t_0}^{t_1} S(t)(1-S(t_0)^{-1/3}) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} &= (1-S(t_0)^{-1/3}) \sum_{t=t_0}^{t_1} S(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} \\ &= \frac{(1-S(t_0)^{-1/3})}{q^k} K(n) \end{aligned} $$

where $K(n) \triangleq \sum_{t=t_0}^{t_1} \binom{n}{t} (\omega^{\perp})^t (1-\omega^{\perp})^{n-t}$ and $K(n) = 1-o(1)$ as $n$ tends to infinity by Proposition 22. By plugging this equality in the left-hand side of (24) we obtain

$$ \Pr_G \left[ n_{s,C} \ge \sqrt{\frac{1-S(t_0)^{-1/3}}{q^k}} K(n) \right] \ge 1 - \frac{(q-1)(t_1 - t_0)}{S(t_0)^{1/3}}. $$

Since $t_0 = \lfloor(\omega^{\perp} - \delta)n\rfloor$ with $\delta_{\min}(1-R) < (\omega^{\perp} - \delta) < \delta_{\max}(1-R)$, we have $S(t_0) = q^{\Omega(n)}$ which implies

$$ \begin{aligned} \mathbb{E}_G[n_{s,C}] &\ge \sqrt{\frac{1-S(t_0)^{-1/3}}{q^k}} K(n) \cdot \Pr_G \left[ n_{s,C} \ge \sqrt{\frac{1-S(t_0)^{-1/3}}{q^k}} K(n) \right] \\ &\ge \sqrt{\frac{1-S(t_0)^{-1/3}}{q^k}} K(n) \cdot \left(1 - \frac{(q-1)(t_1 - t_0)}{S(t_0)^{1/3}}\right) \\ &= \frac{1}{\sqrt{q^k}} (1 - o(1)) \end{aligned} $$

which gives

$$ \mathbb{E}_G \left[ \sum_{s \in \mathbb{F}_q^k} n_{s,C} \right] \ge \sqrt{q^k (1 - o(1))} \quad (25) $$

In order to conclude, we use Jensen's inequality $\mathbb{E}_G(X^2) \ge (\mathbb{E}_G(X))^2$ and Equation 25 to get

$$ P_{PGM} = \frac{1}{q^k} \mathbb{E}_G \left[ \left( \sum_{s \in \mathbb{F}_q^n} n_{s,C} \right)^2 \right] \ge \frac{1}{q^k} \left( \mathbb{E}_G \left[ \sum_{s \in \mathbb{F}_q^k} n_{s,C} \right] \right)^2 \ge 1 - o(1) $$

□
### 5.2.3 Intractability

Again, we use the same notation as in the previous sections with a fixed $\omega \in (0, 1)$. We show that if $\omega$ is too large then $P \triangleq E_G(P_{PGM})$ is an $o(1)$ as shown by

**Theorem 7.** Let $G \in \mathbb{F}_q^{k \times n}$ be a random generating matrix and $C$ be the associated code. Let $\omega > (\delta_{\min}(1-R))^{\perp}$ and let the states $|\psi_c\rangle = \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle$ with

$$f(e) = \sqrt{\left(\frac{\omega}{q-1}\right)^{|e|} (1-\omega)^{n-|e|}}.$$

The pretty good measurement distinguishes the states $|\psi_c\rangle$ w.p. $P = o(1)$.

Again, we will heavily build on the expression of $n_{s,C}$ given by (20) in terms of the $a_{s,C}(t)$'s. The proof is based on the following steps

**Step 1.** Let us start by giving an upper-bound on $a_{s,C}(t)$ which holds with probability close to 1 for large values of $K$

**Lemma 8.** For any $K > 0$, any $t$ in $[1, n]$ and any $s \in \mathbb{F}_q^k$, we have $\mathrm{Pr}_G[a_{s,C}(t) \ge K \cdot S(t)] \le \frac{1}{K}$ which directly implies

$$\mathrm{Pr}_{G}[a_{s,C}(t) \le K \cdot S(t)] \ge 1 - \frac{1}{K}. \qquad (26)$$

*Proof.* This is just Markov's inequality $\mathrm{Pr}_G[a_{s,C}(t) \le K E_G(a_{s,C}(t))] \le \frac{1}{K}$ by recalling that $E_G(a_{s,C}(t)) = S(t)$. $\square$

A rather immediate corollary of this result is that

**Corollary 1.** For any $\delta > 0$, $s$ in $\mathbb{F}_q^k$ and $t$ in $[1, n] \setminus [(\delta_{\min}(1-R) - \delta)n, (\delta_{\max}(1-R) + \delta)n]$, we have with probability $1 - q^{-\Omega(n)}$ that $a_{s,C}(t) = 0$.

*Proof.* In such a case we have $S(t) = q^{-\Omega(n)}$, since $S(t) \le q^{n(h_q(t/n)-k/n)}$ and we use Lemma 8 with $K = \frac{1}{\sqrt{S(t)}}$ to obtain

$$\mathrm{Pr}_{G}[a_{s,C}(t) \le \sqrt{S(t)}] \ge 1 - \sqrt{S(t)} = 1 - q^{-\Omega(n)}.$$

We can conclude by using the fact that $a_{s,C}(t)$ is an non negative integer so if $a_{s,C}(t) \le \sqrt{S(t)} < 1$ then necessarily $a_{s,C}(t) = 0$. $\square$

**Step 2.** The previous results allow to show that

**Lemma 9.** Let $\omega > (\delta_{\min}(1-R))^{\perp}$. There exists an $\varepsilon > 0$ such that for any $s \in \mathbb{F}_q^k$ which is non zero we have

$$\mathrm{Pr}_{G}[n_{s,C} \ge q^{-k/2-\varepsilon n}] = q^{-\Omega(n)}.$$

*Proof.* Let us recall (20)

$$n_{s,C}^2 = \sum_{y \in \mathcal{C}_s^{\perp}} |\hat{f}(y)|^2 = \sum_{t=0}^{n} a_{s,C}(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t}.$$
By using Corollary 1 and $a_{s,C}(0) = 0$ for $s \neq 0$, we obtain that for any absolute constant $\delta > 0$,

$$ \forall \mathbf{s} \in F_q^k \setminus \{\mathbf{0}\}, \quad \mathrm{Pr}_{\mathbf{G}} \left[ n_{\mathbf{s},\mathbf{C}}^2 = \sum_{t=\lfloor (\delta_{\mathrm{min}}-\delta)n \rfloor}^{\lfloor (\delta_{\mathrm{max}}+\delta)n \rfloor} a_{\mathbf{s},\mathbf{C}}(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} \right] \geq 1 - q^{\Omega(n)}, \quad (27) $$

where to simplify notation we simply write $\delta_{\mathrm{min}}$ and $\delta_{\mathrm{max}}$ for $\delta_{\mathrm{min}}(1-R)$ and $\delta_{\mathrm{max}}(1-R)$ respectively. Then by using Lemma 8 we also deduce that for any $\delta, \delta' > 0$,

$$ \forall \mathbf{s} \in F_q^k \setminus \{\mathbf{0}\}, \quad \mathrm{Pr}_{\mathbf{G}} \left[ n_{\mathbf{s},\mathbf{C}}^2 \le \sum_{t=\lfloor (\delta_{\mathrm{min}}-\delta)n \rfloor}^{\lfloor (\delta_{\mathrm{max}}+\delta)n \rfloor} q^{\delta' n} S(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} \right] \ge 1 - q^{-\Omega(n)} $$

We observe now that

$$ \sum_{t=\lfloor (\delta_{\mathrm{min}}-\delta)n \rfloor}^{\lfloor (\delta_{\mathrm{max}}+\delta)n \rfloor} q^{\delta' n} S(t) \left(\frac{\omega^{\perp}}{q-1}\right)^t (1-\omega^{\perp})^{n-t} = q^{\delta' n - k} \sum_{t=\lfloor (\delta_{\mathrm{min}}-\delta)n \rfloor}^{\lfloor (\delta_{\mathrm{max}}+\delta)n \rfloor} p(t) \quad (28) $$

where $p(t) \stackrel{\Delta}{=} \binom{n}{t} (\omega^{\perp})^t (1-\omega^{\perp})^{n-t}$ is the probability that a binomial variable of parameters $n$ and $\omega^{\perp}$ takes the value $t$. By using the fact that $\omega^{\perp} \le (\delta_{\mathrm{min}} - \delta) n$ for some $\delta' > 0$ and the Hoeffding inequality (see Lemma 1) we deduce that for $\delta = \delta' / 2$, it holds that $\sum_{t=\lfloor (\delta_{\mathrm{min}}-\delta)n \rfloor}^{\lfloor (\delta_{\mathrm{max}}+\delta)n \rfloor} p(t) \le q^{-\delta'''n}$ for some $\delta''' > 0$. By choosing $\delta' < \delta'''$, we obtain that $n_{\mathbf{s},\mathbf{C}}$ is less than $q^{-k/2 - \frac{\delta''' - \delta'}{2}n}$ with probability $1 - q^{-\Omega(n)}$. We just have to choose $\varepsilon = (\delta''' - \delta') / 2$ to finish the proof. $\square$

We are ready now to prove Theorem 7.

*Proof of Theorem 7.* For $\mathbf{s} \in \mathbb{F}_q^k$, let $G_{\varepsilon}(\mathbf{s}) = \{\mathbf{G} \in \mathbb{F}_q^{k \times n} : n_{\mathbf{s},\mathbf{C}} \ge q^{-k/2-\varepsilon n}\}$. Also, for $\mathbf{G} \in \mathbb{F}_q^{k \times n}$, let $S_{\varepsilon}(\mathbf{G}) = \{\mathbf{s} \neq 0 : n_{\mathbf{s},\mathbf{C}} \ge q^{-k/2-\varepsilon n}\}$. The previous lemma tells us that $\forall \mathbf{s} \neq \mathbf{0}, |G_{\varepsilon}(\mathbf{s})| = o(|G|)$ where $|G| = q^{nk}$ is the total number of possible matrices $\mathbf{G} \in \mathbb{F}_q^{k \times n}$. Now, notice that

$$ \sum_{\mathbf{s} \neq \mathbf{0}} |G_{\varepsilon}(\mathbf{s})| = |\{(\mathbf{G}, \mathbf{s}) : n_{\mathbf{s},\mathbf{C}} \ge q^{-k/2-\varepsilon n}\}| = \sum_{\mathbf{G}} |S_{\varepsilon}(\mathbf{G})|. $$

This implies that $\sum_{G \in \mathbb{G}} |S_{\varepsilon}(G)| = o(|G|q^k)$ and $\mathbb{E}_{\mathbb{G}}[|S_{\varepsilon}(\mathbf{G})|] = o(q^k)$. Now fix $\mathbf{G} \in \mathbb{F}_q^{k \times n}$. We write

$$ \left( \sum_{\mathbf{s} \in \mathbb{F}_q^n} n_{\mathbf{s},\mathbf{C}} \right)^2 = \left( n_{\mathbf{0},\mathbf{C}} + \sum_{\mathbf{s} \in S_{\varepsilon}(\mathbf{G})} n_{\mathbf{s},\mathbf{C}} + \sum_{\mathbf{s} \notin S_{\varepsilon}(\mathbf{G})} n_{\mathbf{s},\mathbf{C}} \right)^2 \le 3n_{\mathbf{0},\mathbf{C}}^2 + 3 \left( \sum_{\mathbf{s} \in S_{\varepsilon}(\mathbf{G})} n_{\mathbf{s},\mathbf{C}} \right)^2 + 3 \left( \sum_{\mathbf{s} \notin S_{\varepsilon}(\mathbf{G})} n_{\mathbf{s},\mathbf{C}} \right)^2 \quad (29) $$

$$ \le 3n_{\mathbf{0},\mathbf{C}}^2 + 3|S_{\varepsilon}(\mathbf{G})| \sum_{\mathbf{s} \neq \mathbf{0}} n_{\mathbf{s},\mathbf{C}}^2 + 3 \left( q^{k/2 - \varepsilon n} \right)^2 \quad (30) $$

$$ \le 3|S_{\varepsilon}(\mathbf{G})| + o(q^k) \quad (31) $$

Here (29) follows from the inequality $(x + y + z)^2 \le 3x^2 + 3y^2 + 3z^2$ (which can be proved by noticing that $3x^2 + 3y^2 + 3z^2 - (x + y + z)^2 = (x - y)^2 + (y - z)^2 + (x - z)^2$). (30) follows from the Cauchy-Schwartz inequality and (31) is a consequence of $\sum_{\mathbf{s} \in \mathbb{F}_q^k} n_{\mathbf{s},\mathbf{C}}^2 = 1$ which also gives $n_{\mathbf{0},\mathbf{C}}^2 \le 1$. In order to conclude, we write

$$ P = \mathbb{E}_{\mathbb{G}} \left[ \frac{1}{q^k} \left( \sum_{\mathbf{s} \in F_q^k} n_{\mathbf{s},\mathbf{C}} \right)^2 \right] \le \frac{1}{q^k} \left( 3\mathbb{E}_{\mathbb{G}}[|S_{\varepsilon}(\mathbf{G})|] + o(q^k) \right) = o(1). $$

$\square$
# 6 From the quantum decoding problem to the short codeword problem

In this section, we show how to apply our algorithm for the quantum decoding problem into Regev's reduction in order to obtain quantum algorithms for the short codeword problem.

We fix $n, k', q \in \mathbb{N}$ with $q \ge 2$ as well as $\omega' \in (0, 1)$. We start from a random instance $G' \in \mathbb{F}_q^{k' \times n}$ of SCP($q, n, k', \omega'$). Let $C'$ be the code associated to $G'$ and $C = (C')^{\perp}$ the dual code of $C'$. The idea will be to solve a quantum decoding problem associated to $C$, i.e. from the state $|\psi_c\rangle \stackrel{\Delta}{=} \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle$ where $c$ belongs to $C$, we want to recover $c$. Then we apply the quantum Fourier transform and measure in the computational basis to obtain a short codeword of $C'$. We also define $k = n - k'$ and

$$ \omega \stackrel{\Delta}{=} (\omega')^{\perp} = \frac{\left(\sqrt{(q-1)(1-\omega')} - \sqrt{\omega'}\right)^2}{q} \quad ; \quad f(e) \stackrel{\Delta}{=} \left(\sqrt{\frac{\omega}{q-1}}\right)^{|e|} \left(\sqrt{1-\omega'}\right)^{n-|e|} $$

Recall also, using $\omega^{\perp} = \omega'$ that

$$ \hat{f}(\mathbf{y}) = \left( \sqrt{\frac{\omega'}{q-1}} \right)^{|\mathbf{y}|} \left( \sqrt{1-\omega'} \right)^{n-|\mathbf{y}|} $$

**Remark.** We use this notation $k', \omega'$ so that the problem we reduce to is a QDP($q, n, k, \omega$) with a generating matrix $G \in \mathbb{F}_q^{k \times n}$. This allows us to keep notation consistent with the previous section but be aware that the Short Codeword problem we are solving is on $C' = C^{\perp}$.

## 6.1 Regev's reduction for codes

We now describe Regev's reduction for codes. As we will see, this does not necessarily give a reduction from the short codeword problem to the quantum decoding problem because of the small error in the quantum decoding algorithm. We consider the formulation of this reduction from [SSTX09] and adapted in [DRT23] in the context of codes.

We first construct

$$ |\Omega_0\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} \sum_{e \in \mathbb{F}_q^n} f(e)|c\rangle|e\rangle $$

and add $c$ to the second register to obtain

$$ |\Omega_1\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle|\psi_c\rangle, \quad \text{where } |\psi_c\rangle = \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle. $$

The idea is then to recover $c$ from $|\psi_c\rangle$ using an algorithm for the quantum decoding problem. If this can be done perfectly, we can actually use this algorithm to erase the first register and obtain the state

$$ |\Omega_2\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |\psi_c\rangle. $$

We then apply the Quantum Fourier Transform on this state to get

$$ |\widehat{\Omega}_3\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |\widehat{\psi}_c\rangle = \sqrt{|C|} \sum_{\mathbf{y} \in C'} \hat{f}(\mathbf{y})|\mathbf{y}\rangle. $$
This follows from Proposition 11. Finally, we measure this state in the computational basis and
hope to find a small codeword.

The algorithm can be summarized by

<figure><img src="image_10.png" /><figcaption>**Algorithm of the quantum reduction.**</figcaption></figure>

There are a two issues that can make the above algorithm not work as we want:

* The quantum decoding problem used in order to go from $|\Omega_1\rangle$ to $|\Omega_2\rangle$ does not work perfectly in many cases. Even if we have an algorithm which works w.p. $1-o(1)$, this can greatly change the state $|\Omega_3\rangle$ that we have at the end$^5$. This also means we have to explicit each time our quantum decoding procedure and analyze thoroughly the resulting state.

* Even if we obtain exactly the state $\sqrt{|C|} \sum_{\mathbf{y} \in C'} \hat{f}(\mathbf{y})|\mathbf{y}\rangle$ we want, for values of $\omega'$ which are too large, this algorithm will actually always output $\mathbf{y} = \mathbf{0}$ but we want a small non-zero codeword so our algorithm will not work.

In this section, we show that our algorithms (or slight variants of our algorithms) can be successfully used in Regev's reduction in order to solve the Short Codeword Problem despite the above shortcomings. We show the following:

1. If we take our polynomial time algorithms for the quantum decoding problem (Section 4) we can find in quantum polynomial time small codewords down to Prange's bound, i.e. down to $\frac{(n-k')(q-1)}{q} = \frac{k(q-1)}{q}$. Notice however, that our algorithm obtains a state $|\Omega_2\rangle$ very far from the theoretical state $|\Omega_2\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |\psi_c\rangle$, but we still show how to obtain a small codeword in $C$ after performing QFT and measuring.

2. If we consider the tractability regime and if we take the Pretty Good Measurement associated to the states $|\hat{\psi}_c\rangle$, we show that we actually exactly get the state $|\Omega_2\rangle$ we are looking for (up to a normalization factor). We then look at this PGM and 2 variants:

(a) If we finish the analysis with the PGM, we will most often be in regimes where we measure $\mathbf{0}$ in the final step so we will not be able to solve the Short Codeword problem.

(b) We can slightly tweak the PGM so that it will give us a short codeword down to the tractability bound.

<footnote>$^5$This seems counterintuitive at first as we would expect the final state to be $\epsilon$-close to the ideal state if the quantum decoding succeeds w.p. $1 - \epsilon$. However, we are in regimes where an ideal quantum decoder does not exist so such continuity arguments will not hold. As it will appear in our analysis, it is possible to slightly tweak the measurements used in the Quantum Decoding Problem and greatly change the outcome state.</footnote>
(c) We also show another example where we can slightly tweak the PGM but where the reduction utterly fails, meaning that the state we obtain before measuring is $|\perp\rangle$. This shows that there is no hope to perform generic reduction between the quantum decoding problem and the short codeword problem with this method.

## 6.2 The quantum reduction with unambiguous state discrimination

We first show how to use our quantum polynomial time algorithms for the quantum decoding in Regev's reduction. We first construct

$$|\Omega_1\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} |c\rangle|\psi_c\rangle, \quad \text{where } |\psi_c\rangle = \sum_{e \in \mathbb{F}_q^n} f(e)|c+e\rangle.$$

We then apply unambiguous state discrimination measurement on $|\psi_c\rangle = \bigotimes_{i=1}^n |\psi_{c_i}\rangle$. Recall that by using the version of unambiguous state discrimination presented in Proposition 17 for each $i$, we perform a unitary $U$ on the $i^{th}$ register of $|\Omega_1\rangle$ that does the following for each $c_i \in \mathbb{F}_q$:

$$U|\psi_{c_i}\rangle|0\rangle = \sqrt{p_{\text{usd}}}|c_i\rangle|0\rangle + \sqrt{1-p_{\text{usd}}}|0\rangle|1\rangle.$$

Here

$$p_{\text{usd}} = q \cdot \frac{\omega^{\perp}}{q-1} = \frac{q}{q-1} \omega'. \quad (32)$$

After applying this (coherent) USD, we obtain the state

$$|\Omega_2\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} \left( |c\rangle \otimes \left( \bigotimes_{i=1}^n \sqrt{p_{\text{usd}}}|c_i\rangle|0\rangle + \sqrt{1-p_{\text{usd}}}|0\rangle|1\rangle \right) \right) \\ = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} |c\rangle \sum_{J \subseteq [n]} \beta_J |\tilde{c}_J\rangle.$$

where

$|\tilde{c}_J\rangle = \bigotimes_{i=1}^n |\gamma_i\rangle \quad \text{with} \quad \begin{cases} |\gamma_i\rangle = |c_i\rangle|0\rangle & \text{if } i \in J \\ |\gamma_i\rangle = |0\rangle|1\rangle & \text{otherwise} \end{cases}$

and $\beta_J = \sqrt{(1-p_{\text{usd}})^{n-|J|}(p_{\text{usd}})^{|J|}}$. $J$ here corresponds to the set of indices where the USD succeeded. Notice that one can efficiently recover $J$ from $|\tilde{c}_J\rangle$ by looking at the outcome registers, so we can add it to obtain the state

$$|\Omega_3\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} |c\rangle \sum_{J \subseteq [n]} \beta_J |\tilde{c}_J\rangle|J\rangle.$$

We now measure $J$ to obtain the state

$$|\Omega_4(J)\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} |c\rangle|\tilde{c}_J\rangle.$$

Notice that $|J|$ follows the distribution $D(p_{\text{usd}})$ with $p_{\text{usd}} > R$ so, there exists an absolute constant $\varepsilon > 0$, s.t. $(R + \varepsilon)n \le |J| \le (p_{\text{usd}})n$ w.p. at least $\frac{1}{2} - o(1)$ (the probability that $|J| \le p_{\text{usd}}n$ is at least $\frac{1}{2}$). Moreover, using the same argument as in Section 3.1, we can recover $c$ from $c_J$ w.p. $1 - o(1)$. This means we can erase the register $c$ in $|\Omega_4(J)\rangle$ to get

$$|\Omega_5(J)\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}} |c_J\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in \mathcal{C}_J} |c\rangle.$$
We apply the Fourier transform on this state to get

$$|\widehat{\Omega_5(J)}\rangle = \frac{1}{\sqrt{|(C_J)^\perp|}} \sum_{\mathbf{y} \in (C_J)^\perp} |\mathbf{y}\rangle.$$

By measuring this state, we get a vector $\mathbf{y} \in (C_J)^\perp$ of weight at most $\frac{(q-1)|J|}{q} \le \frac{(q-1)P_{\text{usd}}n}{q} = \omega'n$ w.p. $\Theta(1)$. Here we used (32) for the last equality. The crux is that by Lemma 2 we have

$$(C_J)^\perp = (C^\perp)^J.$$

In other words, we get words in $C^\perp$ shortened at $J$, meaning dual codewords that are 0 outside $J$. We have therefore constructed a word $\mathbf{z} \in C^\perp$ s.t. $\mathbf{z}_j = \mathbf{y}_j$ if $j \in J$ and $\mathbf{z}_j = 0$ otherwise.

In conclusion, we just proved the following

**Theorem 8.** The above algorithm, that performs Regev's reduction and uses unambiguous state discrimination for the quantum decoding problem, can solve in polynomial time SCP($q, n, k', \omega'$) for $\omega' > \frac{(q-1)k}{q} = \frac{(q-1)(n-k')}{q}$ w.p. $\Theta(1)$.

Notice that we can repeat this algorithm to amplify the success probability. Our algorithm can go down to Prange's bound $\frac{(q-1)(n-k')}{q}$, which is the best known bound for polynomial time algorithms for the short codeword problem. The whole algorithm is summarized by:

<table><caption>**Algorithm of the quantum reduction in the case of USD.**</caption><tr><td>Initial state preparation:</td><td>$|\Omega_0\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} \sum_{e \in F_q^n} f(e)|c\rangle|e\rangle$</td></tr><tr><td>adding <b>c</b> to <b>e</b>:</td><td>$\mapsto |\Omega_1\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} \sum_{e \in F_q^n} f(e)|c\rangle|c+e\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle|\psi_c\rangle$</td></tr><tr><td>applying coherent USD:</td><td>$\mapsto |\Omega_2\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} \left( |c\rangle \otimes \left( \bigotimes_{i=1}^n \sqrt{P_{\text{usd}}}|c_i\rangle|0\rangle + \sqrt{1-P_{\text{usd}}}|0\rangle|1\rangle \right) \right)$<br>$= \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle \sum_{J \subseteq [n]} \beta_J |\tilde{c}_J\rangle$</td></tr><tr><td>put <i>J</i> in the last register using $|\tilde{c}_J\rangle \mapsto |\Omega_3\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle \sum_{J \subseteq [n]} \beta_J |\tilde{c}_J\rangle|J\rangle$</td></tr><tr><td>measure <i>J</i></td><td>$\mapsto |\Omega_4\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle|\tilde{c}_J\rangle$</td></tr><tr><td>erase <b>c</b></td><td>$\mapsto |\Omega_5\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c_J\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C_J} |c\rangle$</td></tr><tr><td>QFT:</td><td>$\mapsto |\Omega_6\rangle = \frac{1}{\sqrt{|(C_J)^\perp|}} \sum_{\mathbf{y} \in (C_J)^\perp} |\mathbf{y}\rangle$</td></tr><tr><td>measuring the whole state:</td><td>$\mapsto |\mathbf{y}\rangle$ (where $\mathbf{y} \in (C_J)^\perp = (C^\perp)^J \subset C^\perp$)</td></tr></table>

## 6.3 The Quantum reduction with the Pretty Good Measurement

We now study Regev's reduction when we use the PGM for the quantum decoding problem. We consider the basis $\{|Y_c\rangle\}_{c \in C}$ described in the previous section associated to the states $\{|\psi_c\rangle\}_{c \in C}$.
We showed that

$$ \forall \mathbf{c} \in \mathcal{C}, \quad \langle \hat{\psi}_c | Y_c \rangle = \sqrt{P_{\text{PGM}}} $$

where $P_{\text{PGM}}$ is the probability that the Pretty Good Measurement succeeds. We now unfold Regev's reduction. We start from the state $|\Omega_1\rangle$ with a slight change, we apply namely immediately the QFT on the second register to get

$$ |\Omega_1\rangle = \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c \in \mathcal{C}} |c\rangle \langle \psi_c| $$

with $|\psi_c\rangle = \sum_e f(e)|c + e\rangle$. We then perform coherently the PGM on the second register and write the output on the third register. This means that if we write each $|\hat{\psi}_c\rangle = \sum_{c' \in \mathcal{C}} \alpha_{c,c'}|Y_{c'}\rangle$, we obtain

$$ |\Omega_2\rangle = \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c \in \mathcal{C}} |c\rangle \sum_{c' \in \mathcal{C}} \alpha_{c,c'} |Y_{c'}\rangle |c'\rangle $$

We then subtract the value of the third register in the first register to get

$$ |\Omega_3\rangle = \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c,c' \in \mathcal{C}} \alpha_{c,c'} |c-c'\rangle |Y_{c'}\rangle |c'\rangle $$

Finally, we reverse the PGM between registers 2 and 3 to obtain the state

$$ |\Omega_4\rangle = \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c,c' \in \mathcal{C}} \alpha_{c,c'} |c-c'\rangle |Y_{c'}\rangle |0\rangle $$

From the discussion at the beginning of this section, we have that for any $c \in \mathcal{C}$, $\alpha_{c,c} = \sqrt{P_{\text{PGM}}}$. This means we can rewrite the above state as

$$ \begin{aligned} |\Omega_4\rangle &= \frac{1}{\sqrt{|\mathcal{C}|}} \left( \sum_{c' \in \mathcal{C}} \sqrt{P_{\text{PGM}}} |0\rangle |Y_{c'}\rangle + \sum_{c,c' \neq c} \alpha_{c,c'} |c-c'\rangle |Y_{c'}\rangle \right) \\ &= \sqrt{P_{\text{PGM}}} |0\rangle \left( \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c \in \mathcal{C}} |Y_c\rangle \right) + \sum_{c,c' \neq c} \alpha_{c,c'} |c-c'\rangle |Y_{c'}\rangle. \end{aligned} $$

The next step of the reduction is to measure the first register of $|\Omega_4\rangle$. Since the states $|Y_{c'}\rangle$ are orthogonal and of norm 1, we measure 0 w.p. $P_{\text{PGM}}$ in the first register and the second register becomes

$$ |\Omega_5\rangle = \frac{1}{\sqrt{|\mathcal{C}|}} \sum_{c \in \mathcal{C}} |Y_c\rangle = |\tilde{W}_0\rangle = \frac{1}{n_0} \sum_{\mathbf{y} \in \mathcal{C}'} \hat{f}(\mathbf{y}) |\mathbf{y}\rangle $$

where $n_0 \triangleq \|\sum_{\mathbf{y} \in \mathcal{C}'} \hat{f}(\mathbf{y})|\mathbf{y}\|$. We measure this final state to potentially measure a small codeword. Let $a(t) = |\{\mathbf{y} \in \mathcal{C}' : |\mathbf{y}| = t\}|$. Note that this quantity corresponds to $a_0(t, \mathcal{C}')$ as defined in Subsection 5.2.1. The probability $p(t)$ that the above algorithms finds a word of weight $t$ in $\mathcal{C}'$ is

$$ p(t) = \frac{1}{n_0^2} a(t) |\hat{f}(t)|^2, \qquad (33) $$
where we overload the notation $\hat{f}$ to mean that $\hat{f}(t) = \hat{f}(\mathbf{y})$ for any $\mathbf{y}$ s.t. $|\mathbf{y}| = t$ (recall that $\hat{f}(\mathbf{y})$ is constant for any of these $\mathbf{y}$). The issue here is that for $\omega'$ small enough, we will almost always measure 0. Indeed,

$$p_0 = \frac{|\hat{f}(0)|^2}{n_0^2} = \frac{|\hat{f}(0)|^2}{\sum_t a(t)|\hat{f}(t)|^2} = \frac{|\hat{f}(0)|^2}{|\hat{f}(0)|^2 + \sum_{t \neq 0} a(t)|\hat{f}(t)|^2}$$

Here, notice that

$$|\hat{f}(0)|^2 = (1 - \omega')^n$$

$$\Pr_G \left[ \sum_{t \neq 0} a(t) |\hat{f}(t)|^2 \leq \frac{2}{q^k} \right] \geq 1 - o(1)$$

where for the last inequality, we use the concentration bounds for $a(t) = a_0(t, C')$ of Section 5.2.1. So when $\omega' < 1 - q^{-\frac{k}{n}}$, we measure 0 with high probability. This unfortunately happens quite often and it is a problem because in our short codeword problem, we want to find a small non-zero vector.

### 6.3.1 A counterexample that shows complete failure

We show that things can go even worse when slightly changing the measurement used. We show that instead of measuring $|0\rangle$, we can measure some given state $|\perp\rangle$ orthogonal to all the $|\tilde{W}_s\rangle$. Recall from Proposition 18 that

$$|Y_c\rangle = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \chi_c(u_s) |\tilde{W}_s\rangle$$

Also, the state resulting from Regev's reduction is the state $\sum_{c \in C} |Y_c\rangle = |\tilde{W}_0\rangle$. Our modified measurement can give an extra outcome which will be an $\mathbf{u} \in \mathbb{F}_q^n \setminus C$ and we define $S = C \cup \{\mathbf{u}\}$. Let

$$|Z_c\rangle \triangleq \frac{1}{\sqrt{q^k}} \left( |\perp\rangle + \sum_{s \neq 0} \chi_c(u_s) |\tilde{W}_s\rangle \right) \quad \forall c \in C \\ |Z_u\rangle \triangleq |\tilde{W}_0\rangle$$

Notice that the $|Z_y\rangle$ are pairwise orthogonal and $\text{span}(\{|Z_y\rangle\}_{y \in S}) = \text{span}(\{|\tilde{W}_s\rangle\}_{s \in \mathbb{F}_q^k}, |\perp\rangle) = \text{span}(\{|\tilde{\psi}_c\rangle\}_{c \in C}, |\perp\rangle)$. This means the measurement $\{|Z_y\rangle\}_{y \in S}$ will be complete when measuring any $|\tilde{\psi}_c\rangle$.

Recall that $|\tilde{\psi}_c\rangle = \frac{1}{\sqrt{q^k}} \sum_{s \in \mathbb{F}_q^k} \chi_s(\mathbf{u}_s) |W_s\rangle$, so we have

$$\forall c \in C, \langle \tilde{\psi}_c | Z_c \rangle = \frac{1}{\sqrt{q^k}} \sum_{s \neq 0} n_s = \sqrt{P_{\text{PGM}}} - \frac{n_0}{\sqrt{q^k}} \geq \sqrt{P_{\text{PGM}}} - \frac{1}{\sqrt{q^k}}$$

This means the above measurement solves the quantum decoding problem w.p. $(\sqrt{P_{\text{PGM}}} - \frac{n_0}{\sqrt{q^k}})^2 \geq (\sqrt{P_{\text{PGM}}} - \frac{1}{\sqrt{q^k}})^2$ which is $1 - o(1)$ as long as $P_{\text{PGM}} = 1 - o(1)$.
Now, we perform the reduction presented in Section 6.3. We just rewrite the states of the reduction

$$|\Omega_1\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle |\widehat{\psi}_c\rangle$$

$$|\Omega_2\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C} |c\rangle \sum_{y \in S} \beta_{c,y} |Z_y\rangle |y\rangle \quad \text{where } \beta_{c,y} = \langle \widehat{\psi}_c | Z_y \rangle$$

$$|\Omega_3\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C, y \in S} \beta_{c,y} |c - y\rangle |Z_y\rangle |y\rangle$$

$$|\Omega_4\rangle = \frac{1}{\sqrt{|C|}} \sum_{c \in C, y \in S} \beta_{c,y} |c - y\rangle |Z_y\rangle |0\rangle = \left( \sqrt{P_{PGM}} - \frac{n_0}{\sqrt{q^k}} \right) |0\rangle \frac{1}{\sqrt{|C|}} \sum_{c \in C} |Z_c\rangle + \frac{1}{\sqrt{|C|}} \sum_{c \in C} \sum_{y \in S, y \neq c} \beta_{c,y} |c - y\rangle |Z_y\rangle$$

where in the last line, we use that $\beta_{c,c} = (\sqrt{P_{PGM}} - \frac{n_0}{\sqrt{q^k}})$ for each $c \in C$. This means that when we measure the first register, we obtain **0** w.p. $(\sqrt{P_{PGM}} - \frac{n_0}{\sqrt{q^k}})^2$, and the resulting state is $|\Omega_5\rangle = \sum_{c \in C} |Z_c\rangle = |\perp\rangle$ which shows that the reduction entirely fails in this case.

### 6.3.2 A measurement that works

Finally, we show a measurement that will make the reduction work when $P_{PGM} = 1 - o(1)$. The idea is similar to the one of section 6.3.1. We add an extra outcome $u \in \mathbb{F}_q^n \setminus C$ and define $S = C \cup \{u\}$. We now define

$$|U_0\rangle = \frac{\sum_{y \in C', y \neq 0} \hat{f}(y) |y\rangle}{\| \sum_{y \in C', y \neq 0} \hat{f}(y) |y\rangle \|}$$
$$\forall c \in C, \quad |Z_c\rangle = \frac{1}{\sqrt{q^k}} \left( |U_0\rangle + \sum_{s \neq 0} \chi_c(u_s) |\tilde{W}_s\rangle \right)$$
$$|Z_u\rangle = |0\rangle$$

The $|Z_c\rangle$ are exactly the states $|Y_c\rangle$ of the pretty good measurement but we removed the $|0\rangle$ component of $|\tilde{W}_0\rangle$. In order to make the measurement complete, we add an extra basis element $|Z_u\rangle$. We therefore have a projective measurement $\{|Z_y\rangle\}_{y \in S}$. Again, we have $\langle \widehat{\psi}_c | Z_c \rangle \ge \sqrt{P_{PGM}} - \frac{1}{\sqrt{q^k}}$ and independent of $c$ so w.p. at least $\left( \sqrt{P_{PGM}} - \frac{1}{\sqrt{q^k}} \right)^2$, we get the state $|U_0\rangle$. Then, if we measure this state $|U_0\rangle$, we will get a codeword of weight $t$ w.p.

$$p(t) = \frac{a(t)|\hat{f}(t)|^2}{\sum_{t \neq 0} a(t)|\hat{f}(t)|^2}, \quad \forall t \neq 0$$

and $p(0) = 0$, where $a(t)$ is the number of codewords of weight $t$ in $C'$. Recall that

$$\hat{f}(t) = \left( \sqrt{\frac{\omega'}{q-1}} \right)^t \left( \sqrt{1-\omega'} \right)^{n-t}.$$

and we are in the regime where $P_{PGM} = 1 - o(1)$ which means that $\omega < (\delta_{\min}(1 - \frac{k}{n}))^\perp$ and hence $\omega' > \delta_{\min}(\frac{n-k}{n}) = \delta_{\min}(\frac{k}{n})$.
Using Proposition 22 and the expression of $\hat{f}(t)$, as well as concentration bounds for $a(t)$, we have that for any absolute constant $\varepsilon > 0$, $\sum_{t=\lfloor(\omega'-\varepsilon)n\rfloor}^{\lfloor(\omega'+\varepsilon)n\rfloor} p(t) = 1 - o(1)$. This means we will measure a word of weight approximately $\lfloor\omega'n\rfloor$ in $C'$.

**Discussion.** These 3 examples above show that it is very easy to slightly modify the algorithm for solving the quantum decoding problem and drastically change the result after Regev's reduction. We therefore cannot have proper reduction theorems between the quantum decoding problem and the short codeword problem but we have to analyze on a case by case basis whether an algorithm for the quantum decoding problem can be used for finding a short codeword. On the positive side of the reduction, we can summarize our results as follows:

**Proposition 24.** Let $q, n, k \in \mathbb{N}$ with $q \ge 2$ and $\omega \in (0,1)$. Let also $R = \lfloor \frac{k}{n} \rfloor$, $\omega' = \omega^{\perp}$ and $k' = n - k$.

* For $\omega < (\frac{q-1R}{q})^{\perp}$, there exists a quantum algorithm running in time poly($n, \log(q)$) that solves QDP($q, n, k, \omega$) w.p. $1 - o(1)$ (Theorem 6). Moreover, this algorithm can be used using Regev's reduction to solve SCP($q, n, k'$, $\omega'$) in time poly($n, \log(q)$) (Section 6.2).

* For $\omega < (\delta_{\min}(1-R))^{\perp}$, there exists a quantum algorithm (for which we don't specify the running time but which could be exponential in $n$) that solves QDP($q, n, k, \omega$) w.p. $1 - o(1)$ (Proposition 23). This algorithm can be (slightly tweaked but with success probability still $1-o(1)$) and used in Regev's reduction to solve SCP($q, n, k'$, $\omega'$) w.p. $\Theta(1)$ (Section 6.3.2).

## References

[AAB$^{+22a}$] Carlos Aguilar Melchor, Nicolas Aragon, Paulo Barreto, Slim Bettaieb, Loïc Bidoux, Olivier Blazy, Jean-Christophe Deneuville, Philippe Gaborit, Santosh Ghosh, Shay Gueron, Tim Güneysu, Rafael Misoczki, Edoardo Persichetti, Jan Richter-Brockmann, Nicolas Sendrier, Jean-Pierre Tillich, Valentin Vasseur, and Gilles Zémor. BIKE. Round 4 Submission to the NIST Post-Quantum Cryptography Call, v. 5.1, October 2022.

[AAB$^{+22b}$] Carlos Aguilar Melchor, Nicolas Aragon, Slim Bettaieb, Loïc Bidoux, Olivier Blazy, Jurjen Bos, Jean-Christophe Deneuville, Arnaud Dion, Philippe Gaborit, Jérôme Lacan, Edoardo Persichetti, Jean-Marc Robert, Pascal Véron, Gilles Zémor, and Jurjen Bos. HQC. Round 4 Submission to the NIST Post-Quantum Cryptography Call, October 2022. https://pqc-hqc.org/.

[ABC$^{+22}$] Martin Albrecht, Daniel J. Bernstein, Tung Chou, Carlos Cid, Jan Gilcher, Tanja Lange, Varun Maram, Ingo von Maurich, Rafael Mizoczki, Ruben Niederhagen, Edoardo Persichetti, Kenneth Paterson, Christiane Peters, Peter Schwabe, Nicolas Sendrier, Jakub Szefer, Cen Jung Tjhai, Martin Tomlinson, and Wang Wen. Classic McEliece (merger of Classic McEliece and NTS-KEM). https://classic.mceliece.org, November 2022. Fourth round finalist of the NIST post-quantum cryptography call.

[AG11] Sanjeev Arora and Rong Ge. New algorithms for learning in presence of errors. In Luca Aceto, Monika Henzinger, and Jirí Sgall, editors, *Automata, Languages and Programming*, volume 6755 of LNCS, pages 403–415. Springer Berlin Heidelberg, 2011.

[AHI$^{+17}$] Benny Applebaum, Naama Haramaty, Yuval Ishai, Eyal Kushilevitz, and Vinod Vaikuntanathan. Low-complexity cryptographic hash functions. In *ITCS*, volume 67 of LIPIcs, pages 7:1–7:31. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2017.
[Ajt96] Miklós Ajtai. Generating hard instances of lattice problems (extended abstract). 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 99-108. ACM, 1996.

[Ale11] Michael Alekhnovich. More on average case vs approximation complexity. *Computational Complexity*, 20(4):755-786, 2011.

[Ber10] Daniel J. Bernstein. Grover vs. McEliece. In Nicolas Sendrier, editor, *Post-Quantum Cryptography 2010*, volume 6061 of LNCS, pages 73-80. Springer, 2010.

[BJLM13] Daniel J. Bernstein, Stacey Jeffery, Tanja Lange, and Alexander Meurer. Quantum algorithms for the subset-sum problem. In *Post-Quantum Cryptography 2011*, volume 7932 of LNCS, pages 16-33, Limoges, France, June 2013.

[BJMM12] Anja Becker, Antoine Joux, Alexander May, and Alexander Meurer. Decoding random binary linear codes in $2^{n/20}$: How $1+1=0$ improves information set decoding. In *Advances in Cryptology - EUROCRYPT 2012*, LNCS. Springer, 2012.

[BK02] H. Barnum and E. Knill. Reversing quantum dynamics with near-optimal quantum and classical fidelity. *Journal of Mathematical Physics*, 43(5):2097-2106, 04 2002.

[BKMH97] Masahi Ban, Keiko Kurokawa, Rei Momose, and Osamu Hirota. Optimum measurements for discrimination among symmetric quantum states and parameter estimation. *International Journal of Theoretical Physics*, 36(6):1269-1288, 1997.

[BKW03] Avrim Blum, Adam Kalai, and Hal Wasserman. Noise-tolerant learning, the parity problem, and the statistical query model. *Journal of the ACM (JACM)*, 50(4):506-519, 2003.

[BLVW19] Zvika Brakerski, Vadim Lyubashevsky, Vinod Vaikuntanathan, and Daniel Wichs. Worst-case hardness for LPN and cryptographic hashing via code smoothing. In Yuval Ishai and Vincent Rijmen, editors, *Advances in Cryptology - EUROCRYPT 2019 - 38th Annual International Conference on the Theory and Applications of Cryptographic Techniques, Darmstadt, Germany, May 19-23, 2019, Proceedings, Part III*, volume 11478 of LNCS, pages 619-635. Springer, 2019.

[BM17] Leif Both and Alexander May. Optimizing BJMM with Nearest Neighbors: Full Decoding in $2^{2/21n}$ and McEliece Security. In *WCC Workshop on Coding and Cryptography*, September 2017.

[BV11] Zvika Brakerski and Vinod Vaikuntanathan. Efficient fully homomorphic encryption from (standard) LWE. In Rafail Ostrovsky, editor, *IEEE 52nd Annual Symposium on Foundations of Computer Science, FOCS 2011, Palm Springs, CA, USA, October 22-25, 2011*, pages 97-106. IEEE Computer Society, 2011.

[CB98] Anthony Chefles and Stephen M. Barnett. Optimum unambiguous discrimination between linearly independent symmetric states. *Physics Letters A*, 250(4):223-229, 1998.

[CDMT22] Kevin Carrier, Thomas Debris-Alazard, Charles Meyer-Hilfiger, and Jean-Pierre Tillich. Statistical decoding 2.0: Reducing decoding to LPN. In *Advances in Cryptology - ASIACRYPT 2022*, LNCS. Springer, 2022.
[CL21] André Chailloux and Johanna Loyer. Lattice sieving via quantum random walks. In Mehdi Tibouchi and Huaxiong Wang, editors, *Advances in Cryptology - ASIACRYPT 2021 - 27th International Conference on the Theory and Application of Cryptology and Information Security, Singapore, December 6-10, 2021, Proceedings, Part IV*, volume 13093 of *Lecture Notes in Computer Science*, pages 63–91. Springer, 2021.

[CLZ22] Yilei Chen, Qipeng Liu, and Mark Zhandry. Quantum algorithms for variants of average-case lattice problems via filtering. In Orr Dunkelman and Stefan Dziem-bowski, editors, *Advances in Cryptology - EUROCRYPT 2022 - 41st Annual International Conference on the Theory and Applications of Cryptographic Techniques, Trondheim, Norway, May 30 - June 3, 2022, Proceedings, Part III*, volume 13277 of LNCS, pages 372–401. Springer, 2022.

[Deb23] Thomas Debris-Alazard. Code-based cryptography: Lecture notes, arxiv cs.cr 2304.03541, 2023.

[Din07] Irit Dinur. The PCP theorem by gap amplification. J. ACM, 54(3):12, 2007.

[DR22] Thomas Debris-Alazard and Nicolas Resch. Worst and average case hardness of decoding via smoothing bounds. preprint, December 2022. eprint.

[DRT23] Thomas Debris-Alazard, Maxime Remaud, and Jean-Pierre Tillich. Quantum reduction of finding short code vectors to the decoding problem. preprint (v2), June 2023. arXiv:2106.02747.

[Dum89] Il'ya Dumer. Two decoding algorithms for linear codes. Probl. Inf. Transm., 25(1):17–23, 1989.

[FS96] Jean-Bernard Fischer and Jacques Stern. An efficient pseudo-random generator provably as secure as syndrome decoding. In Ueli Maurer, editor, *Advances in Cryptology - EUROCRYPT'96*, volume 1070 of LNCS, pages 245–255. Springer, 1996.

[GGR98] Oded Goldreich, Shafi Goldwasser, and Dana Ron. Property testing and its connection to learning and approximation. J. ACM, 45(4):653–750, 1998.

[GVW13] Sergey Gorbunov, Vinod Vaikuntanathan, and Hoeteck Wee. Attribute-based encryption for circuits. In Dan Boneh, Tim Roughgarden, and Joan Feigenbaum, editors, *Symposium on Theory of Computing Conference, STOC'13, Palo Alto, CA, USA, June 1-4, 2013*, pages 545–554. ACM, 2013.

[KT17] Ghazal Kachigar and Jean-Pierre Tillich. Quantum information set decoding algorithms. In *Post-Quantum Cryptography 2017*, volume 10346 of LNCS, pages 69–89, Utrecht, The Netherlands, June 2017. Springer.

[Laa16] Thijs Laarhoven. *Search problems in cryptography*. PhD thesis, Eindhoven University of Technology, 2016.

[Lev87] Leonid A Levin. One way functions and pseudorandom generators. Combinatorica, 7(4):357–363, 1987.

[LMvdP15] Thijs Laarhoven, Michele Mosca, and Joop van de Pol. Finding shortest lattice vectors faster using quantum search. Des. Codes Cryptogr., 77(2-3):375–400, 2015.

[LN97] Rudolf Lidl and Harald Niederreiter. Finite fields, volume 20 of Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge, second edition, 1997. With a foreword by P. M. Cohn.
[Lyu05] Vadim Lyubashevsky. The parity problem in the presence of noise, decoding random linear codes, and the subset sum problem. In Chandra Chekuri, Klaus Jansen, José D. P. Rolim, and Luca Trevisan, editors, *Approximation, Randomization and Combinatorial Optimization, Algorithms and Techniques, 8th International Workshop on Approximation Algorithms for Combinatorial Optimization Problems, APPROX 2005 and 9th International Workshop on Randomization and Computation, RANDOM 2005, Berkeley, CA, USA, August 22-24, 2005, Proceedings*, volume 3624 of Lecture Notes in Computer Science, pages 378-389. Springer, 2005.

[McE78] Robert J. McEliece. *A Public-Key System Based on Algebraic Coding Theory*, pages 114-116. Jet Propulsion Lab, 1978. DSN Progress Report 44.

[MMT11] Alexander May, Alexander Meurer, and Enrico Thomae. Decoding random linear codes in $O(2^{0.054n})$. In Dong Hoon Lee and Xiaoyun Wang, editors, *Advances in Cryptology - ASIACRYPT 2011*, volume 7073 of LNCS, pages 107-124. Springer, 2011.

[MO15] Alexander May and Ilya Ozerov. On computing nearest neighbors with applications to decoding of binary linear codes. In E. Oswald and M. Fischlin, editors, *Advances in Cryptology - EUROCRYPT 2015*, volume 9056 of LNCS, pages 203-228. Springer, 2015.

[Mon06] Ashley Montanaro. On the distinguishability of random quantum states. *Communications in Mathematical Physics*, 273, 07 2006.

[MTSB12] Rafael Misoczki, Jean-Pierre Tillich, Nicolas Sendrier, and Paulo S. L. M. Barreto. MDPC-McEliece: New McEliece variants from moderate density parity-check codes, 2012.

[Pra62] Eugene Prange. The use of information sets in decoding cyclic codes. *IRE Transactions on Information Theory*, 8(5):5-9, 1962.

[Reg05] Oded Regev. On lattices, learning with errors, random linear codes, and cryptography. In *Proceedings of the 37th Annual ACM Symposium on Theory of Computing, Baltimore, MD, USA, May 22-24, 2005*, pages 84-93, 2005.

[Sha48] Claude E. Shannon. A mathematical theory of communication. *Bell System Technical Journal*, 27(3):379-423, 1948.

[Sha79] Adi Shamir. How to share a secret. *Commun. ACM*, 22(11):612-613, 1979.

[SSTX09] Damien Stehlé, Ron Steinfeld, Keisuke Tanaka, and Keita Xagawa. Efficient public key encryption based on ideal lattices. In Mitsuru Matsui, editor, *Advances in Cryptology - ASIACRYPT 2009, 15th International Conference on the Theory and Application of Cryptology and Information Security, Tokyo, Japan, December 6-10, 2009. Proceedings*, volume 5912 of LNCS, pages 617-635. Springer, 2009.

[Ste88] Jacques Stern. A method for finding codewords of small weight. In G. D. Cohen and J. Wolfmann, editors, *Coding Theory and Applications*, volume 388 of LNCS, pages 106-113. Springer, 1988.

[Ste93] Jacques Stern. A new identification scheme based on syndrome decoding. In D.R. Stinson, editor, *Advances in Cryptology - CRYPTO'93*, volume 773 of LNCS, pages 13-21. Springer, 1993.
[YZ22] Takahashi Yamakawa and Mark Zhandry. Verifiable quantum advantage without structure. In *63rd IEEE Annual Symposium on Foundations of Computer Science, FOCS 2022, Denver, CO, USA, October 31 - November 3, 2022*, pages 69-74. IEEE, 2022.

[YZW$^{+}$19] Yu Yu, Jiang Zhang, Jian Weng, Chun Guo, and Xiangxue Li. Collision resistant hashing from sub-exponential learning parity with noise. In *ASIACRYPT (2)*, volume 11922 of *Lecture Notes in Computer Science*, pages 3-24. Springer, 2019.
A General phases

We consider more general error functions $f(e) = \sqrt{1-t^{(n-|e|)}}(e^{i\theta}\sqrt{t})^{|e|}$ with $t \in [0, \frac{1}{2}]$ and $\theta \in [0, 2\pi)$, which means we consider the states

$$|\psi_f(c)\rangle = \sum_{e \in \{0,1\}^n} f(e)|c+e\rangle = \bigotimes_{i=1}^n \sqrt{1-t}|c_i\rangle + e^{i\theta}\sqrt{t}|1-c_i\rangle.$$

Again, we consider unambiguous states discrimination between the following two states

$$|\zeta_0\rangle = \sqrt{1-t}|0\rangle + e^{i\theta}\sqrt{t}|1\rangle \quad ; \quad |\zeta_1\rangle = e^{i\theta}\sqrt{t}|0\rangle + \sqrt{1-t}|1\rangle.$$

We have $|\langle\zeta_0|\zeta_1\rangle| = |\sqrt{t(1-t)}(e^{i\theta} + e^{-i\theta})| = 2\sqrt{t(1-t)}|\cos(\theta)|$. From there, we have that decoding with this unambiguous measurement is possible w.h.p as long as

$$1 - 2\sqrt{t(1-t)}|\cos(\theta)| > \frac{k}{n} \qquad (34)$$

Now, what do we get in the dual? Let

$$|\psi_f\rangle = \frac{1}{\sqrt{Z}} \sum_{c \in C, e \in \{0,1\}^n} f(e)|c+e\rangle$$

where Z is a normalizing constant. We write

$$\widehat{|\psi_f\rangle} = \frac{2^k}{\sqrt{2^n \cdot Z}} \sum_{y \in C^\perp} \hat{f}(y)|y\rangle.$$

Moreover, we write

$$\widehat{|\zeta_0\rangle} = \frac{1}{\sqrt{2}} (\sqrt{1-t} + e^{i\theta}\sqrt{t}) |0\rangle + \frac{1}{\sqrt{2}} (\sqrt{1-t} - e^{i\theta}\sqrt{t}) |1\rangle$$

$$\widehat{|\zeta_1\rangle} = \frac{1}{\sqrt{2}} (\sqrt{1-t} + e^{i\theta}\sqrt{t}) |0\rangle - \frac{1}{\sqrt{2}} (\sqrt{1-t} - e^{i\theta}\sqrt{t}) |1\rangle$$

This means that $\hat{f}(y) = \frac{1}{\sqrt{2}}(\sqrt{1-t} + e^{i\theta}\sqrt{t})^{(n-|y|)} \frac{1}{\sqrt{2}}(\sqrt{1-t} - e^{i\theta}\sqrt{t})^{|y|}$. The probability $p(t, \theta)$ to measure 1 on each coordinate in the above is given by

$$p(t, \theta) = \frac{1}{2} \left| \sqrt{1-t} - e^{i\theta} \sqrt{t} \right|^2 = \frac{1}{2} \left( \left( \sqrt{1-t} - \sqrt{t \cos(\theta)} \right)^2 + t \sin^2(\theta) \right) \quad (35)$$

$$= \frac{1}{2} \left( 1 - 2\sqrt{t(1-t)} \cos(\theta) \right) \qquad (36)$$

In the case Equation 34 is saturated, meaning $1 - 2\sqrt{t(1-t)}|\cos(\theta)| \approx \frac{k}{n}$, we have $p(t, \theta) = \frac{k}{2n}$ as long as $\cos(\theta) \ge 0$ (otherwise, we have the symmetric for large weights) which is Prange's bound. Notice that the above only works when Equation 34 can be saturated, so we can not take $\theta = \pi/2$ for example.