# Quadratic Modelings of Syndrome Decoding

Alessio Caminata, Ryann Cartor, Alessio Meneghetti, Rocco Mora, Alex Pellegrini

► To cite this version:

Alessio Caminata, Ryann Cartor, Alessio Meneghetti, Rocco Mora, Alex Pellegrini. Quadratic Modelings of Syndrome Decoding. PQCrypto 2025, Apr 2025, Taipei, Taiwan. pp.35-70, 10.1007/978-3-031-86599-2_2. hal-05449347

HAL Id: hal-05449347

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

Submitted on 8 Jan 2026

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
Quadratic Modelings of Syndrome Decoding

Alessio Caminata¹, Ryann Cartor², Alessio Meneghetti³, Rocco Mora⁴, and
Alex Pellegrini⁵

¹ Università di Genova

² Clemson University

³ Università di Trento

⁴ CISPA Helmholtz Center for Information Security

⁵ Eindhoven University of Technology

**Abstract.** This paper presents enhanced reductions of the bounded-weight and exact-weight Syndrome Decoding Problem (SDP) to a system of quadratic equations. Over $F_2$, we improve on a previous work and study the degree of regularity of the modeling of the exact weight SDP. Additionally, we introduce a novel technique that transforms SDP instances over $F_q$ into systems of polynomial equations and thoroughly investigate the dimension of their varieties. Experimental results are provided to evaluate the complexity of solving SDP instances using our models through Gröbner bases techniques.

**Keywords:** Syndrome Decoding · Gröbner Basis · Cryptanalysis · Code-Based Cryptography · Multivariate Cryptography

# 1 Introduction

As widespread quantum computing becomes closer to reality, accurate cryptanalysis of post-quantum cryptosystems is of the utmost importance. Code-based cryptography is one of the main areas of focus in the search for quantum-secure cryptosystems. This is well represented by the NIST Post-Quantum Standardization Process, where as many as three finalists, namely Classic McEliece [9] (an IND-CCA2 secure variation of McEliece's very first code-based scheme [32]), HQC [33] and BIKE [2], belong to this family. Similarly, NIST's additional call for digital signatures has numerous proposals that make use of linear codes. Many of the proposed schemes are based on the hardness of (sometimes structured variants of) the syndrome decoding problem.

The parameters of many code-based schemes are carefully chosen to align with the latest advancements with respect to this computational problem. Despite decades of intensive research in this direction, all the algorithms developed so far exhibit exponential complexity. This is not surprising, since the problem has been shown to be NP-hard [8]. In particular, after more than 60 years of investigation since the groundbreaking paper of Prange [35], the reduction in the exponent for most parameters of interest has been minimal [7, 10, 12, 23, 28, 30, 31, 38]. All the works mentioned fall into the family of Information Set Decoding (ISD) algorithms, whose basic observation is that it is
easier to guess error-free positions, and guessing enough of them is sufficient to decode. This resistance to ISD algorithms makes the syndrome decoding problem a reliable foundation for code-based cryptosystems.

To comprehensively assess security, it is imperative to consider attacks stemming from various other realms of post-quantum cryptography. For instance, attacks typically associated with multivariate or lattice-based schemes should also be taken into account for code-based schemes, when applicable. A remarkable example is offered by dual attacks, originally introduced in lattice-based cryptography, where, however, they have been strongly questioned. In contrast, their code-based counterpart [17, 18] has recently outperformed ISD techniques for a non-negligible regime of parameters, by reducing the decoding problem to the closely related Learning Parity with Noise problem. Concerning polynomial system solving strategies, another notable illustration of this is the algebraic MinRank attack, which broke the rank-metric code-based schemes RQC and Rollo [4, 5] and now represents the state-of-the-art for MinRank cryptanalysis, beating combinatorial approaches.

In the Hamming metric, a reduction that transforms an instance of the syndrome decoding problem into a system of quadratic equations over $F_2$ was introduced in [34]. The most expensive step of the transformation, in terms of numbers of new variables and new equations introduced, is the so-called *Hamming-weight computation encoding*. Indeed, for a binary linear code of length $n$, the procedure dominates the overall complexity of the reduction with a complexity of $O(n \log_2(n)^2)$.

Despite the considerable theoretical interest in this transformation, the latter is too inefficient to be of practical interest in solving the syndrome decoding problem. Thus, the problem of improving the reduction in order to obtain a more effectively solvable system remains open. Moreover, [34] covers only the binary case, leaving unanswered the challenge of modeling through algebraic equations the decoding problem for codes defined over finite fields with more than two elements.

**Our contribution.** In this work, we improve on the reduction presented in [34] by a factor of $\log_2(n)$, thereby reducing the number of introduced variables and equations and achieving an overall reduction cost of $O(n \log_2(n))$. This improvement is achieved by leveraging the recursive structure of the equations generated by the Hamming-weight computation encoding and by transforming the equations similarly to the reduction procedure in Buchberger's algorithm [14] for Gröbner basis computation. When considering a version of the syndrome decoding problem that requires an error vector with a specified Hamming weight, we derive a further improved modeling, for which we study the degree of regularity.

As a second contribution, we present a novel approach that transforms an instance of the syndrome decoding problem over $F_q$ for $q \ge 2$ into a system of polynomial equations. This significantly broadens the applicability of our methods to a wider range of code-based cryptosystems. A common feature of our algebraic modelings is that if the decoding problem admits multiple solutions, the Gröbner basis naturally determines all of them.
We also provide theoretical and experimental data to analyze the complex-
ity of solving syndrome decoding instances using our modelings, demonstrating
that, at least for small parameters, our new strategy is practical and successful.
Software (MAGMA scripts) supporting this work can be found here.

*Structure of the paper.* The next section recalls the background and notions nec-
essary for this work. In Section 3, we review the reduction described in [34] from
the syndrome decoding problem to that of finding the zeroes of a set of polyno-
mials. In Section 4, we describe two modelings that improve upon [34]. We study
the degree of regularity of the modeling for the exact weight syndrome decoding
problem, along with experimental results, in Section 5. Finally, in Section 6, we
present a novel modeling of the syndrome decoding problem over $\mathbb{F}_q$ with $q \ge 2$,
for which we provide a theoretical study of the variety and experimental analysis
of the solving complexity with Gröbner bases techniques.

## 2 Preliminaries

This paper investigates the reduction of the Syndrome Decoding Problem (SDP) into a Polynomial System Solving Problem (PoSSo). In this section, we briefly recall the definitions of both problems, as well as the notions of solving degree and degree of regularity, which are commonly used to estimate the computational complexity of the PoSSo problem.

**2.1 The Syndrome Decoding Problem**

An $[n, k]$-linear code $\mathcal{C}$ is a $k$-dimensional subspace of $\mathbb{F}_q^n$. We call $n$ the length of the code, and $k$ its dimension. An element $\mathbf{x} \in \mathbb{F}_q^n$ is called a codeword if $\mathbf{x} \in \mathcal{C}$. The number of nonzero entries in $\mathbf{x}$ is called the Hamming weight of $\mathbf{x}$ and we denote it as $\mathrm{wt}(\mathbf{x})$. Given a code $\mathcal{C}$ we define a parity check matrix of $\mathcal{C}$ as $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ such that the right kernel of $\mathbf{H}$ is the code $\mathcal{C}$. The subspace spanned by the rows of $\mathbf{H}$ is called the dual code of $\mathcal{C}$. Many code-based cryptosystems rely on the hardness of solving the Syndrome Decoding Problem (SDP), see Problems 1 and 2 described below.

*Problem 1 (SDP: Syndrome Decoding Problem).* Given integers $n, k, t$ such that $k \le n$ and $t \le n$, an instance of the problem $\mathrm{SD}(\mathbf{H}, \mathbf{s}, t)$ consists of a parity check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ and a vector $\mathbf{s} \in \mathbb{F}_q^{n-k}$ (called the syndrome). A solution to the problem is a vector $\mathbf{e} \in \mathbb{F}_q^n$ such that $\mathbf{H}\mathbf{e}^{\top} = \mathbf{s}^{\top}$ and $\mathrm{wt}(\mathbf{e}) \le t$.

In later sections, we will also refer to Problem 1 as the “Bounded Syndrome Decoding” Problem. We will also consider the following variant of SDP.

*Problem 2 (ESDP: Exact Weight Syndrome Decoding Problem).* Given integers $n, k, t$ such that $k \le n$ and $t \le n$, an instance of the problem $\mathrm{ESD}(\mathbf{H}, \mathbf{s}, t)$ consists of a parity check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$ and a vector $\mathbf{s} \in \mathbb{F}_q^{n-k}$ (called the syndrome). A solution to the problem is a vector $\mathbf{e} \in \mathbb{F}_q^n$ such that $\mathbf{H}\mathbf{e}^{\top} = \mathbf{s}^{\top}$ and $\mathrm{wt}(\mathbf{e}) = t$.
Additionally, a close variant of the Syndrome Decoding Problem is the *Code-word Finding Problem*, where the syndrome **s** is the zero vector **0**. Since the null vector is always a solution of the parity-check equations $\mathbf{He}^\top = \mathbf{0}^\top$, a nonzero **e** of weight at most (or exactly) *t* is sought. The name of the problem refers to the fact that any element in the right kernel of **H** belongs to the code **C** having **H** as parity-check matrix. We will later need to distinguish this variant in the analysis of one of our modelings.

In addition to length and dimension, a fundamental notion in coding theory and consequently in code-based cryptography is the minimum distance *d* of an $\mathbb{F}_q$-linear code, i.e. the Hamming weight of the smallest nonzero codeword in the code. Such a quantity is strictly related to the number of solutions to the syndrome decoding problem.

Knowing the expected number of solutions from given parameters is extremely important in cryptography, in order to assess the security correctly. It is guaranteed that the problem does not admit more than one solution as long as the number of errors is upper bounded by $\frac{d-1}{2}$. However, in practice, much better can be done for randomly generated codes. Indeed, it turns out that random codes achieve the so-called Gilbert-Varshamov (GV) distance $d_{GV}$, defined as the largest integer such that

$$ \sum_{i=0}^{d_{GV}-1} \binom{n}{i} (q-1)^i \le q^{n-k}. $$

It can be shown that, as long as the number of errors is below the Gilbert-Varshamov distance, the Syndrome Decoding problem typically has a unique solution. Moreover, the instances where the number of errors attains the GV distance are those supposed to be the most difficult.

## 2.2 The Polynomial System Solving Problem

The Polynomial System Solving Problem (PoSSo) is the following. We define it over a finite field $\mathbb{F}_q$, although it can be more generally considered over any field.

*Problem 3 (PoSSo: Polynomial System Solving).* Given integers $N, r \ge 2$, an instance of the PoSSo problem consists of a system of polynomials $\mathcal{F} = \{f_1, \dots, f_r\}$ in $R = \mathbb{F}_q[x_1, \dots, x_N]$ with $N$ variables and coefficients in $\mathbb{F}_q$. A solution to the problem is a vector $\mathbf{a} \in \mathbb{F}_q^N$ such that $f_1(\mathbf{a}) = \dots = f_r(\mathbf{a}) = 0$.

*Remark 1.* A special case of PoSSo when $\deg(f_i) = 2$ for $1 \le i \le r$ is called MQ (Multivariate Quadratic) and is the basis for multivaritate cryptography.

The following outlines a standard strategy for finding the solutions of a polynomial system $\mathcal{F}$ by means of Gröbner bases.

1. Find a degree reverse lexicographic (degrevlex) Gröbner basis of the ideal $\langle \mathcal{F} \rangle$;
2. Convert the obtained degrevlex Gröbner basis into a lexicographic (lex) Gröbner basis, where the solutions of the system can be easily read from the ideal in this form.

The second step can be done by FGLM [25], or a similar algorithm, whose complexity depends on the degree of the ideal. This is usually faster than the first step, especially when the system $\mathcal{F}$ has few solutions. Therefore, we focus on the first step.

The fastest known algorithms to compute a degrevlex Gröbner basis are the linear algebra based algorithms such as F4 [26], F5 [27], or XL [20]. These transform the problem of computing a Gröbner basis into one or more instances of Gaussian elimination of the Macaulay matrices. The complexity of these algorithms is dominated by the Gaussian elimination on the largest Macaulay matrix encountered during the process. The size of a Macaulay matrix depends on the degrees of the input polynomials $f_1, \dots, f_r$, on the number of variables $N$, and on a degree $d$. In a nutshell, the Macaulay matrix $M_{\le d}$ of degree $d$ of $\mathcal{F}$ has columns indexed by the monic monomials of degree $\le d$, sorted in decreasing order from left to right (with respect to the chosen degrevlex term order). The rows of $M_{\le d}$ are indexed by the polynomials $m_{i,j}f_j$, where $m_{i,j}$ is a monic monomial such that $\deg(m_{i,j}f_j) \le d$. The entry $(i,j)$ of $M_{\le d}$ is the coefficient of the monomial of column $j$ in the polynomial corresponding to the $i$-th row.

The solving degree of $\mathcal{F}$ is defined as the least degree $d$ such that Gaussian elimination on the Macaulay matrix $M_{\le d}$ produces a degrevlex Gröbner basis of $\mathcal{F}$. We denote the solving degree of $\mathcal{F}$ by $d_{\text{sol}}(\mathcal{F})$. We have to compute Macaulay matrices up to degree $d_{\text{sol}} = d_{\text{sol}}(\mathcal{F})$, and the largest one we encounter has $a = \sum_{i=1}^{r} \binom{N+d_{\text{sol}}-d_i}{d_{\text{sol}}-d_i}$ many rows and $b = \binom{N+d_{\text{sol}}}{d_{\text{sol}}}$ many columns, where $d_i = \deg f_i$. Therefore, taking into account the complexity of Gaussian elimination of this matrix, an upper bound on the complexity of solving the system $\mathcal{F}$ with this method is

$$ \mathcal{O}\left(\binom{N+d_{\text{sol}}}{d_{\text{sol}}}^{\omega}\right), \qquad (1) $$

with $2 \le \omega \le 3$.

**Remark 2.** If $\mathcal{F}$ is not homogeneous, Gaussian elimination on $M_{\le d}$ may produce a row corresponding to a polynomial $f$ with $\deg f < d$, where the leading term of $f$ was not the leading term of any row in $M_{\le d}$. Some algorithms, for example F4, address this by adding rows for polynomials $mf$ ($\deg(mf) \le d$) for some monomial $m$ and recomputing the reduced row echelon form. If no Gröbner basis is found in degree $\le d$, they proceed to higher degrees, potentially enlarging the span of $M_{\le d}$ and reducing the solving degree. Throughout this paper, we consider only the case where no extra rows are added. Note that the solving degree as defined above is an upper bound on the degree at which algorithms using this variation terminate.

Since the solving degree of a polynomial system may be difficult to estimate, several invariants related to the solving degree (that are hopefully easier to compute) have been introduced. One of the most important is the degree of
regularity introduced by Bardet, Faugère, and Salvy [6]. We briefly recall its definition and connection with the solving degree.

Let $\langle \mathcal{F}^{\text{top}} \rangle = \langle f_1^{\text{top}}, \dots, f_r^{\text{top}} \rangle$ be the ideal of the polynomial ring $R$ generated by the homogeneous part of highest degree of the polynomial system $\mathcal{F}$. Assume that $\langle \mathcal{F}^{\text{top}} \rangle_d = R_d$ for $d \gg 0$. The degree of regularity of $\mathcal{F}$ is

$$d_{\text{reg}}(\mathcal{F}) = \min\{d \in \mathbb{N} \mid \langle \mathcal{F}^{\text{top}} \rangle_e = R_e \ \forall e \ge d\}.$$

The degree of regularity can be read off from the Hilbert series of $\langle \mathcal{F}^{\text{top}} \rangle$. Let $I$ be a homogeneous ideal of $R$, and let $A = R/I$. For an integer $d \ge 0$, we denote by $A_d$ the homogeneous component of degree $d$ of $A$. The function $\text{HF}_A(-) : \mathbb{N} \to \mathbb{N}$, $\text{HF}_A(d) = \dim_{\mathbb{F}_q} A_d$ is called Hilbert function of $A$. The generating series of $\text{HF}_A$ is called Hilbert series of $A$. We denote it by $\text{HS}_A(z) = \sum_{d \in \mathbb{N}} \text{HF}_A(d)z^d$.

**Remark 3.** Under the assumption that $\langle \mathcal{F}^{\text{top}} \rangle_d = R_d$ for $d \gg 0$, the Hilbert series of $A = R/\langle \mathcal{F}^{\text{top}} \rangle$ is a polynomial. Then, the degree of regularity of $\mathcal{F}$ is given by $d_{\text{reg}}(\mathcal{F}) = \deg \text{HS}_A(z) + 1$ (see [15, Theorem 12]).

Under suitable assumptions, the degree of regularity provides an upper bound for the solving degree [16, 36, 37]. Moreover, it is often assumed that the two values are close. Although this occurs in many relevant situations, there are examples where these two invariants can be arbitrarily far apart (see [11, 15, 22]). We will see in Section 5 that the degree of regularity of the system presented in Section 4.2 seems to yield a much higher value than the solving degree achieved during the Gröbner basis algorithm.

## 3 The MPS Modeling

This section is devoted to an overview of the algebraic modeling of the syndrome decoding problem proposed in [34] (referred to as the MPS modeling). We fix the following notation for this section.

**Notation 1** Let $n \ge 2$ and let $C \subseteq \mathbb{F}_2^n$ be a $[n, k, d]$-linear code having a parity check matrix $\mathbf{H} \in \mathbb{F}_2^{(n-k) \times n}$. We define $\ell = \lfloor \log_2(n) \rfloor + 1$. Let $\mathbf{s} \in \mathbb{F}_2^{n-k}$ play the role of the syndrome and let $0 \le t \le \lfloor (d-1)/2 \rfloor$ be the target error weight. Let $X = (x_1, \dots, x_n)$ and $Y = (Y_1, \dots, Y_n)$ with $Y_j = (y_{j,1}, \dots, y_{j,\ell})$ be two sets of variables and we consider the polynomial ring $\mathbb{F}_2[X, Y]$.

We define the following maps $\pi_i$ for $i = 1, \dots, n$,

$$\pi_i : \mathbb{F}_2^n \to \mathbb{F}_2^i \\ (v_1, \dots, v_n) \mapsto (v_1, \dots, v_i).$$

The construction of the proposed algebraic modeling consists of four steps and uses the variables contained in $X$ and $Y$ to express relations and dependencies. Each of these steps produces a set of polynomials in $\mathbb{F}_2[X, Y]$. An extra
step of the construction reduces the aforementioned polynomials to quadratic polynomials.

The idea is to construct an algebraic system having a variety containing elements $(\mathbf{x} | \mathbf{y}_1 | \cdots | \mathbf{y}_n) \in \mathbb{F}_2^{n(\ell+1)}$ whose first $n$ entries represent an element $\mathbf{x}$ of $\mathbb{F}_2^n$ such that $\mathbf{H}\mathbf{x}^{\top} = \mathbf{s}^{\top}$. The remaining $n\ell$ entries are considered to be the concatenation of $n$ elements $\mathbf{y}_i \in \mathbb{F}_2^{\ell}$ where the elements of $\mathbf{y}_i$ represent the binary expansion of $\mathrm{wt}(\pi_i(\mathbf{x}))$ for every $i = 1, \dots, n$, with $\pi_i(\mathbf{x}) = (x_1, \dots, x_i)$. By this definition, the list $\mathbf{y}_n$ represents the binary expansion of $\mathrm{wt}(\mathbf{x})$. The system finally enforces that $\mathbf{y}_n$ represents the binary expansion of an integer $t'$ such that $t' \le t$. The elements of the variety of solutions of this algebraic modeling are finally projected onto their first $n$ coordinates, revealing the solutions to the original syndrome decoding problem.

Here is a description of the four steps of reduction of the MPS modeling. We describe the set obtained in each step as a set of polynomials in $\mathbb{F}_2[X, Y]$.

- **Parity check encoding.** This step ensures that the solution of the algebraic system satisfies the parity check equations imposed by the parity check matrix $\mathbf{H}$ and the syndrome vector $\mathbf{s}$. Here, we compute the set of $n-k$ linear polynomials

$$ \left\{ \sum_{i=1}^{n} h_{i,j}x_i + s_j \mid j \in \{1, \dots, n-k\} \right\}. \qquad (2) $$

- **Hamming weight computation encoding.** This part of the modeling provides a set of polynomials that describes the binary encoding of $\mathrm{wt}(\pi_i(\mathbf{x}))$ for every $i = 1, \dots, n$ described above. The set of polynomials achieving this goal, is given by the union of the three following sets consisting of the $\ell + n - 1$ polynomials in the sets

$$ \begin{cases} f_{1,1} = x_1 + y_{1,1}, f_{1,2} = y_{1,2}, \dots, f_{1,\ell} = y_{1,\ell}, \\ f_{i,1} = x_i + y_{i,1} + y_{i-1,1} \mid i = 2, \dots, n \end{cases} \qquad (3) $$

and the $(n-1)(\ell-1)$ polynomials

$$ \left\{ f_{i,j} = \left( \prod_{h=1}^{j-1} y_{i-1,h} \right) x_i + y_{i,j} + y_{i-1,j} \mid i = 2, \dots, n, j = 2, \dots, \ell \right\}. \quad (4) $$

We labeled the polynomials of the sets in (3) and in (4) because the improvements in the next sections will mainly involve them.

- **Weight constraint encoding.** This part produces a set consisting of a single polynomial that enforces the constraint $\mathrm{wt}(\mathbf{x}) \le t$ by dealing with the variables in $Y_n$. Let $\mathbf{v} \in \mathbb{F}_2^{\ell}$ represent the binary expansion of $t$. Consider the $\ell$ polynomials in $\mathbb{F}_2[X, Y]$ defined as

$$ f_j = (y_{n,j} + v_j) \prod_{h=j+1}^{\ell} (y_{n,h} + v_h + 1) $$
for $j = 1, \dots, \ell$. The set is the singleton

$$ \left\{ \sum_{j=1}^{\ell} (v_j + 1) f_j \right\}. \qquad (5) $$

- Finite field equations. The set of $n + n\ell$ finite field polynomials of $\mathbb{F}_2[X, Y]$ is

$$ \{x_i^2 - x_i \mid i = 1, \dots, n\} \cup \{y_{i,j}^2 - y_{i,j} \mid i = 1, \dots, n, j = 1, \dots, \ell\}, \quad (6) $$

and ensures that the elements of the variety are restricted to elements of $\mathbb{F}_2^{n(\ell+1)}$.

The algebraic system corresponding to an instance of the syndrome decoding problem is then the union of the four sets described above. Clearly, this is not a quadratic system; thus the authors apply a linearization strategy that introduces a number of auxiliary variables used to label monomials of degree 2. This eventually results in a large quadratic system in many more than just $n(\ell + 1)$ variables. In fact, the final quadratic system ends up having equations and variables bounded by $O(n \log_2(n)^2)$.

# 4 Improving the MPS Modeling

In this section, we provide improvements of the MPS modeling that reduce the number of equations and variables in the final algebraic system. We keep the same notation as in Notation 1. First, we consider the case of the syndrome decoding problem, i.e. with a bounded weight error. We then consider the case of the exact weight syndrome decoding problem. We observe that one can avoid the linearization step as the resulting system is already quadratic.

## 4.1 Improved Modeling for the Case of SDP

We consider the degrevlex monomial ordering on $\mathbb{F}_2[X, Y]$ with the $X$ variables greater than the $Y$ variables, and denote by $\mathrm{lm}(p)$ the leading monomial of a polynomial $p$. Notice that since we are in the binary case, the notions of leading monomial and that of leading term coincide.

Denote by $F = \{f_{i,j} \mid i = 1, \dots, n, j = 1, \dots, \ell\} \subset \mathbb{F}_2[X, Y]$ the set of polynomials of cardinality $n\ell$ given by (3) and (4) for a code of length $n$. We aim at building a set $G = \{g_{i,j} \mid i = 1, \dots, n, j = 1, \dots, \ell\} \subset \mathbb{F}_2[X, Y]$ consisting of polynomials of degree at most 2 such that $\langle G \rangle = \langle F \rangle$. Denote with $F[i, j]$ the polynomial $f_{i,j}$, similarly for $G$. We first give a description of the set $G$ and then formally describe the new modeling.

Construct $G$ as follows:

- Put $G[1, 1] = x_1 + y_{1,1}$ and $G[1, h] = y_{1,h}$ for $h = 2, \dots, \ell$;

- Set $G[i, 1] = F[i, 1] = x_i + y_{i,1} + y_{i-1,1}$ for every $i = 2, \dots, n$;
– Compute

$$
\begin{align*}
G[i, j] &= F[i, j] + y_{i-1, j-1} F[i, j-1] \\
&= F[i, j] + \mathbf{lm}(F[i, j]) + y_{i-1, j-1}(y_{i, j-1} + y_{i-1, j-1}) \\
&= y_{i,j} + y_{i-1,j} + y_{i-1,j-1}^2 + y_{i,j-1}y_{i-1,j-1}.
\end{align*}
$$

for every $i = 2, \dots, n$ and $j = 2, \dots, \ell$, where equality holds because $\mathbf{lm}(F[i, j]) = y_{i-1, j-1} \mathbf{lm}(F[i, j-1])$.

Remark 4. The algebraic system we are going to construct contains the field polynomials $x_i^2 - x_i$ for each $i = 1, \dots, n$ and $y_{i,j}^2 - y_{i,j}$ for every $i = 1, \dots, n$ and $j = 1, \dots, \ell$. Therefore, in terms of generating elements of the ideal, any squared term in $G[i, j]$ can be reduced to a linear term.

The set $G \subset \mathbb{F}_2[X, Y]$ contains $n\ell$ polynomials of degree at most two. The following proposition proves that the set $G \subset \mathbb{F}_2[X, Y]$ computed as above and $F$ generate the same ideal of $\mathbb{F}_2[X, Y]$.

**Proposition 1.** We have $\langle G \rangle = \langle F \rangle$.

*Proof.* The inclusion $\langle G \rangle \subseteq \langle F \rangle$ is trivial. To prove the other inclusion, we show that we can write any element of the basis $F$ as an $\mathbb{F}_2[X, Y]$-linear combination of elements of the basis $G$. By construction, $G[1, j] = F[1, j]$ for every $j = 1, \dots, \ell$. For every $i = 2, \dots, n$ we prove $F[i, j] \in \langle G \rangle$ by induction on $j$. For $j = 1$ we have $F[i, 1] = G[i, 1]$.

Assume that $F[i, j] = \sum_{h=1}^{j} p_{i,j,h} G[i, h]$ with $p_{i,j,h} \in \mathbb{F}_2[X, Y]$. Then by construction we have

$$
\begin{align*}
F[i, j + 1] &= G[i, j + 1] - y_{i-1,j} F[i, j] \\
&= G[i, j + 1] - y_{i-1,j} \sum_{h=1}^{j} p_{i,j,h} G[i, h]
\end{align*}
$$

proving the claim.

□

We thus redefine the Hamming weight computation encoding as follows:

– Hamming weight computation encoding. Compute the following union of sub-
sets of $\mathbb{F}_2[X, Y]$:

$$
\begin{align*}
& \{x_1 + y_{1,1}, y_{1,2}, \dots, y_{1,\ell}\} \cup \{x_i + y_{i,1} + y_{i-1,1} \mid i = 2, \dots, n\} \\
\cup & \{y_{i,j-1}y_{i-1,j-1} + y_{i,j} + y_{i-1,j-1} + y_{i-1,j} \mid i = 2, \dots, n, j = 2, \dots, \ell\},
\end{align*}
$$
**Further improvement.** Set now $\ell_t = \lfloor \log_2(t) \rfloor + 1$. A further improvement to the MPS modeling (described in Equation (7)) follows by observing that in the non-trivial case where $t < n$, we can impose that the last $\ell - \ell_t$ entries of $y_i$ must be 0 for every $i = 1, \dots, n$. This means that we can add the linear equations $y_{i,j} = 0$ for every $i = 1, \dots, n$ and $j = \ell_t + 1, \dots, \ell$. By inspection, setting the aforementioned variables to 0 will make part of the equations of the Hamming weight computation encoding vanish. We can equivalently simply consider the equations that remain, and get rid of the variables which have been set to 0. Consider the following updated notation.

**Notation 2** Let $n \ge 2$ and let $C \subseteq \mathbb{F}_2^n$ be a $[n, k, d]$-linear code having a parity check matrix $\mathbf{H} \in \mathbb{F}_2^{(n-k) \times n}$. Let $\mathbf{s} \in \mathbb{F}_2^{n-k}$ play the role of the syndrome and let $0 \le t \le \lfloor (d-1)/2 \rfloor$ be the target error weight. We define $\ell_t = \lfloor \log_2(t) \rfloor + 1$. Let $X = (x_1, \dots, x_n)$ and $Y = (Y_1, \dots, Y_n)$ with $Y_j = (y_{j,1}, \dots, y_{j,\ell_t})$ be two sets of variables and consider the polynomial ring $\mathbb{F}_2[X, Y]$.

Under Notation 2, the effect of our improvement on the set of polynomials produced by the Hamming weight computation encoding is the following.

- Hamming weight computation encoding. Compute the following union of subsets of $\mathbb{F}_2[X, Y]$:

$$ \begin{aligned} & \{x_1 + y_{1,1}, y_{1,2}, \dots, y_{1,\ell_t}\} \cup \{x_i + y_{i,1} + y_{i-1,1} \mid i = 2, \dots, n\} \\ & \cup \{y_{i,j-1}y_{i-1,j-1} + y_{i,j} + y_{i-1,j-1} + y_{i-1,j} \mid i = 2, \dots, n, j = 2, \dots, \ell_t\} \cup \{y_{i,\ell_t}y_{i-1,\ell_t} + y_{i-1,\ell_t} \mid i = 2, \dots, n\}. \end{aligned} \tag{7} $$

The effect on the weight constraint encoding is simply the decrease in the degree from $\ell$ to $\ell_t$ of the produced polynomial. This is the only non-quadratic polynomial left in the modeling. We can turn this polynomial into a set of $O(t\ell_t)$ polynomials of degree up to 2 in $O(t\ell_t)$ variables with the same linearization techniques described in [34, Fact 1 and Lemma 11].

To summarize, our modeling is defined in the following way.

**Modeling 1 (Improved Modeling for the SDP over $\mathbb{F}_2$)** Given an instance $(\mathbf{H}, \mathbf{s}, t)$ of Problem 1 over $\mathbb{F}_2$, Modeling 1 is the union of the sets of polynomials (2), (5), (6) and (7).

The improved modeling is an algebraic system of $O(n(\ell_t + 2) - k + t\ell_t)$ polynomials of degree at most 2 in $O(n(\ell_t + 1) + t\ell_t)$ variables. Note that most applications of the SDP to code-based cryptography, for instance in the McEliece scheme, choose $t \ll n$, hence the asymptotic bounds on the number of polynomials and variables in the improved modeling are both $O(n\ell_t)$. As shown in Table 1, our modeling improves over MPS by a factor of $\log_2(n) \log_t(n)$.
<table><caption>**Table 1.** Comparison with the asymptotic size of the polynomial system in [34, Theorem 13], where *n* is the length of the code and *t* the bound on the weight of the target vector, that is $wt(e) \le t$.</caption><thead><tr><th></th><th># Polynomials</th><th># Variables</th></tr></thead><tbody><tr><td>[34]</td><td>O(n log<sub>2</sub>(n)<sup>2</sup>)</td><td>O(n log<sub>2</sub>(n)<sup>2</sup>)</td></tr><tr><td>Modeling 1</td><td>O(n log<sub>2</sub>(t))</td><td>O(n log<sub>2</sub>(t))</td></tr></tbody></table>

## 4.2 Improved Modeling for the Case of ESDP

It is possible to obtain an algebraic modeling for the ESDP by tweaking the modeling described in the previous section. In fact, it is enough to redefine the weight constraint encoding to enforce that $y_n$ represents the binary expansion of an integer $t'$ such that $t' = t$ exactly. To this end, let $v \in \mathbb{F}_2^t$ represent the binary expansion of an integer $t$. Under the same notation as in Notation 2, the following version of the weight constraint encoding describes the ESDP modeling with $wt(e) = t$.

— *Weight constraint encoding.* Compute the following set of linear polynomials:

$$ \{y_{n,j} + v_j \mid j = 1, \dots, \ell_t\}. \qquad (8) $$

Using these polynomials leads to Modeling

**Modeling 2 (Improved Modeling for the ESDP over $\mathbb{F}_2$) Given an instance $(\mathbf{H}, \mathbf{s}, t)$ of Problem 2 over $\mathbb{F}_2$, Modeling 2 is the union of the sets of polynomials (2), (6), (7) and (8).**

Observe that, replacing the original Hamming weight computation encoding with that in (7) and the weight constraint encoding with that in (8), we obtain an algebraic system of polynomials of degree at most 2 for ESDP. Hence, linearization is not needed, moreover, we can give the exact number of equations and variables of this system. We report these values in Table 2.

<table><caption>**Table 2.** Number of equations and variables of the algebraic modeling of ESDP with $wt(e) = t$. The value of $ℓ_t$ is $\lfloor \log_2(t) \rfloor + 1$.</caption><thead><tr><th></th><th># Polynomials</th><th># Variables</th></tr></thead><tbody><tr><td>Modeling 2</td><td>2nℓ<sub>t</sub> + 3n + ℓ<sub>t</sub> - k - 1</td><td>n(ℓ<sub>t</sub> + 1)</td></tr></tbody></table>

## 5 Complexity Analysis of Modeling 2

In this section, we investigate the complexity of solving the algebraic system for the ESDP given in Modeling 2 using standard Gröbner basis methods. An upper bound on the complexity is given by the formula (1) which depends on
both the number of variables and the solving degree. Typically, the solving degree of the system is estimated by assessing its degree of regularity. However, in our analysis, we experimentally show that the degree of regularity often significantly exceeds the solving degree for systems given in Section 4.2 (see the results in Table 3). This distinction is crucial in cryptography, where these concepts are frequently used interchangeably. Our findings underscore the importance of thoroughly verifying such claims to ensure accurate security assessments and parameter selection.

**Remark 5.** We point out that the study in [13] investigates a particular case of the problem that this paper deals with, that is the regular syndrome decoding problem. The regular syndrome decoding problem considers error vectors having a regular distribution of non-zero entries. The algebraic modeling proposed in [13] is conjectured to exhibit semi-regular behavior when the linear parity-check constraints and the fixed, structured quadratic polynomials are considered separately. This suggests that, to some extent, their model behaves like a random polynomial system. Despite the fact that the problem tackled in [13] is a particular case of the problem we consider, our modeling has not been devised as a generalization of their modeling. Furthermore, we show that for the more general case, our modeling yields different results.

For the rest of this section, we retain the notation defined in Notation 2. We consider the polynomial ring $\mathbb{F}_2[X, Y]$ with the degrevlex term order with the $X$ variables greater than the $Y$ variables. Let $S \subset \mathbb{F}_2[X, Y]$ be the set of polynomials of Modeling 2 as described in Section 4.2. Let $L$ and $Q$ denote the sets of linear and quadratic polynomials, respectively. Clearly $S = L \cup Q$. Write also $L = L_H \cup P$, where $L_H$ denotes the set of linear polynomials in (2) introduced with the parity check matrix $H$, and $P$ denotes the remaining linear polynomials in $S$. In other words, $P$ is the following set

$$P = \{x_1 + y_{1,1}, y_{1,2}, \dots, y_{1,\ell_t}\} \cup \{x_i + y_{i,1} + y_{i-1,1} \mid i = 2, \dots, n\} \\ \cup \{y_{n,j} + v_j \mid j = 1, \dots, \ell_t\}.$$

We want to estimate the degree of regularity of $S$. Since we do not know $L_H$ a priori, we consider the set $S \setminus L_H = Q \cup P$ and compute its degree of regularity. Indeed, we found that analyzing the degree of regularity or solving degree of the system with the linear equations (2) of $L_H$ included was too challenging and unpredictable, as it heavily depends on the specific instance of the parity check matrix $H$. For this reason, we chose to establish mathematical results for the system without $L_H$, with the aim of providing a clearer foundation. Notice that the degree of regularity of $S \setminus L_H = Q \cup P$ gives an upper bound to the degree of regularity of the whole system $S$ (see Remark 8).

We break down the problem by first computing the degree of regularity of $Q$ and then that of $Q \cup P$. We take advantage of the fact that the Hilbert series of $Q$ and of $Q \cup P$ are polynomials and compute their degree, i.e. for instance, $d_{\text{reg}}(Q) = \text{deg} \operatorname{HS}_{\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle}(z) + 1$ as per Remark 3, similarly for $Q \cup P$. To this end, we are going to compute the maximum degree of a monomial in $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$, similarly we do for $Q \cup P$.
**The quadratic polynomials.** We begin by studying the degree of regularity of the quadratic part $Q$ of the system $S$ of Modeling 2. The highest degree part of $Q$ has a very nice structure, as explained in the following remark.

**Remark 6.** The set $Q^{\text{top}}$ is the union of the following three sets

$$ \{x_i^2 \mid i = 1, \dots, n\}, \{y_{i,j}^2 \mid i = 1, \dots, n, j = 1, \dots, l_t\} $$

and

$$ \{y_{i-1,j}y_{i,j} \mid i = 2, \dots, n, j = 1, \dots, l_t\}. $$

The ideal $\langle Q^{\text{top}} \rangle \subseteq \mathbb{F}_2[X, Y]$ is thus a monomial ideal.

The following lemma gives the structure of the quotient ring $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$.

**Lemma 1.** The set $Q^{\text{top}}$ is a Gröbner basis of the ideal $\langle Q^{\text{top}} \rangle$.

*Proof.* As observed in Remark 6, $Q^{\text{top}}$ is a monomial ideal. Given any two elements of $m_1, m_2 \in Q^{\text{top}}$ it is clear that for $a = \text{lcm}(m_1, m_2)/m_1 \in \mathbb{F}_2[X, Y]$ and $b = \text{lcm}(m_1, m_2)/m_2 \in \mathbb{F}_2[X, Y]$ we have that $am_1 - bm_2 = 0$. $\square$

*Example 1.* Let $n = 4$ be the length of a code, then $l_t = 2$. A Gröbner basis of $\langle Q^{\text{top}} \rangle$ is the union of

$$ \{y_{1,1}y_{2,1}, y_{1,2}y_{2,2}, y_{2,1}y_{3,1}, y_{2,2}y_{3,2}, y_{3,1}y_{4,1}, y_{3,2}y_{4,2}\} $$

and

$$ \{x_1^2, x_2^2, x_3^2, x_4^2, y_{1,1}^2, y_{1,2}^2, y_{2,1}^2, y_{2,2}^2, y_{3,1}^2, y_{3,2}^2, y_{4,1}^2, y_{4,2}^2\}. $$

The following simple lemma is crucial for computing the degree of regularity of $Q$. For the sake of simplicity, we state it in terms of sets, and it ultimately provides a method to construct maximal monomials in the quotient ring $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$.

**Lemma 2.** Let $\mathcal{N} = \{1, 2, 3, \dots, n\}$ and $\mathcal{P} = \{{\{1, 2\}}, \{2, 3\}, \dots, \{n-1, n\}\}$, where $\mathcal{P}$ consists of consecutive pairs of elements from $\mathcal{N}$. Then:

- If $n$ is even, there are exactly two sets of maximal cardinality $S_1, S_2 \subseteq \mathcal{N}$ such that no set in $\mathcal{P}$ is a subset of $S$.

- If $n$ is odd, there is exactly one set of maximal cardinality $S \subseteq \mathcal{N}$ such that no set in $\mathcal{P}$ is a subset of $S$.

*Proof.* We aim to find the number of sets of maximal cardinality $S \subseteq \mathcal{N}$ such that no pair from $\mathcal{P}$ (i.e., no two consecutive elements) appears in $S$. In order to avoid pairs of consecutive elements, we can only select non-consecutive elements from $\mathcal{N}$. To maximize the size of $S$, we select every other element from $\mathcal{N}$. The size of such a set of maximal cardinality $S$ is: $\lceil \frac{n}{2} \rceil$. Thus:

- If $n$ is even, a set of maximal cardinality contains $\frac{n}{2}$ elements.

- If $n$ is odd, a set of maximal cardinality contains $\frac{n+1}{2}$ elements.
**Case 1: n is even.** Let $n = 2k$. The largest possible set $S$ will contain $k = \frac{n}{2}$ elements. There are exactly two ways to construct such a set:

1. Start with 1 and select every other element: $S_1 = \{1, 3, 5, \dots, n-1\}$. This set contains all the odd-numbered elements of $\mathcal{N}$, and its size is $k$.

2. Start with 2 and select every other element: $S_2 = \{2, 4, 6, \dots, n\}$. This set contains all the even-numbered elements of $\mathcal{N}$, and its size is also $k$.

Since there are no other ways to select $k$ elements without picking consecutive elements, these are the only two sets of maximal cardinality for $n$ even.

**Case 2: n is odd.** Let $n = 2k+1$. The largest possible set $S$ contains $k+1 = \frac{n+1}{2}$ elements. In this case, there is only one way to construct a set of size $k+1$ that avoids consecutive elements, i.e. start with 1 and select every other element: $S_1 = \{1, 3, 5, \dots, n\}$. This set contains $k+1$ elements and avoids consecutive pairs. If we were to start with 2 and select every other element, we would only get $k$ elements: $S_2 = \{2, 4, 6, \dots, n-1\}$. This is not maximal, as it contains fewer than $k+1$ elements. Thus, for $n$ odd, there is exactly one maximal set. $\square$

Lemma 2 can be used to prove the following corollary, which we will use to construct a maximal degree monomial in $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$. The idea behind the construction lies in the observation that a Gröbner basis of $Q^{\text{top}}$ can be written as the union of disjoint subsets $Q_{j,n}^{\text{top}}$ for $j = 1, \dots, l_t$, see Theorem 1, which we describe in the next corollary. Also, the next corollary computes a maximal degree monomial with respect to $Q_{j,n}^{\text{top}}$ for every $j = 1, \dots, l_t$. Given these monomials, computing a maximal degree monomial in $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \cup P^{\text{top}} \rangle$, or equivalently, the degree of its Hilbert series, becomes feasible with a slight modification of the subsets due to the presence of linear polynomials in $P^{\text{top}}$.

**Corollary 1.** Let $n \in \mathbb{N}$ with $n \ge 2$, and define

$$Q_{j,n}^{\text{top}} := \{y_{1,j}y_{2,j}, y_{2,j}y_{3,j}, \dots, y_{n-1,j}y_{n,j}\} \cup \{y_{i,j}^2 \mid i = 1, \dots, n\} \subset \mathbb{F}_2[y_{1,j}, \dots, y_{n,j}],$$
for some $j \in \mathbb{N}$. If $n$ is even then there exists two monomials of maximal degree $\lceil \frac{n}{2} \rceil$ in $\mathbb{F}_2[y_{1,j}, \dots, y_{n,j}]/\langle Q_{j,n}^{\text{top}} \rangle$, namely

$$m_1 = \prod_{\substack{i=1,\dots,n-1, \\ i \text{ odd}}} y_{i,j} \quad \text{and} \quad m_2 = \prod_{\substack{i=2,\dots,n, \\ i \text{ even}}} y_{i,j}.$$

If $n$ is odd, then there exists a unique monomial of maximal degree $\lceil \frac{n}{2} \rceil$ in $\mathbb{F}_2[y_{1,j}, \dots, y_{n,j}]/\langle Q_{j,n}^{\text{top}} \rangle$, namely

$$m = \prod_{\substack{i=1,\dots,n, \\ i \text{ odd}}} y_{i,j}.$$

We are ready to prove the following theorem, which provides the degree of regularity of $Q$.
**Theorem 1.**

$$d_{\text{reg}}(Q) = \begin{cases} n + \ell_t n/2 + 1 & \text{if } n \equiv 0 \bmod 2 \\ n + \ell_t (n+1)/2 + 1 & \text{if } n \equiv 1 \bmod 2 \end{cases}.$$

Equivalently,

$$d_{\text{reg}}(Q) = n + \ell_t \lfloor n/2 \rfloor + 1.$$

*Proof.* Let $Q_{j,n}^{\text{top}} \subset \mathbb{F}_2[y_{1,j}, \dots, y_{n,j}]$ as in Corollary 1, for every $j = 1, \dots, \ell_t$. Observe that

$$Q^{\text{top}} = \bigcup_{j=1}^{\ell_t} Q_{j,n}^{\text{top}} \cup \{x_i^2 \mid i = 1, \dots, n\}. \qquad (9)$$

Corollary 1 computes a monomial $m_j \in \mathbb{F}_2[y_{1,j}, \dots, y_{n,j}]$ of maximal degree $\lceil n/2 \rceil$ such that $m_j \notin \langle Q_h^{\text{top}} \rangle$ for every $j = 1, \dots, \ell_t$ and every $h = 1, \dots, \ell_t$. This implies that $m_j \notin \langle Q^{\text{top}} \rangle$ for every $j$. It is now clear that the monomial

$$m := \prod_{i=1}^{n} x_i \prod_{j=1}^{\ell_t} m_j \in \mathbb{F}_2[X, Y]$$

is such that $m \notin \langle Q^{\text{top}} \rangle$. Note that the set $\{x_i^2 \mid i = 1, \dots, n\}$ in (9) enforces that $m$ must be squarefree in the variables $x_1, \dots, x_n$. By the maximality of each $m_j$ and that of $\prod_{i=1}^n x_i$, any multiple of $m$ by a non-constant term would trivially be in $\langle Q^{\text{top}} \rangle$. Since

$$d := \deg m = n + \ell_t \lfloor n/2 \rfloor,$$

we have that the $(d+1)$-th coefficient of the Hilbert series of $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$ is 0. The result on the degree of regularity $d_{\text{reg}}(Q)$ follows. $\square$

*Example 2.* Let $n = 8$ and $\ell_t = 3$. According to Theorem 1 the degree of regularity of $Q$ is 21. Using MAGMA, we compute and report the Hilbert series of the quotient ring $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle$, i.e.

$$\begin{aligned} \mathrm{HS}_{\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle}(z) = & 125z^{20} + 2500z^{19} + 23075z^{18} + 130800z^{17} + \\ & 511140z^{16} + 1465020z^{15} + 3198081z^{14} + \\ & 5448312z^{13} + 7360635z^{12} + 7966528z^{11} + \\ & 6946904z^{10} + 4889800z^9 + 2773415z^8 + \\ & 1260580z^7 + 454625z^6 + 128080z^5 + 27524z^4 + \\ & 4348z^3 + 475z^2 + 32z + 1, \end{aligned}$$

thus $d_{\text{reg}}(Q) = \deg \mathrm{HS}_{\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \rangle} + 1 = 21$, matching our results.
**The linear polynomials.** In this section, we study how the degree of regularity computed in Theorem 1 changes when we add to the quadratic equations $Q$ also the fixed linear equations of $P$, which do not depend on the specific instance of the problem. Specifically, we compute the degree of regularity of $Q \cup P$. For this, we need to consider the ideal $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle$. Note that this ideal contains $\langle Q^{\text{top}} \rangle$, which means that the variety of the former is a subset of the variety of the latter. In particular, the ideal $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle$ is also zero-dimensional, so its degree of regularity is well-defined. We will use similar arguments to those applied to $\langle Q^{\text{top}} \rangle$ to study it.

**Remark 7.** The set $Q^{\text{top}} \cup P^{\text{top}}$ is the union of the following sets

$$ \{x_i^2 \mid i = 1, \dots, n\}, \{x_i \mid i = 1, \dots, n\}, \{y_{i,j}^2 \mid i = 1, \dots, n, j = 1, \dots, \ell_t\}, \\ \{y_{1,j} \mid j = 2, \dots, \ell_t\}, \{y_{n,j} \mid j = 1, \dots, \ell_t\} $$

and

$$ \{y_{i-1,j}y_{i,j} \mid i = 2, \dots, n, j = 1, \dots, \ell_t\}. $$

and the ideal $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle \subseteq \mathbb{F}_2[X, Y]$ is thus a monomial ideal.

Next lemma provides a Gröbner basis of the ideal $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle \subseteq \mathbb{F}_2[X, Y]$.

**Lemma 3.** A Gröbner basis $G$ for $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle \subseteq \mathbb{F}_2[X, Y]$ is

$$ G = \{x_i \mid i = 1, \dots, n\} \cup \{y_{i-1,j}y_{i,j} \mid i = 3, \dots, n-1, j = 1, \dots, \ell_t\} \cup \\ \{y_{1,1}y_{2,1}\} \cup \{y_{1,j} \mid j = 2, \dots, \ell_t\} \cup \{y_{n,j} \mid j = 1, \dots, \ell_t\} \cup \\ \{y_{i,j}^2 \mid i = 2, \dots, n-1, j = 1, \dots, \ell_t\} \cup \{y_{1,1}^2\}. $$

*Proof.* The proof of this statements follows directly from inspecting Remark 7 and the same observations as in proof of Lemma 1. $\square$

The next theorem gives the exact value of the degree of regularity of the system $Q \cup P$. The proof uses similar arguments to those used for the proof of Theorem 1.

**Theorem 2.** The degree of regularity of $Q \cup P$ is

$$ d_{\text{reg}}(Q \cup P) = \left\lfloor \frac{n-1}{2} \right\rfloor + (\ell_t - 1) \left\lfloor \frac{n-2}{2} \right\rfloor + 1. $$

*Proof.* Define the set

$$ \tilde{Q}_{j,n}^{\text{top}} := Q_{j,n-1}^{\text{top}} \setminus \{y_{1,j}y_{2,j}\} \subset \mathbb{F}_2[y_{2,j}, \dots, y_{n-1,j}], $$

for every $j = 1, \dots, \ell_t$. Let $G$ be a Gröbner basis of $\langle Q^{\text{top}} \cup P^{\text{top}} \rangle$ as in Lemma 3. Due to the presence of the linear monomials contributed by $P^{\text{top}}$, we observe

$$ G = Q_{1,n-1}^{\text{top}} \cup \bigcup_{j=2}^{\ell_t} \tilde{Q}_{j,n-1}^{\text{top}} \cup \{x_i^2 \mid i = 1, \dots, n\}. \quad (10) $$
Applying Corollary 1, we can get a monomial $m_1 \in \mathbb{F}_2[y_{1,1}, \dots, y_{n-1,1}]$ of maximal degree $\deg m_1 = \lceil(n-1)/2\rceil$ such that $m_1 \notin \mathbb{F}_2[y_{1,1}, \dots, y_{n-1,1}]/\langle Q_{1,n-1}^{\text{top}} \rangle$. We can obtain other $\ell_t - 1$ monomials $m_j$ of maximal degree $d = \lceil(n-2)/2\rceil$, such that $m_j \notin \langle \tilde{Q}_{h,n-1}^{\text{top}} \rangle$ for every $h = 1, \dots, \ell_t$ and every $j = 2, \dots, \ell_t$. Let now

$$m := \prod_{j=1}^{\ell_t} m_j \in \mathbb{F}_2[X, Y]/\langle G \rangle$$

then

$$d := \deg m = \left\lceil \frac{n-1}{2} \right\rceil + (\ell_t - 1) \left\lceil \frac{n-2}{2} \right\rceil,$$

meaning that the $(d+1)$-th coefficient of the Hilbert series of $\mathbb{F}_2[X, Y]/\langle G \rangle$ is 0. The result on the degree of regularity $d_{\text{reg}}(Q \cup P)$ follows. $\square$

*Example 3.* Let $n = 8$ and $\ell_t = 3$. According to Theorem 2 the degree of regularity of $Q \cup P$ is 11. Using MAGMA, we compute and report the Hilbert series of the quotient ring $\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \cup P^{\text{top}} \rangle$, i.e.

$$\mathrm{HS}_{\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \cup P^{\text{top}} \rangle}(z) = 16z^{10} + 240z^9 + 1188z^8 + 2920z^7 + 4132z^6 + 3608z^5 + 2005z^4 + 710z^3 + 155z^2 + 19z + 1,$$

thus $d_{\text{reg}}(Q \cup P) = \deg \mathrm{HS}_{\mathbb{F}_2[X, Y]/\langle Q^{\text{top}} \cup P^{\text{top}} \rangle} + 1 = 11$, matching our results.

*Remark 8.* Since Theorem 2 considers the set $Q^{\text{top}} \cup P^{\text{top}} = S^{\text{top}} \setminus L_{\mathbf{H}}^{\text{top}}$, it only gives an upper bound to the degree of regularity of $S$, that is

$$d_{\text{reg}}(S) \le \left\lceil \frac{n-1}{2} \right\rceil + (\ell_t - 1) \left\lceil \frac{n-2}{2} \right\rceil + 1.$$

In the next section, we provide some experimental data showing the gap between the value computed in Theorem 2 and that of the actual solving degree.

## 5.1 Experimental results

We performed several experiments for Modeling 2 taking as input both random and Goppa codes, and we obtained a solving degree which is much smaller than the upper bound for the degree of regularity computed in Theorem 2. This results in a much lower complexity estimate. We provide a selection of our experiments in Table 3. The MAGMA code used for our experiments can be found here.
<table><caption>**Table 3.** This table shows experimental results for $\mathbb{F}_2$-linear codes using Modeling 2 for the ESDP. The number of equations is given in the format (#linear equations, #quadratic equations). The values in the $d_M$ column represent the smallest degree D such that MAGMA function GroebnerBasis(F,D) gives the Gröbner basis, i.e. highest step degree achieved when directly computing the Gröbner basis of the system in MAGMA, but ignoring the unnecessary steps in high degree that MAGMA F4 algorithm may do to insure termination. The SR $d_{reg}$ column gives the degree of regularity of a semi-regular system of equations with the associated number of linear equations, quadratic equations, and variables, using [3, Corollary 3.3.8]. The values in $d_{reg}$ column are upper bounds for the degree of regularity of the system as provided by Theorem 2 and Remark 8. Random codes with “*” are decoding challenges from https://decodingchallenge.org/syndrome, with a number of errors slightly above Gilbert-Varshamov distance. The other random code instances are below GV distance instead. Instances with “Goppa” Code Type are random full-length binary Goppa codes with a number of errors equal to the Goppa polynomial degree. The Prange and Modeling 2 columns state the $\log_2$ of the complexities of the Prange algorithm (Esser-Bellini estimator [24]) and Gröbner basis computations (1) with $d_M$, respectively.</caption><thead><tr><th>n</th><th>k</th><th>t</th><th>Code Type</th><th># Eqs</th><th># Vars</th><th>d<sub>reg</sub></th><th>SR d<sub>reg</sub></th><th>d<sub>M</sub></th><th>Prange</th><th>Modeling 2</th></tr></thead><tbody><tr><td>8</td><td>2</td><td>2</td><td>Goppa</td><td>(17,38)</td><td>24</td><td>&le; 8</td><td>3</td><td>2</td><td>9</td><td>23</td></tr><tr><td>10</td><td>5</td><td>4</td><td>Random*</td><td>(20,67)</td><td>40</td><td>&le; 14</td><td>5</td><td>3</td><td>10</td><td>38</td></tr><tr><td>16</td><td>8</td><td>2</td><td>Goppa</td><td>(27,78)</td><td>48</td><td>&le; 16</td><td>5</td><td>3</td><td>12</td><td>40</td></tr><tr><td>20</td><td>10</td><td>5</td><td>Random*</td><td>(35,137)</td><td>80</td><td>&le; 29</td><td>7</td><td>3</td><td>12</td><td>46</td></tr><tr><td>30</td><td>15</td><td>7</td><td>Random*</td><td>(50,207)</td><td>120</td><td>&le; 44</td><td>10</td><td>4</td><td>15</td><td>65</td></tr><tr><td>32</td><td>12</td><td>4</td><td>Goppa</td><td>(57,221)</td><td>128</td><td>&le; 47</td><td>10</td><td>3</td><td>16</td><td>52</td></tr><tr><td>32</td><td>17</td><td>3</td><td>Goppa</td><td>(50,158)</td><td>96</td><td>&le; 32</td><td>5</td><td>4</td><td>16</td><td>61</td></tr><tr><td>32</td><td>22</td><td>2</td><td>Goppa</td><td>(45,158)</td><td>96</td><td>&le; 32</td><td>7</td><td>3</td><td>15</td><td>48</td></tr><tr><td>40</td><td>20</td><td>8</td><td>Random*</td><td>(67,356)</td><td>160</td><td>&le; 78</td><td>16</td><td>5</td><td>17</td><td>88</td></tr><tr><td>50</td><td>30</td><td>5</td><td>Random</td><td>(75,347)</td><td>200</td><td>&le; 74</td><td>15</td><td>4</td><td>20</td><td>73</td></tr><tr><td>50</td><td>40</td><td>4</td><td>Random</td><td>(65,347)</td><td>200</td><td>&le; 74</td><td>17</td><td>4</td><td>14</td><td>73</td></tr><tr><td>64</td><td>52</td><td>2</td><td>Goppa</td><td>(79,318)</td><td>192</td><td>&le; 64</td><td>14</td><td>4</td><td>18</td><td>72</td></tr><tr><td>64</td><td>40</td><td>4</td><td>Goppa</td><td>(93,445)</td><td>256</td><td>&le; 95</td><td>19</td><td>4</td><td>21</td><td>77</td></tr><tr><td>64</td><td>16</td><td>8</td><td>Goppa</td><td>(119,572)</td><td>320</td><td>&le; 126</td><td>21</td><td>4</td><td>19</td><td>81</td></tr></tbody></table>

**Comparison with combinatorial attacks.** We also compare the complexity of solving ESDP using Gröbner basis techniques with the more traditional combinatorial attack proposed by Prange. The latter is widely regarded as a reference algorithm for decoding linear codes in the Hamming metric, and forms the basis of many state-of-the-art attacks on code-based cryptosystems.

However, Gröbner basis computations are known to be computationally expensive, particularly as the number of variables and the degree of the polynomials grow. In contrast, combinatorial methods like Prange exploit structured randomization and search to solve the problem more efficiently, albeit with large memory requirements.

In Table 3, the complexity of the Prange algorithm has been computed using the Esser-Bellini cryptographic estimator [24], see also this link. On the
other hand, the complexity of solving the polynomial system of Modeling 2 with Gröbner bases methods has been computed using formula (1) with $N = n(|\log_2(t)|+2)$, the highest step degree $d_M$ achieved in the MAGMA experiments as a proxy for the solving degree $d_{sol}$ and the conservative matrix multiplication constant $\omega = 2.807$.

These results confirm that direct combinatorial attacks like Prange outperform algebraic methods when solving the syndrome decoding problem, particularly for parameters of practical interest in code-based cryptography. Despite this, algebraic approaches remain valuable from a theoretical perspective and may offer insights into alternative solution strategies that could be leveraged in other contexts. We include this comparison to emphasize that the purpose of our Gröbner basis approach is not to compete with combinatorial attacks in efficiency, but rather to provide an alternative algebraic perspective on the syndrome decoding problem. Such perspectives can contribute to understanding the hardness of related problems in post-quantum cryptography.

# 6 Modelings over $\mathbb{F}_q$

Each of the modelings we have discussed thus far (MPS, Modeling 1, and Modeling 2) are limited to the binary case. To the best of our knowledge, there is no modeling of the general syndrome decoding problem over $\mathbb{F}_q$ for $q > 2$ in the literature. In this section, we adapt the previous modelings to a generic finite field $\mathbb{F}_q$, for some prime power $q \ge 2$, and explain how to efficiently (i.e. in polynomial time) obtain a polynomial system encoding an instance of the Syndrome Decoding Problem.

We will adopt the following notation throughout this section.

**Notation 3** Let $n \ge 2$ and let $C \subseteq \mathbb{F}_q^n$ be a $[n, k, d]$-linear code having a parity check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k)\times n}$. The vector $\mathbf{s} \in \mathbb{F}_q^{n-k}$ denotes the syndrome and $0 \le t \le [(d-1)/2]$ is the target error weight. Let $r_1, r_2 > 0$ be two integers. We will work over the polynomial ring $\mathbb{F}_{q^{r_1}}[X, Y, Z]$, where $X = (x_1, \dots, x_n)$, $Y = (Y_1, \dots, Y_n)$, $Y_j = (y_{j,1}, \dots, y_{j,r_2})$, and $Z = (z_1, \dots, z_n)$ are variables.

As in the previous sections, $\mathbf{x} = (x_1, \dots, x_n)$ is the vector of variables corresponding to the solution of the syndrome decoding problem. On the other hand, the role of the integers $r_1, r_2$ and of the variables $Y$ and $Z$ will be illustrated later.

We separately describe and explain the sets of polynomials that, together, model Problems 1 and 2. Then we provide an analysis of the correctness of our modelings.

## 6.1 Construction of the Equations

Identifying the support of a vector of $\mathbb{F}_q^n$. Unlike the Boolean case, the value of an element in the support of $\mathbf{x}$ is not uniquely determined when $q \ge 3$.
In order to count the number of nonzero coordinates with algebraic equations, we first need to map all nonzero elements to a unique element of $\mathbb{F}_q^*$, say 1. Thus, in addition to the $Y$'s variables encoding the partial Hamming weights, we introduce here another length-$n$ vector of variables $Z = (z_1, \dots, z_n)$, each of which can only assume two values, 0 or 1, depending on whether the corresponding $X$ coordinate is nonzero. First, we tackle the problem of describing the relation between $X$ and $Z$ through algebraic equations. We distinguish two cases, depending on the target version of the problem, and then prove the sets of polynomials correctly describe our target.

- Support constraint encoding for Problem 1. Compute the following set of $2n$ quadratic polynomials

$$ \{x_j(z_j - 1) \mid j = 1, \dots, n\} \cup \{z_j^2 - z_j \mid j = 1, \dots, n\}. \quad (11) $$

- Support constraint encoding for Problem 2. Compute the following set of $n$ polynomials of degree $q-1$

$$ \{z_j - x_j^{q-1} \mid j = 1, \dots, n\}. \quad (12) $$

In the first case, the condition $z_j = 1$ if $x_j \neq 0$ is given from the first set of polynomials. Otherwise, the second set implies $z_j \in \{0, 1\}$. Therefore, the support of $(z_1, \dots, z_n)$ contains the support of $(x_1, \dots, x_n)$ and thus $\text{wt}((z_1, \dots, z_n)) \ge \text{wt}((x_1, \dots, x_n))$. In the second case, in order for the corresponding equations to be satisfied, $z_j = 1$ if and only if $x_j \neq 0$, and $z_j = 0$ otherwise. Hence $\text{wt}((z_1, \dots, z_n)) = \text{wt}((x_1, \dots, x_n))$.

From a computational point of view, the support constraint encoding for Problem 2 has a strong limitation, that is the high degree of the polynomials. A Gröbner basis computation would need to reach at least degree $q-1$ before taking into account such polynomials, leading to infeasible calculations unless $q$ is very small. This is reminiscent of the problem of including field equations in modelings over large fields. Yet, this issue does not appear in the support constraint encoding for Problem 1: the polynomials have constant degree 2 regardless of the field size $q$, making a modeling for Problem 1 more realistic and valuable for effective computations.

**Hamming weight computation encoding.** A difficulty arising from a direct generalization to large fields of the previous approach is the update of the weight registers, i.e. of the vectors $y_i$'s. In order to overcome this limitation, we introduce a different strategy for encoding the partial weights. More precisely, we substitute their binary expansion with vectors from a linear recurring sequence over an extension of $\mathbb{F}_q$. As we will see, this approach naturally allows for the choice of different trade-offs between the number of variables and finite field size.

We first recall some known results about (univariate) polynomials over finite fields, companion matrices, and linear recurring sequences. We mainly refer to [29] for this part.
**Definition 1 (Companion matrix, Chapter 2, §5 [29]).** Let $f(x) = x^d + f_{d-1}x^{d-1} + \cdots + f_0 \in \mathbb{F}_q[x]$ be a monic polynomial. Its companion matrix is

$$ C_f = \begin{bmatrix} 0 & 0 & \cdots & 0 & -f_0 \\ 1 & 0 & \cdots & 0 & -f_1 \\ 0 & 1 & \cdots & 0 & -f_2 \\ \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 & 0 & \cdots & 1 & -f_{d-1} \end{bmatrix}. \qquad (13) $$

It is well known that the equation $f(C_f) = 0$ is satisfied, hence, if $f$ is a monic irreducible polynomial over $\mathbb{F}_q$, then its companion matrix $C_f$ plays the role of a root of $f$. It follows that the elements of the extension field $\mathbb{F}_{q^d}$ can be written, according to this representation, as polynomials in $C_f$ of degree strictly less than $d$.

We also recall that the order of a non-constant polynomial $f$ with $f_0 \neq 0$ is the least positive integer $e$ such that $f(x) \mid x^e - 1$. A polynomial in $\mathbb{F}_q[x]$ of degree $d$ is said primitive if it is monic, $f(0) \neq 0$, and $\mathrm{ord}(f) = q^d - 1$. Such polynomials can be found from the factorization of $x^{q^d-1} - 1$.

The theory of linear recurring sequences says that the sequence of vectors $\mathbf{y}_0, C_f \mathbf{y}_0, C_f^2 \mathbf{y}_0, \dots$, for some nonzero $\mathbf{y}_0$ and companion matrix with $f_0 \neq 0$, is periodic with least period equal to the order of $f$, when the latter is irreducible (cf. [29, Theorem 6.28]). Therefore, by choosing $f$ primitive, we obtain a sequence of vectors $\mathbf{y}_0, C_f \mathbf{y}_0, C_f^2 \mathbf{y}_0, \dots$ of maximal order $q^d - 1$. On the other hand, the choice of $\mathbf{y}_0$ does not seem to affect any property of our modeling. Without loss of generality, from now on we fix the initial state vector

$$ \mathbf{y}_0 = (1 \ 0 \ \cdots \ 0)^{\top}. \qquad (14) $$

By tuning the values $r_1$ and $r_2$ we can choose the number of variables used for the Hamming weight computation encoding, at the cost of working over more or less large field extensions. More precisely, take

$$ m := \min\{i \in \mathbb{N} \mid q^i > \max(t, n-t) + 1\}, $$

and let $r_1, r_2$ be two positive integers such that $m \le r_1 r_2$. Then, let $f \in \mathbb{F}_{q^{r_1}}[x]$ be a primitive polynomial of degree $r_2$ and $C_f \in \mathbb{F}_{q^{r_2 \times r_1}}$ its companion matrix. For convenience sake, we will use the column vector notation for the $Y_j$'s blocks of variables, i.e.

$$ Y_j = (y_{j,1} \cdots y_{j,r_2})^{\top}. $$

The polynomial encoding the partial Hamming weight is the following.

- Hamming weight computation encoding. Compute the $nr_2$ affine bilinear (in $Y$ and $Z$) polynomials from the expansion of

$$ Y_1 - (1 - z_1) \cdot \mathbf{y}_0 - z_1 \cdot C_f \cdot \mathbf{y}_0 \qquad (15) $$

and

$$ \{Y_j - (1 - z_j) \cdot Y_{j-1} - z_j \cdot C_f \cdot Y_{j-1}, \quad \text{for } j \in \{2, \dots, n\}. \qquad (16) $$
**Remark 9.** Using this approach, $r_1$ determines the finite field over which we define the resulting polynomial system (and thus the Multivariate Quadratic Problem instance), while $r_2$ determines the number of variables required for the weight computation encoding (which is strictly linked to the computational complexity). Observe that, together, equations (15) and (16) correspond to $nr_2$ polynomial equations over $\mathbb{F}_{q^{r_1}}$ in $nr_2 + n$ variables. In several cases, working with a small amount of variables (namely, $r_1$ large and $r_2$ small) is preferable, but there are some instances in which working over small finite fields with a large number of variables (i.e. $r_1$ small and $r_2$ large) is advantageous.

The next result shows that the Hamming weight of $\mathbf{z}$ is correctly computed.

**Proposition 2.** Consider the system given by (15) and (16) over $\mathbb{F}_{q^{r_1}}[Y, Z]$. Any solution $(\mathbf{y}, \mathbf{z}) = (\mathbf{y}_1, \dots, \mathbf{y}_n, \mathbf{z}) \in \mathbb{F}_{q^{r_1}}^{r_2 n} \times \{0, 1\}^n$ of the system satisfies

$$ \mathbf{y}_j = \mathbf{C}_f^{\mathrm{wt}(\pi_j(\mathbf{z}))} \mathbf{y}_0. $$

In particular, $\mathbf{y}_n = \mathbf{C}_f^{\mathrm{wt}(\mathbf{z})} \mathbf{y}_0$.

*Proof.* It follows directly from the hypotheses by an inductive argument. The first step is considering $\mathbf{y}_1 := (y_{1,1}, \dots, y_{1,r_2})^\top$, which by definition is

$$ \mathbf{y}_1 = (1 - z_1)\mathbf{y}_0 + z_1 \mathbf{C}_f \mathbf{y}_0 = \begin{cases} \mathbf{y}_0 & \text{if } z_1 = 0 \\ \mathbf{C}_f \mathbf{y}_0 & \text{if } z_1 \neq 0 \end{cases}, $$

namely, $\mathbf{y}_1 = \mathbf{C}_f^{\mathrm{wt}(z_1)} \mathbf{y}_0 = \mathbf{C}_f^{\mathrm{wt}(\pi_1(\mathbf{z}))} \mathbf{y}_0$.

For the inductive step, we consider $\mathbf{y}_{j-1} := (y_{j-1,1}, \dots, y_{j-1,r_2})^\top$ to be equal to $\mathbf{C}_f^{\mathrm{wt}(\pi_{j-1}(\mathbf{z}))} \mathbf{y}_0$, and we look at the definition of $\mathbf{y}_j$. We have

$$ \mathbf{y}_j = (1 - z_j)\mathbf{y}_{j-1} + z_j \mathbf{C}_f \mathbf{y}_{j-1} = \begin{cases} \mathbf{y}_{j-1} & \text{if } z_j = 0 \\ \mathbf{C}_f \mathbf{y}_{j-1} & \text{if } z_j \neq 0 \end{cases}, $$

and either way, we obtain

$$ \mathbf{y}_j = \mathbf{C}_f^{z_j} \cdot \mathbf{y}_{j-1} = \mathbf{C}_f^{z_j} \mathbf{C}_f^{\mathrm{wt}(\pi_{j-1}(\mathbf{z}))} \mathbf{y}_0 = \mathbf{C}_f^{\mathrm{wt}(z_j) + \mathrm{wt}(\pi_{j-1}(\mathbf{z}))} \mathbf{y}_0 = \mathbf{C}_f^{\mathrm{wt}(\pi_j(\mathbf{z}))} \mathbf{y}_0. $$

□

**Weight constraint encoding.** As for the previous modelings, the weight constraint encoding simply ensures that the representation of the last partial Hamming weight coincides with the representation of the total Hamming weight.

- *Weight constraint encoding.* Compute the $r_2$ affine linear polynomials in $Y$ from the expansion of

$$ \mathbf{y}_n - \mathbf{C}_f^t \mathbf{y}_0. \qquad (17) $$

**Corollary 2.** Consider the system given by (15), (16) and (17) over $\mathbb{F}_{q^{r_1}}[Y, Z]$ and let $z_1, \dots, z_n$ be either 0 or 1. Then
1. The number of solutions $(\mathbf{y}, \mathbf{z}) \in \mathbb{F}_{q^{r_1}}^{r_2 n} \times \{0, 1\}^n$ of the system is equal to the number of binary vectors of Hamming weight equal to $t$, i.e. $\binom{n}{t}$;

2. If $(\bar{\mathbf{y}}, \bar{\mathbf{z}})$ and $(\tilde{\mathbf{y}}, \tilde{\mathbf{z}})$ are two distinct solutions, then $\bar{\mathbf{z}} \neq \tilde{\mathbf{z}}$.

*Proof.* From Proposition 2 and (17), it follows that any solution $(\mathbf{y}, \mathbf{z})$ satisfies

$$C_f^t \mathbf{y}_0 = \begin{pmatrix} y_{n,1} \\ \vdots \\ y_{n,r_2} \end{pmatrix} = C_f^{\mathrm{wt}(\mathbf{z})} \mathbf{y}_0,$$

which implies $\mathrm{ord}(f) = |t - \mathrm{wt}(\mathbf{z})|$. Since $f$ is primitive, we obtain

$$\mathrm{ord}(f) = (q^{r_1})^{r_2} - 1 \geq q^m - 1 > \max(t, n - t).$$

On the other hand, $0 \leq \mathrm{wt}(\mathbf{z}) \leq n$, hence $|t - \mathrm{wt}(\mathbf{z})| \leq \min(t, n - t)$. Therefore, the only way $\mathrm{ord}(f)$ can divide $|t - \mathrm{wt}(\mathbf{z})|$, is that $|t - \mathrm{wt}(\mathbf{z})| = 0$, i.e. $\mathrm{wt}(\mathbf{z}) = t$.

Substituting $\mathbf{z}$ in (15) uniquely determines all the values $y_{1,1}, \dots, y_{1,r_2}$ by linear equations of the form $y_{1,i} = c_i$. Moreover, substituting $y_{j-1,1}, \dots, y_{j-1,r_2}$ in (16) recursively determines all the values $y_{j,1}, \dots, y_{j,r_2}$ in a similar manner. Therefore, if $\bar{\mathbf{z}} = \tilde{\mathbf{z}}$ are the projections over the last $n$ coordinates of two solutions, then also $(\bar{\mathbf{y}}, \bar{\mathbf{z}}) = (\tilde{\mathbf{y}}, \tilde{\mathbf{z}})$, which concludes the proof. $\square$

**Field equations.** The field equations concern only the $X$ part of the variables.

– Field equations. The equations are obtained from the $n$ polynomials

$$\{x_j^q - x_j \mid j = 1, \dots, n\}. \qquad (18)$$

Indeed, $\mathbf{z}$ already lies over $\{0, 1\}^n$ because of the support constraint equations (and (18)), while (15) and (16) force $Y$ to lie over $\mathbb{F}_{q^{r_1}}$.

## 6.2 The Modelings

We are finally ready to describe the algebraic systems over $\mathbb{F}_{q^{r_1}}[X, Y, Z]$ for Problems 2 and 1 and prove their correctness.

**Modeling 3 (Modeling for the SDP over $\mathbb{F}_q$)** Given an instance $(\mathbf{H}, \mathbf{s}, t)$ of Problem 1 over $\mathbb{F}_q$, Modeling 3 is the union of the sets of polynomials (2), (11), (15), (16), (17) and (18).

**Modeling 4 (Modeling for the ESDP over $\mathbb{F}_q$)** Given an instance $(\mathbf{H}, \mathbf{s}, t)$ of Problem 2 over $\mathbb{F}_q$, Modeling 4 is the union of the sets of polynomials (2), (12), (15), (16), (17) and (18).

As already said, finite field equations cannot be efficiently taken into account when dealing with large fields. In the exact weight syndrome decoding modeling, the support constraint equations are high-degree as well, so the problem would persist. On the other hand, it becomes convenient to remove the field equations in the bounded syndrome decoding problem. This leads to a new quadratic modeling.
**Modeling 5 (Quadratic Modeling for the SDP over $F_q$)** *Given an instance $(\mathbf{H}, \mathbf{s}, t)$ of Problem 1 over $F_q$, Modeling 5 is the union of the sets of polynomials (2), (11), (15), (16), (17).*

In the next section we thoroughly investigate the effect of removing the field equations from Modeling 4. We find, that at least for the parameter choices interesting for cryptography, the solutions of our modeling without field equations still lie over $F_q$ with high probability.

Table 4 provides the number of variables and equations for the three modelings over $F_q$.

<table><caption>**Table 4.** Number of equations, number of variables and maximum degree of the algebraic modelings over $F_{q^{r_1}}$.</caption><thead><tr><th></th><th># Polynomials</th><th># Variables</th><th>Degree</th></tr></thead><tbody><tr><td>Modeling 3</td><td>4n - k + nr<sub>2</sub> + r<sub>2</sub></td><td>n(r<sub>2</sub> + 2)</td><td>q</td></tr><tr><td>Modeling 4</td><td>3n - k + nr<sub>2</sub> + r<sub>2</sub></td><td>n(r<sub>2</sub> + 2)</td><td>q</td></tr><tr><td>Modeling 5</td><td>3n - k + nr<sub>2</sub> + r<sub>2</sub></td><td>n(r<sub>2</sub> + 2)</td><td>2</td></tr></tbody></table>

*Remark 10.* Since $r_2$ can be chosen as at most $m = O(\log_q(n))$, both the number of polynomials and variables are quasi-linear in the code-length $n$ in all the three modelings, namely they are $O(\log_2(n))$. At the cost of defining the system over $F_{q^{r_1}} = F_{q^m}$, these quantities become linear in $n$, as the choice $r_2 = 1$ is possible.

The modelings above capture exactly the corresponding syndrome decoding problem variants.

**Theorem 3.** *Given an instance $(\mathbf{H}, \mathbf{s}, t)$,*

1. The vector $(\mathbf{x}, \mathbf{y}, \mathbf{z})$ is a solution of Modeling 3 if and only if $\mathbf{x}$ is a solution of Problem 1 and $\mathbf{x} \in F_q$;

2. The vector $(\mathbf{x}, \mathbf{y}, \mathbf{z})$ is a solution of Modeling 4 if and only if $\mathbf{x}$ is a solution of Problem 2 and $\mathbf{x} \in F_q$;

3. The vector $(\mathbf{x}, \mathbf{y}, \mathbf{z})$ is a solution of Modeling 5 if and only if $\mathbf{x}$ is a solution of Problem 1 and $\mathbf{x} \in \overline{F_q}$, where $\overline{F_q}$ denotes the algebraic closure of $F_q$.

*Proof.* Since the parity-check equations (2) belong to all three modelings, it remains to prove the conditions on the weight of $\mathbf{x}$ and to determine the base field over the vector can lie.

*Proof of 1.* Modeling 3 contains the field equations, therefore $\mathbf{x} \in \overline{F_q}^n$. It has already been proved that (11) implies $\mathrm{wt}(\mathbf{x}) \le \mathrm{wt}(\mathbf{z})$. By Corollary 2, (15), (16) and (17) imply that $\mathrm{wt}(\mathbf{z}) = t$, hence $\mathrm{wt}(\mathbf{x}) \le t$.

*Proof of 2.* Modeling 4 contains the field equations, therefore $\mathbf{x} \in \overline{F_q}^n$. It has already been proved that (12) implies $\mathrm{wt}(\mathbf{x}) = \mathrm{wt}(\mathbf{z})$. By Corollary 2, (15), (16) and (17) imply that $\mathrm{wt}(\mathbf{z}) = t$, hence $\mathrm{wt}(\mathbf{x}) = t$.
*Proof of 3.* The proof is analogous to the proof of 1., with the only exception that Modeling 5 does not contain the field equations. Hence, the solutions of the system are all the vectors defined over the algebraic closure $\overline{\mathbb{F}}_q$ that satisfy the parity-check equations and have weight at most $t$. $\square$

## 6.3 The Dimension of the Variety Associated with Modeling 5

Unlike the modelings that include the field equations, Modeling 5 is not a priori associated with a zero-dimensional ideal. This represents the main drawback of Modeling 5 compared to Modeling 3. The zero-dimensional property is desirable because it is necessary for defining the degree of regularity and for applying the FGLM algorithm to convert the degrevlex Gröbner basis into a lex basis. While it is possible to convert non-zero dimensional ideals using methods such as Gröbner walk or others, the process may not be as straightforward [1, 19].

In this subsection, we analyze the dimension of the variety associated with the ideal corresponding to Modeling 5. We will explore the conditions under which the variety is zero-dimensional, as well as the probability of this occurring. We begin with the following reduction.

**Proposition 3.** Let $\mathbf{x} \in \mathbb{F}_q^n$ be a vector which is a solution of Problem 1 for a given instance $(\mathbf{H}, \mathbf{s}, t)$. In other words, $\mathbf{x}$ satisfies $\mathbf{H}\mathbf{x}^\top = \mathbf{s}^\top$ and $\mathrm{wt}(\mathbf{x}) \le t$. Then, there exist finitely many $(\mathbf{y}, \mathbf{z})$ such that $(\mathbf{x}, \mathbf{y}, \mathbf{z})$ is a solution of Modeling 5.

*Proof.* Let us first consider a vector $\mathbf{x}$ satisfying the parity-check equations and such that $\mathrm{wt}(\mathbf{x}) = t$. Then, in Modeling 5, the $z_i$ must detect exactly the support of $\mathbf{x}$, and $\mathbf{x}$ uniquely determines a solution $(\mathbf{x}, \mathbf{y}, \mathbf{z})$ of the system. If instead $\mathrm{wt}(\mathbf{x}) = \bar{t} < t$, then there exist $t - \bar{t}$ indexes where the $Z$ variables can have value 1 while $\mathbf{x}_i = 0$. Thus, for any solution $\bar{\mathbf{x}} \in \mathbb{F}_q^n$ of the parity check matrix of weight $\bar{t}$, there exist

$$ \begin{pmatrix} n - \bar{t} \\ t - \bar{t} \end{pmatrix} $$

different solutions $(\bar{\mathbf{x}}, \mathbf{y}, \mathbf{z})$.

A special case is given by the codeword finding problem, i.e. where the syndrome $\mathbf{s}$ is the zero vector. Here the null vector is a solution of Problem 1 and leads to $\binom{n}{t}$ solutions, thus likely increasing a lot the solving degree and the cost of a Gröbner basis computation. We can get rid of all these solutions by fixing one variable $z_i = 1$, thus forcing any solution to have weight at least 1 and removing the null vector. If the target solution has weight $t$, then the guess has success with probability $t/n$. We will discuss this strategy in more detail at the end of this subsection. $\square$

Proposition 3 implies that each solution to the decoding problem (Problem 1) corresponds to a finite number of solutions for Modeling 5. This allows us to conduct an analysis that is independent of the specific modeling, as long as it accurately encodes the decoding problem in the sense of Theorem 3. Therefore,
we will focus on the Krull dimension of the solution set of Problem 1 and provide a probability estimate for this dimension being zero.

First, in the following remark we briefly collect the definition of Krull dimension and some important properties we will use in the sequel. Expanded details and proofs can be found e.g. in [21, §4, Chapter 9] or other standard references in commutative algebra and algebraic geometry.

**Remark 11 (Krull dimension).** Let $\mathbb{K}$ be an algebraically closed field (we will apply the following definitions and results to $\mathbb{K} = \overline{\mathbb{F}}_q$). An affine variety $V$ is the zero locus in $\mathbb{K}^m$ of a proper ideal $I$ of the polynomial ring $\mathbb{K}[x_1, \dots, x_m]$. We say that $V$ is irreducible if it is not possible to write $V = V_1 \cup V_2$ where $V_1, V_2 \subsetneq V$ are two proper subvarieties. Irreducibility of $V$ is equivalent to the corresponding ideal $I$ being prime. The Krull dimension or simply the dimension of a variety $V$ is defined as the maximal length $d$ of the chains $V_0 \subsetneq V_1 \subsetneq \dots \subsetneq V_d$, of distinct nonempty irreducible subvarieties of $V$. This is also equivalent to the supremum of the lengths of all chains of prime ideals containing the defining ideal $I$ of $V$. For example, the Krull dimension of an affine linear space $\mathcal{L}$ generated by $a$ linearly independent affine linear polynomials $L_1, \dots, L_a$ is precisely $m-a$, that is its dimension as an affine space. This can be seen by completing the polynomials to a maximal linearly independent system of $m$ equations (in $m$ variables) $L_1, \dots, L_a, L_{a+1}, \dots, L_m$ and then considering the following maximal chain of prime ideals

$$ \mathcal{L} = \langle L_1, \dots, L_a \rangle \subsetneq \langle L_1, \dots, L_a, L_{a+1} \rangle \subsetneq \dots \subsetneq \langle L_1, \dots, L_m \rangle. $$

Notice that each ideal in this chain is prime, being generated by linearly independent polynomials of degree 1. Finally, we mention that, thanks to the Noetherian property of the polynomial ring, a variety $V$ can be written uniquely as the union of irreducible varieties, which are called the irreducible components of $V$. Thus, the dimension of $V$ coincides with the largest of the dimensions of its irreducible components (see [21, §4, Chapter 9, Corollary 9]).

Let $S \subseteq [n]$. Given a matrix $\mathbf{H}$ with $n$ columns and a vector $\mathbf{x} \in \mathbb{F}_q^n$, we denote by $\mathbf{H}_S$ the submatrix of $\mathbf{H}$ of columns indexed by $S$ and by $\mathbf{x}_S \in \mathbb{F}_q^{|S|}$ the vector obtained by deleting the coordinates corresponding to $[n] \setminus S$ from $\mathbf{x} \in \mathbb{F}_q^n$. On the contrary, let $\mathbf{pad}_S(\mathbf{x}) \in \mathbb{F}_q^n$ be the vector obtained from $\mathbf{x} \in \mathbb{F}_q^{|S|}$ by padding with 0's the positions corresponding to $[n] \setminus S$.

**Proposition 4.** Let $\mathcal{C}$ be an $[n, k]$ code with parity-check matrix $\mathbf{H} \in \mathbb{F}_q^{(n-k) \times n}$. Then the set of solutions of Problem 1 with target weight $t$ and syndrome $\mathbf{s}$ for the code $\mathcal{C}$ is the finite union of irreducible components, namely

$$ \bigcup_{S \subseteq [n], |S|=t} \{\mathbf{pad}_S(\mathbf{x}) \in \mathbb{F}_q^n \mid \mathbf{H}_S \mathbf{x} = \mathbf{s}\}. $$

*Proof.* For any $S$ of cardinality $t$, $\mathrm{wt}(\mathbf{pad}_S(\mathbf{x})) = \mathrm{wt}(\mathbf{x}) \le t$ and $\mathbf{H} \cdot \mathbf{pad}_S(\mathbf{x}) = \mathbf{H}_S \mathbf{x} = \mathbf{s}$. Thus, the set of solutions of the decoding problem contains

$$ \bigcup_{S \subseteq [n], |S|=t} \{\mathbf{pad}_S(\mathbf{x}) \in \mathbb{F}_q^n \mid \mathbf{H}_S \mathbf{x} = \mathbf{s}\}. $$
On the other hand, for any solution $\mathbf{x} \in \mathbb{F}_q^n$ to the decoding problem, let $S$ be a set of cardinality $t$ containing the support of $\mathbf{x}$. Then, $\mathbf{x} \in \{\mathbf{pad}_S(\mathbf{x}) \in \mathbb{F}_q^n | \mathbf{H}_S\mathbf{x} = \mathbf{s}\}$. Finally, all the sets $\{\mathbf{pad}_S(\mathbf{x}) \in \mathbb{F}_q^n | \mathbf{H}_S\mathbf{x} = \mathbf{s}\}$ are irreducible being affine linear spaces. $\square$

The next proposition characterizes the dimension of the irreducible components of the set of solutions of the decoding problem and the finite field extension over which solutions are defined.

**Proposition 5.** The Krull dimension of the solution set of Problem 1 with target weight $t$ and syndrome $\mathbf{s}$ for the linear code with parity-check matrix $\mathbf{H}$ is

$$t - \min\{\mathrm{rk}(\mathbf{H}_S) \mid S \subseteq [n], |S| = t, \mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S)\}. \quad (19)$$

Moreover, if the dimension is 0, then all solutions lie over $\mathbb{F}_q$.

*Proof.* Let us fix the support $S$ of $t$ possible error positions. By Remark 11, the Krull dimension of the irreducible components coincides with their dimensions as affine linear spaces. The case study of the set of solutions of

$$\mathbf{H}_S\mathbf{x} = \mathbf{s},$$

seen as a variety, thus becomes the following:

- if $\mathrm{rk}((\mathbf{H}_S | \mathbf{s})) > \mathrm{rk}(\mathbf{H}_S) \Rightarrow$ the variety is empty;

- if $\mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S) \Rightarrow$ the variety has dimension $t - \mathrm{rk}(\mathbf{H}_S)$. In particular, if the variety has dimension 0, i.e. $\mathrm{rk}(\mathbf{H}_S) = t$, then it has a unique element, which belongs to $\mathbb{F}_q$.

By Remark 11, the dimension of the solutions set is obtained as the maximum dimension over all the irreducible components corresponding to some $S$ for which $\mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S)$:

$$\max\{t - \mathrm{rk}(\mathbf{H}_S) \mid S \subseteq [n], |S| = t, \mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S)\} \\ = t - \min\{\mathrm{rk}(\mathbf{H}_S) \mid S \subseteq [n], |S| = t, \mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S)\}.$$

Let us now consider the case of a zero-dimensional variety. Then for any choice of $S$, there is at most a solution and it must belong to $\mathbb{F}_q^n$. Hence, all solutions belong to $\mathbb{F}_q^n$. $\square$

**Corollary 3.** The dimension of the variety associated with Modeling 5 is

$$t - \min\{\mathrm{rk}(\mathbf{H}_S) \mid S \subseteq [n], |S| = t, \mathrm{rk}((\mathbf{H}_S | \mathbf{s})) = \mathrm{rk}(\mathbf{H}_S)\}. \quad (20)$$

*Proof.* It readily follows from Propositions 11 and 5 and the fact that each solution of Problem 1 corresponds to a finite number of solutions of Modeling 5, thus it does not increase the dimension of the variety. $\square$
For relevant and not too-small parameters, we usually have $t \ll n-k$. Assuming the weight distribution of a linear code follows closely the Bernoulli one, we can estimate the probability that the ideal is zero-dimensional, and thus, by exploiting the proof of Proposition 5, that all the solutions $\mathbf{x}$ lie over $\mathbb{F}_q$.

**Proposition 6.** Let $\mathcal{C}$ be an $\mathbb{F}_q$-linear code and let $W_i(\mathcal{C})$ the number of code-words of weight exactly $i$ in $\mathcal{C}$. Then the probability that Modeling 5 provides a variety of strictly positive dimension when $t < n-k$ is upper bounded by

$$ \sum_{i=1}^{t} W_i(\mathcal{C}) \left( \frac{1}{q^{n-k-i+1}} + \binom{n-i}{t-i} \left( \frac{1}{q^{n-k-t+1}} - \frac{1}{q^{n-k-i+1}} \right) \right) $$

for a randomly sampled syndrome. For the codeword finding problem, the same probability is upper bounded by

$$ \sum_{i=1}^{t} W_i(\mathcal{C}) \binom{n-i}{t-i}. $$

*Proof.* It follows from Corollary 3 that the variety has positive dimension if and only if there exists a set $S \subseteq [n]$, $|S| = t$, such that $\mathbf{H}_S$ is not full-rank and the syndrome $\mathbf{s}$ belongs to the column space of $\mathbf{H}_S$.

The parity-check matrix $\mathbf{H}$ has $i$ linearly dependent columns indexed by the set $S$ if and only if the corresponding code $\mathcal{C}$ has a codeword of weight $\le i$ with support contained in $S$. Hence any codeword of positive weight $i \le t$ with support $S'$ identifies a set of $\binom{n-i}{t-i}$ supersets $S \supseteq S'$. On the other hand, each set $S$ of $t$ dependent columns is associated with at least one codeword of weight $\le t$, hence iterating over such codewords is enough to guarantee an upper bound.

Let $W_i(\mathcal{C})$ be the number of codewords in $\mathcal{C}$ of weight exactly $i$. By splitting the event $\{\mathbf{s} \in \text{ColSpace}(\mathbf{H}_S)\}$ into the union of the two disjoint events $\{\mathbf{s} \in \text{ColSpace}(\mathbf{H}_{\text{supp}(\mathbf{c})})\}$ and $\{\mathbf{s} \in \text{ColSpace}(\mathbf{H}_S) \setminus \text{ColSpace}(\mathbf{H}_{\text{supp}(\mathbf{c})})\}$ and using that $\text{rk}(\mathbf{H}_{\text{supp}(\mathbf{c})}) \le i-1$ and $\text{rk}(\mathbf{H}_S) \le \text{rk}(\mathbf{H}_{\text{supp}(\mathbf{c})}) + (t-i)$, we thus obtain an upper bound on the sought probability:
$$
\begin{align*}
& \mathbb{P} \left( \bigcup_{\substack{S \subseteq [n] \\ |S| = t \wedge \mathrm{rk}(\mathbf{H}_S) < t}} \{\mathbf{s} \in \mathrm{ColSpace}(\mathbf{H}_S)\} \right) \\
& \le \sum_{\substack{S \subseteq [n] \\ |S| = t \wedge \mathrm{rk}(\mathbf{H}_S) < t}} \mathbb{P}(\{\mathbf{s} \in \mathrm{ColSpace}(\mathbf{H}_S)\}) \\
& \le \sum_{\substack{\mathbf{c} \in \mathcal{C} \\ \mathrm{wt}(\mathbf{c}) \le t}} \left( \mathbb{P}(\{\mathbf{s} \in \mathrm{ColSpace}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})\}) + \sum_{\substack{\mathrm{supp}(\mathbf{c}) \subseteq S \subseteq [n] \\ |S| = t}} \mathbb{P}(\{\mathbf{s} \in \mathrm{ColSpace}(\mathbf{H}_S) \setminus \mathrm{ColSpace}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})\}) \right) \\
& = \sum_{i=1}^t W_i(\mathcal{C}) \left( \frac{q^{\dim_{\mathbb{F}_q} \mathrm{ColSpace}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} + \binom{n-i}{t-i} \frac{q^{\dim_{\mathbb{F}_q} \mathrm{ColSpace}(\mathbf{H}_S)} - q^{\dim_{\mathbb{F}_q} \mathrm{ColSpace}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} \right) \\
& = \sum_{i=1}^t W_i(\mathcal{C}) \left( \frac{q^{\mathrm{rk}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} + \binom{n-i}{t-i} \frac{q^{\mathrm{rk}(\mathbf{H}_S)} - q^{\mathrm{rk}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} \right) \\
& \le \sum_{i=1}^t W_i(\mathcal{C}) \left( \frac{q^{\mathrm{rk}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} + \binom{n-i}{t-i} \frac{q^{\mathrm{rk}(\mathbf{H}_{\mathrm{supp}(\mathbf{c})})}}{q^{n-k}} (q^{t-i} - 1) \right) \\
& \le \sum_{i=1}^t W_i(\mathcal{C}) \left( \frac{1}{q^{n-k-i+1}} + \binom{n-i}{t-i} \left( \frac{1}{q^{n-k-t+1}} - \frac{1}{q^{n-k-i+1}} \right) \right).
\end{align*}
$$

Finally, in the case of the codeword finding problem, i.e. if the syndrome is the
zero vector, the condition on the positive dimension of the variety boils down to
the existence of the set $S$, $|S| = t$, such that the rank $\mathbf{H}_S$ is defective, as the zero
vector belongs to any linear subspace. Therefore, in this case, the calculations
are simplified into:

$$
\mathbb{P} \left( \bigcup_{\substack{S \subseteq [n] \\ |S| = t \wedge \mathrm{rk}(\mathbf{H}_S) < t}} \{0 \in \mathrm{ColSpace}(\mathbf{H}_S)\} \right) \le \sum_{\substack{S \subseteq [n] \\ |S| = t \wedge \mathrm{rk}(\mathbf{H}_S) < t}} 1 \le \sum_{i=1}^{t} W_i(C) \binom{n-i}{t-i}.
$$

□

Remark 12. For random codes, the weight distribution follows closely the Bernoulli one, i.e. $W_i(C) \approx \frac{\binom{n}{i} (q-1)^i}{q^{n-k}}$. Under this assumption, the probability of having a zero-dimensional ideal for the decoding modeling with a random syndrome can be estimated as

$$
\frac{1}{q^{n-k}} \sum_{i=1}^{t} \binom{n}{i} (q-1)^i \left( \frac{1}{q^{n-k-i+1}} + \binom{n-i}{t-i} \left( \frac{1}{q^{n-k-t+1}} - \frac{1}{q^{n-k-i+1}} \right) \right),
$$
while for the codeword finding problem as

$$ \frac{1}{q^{n-k}} \sum_{i=1}^{t} \binom{n}{i} \binom{n-i}{t-i} (q-1)^i. $$

We remark in particular that the bound is independent from the choice of $(r_1, r_2)$. Different admissible pairs provide of course different solutions, but the projections of the varieties with respect to the $x_i$'s variables are the same over the field closure, which is what determines the dimension of the associated ideals.

In Appendix A, Tables 6 and 7, we provide examples of such bounds for concrete parameters. In the case of syndrome decoding, these probabilities are very small even at Gilbert-Varshamov distance and the issue of having ideals of positive dimension is thus absolutely negligible for the purpose of cryptanalysis. On the opposite, the bound on the probability of the same event for the codeword finding problem becomes completely useless when approaching the Gilbert-Varshamov distance. Indeed, the trivial upper bound “$\mathbb{P} \le 1$” entries from the two tables mean that the bound given by Proposition 6 gives a number larger than 1. A possible workaround for the described issue with the codeword finding version is to make use of hybrid methods. Indeed, it is enough to guess a number of nonzero positions equal or greater than the ideal dimension to decrease the latter to 0 with high probability. Recalling that the solution space is projective and one the value of one nonzero entry can be chosen arbitrarily, specializing $l$ coordinates has a success probability of $\frac{\binom{n-l}{l}}{\binom{n}{l}(q-1)^{l-1}}$. In cryptanalysis, however, it is usually assumed to know the minimal weight of a (nonzero) solution. This is because, if there exists a solution of weight smaller than the target, then the challenge is actually easier.

A simple strategy to obtain a zero-dimensional ideal in this setting is thus the following. If we suppose to know a lower bound $d'$ the minimum distance $d(C)$ of the code, then it means that any $d' - 1$ columns of the parity-check matrix $H$ are linearly independent. Therefore, Equation (19) implies that the dimension of the ideal for the bounded weight modeling with target weight $d'$ is exactly 1 and thus it is enough to specialize one variable $x_i$ to any element in $\mathbb{F}_q$ to obtain a zero-dimensional ideal.

## 6.4 Experimental results.

We solved the quadratic system associated with Modeling 5 for several random codes. We show in Table 5 that, similarly to the case over $\mathbb{F}_2$, the solving degree is surprisingly small. MAGMA code used for our experiments with Modeling 5 can be found at this link.

# 7 Conclusion and Future Directions

We have presented a new algebraic cryptanalysis for both the bounded and the exact versions of the Syndrome Decoding problem.
<table><caption>**Table 5.** This table gives information from experiments using random $F_q$-linear codes using Modeling 5. The values in the $d_M$ column represent the highest step degree achieved when directly computing the Gröbner basis of the system in MAGMA. The column “#lin” denotes the number of linear equations, i.e. of parity-check equations, which is independent from the field size. The columns “#quad” and “#vars” stand for the number of quadratic equations and the number of variables, which depend on the value $r_2$ instead. The integer $r_1$ is the extension field degree over which the equations are defined. We recall that the value $m$ leads to different possible choices of $(r_1, r_2)$ and we give all minima with respect to the standard partial order on pairs.</caption><thead><tr><th rowspan="2">n</th><th rowspan="2">k</th><th rowspan="2">t</th><th rowspan="2">#lin</th><th colspan="4">q = 7</th><th colspan="4">q = 16, 17</th><th colspan="4">q = 127</th></tr><tr><th>r<sub>1</sub></th><th>r<sub>2</sub></th><th>#quad</th><th>#vars</th><th>d<sub>M</sub></th><th>r<sub>1</sub></th><th>r<sub>2</sub></th><th>#quad</th><th>#vars</th><th>d<sub>M</sub></th><th>r<sub>1</sub></th><th>r<sub>2</sub></th><th>#quad</th><th>#vars</th><th>d<sub>M</sub></th></tr></thead><tbody><tr><td rowspan="2">10</td><td rowspan="2">5</td><td rowspan="2">2</td><td rowspan="2">5</td><td colspan="4">m = 2</td><td colspan="4">m = 1</td><td colspan="4">m = 1</td></tr><tr><td>2 1</td><td>30</td><td>30</td><td>4</td><td>1 1</td><td>30</td><td>30</td><td>4</td><td>1 1</td><td>30</td><td>30</td><td>4</td></tr><tr><td></td><td></td><td></td><td></td><td>1 2</td><td>40</td><td>40</td><td>3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">15</td><td rowspan="2">9</td><td rowspan="2">3</td><td rowspan="2">6</td><td colspan="4">m = 2</td><td colspan="4">m = 1</td><td colspan="4">m = 1</td></tr><tr><td>2 1</td><td>45</td><td>45</td><td>4</td><td>1 1</td><td>45</td><td>45</td><td>4</td><td>1 1</td><td>45</td><td>45</td><td>4</td></tr><tr><td></td><td></td><td></td><td></td><td>1 2</td><td>60</td><td>60</td><td>4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">19</td><td rowspan="2">10</td><td rowspan="2">5</td><td rowspan="2">9</td><td colspan="4">m = 2</td><td colspan="4">m = 1</td><td colspan="4">m = 1</td></tr><tr><td>2 1</td><td>57</td><td>57</td><td>5</td><td>1 1</td><td>57</td><td>57</td><td>5</td><td>1 1</td><td>57</td><td>57</td><td>5</td></tr><tr><td></td><td></td><td></td><td></td><td>1 2</td><td>76</td><td>76</td><td>4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">22</td><td rowspan="2">14</td><td rowspan="2">4</td><td rowspan="2">8</td><td colspan="4">m = 2</td><td colspan="4">m = 2</td><td colspan="4">m = 1</td></tr><tr><td>2 1</td><td>66</td><td>66</td><td>5</td><td>2 1</td><td>66</td><td>66</td><td>5</td><td>1 1</td><td>66</td><td>66</td><td>4</td></tr><tr><td></td><td></td><td></td><td></td><td>1 2</td><td>88</td><td>88</td><td>4</td><td>1 2</td><td>88</td><td>88</td><td>4</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">30</td><td rowspan="2">20</td><td rowspan="2">4</td><td rowspan="2">10</td><td colspan="4">m = 3</td><td colspan="4">m = 2</td><td colspan="4">m = 1</td></tr><tr><td>3 1</td><td>90</td><td>90</td><td>≥ 6</td><td>2 1</td><td>90</td><td>90</td><td>≥ 6</td><td>1 1</td><td>90</td><td>90</td><td>≥ 6</td></tr><tr><td></td><td></td><td></td><td></td><td>2 2</td><td>120</td><td>120</td><td>4</td><td>1 2</td><td>120</td><td>120</td><td>≥ 5</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>1 3</td><td>150</td><td>150</td><td>4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody></table>

In the binary case, our modelings significantly improved the previous attempt of [34], by capturing the weight condition on the solution vector with quadratic polynomials. We have also experimentally shown that the behavior of the associated Gröbner basis is very different from that of a random system with the same number of variables and equations, *leading to a much better complexity*. We have thus taken an important step towards making algebraic algorithms potentially competitive for the decoding problem.

We introduced algebraic modelings for the first time in the case of the general syndrome decoding problem over larger finite fields. Notably, one of them is quadratic with a number of variables and equations that is linear or quasi-linear in the code length, *independently from the field size*. We have analyzed that, despite the constant degree of the equations involved, the system correctly solves the decoding problem and with high probability does not have spurious solutions for all parameters that are relevant to the problem.

An open question to this work is to understand more clearly the behavior of the Gröbner basis computation both in the binary and in the general finite field
cases and to get a theoretical estimate of the complexity that better matches
with the one obtained from the experiments. This is a difficult task, as it is often
the case for very structured algebraic systems, and probably requires to develop
dedicated tools to analyze such behavior.

Another interesting and natural follow-up to this work can be to analyze the
impact of hybrid strategies on solving the proposed systems. Since the weight
of the solution sought is relatively low, a convenient choice is to set most of the
variables of X to 0. It is not difficult to see that this approach is reminiscent of
the guess part in Prange or later ISD algorithms.

In the case of binary systems, we have verified experimentally that the best
hybrid trade-off actually boils down to the Prange algorithm, the best complexity
being indeed obtained when enough zeros to linearize the system are guessed.

However, the system hides a lot of structure and offers many different ways
to specialize variables. For example, the auxiliary variables from the vector y can
also be fixed and they too have different probabilities of taking a value equal to
0 or 1. It is therefore not at all unrealistic to speculate that an ad-hoc and smart
hybridization technique may lead to a better trade-off than a fully combinatorial
approach.

## Acknowledgments.

We would like to thank the reviewers for their detailed and valuable feedback.
Additionally, special thanks to Magali Bardet, Tanja Lange and Alberto Rav-
agnani for the fruitful discussions and insights.

This publication was created with the co-financing of the European Union
FSE-REACT-EU, PON Research and Innovation 2014-2020 DM1062/2021. A.
Caminata is supported by the PRIN 2020 grant 2020355B8Y "Squarefree Gröbner
degenerations, special varieties and related topics", by the PRIN PNRR 2022
grant P2022J4HRR "Mathematical Primitives for Post Quantum Digital Signa-
tures", by the MUR Excellence Department Project awarded to Dipartimento
di Matematica, Università di Genova, CUP D33C23001110001, and by the Eu-
ropean Union within the program NextGenerationEU. A. Meneghetti acknowl-
edges support from Ripple's University Blockchain Research Initiative. A. Cami-
nata and A. Meneghetti are members of the INdAM Research Group GNSAGA.

## References

1. Amrhein, B., Gloor, O., Küchlin, W.: On the walk. Theoretical Computer Science 187(1), 179–202 (1997)

2. Aragon, N., Barreto, P., Bettaieb, S., Bidoux, L., Blazy, O., Deneuville, J.C., Gaborit, P., Ghosh, S., Gueron, S., Güneysu, T., et al.: BIKE: bit flipping key encapsulation (2022)

3. Bardet, M.: Étude des systèmes algébriques surdéterminés. Applications aux codes correcteurs et à la cryptographie. Ph.D. thesis, Université Pierre et Marie Curie-Paris VI (2004)
4. Bardet, M., Briaud, P., Bros, M., Gaborit, P., Neiger, V., Ruatta, O., Tillich, J.P.: An algebraic attack on rank metric code-based cryptosystems. In: Annual International Conference on the Theory and Applications of Cryptographic Techniques. pp. 64–93. Springer (2020)

5. Bardet, M., Bros, M., Cabarcas, D., Gaborit, P., Perlner, R.A., Smith-Tone, D., Tillich, J., Verbel, J.A.: Improvements of algebraic attacks for solving the rank decoding and minrank problems. In: Moriai, S., Wang, H. (eds.) Advances in Cryptology - ASIACRYPT 2020 - 26th International Conference on the Theory and Application of Cryptology and Information Security, Daejeon, South Korea, December 7-11, 2020, Proceedings, Part I. Lecture Notes in Computer Science, vol. 12491, pp. 507–536. Springer (2020)

6. Bardet, M., Faugere, J.C., Salvy, B.: On the complexity of Gröbner basis computation of semi-regular overdetermined algebraic equations. In: Proceedings of the International Conference on Polynomial System Solving. pp. 71–74 (2004)

7. Becker, A., Joux, A., May, A., Meurer, A.: Decoding random binary linear codes in $2^{n/20}$: How $1+1=0$ improves information set decoding. In: Advances in Cryptology-EUROCRYPT 2012: 31st Annual International Conference on the Theory and Applications of Cryptographic Techniques, Cambridge, UK, April 15-19, 2012. Proceedings 31. pp. 520–536. Springer (2012)

8. Berlekamp, E., McEliece, R., Van Tilborg, H.: On the inherent intractability of certain coding problems (corresp.). IEEE Transactions on Information theory 24(3), 384–386 (1978)

9. Bernstein, D.J., Chou, T., Lange, T., von Maurich, I., Misoczki, R., Niederhagen, R., Persichetti, E., Peters, C., Schwabe, P., Sendrier, N., et al.: Classic McEliece: conservative code-based cryptography. ffhal-04288769 (2017)

10. Bernstein, D.J., Lange, T., Peters, C.: Smaller decoding exponents: ball-collision decoding. In: Advances in Cryptology-CRYPTO 2011: 31st Annual Cryptology Conference, Santa Barbara, CA, USA, August 14-18, 2011. Proceedings 31. pp. 743–760. Springer (2011)

11. Bigdeli, M., De Negri, E., Dizdarevic, M.M., Gorla, E., Minko, R., Tsakou, S.: Semi-regular sequences and other random systems of equations. Association for Women in Mathematics Series 24, 75 – 114 (2021)

12. Both, L., May, A.: Decoding linear codes with high error rate and its impact for LPN security. In: International Conference on Post-Quantum Cryptography. pp. 25–46. Springer (2018)

13. Briaud, P., Øygarden, M.: A new algebraic approach to the regular syndrome decoding problem and implications for PCG constructions. In: EUROCRYPT (5). Lecture Notes in Computer Science, vol. 14008, pp. 391–422. Springer (2023)

14. Buchberger, B.: Bruno Buchberger's PhD thesis 1965: An algorithm for finding the basis elements of the residue class ring of a zero dimensional polynomial ideal. J. Symb. Comput. 41(3-4), 475–511 (2006)

15. Caminata, A., Gorla, E.: Solving multivariate polynomial systems and an invariant from commutative algebra. In: Arithmetic of finite fields, Lecture Notes in Comput. Sci., vol. 12542, pp. 3–36. Springer, Cham (2021)

16. Caminata, A., Gorla, E.: Solving degree, last fall degree, and related invariants. J. Symb. Comput. 114, 322–335 (2023)

17. Carrier, K., Debris-Alazard, T., Meyer-Hilfiger, C., Tillich, J.P.: Statistical decoding 2.0: reducing decoding to LPN. In: International Conference on the Theory and Application of Cryptology and Information Security. pp. 477–507. Springer (2022)
18. Carrier, K., Debris-Alazard, T., Meyer-Hilfiger, C., Tillich, J.P.: Reduction from sparse LPN to LPN, dual attack 3.0. In: Annual International Conference on the Theory and Applications of Cryptographic Techniques. pp. 286–315. Springer (2024)

19. Collart, S., Kalkbrener, M., Mall, D.: Converting bases with the Gröbner walk. Journal of Symbolic Computation 24(3), 465–469 (1997)

20. Courtois, N., Klimov, A., Patarin, J., Shamir, A.: Efficient algorithms for solving overdefined systems of multivariate polynomial equations. In: Advances in cryptology—EUROCRYPT 2000 (Bruges), Lecture Notes in Comput. Sci., vol. 1807, pp. 392–407. Springer, Berlin (2000)

21. Cox, D., Little, J., O'shea, D., Sweedler, M.: Ideals, Varieties, and Algorithms, vol. 3. Springer (1997)

22. Ding, J., Schmidt, D.: Solving degree and degree of regularity for polynomial systems over a finite fields. Lecture Notes in Computer Science 8260, 34 – 49 (2013)

23. Dumer, I.: Two decoding algorithms for linear codes 25(1), 17–23 (1989)

24. Esser, A., Bellini, E.: Syndrome decoding estimator. pp. 112–141 (2022). https://doi.org/10.1007/978-3-030-97121-2_5

25. Faugère, J.C., Gianni, P., Lazard, D., Mora, T.: Efficient computation of zero-dimensional Gröbner bases by change of ordering. J. Symbolic Comput. 16(4), 329–344 (1993)

26. Faugère, J.C.: A new efficient algorithm for computing Gröbner bases ($F_4$). vol. 139, pp. 61–88 (1999), effective methods in algebraic geometry (Saint-Malo, 1998)

27. Faugère, J.C.: A new efficient algorithm for computing Gröbner bases without reduction to zero (F5). p. 75 – 83 (2002)

28. Finiasz, M., Sendrier, N.: Security bounds for the design of code-based cryptosystems. In: 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 15. pp. 88–105. Springer (2009)

29. Lidl, R., Niederreiter, H.: Introduction to Finite Fields and their Applications. Cambridge University Press, 2 edn. (1994)

30. May, A., Meurer, A., Thomae, E.: Decoding random linear codes in $O(2^{0.054n})$. In: Lee, D.H., Wang, X. (eds.) 2011. vol. 7073, pp. 107–124. Springer (2011)

31. May, A., Ozerov, I.: On computing nearest neighbors with applications to decoding of binary linear codes. In: Annual International Conference on the Theory and Applications of Cryptographic Techniques. pp. 203–228. Springer (2015)

32. McEliece, R.J.: A public-key cryptosystem based on algebraic coding theory. Coding Thv 4244, 114–116 (1978)

33. Melchor, C.A., Aragon, N., Bettaieb, S., Bidoux, L., Blazy, O., Deneuville, J.C., Gaborit, P., Persichetti, E., Zémor, G., Bourges, I.: Hamming quasi-cyclic (HQC). NIST PQC Round 2(4), 13 (2018)

34. Meneghetti, A., Pellegrini, A., Sala, M.: On the equivalence of two post-quantum cryptographic families. Annali di Matematica Pura ed Applicata (1923 -) 202, 967–991 (2023)

35. Prange, E.: The use of information sets in decoding cyclic codes. IRE Trans. Inf. Theory 8(5), 5–9 (1962)

36. Salizzoni, F.: An upper bound for the solving degree in terms of the degree of regularity. arXiv:2304.13485 (2023)

37. Semaev, I., Tenti, A.: Probabilistic analysis on Macaulay matrices over finite fields and complexity of constructing Gröbner bases. Journal of Algebra 565, 651 – 674 (2021)
38. Stern, J.: A method for finding codewords of small weight. In: Coding Theory and Applications: 3rd International Colloquium Toulon, France, November 2–4, 1988 Proceedings 3. pp. 106–113. Springer (1989)

A Section 6.3 Bounds on the zero-dimensionality

<table><caption>**Table 6.** Bound on the probability $\mathbb{P}$ that the ideal associated with the system has a strictly positive dimension for the decoding problem with a randomly sampled syndrome.</caption><thead><tr><th>[n, k]<sub>q</sub></th><th>t = ⌊(d<sub>GV</sub> - 1)/2⌋</th><th>t = ⌊(n - k)/2⌋</th><th>t = d<sub>GV</sub></th><th>t = d<sub>GV</sub> + 1</th></tr></thead><tbody><tr><td>[100, 50]<sub>2</sub></td><td>t = 5,<br>P ≤ 2.32 · 10<sup>-20</sup></td><td>t = 25,<br>P ≤ 1</td><td>t = 12,<br>P ≤ 6.73 · 10<sup>-9</sup></td><td>t = 13,<br>P ≤ 1.84 · 10<sup>-7</sup></td></tr><tr><td>[100, 50]<sub>7</sub></td><td>t = 12,<br>P ≤ 8.44 · 10<sup>-51</sup></td><td>t = 25,<br>P ≤ 1.89 · 10<sup>-20</sup></td><td>t = 25,<br>P ≤ 1.89 · 10<sup>-20</sup></td><td>t = 26,<br>P ≤ 2.68 · 10<sup>-18</sup></td></tr><tr><td>[100, 50]<sub>127</sub></td><td>t = 18,<br>P ≤ 5.48 · 10<sup>-118</sup></td><td>t = 25,<br>P ≤ 1.23 · 10<sup>-84</sup></td><td>t = 37,<br>P ≤ 5.38 · 10<sup>-30</sup></td><td>t = 38,<br>P ≤ 1.44 · 10<sup>-25</sup></td></tr><tr><td>[100, 80]<sub>2</sub></td><td>t = 1,<br>P ≤ 9.09 · 10<sup>-11</sup></td><td>t = 10,<br>P ≤ 1</td><td>t = 4,<br>P ≤ 3.14 · 10<sup>-4</sup></td><td>t = 5,<br>P ≤ 0.0268</td></tr><tr><td>[100, 80]<sub>7</sub></td><td>t = 3,<br>P ≤ 4.06 · 10<sup>-25</sup></td><td>t = 10,<br>P ≤ 2.92 · 10<sup>-5</sup></td><td>t = 8,<br>P ≤ 1.30 · 10<sup>-10</sup></td><td>t = 9,<br>P ≤ 6.55 · 10<sup>-8</sup></td></tr><tr><td>[100, 80]<sub>127</sub></td><td>t = 6,<br>P ≤ 1.16 · 10<sup>-52</sup></td><td>t = 10,<br>P ≤ 1.14 · 10<sup>-31</sup></td><td>t = 13,<br>P ≤ 1.97 · 10<sup>-16</sup></td><td>t = 14,<br>P ≤ 1.97 · 10<sup>-11</sup></td></tr></tbody></table>

<table><caption>**Table 7.** Bound on the probability $\mathbb{P}$ that the ideal associated with the system has strictly positive dimension for the codeword finding problem (i.e. with null syndrome).</caption><thead><tr><th>[n, k]<sub>q</sub></th><th>t = ⌊(d<sub>GV</sub> - 1)/2⌋</th><th>t = ⌊(n - k)/2⌋</th><th>t = d<sub>GV</sub> - 2</th><th>t = d<sub>GV</sub> - 1</th><th>t = d<sub>GV</sub></th></tr></thead><tbody><tr><td>[100, 50]<sub>2</sub></td><td>t = 5,<br>P ≤ 2.07 · 10<sup>-6</sup></td><td>t = 25,<br>P ≤ 1</td><td>t = 10,<br>P ≤ 1</td><td>t = 11,<br>P ≤ 1</td><td>t = 12,<br>P ≤ 1</td></tr><tr><td>[100, 50]<sub>7</sub></td><td>t = 12,<br>P ≤ 8.08 · 10<sup>-18</sup></td><td>t = 25,<br>P ≤ 1</td><td>t = 23,<br>P ≤ 0.378</td><td>t = 24,<br>P ≤ 1</td><td>t = 25,<br>P ≤ 1</td></tr><tr><td>[100, 50]<sub>127</sub></td><td>t = 18,<br>P ≤ 1.46 · 10<sup>-48</sup></td><td>t = 25,<br>P ≤ 6.16 · 10<sup>-30</sup></td><td>t = 35,<br>P ≤ 3.04 · 10<sup>-5</sup></td><td>t = 36,<br>P ≤ 0.00696</td><td>t = 37,<br>P ≤ 1</td></tr><tr><td>[100, 80]<sub>2</sub></td><td>t = 1,<br>P ≤ 9.54 · 10<sup>-5</sup></td><td>t = 10,<br>P ≤ 1</td><td>t = 2,<br>P ≤ 0.0142</td><td>t = 3,<br>P ≤ 1</td><td>t = 4,<br>P ≤ 1</td></tr><tr><td>[100, 80]<sub>7</sub></td><td>t = 3,<br>P ≤ 6.93 · 10<sup>-10</sup></td><td>t = 10,<br>P ≤ 1</td><td>t = 6,<br>P ≤ 0.00176</td><td>t = 7,<br>P ≤ 0.165</td><td>t = 8,<br>P ≤ 1</td></tr><tr><td>[100, 80]<sub>127</sub></td><td>t = 6,<br>P ≤ 4.20 · 10<sup>-21</sup></td><td>t = 10,<br>P ≤ 1.59 · 10<sup>-8</sup></td><td>t = 11,<br>P ≤ 1.65 · 10<sup>-5</sup></td><td>t = 12,<br>P ≤ 0.0155</td><td>t = 13,<br>P ≤ 1</td></tr></tbody></table>